/* DoomBrain — "bold sticker" style.
   Thick ink outlines, hard offset shadows (no blur), loud flat colors. No gradients.
   Phone: top bar + bottom tabs. PC (900px+): left sidebar + wide content. */

:root {
  --paper: #fff4e0;      /* page background */
  --paper-2: #f3e6cc;    /* locked / muted fills */
  --surface: #ffffff;    /* cards, keys */
  --text: #121212;
  --muted: #5c5547;
  --line: #121212;       /* outlines + hard shadows */
  --on-color: #121212;   /* text on colored stickers */

  --yellow: #ffd400;
  --pink: #ff5fa2;
  --cyan: #22d3ee;
  --lime: #a3e635;
  --violet: #a78bfa;
  --orange: #ff8a3d;
  --red: #ff5a5a;

  --mult: var(--yellow);
  --spell: var(--pink);
  --learn: var(--cyan);
  --boss: var(--violet);
  --good: var(--lime);
  --bad: var(--red);

  --b: 3px;                       /* outline width */
  --shadow: 4px 4px 0 var(--line);
  --shadow-sm: 3px 3px 0 var(--line);
  --shadow-lg: 6px 6px 0 var(--line);
  --radius: 16px;
  --font: "Bricolage Grotesque", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #16141b;
    --paper-2: #2a2733;
    --surface: #221f2a;
    --text: #f6efe2;
    --muted: #b5ac9c;
    --line: #f6efe2;      /* light outlines on dark = sticker edges */
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--paper);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px; line-height: 1.5;
  min-height: 100dvh;
  -webkit-tap-highlight-color: transparent;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px dashed var(--line); outline-offset: 4px; }
.ic { width: 24px; height: 24px; flex: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }
/* the × in our display font is tiny; draw symbol-only × bigger */
.x-glyph { font-family: Arial, Helvetica, sans-serif; font-weight: 700; font-size: 1.35em; line-height: 1; }

/* accent per area: set --accent on a container, everything inside follows */
.mult  { --accent: var(--mult); }
.spell { --accent: var(--spell); }
.learn { --accent: var(--learn); }
.boss  { --accent: var(--boss); }

/* ================= sticker primitives ================= */
.card, .btn, .key, .answer, .node, .medal, .tile, .chip {
  border: var(--b) solid var(--line);
}
.card {
  display: block;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
a.card, button.card { cursor: pointer; text-align: left; transition: transform 90ms ease-out, box-shadow 90ms ease-out; }
@media (hover: hover) {
  a.card:hover, button.card:hover { transform: translate(-2px, -2px); box-shadow: var(--shadow-lg); }
}
a.card:active, button.card:active { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--line); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px; padding: 0 22px;
  background: var(--surface); color: var(--text);
  border-radius: 14px; box-shadow: var(--shadow-sm);
  font-weight: 800; font-size: 1rem; letter-spacing: .01em;
  cursor: pointer; transition: transform 80ms ease-out, box-shadow 80ms ease-out;
}
.btn:active { transform: translate(3px, 3px); box-shadow: 0 0 0 var(--line); }
.btn.primary { background: var(--accent, var(--yellow)); color: var(--on-color); }
.btn .ic { width: 22px; height: 22px; }

.tile {
  display: grid; place-items: center; flex: none;
  width: 60px; height: 60px; border-radius: 14px;
  background: var(--accent); color: var(--on-color);
  font-weight: 800; font-size: 1.9rem; line-height: 1;
}
.tile .ic { width: 30px; height: 30px; }
.tile.sm { width: 48px; height: 48px; border-radius: 12px; font-size: 1.3rem; }
.tile.sm .ic { width: 24px; height: 24px; }

.bar {
  height: 14px; border: var(--b) solid var(--line); border-radius: 99px;
  background: var(--surface); overflow: hidden;
}
.bar > span { display: block; height: 100%; background: var(--line); transition: width 200ms ease-out; }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: 99px;
  background: var(--surface); font-weight: 800; font-size: .85rem;
}
.chip .ic { width: 16px; height: 16px; }

