@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&display=swap');
:root{font-family:'Space Grotesk',system-ui,sans-serif;color:#f4f3e8;background:#0c1720;font-synthesis:none}*{box-sizing:border-box}body{margin:0;min-height:100dvh;background:radial-gradient(ellipse at top,#243b42,#0c1720 70%)}button{font:inherit;cursor:pointer;color:inherit;touch-action:none;-webkit-tap-highlight-color:transparent}button:focus-visible{outline:3px solid #fff;outline-offset:3px}button:disabled{opacity:.38;cursor:default}.cabinet{max-width:480px;margin:auto;padding:16px 20px 10px;min-height:100dvh;display:flex;flex-direction:column}header{display:flex;align-items:center;justify-content:space-between;margin-bottom:17px}.eyebrow{font-size:9px;letter-spacing:1.2px;color:#9aafb2;font-weight:600}h1{font-size:29px;letter-spacing:-1px;margin:3px 0 0;line-height:1}h1 span{display:block;font-size:8px;letter-spacing:2px;color:#b8c5bd;margin-top:7px}.small{border:1px solid #415358;background:#24363f;border-radius:8px;width:36px;height:36px}.hud{display:flex;justify-content:space-between;margin-bottom:12px;gap:10px}.score{background:none;border:0;text-align:left;padding:0}.score>*{display:block}.score strong{font-size:14px;margin:5px 0}#timer{font-size:11px;color:#a7bdbe;font-variant-numeric:tabular-nums}i{color:#e6c66a;margin:0 4px}.haul{text-align:right}.haul strong{display:block;font-size:24px;line-height:1.2;margin:3px 0}.haul strong span{font-size:12px;color:#a7bdbe}#items{display:flex;gap:4px;justify-content:flex-end}#items span{width:14px;height:5px;border-radius:2px;background:#3b4e56}#items span.done{background:#e9ca77}#items span.carry{background:#91d3c4}.field{position:relative;border:2px solid #516667;border-radius:10px;overflow:hidden;box-shadow:0 8px 30px #0005;flex:1;min-height:220px;max-height:620px;background:#405f6c}canvas{display:block;width:100%;height:100%;position:absolute;inset:0;image-rendering:pixelated}.overlay{position:absolute;inset:0;z-index:2;background:#102832eF;display:flex;flex-direction:column;align-items:center;justify-content:center;padding:20px;text-align:center}.overlay.hidden{display:none}.tag{font-size:8px;color:#e6ca82;letter-spacing:1.6px}h2{font-size:32px;line-height:1.08;letter-spacing:-1.4px;margin:18px 0 12px}.overlay p{font-size:12px;color:#bdcdd0;line-height:1.65;margin:0 0 17px}.rules{display:grid;gap:9px;text-align:left;font-size:11px;color:#d9e4df;margin-bottom:22px}.primary{background:#efcc78;color:#15252b;border:0;border-bottom:4px solid #a38445;border-radius:5px;padding:14px 16px;font-size:11px;font-weight:700;width:100%;max-width:285px;display:flex;justify-content:space-between}.overlay small{font-size:9px;color:#91a9af;margin-top:13px}.mission{display:flex;align-items:center;gap:8px;min-height:36px;font-size:10px;color:#d5dfd7}.dot{width:5px;height:5px;background:#edcc77;border-radius:50%;flex-shrink:0}.controls{display:flex;align-items:center;justify-content:space-between;height:132px;user-select:none}.actions{display:flex;gap:10px;align-items:center}.actions button{border-radius:10px;font-size:8px;font-weight:700;letter-spacing:.5px;height:64px;width:70px;border:1px solid #657879;border-bottom-width:4px;background:#283e48}.actions button span{display:block;font-size:24px;margin-bottom:3px}.dpad{display:grid;grid-template:repeat(3,38px)/repeat(3,38px);gap:3px}.dpad button{border:1px solid #61747b;border-bottom:3px solid #172a34;background:#334c59;border-radius:6px;font-size:16px}.dpad button:active,.dpad button.held{background:#759b9c;transform:translateY(1px)}[data-dir=up]{grid-area:1/2}[data-dir=left]{grid-area:2/1}[data-dir=right]{grid-area:2/3}[data-dir=down]{grid-area:3/2}.center{grid-area:2/2;display:grid;place-items:center;color:#69828b}footer{display:flex;justify-content:space-between;align-items:center;padding-top:7px;color:#68818c;font-size:7px;letter-spacing:.7px}footer button{font-size:9px;border:0;background:none;color:#a6babd;text-decoration:underline;padding:4px}@media(min-height:850px){.cabinet{height:100dvh;max-height:1100px}}@media(max-height:849px){.cabinet{height:100dvh;padding-top:10px}.controls{height:120px;flex-shrink:0}header{margin-bottom:10px}.field{min-height:200px}h2{font-size:26px;margin:10px 0}.rules{gap:5px;margin-bottom:12px}.overlay p{margin-bottom:10px}.overlay small{margin-top:8px}}@media(max-width:360px){.cabinet{padding-left:12px;padding-right:12px}.actions{gap:6px}.actions button{width:58px}.eyebrow{font-size:8px}}@media(max-height:600px) and (orientation:landscape){.cabinet{height:auto;min-height:100dvh}.field{height:400px;flex:none}}

em{font-style:normal;color:#e6ca82}
/* Comfortable thumb targets and device safe areas. */
.dpad{grid-template:repeat(3,44px)/repeat(3,44px);gap:3px}.controls{height:146px;flex-shrink:0}.cabinet{padding-bottom:max(10px,env(safe-area-inset-bottom));padding-top:max(12px,env(safe-area-inset-top))}.small{width:44px;height:44px}
/* Game surface must never select text or show long-press callouts. */
.cabinet,.cabinet *{-webkit-user-select:none;user-select:none;-webkit-touch-callout:none}button{touch-action:manipulation}.controls button{touch-action:none}
header{margin-bottom:3px;min-height:44px}h1{font-size:23px;letter-spacing:-.8px;margin:0}.header-actions{display:flex;gap:7px}.header-actions button{background:none;border-color:#435b64;border-radius:7px;font-size:12px;font-weight:700}.hud{align-items:center;margin-bottom:8px;min-height:46px}.score{display:flex;align-items:center;gap:7px;min-height:44px}.score>span:first-child{font-size:22px}#timer{font-size:11px}.lives{font-size:19px;letter-spacing:3px;color:#edb885;white-space:nowrap}.haul{display:grid;grid-template-columns:auto auto;align-items:center;column-gap:6px}.haul strong{font-size:18px;margin:0}.haul strong span{font-size:11px}#remaining{font-size:9px;color:#dcc58b}#items{grid-column:1/3;margin-top:4px}footer{justify-content:flex-end}.overlay{overflow-y:auto}.overlay p{max-width:310px}.field{max-height:none}@media(max-width:360px){.lives{font-size:16px;letter-spacing:2px}.score{gap:3px}#timer{font-size:10px}.haul{column-gap:4px}}

/* Full-viewport playfield. The canvas keeps its own world aspect ratio in game.js. */
body{width:100%;height:100dvh;overflow:hidden;background:#0c1720}
.cabinet{position:relative;display:block;width:100%;max-width:none;height:100dvh;min-height:0;max-height:none;margin:0;padding:0;overflow:hidden}
header,.hud{position:absolute;left:0;right:0;z-index:3;background:#10232d;padding-left:max(12px,env(safe-area-inset-left));padding-right:max(12px,env(safe-area-inset-right))}
header{top:env(safe-area-inset-top);height:44px;min-height:44px;margin:0;border-bottom:1px solid #49606a}
h1{font-size:20px;line-height:1}
.header-actions{gap:4px}
.small{width:44px;height:44px;border:0;border-radius:0;font-size:13px}
#help{font-size:19px;font-weight:700}
.hud{top:calc(env(safe-area-inset-top) + 44px);height:36px;min-height:36px;margin:0;align-items:center;border-bottom:1px solid #49606a}
.score{min-height:36px;gap:4px}
.score>span:first-child{font-size:17px}
#timer{font-size:10px}
.lives{font-size:17px;letter-spacing:1px}
.haul strong{font-size:16px}
.haul strong span{font-size:10px}
#remaining{font-size:8px}
#items{margin-top:1px}
#items span{width:11px;height:4px}
.field{position:absolute;top:calc(env(safe-area-inset-top) + 80px);right:0;bottom:0;left:0;width:100%;height:auto;min-height:0;max-height:none;flex:none;border:0;border-radius:0;box-shadow:none;background:#496775}
canvas{width:100%;height:100%;image-rendering:pixelated;pointer-events:none}
.mission{position:absolute;z-index:3;left:50%;bottom:calc(max(8px,env(safe-area-inset-bottom)) + 146px);transform:translateX(-50%);width:max-content;max-width:calc(100% - 24px);min-height:26px;padding:5px 9px;border:1px solid #a8b7a766;border-radius:6px;background:#10232dcc;font-size:10px;line-height:1.2;text-align:center}
.controls{position:absolute;z-index:3;left:0;right:0;bottom:max(8px,env(safe-area-inset-bottom));width:100%;height:138px;padding:0 max(12px,env(safe-area-inset-left)) 0 max(12px,env(safe-area-inset-right));display:flex;align-items:flex-end;pointer-events:none}
.controls button{pointer-events:auto;box-shadow:0 2px 9px #07131c99}
.actions{gap:6px;padding-bottom:0}
.actions button{width:54px;height:54px;border-radius:8px;font-size:8px;background:#263d48de;backdrop-filter:blur(2px)}

.actions button span{font-size:18px;margin-bottom:1px}
.dpad{grid-template:repeat(3,44px)/repeat(3,44px);gap:2px}
.dpad button{background:#334c59de;backdrop-filter:blur(2px)}
.center{color:#cbd8ca8a}
.overlay{z-index:2;padding:20px max(20px,env(safe-area-inset-left)) 20px max(20px,env(safe-area-inset-right))}
@media(max-width:360px){h1{font-size:18px}.hud{padding-left:8px;padding-right:8px}.lives{font-size:15px}.actions button{width:48px;height:48px}.actions{gap:4px}.controls{padding-left:8px;padding-right:8px}}
.hud{height:44px;min-height:44px}
.score{min-width:44px;min-height:44px}
.field{top:calc(env(safe-area-inset-top) + 88px)}
#items{gap:1px;margin-top:0}
#items span{display:block;width:15px;height:15px;flex:none;border:0;border-radius:0;background-color:transparent;background-position:center;background-repeat:no-repeat;background-size:contain;image-rendering:pixelated;opacity:.4;filter:grayscale(1)}
#items span.done{background-color:transparent;opacity:1;filter:none}
#items span.carry{background-color:transparent;opacity:1;filter:drop-shadow(0 0 2px #f2d67a)}
header{justify-content:initial;gap:8px}
.level-label{margin-left:auto;color:#e9ca77;font-size:11px;font-weight:700;white-space:nowrap;letter-spacing:.3px}
.haul{display:flex;flex-direction:column;align-items:flex-end;gap:0}
.haul strong{line-height:1.1}
#items{grid-column:auto}
@media(max-width:360px){header{gap:4px}.level-label{font-size:9px;letter-spacing:0}}
.actions .buy{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2px;width:68px;height:68px;background:#ebcd80ed;color:#24343a;border-color:#a58e58;font-size:11px}
.actions .buy img{display:block;width:26px;height:26px;object-fit:contain;image-rendering:pixelated}
.actions .buy span{display:block;margin:0;font-size:11px;line-height:1;font-weight:800}
.actions .buy:disabled{opacity:.72}
@media(max-width:360px){.actions .buy{width:60px;height:60px}}

/* Amber and navy presentation. */
:root{color:#f9edcf;background:#0c1730}
body{background:#0c1730}
header,.hud{background:#101d39;border-color:#40506a}
h1{font-size:19px;letter-spacing:-.6px;color:#ffd779;white-space:nowrap;text-shadow:2px 2px 0 #422c36}
.level-label{color:#ffd779}
.header-actions button{color:#f8e9c4}
.header-actions button:active,.header-actions button:focus-visible{background:#26385b}
#timer,.haul strong span{color:#ced8e8}
.lives{color:#f5b765}
.field{background:#233e66}
.mission{color:#fff1d0;background:#101d39e8;border-color:#e4b55c88}
.dot{background:#ffce6c}
.controls button{box-shadow:0 3px 12px #09162fb3}
.dpad button{background:#20385ddd;border-color:#7284a5;border-bottom-color:#0a1933}
.dpad button:active,.dpad button.held{background:#a66f36}
.center{color:#f6d285a6}
.actions .buy{background:#f2bf62ee;color:#142544;border-color:#a87838}
.overlay{background:#101d39f2;padding-bottom:calc(165px + env(safe-area-inset-bottom))}
.overlay p{color:#dbe2ef}
.primary{background:#f4c66e;color:#122344;border-bottom-color:#a77537}
.overlay-body{width:min(310px,100%)}
.best-card{width:100%;max-width:280px;padding:17px 12px;margin:0 auto 15px;background:#1b3054;border:2px solid #e6b55d;border-radius:9px;box-shadow:5px 5px 0 #0a1429}
.best-card span,.best-card small{display:block;color:#e1cfaa;font-size:10px;font-weight:700;letter-spacing:.6px}
.best-card strong{display:block;color:#ffd77b;font-size:42px;line-height:1.25;font-variant-numeric:tabular-nums}
.best-card small{color:#dae2ef;letter-spacing:0;font-weight:500}
.overlay .level-best{margin:4px 0 8px}.level-best b{color:#ffd77b}
.overlay .record-note{font-size:10px;color:#aebdd4}
@media(max-width:360px){h1{font-size:17px;white-space:normal;max-width:84px;line-height:.92}.level-label{font-size:9px}}

/* Desktop play uses the keyboard and gives the game a dedicated frame. */
.desktop-guide{display:none}
@media (min-width:760px) and (pointer:fine){
 body{background:radial-gradient(circle at 50% 10%,#314469,#0a1429 70%)}
 .cabinet{max-width:1250px;margin:auto;background:#0e1c37;box-shadow:0 0 50px #050d23}
 header{height:58px;min-height:58px;padding:0 28px}
 header h1{font-size:27px}
 .hud{top:calc(env(safe-area-inset-top) + 58px);height:44px;padding:0 28px}
 .field{top:calc(env(safe-area-inset-top) + 102px);left:292px;right:20px;bottom:20px;width:auto;height:auto;border:3px solid #a47d43;border-radius:12px;box-shadow:0 18px 45px #050d23b0}
 .controls{display:none}
 .desktop-guide{display:flex;position:absolute;z-index:3;top:calc(env(safe-area-inset-top) + 124px);bottom:24px;left:20px;width:250px;padding:28px 24px;flex-direction:column;align-items:flex-start;border:2px solid #5d6f91;border-radius:12px;background:linear-gradient(160deg,#20375c,#101e3b 80%);box-shadow:0 12px 30px #050d2380}
 .guide-kicker{color:#ffd47d;font-size:11px;font-weight:800;letter-spacing:2px}
 .desktop-guide h2{font-size:29px;line-height:1.05;margin:14px 0 10px}
 .desktop-guide p{color:#d5deec;font-size:14px;line-height:1.4}
 #desktop-goal{min-height:50px;color:#ffd47d;font-weight:700}
 .key-arrows{display:grid;grid-template-columns:repeat(3,42px);grid-template-rows:repeat(2,42px);gap:5px;margin:15px 0 5px}
 .key-arrows kbd:first-child{grid-column:2}
 .key-arrows kbd:nth-child(2){grid-column:1;grid-row:2}
 .key-arrows kbd:nth-child(3){grid-column:2;grid-row:2}
 .key-arrows kbd:nth-child(4){grid-column:3;grid-row:2}
 .desktop-guide kbd{display:grid;place-items:center;border:1px solid #c9a05c;border-bottom-width:4px;border-radius:6px;background:#344b70;color:#fff3d1;font:700 22px 'Space Grotesk',sans-serif}
 .key-action{display:flex;align-items:center;gap:12px;margin-top:20px;color:#f8ddb0;font-size:14px;font-weight:700}
 .key-action kbd{width:48px;height:48px;background:#b57e37;color:#111d37}
 .guide-foot{margin-top:auto}
 .mission{left:calc(50% + 146px);bottom:31px}
}

/* The opening scene takes over the playfield until the storm begins. */
.cabinet.story-active header,.cabinet.story-active .hud,.cabinet.story-active .mission,.cabinet.story-active .controls,.cabinet.story-active .desktop-guide{display:none}
.cabinet.story-active .field{top:0;right:0;bottom:0;left:0;width:100%;height:100%;border:0;border-radius:0}
.story{position:absolute;inset:0;z-index:5;display:grid;place-items:center;pointer-events:none}
.story.hidden{display:none}
.story p{position:relative;z-index:1;max-width:min(620px,calc(100% - 36px));margin:0;padding:20px 25px;border:2px solid #f5d184;border-radius:8px;background:#fff2cce8;color:#16223d;box-shadow:7px 7px 0 #29385399;font-size:clamp(18px,3vw,30px);font-weight:800;line-height:1.25;text-wrap:balance;animation:story-arrive .8s both}
.story.storm p{background:#182949ec;color:#fff0c8;border-color:#bfcfe8}
#story-flash{position:absolute;inset:0;background:#fff9e9;opacity:var(--flash,0)}
@keyframes story-arrive{from{opacity:0;transform:translateY(20px)}to{opacity:1;transform:translateY(0)}}
@media(prefers-reduced-motion:reduce){.story p{animation:none}}
