/* ===========================================================================
   WPM — racing-themed typing test
   Palette: asphalt darks + electric lime / cyan accents + checkered-flag motifs
   =========================================================================== */
:root {
  --asphalt-900: #0b0f14;
  --asphalt-800: #11161d;
  --asphalt-700: #1a2230;
  --asphalt-600: #243042;
  --line: #2c3a4f;
  --text: #e8eef6;
  --muted: #8b9bb0;
  --lime: #c6ff3d;
  --cyan: #2ee6e6;
  --hot: #ff4d6d;
  --good: #43e97b;
  --bad: #ff5c7a;
  --glow: 0 0 18px rgba(198, 255, 61, 0.45);
  --font: 'Segoe UI', system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
  --mono: 'SFMono-Regular', ui-monospace, 'JetBrains Mono', Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: radial-gradient(1200px 600px at 50% -10%, #16202c 0%, var(--asphalt-900) 60%);
  overflow-x: hidden;
  position: relative;
}

/* Moving "road" stripes behind everything for a sense of speed. */
body::before {
  content: '';
  position: fixed;
  inset: -20% -20% -20% -20%;
  background:
    repeating-linear-gradient(
      115deg,
      transparent 0 70px,
      rgba(255, 255, 255, 0.018) 70px 76px
    );
  animation: roadScroll 6s linear infinite;
  pointer-events: none;
  z-index: 0;
}
@keyframes roadScroll {
  from { transform: translateX(0); }
  to { transform: translateX(-76px); }
}

/* Checkered flag strip across the very top. */
body::after {
  content: '';
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 8px;
  background-image:
    linear-gradient(45deg, #0e1217 25%, transparent 25%, transparent 75%, #0e1217 75%),
    linear-gradient(45deg, #0e1217 25%, #e8eef6 25%, #e8eef6 75%, #0e1217 75%);
  background-size: 16px 16px;
  background-position: 0 0, 8px 8px;
  background-color: #e8eef6;
  opacity: 0.9;
  z-index: 5;
}

.app {
  position: relative;
  z-index: 1;
  max-width: 880px;
  margin: 0 auto;
  padding: 2.4rem 1.2rem 3rem;
}

/* ----------------------------------------------------------------- header */
.app__header { text-align: center; margin-bottom: 1.4rem; }
.app__header h1 {
  margin: 0;
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  letter-spacing: 0.5px;
  text-transform: uppercase;
  font-weight: 800;
  background: linear-gradient(90deg, var(--lime), var(--cyan));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 2px 10px rgba(46, 230, 230, 0.25));
}
.app__tagline { margin: 0.3rem 0 0; color: var(--muted); }

/* ----------------------------------------------------------------- typist */
/* --tap (tap duration) and --intensity (0..1) are set from JS based on WPM. */
.typist {
  --tap: 700ms;
  --intensity: 0;
  width: 200px;
  max-width: 60vw;
  margin: 0.4rem auto 0;
}
.typist svg { width: 100%; height: auto; overflow: visible; }

/* One finger taps per keystroke (driven from JS via the Web Animations API),
   so the cadence matches exactly what you type. */
.typist__fingers .finger { transform-box: view-box; }
/* Speed lines brighten with WPM (static — reflects speed without motion). */
.typist__speed line {
  stroke: var(--typist-color, var(--cyan));
  stroke-width: 3;
  stroke-linecap: round;
  opacity: calc(0.6 * var(--intensity, 0));
}
.typist__keys .key { fill: #1a2230; transition: fill 0.08s ease; }
.typist__keys .key.lit { fill: var(--typist-color, var(--lime)); }

body.boss .typist { display: none !important; } /* a cartoon typist would blow your cover */

/* --------------------------------------------------------------- controls */
.controls {
  background: linear-gradient(180deg, var(--asphalt-800), var(--asphalt-700));
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 0.9rem;
  margin-bottom: 1rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}
.controls__top {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.8rem;
  flex-wrap: wrap;
}
.tabs { display: flex; gap: 0.4rem; flex: 1; min-width: 220px; }
.boss-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--muted);
  background: var(--asphalt-600);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.4rem 0.8rem;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
.boss-toggle:hover { color: var(--text); border-color: var(--cyan); }
.boss-toggle input { accent-color: var(--cyan); }
.tab {
  flex: 1;
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--line);
  background: var(--asphalt-600);
  color: var(--muted);
  border-radius: 10px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}
.tab:hover { color: var(--text); border-color: var(--cyan); }
.tab--active {
  color: var(--asphalt-900);
  background: linear-gradient(90deg, var(--lime), var(--cyan));
  border-color: transparent;
  box-shadow: var(--glow);
}
.controls__row { display: flex; flex-wrap: wrap; gap: 0.8rem; align-items: flex-end; }
.controls__field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.8rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
select {
  background: var(--asphalt-900);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.5rem 0.6rem;
  font-size: 0.95rem;
}

/* ---------------------------------------------------------------- buttons */
.btn {
  font-family: var(--font);
  font-weight: 700;
  border-radius: 10px;
  padding: 0.55rem 1.1rem;
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform 0.1s ease, box-shadow 0.15s ease, background 0.15s;
}
.btn:active { transform: translateY(1px); }
.btn--primary {
  background: linear-gradient(90deg, var(--lime), var(--cyan));
  color: #06241f;
  box-shadow: var(--glow);
}
.btn--primary:disabled { opacity: 0.45; cursor: not-allowed; box-shadow: none; filter: grayscale(0.4); }
.btn--ghost { background: var(--asphalt-600); color: var(--text); border-color: var(--line); }
.btn--ghost:hover { border-color: var(--cyan); }

/* ------------------------------------------------------------------- stats */
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.6rem;
  margin: 1rem 0;
}
.stat {
  background: linear-gradient(180deg, var(--asphalt-700), var(--asphalt-800));
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.7rem 0.5rem;
  text-align: center;
}
.stat__value {
  display: block;
  font-family: var(--mono);
  font-size: 1.7rem;
  font-weight: 800;
  color: var(--lime);
  text-shadow: 0 0 12px rgba(198, 255, 61, 0.3);
}
.stat__label {
  display: block;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--muted);
  margin-top: 0.2rem;
}

