/* Kamhi World Arcade v3 — shared styles.
   v2's Flash-era channel look (chunky outlined lettering, thick ink outlines, poster titles, framed
   HUDs) with v1's single flat-toon drawing language. Fonts: Luckiest Guy (logos/titles), Bangers
   (labels/HUD), Nunito 700/800 (body). All embedded in fonts.css. Icons are inline SVG, never emoji. */

:root {
  --ink: #1a1420;
  --paper: #fffdf4;
  --yellow: #ffe14d;
  --gold: #ffb81f;
  --orange: #ff8a1f;
  --red: #ff3b3b;
  --pink: #ff3d9a;
  --cyan: #19c7ff;
  --lime: #8cf03c;
  --purple: #7b2cff;
  --kw-blue: #0f5a92;
  --kw-sky: #2a9de8;
  --logo: "Luckiest Guy", "Bangers", "Arial Black", Impact, sans-serif;
  --comic: "Bangers", "Luckiest Guy", "Arial Black", Impact, sans-serif;
  --body: "Nunito", ui-rounded, "Trebuchet MS", system-ui, sans-serif;
  --border: 4px solid var(--ink);
  --pop: 5px 5px 0 var(--ink);
  /* Safe-area insets (notch, home bar, rounded corners; needs viewport-fit=cover). Everything uses these
     vars, never env() directly, so tests can fake an iPhone's insets. */
  --sa-t: env(safe-area-inset-top, 0px);
  --sa-r: env(safe-area-inset-right, 0px);
  --sa-b: env(safe-area-inset-bottom, 0px);
  --sa-l: env(safe-area-inset-left, 0px);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
/* No double-tap zoom anywhere (pinch zoom still works); no font inflation when an iPhone turns sideways */
html, button, a, [role="button"] { touch-action: manipulation; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  font-family: var(--body);
  font-weight: 700;
  color: var(--ink);
  background: var(--kw-sky);
  min-height: 100vh; min-height: 100dvh;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}
a { color: inherit; }
img { max-width: 100%; }
[hidden] { display: none !important; }
b, strong { font-weight: 800; }

.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;
}

/* SVG icons */
svg.i { width: 1.1em; height: 1.1em; flex: none; display: inline-block; vertical-align: -0.15em; overflow: visible; }
.btn svg.i { width: 1.15em; height: 1.15em; margin-top: -2px; }

/* ---------- Outlined cartoon lettering ---------- */

.toon {
  font-family: var(--logo);
  font-weight: 400;
  letter-spacing: .5px;
  color: var(--yellow);
  -webkit-text-stroke: 7px var(--ink);
  paint-order: stroke fill;
  text-shadow: 0 5px 0 var(--ink), 3px 7px 0 rgba(0,0,0,.35);
  line-height: 1;
}

