:root{color-scheme:light;--ink:#203e70;--cream:#faf3df;--coral:#db6755;--mint:#d5e5d9;--gold:#e5b84e}*{box-sizing:border-box}html,body{margin:0;width:100%;height:100%;overflow:hidden}body{font-family:Georgia,serif;color:var(--ink);background-color:#e8e9dc;background-image:linear-gradient(#24446a08 1px,transparent 1px),linear-gradient(90deg,#24446a08 1px,transparent 1px);background-size:32px 32px}button{font:700 13px system-ui,sans-serif;border:1px solid #203e7050;border-radius:8px;background:var(--cream);color:var(--ink);padding:10px 14px;cursor:pointer;touch-action:manipulation}button:hover{background:#e7dfc6}button:active{transform:translateY(1px);background:#d7d9c5}button:disabled{opacity:.45;cursor:default}button:focus-visible,canvas:focus-visible{outline:3px solid #ce583e;outline-offset:3px}.primary{background:var(--ink);color:var(--cream);border-color:var(--ink)}.primary:hover{background:#355889}.eyebrow{font:700 10px/1.5 system-ui,sans-serif;letter-spacing:2px}header{height:100px;padding:18px 30px 12px 80px;display:flex;align-items:center;justify-content:space-between;border-bottom:1px solid #203e702b}.brand span{font:700 9px system-ui;letter-spacing:3px}.brand h1{font-size:38px;margin:3px 0;letter-spacing:-1.5px}.brand em{font-weight:400}.brand sup{font:26px system-ui;margin-left:8px;color:var(--coral)}.tools{display:flex;gap:8px;align-items:center}#help-button{opacity:.65;border-radius:50%;width:38px;padding:10px}main{height:calc(100dvh - 100px);padding:18px 25px 12px;display:flex;align-items:center;justify-content:center;gap:clamp(28px,5vw,90px)}aside{width:200px;flex-shrink:0}.left-panel h2{font-size:28px;font-weight:400;margin:8px 0 0}.specimen{width:160px;margin:8px auto 0}.caption{font-style:italic;text-align:center;line-height:1.5;margin:4px 0 25px}.legend{font:13px/1.9 system-ui;border-top:1px solid #203e7030;border-bottom:1px solid #203e7030;padding:15px 0}.legend span{display:inline-block;width:25px;font-size:20px;font-weight:900}.coral{color:#b63d34}.gold{color:#8e6707}.blue{color:var(--ink)}.lab-note{font:13px/1.6 system-ui;opacity:.8}.desktop-note{font:11px/1.9 system-ui;opacity:.8;margin-top:24px}#bottle-area{height:100%;max-height:740px;display:flex;flex-direction:column;align-items:center;min-height:0;--board-h:min(calc(100dvh - 210px),588px)}#hud{width:calc(var(--board-h)*4/7 + 18px);display:flex;justify-content:space-between;gap:12px;font:9px system-ui;margin-bottom:10px}#hud span{display:flex;flex-direction:column;gap:3px}#hud b{font-size:19px;font-variant-numeric:tabular-nums}#bottle{position:relative;border:8px solid var(--ink);border-top-width:5px;border-radius:20px 20px 28px 28px;background:#fdf8e8;box-shadow:8px 10px 0 #203e7014;line-height:0}#game{display:block;height:var(--board-h);width:calc(var(--board-h)*4/7);max-width:100%;border-radius:9px 9px 17px 17px;touch-action:none!important;-webkit-user-select:none;user-select:none;cursor:grab}.bottle-neck{height:21px;line-height:21px;background:var(--ink);color:#f2ead4;text-align:center;font:8px/21px system-ui;letter-spacing:2px}#cue{font:12px/1.4 system-ui;margin-top:12px;min-height:18px;text-align:center;max-width:350px}#queue{display:flex;flex-direction:column;gap:12px;padding:8px 0 20px}.mini-pair{display:flex;align-items:center;gap:2px}.mini-cell{width:30px;height:30px;border-radius:8px;display:grid;place-items:center;color:#fff9e8;text-shadow:0 1px 1px #0003;font:900 20px system-ui;border:2px solid #203e7060}.mini-cell.c0{background:#d65d4e}.mini-cell.c1{background:#c49326}.mini-cell.c2{background:#315e91}.reserve,.rewind{border-top:1px solid #203e7030;padding-top:10px;margin-top:10px}.reserve button,.rewind button{margin-top:8px}#reserve-preview{min-height:32px}.rewind strong{display:block;font-size:22px;font-weight:400}kbd{font:10px system-ui;opacity:.7}#best{font:700 10px system-ui;letter-spacing:1px;margin-top:20px}.overlay{position:fixed;inset:0;z-index:80;background:#1c3659b8;display:grid;place-items:center;line-height:1.5;padding:12px}.hidden{display:none!important}.paper{background:var(--cream);border-radius:18px;box-shadow:9px 10px 0 #162c4a55;padding:24px 30px;max-width:510px;width:100%;max-height:calc(100dvh - 24px);overflow-y:auto;border:1px solid #203e7040}.paper h2{font-size:clamp(27px,4vw,38px);line-height:1.07;letter-spacing:-1px;margin:12px 0 18px;font-weight:400}.paper p{font:14px/1.55 system-ui}.paper .eyebrow{font-size:9px}.paper .primary{padding:13px 20px}.paper .keyline{font-size:11px;border-top:1px solid #203e7025;padding-top:14px}.touch-line{display:none}#result{position:absolute;border-radius:9px;padding:8px;background:#203e70b5;z-index:20}#result .paper{padding:20px;max-height:100%;font-size:12px}#result h2{font-size:28px}#result p{font-size:12px}#result button{margin-top:7px}#pause-screen{position:absolute;z-index:25;background:#203e70b8;border-radius:9px}.touch-controls{display:none}body.touch-device header{height:54px;padding:5px 80px 4px 14px}body.touch-device .brand span{font-size:7px;letter-spacing:1.5px}body.touch-device .brand h1{font-size:24px;margin:0}body.touch-device .brand sup{font-size:18px}body.touch-device .tools,body.touch-device aside,body.touch-device #flyout-nav{display:none!important}body.touch-device main{height:calc(100dvh - 54px);padding:6px 136px 5px;gap:0}body.touch-device #bottle-area{--board-h:calc(100dvh - 139px);width:100%}body.touch-device #bottle{border-width:5px;border-top-width:3px;box-shadow:4px 5px 0 #203e7014;border-radius:13px 13px 20px 20px}body.touch-device .bottle-neck{height:14px;line-height:14px;font-size:6px}body.touch-device #hud{font-size:8px;margin-bottom:5px;width:calc(var(--board-h)*4/7 + 10px);gap:10px}body.touch-device #hud b{font-size:13px}body.touch-device #cue{font-size:9px;margin-top:6px;max-width:260px}body.touch-device .touch-controls{display:contents}body.touch-device .left-actions,body.touch-device .right-actions{position:fixed;top:64px;bottom:8px;width:116px;display:flex;flex-direction:column;justify-content:center;align-items:center;gap:8px}body.touch-device .left-actions{left:max(8px,env(safe-area-inset-left))}body.touch-device .right-actions{right:max(8px,env(safe-area-inset-right))}body.touch-device .touch-controls button{width:105px;min-height:37px;padding:6px;font-size:11px;touch-action:none!important}body.touch-device .touch-controls .action{width:80px;height:72px;font:30px/1 system-ui;border-radius:15px;box-shadow:0 3px 0 #203e7020}body.touch-device .action small{display:block;font:700 9px/1.5 system-ui;margin-top:3px;letter-spacing:1px}.drag-note{font:700 9px/1.6 system-ui;letter-spacing:1px;text-align:center}.touch-preview{font:9px system-ui;letter-spacing:1px;display:grid;place-items:center;gap:5px}.touch-preview .mini-cell{width:22px;height:22px;font-size:15px}body.touch-device:has(#instruction-modal.is-visible) .left-actions,body.touch-device:has(#instruction-modal.is-visible) .right-actions{display:none!important}body.touch-device .touch-line{display:block}body.touch-device .keyline{display:none}body.touch-device .paper{padding:18px 23px}body.touch-device .paper p{font-size:12px;margin:10px 0}body.touch-device .paper h2{font-size:28px;margin:9px 0 12px}body.touch-device #result .paper{padding:12px}body.touch-device #result h2{font-size:20px}body.touch-device #result p{font-size:10px;line-height:1.4}body.touch-device #result button{padding:8px;font-size:10px}body.touch-device #result .eyebrow{font-size:7px;letter-spacing:1px}
@media(max-width:550px) and (orientation:portrait){body.touch-device main{padding:8px 15px 140px}body.touch-device #bottle-area{--board-h:min(calc(100dvh - 270px),calc((100vw - 40px)*7/4))}body.touch-device .left-actions,body.touch-device .right-actions{top:auto;bottom:max(12px,env(safe-area-inset-bottom));height:115px;width:calc(50% - 18px);display:grid;grid-template-columns:1fr 1fr;gap:6px}body.touch-device .left-actions{left:12px}body.touch-device .right-actions{right:12px}body.touch-device .touch-controls button{width:100%;min-height:44px}body.touch-device .touch-controls .action{width:100%;height:63px}body.touch-device .drag-note{display:none}.touch-preview{height:42px}body.touch-device #touch-sound{grid-column:1/3}body.touch-device #cue{font-size:11px}body.touch-device #hud b{font-size:16px}}
@media(prefers-reduced-motion:reduce){*{scroll-behavior:auto!important}}

/* The shared fullscreen helper makes the touch wrapper fill the viewport. */
body.touch-device #touch-controls{pointer-events:none!important}body.touch-device #touch-controls>div{pointer-events:auto}
/* Improvement pass 1: glanceable progress, useful warnings, mobile preview parity. */
#hud{padding-bottom:6px;background:linear-gradient(90deg,#6f9c89 var(--progress,0%),#203e7018 var(--progress,0%)) left bottom/100% 3px no-repeat}
#bottle.danger{border-color:#bd4e3d}.danger .bottle-neck{background:#bd4e3d}
body.touch-device #bottle-area{--board-h:calc(100dvh - 154px)}
#touch-next{display:flex;gap:4px}.touch-preview .mini-pair{gap:1px}.touch-preview .mini-cell{width:13px;height:19px;font-size:10px;border-width:1px;border-radius:4px}
@media(max-width:550px) and (orientation:portrait){body.touch-device #bottle-area{--board-h:min(calc(100dvh - 292px),calc((100vw - 40px)*7/4))}.touch-preview .mini-cell{width:11px;height:18px;font-size:9px}#touch-next{gap:2px}}
/* Improvement pass 2: a visible reserve on touch, without a new control. */
body.touch-device #touch-hold{display:flex;align-items:center;justify-content:center;gap:5px}#touch-hold .mini-cell{width:14px;height:19px;font-size:11px;border-width:1px;border-radius:4px}#touch-hold .mini-pair{gap:1px}
@media(orientation:landscape){body.touch-device #result{position:fixed;inset:62px 136px 10px;z-index:42;border-radius:16px;padding:10px}body.touch-device #result .paper{max-width:360px;padding:18px 22px}body.touch-device #result h2{font-size:26px}body.touch-device #result p{font-size:12px}body.touch-device #result button{font-size:12px;padding:10px 14px}}
