:root {
  /* surfaces */
  --bg: #fbfbfd;
  --surface: #ffffff;
  --surface-2: #f5f5f7;
  --hairline: #e6e6ea;
  --hairline-strong: #d2d2d7;

  /* ink */
  --text: #1d1d1f;
  --muted: #6e6e73;
  --faint: #a1a1a6;

  /* brand + accents */
  --accent: #6b5bff;          /* Chucklemore violet — functional accent */
  --accent-press: #574ae6;
  --accent-soft: #ece9ff;
  --grad-a: #7b61ff;
  --grad-b: #ff7a9c;

  --ok: #1f9d57;
  --warn: #c77711;
  --err: #e0484d;

  /* stimuli (gentle on a light field — no harsh afterimage) */
  --stim-red: #d8413f;
  --stim-blue: #2f6bd8;

  /* charts */
  --chart-grid: #ededf1;
  --chart-axis: #9b9ba1;
  --chart-dot: #6b5bff;
  --chart-mean: #cfcfd6;
  --chart-q-fade: #d8d2ff;
  --chart-whisker: #b9b9c0;

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05), 0 6px 18px rgba(20,20,40,0.05);
  --shadow-md: 0 2px 6px rgba(0,0,0,0.06), 0 18px 48px rgba(20,20,40,0.08);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "SF Pro Text", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.5;
}

main {
  max-width: 880px;
  margin: 0 auto;
  padding: 40px 24px 80px;
}

kbd {
  background: var(--surface);
  border: 1px solid var(--hairline-strong);
  border-bottom-width: 2px;
  border-radius: 6px;
  padding: 1px 7px;
  font-size: 0.82em;
  font-family: ui-monospace, "SF Mono", SFMono-Regular, Menlo, monospace;
  color: var(--text);
}

em { font-style: normal; color: var(--accent); }

/* ---------------- brand bar ---------------- */
.brandbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  background: rgba(251, 251, 253, 0.8);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--hairline);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
  color: var(--text);
}
.brand__mark { display: inline-flex; filter: drop-shadow(0 2px 6px rgba(123, 97, 255, 0.28)); }
.brand__name {
  font-family: "SF Pro Display", -apple-system, BlinkMacSystemFont, sans-serif;
  font-weight: 600;
  font-size: 18px;
  letter-spacing: -0.015em;
}
.brand__by { color: var(--faint); font-size: 13px; }

/* ---------------- screens ---------------- */
.screen { display: none; }
.screen.active { display: block; animation: rise 0.5s cubic-bezier(0.22, 1, 0.36, 1); }

@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---------------- hero ---------------- */
.hero { text-align: center; padding: 36px 0 30px; }
.eyebrow {
  margin: 0 0 14px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--accent);
  text-transform: uppercase;
}
.hero__title {
  font-family: "SF Pro Display", -apple-system, BlinkMacSystemFont, sans-serif;
  margin: 0;
  font-size: clamp(48px, 9vw, 80px);
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1.02;
}
.hero__lede {
  max-width: 540px;
  margin: 18px auto 0;
  font-size: 20px;
  line-height: 1.45;
  color: var(--muted);
}

/* ---------------- cards ---------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 22px;
  padding: 30px 32px;
  box-shadow: var(--shadow-sm);
}
.setup { max-width: 620px; margin: 8px auto 0; }

h2 {
  font-family: "SF Pro Display", -apple-system, sans-serif;
  margin: 0 0 20px;
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.02em;
}
h3 {
  margin: 0 0 8px;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
}

/* steps */
.steps { list-style: none; margin: 0 0 26px; padding: 0; }
.steps li {
  display: flex;
  gap: 14px;
  align-items: baseline;
  padding: 11px 0;
  border-top: 1px solid var(--hairline);
  color: var(--muted);
  font-size: 16px;
}
.steps li:first-child { border-top: none; }
.steps li strong { color: var(--text); font-weight: 600; }
.steps__n {
  flex: none;
  width: 24px; height: 24px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 13px; font-weight: 600;
  align-self: center;
}

/* setup controls */
.setup__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  padding-top: 4px;
}
.field { display: flex; align-items: center; gap: 10px; }
.field label { color: var(--muted); font-size: 15px; }
select {
  appearance: none;
  background: var(--surface-2) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path d='M1 1l5 5 5-5' fill='none' stroke='%236e6e73' stroke-width='1.6' stroke-linecap='round'/></svg>") no-repeat right 14px center;
  border: 1px solid var(--hairline-strong);
  border-radius: 12px;
  padding: 10px 38px 10px 14px;
  font-size: 15px;
  color: var(--text);
  cursor: pointer;
}
select:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.switch { display: inline-flex; align-items: center; gap: 9px; font-size: 15px; color: var(--muted); cursor: pointer; }
.switch input { width: 18px; height: 18px; accent-color: var(--accent); cursor: pointer; }

