:root{color-scheme:dark;font-family:ui-monospace,"Courier New","Noto Sans TC",monospace;color:#edf2dc;background:#101523}*{box-sizing:border-box}body{margin:0;background:radial-gradient(ellipse at 50% 35%,#26324a 0,#101523 65%);min-height:100svh}main{width:min(100% - 32px,620px);margin:auto;padding:28px 0 18px}header{display:flex;align-items:center;justify-content:space-between;margin-bottom:20px}.tag{color:#8697ae;font-size:11px;letter-spacing:2px}h1{margin:8px 0 0;font-size:32px;letter-spacing:3px;font-weight:900}h1 span{color:#c8ee80}.tools{display:flex;gap:8px}button{font:inherit;cursor:pointer;border:2px solid #49536c;border-radius:0;color:#ecf1de;background:#273147;touch-action:none;user-select:none;-webkit-user-select:none}button:focus-visible{outline:3px solid #c8ee80;outline-offset:3px}.tools button{font-size:12px;min-height:40px;padding:8px}.machine{border:3px solid #566179;box-shadow:7px 7px 0 #080d19;background:#20283b;padding:12px}.hud{display:flex;justify-content:space-between;align-items:center;padding:8px 9px 16px;gap:24px}.hud small{display:block;font-size:12px;color:#a6b1c0;margin-bottom:6px}.hud strong{font-size:30px;line-height:1;color:#c8ee80}.hud i{font-size:14px;font-style:normal}.energy{flex:1}.energy>div:first-child{display:flex;justify-content:space-between;font-size:12px}.bar{height:12px;background:#101523;border:2px solid #596277;padding:1px}.bar b{display:block;width:100%;height:100%;background:#c8ee80}.energy>span{font-size:11px;color:#a6b1c0;display:block;margin-top:7px}.best{text-align:right}.best strong{color:#efca80}.screen{position:relative;overflow:hidden;border:2px solid #0b101b;background:#172638;aspect-ratio:384/480}canvas{width:100%;height:100%;display:block;image-rendering:pixelated}#overlay{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;flex-direction:column;text-align:center;background:#0e1929d9;padding:22px}.badge{font-size:11px;letter-spacing:2px;color:#c8ee80;border:1px solid #789756;padding:8px 12px}h2{font-size:clamp(24px,5vw,34px);line-height:1.55;margin:22px 0 10px;letter-spacing:2px}p{font-size:14px;color:#bcc8d3;line-height:1.9;margin:0 0 20px}.instructions{display:flex;flex-direction:column;gap:9px;font-size:13px;color:#d6dccb;margin-bottom:25px}#start{background:#c8ee80;border-color:#e2ffae;color:#182433;padding:16px;width:min(100%,300px);font-weight:900;box-shadow:4px 4px 0 #5b7244}#start span{margin-left:10px}#overlayFoot{font-size:10px;color:#95a3b6;margin-top:22px;line-height:1.8}.controls{display:flex;gap:18px;margin-top:14px}.arrows{display:flex;gap:10px;flex:1}.arrows button{width:50%;font-size:24px;min-height:65px;border-bottom-width:6px}#jump{width:45%;background:#c8ee80;color:#182433;border-color:#9abc65;border-bottom-width:6px;font-size:16px;font-weight:bold}#jump span{display:block;font-size:11px;margin-top:5px}button:active,button.pressed{transform:translateY(2px);filter:brightness(1.2)}footer{display:flex;flex-direction:column;align-items:center;gap:7px;font-size:11px;color:#7c8ba1;margin-top:20px}.charge{position:absolute;bottom:10px;left:12px;right:12px;display:flex;gap:10px;align-items:center;font-size:10px;color:#e7dab8;pointer-events:none}.charge>div{height:7px;background:#0b1426b0;flex:1}.charge b{height:100%;display:block;background:#efca80;width:0}#toast{position:absolute;left:0;right:0;top:20px;text-align:center;color:#e0ffb1;font-size:15px;font-weight:bold;text-shadow:2px 2px #101523;pointer-events:none}@media(max-width:600px){main{width:min(100% - 16px,460px);padding:12px 0}header{margin-bottom:12px}h1{font-size:25px}.tag{font-size:9px;letter-spacing:1px}.machine{padding:7px}.hud{gap:12px;padding:6px 4px 12px}.hud strong{font-size:25px}.tools button{padding:5px;font-size:11px}.controls{gap:12px;margin-top:9px}.arrows button{min-height:58px}footer{font-size:10px;margin-top:14px}h2{margin-top:15px}#overlay{padding:18px}p{font-size:13px}.instructions{margin-bottom:18px}}@media(max-height:760px) and (min-width:600px){main{max-width:465px;padding-top:12px}header{margin-bottom:12px}h1{font-size:26px}.controls button{min-height:48px}.machine{padding:8px}}

/* Fit both the playfield and controls in a typical phone or desktop viewport. */
main{width:min(calc(100% - 20px),560px,calc((100svh - 280px)*.8 + 34px));min-width:300px;padding:12px 0}
header{margin-bottom:12px}.machine{padding:8px}h1{font-size:27px}.tag{font-size:10px;letter-spacing:1px}
.controls{margin-top:10px}.arrows button{min-height:56px}.charge>span{min-width:136px;font-size:11px}
#overlay{overflow-y:auto;padding:16px}h2{font-size:26px;margin:16px 0 8px;line-height:1.4}
p{font-size:14px;margin-bottom:14px}.instructions{gap:6px;margin-bottom:16px;font-size:13px}
#overlayFoot{font-size:12px;margin-top:16px}#start{padding:13px}footer{margin-top:12px}
@media(max-width:600px){h1{font-size:24px}.tag{font-size:9px}.tools button{min-height:40px}.energy>span{font-size:11px}.hud{gap:10px}}
@media(max-height:700px){main{width:min(calc(100% - 16px),350px)}h2{font-size:23px}.badge{padding:6px}#overlayFoot{margin-top:10px}footer{display:none}}
