/* reflexzap.com — design system
   Dark, high-contrast aesthetic, system font stack (zero external font requests). */

:root {
  --bg: #0a0e14;
  --bg-raised: #10161f;
  --bg-inset: #070a10;
  --border: #232c38;
  --border-soft: #1a212b;
  --text: #e9edf2;
  --text-dim: #9aa8b8;
  --text-faint: #5c6a7a;
  --accent: #ffcc33;
  --accent-dim: #c99a1f;
  --accent-contrast: #1a1400;
  --danger: #ff4d5e;
  --success: #2ee66b;
  --focus: #66c2ff;
  --radius: 6px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.2), 0 2px 8px rgba(0,0,0,.18);
  --shadow-md: 0 4px 14px rgba(0,0,0,.28);
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial,
    sans-serif;
  --maxw: 1080px;
}

:root[data-theme="light"] {
  --bg: #f6f7f5;
  --bg-raised: #ffffff;
  --bg-inset: #edeeec;
  --border: #d8dbd6;
  --border-soft: #e6e8e4;
  --text: #14181a;
  --text-dim: #4b5560;
  --text-faint: #8a939c;
  --accent: #b8860b;
  --accent-dim: #96700a;
  --accent-contrast: #fffaf0;
  --focus: #0a6cbf;
  --shadow-sm: 0 1px 2px rgba(20,24,26,.06), 0 2px 8px rgba(20,24,26,.06);
  --shadow-md: 0 4px 14px rgba(20,24,26,.1);
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f6f7f5;
    --bg-raised: #ffffff;
    --bg-inset: #edeeec;
    --border: #d8dbd6;
    --border-soft: #e6e8e4;
    --text: #14181a;
    --text-dim: #4b5560;
    --text-faint: #8a939c;
    --accent: #b8860b;
    --accent-dim: #96700a;
    --accent-contrast: #fffaf0;
    --focus: #0a6cbf;
    --shadow-sm: 0 1px 2px rgba(20,24,26,.06), 0 2px 8px rgba(20,24,26,.06);
    --shadow-md: 0 4px 14px rgba(20,24,26,.1);
  }
}

* { box-sizing: border-box; }
html { color-scheme: dark light; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent);
  color: var(--accent-contrast);
  padding: 8px 12px;
  z-index: 100;
}
.skip-link:focus { left: 8px; top: 8px; }

button, select, input, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  background: var(--bg-inset);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius);
  padding: 9px 14px;
  transition: border-color .12s ease, background .12s ease, color .12s ease, transform .12s ease, box-shadow .12s ease;
}
button:hover { border-color: var(--accent-dim); color: var(--accent); }
button:focus-visible, a:focus-visible, select:focus-visible, input:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}
button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-contrast);
  font-weight: 700;
  box-shadow: var(--shadow-sm);
}
button.primary:hover { color: var(--accent-contrast); filter: brightness(1.08); transform: translateY(-1px); box-shadow: var(--shadow-md); }
button.primary:active { transform: translateY(0); }
button:disabled { opacity: .45; cursor: not-allowed; }
button.icon-btn { padding: 6px 10px; font-size: 13px; }

label { display: block; font-size: 12.5px; color: var(--text-dim); margin-bottom: 4px; }

/* ---------- layout shell ---------- */
.site-header {
  border-bottom: 1px solid var(--border-soft);
  position: sticky;
  top: 0;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(8px);
  z-index: 20;
}
.header-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.brand { display: flex; align-items: baseline; gap: 10px; }
.brand-mark {
  font-weight: 800;
  font-size: 18px;
  letter-spacing: -0.02em;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.brand-mark .bolt { color: var(--accent); }
.brand-tag { color: var(--text-faint); font-size: 12px; display: none; }
@media (min-width: 640px) { .brand-tag { display: inline; } }

.header-actions { display: flex; align-items: center; gap: 8px; }

main { max-width: var(--maxw); margin: 0 auto; padding: 24px 20px 60px; }

.container-narrow { max-width: 720px; margin: 0 auto; padding: 40px 20px 60px; }
.container-narrow h1 { font-size: 22px; }
.container-narrow h2 { font-size: 17px; margin-top: 32px; }
.container-narrow p, .container-narrow li { color: var(--text-dim); }

/* ---------- hero ---------- */
.hero { text-align: center; padding: 20px 0 28px; }
.hero h1 {
  font-size: clamp(24px, 4.2vw, 36px);
  margin: 0 0 8px;
  letter-spacing: -0.01em;
}
.hero p { color: var(--text-dim); margin: 0; font-size: 14.5px; }
.hero .trust-line {
  margin-top: 10px;
  font-size: 12.5px;
  color: var(--text-faint);
}
.hero .trust-line .dot { color: var(--accent); margin: 0 6px; }

/* ---------- panel shell ---------- */
.panel {
  background: var(--bg-raised);
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  padding: 18px;
  box-shadow: var(--shadow-sm);
}
.panel h2 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-faint);
  margin: 0 0 14px;
}
.panel + .panel { margin-top: 16px; }
.panel-narrow { max-width: 640px; margin: 24px auto 0; }

