:root {
  --bg: #0f1115;
  --panel: #171a21;
  --panel-hover: #1f232c;
  --text: #eef0f4;
  --muted: #8a8f9c;
  --accent: #5b8cff;
  --accent-2: #ff7a5b;
  --border: #262b35;
  --radius: 14px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at top, #1a1e27, var(--bg) 60%);
  color: var(--text);
  font-family: "Segoe UI", "Hiragino Sans", "Noto Sans JP", sans-serif;
}

#app {
  max-width: 860px;
  margin: 0 auto;
  padding: 24px 20px 64px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 32px;
}

.brand {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.private-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 14px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.85rem;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.private-toggle .dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--muted);
}

.private-toggle[aria-pressed="true"] {
  border-color: var(--accent-2);
  background: rgba(255, 122, 91, 0.12);
}

.private-toggle[aria-pressed="true"] .dot {
  background: var(--accent-2);
  box-shadow: 0 0 8px var(--accent-2);
}

.search-section { margin-bottom: 40px; }

.search-form {
  display: flex;
  gap: 8px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px;
}

.engine-select {
  background: transparent;
  color: var(--text);
  border: none;
  border-right: 1px solid var(--border);
  padding: 0 10px;
  font-size: 0.9rem;
  outline: none;
}

.search-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 1rem;
  padding: 10px 4px;
}

.search-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 0 20px;
  font-size: 0.9rem;
  cursor: pointer;
}

.search-btn:hover { filter: brightness(1.08); }

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.section-head h2 {
  font-size: 1rem;
  color: var(--muted);
  font-weight: 600;
  margin: 0;
}

.ghost-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 0.8rem;
  cursor: pointer;
}

.ghost-btn:hover { background: var(--panel-hover); }

.primary-btn {
  background: var(--accent);
  border: none;
  color: #fff;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 0.85rem;
  cursor: pointer;
}

.links-section { margin-bottom: 40px; }

.links-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 12px;
}

.link-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 8px 10px;
  text-decoration: none;
  color: var(--text);
  cursor: pointer;
}

.link-tile:hover { background: var(--panel-hover); }

.link-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.95rem;
}

.link-name {
  font-size: 0.72rem;
  text-align: center;
  color: var(--muted);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.link-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: none;
  background: rgba(0,0,0,0.4);
  color: #fff;
  font-size: 11px;
  line-height: 18px;
  text-align: center;
  cursor: pointer;
  display: none;
}

.link-tile:hover .link-remove { display: block; }

.recent-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.recent-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  text-decoration: none;
  color: var(--text);
  font-size: 0.85rem;
}

.recent-item:hover { background: var(--panel-hover); }

.recent-item .time {
  color: var(--muted);
  font-size: 0.75rem;
}

.empty-hint {
  color: var(--muted);
  font-size: 0.82rem;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal.hidden { display: none; }

.modal-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  width: 100%;
  max-width: 360px;
}

.modal-card h3 { margin-top: 0; }

.modal-card label {
  display: block;
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 12px;
}

.modal-card input {
  display: block;
  width: 100%;
  margin-top: 6px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 10px;
  color: var(--text);
  font-size: 0.9rem;
  outline: none;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 8px;
}

.privacy-note {
  margin-top: 48px;
  font-size: 0.72rem;
  line-height: 1.6;
  color: var(--muted);
  border-top: 1px solid var(--border);
  padding-top: 16px;
}

@media (max-width: 480px) {
  .search-form { flex-wrap: wrap; }
  .engine-select { border-right: none; }
}