/* ------------------------------------------------------------------- words */
.words {
  position: relative;
  background: var(--asphalt-800);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1.2rem 1.3rem;
  height: 7.6em;
  overflow: hidden;
  font-family: var(--mono);
  font-size: 1.45rem;
  line-height: 1.9;
  letter-spacing: 0.3px;
  scroll-behavior: smooth;
  /* faint lane line down the middle */
  background-image: repeating-linear-gradient(
    to bottom,
    transparent 0 calc(1.9em - 1px),
    rgba(255, 255, 255, 0.02) calc(1.9em - 1px) 1.9em
  );
}
.word {
  display: inline-block;
  padding: 0 0.18em;
  margin: 0 0.05em;
  border-radius: 6px;
  color: var(--muted);
  transition: color 0.1s ease, background 0.1s ease, transform 0.1s ease;
}
.word.current {
  color: var(--text);
  background: rgba(46, 230, 230, 0.12);
  box-shadow: inset 0 -3px 0 var(--cyan);
}
.word.current.bad {
  background: rgba(255, 92, 122, 0.18);
  box-shadow: inset 0 -3px 0 var(--bad);
}
.word.correct { color: var(--good); }
.word.wrong { color: var(--bad); text-decoration: line-through wavy var(--bad); }

/* Code mode: render leading indentation (not typed) and tighten spacing so it
   reads like source. */
.indent { white-space: pre; }
.words--code {
  font-size: 1.2rem;
  line-height: 1.7;
  background-image: none;
  text-align: left;
}
.words--code .word { margin: 0; padding: 0 0.12em; }
.words--code .word + .word { margin-left: 0.45ch; }

