@font-face { font-family: "Fredoka"; font-weight: 700; font-display: swap; src: url("./assets/fonts/fredoka-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Outfit"; font-weight: 400; font-display: swap; src: url("./assets/fonts/outfit-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Outfit"; font-weight: 600; font-display: swap; src: url("./assets/fonts/outfit-latin-600-normal.woff2") format("woff2"); }

:root {
  --lagoon-950: #051b1d; --lagoon-900: #072325; --lagoon-800: #0c3437; --lagoon-700: #13484c;
  --foam: #e9f6f1; --foam-dim: #a9cbc4; --hibiscus: #ff5e6c; --sun: #ffc23d; --reef: #2fc4b2; --ink-on-sun: #2a1a00;
  --sand: #f0dcae;
  --hibiscus-lip: #c43d4b; --hibiscus-deep: #8f2833; --sun-lip: #c98f12;
  --stat-w: 72px; --gap: 8px; --gutter: 16px;
  --hud-col: 164px; --controls-col: 136px;   /* landscape side columns (the camera frames around them) */
  --font-display: "Fredoka", "Baloo 2", "Arial Rounded MT Bold", system-ui, sans-serif;
  --font-body: "Outfit", "Segoe UI", system-ui, sans-serif;
  --radius-pill: 999px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--sand); color: var(--lagoon-900); font: 16px/1.4 var(--font-body); overscroll-behavior: none; }
#app { position: relative; height: 100dvh; display: grid; grid-template-rows: auto 1fr auto; grid-template-columns: minmax(0, 1fr); max-width: 720px; margin: 0 auto; }
#board { width: 100%; height: 100%; min-height: 0; display: block; touch-action: none; outline: none;
  --board-inset-top: 0px; --board-inset-right: 0px; --board-inset-bottom: 0px; --board-inset-left: 0px; }

/* HUD: two-line title (place eyebrow + level) on the left, sound + Moves + Par on the right.
   Every part has a fixed shape, so the bar looks the same on every level. */
.hud { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: max(12px, env(safe-area-inset-top)) var(--gutter) var(--gap); }
.hud-title { display: flex; flex-direction: column; min-width: 0; }
.hud-place { font: 600 12px/16px var(--font-body); letter-spacing: .08em; text-transform: uppercase; color: var(--lagoon-700); }
.hud-label { font: 700 20px/24px var(--font-display); color: var(--lagoon-900); }
.hud-place, .hud-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hud-stats { display: flex; gap: var(--gap); flex: none; }
.stat { width: var(--stat-w); height: 52px; background: var(--lagoon-900); color: var(--foam); border-radius: 14px; padding: 6px 4px; text-align: center; box-shadow: 0 4px 0 var(--lagoon-950); }
.stat span { display: block; font: 600 12px/16px var(--font-body); color: var(--foam-dim); white-space: nowrap; }
.stat span small { font-size: 12px; font-weight: 400; }
.stat b { display: block; font: 700 20px/24px var(--font-display); font-variant-numeric: tabular-nums; }

/* Buttons: brand display face, solid lip shadow, equal widths in the control row. */
.controls { display: flex; gap: 10px; justify-content: center; padding: var(--gap) var(--gutter) max(var(--gutter), env(safe-area-inset-bottom)); }
.controls button { flex: 1 1 0; max-width: 124px; min-width: 0; padding: 10px 8px; }
/* Nothing to undo or reset yet: an empty slot pressed into the sand, not a faded button that looks broken. */
.controls button:disabled { opacity: 1; filter: none; background: rgba(7, 35, 37, .07); color: rgba(7, 35, 37, .34); box-shadow: inset 0 0 0 2px rgba(7, 35, 37, .14), inset 0 3px 0 rgba(7, 35, 37, .06); }
button { font: 700 17px var(--font-display); letter-spacing: .01em; min-height: 48px; min-width: 96px; padding: 10px 18px; border-radius: var(--radius-pill); border: 0;
  background: var(--lagoon-900); color: var(--foam); cursor: pointer; box-shadow: 0 4px 0 var(--lagoon-950); }
