:root {
  --bg: #f7f8fa;
  --surface: #ffffff;
  --surface-2: #f1f3f7;
  --text: #0f172a;
  --muted: #5b6475;
  --border: #e3e6ec;
  --accent: #4f46e5;
  --accent-ink: #ffffff;
  --accent-soft: #eef0ff;
  --good: #0f8a5f;
  --no: #a0a7b4;
  --bar: #6366f1;
  --code-bg: #0f172a;
  --code-text: #e2e8f0;
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 4px 16px rgba(15, 23, 42, .04);
  --radius: 14px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b0e14; --surface: #121722; --surface-2: #1a2030; --text: #e6e9ef; --muted: #98a2b3;
    --border: #252c3b; --accent: #818cf8; --accent-ink: #0b0e14; --accent-soft: #1e2240; --good: #34d399;
    --no: #5b6475; --bar: #818cf8; --code-bg: #0a0d13; --code-text: #e2e8f0; --shadow: none;
  }
}
:root[data-theme="dark"] {
  --bg: #0b0e14; --surface: #121722; --surface-2: #1a2030; --text: #e6e9ef; --muted: #98a2b3;
  --border: #252c3b; --accent: #818cf8; --accent-ink: #0b0e14; --accent-soft: #1e2240; --good: #34d399;
  --no: #5b6475; --bar: #818cf8; --code-bg: #0a0d13; --code-text: #e2e8f0; --shadow: none;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: var(--mono); font-size: .9em; }
h1, h2, h3 { line-height: 1.2; margin: 0; letter-spacing: -0.01em; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1rem; margin-bottom: .5rem; }
.wrap { max-width: 1240px; margin: 0 auto; padding: 0 20px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.sub { font-weight: 400; color: var(--muted); font-size: .75rem; }

/* top bar */
.topbar { position: sticky; top: 0; z-index: 10; background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--border); }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; height: 56px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 650; }
.brand:hover { text-decoration: none; }
.logo { width: 28px; height: 28px; border-radius: 8px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-weight: 800; font-size: 15px; }
.topnav { display: flex; align-items: center; gap: 18px; }
.topnav a { color: var(--muted); font-size: .92rem; }
.topnav a:hover { color: var(--text); text-decoration: none; }
.icon-btn { background: transparent; border: 1px solid var(--border); color: var(--text); border-radius: 8px; width: 34px; height: 34px; display: grid; place-items: center; cursor: pointer; }
.i-moon { display: none; }
:root[data-theme="dark"] .i-sun { display: none; }
:root[data-theme="dark"] .i-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .i-sun { display: none; }
  :root:not([data-theme="light"]) .i-moon { display: block; }
}

