/*
 * CPSTesting.com — "Bold Light, Emerald".
 * Layout: an always-visible navy sidebar listing every test, a light content
 * column, and a big emerald test stage with a 3D edge and a navy readout
 * circle. Sora for headings and numbers, Figtree for text. Dark mode
 * redefines tokens only.
 */
/* Self-hosted variable fonts (SIL Open Font License, see assets/fonts/), latin subset. */
@font-face { font-family: 'Figtree'; font-style: normal; font-weight: 300 900; font-display: swap; src: url(../fonts/figtree.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Figtree'; font-style: normal; font-weight: 300 900; font-display: swap; src: url(../fonts/figtree-latin-ext.woff2) format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Sora'; font-style: normal; font-weight: 100 800; font-display: swap; src: url(../fonts/sora.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Sora'; font-style: normal; font-weight: 100 800; font-display: swap; src: url(../fonts/sora-latin-ext.woff2) format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
/* Extended Latin (Polish, Turkish…) downloads only on pages that use those letters.
   Vietnamese and Arabic aren't in these fonts, so those pages use the device's own font throughout. */
:root:lang(vi), :root:lang(ar) { --display: system-ui, -apple-system, 'Segoe UI', Roboto, 'Noto Sans', 'Noto Sans Arabic', Tahoma, sans-serif; --font: var(--display); }
/* Arabic letters join up, so no letter spacing or capitals there. */
[dir="rtl"] * { letter-spacing: 0 !important; text-transform: none !important; }
/* Monospace fonts break Arabic letter joining, so the typing test uses the text font. */
:root:lang(ar) .words, :root:lang(ar) .typing-input { font-family: var(--font); }
:root {
  color-scheme: light;
  --bg: #f3f5fb;
  --surface: #ffffff;
  --surface-2: #eef1f8;
  --surface-3: #dfe4f0;
  --border: #e1e6f1;
  --text: #111733;
  --muted: #5b6283;
  --navy: #111733;
  --picked: #111733;        /* selected pill/chip; green in dark mode so it stands out */
  --navy-2: #1d2550;
  --navy-ink: #cfd5f2;
  --navy-muted: #7880a8;
  --hero: #12b886;          /* emerald: test stage, active items */
  --hero-deep: #0b8f67;     /* 3D edge under the stage */
  --hero-light: #5ff2c4;    /* accents on navy */
  --hero-btn: #0c8460;      /* emerald behind white text: deep enough to read (WCAG 4.5:1) */
  --hero-btn-edge: #08664a;
  --accent: #087a58;        /* links and buttons on light backgrounds */
  --label-accent: #087556;  /* small green labels: darker so they stay readable */
  --accent-hover: #06654a;
  --accent-ink: #ffffff;
  --accent-soft: #dcf5ec;
  --title-accent: #0e9f72;
  --good: #0f8551; --good-soft: #def5e8;
  --bad: #e0424b;  --bad-soft: #fde6e7;
  --warn: #b26a00; --warn-soft: #fff1d6;
  --footer: #111733;
  --shadow: 0 1px 2px rgba(17, 23, 51, .05), 0 10px 28px rgba(17, 23, 51, .07);
  --radius: 16px;
  --radius-sm: 10px;
  --display: 'Sora', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font: 'Figtree', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0c1020; --surface: #141a30; --surface-2: #1a2140; --surface-3: #263058; --border: #252d50;
    --text: #e9edfa; --muted: #98a1c2; --navy: #080c1c; --navy-2: #161d3f; --picked: #0c8460;
    --accent: #3fd8a3; --accent-hover: #6ee6bd; --accent-ink: #062018; --accent-soft: #10382c; --title-accent: #3fd8a3; --label-accent: #3fd8a3;
    --good: #3fd8a3; --good-soft: #0f3326; --bad: #ff6b72; --bad-soft: #3a1519; --warn: #f2b14a; --warn-soft: #3a2a0c;
    --footer: #080c1c; --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 28px rgba(0, 0, 0, .3);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0c1020; --surface: #141a30; --surface-2: #1a2140; --surface-3: #263058; --border: #252d50;
  --text: #e9edfa; --muted: #98a1c2; --navy: #080c1c; --navy-2: #161d3f; --picked: #0c8460;
  --accent: #3fd8a3; --accent-hover: #6ee6bd; --accent-ink: #062018; --accent-soft: #10382c; --title-accent: #3fd8a3; --label-accent: #3fd8a3;
  --good: #3fd8a3; --good-soft: #0f3326; --bad: #ff6b72; --bad-soft: #3a1519; --warn: #f2b14a; --warn-soft: #3a2a0c;
  --footer: #080c1c; --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 28px rgba(0, 0, 0, .3);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.6 var(--font); }
a { color: var(--accent); }
a:hover { color: var(--accent-hover); }
button { font: inherit; color: inherit; }
img { max-width: 100%; }
h1, h2, h3 { font-family: var(--display); letter-spacing: -.02em; text-wrap: balance; line-height: 1.2; }
:focus-visible { outline: 2px solid var(--hero); outline-offset: 2px; }
[hidden] { display: none !important; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: 12px; top: -60px; z-index: 100; background: var(--hero-btn); color: #fff; padding: 8px 14px; border-radius: 8px; text-decoration: none; font-weight: 700; }
.skip-link:focus { top: 12px; }
.muted { color: var(--muted); }
.text-good { color: var(--good); }
.center-text { text-align: center; }
kbd { font-family: var(--mono); font-size: .85em; padding: 1px 6px; border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 6px; background: var(--surface); color: var(--text); }

/* ---------- App shell: sidebar + main column ---------- */
.shell { display: grid; grid-template-columns: 264px minmax(0, 1fr); min-height: 100vh; }
.shell-main { min-width: 0; display: flex; flex-direction: column; }
.sidebar { position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; background: var(--navy); color: var(--navy-ink); padding: 18px 14px 28px; scrollbar-width: thin; scrollbar-color: var(--navy-2) transparent; }
.side-head { display: flex; align-items: center; justify-content: space-between; padding: 6px 8px 22px; }
.brand { display: inline-flex; align-items: center; gap: 9px; color: var(--text); text-decoration: none; font-family: var(--display); font-weight: 800; font-size: 19px; letter-spacing: -.03em; }
.brand:hover { color: inherit; }
.brand-mark { flex: none; }
.brand-tld { color: var(--muted); font-weight: 600; }
.sidebar .brand, .sidebar .brand:hover { color: #fff; font-size: 21px; }
.sidebar .brand-tld { color: var(--navy-muted); }
.sidebar .side-close { display: none; color: #fff; border-color: var(--navy-2); }
.side-group { margin-top: 6px; }
.side-label { margin: 12px 10px 6px; font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--navy-muted); }
.side-link { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 11px; color: var(--navy-ink); text-decoration: none; font-weight: 600; font-size: 14px; }
.side-link:hover { background: var(--navy-2); color: #fff; }
.side-link.active { background: var(--hero-btn); color: #fff; box-shadow: 0 6px 18px rgba(12, 132, 96, .35); }
.side-ic { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; font-size: 14px; background: var(--navy-2); flex: none; }
.side-link.active .side-ic { background: rgba(255, 255, 255, .22); }
.side-tag { margin-left: auto; font-size: 10px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; padding: 2px 7px; border-radius: 6px; background: #d63a40; color: #fff; }
.side-tools { margin-top: 14px; padding: 14px 4px 0; border-top: 1px solid var(--navy-2); display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.side-btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 10px 8px; border-radius: 11px; border: 1px solid var(--navy-2); background: var(--navy-2); color: var(--navy-ink); font: inherit; font-size: 13px; font-weight: 700; white-space: nowrap; cursor: pointer; }
.side-btn:hover { filter: brightness(1.2); }
/* Small tinted chips, one colour each, under the test list. */
.side-tools .side-btn { padding: 6px 4px; border-radius: 9px; font-size: 12px; gap: 5px; }
.side-tools .side-btn svg { width: 14px; height: 14px; }
.side-btn-theme { background: rgba(124, 92, 255, .16); border-color: rgba(124, 92, 255, .35); color: #c4b5ff; }
.side-btn-history { background: rgba(79, 123, 255, .16); border-color: rgba(79, 123, 255, .35); color: #b3c5ff; }
.side-btn-sound { background: rgba(255, 138, 61, .14); border-color: rgba(255, 138, 61, .35); color: #ffc39b; }
.side-btn-sound.is-muted { background: var(--navy-2); border-color: var(--navy-2); color: var(--navy-muted); }
.side-tools:has(> :nth-child(3)) { grid-template-columns: repeat(3, 1fr); gap: 6px; }
[data-sound-toggle] .snd-x { display: none; }
[data-sound-toggle].is-muted .snd-wave { display: none; }
[data-sound-toggle].is-muted .snd-x { display: inline; }
.drawer-backdrop { position: fixed; inset: 0; background: rgba(8, 12, 28, .5); z-index: 55; }

.topbar { display: none; position: sticky; top: 0; z-index: 40; background: color-mix(in srgb, var(--bg) 86%, transparent); backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--border); }
.topbar-inner { max-width: 1680px; margin: 0 auto; padding: 12px 24px; display: flex; align-items: center; gap: 12px; }
.topbar .menu-toggle, .topbar .topbar-brand { display: none; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.top-btn { display: inline-flex; align-items: center; gap: 7px; padding: 8px 13px; border-radius: 11px; background: var(--surface); border: 1px solid var(--border); color: var(--text); font-weight: 700; font-size: 13px; text-decoration: none; cursor: pointer; }
.top-btn:hover { border-color: var(--hero); color: var(--text); }
.top-btn.icon-only { padding: 8px 10px; }
.icon-btn { display: inline-grid; place-items: center; width: 38px; height: 38px; flex: none; background: transparent; border: 1px solid var(--border); border-radius: 10px; cursor: pointer; color: var(--text); }
.icon-btn:hover { background: var(--surface-2); }

/* ---------- Page frame ---------- */
.wrap { width: 100%; max-width: 1680px; margin: 0 auto; padding: 22px 24px 44px; flex: 1; }

/* Ad spaces: one tidy, labelled card per place, with reserved height so nothing jumps when an ad loads. */
.ad-slot { margin: 26px 0; padding: 10px 14px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); text-align: center; min-height: 130px; overflow: hidden; }
.ad-label { display: block; font-size: 10px; font-weight: 800; letter-spacing: .16em; color: var(--muted); text-transform: uppercase; margin-bottom: 8px; text-align: left; }
.tool-side .ad-slot { margin: 0; min-height: 290px; }
.content-flow .ad-slot, .content .ad-slot { margin: 28px 0; }
.ad-placeholder { display: grid; place-items: center; min-height: 96px; border: 1px dashed var(--surface-3); border-radius: 10px; color: var(--muted); font-size: 13px; font-weight: 700; background: repeating-linear-gradient(45deg, transparent 0 10px, color-mix(in srgb, var(--surface-2) 75%, transparent) 10px 20px); }
.tool-side .ad-placeholder { min-height: 250px; }
.ad-slot.ad-top { margin: 0 0 22px; min-height: 120px; } /* leaderboard above the shortcut buttons, never sticky */
.ad-top .ad-placeholder { min-height: 90px; }

/* Six big shortcut buttons at the top of test pages */
.quick-row { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; margin: 0 0 24px; }
.qbtn { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 54px; padding: 10px 12px; border-radius: 16px; color: #fff; text-decoration: none; font-family: var(--display); font-weight: 700; font-size: 14px; text-align: center; line-height: 1.2; transition: transform .1s, filter .1s; }
.qbtn:hover { color: #fff; transform: translateY(-2px); filter: brightness(1.06); }
.qbtn:active { transform: translateY(2px); }
.qbtn-ic { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; font-size: 16px; background: rgba(255, 255, 255, .22); flex: none; }
.qbtn-1 { background: var(--hero-btn); box-shadow: 0 5px 0 var(--hero-btn-edge); }
.qbtn-2 { background: #c4530c; box-shadow: 0 5px 0 #9a3f06; }
.qbtn-3 { background: #3d63f0; box-shadow: 0 5px 0 #2747c4; }
.qbtn-4 { background: #d6336c; box-shadow: 0 5px 0 #ab2350; }
.qbtn-5 { background: #7050f5; box-shadow: 0 5px 0 #5534d4; }
.qbtn-6 { background: #ffc23d; box-shadow: 0 5px 0 #d99a00; color: #111733; }
.qbtn-6:hover { color: #111733; }
.qbtn-6 .qbtn-ic { background: rgba(17, 23, 51, .12); }
.qbtn.active { outline: 3px solid var(--navy); outline-offset: 3px; }

/* ---------- Tool layout ---------- */
.tool-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 26px; align-items: start; }
.tool-main { min-width: 0; }
.tool-intro { margin-bottom: 16px; }
.tool-intro h1 { margin: 4px 0 0; font-size: clamp(30px, 4.2vw, 42px); font-weight: 800; letter-spacing: -.035em; }
.tool-intro h1 em, .page-title em { font-style: normal; color: var(--title-accent); }
.tool-sub { margin: 6px 0 0; color: var(--muted); font-size: 17px; }
.pills { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 18px; }
.pill { padding: 8px 15px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text); text-decoration: none; font-weight: 700; font-size: 14px; font-variant-numeric: tabular-nums; }
.pill:hover { border-color: var(--hero); color: var(--text); }
.pill.active { background: var(--picked); border-color: var(--picked); color: #fff; }

.tool-panel { min-width: 0; }

/* Test stage: emerald click area with a 3D edge, corner readouts and a navy readout circle */
.pad { position: relative; overflow: hidden; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; min-height: 360px; padding: 26px 16px;
  border-radius: 22px; cursor: pointer; user-select: none; -webkit-user-select: none; touch-action: manipulation; transition: box-shadow .15s, transform .08s; }
.stage { color: #fff; min-height: 430px; padding: 20px 20px 34px; justify-content: flex-start; margin-bottom: 12px;
  background: radial-gradient(rgba(255, 255, 255, .16) 1.5px, transparent 1.6px) 0 0 / 20px 20px, var(--hero);
  box-shadow: 0 12px 0 var(--hero-deep); }
.stage.stage-navy { background: radial-gradient(rgba(255, 255, 255, .08) 1.5px, transparent 1.6px) 0 0 / 20px 20px, var(--navy); box-shadow: 0 12px 0 #070a18; }
.stage:hover { box-shadow: 0 12px 0 var(--hero-deep), 0 0 0 4px color-mix(in srgb, var(--hero) 30%, transparent); }
.stage.stage-navy:hover { box-shadow: 0 12px 0 #070a18, 0 0 0 4px rgba(17, 23, 51, .2); }
.stage.running { cursor: crosshair; box-shadow: 0 12px 0 var(--hero-deep), 0 0 0 5px color-mix(in srgb, var(--hero) 45%, transparent); }
.stage:active { transform: translateY(2px); }
.pad.locked { cursor: not-allowed; }
/* Three solid stat boxes across the top of the stage */
.stat-row { position: relative; width: 100%; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; pointer-events: none; }
.sbox { border-radius: 16px; padding: 12px 10px 10px; text-align: center; color: #fff; }
.sbox b { display: block; font-family: var(--display); font-weight: 800; font-size: clamp(26px, 4vw, 40px); line-height: 1.05; letter-spacing: -.035em; font-variant-numeric: tabular-nums; }
.sbox b i { font-style: normal; }
.sbox b small { font-size: .5em; font-weight: 700; margin-left: 2px; opacity: .8; }
.sbox span { display: block; margin-top: 3px; font-size: 12px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.sbox-time  { background: var(--navy); box-shadow: 0 5px 0 #070a18; }
.sbox-rate  { background: #d43d35; box-shadow: 0 5px 0 #a92b25; }
.sbox-score { background: #3d63f0; box-shadow: 0 5px 0 #2747c4; }
/* Big, obvious click target in the middle */
.stage-center { position: relative; flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; pointer-events: none; }
.stage-icon { width: 112px; height: 112px; border-radius: 50%; display: grid; place-items: center; font-size: 52px; background: rgba(255, 255, 255, .2); box-shadow: 0 0 0 14px rgba(255, 255, 255, .08); transition: transform .08s; }
.stage.running .stage-icon { transform: scale(.94); }
.stage-progress { position: absolute; left: 0; right: 0; bottom: 0; height: 8px; background: rgba(17, 23, 51, .18); }
.stage-progress i { display: block; height: 100%; width: 100%; background: #fff; transition: width .1s linear; }
.pad-text { font-weight: 700; font-size: 15px; text-align: center; pointer-events: none; }
.stage .pad-text { display: inline-flex; align-items: center; gap: 9px; padding: 11px 22px; border-radius: 999px; background: var(--navy); color: #fff; font-size: 16px; font-weight: 800; box-shadow: 0 8px 20px rgba(17, 23, 51, .25); }
.stage .pad-text::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--hero-light); box-shadow: 0 0 0 4px rgba(95, 242, 196, .25); }
.pad.running .pad-text { opacity: .85; }
.ripple { position: absolute; width: 18px; height: 18px; margin: -9px 0 0 -9px; border-radius: 50%; background: radial-gradient(circle, rgba(255, 255, 255, .85), transparent 70%); pointer-events: none; animation: ripple .45s ease-out forwards; }
@keyframes ripple { to { transform: scale(5); opacity: 0; } }
.pad.flash { animation: flash .12s ease; }
@keyframes flash { from { filter: brightness(1.08); } }

.pad-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 8px; padding: 6px 6px 0; color: var(--muted); font-size: 16px; }
.pad-foot b { color: var(--text); font-family: var(--display); font-size: 20px; }
.pad-actions { display: flex; gap: 8px; align-items: center; }

/* Result scoreboard (replaces the stage after a timed test): dark, bold and clearly a result */
.rc-dim { position: fixed; inset: 0; z-index: 66; background: rgba(6, 9, 22, .62); backdrop-filter: blur(2px); animation: fade .2s ease; cursor: pointer; }
.result-card { position: relative; z-index: 67; scroll-margin-top: 24px; border-radius: 22px; padding: 22px clamp(16px, 4vw, 32px) 24px; margin-bottom: 12px; color: #fff;
  background: radial-gradient(rgba(255, 255, 255, .06) 1.5px, transparent 1.6px) 0 0 / 20px 20px, radial-gradient(120% 80% at 50% 0%, #1d2a6b, var(--navy) 70%);
  box-shadow: 0 12px 0 #070a18; animation: rc-pop .35s cubic-bezier(.2, 1.4, .4, 1); }
@keyframes rc-pop { from { transform: scale(.94) translateY(8px); opacity: 0; } }
.result-card:focus { outline: none; }
.result-card { max-width: 760px; margin-left: auto; margin-right: auto; }
.rc-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding-right: 56px; margin-bottom: 24px; }
.rc-kicker { padding: 5px 12px; border-radius: 999px; background: var(--hero-btn); color: #fff; font-size: 12px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.rc-test { color: rgba(255, 255, 255, .65); font-weight: 600; font-size: 14px; }
/* Solid white close button so it is easy to spot on the navy card */
.rc-close { position: absolute; top: 14px; right: 14px; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; border: 0; background: #fff; color: #111733; font-size: 20px; font-weight: 800; cursor: pointer; box-shadow: 0 4px 0 rgba(0, 0, 0, .35); transition: transform .1s, background .1s; }
.rc-close:hover { background: #d43d35; color: #fff; transform: scale(1.06); }
.rc-close:focus-visible { outline: 3px solid var(--hero-light); outline-offset: 3px; }
.rc-top { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 18px; }
.rc-icon { width: 128px; height: 128px; border-radius: 28px; display: grid; place-items: center; font-size: 98px; line-height: 1; background: linear-gradient(160deg, rgba(95, 242, 196, .28), rgba(255, 255, 255, .06)); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .16), 0 6px 0 rgba(0, 0, 0, .25); }
.rc-who { min-width: 0; }
.rc-rank-label { margin: 0; color: rgba(255, 255, 255, .6); font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: .12em; }
.rc-rank { margin: 2px 0 0; font-family: var(--display); font-weight: 800; font-size: clamp(30px, 4.6vw, 42px); letter-spacing: -.03em; line-height: 1.05; }
.rc-quote { margin: 6px 0 0; font-style: italic; font-size: 14px; color: rgba(255, 255, 255, .62); }
.rc-score { position: relative; text-align: center; padding: 17px 15px 8px; border-radius: 18px; background: var(--hero-btn); box-shadow: 0 6px 0 var(--hero-btn-edge); min-width: 150px; }
.rc-score b { display: block; font-family: var(--display); font-weight: 800; font-size: clamp(42px, 6vw, 45px); line-height: 1; letter-spacing: -.045em; font-variant-numeric: tabular-nums; }
.rc-score > span:not(.rc-best) { display: block; margin-top: 4px; font-size: 12px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.rc-sub { display: block; margin-top: 6px; padding-top: 6px; border-top: 1px solid rgba(255, 255, 255, .25); font-size: 12px; font-weight: 600; }
.rc-best { position: absolute; top: -12px; left: 50%; transform: translateX(-50%); white-space: nowrap; padding: 3px 10px; border-radius: 999px; background: #ffd34d; color: #111733; font-weight: 800; font-size: 12px; box-shadow: 0 3px 0 #d9a400; }
.rc-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 20px; }
.rc-tile { padding: 12px 14px; border-radius: 14px; background: rgba(255, 255, 255, .07); border: 1px solid rgba(255, 255, 255, .1); min-width: 0; }
.rc-tile-label { display: block; font-size: 11px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: rgba(255, 255, 255, .5); margin-bottom: 4px; }
.rc-pct { margin: 0; font-weight: 700; font-size: 15px; }
.rc-pct small { color: rgba(255, 255, 255, .55); font-weight: 400; }
.rc-bar { margin: 8px 0 2px; height: 8px; border-radius: 999px; background: rgba(255, 255, 255, .12); overflow: hidden; }
.rc-bar i { display: block; min-width: 8px; height: 100%; border-radius: inherit; background: var(--hero-light); }
.rc-next-rank { margin: 0; font-family: var(--display); font-weight: 800; font-size: 18px; }
.rc-goal { margin: 2px 0 0; color: rgba(255, 255, 255, .7); font-size: 14px; }
/* Extra panel on the jitter (rhythm) and Kohi (speed per second) results. */
.rc-wide { grid-column: 1 / -1; }
.rc-chip { margin-inline-start: 6px; padding: 2px 8px; border-radius: 999px; background: rgba(95, 242, 196, .16); color: var(--hero-light); font-family: var(--font); font-size: 12px; font-weight: 700; vertical-align: middle; }
.rc-gap { margin-top: 12px; }
.rc-chart { display: flex; align-items: flex-end; gap: 2px; height: 64px; margin: 10px 0 6px; padding: 4px; border-radius: 10px; background: rgba(255, 255, 255, .05); }
.rc-chart i { flex: 1; min-width: 2px; border-radius: 3px 3px 1px 1px; background: var(--hero-light); opacity: .85; }
.rc-chart-secs { gap: 4px; }
.rc-chart i { position: relative; }
.rc-chart b { font-style: normal; position: absolute; inset: 3px 0 auto; text-align: center; font-size: 11px; font-weight: 800; color: #0b2a20; }
.rc-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 18px; }
.result-card .btn:not(.btn-accent) { background: rgba(255, 255, 255, .1); border-color: rgba(255, 255, 255, .2); color: #fff; }
.result-card .btn:not(.btn-accent):hover { background: rgba(255, 255, 255, .18); }
.rc-hint { margin: 0 0 0 auto; font-size: 12px; color: rgba(255, 255, 255, .5); }
.rc-next { margin-top: 18px; padding-top: 14px; border-top: 1px solid rgba(255, 255, 255, .12); display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.rc-next h3 { margin: 0; font-size: 11px; text-transform: uppercase; letter-spacing: .12em; color: rgba(255, 255, 255, .5); font-family: var(--font); }
.rc-next ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.rc-next a { display: inline-flex; padding: 6px 11px; border-radius: 999px; background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .12); text-decoration: none; font-weight: 700; font-size: 13px; color: #fff; }
.rc-next a:hover { background: rgba(255, 255, 255, .16); color: var(--hero-light); }
.result-card kbd { background: rgba(255, 255, 255, .1); border-color: rgba(255, 255, 255, .25); color: #fff; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 8px 16px; border-radius: 11px; background: var(--surface); border: 1px solid var(--border); font-weight: 700; font-size: 15px; cursor: pointer; text-decoration: none; color: var(--text); }
.btn:hover { border-color: var(--hero); color: var(--text); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-accent { background: var(--hero-btn); border-color: var(--hero-btn); color: #fff; box-shadow: 0 4px 0 var(--hero-btn-edge); }
.btn-accent:hover { background: var(--hero-btn); border-color: var(--hero-btn); color: #fff; filter: brightness(1.05); }
.btn-accent:active { transform: translateY(2px); box-shadow: 0 2px 0 var(--hero-btn-edge); }
.btn-ghost { background: var(--surface); }
.btn-lg { min-height: 50px; padding: 10px 22px; font-size: 16px; }

/* Side rail */
.tool-side { display: flex; flex-direction: column; gap: 16px; position: sticky; top: 84px; }
.side-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; }
.side-card h2 { margin: 0 0 10px; font-size: 15px; }
.side-note { margin: 10px 0 0; color: var(--muted); font-size: 13px; }
.side-steps { margin: 0; padding-left: 20px; color: var(--muted); font-size: 14px; display: grid; gap: 4px; }
.best-list, .next-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.best-list li { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 14px; padding: 6px 9px; border-radius: 9px; }
.best-list li.current { background: var(--accent-soft); font-weight: 700; }
.best-list a { color: var(--text); text-decoration: none; display: inline-flex; align-items: center; gap: 8px; }
.best-list a::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--dot, var(--hero)); flex: none; }
/* Each saved best gets its own soft colour pill, cycling through the shortcut-button palette */
.best-list b { font-family: var(--display); font-variant-numeric: tabular-nums; font-size: 13px; padding: 3px 10px; border-radius: 999px; color: var(--dot, var(--hero)); background: color-mix(in srgb, var(--dot, var(--hero)) 16%, transparent); }
.best-list b small { font-size: 10px; opacity: .8; }
.best-list li:nth-child(6n+1) { --dot: #12b886; }
.best-list li:nth-child(6n+2) { --dot: #ff8a3d; }
.best-list li:nth-child(6n+3) { --dot: #4f7bff; }
.best-list li:nth-child(6n+4) { --dot: #ff5d8a; }
.best-list li:nth-child(6n+5) { --dot: #7c5cff; }
.best-list li:nth-child(6n+6) { --dot: #e0a400; }
.best-list .none { color: var(--muted); }
.next-list a { display: flex; justify-content: space-between; gap: 8px; padding: 7px 8px; border-radius: 8px; text-decoration: none; color: var(--text); font-weight: 600; font-size: 14px; }
.next-list a:hover { background: var(--surface-2); color: var(--accent); }
.field-label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.select { width: 100%; padding: 9px 10px; border-radius: var(--radius-sm); background: var(--surface); border: 1px solid var(--border); color: var(--text); font: inherit; font-size: 14px; }

/* Stat tiles (reaction, typing, mouse) */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 18px; }
.stat { border-radius: 16px; padding: 12px 8px 10px; text-align: center; color: #fff; background: var(--navy); box-shadow: 0 5px 0 #070a18; }
.stat b { display: block; font-family: var(--display); font-weight: 800; font-size: clamp(24px, 3.6vw, 32px); line-height: 1.2; font-variant-numeric: tabular-nums; }
.stat span { font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.stat.g-orange, .stat.g-pink { background: #d43d35; box-shadow: 0 5px 0 #a92b25; }
.stat.g-green { background: #3d63f0; box-shadow: 0 5px 0 #2747c4; }

/* ---------- Reaction test ---------- */
.reaction-pad { min-height: 380px; padding: 30px 20px; transition: background .08s linear; }
.reaction-pad .pad-text { font-family: var(--display); font-size: clamp(22px, 3.6vw, 32px); line-height: 1.35; color: #fff; padding: 0; background: none; box-shadow: none; display: block; }
.reaction-pad .pad-text::before { display: none; }
.reaction-pad small { display: block; font-family: var(--font); font-size: 15px; font-weight: 500; opacity: .85; margin-top: 6px; }
.reaction-pad.r-wait  { background: #df3b4c; box-shadow: 0 12px 0 #a9232f; }
.reaction-pad.r-go    { background: var(--hero); box-shadow: 0 12px 0 var(--hero-deep); }
.reaction-pad.r-early { background: #4256e0; box-shadow: 0 12px 0 #2c3cad; }
.attempts { display: flex; gap: 6px; flex-wrap: wrap; }
.attempt { min-width: 62px; text-align: center; padding: 3px 8px; border-radius: 8px; background: var(--surface); border: 1px solid var(--border); font-family: var(--display); font-size: 13px; color: var(--muted); }
.attempt.done { color: var(--text); background: var(--accent-soft); border-color: transparent; }

/* ---------- Typing test ---------- */
.typing-box { position: relative; background: var(--surface); border: 2px solid var(--border); border-radius: 18px; padding: 20px; height: 180px; overflow: hidden; cursor: text; }
.typing-box.focused { border-color: var(--hero); }
.words { display: flex; flex-wrap: wrap; gap: 6px 12px; font-family: var(--mono); font-size: 22px; line-height: 40px; color: var(--muted); transition: transform .15s ease; }
.word { border-radius: 5px; padding: 0 3px; }
.word.current { background: var(--accent-soft); color: var(--text); }
.word.current.wrong { background: var(--bad-soft); }
.word.ok { color: var(--good); }
.word.bad { color: var(--bad); text-decoration: underline wavy; text-underline-offset: 6px; }
.typing-input { width: 100%; margin-top: 12px; padding: 13px 15px; border-radius: 14px; background: var(--surface); border: 2px solid var(--border); color: var(--text); font-family: var(--mono); font-size: 18px; }
.typing-input:focus { outline: none; border-color: var(--hero); }
.typing-input:disabled { opacity: .55; }
.typing-hint { color: var(--muted); font-size: 13px; margin: 8px 0 0; }

/* ---------- Mouse test ---------- */
.mouse-pad { min-height: 360px; cursor: default; padding-top: 26px; }
.mouse-stage { display: grid; justify-items: center; gap: 10px; pointer-events: none; padding: 18px 0; }
.mouse-svg { width: 150px; height: auto; }
.m-body { fill: rgba(255, 255, 255, .06); stroke: rgba(255, 255, 255, .55); stroke-width: 2.5; }
.m-part { fill: rgba(255, 255, 255, .1); stroke: rgba(255, 255, 255, .55); stroke-width: 2; transition: fill .08s; }
.m-arrow { fill: #fff; opacity: .4; transition: fill .08s, opacity .08s; }
.m-part.on, .m-arrow.on { fill: var(--hero-light); opacity: 1; }
.m-part.fault { fill: var(--bad); }
.mouse-hint { color: rgba(255, 255, 255, .85) !important; padding: 0; background: none; box-shadow: none; }
.btn-counters { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; margin-top: 12px; }
.counter { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 7px 4px; text-align: center; }
.counter b { display: block; font-family: var(--display); font-size: 20px; font-variant-numeric: tabular-nums; }
.counter span { font-size: 12px; color: var(--muted); }
.counter.fault { border-color: var(--bad); }
.counter.fault b { color: var(--bad); }
.gap-strip { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; min-height: 30px; }
.gap { font-family: var(--display); font-size: 13px; padding: 3px 9px; border-radius: 999px; background: var(--good-soft); color: var(--good); }
.gap.bad { background: var(--bad-soft); color: var(--bad); font-weight: 700; }
.empty-gaps { color: var(--muted); font-size: 14px; }
.verdict { font-weight: 700; }
.verdict.good { color: var(--good); }
.verdict.bad { color: var(--bad); }
.event-log { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-family: var(--mono); font-size: 12.5px; max-height: 300px; overflow-y: auto; }
.event-log li { padding: 5px 8px; border-radius: 6px; background: var(--surface-2); }
.event-log li.bad { color: var(--bad); }
.event-log li.empty { background: none; color: var(--muted); font-family: var(--font); }

/* ---------- Modal (history, reaction & typing results) ---------- */
.modal { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 16px; background: rgba(8, 12, 28, .55); animation: fade .15s ease; }
@keyframes fade { from { opacity: 0; } }
.modal-box { width: min(560px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; background: var(--surface); border: 1px solid var(--border); border-radius: 22px; box-shadow: var(--shadow); animation: pop .2s ease; }
@keyframes pop { from { transform: translateY(10px) scale(.98); } }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px 0 20px; }
.modal-head h2 { margin: 0; font-size: 13px; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); font-family: var(--font); }
.modal-body { padding: 16px 20px 22px; }
.result { border-radius: 18px; padding: 22px 18px; text-align: center; background: var(--surface); border: 1px solid var(--border); border-top: 8px solid var(--hero); }
.result-icon { font-size: 60px; line-height: 1; }
.result-rank-label { color: var(--muted); font-weight: 600; margin: 10px 0 0; }
.result-rank { font-family: var(--display); font-size: clamp(28px, 6vw, 38px); font-weight: 800; color: var(--title-accent); margin: 0; line-height: 1.15; }
.stars { font-size: 22px; letter-spacing: 4px; margin: 6px 0 10px; color: #f2a516; }
.stars .off { color: var(--surface-3); }
.result-main { font-size: 17px; margin: 0; }
.result-main b { font-family: var(--display); font-size: 34px; vertical-align: -3px; }
.result-sub { color: var(--muted); font-size: 14px; margin: 6px 0 0; }
.result-best { display: inline-block; margin-top: 10px; padding: 3px 12px; border-radius: 999px; background: var(--good-soft); color: var(--good); font-weight: 700; font-size: 13px; }
.result-quote { text-align: center; font-style: italic; color: var(--muted); margin: 16px 0; }
.result-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; margin-top: 14px; }
.result-grid div { background: var(--surface-2); border-radius: 10px; padding: 8px; }
.result-grid b { display: block; font-family: var(--display); font-size: 20px; }
.result-grid span { color: var(--muted); font-size: 12px; }
.result-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
/* "My scores" panel: slides in from the right, same navy scoreboard look as the result card */
.scores-backdrop { position: fixed; inset: 0; z-index: 84; background: rgba(8, 12, 28, .55); animation: fade .15s ease; }
.scores { position: fixed; top: 0; right: 0; bottom: 0; z-index: 85; width: min(470px, 100%); display: flex; flex-direction: column; color: #fff; background: radial-gradient(120% 60% at 100% 0, #23306b 0, transparent 60%), #111733; box-shadow: -20px 0 60px rgba(0, 0, 0, .35); animation: sc-in .22s ease; }
@keyframes sc-in { from { transform: translateX(40px); opacity: 0; } }
.scores-head { position: relative; padding: 22px 70px 16px 22px; }
.sc-kicker { display: inline-block; padding: 5px 12px; border-radius: 999px; background: var(--hero-btn); color: #fff; font-size: 12px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.scores-head h2 { margin: 12px 0 4px; font-size: 24px; color: #fff; letter-spacing: -.02em; }
.scores-head p { margin: 0; color: #9aa3cc; font-size: 13px; }
.sc-close { position: absolute; top: 18px; right: 18px; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; border: 1px solid rgba(255, 255, 255, .2); background: rgba(255, 255, 255, .1); color: #fff; font-size: 18px; font-weight: 700; cursor: pointer; }
.sc-close:hover { background: rgba(255, 255, 255, .2); }
.scores-body { flex: 1; overflow-y: auto; padding: 4px 22px 22px; display: flex; flex-direction: column; gap: 14px; }
.sc-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.sc-stat { border-radius: 14px; padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; }
.sc-stat b { font-family: var(--display); font-size: 24px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.sc-stat span { font-size: 11px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.c-green { background: #0c8460; box-shadow: 0 4px 0 #08664a; }
.c-coral { background: #d43d35; box-shadow: 0 4px 0 #a92b25; }
.c-blue { background: #3d63f0; box-shadow: 0 4px 0 #2747c4; }
.c-violet { background: #7050f5; box-shadow: 0 4px 0 #5534d4; }
.c-pink { background: #d6336c; box-shadow: 0 4px 0 #ab2350; }
.c-yellow { background: #ffc23d; box-shadow: 0 4px 0 #d99a00; color: #111733; }
.c-navy { background: #2a3366; box-shadow: 0 4px 0 #1a2048; }
.sc-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.sc-chip { padding: 6px 12px; border-radius: 999px; border: 1px solid rgba(255, 255, 255, .18); background: rgba(255, 255, 255, .06); color: #cfd5f2; font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; }
.sc-chip:hover { color: #fff; border-color: rgba(255, 255, 255, .4); }
.sc-chip.on { background: var(--hero-btn); border-color: var(--hero-btn); color: #fff; }
.sc-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.sc-day { margin: 8px 2px 0; font-size: 11px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: #7880a8; }
.sc-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; align-items: center; gap: 12px; padding: 10px 10px 10px 12px; border-radius: 14px; background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .08); }
.sc-ic { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; font-size: 19px; box-shadow: none; }
.sc-main { min-width: 0; display: flex; flex-direction: column; }
.sc-main b { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sc-main small { color: #9aa3cc; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sc-val { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.1; }
.sc-val b { font-family: var(--display); font-size: 20px; font-variant-numeric: tabular-nums; }
.sc-val small { color: #9aa3cc; font-size: 11px; font-weight: 700; }
.sc-best { margin-top: 4px; padding: 1px 7px; border-radius: 6px; background: #ffd43b; color: #111733; font-size: 10px; font-style: normal; font-weight: 800; }
.sc-again { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: rgba(255, 255, 255, .1); color: #fff; text-decoration: none; font-size: 17px; font-weight: 700; }
.sc-again:hover { background: var(--hero-btn); color: #fff; }
.sc-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding-top: 6px; border-top: 1px solid rgba(255, 255, 255, .1); color: #cfd5f2; font-size: 13px; }
.sc-foot span { flex-basis: 100%; }
.sc-btn { padding: 8px 14px; border-radius: 10px; border: 1px solid rgba(255, 255, 255, .2); background: rgba(255, 255, 255, .08); color: #fff; font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; }
.sc-btn:hover { background: rgba(255, 255, 255, .16); }
.sc-danger { background: #d63a40; border-color: #d63a40; }
.sc-danger:hover { background: #e63e44; }
.sc-empty { margin: auto 0; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 30px 0; }
.sc-empty-ic { font-size: 46px; }
.sc-empty b { font-family: var(--display); font-size: 22px; }
.sc-empty p { margin: 0 0 10px; color: #9aa3cc; max-width: 30ch; }
.sc-starts { display: grid; gap: 8px; width: 100%; }
.sc-start { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 12px; background: rgba(255, 255, 255, .08); color: #fff; text-decoration: none; font-weight: 700; }
.sc-start:hover { background: var(--hero-btn); color: #fff; }
.empty { color: var(--muted); text-align: center; margin: 20px 0; }

/* ---------- Content ---------- */
.content { margin-top: 30px; background: var(--surface); border: 1px solid var(--border); border-radius: 20px; padding: clamp(20px, 3.5vw, 40px); max-width: 880px; }
.tool-layout ~ .content, .tool-layout ~ .guide-box { max-width: none; }

/* Reading pages (guides, legal, info): full-width text with a side rail */
.page-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 26px; align-items: start; }
.page-main { min-width: 0; }
.page-main > .content:first-child, .page-main > .post:first-child { margin-top: 0; }
.page-main .content { max-width: none; }
.page-rail { align-self: stretch; display: flex; flex-direction: column; gap: 16px; }
.page-rail .ad-slot { margin: 0; min-height: 290px; }
.page-rail .ad-placeholder { min-height: 250px; }
.rail-cta { display: flex; flex-direction: column; gap: 6px; padding: 18px; border-radius: var(--radius); background: var(--navy); color: #fff; }
.rail-cta strong { font-family: var(--display); font-size: 18px; }
.rail-cta .btn { margin-top: 8px; }
.rail-link { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; color: var(--text); text-decoration: none; font-size: 14px; font-weight: 600; }
.rail-link:hover { background: var(--surface-2); color: var(--text); }
.rail-link.active { background: color-mix(in srgb, var(--hero) 14%, transparent); color: var(--accent); }
.rail-toc { position: sticky; top: 84px; max-height: calc(100vh - 100px); overflow: auto; }
.rail-toc ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; font-size: 14px; }
.rail-toc a { display: block; padding: 6px 10px; border-radius: 8px; border-left: 3px solid transparent; color: var(--muted); text-decoration: none; line-height: 1.35; }
.rail-toc a:hover { color: var(--text); background: var(--surface-2); }
.rail-toc a.on { color: var(--accent); border-left-color: var(--hero); background: var(--surface-2); font-weight: 700; }
@media (min-width: 1025px) { .page-layout .legal-toc, .page-main .post > .cta-card:not(.cta-end) { display: none; } } /* the rail shows these instead */
.content h2 { font-size: 24px; margin: 34px 0 10px; }
.content h2:first-child { margin-top: 0; }
.content h3 { font-size: 18px; margin: 22px 0 8px; }
.content p, .content li { color: color-mix(in srgb, var(--text) 84%, var(--muted)); }
.content ul, .content ol { padding-left: 22px; }
.content li { margin: 4px 0; }
.content table { width: 100%; border-collapse: collapse; margin: 12px 0; font-size: 15px; }
.content th, .content td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--border); }
.content th { color: var(--muted); font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; }
.content code { font-family: var(--mono); font-size: .9em; background: var(--surface-2); padding: 1px 6px; border-radius: 5px; }
.table-scroll { overflow-x: auto; }
.page-title { font-size: clamp(30px, 4.4vw, 42px); margin: 4px 0 6px; font-weight: 800; letter-spacing: -.035em; }

.section-title { font-size: 22px; margin: 40px 0 14px; }
.tool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.tool-card-link { display: flex; align-items: center; gap: 10px; padding: 13px 15px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); color: var(--text); text-decoration: none; font-weight: 700; font-size: 15px; }
.tool-card-link:hover { border-color: var(--hero); color: var(--text); }
.tool-icon { font-size: 20px; }

/* ---------- Footer ---------- */
.site-footer { background: var(--footer); color: #e7ecf8; margin-top: 30px; }
.site-footer .brand, .site-footer .brand:hover { color: #fff; }
.site-footer .brand-tld { color: rgba(255, 255, 255, .55); }
.site-footer a { color: #c9d6ff; }
.footer-inner { max-width: 1680px; margin: 0 auto; padding: 34px 24px 12px; display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 24px; }
.footer-brand p { color: rgba(231, 236, 248, .7); font-size: 14px; max-width: 360px; }
.footer-col h3 { font-family: var(--font); font-size: 16px; text-transform: capitalize; letter-spacing: .5px; color: rgba(231, 236, 248, .55); margin: 6px 0 10px; }
.footer-col a { display: block; color: #e7ecf8; text-decoration: none; font-size: 14px; padding: 3px 0; }
.footer-col a:hover { color: var(--hero-light); }
.footer-social { display: flex; gap: 8px; margin-top: 4px; }
.footer-social a { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .12); color: #e7ecf8; }
.footer-social a:hover { background: var(--hero); border-color: var(--hero); color: #fff; }
.footer-bottom { max-width: 1680px; margin: 0 auto; padding: 16px 24px 26px; display: flex; align-items: center; justify-content: space-between; gap: 10px 20px; flex-wrap: wrap; border-top: 1px solid rgba(255, 255, 255, .1); }
.copyright { margin: 0; color: rgba(231, 236, 248, .6); font-size: 13px; }
.footer-legal { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 0; font-size: 13px; }
.footer-legal a, .footer-legal .link-btn { color: rgba(231, 236, 248, .75); text-decoration: none; font-size: 13px; }
.footer-legal a:hover, .footer-legal .link-btn:hover { color: var(--hero-light); }
.footer-legal > * + *::before { content: "·"; margin: 0 10px; color: rgba(231, 236, 248, .35); }
.link-btn { background: none; border: 0; padding: 3px 0; color: #e7ecf8; font-size: 14px; cursor: pointer; text-align: left; }
.link-btn:hover { color: var(--hero-light); }

/* "Available in" language links above the footer bottom bar */
.lang-links { margin-top: 40px; padding: 18px 20px 20px; border-radius: 18px; background: var(--surface-2); border: 1px dashed var(--border); }
.lang-links .section-title { margin: 0 0 12px; }
.lang-links ul { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 6px 8px; }
.lang-links a { display: flex; align-items: center; gap: 8px; height: 100%; padding: 7px 10px; border-radius: 999px; background: transparent; border: 1px solid transparent; color: var(--text); text-decoration: none; font-weight: 700; font-size: 13px; line-height: 1.25; }
.lang-links a:hover { background: var(--surface); border-color: var(--border); color: var(--text); }
.lang-links a.on { background: var(--hero-btn); border-color: var(--hero-btn); color: #fff; }
.lang-links svg, .lang-links .flag { flex: none; }
/* The site fonts have no Arabic letters; use a plain Arabic system font instead of a decorative fallback. */
.lang-links a[lang="ar"] { font-family: "Geeza Pro", "SF Arabic", "Noto Sans Arabic", "Segoe UI", Tahoma, sans-serif; font-size: 13px; }
@media (max-width: 1280px) { .lang-links ul { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 640px) { .lang-links ul { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.flag { flex: none; border-radius: 3px; box-shadow: 0 0 0 1px rgba(255, 255, 255, .15); }

/* "This page is available in …" card: fixed at the bottom, so it never moves the page */
.lang-suggest { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 64; display: flex; align-items: center; gap: 12px; width: max-content; max-width: calc(100% - 24px); padding: 10px 10px 10px 16px; border-radius: 14px; background: #111733; color: #e7ecf8; box-shadow: 0 10px 30px rgba(0, 0, 0, .3); font-size: 14px; font-weight: 600; animation: fade .2s ease; }
.lang-suggest p { margin: 0; min-width: 0; }
.lang-suggest a { flex: none; padding: 8px 14px; border-radius: 10px; background: var(--hero-btn); color: #fff; text-decoration: none; font-weight: 800; font-size: 13px; }
.lang-suggest a:hover { color: #fff; filter: brightness(1.1); }
.lang-suggest button { flex: none; width: 32px; height: 32px; border-radius: 9px; border: 1px solid rgba(255, 255, 255, .18); background: transparent; color: #e7ecf8; font-size: 15px; cursor: pointer; }
.lang-suggest button:hover { background: rgba(255, 255, 255, .1); }

/* ---------- Consent banner ---------- */
.consent { position: fixed; left: 0; right: 0; bottom: 0; z-index: 70; padding: 0 16px calc(16px + env(safe-area-inset-bottom, 0px)); display: flex; justify-content: center; pointer-events: none; }
.consent-box { pointer-events: auto; width: min(760px, 100%); background: var(--surface); border: 1px solid var(--border); border-radius: 18px; box-shadow: 0 18px 50px rgba(8, 12, 24, .2); padding: 18px 20px; }
.consent-box h2 { margin: 0 0 6px; font-size: 17px; }
.consent-box p { margin: 0; color: var(--muted); font-size: 14px; }
.consent-options { display: grid; gap: 8px; margin-top: 12px; }
.consent-opt { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; color: var(--muted); background: var(--surface-2); padding: 9px 12px; border-radius: 10px; cursor: pointer; }
.consent-opt b { display: block; color: var(--text); }
.consent-opt input { margin-top: 4px; accent-color: var(--hero); width: 16px; height: 16px; flex: none; }
.consent-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; margin-top: 14px; }
.consent-actions .btn { min-width: 120px; }

/* ---------- Legal & affiliate ---------- */
.aff-tag { color: var(--muted); font-size: 12px; }
.aff-notice { font-size: 14px; color: var(--muted) !important; background: var(--warn-soft); border-left: 3px solid var(--warn); padding: 10px 14px; border-radius: 8px; }
.legal-meta { color: var(--muted) !important; font-size: 14px; margin-top: 0; }
.legal-toc { background: var(--surface-2); border-radius: 12px; padding: 12px 18px 12px 34px; columns: 2; column-gap: 28px; font-size: 14px; }
.legal-toc li { break-inside: avoid; }
.content address { font-style: normal; color: var(--text); line-height: 1.8; }

/* ---------- Guide link, blog & posts ---------- */
.guide-box { display: flex; align-items: center; gap: 14px; margin-top: 22px; padding: 16px 18px; background: var(--navy); border-radius: var(--radius); color: #fff; text-decoration: none; }
.guide-box:hover { color: #fff; box-shadow: 0 0 0 3px color-mix(in srgb, var(--hero) 40%, transparent); }
.guide-kicker { font-size: 12px; font-weight: 800; color: var(--hero-light); white-space: nowrap; text-transform: uppercase; letter-spacing: .1em; }
.guide-title { flex: 1; font-family: var(--display); font-weight: 700; min-width: 0; }
.guide-arrow { font-size: 22px; color: var(--hero-light); }
[dir="rtl"] .guide-arrow, [dir="rtl"] .arr { display: inline-block; transform: scaleX(-1); }

.blog-hero { margin: 4px 0 24px; }
.blog-hero p { color: var(--muted); max-width: 680px; margin: 0 0 14px; }
.hero-kicker { display: inline-block; font-size: 12px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--label-accent); }
.guides-hub { margin-top: 34px; }
.guides-hub ul { display: grid; gap: 6px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { padding: 7px 14px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); color: var(--text); text-decoration: none; font-size: 14px; font-weight: 700; }
.chip.active, .chip:hover { background: var(--picked); border-color: var(--picked); color: #fff; }
.post-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 16px; }
.post-card { background: var(--surface); border: 1px solid var(--border); border-radius: 18px; overflow: hidden; transition: transform .12s, box-shadow .12s; }
.post-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.post-card-link { display: flex; flex-direction: column; height: 100%; color: var(--text); text-decoration: none; }
.post-card-link:hover { color: var(--text); }
.post-card img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; display: block; background: var(--surface-2); }
.post-card-ph { aspect-ratio: 16 / 9; display: grid; place-items: center; font-size: 46px; background: radial-gradient(rgba(255, 255, 255, .16) 1.5px, transparent 1.6px) 0 0 / 18px 18px, var(--hero); }
.post-card:nth-child(4n+2) .post-card-ph { background-color: #4f7bff; }
.post-card:nth-child(4n+3) .post-card-ph { background-color: var(--navy); }
.post-card:nth-child(4n+4) .post-card-ph { background-color: #ff8a3d; }
.post-card-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.post-card-body h2 { margin: 0; font-size: 18px; line-height: 1.35; }
.post-card-body p { margin: 0; color: var(--muted); font-size: 14px; }
.post-cat { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .1em; color: var(--label-accent); }
.post-meta { margin-top: auto; color: var(--muted); font-size: 13px; }
.pager { display: flex; gap: 8px; justify-content: center; margin-top: 24px; flex-wrap: wrap; }

.post { max-width: 760px; margin: 0 auto; }
.page-main .post { max-width: none; }
.crumbs { font-size: 14px; color: var(--muted); margin: 0 0 10px; }
.crumbs a { color: var(--muted); }
.post-title { font-size: clamp(30px, 4.6vw, 44px); line-height: 1.12; margin: 0 0 10px; font-weight: 800; letter-spacing: -.035em; }
.post-byline { color: var(--muted); font-size: 14px; margin: 0 0 18px; }
.post-hero { width: 100%; height: auto; border-radius: 18px; margin-bottom: 18px; }
.content-flow { font-size: 18px; line-height: 1.75; }
.content-flow h2 { font-size: 26px; margin: 38px 0 10px; }
.content-flow h3 { font-size: 20px; margin: 26px 0 8px; }
.content-flow p, .content-flow li { color: color-mix(in srgb, var(--text) 86%, var(--muted)); }
.content-flow img { height: auto; border-radius: 12px; }
.content-flow table { width: 100%; border-collapse: collapse; display: block; overflow-x: auto; font-size: 16px; }
.content-flow th, .content-flow td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--border); }
.content-flow th { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.content-flow blockquote { margin: 18px 0; padding: 12px 18px; border-left: 4px solid var(--hero); background: var(--accent-soft); border-radius: 0 12px 12px 0; }
.content-flow code, .content-flow kbd { font-family: var(--mono); font-size: .88em; background: var(--surface-2); padding: 1px 6px; border-radius: 5px; }
.cta-card { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin: 22px 0; padding: 18px 20px; border-radius: 18px; background: var(--navy); color: #fff; }
.cta-card div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cta-card strong { font-family: var(--display); }
.cta-card span { color: var(--navy-ink); font-size: 14px; }
.cta-kicker { font-weight: 800; color: var(--hero-light) !important; font-size: 12px !important; text-transform: uppercase; letter-spacing: .1em; }
.mini-test { margin: 28px 0 8px; }
.mini-test .stage { min-height: 380px; }
.mini-test-note { font-size: 14px; color: var(--muted); }
.faq { margin-top: 32px; }
.faq h2 { font-size: 24px; }
.faq details { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 13px 16px; margin-bottom: 8px; }
.faq summary { cursor: pointer; font-weight: 700; }
.faq details p { color: var(--muted); margin: 10px 0 0; }
.author-box { display: flex; gap: 14px; align-items: flex-start; margin-top: 28px; padding: 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.author-box img { border-radius: 50%; flex: none; object-fit: cover; }
.author-box p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.preview-bar { background: var(--warn-soft); border: 1px solid var(--warn); color: var(--warn); padding: 10px 14px; border-radius: 10px; font-weight: 600; }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .quick-row { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1024px) {
  /* Sidebar becomes a slide-in menu; the top bar shows the menu button and logo. */
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: min(300px, 86vw); z-index: 60; transform: translateX(-105%); transition: transform .22s ease; box-shadow: 0 0 40px rgba(0, 0, 0, .35); }
  .sidebar.open { transform: none; }
  [dir="rtl"] .sidebar { left: auto; right: 0; transform: translateX(105%); }
  [dir="rtl"] .sidebar.open { transform: none; }
  .sidebar .side-close { display: inline-grid; }
  .topbar .menu-toggle { display: inline-grid; }
  .topbar { display: block; }
  .topbar .topbar-brand { display: inline-flex; }
  .tool-layout { grid-template-columns: 1fr; }
  .tool-side { position: static; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
  .tool-side .ad-slot { display: none; } /* sidebar ad never stacks under the test on small screens */
  .page-layout { grid-template-columns: 1fr; }
  .page-rail { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
  .page-rail .ad-slot, .rail-toc { display: none; }
}
@media (max-width: 640px) {
  .lang-suggest { left: 12px; right: 12px; bottom: 12px; transform: none; width: auto; flex-wrap: wrap; }
  .lang-suggest p { flex: 1 1 60%; }
  .rc-top { grid-template-columns: auto minmax(0, 1fr); gap: 14px; }
  .rc-icon { width: 80px; height: 80px; font-size: 50px; border-radius: 22px; }
  .rc-score { grid-column: 1 / -1; margin-top: 8px; }
  .rc-tiles { grid-template-columns: 1fr; }
  .rc-hint { display: none; }
  .topbar-inner { padding: 10px 16px; }
  .wrap { padding: 18px 16px 36px; }
  .ad-slot.ad-top { min-height: 0; margin-bottom: 16px; }
  .ad-top .ad-placeholder { min-height: 60px; }
  .top-btn { padding: 8px 10px; }
  .pills { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-right: -16px; padding-right: 16px; }
  .pills::-webkit-scrollbar { display: none; }
  .pill { flex: none; }
  .quick-row { display: flex; overflow-x: auto; scrollbar-width: none; margin: -6px -16px 18px -6px; padding: 6px 16px 10px 6px; }
  .quick-row::-webkit-scrollbar { display: none; }
  .qbtn { flex: none; min-height: 48px; font-size: 13px; }
  .stage { min-height: 380px; padding: 14px 12px 30px; }
  .stat-row { gap: 8px; }
  .sbox { padding: 10px 6px 8px; border-radius: 13px; }
  .sbox span { font-size: 10px; letter-spacing: .06em; }
  .stage-icon { width: 92px; height: 92px; font-size: 42px; }
  .rc-score { margin-left: 0; width: 100%; }
  .footer-inner { grid-template-columns: 1fr 1fr; padding: 28px 16px 10px; }
  .footer-bottom { padding: 14px 16px 22px; }
  .footer-brand { grid-column: 1 / -1; }
  .words { font-size: 18px; line-height: 34px; }
  .typing-box { height: 150px; padding: 14px; }
  .btn-counters { grid-template-columns: repeat(4, 1fr); }
  .guide-box { flex-wrap: wrap; gap: 4px 10px; }
  .guide-title { flex-basis: 100%; order: 3; }
  .cta-card .btn { width: 100%; }
  .consent-actions .btn { flex: 1 1 45%; min-width: 0; }
  .legal-toc { columns: 1; }
}
/* Small phones: room for menu, logo and three top buttons (history, theme, sound) without sideways scroll. */
@media (max-width: 420px) {
  .topbar-inner { gap: 8px; padding: 10px 12px; }
  .top-actions { gap: 5px; }
  .top-btn.icon-only { padding: 8px 7px; }
  .topbar .brand { font-size: 16px; gap: 7px; }
  .topbar .brand-mark { width: 26px; height: 26px; }
}
@media (max-width: 345px) {
  .topbar .brand-tld { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Live card under the click area (jitter rhythm, Kohi speed per second). Kept outside the pad and
   styled like page content so it never looks like part of the game. */
.live-strip { margin-top: 20px; padding: 12px 16px 14px; border-radius: 16px; background: var(--surface); border: 1px solid var(--border); color: var(--text); }
.live-strip:empty { display: none; }
.ls-label { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 11px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.ls-label b { padding: 2px 9px; border-radius: 999px; background: var(--surface-2); color: var(--text); font-size: 12px; letter-spacing: 0; text-transform: none; }
.ls-wait { display: block; margin-top: 6px; font-size: 14px; color: var(--muted); }
.ls-chart { height: 54px; margin: 8px 0 0; padding: 4px; background: var(--surface-2); }
.ls-chart i { background: var(--hero-btn); opacity: 1; transition: height .15s ease; }
.ls-chart b { color: #fff; font-size: 10px; }
.ls-chart i.ls-empty { background: transparent; }