button:active { transform: translateY(2px); box-shadow: 0 2px 0 var(--lagoon-950); }
button:disabled { opacity: .3; filter: grayscale(.8); box-shadow: none; cursor: default; }
button:not(:disabled):not(.icon) { outline: 2px solid var(--reef); outline-offset: -2px; }
button.confirming { background: var(--hibiscus); color: var(--lagoon-900); box-shadow: 0 4px 0 var(--hibiscus-lip); outline-color: var(--lagoon-900); }
button.primary { background: var(--sun); color: var(--ink-on-sun); box-shadow: 0 4px 0 var(--sun-lip); }
button.icon { min-width: 48px; width: 48px; height: 52px; padding: 0; display: grid; place-items: center; border-radius: 14px; }
button.icon .cross { display: none; }
button.icon.off .cross { display: inline; }
button.icon.off { background: var(--hibiscus-lip); color: var(--foam); box-shadow: 0 4px 0 var(--hibiscus-deep); }
button.icon.off .wave { display: none; }

/* Win and "coming soon" cards. */
.win { position: absolute; inset: 0; z-index: 2; display: grid; place-items: center; background: rgba(5, 27, 29, .55); padding: var(--gutter); }
.win[hidden] { display: none; }
.win-card { background: var(--lagoon-900); color: var(--foam); border-radius: 24px; padding: 24px; width: min(360px, 100%); text-align: center; box-shadow: 0 10px 30px rgba(0,0,0,.45); }
.win-card h2 { margin: 0 0 8px; font: 700 30px/1.1 var(--font-display); color: var(--sun); }
.win-card p { margin: 12px 0 0; text-wrap: balance; }
.stars { display: flex; justify-content: center; gap: 12px; padding: 4px 0; }
.star svg { width: 44px; height: 44px; display: block; filter: drop-shadow(0 3px 0 var(--sun-lip)); }
.star path { fill: var(--sun); stroke: var(--sun-lip); stroke-width: 1; stroke-linejoin: round; }
.star.off svg { filter: drop-shadow(0 3px 0 var(--lagoon-950)); }
.star.off path { fill: var(--lagoon-700); stroke: var(--lagoon-800); }
.win-buttons { display: flex; gap: 10px; justify-content: center; margin-top: 16px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Win card show (DECISIONS B37). Card: Tiki Tiles' spring rise. Title: the brand kit's per-letter pop.
   Stars: Jungle Duel's stamp (2.4 -> .92 -> 1), 260 ms apart, the middle one bigger (Tiki Tiles).
   Rays: Castle Match's turning sunburst. .settled (or a tap) shows the end state at once. */
#win:not([hidden]) .win-card { animation: card-up .34s cubic-bezier(.2, .9, .3, 1.2) both; }
@keyframes card-up { from { transform: translateY(48px) scale(.96); opacity: 0; } }
.win-kick { font: 600 12px/16px var(--font-body); letter-spacing: .08em; text-transform: uppercase; color: var(--foam-dim); }
#win-title .word { display: inline-block; white-space: nowrap; }
#win-title .letter { display: inline-block; animation: letter-pop .42s cubic-bezier(.2, .9, .25, 1.6) both; }
@keyframes letter-pop { from { transform: translateY(14px) scale(.2); opacity: 0; } }
.star-stage { position: relative; display: grid; place-items: center; margin: 4px 0 2px; }
.rays { position: absolute; width: 230px; height: 230px; border-radius: 50%; pointer-events: none;
  background: repeating-conic-gradient(rgba(255, 194, 61, .22) 0 12deg, transparent 12deg 30deg);
  -webkit-mask: radial-gradient(closest-side, #000 35%, transparent); mask: radial-gradient(closest-side, #000 35%, transparent);
  animation: rays-in .5s .9s ease-out both, rays-spin 9s 1.4s linear infinite; }
.rays[hidden] { display: none; }
@keyframes rays-in { from { opacity: 0; transform: scale(.4); } }
@keyframes rays-spin { to { transform: rotate(360deg); } }
.stars { position: relative; align-items: center; }
.star { animation: star-stamp .42s cubic-bezier(.2, .8, .3, 1.15) both; }
.star:nth-child(2) svg { width: 56px; height: 56px; }
@keyframes star-stamp { 0% { transform: scale(2.4) rotate(-12deg); opacity: 0; } 60% { transform: scale(.92); opacity: 1; } 100% { transform: scale(1); } }
.star.off { animation-name: star-dim; animation-duration: .3s; }
@keyframes star-dim { from { opacity: 0; transform: scale(.7); } }
.win-moves { margin-top: 6px; font: 600 15px/1.2 var(--font-body); color: var(--foam-dim); }
.win-moves b { font: 700 34px/1 var(--font-display); color: var(--foam); font-variant-numeric: tabular-nums; vertical-align: -3px; }
.badges { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: 10px; }
.badges:empty { display: none; }
.badge { font: 700 14px/1 var(--font-display); color: var(--ink-on-sun); background: var(--sun); padding: 7px 12px; border-radius: var(--radius-pill);
  box-shadow: 0 3px 0 var(--sun-lip); animation: badge-pop .38s cubic-bezier(.2, .9, .3, 1.5) both; }
@keyframes badge-pop { from { transform: scale(0) rotate(-8deg); opacity: 0; } }
.win-card.settled .letter, .win-card.settled .star, .win-card.settled .badge, .win-card.settled .rays { animation-delay: 0s !important; animation-duration: 0s; }
.win-card.settled .rays { animation: rays-spin 9s linear infinite; }
.confetti { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 10; pointer-events: none; }
.win > .confetti { position: absolute; z-index: 0; }
.win > .win-card { position: relative; z-index: 1; }
/* Short screens (a phone on its side): a compact card that always fits, scrolling if it must. */
@media (max-height: 480px) {
  .win { overflow-y: auto; align-items: start; }
  .win-card { padding: 14px 20px; margin: auto 0; }
  .win-card h2 { font-size: 24px; margin-bottom: 2px; }
  .star svg { width: 34px; height: 34px; }
  .star:nth-child(2) svg { width: 42px; height: 42px; }
  .rays { width: 160px; height: 160px; }
  .win-moves { margin-top: 2px; }
  .win-moves b { font-size: 26px; }
  .badges { margin-top: 6px; }
  .win-card p { margin-top: 6px; }
  .win-buttons { margin-top: 10px; }
  .win-card button.link { margin-top: 0; min-height: 44px; padding-block: 6px; }
}
@media (prefers-reduced-motion: reduce) {
  #win:not([hidden]) .win-card, #win-title .letter, .star, .badge, .rays { animation: none !important; }
}

/* Secondary text button (win card "All levels", tutorial Skip): quiet, still a 48px target. */
button.link, button.link:not(:disabled):not(.icon) { background: transparent; box-shadow: none; outline: 0; color: var(--foam-dim); min-width: 0; padding: 10px 14px; font-size: 15px; text-decoration: underline; text-underline-offset: 3px; }
button.link:active { transform: none; box-shadow: none; }
.win-card button.link { margin-top: 10px; }

/* Pause menu: one column of full-width buttons. */
.sheet-buttons { display: grid; gap: 12px; margin-top: 16px; }
.sheet-buttons button { width: 100%; }
#mute[aria-pressed="true"] { background: var(--hibiscus-lip); box-shadow: 0 4px 0 var(--hibiscus-deep); }
#fail { z-index: 5; }

/* Home and level select: full screens over the board (the board loads behind Home). */
.screen { position: absolute; inset: 0; z-index: 3; overflow-y: auto; padding: max(16px, env(safe-area-inset-top)) var(--gutter) max(16px, env(safe-area-inset-bottom)); }
.screen[hidden] { display: none; }
#home { background: linear-gradient(rgba(240, 220, 174, .94), var(--sand) 60%); place-items: center; }
#home:not([hidden]) { display: grid; }
.home-inner { width: min(360px, 100%); display: grid; justify-items: center; gap: 12px; text-align: center; }
.logo { width: min(300px, 80%); height: auto; }
.logo-text { margin: 0; font: 700 44px/1 var(--font-display); color: var(--lagoon-900); letter-spacing: .01em; text-wrap: balance; }
.logo-text span { color: var(--hibiscus); display: inline-block; transform: rotate(-6deg); text-shadow: 0 3px 0 var(--hibiscus-deep); }
.tagline { margin: 0; font: 600 16px/1.4 var(--font-body); color: var(--lagoon-700); }
.home-stars { margin: 0; min-height: 24px; font: 700 18px/24px var(--font-display); display: flex; gap: 6px; align-items: center; }
.home-buttons { display: grid; gap: 12px; width: 100%; margin-top: 8px; }
.home-buttons button { width: 100%; }
button.big { min-height: 64px; display: grid; place-items: center; gap: 0; font-size: 22px; line-height: 1.1; }
button.big small { font: 600 13px/1.2 var(--font-body); }
.star.small svg { width: 20px; height: 20px; filter: drop-shadow(0 2px 0 var(--sun-lip)); }

#levels { background: var(--sand); }
.levels-head { display: flex; align-items: center; gap: 12px; max-width: 520px; margin: 0 auto; }
.levels-head h2 { flex: 1; margin: 0; font: 700 26px/1 var(--font-display); }
.levels-total { font: 700 18px/24px var(--font-display); display: flex; gap: 6px; align-items: center; }
.tabs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; max-width: 520px; margin: 16px auto 0; }
button.tab { min-width: 0; padding: 8px 4px; font-size: 15px; background: var(--lagoon-800); display: flex; gap: 4px; align-items: center; justify-content: center; }
button.tab.on { background: var(--sun); color: var(--ink-on-sun); box-shadow: 0 4px 0 var(--sun-lip); }
.pack-info { max-width: 520px; margin: 14px auto 10px; font: 600 14px/1.4 var(--font-body); color: var(--lagoon-700); text-align: center; }
.grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; max-width: 520px; margin: 0 auto; }
button.tile { min-width: 0; min-height: 56px; padding: 6px 2px 4px; border-radius: 14px; display: grid; gap: 2px; place-items: center; background: var(--lagoon-800); outline: 0; }
button.tile b { font: 700 18px/1 var(--font-display); }
button.tile.solved { background: var(--lagoon-900); }
button.tile.here { outline: 3px solid var(--sun); outline-offset: -3px; }
.tile-stars { display: flex; gap: 1px; }
.pip svg { width: 11px; height: 11px; display: block; }
.pip path { fill: var(--sun); }
.pip.off path { fill: var(--lagoon-700); }