/* Line-ending words: the ↵ marker only shows when Enter is required
   (the .words--enter class is toggled from the "Enter key" switch). */
.words--enter .word--eol::after {
  content: '↵';
  display: inline-block;
  margin-left: 0.25em;
  color: var(--cyan);
  opacity: 0.4;
  font-weight: 700;
}
.words--enter .word--eol.current::after { opacity: 1; text-shadow: 0 0 10px var(--cyan); }
.words--enter .word--eol.correct::after { color: var(--good); opacity: 0.5; }
.words--enter .word--eol.wrong::after { color: var(--bad); opacity: 0.8; }
.words--enter .word--eol.need-return::after { animation: retPulse 0.45s ease; }
@keyframes retPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.7); text-shadow: 0 0 14px var(--cyan); }
}

/* Fancy "pop" when a word is typed correctly. */
.word.pop { animation: wordPop 0.4s cubic-bezier(0.18, 1.4, 0.4, 1); }
@keyframes wordPop {
  0% { transform: scale(1); }
  35% { transform: scale(1.35); color: #fff; text-shadow: 0 0 16px var(--lime); }
  100% { transform: scale(1); }
}

/* Rising spark glyph. */
.spark {
  position: absolute;
  transform: translate(-50%, 0);
  font-size: 1rem;
  pointer-events: none;
  animation: sparkFloat 0.8s ease-out forwards;
  z-index: 3;
}
@keyframes sparkFloat {
  0% { opacity: 0; transform: translate(-50%, 0) scale(0.6); }
  20% { opacity: 1; }
  100% { opacity: 0; transform: translate(calc(-50% + var(--drift, 0px)), -2.4em) scale(1.2); }
}

/* Confetti specks burst. */
.confetti {
  position: absolute;
  width: 7px;
  height: 7px;
  border-radius: 2px;
  background: hsl(var(--hue, 90), 90%, 60%);
  pointer-events: none;
  animation: confettiFly 0.7s ease-out forwards;
  z-index: 3;
}
@keyframes confettiFly {
  0% { opacity: 1; transform: translate(0, 0) rotate(0deg) scale(1); }
  100% { opacity: 0; transform: translate(var(--dx, 0), var(--dy, 0)) rotate(220deg) scale(0.3); }
}

/* Quote / celebrity attribution */
.attribution {
  margin: 0.5rem 0 0;
  text-align: right;
  font-style: italic;
  color: var(--cyan);
  font-size: 0.95rem;
}

/* ------------------------------------------------------------------- input */
.typing { margin: 1rem 0 0.6rem; }
.typing__input {
  width: 100%;
  font-family: var(--mono);
  font-size: 1.25rem;
  padding: 0.85rem 1rem;
  border-radius: 12px;
  border: 2px solid var(--line);
  background: var(--asphalt-900);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.typing__input:focus { border-color: var(--lime); box-shadow: var(--glow); }
.typing__input:disabled { opacity: 0.6; }

/* --------------------------------------------------------------- lobby/race */
.lobby {
  background: linear-gradient(180deg, var(--asphalt-800), var(--asphalt-700));
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1rem;
  margin-bottom: 1rem;
}
.lobby__hint { margin: 0 0 0.5rem; color: var(--muted); font-size: 0.9rem; }
.invite { display: flex; gap: 0.5rem; }
.invite__url {
  flex: 1;
  font-family: var(--mono);
  font-size: 0.9rem;
  padding: 0.6rem 0.8rem;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--asphalt-900);
  color: var(--cyan);
}
.roster {
  list-style: none;
  margin: 0.9rem 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.roster__item {
  background: var(--asphalt-600);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.3rem 0.8rem;
  font-size: 0.9rem;
  font-weight: 600;
}
.lobby__actions { display: flex; align-items: center; gap: 0.8rem; flex-wrap: wrap; }
.lobby__status { color: var(--muted); font-size: 0.9rem; }

/* Race progress lanes with a little car riding the fill. */
.progress-bars { display: flex; flex-direction: column; gap: 0.6rem; margin-bottom: 1rem; }
.pbar {
  background: var(--asphalt-800);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.5rem 0.7rem;
}
.pbar--you { border-color: var(--lime); box-shadow: 0 0 0 1px rgba(198, 255, 61, 0.2); }
.pbar__head {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  margin-bottom: 0.35rem;
}
.pbar__name { font-weight: 700; }
.pbar__wpm { color: var(--cyan); font-family: var(--mono); }
.pbar__track {
  position: relative;
  height: 14px;
  border-radius: 999px;
  background:
    repeating-linear-gradient(90deg, transparent 0 12px, rgba(255,255,255,0.05) 12px 14px),
    var(--asphalt-900);
  border: 1px solid var(--line);
  overflow: visible;
}
.pbar__fill {
  position: relative;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--cyan), var(--lime));
  transition: width 0.25s ease;
  box-shadow: 0 0 10px rgba(46, 230, 230, 0.5);
}
.pbar__fill::after {
  content: '🏎️';
  position: absolute;
  right: -10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.1rem;
  filter: drop-shadow(0 0 4px rgba(0,0,0,0.6));
}