/* ---------------- buttons ---------------- */
.actions { display: flex; gap: 14px; margin-top: 28px; flex-wrap: wrap; align-items: center; }
.actions--center { justify-content: center; }

.btn {
  font: inherit;
  font-size: 16px;
  font-weight: 500;
  border-radius: 980px;
  padding: 12px 26px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.18s ease, transform 0.06s ease, box-shadow 0.18s ease;
}
.btn--primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 6px 18px rgba(107, 91, 255, 0.32);
}
.btn--primary:hover { background: var(--accent-press); }
.btn--primary:active { transform: translateY(1px); }
.btn--text {
  background: transparent;
  color: var(--accent);
  padding: 12px 14px;
}
.btn--text:hover { color: var(--accent-press); text-decoration: underline; }

/* ---------------- fineprint ---------------- */
.fineprint {
  text-align: center;
  color: var(--faint);
  font-size: 13px;
  margin: 26px 0 0;
}
.fineprint strong { color: var(--muted); font-weight: 600; }

/* ---------------- test arena ---------------- */
.test-top {
  display: flex;
  align-items: center;
  gap: 16px;
  max-width: 620px;
  margin: 16px auto 26px;
}
.badge {
  flex: none;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 5px 12px;
  border-radius: 980px;
  background: var(--accent-soft);
  color: var(--accent);
}
.badge--quiet {
  background: var(--surface-2);
  color: var(--muted);
  border: 1px solid var(--hairline);
  font-weight: 500;
}
.progress { flex: 1; height: 6px; background: var(--surface-2); border-radius: 980px; overflow: hidden; }
.progress__bar { height: 100%; width: 0%; background: var(--accent); border-radius: 980px; transition: width 0.2s linear; }

.arena {
  position: relative;
  max-width: 620px;
  height: 440px;
  margin: 0 auto;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 28px;
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  justify-content: center;
}
.fixation { position: absolute; font-size: 30px; color: #d6d6db; user-select: none; font-weight: 300; }

.stimulus {
  width: 168px;
  height: 168px;
  display: none;
  box-shadow: 0 10px 30px rgba(0,0,0,0.10);
}
.stimulus.show { display: block; }
.stimulus.shape-square { border-radius: 22px; }
.stimulus.shape-circle { border-radius: 50%; }
.stimulus.color-red { background: var(--stim-red); }
.stimulus.color-blue { background: var(--stim-blue); }

.feedback { position: absolute; bottom: 22px; font-size: 22px; font-weight: 600; }
.feedback.ok { color: var(--ok); }
.feedback.err { color: var(--err); }

.hint { text-align: center; color: var(--faint); font-size: 14px; margin-top: 18px; }

/* ---------------- countdown ---------------- */
#screen-countdown { text-align: center; padding: 110px 0; }
.countdown {
  font-family: "SF Pro Display", -apple-system, sans-serif;
  font-size: 120px;
  font-weight: 700;
  letter-spacing: -0.04em;
  color: var(--accent);
  line-height: 1;
}

/* ---------------- results ---------------- */
.results-head { text-align: center; margin-bottom: 30px; }
.results-title {
  font-family: "SF Pro Display", -apple-system, sans-serif;
  margin: 6px 0 0;
  font-size: clamp(32px, 5vw, 44px);
  font-weight: 700;
  letter-spacing: -0.03em;
}

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 22px; }
.stat {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 18px;
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
}
.stat__val {
  font-family: "SF Pro Display", -apple-system, sans-serif;
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.stat__label { font-size: 13px; font-weight: 500; color: var(--text); margin-top: 4px; }
.stat__sub { font-size: 12px; color: var(--faint); margin-top: 3px; }
.stat--good .stat__val { color: var(--ok); }
.stat--warn .stat__val { color: var(--warn); }

.charts { display: grid; gap: 18px; margin-bottom: 18px; }
.chart-card { padding: 24px 26px; }
.chart-note { font-size: 13px; color: var(--muted); margin: 0 0 14px; line-height: 1.5; }
canvas { width: 100%; height: auto; display: block; }

.interpret { margin-bottom: 22px; }
.interpret .row { display: flex; gap: 16px; padding: 14px 0; border-top: 1px solid var(--hairline); }
.interpret .row:first-of-type { border-top: none; }
.interpret .row__name { font-weight: 600; min-width: 130px; font-size: 15px; }
.interpret .row__body { color: var(--muted); font-size: 15px; line-height: 1.55; }
.interpret .row__body strong { color: var(--text); }
.interpret .row__body code {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 0.88em;
  background: var(--surface-2);
  padding: 1px 6px;
  border-radius: 5px;
}
