:root {
  --bg: #ffffff;
  --bg-soft: #f6f8fb;
  --line: #e5e9f0;
  --text: #0f172a;
  --muted: #64748b;
  --accent: #2563eb;
  --accent-soft: #eff4ff;
  --good: #047857;
  --good-soft: #ecfdf5;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 4px 16px rgba(15, 23, 42, 0.04);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.55 Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; }
.wrap { max-width: 1160px; margin: 0 auto; padding: 0 20px; }
[hidden] { display: none !important; }

/* Top bar */
.topbar { position: sticky; top: 0; z-index: 20; background: rgba(255,255,255,.9); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.logo { font-weight: 800; letter-spacing: -0.02em; font-size: 18px; display: flex; gap: 8px; align-items: center; }
.logo-mark { color: var(--accent); }
.topnav { display: flex; gap: 24px; font-weight: 500; color: var(--muted); font-size: 15px; }
.topnav a:hover { color: var(--text); }
.count { background: var(--accent); color: #fff; border-radius: 999px; padding: 0 7px; font-size: 12px; margin-left: 4px; }

/* Home */
.hero { text-align: center; padding: 72px 0 32px; }
.hero h1 { font-size: clamp(32px, 5vw, 52px); line-height: 1.08; letter-spacing: -0.035em; margin: 0 0 14px; font-weight: 800; }
.hero p { color: var(--muted); font-size: 18px; margin: 0 auto 32px; max-width: 520px; }
.search { position: relative; max-width: 560px; margin: 0 auto; }
.search input {
  width: 100%; padding: 16px 20px 16px 48px; border-radius: 999px; border: 1px solid var(--line);
  font: inherit; font-size: 16px; box-shadow: var(--shadow); outline: none;
}
.search input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.search::before { content: "⌕"; position: absolute; left: 20px; top: 50%; transform: translateY(-52%); font-size: 20px; color: var(--muted); }
.section-label { text-align: center; font-size: 13px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 48px 0 16px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.tile {
  text-align: left; padding: 16px; border-radius: var(--radius); border: 1px solid var(--line); background: #fff;
  display: grid; grid-template-columns: 36px 1fr; gap: 2px 12px; align-items: center; transition: .15s;
}
.tile:hover { border-color: #c7d2e3; transform: translateY(-1px); box-shadow: var(--shadow); }
.tile .ico { grid-row: span 2; width: 36px; height: 36px; border-radius: 10px; background: var(--bg-soft); display: grid; place-items: center; font-size: 17px; font-weight: 700; }
.tile strong { font-size: 15px; font-weight: 600; }
.tile small { color: var(--muted); font-size: 13px; line-height: 1.3; }
.tile[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }
.tile[aria-pressed="true"] .ico { background: var(--accent); color: #fff; }
.home-cta { text-align: center; margin: 32px 0 80px; }
.btn {
  display: inline-flex; align-items: center; gap: 8px; border: 0; border-radius: 999px; padding: 13px 26px;
  background: var(--accent); color: #fff; font-weight: 600; font-size: 15px; transition: .15s;
}
.btn:hover { background: #1d4ed8; }
.btn.ghost { background: #fff; color: var(--text); border: 1px solid var(--line); }
.btn.ghost:hover { background: var(--bg-soft); }
.btn.small { padding: 8px 16px; font-size: 14px; }

/* Results */
.results-layout { display: grid; grid-template-columns: 250px 1fr; gap: 40px; padding: 32px 0 120px; }
.filters { position: sticky; top: 88px; align-self: start; max-height: calc(100vh - 100px); overflow: auto; padding-right: 4px; }
.filters h2 { font-size: 15px; margin: 0 0 4px; }
.fgroup { border-bottom: 1px solid var(--line); padding: 16px 0; }
.fgroup summary { font-weight: 600; font-size: 14px; cursor: pointer; list-style: none; display: flex; justify-content: space-between; }
.fgroup summary::after { content: "–"; color: var(--muted); }
.fgroup:not([open]) summary::after { content: "+"; }
.fgroup .opts { display: grid; gap: 8px; margin-top: 12px; }
.check { display: flex; gap: 10px; align-items: center; font-size: 14px; color: #334155; cursor: pointer; }
.check input { accent-color: var(--accent); width: 16px; height: 16px; margin: 0; }
.check .n { margin-left: auto; color: #94a3b8; font-size: 12px; }

.results-head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; justify-content: space-between; margin-bottom: 14px; }
.results-head h1 { font-size: 24px; letter-spacing: -0.02em; margin: 0; }
.results-head .sub { color: var(--muted); font-size: 14px; }
.sort { display: flex; gap: 8px; align-items: center; font-size: 14px; color: var(--muted); }
.sort select { font: inherit; font-size: 14px; padding: 7px 10px; border-radius: 10px; border: 1px solid var(--line); background: #fff; color: var(--text); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; min-height: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 5px 8px 5px 12px; background: var(--accent-soft); color: var(--accent); font-size: 13px; font-weight: 500; border: 0; }
.chip span { font-size: 15px; line-height: 1; opacity: .7; }
.chip:hover span { opacity: 1; }
.chip.clear { background: none; color: var(--muted); text-decoration: underline; padding-left: 4px; }
.mobile-filter-btn { display: none; }

.rcard { border: 1px solid var(--line); border-radius: 18px; padding: 22px; margin-bottom: 16px; background: #fff; transition: .15s; }
.rcard:hover { box-shadow: var(--shadow); border-color: #d5dce7; }
.rcard-top { display: grid; grid-template-columns: 120px 1fr auto; gap: 20px; align-items: start; }
.rcard h3 { margin: 0; font-size: 19px; letter-spacing: -0.01em; }
.rcard h3 a:hover { color: var(--accent); }
.meta { color: var(--muted); font-size: 13px; margin-top: 2px; }
.matchline { margin-top: 10px; font-size: 13px; color: var(--good); font-weight: 500; }
.matchline b { font-weight: 600; }
.cmp-toggle { display: flex; gap: 8px; align-items: center; font-size: 13px; color: var(--muted); cursor: pointer; white-space: nowrap; }
.cmp-toggle input { accent-color: var(--accent); width: 16px; height: 16px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--line); border-radius: 12px; overflow: hidden; margin: 18px 0 14px; }
.stat { background: var(--bg-soft); padding: 12px 14px; }
.stat label { display: block; font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.stat strong { font-size: 18px; letter-spacing: -0.01em; }
.stat small { display: block; font-size: 12px; color: var(--muted); }
.hl { list-style: none; padding: 0; margin: 0; display: grid; gap: 4px; font-size: 14px; color: #334155; }
.hl li::before { content: "✓"; color: var(--good); font-weight: 700; margin-right: 8px; }
.rcard-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--line); }
.value { font-size: 14px; color: var(--muted); }
.value strong { color: var(--text); font-size: 17px; }
.info { display: inline-grid; place-items: center; width: 16px; height: 16px; border-radius: 50%; border: 1px solid #cbd5e1; font-size: 10px; color: var(--muted); margin-left: 4px; cursor: help; vertical-align: 2px; }
.empty { text-align: center; padding: 60px 20px; color: var(--muted); border: 1px dashed var(--line); border-radius: 18px; }

/* Card art */
.art { aspect-ratio: 1.586; border-radius: 10px; position: relative; overflow: hidden; color: #fff; padding: 8px 10px; font-size: 9px; font-weight: 600; letter-spacing: .02em; box-shadow: 0 6px 16px rgba(15,23,42,.15); }
.art::after { content: ""; position: absolute; width: 22%; height: 18%; left: 10px; bottom: 26%; border-radius: 3px; background: linear-gradient(135deg,#fde68a,#d97706); opacity: .9; }
.art .nm { position: absolute; bottom: 8px; left: 10px; right: 10px; font-size: 9px; opacity: .9; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.art.lg { font-size: 13px; padding: 16px 18px; border-radius: 16px; }
.art.lg::after { left: 18px; }
.art.lg .nm { font-size: 13px; bottom: 14px; left: 18px; }

/* Compare tray */
.tray { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 30; background: var(--text); color: #fff; border-radius: 999px; padding: 8px 8px 8px 20px; display: flex; gap: 16px; align-items: center; box-shadow: 0 10px 30px rgba(15,23,42,.3); font-size: 14px; }
.tray .minis { display: flex; gap: 6px; }
.tray .minis .art { width: 40px; padding: 0; box-shadow: none; border-radius: 4px; }
.tray .minis .art::after, .tray .minis .art .nm { display: none; }
.tray .btn { padding: 9px 18px; }
.tray .x { background: none; border: 0; color: #94a3b8; font-size: 13px; }

/* Detail */
.crumbs { font-size: 14px; color: var(--muted); padding: 24px 0 0; }
.crumbs a:hover { color: var(--accent); }
.detail-hero { display: grid; grid-template-columns: 300px 1fr; gap: 48px; align-items: center; padding: 32px 0 40px; border-bottom: 1px solid var(--line); }
.detail-hero h1 { font-size: 38px; letter-spacing: -0.03em; margin: 0; line-height: 1.1; }
.detail-hero .stats { max-width: 560px; }
.detail-body { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; padding: 40px 0 100px; }
.panel { border: 1px solid var(--line); border-radius: 18px; padding: 24px; }
.panel.wide { grid-column: 1 / -1; }
.panel h2 { font-size: 17px; margin: 0 0 14px; }
.fitlist { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; font-size: 15px; }
.fitlist li { display: flex; gap: 10px; }
.fitlist .y { color: var(--good); font-weight: 700; }
.fitlist .n { color: #b45309; font-weight: 700; }
.tbl { width: 100%; border-collapse: collapse; font-size: 15px; }
.tbl td { padding: 10px 0; border-bottom: 1px solid var(--line); }
.tbl tr:last-child td { border-bottom: 0; }
.tbl td:last-child { text-align: right; color: var(--muted); }
.tbl td:nth-child(2) { font-weight: 600; text-align: right; width: 70px; }
.credit { padding: 12px 0; border-bottom: 1px solid var(--line); }
.credit:last-child { border-bottom: 0; }
.credit strong { display: block; }
.credit span { color: var(--muted); font-size: 14px; }
details.fine summary { cursor: pointer; font-weight: 600; }
.verified { font-size: 13px; color: var(--muted); margin-top: 12px; }

/* Compare page */
.cmp-head { display: flex; justify-content: space-between; align-items: end; gap: 16px; flex-wrap: wrap; padding: 32px 0 20px; }
.cmp-head h1 { margin: 0; font-size: 28px; letter-spacing: -0.02em; }
.switch { display: inline-flex; gap: 10px; align-items: center; font-size: 14px; font-weight: 500; cursor: pointer; }
.switch input { appearance: none; width: 38px; height: 22px; background: #cbd5e1; border-radius: 999px; position: relative; transition: .15s; margin: 0; cursor: pointer; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: .15s; }
.switch input:checked { background: var(--accent); }
.switch input:checked::after { left: 19px; }
.cmp-scroll { overflow-x: auto; margin-bottom: 100px; }
.cmp { width: 100%; border-collapse: separate; border-spacing: 0; min-width: 640px; font-size: 15px; }
.cmp th, .cmp td { padding: 14px 16px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
.cmp thead th { position: sticky; top: 64px; background: #fff; z-index: 2; border-bottom: 2px solid var(--line); }
.cmp thead .art { width: 120px; margin-bottom: 10px; }
.cmp thead .nm2 { font-size: 16px; font-weight: 700; }
.cmp thead .rm { font-size: 12px; color: var(--muted); background: none; border: 0; padding: 0; text-decoration: underline; }
.cmp th.rowlabel { width: 180px; color: var(--muted); font-weight: 500; font-size: 14px; }
.cmp tr.group td { background: var(--bg-soft); font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 10px 16px; cursor: pointer; }
.cmp tr.group td::before { content: "▾ "; }
.cmp tr.group.closed td::before { content: "▸ "; }
.cmp td.best { background: var(--good-soft); }
.cmp td.best::after { content: " ★"; color: var(--good); font-size: 12px; }
.cmp-empty { text-align: center; padding: 80px 20px; }
.cmp-empty p { color: var(--muted); }
.addcol { border: 1px dashed var(--line); border-radius: 12px; display: grid; place-items: center; min-height: 120px; color: var(--muted); font-size: 14px; }

/* Mobile */
@media (max-width: 860px) {
  .results-layout { grid-template-columns: 1fr; gap: 0; padding-top: 20px; }
  .filters { position: fixed; inset: auto 0 0 0; top: auto; max-height: 80vh; background: #fff; z-index: 40; padding: 20px; border-radius: 20px 20px 0 0; box-shadow: 0 -10px 40px rgba(15,23,42,.2); transform: translateY(100%); transition: transform .25s; }
  .filters.open { transform: none; }
  .filters .close-filters { display: block !important; width: 100%; margin-top: 16px; }
  .mobile-filter-btn { display: inline-flex; }
  .rcard-top { grid-template-columns: 84px 1fr; }
  .rcard-top .cmp-toggle { grid-column: 1 / -1; }
  .stats { grid-template-columns: 1fr 1fr; }
  .stats .stat:last-child { grid-column: 1 / -1; }
  .detail-hero { grid-template-columns: 1fr; gap: 24px; }
  .detail-hero .art { max-width: 280px; }
  .detail-body { grid-template-columns: 1fr; }
  .topnav { gap: 16px; }
  .tray { left: 16px; right: 16px; transform: none; justify-content: space-between; }
  .cmp thead th { top: 64px; }
}
.rcard-foot .btn { white-space: nowrap; }
