/* Design v3 (2026-11-03, owner): MINIMAL BLACK & WHITE — a colour-system
   update only, no layout or behaviour change. Black text and buttons on
   white, light-grey page and borders. Preserved product colours: the
   yellow Start-typing bubble, green correct / red incorrect feedback.
   (v2 layout history: calm first screen, open passage, grey pill bars.) */
:root{
  --bg:#F5F5F5; --ink:#000000; --sub:#666666; --muted:#999999;
  --line:#E5E5E5; --accent:#000000; --accent-dark:#333333;
  --bar:#E5E5E5; --ok:#15803D; --bad:#DC2626; --current-bg:#E5E5E5; --ring:#000000;
}
*{box-sizing:border-box}
html{-webkit-text-size-adjust:100%}
@supports (overflow:clip){html,body{overflow-x:clip}}
::selection{background:#E5E5E5}
body{margin:0;background:var(--bg);color:var(--ink);
  font-family:system-ui,-apple-system,"Segoe UI",Roboto,Arial,sans-serif;
  font-size:16px;line-height:1.55}
.wrap{max-width:820px;margin:0 auto;padding:10px 18px 48px}

/* full-width black header bar — owner's speaker-cleaner style: logo left,
   white links right, across the whole page (owner's order 2026-10-29) */
header.site{background:var(--accent);color:#fff}
.bar-in{max-width:1120px;margin:0 auto;display:flex;align-items:center;gap:12px;
  flex-wrap:wrap;padding:12px 20px}
.brandmark{display:inline-flex;align-items:center;gap:10px;text-decoration:none;color:#fff}
.brandmark .mark{width:41px;height:43px;flex:none}
/* logo mark paint: currentColor, so the one SVG is white on the black
   header and black on light pages; the bolt is always brand yellow */
.mark .a{fill:none;stroke:currentColor;stroke-width:4.4}
.mark .b{fill:#FFDF4D}
.mark .c{fill:none;stroke:currentColor;stroke-width:2}
.mark .d,.mark .e{fill:none;stroke:currentColor;stroke-width:2.7}
/* wordmark lockup: stacked lines, all centred — "Test" sits in the
   middle under "Typing Speed" (owner's explicit layout, 2026-11-03) */
.brandtxt{display:flex;flex-direction:column;align-items:center;text-align:center;
  font-weight:800;font-size:clamp(1.02rem,4.2vw,1.22rem);letter-spacing:-.02em;line-height:1.12}
.brandtxt small{font-weight:600;color:#999999;font-size:.66rem;letter-spacing:.05em;margin-top:2px}
/* About-page brand showcase: the full lockup, large, black on light */
.logo-show{display:flex;align-items:center;justify-content:center;gap:16px;margin:4px 0 18px;color:var(--ink)}
.logo-show .mark{width:82px;height:86px;flex:none}
.logo-show .brandtxt{font-size:1.85rem}
.logo-show .brandtxt small{color:var(--sub)}
/* widget bits whose inline styles moved here (page byte budget) */
#timePills{display:inline-flex;gap:2px}
#wordPills{display:none;gap:2px}
#customPanel label{font-weight:600}
.small-note.ta-l{text-align:left}
#rMeta{color:var(--sub);margin:0;text-align:center}
#errSummary{margin:0;text-align:center}
#histSummary{margin:0 0 6px;font-weight:600;text-align:center}
.secttl.mt{margin-top:22px}
.row.start{justify-content:flex-start}
nav.site{display:flex;gap:2px;flex-wrap:wrap;margin-left:auto}
nav.site a{color:#E5E5E5;text-decoration:none;font-weight:600;font-size:.95rem;padding:7px 10px;border-radius:8px;white-space:nowrap}
nav.site a:hover{color:#fff;background:rgba(255,255,255,.16)}
.navbtn{display:none;margin-left:auto;flex:none;width:44px;height:44px;border-radius:10px;
  border:1px solid rgba(255,255,255,.4);background:rgba(255,255,255,.14);color:#fff;
  font-size:1.3rem;line-height:1;cursor:pointer;align-items:center;justify-content:center}
.crumbs{color:var(--sub);font-size:.86rem;margin:14px 0 0;text-align:center}
.crumbs a{color:var(--sub)}
h1{font-size:clamp(1.3rem,5vw,1.6rem);line-height:1.2;margin:14px 0 4px;
  letter-spacing:-.01em;font-weight:800;text-align:center}
.home-title{font-size:clamp(2.25rem,7vw,3.35rem);line-height:1.08;
  margin:26px 0 10px;letter-spacing:-.03em}
.home-lead{max-width:700px;margin:0 auto 8px;text-align:center;color:var(--sub);
  font-size:clamp(1rem,2.6vw,1.13rem);line-height:1.65}
/* one description per screen size: full on desktop, shorter on
   tablet, one line on mobile (owner's responsive brief) */
.lead-mid,.lead-mini{display:none}
/* test controls — pause / end, visible only while a test is active
   (owner, 2026-11-01). Pause is the prominent action, End secondary. */
#testCtl{display:flex;gap:8px;align-items:center;margin:10px 0 0;flex-wrap:wrap}
#testCtl[hidden]{display:none}
#testCtl .btn{min-height:40px}
.ctl-note{color:var(--sub);font-size:.85rem}
.more-note{color:var(--ok);font-weight:700;font-size:.9rem}
body.testing #testCtl{position:sticky;top:58px;z-index:4;background:var(--bg);padding:4px 0}

/* "Start typing" bubble (owner, 2026-11-01): yellow speech bubble whose
   pointer tracks the FIRST character of the passage (left set from JS).
   While it shows, the surface grows a slim top strip so the bubble
   never covers passage text. Yellow is a deliberate product accent
   outside the Sapphire tokens. Reduced-motion is handled globally. */
#surface.bub{padding-top:46px}
.bubble{position:absolute;top:6px;left:2px;background:#FFDF4D;color:#000000;
  font-weight:700;font-size:.85rem;line-height:1;padding:7px 12px;border-radius:999px;
  box-shadow:0 4px 14px rgba(0,0,0,.18);white-space:nowrap;z-index:6;pointer-events:none;
  animation:bob 1.6s ease-in-out infinite}
.bubble::after{content:"";position:absolute;left:14px;bottom:-6px;width:0;height:0;
  border:6px solid transparent;border-top-color:#FFDF4D;border-bottom:0}
.bubble[hidden]{display:none}
@keyframes bob{0%,100%{transform:translateY(0)}50%{transform:translateY(-4px)}}

/* blinking text caret (owner, 2026-11-01): a standard input-style caret
   glued to the current character — position (left/top/height) is set from
   the character's real rendered rect on every render. The existing
   current-character highlight stays; the caret is an addition, not a
   replacement. The global reduced-motion rule stops the blink. */
#caret{position:absolute;width:2px;border-radius:2px;background:var(--accent);
  z-index:5;pointer-events:none;animation:caretBlink 1.06s steps(1) infinite}
#caret[hidden]{display:none}
@keyframes caretBlink{0%{opacity:1}50%{opacity:0}100%{opacity:1}}

/* paused state: passage dims, chip shows, time is frozen */
#pausedChip{position:absolute;top:8px;right:8px;background:var(--accent);color:#fff;
  font-weight:700;font-size:.8rem;padding:5px 11px;border-radius:999px;z-index:6}
#pausedChip[hidden]{display:none}
#surface.paused #text{opacity:.5}

/* end-test confirmation dialog */
.dlg{position:fixed;inset:0;z-index:70;display:flex;align-items:center;justify-content:center}
.dlg[hidden]{display:none}
.dlg-bg{position:absolute;inset:0;background:rgba(0,0,0,.48)}
.dlg-card{position:relative;background:#fff;border-radius:16px;padding:22px;
  width:calc(100% - 40px);max-width:350px;box-shadow:0 18px 50px rgba(0,0,0,.25)}
.dlg-card h2{margin:0 0 8px;font-size:1.15rem;color:var(--ink)}
.dlg-card p{margin:0;color:var(--sub)}
.dlg-btns{display:flex;gap:8px;justify-content:flex-end;margin-top:18px;flex-wrap:wrap}
.dlg-btns .btn{min-height:40px}

@media (max-width:1024px){.lead-full{display:none}.lead-mid{display:block}}
@media (max-width:640px){.lead-mid{display:none}.lead-mini{display:block}
  .home-title{margin:18px 0 6px}.home-lead{margin-bottom:4px}}
.intro{color:var(--sub);margin:0 0 12px}

/* open sections — no cards, no shadows; air and hairlines do the work */
.card{padding:20px 0 4px;border-top:1px solid var(--line);margin-top:22px}
.card:first-of-type{border-top:0;margin-top:0}
.tool{padding-top:10px}

/* control bars: two quiet grey bars, like the reference */
.bar{display:flex;flex-wrap:wrap;gap:8px;justify-content:center;margin-top:10px}
.seg{display:inline-flex;align-items:center;gap:2px;background:var(--bar);
  border-radius:999px;padding:4px;flex-wrap:wrap;justify-content:center}
.seg .pill{appearance:none;border:0;background:transparent;color:var(--ink);
  border-radius:999px;padding:7px 13px;font-size:.93rem;font-weight:600;
  cursor:pointer;min-height:36px;transition:background .15s,color .15s;white-space:nowrap}
.seg .pill:hover{background:#FFFFFF}
.seg .pill[aria-pressed="true"]{background:var(--accent);color:#fff}
.seg .pill[aria-pressed="true"]:hover{background:var(--accent-dark)}
.seg-div{width:1px;align-self:stretch;background:#FFFFFF;margin:4px 3px}
.subbar{display:flex;flex-wrap:wrap;gap:8px;justify-content:center;align-items:center;margin-top:8px}
.seg.small .pill{padding:5px 11px;min-height:32px;font-size:.88rem}
.chip{display:inline-flex;gap:7px;align-items:center;background:var(--bar);
  border-radius:999px;padding:6px 13px;font-weight:600;font-size:.9rem;cursor:pointer;min-height:32px}
.chip input{width:17px;height:17px;accent-color:var(--accent)}
.chip input:disabled{opacity:.4}
.restart{appearance:none;border:0;background:transparent;color:var(--accent);
  font-weight:700;font-size:.92rem;cursor:pointer;padding:6px 10px;border-radius:8px}
.restart:hover{background:var(--bar)}
.pill:focus-visible,.btn:focus-visible,.del:focus-visible,.restart:focus-visible,
input:focus-visible,textarea:focus-visible,summary:focus-visible{outline:3px solid var(--ring);outline-offset:2px}
.btn{appearance:none;border:0;border-radius:999px;padding:10px 20px;min-height:44px;
  font-size:.98rem;font-weight:700;cursor:pointer;background:var(--accent);color:#fff;transition:background .15s}
.btn:hover{background:var(--accent-dark)}
.btn.secondary{background:#fff;color:var(--accent);border:1.5px solid var(--accent)}
.btn.secondary:hover{background:var(--bar)}
.btn:active{transform:translateY(1px)}
.small-note{color:var(--sub);font-size:.86rem;margin:6px 0 0;text-align:center}
.small-note:empty{display:none}
textarea{width:100%;min-height:96px;border:1.5px solid var(--line);border-radius:11px;
  padding:10px;font:inherit;font-size:.95rem;resize:vertical;background:#FFFFFF}
textarea:focus{border-color:var(--accent)}
#customPanel{text-align:left;max-width:640px;margin:14px auto 0}

/* live stats: ONE slim row of five quiet chips; sticks to the top while typing */
.stats{display:flex;gap:6px;margin:16px 0 0;position:sticky;top:0;z-index:5;
  background:var(--bg);padding:8px 0 6px}
.stat{flex:1 1 0;min-width:0;background:#FFFFFF;border:1px solid var(--line);border-radius:11px;padding:6px 4px;text-align:center}
.stat b{display:block;font-size:clamp(1rem,4.4vw,1.3rem);line-height:1.15;color:var(--accent-dark);
  font-variant-numeric:tabular-nums;white-space:nowrap}
.stat span{font-size:.62rem;font-weight:700;letter-spacing:.07em;
  text-transform:uppercase;color:var(--sub);white-space:nowrap}
.prog{height:3px;background:var(--bar);border-radius:99px;margin-top:8px;overflow:hidden}
.prog i{display:block;height:100%;width:0;background:var(--accent);border-radius:99px;transition:width .25s}

/* the passage — open on the page, no box, plain spaces between words */
#surface{position:relative;padding:14px 2px 4px;cursor:text}
#text{font-family:ui-monospace,"SF Mono",Menlo,Consolas,monospace;
  font-size:clamp(1.14rem,4.8vw,1.5rem);line-height:1.95;letter-spacing:.02em;
  height:calc(1.95em * 3);overflow:hidden;overflow-wrap:break-word;
  user-select:none;-webkit-user-select:none}
#textIn{position:relative;will-change:transform}
#text .w{display:inline-block;max-width:100%;vertical-align:top}
#text .ch{color:#666666;border-radius:3px}
#text .ch.sp{white-space:pre}
#text .ch.ok{color:var(--ok)}
#text .ch.bad{color:var(--bad);text-decoration:underline;text-underline-offset:4px}
#text .ch.now{background:var(--current-bg);color:var(--ink);box-shadow:inset 0 -3px 0 var(--accent)}
#capture{position:absolute;left:0;bottom:0;width:100%;height:44px;opacity:.01;
  border:0;font-size:16px;background:transparent;color:transparent}
.hint{color:var(--sub);font-size:.9rem;margin:8px 0 0;min-height:1.4em;text-align:center}

/* finish bar — appears under the passage when a test ends */
#finishBar{display:none;margin-top:12px;background:var(--bar);border-radius:12px;
  padding:12px 14px;align-items:center;gap:10px;flex-wrap:wrap;justify-content:center;text-align:center}
#finishBar.show{display:flex}
#finishBar .msg{font-weight:700}
#finishBar .sub{color:var(--sub);font-size:.88rem;width:100%}

/* keyboard activity — readable keycaps; the live key presses down, and the
   heat shade stays readable (dark text until a key is among the most used) */
.kb-block{margin-top:30px}
.kb-block h3,.secttl{font-size:1.02rem;margin:0 0 10px;text-align:center;font-weight:700}
.kb{display:flex;flex-direction:column;gap:6px;
  background:linear-gradient(180deg,#FFFFFF,#F5F5F5);
  border:1px solid var(--line);border-radius:18px;padding:12px;
  box-shadow:0 10px 25px rgba(0,0,0,.08)}
.kb-row{display:flex;gap:6px}
.key{position:relative;flex:1 1 0;min-width:0;min-height:48px;
  display:flex;align-items:center;justify-content:center;text-align:center;
  background:#fff;border:1px solid #E5E5E5;border-bottom:3px solid #E5E5E5;
  border-radius:9px;padding:7px 2px 5px;
  font-family:ui-monospace,"SF Mono",Menlo,Consolas,monospace;
  font-size:.92rem;font-weight:700;color:#000000;line-height:1.15;
  overflow:hidden;white-space:nowrap;
  transition:background .12s,color .12s,transform .05s,border-color .12s}
.key small{position:absolute;top:4px;left:6px;font-size:.68rem;
  font-weight:700;color:#666666;line-height:1}
@keyframes keyflash{0%{transform:scale(1)}35%{transform:scale(1.13)}100%{transform:scale(1)}}
.key.good{background:#15803D;color:#fff;border-color:#166534;border-bottom-color:#14532D;
  animation:keyflash .35s ease}
.key.good small{color:#DCFCE7}
.key.bad{background:#DC2626;color:#fff;border-color:#B91C1C;border-bottom-color:#991B1B;
  animation:keyflash .35s ease}
.key.bad small{color:#FEE2E2}
.key.pressed{background:var(--accent);color:#fff;border-color:var(--accent-dark);
  border-bottom-width:1px;transform:translateY(2px);
  box-shadow:0 0 0 3px #666666 inset}
.key.pressed small{color:#999999}
.key.k15,.key.k2,.key.k25{font-size:.78rem;letter-spacing:.01em}
.k15{flex-grow:1.6}.k2{flex-grow:2.1}.k25{flex-grow:2.6}.kspace{flex-grow:6.5}

/* Focus mode while a test runs (owner's rule, 2026-10-30): only the
   test itself stays on screen — the stats line, the passage and the
   keyboard. Everything else hides and returns when the test ends. */
body.testing header.site,body.testing footer.site,
body.testing main>h1,body.testing main>.home-lead,
body.testing main>.crumbs,body.testing main>.badges,
body.testing main>section.card,
body.testing #tst .bar,body.testing #tst .ddrow,
body.testing #tst .subbar,body.testing #tst #customPanel,
body.testing #tst .hint,body.testing #tst .small-note,
body.testing #finishBar{display:none}

/* results — spread out, one thing at a time */
#results{display:none}
#results.show{display:block}
.big{font-size:clamp(2.6rem,11vw,3.6rem);font-weight:800;line-height:1;color:var(--accent-dark);
  letter-spacing:-.02em;text-align:center;margin-top:6px}
.big small{font-size:1rem;font-weight:700;color:var(--sub)}
.verdict{font-size:1.03rem;font-weight:600;margin:8px 0 0;text-align:center}
.rgrid{display:grid;grid-template-columns:repeat(auto-fit,minmax(104px,1fr));gap:6px;margin:16px 0}
.rgrid .stat{padding:9px 4px}
.rgrid .stat b{font-size:1.15rem}
.note{background:#FEE2E2;border:1px solid #FECACA;color:#7F1D1D;
  border-radius:11px;padding:10px 12px;font-size:.93rem;margin:10px 0}
.note[hidden]{display:none}
.row{display:flex;gap:8px;flex-wrap:wrap;margin-top:14px;justify-content:center}
#graph{margin-top:6px}
details{margin-top:10px}
summary{cursor:pointer;font-weight:600;color:var(--accent)}
table{border-collapse:collapse;width:100%;font-size:.92rem;margin-top:8px}
th,td{border:1px solid var(--line);padding:6px 9px;text-align:left}
th{background:var(--bar)}
#errList{margin:8px 0 0;padding-left:20px}
#historyList{list-style:none;margin:0;padding:0}
#historyList li{display:flex;justify-content:space-between;gap:10px;align-items:center;
  padding:8px 0;border-bottom:1px solid var(--line);font-size:.95rem;flex-wrap:wrap}
#historyList li:last-child{border-bottom:0}
#historyList .when{color:var(--sub);font-size:.85rem}
.del{appearance:none;border:1px solid var(--line);background:#fff;color:var(--sub);
  border-radius:8px;width:30px;height:30px;font-size:1rem;cursor:pointer;line-height:1}
.del:hover{color:var(--bad);border-color:var(--bad)}
.empty{color:var(--sub);font-size:.95rem;text-align:center}
.badges{display:flex;gap:8px;flex-wrap:wrap;justify-content:center;margin:18px 0 0;padding:0;list-style:none}
.badges li{background:var(--bar);border-radius:999px;padding:6px 13px;
  font-size:.86rem;font-weight:600;color:var(--ink)}
.badges li::before{content:"✓ ";color:var(--accent);font-weight:800}
.prose{text-align:left}
.prose h2{font-size:1.22rem;margin:20px 0 8px;letter-spacing:-.01em}
.prose h2:first-child{margin-top:0}
.prose p{margin:0 0 12px;color:#000000}
.prose ul{margin:0 0 12px;padding-left:20px;color:#000000}
.prose a{color:var(--accent);text-underline-offset:3px}
.prose code{background:var(--bar);padding:1px 5px;border-radius:5px;font-size:.92em}
.faqitem{border-bottom:1px solid var(--line);padding:10px 0}
.faqitem:last-child{border-bottom:0}

/* plain footer — links and one line, like the reference */
footer.site{color:var(--sub);font-size:.9rem;text-align:center;
  padding:20px 0 4px;margin-top:26px;border-top:1px solid var(--line);line-height:2}
footer.site a{color:var(--sub);text-decoration:none;font-weight:600}
footer.site a:hover{color:var(--accent-dark);text-decoration:underline}
.sr{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
/* mobile option buttons + bottom sheet (competitor-style, owner's order) */
.ddrow{display:none;gap:8px;margin-top:10px}
.dd{flex:1 1 0;min-width:0;display:flex;justify-content:space-between;align-items:center;gap:8px;
  background:#fff;border:1.5px solid var(--line);border-radius:12px;padding:12px 14px;
  font-size:1rem;font-weight:600;color:var(--ink);cursor:pointer}
.dd::after{content:"▾";color:var(--sub);flex:none}
#sheet{position:fixed;inset:0;z-index:60;display:none}
#sheet.show{display:block}
.sheet-bg{position:absolute;inset:0;background:rgba(0,0,0,.48)}
.sheet-panel{position:absolute;left:0;right:0;bottom:0;background:#fff;
  border-radius:20px 20px 0 0;padding:8px 0 20px;max-height:84vh;overflow:auto}
.sheet-panel::before{content:"";display:block;width:42px;height:5px;border-radius:99px;background:#E5E5E5;margin:6px auto 2px}
.sheet-title{font-weight:700;text-align:center;margin:6px 0 8px;font-size:1.02rem}
.sheet-close{position:absolute;top:12px;right:14px;appearance:none;border:0;background:var(--bar);
  width:32px;height:32px;border-radius:50%;font-size:.95rem;color:var(--sub);cursor:pointer}
.sheet-basis{display:flex;gap:8px;padding:8px 16px 6px}
.sheet-basis button{flex:1;appearance:none;border:0;background:var(--bar);color:var(--ink);
  border-radius:999px;padding:9px;font-size:.95rem;font-weight:700;cursor:pointer}
.sheet-basis button[aria-pressed="true"]{background:var(--accent);color:#fff}
.sheet-item{display:flex;justify-content:space-between;align-items:center;width:100%;
  background:#fff;border:0;border-bottom:1px solid var(--line);padding:15px 20px;
  font-size:1.05rem;color:var(--ink);cursor:pointer;text-align:left}
.sheet-item:last-child{border-bottom:0}
.radio{width:22px;height:22px;border:2px solid #666666;border-radius:50%;flex:none;position:relative}
.radio.on{border-color:var(--accent)}
.radio.on::after{content:"";position:absolute;inset:4px;border-radius:50%;background:var(--accent)}

@media (min-width:861px){
  .bar{flex-wrap:nowrap}
  .seg{flex-wrap:nowrap}
  .seg .pill{padding:7px 11px}
}
@media (max-width:860px){
  .bar{display:none}
  .ddrow{display:flex}
  /* hamburger: links fold into a drop-down panel under the bar */
  .navbtn{display:inline-flex}
  nav.site{display:none;order:3;width:100%;flex-direction:column;flex-wrap:nowrap;
    overflow:visible;margin-left:0;gap:0;padding-top:6px}
  header.site.nav-open nav.site{display:flex}
  nav.site a{padding:12px 8px;font-size:1rem;border-radius:0;
    border-top:1px solid rgba(255,255,255,.18)}
  /* comfortable touch targets for the sub-controls */
  .chip{min-height:40px;padding:8px 14px}
  .seg.small .pill{min-height:40px;padding:8px 13px}
  .restart{min-height:40px;padding:8px 10px}
}
@media (max-width:480px){
  .brandmark{gap:8px}
  .brandmark .mark{width:35px;height:37px}
  .stats{gap:4px}
  .stat{padding:6px 1px}
  .stat b{font-size:1rem}
  .stat span{font-size:.54rem;letter-spacing:.03em}
}
@media (max-width:560px){
  .wrap{padding:8px 14px 40px}
  .seg .pill{padding:6px 10px;font-size:.88rem;min-height:34px}
  .key{min-height:40px;font-size:.7rem;border-radius:6px;padding:5px 0 4px}
  .key small{font-size:.52rem;top:3px;left:4px}
  .key.k15,.key.k2,.key.k25{font-size:.52rem}
  .kb{gap:4px;padding:7px}
  .kb-row{gap:4px}
  .stat span{font-size:.56rem}
}
@media (prefers-reduced-motion:reduce){*{transition:none!important;animation:none!important}}
