/* ═══════════════════════════════════════════════════════════
   Brainpulse Tests — shared stylesheet
   Covers the hub (/brain-tests/), the content page of every test,
   and the full-screen overlay the test itself runs in.
   Brand tokens are identical to the main site.
   ═══════════════════════════════════════════════════════════ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --teal:      #005F6B;
  --teal-mid:  #007a8a;
  --teal-deep: #003d47;
  --teal-pale: #d4edf0;
  --teal-xs:   #eaf6f8;
  --coral:     #FF6B57;
  --coral-l:   #ff8572;
  --cream:     #F8F9F4;
  --slate:     #2C3E50;
  --slate-m:   #4a6070;
  --slate-l:   #7a90a0;

  --cat-memory: #005F6B;
  --cat-focus:  #FF6B57;
  --cat-logic:  #5B6ABF;
  --cat-speed:  #C9812E;

  --r-xl: 30px;
  --r-lg: 22px;
  --r-md: 16px;

  --shadow-card: 0 1px 2px rgba(0,95,107,.05), 0 10px 30px rgba(0,95,107,.07);
  --shadow-lift: 0 6px 14px rgba(0,95,107,.08), 0 24px 54px rgba(0,95,107,.14);
  --ease: cubic-bezier(.4,.85,.35,1);
}

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

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--slate);
  background: var(--cream);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

button { font-family: inherit; }
a { color: var(--teal); }

:focus-visible { outline: 3px solid var(--coral); outline-offset: 3px; border-radius: 6px; }
:focus:not(:focus-visible) { outline: none; }

.wrap { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 20px; }
.narrow { max-width: 720px; }

/* visually hidden but readable by screen readers and crawlers */
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ═══════════════════════════════════════════════════════════
   1. SITE CHROME
   ═══════════════════════════════════════════════════════════ */

.topbar {
  position: relative; z-index: 2;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px;
  padding-top: max(20px, env(safe-area-inset-top));
  padding-bottom: 10px;
}
.topbar-logo img { height: 30px; width: auto; display: block; }
.topbar-link {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: .82rem; font-weight: 700;
  color: var(--teal); text-decoration: none;
  background: rgba(0,95,107,.07);
  padding: 9px 16px; border-radius: 50px;
  transition: background .18s;
  white-space: nowrap;
}
.topbar-link:hover { background: rgba(0,95,107,.13); }

/* soft brand glow behind every page header */
.glowtop { position: relative; overflow-x: clip; }
.glowtop::before {
  content: '';
  position: absolute; top: -340px; left: 50%;
  width: 900px; height: 620px;
  transform: translateX(-50%);
  background: radial-gradient(closest-side, rgba(0,122,138,.16), rgba(0,122,138,0));
  pointer-events: none; z-index: 0;
}
.glowtop > * { position: relative; z-index: 1; }

/* breadcrumbs */
.crumbs { padding: 14px 0 0; font-size: .78rem; color: var(--slate-l); font-weight: 600; }
.crumbs ol { list-style: none; display: flex; flex-wrap: wrap; align-items: center; gap: 7px; }
.crumbs a { color: var(--teal); text-decoration: none; }
.crumbs a:hover { text-decoration: underline; }
.crumbs li + li::before { content: '/'; margin-right: 7px; color: rgba(0,95,107,.35); }
.crumbs [aria-current] { color: var(--slate-l); }

/* footer */
.foot {
  margin-top: 60px;
  border-top: 1px solid rgba(0,95,107,.11);
  padding: 26px 0 max(34px, env(safe-area-inset-bottom));
  font-size: .82rem; line-height: 1.7; color: var(--slate-l);
}
.foot-links { display: flex; flex-wrap: wrap; gap: 8px 20px; margin-bottom: 12px; }
.foot-links a { font-weight: 600; text-decoration: none; }
.foot-links a:hover { text-decoration: underline; }

/* ═══════════════════════════════════════════════════════════
   2. PAGE HEADER (hub and test pages share this)
   ═══════════════════════════════════════════════════════════ */

.phead { padding: 26px 0 28px; max-width: 700px; }

.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  background: #fff8f7;
  border: 1.5px solid rgba(255,107,87,.25);
  border-radius: 50px;
  padding: 6px 15px 6px 10px;
  margin-bottom: 18px;
}
.eyebrow-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--coral); flex: none;
  animation: bpPulse 2.2s ease-in-out infinite;
}
@keyframes bpPulse {
  0%, 100% { transform: scale(1);   box-shadow: 0 0 0 0 rgba(255,107,87,.5); }
  50%      { transform: scale(1.2); box-shadow: 0 0 0 5px rgba(255,107,87,0); }
}
.eyebrow-text {
  font-size: .7rem; font-weight: 700; letter-spacing: .11em;
  text-transform: uppercase; color: var(--coral);
}

