:root {
  --bg: #f7f7f4;
  --surface: #ffffff;
  --ink: #17191c;
  --muted: #5d636b;
  --line: #e2e2dc;
  --accent: #2f5fd0;
  --pass: #1f8a4c;
  --fail: #c2412d;
  --warn: #b7791f;
  --orig: #c2412d;
  --mask: #2f5fd0;
  --seed-ok: #1f8a4c;
  --seed-bad: #c2412d;
  --radius: 14px;
  --font: "Be Vietnam Pro", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1115;
    --surface: #171a20;
    --ink: #e8e9ec;
    --muted: #9aa1ab;
    --line: #2a2f38;
    --accent: #7ea2ff;
    --pass: #4cc382;
    --fail: #f07a66;
    --warn: #e5b34f;
    --orig: #f07a66;
    --mask: #7ea2ff;
    --seed-ok: #4cc382;
    --seed-bad: #f07a66;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0f1115;
  --surface: #171a20;
  --ink: #e8e9ec;
  --muted: #9aa1ab;
  --line: #2a2f38;
  --accent: #7ea2ff;
  --pass: #4cc382;
  --fail: #f07a66;
  --warn: #e5b34f;
  --orig: #f07a66;
  --mask: #7ea2ff;
  --seed-ok: #4cc382;
  --seed-bad: #f07a66;
  color-scheme: dark;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.6 var(--font);
  -webkit-font-smoothing: antialiased;
}

.wrap { max-width: 960px; margin: 0 auto; padding: 0 16px; }

code, .mono { font-family: var(--mono); font-size: 0.88em; }

.hero { padding: 72px 0 40px; border-bottom: 1px solid var(--line); }
.eyebrow { margin: 0 0 8px; color: var(--muted); font-size: 14px; letter-spacing: 0.02em; }
h1 { margin: 0; font-size: clamp(36px, 6vw, 56px); line-height: 1.1; letter-spacing: -0.02em; }
.lede { max-width: 680px; font-size: 19px; color: var(--ink); margin: 20px 0 28px; }
.lede strong { color: var(--fail); }

