/* Anagram Blast web game (#359). Loaded by templates/anagram_game/blast.html.
   Ink and amber (D1): the game, start and end screens sit on Blast ink, and
   amber is the one accent (the fuse, the main button, solved words and the
   score). Coral marks misses. The run grid's results are the one exception:
   green solved, red missed, like the share text (#456). The game screen follows art board A3 and the
   Part 3 tile states of the design review; the app matches it
   (flutter/anagram_blast/DESIGN.md, BlastUiConfig). */
.blast-shell {
  --b-ink: #1c2333;
  --b-raised: #252f45;
  --b-line: #34405a;
  --b-track: #2b3550;
  --b-amber: #e0a526;
  --b-amber-light: #f6cf6c;
  --b-amber-deep: #a8740c;
  --b-coral: #e4685a;
  --b-coral-light: #ff8f7f;
  --b-green: #4ade80;
  --b-red: #d6453d;
  --b-text: #e8ecf4;
  --b-soft: #cfd6e4;
  --b-muted: #9aa6bf;
  --b-faint: #7d89a3;
  --b-mono: "JetBrains Mono", ui-monospace, Menlo, monospace;
  --b-display: "Fraunces", Georgia, serif;
  --b-body: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;

  position: relative;
  border: 1px solid var(--b-line);
  border-radius: 18px;
  background: var(--b-ink);
  color: var(--b-text);
  font-family: var(--b-body);
  box-shadow: 0 12px 32px -12px rgba(10, 15, 30, 0.55);
  padding: 1.5rem;
  max-width: 30rem;
  margin: 2rem auto;
}
.blast-shell button { font-family: var(--b-body); }
.blast-shell svg.bi { width: 1em; height: 1em; }

.blast-title {
  font-family: var(--b-display);
  font-size: clamp(1.6rem, 3.5vw, 2.2rem);
  font-weight: 700;
  color: var(--b-text);
  text-align: center;
}
.blast-title em { color: var(--b-amber-light); font-style: italic; }
.blast-subtitle {
  text-align: center;
  color: #b4bdd0;
  font-size: 0.95rem;
  margin-top: 0.25rem;
}

/* Buttons: amber for the main action, raised ink for everything else. */
.blast-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border-radius: 12px;
  border: 1px solid var(--b-line);
  background: var(--b-raised);
  color: var(--b-text);
  font-weight: 700;
  font-size: 0.9rem;
  padding: 0.6rem 1.5rem;
  cursor: pointer;
  transition: border-color 120ms ease, color 120ms ease, transform 80ms ease;
  text-decoration: none;
}
.blast-btn:hover { border-color: var(--b-amber); color: var(--b-amber-light); }
.blast-btn:active { transform: scale(0.97); }
.blast-btn:disabled { opacity: 0.35; cursor: default; }
.blast-btn-primary {
  border: 0;
  border-radius: 14px;
  background: linear-gradient(var(--b-amber-light), var(--b-amber));
  color: #2a1a02;
  font-weight: 800;
  box-shadow: inset 0 -4px 0 var(--b-amber-deep), 0 6px 20px rgba(224, 165, 38, 0.3);
}
.blast-btn-primary:hover { color: #2a1a02; filter: brightness(1.05); }
.blast-shell :focus-visible { outline: 2px solid var(--b-amber); outline-offset: 2px; }

/* Screens */
.blast-screen { display: none; }
.blast-screen.active { display: block; }

/* Cards on the start and end screens (the app call to action, #176) */
.blast-watch-card {
  margin-top: 1.25rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--b-line);
  border-radius: 12px;
  background: var(--b-raised);
  text-align: center;
}
.blast-watch-card-title { font-weight: 700; font-size: 0.92rem; color: var(--b-text); }
.blast-watch-card-desc { font-size: 0.82rem; color: var(--b-muted); margin: 0.25rem 0 0.6rem; }

