/* Model Prices: a calm data page. Light gray canvas, white cards, one sans
   family with mono numbers, one accent used for the cost bars. Dark mode
   follows the device. */
:root {
  --bg: #f5f5f7; --panel: #ffffff; --panel-2: #f0f0f3;
  --line: rgba(0, 0, 0, 0.07); --line-strong: rgba(0, 0, 0, 0.14);
  --ink: #1d1d1f; --muted: #6e6e73; --faint: #a1a1a6;
  --accent: #0071e3; --accent-soft: rgba(0, 113, 227, 0.1); --bar: #0071e3; --bar-track: rgba(0, 0, 0, 0.06);
  --good: #1a8a42; --good-soft: rgba(26, 138, 66, 0.1);
  --wait: #b25e00; --wait-soft: rgba(178, 94, 0, 0.1); --bad: #d70015; --bad-soft: rgba(215, 0, 21, 0.07);
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.05);
  --f-body: 'Inter', system-ui, -apple-system, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --f-mono: 'Geist Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000; --panel: #1c1c1e; --panel-2: #2c2c2e;
    --line: rgba(255, 255, 255, 0.1); --line-strong: rgba(255, 255, 255, 0.2);
    --ink: #f5f5f7; --muted: #a1a1a6; --faint: #6e6e73;
    --accent: #2997ff; --accent-soft: rgba(41, 151, 255, 0.16); --bar: #2997ff; --bar-track: rgba(255, 255, 255, 0.1);
    --good: #30d158; --good-soft: rgba(48, 209, 88, 0.14);
    --wait: #ffb340; --wait-soft: rgba(255, 179, 64, 0.14); --bad: #ff6961; --bad-soft: rgba(255, 105, 97, 0.14);
    --shadow: 0 0 0 1px rgba(255, 255, 255, 0.06);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.6 var(--f-body); -webkit-font-smoothing: antialiased; min-height: 100vh; }
h1, h2 { margin: 0; font-weight: 600; letter-spacing: -0.025em; line-height: 1.12; text-wrap: balance; }
p { margin: 0; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }

.wrap { max-width: 1180px; margin: 0 auto; padding: 0 16px; }

.topbar { position: sticky; top: 0; z-index: 5; background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: saturate(180%) blur(16px); -webkit-backdrop-filter: saturate(180%) blur(16px); border-bottom: 1px solid var(--line); }
.topbar-in { display: flex; align-items: center; gap: 12px; height: 52px; }
.home { color: var(--muted); font-size: 14px; }
.brand { font-weight: 600; flex: 1; }
.home::after { content: '/'; margin-left: 12px; color: var(--faint); }
.lang { border: 1px solid var(--line-strong); background: transparent; border-radius: 999px; padding: 4px 14px; font-size: 14px; cursor: pointer; }
.lang:hover { background: var(--panel-2); }

.hero { padding: 48px 0 28px; max-width: 760px; }
.eyebrow { color: var(--accent); font-size: 14px; font-weight: 500; margin-bottom: 10px; }
.hero h1 { font-size: clamp(30px, 5vw, 48px); }
.lede { margin-top: 14px; color: var(--muted); font-size: 17px; }