/* ---------------------------------------------------------------- countdown */
.countdown {
  text-align: center;
  font-family: var(--mono);
  font-size: 5rem;
  font-weight: 800;
  color: var(--lime);
  text-shadow: var(--glow);
  margin: 0.4rem 0;
  animation: countPulse 1s ease-in-out infinite;
}
@keyframes countPulse {
  0%, 100% { transform: scale(1); opacity: 0.9; }
  50% { transform: scale(1.25); opacity: 1; }
}

/* ------------------------------------------------------------------ result */
.result {
  background: linear-gradient(180deg, var(--asphalt-700), var(--asphalt-800));
  border: 1px solid var(--cyan);
  border-radius: 16px;
  padding: 1.4rem;
  margin-top: 1rem;
  text-align: center;
  box-shadow: 0 0 30px rgba(46, 230, 230, 0.15);
  animation: resultIn 0.4s ease;
}
@keyframes resultIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.result h2 { margin: 0 0 1rem; }
.result__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.8rem;
  margin-bottom: 1.2rem;
}
.result__item { background: var(--asphalt-900); border-radius: 12px; padding: 0.8rem 0.4rem; }
.result__item strong {
  display: block;
  font-family: var(--mono);
  font-size: 1.6rem;
  color: var(--lime);
}
.result__item span { font-size: 0.72rem; text-transform: uppercase; color: var(--muted); letter-spacing: 0.5px; }

/* Mistake review */
.result__mistakes { margin: 0 0 1.1rem; text-align: left; }
.result__mistakes h3 {
  margin: 0 0 0.5rem;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--hot);
}
.result__perfect { margin: 0 0 0.4rem; color: var(--good); font-weight: 700; text-align: center; }
.result__more { margin: 0.4rem 0 0; color: var(--muted); font-size: 0.8rem; }
.miss {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  max-height: 7.5rem;
  overflow-y: auto;
}
.miss li {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: var(--asphalt-900);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.25rem 0.55rem;
  font-family: var(--mono);
  font-size: 0.85rem;
}
.miss__typed { color: var(--bad); text-decoration: line-through; }
.miss__arrow { color: var(--muted); }
.miss__expected { color: var(--good); }

/* ------------------------------------------------------------------- footer */
.app__footer { text-align: center; color: var(--muted); font-size: 0.82rem; margin-top: 1.6rem; }
kbd {
  background: var(--asphalt-600);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 0.05rem 0.35rem;
  font-family: var(--mono);
  font-size: 0.8rem;
}

