/* Macro X CPS test. Uses the main site's tokens (black, system type, #0A84FF). */
:root {
  --bg: #000;
  --sf: rgba(255, 255, 255, .045);
  --sf2: rgba(255, 255, 255, .07);
  --ln: rgba(255, 255, 255, .09);
  --ln2: rgba(255, 255, 255, .14);
  --tx: #F5F5F7;
  --mu: #A1A1A6;
  --dim: #86868B;
  --acc: #0A84FF;
  --red: #FF453A;
  --amber: #C2850E;
  --green: #30D158;
  --orange: #FF9F0A;
  --ease: cubic-bezier(.22, 1, .36, 1);
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Segoe UI Variable Display", "Segoe UI", system-ui, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; background: var(--bg); }
body {
  margin: 0; background: var(--bg); color: var(--tx); font-family: var(--sans);
  font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; overflow-x: clip;
}
a { color: var(--tx); }
a:hover { color: #fff; }
button, input { font: inherit; color: inherit; }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; border-radius: 8px; }
.sr { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.num { font-variant-numeric: tabular-nums; }
.mu { color: var(--mu); }
.k { color: var(--mu); font-size: 13px; }
.h { letter-spacing: -0.035em; font-weight: 700; }
[hidden] { display: none !important; }

/* ---------- nav (same as the main site) ---------- */
.nav {
  position: sticky; top: 0; z-index: 20; border-bottom: 1px solid var(--ln);
  background: rgba(0, 0, 0, .6);
  -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
}
.nav-in { max-width: 1080px; margin: 0 auto; padding: 0 22px; height: 52px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.nav nav { display: flex; align-items: center; gap: 28px; }
.brand { display: flex; align-items: center; gap: 9px; text-decoration: none; font-weight: 600; font-size: 16px; letter-spacing: -0.01em; color: var(--tx); }
.brand img { width: 28px; height: 28px; border-radius: 7px; display: block; }
.brand-sm { font-size: 12px; font-weight: 500; gap: 8px; color: var(--dim); }
.brand-sm img { width: 20px; height: 20px; border-radius: 5px; }
.nav-a { color: var(--mu); text-decoration: none; font-size: 13px; font-weight: 500; padding: 12px 2px; transition: color .25s var(--ease); }
.nav-a:hover, .nav-on { color: var(--tx); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 22px; border-radius: 999px; font-weight: 600; font-size: 15px; text-decoration: none; transition: transform .4s var(--ease), box-shadow .4s var(--ease); }
.btn-p { background: var(--acc); color: #fff; }
.btn-p:hover { color: #fff; transform: translateY(-1px); box-shadow: 0 8px 30px -8px var(--acc); }
.btn-sm { min-height: 32px; padding: 0 14px; font-size: 13px; }

/* ---------- page ---------- */
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 22px 40px; }
.intro { padding: 72px 0 34px; display: flex; flex-direction: column; gap: 12px; max-width: 760px; }
.eyebrow { font-size: 17px; font-weight: 600; color: var(--acc); letter-spacing: -0.01em; }
.intro h1 { margin: 0; font-size: 56px; line-height: 1.05; }
.intro p { margin: 4px 0 0; color: var(--mu); font-size: 19px; line-height: 1.5; max-width: 640px; }

/* ---------- controls ---------- */
.controls { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 12px; }
.grow { flex: 1; }
.seg { display: inline-flex; flex-wrap: wrap; padding: 3px; border-radius: 10px; background: rgba(255, 255, 255, .07); border: 1px solid var(--ln); gap: 2px; }
.seg-b { min-height: 36px; padding: 0 14px; border-radius: 8px; border: 0; background: transparent; color: var(--mu); font-size: 13px; font-weight: 500; cursor: pointer; transition: color .3s var(--ease), background .3s var(--ease); }
.seg-b:hover { color: var(--tx); }
.seg-on { background: rgba(255, 255, 255, .14); color: var(--tx); box-shadow: 0 1px 3px rgba(0, 0, 0, .4); }
.custom { display: inline-flex; gap: 6px; align-items: center; }
.custom input { width: 96px; min-height: 36px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--ln2); background: rgba(255, 255, 255, .05); text-align: center; font-variant-numeric: tabular-nums; }
.custom input:focus-visible { border-color: var(--acc); }
.ctl { min-height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--ln2); background: rgba(255, 255, 255, .05); color: var(--tx); font-size: 13px; font-weight: 500; cursor: pointer; transition: background .25s var(--ease), border-color .25s var(--ease); }
.ctl:hover { background: rgba(255, 255, 255, .1); }
.ctl-p { background: var(--acc); border-color: transparent; color: #fff; }
.ctl-p:hover { background: #2997FF; }
.ctl-stop { color: #FF6961; border-color: rgba(255, 69, 58, .45); background: transparent; }
.ctl-stop:hover { background: rgba(255, 69, 58, .12); }
.kbd { color: var(--mu); font-size: 12px; }

.statusline { display: flex; flex-wrap: wrap; gap: 6px 18px; color: var(--tx); font-size: 12px; margin-bottom: 18px; font-variant-numeric: tabular-nums; }
.st { white-space: nowrap; }
.st-l { color: var(--dim); }
.st-warn #sbTimer { color: var(--orange); }

/* ---------- stage: pad + rail ---------- */
.stage { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 18px; margin-bottom: 18px; }
.pad {
  position: relative; min-height: 400px; border-radius: 28px; overflow: hidden;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  background: radial-gradient(120% 90% at 15% 0%, #1E2A4A 0%, transparent 55%), radial-gradient(90% 80% at 100% 100%, #2A1840 0%, transparent 60%), #0B0B10;
  border: 1px solid var(--ln); cursor: pointer; touch-action: none;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent;
  contain: layout paint;
}
.pad-glow { position: absolute; inset: 0; border-radius: inherit; box-shadow: inset 0 0 0 1px rgba(10, 132, 255, .55), inset 0 0 60px rgba(10, 132, 255, .18); opacity: 0; transition: opacity .3s var(--ease); pointer-events: none; }
.pad.is-live .pad-glow { opacity: 1; }
.pad-count { font-size: 104px; font-weight: 700; letter-spacing: -0.045em; line-height: 1; font-variant-numeric: tabular-nums; pointer-events: none; }
.pad-label { font-size: 17px; color: var(--mu); pointer-events: none; }
.pad-hint { margin-top: 18px; font-size: 13px; color: var(--dim); pointer-events: none; text-align: center; padding: 0 20px; }
.pad-prog { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: rgba(255, 255, 255, .06); pointer-events: none; }
.pad-prog-fill { height: 100%; width: 100%; background: var(--acc); transform: scaleX(0); transform-origin: 0 50%; will-change: transform; }

.rail { display: flex; flex-direction: column; background: var(--sf); border: 1px solid var(--ln); border-radius: 22px; overflow: hidden; }
.rail-sec { padding: 18px 20px; }
.rail-sec + .rail-sec { border-top: 1px solid var(--ln); }
.spark { display: block; width: 100%; height: 44px; margin-bottom: 14px; }
.kv2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.kv { display: flex; flex-direction: column; gap: 2px; min-width: 0; position: relative; }
.kv .v { font-size: 26px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.15; white-space: nowrap; }
.key-line { display: inline-block; width: 12px; height: 2px; border-radius: 2px; background: var(--acc); vertical-align: middle; margin-right: 6px; position: relative; top: -1px; }
.sess { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--mu); margin-bottom: 12px; }
.sess-t { margin-left: auto; color: var(--tx); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--dim); }
.dot.is-live { background: var(--red); box-shadow: 0 0 10px rgba(255, 69, 58, .6); }
.dot.is-done { background: var(--green); }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.tag { font-size: 11px; font-weight: 500; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--ln); color: var(--dim); }
.tag.is-on { border-color: rgba(10, 132, 255, .7); color: var(--tx); background: rgba(10, 132, 255, .14); }
.verdict { display: flex; align-items: center; gap: 14px; }
.verdict-n { font-size: 44px; font-weight: 700; letter-spacing: -0.03em; line-height: 1; min-width: 2.2ch; }
.verdict-side { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; background: rgba(255, 255, 255, .07); color: var(--tx); }
.pill i { width: 7px; height: 7px; border-radius: 50%; background: var(--dim); }
.pill.lv-ok i { background: var(--green); }
.pill.lv-warn i { background: var(--orange); }
.pill.lv-bad i { background: var(--red); }
.tech { margin-top: 12px; font-size: 15px; }

/* ---------- panels & charts ---------- */
.panel { background: var(--sf); border: 1px solid var(--ln); border-radius: 22px; padding: 20px 22px 18px; margin-bottom: 18px; min-width: 0; }
.panel-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.panel-h h2, .history-h h2, .how h2 { margin: 0; font-size: 17px; font-weight: 600; letter-spacing: -0.01em; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--mu); flex-wrap: wrap; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.lk { display: inline-block; width: 14px; height: 2px; border-radius: 2px; }
.lk-acc { background: var(--acc); }
.lk-avg { background: #8E8E93; }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; }
.sw-red { background: var(--red); }
.sw-acc { background: var(--acc); }
.sw-dot { border-radius: 50%; width: 8px; height: 8px; }
.sw-ring { background: transparent; border: 2px solid var(--amber); border-radius: 50%; }
.chart { position: relative; height: 300px; border-radius: 10px; }
.chart-sm { height: 200px; }
.chart canvas { display: block; width: 100%; height: 100%; }
.tip {
  position: absolute; top: 0; left: 0; z-index: 2; pointer-events: none; min-width: 120px;
  padding: 8px 10px; border-radius: 10px; font-size: 12px; line-height: 1.45;
  background: rgba(28, 28, 30, .92); border: 1px solid var(--ln2); box-shadow: 0 10px 30px rgba(0, 0, 0, .5);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); font-variant-numeric: tabular-nums;
}
.tip b { font-weight: 600; color: var(--tx); }
.tip .t-h { color: var(--mu); margin-bottom: 2px; }
.tip .t-r { display: flex; align-items: center; gap: 7px; }
.tip .t-r i { width: 12px; height: 2px; border-radius: 2px; flex: none; }
.tip .t-r span { color: var(--mu); }
.note { margin: 10px 0 0; font-size: 12px; color: var(--mu); }

.table-view { margin-top: 14px; border-top: 1px solid var(--ln); padding-top: 12px; }
.table-view summary { cursor: pointer; font-size: 13px; color: var(--mu); }
.table-view summary:hover { color: var(--tx); }
.table-tools { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 10px 0; flex-wrap: wrap; }
.table-scroll { max-height: 260px; overflow: auto; border: 1px solid var(--ln); border-radius: 10px; }
.table-scroll table { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.table-scroll th { position: sticky; top: 0; background: #141416; text-align: left; font-weight: 600; color: var(--mu); padding: 8px 12px; border-bottom: 1px solid var(--ln); }
.table-scroll td { padding: 6px 12px; border-bottom: 1px solid rgba(255, 255, 255, .05); }
.table-scroll td:last-child, .table-scroll th:last-child { text-align: right; }
.table-scroll .empty { color: var(--dim); text-align: left !important; }

/* ---------- metrics: a spec sheet, not tiles ---------- */
.metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 34px; margin: 6px 0 24px; padding: 6px 4px 0; }
.mgroup h3 { margin: 0 0 6px; font-size: 13px; font-weight: 600; color: var(--acc); letter-spacing: -0.005em; }
.row { position: relative; display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--ln); cursor: default; border-radius: 0; }
.row .k { font-size: 14px; color: var(--mu); }
.row .v { font-size: 20px; font-weight: 600; letter-spacing: -0.015em; white-space: nowrap; }
.row:focus-visible { outline-offset: 4px; }
[data-tip]:hover::after, [data-tip]:focus-visible::after {
  content: attr(data-tip); position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 5;
  padding: 8px 10px; border-radius: 10px; font-size: 12px; font-weight: 400; line-height: 1.45; letter-spacing: 0; color: var(--tx); white-space: normal;
  background: rgba(28, 28, 30, .96); border: 1px solid var(--ln2); box-shadow: 0 10px 30px rgba(0, 0, 0, .5); pointer-events: none;
}
.kv[data-tip]:hover::after { right: -20px; }

.duo { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; }

/* ---------- history ---------- */
.history { margin-top: 30px; }
.history-h { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.history-h h2 { font-size: 24px; font-weight: 700; letter-spacing: -0.02em; }
.history-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.history-grid > .empty { grid-column: 1 / -1; margin: 0; padding: 34px 0; color: var(--dim); text-align: center; border: 1px dashed var(--ln2); border-radius: 22px; }
.card { position: relative; background: var(--sf); border: 1px solid var(--ln); border-radius: 22px; padding: 18px 20px 16px; }
.card-head { display: flex; align-items: baseline; gap: 8px; padding-right: 28px; }
.card-name { font-size: 13px; color: var(--mu); }
.card-best { font-size: 11px; font-weight: 600; color: var(--acc); border: 1px solid rgba(10, 132, 255, .6); border-radius: 999px; padding: 0 7px; }
.card-avg { margin-left: auto; font-size: 30px; font-weight: 700; letter-spacing: -0.03em; line-height: 1; }
.card-avg small { font-size: 13px; font-weight: 500; color: var(--mu); letter-spacing: 0; margin-left: 3px; }
.card-sub { font-size: 12px; color: var(--dim); margin: 6px 0 12px; }
.card-hero, .card-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px 10px; }
.card-hero { padding-bottom: 12px; border-bottom: 1px solid var(--ln); }
.card-hero div, .card-grid div { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.card-hero span, .card-grid span { font-size: 11px; color: var(--dim); }
.card-hero b { font-size: 17px; font-weight: 600; font-variant-numeric: tabular-nums; }
.card-grid b { font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card canvas { display: block; width: 100%; height: 64px; margin: 12px 0; }
.card-del { position: absolute; top: 12px; right: 12px; width: 28px; height: 28px; border-radius: 8px; border: 0; background: transparent; color: var(--dim); cursor: pointer; display: grid; place-items: center; }
.card-del:hover { color: #FF6961; background: rgba(255, 69, 58, .12); }

/* ---------- how it works & footer ---------- */
.how { margin-top: 44px; max-width: 760px; }
.how p { color: var(--mu); font-size: 15px; margin: 10px 0 0; }
.how .k { font-size: 13px; color: var(--dim); }
.foot { border-top: 1px solid var(--ln); margin-top: 40px; }
.foot-in { max-width: 1080px; margin: 0 auto; padding: 22px; display: flex; justify-content: space-between; align-items: center; gap: 16px; color: var(--dim); font-size: 12px; }

/* ---------- command menu ---------- */
.palette-bg { position: fixed; inset: 0; z-index: 100; display: flex; align-items: flex-start; justify-content: center; padding-top: 14vh; background: rgba(0, 0, 0, .55); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.palette { width: min(540px, 92vw); background: rgba(28, 28, 30, .96); border: 1px solid var(--ln2); border-radius: 16px; overflow: hidden; box-shadow: 0 30px 80px rgba(0, 0, 0, .6); }
.palette-in { width: 100%; padding: 15px 18px; border: 0; border-bottom: 1px solid var(--ln); background: transparent; font-size: 16px; }
.palette-list { max-height: 320px; overflow-y: auto; padding: 6px; }
.palette-item { padding: 10px 12px; border-radius: 10px; font-size: 14px; color: var(--mu); cursor: pointer; }
.palette-item.is-on, .palette-item:hover { background: rgba(255, 255, 255, .08); color: var(--tx); }

/* ---------- responsive ---------- */
@media (max-width: 920px) {
  .stage { grid-template-columns: minmax(0, 1fr); }
  .metrics { grid-template-columns: minmax(0, 1fr); gap: 18px; }
  .duo { grid-template-columns: minmax(0, 1fr); gap: 0; }
}
@media (max-width: 820px) {
  .hide-sm { display: none !important; }
  .intro { padding-top: 44px; }
  .intro h1 { font-size: 40px; }
  .intro p { font-size: 17px; }
  .pad { min-height: 320px; }
  .pad-count { font-size: 84px; }
}
@media (max-width: 480px) {
  .wrap { padding: 0 16px 32px; }
  .nav-in { padding: 0 16px; }
  .intro h1 { font-size: 32px; }
  .chart { height: 240px; }
  .card-hero, .card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kbd { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