h1 {
  font-family: 'DM Serif Display', Georgia, serif;
  font-weight: 400;
  font-size: clamp(2rem, 6.2vw, 3.15rem);
  line-height: 1.14;
  color: var(--teal);
  margin-bottom: 16px;
}
h1 em { font-style: italic; color: var(--coral); display: block; }

.plead {
  font-size: clamp(.97rem, 2.6vw, 1.09rem);
  line-height: 1.72; color: var(--slate-m);
  max-width: 560px;
}

/* ═══════════════════════════════════════════════════════════
   3. TEST CARD — the "pregame" block at the top of a test page
   ═══════════════════════════════════════════════════════════ */

.tcard {
  position: relative;
  background: #fff;
  border: 1px solid rgba(0,95,107,.09);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-card);
  padding: 24px 22px;
  margin-bottom: 18px;
  overflow: hidden;
}
.tcard::before {
  content: '';
  position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
  background: var(--accent, var(--teal)); opacity: .85;
}

/* compact pre-test facts: only information useful before starting */
.test-facts {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border: 1px solid rgba(0,95,107,.09);
  border-radius: var(--r-md);
  overflow: hidden;
  margin-bottom: 18px;
}
.test-facts li {
  min-width: 0;
  padding: 13px 12px 14px;
  background: linear-gradient(180deg, rgba(234,246,248,.58), rgba(255,255,255,.18));
}
.test-facts li + li { border-left: 1px solid rgba(0,95,107,.09); }
.fact-k {
  display: block;
  font-size: .62rem; font-weight: 800; letter-spacing: .12em;
  text-transform: uppercase; color: var(--slate-l);
  margin-bottom: 4px;
}
.test-facts strong {
  display: block;
  font-size: .84rem; font-weight: 700; color: var(--teal); line-height: 1.35;
}

.tcard h2 {
  font-size: .74rem; font-weight: 800; letter-spacing: .13em;
  text-transform: uppercase; color: var(--teal);
  margin-bottom: 13px;
}