.headline { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.headline .stat {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px;
}
.headline .value { font-size: 34px; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.headline .label { color: var(--muted); font-size: 14px; margin-top: 4px; }
.headline .stat.bad .value { color: var(--fail); }
.headline .stat.good .value { color: var(--pass); }

section { padding: 48px 0 8px; }
h2 { font-size: 26px; line-height: 1.25; margin: 0 0 12px; letter-spacing: -0.01em; display: flex; gap: 12px; align-items: baseline; }
h2 .num {
  flex: none; display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%;
  background: var(--ink); color: var(--bg); font-size: 15px; font-weight: 600; transform: translateY(-3px);
}
h3 { font-size: 16px; margin: 0 0 12px; }
.intro { max-width: 720px; margin: 0 0 24px; }
.note { color: var(--muted); font-size: 14px; margin: 12px 0 0; }
.loading { padding: 48px 0; color: var(--muted); }

.clip { margin: 0 0 20px; }
.clip video { width: 100%; display: block; border-radius: var(--radius); background: #000; aspect-ratio: 3 / 1; }
.clip.chat video { aspect-ratio: 1280 / 608; background: var(--surface); border: 1px solid var(--line); }
.clip figcaption { color: var(--muted); font-size: 14px; margin-top: 8px; }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 0 0 20px; }
.stats div { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.stats dt { color: var(--muted); font-size: 13px; }
.stats dd { margin: 2px 0 0; font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; }

.chart-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin-top: 16px; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .grid line { stroke: var(--line); }
.chart text { fill: var(--muted); font: 12px var(--mono); }
.chart .line { fill: none; stroke: var(--accent); stroke-width: 2; }

.strips { display: grid; gap: 14px; }
.strip { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.strip-head { display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: baseline; margin-bottom: 10px; }
.strip-head .name { font-weight: 600; }
.strip-head .meta { color: var(--muted); font-size: 14px; }
.strip-head .score { margin-left: auto; font-weight: 700; font-variant-numeric: tabular-nums; }
.strip-head .score small { font-weight: 400; color: var(--muted); font-size: 13px; }
.seeds { display: grid; grid-template-columns: repeat(50, minmax(0, 1fr)); gap: 3px; }
.seeds i { display: block; aspect-ratio: 1; border-radius: 3px; background: var(--seed-ok); }
.seeds i.bad { background: transparent; box-shadow: inset 0 0 0 1.5px var(--seed-bad); }
.verdict { display: inline-block; font-size: 12px; font-weight: 600; padding: 1px 8px; border-radius: 99px; border: 1px solid currentColor; }
.verdict.pass { color: var(--pass); }
.verdict.warn { color: var(--warn); }
.verdict.fail { color: var(--fail); }
.strip .why { color: var(--muted); font-size: 13px; margin: 8px 0 0; }

.checks { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.checks li {
  display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 12px; align-items: start;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px;
}
.checks li.hl { border-color: var(--warn); box-shadow: 0 0 0 1px var(--warn); }
.checks .label { font-weight: 500; }
.checks .reason { color: var(--muted); font-size: 14px; overflow-wrap: anywhere; }
.pill { justify-self: start; display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 10px; border-radius: 99px; text-align: center; }
.pill.pass { background: color-mix(in srgb, var(--pass) 15%, transparent); color: var(--pass); }
.pill.warn { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); }
.pill.fail { background: color-mix(in srgb, var(--fail) 15%, transparent); color: var(--fail); }
.pill.skip { background: color-mix(in srgb, var(--muted) 15%, transparent); color: var(--muted); }

.legend { display: flex; gap: 8px 16px; align-items: center; font-size: 14px; color: var(--muted); margin-bottom: 12px; flex-wrap: wrap; }
.key { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: -8px; }
.key.orig { background: var(--orig); }
.key.mask { background: var(--mask); }
.bars { display: grid; gap: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.bar-row { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 14px; align-items: center; }
.bar-row.hl .bar-name { font-weight: 700; }
.bar-name { font-size: 14px; }
.bar-pair { display: grid; gap: 3px; }
.bar { position: relative; height: 14px; background: color-mix(in srgb, var(--muted) 12%, transparent); border-radius: 4px; }
.bar span { position: absolute; inset: 0 auto 0 0; border-radius: 4px; }
.bar.orig span { background: var(--orig); }
.bar.mask span { background: var(--mask); }
.bar b { position: absolute; left: calc(100% + 8px); top: -2px; font: 500 12px var(--mono); color: var(--muted); white-space: nowrap; }
.bar-pair { padding-right: 52px; }

.latency { display: grid; gap: 12px; }
.lat-row { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 14px; align-items: center; font-size: 14px; }
.lat-track { position: relative; height: 18px; background: color-mix(in srgb, var(--muted) 12%, transparent); border-radius: 4px; }
.lat-track span { position: absolute; inset: 0 auto 0 0; background: var(--accent); border-radius: 4px; }
.lat-track .limit { position: absolute; top: -6px; bottom: -6px; width: 2px; background: var(--fail); }
.lat-track .limit::after { content: "200 ms"; position: absolute; top: -18px; left: 4px; font: 11px var(--mono); color: var(--fail); white-space: nowrap; }
.lat-track b { position: absolute; top: 0; font: 500 12px/18px var(--mono); white-space: nowrap; }
.lat-row .na { color: var(--muted); }


.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.compare { width: 100%; border-collapse: collapse; font-size: 15px; }
.compare th, .compare td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
.compare th { color: var(--muted); font-weight: 500; font-size: 13px; }
.compare tr:last-child td { border-bottom: 0; }
.compare td.num { font-variant-numeric: tabular-nums; }
.compare .over { color: var(--fail); font-weight: 600; }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Lộ trình: hàng ngang trên màn rộng, dọc trên điện thoại. Chấm: xong (đặc), đang làm (viền nhấn), sắp tới (rỗng). */
.roadmap { padding-top: 40px; }
.timeline {
  list-style: none; margin: 8px 0 0; padding: 0; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr));
  position: relative;
}
.timeline::before {
  content: ""; position: absolute; left: 0; right: 0; top: 9px; height: 2px; background: var(--line);
}
.timeline > li { position: relative; padding: 32px 14px 0 0; }
.timeline .dot {
  position: absolute; top: 0; left: 0; width: 20px; height: 20px; border-radius: 50%;
  background: var(--bg); border: 2px solid var(--line); z-index: 2;
}
.timeline > li.done .dot { background: var(--pass); border-color: var(--pass); }
.timeline > li.done .dot::after {
  content: ""; position: absolute; left: 6px; top: 2px; width: 5px; height: 10px;
  border: solid var(--bg); border-width: 0 2px 2px 0; transform: rotate(45deg);
}
.timeline > li.current .dot { border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 22%, transparent); }
.timeline > li.current .dot::after {
  content: ""; position: absolute; inset: 4px; border-radius: 50%; background: var(--accent);
}
.timeline > li.done::after {
  content: ""; position: absolute; left: 0; right: 0; top: 9px; height: 2px; background: var(--pass); z-index: 1;
}
.timeline .date { font: 500 12px var(--mono); color: var(--muted); }
.timeline .title { font-weight: 700; font-size: 17px; line-height: 1.3; margin-top: 2px; }
.timeline .sub { font-size: 13px; color: var(--muted); }
.timeline > li.current .title { color: var(--accent); }
.timeline .now {
  display: inline-block; margin-left: 6px; font-size: 11px; font-weight: 600; color: var(--accent);
  border: 1px solid currentColor; border-radius: 99px; padding: 0 7px; vertical-align: 2px;
}
.timeline ul { margin: 8px 0 0; padding: 0 0 0 14px; font-size: 13px; color: var(--ink); }
.timeline > li.next ul { color: var(--muted); }

.phases { display: flex; gap: 4px; margin-top: 28px; }
.phase {
  flex: 1; min-width: 0; padding: 10px 14px 10px 22px; background: var(--surface); border: 1px solid var(--line);
  clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 50%, calc(100% - 12px) 100%, 0 100%, 12px 50%);
}
.phase:first-child { clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 50%, calc(100% - 12px) 100%, 0 100%); padding-left: 14px; border-radius: 10px 0 0 10px; }
.phase .name { font-weight: 600; font-size: 14px; }
.phase .detail { font-size: 12px; color: var(--muted); }
.phase.current { background: color-mix(in srgb, var(--accent) 14%, var(--surface)); }
.phase.current .name { color: var(--accent); }

.foot { padding: 48px 16px 64px; color: var(--muted); font-size: 14px; border-top: 1px solid var(--line); margin-top: 48px; }

@media (max-width: 720px) {
  .hero { padding: 48px 0 28px; }
  .lede { font-size: 17px; }
  .headline { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bar-row, .lat-row { grid-template-columns: 1fr; gap: 6px; }
  .checks li { grid-template-columns: 1fr; gap: 4px; }
  .seeds { gap: 2px; }
  .seeds i { border-radius: 2px; }
  .timeline { grid-template-columns: 1fr; gap: 18px; }
  .timeline::before { left: 9px; right: auto; top: 10px; bottom: 10px; width: 2px; height: auto; }
  .timeline > li { padding: 0 0 0 34px; }
  .timeline > li.done::after { left: 9px; right: auto; top: 10px; bottom: -28px; width: 2px; height: auto; }
  .phases { flex-direction: column; }
  .phase, .phase:first-child { clip-path: none; border-radius: 10px; padding-left: 14px; }
}