/* Ordered art (src/art.js): each image shows once its file exists; until then the plain styling stands. */
#home[data-art~="home-bg"] { background: var(--home-bg) center top / cover no-repeat, #fbdea6; }
/* Wide screens: the portrait picture is cropped to its busiest part, so a sand wash behind the
   menu column keeps it readable (a wide version of the picture is on order, BB-018). */
@media (orientation: landscape) and (min-width: 600px) {
  #home[data-art~="home-bg"] { background: linear-gradient(to right, rgba(251, 222, 166, 0), rgba(251, 222, 166, .9) calc(50% - 200px), rgba(251, 222, 166, .9) calc(50% + 200px), rgba(251, 222, 166, 0)),
    var(--home-bg) center top / cover no-repeat, #fbdea6; }
  #home[data-art~="home-bg-wide"] { background: var(--home-bg-wide) center / cover no-repeat, #fbdea6; }
}
#home[data-art~="home-bg"] .tagline { background: rgba(251, 222, 166, .9); border-radius: 999px; padding: 2px 12px; color: var(--lagoon-900); }
.place-head[data-art~="banner"] { height: 72px; display: flex; align-items: flex-end; padding: 0 12px 8px; border-radius: 14px;
  background: var(--banner) center / cover no-repeat; color: var(--lagoon-900); text-shadow: 0 1px 0 rgba(255, 255, 255, .7); }
