/* Layout: one-screen notebook page — header, a panel (menu / HUD / results / stats), then the board with its side arrows. */
:root {
  --paper: #f3f6f9;      /* squared notebook paper */
  --rule: #cfdbea;       /* faint blue lines */
  --margin: #d4605a;     /* red margin line, also used for misses */
  --ink: #22306a;        /* blue-black pen */
  --ink-soft: #5d6a94;
  --green: #17845a;      /* the green pen from the signatures — success */
  --card: rgba(255,255,255,.72);
  --gold: #b07a12;       /* gold walls */
  --display: "Kalam", "Comic Sans MS", "Segoe Print", cursive;
  --body: "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #131a2c; --rule: #222d47; --margin: #e0716b; --ink: #e2e8ff; --ink-soft: #9aa6cc;
    --green: #4fd08d; --card: rgba(24,32,54,.8); --gold: #f2c14e; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #131a2c; --rule: #222d47; --margin: #e0716b; --ink: #e2e8ff; --ink-soft: #9aa6cc;
  --green: #4fd08d; --card: rgba(24,32,54,.8); --gold: #f2c14e; color-scheme: dark;
}

html, body { height: 100%; }
[hidden] { display: none !important; }
body {
  margin: 0;
  background-color: var(--paper);
  background-image:
    linear-gradient(90deg, transparent 10px, var(--margin) 10px, var(--margin) 11.5px, transparent 11.5px),
    repeating-linear-gradient(180deg, transparent 0 27px, var(--rule) 27px 28px);
  color: var(--ink);
  font: 16px/1.4 var(--body);
  -webkit-tap-highlight-color: transparent;
  user-select: none; -webkit-user-select: none;
  overflow: hidden;
}
.app {
  height: 100%;
  box-sizing: border-box;
  max-width: 520px;
  margin: 0 auto;
  padding-inline: 20px 16px;
  /* In the app, Capacitor passes the status and navigation bar sizes as --safe-area-inset-*. */
  /* --banner-h: room for the app's banner ad on menu screens (set by ads.js). */
  padding-block: calc(10px + var(--safe-area-inset-top, env(safe-area-inset-top, 0px))) calc(12px + var(--safe-area-inset-bottom, env(safe-area-inset-bottom, 0px)) + var(--banner-h, 0px));
  display: flex; flex-direction: column; gap: 10px;
}
header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
h1 { font: 700 2.3rem/1 var(--display); margin: 0; letter-spacing: .01em; }
h1 span { color: var(--green); }
.toggles { display: flex; gap: 6px; }
.tog {
  width: 38px; height: 38px; padding: 0; cursor: pointer;
  display: grid; place-items: center;
  border: 2px solid var(--ink); border-radius: 9px 12px 8px 11px;
  background: var(--card); color: var(--ink);
  transition: color .2s, border-color .2s, transform .15s;
}
.tog svg { width: 21px; height: 21px; }
.tog:active { transform: scale(.92); }
.tog[aria-pressed="false"] { color: var(--ink-soft); border-color: var(--ink-soft); border-style: dashed; }
.tog[aria-pressed="false"] .on, .tog[aria-pressed="true"] .off { display: none; }