/* optional numbered how-to */
.how { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.how li { display: flex; align-items: flex-start; gap: 11px; font-size: .93rem; line-height: 1.6; color: var(--slate-m); }
.how-num {
  flex: none; width: 22px; height: 22px; border-radius: 50%;
  background: var(--teal-xs); color: var(--teal);
  font-size: .71rem; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  margin-top: 1px;
}

.tcard-go { display: flex; flex-direction: column; gap: 9px; }
.tcard-best { font-size: .84rem; font-weight: 600; color: var(--slate-l); text-align: center; }
.tcard-best b { color: var(--teal); font-weight: 800; }
.tcard-note { font-size: .78rem; line-height: 1.6; color: var(--slate-l); text-align: center; }

.how-more {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid rgba(0,95,107,.09);
}
.how-more summary {
  position: relative;
  display: flex; align-items: center; gap: 10px;
  min-height: 32px;
  padding-right: 28px;
  color: var(--teal);
  cursor: pointer;
  list-style: none;
  -webkit-tap-highlight-color: transparent;
}
.how-more summary::-webkit-details-marker { display: none; }
.how-more summary::after {
  content: '';
  position: absolute; right: 4px; top: 50%;
  width: 8px; height: 8px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translateY(-68%) rotate(45deg);
  transition: transform .2s var(--ease);
}
.how-more[open] summary::after { transform: translateY(-30%) rotate(225deg); }
.how-more summary span {
  font-size: .78rem; font-weight: 800; letter-spacing: .1em;
  text-transform: uppercase;
}
.how-more summary small {
  margin-left: auto;
  font-size: .72rem; font-weight: 600; color: var(--slate-l);
}
.how-more[open] summary { margin-bottom: 14px; }

/* the page works without JS: the button says so until JS enables it */
[data-bp-start][disabled] { opacity: .5; cursor: not-allowed; }

@media (min-width: 620px) {
  .tcard { padding: 30px 30px 28px; max-width: 860px; }
  /* a full-bleed Start button looks stretched on a wide card */
  .tcard-go .btn-block { max-width: 340px; margin: 0 auto; }
}

/* ═══════════════════════════════════════════════════════════
   4. ARTICLE BODY
   ═══════════════════════════════════════════════════════════ */

.prose { max-width: 700px; padding-top: 22px; }

.prose h2 {
  font-family: 'DM Serif Display', Georgia, serif;
  font-weight: 400;
  font-size: clamp(1.42rem, 4.4vw, 1.85rem);
  line-height: 1.25;
  color: var(--teal);
  margin: 42px 0 14px;
}
.prose h2:first-child { margin-top: 8px; }
.prose h3 {
  font-size: 1.02rem; font-weight: 800; color: var(--teal);
  margin: 26px 0 9px;
}
.prose p { font-size: .98rem; line-height: 1.78; color: var(--slate-m); margin-bottom: 16px; }
.prose strong { color: var(--slate); font-weight: 700; }
.prose ul, .prose ol { margin: 0 0 18px 0; padding-left: 20px; }
.prose li { font-size: .98rem; line-height: 1.72; color: var(--slate-m); margin-bottom: 9px; }
.prose a { font-weight: 600; }

/* level / norms table */
.tbl { width: 100%; overflow-x: auto; margin: 6px 0 20px; -webkit-overflow-scrolling: touch; }
.tbl table { width: 100%; border-collapse: collapse; min-width: 380px; font-size: .9rem; }
.tbl th, .tbl td { padding: 10px 12px; text-align: left; border-bottom: 1px solid rgba(0,95,107,.1); }
.tbl th {
  font-size: .64rem; font-weight: 800; letter-spacing: .1em;
  text-transform: uppercase; color: var(--slate-l);
  background: rgba(0,95,107,.04);
}
.tbl td { color: var(--slate-m); }
.tbl td:first-child { font-weight: 700; color: var(--teal); white-space: nowrap; }

/* pull-out note */
.note {
  border-left: 3px solid var(--coral);
  background: #fff8f7;
  border-radius: 0 var(--r-md) var(--r-md) 0;
  padding: 16px 18px;
  margin: 4px 0 22px;
}
.note p { margin: 0; font-size: .92rem; line-height: 1.7; color: var(--slate-m); }
.note p + p { margin-top: 10px; }
.note-k {
  display: block;
  font-size: .64rem; font-weight: 800; letter-spacing: .12em;
  text-transform: uppercase; color: var(--coral);
  margin-bottom: 7px;
}

/* FAQ */
.faq { margin: 8px 0 6px; }
.faq details {
  border-bottom: 1px solid rgba(0,95,107,.11);
}
.faq summary {
  list-style: none;
  cursor: pointer;
  padding: 16px 34px 16px 0;
  position: relative;
  font-size: .97rem; font-weight: 700; color: var(--teal);
  line-height: 1.5;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: '';
  position: absolute; right: 6px; top: 50%;
  width: 9px; height: 9px;
  border-right: 2.2px solid var(--slate-l);
  border-bottom: 2.2px solid var(--slate-l);
  transform: translateY(-70%) rotate(45deg);
  transition: transform .2s var(--ease);
}
.faq details[open] summary::after { transform: translateY(-25%) rotate(-135deg); }
.faq .faq-a { padding: 0 0 18px; }
.faq .faq-a p { font-size: .94rem; line-height: 1.75; color: var(--slate-m); margin-bottom: 12px; }
.faq .faq-a p:last-child { margin-bottom: 0; }

/* references */
.refs { margin-top: 8px; padding-left: 20px; }
.refs li { font-size: .84rem; line-height: 1.65; color: var(--slate-l); margin-bottom: 10px; }
.refs a { color: var(--teal); }

/* disclaimer */
.disclaimer {
  margin-top: 26px;
  background: rgba(0,95,107,.05);
  border-radius: var(--r-md);
  padding: 16px 18px;
  font-size: .85rem; line-height: 1.7; color: var(--slate-m);
}
.disclaimer strong { color: var(--teal); }

/* ═══════════════════════════════════════════════════════════
   5. APP CTA
   ═══════════════════════════════════════════════════════════ */

.cta {
  margin-top: 44px;
  background: linear-gradient(135deg, #00707f 0%, #005F6B 55%, #00434e 100%);
  border-radius: var(--r-xl);
  padding: 30px 24px;
  color: #eaf6f8;
  box-shadow: 0 18px 44px rgba(0,95,107,.24);
}
.cta h2 {
  font-family: 'DM Serif Display', Georgia, serif;
  font-weight: 400;
  font-size: clamp(1.45rem, 5vw, 1.95rem);
  line-height: 1.2; color: #fff;
  margin-bottom: 12px;
}
.cta p { font-size: .95rem; line-height: 1.7; color: rgba(234,246,248,.85); margin-bottom: 20px; max-width: 480px; }
.cta-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.cta .btn-primary { box-shadow: 0 10px 26px rgba(255,107,87,.3); }
.cta .btn-light { background: rgba(255,255,255,.14); color: #fff; }
.cta .btn-light:hover { background: rgba(255,255,255,.24); }

@media (min-width: 620px) { .cta { padding: 38px 36px; } }

/* ═══════════════════════════════════════════════════════════
   6. HUB — the list of tests
   ═══════════════════════════════════════════════════════════ */

.hub-bar {
  display: flex; align-items: baseline; justify-content: space-between; gap: 14px;
  padding-bottom: 15px;
  border-bottom: 1px solid rgba(0,95,107,.11);
  margin-bottom: 20px;
}
.hub-bar h2 {
  font-size: .74rem; font-weight: 800; letter-spacing: .13em;
  text-transform: uppercase; color: var(--teal);
}
.hub-bar-count { font-size: .78rem; font-weight: 600; color: var(--slate-l); }

.ex-grid { display: grid; grid-template-columns: 1fr; gap: 14px; }

.ex-card {
  position: relative;
  display: flex; flex-direction: column; gap: 11px;
  background: #fff;
  border: 1px solid rgba(0,95,107,.08);
  border-radius: var(--r-xl);
  padding: 22px 22px 20px;
  text-decoration: none; color: inherit;
  box-shadow: var(--shadow-card);
  transition: transform .22s var(--ease), box-shadow .22s var(--ease), border-color .22s;
  overflow: hidden;
}
.ex-card::before {
  content: '';
  position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
  background: var(--accent, var(--teal)); opacity: .85;
}
.ex-card:hover, .ex-card:focus-visible {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lift);
  border-color: rgba(0,95,107,.16);
}
.ex-card:active { transform: translateY(-1px); }
.ex-card-featured {
  background: linear-gradient(145deg, #fff 0%, #fbfbff 58%, rgba(91,106,191,.075) 100%);
  border-color: rgba(91,106,191,.17);
}

.ex-card-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.ex-cat {
  display: inline-flex; align-items: center;
  font-size: .64rem; font-weight: 800; letter-spacing: .11em;
  text-transform: uppercase;
  color: var(--accent, var(--teal));
  background: rgba(0,95,107,.08);
  padding: 5px 11px; border-radius: 50px;
}
.ex-time { font-size: .74rem; font-weight: 600; color: var(--slate-l); white-space: nowrap; }

.ex-name { font-size: 1.2rem; font-weight: 700; line-height: 1.28; color: var(--teal); letter-spacing: -.01em; }
.ex-desc { font-size: .9rem; line-height: 1.62; color: var(--slate-m); }
.ex-measures { font-size: .8rem; line-height: 1.55; color: var(--slate-l); }
.ex-measures b { color: var(--slate-m); font-weight: 700; }

.ex-card-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-top: 2px; padding-top: 14px;
  border-top: 1px solid rgba(0,95,107,.08);
}
.ex-best { font-size: .8rem; font-weight: 600; color: var(--slate-l); }
.ex-best b { color: var(--teal); font-weight: 800; }
.ex-go { display: inline-flex; align-items: center; gap: 7px; font-size: .85rem; font-weight: 700; color: var(--coral); white-space: nowrap; }
.ex-go svg { width: 15px; height: 15px; transition: transform .22s var(--ease); }
.ex-card:hover .ex-go svg { transform: translateX(4px); }

@media (min-width: 700px) {
  .ex-grid { grid-template-columns: repeat(2, 1fr); gap: 18px; }
  .phead { padding: 40px 0 34px; }
}

/* ═══════════════════════════════════════════════════════════
   7. BUTTONS
   ═══════════════════════════════════════════════════════════ */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  min-height: 52px; padding: 0 26px;
  border: 0; border-radius: 50px;
  font-size: .96rem; font-weight: 700;
  text-decoration: none; cursor: pointer;
  transition: background .18s, transform .14s var(--ease), box-shadow .18s, color .18s;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: translateY(1px); }
.btn-block { width: 100%; }
.btn-primary { background: var(--coral); color: #fff; box-shadow: 0 10px 28px rgba(255,107,87,.32); }
.btn-primary:hover { background: var(--coral-l); box-shadow: 0 14px 34px rgba(255,107,87,.4); }
.btn-ghost { background: rgba(0,95,107,.07); color: var(--teal); }
.btn-ghost:hover { background: rgba(0,95,107,.13); }

/* ═══════════════════════════════════════════════════════════
   8. THE TEST OVERLAY
   The page stays where it is; the test covers it.
   ═══════════════════════════════════════════════════════════ */

body.bp-testing {
  position: fixed;
  left: 0; right: 0; width: 100%;
  overflow: hidden;
}

.bp-overlay {
  position: fixed; inset: 0; z-index: 900;
  background: #00262d;
  background-image: radial-gradient(1100px 780px at 50% -18%, #007a8a 0%, #00505c 42%, #00262d 100%);
  color: #e6f4f6;
  overscroll-behavior: none;
  animation: overlayIn .28s var(--ease) both;
}
@keyframes overlayIn { from { opacity: 0; } to { opacity: 1; } }

.play-shell {
  height: 100%;
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  display: flex; flex-direction: column; gap: 12px;
  padding: calc(10px + env(safe-area-inset-top)) 14px calc(14px + env(safe-area-inset-bottom));
}

.play-top { flex: none; display: flex; align-items: center; gap: 12px; min-height: 44px; }
.play-back {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 40px; padding: 0 15px 0 12px;
  border: 0; border-radius: 50px;
  background: rgba(255,255,255,.11); color: #e6f4f6;
  font-size: .82rem; font-weight: 700;
  text-decoration: none; cursor: pointer;
  transition: background .18s;
  -webkit-tap-highlight-color: transparent;
}
.play-back:hover { background: rgba(255,255,255,.2); }
.play-back svg { width: 15px; height: 15px; }

.play-title {
  flex: 1; min-width: 0;
  font-size: .92rem; font-weight: 700; color: rgba(255,255,255,.94);
  text-align: center;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.play-dots { display: flex; align-items: center; gap: 5px; min-width: 40px; justify-content: flex-end; }
.play-dot { width: 7px; height: 7px; border-radius: 50%; background: rgba(255,255,255,.26); transition: background .2s, transform .2s; }
.play-dot.is-done { background: var(--coral); }
.play-dot.is-now  { background: #fff; transform: scale(1.35); }
.play-counter { font-size: .8rem; font-weight: 700; color: rgba(255,255,255,.7); font-variant-numeric: tabular-nums; }

.stage {
  flex: 1; min-height: 0;
  position: relative;
  display: flex; flex-direction: column;
  background: var(--cream); color: var(--slate);
  border-radius: 28px;
  box-shadow: 0 24px 60px rgba(0,0,0,.28), inset 0 1px 0 rgba(255,255,255,.6);
  overflow: hidden;
}

.stage-play {
  flex: 1; min-height: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 20px; padding: 22px 20px;
  text-align: center;
  -webkit-user-select: none; user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.stage-status {
  flex: none; min-height: 46px;
  display: flex; align-items: center; justify-content: center;
  padding: 10px 18px;
  border-top: 1px solid rgba(0,95,107,.09);
  background: rgba(0,95,107,.035);
  font-size: .85rem; font-weight: 600; color: var(--slate-m);
  text-align: center;
}
.stage-status:empty { display: none; }

/* result panel inside the stage */
.panel {
  flex: 1; min-height: 0;
  overflow-y: auto; -webkit-overflow-scrolling: touch;
  display: flex; flex-direction: column; justify-content: flex-start;
  gap: 16px; padding: 30px 24px;
  text-align: center;
  animation: panelIn .34s var(--ease) both;
}
.panel:focus, .panel:focus-visible { outline: none; }
@keyframes panelIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.panel-title {
  font-family: 'DM Serif Display', Georgia, serif;
  font-weight: 400;
  font-size: clamp(1.6rem, 6vw, 2.1rem);
  line-height: 1.16; color: var(--teal);
}

.score { display: flex; flex-direction: column; align-items: center; gap: 4px; margin: 2px 0; }
.score-value {
  font-family: 'DM Serif Display', Georgia, serif;
  font-size: clamp(3rem, 15vw, 4.4rem);
  line-height: 1; color: var(--teal);
  font-variant-numeric: tabular-nums;
}
.score-label { font-size: .7rem; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; color: var(--slate-l); }
.score-note { font-size: .88rem; line-height: 1.6; color: var(--slate-m); max-width: 380px; margin: 0 auto; }

.record {
  align-self: center;
  display: inline-flex; align-items: center; gap: 7px;
  background: #fff3f1; border: 1.5px solid rgba(255,107,87,.3);
  color: var(--coral);
  font-size: .74rem; font-weight: 800; letter-spacing: .07em; text-transform: uppercase;
  padding: 7px 14px; border-radius: 50px;
  animation: recordPop .45s var(--ease) both;
}
@keyframes recordPop { from { opacity: 0; transform: scale(.85); } to { opacity: 1; transform: none; } }

.stats { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; margin-top: 2px; }
.stat { background: rgba(0,95,107,.06); border-radius: var(--r-md); padding: 10px 16px; min-width: 88px; }
.stat-k { display: block; font-size: .62rem; font-weight: 800; letter-spacing: .11em; text-transform: uppercase; color: var(--slate-l); margin-bottom: 3px; }
.stat-v { font-size: .98rem; font-weight: 800; color: var(--teal); font-variant-numeric: tabular-nums; }

.share-preview {
  position: relative;
  isolation: isolate;
  flex: none;
  width: 100%; max-width: 380px;
  aspect-ratio: 1.9;
  margin: 2px auto 0;
  overflow: hidden;
  border: 1px solid rgba(0,95,107,.1);
  border-radius: 20px;
  padding: 18px 20px;
  background: linear-gradient(130deg, #fff 0%, #eef8f6 62%, #d8eff0 100%);
  box-shadow: 0 12px 30px rgba(0,95,107,.11);
  text-align: left;
}
.share-preview::before,
.share-preview::after {
  content: '';
  position: absolute; z-index: -1;
  border-radius: 50%;
  pointer-events: none;
}
.share-preview::before {
  width: 190px; height: 190px; right: -70px; top: -105px;
  background: rgba(0,122,138,.11);
}
.share-preview::after {
  width: 120px; height: 120px; right: -42px; bottom: -65px;
  background: rgba(255,107,87,.12);
}
.share-brand { font-size: .77rem; font-weight: 800; margin-bottom: 16px; }
.share-brand b { color: var(--teal); }
.share-brand em { color: var(--coral); font-style: normal; }
.share-kicker { font-size: .55rem; font-weight: 800; letter-spacing: .15em; text-transform: uppercase; color: var(--slate-l); }
.share-score {
  font-family: 'DM Serif Display', Georgia, serif;
  font-size: clamp(2.1rem, 11vw, 3.25rem); line-height: 1.02; color: var(--teal);
  font-variant-numeric: tabular-nums;
}
.share-test { max-width: 78%; font-size: .78rem; font-weight: 800; line-height: 1.3; color: var(--teal); }
.share-challenge { position: absolute; left: 20px; bottom: 17px; font-size: .7rem; font-weight: 700; color: var(--slate-m); }

.share-action { width: 100%; max-width: 380px; margin: 0 auto; }
.share-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.btn-share { width: 100%; min-height: 48px; background: var(--teal); color: #fff; box-shadow: 0 9px 24px rgba(0,95,107,.22); }
.btn-share:hover { background: var(--teal-mid); box-shadow: 0 12px 28px rgba(0,95,107,.28); }
.btn-share svg, .btn-copy-link svg { width: 18px; height: 18px; flex: 0 0 auto; }
.btn-share[disabled] { opacity: .65; cursor: wait; }
.btn-copy-link { width: 100%; min-height: 48px; padding-left: 12px; padding-right: 12px; border: 1px solid rgba(0,95,107,.2); background: #fff; color: var(--teal); }
.btn-copy-link:hover { border-color: rgba(0,95,107,.42); background: var(--teal-pale); }
.share-status { margin-top: 7px; font-size: .68rem; line-height: 1.45; color: var(--slate-l); }

.actions { display: flex; flex-direction: column; gap: 10px; width: 100%; max-width: 320px; margin: 6px auto 0; }

/* ── reusable pieces a test can render into the stage ── */

.disc {
  width: min(64vw, 44vh, 280px);
  aspect-ratio: 1;
  border: 0; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.05rem; font-weight: 800; letter-spacing: .04em; color: #fff;
  cursor: pointer;
  background: var(--teal);
  box-shadow: 0 16px 40px rgba(0,95,107,.28);
  transition: background .12s, transform .12s var(--ease), box-shadow .12s;
  -webkit-tap-highlight-color: transparent;
}
.disc.is-wait { background: #93a7b1; box-shadow: 0 12px 30px rgba(44,62,80,.2); }
.disc.is-go   { background: var(--coral); box-shadow: 0 18px 46px rgba(255,107,87,.45); transform: scale(1.04); }
.disc.is-bad  { background: var(--slate); box-shadow: 0 12px 30px rgba(44,62,80,.3); }

/* --grid-gap / --tile-r are set inline by the test as the board grows,
   so the board keeps one outer size and only the tiles get smaller */
.grid { display: grid; gap: var(--grid-gap, 9px); width: min(100%, 48vh, 340px); }
.tile {
  aspect-ratio: 1;
  border: 0; border-radius: var(--tile-r, 14px);
  background: #fff;
  box-shadow: inset 0 0 0 1.5px rgba(0,95,107,.12);
  cursor: pointer;
  transition: background .16s, transform .16s var(--ease), box-shadow .16s;
  -webkit-tap-highlight-color: transparent;
}
.tile:hover { background: var(--teal-xs); }
.tile.is-lit  { background: var(--teal);     box-shadow: 0 6px 18px rgba(0,95,107,.34); transform: scale(1.04); }
.tile.is-ok   { background: var(--teal-mid); box-shadow: 0 6px 18px rgba(0,122,138,.3); }
.tile.is-miss { background: var(--coral);    box-shadow: 0 6px 18px rgba(255,107,87,.35); }
.tile[disabled] { cursor: default; }
.tile[disabled]:hover { background: #fff; }
.tile.is-lit[disabled]:hover  { background: var(--teal); }
.tile.is-ok[disabled]:hover   { background: var(--teal-mid); }
.tile.is-miss[disabled]:hover { background: var(--coral); }

/* The intro stays compact so users can reach either start path immediately. */
.reason-intro {
  width: 100%; max-width: 430px; margin: auto; gap: 16px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.reason-kicker {
  font-size: .66rem; font-weight: 800; letter-spacing: .14em;
  text-transform: uppercase; color: var(--coral);
}
.reason-demo {
  width: 100%; margin: 4px 0 8px; gap: 12px;
  display: flex; align-items: center; justify-content: center;
}
.reason-arrow { flex: none; color: rgba(0,95,107,.38); font-size: clamp(1rem, 4vw, 1.35rem); font-weight: 700; }

/* Dedicated matrix styles preserve large, readable targets without changing
   the layout of the other browser tests. */
.iq-play {
  width: 100%; max-width: 520px; margin: auto;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 13px;
}
.iq-kind {
  font-size: .64rem; font-weight: 800; letter-spacing: .13em;
  text-transform: uppercase; color: var(--coral);
}
.iq-prompt { max-width: 430px; font-size: .88rem; line-height: 1.45; font-weight: 700; color: var(--teal); }
.iq-matrix {
  display: grid; gap: 6px; padding: 7px;
  border-radius: 16px; background: rgba(0,95,107,.055);
}
.iq-matrix.is-3 {
  width: min(100%, 46vh, 420px);
  grid-template-columns: repeat(3, minmax(0, 1fr));
  box-sizing: border-box;
}
.iq-panel {
  flex: none; width: clamp(52px, 14vw, 70px); aspect-ratio: 1;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; border: 1px solid rgba(0,95,107,.15); border-radius: 13px;
  background: #fff; color: var(--teal); box-shadow: 0 4px 12px rgba(0,95,107,.06);
}
.iq-matrix.is-3 .iq-panel { width: 100%; }
.iq-panel svg { display: block; width: 100%; height: 100%; }
.iq-panel.is-missing {
  border-style: dashed; background: rgba(255,255,255,.55);
  font-family: 'DM Serif Display', Georgia, serif; font-size: 1.75rem; color: rgba(0,95,107,.42);
}
.iq-options {
  width: min(100%, 480px); display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px;
}
.iq-option {
  position: relative; min-height: clamp(86px, 18vw, 112px); display: flex; align-items: center; justify-content: center;
  border: 1.5px solid rgba(0,95,107,.13); border-radius: 15px; background: #fff;
  box-shadow: 0 4px 14px rgba(0,95,107,.06); cursor: pointer;
  transition: transform .14s var(--ease), border-color .16s, background .16s, box-shadow .16s;
  -webkit-tap-highlight-color: transparent;
}
.iq-option:hover { transform: translateY(-2px); border-color: rgba(0,95,107,.35); box-shadow: 0 8px 20px rgba(0,95,107,.11); }
.iq-option:focus-visible { outline: 3px solid rgba(255,107,87,.3); outline-offset: 2px; }
.iq-option .iq-panel { width: min(86px, 76%); border: 0; border-radius: 0; box-shadow: none; }
.iq-option-key { position: absolute; right: 7px; top: 5px; font-size: .58rem; font-weight: 800; color: rgba(0,95,107,.4); }
.iq-option.is-picked { border-color: var(--teal); background: var(--teal-xs); transform: scale(.97); }
.iq-option.is-correct { border-color: var(--teal); background: var(--teal-xs); box-shadow: 0 0 0 3px rgba(0,95,107,.1); }
.iq-option.is-wrong { border-color: var(--coral); background: #fff3f1; }
.iq-option[disabled] { cursor: default; }
.iq-option[disabled]:hover { transform: none; }
.iq-nav { width: min(100%, 480px); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.iq-nav span { font-size: .68rem; color: var(--slate-l); text-align: right; }
.iq-back {
  flex: none; padding: 7px 10px; border: 1px solid rgba(0,95,107,.15); border-radius: 10px;
  background: rgba(255,255,255,.72); color: var(--teal); font: inherit; font-size: .72rem; font-weight: 800; cursor: pointer;
}
.iq-back:hover:not(:disabled) { border-color: rgba(0,95,107,.35); background: #fff; }
.iq-back:disabled { opacity: .42; cursor: default; }
.iq-practice-note {
  width: min(100%, 430px); padding: 11px 14px; border-radius: 13px;
  background: rgba(0,95,107,.07); color: var(--slate-m); font-size: .82rem; line-height: 1.45;
}
.iq-practice-note strong { color: var(--teal); }
.iq-review {
  width: min(100%, 430px); margin: 2px auto; text-align: left;
  border: 1px solid rgba(0,95,107,.12); border-radius: 15px; background: #fff;
}
.iq-review > summary {
  padding: 13px 15px; cursor: pointer; color: var(--teal);
  font-size: .82rem; font-weight: 800; text-align: center;
}
.iq-review-list { max-height: 330px; overflow-y: auto; padding: 0 12px 12px; }
.iq-review-item { padding: 12px 3px; border-top: 1px solid rgba(0,95,107,.09); }
.iq-review-head { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 8px; font-size: .72rem; font-weight: 800; color: var(--slate-m); }
.iq-review-head .is-right { color: var(--teal); }
.iq-review-head .is-wrong { color: var(--coral); }
.iq-review-answer { display: flex; align-items: center; gap: 9px; margin-bottom: 7px; }
.iq-review-answer .iq-panel { width: 48px; }
.iq-review-answer span:last-child { font-size: .72rem; color: var(--slate-l); }
.iq-review-explanation { font-size: .76rem; line-height: 1.45; color: var(--slate-m); }
.iq-legend { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; color: var(--slate-l); font-size: .72rem; }
.iq-legend span { display: inline-flex; align-items: center; gap: 5px; }
.iq-legend i { width: 8px; height: 8px; border-radius: 50%; background: var(--teal); }
.iq-legend span:last-child i { border-radius: 2px; background: var(--coral); }
.iq-intro-actions { width: min(100%, 390px); display: flex; justify-content: center; gap: 9px; flex-wrap: wrap; }
.iq-intro-actions .btn { flex: 1 1 170px; }

/* Mobile-first readability for the visual matrices. The puzzle uses the
   available stage width; limits remain in place on larger screens. */
@media (max-width: 699px) {
  .stage-play:has(.iq-play) { padding-left: 14px; padding-right: 14px; }
  .iq-play { width: 100%; max-width: none; gap: 15px; }
  .iq-kind { font-size: .7rem; }
  .iq-prompt { max-width: none; font-size: 1rem; line-height: 1.4; }
  .iq-matrix.is-3 {
    width: min(100%, 420px);
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 7px; padding: 8px; box-sizing: border-box;
    border-radius: 19px;
  }
  .iq-matrix.is-3 .iq-panel {
    width: 100%;
    border-radius: 15px;
  }
  .iq-options { width: min(100%, 480px); gap: 9px; }
  .iq-option {
    min-height: clamp(86px, 18vw, 112px);
    border-radius: 17px;
  }
  .iq-option .iq-panel { width: min(86px, 76%); }
  .iq-option-key { top: 7px; right: 8px; font-size: .64rem; }
  .iq-nav { width: min(100%, 480px); }
  .iq-nav span { font-size: .72rem; }
}

@media (max-height: 700px) {
  .iq-play { gap: 8px; }
  .iq-panel { width: clamp(44px, 11vh, 60px); }
  .iq-matrix.is-3 { width: min(100%, 40vh); }
  .iq-matrix.is-3 .iq-panel { width: 100%; }
  .iq-option { min-height: 68px; }
  .iq-option .iq-panel { width: min(70px, 68%); }
  .iq-options { width: min(100%, 340px); gap: 6px; }
}

@media (max-height: 650px) {
  .stage-play:has(.iq-play) {
    justify-content: flex-start;
    overflow-y: auto;
    padding-top: 14px;
    padding-bottom: 14px;
  }
  .iq-play { margin: 0 auto; }
}

/* ── trail-making board ──
   Nodes are placed in percentages so the layout survives a resize;
   --node carries the pixel diameter, recomputed by the test on resize.
   The connecting line is one SVG with a 0–100 viewBox stretched over the
   board, so its points are the same percentages the nodes use. */
.stage-play.is-board { padding: 12px; gap: 8px; justify-content: stretch; }

.trail {
  position: relative;
  flex: 1; width: 100%; min-height: 0;
  color: rgba(0,95,107,.32);
}
.trail svg {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  pointer-events: none; overflow: visible;
}

.node {
  position: absolute;
  width: var(--node, 44px); height: var(--node, 44px);
  margin-left: calc(var(--node, 44px) / -2);
  margin-top:  calc(var(--node, 44px) / -2);
  border: 0; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: inherit;
  font-size: calc(var(--node, 44px) * .38);
  font-weight: 800; font-variant-numeric: tabular-nums;
  line-height: 1;
  background: #fff; color: var(--teal);
  box-shadow: inset 0 0 0 2px rgba(0,95,107,.2);
  cursor: pointer;
  transition: background .12s, color .12s, box-shadow .12s, transform .14s var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.node:hover { background: var(--teal-xs); }
.node.is-done {
  background: var(--teal); color: #fff;
  box-shadow: 0 3px 10px rgba(0,95,107,.28);
  transform: scale(.88);
}
.node.is-done:hover { background: var(--teal); }
/* only shown during the practice rounds */
.node.is-next { box-shadow: inset 0 0 0 2.5px var(--coral), 0 0 0 5px rgba(255,107,87,.15); }
.node.is-bad  { background: var(--coral); color: #fff; box-shadow: 0 3px 12px rgba(255,107,87,.4); }

/* full-board announcement between parts */
.board-say {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; padding: 20px; text-align: center;
  background: var(--cream);
}

.cue { font-family: 'DM Serif Display', Georgia, serif; font-size: clamp(1.5rem, 6vw, 2rem); line-height: 1.2; color: var(--teal); }
.cue-sub { font-size: .88rem; line-height: 1.6; color: var(--slate-m); max-width: 340px; }

/* ═══════════════════════════════════════════════════════════
   9. RESPONSIVE TAIL
   ═══════════════════════════════════════════════════════════ */

@media (min-width: 700px) {
  .play-shell { padding: 22px 20px 26px; gap: 16px; }
  .stage { border-radius: 32px; }
  .iq-matrix.is-3 { width: min(100%, 38vh, 380px); }
  .iq-options { width: min(100%, 440px); }
  .iq-option { min-height: clamp(82px, 11vh, 96px); }
  .iq-option .iq-panel { width: min(76px, 70%); }
  .actions { flex-direction: row; max-width: 440px; }
  .actions .btn { flex: 1; }
}

/* small phones: claw back side padding so a 6×6 board keeps usable tap targets */
@media (max-width: 380px) {
  .play-shell { padding-left: 10px; padding-right: 10px; }
  .stage-play { padding: 18px 12px; }
  .panel      { padding: 26px 18px; }
  .wrap       { padding: 0 16px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}