/* -------------------------------------------------------------- leaderboard */
.leaderboard {
  margin-top: 2rem;
  background: linear-gradient(180deg, var(--asphalt-800), var(--asphalt-700));
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1.1rem;
}
.leaderboard__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  flex-wrap: wrap;
  margin-bottom: 0.8rem;
}
.leaderboard__head h2 { margin: 0; font-size: 1.1rem; }
.leaderboard__note { margin: 0.7rem 0 0; color: var(--muted); font-size: 0.78rem; }
.lb { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.3rem; }
.lb__empty { color: var(--muted); padding: 0.5rem 0; }
.lb__row {
  display: grid;
  grid-template-columns: 2rem 1fr auto auto;
  align-items: center;
  gap: 0.7rem;
  padding: 0.5rem 0.7rem;
  background: var(--asphalt-900);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.lb__row:nth-child(1) { border-color: var(--lime); box-shadow: var(--glow); }
.lb__rank { font-family: var(--mono); font-weight: 800; color: var(--lime); text-align: center; }
.lb__name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb__wpm { font-family: var(--mono); color: var(--cyan); }
.lb__acc { font-family: var(--mono); color: var(--muted); font-size: 0.85rem; }

.ranked-submit { display: flex; gap: 0.5rem; margin: 0 0 0.9rem; }
.ranked-submit .typing__input { font-size: 1rem; padding: 0.6rem 0.8rem; }
.ranked-status { margin: 0 0 0.9rem; font-weight: 700; color: var(--lime); }

body.boss .leaderboard { display: none !important; }

/* -------------------------------------------------------------------- modal */
.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(5, 8, 12, 0.78);
  backdrop-filter: blur(4px);
}
.modal__box {
  background: linear-gradient(180deg, var(--asphalt-700), var(--asphalt-800));
  border: 1px solid var(--cyan);
  border-radius: 16px;
  padding: 1.6rem;
  width: min(420px, 92vw);
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}
.modal__box h2 { margin-top: 0; }
.modal__box form { display: flex; flex-direction: column; gap: 0.8rem; margin-top: 1rem; }

[hidden] { display: none !important; }

/* ===========================================================================
   BOSS MODE — disguise the page as a VS Code editor so it looks like work.
   Toggled by adding `.boss` to <body>. The typing engine is untouched.
   =========================================================================== */