/* hero */
.hero { display: grid; grid-template-columns: 1.2fr 1fr; gap: 40px; padding-top: 44px; padding-bottom: 28px; align-items: start; }
.eyebrow { color: var(--accent); font-weight: 600; font-size: .85rem; margin: 0 0 10px; }
.hero h1 { font-size: clamp(1.7rem, 3.4vw, 2.5rem); margin-bottom: 14px; }
.lede { color: var(--muted); font-size: 1.05rem; margin: 0; max-width: 60ch; }
.why { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.why li { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; font-size: .92rem; color: var(--muted); }
.why strong { color: var(--text); display: block; }

/* cards */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; margin-top: 20px; margin-bottom: 20px; }
main > .card.wrap { max-width: 1200px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.section-head p { margin: 0; }
.note { margin: 14px 0 0; }

/* filters */
.filters { display: grid; gap: 10px; margin-bottom: 14px; }
.search { display: flex; align-items: center; gap: 8px; border: 1px solid var(--border); background: var(--surface-2); border-radius: 10px; padding: 0 12px; color: var(--muted); max-width: 420px; }
.search input { border: 0; background: transparent; color: var(--text); font: inherit; padding: 10px 0; width: 100%; outline: none; }
.search:focus-within { border-color: var(--accent); }
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chip-label { font-size: .8rem; color: var(--muted); margin-right: 4px; min-width: 64px; }
.chip { font: inherit; font-size: .85rem; border: 1px solid var(--border); background: var(--surface); color: var(--text); padding: 5px 11px; border-radius: 999px; cursor: pointer; transition: background .15s, border-color .15s; }
.chip:hover { border-color: var(--accent); }
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.chip.small { font-size: .8rem; padding: 3px 10px; }

/* table */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 12px; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
thead th { position: sticky; top: 0; background: var(--surface-2); text-align: left; font-weight: 600; font-size: .8rem; color: var(--muted); padding: 10px 10px; line-height: 1.3; border-bottom: 1px solid var(--border); white-space: nowrap; user-select: none; }
th[data-sort] { cursor: pointer; }
th[data-sort]:hover { color: var(--text); }
th[aria-sort="ascending"]::after { content: " ▲"; font-size: .7em; }
th[aria-sort="descending"]::after { content: " ▼"; font-size: .7em; }
td { padding: 10px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: color-mix(in srgb, var(--accent-soft) 50%, transparent); }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.c { text-align: center; }
.m-name { font-weight: 600; }
.m-id { font-family: var(--mono); font-size: .78rem; color: var(--muted); display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.td-model { min-width: 190px; }
.use-btn { font: inherit; font-size: .72rem; padding: 1px 7px; border-radius: 6px; border: 1px solid var(--border); background: transparent; color: var(--accent); cursor: pointer; }
.use-btn:hover { border-color: var(--accent); }
.fam { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.fam-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.lab { color: var(--muted); font-size: .78rem; display: block; padding-left: 16px; }
.yes { color: var(--good); font-weight: 700; }
.no { color: var(--no); }
.mods { display: flex; gap: 4px; flex-wrap: wrap; min-width: 100px; max-width: 120px; }
.mod { font-size: .7rem; border: 1px solid var(--border); border-radius: 5px; padding: 0 5px; color: var(--muted); white-space: nowrap; }
.tags { display: flex; gap: 4px; flex-wrap: wrap; min-width: 140px; max-width: 210px; }
.tag { font-size: .72rem; background: var(--accent-soft); color: var(--accent); border-radius: 5px; padding: 1px 6px; white-space: nowrap; }
.price { white-space: nowrap; font-variant-numeric: tabular-nums; }
.price b { font-weight: 600; }
.price .sep { color: var(--muted); padding: 0 3px; }
.tier-badge { display: inline-block; font-size: .68rem; border: 1px dashed var(--muted); color: var(--muted); border-radius: 5px; padding: 0 5px; margin-left: 6px; cursor: help; position: relative; }
.tier-pop { display: none; position: absolute; right: 0; top: 130%; z-index: 5; background: var(--surface); color: var(--text); border: 1px solid var(--border); box-shadow: 0 8px 24px rgba(0,0,0,.15); border-radius: 8px; padding: 8px 10px; font-size: .78rem; text-align: left; white-space: nowrap; }
.tier-badge:hover .tier-pop, .tier-badge:focus .tier-pop, .tier-badge.open .tier-pop { display: block; }
.on-pt { font-size: .8rem; white-space: nowrap; }
.empty { padding: 24px; text-align: center; color: var(--muted); margin: 0; }
.linkish { font: inherit; background: none; border: 0; color: var(--accent); cursor: pointer; padding: 0; }

/* calculator */
.calc { display: grid; grid-template-columns: repeat(3, minmax(0, 220px)) 1fr; gap: 14px; align-items: end; margin-bottom: 16px; }
.calc label { display: grid; gap: 6px; font-size: .82rem; color: var(--muted); font-weight: 500; }
.calc input, .calc select { font: inherit; color: var(--text); background: var(--surface-2); border: 1px solid var(--border); border-radius: 9px; padding: 9px 10px; width: 100%; }
.calc input:focus, .calc select:focus { outline: none; border-color: var(--accent); }
.unit-input { position: relative; display: block; }
.unit-input span { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: .85rem; pointer-events: none; }
.presets { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; padding-bottom: 6px; }
.bars { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.bars li { display: grid; grid-template-columns: 210px 1fr 110px; gap: 12px; align-items: center; font-size: .88rem; }
.bars .b-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bars .b-track { display: block; height: 10px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.bars .b-fill { display: block; height: 100%; background: var(--bar); border-radius: 99px; min-width: 2px; }
.bars .b-val { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.bars li.skip { color: var(--muted); }
#calcMore { margin-top: 10px; }

/* access */
.access-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
.access-col { border: 1px solid var(--border); border-radius: 12px; padding: 18px; min-width: 0; }
.access-col p { margin: 0 0 12px; color: var(--muted); font-size: .92rem; }
.access-col.pt { background: color-mix(in srgb, var(--accent-soft) 45%, var(--surface)); }
.official { list-style: none; padding: 0; margin: 0 0 12px; display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px; font-size: .9rem; }
.official .muted { font-size: .78rem; margin-left: 4px; }
.checks { list-style: none; padding: 0; margin: 0 0 14px; display: grid; gap: 6px; font-size: .92rem; }
.checks li { padding-left: 22px; position: relative; }
.checks li::before { content: "✓"; position: absolute; left: 0; color: var(--good); font-weight: 700; }
.snippet { background: var(--code-bg); border-radius: 10px; overflow: hidden; margin-bottom: 8px; }
.snippet-head { display: flex; justify-content: space-between; align-items: center; padding: 6px 8px; border-bottom: 1px solid rgba(255,255,255,.08); }
.tabs { display: flex; gap: 2px; }
.tab, .copy { font: inherit; font-size: .78rem; background: transparent; color: #94a3b8; border: 0; padding: 4px 9px; border-radius: 6px; cursor: pointer; }
.tab[aria-selected="true"] { background: rgba(255,255,255,.1); color: #fff; }
.copy:hover, .tab:hover { color: #fff; }
.snippet pre { margin: 0; padding: 14px; overflow-x: auto; color: var(--code-text); font: 12.5px/1.6 var(--mono); }
.snippet .hl { color: #a5b4fc; }
.snippet .str { color: #86efac; }
.cta { display: block; text-align: center; background: var(--accent); color: var(--accent-ink); font-weight: 650; padding: 12px 16px; border-radius: 10px; margin: 14px 0 8px; }
.cta:hover { text-decoration: none; filter: brightness(1.07); }

.method ul { margin: 10px 0 0; padding-left: 18px; color: var(--muted); font-size: .9rem; display: grid; gap: 6px; }
.method strong { color: var(--text); }

.footer { border-top: 1px solid var(--border); margin-top: 32px; padding: 26px 0 40px; font-size: .88rem; color: var(--muted); }
.footer p { margin: 0 0 8px; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px); background: var(--text); color: var(--bg); padding: 8px 14px; border-radius: 8px; font-size: .85rem; opacity: 0; transition: .2s; pointer-events: none; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* responsive */
@media (max-width: 960px) {
  .hero { grid-template-columns: 1fr; gap: 22px; padding-top: 28px; }
  .calc { grid-template-columns: 1fr 1fr; }
  .presets { grid-column: 1 / -1; }
  .access-grid { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .wrap { padding: 0 14px; }
  .card { padding: 16px; border-radius: 12px; }
  main > .card.wrap { margin-left: 10px; margin-right: 10px; }
  .topnav a { display: none; }
  .search { max-width: none; }
  .chip-row { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
  .chip-row::-webkit-scrollbar { display: none; }
  .chip { white-space: nowrap; }
  .table-wrap { border: 0; overflow: visible; }
  table, tbody, tr, td { display: block; width: 100%; }
  thead { display: none; }
  tbody tr { border: 1px solid var(--border); border-radius: 12px; padding: 12px; margin-bottom: 10px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px 10px; }
  td { border: 0; padding: 0; text-align: left !important; }
  td::before { content: attr(data-label); display: block; font-size: .7rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
  td.td-model, td.td-tags { grid-column: 1 / -1; }
  td.td-price, td.td-input { grid-column: span 2; }
  td { font-size: .88rem; }
  .lab { padding-left: 0; display: inline; margin-left: 4px; }
  .lab::before { content: "· "; }
  td.td-model::before { display: none; }
  .td-model .m-name { font-size: 1rem; }
  .fam { white-space: normal; }
  .tier-pop { left: 0; right: auto; }
  .calc { grid-template-columns: 1fr; }
  .bars li { grid-template-columns: 1fr 90px; grid-template-rows: auto auto; gap: 3px 10px; }
  .bars .b-name { grid-column: 1; }
  .bars .b-val { grid-column: 2; grid-row: 1; }
  .bars .b-track { grid-column: 1 / -1; }
  .official { grid-template-columns: 1fr; }
}

.why-title { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 10px; font-weight: 600; }
.result-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.sort-mobile { display: none; align-items: center; gap: 6px; color: var(--muted); }
.sort-mobile select { font: inherit; color: var(--text); background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 5px 8px; }
@media (max-width: 720px) {
  .sort-mobile { display: inline-flex; }
  .why { gap: 8px; }
  .why li { padding: 9px 12px; font-size: .86rem; }
  .hero { padding-bottom: 8px; }
  .td-model { min-width: 0; }
  .mods { max-width: none; min-width: 0; }
}
@media (max-width: 720px) { .desk-only { display: none; } }

/* FAQ */
.faq { display: grid; gap: 14px; }
.faq h3 { font-size: 1rem; margin: 0 0 4px; }
.faq p { margin: 0; color: var(--muted); font-size: .92rem; }
.faq-item + .faq-item { border-top: 1px solid var(--border); padding-top: 12px; }
