/* Math Connect — Direction A "Neon, polished" (2026-09-26).
   Flat 2D: dark cells with coloured rings, one cyan accent, glow only on the chain. */
:root {
  --bg: #050810;
  --cell: #0a1120;
  --panel: #0c1526;
  --panel-2: #111c30;
  --line: #5b6b87;          /* >= 3:1 against --bg for control borders */
  --line-soft: #1f2c44;
  --text: #e8eef9;
  --muted: #9aa8bf;
  --faint: #64748b;
  --cyan: #67e8f9;
  --cyan-hot: #22d3ee;
  --add: #4ade80;
  --sub: #fb7185;
  --mul: #facc15;
  --div: #8b5cf6;           /* ring */
  --div-fill: #7c3aed;      /* ÷ fill when selected, with white text */
  --bad: #f43f5e;
  --ink: #050810;
  --star: #facc15;
  --r: 14px;
  --tile: 80px;
  --gap: 13px;
  --ease-out: cubic-bezier(.2, .8, .2, 1);
  --ease-pop: cubic-bezier(.3, 1.6, .5, 1);
  --ease-back: cubic-bezier(.34, 1.56, .64, 1);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: "Baloo 2", system-ui, sans-serif; font-weight: 700;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
  display: flex; flex-direction: column; height: 100dvh; overflow: hidden;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
button { color: inherit; font: inherit; }
button:focus-visible, a:focus-visible { outline: 3px solid var(--cyan-hot); outline-offset: 3px; }
svg.ic { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---- Site topbar (contract: ← Games + wordmark h1 + feedback mount) ---- */
.topbar {
  flex: none; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  width: 100%; max-width: 1320px; margin: 0 auto; padding: 8px 16px 2px;
}
.topbar > [data-feedback-mount] { display: flex; flex-shrink: 0; --feedback-ink: var(--muted); }
.hub-back {
  display: inline-flex; align-items: center; min-height: 40px; padding: 0 14px;
  border: 1px solid var(--line); border-radius: 999px; color: #dfe7f5; background: var(--panel);
  font-size: 13px; font-weight: 800; text-decoration: none; white-space: nowrap;
}
.hub-back:hover { border-color: var(--cyan-hot); }
.wordmark {
  margin: 0; font-weight: 400; font-family: "Press Start 2P", monospace; font-size: 11px;
  color: var(--cyan); letter-spacing: 1px; white-space: nowrap;
}
@media (max-width: 380px) { .wordmark { font-size: 9px; letter-spacing: 0; } .hub-back { padding: 0 10px; } }

#app { flex: 1; min-height: 0; width: 100%; max-width: 1320px; margin: 0 auto; padding: 0 16px 10px; position: relative; }
.screen { height: 100%; animation: screen-in .16s var(--ease-out); }

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 52px; padding: 0 20px; border: 2px solid var(--line); border-radius: var(--r);
  background: var(--panel); color: var(--text); font-size: 18px; font-weight: 800; cursor: pointer;
  transition: transform .12s ease, border-color .12s ease, background .12s ease;
}
.btn:hover { border-color: var(--cyan); }
.btn:active { transform: scale(.97); }
.btn-primary { border-color: var(--cyan); background: var(--cyan); color: var(--ink); }
.btn-primary:hover { background: var(--cyan-hot); border-color: var(--cyan-hot); }
.icon-btn {
  display: inline-grid; place-items: center; width: 44px; height: 44px; padding: 0; flex: none;
  border: 1px solid var(--line); border-radius: 12px; background: var(--panel); cursor: pointer; color: var(--text);
}
.icon-btn:hover { border-color: var(--cyan); }
.icon-btn.labeled { width: auto; display: inline-flex; align-items: center; gap: 8px; padding: 0 14px; font-size: 15px; color: var(--muted); }
.icon-btn[aria-pressed="false"] { color: var(--faint); }

/* ==================== MENU ==================== */
.menu {
  display: flex; flex-direction: column; align-items: center; justify-content: safe center;
  gap: clamp(12px, 2.4dvh, 22px); max-width: 420px; margin: 0 auto; text-align: center; overflow-y: auto;
}
.menu-main, .menu-levels { display: contents; }
.hero-tape {
  display: flex; align-items: baseline; gap: 8px; justify-content: center;
  font-size: clamp(22px, 6vw, 30px); font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1;
}
.hero-tape .z { color: var(--faint); } .hero-tape .v { color: #c4cedf; }
.hero-tape .t-add { color: var(--add); } .hero-tape .t-mul { color: var(--mul); }
.hero-tape .total { color: var(--cyan); text-shadow: 0 0 18px rgba(103, 232, 249, .45); }
.hero-tape .arrow { color: var(--faint); font-size: .7em; }
.menu-sub { margin: -6px 0 0; color: var(--muted); font-size: 15px; font-weight: 600; }
.menu .play { width: 100%; font-size: 20px; min-height: 58px; }
.continue-sub { font-weight: 700; opacity: .7; }
.levels-head { width: 100%; display: flex; justify-content: space-between; align-items: baseline; color: var(--muted); font-size: 14px; margin-bottom: -8px; }
.levels-head b { color: var(--text); font-weight: 800; margin-left: 4px; }
.levels-head .stars-total { color: var(--star); }
.levels-head .of { color: var(--muted); }
.level-grid { width: 100%; display: grid; grid-template-columns: repeat(5, 1fr); gap: clamp(6px, 1.3dvh, 10px); }
.level-cell {
  position: relative; aspect-ratio: 1 / .86; border: 2px solid var(--line-soft); border-radius: 12px;
  background: var(--panel); color: var(--text); font-size: clamp(17px, 4.6vw, 22px); font-weight: 800;
  cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1;
  font-variant-numeric: tabular-nums; padding: 0;
}
.level-cell:hover:not(:disabled) { border-color: var(--cyan); }
.level-cell .st { display: flex; gap: 1px; margin-top: 3px; height: 9px; }
.level-cell .st i, .stars-big i { clip-path: polygon(50% 0, 62% 35%, 100% 38%, 70% 60%, 80% 100%, 50% 78%, 20% 100%, 30% 60%, 0 38%, 38% 35%); }
.level-cell .st i { width: 9px; height: 9px; background: var(--star); }
.level-cell .st i.off { background: #26324a; }
.level-cell.done { border-color: #2a3a57; }
.level-cell.current { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(103, 232, 249, .16); color: var(--cyan); }
.level-cell:disabled { cursor: default; border-color: var(--line-soft); }
.level-cell:disabled .num { opacity: .45; }
.level-cell:disabled svg.ic { width: 13px; height: 13px; margin-top: 3px; stroke-width: 2.4; color: var(--faint); }
.menu-foot { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; order: 5; }
@media (min-aspect-ratio: 13/10) {
  .menu { flex-direction: row; max-width: 1000px; height: 100%; gap: clamp(32px, 6vw, 80px); overflow: hidden; }
  .menu-main { display: flex; flex-direction: column; align-items: center; gap: 18px; flex: 1 1 0; max-width: 400px; }
  .menu-levels { display: flex; flex-direction: column; gap: 14px; flex: none; width: min(480px, calc((100dvh - 140px) * 1.08)); }
  .menu-foot { order: 0; }
  .hero-tape { font-size: clamp(30px, 3vw, 40px); }
}

/* ==================== GAME ==================== */
/* Portrait: bar, target strip, tape, then the board takes the rest. */
.game { display: flex; flex-direction: column; }
.frame { flex: 1; min-height: 0; width: 100%; max-width: 560px; margin: 0 auto; display: flex; flex-direction: column; }
.bar { flex: none; display: flex; align-items: center; gap: 10px; padding: 2px 0 8px; }
.bar .lvl { font-size: 18px; font-weight: 800; white-space: nowrap; }
.bar .best { font-size: 14px; color: var(--faint); white-space: nowrap; }
.bar .count { margin-left: auto; font-size: 16px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.bar .count b { color: var(--text); font-weight: 800; }
.rule-icon { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; color: var(--cyan); border: 1px solid rgba(103, 232, 249, .45); }
.rule-icon svg.ic { width: 20px; height: 20px; stroke-width: 2; }
.stage { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.side { flex: none; display: flex; flex-direction: column; min-width: 0; }
.board { flex: 1; min-height: 0; min-width: 0; display: flex; align-items: center; justify-content: center; padding: 6px 0; touch-action: none; }

/* Targets */
.targets { display: flex; flex-wrap: wrap; justify-content: center; gap: 5px; align-content: flex-start; }
.chip {
  position: relative; min-width: 44px; height: 46px; padding: 0 6px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  border: 2px solid rgba(103, 232, 249, .55); border-radius: 12px; background: var(--cell);
  color: var(--text); font-size: 20px; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums;
  transition: background .2s ease, border-color .2s ease, color .2s ease, opacity .2s ease;
}
.chip .n { padding-top: 3px; }
.chip.flying .n { opacity: 0; }
.chip svg.ok { display: none; }
.chip .dots { display: flex; gap: 3px; margin-top: 3px; }
.chip .dot { width: 9px; height: 9px; border-radius: 50%; border: 2px solid var(--muted); }
.chip.many .dots { gap: 2px; }
.chip.many .dot { width: 7px; height: 7px; border-width: 1.5px; }
.chip .dot.filled { background: var(--cyan); border-color: var(--cyan); }
.chip .dots.over .dot { border-color: var(--bad); background: var(--bad); }
.chip.would-match { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(103, 232, 249, .22), 0 0 18px rgba(103, 232, 249, .35); animation: chip-pulse .3s ease-in-out infinite alternate; }
.chip.length-off { border-color: var(--mul); border-style: dashed; }
.chip.matched { border-color: transparent; background: rgba(103, 232, 249, .12); color: rgba(103, 232, 249, .75); flex-direction: row; gap: 3px; font-size: 17px; }
.chip.matched .n { padding-top: 2px; }
.chip.matched .dots { display: none; }
.chip.matched svg.ok { display: block; width: 15px; height: 15px; stroke-width: 3; }
.chip.coach-ring { border-color: var(--cyan); box-shadow: 0 0 0 4px rgba(103, 232, 249, .3); }
.game.tip-dots .chip .dots { animation: dots-pulse .5s ease 4; }
.game.won .chip { animation: wave .5s var(--ease-out) calc(var(--i) * 40ms) both; }

/* Tape: the largest element on the page */
.tape-wrap { padding: 8px 0 2px; min-width: 0; }
.tape { height: 56px; display: flex; align-items: center; justify-content: center; min-width: 0; font-variant-numeric: tabular-nums; font-weight: 800; line-height: 1; white-space: nowrap; }
.tape .terms { display: flex; align-items: center; justify-content: flex-end; overflow: hidden; min-width: 0; flex: 0 1 auto; }
.tape.long .terms { -webkit-mask-image: linear-gradient(90deg, transparent, #000 36px); mask-image: linear-gradient(90deg, transparent, #000 36px); }
.tape .tk { display: inline-flex; align-items: center; flex: none; font-size: 23px; padding: 0 3px; }
.tape .terms .tk:last-child, .tape .terms .tk:nth-last-child(2) { animation: tk-in .12s var(--ease-out); }
.tape .zero { color: var(--faint); }
.tape .v { color: #c4cedf; }
.tape .arrow { color: var(--faint); font-size: 16px; padding: 0 2px; }
.tape .arrow.hide { display: none; }
.tape .t-add { color: var(--add); } .tape .t-sub { color: var(--sub); } .tape .t-mul { color: var(--mul); } .tape .t-div { color: #c4b5fd; }
.tape .tk.err { color: var(--bad); text-decoration: line-through; }
.tape .tk.flash { animation: flash .9s ease-in-out infinite; }
.tape .tk.total { font-size: 50px; color: var(--text); padding-left: 6px; }
.tape.idle .total { color: #3a4863; }
.tape.good .total { color: var(--cyan); text-shadow: 0 0 18px rgba(103, 232, 249, .45); }
.tape.bad .total { color: var(--bad); }
.tape svg.ok { display: none; width: 26px; height: 26px; stroke-width: 3; margin-left: 2px; color: var(--cyan); }
.tape.good svg.ok { display: block; }
.tape.ghost .terms, .tape.ghost .total { opacity: .85; }
.tape.shake { animation: shake .3s ease; }
.note { height: 24px; margin: 0; display: flex; justify-content: center; font-size: 15px; font-weight: 700; white-space: nowrap; overflow: hidden; }
.note span { overflow: hidden; text-overflow: ellipsis; }
.note .reason { color: #fda4af; }
.note.soft .reason { color: var(--muted); }
.note .tip { color: var(--text); }
.note.has-reason .tip { display: none; }

/* Board */
.grid {
  position: relative; display: grid; gap: var(--gap);
  grid-template-columns: repeat(var(--cols), var(--tile)); grid-template-rows: repeat(var(--rows), var(--tile));
}
.grid:focus { outline: none; }
.hole { border: 2px dashed rgba(91, 107, 135, .22); border-radius: calc(var(--tile) * .2); }
.game.tip-holes .hole { animation: shimmer 1.1s ease 3; }
.tile {
  --c: var(--add);
  position: relative; width: var(--tile); height: var(--tile); padding: 0; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  border: 3px solid var(--c); border-radius: calc(var(--tile) * .2);
  background: color-mix(in srgb, var(--c) 8%, var(--cell));
  color: var(--c); font-size: calc(var(--tile) * .34); font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; cursor: pointer; touch-action: none;
  transition: transform .09s var(--ease-pop), background .09s ease, color .09s ease, border-color .09s ease;
}
.tile .lbl { padding-top: .1em; pointer-events: none; }
.tile .step { position: absolute; top: 5%; left: 9%; font-style: normal; font-size: max(10px, calc(var(--tile) * .14)); opacity: .7; pointer-events: none; }
.tile .step:empty { display: none; }
.tile.add { --c: var(--add); } .tile.sub { --c: var(--sub); } .tile.mul { --c: var(--mul); }
.tile.div { --c: var(--div); color: #fff; background: color-mix(in srgb, var(--div-fill) 26%, var(--cell)); }
.tile.bad { --c: var(--faint); }
/* "not a start" corner: hatched in the tile's own colour */
.tile.nostart::after {
  content: ""; position: absolute; top: 0; right: 0; width: 30%; height: 30%; pointer-events: none;
  background: repeating-linear-gradient(-45deg, var(--c) 0 2px, transparent 2px 5px);
  clip-path: polygon(0 0, 100% 0, 100% 100%); opacity: .7;
}
.tile.selected, .tile.ghost { background: var(--c); color: var(--ink); transform: scale(1.06); }
.tile.div.selected, .tile.div.ghost { background: var(--div-fill); border-color: var(--div-fill); color: #fff; }
.tile.selected.nostart::after, .tile.ghost.nostart::after { background: repeating-linear-gradient(-45deg, rgba(5, 8, 16, .45) 0 2px, transparent 2px 5px); }
.grid.bad .tile.selected { background: var(--bad); border-color: var(--bad); color: #fff; }
.grid.good .tile.selected { background: var(--add); border-color: var(--add); color: var(--ink); }
.tile.shake { animation: shake .25s ease; }

/* Chain line, drawn above the tiles */
.chain { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; z-index: 3; }
.chain .glow { fill: none; stroke: var(--cyan); stroke-width: max(14px, calc(var(--tile) * .22)); stroke-linecap: round; stroke-linejoin: round; opacity: .22; filter: blur(6px); }
.chain .core { fill: none; stroke: var(--cyan); stroke-width: max(8px, calc(var(--tile) * .11)); stroke-linecap: round; stroke-linejoin: round; opacity: .8; }
.chain .live { stroke-width: max(6px, calc(var(--tile) * .09)); stroke-linecap: round; }
.chain .head { fill: #fff; filter: drop-shadow(0 0 6px var(--cyan)) drop-shadow(0 0 12px var(--cyan)); }
.grid.bad .chain .core, .grid.bad .chain .glow { stroke: var(--bad); }
.grid.good .chain .core, .grid.good .chain .glow { stroke: var(--add); }

.game.paused .board, .game.paused .side { filter: blur(6px); opacity: .5; }
.game.won .board { opacity: .35; transition: opacity .4s; }

/* Landscape wider than 1.3:1: board, tape and targets are ONE centred composition, and the
   bar spans exactly that composition. */
@media (min-aspect-ratio: 13/10) {
  .game { justify-content: center; align-items: center; }
  .frame { flex: none; width: auto; max-width: 100%; }
  .stage { flex: none; flex-direction: row; align-items: center; justify-content: center; gap: var(--col-gap, 40px); }
  .board { flex: none; order: -1; padding: 0; }
  .side { width: clamp(280px, 27vw, 420px); }
  .side .targets { order: 1; justify-content: flex-start; padding-top: 14px; gap: 7px; }
  .side .targets::before { content: "Targets"; width: 100%; font-size: 13px; color: var(--muted); margin-bottom: 2px; }
  .tape-wrap { padding: 6px 16px 8px; border: 1px solid var(--line-soft); border-radius: 16px; background: var(--panel); }
  .tape { justify-content: flex-start; }
  /* The tape column is narrower than a sentence at laptop widths: the note keeps two lines
     reserved and wraps into them instead of ellipsising the tutorial's one rule. */
  .side .note { justify-content: flex-start; height: auto; min-height: 2.5em; line-height: 1.25; white-space: normal; overflow: visible; }
  .side .note span { overflow: visible; text-overflow: clip; white-space: normal; }
  .bar { padding-bottom: 14px; }
}
@media (min-aspect-ratio: 13/10) and (min-height: 760px) {
  .chip { height: 56px; min-width: 54px; font-size: 24px; }
  .tape { height: 66px; } .tape .tk { font-size: 26px; } .tape .tk.total { font-size: 58px; }
  .bar .lvl { font-size: 20px; }
}
@media (min-aspect-ratio: 13/10) and (min-height: 950px) {
  .side { width: clamp(300px, 24vw, 460px); }
  .chip { height: 64px; min-width: 62px; font-size: 28px; border-radius: 14px; }
  .chip .dot { width: 11px; height: 11px; }
  .tape { height: 80px; } .tape .tk { font-size: 30px; } .tape .tk.total { font-size: 70px; }
  .tape svg.ok { width: 32px; height: 32px; }
  .note { height: 28px; font-size: 18px; }
  .bar .lvl { font-size: 22px; } .bar .count { font-size: 19px; }
}

/* ==================== SHEETS (win / pause / how to) ==================== */
.sheet-root { position: fixed; inset: 0; z-index: 30; }
.sheet-scrim { position: absolute; inset: 0; background: rgba(5, 8, 16, .55); animation: fade .18s ease; }
.sheet {
  position: absolute; left: 50%; bottom: 0; width: min(440px, 100%);
  transform: translateX(-50%); border: 1px solid var(--line-soft); border-bottom: 0;
  border-radius: 22px 22px 0 0; background: var(--panel); padding: 20px 20px calc(20px + env(safe-area-inset-bottom));
  box-shadow: 0 -12px 40px rgba(0, 0, 0, .5); animation: sheet-up .26s var(--ease-out);
  display: flex; flex-direction: column; gap: 12px; text-align: center; max-height: 100%; overflow-y: auto;
}
.sheet-root.win .sheet { animation: card-in .22s var(--ease-back); }
/* On a desktop the sheets sit centred instead of clinging to the bottom edge (this block must
   follow the base .sheet rule: same specificity, later wins). */
@media (min-aspect-ratio: 13/10) {
  .sheet { bottom: auto; top: 50%; transform: translate(-50%, -50%); border-bottom: 1px solid var(--line-soft); border-radius: 22px; padding-bottom: 20px; box-shadow: 0 18px 50px rgba(0, 0, 0, .55); animation: card-in-centred .22s var(--ease-back); }
  .sheet-root.win .sheet { animation: card-in-centred .22s var(--ease-back); }
}
.sheet h2 { margin: 0; font-size: 24px; font-weight: 800; line-height: 1.1; }
.stars-big { display: flex; justify-content: center; gap: 10px; margin: 2px 0; }
.stars-big i { width: 46px; height: 46px; background: #26324a; }
.stars-big i.on { background: var(--star); animation: stamp .3s var(--ease-pop) both; animation-delay: .1s; }
.stars-big i.on:nth-child(2) { animation-delay: .25s; } .stars-big i.on:nth-child(3) { animation-delay: .4s; }
.rule { display: flex; justify-content: center; gap: 14px; font-size: 15px; color: var(--muted); }
.rule span.me { color: var(--text); }
.stats { display: flex; justify-content: center; gap: 10px; }
.stats div { flex: 1; max-width: 130px; padding: 8px 6px; border-radius: 12px; background: var(--cell); border: 1px solid var(--line-soft); }
.stats b { display: block; font-size: 22px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stats small { color: var(--muted); font-size: 12px; }
.sheet .actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 4px; }
.sheet .actions .btn-primary { grid-column: 1 / -1; min-height: 56px; font-size: 20px; }
.sheet.howto .actions, .sheet-root.howto .actions { grid-template-columns: 1fr; }
.sheet .opt { display: flex; justify-content: center; gap: 10px; }
.howto { text-align: left; color: var(--muted); font-size: 15px; line-height: 1.5; font-weight: 600; }
.howto p { margin: 0 0 10px; }
.howto b { color: var(--text); }

/* ==================== COACH ==================== */
.coach-layer { position: fixed; inset: 0; z-index: 20; pointer-events: none; }
.coach-layer:empty { display: none; }
.coach-dim, .coach-trail { position: absolute; inset: 0; width: 100%; height: 100%; animation: fade .25s ease; }
.coach-trail path { fill: none; stroke: var(--cyan); stroke-width: 8; stroke-linecap: round; opacity: .35; }
.coach-hand { position: absolute; left: 0; top: 0; opacity: 0; will-change: transform, opacity; }
.hand-svg { display: block; width: 100%; height: 100%; overflow: visible; filter: drop-shadow(0 5px 10px rgba(0, 0, 0, .55)); }
.game.tip-lines .rule-icon { animation: pulse-ring .8s ease 4; }

/* ---- ×/÷ start bubble, fly-to-target, particles ---- */
.toast {
  position: fixed; left: 50%; bottom: 9%; transform: translateX(-50%); z-index: 40;
  padding: 9px 14px; border-radius: 12px; border: 1px solid rgba(251, 113, 133, .7);
  background: var(--panel-2); color: #fecdd3; font-size: 15px; font-weight: 800; pointer-events: none;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .5); animation: fade .15s ease;
}
.toast.anchored { bottom: auto; width: max-content; max-width: calc(100vw - 16px); text-align: center; }
.toast.anchored::after {
  content: ""; position: absolute; left: 50%; bottom: -6px; width: 10px; height: 10px; margin-left: -5px;
  background: var(--panel-2); border-right: 1px solid rgba(251, 113, 133, .7); border-bottom: 1px solid rgba(251, 113, 133, .7); transform: rotate(45deg);
}
.toast.anchored.below::after { bottom: auto; top: -6px; transform: rotate(225deg); }
.fly { position: fixed; z-index: 40; pointer-events: none; font-weight: 800; color: var(--cyan); font-size: 36px; line-height: 1; text-shadow: 0 0 14px rgba(103, 232, 249, .6); transform: translate(-50%, -50%); }
.particle { position: fixed; z-index: 50; width: 7px; height: 7px; border-radius: 50%; pointer-events: none; }

/* ---- Animations ---- */
.pop { animation: pop .35s var(--ease-pop); }
@keyframes pop { 40% { transform: scale(1.25); } }
@keyframes shake { 20% { transform: translateX(-6px); } 40% { transform: translateX(6px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(4px); } }
@keyframes chip-pulse { to { transform: scale(1.12); } }
@keyframes dots-pulse { 50% { transform: scale(1.35); } }
@keyframes tk-in { from { opacity: 0; transform: translateX(8px); } }
@keyframes fade { from { opacity: 0; } }
@keyframes screen-in { from { opacity: 0; transform: translateY(8px); } }
@keyframes sheet-up { from { transform: translate(-50%, 100%); } }
@keyframes card-in { from { transform: translate(-50%, 0) scale(.92); opacity: 0; } }
@keyframes card-in-centred { from { transform: translate(-50%, -50%) scale(.92); opacity: 0; } }
@keyframes stamp { from { transform: scale(1.8); opacity: 0; } }
@keyframes wave { 40% { transform: translateY(-7px); } }
@keyframes flash { 50% { opacity: .35; } }
@keyframes shimmer { 50% { border-color: rgba(103, 232, 249, .7); background: rgba(103, 232, 249, .08); } }
@keyframes pulse-ring { 50% { box-shadow: 0 0 0 6px rgba(103, 232, 249, .25); } }
@keyframes particle-fly { to { transform: translate(var(--dx), var(--dy)) scale(.2); opacity: 0; } }

@media (max-height: 700px) {
  .tape { height: 46px; } .tape .tk { font-size: 20px; } .tape .tk.total { font-size: 40px; }
  .chip { height: 42px; font-size: 18px; }
  .tape-wrap { padding-top: 4px; }
  .bar { padding-bottom: 4px; }
  .note { height: 22px; font-size: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .tile.selected, .tile.ghost { transform: none; }
  .coach-hand { opacity: 1; }
}