/* ================= app shell ================= */
.logo {
  display: inline-flex; align-items: center; gap: 10px;
  font-weight: 800; font-size: 1.35rem; letter-spacing: -.03em; line-height: 1;
}
.logo-mark {
  display: grid; place-items: center;
  width: 34px; height: 34px; border: var(--b) solid var(--line); border-radius: 10px;
  background: var(--pink); color: var(--on-color); font-size: .9rem; letter-spacing: -.04em;
  box-shadow: 2px 2px 0 var(--line); transform: rotate(-8deg);
}
.stats { display: flex; gap: 8px; }
.stat {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border: var(--b) solid var(--line); border-radius: 99px;
  font-weight: 800; font-size: .95rem; font-variant-numeric: tabular-nums;
  color: var(--on-color);
}
.stat .ic { width: 18px; height: 18px; fill: currentColor; }
.stat.streak { background: var(--orange); }
.stat.xp { background: var(--yellow); }
.stat.off { background: var(--surface); color: var(--muted); }

.sound-btn {
  display: grid; place-items: center; width: 40px; height: 40px; flex: none;
  background: var(--surface); border: var(--b) solid var(--line); border-radius: 12px;
  box-shadow: 2px 2px 0 var(--line); cursor: pointer;
}
.sound-btn .ic { width: 20px; height: 20px; }
.sound-btn:active { transform: translate(2px, 2px); box-shadow: none; }

/* phone top bar */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: var(--paper);
  border-bottom: var(--b) solid var(--line);
}
.topbar .right { display: flex; align-items: center; gap: 8px; }

/* phone bottom tabs */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px;
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
  background: var(--paper); border-top: var(--b) solid var(--line);
}
.nav-link {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  min-height: 54px; padding: 6px 4px; border-radius: 12px;
  font-weight: 800; font-size: .78rem; color: var(--muted);
  border: var(--b) solid transparent;
}
.nav-glyph { display: grid; place-items: center; width: 26px; height: 24px; font-size: 1.1rem; line-height: 1; }
.nav-glyph .ic { width: 22px; height: 22px; }
.nav-link.active { color: var(--on-color); background: var(--accent); border-color: var(--line); box-shadow: 2px 2px 0 var(--line); }
.nav-link.home { --accent: var(--orange); }

.sidebar { display: none; }

main {
  max-width: 640px; margin: 0 auto;
  padding: 20px 16px calc(110px + env(safe-area-inset-bottom));
  outline: none;
}

/* PC: sidebar layout */
@media (min-width: 900px) {
  .topbar, .tabbar { display: none; }
  .shell { display: grid; grid-template-columns: 250px minmax(0, 1fr); min-height: 100dvh; }
  .sidebar {
    position: sticky; top: 0; height: 100dvh;
    display: flex; flex-direction: column; gap: 26px;
    padding: 26px 18px;
    border-right: var(--b) solid var(--line);
  }
  .sidebar .logo { font-size: 1.55rem; padding: 0 6px; }
  .sidebar nav { display: flex; flex-direction: column; gap: 8px; }
  .sidebar .nav-link {
    flex-direction: row; justify-content: flex-start; gap: 12px;
    min-height: 52px; padding: 8px 14px; font-size: 1.08rem; color: var(--text);
  }
  .sidebar .nav-link:hover:not(.active) { border-color: var(--line); background: var(--surface); }
  .side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 14px; }
  .side-foot .stats { flex-wrap: wrap; }
  .sound-row { display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--muted); }
  main { max-width: 1120px; width: 100%; padding: 36px 44px 60px; }
}