/* ═════════ The start screen (art board C2, ideas L1-L3, #362) ═════════ */
.st { display: grid; gap: 14px; align-content: start; }
.st [hidden] { display: none !important; }
.st-head { display: grid; gap: 6px; justify-items: start; }
.st-head .blast-logo { margin: 0; width: 100%; max-width: 220px; line-height: 0; }
.st-date { font-family: var(--b-mono); font-size: 10.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--b-muted); }
.st-rules { display: grid; gap: 8px; }
.st-rule { display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 10px; align-items: center; font-size: 13.5px; line-height: 1.4; color: var(--b-soft); }
.st-rule svg { width: 22px; height: 22px; color: var(--b-amber-light); justify-self: center; }
.st-rule b { color: #fff; }
.st-go { display: grid; gap: 8px; }
.st-go .sc-go, .st-played .sc-go { width: 100%; flex: none; }
.st-note { margin: 0; text-align: center; font-size: 13px; color: var(--b-soft); }
.st-limit { font-weight: 700; color: var(--b-amber-light); }
.st-dateline { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; width: 100%; }
.st-num { font-family: var(--b-mono); font-size: 10.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--b-amber-light); white-space: nowrap; }
/* #664: the countdown to the next puzzle, at the player's midnight */
.st-next, .sc-next { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.st-next .k, .sc-next .k { font-family: var(--b-mono); font-size: 10.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--b-muted); }
.st-next .v { font-family: var(--b-display, inherit); font-weight: 800; font-size: 28px; color: var(--b-amber-light); font-variant-numeric: tabular-nums; }
.sc-next { flex: 10; justify-content: center; }
#screen-end .sc-acts .sc-go { flex: 14; }
.sc-next .k { font-size: 9.5px; }
.sc-next .v { font-weight: 800; font-size: 17px; color: var(--b-amber-light); font-variant-numeric: tabular-nums; }
#daily-limit-container .app-cta-slot .blast-watch-card { margin-top: 8px; }
.st-played { display: grid; gap: 10px; }
.st-score { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.st-score .v { font-weight: 800; font-size: 15px; color: var(--b-text); white-space: nowrap; }
.st-score .v b { font-family: var(--b-display); font-size: 40px; line-height: 1; color: var(--b-amber-light); margin-right: 4px; font-variant-numeric: tabular-nums; }
.st-score .k { font-size: 12px; color: var(--b-muted); text-align: right; }
.st-mini { gap: 3px; }
.st-mini .sc-row { grid-template-columns: 62px repeat(5, minmax(0, 1fr)); gap: 3px; }
.st-mini .sc-cell { height: 12px; border-radius: 4px; cursor: default; }
.sc-go.copied { filter: brightness(1.08); }
.st-ghost { height: 44px; border-radius: 12px; border: 1px solid var(--b-line); background: var(--b-raised); color: var(--b-text); font-weight: 700; font-size: 14px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 0 14px; width: 100%; }
.st-ghost svg { width: 16px; height: 16px; }
.st-ghost:hover { border-color: var(--b-amber); color: var(--b-amber-light); }
.st-staff { display: flex; gap: 0.5rem; justify-content: center; align-items: center; }

/* Recent scores: the last 7 first runs as bars, today's highlighted */
.st-recent { display: grid; gap: 8px; background: var(--b-raised); border-radius: 12px; padding: 10px 12px; }
.st-label { font-size: 11px; font-weight: 700; color: var(--b-muted); }
.st-bars { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; align-items: end; }
.st-bar { display: grid; gap: 3px; justify-items: center; min-width: 0; }
.st-bar b { font-size: 11px; font-weight: 800; color: var(--b-soft); font-variant-numeric: tabular-nums; }
.st-bar .col { width: 100%; max-width: 26px; height: 44px; display: flex; align-items: flex-end; }
.st-bar .col i { display: block; width: 100%; border-radius: 4px 4px 2px 2px; background: var(--b-line); }
.st-bar small { font-family: var(--b-mono); font-size: 9.5px; color: var(--b-faint); white-space: nowrap; }
.st-bar.today b { color: var(--b-amber-light); }
.st-bar.today .col i { background: var(--b-amber); }
.st-bar.today small { color: var(--b-amber-light); }

/* L3: the subscribe card */
.subs { border: 1px dashed var(--b-line); border-radius: 12px; padding: 10px 12px; display: flex; gap: 10px; align-items: center; font-size: 12.5px; color: #b4bdd0; text-align: left; }
.subs > svg, .subs-line > svg { width: 18px; height: 18px; color: var(--b-amber-light); flex: 0 0 auto; }
.subs > span { min-width: 0; }
.subs small { display: block; margin-top: 2px; font-size: 11.5px; color: var(--b-muted); }
.subs a, .subs-link { color: var(--b-amber-light); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; background: none; border: 0; padding: 0; font-size: inherit; cursor: pointer; }
.subs-btn { margin-left: auto; flex: 0 0 auto; height: 34px; border-radius: 12px; border: 1px solid var(--b-line); background: var(--b-raised); color: var(--b-text); font-weight: 700; font-size: 12.5px; padding: 0 12px; cursor: pointer; }
.subs-btn:hover { border-color: var(--b-amber); color: var(--b-amber-light); }
.subs-open { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.subs-line { display: flex; gap: 10px; align-items: center; }
.subs-form { display: flex; gap: 8px; margin: 0; }
.subs-form input[type="email"] { flex: 1; min-width: 0; width: 100%; height: 38px; padding: 0 10px; border: 1px solid var(--b-line); border-radius: 10px; background: var(--b-ink); color: var(--b-text); font-size: 14px; font-family: var(--b-body); }
.subs-form input[type="email"]::placeholder { color: var(--b-faint); }
.subs-form input[type="email"]:focus { outline: none; border-color: var(--b-amber); }
.subs-submit { margin-left: 0; height: 38px; border: 0; background: linear-gradient(var(--b-amber-light), var(--b-amber)); color: #2a1a02; font-weight: 800; box-shadow: inset 0 -3px 0 var(--b-amber-deep); }
.subs-submit:hover { color: #2a1a02; filter: brightness(1.05); }
.subs-msg { font-size: 12px; color: var(--b-soft); }
.subs-msg.bad { color: var(--b-coral-light); }
#subscribe-section-end { margin-top: 20px; }

/* L2: yesterday's answers */
.st-ytitle { font-size: clamp(24px, 7.4vw, 30px); }
.st-sub { margin: 0; font-size: 13px; color: #b4bdd0; }
.sc-peek .ws { display: flex; gap: 4px 3px; flex-wrap: wrap; align-items: center; }
.sc-peek .ws .grp { display: inline-flex; gap: 3px; align-items: center; flex-wrap: nowrap; }
.sc-peek .ws .tile { --t: 22px; }
.sc-peek .ws .arrow { color: var(--b-amber-light); font-weight: 800; margin: 0 4px; }
.sc-peek .alts { font-size: 11.5px; color: var(--b-muted); }
.sc-peek .hint { color: var(--b-soft); }
.blast-shell .tile.ans { background: rgba(255, 255, 255, 0.08); box-shadow: inset 0 0 0 1.5px rgba(232, 236, 244, 0.4); color: var(--b-text); }
#screen-yesterday .sc-acts .st-ghost { flex: 2; width: auto; white-space: nowrap; padding: 0 10px; }
#screen-yesterday .sc-acts #btn-watch-yesterday { flex: 3; }

.blast-dashboard-link { font-size: 0.78rem; padding: 0.4rem 0.9rem; }

/* ═════════ The scorecard (art board B2, #361) ═════════ */
.sc { display: grid; gap: 14px; align-content: start; position: relative; }
.sc-head { display: grid; grid-template-columns: minmax(0, 1fr) 34px; gap: 8px; align-items: start; }
.sc-eyebrow { font-family: var(--b-mono); font-size: 10.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--b-muted); }
.sc-title { font-family: var(--b-display); font-weight: 700; font-size: clamp(26px, 8.4vw, 40px); line-height: 1; margin: 2px 0 0; letter-spacing: -0.01em; color: var(--b-text); }
.sc-title em { color: var(--b-amber-light); font-style: italic; }
/* E1: three tiles */
.sc-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.sc-stat { background: var(--b-raised); border-radius: 12px; padding: 8px 10px; display: grid; gap: 2px; min-width: 0; }
.sc-stat .k { font-size: 11px; color: var(--b-muted); font-weight: 600; }
.sc-stat .v { font-weight: 800; font-size: 20px; line-height: 1.1; font-variant-numeric: tabular-nums; color: var(--b-text); }
.sc-stat .v small { font-size: 11px; color: var(--b-muted); font-weight: 600; }
/* E5: the rank */
.sc-rank { display: flex; gap: 10px; align-items: center; background: var(--b-raised); border-radius: 12px; padding: 8px 12px; font-size: 13px; color: var(--b-soft); }
.sc-rank[hidden] { display: none; }
.sc-rank b { color: #fff; }
.sc-rank .bar { flex: 1; height: 8px; border-radius: 99px; background: var(--b-line); position: relative; overflow: hidden; min-width: 40px; }
.sc-rank .bar i { position: absolute; left: 0; top: 0; bottom: 0; background: var(--b-amber); border-radius: 99px; }
/* E2: the 40 squares by length */
.sc-grid { display: grid; gap: 4px; }
.sc-row { display: grid; grid-template-columns: 62px repeat(5, minmax(0, 1fr)); gap: 4px; align-items: center; }
.sc-row > small { font-family: var(--b-mono); font-size: 10px; color: var(--b-muted); white-space: nowrap; }
.sc-cell { height: 22px; border-radius: 6px; background: var(--b-track); border: 0; cursor: pointer; padding: 0; }
.sc-cell.ok { background: var(--b-green); }
.sc-cell.miss { background: var(--b-red); }
.sc-cell.sel { box-shadow: 0 0 0 2px #fff; }
@media (hover: hover) { .sc-cell:hover { filter: brightness(1.1); } }
.sc-peek { background: var(--b-raised); border-radius: 12px; padding: 10px 12px; display: grid; gap: 6px; align-content: center; font-size: 12.5px; color: var(--b-soft); min-height: 64px; }
.sc-peek .what b { color: var(--b-text); }
.sc-unlimited { justify-self: start; border: 0; background: none; padding: 0; color: var(--b-amber-light); font-weight: 800; font-size: 12.5px; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
/* E1: best score and day streak */
.sc-best { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 12px; color: var(--b-muted); }
.sc-best[hidden] { display: none; }
.sc-best b { color: #fff; }
.sc-stamp { font-family: var(--b-mono); font-size: 10px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: #2a1a02; background: var(--b-amber-light); border-radius: 6px; padding: 3px 7px; transform: rotate(-3deg); }
.sc-stamp[hidden] { display: none; }
/* E3, E4: Share, then the app card where "Practice again" would be */
.sc-acts { display: flex; gap: 8px; }
.sc-go { flex: 1; height: 52px; border: 0; border-radius: 14px; background: linear-gradient(var(--b-amber-light), var(--b-amber)); color: #2a1a02; font-weight: 800; font-size: 18px; letter-spacing: 0.02em; cursor: pointer; box-shadow: inset 0 -4px 0 var(--b-amber-deep), 0 6px 20px rgba(224, 165, 38, 0.3); display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.sc-go svg { width: 20px; height: 20px; }
.sc-go:hover { filter: brightness(1.05); }
.sc-go:active { transform: scale(0.98); }
.sc .app-cta-slot .blast-watch-card { margin-top: 0; }
.sc-flash { animation: sc-flash 1.2s ease-out; }
@keyframes sc-flash { 0%, 40% { border-color: var(--b-amber); box-shadow: 0 0 0 3px rgba(224, 165, 38, 0.35); } }
/* The "Copied" toast */
.sc-toast { position: absolute; left: 50%; top: 0; z-index: 30; transform: translate(-50%, -160%); background: var(--b-amber-light); color: #2a1a02; font-size: 12.5px; font-weight: 800; padding: 7px 14px; border-radius: 99px; white-space: nowrap; transition: transform 0.35s cubic-bezier(0.2, 0.9, 0.3, 1.3), visibility 0s 0.35s; visibility: hidden; pointer-events: none; }
.sc-toast.on { transform: translate(-50%, 0); visibility: visible; transition: transform 0.35s cubic-bezier(0.2, 0.9, 0.3, 1.3); }
@media (max-width: 360px) {
  .sc-eyebrow { letter-spacing: 0.06em; }
  .sc-row > small { font-size: 9px; letter-spacing: -0.02em; }
  .sc-rank { gap: 8px; }
  .sc-rank .bar { min-width: 28px; }
}

/* Solutions screen (after Watch) */
.blast-solutions-section { margin-bottom: 1.25rem; }
.blast-solutions-section-title {
  font-family: var(--b-display);
  font-size: 1rem;
  font-weight: 700;
  color: var(--b-text);
  margin-bottom: 0.5rem;
  padding-bottom: 0.25rem;
  border-bottom: 1px solid var(--b-line);
}
.blast-solution-card {
  padding: 0.6rem 0.75rem;
  margin-bottom: 0.5rem;
  border: 1px solid var(--b-line);
  border-radius: 10px;
  background: var(--b-raised);
}
.blast-solution-scramble { display: inline-flex; gap: 0.2rem; margin-bottom: 0.35rem; }
.blast-solution-words { display: flex; flex-wrap: wrap; gap: 0.3rem; margin-top: 0.3rem; }
.blast-solution-word {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 6px;
  background: rgba(224, 165, 38, 0.16);
  border: 1px solid rgba(224, 165, 38, 0.4);
  font-weight: 700;
  font-size: 0.82rem;
  color: var(--b-amber-light);
  letter-spacing: 0.03em;
}

/* Confirm modal (outside .blast-shell, so it repeats the tokens it needs) */
.blast-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(10, 14, 24, 0.6);
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.blast-modal-overlay.active { display: flex; }
.blast-modal {
  background: #252f45;
  border: 1px solid #34405a;
  border-radius: 16px;
  padding: 18px;
  max-width: 300px;
  width: 100%;
  text-align: center;
  color: #e8ecf4;
  font-family: "Manrope", system-ui, sans-serif;
}
.blast-modal-title { font-family: "Fraunces", Georgia, serif; font-size: 20px; font-weight: 700; margin-bottom: 6px; }
.blast-modal-text { font-size: 13px; color: #b4bdd0; margin-bottom: 14px; line-height: 1.45; }
.blast-modal-actions { display: flex; gap: 8px; justify-content: center; }
.blast-modal-actions button {
  height: 44px; border-radius: 12px; padding: 0 16px; font-weight: 700; font-size: 14px; cursor: pointer;
  font-family: inherit;
}
.blast-modal-actions .keep { border: 0; background: linear-gradient(#f6cf6c, #e0a526); color: #2a1a02; font-weight: 800; box-shadow: inset 0 -4px 0 #a8740c; }
.blast-modal-actions .leave { border: 1px solid #34405a; background: transparent; color: #e8ecf4; }
.blast-modal-actions .leave:hover { border-color: #e4685a; color: #ff8f7f; }

/* ═════════ The game screen (A3) ═════════ */
.bm {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  height: min(680px, calc(100dvh - 4rem));
  min-height: 460px;
  padding: 0;
  overflow: hidden;
  container-type: inline-size;
  outline: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.bm > * { flex: 0 0 auto; }
.blast-shell .bm:focus, .blast-shell .bm:focus-visible { outline: none; }
.bm::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(120% 60% at 50% 62%, rgba(224, 165, 38, 0.10), transparent 60%);
}

/* The shared maple tile (game-ui.css .gt.maple), on ink. */
.blast-shell .tile {
  --t: 40px;
  position: relative;
  width: var(--t);
  height: calc(var(--t) * 1.06);
  flex: 0 0 auto;
  border-radius: calc(var(--t) * 0.2);
  background: linear-gradient(#f9e6bd, #efd095);
  box-shadow: inset 0 calc(var(--t) * -0.09) 0 #c99a55, 0 2px 4px rgba(0, 0, 0, 0.35);
  color: #3a2510;
  display: grid;
  place-items: center;
  font-family: var(--b-body);
  font-weight: 800;
  font-size: calc(var(--t) * 0.52);
  line-height: 1;
  user-select: none;
  transition: transform 0.16s, opacity 0.16s;
}
.blast-shell .tile.slot {
  background: rgba(255, 255, 255, 0.04);
  box-shadow: none;
  outline: 1.5px dashed rgba(232, 236, 244, 0.28);
  outline-offset: -1.5px;
  color: transparent;
}
.blast-shell .tile.slot.cur { outline: 2px solid var(--b-amber); outline-offset: -2px; background: rgba(224, 165, 38, 0.08); }
.blast-shell .tile.slot.cur::after {
  content: ""; position: absolute; left: 24%; right: 24%; bottom: 16%; height: 2px; border-radius: 2px;
  background: var(--b-amber); animation: blast-caret 1s steps(2) infinite;
}
@keyframes blast-caret { 50% { opacity: 0; } }
.blast-shell .tile.amber {
  background: linear-gradient(#f6cf6c, #e0a526);
  box-shadow: inset 0 calc(var(--t) * -0.09) 0 #a8740c, 0 0 18px rgba(224, 165, 38, 0.55);
  color: #2a1a02;
}
.blast-shell .tile.bad { box-shadow: inset 0 calc(var(--t) * -0.09) 0 #c99a55, 0 0 0 2px var(--b-ink), 0 0 0 4px var(--b-coral); }
.blast-shell .tile.press { cursor: pointer; }
@media (hover: hover) { .blast-shell .tile.press:hover { transform: translateY(-3px); } }
.blast-solution-scramble .tile { --t: 22px; }

/* Top bar (D3) */
.btop { display: grid; grid-template-columns: 34px minmax(0, 1fr) 34px auto; align-items: center; gap: 8px; position: relative; }
.btop .ttl { display: grid; line-height: 1.15; min-width: 0; }
.btop .k { font-family: var(--b-mono); font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--b-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.btop .v { font-weight: 800; font-size: 14px; white-space: nowrap; }
.btop .v b { font-family: var(--b-display); font-size: 20px; color: var(--b-amber-light); margin-right: 2px; font-variant-numeric: tabular-nums; }
.rb { width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--b-line); background: var(--b-raised); display: grid; place-items: center; color: var(--b-soft); cursor: pointer; padding: 0; }
.rb svg { width: 16px; height: 16px; }
.rb:hover { border-color: var(--b-amber); color: var(--b-amber-light); }
/* The speaker toggle (S6), as in the other games. */
.rb.spk[aria-pressed="false"] { color: var(--b-faint); background: transparent; }
.bombs { display: flex; gap: 4px; }
.bomb { width: 26px; height: 26px; color: var(--b-text); transition: opacity 0.3s, transform 0.3s; }
.bomb.spent { opacity: 0.22; transform: scale(0.85); }
.bomb.blow { animation: blast-blow 0.6s ease-out; }
@keyframes blast-blow { 0% { transform: scale(1); } 30% { transform: scale(1.5); color: var(--b-coral); } 100% { transform: scale(0.85); opacity: 0.22; } }

/* Fuse (D2) */
.fusebox { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: center; position: relative; }
.fuse { position: relative; height: 10px; border-radius: 99px; background: var(--b-track); }
.fuse i { position: absolute; left: 0; top: 0; bottom: 0; width: 100%; border-radius: 99px; background: linear-gradient(90deg, #a8740c, #e0a526); transition: width 1s linear; }
.fuse.reset i { transition: none; }
.fuse i::after {
  content: ""; position: absolute; right: -7px; top: 50%; width: 14px; height: 14px; margin-top: -7px; border-radius: 50%;
  background: radial-gradient(circle, #fff7d6 0 25%, #f6cf6c 40%, rgba(224, 165, 38, 0) 72%);
  animation: blast-spark 0.25s infinite alternate;
}
@keyframes blast-spark { to { transform: scale(1.35); } }
.fuse.hot i { background: linear-gradient(90deg, #b8432f, #e4685a); }
.fuse.out i::after { display: none; }
.secs { font-family: var(--b-display); font-weight: 700; font-size: 26px; font-variant-numeric: tabular-nums; min-width: 36px; text-align: right; line-height: 1; }
.secs.hot { color: var(--b-coral-light); }
.bank { position: absolute; right: 48px; top: -16px; font-size: 10.5px; font-weight: 700; color: var(--b-amber-light); font-family: var(--b-mono); letter-spacing: 0.02em; opacity: 0; transition: opacity 0.2s; pointer-events: none; }
.bank.on { opacity: 1; }

/* Pips (D5): 8 groups of 5, by length */
/* Each group shrinks its squares (7px at most) so all 40 fit at 320px. */
.pips { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 4px; }
.pg { display: grid; gap: 3px; justify-items: center; min-width: 0; }
.pg .row { display: grid; grid-template-columns: repeat(5, minmax(0, 7px)); gap: 1.5px; width: 100%; justify-content: center; }
.pg .row span { width: 100%; aspect-ratio: 1; border-radius: 2px; background: var(--b-line); }
.pg .row span.ok { background: var(--b-green); }
.pg .row span.miss { background: var(--b-red); }
.pg .row span.now { background: var(--b-text); box-shadow: 0 0 0 1.5px var(--b-amber); }
.pg small { font-family: var(--b-mono); font-size: 9px; color: var(--b-faint); line-height: 1.2; }
.pg.on small { color: var(--b-amber-light); }

/* The step caption under the pips (#604): 8 LETTERS · WORD 3 OF 5 · 23 OF 40 */
.step {
  margin-top: -3px; display: flex; justify-content: center; gap: 0.55em; white-space: nowrap;
  font-family: var(--b-mono); font-size: 11px; font-weight: 700; letter-spacing: 0.1em; line-height: 14px;
  text-transform: uppercase; color: var(--b-soft);
  transition: text-shadow 0.4s, transform 0.3s;
}
.step b { font-weight: 700; color: var(--b-amber-light); }
.step i { font-style: normal; color: #4a5570; }
.step em { font-style: normal; color: var(--b-muted); }
.step.land { text-shadow: 0 0 12px rgba(246, 207, 108, 0.9); transform: scale(1.08); }
@media (max-width: 340px) { .step { letter-spacing: 0.04em; gap: 0.4em; } }

/* Stage: slots, a one-line message, the scramble */
.stage { flex: 1 1 auto; min-height: 0; display: grid; align-content: center; justify-items: center; gap: 22px; position: relative; }
.slots, .scr { display: flex; gap: 5px; justify-content: center; flex-wrap: nowrap; }
@supports (width: 1cqi) {
  .slots .tile, .scr .tile { --t: min(44px, calc((100cqi - 40px) / var(--n) - 5px)); }
}
@supports not (width: 1cqi) {
  .slots .tile, .scr .tile { --t: min(44px, calc((100vw - 72px) / var(--n) - 5px)); }
}
.say { min-height: 20px; font-size: 13px; font-weight: 700; color: var(--b-soft); text-align: center; }
.say.bad { color: var(--b-coral-light); }
.say.good { color: var(--b-amber-light); }

/* Dock: Shuffle, then Clear and Backspace (no Pass) */
.bdock { display: grid; grid-template-columns: 46px minmax(0, 1fr) 46px; gap: 8px; align-items: center; }
.bdock .mid { display: flex; justify-content: center; gap: 8px; }
.bdock .end { display: flex; justify-content: flex-end; }
.ib { width: 46px; height: 44px; display: grid; place-items: center; border-radius: 12px; background: var(--b-raised); border: 1px solid var(--b-line); color: var(--b-text); cursor: pointer; padding: 0; }
.ib svg { width: 20px; height: 20px; }
.ib:hover:not(:disabled) { border-color: var(--b-amber); color: var(--b-amber-light); }
.ib:disabled { opacity: 0.35; cursor: default; }
.ib[hidden] { display: none; }

.shakebox { animation: blast-shake 0.42s cubic-bezier(0.36, 0.07, 0.19, 0.97); }
@keyframes blast-shake { 15%, 55% { transform: translateX(-7px); } 35%, 75% { transform: translateX(7px); } 90% { transform: translateX(-2px); } }

/* ═════════ Sound and motion (#360) ═════════ */
/* The level banner (S5, #604): "8 letters" grows big over the stage (1.9x
   the old 34px), holds, then shrinks into the step caption. It is drawn at its
   peak size so the big moment is crisp; the other states scale it down. */
.lvl {
  position: absolute; left: 50%; top: 22%; z-index: 2;
  transform: translate(-50%, -50%) scale(0.26); opacity: 0;
  font-family: var(--b-display); font-style: italic; font-weight: 700;
  font-size: min(65px, 17cqi); line-height: 1.1;
  color: var(--b-amber-light); white-space: nowrap; pointer-events: none;
  text-shadow: 0 3px 30px rgba(224, 165, 38, 0.5);
  transition: transform 0.48s cubic-bezier(0.2, 1.35, 0.4, 1), opacity 0.2s;
}
.lvl.on { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.lvl.on.dock {
  opacity: 0;
  transform: translate(calc(-50% + var(--dx, 0px)), calc(-50% + var(--dy, -120px))) scale(0.16);
  transition: transform 0.52s cubic-bezier(0.55, 0, 0.35, 1), opacity 0.52s cubic-bezier(0.7, 0, 1, 0.6);
}
.lvl small {
  display: block; font-family: var(--b-mono); font-style: normal; font-weight: 500; font-size: 0.29em;
  letter-spacing: 0.16em; text-transform: uppercase; color: var(--b-soft); text-align: center;
}

/* A solve bursts (S2): amber rays from behind the word, and "+7" floats up. */
.fx { position: absolute; inset: 0; pointer-events: none; z-index: 8; overflow: hidden; }
.fx.back { z-index: auto; }
.burst { position: absolute; width: 240px; height: 240px; margin: -120px 0 0 -120px; }
.burst i {
  position: absolute; left: 50%; top: 50%; width: 4px; height: 26px; margin: -13px 0 0 -2px; border-radius: 4px;
  background: var(--b-amber); transform-origin: 50% 50%; animation: blast-ray 0.55s ease-out forwards;
}
@keyframes blast-ray {
  from { opacity: 1; transform: rotate(var(--a)) translateY(-20px) scaleY(0.4); }
  to { opacity: 0; transform: rotate(var(--a)) translateY(-110px) scaleY(1); }
}
.float {
  position: absolute; font-family: var(--b-display); font-weight: 700; font-size: 26px; color: var(--b-amber-light);
  transform: translate(-50%, -50%); text-shadow: 0 2px 12px rgba(0, 0, 0, 0.5); white-space: nowrap;
}

/* A timeout jolts the screen (S4). */
.quake { animation: blast-quake 0.5s; }
@keyframes blast-quake {
  10%, 50% { transform: translate(-4px, 2px); }
  30%, 70% { transform: translate(4px, -2px); }
  90% { transform: translate(-1px, 1px); }
}

/* Phones: the game takes over the screen, as Gramma Ana's games do. */
@media (max-width: 639px) {
  body.blast-playing > header,
  body.blast-playing > footer { display: none; }
  body.blast-playing { background: #1c2333; }
  body.blast-playing > main { padding: 0; margin: 0; max-width: none; }
  body.blast-playing .blast-shell {
    margin: 0; max-width: none; border: 0; border-radius: 0; box-shadow: none;
    min-height: 100dvh;
    padding: max(12px, env(safe-area-inset-top)) 12px max(14px, env(safe-area-inset-bottom));
  }
  body.blast-playing .bm { height: calc(100dvh - max(12px, env(safe-area-inset-top)) - max(14px, env(safe-area-inset-bottom))); min-height: 0; }
}
@media (max-width: 400px) {
  .blast-shell { padding: 1rem; margin: 1rem auto; }
}

/* Reduce motion: no flights, bursts, jolt or scale; short fades instead. */
@media (prefers-reduced-motion: reduce) {
  .blast-shell .tile.slot.cur::after, .fuse i::after { animation: none; }
  .shakebox, .bomb.blow, .quake { animation: none; }
  .fuse i { transition: none; }
  /* No grow or flight: the banner fades in at its old 34px size, holds, fades out. */
  .lvl, .lvl.on, .lvl.on.dock { transform: translate(-50%, -50%) scale(0.53); transition: opacity 0.2s; }
  .step, .step.land { transform: none; }
  .burst { display: none; }
  .sc-toast, .sc-toast.on { transition: none; }
  .sc-flash { animation: none; }
}
