:root {
  --brand: #26b2e6;
  --brand-ink: #0b6f96;
  --ink: #1d2430;
  --ink-2: #4a5566;
  --ink-3: #6b7685;
  --line: #e3e8ef;
  --page: #f6f8fb;
  --card: #fff;
  --stage-light: #ffffff;
  --stage-dark: #0f1a2b;
  --good: #1f8a4c;
  --bad: #b3362b;
  --partial: #9a6a00;
  --radius: 14px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: var(--page);
  line-height: 1.5;
}
* { box-sizing: border-box; }
body { margin: 0; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 20px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
h1, h2, h3 { line-height: 1.2; }
code { font-size: 0.9em; background: #eef2f7; padding: 0 4px; border-radius: 4px; }

.hero {
  background: linear-gradient(160deg, #0f1a2b 0%, #123a5a 60%, #1b6f9a 100%);
  color: #fff;
  padding: 56px 0 44px;
}
.eyebrow { text-transform: uppercase; letter-spacing: 0.12em; font-size: 0.8rem; color: #9fdcf5; margin: 0 0 8px; }
.hero h1 { font-size: clamp(2rem, 4.5vw, 3.1rem); margin: 0 0 12px; }
.lede { max-width: 760px; font-size: 1.12rem; color: #d7e7f3; margin: 0; }

.controls {
  position: sticky; top: 0; z-index: 10;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.controls-row { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; padding-top: 10px; padding-bottom: 10px; }
.seg { display: inline-flex; align-items: center; gap: 4px; background: #eef2f7; border-radius: 999px; padding: 3px; }
.seg-label { font-size: 0.8rem; color: var(--ink-3); padding: 0 8px 0 10px; }
.seg button {
  border: 0; background: transparent; font: inherit; font-size: 0.9rem; color: var(--ink-2);
  padding: 6px 14px; border-radius: 999px; cursor: pointer;
}
.seg button[aria-pressed="true"] { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12); font-weight: 600; }
.seg button:focus-visible, .jump:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.jump { margin-left: auto; font-size: 0.9rem; color: var(--brand-ink); }

.howto { max-width: 860px; margin: 28px 0 8px; color: var(--ink-2); }

.demos { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 520px), 1fr)); gap: 22px; margin: 22px 0 40px; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 18px 14px; display: flex; flex-direction: column; gap: 10px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}
.card header { display: flex; align-items: center; gap: 10px; }
.card h2 { font-size: 1.15rem; margin: 0; }
.num {
  flex: none; width: 28px; height: 28px; border-radius: 50%; background: var(--brand); color: #fff;
  display: grid; place-items: center; font-weight: 700; font-size: 0.9rem;
}
.kind { margin-left: auto; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-3); border: 1px solid var(--line); border-radius: 999px; padding: 2px 8px; }
.stage {
  border-radius: 10px; overflow: hidden; border: 1px solid var(--line);
  background: var(--stage-light);
  aspect-ratio: var(--ar, 900 / 271);
  display: grid; place-items: center;
  padding: 0;
  position: relative;
}
body[data-bg="dark"] .stage { background: var(--stage-dark); border-color: #22324a; }
.stage > img, .stage > iframe, .stage > video { width: 100%; height: 100%; display: block; border: 0; }
.stage > video { object-fit: contain; }
.stage .badge {
  position: absolute; left: 8px; bottom: 8px; font-size: 0.75rem; background: rgba(0, 0, 0, 0.65); color: #fff;
  padding: 3px 8px; border-radius: 6px;
}
.stage .badge button { font: inherit; color: #9fdcf5; background: none; border: 0; text-decoration: underline; cursor: pointer; padding: 0 0 0 6px; }
.what { margin: 0; color: var(--ink-2); }
.playing { display: block; font-size: 0.85rem; color: var(--ink-3); margin-top: 4px; }

.stats { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; align-items: center; background: #f7f9fc; border-radius: 10px; padding: 10px 12px; }
.stats .size { font-size: 1.35rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.stats .size small { display: block; font-size: 0.75rem; font-weight: 400; color: var(--ink-3); }
.stats table { border-collapse: collapse; font-size: 0.82rem; width: 100%; font-variant-numeric: tabular-nums; }
.stats th, .stats td { padding: 2px 6px; text-align: right; white-space: nowrap; }
.stats th:first-child, .stats td:first-child { text-align: left; color: var(--ink-3); font-weight: 400; }
.stats thead th { color: var(--ink-3); font-weight: 500; font-size: 0.75rem; }
.stats.extra { background: #fbf8f1; }
.stats:empty { display: none; }

.proscons { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.proscons h3 { font-size: 0.85rem; margin: 4px 0; text-transform: uppercase; letter-spacing: 0.06em; }
.proscons div:first-child h3 { color: var(--good); }
.proscons div:last-child h3 { color: var(--bad); }
.proscons ul { margin: 0; padding-left: 18px; font-size: 0.9rem; color: var(--ink-2); }
.proscons li { margin-bottom: 4px; }
@media (max-width: 560px) { .proscons { grid-template-columns: 1fr; } }
.why summary { cursor: pointer; color: var(--brand-ink); font-size: 0.9rem; }
.why p { font-size: 0.9rem; color: var(--ink-2); }

.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; margin: 0 0 28px; }
.panel h2 { margin-top: 0; }
.panel > p { max-width: 900px; color: var(--ink-2); }
.note { font-size: 0.88rem; color: var(--ink-3); }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; }
@media (max-width: 800px) { .two-col { grid-template-columns: 1fr; } }
.two-col ul { padding-left: 18px; color: var(--ink-2); }
.two-col li { margin-bottom: 8px; }

.table-scroll { overflow-x: auto; }
table.data { border-collapse: collapse; width: 100%; font-size: 0.9rem; font-variant-numeric: tabular-nums; }
table.data th, table.data td { border-bottom: 1px solid var(--line); padding: 8px 10px; text-align: left; vertical-align: top; }
table.data thead th { font-size: 0.78rem; color: var(--ink-3); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
table.data td.r { text-align: right; white-space: nowrap; }
table.compat td.y { color: var(--good); }
table.compat td.n { color: var(--bad); }
table.compat td.p { color: var(--partial); }
table.compat td::before { font-weight: 700; margin-right: 4px; }
table.compat td.y::before { content: "✓"; }
table.compat td.n::before { content: "✕"; }
table.compat td.p::before { content: "~"; }

/* size chart: shared log scale, status colours with icon + word */
.chart { display: grid; grid-template-columns: max-content minmax(140px, 1fr) minmax(0, 1.1fr); gap: 8px 14px; align-items: center; margin: 14px 0 18px; font-size: 0.88rem; }
.chart .label { color: var(--ink-2); white-space: nowrap; }
.chart .track { position: relative; }
.chart .cval { font-variant-numeric: tabular-nums; }
.chart .cvs { color: var(--ink-3); font-size: 0.82rem; }
.chart-ticks { position: relative; height: 16px; }
.chart-better { margin-bottom: -2px; }
@media (max-width: 640px) {
  .chart { grid-template-columns: 1fr; gap: 2px; }
  .chart .label { margin-top: 10px; font-weight: 600; color: var(--ink); }
  .chart > div:empty { display: none; }
}
.chart-tip {
  position: fixed; pointer-events: none; z-index: 20; background: var(--ink); color: #fff; font-size: 0.8rem;
  padding: 6px 9px; border-radius: 6px; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2); display: none;
}

.zoom-top { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 22px; align-items: start; }
@media (max-width: 800px) { .zoom-top { grid-template-columns: 1fr; } }
.overview { position: relative; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--stage-light); touch-action: none; cursor: crosshair; }
body[data-bg="dark"] .overview { background: var(--stage-dark); }
.overview img { display: block; width: 100%; user-select: none; -webkit-user-drag: none; }
.lens { position: absolute; border: 2px solid #ff4d6d; box-shadow: 0 0 0 9999px rgba(255, 255, 255, 0.25); border-radius: 3px; pointer-events: none; }
body[data-bg="dark"] .lens { box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.35); }
.zoom-controls select { font: inherit; padding: 2px 6px; margin: 0 4px; }
.hint { font-size: 0.88rem; color: var(--ink-2); }
ul.hint { padding-left: 18px; margin-top: 0; }
.zoom-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; margin-top: 20px; }
.zpanel figure { margin: 0; }
.zpanel .view { position: relative; width: 100%; aspect-ratio: 4 / 3; overflow: hidden; border-radius: 8px; border: 1px solid var(--line); background: var(--stage-light); }
.zpanel .view.dark { background: var(--stage-dark); border-color: #22324a; }
.zpanel .view > * { position: absolute; left: 0; top: 0; transform-origin: 0 0; border: 0; max-width: none; }
.zpanel .view img.px { image-rendering: pixelated; }
.zpanel figcaption { font-size: 0.82rem; color: var(--ink-2); margin-top: 6px; }
.zpanel figcaption strong { color: var(--ink); }

.foot { color: var(--ink-3); font-size: 0.85rem; padding: 10px 0 40px; }
@media (max-width: 560px) {
  .stats { grid-template-columns: 1fr; }
  .stats .size small { display: inline; margin-left: 8px; }
  .card { padding: 14px 12px 12px; }
}
.stats .size { white-space: nowrap; }

/* ---- at-a-glance size meter ---- */
:root { --light: #1b7a43; --medium: #a3620a; --heavy: #c0392b; }
.meter { background: #f7f9fc; border-radius: 10px; padding: 10px 12px 10px; }
.m-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.m-size { font-size: 1.5rem; font-weight: 750; font-variant-numeric: tabular-nums; line-height: 1.1; }
.m-label { font-size: 0.78rem; color: var(--ink-3); }
.pill { display: inline-flex; align-items: center; gap: 5px; font-size: 0.78rem; font-weight: 700; padding: 2px 9px; border-radius: 999px; color: #fff; white-space: nowrap; vertical-align: 1px; }
.pill b { font-size: 0.7em; }
.pill.light { background: var(--light); }
.pill.medium { background: var(--medium); }
.pill.heavy { background: var(--heavy); }
.better { font-size: 0.74rem; color: var(--ink-3); margin: 6px 0 3px; font-weight: 600; letter-spacing: 0.01em; }
.better span { color: var(--light); font-weight: 800; }
.better.inline { display: inline; margin: 0 0 0 6px; font-weight: 500; text-transform: none; letter-spacing: 0; }
.sbar { position: relative; height: 12px; background: #e6ebf2; border-radius: 6px; overflow: hidden; }
.sfill { height: 100%; border-radius: 0 6px 6px 0; }
.sbar.light .sfill { background: var(--light); }
.sbar.medium .sfill { background: var(--medium); }
.sbar.heavy .sfill { background: var(--heavy); }
.sbar i { position: absolute; top: 0; bottom: 0; width: 2px; background: rgba(255, 255, 255, 0.85); }
.m-ticks { position: relative; height: 15px; font-size: 0.66rem; color: var(--ink-3); margin-top: 2px; }
.m-ticks span { position: absolute; transform: translateX(-50%); white-space: nowrap; }
.m-ticks span:first-child { transform: none; }
.m-ticks span:last-child { transform: translateX(-100%); }
.m-say { margin: 6px 0 8px; font-size: 0.9rem; color: var(--ink-2); }
.m-say strong { color: var(--ink); }
.m-time { display: grid; grid-template-columns: 1fr; gap: 3px; font-size: 0.82rem; color: var(--ink-2); }
.m-time-label { font-weight: 600; color: var(--ink); }
.tbar { position: relative; height: 8px; background: #e6ebf2; border-radius: 4px; overflow: hidden; }
.tfill { height: 100%; width: 0; border-radius: 4px; }
.tfill.light { background: var(--light); }
.tfill.medium { background: var(--medium); }
.tfill.heavy { background: var(--heavy); }
.tfirst { position: absolute; top: -1px; bottom: -1px; width: 2px; background: var(--ink); opacity: 0.6; }
.m-time-val { font-variant-numeric: tabular-nums; }
.m-extra { margin-top: 12px; padding-top: 10px; border-top: 1px dashed #d5dce6; }
.legend { display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: 0.85rem; color: var(--ink-2); margin: 6px 0 4px; }
.legend-note { color: var(--ink-3); }
td.mini-cell { min-width: 210px; }
.mini { margin-bottom: 8px; }
.mini:last-child { margin-bottom: 0; }
.mini .sbar { height: 8px; margin-bottom: 4px; }
.mini-txt { font-size: 0.84rem; font-variant-numeric: tabular-nums; }
.mini-txt small { color: var(--ink-3); }