.card { background: var(--panel); border-radius: 20px; box-shadow: var(--shadow); }
.status { padding: 28px; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; color: var(--muted); }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line-strong); border-top-color: var(--accent); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.btn { border: 0; background: var(--accent); color: #fff; border-radius: 999px; padding: 8px 18px; cursor: pointer; }

/* Trust bar: when the data was taken, how much there is, how to check it. */
.trust { margin: 0 0 16px; padding: 14px 18px; border-radius: 16px; border: 1px solid var(--line-strong); display: grid; gap: 8px; font-size: 14px; }
.tline { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; }
.pill { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: 13px; padding: 2px 10px; border-radius: 999px; color: var(--good); background: var(--good-soft); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.trust.live .dot { animation: pulse 2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.35; } }
@media (prefers-reduced-motion: reduce) { .trust.live .dot { animation: none; } }
.trust.aging .pill, .trust.direct .pill { color: var(--wait); background: var(--wait-soft); }
.trust.stale { border-color: var(--bad); }
.trust.stale .pill { color: var(--bad); background: var(--bad-soft); }
.tnote { color: var(--muted); font-size: 13px; }
.tnote.warn { color: var(--ink); }
.stats { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 18px; color: var(--muted); }
.stats b { color: var(--ink); font-family: var(--f-mono); font-weight: 500; }
.tlinks { display: flex; flex-wrap: wrap; gap: 4px 16px; }
.linkbtn { border: 0; background: none; padding: 0; color: var(--accent); cursor: pointer; font-size: inherit; }
.linkbtn:hover { text-decoration: underline; }

.workload { padding: 24px; }
.workload h2 { font-size: 20px; }
.hint { color: var(--muted); margin-top: 4px; }
.presets { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.preset { display: flex; flex-direction: column; align-items: flex-start; gap: 0; text-align: left; border: 1px solid var(--line-strong); background: var(--panel); border-radius: 14px; padding: 8px 14px; cursor: pointer; font-weight: 500; line-height: 1.35; }
.preset small { font-weight: 400; color: var(--muted); font-size: 12px; font-family: var(--f-mono); }
.preset.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.preset.on small { color: inherit; opacity: 0.85; }
.custom { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 14px; }
.custom label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.custom input { width: 160px; max-width: 100%; border: 1px solid var(--line-strong); background: var(--panel); border-radius: 12px; padding: 8px 12px; font-family: var(--f-mono); color: var(--ink); }
.insight { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); font-size: 16px; }
.insight:empty { display: none; }
.insight b { font-weight: 600; }

.controls { margin: 28px 0 12px; display: grid; gap: 12px; }
.controls .row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.search { flex: 1 1 260px; }
.search input, .sort select { width: 100%; border: 1px solid var(--line-strong); background: var(--panel); border-radius: 12px; padding: 9px 14px; color: var(--ink); }
.sort { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 14px; white-space: nowrap; }
.sort select { width: auto; color: var(--ink); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--line-strong); background: transparent; border-radius: 999px; padding: 4px 12px; font-size: 14px; cursor: pointer; }
.chip:hover { background: var(--panel-2); }
.chip.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.filter { display: flex; gap: 10px; align-items: baseline; }
.flabel { flex: 0 0 auto; min-width: 84px; font-size: 13px; color: var(--muted); }
.fhint { font-size: 13px; color: var(--faint); margin: -4px 0 0 94px; }
.chip.more { border-style: dashed; color: var(--muted); }
.older { font-size: 14px; color: var(--muted); display: flex; gap: 8px; align-items: center; cursor: pointer; }

