@font-face{font-family:Archivo;src:url("assets/archivo-black-400.woff2") format("woff2");font-weight:400;font-display:swap}
@font-face{font-family:Barlow;src:url("assets/barlow-600.woff2") format("woff2");font-weight:600;font-display:swap}
@font-face{font-family:Barlow;src:url("assets/barlow-700.woff2") format("woff2");font-weight:700;font-display:swap}
@font-face{font-family:Barlow;src:url("assets/barlow-800.woff2") format("woff2");font-weight:800;font-display:swap}
:root{color-scheme:dark;--shell:#132d26;--dark:#0e231e;--line:#395044;--cream:#fff6db;--lime:#c5ed64;--gold:#ffc355;--muted:#b3c3ae;--ink:#193329}
*{box-sizing:border-box}
[hidden]{display:none!important}
html,body{margin:0;width:100%;height:100%;overflow:hidden}
body{background:var(--shell);color:var(--cream);font:600 16px/1.3 Barlow,"Trebuchet MS",Arial,sans-serif}
button,input{font:inherit}
button{cursor:pointer;touch-action:manipulation}
button:focus-visible,input:focus-visible{outline:3px solid #55ccee;outline-offset:3px}
button:disabled{cursor:default;opacity:.67}
canvas[data-icon]{display:block;width:24px;height:24px;flex-shrink:0}
#arcade{height:100%;height:100dvh;display:grid;grid-template-rows:auto minmax(0,1fr) auto auto;padding:max(0px,env(safe-area-inset-top)) max(20px,env(safe-area-inset-right)) max(0px,env(safe-area-inset-bottom)) max(20px,env(safe-area-inset-left));max-width:2400px;margin:auto}
.topbar{min-width:0;display:flex;align-items:center;gap:clamp(16px,2.1vw,36px);height:clamp(74px,10vh,100px);padding:0 clamp(2px,.8vw,15px)}
.brand{display:flex;align-items:center;gap:clamp(5px,.7vw,13px);font:400 italic clamp(25px,3vw,52px)/.99 Archivo,"Arial Black",sans-serif;letter-spacing:-.072em;white-space:nowrap;margin:0 auto 0 0;color:#fff8e4;text-shadow:0 3px 0 #061d19}
.brand span{transform:skew(-4deg);display:block;padding-right:4px}
.brand b{font-weight:400;color:var(--lime)}
canvas.brand-icon{width:clamp(45px,4.4vw,76px);height:clamp(45px,4.4vw,76px)}
.stats{display:flex;align-items:center;height:46px;gap:clamp(14px,1.8vw,32px)}
.stat{display:flex;align-items:center;gap:11px}
canvas.stat-icon{width:30px;height:30px;color:var(--lime)}
.stat-line{display:flex;align-items:center;gap:15px;font-size:clamp(16px,1.35vw,23px);line-height:1}
.stat-line strong{font-weight:700}
#counter{font:800 1.14em/1 Barlow,sans-serif;color:var(--lime);font-variant-numeric:tabular-nums}
#counter span{font-size:.86em}
.segments{display:flex;gap:3px;margin-top:8px}
.segments i{flex:1;height:4px;min-width:7px;border-radius:2px;background:#52654a}
.segments i.on{background:var(--lime)}
.timer{border-left:1px solid var(--line);padding-left:clamp(14px,1.8vw,32px)}
.timer .stat-icon{color:#bdcdb9;width:23px;height:23px}
.eyebrow,.kicker,.stage-meta{text-transform:uppercase;font-weight:800;letter-spacing:.14em;font-size:11px;line-height:1.2}
.eyebrow{color:var(--muted);display:block}
#clock{display:block;font-weight:800;font-size:21px;font-variant-numeric:tabular-nums;line-height:1.1;min-width:4ch}
.rank-button,.primary{display:inline-flex;justify-content:center;align-items:center;gap:10px;background:var(--gold);color:#253222;border:1px solid #fcd788;border-bottom:3px solid #bd8533;border-radius:11px;font-weight:800;box-shadow:0 3px 0 #0b211c}
.rank-button{height:46px;font-size:18px;padding:0 20px}
.rank-button canvas{width:22px;height:22px}
.rank-button:hover,.primary:hover{background:#ffd677}
.viewport{position:relative;min-width:0;min-height:0;overflow:hidden;isolation:isolate;border-radius:17px;border:2px solid #456046;box-shadow:0 2px 0 #091e19;background:#85d0d7}
#game{display:block;width:100%;height:100%;touch-action:none;user-select:none}
.stage-card{position:absolute;top:clamp(14px,2.5vh,28px);left:clamp(14px,1.85vw,32px);padding:13px 20px 15px 17px;pointer-events:none;background:#fff7dd;color:var(--ink);border:2px solid #254031;border-radius:10px 16px 16px 10px;box-shadow:3px 4px 0 #213c3070}
.stage-card::before{content:"";position:absolute;left:0;top:10px;bottom:10px;width:4px;background:#82a83e;border-radius:0 2px 2px 0}
.stage-meta{display:flex;align-items:center;gap:6px;color:#507037}
.stage-dot{background:#6c903b;width:6px;height:6px;transform:rotate(45deg)}
.stage-card h2{margin:4px 0 1px;font:400 clamp(20px,2vw,32px)/1.09 Archivo,"Arial Black",sans-serif;letter-spacing:-.06em}
.stage-card p{font-size:14px;font-weight:600;margin:3px 0 0;color:#425440}
.stage-tools{position:absolute;display:flex;gap:7px;top:clamp(14px,2.5vh,28px);right:clamp(14px,1.75vw,30px)}
.tool{display:grid;place-items:center;width:40px;height:40px;color:#fff7df;background:#18372fee;border:1px solid #f6ffdf80;border-radius:11px;box-shadow:0 2px 0 #152d2560}
.tool:hover{background:#335545}.tool canvas{width:20px;height:20px}
.controls{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:0 clamp(4px,1.7vw,24px);min-height:clamp(74px,10.8vh,102px)}
.control-strip,.control-group,.inventory{display:flex;align-items:center}
.control-strip{gap:clamp(14px,2.1vw,36px)}
.control-group{gap:6px}
.control-group+.control-group{padding-left:clamp(14px,2.1vw,36px);border-left:1px solid var(--line)}
.control-group>span{font-size:clamp(15px,1.3vw,21px);font-weight:700;margin-left:3px}
.key{display:grid;place-items:center;padding:0;width:clamp(36px,2.8vw,48px);height:clamp(34px,2.7vw,44px);border:1px solid #fff5d0;border-bottom:4px solid #b3ac88;border-radius:8px;box-shadow:0 3px 0 #081f19;background:#fff5d9;color:#213b2e;font:400 clamp(18px,1.6vw,24px)/1 Archivo,"Arial Black",sans-serif;touch-action:none;user-select:none;-webkit-user-select:none;-webkit-touch-callout:none;-webkit-tap-highlight-color:transparent}
.key:active,.key.pressed{transform:translateY(2px);background:var(--lime);border-bottom-width:2px;box-shadow:0 1px 0 #081f19}
.inventory{gap:10px;min-width:133px}
.inventory-icon{display:grid;place-items:center;width:41px;height:41px;color:var(--lime);border-radius:12px;background:#233e30;border:1px solid #3c5841}
.inventory-icon canvas{width:23px;height:23px}
.inventory strong{display:block;font-weight:700;margin-top:3px;font-size:16px;white-space:nowrap}
.hint,#toast,#network-status{position:absolute;z-index:1;left:50%;transform:translateX(-50%);width:max-content;max-width:calc(100% - 28px);font-weight:700;text-align:center;pointer-events:none}
.hint{display:flex;align-items:center;gap:8px;bottom:14px;color:var(--cream);background:#18332bf2;border:1px solid #adc69e;border-radius:10px;padding:6px 13px 6px 7px;font-size:15px}
.hint-key{display:grid;place-items:center;background:var(--cream);color:var(--ink);padding:0 6px;min-width:22px;height:23px;border-radius:4px;font-weight:800}
#toast{bottom:62px;border-radius:12px;border:2px solid #2c4836;background:#fff6db;color:#294030;padding:10px 17px;box-shadow:2px 3px 0 #163a2b66;max-width:min(520px,calc(100% - 28px))}
#toast[data-kind="wrong"]{background:#fff0cd;border-color:#b96a29}
#network-status{position:static;transform:none;margin:0 auto 5px;background:#482e19;color:#fff4d2;border-radius:6px;padding:3px 10px;font-size:13px}
.dialog{background:#fff8e2;color:var(--ink);width:min(384px,calc(100% - 30px));max-height:calc(100dvh - 24px);overflow:auto;padding:28px;border:2px solid #264632;border-radius:20px;box-shadow:5px 6px 0 #102c22b3;text-align:center}
.dialog::backdrop{background:#0c251ed6}
.dialog-mark{width:52px;height:52px;display:grid;place-items:center;margin:0 auto 11px;border-radius:15px;background:#e5ecd6;color:#345b37;border:1px solid #bdc8a3}
.dialog-mark canvas{width:30px;height:30px}
.dialog-mark.success{background:#d8f395;color:#41612c}
.dialog-mark.gold{background:#ffdb83;color:#7d551d;border-color:#e1b863}
.dialog h2{font:400 28px/1.1 Archivo,"Arial Black",sans-serif;letter-spacing:-.06em;margin:5px 0 12px}
.dialog p{font-size:16px;margin:12px 0;color:#425042}
.kicker{color:#537046}
.time-card{display:flex;justify-content:space-between;align-items:center;margin:18px 0;background:#eaf0d8;border:1px solid #cedab6;border-radius:9px;padding:12px 14px}
.time-card strong,#rank-list time{font-variant-numeric:tabular-nums}
.time-card strong{font:800 25px/1 Barlow,sans-serif}
#save-form{text-align:left}
#save-form label{display:block;font-weight:700;margin-bottom:6px}
#save-form em{font-size:14px;font-weight:600;color:#5e6958;font-style:normal}
#nickname{height:43px;border-radius:8px;background:#fffdf5;border:1px solid #a2ad90;color:var(--ink);padding:9px 12px;width:100%;margin-bottom:12px}
#nickname::placeholder{color:#74806e}
.primary,.secondary{min-height:42px;padding:8px 14px;font-size:16px;font-weight:800}
.primary{width:100%;box-shadow:0 2px 0 #c9b783}.primary canvas{width:20px;height:20px}
.secondary{background:#f5f2dc;color:#294633;border:1px solid #b8c29f;border-radius:8px}
.secondary:hover,.close-dialog:hover{background:#e5edce}
.end-actions{display:flex;gap:8px;margin-top:10px}.end-actions button{flex:1}
.close-dialog{position:absolute;right:12px;top:12px;border:0;background:transparent;color:#3c5541;width:34px;height:34px;display:grid;place-items:center;border-radius:8px}
.close-dialog canvas{width:18px;height:18px}
#rank-list{margin:13px 0 0;padding:0;list-style:none}
#rank-list li{display:grid;grid-template-columns:26px 1fr auto;align-items:center;gap:9px;text-align:left;padding:8px 4px;border-top:1px solid #d9dec4}
.place{background:#e8edda;border-radius:6px;text-align:center;font-weight:800;font-size:14px;padding:2px}
li:first-child .place{background:#ffda78}
#rank-list time{font-weight:800}
#rank-retry{width:100%}
@media(min-width:901px){.stats{margin-right:auto}}
@media(max-width:900px){
 #arcade{padding-inline:max(10px,env(safe-area-inset-left)) max(10px,env(safe-area-inset-right))}
 .topbar{gap:14px}.brand{font-size:clamp(22px,3.2vw,32px)}
 .rank-button{padding-inline:14px}.stats{gap:13px}.timer{padding-left:13px}
 .control-strip{gap:12px}.control-group+.control-group{padding-left:12px}
 .inventory{min-width:0}.stage-card{padding:10px 14px 11px}
 .controls{padding-inline:5px}
}
@media(max-width:640px){
 .topbar{height:96px;display:grid;grid-template-columns:1fr auto;grid-template-rows:50px 36px;align-content:center;gap:0;padding-inline:3px}
 .brand{grid-area:1/1;font-size:clamp(22px,6.2vw,33px);gap:4px}.brand canvas{width:38px;height:38px}
 .rank-button{grid-area:1/2;height:34px;gap:6px;font-size:15px;border-radius:8px;padding:0 10px}.rank-button canvas{width:16px;height:16px}
 .stats{grid-area:2/1/3/3;justify-content:space-between;height:auto;gap:12px}
 .stat{gap:6px}.recycled .stat-icon{width:19px;height:19px}.recycled>div{display:flex;align-items:center;gap:10px}
 .segments{margin:0}.segments i{min-width:5px;width:7px}
 .stat-line{font-size:15px;gap:6px}.timer{border:0;padding:0}.timer .stat-icon{width:16px;height:16px}
 .timer>div{display:flex;align-items:center;gap:5px}#clock{font-size:16px}.timer .eyebrow{font-size:9px}
 .viewport{border-radius:12px}.stage-card{top:10px;left:10px;padding:8px 12px}.stage-meta{font-size:9px;gap:4px}
 .stage-card h2{font-size:18px;margin-top:2px}.stage-card p{font-size:12px;margin-top:1px}
 .stage-tools{top:10px;right:10px;gap:4px}.tool{width:33px;height:33px;border-radius:8px}.tool canvas{width:16px;height:16px}
 .controls{min-height:94px;padding:7px 2px;gap:5px;display:flex;flex-direction:column-reverse;align-items:stretch;justify-content:center}
 .control-strip{justify-content:space-between;gap:5px}.control-group{display:grid;grid-template-columns:auto;gap:1px;justify-items:center}
 .control-group:first-child{grid-template-columns:1fr 1fr;column-gap:5px}.control-group:first-child span{grid-column:span 2}
 .control-group+.control-group{padding:0;border:0}
 .control-group>span{font-size:12px;margin:3px 0 0}
 .key{width:clamp(43px,10.8vw,58px);height:39px;font-size:19px}
 .inventory{gap:5px;justify-content:flex-end}.inventory-icon{background:transparent;border:0;width:16px;height:16px}.inventory-icon canvas{width:14px;height:14px}
 .inventory>div{display:flex;gap:6px;align-items:center}.inventory .eyebrow{font-size:9px}.inventory strong{font-size:12px;margin:0}
 .hint{bottom:9px;font-size:13px;padding-block:4px}#toast{bottom:50px;font-size:14px;max-width:calc(100% - 20px)}
}
@media(max-height:540px) and (orientation:landscape){
 #arcade{padding-inline:8px}.topbar{height:46px;display:flex;gap:15px}
 .brand{font-size:23px}.brand canvas{width:36px;height:36px}.stats{height:auto;gap:10px}
 .stat-icon{max-width:20px;max-height:20px}.stat{gap:5px}.stat-line{font-size:14px;gap:8px}.segments{margin-top:4px}
 #clock{font-size:15px}.eyebrow{font-size:9px}.rank-button{height:32px;padding:0 10px;font-size:14px}.rank-button canvas{width:15px;height:15px}
 .stage-card{left:8px;top:6px;border-radius:7px;padding:5px 10px}.stage-meta{font-size:8px}.stage-card h2{font-size:15px;margin:0}.stage-card p{display:none}
 .stage-tools{top:6px;right:8px}.tool{width:29px;height:29px;border-radius:7px}.tool canvas{width:14px;height:14px}
 .controls{display:flex;flex-direction:row;min-height:51px;padding:4px;align-items:center;justify-content:space-between}
 .control-strip{gap:8px}.control-group{display:flex;gap:4px}.control-group+.control-group{border:0;padding-left:6px}.control-group>span{margin:0 0 0 2px;font-size:13px}.key{height:34px;width:36px;font-size:16px}
 .inventory{gap:5px}.inventory strong{font-size:13px}.inventory-icon{width:27px;height:27px}.inventory-icon canvas{width:16px;height:16px}
 .hint{bottom:4px;padding:3px 8px;font-size:12px}.hint-key{min-width:16px;height:17px}
 #toast{bottom:34px;padding:5px 10px;font-size:13px}
 .dialog{padding:14px 22px}.dialog-mark{width:30px;height:30px;margin-bottom:4px}.dialog-mark canvas{width:20px;height:20px}
 .dialog h2{font-size:22px;margin:3px 0 6px}.time-card{margin:8px 0;padding:6px 10px}
}
@media(max-width:680px) and (orientation:landscape){
 .topbar{display:flex;gap:8px}.brand{font-size:20px;gap:2px;flex-shrink:0}.brand canvas{width:28px;height:28px}
 .stats{gap:8px;justify-content:flex-start;flex:none}.recycled>div{display:block}
 .stat{gap:4px}.timer{padding-left:7px}.timer .eyebrow{display:none}
 .segments{margin-top:3px}.segments i{min-width:3px;width:auto}
 .rank-button{gap:4px;padding:0 7px;font-size:13px}
 .inventory{min-width:0}.controls{gap:8px}.control-strip{gap:4px}
}
