/* Balls n Booties */
:root {
  color-scheme: dark;
  --ink: #16121c;
  --panel: #1d2747;
  --panel-2: #26335c;
  --panel-3: #314274;
  --line: #0e1430;
  --text: #f4f7ff;
  --muted: #a9b6d8;
  --gold: #ffd23f;
  --lime: #b7f36b;
  --sky: #7fe8ff;
  --red: #ff5d5d;
  --pink: #ff7aa8;
  --gem: #29c6e8;
  --orange: #ff9f43;
  --radius: 14px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { min-height: 100%; }
body {
  margin: 0; min-width: 320px; color: var(--text); background: #5fb4ff;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; line-height: 1.4;
  -webkit-tap-highlight-color: transparent; overflow-x: hidden;
}
h1, h2, h3, p { margin: 0; }
h2 { font-size: 1.2rem; line-height: 1.2; text-wrap: balance; }
.px, .spr, .obj, .tile, .facade { image-rendering: pixelated; }
.muted { color: var(--muted); font-size: 0.9rem; }
.center { text-align: center; }
.eyebrow { color: var(--lime); font-size: 0.68rem; font-weight: 900; letter-spacing: 0.14em; text-transform: uppercase; }
.section-title { margin: 18px 0 8px; font-size: 0.78rem; font-weight: 900; letter-spacing: 0.14em; text-transform: uppercase; color: #fff; text-shadow: 0 2px 0 var(--ink); }
kbd { padding: 0 5px; border: 2px solid rgb(255 255 255 / 25%); border-radius: 5px; font: inherit; font-size: 0.7em; opacity: 0.75; }

/* ------------------------------ sky ------------------------------ */
.sky { position: fixed; inset: 0; z-index: -1; overflow: hidden; background: linear-gradient(180deg, var(--sky-a) 0%, var(--sky-b) 55%, var(--sky-c) 100%); }
.sky-layer { position: absolute; left: 0; right: 0; image-rendering: pixelated; background-repeat: repeat-x; }
.sky-far { bottom: 0; height: 26vh; background-image: var(--hz-far); background-size: auto 100%; animation: drift 220s linear infinite; opacity: 0.85; }
.sky-mid { bottom: 0; height: 18vh; background-image: var(--hz-mid); background-size: auto 100%; animation: drift 140s linear infinite reverse; }
.sky-clouds { top: 0; bottom: 30vh; background-repeat: repeat; }
.sky-clouds.a { background-image: var(--cloud-a); background-size: 320px auto; background-position: 0 12%; animation: drift-cloud 160s linear infinite; opacity: 0.95; }
.sky-clouds.b { background-image: var(--cloud-b); background-size: 200px auto; background-position: 90px 55%; animation: drift-cloud 95s linear infinite; opacity: 0.7; }
.sky-birds { position: absolute; inset: 0; }
.bird-flock { position: absolute; left: -80px; display: flex; gap: 10px; animation: fly-across 26s linear forwards; }
.bird { width: 21px; animation: flap 0.5s steps(2) infinite; animation-delay: calc(var(--i) * -0.13s); translate: 0 calc(var(--i) * 4px); }
@keyframes drift { to { background-position-x: -1600px; } }
@keyframes drift-cloud { to { background-position-x: -3200px; } }
@keyframes fly-across { to { transform: translateX(calc(100vw + 160px)) translateY(-40px); } }
@keyframes flap { 50% { scale: 1 0.5; } }

/* ------------------------------ buttons, pills, cards ------------------------------ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 42px; padding: 8px 15px;
  border: 3px solid var(--ink); border-radius: 12px; color: var(--text); background: var(--panel-3);
  font: inherit; font-weight: 800; font-size: 0.92rem; cursor: pointer; box-shadow: 0 4px 0 var(--ink), inset 0 2px 0 rgb(255 255 255 / 18%);
  transition: transform 0.06s, box-shadow 0.06s, background 0.12s; user-select: none;
}
.btn:hover:not(:disabled) { background: #3c5190; }
.btn:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink), inset 0 2px 0 rgb(255 255 255 / 18%); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn:focus-visible, .mode-card:focus-visible, .zone-card:focus-visible, .item-card:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }
.btn.primary { color: #10240a; background: var(--lime); }
.btn.primary:hover:not(:disabled) { background: #cdfb93; }
.btn.gold { color: #2b1d00; background: var(--gold); }
.btn.gold:hover:not(:disabled) { background: #ffe27a; }
.btn.danger { background: #b83434; }
.btn.ghost { background: transparent; box-shadow: none; border-color: rgb(255 255 255 / 25%); }
.btn.ghost:hover:not(:disabled) { background: rgb(127 127 127 / 18%); }
.btn.small { min-height: 34px; padding: 4px 11px; font-size: 0.82rem; border-width: 2px; box-shadow: 0 3px 0 var(--ink), inset 0 2px 0 rgb(255 255 255 / 15%); }
.btn.huge { min-height: 64px; padding: 10px 40px; font-size: 1.35rem; border-radius: 16px; box-shadow: 0 6px 0 var(--ink), inset 0 3px 0 rgb(255 255 255 / 35%); }
.btn.huge:active { transform: translateY(5px); box-shadow: 0 1px 0 var(--ink); }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 11px 3px 6px; border: 2px solid var(--ink); border-radius: 99px; color: var(--text); background: var(--panel); font: inherit; font-weight: 800; font-size: 0.88rem; font-variant-numeric: tabular-nums; box-shadow: 0 2px 0 var(--ink); }
.pill img { width: 20px; height: 20px; }
button.pill { cursor: pointer; }
.pill.gold { color: var(--gold); }
.pill.hint { color: #ffe9a0; }
.pill.gem { color: var(--sky); }
.card { padding: 16px; border: 3px solid var(--ink); border-radius: var(--radius); background: var(--panel); box-shadow: 0 5px 0 var(--ink), inset 0 2px 0 rgb(255 255 255 / 10%); }

/* ------------------------------ top bar ------------------------------ */
.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 12px; padding: 10px 16px; background: rgb(14 20 48 / 82%); border-bottom: 3px solid var(--ink); backdrop-filter: blur(4px); }
.screen-title { flex: 1; min-width: 0; font-size: 1.15rem; font-weight: 900; letter-spacing: 0.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-shadow: 0 2px 0 var(--ink); }
.wallet { display: flex; gap: 8px; }

/* ------------------------------ home ------------------------------ */
.home { min-height: 100dvh; padding: 22px 18px 40px; }
.home-wrap { width: min(100%, 1180px); margin: 0 auto; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 28px; align-items: start; }
.home-hero { display: flex; flex-direction: column; align-items: center; gap: 12px; padding-top: 10px; }
.logo { padding: 0; border: 0; background: none; cursor: pointer; animation: logo-bob 3s ease-in-out infinite; }
.logo img { display: block; width: min(92vw, 540px); }
.logo.tap { animation: logo-tap 0.18s; }
.tagline { color: #fff; font-weight: 800; text-align: center; text-shadow: 0 2px 0 var(--ink); }
.hero-stage { position: relative; width: 260px; height: 190px; margin-bottom: 40px; }
#playBtn { position: relative; z-index: 2; }
.hero-roof { position: absolute; left: 30px; right: 30px; bottom: 20px; height: 54px; border: 3px solid var(--ink); border-radius: 8px; background: var(--hero-turf) 0 0 / 54px 54px; box-shadow: inset 0 3px 0 rgb(255 255 255 / 45%), 0 6px 0 var(--ink); }
.hero-roof::after { content: ""; position: absolute; left: 0; right: 0; top: 100%; height: 54px; margin-top: 2px; background: var(--hero-facade) 0 0 / 36px 54px repeat-x; image-rendering: pixelated; }
.hero-player { position: absolute; left: 92px; bottom: 44px; width: 72px; height: 96px; background-size: 600% 300%; image-rendering: pixelated; animation: f-run 0.26s steps(1) infinite, hero-run 4s ease-in-out infinite; }
.hero-ball { position: absolute; left: 150px; bottom: 44px; width: 32px; height: 32px; background-size: 1600% 200%; image-rendering: pixelated; animation: roll-x 0.9s steps(16, jump-none) infinite, hero-ball 4s ease-in-out infinite; }
@keyframes logo-bob { 50% { transform: translateY(-6px) rotate(-1deg); } }
@keyframes logo-tap { 50% { transform: scale(0.94); } }
@keyframes hero-run { 0%, 100% { translate: -40px 0; scale: 1 1; } 49% { translate: 40px 0; scale: 1 1; } 50% { translate: 40px 0; scale: -1 1; } 99% { translate: -40px 0; scale: -1 1; } }
@keyframes hero-ball { 0%, 100% { translate: -40px 0; } 49% { translate: 40px 0; } 50% { translate: -40px 0; } 99% { translate: -100px 0; } }
.home-side { min-width: 0; }
.home-wallet { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.zone-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.zone-card {
  position: relative; display: flex; flex-direction: column; justify-content: flex-end; min-height: 150px; padding: 12px; overflow: hidden;
  border: 3px solid var(--ink); border-radius: var(--radius); color: #fff; text-align: left; font: inherit; cursor: pointer;
  background: linear-gradient(180deg, var(--sky-a), var(--sky-b) 60%, var(--sky-c)); box-shadow: 0 5px 0 var(--ink);
  transition: transform 0.1s;
}
.zone-card:hover:not(:disabled) { transform: translateY(-3px); }
.zone-card:disabled { cursor: default; }
.zone-card::before { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 60%; background: var(--hz-far) repeat-x 0 100% / auto 100%; image-rendering: pixelated; opacity: 0.9; }
.zone-card .zc-isle { position: absolute; right: 14px; top: 16px; width: 92px; height: 34px; border: 3px solid var(--ink); border-radius: 6px; background: var(--zc-turf) 0 0 / 34px 34px; image-rendering: pixelated; box-shadow: inset 0 3px 0 rgb(255 255 255 / 40%); animation: isle 4s ease-in-out infinite; }
.zone-card .zc-isle::after { content: ""; position: absolute; left: 0; right: 0; top: 100%; height: 51px; margin-top: 2px; background: var(--zc-facade) 0 0 / 34px 51px repeat-x; image-rendering: pixelated; }
.zone-card .zc-goal { position: absolute; right: 22px; top: -4px; width: 32px; height: 28px; background: var(--zc-goal) center / contain no-repeat; image-rendering: pixelated; }
.zone-card > * { position: relative; }
.zone-card b { font-size: 1.1rem; text-shadow: 0 2px 0 var(--ink); }
.zone-card small { color: #fff; font-weight: 700; text-shadow: 0 1px 0 var(--ink); }
.zone-card .zc-progress { display: inline-flex; gap: 6px; margin-top: 6px; }
.zone-card.locked { filter: saturate(0.4) brightness(0.8); }
.zone-card .zc-lock { position: absolute; left: 12px; top: 12px; padding: 3px 9px; border: 2px solid var(--ink); border-radius: 8px; color: var(--ink); background: #fff; font-size: 0.72rem; font-weight: 900; }
@keyframes isle { 50% { translate: 0 -5px; } }
.mode-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.mode-card { display: grid; grid-template-columns: 48px 1fr; grid-template-rows: auto auto; column-gap: 10px; align-items: center; padding: 12px; border: 3px solid var(--ink); border-radius: var(--radius); color: var(--text); background: var(--panel); text-align: left; font: inherit; cursor: pointer; box-shadow: 0 4px 0 var(--ink); }
.mode-card:hover:not(:disabled) { background: var(--panel-2); }
.mode-card:disabled { opacity: 0.55; cursor: not-allowed; }
.mode-card .mode-icon { grid-row: span 2; display: grid; place-items: center; width: 48px; height: 48px; border-radius: 10px; background: rgb(255 255 255 / 8%); }
.mode-card .mode-icon img { width: 36px; height: 36px; object-fit: contain; }
.mode-card small { color: var(--muted); font-size: 0.8rem; }
.home-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }

/* ------------------------------ zone map: climb the tower ------------------------------ */
.zone { height: calc(100dvh - 60px); }
.zone-scroll { height: 100%; overflow-y: auto; overscroll-behavior: contain; }
.tower { position: relative; width: min(100%, 980px); margin: 0 auto; padding: 30px 14px 60px; display: flex; flex-direction: column-reverse; gap: 0; }
.floor { position: relative; padding: 14px 18px 18px; }
.floor-head { position: relative; z-index: 2; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.floor-head h2 { font-size: 1.3rem; text-shadow: 0 2px 0 var(--ink); }
.floor-head .eyebrow { color: #fff; text-shadow: 0 1px 0 var(--ink); }
.floor-head .muted { color: #fff; text-shadow: 0 1px 0 var(--ink); }
.floor-state { flex: 0 0 auto; max-width: 52%; padding: 5px 12px; border: 3px solid var(--ink); border-radius: 10px; color: var(--ink); background: var(--gold); font-size: 0.8rem; font-weight: 900; box-shadow: 0 3px 0 var(--ink); text-align: right; }
.floor.locked .floor-state { background: #eef1f6; }
.floor-roof { position: absolute; left: 4%; right: 4%; bottom: 12px; top: 90px; border: 3px solid var(--ink); border-radius: 12px; background: var(--fl-turf) 0 0 / 48px 48px; image-rendering: pixelated; box-shadow: inset 0 4px 0 rgb(255 255 255 / 40%), 0 6px 0 var(--ink); }
.floor-roof::after { content: ""; position: absolute; left: 0; right: 0; top: 100%; height: 72px; margin-top: 2px; background: var(--fl-facade) 0 0 / 48px 72px repeat-x; image-rendering: pixelated; }
.floor.locked .floor-roof { filter: saturate(0.3) brightness(0.7); }
.track { position: relative; z-index: 1; margin-top: 64px; }
.trail { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.trail path { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.trail path:first-child { stroke: var(--ink); stroke-width: 14; opacity: 0.55; }
.trail path:last-child { stroke: #fff7de; stroke-width: 6; stroke-dasharray: 1 14; }
.lift { position: relative; height: 70px; margin: 0 auto; width: 18px; }
.lift::before { content: ""; position: absolute; inset: 0; border-left: 4px dashed rgb(255 255 255 / 80%); border-right: 4px dashed rgb(255 255 255 / 80%); }
.node { position: absolute; display: grid; justify-items: center; gap: 2px; width: 112px; padding: 0; translate: -50% -32px; border: 0; color: #fff; background: none; font: inherit; cursor: pointer; }
.node:disabled { cursor: not-allowed; }
.node-disc { display: grid; place-items: center; width: 60px; height: 60px; border: 4px solid var(--ink); border-radius: 50%; color: var(--ink); background: radial-gradient(circle at 35% 30%, #fff 0 18%, #e6eef8 19% 100%); font-size: 1.3rem; font-weight: 900; box-shadow: 0 6px 0 var(--ink), 0 10px 14px rgb(0 0 0 / 30%); transition: translate 0.1s, box-shadow 0.1s; }
.node:hover:not(:disabled) .node-disc { translate: 0 -3px; box-shadow: 0 9px 0 var(--ink); }
.node:active:not(:disabled) .node-disc { translate: 0 4px; box-shadow: 0 2px 0 var(--ink); }
.node.done .node-disc { background: radial-gradient(circle at 35% 30%, #fff7cf 0 18%, var(--gold) 19% 100%); }
.node.current .node-disc { background: radial-gradient(circle at 35% 30%, #f3ffd9 0 18%, var(--lime) 19% 100%); animation: pulse 1.1s ease-in-out infinite; }
.node.locked .node-disc { color: #59606f; background: #a3acba; font-size: 1rem; box-shadow: 0 4px 0 var(--ink); }
.node-name { max-width: 100%; padding: 1px 7px; border-radius: 7px; background: rgb(14 20 48 / 78%); font-size: 0.72rem; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.node.locked .node-name { opacity: 0.7; }
.node-gem { position: absolute; top: -8px; left: calc(50% + 16px); width: 26px; filter: drop-shadow(0 2px 0 var(--ink)); }
.node-pro { position: absolute; top: -6px; right: calc(50% + 18px); font-size: 1.05rem; }
.node-you { position: absolute; left: 50%; top: -60px; width: 42px; height: 56px; translate: -50% 0; background-size: 600% 300%; image-rendering: pixelated; animation: f-idle 0.9s steps(1) infinite, hop 0.9s ease-in-out infinite; filter: drop-shadow(0 3px 0 rgb(0 0 0 / 35%)); pointer-events: none; }
.stars { display: inline-flex; gap: 2px; justify-content: center; min-height: 18px; }
.stars img { width: 18px; height: 16px; }
.stars img:nth-child(2) { translate: 0 -3px; }
.stars.big { display: flex; justify-content: center; gap: 8px; margin: 6px 0 10px; }
.stars.big img { width: 64px; height: 56px; }
.stars.big img.lit { animation: starpop 0.45s backwards; }
.stars.big img.lit:nth-child(2) { animation-delay: 0.25s; }
.stars.big img.lit:nth-child(3) { animation-delay: 0.5s; }
@keyframes hop { 50% { translate: -50% -10px; } }
@keyframes pulse { 50% { filter: brightness(1.18); scale: 1.05; } }
@keyframes starpop { 0% { scale: 0; rotate: -40deg; } 70% { scale: 1.35; } 100% { scale: 1; rotate: 0deg; } }

/* ------------------------------ game layout ------------------------------ */
.game { display: flex; flex-direction: column; gap: 8px; height: 100dvh; padding: 8px 12px 12px; overflow: hidden; }
.bar { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; padding: 6px 10px; border: 3px solid var(--ink); border-radius: var(--radius); background: rgb(29 39 71 / 92%); box-shadow: 0 4px 0 var(--ink); }
.bar-title { flex: 1 1 auto; min-width: 0; }
.bar-title h2 { font-size: 1.1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-title .eyebrow { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-tools { display: flex; align-items: center; gap: 6px; }
.pro-toggle { display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 0 10px; border: 2px solid var(--ink); border-radius: 10px; background: var(--panel-3); font-weight: 800; font-size: 0.85rem; cursor: pointer; box-shadow: 0 3px 0 var(--ink); }
.pro-toggle:has(input:checked) { color: #ffc078; background: #4a2a10; }
.pro-toggle input { accent-color: var(--orange); }
.stage { flex: 1 1 auto; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 330px; grid-template-rows: minmax(0, 1fr); gap: 12px; }
.board-wrap { position: relative; min-width: 0; min-height: 0; display: grid; place-items: center; }
.side { display: flex; flex-direction: column; gap: 9px; min-height: 0; padding: 12px; border: 3px solid var(--ink); border-radius: var(--radius); background: rgb(29 39 71 / 94%); box-shadow: 0 5px 0 var(--ink); overflow: auto; }
.hud { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
.stat { display: grid; gap: 1px; padding: 6px 9px; border: 2px solid var(--ink); border-radius: 10px; background: var(--line); }
.stat span { color: var(--muted); font-size: 0.64rem; font-weight: 900; letter-spacing: 0.1em; text-transform: uppercase; }
.stat strong { font-size: 1.1rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
#hudLives { color: var(--red); letter-spacing: 0.08em; }
.goals { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border: 2px solid var(--ink); border-radius: 99px; background: var(--line); font-size: 0.8rem; font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.chip img { width: 16px; height: 16px; }
.chip.pace { color: var(--gold); border-color: var(--gold); }
.chip.missed { opacity: 0.4; text-decoration: line-through; }
.chip.gem { color: var(--sky); }
.chip.gem.got { color: #00313b; background: var(--sky); animation: chip-pop 0.5s; }
.chip.pro { color: #ffc078; border-color: var(--orange); }
@keyframes chip-pop { 30% { scale: 1.35; } }
.desc { color: var(--muted); font-size: 0.88rem; }
.message { min-height: 3.3em; padding: 8px 11px; border: 2px solid var(--ink); border-left: 6px solid var(--lime); border-radius: 10px; background: var(--line); font-size: 0.88rem; }
.message.good { border-left-color: var(--gold); }
.message.warn { border-left-color: var(--orange); }
.message.bad { border-left-color: var(--red); }
.controls { display: flex; flex-direction: column; gap: 12px; margin-top: auto; }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.actions .btn { padding: 6px 8px; font-size: 0.84rem; }
.dpad { display: grid; grid-template-columns: repeat(3, 58px); grid-template-rows: repeat(3, 48px); gap: 6px; justify-content: center; }
.pad { min-height: 0; padding: 0; font-size: 1rem; }
.pad.up { grid-area: 1 / 2; } .pad.left { grid-area: 2 / 1; } .pad.kick { grid-area: 2 / 2; } .pad.right { grid-area: 2 / 3; } .pad.down { grid-area: 3 / 2; }
.pad.kick { color: #10240a; background: var(--lime); font-size: 0.8rem; }
.pad.kick.active { background: var(--gold); animation: pulse 0.8s infinite; }

/* kit bag */
.inventory { display: flex; flex-wrap: wrap; gap: 6px; align-items: stretch; }
.inv-label { flex: 1 0 100%; color: var(--muted); font-size: 0.64rem; font-weight: 900; letter-spacing: 0.1em; text-transform: uppercase; }
.slot { position: relative; display: grid; justify-items: center; gap: 1px; min-width: 66px; padding: 5px 8px 4px; border: 3px solid var(--ink); border-radius: 11px; color: var(--text); background: var(--line); font: inherit; font-size: 0.72rem; font-weight: 800; cursor: pointer; box-shadow: 0 3px 0 var(--ink); }
.slot img { width: 30px; height: 30px; }
.slot .count { position: absolute; top: -8px; right: -8px; min-width: 22px; padding: 1px 6px; border: 2px solid var(--ink); border-radius: 99px; color: var(--ink); background: #fff; font-size: 0.72rem; }
.slot .key { position: absolute; top: 2px; left: 5px; color: var(--muted); font-size: 0.62rem; }
.slot:disabled { opacity: 0.35; cursor: not-allowed; }
.slot.active { background: #3a2f0c; border-color: var(--gold); animation: slot-glow 0.9s ease-in-out infinite; }
.slot.active.power { background: #3d1414; border-color: var(--red); --glow: var(--red); }
.slot.active.chip { background: #0d2c3a; border-color: var(--gem); --glow: var(--gem); }
.slot.ballslot { cursor: default; }
@keyframes slot-glow { 50% { box-shadow: 0 3px 0 var(--ink), 0 0 16px 3px var(--glow, var(--gold)); translate: 0 -2px; } }

/* replay bar and coach */
.replay-bar { position: absolute; left: 50%; top: 8px; z-index: 6; translate: -50% 0; display: flex; align-items: center; gap: 8px; padding: 6px 10px; border: 3px solid var(--ink); border-radius: 12px; background: rgb(14 20 48 / 90%); font-weight: 900; font-size: 0.8rem; letter-spacing: 0.08em; text-transform: uppercase; box-shadow: 0 4px 0 var(--ink); }
.coach { position: absolute; left: 50%; bottom: 8px; z-index: 7; translate: -50% 0; display: flex; align-items: flex-end; gap: 10px; width: min(96%, 620px); pointer-events: none; }
.coach-face { flex: 0 0 auto; width: 84px; height: 84px; image-rendering: pixelated; filter: drop-shadow(0 4px 0 var(--ink)); animation: coach-bob 1.6s ease-in-out infinite; }
.coach-bubble { position: relative; flex: 1; padding: 12px 14px; border: 3px solid var(--ink); border-radius: 14px; color: var(--ink); background: #fffbe9; box-shadow: 0 5px 0 var(--ink); pointer-events: auto; animation: bubble-in 0.25s; }
.coach-bubble::before { content: ""; position: absolute; left: -14px; bottom: 18px; border: 8px solid transparent; border-right: 10px solid var(--ink); }
.coach-bubble .eyebrow { color: #4a7a10; }
.coach-bubble p:not(.eyebrow) { margin-top: 2px; font-weight: 700; font-size: 0.95rem; }
.coach-actions { display: flex; gap: 8px; margin-top: 8px; }
.coach-actions .btn.ghost { color: #555; border-color: #ccc; }
@keyframes coach-bob { 50% { translate: 0 -4px; } }
@keyframes bubble-in { from { scale: 0.9; opacity: 0; } }
.spot-ui { position: relative; z-index: 3; animation: spot-ui 1s ease-in-out infinite; }
@keyframes spot-ui { 50% { box-shadow: 0 0 0 4px var(--gold), 0 0 22px 6px rgb(255 210 63 / 70%); } }

/* ------------------------------ the pitch ------------------------------ */
.board { --t: 48px; position: relative; flex: 0 0 auto; border: 3px solid var(--ink); border-radius: 14px; overflow: hidden; box-shadow: 0 8px 0 var(--ink), 0 16px 34px rgb(0 0 0 / 35%); user-select: none; touch-action: manipulation; contain: layout paint; }
.board.mini { border-width: 2px; border-radius: 10px; box-shadow: 0 4px 0 var(--ink); }
.b-sky { position: absolute; inset: 0; overflow: hidden; background: linear-gradient(180deg, var(--sky-a), var(--sky-b) 60%, var(--sky-c)); }
.b-hz, .b-cl { position: absolute; left: 0; right: 0; background-repeat: repeat-x; image-rendering: pixelated; }
.b-hz.far { bottom: 0; height: 45%; background-image: var(--hz-far); background-size: auto 100%; opacity: 0.8; animation: drift 180s linear infinite; }
.b-hz.mid { bottom: 0; height: 30%; background-image: var(--hz-mid); background-size: auto 100%; animation: drift 120s linear infinite reverse; }
.b-cl { top: 0; bottom: 0; background-repeat: repeat; }
.b-cl.a { background-image: var(--cloud-a); background-size: calc(var(--t) * 5) auto; animation: drift-cloud 140s linear infinite; opacity: 0.95; }
.b-cl.b { background-image: var(--cloud-b); background-size: calc(var(--t) * 3.2) auto; background-position: calc(var(--t) * 2) calc(var(--t) * 2.5); animation: drift-cloud 80s linear infinite; opacity: 0.65; }
.b-under, .tiles, .actors, .fx { position: absolute; left: calc(var(--t) * 0.5); top: calc(var(--t) * 0.5); width: calc(var(--t) * var(--cols)); height: calc(var(--t) * var(--rows)); }
.tiles { display: grid; grid-template-columns: repeat(var(--cols), var(--t)); grid-template-rows: repeat(var(--rows), var(--t)); }
.actors, .fx { pointer-events: none; }
.facade { position: absolute; left: calc(var(--x) * var(--t)); top: calc(var(--y) * var(--t) - 1px); width: var(--t); height: calc(var(--t) * 1.5); background: var(--under-m0) 0 0 / 100% 100% no-repeat; animation: isle-sway 6s ease-in-out infinite; animation-delay: calc(var(--x) * -0.4s); }
.facade.u-m1 { background-image: var(--under-m1); } .facade.u-m2 { background-image: var(--under-m2); }
.facade.u-l { background-image: var(--under-l); } .facade.u-r { background-image: var(--under-r); } .facade.u-s { background-image: var(--under-s); }
@keyframes isle-sway { 50% { translate: 0 1px; } }
.tile { position: relative; width: var(--t); height: var(--t); cursor: pointer; }
.tile.ground.g0 { background: var(--turf0) 0 0 / 100% 100%; }
.tile.ground.g1 { background: var(--turf1) 0 0 / 100% 100%; }
.tile .glaze { position: absolute; inset: 0; z-index: 1; background: var(--glaze0) 0 0 / 100% 100%; image-rendering: pixelated; animation: glaze 2.4s steps(1) infinite; pointer-events: none; }
.tile.ground::before { content: ""; position: absolute; inset: 0; z-index: 1; background: var(--fade, none); pointer-events: none; }
.tile.air { cursor: default; }
.tile.air::after { content: ""; position: absolute; left: -30%; top: 30%; width: 60%; height: 6%; border-radius: 9px; background: rgb(255 255 255 / 55%); opacity: 0; animation: wisp 9s linear infinite; animation-delay: var(--d, 0s); }
.tile.walk { cursor: pointer; }
.tile.walk.wh { background: var(--walk-h) 0 0 / 100% 100%; }
.tile.walk.wv { background: var(--walk-v) 0 0 / 100% 100%; }
.tile.walk::before { content: ""; position: absolute; left: 6%; right: 6%; bottom: -10%; height: 12%; border-radius: 50%; background: rgb(0 0 0 / 18%); }
@keyframes glaze { 0% { background-image: var(--glaze0); } 33% { background-image: var(--glaze1); } 66% { background-image: var(--glaze2); } }
@keyframes wisp { 0% { opacity: 0; translate: 0 0; } 10% { opacity: 0.8; } 45% { opacity: 0; translate: 220% 30%; } 100% { opacity: 0; translate: 220% 30%; } }

.obj { position: absolute; inset: 9%; z-index: 2; background: center / contain no-repeat; pointer-events: none; }
.o-cone { background-image: var(--o-cone); }
.o-block { background-image: var(--o-block, var(--o-cone)); }
.o-vent { inset: 4%; background: var(--vent0) 0 0 / 100% 100%; transform: rotate(var(--r)); animation: vent 0.45s steps(1) infinite; }
.o-curvePickup { inset: 20%; background-image: var(--o-curvePickup); animation: bob 1.1s ease-in-out infinite; }
.wind { position: absolute; inset: 0; z-index: 2; pointer-events: none; transform: rotate(var(--r)); overflow: hidden; }
.wind::before, .wind::after { content: ""; position: absolute; left: 30%; width: 3px; height: 30%; border-radius: 3px; background: rgb(255 255 255 / 65%); animation: gust 0.9s linear infinite; }
.wind::after { left: 64%; animation-delay: -0.45s; }
@keyframes vent { 0% { background-image: var(--vent0); } 33% { background-image: var(--vent1); } 66% { background-image: var(--vent2); } }
@keyframes gust { 0% { top: 100%; opacity: 0; } 30% { opacity: 1; } 100% { top: -30%; opacity: 0; } }
.o-button { inset: 14%; background-image: var(--o-button); }
.tile.on .o-button { background-image: var(--o-buttonDown); }
.o-door { inset: 2%; background-image: var(--o-door); }
.tile.on .o-door { background-image: var(--o-doorOpen); }
.o-plate { inset: 6%; background-image: var(--o-plate); }
.tile.on .o-plate { background-image: var(--o-plateDown); filter: drop-shadow(0 0 5px rgb(255 255 255 / 55%)); }
.o-gate { inset: 2%; background-image: var(--o-gate); }
.tile.on .o-gate { background-image: var(--o-gateOpen); }
.o-crack { inset: 0; background-image: var(--o-crack); background-size: 100% 100%; }
.tile.broken .o-crack { opacity: 0.25; filter: grayscale(1); transform: scale(0.7) rotate(8deg); transition: 0.3s; }
.o-goal { inset: 4% 0 0; background-image: var(--goal); background-size: 100% 100%; }
.tile.net .o-goal { animation: net 0.5s; }
.o-gem { inset: 20%; background-image: var(--o-gem); animation: bob 1.4s ease-in-out infinite; filter: drop-shadow(0 0 4px rgb(127 240 255 / 90%)); }
.tile.got .o-gem { opacity: 0; transform: scale(2.4); animation: none; transition: opacity 0.35s, transform 0.35s; }
.o-bootPower, .o-bootChip { inset: 10%; animation: bob 1.1s ease-in-out infinite; filter: drop-shadow(0 0 5px rgb(255 255 255 / 85%)); transition: opacity 0.25s, transform 0.25s; }
.o-bootPower { background-image: var(--o-bootPower); }
.o-bootChip { background-image: var(--o-bootChip); }
.o-bombPickup { inset: 18%; background-image: var(--o-bombPickup); animation: bob 1.1s ease-in-out infinite; }
.o-ironPickup { inset: 22%; background-image: var(--o-ironPickup); animation: bob 1.1s ease-in-out infinite; }
.tile.taken .obj:not(.o-goal) { opacity: 0; transform: translateY(-60%) scale(1.5); animation: none; }
@keyframes bob { 50% { translate: 0 -9%; } }
@keyframes net { 20% { transform: translate(4%, -3%) scale(1.06); } 40% { transform: translate(-3%, 2%); } 60% { transform: translate(2%, -1%); } }

.tile.danger::after { content: ""; position: absolute; inset: 0; z-index: 3; pointer-events: none; background: repeating-linear-gradient(45deg, rgb(255 60 60 / 58%) 0 6px, rgb(255 60 60 / 30%) 6px 12px); box-shadow: inset 0 0 0 2px rgb(255 120 120 / 95%); }
.tile.danger-next::after { content: ""; position: absolute; inset: 8%; z-index: 3; pointer-events: none; border: 2px dashed rgb(255 160 160 / 95%); border-radius: 6px; }
.tile.flash::after { content: ""; position: absolute; inset: 0; z-index: 4; background: rgb(255 60 60 / 70%); animation: fade-out 0.5s forwards; }
.tile.aim-path { box-shadow: inset 0 0 0 100vmax rgb(255 255 255 / 22%); }
.tile.aim-land { box-shadow: inset 0 0 0 4px var(--lime), inset 0 0 0 100vmax rgb(183 243 107 / 34%); }
.tile.aim-goal { box-shadow: inset 0 0 0 4px var(--gold), inset 0 0 0 100vmax rgb(255 210 63 / 45%); }
.tile.aim-pass { box-shadow: inset 0 0 0 4px var(--sky), inset 0 0 0 100vmax rgb(127 232 255 / 38%); }
.tile.aim-bad { box-shadow: inset 0 0 0 4px var(--red), inset 0 0 0 100vmax rgb(255 93 93 / 40%); }
.tile.aim-ghost { box-shadow: inset 0 0 0 100vmax rgb(255 255 255 / 26%); }
.tile.aim-ghost > .ghost-ring, .tile .ghost-ring { position: absolute; inset: 14%; z-index: 4; border: 3px dashed #fff; border-radius: 50%; animation: spin 4s linear infinite; pointer-events: none; }
.tile.hint { box-shadow: inset 0 0 0 4px var(--sky), inset 0 0 0 100vmax rgb(127 232 255 / 34%); animation: tile-pulse 0.9s ease-in-out infinite; }
.tile.spot { box-shadow: inset 0 0 0 4px var(--gold), inset 0 0 0 100vmax rgb(255 210 63 / 30%); animation: tile-pulse 0.9s ease-in-out infinite; z-index: 1; }
.tile[data-mark]::before { content: attr(data-mark); position: absolute; z-index: 5; left: 50%; top: 4%; translate: -50% 0; padding: 1px 5px; border-radius: 5px; color: #fff; background: rgb(0 0 0 / 75%); font-size: clamp(0.5rem, calc(var(--t) * 0.2), 0.75rem); font-weight: 900; letter-spacing: 0.04em; white-space: nowrap; pointer-events: none; }
.tile[data-mark=""]::before { display: none; }
.tile.ground[data-mark]::before { inset: auto; background: rgb(0 0 0 / 75%); }
@keyframes tile-pulse { 50% { filter: brightness(1.28); } }
@keyframes spin { to { rotate: 360deg; } }
@keyframes fade-out { to { opacity: 0; } }

/* sprites */
.actor { position: absolute; left: 0; top: 0; width: var(--t); height: var(--t); transform: translate(calc(var(--x, 0) * var(--t)), calc(var(--y, 0) * var(--t))); transition-property: transform; transition-timing-function: linear; transition-duration: 0ms; }
.actor .body { position: absolute; inset: 0; }
.actor .spr { position: absolute; background-repeat: no-repeat; }
.actor .shadow { position: absolute; left: 22%; right: 22%; bottom: 4%; height: 14%; border-radius: 50%; background: rgb(0 0 0 / 28%); }
.blue, .defender, .brute { z-index: 3; }
.blue .spr, .defender .spr, .brute .spr { left: 7%; bottom: 5%; width: 86%; height: 115%; background-size: 600% 300%; background-position: 0 0; animation: f-idle 0.9s steps(1) infinite; }
.brute .spr { left: -6%; width: 112%; height: 118%; }
.crate { z-index: 2; }
.crate .spr { left: 4%; top: 2%; width: 92%; height: 92%; background-size: 100% 100%; image-rendering: pixelated; }
.crate .shadow { left: 8%; right: 8%; bottom: 0; height: 12%; }
.crate.gone .body { animation: crate-burst 0.3s forwards; }
.crate.falling .body { animation: fall 0.75s ease-in forwards; }
.crate.falling .shadow { opacity: 0; }
@keyframes crate-burst { to { scale: 1.6; opacity: 0; rotate: 20deg; } }
/* facing rows apply to people only: the ball has its own two rolling rows */
:is(.blue, .defender, .brute)[data-face="up"] .spr { background-position-y: 50%; }
:is(.blue, .defender, .brute)[data-face="left"] .spr, :is(.blue, .defender, .brute)[data-face="right"] .spr { background-position-y: 100%; }
:is(.blue, .defender, .brute)[data-face="left"] .spr { scale: -1 1; }
.actor.run .spr { animation: f-run 0.22s steps(1) infinite; }
.actor.kick .spr { animation: none; background-position-x: 80%; }
.actor.cheer .spr { animation: f-cheer 0.45s steps(1) infinite; }
.actor.receive .spr { translate: 0 -12%; }
.actor.shoved .body { animation: shoved 0.2s; }
.actor.falling .body { animation: fall 0.75s ease-in forwards; }
.actor.falling .shadow { opacity: 0; transition: opacity 0.2s; }
@keyframes f-idle { 0% { background-position-x: 0%; } 50% { background-position-x: 20%; } }
@keyframes f-run { 0% { background-position-x: 40%; } 50% { background-position-x: 60%; } }
@keyframes f-cheer { 0% { background-position-x: 100%; translate: 0 0; } 50% { background-position-x: 100%; translate: 0 -14%; } }
@keyframes fall { 0% { translate: 0 0; scale: 1; rotate: 0deg; opacity: 1; } 22% { translate: 0 -18%; scale: 1.05; } 100% { translate: 0 240%; scale: 0.15; rotate: 260deg; opacity: 0; } }
@keyframes shoved { 50% { filter: brightness(1.6); } }
.blue .ring { position: absolute; left: 16%; right: 16%; bottom: 3%; height: 20%; border-radius: 50%; }
.blue.me .ring { border: 2px solid var(--lime); background: rgb(183 243 107 / 38%); box-shadow: 0 0 10px rgb(183 243 107 / 70%); }
.blue.mate .ring { border: 2px dashed var(--sky); background: rgb(127 232 255 / 16%); }
.blue.mate .spr { filter: saturate(0.6) brightness(0.92); }
.blue .aura { position: absolute; inset: -6%; display: none; pointer-events: none; }
.blue.me.armed .aura { display: block; }
.blue.me.armed .body { animation: armed 0.7s ease-in-out infinite; }
.blue.me.armed.armed-power { --armc: #ff5d5d; }
.blue.me.armed.armed-chip { --armc: #29c6e8; }
.aura::before { content: ""; position: absolute; left: 10%; right: 10%; bottom: 0; height: 30%; border-radius: 50%; background: radial-gradient(closest-side, var(--armc), transparent); opacity: 0.85; animation: pulse 0.7s infinite; }
.aura-icon { position: absolute; left: 50%; top: -42%; width: 46%; height: 46%; translate: -50% 0; background: center / contain no-repeat; image-rendering: pixelated; animation: bob 0.7s ease-in-out infinite; filter: drop-shadow(0 0 4px #fff); }
.armed-power .aura-icon { background-image: var(--o-bootPower); }
.armed-chip .aura-icon { background-image: var(--o-bootChip); }
@keyframes armed { 50% { filter: drop-shadow(0 0 6px var(--armc)) brightness(1.15); } }
.defender .aim-arrow { position: absolute; inset: 0; transform: rotate(var(--rot, 0deg)); transition: transform 0.2s; pointer-events: none; }
.defender .aim-arrow::after { content: ""; position: absolute; left: 50%; top: -6%; width: 30%; height: 16%; translate: -50% 0; background: #ff4d4d; clip-path: polygon(50% 0, 100% 100%, 0 100%); filter: drop-shadow(0 0 2px #000); }
.defender .spin-badge { position: absolute; right: 0; bottom: 2%; width: 34%; height: 34%; border-radius: 50%; background: #c0392b var(--art-spin) center / 66% no-repeat; box-shadow: 0 0 0 2px #fff; animation: spin 3s linear infinite; }
.brute.ko .spr { rotate: 90deg; translate: 0 22%; filter: grayscale(0.5) brightness(0.8); animation: none; background-position-x: 100%; transition: rotate 0.25s, translate 0.25s; }
.brute.ko { z-index: 1; }
.brute.shoving .spr { animation: none; background-position-x: 80%; }

.ball { z-index: 4; }
.ball .shadow { left: 32%; right: 32%; bottom: 20%; height: 12%; transition: scale 0.15s, opacity 0.15s; }
.ball .spr { left: 27%; top: 44%; width: 46%; height: 46%; background-size: 1600% 200%; background-position: 0 0; transition: left 0.1s, top 0.1s, width 0.1s, height 0.1s; }
.ball.held .shadow { opacity: 0; }
.ball.held .spr { width: 38%; height: 38%; }
.ball.held[data-face="right"] .spr { left: 60%; top: 60%; }
.ball.held[data-face="left"] .spr { left: 6%; top: 60%; }
.ball.held[data-face="down"] .spr { left: 33%; top: 72%; }
.ball.held[data-face="up"] .spr { left: 31%; top: -16%; }

.ball.roll .spr { animation: roll-x var(--roll, 0.3s) steps(16, jump-none) infinite; }
.ball.roll[data-roll="left"] .spr { animation-direction: reverse; }
.ball.roll[data-roll="down"] .spr, .ball.roll[data-roll="up"] .spr { background-position-y: 100%; }
.ball.roll[data-roll="up"] .spr { animation-direction: reverse; }
.ball.fly .shadow { scale: 0.7; opacity: 0.6; }
.ball.fly.high .shadow { scale: 0.45; opacity: 0.4; }
.ball.scored .spr { scale: 0.7; }
.ball.gone { opacity: 0; transition: opacity 0.3s; }
.ball.falling .body { animation: fall 0.75s ease-in forwards; }
.ball.falling .shadow { opacity: 0; }
@keyframes roll-x { from { background-position-x: 0%; } to { background-position-x: 100%; } }

/* effects */
.fxp { position: absolute; left: calc(var(--x) * var(--t)); top: calc(var(--y) * var(--t)); translate: -50% -50%; pointer-events: none; }
.puff { width: calc(var(--t) * 0.4); height: calc(var(--t) * 0.2); border-radius: 50%; background: rgb(255 255 255 / 75%); animation: puff 0.42s ease-out forwards; }
.dust { width: calc(var(--t) * 0.14); height: calc(var(--t) * 0.14); border-radius: 50%; background: rgb(255 255 255 / 70%); animation: dust 0.4s ease-out forwards; }
.dash { width: calc(var(--t) * 0.9); height: calc(var(--t) * 0.14); border-radius: 9px; background: linear-gradient(90deg, rgb(255 255 255 / 0), rgb(255 255 255 / 70%)); animation: dash 0.3s ease-out forwards; }
.dash.d-left { rotate: 180deg; } .dash.d-up { rotate: -90deg; } .dash.d-down { rotate: 90deg; }
.spark { width: calc(var(--t) * 0.12); height: calc(var(--t) * 0.12); animation: spark 0.75s ease-out forwards; }
.spark.big { width: calc(var(--t) * 0.18); height: calc(var(--t) * 0.18); }
.cel { width: calc(var(--t) * 0.16); height: calc(var(--t) * 0.16); animation: cel 1.6s cubic-bezier(.2,.6,.3,1) forwards; animation-delay: var(--delay); opacity: 0; }
.cel-heart { clip-path: polygon(50% 100%, 0 40%, 10% 10%, 35% 5%, 50% 25%, 65% 5%, 90% 10%, 100% 40%); width: calc(var(--t) * 0.24); height: calc(var(--t) * 0.24); }
.cel-balloon { width: calc(var(--t) * 0.3); height: calc(var(--t) * 0.38); border-radius: 50% 50% 46% 46%; box-shadow: inset -3px -3px 0 rgb(0 0 0 / 18%); animation-duration: 1.8s; }
.cel-spark { width: calc(var(--t) * 0.08); height: calc(var(--t) * 0.3); border-radius: 4px; }
.cel-coin { width: calc(var(--t) * 0.26); height: calc(var(--t) * 0.26); background: center / contain no-repeat; image-rendering: pixelated; }
.cel-bolt { clip-path: polygon(40% 0, 100% 0, 60% 40%, 90% 40%, 20% 100%, 40% 55%, 10% 55%); width: calc(var(--t) * 0.22); height: calc(var(--t) * 0.36); }
.banner { position: absolute; left: 50%; top: 42%; z-index: 9; translate: -50% -50%; width: min(80%, calc(var(--t) * 7)); animation: banner 1.3s ease-out forwards; pointer-events: none; }
.banner img { display: block; width: 100%; }
.banner.bad { width: min(70%, calc(var(--t) * 6)); animation-duration: 0.85s; }
.banner.gem { top: 22%; width: min(36%, calc(var(--t) * 3)); animation-duration: 1s; }
.flyer { position: fixed; z-index: 50; pointer-events: none; filter: drop-shadow(0 0 8px rgb(127 240 255 / 90%)); }
.board.shake { animation: shake 0.22s steps(4); }
@keyframes puff { to { scale: 2.6; opacity: 0; } }
@keyframes dust { to { translate: -50% -140%; scale: 0.3; opacity: 0; } }
@keyframes dash { 0% { opacity: 0.9; scale: 0.3 1; } 100% { opacity: 0; scale: 1.2 0.6; } }
@keyframes spark { to { transform: translate(calc(var(--dx) * var(--t)), calc(var(--dy) * var(--t))) rotate(180deg); opacity: 0; } }
@keyframes cel { 0% { opacity: 1; transform: translate(0, 0) rotate(0); } 100% { opacity: 0; transform: translate(calc(var(--dx) * var(--t)), calc(var(--dy) * var(--t) + var(--t))) rotate(var(--rot)); } }
@keyframes banner { 0% { opacity: 0; scale: 0.4; } 15% { opacity: 1; scale: 1.15; } 28% { scale: 1; } 80% { opacity: 1; } 100% { opacity: 0; translate: -50% -80%; } }
@keyframes shake { 25% { translate: -4px 2px; } 50% { translate: 4px -2px; } 75% { translate: -2px -2px; } }

/* ------------------------------ dialogs and toasts ------------------------------ */
.modal { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 16px; background: rgb(6 10 28 / 66%); backdrop-filter: blur(3px); }
.modal-card { width: min(100%, 540px); max-height: calc(100dvh - 32px); overflow: auto; padding: 22px; border: 3px solid var(--ink); border-radius: 18px; background: var(--panel); box-shadow: 0 8px 0 var(--ink), 0 24px 60px rgb(0 0 0 / 50%); animation: modal-in 0.2s; }
.modal-card.wide { width: min(100%, 760px); }
.modal-card h2 { font-size: 1.45rem; margin-bottom: 8px; }
.modal-card h3 { margin-top: 16px; font-size: 0.85rem; color: var(--lime); letter-spacing: 0.08em; text-transform: uppercase; }
.modal-card p + p { margin-top: 8px; }
.modal-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.win-title { display: flex; justify-content: center; }
.win-title img { width: min(90%, 300px); }
.win-line { text-align: center; font-weight: 700; }
.win-gold { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.note { margin-top: 8px; padding: 8px 11px; border: 2px solid var(--ink); border-radius: 10px; background: var(--line); font-size: 0.88rem; }
.note.gemnote { border-color: var(--gem); color: var(--sky); }
.keys { margin: 6px 0 0; padding-left: 18px; color: var(--muted); font-size: 0.9rem; }
.keys strong { color: var(--text); }
.mech { display: flex; gap: 14px; align-items: flex-start; margin-top: 14px; }
.mech p { margin-top: 2px; color: var(--muted); font-size: 0.88rem; }
.mech-demo { flex: 0 0 auto; }
.intro-demo { display: flex; justify-content: center; margin: 10px 0; }
.mini-icon { flex: 0 0 auto; width: 48px; height: 48px; border: 2px solid var(--ink); border-radius: 10px; background: var(--panel-3) center / 70% no-repeat; image-rendering: pixelated; }
@keyframes modal-in { from { scale: 0.94; opacity: 0; } }
.toasts { position: fixed; left: 50%; top: 14px; z-index: 60; translate: -50% 0; display: grid; gap: 8px; pointer-events: none; }
.toast { display: flex; align-items: center; gap: 8px; padding: 8px 14px; border: 3px solid var(--ink); border-radius: 12px; background: #fffbe9; color: var(--ink); font-weight: 800; box-shadow: 0 4px 0 var(--ink); animation: toast-in 0.25s; }
.toast img { width: 22px; height: 22px; }
.toast.out { opacity: 0; translate: 0 -10px; transition: 0.4s; }
@keyframes toast-in { from { translate: 0 -16px; opacity: 0; } }

.gen-bar { height: 16px; margin: 12px 0 8px; border: 3px solid var(--ink); border-radius: 99px; background: var(--line); overflow: hidden; }
.gen-bar span { display: block; height: 100%; width: 0; background: repeating-linear-gradient(45deg, var(--lime) 0 10px, #9fe05a 10px 20px); transition: width 0.2s; animation: gen-stripes 0.6s linear infinite; }
@keyframes gen-stripes { to { background-position: 28px 0; } }
.coach-big { display: block; width: 96px; height: 96px; margin: 0 auto 8px; }

/* ------------------------------ store and locker ------------------------------ */
.store { min-height: calc(100dvh - 60px); padding: 16px; }
.store-wrap { width: min(100%, 1180px); margin: 0 auto; display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 18px; align-items: start; }
.locker { position: sticky; top: 76px; padding: 14px; border: 3px solid var(--ink); border-radius: var(--radius); background: rgb(29 39 71 / 92%); box-shadow: 0 5px 0 var(--ink); }
.locker-stage { position: relative; height: 230px; border: 3px solid var(--ink); border-radius: 12px; overflow: hidden; background: linear-gradient(180deg, var(--sky-a), var(--sky-b) 60%, var(--sky-c)); }
.locker-stage::before { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 50%; background: var(--hz-far) repeat-x 0 100% / auto 100%; image-rendering: pixelated; opacity: 0.8; animation: drift 120s linear infinite; }
.locker-roof { position: absolute; left: 10%; right: 10%; bottom: 18px; height: 50px; border: 3px solid var(--ink); border-radius: 8px; background: var(--hero-turf) 0 0 / 50px 50px; image-rendering: pixelated; box-shadow: inset 0 3px 0 rgb(255 255 255 / 45%); }
.locker-player { position: absolute; left: 50%; bottom: 40px; width: 108px; height: 144px; translate: -60% 0; background-size: 600% 300%; image-rendering: pixelated; animation: f-idle 1.6s steps(1) infinite; }
.locker-ball { position: absolute; left: 60%; bottom: 44px; width: 40px; height: 40px; background-size: 1600% 200%; image-rendering: pixelated; animation: roll-x 2.8s steps(16, jump-none) infinite; }
.locker-views { display: flex; justify-content: center; gap: 8px; margin-top: 10px; }
.locker-views div { width: 48px; height: 64px; background-size: 600% 300%; image-rendering: pixelated; animation: f-idle 1.6s steps(1) infinite; }
.locker-name { margin-top: 8px; text-align: center; font-weight: 800; }
.tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.tab { padding: 7px 13px; border: 3px solid var(--ink); border-radius: 11px; color: var(--text); background: var(--panel); font: inherit; font-weight: 800; font-size: 0.86rem; cursor: pointer; box-shadow: 0 3px 0 var(--ink); }
.tab[aria-selected="true"] { color: var(--ink); background: var(--gold); }
.store-body { min-height: 300px; padding: 14px; border: 3px solid var(--ink); border-radius: var(--radius); background: rgb(29 39 71 / 92%); box-shadow: 0 5px 0 var(--ink); }
.item-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.item-card { position: relative; display: grid; gap: 6px; justify-items: center; padding: 10px 8px 10px; border: 3px solid var(--ink); border-radius: 13px; color: var(--text); background: var(--panel); font: inherit; text-align: center; cursor: pointer; box-shadow: 0 4px 0 var(--ink); transition: transform 0.08s; }
.item-card:hover { transform: translateY(-2px); background: var(--panel-2); }
.item-card.equipped { border-color: var(--lime); box-shadow: 0 4px 0 var(--ink), 0 0 0 2px var(--lime); }
.item-card .thumb { display: grid; place-items: end center; width: 100%; height: 92px; border-radius: 9px; background: linear-gradient(180deg, #8fd3ff, #c9ecff); }
.item-card .thumb .spr-still { width: 54px; height: 72px; background-size: 600% 300%; image-rendering: pixelated; animation: f-idle 1.8s steps(1) infinite; margin-bottom: 6px; }
.item-card .thumb .ball-still { width: 48px; height: 48px; background-size: 1600% 200%; image-rendering: pixelated; animation: roll-x 3.2s steps(16, jump-none) infinite; margin-bottom: 20px; }
.item-card .thumb .boot-still { width: 64px; height: 64px; margin-bottom: 14px; image-rendering: pixelated; }
.item-card .thumb .cel-still { display: flex; gap: 4px; margin-bottom: 30px; }
.item-card .thumb .cel-still i { width: 14px; height: 14px; animation: bob 0.8s ease-in-out infinite; }
.item-card .thumb .cel-still i:nth-child(2) { animation-delay: -0.2s; } .item-card .thumb .cel-still i:nth-child(3) { animation-delay: -0.4s; }
.item-card b { font-size: 0.86rem; line-height: 1.15; }
.item-card small { color: var(--muted); font-size: 0.72rem; }
.item-card .price { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border: 2px solid var(--ink); border-radius: 99px; color: var(--gold); background: var(--line); font-weight: 900; font-size: 0.8rem; }
.item-card .price img { width: 16px; height: 16px; }
.item-card .price.owned { color: var(--lime); }
.item-card .price.locked { color: var(--muted); }
.item-card.cant .price { color: #ff9b9b; }
.shop-row { display: flex; align-items: center; gap: 14px; padding: 12px; border: 3px solid var(--ink); border-radius: 13px; background: var(--panel); box-shadow: 0 4px 0 var(--ink); }
.shop-row + .shop-row { margin-top: 10px; }
.shop-row .mini-icon { width: 54px; height: 54px; }
.shop-row div { flex: 1; min-width: 0; }
.shop-row p { color: var(--muted); font-size: 0.85rem; }
.shop-section { margin: 18px 0 8px; font-size: 0.78rem; font-weight: 900; letter-spacing: 0.12em; text-transform: uppercase; color: var(--lime); }
.creator { display: grid; gap: 12px; }
.creator-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.creator-row > span { width: 92px; color: var(--muted); font-size: 0.78rem; font-weight: 900; text-transform: uppercase; letter-spacing: 0.08em; }
.swatches { display: flex; flex-wrap: wrap; gap: 5px; }
.swatch { width: 28px; height: 28px; padding: 0; border: 3px solid var(--ink); border-radius: 7px; cursor: pointer; box-shadow: 0 2px 0 var(--ink); }
.swatch[aria-pressed="true"] { outline: 3px solid #fff; outline-offset: 1px; }
.swatch.custom { position: relative; overflow: hidden; background: conic-gradient(red, yellow, lime, cyan, blue, magenta, red); }
.swatch.custom input { position: absolute; inset: -6px; width: 200%; height: 200%; opacity: 0; cursor: pointer; }
.pattern-btn { width: 54px; height: 64px; padding: 2px; border: 3px solid var(--ink); border-radius: 9px; background: #c9ecff center / 90% auto no-repeat; image-rendering: pixelated; cursor: pointer; box-shadow: 0 2px 0 var(--ink); }
.pattern-btn[aria-pressed="true"] { border-color: var(--gold); box-shadow: 0 0 0 2px var(--gold); }
.slots-row { display: flex; gap: 8px; flex-wrap: wrap; }
.text-in { min-height: 40px; padding: 6px 11px; border: 3px solid var(--ink); border-radius: 10px; color: var(--text); background: var(--line); font: inherit; font-weight: 700; }
textarea.text-in { width: 100%; resize: vertical; font-family: ui-monospace, monospace; font-size: 0.82rem; }

/* ------------------------------ workshop ------------------------------ */
.workshop { min-height: calc(100dvh - 60px); padding: 16px; }
.workshop-wrap { width: min(100%, 1100px); margin: 0 auto; }
.workshop-head { display: flex; flex-wrap: wrap; gap: 10px; }
.level-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.lv-card { display: grid; gap: 8px; padding: 12px; border: 3px solid var(--ink); border-radius: var(--radius); background: var(--panel); box-shadow: 0 5px 0 var(--ink); }
.lv-card .thumbwrap { display: grid; place-items: center; min-height: 120px; padding: 6px; border-radius: 10px; background: rgb(0 0 0 / 20%); overflow: hidden; }
.lv-card h3 { font-size: 1rem; }
.lv-card .meta { display: flex; flex-wrap: wrap; gap: 6px; color: var(--muted); font-size: 0.78rem; font-weight: 700; }
.lv-card .meta span { padding: 1px 7px; border-radius: 99px; background: var(--line); }
.lv-card .meta .ok { color: var(--lime); }
.lv-card .row { display: flex; flex-wrap: wrap; gap: 6px; }
.empty { padding: 18px; border: 3px dashed rgb(255 255 255 / 30%); border-radius: var(--radius); color: #fff; text-align: center; font-weight: 700; text-shadow: 0 1px 0 var(--ink); }

/* ------------------------------ editor ------------------------------ */
.editor { display: flex; flex-direction: column; height: calc(100dvh - 60px); padding: 10px 12px 12px; gap: 10px; }
.ed-top { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 8px 10px; border: 3px solid var(--ink); border-radius: var(--radius); background: rgb(29 39 71 / 94%); box-shadow: 0 4px 0 var(--ink); }
.ed-title { flex: 1 1 180px; min-width: 140px; min-height: 40px; padding: 6px 11px; border: 3px solid var(--ink); border-radius: 10px; color: var(--text); background: var(--line); font: inherit; font-weight: 900; font-size: 1.05rem; }
.ed-size, .ed-history { display: flex; align-items: center; gap: 6px; font-weight: 800; font-size: 0.82rem; }
.ed-size span { color: var(--muted); text-transform: uppercase; font-size: 0.7rem; letter-spacing: 0.08em; }
.ed-size b { min-width: 22px; text-align: center; }
.ed-body { flex: 1 1 auto; min-height: 0; display: grid; grid-template-columns: 230px minmax(0, 1fr) 280px; gap: 12px; }
.ed-palette, .ed-side { min-height: 0; overflow: auto; padding: 10px; border: 3px solid var(--ink); border-radius: var(--radius); background: rgb(29 39 71 / 94%); box-shadow: 0 5px 0 var(--ink); }
.ed-group { margin-bottom: 12px; }
.ed-group h4 { margin: 0 0 6px; color: var(--muted); font-size: 0.68rem; font-weight: 900; letter-spacing: 0.12em; text-transform: uppercase; }
.ed-group-items { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.ed-tile { position: relative; aspect-ratio: 1; padding: 0; border: 3px solid var(--ink); border-radius: 9px; background: #4fae4a center / 100% 100% no-repeat; image-rendering: pixelated; cursor: pointer; box-shadow: 0 2px 0 var(--ink); overflow: hidden; }
.ed-tile i { position: absolute; inset: 8%; background: center / contain no-repeat; image-rendering: pixelated; }
.ed-tile[aria-pressed="true"] { border-color: var(--gold); box-shadow: 0 0 0 2px var(--gold), 0 2px 0 var(--ink); }
.ed-tile .k { position: absolute; left: 2px; top: 0; color: #fff; font-size: 0.6rem; font-weight: 900; text-shadow: 0 1px 0 #000; }
.ed-board-wrap { position: relative; min-width: 0; min-height: 0; display: grid; place-items: center; }
.board.editing .tile { cursor: crosshair; }
.board.editing .tile.air { cursor: crosshair; }
.board.editing .tile:hover { box-shadow: inset 0 0 0 3px #fff; }
.board.editing .tile.air { background: repeating-linear-gradient(45deg, rgb(255 255 255 / 6%) 0 6px, transparent 6px 12px); outline: 1px dashed rgb(255 255 255 / 25%); outline-offset: -1px; }
.ed-tools { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.ed-tools .btn[aria-pressed="true"] { color: var(--ink); background: var(--gold); }
.ed-field { display: grid; gap: 4px; margin-bottom: 10px; color: var(--muted); font-size: 0.72rem; font-weight: 900; text-transform: uppercase; letter-spacing: 0.08em; }
.ed-field textarea, .ed-field select { padding: 6px 9px; border: 3px solid var(--ink); border-radius: 9px; color: var(--text); background: var(--line); font: inherit; font-size: 0.88rem; font-weight: 600; text-transform: none; letter-spacing: 0; resize: vertical; }
.ed-panel { margin-top: 10px; padding: 10px; border: 2px solid var(--ink); border-radius: 11px; background: var(--line); }
.ed-panel h3 { margin-bottom: 6px; font-size: 0.72rem; color: var(--lime); letter-spacing: 0.12em; text-transform: uppercase; }
.ed-checks { margin: 0; padding: 0; list-style: none; font-size: 0.84rem; }
.ed-checks li { padding: 2px 0 2px 22px; position: relative; }
.ed-checks li::before { position: absolute; left: 0; }
.ed-checks li.ok::before { content: "✅"; }
.ed-checks li.bad::before { content: "⛔"; }
.ed-checks li.warn::before { content: "⚠️"; }
.ed-solver { font-size: 0.86rem; }
.ed-solver b { color: var(--gold); }
.ed-solver-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.ed-clear { margin-bottom: 8px; font-size: 0.84rem; }
.ed-clear.ok { color: var(--lime); }
.ed-dir { display: flex; gap: 4px; margin-top: 6px; }
.ed-dir .btn { min-width: 34px; }
.ed-dir .btn[aria-pressed="true"] { color: var(--ink); background: var(--gold); }

/* ------------------------------ responsive ------------------------------ */
.wide-only { display: inline; }
@media (max-width: 980px) {
  .home-wrap { grid-template-columns: 1fr; }
  .store-wrap { grid-template-columns: 1fr; }
  .locker { position: static; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; align-items: center; }
  .locker-stage { height: 180px; }
  .ed-body { grid-template-columns: 1fr; grid-template-rows: auto minmax(260px, 1fr) auto; }
  .ed-palette { display: flex; gap: 14px; overflow-x: auto; max-height: none; }
  .ed-group { flex: 0 0 auto; margin: 0; }
  .ed-group-items { grid-template-columns: repeat(4, 40px); }
  .editor { height: auto; min-height: calc(100dvh - 60px); }
}
@media (max-width: 900px), (orientation: portrait) {
  .stage { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; gap: 8px; }
  .side { padding: 9px; gap: 7px; overflow: visible; }
  .desc { display: none; }
  .message { height: 4.4em; min-height: 0; padding: 6px 9px; font-size: 0.84rem; overflow-y: auto; }
  .goals { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .inventory { overflow-x: auto; padding-top: 8px; }
  .kick-bar { top: auto; bottom: 8px; }
  .inv-label { display: none; }
  .controls { flex-direction: row; align-items: center; justify-content: space-between; margin-top: 0; }
  .actions { flex: 1 1 auto; max-width: 300px; }
  .actions kbd { display: none; }
  .dpad { grid-template-columns: repeat(3, 50px); grid-template-rows: repeat(3, 40px); gap: 5px; }
  .coach-face { width: 60px; height: 60px; }
}
@media (max-width: 560px) {
  .game { padding: 6px; gap: 6px; }
  .bar { padding: 4px 6px; gap: 6px; }
  .bar-tools .pro-toggle span { display: none; }
  .zone-list, .mode-grid { grid-template-columns: 1fr; }
  .locker { grid-template-columns: 1fr; }
  .wallet .pill span { font-size: 0.8rem; }
  .topbar { padding: 8px 10px; gap: 8px; }
  .floor-head { flex-direction: column; }
  .floor-state { max-width: 100%; text-align: left; }
  .node { width: 92px; }
  .node-disc { width: 52px; height: 52px; font-size: 1.1rem; }
  .node-you { width: 30px; height: 40px; top: -12px; left: calc(50% - 34px); }
  .slot { min-width: 58px; }
}
@media (max-height: 640px) and (min-width: 901px) and (orientation: landscape) {
  .desc { display: none; }
  .dpad { grid-template-rows: repeat(3, 38px); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
.play-note { color: #fff; font-weight: 700; font-size: 0.9rem; text-align: center; text-shadow: 0 2px 0 var(--ink); }

.peek { position: absolute; top: 6px; right: 6px; display: grid; place-items: center; width: 28px; height: 28px; border: 2px solid var(--ink); border-radius: 8px; background: #fffbe9; font-size: 0.9rem; cursor: pointer; box-shadow: 0 2px 0 var(--ink); }
.peek:hover { background: var(--gold); }
.preview-stage { display: flex; justify-content: center; margin: 10px 0 4px; }
.preview-stage.slowmo .spr { animation-duration: 2.2s !important; }
.preview-views { display: flex; justify-content: center; gap: 14px; margin-top: 8px; }
.preview-views div { width: 60px; height: 80px; background-size: 600% 300%; image-rendering: pixelated; animation: f-run 0.6s steps(1) infinite; }

/* kick chooser: in the kit bag and floating over the pitch while aiming */
.slot-row { display: flex; gap: 6px; flex-wrap: wrap; }
.slot b { font-size: 0.78rem; }
.slot small { color: var(--muted); font-size: 0.62rem; font-weight: 700; white-space: nowrap; }
.slot .count.none { background: #9aa1ad; }
.slot.big { min-width: 92px; padding: 6px 10px; }
.slot.big img { width: 36px; height: 36px; }
.kick-bar { position: absolute; left: 50%; top: 8px; z-index: 7; translate: -50% 0; display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 3px solid var(--ink); border-radius: 14px; background: rgb(14 20 48 / 92%); box-shadow: 0 5px 0 var(--ink); animation: bubble-in 0.18s; }
.kb-label { color: var(--muted); font-size: 0.64rem; font-weight: 900; letter-spacing: 0.1em; text-transform: uppercase; writing-mode: vertical-rl; rotate: 180deg; }
.ball-status { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border: 2px solid var(--ink); border-radius: 11px; background: var(--line); }
.ball-status img { width: 30px; height: 30px; }
.ball-status b { display: block; font-size: 0.84rem; }
.ball-status small { color: var(--muted); font-size: 0.74rem; }
.ball-status.special { border-color: var(--sky); box-shadow: 0 0 12px rgb(127 232 255 / 35%); }
.pad.kick.boot-power { background: #ff8a8a; }
.pad.kick.boot-chip { background: #8fe3ff; }
.inventory { flex-direction: column; flex-wrap: nowrap; align-items: stretch; }
.side > * { flex-shrink: 0; }
.inventory > .inv-label, .inventory > .slot-row, .inventory > .ball-status { flex: none; }

/* ---------- Space zone: hover crates and fragile hard-light bridges ---------- */
.crate.hover .body { animation: hover-bob 1.6s ease-in-out infinite; }
.crate.hover .shadow { background: rgb(95 227 255 / 35%); }
.crate.hover.docked { z-index: 1; }
.crate.hover.docked .body { animation: none; translate: 0 6%; filter: drop-shadow(0 0 3px #5fe3ff); }
.crate.hover.docked .shadow { opacity: 0; }
@keyframes hover-bob { 0%, 100% { translate: 0 -4%; } 50% { translate: 0 2%; } }
.tile.frag { cursor: pointer; background-size: 100% 100%; }
.tile.frag.fh[data-left="3"] { background-image: var(--frag-h3); } .tile.frag.fv[data-left="3"] { background-image: var(--frag-v3); }
.tile.frag.fh[data-left="2"] { background-image: var(--frag-h2); } .tile.frag.fv[data-left="2"] { background-image: var(--frag-v2); }
.tile.frag.fh[data-left="1"] { background-image: var(--frag-h1); } .tile.frag.fv[data-left="1"] { background-image: var(--frag-v1); }
.tile.frag.fh[data-left="0"] { background-image: var(--frag-h0); } .tile.frag.fv[data-left="0"] { background-image: var(--frag-v0); }
.tile.frag[data-left="1"], .tile.frag[data-left="0"] { animation: frag-flicker 0.9s steps(2) infinite; }
.tile.frag.flicker { animation: frag-hit 0.3s; }
.tile.frag.gone { background-image: none !important; animation: none; cursor: default; }
@keyframes frag-flicker { 50% { opacity: 0.55; } }
@keyframes frag-hit { 30% { opacity: 0.3; filter: brightness(2); } }

/* ---------- Game screen layout: status card top left, pitch, one dock below ---------- */
.stage { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr) auto; gap: 8px; }
.status { justify-self: start; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; max-width: 100%; padding: 6px 10px; border: 3px solid var(--ink); border-radius: var(--radius); background: rgb(29 39 71 / 94%); box-shadow: 0 4px 0 var(--ink); }
.status .hud { display: flex; gap: 6px; }
.status .stat { padding: 3px 9px; }
.status .stat strong { font-size: 1rem; }
.status .goals { flex-wrap: wrap; }
.dock { display: grid; grid-template-columns: minmax(220px, 1.2fr) minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 10px 12px; border: 3px solid var(--ink); border-radius: var(--radius); background: rgb(29 39 71 / 94%); box-shadow: 0 5px 0 var(--ink); }
.dock-info { display: grid; gap: 6px; min-width: 0; }
.dock .desc { margin: 0; }
.dock .message { min-height: 3.1em; }
.dock .inventory { min-width: 0; }
.dock .inventory[hidden] + .controls { grid-column: 2 / 4; justify-self: end; }
.dock .controls { flex-direction: row; align-items: center; gap: 12px; margin-top: 0; }
.dock .actions { grid-template-columns: 1fr 1fr; min-width: 230px; }
.dock .dpad { grid-template-columns: repeat(3, 50px); grid-template-rows: repeat(3, 38px); gap: 5px; }
.ball-rule { color: var(--muted); font-size: 0.72rem; }
.slot.ball-slot.active { border-color: var(--sky); box-shadow: 0 0 10px rgb(127 232 255 / 40%), 0 3px 0 var(--ink); }

@media (max-width: 900px), (orientation: portrait) {
  .stage { grid-template-rows: auto minmax(0, 1fr) auto; }
  .status { padding: 4px 8px; gap: 6px; }
  .status .goals { flex-wrap: nowrap; overflow-x: auto; }
  .dock { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "info info" "inv inv" "actions pad"; gap: 8px; padding: 8px; }
  .dock-info { grid-area: info; }
  .dock .message { height: 3.6em; min-height: 0; overflow-y: auto; }
  .dock .inventory { grid-area: inv; flex-direction: row; overflow-x: auto; padding-top: 0; }
  .dock .controls { display: contents; }
  .dock .actions { grid-area: actions; min-width: 0; align-self: center; }
  .dock .dpad { grid-area: pad; }
  .dock .inventory[hidden] + .controls { grid-column: auto; }
}
@media (max-width: 560px) {
  .status .stat span { font-size: 0.56rem; }
  .dock .dpad { grid-template-columns: repeat(3, 44px); grid-template-rows: repeat(3, 34px); }
  .dock .actions .btn { font-size: 0.76rem; padding: 5px 6px; }
}

/* ---------- editor: colour channel swatches for buttons, doors, plates and gates ---------- */
.ed-chan { flex-wrap: wrap; }
.warn-text { color: var(--orange); }
.btn.chan-swatch { width: 32px; min-width: 32px; min-height: 26px; padding: 0; }
.btn.chan-swatch[aria-pressed="true"] { outline: 3px solid #fff; outline-offset: 1px; }