.count { font-size: 14px; margin: 18px 0 8px; }
.table-card { overflow: hidden; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12px; font-weight: 500; color: var(--muted); padding: 12px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: color-mix(in srgb, var(--panel-2) 55%, transparent); }
.num { text-align: right; font-family: var(--f-mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
th.num { font-family: var(--f-body); }
.model b { display: block; font-weight: 600; }
.model code { font-family: var(--f-mono); font-size: 12px; color: var(--faint); word-break: break-all; }
.badges { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 4px; }
.badge { font-size: 11px; color: var(--muted); background: var(--panel-2); border-radius: 999px; padding: 1px 8px; }
.lab { white-space: nowrap; color: var(--muted); font-size: 14px; }
.job { min-width: 150px; }
.cost { font-family: var(--f-mono); font-variant-numeric: tabular-nums; font-weight: 500; }
.bar { display: block; height: 4px; border-radius: 4px; background: var(--bar-track); margin-top: 6px; overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 4px; background: var(--bar); }
.plat { font-size: 14px; }
.pname { display: block; font-weight: 500; white-space: nowrap; }
.quant { font-family: var(--f-mono); font-size: 11px; color: var(--muted); font-weight: 400; }
.cmp { margin-top: 4px; border: 0; background: none; padding: 0; color: var(--accent); font-size: 13px; cursor: pointer; text-align: left; }
.cmp:hover { text-decoration: underline; }
.cmp::after { content: ' ▾'; font-size: 10px; }
.mrow.is-open .cmp::after { content: ' ▴'; }
.mrow.is-open td { border-bottom-color: transparent; }
tr.compare > td { padding: 0 14px 16px; background: none !important; }
.cmp-panel { background: var(--panel-2); border-radius: 14px; padding: 14px 16px; }
.cmp-panel h3 { margin: 0 0 8px; font-size: 14px; font-weight: 600; }
.ctable th, .ctable td { padding: 7px 10px; background: none; font-size: 14px; }
.ctable th { font-size: 11px; position: static; }
.ctable tbody tr:hover td { background: none; }
.ctable tr.best td { font-weight: 500; }
.ctable tr.out td { opacity: 0.45; }
.ctable .job { min-width: 120px; }
.cplat { white-space: nowrap; }
.vs { white-space: nowrap; color: var(--muted); font-size: 13px; }
.tag.good { color: var(--good); background: var(--good-soft); border-radius: 999px; padding: 1px 8px; font-size: 12px; font-weight: 500; }
.tag { display: inline-block; border-radius: 999px; padding: 0 7px; font-size: 11px; font-weight: 500; vertical-align: 1px; white-space: nowrap; }
.tag.off { color: var(--accent); background: var(--accent-soft); }
.tag.warn { color: var(--wait); background: var(--wait-soft); cursor: help; }
.offref { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }
.chg { display: inline-block; margin-left: 8px; font-size: 12px; font-weight: 500; white-space: nowrap; }
.chg.down { color: var(--good); }
.chg.up { color: var(--bad); }
td .chg[title] { cursor: help; }
.hist { font-size: 12px; white-space: nowrap; }
.hist .chg { margin-left: 0; }
/* Per-platform price history: one bar per recorded price point, newest last. */
.hbars { display: inline-flex; align-items: flex-end; gap: 2px; height: 20px; margin-right: 8px; vertical-align: -4px; }
.hbars i { display: block; width: 4px; min-height: 2px; border-radius: 2px; background: var(--faint); opacity: 0.55; }
.hbars i.last { background: var(--bar); opacity: 1; }
/* Discontinued models: dimmed but readable, tagged in the platform column. */
.mrow.gone td { opacity: 0.6; }
.mrow.gone td.plat { opacity: 0.85; }
.tag.disc { color: var(--muted); background: var(--panel-2); cursor: help; }
.sources { margin-top: 10px; font-size: 13px; color: var(--muted); }
.cnote { margin-top: 8px; font-size: 12px; color: var(--muted); }

.log, .method { margin-top: 28px; padding: 24px; }
.log h2, .method h2 { font-size: 20px; }
.log .hint { margin-bottom: 10px; }
.ltable td, .ltable th { padding: 9px 10px; font-size: 14px; }
.ltable th { font-size: 11px; }
.ltable .when { white-space: nowrap; color: var(--muted); font-size: 13px; }
.ltable s { color: var(--faint); }
.ltable .chg { margin-left: 0; }
.log .linkbtn { margin-top: 10px; }
.method dl { margin: 12px 0 0; display: grid; gap: 14px; }
.method dl > div { display: grid; grid-template-columns: 200px 1fr; gap: 16px; }
.method dt { font-weight: 600; }
.method dd { margin: 0; color: var(--muted); }
.method dd b { color: var(--ink); font-weight: 500; }
.foot { margin: 28px 0 56px; color: var(--muted); font-size: 13px; display: grid; gap: 8px; max-width: 760px; }

/* Phones: each model becomes a small card. */
@media (max-width: 760px) {
  .hero { padding: 32px 0 20px; }
  .lede { font-size: 16px; }
  .workload { padding: 20px 16px; }
  .preset { flex: 1 1 calc(50% - 8px); }
  .custom label { flex: 1 1 120px; }
  .custom input { width: 100%; }
  .sort { flex: 1 1 100%; }
  .sort select { flex: 1; }
  .table-card { background: transparent; box-shadow: none; overflow: visible; }
  table, tbody, tr, td { display: block; }
  thead { display: none; }
  tbody { display: grid; gap: 10px; }
  tr { background: var(--panel); border-radius: 16px; box-shadow: var(--shadow); padding: 14px 16px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px 12px; }
  tbody tr:hover td { background: none; }
  td { border: 0; padding: 0; }
  td.model { grid-column: 1 / -1; }
  td.lab { grid-column: 1 / -1; order: -1; font-size: 12px; }
  td.num, td.date { text-align: left; }
  td[data-label]:not(.model):not(.lab)::before { content: attr(data-label); display: block; font-family: var(--f-body); font-size: 11px; color: var(--faint); }
  .filter { flex-direction: column; gap: 6px; }
  .trust { padding: 12px 14px; }
  .log, .method { padding: 20px 16px; }
  .method dl > div { grid-template-columns: 1fr; gap: 2px; }
  .ltable tr { grid-template-columns: 1fr 1fr; }
  .ltable td.when { grid-column: 1 / -1; order: -1; }
  .ltable td.when::before { display: none !important; }
  .hist { white-space: normal; }
  .ctable td.hist { grid-column: 1 / -1; }
  .ltable tbody { gap: 8px; }
  .ltable tr { background: var(--panel-2); box-shadow: none; padding: 10px 12px; border-radius: 12px; gap: 6px 12px; }
  .fhint { margin: -4px 0 0; }
  td.plat { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
  td.plat::before { display: none !important; }
  td.plat .cmp { margin: 0; }
  tr.compare { display: block; padding: 0; background: none; box-shadow: none; margin-top: -6px; }
  tr.compare > td { padding: 0; }
  .cmp-panel { padding: 12px; }
  .ctable thead { display: none; }
  .ctable tbody { display: grid; gap: 8px; }
  .ctable tr { background: var(--panel); box-shadow: none; padding: 10px 12px; border-radius: 12px; grid-template-columns: repeat(3, 1fr); gap: 6px 10px; }
  .ctable td { padding: 0; }
  .ctable td.cplat { grid-column: 1 / span 2; font-weight: 600; }
  .ctable td.vs { text-align: right; }
  .ctable td.cplat::before, .ctable td.vs::before { display: none !important; }
  .ctable td.vs { order: -1; grid-column: 3; grid-row: 1; }
  .ctable td.job { border-top: 0; padding-top: 0; }
  td.job { order: 1; grid-column: 1 / -1; min-width: 0; padding-top: 10px; border-top: 1px solid var(--line); }
  td.job .cost { font-size: 16px; }
}
