:root {
  --radius: 0.625rem;
  --background: oklch(1 0 0);
  --foreground: oklch(0.145 0 0);
  --card: oklch(1 0 0);
  --muted: oklch(0.97 0 0);
  --muted-foreground: oklch(0.556 0 0);
  --border: oklch(0.922 0 0);
  --accent: oklch(0.646 0.222 41.116);
  --accent-soft: oklch(0.646 0.222 41.116 / 12%);
  --shadow: 0 1px 2px oklch(0 0 0 / 5%);
  --tile: oklch(0.94 0 0);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --background: oklch(0.145 0 0);
    --foreground: oklch(0.985 0 0);
    --card: oklch(0.205 0 0);
    --muted: oklch(0.269 0 0);
    --muted-foreground: oklch(0.708 0 0);
    --border: oklch(1 0 0 / 10%);
    --accent-soft: oklch(0.646 0.222 41.116 / 18%);
    --shadow: none;
    --tile: oklch(0.3 0 0);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --background: oklch(0.145 0 0);
  --foreground: oklch(0.985 0 0);
  --card: oklch(0.205 0 0);
  --muted: oklch(0.269 0 0);
  --muted-foreground: oklch(0.708 0 0);
  --border: oklch(1 0 0 / 10%);
  --accent-soft: oklch(0.646 0.222 41.116 / 18%);
  --shadow: none;
  --tile: oklch(0.3 0 0);
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 72px; }

body {
  margin: 0;
  background: var(--background);
  color: var(--foreground);
  font-family: "Geist", ui-sans-serif, system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-underline-offset: 3px; text-decoration-color: var(--border); }
a:hover { text-decoration-color: var(--accent); }
button, input, select { font: inherit; color: inherit; }

h1, h2, h3 { letter-spacing: -0.02em; margin: 0; }
h1 { font-size: clamp(30px, 4.6vw, 46px); line-height: 1.08; font-weight: 600; max-width: 18ch; }
h2 { font-size: 22px; font-weight: 600; }
h3 { font-size: 16px; font-weight: 600; }
p { margin: 0; }

.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted-foreground); }
.mono { font-family: "Geist Mono", ui-monospace, monospace; }
.small { font-size: 13px; }

/* header */
.top { border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20; background: color-mix(in oklab, var(--background) 85%, transparent); backdrop-filter: blur(8px); }
.top-inner { display: flex; align-items: center; justify-content: space-between; height: 56px; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 600; text-decoration: none; font-family: "Geist Mono", ui-monospace, monospace; font-size: 14px; }
.brand-mark { width: 14px; height: 14px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); position: relative; }
.brand-mark::after { content: ""; position: absolute; width: 4px; height: 4px; border-radius: 50%; background: var(--background); top: 3px; left: 3px; }
.links { display: flex; align-items: center; gap: 20px; font-size: 14px; }
.links a { text-decoration: none; color: var(--muted-foreground); }
.links a:hover { color: var(--foreground); }

.icon-btn { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: calc(var(--radius) - 2px); border: 1px solid var(--border); background: var(--card); color: var(--foreground); cursor: pointer; }
.icon-btn:hover { background: var(--muted); }
.icon-btn .moon { display: none; }
:root[data-theme="dark"] .icon-btn .sun { display: none; }
:root[data-theme="dark"] .icon-btn .moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .icon-btn .sun { display: none; }
  :root:not([data-theme="light"]) .icon-btn .moon { display: block; }
}

/* hero */
.hero { padding: 56px 0 8px; display: grid; gap: 14px; }
.eyebrow { color: var(--accent); font-weight: 500; font-size: 13px; font-family: "Geist Mono", ui-monospace, monospace; }
.lead { color: var(--muted-foreground); font-size: 17px; max-width: 64ch; }

.card { background: var(--card); border: 1px solid var(--border); border-radius: calc(var(--radius) + 4px); box-shadow: var(--shadow); }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-top: 14px; }
.stat { padding: 18px 20px; display: grid; gap: 4px; }
.stat-label { font-size: 13px; color: var(--muted-foreground); }
.stat-value { font-size: 30px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat-sub { font-size: 13px; color: var(--muted-foreground); }

.section { padding: 56px 0 0; }
.section-head { display: grid; gap: 4px; margin-bottom: 16px; }

/* scout */
.scout-card { padding: 16px; display: grid; gap: 14px; }
.search { position: relative; }
.search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted-foreground); pointer-events: none; }
#q { width: 100%; height: 44px; padding: 0 14px 0 38px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--background); font-size: 15px; outline: none; }
#q:focus { border-color: color-mix(in oklab, var(--accent) 60%, var(--border)); box-shadow: 0 0 0 3px var(--accent-soft); }

