/* Scrub-a-Dub Showdown — styles */
@font-face { font-family: "VT323"; src: url("../fonts/VT323-Regular.ttf") format("truetype"); font-display: swap; }

#app {
  --bg: #05070c; --bg2: #0b1220; --led: #3fa9ff; --led2: #6fd3ff; --foam: #f6fbff; --duck: #ffd23f;
  --ink: #e9f2ff; --muted: #9db0c8; --amber: #ffb03a; --teal: #2fd6c0; --red: #ff4d5e;
  --phosphor: #5cff6a; --phosphor-dim: #1f8a32; --phosphor-bright: #c8ffb0; --crt-black: #050a05;
  --radius: 18px;
  --font: ui-rounded, "SF Pro Rounded", "Nunito", "Varela Round", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --sat: env(safe-area-inset-top, 0px); --sab: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { margin: 0; }
button { font-family: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
#app button:focus-visible { outline: 3px solid var(--led2); outline-offset: 2px; }
#app { overflow: hidden; user-select: none; -webkit-user-select: none; font-family: var(--font); background: var(--bg); }

/* ---------- background ---------- */
.bg { position: absolute; inset: 0; overflow: hidden; z-index: 0;
  background:
    radial-gradient(ellipse 60% 40% at 50% -5%, rgba(63,169,255,.28), transparent 70%),
    linear-gradient(115deg, transparent 40%, rgba(255,255,255,.05) 42%, transparent 44%, transparent 70%, rgba(255,255,255,.04) 71%, transparent 73%),
    linear-gradient(160deg, #0b1220, #05070c 60%, #0a0f18); }
.bg-glow { position: absolute; left: 0; right: 0; bottom: -10%; height: 40%; background: radial-gradient(ellipse at 50% 100%, rgba(63,169,255,.22), transparent 70%); }
.bg-bubble { position: absolute; bottom: -80px; border-radius: 50%;
  background: radial-gradient(circle at 32% 30%, rgba(255,255,255,.7), rgba(111,211,255,.15) 40%, rgba(111,211,255,.05) 70%);
  border: 1px solid rgba(160,220,255,.35); animation: rise linear infinite; }
@keyframes rise { from { transform: translate(0,0); } 50% { transform: translate(24px,-55vh); } to { transform: translate(-10px,-115vh); } }

/* ---------- layout (desktop) ---------- */
.layout { position: relative; z-index: 1; height: 100%; display: grid; grid-template-columns: minmax(220px,1fr) auto minmax(260px,1fr); gap: 18px; padding: 0 18px; }
.scene-col { height: 100%; display: flex; align-items: center; justify-content: center; }
#scene { position: relative; height: 100%; aspect-ratio: 900 / 1196; max-width: calc(100vw - 540px); overflow: hidden; touch-action: none;
  background: #000; box-shadow: 0 0 0 2px #b89b62, 0 0 0 3px #e2c98f, 0 20px 60px rgba(0,0,0,.6); }
.panel { align-self: center; max-height: 100%; overflow-y: auto; padding: 18px 0; display: flex; flex-direction: column; gap: 12px; }
.panel-left { align-items: center; text-align: center; }
.topbar { display: none; }

/* ---------- logo ---------- */
.logo { display: flex; flex-direction: column; align-items: center; line-height: .9; letter-spacing: .5px; }
.logo-kicker { display: block; margin: 0 0 10px; font: 700 11px/1.3 "MT Lato", ui-sans-serif, system-ui, sans-serif; letter-spacing: .22em; text-transform: uppercase; color: #e2c98f; }
.logo-sm .logo-kicker { font-size: 8px; letter-spacing: .16em; margin-bottom: 6px; }
.lw { display: block; font-family: "MT EB Garamond", Garamond, Georgia, serif; font-weight: 500; font-size: 56px; color: #e2c98f;
  background: linear-gradient(180deg, #fff8e6 0%, #e2c98f 45%, #b89b62 100%); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 2px 0 #14110a) drop-shadow(0 8px 16px rgba(20,17,10,.45)); }
.lw2 { font-size: 64px; transform: none; margin-top: 2px; }
.logo-sm .lw { font-size: 26px; }
.logo-sm .lw2 { font-size: 30px; }
.subtitle { margin: 6px 0 0; color: #e2c98f; font-weight: 600; letter-spacing: 1px; }

/* ---------- HUD bits ---------- */
.pl-level { font-weight: 800; font-size: 16px; }
.tag { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 800; background: #24324a; color: #fff; }
.tag-cement { background: rgba(255,176,58,.18); color: var(--amber); box-shadow: inset 0 0 0 1.5px rgba(255,176,58,.6); }
.tag-epoxy { background: rgba(47,214,192,.16); color: var(--teal); box-shadow: inset 0 0 0 1.5px rgba(47,214,192,.6); }
.pl-stats { display: flex; gap: 22px; }
.pl-stats small, .tb-stat small { display: block; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 1px; }
.pl-stats b { font-size: 26px; font-variant-numeric: tabular-nums; }
.ring { position: relative; width: 44px; height: 44px; flex: none; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: rgba(255,255,255,.12); stroke-width: 5; }
.ring-fg { fill: none; stroke: var(--led2); stroke-width: 5; stroke-linecap: round; transition: stroke-dashoffset .3s, stroke .3s; filter: drop-shadow(0 0 4px var(--led)); }
.ring-fg.done { stroke: var(--duck); }
.ring-txt { position: absolute; inset: 0; display: grid; place-items: center; font-size: 11px; font-weight: 900; font-variant-numeric: tabular-nums; }
.ring-big { width: 130px; height: 130px; }
.ring-big .ring-txt { font-size: 30px; }
.pl-cleanlab { margin-top: -8px; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 2px; }
.meters { display: flex; flex-direction: column; gap: 6px; width: 100%; max-width: 230px; }
.meter { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.m-lab { width: 62px; text-align: right; color: var(--muted); text-transform: capitalize; }
.m-bar { flex: 1; height: 9px; border-radius: 9px; background: rgba(255,255,255,.1); overflow: hidden; }
.m-bar i { display: block; height: 100%; width: 0; border-radius: 9px; transition: width .3s; filter: saturate(1.6) brightness(1.4); }
.meter.full .m-lab { color: var(--duck); }
.pl-btns { display: flex; gap: 10px; }
.btn-round { width: 44px; height: 44px; border-radius: 50%; background: linear-gradient(180deg, #24344f, #121c2e); box-shadow: inset 0 2px 0 rgba(255,255,255,.15), 0 3px 0 #050a14; font-size: 16px; }
.btn-round:active { transform: translateY(2px); box-shadow: inset 0 2px 0 rgba(255,255,255,.15); }
.btn-fs { flex: none; width: 44px; height: 44px; min-width: 44px; min-height: 44px; padding: 0; border-radius: 10px; display: inline-grid; place-items: center; color: #e2c98f; background: linear-gradient(180deg, #2c3c58, #1b2638); box-shadow: inset 0 0 0 2px #e2c98f, 0 3px 0 #14110a; }
.btn-fs svg { width: 22px; height: 22px; display: block; }
.btn-fs:active { transform: translateY(2px); box-shadow: inset 0 0 0 2px #e2c98f; }
.btn-fs.is-on { background: linear-gradient(180deg, #e2c98f, #b89b62); color: #14110a; box-shadow: inset 0 0 0 2px #14110a, 0 3px 0 #8a7344; }
#scene, #app, .layout, .scene-col { touch-action: none; }
.pl-duck .duck-svg { width: 110px; animation: bob 3s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-6px) rotate(-3deg); } }

/* ---------- product shelf + tools ---------- */
.pr-h { margin: 0; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: 2px; }
.shelf { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.prod { position: relative; display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 14px; text-align: left;
  background: linear-gradient(180deg, rgba(36,52,79,.9), rgba(16,25,42,.9)); box-shadow: inset 0 1px 0 rgba(255,255,255,.12), 0 3px 0 #04080f; transition: transform .15s, box-shadow .15s, opacity .2s; }
.prod:hover { transform: translateY(-2px); }
.prod.active { box-shadow: 0 0 0 2.5px var(--led2), 0 0 18px rgba(63,169,255,.55); }
.prod-img { width: 40px; height: 64px; flex: none; display: block; overflow: hidden; }
.prod-img img { display: block; width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 2px 2px rgba(0,0,0,.5)); }
.prod.pulse { animation: prodpulse .65s ease-in-out 4; }
@keyframes prodpulse { 50% { transform: scale(1.08); } }
.prod-txt b { display: block; font-size: 13px; }
.prod-txt small { display: block; font-size: 10.5px; color: var(--muted); line-height: 1.25; }
.prod.is-acid .prod-txt b { color: #ffd0a0; }
.prod.locked { opacity: .5; filter: grayscale(.8); }
.lock { display: none; position: absolute; top: 4px; right: 6px; align-items: center; gap: 3px; font-size: 10px; color: var(--duck); font-style: normal; }
.lock em { font-style: normal; font-weight: 800; }
.prod.locked .lock { display: flex; }
.prod.shake { animation: shake .35s; }
@keyframes shake { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
.prod.shimmer::after { content: ""; position: absolute; inset: 0; border-radius: inherit; background: linear-gradient(110deg, transparent 30%, rgba(255,255,255,.55) 50%, transparent 70%); background-size: 250% 100%; animation: shim 1.2s 2; pointer-events: none; }
@keyframes shim { from { background-position: 150% 0; } to { background-position: -100% 0; } }
.phase-seal .prod:not(.is-sealer) { opacity: .35; }
.phase-seal .prod.is-sealer:not(.locked) { box-shadow: 0 0 0 2px var(--duck), 0 0 16px rgba(255,210,63,.45); }
.tools { display: flex; flex-wrap: wrap; gap: 10px; }
.tool { display: flex; flex-direction: column; align-items: center; gap: 3px; width: 62px; }
.tool-ic { width: 50px; height: 50px; border-radius: 50%; display: grid; place-items: center;
  background: radial-gradient(circle at 35% 28%, #3a5276, #16233a 70%); box-shadow: inset 0 2px 0 rgba(255,255,255,.2), 0 4px 0 #04080f; transition: transform .15s; }
.tool-ic svg { width: 30px; height: 30px; }
.tool small { font-size: 11px; color: var(--muted); }
.tool.active .tool-ic { box-shadow: 0 0 0 3px var(--led2), 0 0 16px rgba(63,169,255,.6); transform: scale(1.08); }
.tool.active small { color: #fff; }
.tool:active .tool-ic { transform: scale(.94); }
.sealbrush { display: none; }
.phase-seal .sealbrush { display: flex; }
.phase-seal .sealbrush .tool-ic { background: radial-gradient(circle at 35% 28%, #ffe27a, #c99a10 75%); }

/* ---------- scene overlay ---------- */
.scene-ui { position: absolute; inset: 0; z-index: 30; pointer-events: none; }
.fx-layer { position: absolute; inset: 0; }
.led-strip { position: absolute; height: 14px; transform-origin: 0 50%; border-radius: 14px; opacity: .12; mix-blend-mode: screen;
  background: linear-gradient(90deg, rgba(63,169,255,.6), rgba(111,211,255,1), rgba(63,169,255,.6)); filter: blur(7px); transition: opacity 1.2s; }
.led-strip.pulse { animation: ledpulse 2.4s ease-in-out infinite; will-change: opacity, transform; }
@keyframes ledpulse { 0%,100% { opacity: 1; transform: translateY(-50%) rotate(var(--r,0)) scaleY(1); } 50% { opacity: .65; } }
.splat { position: absolute; transform: translate(-50%,-50%); display: grid; place-items: center; animation: splat 1.3s ease-out forwards; }
.splat-svg { width: 130px; height: 130px; fill: rgba(250,253,255,.92); filter: drop-shadow(0 3px 0 rgba(111,180,220,.6)); }
.splat span { position: absolute; white-space: nowrap; font-weight: 900; font-size: 17px; color: #1667b8; text-shadow: 0 1px 0 #fff; }
@keyframes splat { 0% { transform: translate(-50%,-50%) scale(.2); opacity: 0; } 15% { transform: translate(-50%,-50%) scale(1.12); opacity: 1; } 30% { transform: translate(-50%,-50%) scale(1); } 80% { opacity: 1; } 100% { transform: translate(-50%,-70%) scale(.95); opacity: 0; } }
.float-score { position: absolute; transform: translate(-50%,-50%); font-weight: 900; font-size: 20px; color: var(--duck); text-shadow: 0 2px 0 #000, 0 0 10px rgba(0,0,0,.6); animation: floatup 1.1s ease-out forwards; white-space: nowrap; }
@keyframes floatup { to { transform: translate(-50%,-180%); opacity: 0; } }
.seal-meter { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px;
  background: rgba(5,7,12,.75); font-size: 12px; font-weight: 800; box-shadow: 0 0 0 1.5px rgba(255,210,63,.6); }
.sm-bar { width: 110px; height: 9px; border-radius: 9px; background: rgba(255,255,255,.15); overflow: hidden; }
.sm-bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--duck), #fff3a8); transition: width .2s; }
.epoxy-note { position: absolute; left: 50%; top: 56px; transform: translateX(-50%); width: min(88%, 340px); padding: 10px 12px; border-radius: 14px;
  background: rgba(8,30,32,.88); box-shadow: 0 0 0 1.5px rgba(47,214,192,.6); text-align: center; pointer-events: auto; font-size: 13px; }
.epoxy-note p { margin: 0 0 8px; }
.hidden { display: none !important; }

/* ---------- buttons, cards, screens ---------- */
.btn { padding: 12px 26px; border-radius: 999px; font-weight: 900; font-size: 18px; color: #06223f;
  background: linear-gradient(180deg, #bff0ff, #59c6ff 55%, #2a95e8); box-shadow: inset 0 3px 0 rgba(255,255,255,.7), 0 5px 0 #0c4f8f, 0 10px 20px rgba(0,0,0,.4); transition: transform .12s; }
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(3px); box-shadow: inset 0 3px 0 rgba(255,255,255,.7), 0 2px 0 #0c4f8f; }
.btn-ghost { background: linear-gradient(180deg, #2a3a56, #16233a); color: #fff; box-shadow: inset 0 2px 0 rgba(255,255,255,.15), 0 5px 0 #050a14; }
.btn-small { padding: 7px 16px; font-size: 14px; }
.screens { position: absolute; inset: 0; z-index: 50; pointer-events: none; }
.screen { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: auto; background: rgba(3,6,12,.84); overflow-y: auto; padding: 16px; }
.card { width: min(92vw, 420px); padding: 24px; border-radius: 26px; text-align: center; background: linear-gradient(180deg, #16233a, #0b1220); box-shadow: 0 0 0 2px #b89b62, 0 0 0 3px #e2c98f, 0 20px 50px rgba(0,0,0,.6); }
.card h2 { margin: 4px 0 10px; font-size: 28px; font-family: "MT EB Garamond", Garamond, Georgia, serif; font-weight: 500; color: #f3ead6; }
.card p { color: #c8d6e8; line-height: 1.4; }
.card .btn { margin-top: 14px; }
.card .btn + .btn { margin-left: 8px; }
.card-kicker { color: #e2c98f; font: 700 11px/1.3 "MT Lato", ui-sans-serif, system-ui, sans-serif; letter-spacing: .2em; text-transform: uppercase; }
.goal { font-weight: 700; color: #fff !important; }
.chip { display: inline-block; padding: 7px 14px; border-radius: 999px; font-weight: 900; font-size: 14px; }
.chip-amber { background: rgba(255,176,58,.2); color: var(--amber); box-shadow: inset 0 0 0 2px var(--amber); }
.chip-teal { background: rgba(47,214,192,.18); color: var(--teal); box-shadow: inset 0 0 0 2px var(--teal); }
.pop-in { animation: popin .35s cubic-bezier(.3,1.6,.5,1); }
@keyframes popin { from { transform: scale(.7); opacity: 0; } }

.title-screen { background: radial-gradient(ellipse at 50% 20%, rgba(27,38,56,.97), #05070c 72%); }
.title-inner { display: flex; flex-direction: column; align-items: center; gap: 12px; max-width: 760px; text-align: center; }
.title-duck .duck-svg { width: 96px; animation: bob 2.6s ease-in-out infinite; }
.howto { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; }
.howto span { padding: 6px 11px; border-radius: 999px; background: rgba(111,211,255,.12); box-shadow: inset 0 0 0 1px rgba(111,211,255,.35); }
.howto i { color: var(--led2); font-style: normal; }
.lvcards { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.lvcard { width: 180px; padding: 14px; border-radius: 20px; text-align: left; display: flex; flex-direction: column; gap: 6px;
  background: linear-gradient(180deg, #1b2a44, #0f182a); box-shadow: inset 0 1px 0 rgba(255,255,255,.12), 0 4px 0 #04080f; transition: transform .15s; }
.lvcard b { font-size: 16px; }
.lvcard small { color: var(--muted); }
.lvcard em { font-style: normal; font-size: 12px; color: var(--duck); }
.lvcard.sel { box-shadow: 0 0 0 3px var(--led2), 0 0 22px rgba(63,169,255,.5); transform: translateY(-3px); }
.btn-play { font-size: 26px; padding: 14px 54px; animation: pulsebtn 1.8s ease-in-out infinite; }
@keyframes pulsebtn { 50% { transform: scale(1.05); } }
.credit { margin: 0; font-size: 12px; color: var(--muted); }

/* ---------- toasts + duck ---------- */
.toasts { position: absolute; z-index: 60; top: 16px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 6px; align-items: center; pointer-events: none; }
.toast { padding: 9px 16px; border-radius: 999px; font-weight: 800; font-size: 14px; background: rgba(11,18,32,.94); box-shadow: 0 0 0 1.5px rgba(111,211,255,.5), 0 6px 18px rgba(0,0,0,.5); animation: popin .3s; transition: opacity .4s, transform .4s; max-width: 90vw; text-align: center; }
.toast-warn { box-shadow: 0 0 0 1.5px var(--amber); color: #ffe0b0; }
.toast-good { box-shadow: 0 0 0 1.5px var(--duck); color: #fff3b8; }
.toast-bad { box-shadow: 0 0 0 1.5px var(--red); color: #ffc4ca; }
.toast.out { opacity: 0; transform: translateY(-8px); }
.duck-pop { position: absolute; z-index: 55; left: 14px; bottom: -140px; display: flex; align-items: flex-end; gap: 4px; pointer-events: none; transition: bottom .35s cubic-bezier(.3,1.5,.5,1); }
.duck-pop .duck-svg { width: 84px; }
.duck-pop.show { bottom: 14px; }
.duck-bubble { margin-bottom: 60px; padding: 8px 14px; border-radius: 18px 18px 18px 4px; background: #fff; color: #0b1a33; font-weight: 900; font-size: 15px; white-space: nowrap; box-shadow: 0 4px 0 rgba(0,0,0,.25); }

/* ---------- GROUT_SECURITY.EXE ---------- */
.gs-veil { position: absolute; inset: 0; z-index: 80; display: grid; place-items: center; background: rgba(0,0,0,.55); pointer-events: auto; }
.gs-win { position: relative; width: 292px; max-width: 92%; background: #2a2f2a; border-radius: 8px; padding: 4px; box-shadow: 0 0 0 2px #0a0d0a, 0 18px 50px rgba(0,0,0,.7), 0 0 40px rgba(92,255,106,.15);
  animation: crton .45s ease-out both; transform-origin: 50% 50%; }
@keyframes crton { 0% { transform: scale(1, .01); filter: brightness(3); } 45% { transform: scale(1, .02); } 100% { transform: scale(1, 1); filter: none; } }
.gs-title { display: flex; align-items: center; gap: 6px; padding: 4px 6px; background: linear-gradient(180deg, #1f8a32, #13561f); border-radius: 5px 5px 0 0; font: 18px/1 "VT323", monospace; color: var(--phosphor-bright); }
.gs-title span { flex: 1; letter-spacing: 1px; }
.gs-icon { width: 11px; height: 11px; background: var(--phosphor-bright); box-shadow: inset 0 0 0 2px #13561f, inset 0 0 0 4px var(--phosphor-bright); }
.gs-x { width: 20px; height: 18px; border: 2px solid var(--phosphor-bright); color: var(--phosphor-bright); font: 18px/12px "VT323", monospace; padding: 0; }
.gs-bezel { background: #111611; padding: 12px; border-radius: 0 0 6px 6px; box-shadow: inset 0 3px 8px #000; }
.gs-screen { position: relative; background: radial-gradient(ellipse at 50% 45%, #0b180b, var(--crt-black) 75%); border-radius: 22px / 16px; overflow: hidden; padding: 12px 10px 14px;
  box-shadow: inset 0 0 30px rgba(0,0,0,.95), inset 0 0 6px rgba(92,255,106,.25); animation: flicker 3.2s infinite; }
@keyframes flicker { 0%,100% { opacity: 1; } 47% { opacity: .96; } 48% { opacity: .88; } 49% { opacity: 1; } }
.gs-scan { position: absolute; inset: 0; pointer-events: none; background: repeating-linear-gradient(0deg, rgba(0,0,0,.35) 0 1px, transparent 1px 3px), radial-gradient(ellipse at center, transparent 55%, rgba(0,0,0,.6)); }
.gs-content { position: relative; display: flex; flex-direction: column; align-items: center; text-align: center; font-family: "VT323", monospace; color: var(--phosphor); text-shadow: 0 0 6px rgba(92,255,106,.6); }
.gs-handwrap { width: 96px; height: 96px; transform-origin: 50% 100%; animation: wag .33s ease-in-out infinite alternate; }
@keyframes wag { from { transform: rotate(-18deg); } to { transform: rotate(18deg); } }
.gs-hand { width: 96px; height: 96px; image-rendering: pixelated; image-rendering: crisp-edges; filter: drop-shadow(0 0 4px rgba(92,255,106,.6)); }
.gs-big { font-size: 34px; line-height: 1; margin-top: 4px; color: var(--phosphor-bright); text-shadow: 0 0 8px var(--phosphor), 0 0 18px var(--phosphor-dim); }
.gs-mid { font-size: 18px; margin-top: 2px; }
.gs-small { font-size: 13px; margin-top: 6px; line-height: 1.15; color: #8ff59a; }
.gs-small .hl { color: var(--phosphor-bright); background: rgba(31,138,50,.45); padding: 0 2px; }
.gs-ok { margin-top: 10px; font: 18px/1 "VT323", monospace; color: var(--phosphor-bright); padding: 4px 6px; border: 1px solid var(--phosphor-dim); text-shadow: inherit; }
.gs-ok:hover, .gs-ok:focus-visible { background: var(--phosphor-dim); color: var(--crt-black); text-shadow: none; outline: none; }
.gs-cur { display: inline-block; width: 8px; height: 14px; margin-left: 4px; vertical-align: -2px; background: currentColor; animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.gs-penalty { position: absolute; top: -16px; right: -12px; width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; font-weight: 900; font-size: 18px; color: #fff;
  background: radial-gradient(circle at 35% 30%, #ff8a95, #e0213a 70%); box-shadow: 0 3px 0 #7a0d1c, 0 0 14px rgba(255,77,94,.6); animation: popin .4s .3s both cubic-bezier(.3,1.8,.5,1); }

/* ---------- finale ---------- */
.finale-screen { background: linear-gradient(0deg, rgba(3,6,12,.78), rgba(3,6,12,.25) 55%, transparent 70%); align-items: end; justify-items: center; overflow: hidden; padding: 0 12px 12px; }
.fin-card.slide-up { animation: slideup .5s cubic-bezier(.2,1.2,.4,1) both; max-height: 62vh; overflow-y: auto; }
@keyframes slideup { from { transform: translateY(110%); } to { transform: translateY(0); } }
.fin-head { font-size: 22px; font-weight: 900; color: var(--duck); letter-spacing: 1px; }
.finale-screen .ba { max-height: 20vh; max-width: 170px; }
.fin-reveal { position: absolute; inset: 0; pointer-events: auto; cursor: pointer; display: flex; flex-direction: column; align-items: center; padding-top: 12%; }
.fin-reveal .stamp { font-size: clamp(28px, 7vw, 46px); background: rgba(5,7,12,.35); }
.rv-duck { position: absolute; left: 50%; bottom: 16%; margin-left: -45px; width: 90px; animation: rvpop .5s .4s cubic-bezier(.3,1.6,.5,1) both; }
@keyframes rvpop { from { transform: translateY(80px) scale(.4); opacity: 0; } }
.rv-skip { position: absolute; bottom: 5%; padding: 5px 12px; border-radius: 999px; background: rgba(5,7,12,.6); font-size: 12px; font-weight: 800; color: var(--muted); }
.fin-card { position: relative; width: min(94vw, 440px); padding: 16px 18px 12px; border-radius: 28px; text-align: center; background: linear-gradient(180deg, rgba(22,35,58,.96), rgba(11,18,32,.96)); box-shadow: 0 0 0 2px rgba(111,211,255,.35), 0 20px 60px rgba(0,0,0,.6); }
.stamp { display: inline-block; padding: 6px 16px; font-size: 34px; font-weight: 900; color: #ff4d5e; border: 5px solid #ff4d5e; border-radius: 10px; letter-spacing: 1px;
  transform: rotate(-8deg); opacity: .92; mix-blend-mode: screen;
  -webkit-mask-image: radial-gradient(circle at 30% 40%, #000 60%, rgba(0,0,0,.7) 75%, #000 90%);
  animation: slam .45s .25s cubic-bezier(.2,1.4,.4,1) both; }
@keyframes slam { 0% { transform: rotate(-8deg) scale(3); opacity: 0; } 70% { transform: rotate(-8deg) scale(.92); opacity: 1; } 100% { transform: rotate(-8deg) scale(1); } }
.fin-duck { position: relative; height: 90px; margin-top: 4px; }
.fin-duck .duck-svg { width: 90px; animation: hop .6s ease-in-out infinite alternate; }
.fin-duck .duck-wing { transform-origin: 46px 70px; animation: flap .2s ease-in-out infinite alternate; }
@keyframes hop { from { transform: translateY(0) rotate(-4deg); } to { transform: translateY(-12px) rotate(4deg); } }
@keyframes flap { to { transform: rotate(-25deg); } }
.confetti { position: absolute; inset: -20px 0 0; pointer-events: none; }
.confetti i { position: absolute; bottom: 0; aspect-ratio: 1; border-radius: 50%; background: radial-gradient(circle at 30% 30%, #fff, rgba(111,211,255,.4) 60%); border: 1px solid rgba(255,255,255,.5); animation: confup 1.8s ease-out infinite; }
@keyframes confup { from { transform: translateY(0); opacity: 1; } to { transform: translateY(-110px); opacity: 0; } }
.fin-stats { display: flex; justify-content: center; gap: 26px; margin: 8px 0; }
.fin-stats small { display: block; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; }
.fin-stats b { font-size: 24px; font-variant-numeric: tabular-nums; }
.newbest { color: var(--duck); font-weight: 900; animation: pulsebtn 1s infinite; }
.bonus { color: var(--teal); font-weight: 800; font-size: 13px; }
.ba { position: relative; margin: 10px auto; width: 100%; max-width: 300px; aspect-ratio: 900 / 1196; max-height: 38vh; border-radius: 16px; overflow: hidden; touch-action: none; cursor: ew-resize; box-shadow: 0 0 0 2px rgba(111,211,255,.35); }
.ba img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.ba-before { position: absolute; inset: 0; }
.ba-handle { position: absolute; top: 0; bottom: 0; width: 3px; margin-left: -1.5px; background: #fff; box-shadow: 0 0 8px rgba(0,0,0,.6); pointer-events: none; }
.ba-handle span { position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%); width: 38px; height: 38px; border-radius: 50%; background: #fff; color: #0b1a33; display: grid; place-items: center; font-weight: 900; }
.ba em { position: absolute; bottom: 6px; padding: 2px 8px; border-radius: 999px; background: rgba(0,0,0,.6); font-style: normal; font-size: 11px; font-weight: 800; pointer-events: none; }
.ba-l { left: 6px; } .ba-r { right: 6px; }
.fin-btns { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 6px; }
.fin-link { display: inline-block; margin-top: 12px; font-size: 12px; color: var(--muted); text-decoration: none; }
.fin-link:hover { color: var(--led2); text-decoration: underline; }

/* ---------- phone / narrow ---------- */
@media (max-width: 820px) {
  .layout { display: block; padding: 0; }
  .panel-left { display: none; }
  .scene-col { position: absolute; inset: 0; height: auto; }
  #scene { position: absolute; inset: 0; width: 100%; height: 100%; max-width: none; aspect-ratio: auto; box-shadow: none; }
  .topbar { display: block; position: absolute; z-index: 20; top: 0; left: 0; right: 0; padding: calc(var(--sat) + 6px) 8px 4px;
    background: linear-gradient(180deg, rgba(5,7,12,.92), rgba(5,7,12,.6) 80%, transparent); }
  .tb-row { display: flex; align-items: center; gap: 8px; }
  .tb-lv { flex: 1; display: flex; align-items: center; gap: 6px; min-width: 0; }
  .tb-lv b { font-size: 15px; }
  .tb-lv .tag { font-size: 10.5px; padding: 2px 8px; white-space: nowrap; }
  .tb-stat { display: flex; align-items: center; gap: 3px; }
  .tb-stat small { font-size: 12px; }
  .tb-stat b { font-size: 15px; font-variant-numeric: tabular-nums; }
  .topbar .btn-round { width: 34px; height: 34px; font-size: 13px; }
  .topbar .btn-fs { width: 44px; height: 44px; min-width: 44px; min-height: 44px; }
  .meters-phone { flex-direction: row; max-width: none; gap: 4px; margin-top: 4px; }
  .meters-phone .meter { flex: 1; flex-direction: column; gap: 2px; font-size: 9px; }
  .meters-phone .m-lab { width: auto; text-align: center; }
  .meters-phone .m-bar { width: 100%; height: 4px; }
  .dock { position: absolute; z-index: 20; left: 0; right: 0; bottom: 0; max-height: none; overflow: visible; padding: 8px 0 calc(var(--sab) + 6px); gap: 4px;
    background: linear-gradient(0deg, rgba(5,7,12,.95), rgba(5,7,12,.75) 75%, transparent); }
  .pr-h { display: none; }
  .shelf { display: flex; overflow-x: auto; gap: 6px; padding: 4px 8px; scrollbar-width: none; scroll-snap-type: x proximity; }
  .shelf::-webkit-scrollbar { display: none; }
  .prod { flex: none; flex-direction: column; width: 70px; padding: 4px 3px; gap: 2px; text-align: center; scroll-snap-align: start; }
  .prod-img { width: 50px; height: 56px; }
  .fin-reveal { padding-top: 26%; }
  .rv-duck { bottom: 30%; }
  .finale-screen { padding: 0; }
  .fin-card.slide-up { width: 100%; border-radius: 24px 24px 0 0; padding-bottom: calc(var(--sab) + 12px); }
  .prod-txt b { font-size: 10px; line-height: 1.1; }
  .prod-txt small { display: none; }
  .lock { top: 2px; right: 2px; } .lock em { display: none; }
  .tools { justify-content: center; flex-wrap: nowrap; gap: 4px; padding: 0 6px; }
  .tool { width: 58px; }
  .tool-ic { width: 44px; height: 44px; }
  .tool-ic svg { width: 26px; height: 26px; }
  .tool small { font-size: 9.5px; white-space: nowrap; }
  .seal-meter { top: calc(var(--sat) + 78px); }
  .epoxy-note { top: calc(var(--sat) + 118px); }
  .toasts { top: calc(var(--sat) + 84px); }
  .duck-pop { bottom: -140px; } .duck-pop.show { bottom: calc(var(--sab) + 170px); }
  .duck-pop .duck-svg { width: 64px; }
  .lw { font-size: 42px; } .lw2 { font-size: 48px; }
  .lvcard { width: 100%; max-width: 320px; }
  .stamp { font-size: 28px; }
}
@media (min-width: 821px) and (max-width: 1100px) {
  .layout { grid-template-columns: 210px auto 240px; gap: 10px; padding: 0 10px; }
  #scene { max-width: calc(100vw - 480px); }
  .shelf { grid-template-columns: 1fr; }
}

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .bg-bubble { display: none; }
  .gs-handwrap { animation: wag 1s ease-in-out 3 alternate !important; animation-duration: .5s !important; }
}


/* Hide in-game HUD while title/intro/pause/finale screens are open */
#app.mode-overlay .topbar,
#app.mode-overlay .panel,
#app.mode-overlay .dock { visibility: hidden; pointer-events: none; }

/* Phone product shelf: fade on the right so it is clear you can scroll to the sealers */
@media (max-width: 820px) {
  .lw { font-size: 42px; } .lw2 { font-size: 48px; }
  .shelf {
    -webkit-mask-image: linear-gradient(90deg, #000 0%, #000 calc(100% - 22px), transparent 100%);
    mask-image: linear-gradient(90deg, #000 0%, #000 calc(100% - 22px), transparent 100%);
  }
}