.boss-bar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 38px;
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 0 0.8rem;
  background: #323233;
  color: #cccccc;
  font-family: var(--font);
  font-size: 0.78rem;
  border-bottom: 1px solid #252526;
  z-index: 30;
}
.boss-bar__lights { display: inline-flex; gap: 7px; }
.boss-bar__lights i { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }
.boss-bar__lights i:nth-child(1) { background: #ff5f56; cursor: pointer; } /* click to exit */
.boss-bar__lights i:nth-child(2) { background: #ffbd2e; }
.boss-bar__lights i:nth-child(3) { background: #27c93f; }
.boss-bar__menu { color: #b0b0b0; }
.boss-bar__tab {
  background: #1e1e1e;
  color: #ffffff;
  padding: 0.35rem 0.7rem;
  border-radius: 5px 5px 0 0;
  font-family: var(--mono);
  font-size: 0.76rem;
}
.boss-bar__tab--muted { background: transparent; color: #8a8a8a; }

.boss-status {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: 22px;
  display: flex;
  align-items: center;
  gap: 1.1rem;
  padding: 0 0.8rem;
  background: #007acc;
  color: #ffffff;
  font-family: var(--font);
  font-size: 0.72rem;
  z-index: 30;
}
.boss-status__spacer { flex: 1; }

/* Restyle the whole page when boss mode is on. */
body.boss { background: #1e1e1e; color: #d4d4d4; }
body.boss::before, body.boss::after { display: none !important; } /* kill road + flag */
body.boss .app { padding-top: 3.4rem; padding-bottom: 2.6rem; }

/* Hide the playful UI. */
body.boss .app__header,
body.boss .controls,
body.boss .stats,
body.boss .progress-bars,
body.boss .lobby,
body.boss .app__footer { display: none !important; }

/* Suppress celebratory effects — confetti at work is a dead giveaway. */
body.boss .spark, body.boss .confetti { display: none !important; }

/* The word stream becomes a code editor pane with a line-number gutter. */
body.boss .words {
  background: #1e1e1e;
  border: none;
  border-radius: 0;
  background-image: none;
  padding-left: 3.6rem;
  height: 9em;
  font-size: 1rem;
  line-height: 1.55;
  color: #d4d4d4;
}
body.boss .words::before {
  content: '137\A 138\A 139\A 140\A 141\A 142\A 143\A 144';
  white-space: pre;
  position: absolute;
  left: 0;
  top: 1.2rem;
  width: 3rem;
  text-align: right;
  color: #6e7681;
  font-family: var(--mono);
  font-size: 1rem;
  line-height: 1.55;
  border-right: 1px solid #2b2b2b;
  padding-right: 0.6rem;
}
body.boss .word { color: #9cdcfe; background: none; box-shadow: none; }
body.boss .word.current { color: #fff; background: #264f78; box-shadow: none; }
body.boss .word.current.bad { background: #5a1d1d; }
body.boss .word.correct { color: #ce9178; } /* looks like syntax-highlighted strings */
body.boss .word.wrong { color: #f44747; }
/* In the editor disguise, the line break itself is the cue — hide the ↵ glyph. */
body.boss .word--eol::after { content: ''; margin: 0; }

/* Input becomes the active editor line. */
body.boss .typing { margin-top: 0; }
body.boss .typing__input {
  background: #1e1e1e;
  border: none;
  border-left: 2px solid #007acc;
  border-radius: 0;
  color: #d4d4d4;
  font-size: 1rem;
  padding-left: 3.4rem;
}
body.boss .typing__input:focus { box-shadow: none; }

/* Results become a subtle editor "panel" (like VS Code's bottom pane) instead
   of a bright trophy card. */
body.boss .result {
  background: #1e1e1e;
  border: 1px solid #2b2b2b;
  border-top: 2px solid #007acc;
  border-radius: 0;
  box-shadow: none;
  text-align: left;
  font-family: var(--mono);
  padding: 0.85rem 1rem;
  animation: none;
}
body.boss .result h2 {
  font-size: 0.82rem;
  font-weight: 600;
  color: #cccccc;
  margin: 0 0 0.7rem;
}
body.boss .result__grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem 1.3rem;
  margin-bottom: 0.7rem;
}
body.boss .result__item {
  flex-direction: row;
  align-items: baseline;
  gap: 0.4rem;
  background: transparent;
  border-radius: 0;
  padding: 0;
}
body.boss .result__item strong { font-size: 0.95rem; color: #4ec9b0; }
body.boss .result__item span { font-size: 0.7rem; color: #6e7681; text-transform: none; letter-spacing: 0; }
body.boss .result__mistakes h3 { color: #c5705d; font-weight: 600; }
body.boss .miss li { background: #181818; border-color: #2b2b2b; font-size: 0.78rem; }
body.boss #result-again {
  background: #2d2d2d;
  color: #cccccc;
  border: 1px solid #3c3c3c;
  box-shadow: none;
  font-weight: 500;
  font-size: 0.8rem;
  padding: 0.35rem 0.9rem;
}
body.boss .countdown { color: #d4d4d4; text-shadow: none; }

/* --------------------------------------------------------------- responsive */
@media (max-width: 560px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .result__grid { grid-template-columns: repeat(2, 1fr); }
  .words { font-size: 1.2rem; }
}

@media (prefers-reduced-motion: reduce) {
  body::before, .countdown, .word.pop, .spark, .confetti, .result { animation: none !important; }
}

/* Manual "Animations off" switch (normal mode). Finger taps + confetti are
   skipped in JS; this kills the looping/decorative CSS animations. */
body.no-anim::before { animation: none !important; }
body.no-anim .countdown,
body.no-anim .result,
body.no-anim .word.pop,
body.no-anim .word--eol.need-return::after { animation: none !important; }