.suggest { position: absolute; left: 0; right: 0; top: 48px; z-index: 15; margin: 0; padding: 4px; list-style: none; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 8px 24px oklch(0 0 0 / 12%); max-height: 380px; overflow-y: auto; }
.suggest li { display: flex; gap: 10px; align-items: center; padding: 6px 8px; border-radius: calc(var(--radius) - 3px); cursor: pointer; }
.suggest li.on, .suggest li:hover { background: var(--muted); }
.suggest img, .suggest .thumb { width: 30px; height: 42px; object-fit: cover; border-radius: 4px; background: var(--muted); flex-shrink: 0; }
.suggest .s-title { font-weight: 500; font-size: 14px; line-height: 1.3; }
.suggest .s-sub { font-size: 12px; color: var(--muted-foreground); }
.suggest .none { color: var(--muted-foreground); cursor: default; font-size: 14px; padding: 10px; }
.suggest .none:hover { background: transparent; }

.picks { display: flex; flex-wrap: wrap; gap: 8px; }
.picks:empty { display: none; }
.chip { display: inline-flex; align-items: center; gap: 8px; padding: 4px 6px 4px 4px; border: 1px solid var(--border); border-radius: 999px; background: var(--muted); font-size: 13px; font-weight: 500; max-width: 100%; }
.chip img, .chip .thumb { width: 24px; height: 24px; border-radius: 50%; object-fit: cover; background: var(--border); flex-shrink: 0; }
.chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip button { border: 0; background: transparent; cursor: pointer; color: var(--muted-foreground); width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; padding: 0; font-size: 15px; line-height: 1; }
.chip button:hover { background: var(--border); color: var(--foreground); }
.chip.clear { background: transparent; padding: 4px 10px; cursor: pointer; color: var(--muted-foreground); }

.try { font-size: 13px; }
.link-btn { border: 0; background: none; padding: 0; color: var(--foreground); text-decoration: underline; text-decoration-color: var(--border); text-underline-offset: 3px; cursor: pointer; font-size: 13px; }
.link-btn:hover { text-decoration-color: var(--accent); }

.filters { display: grid; grid-template-columns: 1.6fr 1fr 1fr auto; gap: 16px 24px; align-items: end; padding-top: 14px; border-top: 1px solid var(--border); }
.filter { display: grid; gap: 6px; min-width: 0; }
.filter-label { font-size: 13px; color: var(--muted-foreground); display: flex; justify-content: space-between; gap: 8px; }
.filter-label b { color: var(--foreground); font-weight: 500; font-size: 12px; }
.pills { display: flex; flex-wrap: wrap; gap: 6px; }
.pill { border: 1px solid var(--border); background: var(--card); padding: 3px 10px; border-radius: 999px; font-size: 13px; cursor: pointer; color: var(--muted-foreground); }
.pill.on { background: var(--foreground); border-color: var(--foreground); color: var(--background); }
.checks { display: grid; gap: 8px; }
.check { display: flex; gap: 8px; align-items: center; font-size: 13px; cursor: pointer; padding-bottom: 4px; }
.check input { accent-color: var(--accent); width: 16px; height: 16px; margin: 0; }

input[type="range"] { width: 100%; accent-color: var(--accent); margin: 4px 0; }
.range2 { position: relative; height: 22px; }
.range2 input { position: absolute; left: 0; top: 0; margin: 4px 0; pointer-events: none; background: transparent; -webkit-appearance: none; appearance: none; height: 14px; }
.range2 input::-webkit-slider-thumb { pointer-events: auto; -webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%; background: var(--card); border: 2px solid var(--accent); cursor: pointer; position: relative; z-index: 2; }
.range2 input::-moz-range-thumb { pointer-events: auto; width: 12px; height: 12px; border-radius: 50%; background: var(--card); border: 2px solid var(--accent); cursor: pointer; }
.range2 input::-webkit-slider-runnable-track { height: 4px; background: transparent; }
.range2::before { content: ""; position: absolute; left: 0; right: 0; top: 9px; height: 4px; border-radius: 2px; background: var(--border); }
.range2 .fill { position: absolute; top: 9px; height: 4px; border-radius: 2px; background: var(--accent); }