/* ================= page bits ================= */
h1 { font-size: clamp(1.9rem, 5vw, 2.8rem); line-height: 1.05; font-weight: 800; letter-spacing: -.035em; margin: 0 0 6px; }
.sub { color: var(--muted); margin: 0 0 22px; font-weight: 600; font-size: 1.05rem; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin: 36px 0 14px; }
.section-head h2 { font-size: 1.45rem; font-weight: 800; letter-spacing: -.02em; margin: 0; }
.section-head span { color: var(--muted); font-weight: 700; }
.back { display: inline-flex; align-items: center; gap: 4px; min-height: 44px; margin: -6px 0 6px -4px; color: var(--muted); font-weight: 800; }
.footer-actions { margin-top: 40px; display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.link-btn { background: none; border: 0; cursor: pointer; min-height: 44px; padding: 0 12px; color: var(--muted); font-weight: 700; }
.link-btn:hover { color: var(--text); text-decoration: underline; }
.warn { padding: 12px 14px; border: var(--b) solid var(--line); border-radius: 12px; background: var(--red); color: var(--on-color); font-weight: 700; }
.all-done { text-align: center; color: var(--muted); font-weight: 700; }

/* ================= home ================= */
.hero {
  position: relative; overflow: hidden;
  padding: 24px; margin-bottom: 24px;
  background: var(--cyan); color: var(--on-color);
}
.hero h1 { margin: 0 0 4px; }
.hero p { margin: 0; font-weight: 700; font-size: 1.05rem; }
.hero-stats { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
.hero .chip { background: var(--surface); color: var(--text); border-color: var(--on-color); }
.hero-deco {
  position: absolute; right: 18px; top: 50%;
  font-size: 7rem; font-weight: 800; line-height: 1; letter-spacing: -.06em;
  color: var(--on-color); opacity: .14; transform: translateY(-50%) rotate(10deg); pointer-events: none;
}

.modes { display: grid; gap: 18px; }
@media (min-width: 640px) { .modes { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1100px) { .modes { grid-template-columns: repeat(3, 1fr); } }
.mode {
  display: flex; flex-direction: column; gap: 14px;
  padding: 18px; min-height: 200px;
  background: var(--accent); color: var(--on-color);
}
.mode .tile { background: var(--surface); color: #121212; border-color: var(--on-color); }
.mode-top { display: flex; align-items: center; justify-content: space-between; }
.mode h3 { margin: 0; font-size: 1.5rem; font-weight: 800; letter-spacing: -.03em; line-height: 1.1; }
.mode p { margin: 2px 0 0; font-weight: 600; }
.mode .bottom { margin-top: auto; }
.mode .bar { border-color: var(--on-color); background: #fff; }
.mode .bar > span { background: var(--on-color); }
.progress { display: flex; align-items: center; gap: 10px; }
.progress .bar { flex: 1; }
.progress b { font-variant-numeric: tabular-nums; min-width: 42px; text-align: right; }
.meta { margin-top: 6px; font-size: .9rem; font-weight: 700; }
.go {
  display: grid; place-items: center; width: 40px; height: 40px;
  border: var(--b) solid var(--on-color); border-radius: 50%; background: #fff; color: #121212;
}
.go .ic { width: 20px; height: 20px; }

.nudge { display: flex; align-items: center; gap: 14px; padding: 14px 16px; margin-top: 18px; }
.nudge h3 { margin: 0; font-size: 1.05rem; font-weight: 800; }
.nudge p { margin: 0; color: var(--muted); font-weight: 600; font-size: .92rem; }
.nudge .ic.chev { margin-left: auto; }

/* badges */
.badges { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px 8px; }
@media (min-width: 900px) { .badges { grid-template-columns: repeat(8, 1fr); } }
.badge { text-align: center; font-size: .8rem; font-weight: 700; color: var(--muted); line-height: 1.25; }
.medal {
  width: 62px; height: 62px; margin: 0 auto 8px; border-radius: 50%;
  display: grid; place-items: center;
  font-weight: 800; font-size: 1.35rem; line-height: 1;
  background: var(--paper-2); color: var(--muted); border-style: dashed;
}
.medal .ic { width: 26px; height: 26px; }
.badge.earned { color: var(--text); }
.badge.earned .medal, .medal.earned-medal {
  background: var(--yellow); color: var(--on-color); border-style: solid; box-shadow: var(--shadow-sm);
}
.badge.earned:nth-child(odd) .medal { transform: rotate(-6deg); }
.badge.earned:nth-child(even) .medal { transform: rotate(5deg); }

/* ================= maps ================= */
.map-layout { display: grid; gap: 20px; }
@media (min-width: 900px) {
  .map-layout { grid-template-columns: minmax(0, 1fr) 330px; align-items: start; gap: 40px; }
  .map-layout .side { position: sticky; top: 36px; order: 2; }
}
.side { display: flex; flex-direction: column; gap: 14px; }
.row-card {
  display: grid; grid-template-columns: 48px 1fr 24px; gap: 14px; align-items: center;
  padding: 14px 16px;
}
.row-card h3 { margin: 0; font-size: 1.05rem; font-weight: 800; }
.row-card p { margin: 0; color: var(--muted); font-size: .92rem; font-weight: 600; }
.stat-card { padding: 14px 16px; }
.stat-card h3 { margin: 0 0 8px; font-size: 1rem; font-weight: 800; }
.stat-card .progress b { min-width: 52px; }
.stat-card .bar > span { background: var(--accent); }

.path { display: flex; flex-direction: column; align-items: center; padding: 56px 0 8px; }
.node-row { position: relative; display: flex; flex-direction: column; align-items: center; margin: 0 0 30px; transform: translateX(var(--x)); }
.node-row.has-tag:not(:first-child) { margin-top: 36px; }
.node {
  position: relative;
  display: grid; place-items: center;
  width: 78px; height: 78px; border-radius: 50%;
  background: var(--accent); color: var(--on-color);
  box-shadow: var(--shadow);
  font-weight: 800; font-size: 1.6rem; line-height: 1;
  transition: transform 80ms ease-out, box-shadow 80ms ease-out;
}
.node .ic { width: 34px; height: 34px; }
@media (hover: hover) { a.node:hover { transform: translate(-2px, -2px) rotate(-5deg); box-shadow: var(--shadow-lg); } }
a.node:active { transform: translate(4px, 4px); box-shadow: none; }
.node.boss { --accent: var(--boss); width: 88px; height: 88px; border-radius: 22px; transform: rotate(45deg); }
.node.boss .node-face { transform: rotate(-45deg); }
@media (hover: hover) { a.node.boss:hover { transform: translate(-2px, -2px) rotate(38deg); } }
a.node.boss:active { transform: translate(4px, 4px) rotate(45deg); }
.node.locked { background: var(--paper-2); color: var(--muted); border-style: dashed; box-shadow: none; cursor: not-allowed; }
.node.done::after {
  content: "✓"; position: absolute; right: -9px; top: -9px;
  display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%;
  background: var(--lime); color: var(--on-color); border: var(--b) solid var(--line);
  font-size: .9rem; font-weight: 800;
}
.node.boss.done::after { right: auto; left: 50%; top: -14px; transform: translateX(-50%) rotate(-45deg); }
.node-label { margin-top: 22px; font-size: .8rem; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.start-tag {
  position: absolute; bottom: calc(100% + 12px); left: 50%;
  transform: translateX(-50%) rotate(-5deg);
  padding: 4px 12px; border: var(--b) solid var(--line); border-radius: 8px;
  background: var(--surface); box-shadow: var(--shadow-sm);
  font-weight: 800; font-size: .85rem; text-transform: uppercase; letter-spacing: .06em; white-space: nowrap;
}

/* ================= learn ================= */
.seg { display: inline-flex; gap: 8px; margin-bottom: 22px; }
.seg a {
  padding: 8px 18px; border: var(--b) solid var(--line); border-radius: 99px;
  font-weight: 800; background: var(--surface);
}
.seg a.active { background: var(--accent); color: var(--on-color); box-shadow: var(--shadow-sm); }
.sets { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 14px; }
.set {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  aspect-ratio: 1; padding: 8px; text-align: center !important;
}
.set b { font-size: 1.8rem; line-height: 1; font-weight: 800; }
.set span { font-size: .8rem; font-weight: 700; color: var(--muted); }
.set.hot { background: var(--accent); color: var(--on-color); }
.set.hot span { color: var(--on-color); }

.study-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 4px 0 26px; max-width: 560px; }
.study-actions .btn { min-height: 66px; font-size: 1.08rem; }
.study-list { padding: 4px 16px; }
.study-list ul { margin: 0; padding: 0; }
.study-list li { list-style: none; display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 2px dashed var(--line); }
.study-list li:first-child { border-top: 0; }
.study-list .w { font-size: 1.2rem; font-weight: 800; letter-spacing: .02em; min-width: 150px; }
.study-list .s { color: var(--muted); font-weight: 600; font-size: .95rem; flex: 1; }
.mini-speak { display: grid; place-items: center; background: none; border: 0; cursor: pointer; color: var(--muted); min-width: 44px; min-height: 44px; }
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.fact { padding: 10px 14px; font-weight: 800; font-size: 1.2rem; font-variant-numeric: tabular-nums; display: flex; justify-content: space-between; box-shadow: var(--shadow-sm); }
.fact.hot { background: var(--accent); color: var(--on-color); }
@media (max-width: 560px) { .study-list li { flex-wrap: wrap; } .study-list .w { min-width: 0; } }

/* flashcards */
.cards-wrap { max-width: 580px; margin: 0 auto; }
.flash-top { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.flash-top .bar { flex: 1; height: 18px; }
.flash-top .bar > span { background: var(--accent); }
.flash-top b { font-variant-numeric: tabular-nums; }
.flashcard { perspective: 1200px; height: 340px; cursor: pointer; }
.flash-inner { position: relative; width: 100%; height: 100%; transition: transform 380ms cubic-bezier(.2,.8,.2,1); transform-style: preserve-3d; }
.flashcard.flipped .flash-inner { transform: rotateY(180deg); }
.face {
  position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  padding: 24px; text-align: center;
  border: var(--b) solid var(--line); border-radius: 22px; box-shadow: var(--shadow-lg);
  background: var(--surface);
}
.face.back { transform: rotateY(180deg); background: var(--accent); color: var(--on-color); }
.face .big { font-size: clamp(2.6rem, 11vw, 4.2rem); font-weight: 800; line-height: 1.05; letter-spacing: -.02em; overflow-wrap: anywhere; }
.face .small { font-weight: 700; color: var(--muted); max-width: 420px; }
.face.back .small { color: var(--on-color); }
.face .tap { font-size: .8rem; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .1em; }
.flash-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 24px; }
.flash-actions .no { background: var(--red); color: var(--on-color); }
.flash-actions .yes { background: var(--lime); color: var(--on-color); }
.kbd-hint { margin-top: 14px; text-align: center; color: var(--muted); font-size: .85rem; font-weight: 600; }
.kbd-hint kbd { font-family: inherit; font-weight: 800; padding: 1px 7px; border: 2px solid var(--line); border-radius: 6px; background: var(--surface); }
@media (hover: none) { .kbd-hint { display: none; } }

/* ================= play screen ================= */
body.playing .topbar, body.playing .tabbar, body.playing .sidebar { display: none; }
body.playing .shell { display: block; }
.play {
  position: fixed; left: 0; right: 0; top: 0; z-index: 20;
  height: var(--vvh, 100dvh);
  display: flex; flex-direction: column; align-items: center;
  background: var(--paper);
  padding-top: env(safe-area-inset-top);
}
.play > * { width: 100%; max-width: 760px; }
.play-top { display: flex; align-items: center; gap: 12px; padding: 14px 16px; }
.icon-btn {
  display: grid; place-items: center; flex: none; width: 44px; height: 44px;
  background: var(--surface); border: var(--b) solid var(--line); border-radius: 12px;
  box-shadow: 2px 2px 0 var(--line); cursor: pointer;
}
.icon-btn:active { transform: translate(2px, 2px); box-shadow: none; }
.icon-btn .ic { width: 22px; height: 22px; }
.play-bar { flex: 1; height: 20px; }
.play-bar > span { background: var(--accent); }
.hearts, .score {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 10px; border: var(--b) solid var(--line); border-radius: 99px;
  font-weight: 800; font-size: 1.05rem; font-variant-numeric: tabular-nums; color: var(--on-color);
}
.hearts { background: var(--red); }
.hearts .ic { width: 20px; height: 20px; fill: currentColor; }
.score { background: var(--lime); }
.score .ic { width: 20px; height: 20px; }

.play-body { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 12px 16px 24px; }
@media (max-height: 560px) {
  .play-label { margin-bottom: 6px; }
  .q { font-size: 3rem; }
  .speak-btn { width: 84px; height: 72px; }
  .hint { margin-top: 10px; font-size: .95rem; }
  .answer { height: 60px; margin-top: 10px; }
  .tools { margin-top: 10px; }
}
.play-label {
  margin: 0 0 14px; padding: 3px 12px; border: var(--b) solid var(--line); border-radius: 8px;
  background: var(--accent); color: var(--on-color); transform: rotate(-2deg);
  font-weight: 800; text-transform: uppercase; letter-spacing: .06em; font-size: .8rem;
}
.q { font-weight: 800; font-size: clamp(3.2rem, 15vw, 5.5rem); line-height: 1.05; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.answer {
  width: 200px; max-width: 100%; height: 80px; margin-top: 16px; padding: 0 14px;
  background: var(--surface); color: var(--text); border-radius: 18px; box-shadow: var(--shadow);
  font: inherit; font-weight: 800; font-size: 2.7rem; line-height: 1; font-variant-numeric: tabular-nums;
  text-align: center; caret-color: var(--text); outline: none; -webkit-appearance: none; appearance: none;
}
.answer::placeholder { color: var(--muted); opacity: .45; }
.answer:focus { box-shadow: var(--shadow-lg); }
.q-timer { flex: none; width: 180px; height: 14px; margin-top: 18px; }
.q-timer > span { background: var(--boss); }
.q-timer.low > span { background: var(--red); }

.tools { display: flex; gap: 10px; margin-top: 16px; }
.tool-btn {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 44px; padding: 0 14px; cursor: pointer;
  background: var(--surface); border: var(--b) solid var(--line); border-radius: 12px; box-shadow: 2px 2px 0 var(--line);
  font-weight: 800; font-size: .9rem;
}
.tool-btn:active { transform: translate(2px, 2px); box-shadow: none; }
.tool-btn .ic { width: 18px; height: 18px; }

.play .kbd-hint { margin: 18px 0 0; }

/* spelling: listen buttons + sentence hint */
.listen { display: flex; align-items: center; gap: 14px; }
.speak-btn {
  width: 104px; height: 92px; border-radius: 22px; cursor: pointer;
  display: grid; place-items: center;
  background: var(--accent); color: var(--on-color);
  border: var(--b) solid var(--line); box-shadow: var(--shadow); transform: rotate(-3deg);
  transition: transform 60ms ease-out, box-shadow 60ms ease-out;
}
.speak-btn:active { transform: translate(4px, 4px) rotate(-3deg); box-shadow: none; }
.speak-btn .ic { width: 46px; height: 46px; }
.hint { margin: 18px 0 0; max-width: 380px; text-align: center; color: var(--muted); font-weight: 700; font-size: 1.05rem; }
.letters .answer { width: 340px; height: 68px; margin-top: 14px; font-size: clamp(1.5rem, 7vw, 2.2rem); letter-spacing: .05em; }

/* feedback sheet */
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 25;
  display: flex; justify-content: center;
  padding: 20px 16px calc(20px + env(safe-area-inset-bottom));
  border-top: var(--b) solid #121212;
  color: #121212;
  animation: sheet-in 180ms cubic-bezier(.2,.9,.3,1.2);
}
.play .sheet { max-width: none; }
.sheet-inner { width: 100%; max-width: 760px; }
@keyframes sheet-in { from { transform: translateY(100%); } }
.sheet.good { background: var(--good); }
.sheet.bad { background: var(--bad); }
.sheet-msg { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.sheet-msg strong { font-size: 1.6rem; line-height: 1.15; font-weight: 800; letter-spacing: -.02em; }
.sheet-msg p { margin: 0; font-weight: 700; font-size: 1.1rem; line-height: 1.5; }
.sheet-icon {
  width: 52px; height: 52px; flex: none; border-radius: 50%;
  display: grid; place-items: center; background: #fff; color: #121212;
  border: var(--b) solid #121212; transform: rotate(-8deg);
}
.sheet-icon .ic { width: 28px; height: 28px; stroke-width: 3; }
.sheet-btn { width: 100%; border-color: #121212; box-shadow: 3px 3px 0 #121212; background: #fff; color: #121212; }
.sheet-btn:active { box-shadow: none; }
.spelled { font-size: 1.45rem; letter-spacing: .04em; font-weight: 800; }
.spelled mark { background: #fff; color: #121212; padding: 0 2px; border-radius: 4px; border: 2px solid #121212; }
.yours s { text-decoration-thickness: 3px; }
.typed-wrong { text-decoration: line-through; color: var(--muted); }

/* ================= results ================= */
.results { max-width: 580px; margin: 0 auto; text-align: center; padding-top: 8px; }
.results-icon {
  width: 92px; height: 92px; margin: 0 auto 18px; border-radius: 26px;
  display: grid; place-items: center; color: var(--on-color);
  border: var(--b) solid var(--line); box-shadow: var(--shadow); transform: rotate(-6deg);
}
.results-icon .ic { width: 46px; height: 46px; stroke-width: 3; }
.results.won .results-icon { background: var(--good); }
.results.lost .results-icon { background: var(--bad); }
.results.lost .results-icon .ic { fill: currentColor; stroke-width: 2; }
.stat-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 8px 0 22px; }
.stat-tile { border: var(--b) solid var(--line); border-radius: 14px; box-shadow: var(--shadow-sm); overflow: hidden; color: var(--on-color); }
.stat-tile span { display: block; padding: 5px 0; font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; border-bottom: var(--b) solid var(--line); }
.stat-tile b { display: flex; align-items: center; justify-content: center; gap: 4px; padding: 12px 0; font-size: 1.25rem; font-variant-numeric: tabular-nums; background: var(--surface); color: var(--text); }
.stat-tile .ic { width: 20px; height: 20px; }
.xp-tile span { background: var(--yellow); }
.acc-tile span { background: var(--lime); }
.time-tile span { background: var(--cyan); }
.new-badge {
  display: flex; align-items: center; gap: 14px; text-align: left;
  margin: 0 0 18px; padding: 12px 16px;
  background: var(--yellow); color: var(--on-color);
  border: var(--b) solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); transform: rotate(-1.5deg);
}
.new-badge .medal { margin: 0; flex: none; background: #fff; color: #121212; border-style: solid; border-color: #121212; }
.new-badge strong { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; }
.new-badge p { margin: 0; font-weight: 800; font-size: 1.15rem; }
.missed { text-align: left; padding: 14px 16px; }
.missed h2 { margin: 0 0 8px; font-size: 1.15rem; font-weight: 800; }
.missed ul { list-style: none; margin: 0; padding: 0; }
.missed li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-top: 2px dashed var(--line); font-weight: 700; font-variant-numeric: tabular-nums; }
.missed li:first-child { border-top: 0; }
.results-actions { display: grid; gap: 14px; margin-top: 26px; }
@media (min-width: 640px) { .results-actions { grid-template-columns: 1fr 1fr; } .results-actions .primary { order: 2; } }

/* ================= sound test ================= */
.snd-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 14px 16px; margin-bottom: 14px; }
.snd-row h3 { margin: 0; flex-basis: 100%; font-size: 1.05rem; font-weight: 800; }
.snd-row .btn { min-height: 44px; padding: 0 14px; font-size: .9rem; }
.snd-row .btn.on { background: var(--lime); color: var(--on-color); }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