.panel-enter { animation: panelEnter .4s ease-out; }
@keyframes panelEnter {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.btn-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; justify-content: center; }

/* ---------- reaction test stage ---------- */
.stage-wrap {
  max-width: 640px;
  margin: 0 auto;
}
.round-status {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12.5px;
  color: var(--text-faint);
  margin-bottom: 10px;
  min-height: 18px;
}
.round-status .best-chip {
  color: var(--text-dim);
}
.round-status .best-chip strong { color: var(--accent); font-variant-numeric: tabular-nums; }

.test-stage {
  --stage-bg: var(--bg-inset);
  --stage-fg: var(--text);
  position: relative;
  background: var(--stage-bg);
  color: var(--stage-fg);
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  min-height: 320px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 32px 20px;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  transition: background-color .15s ease-out, border-radius .2s ease;
  box-shadow: var(--shadow-sm);
}
.test-stage:focus-visible { outline: 2px solid var(--focus); outline-offset: 4px; }

/* Full-bleed active state: the wait/ready/too-soon/round-result sequence takes
   over the entire viewport so the color cue is unmissable, like a fullscreen
   traffic light rather than a small panel. */
.test-stage.is-active {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  margin: 0;
  border: none;
  border-radius: 0;
  box-shadow: none;
  z-index: 1000;
  animation: stageEnter .28s ease-out;
}
.test-stage.is-active.stage-exiting {
  animation: stageExit .22s ease-in forwards;
}
body.test-active { overflow: hidden; }

@keyframes stageEnter {
  from { opacity: 0; transform: scale(.97); }
  to { opacity: 1; transform: scale(1); }
}
@keyframes stageExit {
  from { opacity: 1; transform: scale(1); }
  to { opacity: 0; transform: scale(.97); }
}

@keyframes stageShake {
  10%, 90% { transform: translate3d(-1px, 0, 0); }
  20%, 80% { transform: translate3d(2px, 0, 0); }
  30%, 50%, 70% { transform: translate3d(-5px, 0, 0); }
  40%, 60% { transform: translate3d(5px, 0, 0); }
}
.test-stage.stage-shake { animation: stageShake .4s cubic-bezier(.36,.07,.19,.97); }
.test-stage.is-active.stage-shake { animation: stageEnter .28s ease-out, stageShake .4s cubic-bezier(.36,.07,.19,.97); }

.stage-round-pill {
  position: absolute;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: .03em;
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(0,0,0,.18);
  color: inherit;
  pointer-events: none;
  opacity: .85;
}
.test-stage:not(.is-active) .stage-round-pill { display: none; }

.stage-cancel {
  display: none;
  position: absolute;
  top: 14px;
  right: 14px;
  width: 34px;
  height: 34px;
  align-items: center;
  justify-content: center;
  padding: 0;
  border-radius: 50%;
  background: rgba(0,0,0,.18);
  border: 1px solid rgba(255,255,255,.25);
  color: inherit;
  font-size: 14px;
  line-height: 1;
}
.stage-cancel:hover { background: rgba(0,0,0,.32); }
.test-stage.is-active .stage-cancel { display: inline-flex; }

/* Each stage message (wait / ready / too soon / round result) fades and
   lifts in on entry instead of popping instantly. */
.content-anim { animation: contentIn .25s ease-out; }
@keyframes contentIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.test-stage .stage-title {
  font-size: clamp(20px, 4vw, 28px);
  font-weight: 700;
  margin: 0 0 8px;
}
.test-stage.is-active .stage-title { font-size: clamp(28px, 7vw, 56px); }
.test-stage .stage-sub {
  font-size: 14px;
  opacity: .85;
  margin: 0;
}
.test-stage.is-active .stage-sub { font-size: clamp(14px, 2.2vw, 18px); }
.test-stage .stage-time {
  font-size: clamp(40px, 9vw, 64px);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  margin: 0 0 6px;
  letter-spacing: -0.02em;
}
.test-stage.is-active .stage-time { font-size: clamp(56px, 14vw, 120px); }