.results-head { display: flex; justify-content: space-between; align-items: baseline; margin: 24px 0 12px; gap: 12px; }
.results-head .muted { font-size: 13px; }
.results { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.rec { display: grid; grid-template-rows: auto 1fr; overflow: hidden; position: relative; }
.poster { position: relative; aspect-ratio: 225 / 318; background: var(--muted); overflow: hidden; }
.poster img { width: 100%; height: 100%; object-fit: cover; display: block; }
.poster .fallback, .thumb { display: grid; place-items: center; width: 100%; height: 100%; color: var(--muted-foreground); font-family: "Geist Mono", ui-monospace, monospace; font-size: 22px; background: repeating-linear-gradient(135deg, var(--muted) 0 10px, color-mix(in oklab, var(--muted) 70%, var(--border)) 10px 20px); }
.thumb { font-size: 11px; }
.score { position: absolute; top: 8px; left: 8px; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; background: color-mix(in oklab, var(--card) 88%, transparent); backdrop-filter: blur(6px); font-variant-numeric: tabular-nums; }
.score.hi { background: var(--accent); color: white; }
.add { position: absolute; top: 8px; right: 8px; width: 30px; height: 30px; border-radius: 50%; border: 0; background: color-mix(in oklab, var(--card) 88%, transparent); backdrop-filter: blur(6px); cursor: pointer; font-size: 18px; line-height: 1; display: grid; place-items: center; }
.add:hover { background: var(--accent); color: white; }
.rec-body { padding: 10px 12px 12px; display: grid; gap: 4px; align-content: start; }
.rec-title { font-weight: 600; font-size: 14px; line-height: 1.3; text-decoration: none; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.rec-sub { font-size: 12px; color: var(--muted-foreground); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rec-meta { font-size: 12px; color: var(--muted-foreground); font-family: "Geist Mono", ui-monospace, monospace; }
.why { margin-top: 4px; font-size: 12px; line-height: 1.45; color: var(--muted-foreground); }
.why b { color: var(--foreground); font-weight: 500; }
.tag { display: inline-block; padding: 0 6px; border-radius: 4px; background: var(--accent-soft); color: var(--accent); font-size: 11px; font-weight: 500; margin: 2px 2px 0 0; }
.tag.fans { background: var(--muted); color: var(--foreground); }

.empty { display: grid; justify-items: center; gap: 4px; padding: 36px 16px; text-align: center; margin-top: 24px; }
.empty-art { font-family: "Geist Mono", ui-monospace, monospace; font-size: 22px; color: var(--accent); margin-bottom: 6px; }
.more-wrap { display: flex; justify-content: center; margin-top: 16px; }
.btn { border: 1px solid var(--border); background: var(--card); padding: 7px 16px; border-radius: var(--radius); cursor: pointer; font-size: 14px; font-weight: 500; }
.btn:hover { background: var(--muted); }
.btn.primary { background: var(--foreground); color: var(--background); border-color: var(--foreground); }
.btn.primary:hover { opacity: 0.9; }

/* animap */
.map-card { overflow: hidden; }
.map-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.crumbs { display: flex; align-items: center; gap: 6px; font-size: 14px; min-width: 0; flex-wrap: wrap; }
.crumbs button { border: 0; background: none; padding: 2px 4px; border-radius: 4px; cursor: pointer; color: var(--muted-foreground); }
.crumbs button:hover { color: var(--foreground); background: var(--muted); }
.crumbs b { font-weight: 600; }
.map-controls { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.seg { display: inline-flex; padding: 3px; background: var(--muted); border-radius: var(--radius); }
.seg button { border: 0; background: transparent; color: var(--muted-foreground); font-size: 13px; font-weight: 500; padding: 4px 10px; border-radius: calc(var(--radius) - 3px); cursor: pointer; }
.seg button.on { background: var(--card); color: var(--foreground); box-shadow: 0 1px 2px oklch(0 0 0 / 10%); }
select { height: 32px; border: 1px solid var(--border); border-radius: calc(var(--radius) - 2px); background: var(--card); padding: 0 8px; font-size: 13px; }

.map-wrap { position: relative; padding: 8px; }
.map { position: relative; height: min(70vh, 620px); min-height: 380px; }
.tile { position: absolute; border: 0; padding: 0; margin: 0; cursor: pointer; overflow: hidden; text-align: left; border-radius: 6px; background: var(--tile); color: var(--foreground); transition: filter .12s; }
.tile:hover { filter: brightness(1.06); outline: 2px solid var(--foreground); outline-offset: -2px; z-index: 2; }
.tile .t-in { position: absolute; inset: 0; padding: 7px 8px; display: flex; flex-direction: column; justify-content: flex-start; gap: 1px; }
.tile .t-name { font-weight: 600; font-size: 13px; line-height: 1.2; overflow: hidden; }
.tile .t-sub { font-size: 11px; opacity: .75; font-family: "Geist Mono", ui-monospace, monospace; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile.small .t-name { font-size: 11px; font-weight: 500; }
.tile.small .t-sub { display: none; }
.tile.tiny .t-in { display: none; }
.tile.hot { color: white; }
.tile.pic { background-size: cover; background-position: center top; color: white; }
.tile.pic .t-in { justify-content: flex-end; background: linear-gradient(to top, oklch(0 0 0 / 78%), oklch(0 0 0 / 0%) 70%); }
.tile.pic .t-score { position: absolute; top: 6px; left: 6px; font-size: 11px; font-weight: 600; padding: 1px 6px; border-radius: 999px; background: var(--accent); color: white; }
.tile.picked { outline: 3px solid var(--accent); outline-offset: -3px; }

.legend { position: absolute; right: 16px; bottom: 16px; display: flex; gap: 8px; align-items: center; padding: 4px 10px; font-size: 12px; background: color-mix(in oklab, var(--card) 90%, transparent); border: 1px solid var(--border); border-radius: 999px; color: var(--muted-foreground); z-index: 3; pointer-events: none; }
.legend-bar { width: 64px; height: 8px; border-radius: 4px; background: linear-gradient(to right, var(--tile), var(--accent)); }

.detail { padding: 14px 16px; border-top: 1px solid var(--border); font-size: 14px; min-height: 64px; }
.detail.show { color: var(--foreground); display: grid; grid-template-columns: 64px 1fr auto; gap: 14px; align-items: center; }
.detail .d-img { width: 64px; height: 90px; border-radius: 6px; overflow: hidden; background: var(--muted); }
.detail .d-img img { width: 100%; height: 100%; object-fit: cover; }
.detail .d-title { font-weight: 600; }
.detail .d-sub { font-size: 13px; color: var(--muted-foreground); }
.detail .d-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.detail .d-actions a { text-decoration: none; }

/* how it works */
.two { display: grid; grid-template-columns: 1fr 2fr; gap: 32px; }
.two > div:first-child { display: grid; gap: 6px; align-content: start; }
.two > div:first-child .muted { font-size: 14px; }
.how { display: grid; gap: 14px; }
.how .sub { margin-top: 18px; }
.how > .muted { font-size: 14px; }
.steps { margin: 0; padding: 0; list-style: none; counter-reset: s; display: grid; gap: 10px; }
.steps li { counter-increment: s; position: relative; padding: 14px 16px 14px 52px; border: 1px solid var(--border); border-radius: calc(var(--radius) + 4px); background: var(--card); color: var(--muted-foreground); font-size: 14px; }
.steps li b { color: var(--foreground); font-weight: 600; }
.steps li::before { content: counter(s); position: absolute; left: 16px; top: 14px; width: 22px; height: 22px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-size: 12px; font-weight: 600; display: grid; place-items: center; font-family: "Geist Mono", ui-monospace, monospace; }

.table-card { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 16px; border-bottom: 1px solid var(--border); }
th { font-weight: 500; color: var(--muted-foreground); font-size: 13px; }
tbody tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tr.best td { font-weight: 600; }
tr.best td:first-child::after { content: "site default"; margin-left: 8px; font-size: 11px; font-weight: 500; padding: 1px 6px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); }

.foot { padding: 64px 16px 40px; color: var(--muted-foreground); font-size: 13px; display: grid; gap: 4px; }

@media (max-width: 900px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .filters { grid-template-columns: 1fr 1fr; }
  .filter:first-child { grid-column: 1 / -1; }
  .two { grid-template-columns: 1fr; gap: 14px; }
}

@media (max-width: 560px) {
  .hero { padding: 36px 0 4px; }
  .links a { display: none; }
  .stat { padding: 14px 16px; }
  .stat-value { font-size: 24px; }
  .filters { grid-template-columns: 1fr; }
  .results { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .rec-body { padding: 8px 10px 10px; }
  .map { height: 64vh; min-height: 360px; }
  .map-controls { width: 100%; }
  .detail.show { grid-template-columns: 56px 1fr; }
  .detail .d-actions { grid-column: 1 / -1; justify-content: flex-start; }
  th, td { padding: 9px 12px; }
}