.daily-icon { width: 40px; height: 40px; flex: none; margin: -8px -2px -8px -6px; }
.daily-top:has(.daily-icon:not([hidden])) { align-items: center; justify-content: flex-start; }
.daily-top:has(.daily-icon:not([hidden])) #daily-streak { margin-left: auto; }
.flame { width: 18px; height: 18px; vertical-align: -3px; margin-right: 4px; }
#daily-streak { display: inline-flex; align-items: center; }
#pack-art { display: flex; justify-content: center; }
img.pack-art { width: 120px; height: 120px; margin-top: 8px; }
#win-art { display: flex; justify-content: center; }
img.win-art { width: 112px; height: 112px; margin: -8px auto 2px; display: block; }
/* First visit: the name and the hook for a moment before the lesson (tap skips). */
.title-card { position: fixed; inset: 0; z-index: 5; display: grid; place-content: center; justify-items: center; gap: 8px; padding: var(--gutter);
  background: var(--home-bg, none) center top / cover no-repeat, #fbdea6; animation: title-out .35s ease 1.5s forwards; }
.title-card[hidden] { display: none; }
.title-card img { width: min(320px, 82vw); height: auto; animation: title-pop .45s cubic-bezier(.2, 1.4, .4, 1) both; }
.title-card p { margin: 0; font: 700 17px/1.3 var(--font-display); color: var(--lagoon-900); background: rgba(251, 222, 166, .9); border-radius: 999px; padding: 4px 14px; }
@keyframes title-pop { from { transform: scale(.6) rotate(-4deg); opacity: 0; } }
@keyframes title-out { to { opacity: 0; visibility: hidden; } }
@media (prefers-reduced-motion: reduce) { .title-card img { animation: none; } }
#loading-art { position: absolute; left: 50%; top: 40%; width: 140px; height: 140px; transform: translate(-50%, -50%); pointer-events: none; }

/* Daily Drive card on Home (spec 9). */
.daily { width: 100%; background: var(--lagoon-900); color: var(--foam); border-radius: 20px; padding: 12px 14px 10px; box-shadow: 0 4px 0 var(--lagoon-950); text-align: left; }
.daily-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.daily h2 { margin: 0; font: 700 20px/1.2 var(--font-display); color: var(--sun); white-space: nowrap; }
#daily-streak { font: 600 13px/1.2 var(--font-body); color: var(--foam-dim); min-width: 0; text-align: right; text-wrap: balance; }
.daily-buttons { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 10px; }
button.daily-btn { min-width: 0; padding: 6px 4px; min-height: 56px; display: grid; place-items: center; gap: 2px; font-size: 16px; background: var(--lagoon-800); }
button.daily-btn span { font: 600 12px/1 var(--font-body); color: var(--foam-dim); }
button.daily-btn.done { background: var(--lagoon-700); }
button.daily-btn .pip svg { width: 13px; height: 13px; }
.daily-next { margin: 8px 0 0; font: 600 12px/1.2 var(--font-body); color: var(--foam-dim); text-align: center; font-variant-numeric: tabular-nums; }

/* Level select: header and tabs stay pinned while the grid scrolls; place headings every 15. */
.levels-head, .tabs { position: sticky; z-index: 1; background: var(--sand); }
.levels-head { top: calc(-1 * max(16px, env(safe-area-inset-top))); padding-top: max(16px, env(safe-area-inset-top)); margin-top: calc(-1 * max(16px, env(safe-area-inset-top))); }
.tabs { top: 56px; padding: 8px 0; margin-top: 8px; }
.place-head { grid-column: 1 / -1; margin: 10px 0 0; font: 600 12px/16px var(--font-body); letter-spacing: .08em; text-transform: uppercase; color: var(--lagoon-700); }
.grid.locked .tile { opacity: .45; }
.grid.locked .tile:disabled { filter: none; }

/* "Welcome to Downtown": a short banner over the board when the place changes. */
.arrive { position: absolute; left: 50%; top: 22%; z-index: 1; transform: translateX(-50%); pointer-events: none; text-align: center;
  background: var(--lagoon-900); color: var(--foam); padding: 12px 24px; border-radius: 20px; box-shadow: 0 6px 0 var(--lagoon-950); animation: arrive 2s ease both; }
.arrive[hidden] { display: none; }
.arrive span { display: block; font: 600 13px/1.2 var(--font-body); letter-spacing: .08em; text-transform: uppercase; color: var(--foam-dim); }
.arrive b { display: block; font: 700 28px/1.15 var(--font-display); color: var(--sun); white-space: nowrap; }
@keyframes arrive { 0% { opacity: 0; transform: translate(-50%, -8px); } 12%, 82% { opacity: 1; transform: translate(-50%, 0); } 100% { opacity: 0; } }

/* Tutorial coach line and the dragging finger. */
.coach { position: absolute; left: var(--gutter); right: var(--gutter); top: 84px; z-index: 1; display: flex; gap: 8px; align-items: center; justify-content: space-between;
  background: var(--lagoon-900); color: var(--foam); border-radius: 16px; padding: 6px 6px 6px 16px; box-shadow: 0 4px 0 var(--lagoon-950); }
.coach[hidden] { display: none; }
.coach p { margin: 0; font: 700 17px/1.25 var(--font-display); min-width: 0; text-wrap: balance; }
@media (max-width: 360px) { .coach p { font-size: 15px; } button.tab { font-size: 13px; gap: 2px; padding: 8px 2px; } button.tab svg { width: 11px; height: 11px; flex: none; } }
.finger { position: absolute; left: 0; top: 0; z-index: 1; width: 44px; height: 44px; margin: -22px 0 0 -22px; border-radius: 50%; pointer-events: none;
  background: rgba(255, 255, 255, .85); border: 3px solid var(--lagoon-900); box-shadow: 0 0 0 6px rgba(255, 194, 61, .55); }
.finger[hidden] { display: none; }
/* BB-019: a pointing hand whose fingertip is at the top centre of the picture, so it lands on the car. */
.finger[data-art~="finger"] { width: 64px; height: 64px; margin: -3px 0 0 -32px; border: 0; border-radius: 0; box-shadow: none;
  background: var(--finger) center / contain no-repeat; filter: drop-shadow(0 3px 2px rgba(7, 35, 37, .35)); }
.toast { position: absolute; left: 50%; bottom: 92px; z-index: 1; transform: translateX(-50%); width: max-content; max-width: calc(100% - 2 * var(--gutter));
  background: var(--lagoon-900); color: var(--foam); padding: 10px 16px; border-radius: 14px; font: 600 15px/1.3 var(--font-body); text-align: center; box-shadow: 0 4px 0 var(--lagoon-950); }
.toast[hidden] { display: none; }
@media (prefers-reduced-motion: reduce) { .arrive { animation: none; } }

/* Narrow phones (360 and below): tighter HUD so nothing runs off the edge. */
@media (max-width: 360px) {
  :root { --stat-w: 68px; --gap: 6px; --gutter: 12px; }
  .hud { gap: 8px; }
  .hud-label { font-size: 18px; }
  button.icon { min-width: 44px; width: 44px; }
}

/* Landscape (phones on their side, tablets, desktop): the scene fills the screen; the HUD is a
   column on the left, the buttons a column on the right, and the camera frames the lot between
   them (the --board-inset-* values). */
@media (orientation: landscape) and (min-width: 600px) {
  /* The exit road runs on under the button panel: the panel's edge fades in over it, so the road
     doesn't stop dead at a wall of sand. */
  .controls::before { content: ""; position: absolute; top: 0; bottom: 0; right: 100%; width: 40px; pointer-events: none;
    background: linear-gradient(to right, rgba(240, 220, 174, 0), var(--sand)); }
  .coach { left: 50%; right: auto; top: auto; bottom: max(16px, env(safe-area-inset-bottom)); transform: translateX(-50%); width: min(460px, calc(100% - var(--hud-col) - var(--controls-col) - 16px)); }
  .toast { bottom: max(16px, env(safe-area-inset-bottom)); }
  #app { max-width: none; display: block; }
  #board { position: absolute; inset: 0; width: 100%; height: 100%;
    --board-inset-left: var(--hud-col); --board-inset-right: var(--controls-col); }
  .hud { position: absolute; z-index: 1; top: 0; left: 0; width: var(--hud-col); flex-direction: column; align-items: flex-start;
    padding: max(12px, env(safe-area-inset-top)) 8px 8px max(12px, env(safe-area-inset-left)); pointer-events: none; }
  .hud button { pointer-events: auto; }
  .hud-title { background: rgba(240, 220, 174, .9); border-radius: 12px; padding: 4px 10px; max-width: 100%; }
  .hud-stats { flex-direction: column; align-items: flex-start; }
  .hud button.icon { width: var(--stat-w); }   /* same width as the stat boxes in the stacked column */
  .controls { position: absolute; z-index: 1; top: 0; right: 0; bottom: 0; width: var(--controls-col); flex-direction: column; justify-content: center; align-items: center;
    padding: 8px max(12px, env(safe-area-inset-right)) 8px 8px;
    background: var(--sand); box-shadow: -1px 0 0 rgba(7, 35, 37, .08), -10px 0 24px rgba(7, 35, 37, .10); }   /* the buttons' own surface, never floating over the road */
  .controls button { flex: none; width: 104px; max-width: none; }
}

/* Age label (Best Practices ruling 2) on Home, in the pause menu and on the first-visit title card. */
.age { margin: 0; font: 600 12px/16px var(--font-body); color: var(--lagoon-700); letter-spacing: .02em; }
.sheet .age { margin-top: 12px; color: var(--foam-dim); text-align: center; }
.title-card .age { background: rgba(251, 222, 166, .9); border-radius: 999px; padding: 2px 10px; }
/* "Up next": the next goal, then one other HulaGames game (leakage ruling 3). */
.up-next { margin: 10px 0 0; font: 700 15px/1.3 var(--font-display); color: var(--sun); text-wrap: balance; }
.up-next[hidden], .up-next-game[hidden] { display: none; }
.up-next-game { display: block; margin-top: 2px; font: 600 13px/20px var(--font-body); color: var(--foam-dim); text-decoration: underline; text-underline-offset: 3px; }