.test-stage.state-idle {
  --stage-bg: var(--bg-inset);
  --stage-fg: var(--text);
}
.test-stage.state-waiting {
  --stage-bg: #d7263d;
  --stage-fg: #ffffff;
}
.test-stage.state-ready {
  --stage-bg: #13a955;
  --stage-fg: #ffffff;
}
.test-stage.state-toosoon {
  --stage-bg: #e0862e;
  --stage-fg: #1a1400;
}
.test-stage.state-result {
  --stage-bg: var(--bg-raised);
  --stage-fg: var(--text);
}
.test-stage.state-done {
  --stage-bg: var(--bg-raised);
  --stage-fg: var(--text);
  cursor: default;
}
.test-stage.state-idle:hover {
  border-color: var(--accent-dim);
  box-shadow: var(--shadow-md);
}

/* ---------- results ---------- */
.results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px;
  margin: 18px 0;
}
.stat-tile {
  background: var(--bg-inset);
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  padding: 14px;
  text-align: center;
  box-shadow: var(--shadow-sm);
}
.stat-tile .stat-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-faint);
  margin-bottom: 6px;
}
.stat-tile .stat-value {
  font-size: 24px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}
.stat-tile.highlight .stat-value { color: var(--accent); }

.rating-banner {
  text-align: center;
  padding: 14px;
  border-radius: 10px;
  background: var(--bg-inset);
  border: 1px solid var(--border-soft);
  margin: 0 0 16px;
}
.rating-banner .rating-label {
  font-size: 20px;
  font-weight: 800;
  color: var(--accent);
}
.rating-banner .rating-note {
  font-size: 12.5px;
  color: var(--text-faint);
  margin-top: 4px;
}
.rating-banner .rating-percentile {
  font-size: 13px;
  font-weight: 600;
  color: var(--success);
  margin-top: 10px;
}

/* ---------- results chart ---------- */
.chart-card {
  background: var(--bg-inset);
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  padding: 14px 10px 6px;
  margin-bottom: 16px;
}
.chart-card-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-faint);
  margin: 0 0 4px 6px;
}
.chart-svg { width: 100%; height: auto; display: block; }
.chart-bar {
  fill: var(--accent);
  opacity: .8;
  transition: opacity .15s ease;
}
.chart-bar--best { fill: var(--success); opacity: 1; }
.chart-bar-value {
  font-size: 10px;
  font-weight: 600;
  fill: var(--text-dim);
  font-variant-numeric: tabular-nums;
}
.chart-bar-label { font-size: 9.5px; fill: var(--text-faint); }
.chart-avg-line { stroke: var(--text-faint); stroke-width: 1; stroke-dasharray: 4 3; }
.chart-avg-label { font-size: 9.5px; fill: var(--text-faint); }

/* ---------- history sparkline ---------- */
.sparkline-wrap { margin: 4px 0 6px; }
.spark-svg { width: 100%; height: 44px; display: block; }
.spark-line {
  stroke: var(--accent);
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
}
.spark-dot { fill: var(--bg-raised); stroke: var(--accent-dim); stroke-width: 1.5; }
.spark-dot--current { fill: var(--accent); stroke: var(--accent); }

table.rounds-table {
  width: 100%;
  border-collapse: collapse;
  margin: 10px 0 0;
  font-size: 13.5px;
}
table.rounds-table th, table.rounds-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border-soft);
  text-align: left;
}
table.rounds-table th {
  color: var(--text-faint);
  font-weight: 600;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: .04em;
}
table.rounds-table td.num, table.rounds-table th.num { text-align: right; font-variant-numeric: tabular-nums; }

.disclaimer {
  font-size: 12px;
  color: var(--text-faint);
  margin-top: 16px;
  line-height: 1.5;
}

/* ---------- copy toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%) translateY(8px);
  background: var(--accent);
  color: var(--accent-contrast);
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 700;
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s ease, transform .15s ease;
  z-index: 50;
  box-shadow: 0 6px 20px rgba(0,0,0,.25);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- FAQ ---------- */
.faq-item { margin-bottom: 18px; }
.faq-item h3 { font-size: 14.5px; margin: 0 0 6px; color: var(--text); }
.faq-item p { margin: 0; }

/* ---------- footer ---------- */
.site-footer {
  border-top: 1px solid var(--border-soft);
  margin-top: 40px;
}
.footer-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 24px 20px 40px;
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  justify-content: space-between;
  color: var(--text-faint);
  font-size: 12.5px;
}
.footer-links { display: flex; gap: 16px; flex-wrap: wrap; }
.footer-links a { color: var(--text-dim); }

/* ---------- misc ---------- */
.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

::selection { background: var(--accent); color: var(--accent-contrast); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg-inset); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-faint); }

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .test-stage.is-active,
  .test-stage.stage-shake,
  .content-anim,
  .panel-enter {
    animation: none !important;
  }
  .test-stage, button, .stat-tile, .chart-bar {
    transition: none !important;
  }
}