/* Poster logo: each letter bounces and tilts, alternating fills */
.poster-logo {
  font-family: var(--logo);
  font-weight: 400;
  margin: 0;
  line-height: .92;
  text-align: center;
  -webkit-text-stroke: var(--stroke, 8px) var(--ink);
  paint-order: stroke fill;
  text-shadow: 0 6px 0 var(--ink), 4px 10px 0 rgba(0,0,0,.35);
}
.poster-logo .word { display: inline-block; white-space: nowrap; }
.poster-logo .l {
  display: inline-block;
  color: var(--c1, var(--yellow));
  transform: rotate(calc((var(--i) * 37 % 13 - 6) * 1deg)) translateY(calc((var(--i) * 53 % 7 - 3) * 1px));
  animation: bob 2.4s ease-in-out infinite;
  animation-delay: calc(var(--i) * -0.13s);
}
.poster-logo .l:nth-child(3n+2) { color: var(--c2, var(--gold)); }
.poster-logo .l:nth-child(3n) { color: var(--c3, var(--orange)); }
@keyframes bob { 0%, 100% { translate: 0 0; } 50% { translate: 0 -5px; } }

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--logo); font-weight: 400; letter-spacing: .5px;
  font-size: 18px; line-height: 1;
  text-decoration: none; text-transform: uppercase;
  color: var(--ink); background: #fff;
  border: var(--border); border-radius: 16px;
  padding: 12px 18px 9px; min-height: 48px;
  box-shadow: var(--pop), inset 0 -5px 0 rgba(0,0,0,.15);
  cursor: pointer;
  transition: transform .08s, box-shadow .08s;
  touch-action: manipulation;
  user-select: none; -webkit-user-select: none;
}
.btn:hover { transform: translate(-1px, -2px) rotate(-1deg); box-shadow: 6px 7px 0 var(--ink), inset 0 -5px 0 rgba(0,0,0,.15); }
.btn:active { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--ink), inset 0 -2px 0 rgba(0,0,0,.15); }
.btn:focus-visible { outline: 4px dashed var(--yellow); outline-offset: 3px; }
.btn.big { font-size: clamp(20px, 6vw, 28px); padding: 14px 24px 10px; border-radius: 20px; }
.btn.go { background: var(--lime); }
.btn.share { background: var(--cyan); }
.btn.white { background: #fff; }
.btn.pink { background: var(--pink); color: #fff; -webkit-text-stroke: 1px var(--ink); }
.btn.purple { background: var(--purple); color: #fff; }
.btn.yellow { background: var(--yellow); }
.btn[disabled] { opacity: .5; pointer-events: none; }

/* The one big START button on title posters: bubbly pill that pulses */
.start-btn {
  font-size: clamp(30px, 9vw, 44px);
  padding: 16px 34px 11px;
  border-radius: 999px;
  background: radial-gradient(circle at 35% 25%, #fff6 0 18%, transparent 19%), var(--lime);
  border-width: 5px;
  box-shadow: 0 8px 0 var(--ink), 0 12px 18px rgba(0,0,0,.35), inset 0 -8px 0 rgba(0,0,0,.18);
  animation: pulse 1.1s ease-in-out infinite;
}
.start-btn:hover { animation-play-state: paused; }
@keyframes pulse { 0%, 100% { scale: 1; } 50% { scale: 1.07; } }

/* Sound toggle: always visible */
.sound-toggle {
  flex: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font-family: var(--logo); font-size: 15px; letter-spacing: .5px; text-transform: uppercase;
  background: #fff; color: var(--ink);
  border: var(--border); border-radius: 999px;
  padding: 6px 12px 4px; min-height: 44px; min-width: 44px;
  box-shadow: 3px 3px 0 var(--ink);
  cursor: pointer;
}
.sound-toggle svg.i { width: 24px; height: 24px; }
.sound-toggle[aria-pressed="true"] { background: #ffd0d0; }
.sound-toggle:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
@media (max-width: 520px) { .sound-toggle .lbl { display: none; } .sound-toggle { padding: 6px 8px; } }

/* ---------- Game pages: screens ---------- */

.game-page { min-height: 100vh; min-height: 100dvh; }
.screen { position: relative; min-height: 100vh; min-height: 100dvh; }

.topbar {
  position: absolute; z-index: 20; top: 0; left: 0; right: 0;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: max(10px, var(--sa-t)) max(12px, var(--sa-r)) 0 max(12px, var(--sa-l));
  pointer-events: none;
}
.topbar > * { pointer-events: auto; }
.topbar .back {
  font-size: 15px; padding: 7px 12px 4px; min-height: 44px; border-radius: 999px; box-shadow: 3px 3px 0 var(--ink);
}

/* Title poster: logo above, hero fills the middle (45-60% of the screen), one START below */
.poster {
  display: flex; flex-direction: column; align-items: center;
  overflow: hidden;
  height: 100vh; height: 100dvh; min-height: 520px;
  padding: calc(52px + max(10px, var(--sa-t))) max(12px, var(--sa-r)) 18px max(12px, var(--sa-l));
}
.poster .poster-logo { position: relative; z-index: 3; font-size: clamp(54px, 16vw, 110px); flex: none; }
.poster .tagline {
  position: relative; z-index: 3; flex: none;
  font-family: var(--comic); font-size: clamp(18px, 5vw, 26px); letter-spacing: 1px;
  background: var(--yellow); border: var(--border); border-radius: 12px;
  padding: 6px 14px 4px; margin: 10px 0 0;
  transform: rotate(-2deg); box-shadow: var(--pop);
  display: inline-flex; align-items: center; gap: 8px;
}
.poster .hero {
  position: relative; z-index: 2;
  flex: 1 1 auto; width: 100%; max-width: 640px;
  min-height: 0;
}
.poster .hero canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.poster .start-row {
  position: relative; z-index: 4; flex: none;
  display: flex; flex-direction: column; align-items: center; gap: 8px; width: 100%;
  padding: 6px 0 max(4px, var(--sa-b));
}
.poster .hint { font: 400 15px var(--comic); letter-spacing: 1px; color: #fff; text-transform: uppercase; margin: 0; opacity: .9;
  background: rgba(26,20,32,.55); border-radius: 999px; padding: 4px 12px 2px; }
.poster .burst {
  position: absolute; z-index: 1; left: 50%; top: 52%;
  width: 150vmax; height: 150vmax; translate: -50% -50%;
  background: repeating-conic-gradient(var(--ray1, rgba(255,255,255,.12)) 0 10deg, transparent 10deg 20deg);
  animation: spin 40s linear infinite;
  pointer-events: none;
}
@keyframes spin { to { rotate: 360deg; } }

/* Numbered how-to card: compact on phones, never the full viewport */
.howto {
  display: flex; align-items: center; justify-content: center;
  padding: calc(60px + max(10px, var(--sa-t))) max(14px, var(--sa-r)) max(20px, var(--sa-b)) max(14px, var(--sa-l));
}
.card {
  position: relative;
  width: min(500px, 100%);
  background: var(--paper);
  border: 5px solid var(--ink); border-radius: 24px;
  box-shadow: 8px 8px 0 var(--ink);
  padding: 18px 14px 16px;
  text-align: center;
}
.card h2 { margin: 0 0 4px; padding: 0 30px; font-size: clamp(28px, 8vw, 42px); }

/* Coming soon card (KW.lockIfSoon, js/config.js GAMES): replaces a locked game's screens */
.soon-screen {
  display: flex; align-items: center; justify-content: center; min-height: 100vh; min-height: 100dvh;
  padding: max(20px, var(--sa-t)) max(14px, var(--sa-r)) max(20px, var(--sa-b)) max(14px, var(--sa-l));
  background: repeating-conic-gradient(from 0deg at 50% 45%, #ffe14d 0 10deg, #ffb81f 10deg 20deg);
}
.soon-screen .card { padding: 30px 18px 22px; }
.soon-screen h1 { margin: 18px 0 8px; font-size: clamp(32px, 10vw, 52px); }
.soon-screen p { margin: 0 0 16px; font-size: 17px; }
.soon-badge {
  display: inline-block; rotate: -4deg;
  font: 400 18px var(--comic); letter-spacing: 1.5px; text-transform: uppercase;
  padding: 4px 14px 2px; border: 3px solid var(--ink);
  background: repeating-linear-gradient(-45deg, var(--yellow) 0 12px, #ffd21f 12px 24px);
  box-shadow: 2px 3px 0 rgba(26,20,32,.4);
}
.steps { list-style: none; margin: 10px 0; padding: 0; counter-reset: s; text-align: left; }
.steps li {
  counter-increment: s;
  position: relative;
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px 7px 58px; margin: 0 0 8px;
  min-height: 52px;
  background: #fff; border: 3px solid var(--ink); border-radius: 14px;
  font-size: 15px; line-height: 1.25;
}
.steps li::before {
  content: counter(s);
  position: absolute; left: 7px; top: 50%; translate: 0 -50%;
  width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center;
  font-family: var(--logo); font-size: 26px; padding-top: 4px;
  color: #fff; background: var(--step, var(--pink));
  -webkit-text-stroke: 4px var(--ink); paint-order: stroke fill;
  border: 3px solid var(--ink);
}
.steps li:nth-child(2)::before { background: var(--step2, var(--cyan)); }
.steps li:nth-child(3)::before { background: var(--step3, var(--lime)); }
.steps li:nth-child(4)::before { background: var(--step4, var(--orange)); }
.steps b { font-family: var(--comic); font-weight: 400; font-size: 1.2em; letter-spacing: .5px; }
kbd {
  display: inline-block; min-width: 1.6em; padding: 2px 6px 0;
  font: 400 15px var(--logo); text-align: center;
  background: #fff; border: 2px solid var(--ink); border-bottom-width: 4px; border-radius: 6px;
}
.card .row { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 10px; }
.card .host-peek {
  position: absolute; right: -12px; top: -54px; width: 84px; height: 84px; pointer-events: none;
  animation: peek 2.2s ease-in-out infinite;
}
@keyframes peek { 0%, 100% { rotate: 6deg; } 50% { rotate: -3deg; translate: 0 -4px; } }

/* Themed HUD: chunky framed bar */
.hud {
  position: relative; z-index: 10;
  display: flex; align-items: stretch; gap: 6px;
  padding: max(8px, var(--sa-t)) max(8px, var(--sa-r)) 8px max(8px, var(--sa-l));
  background: var(--hud-bg, var(--ink));
  border-bottom: 5px solid var(--ink);
  box-shadow: 0 4px 0 rgba(0,0,0,.25);
}
.hud .cell {
  flex: 1 1 0; min-width: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: var(--hud-cell, #fff); color: var(--ink);
  border: 3px solid var(--ink); border-radius: 12px;
  padding: 3px 4px 2px; box-shadow: inset 0 -4px 0 rgba(0,0,0,.12);
}
.hud .cell small { font: 400 11px var(--comic); letter-spacing: 1px; text-transform: uppercase; opacity: .75; }
.hud .cell b { font: 400 clamp(18px, 5.4vw, 26px) var(--logo); line-height: 1; padding-top: 2px; }
.hud .icon-btn {
  flex: none; width: 46px; min-height: 46px; padding: 0;
  display: grid; place-items: center;
  background: #fff; border: 3px solid var(--ink); border-radius: 12px; cursor: pointer;
  box-shadow: inset 0 -4px 0 rgba(0,0,0,.12); text-decoration: none; color: var(--ink);
}
.hud .icon-btn svg.i { width: 22px; height: 22px; }
.hud .sound-toggle { min-width: 46px; padding: 0 8px; border-width: 3px; border-radius: 12px; box-shadow: inset 0 -4px 0 rgba(0,0,0,.12); }
.hud .sound-toggle .lbl { display: none; }
.meter { position: relative; width: 100%; height: 10px; border: 2px solid var(--ink); border-radius: 6px; background: #ddd; overflow: hidden; margin-top: 2px; }
.meter i { position: absolute; inset: 0 auto 0 0; width: 0; background: var(--meter, var(--lime)); transition: width .2s; }

/* ---------- End screen ---------- */

/* Compact so the coupon + every buy button are above the fold on a 390x844 phone */
.end-screen { padding: calc(4px + max(10px, var(--sa-t))) max(12px, var(--sa-r)) max(28px, var(--sa-b)) max(12px, var(--sa-l)); overflow: hidden; display: flex; flex-direction: column; }
/* spare height on tall phones goes to the host (up to 260px), the rest centres the column */
.end-inner { position: relative; z-index: 2; width: min(560px, 100%); margin: 0 auto; flex: 1 0 auto; display: flex; flex-direction: column; justify-content: center; }
.end-host { position: relative; flex: 1 0 auto; min-height: clamp(130px, 18vh, 190px); max-height: 260px; margin-bottom: 4px; z-index: 3; }
.end-host .host-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.end-host .bubble {
  position: absolute; left: 0; top: 0; max-width: 46%;
  background: #fff; border: 3px solid var(--ink); border-radius: 18px;
  padding: 8px 10px 6px; font: 400 18px/1.1 var(--comic); letter-spacing: .5px; text-align: center; color: var(--ink);
  box-shadow: 3px 3px 0 var(--ink);
  rotate: -3deg;
}
.end-host .bubble:empty { display: none; }
.end-host .bubble::after {
  content: ''; position: absolute; right: -14px; bottom: 14px;
  border: 9px solid transparent; border-left: 14px solid var(--ink);
}
.end-card {
  position: relative;
  background: var(--paper); border: 5px solid var(--ink); border-radius: 26px;
  box-shadow: 8px 8px 0 var(--ink);
  padding: 20px 12px 14px; text-align: center;
}
.end-card .stamp {
  position: absolute; top: -18px; left: 50%; translate: -50% 0; rotate: -3deg;
  font: 400 18px var(--logo); letter-spacing: 1px; text-transform: uppercase; white-space: nowrap;
  background: var(--pink); color: #fff; -webkit-text-stroke: 3px var(--ink); paint-order: stroke fill;
  border: 3px solid var(--ink); border-radius: 10px; padding: 6px 12px 3px; box-shadow: 3px 3px 0 var(--ink);
}
.end-title { font-size: clamp(28px, 8.4vw, 48px); --stroke: 6px; margin: 4px 0 0; text-shadow: 0 4px 0 var(--ink); }
.end-score { margin: 4px 0 2px; }
.end-score small { display: block; font: 400 13px var(--comic); letter-spacing: 2px; text-transform: uppercase; opacity: .7; }
.end-score b { display: block; padding-top: 4px; font: 400 clamp(40px, 12vw, 64px)/1 var(--logo); color: #fff; -webkit-text-stroke: 7px var(--ink); paint-order: stroke fill; text-shadow: 0 5px 0 var(--ink); }
.end-card .stats { font-size: 13px; line-height: 1.4; }
.end-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 14px 0 6px; }
.end-actions .btn.big { padding-top: 10px; padding-bottom: 7px; }
.end-actions .btn { padding-left: 8px; padding-right: 8px; font-size: clamp(18px, 5.4vw, 24px); }
.coupon {
  margin: 8px 0; padding: 5px 10px 4px;
  border: 3px dashed var(--ink); border-radius: 14px; background: #fff7c2;
  display: flex; flex-wrap: wrap; align-items: baseline; justify-content: center; column-gap: 10px;
}
.coupon .label { flex: 1 0 100%; font: 400 15px var(--comic); letter-spacing: .5px; text-transform: uppercase; display: flex; align-items: center; justify-content: center; gap: 6px; }
.coupon .label svg.i { width: 22px; height: 22px; }
.coupon .code { font: 400 22px var(--logo); letter-spacing: 2px; margin: 1px 0 0; }
.coupon .demo { font-size: 11px; opacity: .7; }
.buy-grid { display: grid; gap: 8px; }
.buy-grid.multi { grid-template-columns: 1fr 1fr; }
.buy {
  display: flex; align-items: center; gap: 6px;
  text-decoration: none; text-align: left; color: var(--ink);
  font: 400 clamp(13px, 3.8vw, 16px)/1.05 var(--logo); letter-spacing: .3px; text-transform: uppercase;
  background: var(--yellow); border: 3px solid var(--ink); border-radius: 14px;
  padding: 3px 8px 3px 3px; min-height: 54px; box-shadow: 3px 3px 0 var(--ink);
}
.buy span { flex: 1 1 auto; padding-top: 3px; }
.buy .buy-art { width: 46px; height: 46px; flex: none; }
.buy svg.out { width: 18px; height: 18px; }
.buy:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
.buy.mvp { background: var(--lime); outline: 4px solid var(--pink); outline-offset: 2px; }
.back-link { margin-top: 12px; font-size: 15px; }
.fine { font-size: 11px; opacity: .65; margin: 10px 0 0; font-weight: 700; }

/* ---------- Toast ---------- */

.toast {
  position: fixed; z-index: 100; left: 50%; bottom: max(20px, calc(8px + var(--sa-b)));
  translate: -50% 0;
  max-width: calc(100% - 24px);
  font: 400 18px var(--comic); letter-spacing: .5px;
  background: var(--yellow); border: 3px solid var(--ink); border-radius: 14px;
  padding: 10px 16px 8px; box-shadow: 4px 4px 0 var(--ink);
  animation: toast-in .25s ease-out;
  transition: opacity .4s, translate .4s;
}
.toast.out { opacity: 0; translate: -50% 20px; }
@keyframes toast-in { from { translate: -50% 30px; opacity: 0; } }

.shake { animation: shake .35s; }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001s !important; animation-iteration-count: 1 !important; transition: none !important; }
}
/* v5: the in-app "Reduce motion" switch (KW.a11y) puts html.kw-reduce on, same rule as the OS setting */
html.kw-reduce *, html.kw-reduce *::before, html.kw-reduce *::after { animation-duration: .001s !important; animation-iteration-count: 1 !important; transition: none !important; }
html.kw-reduce { scroll-behavior: auto; }

/* ---------- v5 accessibility: focus rings, captions, settings ---------- */
/* Every focusable thing gets a visible keyboard ring: a thick yellow dash with an ink halo so it reads on
   light and dark art. :where() keeps it weak so the existing per-component rings still win. */
:where(a, button, input, select, textarea, summary, label, [tabindex]):focus-visible {
  outline: 4px dashed var(--yellow); outline-offset: 3px;
  box-shadow: 0 0 0 3px var(--ink);
}
:where(input[type="checkbox"], input[type="range"]):focus-visible { outline-offset: 2px; }
/* Captions strip (KW.cc): exact voice words + [sound effects]. Sits above the bottom safe area, no motion. */
.kw-cc {
  position: fixed; z-index: 300; left: 50%; bottom: calc(max(10px, var(--sa-b)) + 6px); translate: -50% 0;
  max-width: min(560px, calc(100vw - 24px)); padding: 6px 12px 5px; border-radius: 12px;
  background: rgba(26, 20, 32, .9); color: #fff; border: 2px solid #fff;
  font: 700 16px/1.3 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; text-align: center; pointer-events: none;
  opacity: 0; visibility: hidden;
}
/* on game pages the bottom is the action (Start button, nests, hit line, track): sit just under the top bar / HUD */
body.game-page .kw-cc { bottom: auto; top: calc(max(10px, var(--sa-t)) + 76px); }
.kw-cc.on { opacity: 1; visibility: visible; }
.kw-cc.sfx { color: var(--yellow); font-style: italic; }
.kw-cc b { color: var(--yellow); font-weight: 800; }
.mixer-check { display: flex; align-items: center; gap: 10px; min-height: 44px; font-size: 16px; cursor: pointer; }
.mixer-check input { width: 24px; height: 24px; flex: none; accent-color: var(--pink, #ff5fa2); }
.mixer-check small { opacity: .75; font-size: 13px; }
.mixer-check input:disabled + span { opacity: .8; }

/* ---------- Volume mixer (Music / Sound FX sliders beside the mute) ---------- */
.sound-group { flex: none; display: inline-flex; align-items: center; gap: 6px; }
.topbar > .sound-group { pointer-events: auto; }
.sound-toggle.mixer-toggle { padding: 6px 8px; }
.sound-toggle.mixer-toggle[aria-expanded="true"] { background: var(--yellow, #ffe14d); }
.mixer {
  position: fixed; z-index: 200; right: max(12px, var(--sa-r)); top: calc(50px + max(10px, var(--sa-t)));
  width: min(300px, calc(100vw - 24px - var(--sa-l) - var(--sa-r)));
  max-height: calc(100dvh - 70px - var(--sa-t) - var(--sa-b)); overflow: auto;
  background: #fff; color: var(--ink);
  border: var(--border); border-radius: 18px; box-shadow: 4px 4px 0 var(--ink);
  padding: 10px 14px 12px;
  font-family: var(--comic);
}
.mixer[hidden] { display: none; }
.mixer-title { margin: 0 0 4px; font-family: var(--logo); font-size: 18px; letter-spacing: .5px; text-transform: uppercase; }
.mixer-row { display: grid; grid-template-columns: 78px 1fr 44px; align-items: center; gap: 8px; min-height: 44px; font-size: 16px; }
.mixer-row input[type="range"] { width: 100%; height: 32px; accent-color: var(--pink, #ff5fa2); }
.mixer-row output { text-align: right; font-variant-numeric: tabular-nums; }
.mixer-done { display: block; margin: 6px 0 0 auto; min-height: 44px; font-size: 15px; padding: 6px 16px 4px; }

/* ---------- Leaderboard (Task C) ---------- */
.hs-end { margin: 14px 0; text-align: center; }
.hs-end h3, .hs-game h3 { margin: 0 0 6px; font-family: var(--font-toon, inherit); }
.hs-board { list-style: none; margin: 0 auto 10px; padding: 0; max-width: 280px; }
.hs-board li { display: flex; gap: 10px; padding: 3px 10px; border-radius: 10px; font-weight: 700; }
.hs-board li:nth-child(odd) { background: rgba(0,0,0,.06); }
.hs-board li.hs-me { background: #ffd23f; outline: 3px solid var(--ink, #1b1035); }
.hs-rank { width: 2ch; text-align: right; } .hs-ini { letter-spacing: .15em; } .hs-pts { margin-left: auto; }
.hs-entry { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; align-items: center; margin-bottom: 10px; }
.hs-entry label { width: 100%; font-weight: 700; }
.hs-entry input { width: 5.5ch; font: inherit; font-size: 1.6rem; text-align: center; text-transform: uppercase; letter-spacing: .2em; border: 3px solid var(--ink, #1b1035); border-radius: 10px; padding: 4px; }
.hs-msg { width: 100%; color: #c0123c; min-height: 1em; }
.hs-empty { opacity: .75; }
.hs-view { position: fixed; inset: 0; z-index: 60; background: rgba(27,16,53,.6); display: flex; align-items: center; justify-content: center;
  padding: max(12px, var(--sa-t)) max(12px, var(--sa-r)) max(12px, var(--sa-b)) max(12px, var(--sa-l)); }
.hs-panel { max-height: 100%; overflow: auto; width: min(720px, 100%); text-align: center; background: #fff; border-radius: 18px; padding: 16px; }
.hs-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.hs-open { font: inherit; font-weight: 700; border: 3px solid var(--ink, #1b1035); border-radius: 12px; background: #ffd23f; padding: 6px 10px; box-shadow: 3px 3px 0 var(--ink, #1b1035); cursor: pointer; }
/* Grown-ups signup (Task D, demo) */
.gu-panel { max-width: 440px; }
.gu-gate, .gu-form { display: flex; flex-direction: column; gap: 8px; align-items: center; margin-bottom: 10px; }
.gu-gate input, .gu-form input[type=email] { font: inherit; font-size: 1.2rem; border: 3px solid var(--ink, #1b1035); border-radius: 10px; padding: 6px 10px; width: min(300px, 100%); text-align: center; }
.gu-consent { display: flex; gap: 8px; align-items: flex-start; text-align: left; font-size: .95rem; max-width: 340px; }
.gu-consent input { width: 22px; height: 22px; flex: none; }
.end-card .gu-open { display: block; margin: 8px auto; }
/* Score card preview (funnel): the PNG + Share (if files can be shared) / Download / Close. No motion. */
.card-panel { max-width: 420px; }
.card-png { display: block; width: auto; height: auto; max-width: 100%; max-height: 52vh; margin: 0 auto 10px; border-radius: 12px; border: 3px solid var(--ink, #1b1035); }
.card-btns { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; align-items: center; }

/* ---------- Phone held sideways on a game (KW.rotate in js/arcade.js): friendly rotate card ---------- */
.rotate-hint {
  position: fixed; inset: 0; z-index: 400;
  display: flex; align-items: center; justify-content: center;
  padding: max(10px, var(--sa-t)) max(14px, var(--sa-r)) max(10px, var(--sa-b)) max(14px, var(--sa-l));
  background: repeating-conic-gradient(from 0deg at 50% 45%, #ffe14d 0 10deg, #ffb81f 10deg 20deg);
  overflow: auto;
}
.rotate-hint .card { width: min(460px, 100%); padding: 12px 16px 14px; }
.rotate-hint h2 { margin: 2px 0 6px; padding: 0; font-size: clamp(26px, 7vh, 38px); }
.rotate-hint p { margin: 0 0 10px; font-size: 16px; }
.rotate-phone { display: block; width: 56px; height: 56px; margin: 0 auto; rotate: -90deg; animation: tip-up 2.4s ease-in-out infinite; }
@keyframes tip-up { 0%, 25% { rotate: -90deg; } 55%, 100% { rotate: 0deg; } }
html.rotate-on body { overflow: hidden; }

/* Task F: old iOS / webviews without dvh use the JS-measured --kw-vh (see KW.env in arcade.js) */
@supports not (height: 100dvh) {
  body, .game-page, .screen { min-height: calc(var(--kw-vh, 1vh) * 100); }
  #play, .hub-shell { height: calc(var(--kw-vh, 1vh) * 100) !important; }
}
/* Landscape notch: keep the bottom UI clear of the side insets too */
.poster .start-row { padding-left: var(--sa-l); padding-right: var(--sa-r); }

/* v7: on the end screen the host character sits at the top, so the caption strip drops to the bottom
   (it used to cover the dragon's head / the plush). It is pointer-events: none and only lasts a moment. */
body.game-page[data-screen="end"] .kw-cc { top: auto; bottom: calc(max(10px, var(--sa-b)) + 6px); }

/* v7: end screens: the high-score block and the Grown-ups signup button sit higher and are more compact so they
   are above the fold at 390x844 (Egg Pops' Grown-ups button used to straddle the fold). Same text, same actions. */
.hs-end { margin: 8px 0 6px; }
.end-card .gu-open { margin: 6px auto; width: 100%; min-height: 40px; padding: 8px 10px 6px; font-size: 14px; letter-spacing: .2px; }

/* v8: end screens at phone size: tighter vertical rhythm so the Predicto fortune card and "Back to the arcade map"
   are above the fold at 390x844 (same text, same actions; every tap target stays >= 44px). */
.end-card .end-actions { margin: 8px 0 4px; gap: 8px; }
.end-card .end-actions .btn.big { padding-top: 7px; padding-bottom: 5px; }
.end-card .coupon { margin: 6px 0; }
.end-card .stats { line-height: 1.3; }
.end-card .hs-end { margin: 4px 0 4px; }
.end-card .hs-end h3 { font-size: 15px; margin: 0 0 2px; }
.end-card .hs-entry { margin-bottom: 4px; gap: 6px; }
.end-card .hs-entry label { font-size: 13px; }
.end-card .hs-entry input { font-size: 1.3rem; padding: 0 4px; height: 44px; }
.end-card .hs-board { margin-bottom: 4px; }
.end-card .hs-board li { padding: 1px 10px; }
.end-card .hs-empty { margin: 2px 0; font-size: 13px; }
.end-card .fortune-card { margin: 4px auto 0; padding: 6px 10px; font-size: 13px; line-height: 1.3; }
.end-card .fortune-card b { font-size: 13px; letter-spacing: .5px; }
.end-card .back-link { margin-top: 6px; min-height: 44px; padding-top: 8px; padding-bottom: 6px; font-size: 14px; }
.end-card .fine { margin-top: 6px; }
.end-card .end-actions .btn { font-size: clamp(16px, 4.8vw, 22px); white-space: nowrap; }
.end-card .hs-entry { flex-wrap: wrap; }
.end-card .hs-entry label { width: auto; flex: 1 1 80px; text-align: right; }
.end-card .hs-entry input { flex: none; }
.end-card .hs-entry .btn { flex: none; padding-top: 6px; padding-bottom: 4px; }
.end-card .hs-entry .hs-msg { flex: 1 0 100%; min-height: 0; }
.end-card .hs-entry .hs-msg:empty { display: none; }
.end-card .hs-end > .btn.share { min-height: 44px; padding-top: 6px; padding-bottom: 4px; }
.end-card .gu-open { min-height: 44px; }   /* v8: tap target >= 44px (was 40) */

/* v9 'Unlocked' card (KW.endScreen opts.unlock): the prize-code block features the product you just played as.
   Art | name, pitch, demo code | its own buy button, with the "Unlocked!" tag sitting on the top border. About the
   same height as the plain coupon so the end screen does not grow. */
.coupon.unlocked { position: relative; display: grid; grid-template-columns: 50px 1fr auto; align-items: center; column-gap: 8px;
  margin-top: 14px; padding: 12px 8px 5px; text-align: left; background: #fff7c2; border-style: solid; box-shadow: 3px 3px 0 var(--ink);
  animation: unlock-pop .45s ease-out both; }
.coupon.unlocked .u-tag { position: absolute; left: 10px; top: -11px; flex: none; display: inline-flex; gap: 4px; align-items: center;
  font: 400 12px/1 var(--comic); letter-spacing: .5px; text-transform: uppercase; color: #fff; background: var(--pink, #ff5fa2);
  border: 2px solid var(--ink); border-radius: 999px; padding: 3px 8px 2px; white-space: nowrap; }
.coupon.unlocked .u-tag svg.i { width: 14px; height: 14px; }
.coupon.unlocked .unlock-art { width: 50px; height: 50px; display: block; }
.coupon.unlocked .u-text { min-width: 0; display: flex; flex-direction: column; line-height: 1.1; gap: 1px; }
.coupon.unlocked .u-name { font: 400 15px/1.05 var(--logo); letter-spacing: .2px; text-transform: uppercase; }
.coupon.unlocked .u-pitch { font-size: 12px; line-height: 1.15; }
.coupon.unlocked .u-code { display: flex; align-items: baseline; gap: 5px; white-space: nowrap; }
.coupon.unlocked .u-code .code { font-size: 14px; letter-spacing: 1px; margin: 0; }
.coupon.unlocked .u-code .demo { font-size: 10px; opacity: 1; padding: 1px 4px 0; border: 1px solid var(--ink); border-radius: 4px; text-transform: uppercase; }
.coupon.unlocked .u-buy { min-height: 44px; padding: 6px 9px 4px; font-size: 14px; white-space: nowrap; outline-width: 3px; gap: 4px; }
.coupon.unlocked .u-buy svg.out { width: 14px; height: 14px; }
.buy-grid.tri { grid-template-columns: repeat(3, 1fr); gap: 6px; }
.buy-grid.tri .buy { flex-direction: column; justify-content: center; gap: 2px; padding: 5px 4px 4px; text-align: center; min-height: 44px; font-size: 12px; position: relative; }
.buy-grid.tri .buy .buy-art { width: 40px; height: 40px; }
.buy-grid.tri .buy span { padding-top: 0; }
.buy-grid.tri .buy svg.out { position: absolute; right: 4px; top: 4px; width: 13px; height: 13px; }
@keyframes unlock-pop { from { transform: scale(.85); opacity: 0; } 70% { transform: scale(1.03); opacity: 1; } to { transform: none; } }
@media (prefers-reduced-motion: reduce) { .coupon.unlocked { animation: none; } }
html.kw-reduce .coupon.unlocked { animation: none; }
