:root {
  --bg: #ffffff;
  --fg: #141414;
  --muted: #6b6b6b;
  --faint: #9a9a9a;
  --line: #e6e6e6;
  --soft: #f5f5f5;
  --accent: #0b57d0;
  --accent-fg: #ffffff;
  --danger: #b3261e;
  --radius: 10px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111111; --fg: #ececec; --muted: #a0a0a0; --faint: #707070; --line: #2a2a2a; --soft: #1b1b1b;
    --accent: #7eb0ff; --accent-fg: #0b1a33; --danger: #ff8a80;
  }
}
:root[data-theme="dark"] {
  --bg: #111111; --fg: #ececec; --muted: #a0a0a0; --faint: #707070; --line: #2a2a2a; --soft: #1b1b1b;
  --accent: #7eb0ff; --accent-fg: #0b1a33; --danger: #ff8a80;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--fg); font-family: var(--font);
  font-size: 16px; line-height: 1.5; -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
em, i { font-style: normal; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; }

.top, main, footer { max-width: 720px; margin: 0 auto; padding: 0 16px; }
.top { display: flex; align-items: center; gap: 14px; padding-top: 22px; padding-bottom: 8px; }
.mark { display: inline-flex; align-items: center; gap: 9px; color: var(--fg); font-weight: 600; font-size: 17px; letter-spacing: -0.01em; }
.mark:hover { text-decoration: none; }
.tag { color: var(--muted); font-size: 14px; }

.intro { margin-top: 36px; }
h1 { font-size: 30px; line-height: 1.2; font-weight: 600; letter-spacing: -0.02em; margin: 0 0 10px; }
.intro p { margin: 0; color: var(--muted); font-size: 17px; max-width: 560px; }

.picker { margin-top: 28px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.chip {
  display: inline-flex; align-items: center; gap: 8px; padding: 5px 6px 5px 5px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--soft); font-size: 14px; max-width: 100%;
}
.chip img { width: 26px; height: 26px; border-radius: 6px; object-fit: cover; background: var(--line); flex: none; }
.chip span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip button {
  border: 0; background: transparent; width: 24px; height: 24px; border-radius: 50%; cursor: pointer;
  color: var(--muted); display: inline-grid; place-items: center; font-size: 16px; line-height: 1; flex: none;
}
.chip button:hover { background: var(--line); color: var(--fg); }

.search { position: relative; }
#q {
  width: 100%; font: inherit; font-size: 18px; padding: 14px 16px; border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--bg); color: var(--fg); outline: none; appearance: none; -webkit-appearance: none;
}
#q:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
#q::-webkit-search-cancel-button { -webkit-appearance: none; }
.suggest {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 10; margin: 0; padding: 6px; list-style: none;
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: 0 10px 30px rgba(0,0,0,0.10); max-height: 420px; overflow: auto;
}
.suggest li {
  display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 8px; cursor: pointer;
}
.suggest li[aria-selected="true"], .suggest li:hover { background: var(--soft); }
.suggest img { width: 44px; height: 44px; border-radius: 8px; object-fit: cover; background: var(--line); flex: none; }
.suggest .t { min-width: 0; }
.suggest .n { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.suggest .a { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.suggest .k { margin-left: auto; color: var(--faint); font-size: 12px; flex: none; }
.suggest .empty { color: var(--muted); cursor: default; }
.hint { color: var(--faint); font-size: 13px; margin: 10px 2px 0; min-height: 20px; }

.results { margin-top: 36px; }
.status { color: var(--muted); font-size: 14px; display: flex; gap: 14px; align-items: baseline; flex-wrap: wrap; }
.status .spacer { flex: 1; }
.status button, .status a.btn {
  border: 1px solid var(--line); background: var(--bg); border-radius: 999px; padding: 4px 12px; font-size: 13px; cursor: pointer; color: var(--fg);
}
.status button:hover { background: var(--soft); text-decoration: none; }
.error { color: var(--danger); font-size: 15px; }

.list { list-style: none; margin: 16px 0 0; padding: 0; counter-reset: rec; }
.rec {
  display: grid; grid-template-columns: 72px 1fr; gap: 16px; padding: 20px 0; border-top: 1px solid var(--line);
}
.rec:last-child { border-bottom: 1px solid var(--line); }
.rec .art { width: 72px; height: 72px; border-radius: 12px; object-fit: cover; background: var(--soft); display: block; }
.rec .body { min-width: 0; }
.rec .head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.rec h2 { margin: 0; font-size: 17px; font-weight: 600; letter-spacing: -0.01em; line-height: 1.3; }
.rec h2 a { color: var(--fg); }
.rec .by { color: var(--muted); font-size: 14px; }
.rec .meta { color: var(--muted); font-size: 13px; margin-top: 2px; display: flex; flex-wrap: wrap; gap: 4px 0; }
.rec .meta span + span::before { content: "·"; margin: 0 6px; color: var(--faint); }
.rec .pill { font-size: 12px; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 0 8px; line-height: 20px; }
.rec .why { margin: 10px 0 0; padding: 0; list-style: none; font-size: 14px; color: var(--fg); }
.rec .why li { position: relative; padding-left: 16px; margin: 2px 0; color: var(--fg); }
.rec .why li::before { content: ""; position: absolute; left: 2px; top: 9px; width: 5px; height: 5px; border-radius: 50%; background: var(--faint); }
.rec .why li.people::before { background: var(--accent); }
.rec .desc { margin: 8px 0 0; font-size: 14px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.rec .links { margin-top: 10px; font-size: 13px; display: flex; flex-wrap: wrap; gap: 4px 0; }
.rec .links a + a::before, .rec .links a + span::before { content: "·"; margin: 0 8px; color: var(--faint); }
.rec .links .off { color: var(--faint); }

.skeleton .rec .art { background: var(--soft); }
.skeleton .bar { height: 12px; border-radius: 6px; background: var(--soft); margin: 8px 0; }
.skeleton .bar.w2 { width: 55%; } .skeleton .bar.w3 { width: 80%; }

footer { margin: 56px auto 40px; color: var(--faint); font-size: 13px; }
footer p { margin: 4px 0; }
footer a { color: var(--muted); }

@media (max-width: 480px) {
  h1 { font-size: 26px; }
  .tag { display: none; }
  .rec { grid-template-columns: 56px 1fr; gap: 12px; }
  .rec .art { width: 56px; height: 56px; }
}
@media (prefers-reduced-motion: no-preference) {
  .rec { animation: rise .25s ease both; }
  @keyframes rise { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
}