/* Panel */
.panel {
  background: var(--card);
  border: 2px solid var(--ink);
  border-radius: 6px 10px 7px 12px;
  padding: 12px 14px;
  box-sizing: border-box;
}
.screen { animation: enter .25s ease-out; }
@keyframes enter { from { opacity: 0; transform: translateY(6px); } }
.stack { display: flex; flex-direction: column; gap: 8px; }
.stack p { margin: 0; font-size: .92rem; max-width: 60ch; }
.stack p strong { font-family: var(--display); font-size: 1.15rem; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.muted { color: var(--ink-soft); font-size: .85rem; }

button { font: inherit; }
button:focus-visible { outline: 3px solid var(--green); outline-offset: 3px; }
.go, .ghost {
  font: 700 1.2rem/1 var(--display);
  border: 2px solid var(--ink); border-radius: 8px 12px 9px 13px;
  padding: 9px 20px 7px; cursor: pointer;
  transition: transform .15s;
}
.go { color: var(--paper); background: var(--ink); }
.ghost { color: var(--ink); background: transparent; }
.go:active, .ghost:active { transform: scale(.96); }

.modes { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.mode {
  text-align: left; cursor: pointer; color: var(--ink);
  background: var(--paper);
  border: 2px solid var(--ink); border-radius: 7px 11px 8px 12px;
  padding: 8px 10px; min-width: 0;
  display: flex; flex-direction: column; gap: 2px;
  transition: transform .15s;
}
.mode:active { transform: scale(.97); }
.mode.hero { grid-column: 1 / -1; background: var(--ink); color: var(--paper); border-color: var(--ink); }
.mode.hero span { color: color-mix(in srgb, var(--paper) 78%, var(--ink)); }
.mode.hero em { color: color-mix(in srgb, var(--green) 55%, var(--paper)); }
.mode b { font: 700 1.3rem/1.1 var(--display); }
.mode span { font-size: .78rem; color: var(--ink-soft); line-height: 1.25; }
.mode em { font-style: normal; font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: var(--green); font-variant-numeric: tabular-nums; }

.head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.head strong { font: 700 1.3rem/1 var(--display); }
.link { background: none; border: 0; color: var(--ink-soft); font-size: .88rem; text-decoration: underline; cursor: pointer; padding: 4px; }

.hud { display: flex; flex-direction: column; gap: 10px; }
.targets { display: flex; gap: 6px; align-items: center; }
.stats { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.nums { display: flex; justify-content: space-between; gap: 8px; font-variant-numeric: tabular-nums; }
.nums div { display: flex; flex-direction: column; min-width: 0; }
.nums b { font: 700 1.6rem/1 var(--display); display: inline-block; transform-origin: left bottom; white-space: nowrap; }
.nums b.bump { animation: bump .4s cubic-bezier(.34,1.56,.64,1); }
@keyframes bump { 40% { transform: scale(1.35); color: var(--green); } }
.label { font-size: .68rem; text-transform: uppercase; letter-spacing: .1em; color: var(--ink-soft); }
.bar { height: 10px; border: 2px solid var(--ink); border-radius: 6px; overflow: hidden; }
.bar i { display: block; height: 100%; width: 100%; background: var(--ink); transform-origin: left; transition: background .3s; }
.bar.low i { background: var(--margin); }
.line { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.line span { font-size: .8rem; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.stars { font: 700 2rem/1 var(--display); color: var(--green); letter-spacing: .1em; }
.stars .dim { color: var(--rule); }

/* Board: one SVG per world, drawn in piece units */
.stage {
  flex: 1; min-height: 0;
  display: grid; place-items: center;
  touch-action: none;
  container-type: size;
}
#board { width: min(92vw, calc(100dvh - 330px), 520px); height: auto; aspect-ratio: 1; max-width: 100%; overflow: visible; }
@supports (container-type: size) {
  #board { width: max(160px, min(100cqw, 100cqh, 520px)); }
}
.defs { position: absolute; width: 0; height: 0; overflow: hidden; }
#hatch line, #hatchWin line, #hatchMiss line { stroke-width: .045; }
#hatch line { stroke: var(--ink); }
#hatchWin line { stroke: var(--green); }
#hatchMiss line { stroke: var(--margin); }

.board { display: block; }
.board polygon { vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.board .outline { fill: color-mix(in srgb, var(--paper) 85%, transparent); stroke: var(--ink); stroke-width: 3px; }
.board .piece { fill: url(#hatch); stroke: var(--ink); stroke-width: 2.5px; transition: stroke .2s, opacity .2s; }
.board .piece.fit { stroke: var(--green); }
.board.win .piece { fill: url(#hatchWin); stroke: var(--green); }
.board.miss .piece { fill: url(#hatchMiss); stroke: var(--margin); }
#board.pop { animation: pop .42s cubic-bezier(.34,1.56,.64,1); }
@keyframes pop { 35% { transform: scale(1.04) rotate(-.6deg); } }
#board.shake { animation: shake .42s ease-in-out; }
@keyframes shake { 20% { transform: translateX(-8px); } 40% { transform: translateX(7px); } 60% { transform: translateX(-5px); } 80% { transform: translateX(3px); } }

/* Gates: the approaching wall */
.wall .panel { fill: var(--ink); fill-opacity: .16; stroke: var(--ink); stroke-width: 2px; vector-effect: non-scaling-stroke; }
.wall .holes { fill: none; stroke: var(--ink); stroke-width: 2px; stroke-dasharray: 5 4; vector-effect: non-scaling-stroke; }
.wall.danger .panel { fill: var(--margin); fill-opacity: .14; }
.wall.danger .holes { stroke: var(--margin); }
.wall.passed .panel { fill: var(--green); fill-opacity: .14; stroke: var(--green); }
.wall.passed .holes { stroke: var(--green); }
.wall.hit .panel { fill: var(--margin); fill-opacity: .32; stroke: var(--margin); }
.wall.hit .holes { stroke: var(--margin); }
.mini.next { opacity: .55; }
.mini.next::before { content: "next"; position: absolute; top: -14px; left: 0; right: 0; text-align: center; font-size: .6rem; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-soft); }

.edge { cursor: pointer; outline: none; }
.edge .hit { fill: transparent; }
.edge .arrows { fill: none; stroke: var(--ink); stroke-width: 2.4px; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.edge:focus-visible .hit { stroke: var(--green); stroke-width: 2px; vector-effect: non-scaling-stroke; }
.edge.fire .hit { animation: fire .35s ease-out; }
@keyframes fire { 0% { fill: color-mix(in srgb, var(--green) 28%, transparent); } 100% { fill: transparent; } }

.mini { position: relative; width: 74px; height: 74px; flex: none; }
.mini.sm { width: 52px; height: 52px; }
.mini .board { width: 100%; height: 100%; }
.mini .outline { stroke-width: 2px; }
.mini .piece { stroke-width: 1.5px; }
.mini.sm.cur { border-radius: 8px; box-shadow: 0 0 0 3px color-mix(in srgb, var(--green) 45%, transparent); }
.mini.done { opacity: .4; }
.mini.enter { animation: tin .34s cubic-bezier(.34,1.56,.64,1); }
@keyframes tin { from { transform: scale(.55) rotate(-8deg); opacity: 0; } }
.mini.veil .piece { opacity: 0; }
.mini.veil::after {
  content: "?"; position: absolute; inset: 0;
  display: grid; place-items: center;
  font: 700 2.2rem/1 var(--display); color: var(--ink-soft);
}

/* World picker */
.worlds { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.world {
  display: flex; align-items: center; gap: 6px; min-width: 0;
  padding: 4px 6px 4px 4px; cursor: pointer; text-align: left;
  color: var(--ink); background: transparent;
  border: 2px dashed var(--ink-soft); border-radius: 8px 11px 7px 12px;
  transition: transform .15s, background .2s;
}
.world:active { transform: scale(.97); }
.world[aria-pressed="true"] { border-style: solid; border-color: var(--ink); background: var(--paper); }
.world .mini.icon { width: 30px; height: 30px; }
.world .mini.icon .piece { stroke-width: 1.2px; }
.world .mini.icon .outline { stroke-width: 1.5px; }
.world b { font: 700 1rem/1.05 var(--display); display: block; white-space: nowrap; }
.world em { font-style: normal; font-size: .68rem; color: var(--green); font-variant-numeric: tabular-nums; }
.world span.txt { min-width: 0; }
.links { display: flex; gap: 4px; }

.hint { text-align: center; font: 400 1.05rem/1.2 var(--display); color: var(--ink-soft); margin: 0; min-height: 1.3em; }
.hint.say { color: var(--green); animation: say .45s cubic-bezier(.34,1.56,.64,1); }
.hint.bad { color: var(--margin); }
@keyframes say { from { transform: scale(.7); opacity: 0; } }

@media (max-height: 760px) {
  .mode span { display: none; }
  .mode { padding: 6px 10px; }
}
@media (max-width: 360px) {
  .world .mini.icon { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .edge.fire .hit, #board.pop, #board.shake, .mini.enter, .hint.say, .nums b.bump, .screen { animation: none; }
}

/* Menu */
.world.locked { opacity: .55; }
.world.locked em { color: var(--ink-soft); }
.panel:has(#stats:not([hidden])) { max-height: 56%; overflow-y: auto; }
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px 10px; font-variant-numeric: tabular-nums; }
.stat-grid div { display: flex; flex-direction: column; min-width: 0; }
.stat-grid b { font: 700 1.15rem/1.1 var(--display); }
.ach { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.ach li { display: flex; flex-direction: column; padding: 6px 10px; border: 2px dashed var(--ink-soft); border-radius: 7px 10px 8px 9px; opacity: .65; }
.ach li.done { border-style: solid; border-color: var(--green); opacity: 1; }
.ach li b { font: 700 1rem/1.15 var(--display); }
.ach li.done b::after { content: " ✓"; color: var(--green); }
.ach li span { font-size: .8rem; color: var(--ink-soft); }
.extra { margin: 0; padding-left: 18px; color: var(--green); font-size: .9rem; }
.extra:empty { display: none; }

/* HUD power-ups */
.items { display: flex; gap: 5px; flex-wrap: nowrap; }
.line #line { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.chip {
  font: 700 .7rem/1 var(--body); color: var(--ink-soft);
  border: 1.5px dashed var(--ink-soft); background: transparent; border-radius: 999px;
  padding: 3px 8px; cursor: pointer; font-variant-numeric: tabular-nums; white-space: nowrap;
}
.chip.has { border-style: solid; border-color: var(--green); color: var(--green); }
.chip:disabled { cursor: default; }
#item-shield.has { background: color-mix(in srgb, var(--green) 14%, transparent); }

/* Wall kinds */
.wall .badge { font: 700 .5px/1 var(--body); fill: var(--ink); letter-spacing: .06px; }
.wall.gold .panel { fill: var(--gold); fill-opacity: .28; stroke: var(--gold); }
.wall.gold .holes { stroke: var(--gold); }
.wall.blink .panel { fill-opacity: .24; }
.wall.blink .holes { stroke-dasharray: 2 3; }
.wall.locked .panel { fill-opacity: .2; }
.wall.double .panel { stroke-width: 4px; }
.lockline { stroke: var(--margin); stroke-width: 5px; stroke-dasharray: 3 4; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.edge.locked .arrows { stroke: var(--margin); opacity: .45; }
.edge.hint .hit { fill: var(--green); fill-opacity: .08; animation: hint 1s ease-in-out infinite; }
.edge.hint .arrows { stroke: var(--green); }
@keyframes hint { 50% { fill-opacity: .3; } }
.guide { fill: none; stroke: var(--green); stroke-width: 4px; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 8 7; vector-effect: non-scaling-stroke; animation: guide .8s linear infinite; }
@keyframes guide { to { stroke-dashoffset: -15; } }
.mini.cur.gold .outline { stroke: var(--gold); }

/* Effects */
.stage { position: relative; }
.shard { stroke-width: 1.5px; vector-effect: non-scaling-stroke; fill: var(--ink); fill-opacity: .35; stroke: var(--ink); }
.shard.hit { fill: var(--margin); stroke: var(--margin); }
.shard.shield { fill: var(--green); stroke: var(--green); }
.float {
  position: absolute; left: 0; right: 0; top: 38%; text-align: center; pointer-events: none;
  font: 700 2rem/1 var(--display); color: var(--green);
  animation: floatUp .95s ease-out forwards;
}
.float.bad { color: var(--margin); }
.float.gold { color: var(--gold); font-size: 2.4rem; }
@keyframes floatUp { from { transform: translateY(10px) scale(.8); opacity: 0; } 20% { opacity: 1; transform: translateY(0) scale(1.1); } to { transform: translateY(-60px) scale(1); opacity: 0; } }
#flash { position: absolute; inset: 0; pointer-events: none; border-radius: 18px; opacity: 0; }
#flash.good { animation: flash .5s ease-out; background: radial-gradient(circle, color-mix(in srgb, var(--green) 30%, transparent), transparent 70%); }
#flash.bad { animation: flash .5s ease-out; background: radial-gradient(circle, color-mix(in srgb, var(--margin) 35%, transparent), transparent 70%); }
#flash.gold { animation: flash .6s ease-out; background: radial-gradient(circle, color-mix(in srgb, var(--gold) 40%, transparent), transparent 70%); }
@keyframes flash { 0% { opacity: 1; } 100% { opacity: 0; } }
.stage.slow #board { filter: saturate(.5) brightness(1.05); }
.stage.slow::before { content: "slow motion"; position: absolute; top: 2px; left: 0; right: 0; text-align: center; font: 400 .95rem/1 var(--display); color: var(--green); }
.hint.gold { color: var(--gold); }

.toast {
  position: fixed; left: 50%; top: calc(64px + var(--safe-area-inset-top, env(safe-area-inset-top, 0px)));
  transform: translateX(-50%); z-index: 10; max-width: calc(100% - 32px); box-sizing: border-box;
  display: flex; flex-direction: column; align-items: center; gap: 1px;
  padding: 8px 16px; border: 2px solid var(--green); border-radius: 9px 12px 8px 11px;
  background: var(--paper); color: var(--ink); box-shadow: 0 6px 20px rgba(0,0,0,.18);
}
.toast b { font-size: .65rem; letter-spacing: .12em; text-transform: uppercase; color: var(--green); }
.toast span { font: 700 1.15rem/1.1 var(--display); }
.toast.show { animation: toastIn .35s cubic-bezier(.34,1.56,.64,1); }
@keyframes toastIn { from { transform: translate(-50%, -20px); opacity: 0; } }

@media (max-height: 700px) {
  .items .chip { padding: 3px 7px; }
}
@media (prefers-reduced-motion: reduce) {
  .float, .toast.show, #flash.good, #flash.bad, #flash.gold, .guide, .edge.hint .hit { animation: none; }
  .float { opacity: 0; }
}

/* ---------- Game look ----------
   Buttons are chunky and pressable: a thick ink edge with a hard drop shadow that
   flattens when pressed. While a game runs, the menu bar steps aside. */
.go, .ghost, .mode, .world, .tog, .icon-btn, .chip, .store-promo {
  box-shadow: 0 4px 0 var(--ink);
  transition: transform .08s, box-shadow .08s, background .2s, color .2s;
}
.go:active, .ghost:active, .mode:active, .world:active, .tog:active, .icon-btn:active, .chip:not(:disabled):active, a.store-promo:active {
  transform: translateY(3px); box-shadow: 0 1px 0 var(--ink);
}
.go, .ghost { border-width: 2.5px; }
.ghost { background: var(--paper); }
.go.big, .ghost.big { width: 100%; font-size: 1.55rem; padding: 13px 18px 10px; }
.ghost.small { font-size: 1rem; padding: 7px 14px 5px; }
.mode { border-width: 2.5px; }
.mode.hero { box-shadow: 0 5px 0 color-mix(in srgb, var(--ink) 55%, #000); }
.world { border-width: 2.5px; box-shadow: 0 3px 0 var(--ink-soft); }
.world[aria-pressed="true"] { box-shadow: 0 4px 0 var(--ink); }
.tog[aria-pressed="false"] { box-shadow: 0 3px 0 var(--ink-soft); }
.chip { box-shadow: 0 2px 0 var(--ink-soft); }
.chip.has { box-shadow: 0 3px 0 var(--green); }
.chip:disabled { box-shadow: none; }

/* In-game top bar: pause button and the three numbers. */
body.playing header { display: none; }
body.playing .panel { padding: 10px 12px; }
.hud-bar { display: flex; align-items: center; gap: 12px; }
.hud-bar .nums { flex: 1; }
.hud-bar .nums b { font-size: 1.9rem; }
.hud-row { display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: center; }
.line-text { font-size: .8rem; color: var(--ink-soft); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn {
  flex: none; width: 50px; height: 50px; padding: 0; cursor: pointer;
  display: grid; place-items: center;
  border: 2.5px solid var(--ink); border-radius: 50%;
  background: var(--ink); color: var(--paper);
}
.icon-btn svg { width: 24px; height: 24px; fill: currentColor; }
.icon-btn:focus-visible { outline: 3px solid var(--green); outline-offset: 3px; }

/* Overlays: the pause menu is opaque (no peeking at the board), results float over it. */
.overlay {
  position: fixed; inset: 0; z-index: 30;
  display: grid; place-items: center;
  padding: calc(20px + var(--safe-area-inset-top, env(safe-area-inset-top, 0px))) 20px calc(20px + var(--safe-area-inset-bottom, env(safe-area-inset-bottom, 0px)));
  background: color-mix(in srgb, var(--paper) 72%, transparent);
  -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
}
.overlay.solid {
  background-color: var(--paper);
  background-image:
    linear-gradient(90deg, transparent 10px, var(--margin) 10px, var(--margin) 11.5px, transparent 11.5px),
    repeating-linear-gradient(180deg, transparent 0 27px, var(--rule) 27px 28px);
  -webkit-backdrop-filter: none; backdrop-filter: none;
}
.card {
  width: min(360px, 100%); box-sizing: border-box;
  display: flex; flex-direction: column; gap: 12px; text-align: center;
  padding: 22px 20px 20px;
  background: var(--paper);
  border: 3px solid var(--ink); border-radius: 14px 18px 13px 17px;
  box-shadow: 0 7px 0 var(--ink);
}
.card h2 { font: 700 2.5rem/1 var(--display); margin: 0; }
.card p { margin: 0; }
.card .extra { text-align: left; }
.menu { display: grid; gap: 12px; margin-top: 4px; }
.toggles.center { justify-content: center; gap: 12px; margin-top: 6px; }
.overlay.screen .card { animation: cardIn .3s cubic-bezier(.34,1.56,.64,1); }
@keyframes cardIn { from { transform: translateY(16px) scale(.94); opacity: 0; } }

/* Web build: a pointer to the store app. */
.store-promo {
  display: flex; flex-direction: column; gap: 1px; text-decoration: none; text-align: left;
  padding: 9px 14px 8px; border: 2.5px solid var(--green); border-radius: 10px 13px 9px 12px;
  color: var(--ink); background: var(--paper); box-shadow: 0 4px 0 var(--green); cursor: pointer;
}
.store-promo b { font: 700 1.1rem/1.1 var(--display); color: var(--green); }
.store-promo span { font-size: .8rem; color: var(--ink-soft); }
.store-promo.soon { cursor: default; border-style: dashed; box-shadow: none; }
.card .store-promo { text-align: center; align-items: center; }
body.platform-app .web-only { display: none !important; }
body.platform-web .app-only { display: none !important; }

@media (max-height: 700px) {
  .store-promo span { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .overlay.screen .card { animation: none; }
}

/* End of the tutorial: the menu arrives piece by piece. */
#home.reveal > *, #home.reveal .modes > * { animation: revealUp .5s cubic-bezier(.34,1.56,.64,1) both; }
#home.reveal > :nth-child(1) { animation-delay: .35s; }
#home.reveal .modes > :nth-child(1) { animation-delay: .5s; }
#home.reveal .modes > :nth-child(2) { animation-delay: .6s; }
#home.reveal .modes > :nth-child(3) { animation-delay: .7s; }
#home.reveal .modes > :nth-child(4) { animation-delay: .8s; }
#home.reveal .modes > :nth-child(5) { animation-delay: .9s; }
#home.reveal > :nth-child(3), #home.reveal > :nth-child(4) { animation-delay: 1s; }
#home.reveal > .modes { animation: none; }
body.revealing header { animation: revealDown .45s cubic-bezier(.34,1.56,.64,1) .2s both; }
@keyframes revealUp { from { opacity: 0; transform: translateY(18px) scale(.96); } }
@keyframes revealDown { from { opacity: 0; transform: translateY(-14px); } }
.mode.hero.pulse { animation: heroPulse 1.1s ease-in-out 1.1s 2; }
@keyframes heroPulse { 50% { transform: scale(1.035); box-shadow: 0 5px 0 color-mix(in srgb, var(--ink) 55%, #000), 0 0 0 6px color-mix(in srgb, var(--green) 35%, transparent); } }
@media (prefers-reduced-motion: reduce) {
  #home.reveal > *, #home.reveal .modes > *, body.revealing header, .mode.hero.pulse { animation: none; }
}

.row.app-only { justify-content: center; flex-wrap: wrap; gap: 8px; }
.ghost.small:disabled { opacity: .6; box-shadow: none; cursor: default; }

/* Toasts never block taps; during play they sit low, clear of the pause button and power-ups. */
.toast { pointer-events: none; }
body.playing .toast { top: auto; bottom: calc(56px + var(--safe-area-inset-bottom, env(safe-area-inset-bottom, 0px))); }
