*{box-sizing:border-box;-webkit-tap-highlight-color:transparent}html,body{margin:0;width:100%;height:100%;overflow:hidden;overscroll-behavior:none;background:#180c07;color:#f4dfac;font-family:var(--theme-font,Georgia,serif)}body{position:fixed;inset:0;height:100dvh;overflow:hidden;user-select:none;-webkit-user-select:none;display:grid;grid-template-columns:minmax(0,1fr);place-items:start center}button{font:600 12px Georgia,serif;color:var(--theme-gold,#f4d788);border:1px solid #b38a43;background:linear-gradient(#48281a,#21140d);border-radius:18px;padding:10px;cursor:pointer;touch-action:manipulation}button:focus-visible{outline:2px solid #fff0ae;outline-offset:3px}button:disabled{cursor:default;filter:saturate(.4) brightness(.65)}button:active:not(:disabled){transform:translateY(1px);filter:brightness(1.13)}[hidden]{display:none!important}
#app{min-width:0;max-width:100%;width:min(100%,var(--app-max-width,520px));height:100dvh;display:flex;flex-direction:column;position:relative;overflow:clip;padding:env(safe-area-inset-top) max(8px,env(safe-area-inset-right)) var(--toolbar-height,0px) max(8px,env(safe-area-inset-left));background:#3a1b0d var(--ui-bg-wood) center/cover;box-shadow:0 0 70px #0009,inset 0 0 26px #180900bb}header{flex:none;padding:10px 8px 3px}h1{margin:0;height:clamp(54px,9.5dvh,86px);display:flex;justify-content:center}#logo{width:100%;height:100%;object-fit:contain;filter:drop-shadow(0 3px 3px #0008)}
#stats{display:grid;grid-template-columns:repeat(2,minmax(0,.5fr)) repeat(3,minmax(0,1fr));align-items:start;gap:2px 4.5px;flex:none;padding:0 8px;color:#fff0c5;font-family:system-ui;text-shadow:0 2px 3px #000}#stats>div{display:flex;flex-direction:column;align-items:center;min-width:0;gap:1px}#stats span{font-size:14px;font-weight:700;line-height:16.1px;height:16.1px;white-space:nowrap}#stats strong{width:100%;height:32px;min-height:32px;min-width:0;display:flex;align-items:center;justify-content:center;background:var(--ui-label-level) center/100% 100% no-repeat;font-size:22px;font-weight:800;line-height:1;font-variant-numeric:tabular-nums;white-space:nowrap;overflow:hidden}
/* Four 4.5px gaps equal the previous three 6px gaps: full pills retain their widths.
   Slice the existing 320x81 artwork at its 41px caps, preserving round ends. */
#stats .level-display strong,#stats .factor-display strong{position:relative;isolation:isolate;background:none}
#stats .level-display strong::before,#stats .factor-display strong::before{content:"";position:absolute;inset:0;z-index:-1;pointer-events:none;border-image:var(--ui-label-level) 0 41 fill / 0 16.2px / 0 stretch}
body[data-compact="true"][data-layout="wide"] #stats .level-display strong::before,body[data-compact="true"][data-layout="wide"] #stats .factor-display strong::before{border-image-width:0 14.2px}

#objective{text-align:center;flex:none;font:700 16px/1.25 system-ui;padding:3px 0;color:#fff0c5;text-shadow:0 2px 3px #000;overflow-wrap:anywhere}
#toast{position:relative;flex:none;margin:1px 9px 0;height:30px;line-height:30px;text-align:center;pointer-events:none;color:#ffebba;font-size:clamp(17px,4.7vw,22px);font-weight:bold;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;opacity:0;text-shadow:0 1px 3px #000}
#stage{position:relative;flex:1;min-height:0;overflow:visible}canvas{display:block;width:100%;height:100%;touch-action:none;-webkit-touch-callout:none}#overlay{position:fixed;inset:0;z-index:20;padding:16px;display:flex;align-items:center;justify-content:center;background:transparent}.panel{text-align:center;background:var(--ui-help-panel) center/100% 100% no-repeat;border:0;border-radius:24px;padding:24px;width:94%;max-width:350px;max-height:100%;overflow:auto;box-shadow:0 12px 35px #0008}.panel h2{font:clamp(21px,3.4dvh,30px)/1.1 Georgia,serif;margin:7px 0 12px;color:#f9df9e}.panel p{font:11px/1.6 system-ui;color:#e6d4b4}.panel #start{background:linear-gradient(#e0c078,#9a6b25);color:#25160b;min-height:44px;width:85%;margin:3px}
#toolbar{position:fixed;left:50%;transform:translateX(-50%);bottom:0;width:min(100%,var(--app-max-width,520px));max-width:100%;margin:0;padding:8px max(8px,env(safe-area-inset-right)) calc(16px + env(safe-area-inset-bottom)) max(8px,env(safe-area-inset-left));background:#000;border-top:1px solid #b38a43;z-index:5}#bottomControls{width:min(100%,520px);margin-inline:auto;display:grid;grid-template-columns:repeat(5,minmax(0,1fr));align-items:center;gap:4px}#bottomControls>.icon-button{width:min(100%,78px);justify-self:center;min-width:0;min-height:44px}.icon-button{width:100%;aspect-ratio:1.65;min-height:36px;padding:0;border:0;border-radius:0;background:var(--btn-sound) center/contain no-repeat;filter:drop-shadow(0 2px 2px #0007)}.icon-button svg{display:none}#sound.muted{background-image:var(--btn-sound-muted)}#settings{background-image:var(--btn-settings)}#pause{background-image:var(--btn-pause)}#pause.paused{background-image:var(--btn-play)}#endGame{background-image:var(--btn-end-game);min-height:38px;aspect-ratio:1.65}
.settings-build{display:flex;align-items:center;justify-content:space-between;gap:8px;flex-wrap:wrap;margin:auto 0 2px;padding-top:8px;color:#dcc391;font:12px/1.2 system-ui}.settings-copyright{white-space:nowrap}#version{white-space:nowrap;font:12px/1.2 system-ui;color:#dcc391;font-variant-numeric:tabular-nums}

#gameSummary{display:grid;gap:12px;margin:18px 0;color:#fff0c5;font-family:system-ui}#gameSummary>div{padding:8px;border:1px solid #b38a43;border-radius:12px;background:#1c100ad9}#gameSummary dt{font-size:16px;font-weight:700}#gameSummary dd{margin:3px 0 0;font-size:28px;font-weight:800;overflow-wrap:anywhere}.game-over .panel{box-shadow:0 12px 35px #000b}.game-over #start{font:800 20px system-ui;min-height:50px}.game-over #instructions{font-size:16px}
#update{display:block;margin:5px auto 0;padding:7px 16px;font-size:11px}#updateStatus{display:block;text-align:center;font:10px system-ui;color:#edd39a;min-height:0}
#settingsDialog,#endDialog{color:#f4dfac;background:var(--ui-help-panel) center/100% 100% no-repeat;border:0;border-radius:22px;width:calc(100% - 32px);max-width:350px;max-height:calc(100dvh - 36px);padding:26px 24px;box-shadow:0 15px 50px #000a;overflow:auto}dialog::backdrop{background:#140903b8;backdrop-filter:blur(4px)}.settings-heading{height:40px}.settings-heading h2{font:26px Georgia,serif;margin:0;color:#f4d788}#closeSettings{position:absolute;right:0;top:-5px;width:40px;height:40px;min-height:40px;background:none;border:1px solid #9b7840;border-radius:50%}#closeSettings svg{display:block;width:20px;height:20px;margin:auto;fill:none;stroke:#f4d788;stroke-width:2}.volume-label{display:flex;justify-content:space-between;align-items:center;font:14px system-ui;margin-top:15px}.volume-label output{font-size:12px;color:#d2b57c}#settingsDialog input[type=range]{width:100%;height:44px;margin:2px 0 0;accent-color:#c9ac70;touch-action:pan-x}#endDialog .confirm-actions{display:flex;gap:10px;margin:0}.confirm-actions button{flex:1;min-height:44px}#confirmEnd{background:linear-gradient(#762418,#3d100c)}
@media(max-height:700px){header{padding-top:4px}h1{height:50px}#toast{height:30px;line-height:30px}.icon-button{min-height:31px}.panel{padding:22px}.panel p{font-size:10px}.panel h2{margin:5px 0}}

#wheelTouchSurface{position:absolute;border-radius:50%;background:transparent;touch-action:none;-webkit-touch-callout:none;z-index:1}#overlay{z-index:20}
.settings-link{display:block;width:100%;margin:0 0 16px;padding:12px 16px;text-align:left;font-size:14px}
#licenseDialog{color:#f4dfac;background:linear-gradient(145deg,#48291b,#1f100a);border:1px solid #b18b43;border-radius:18px;width:calc(100% - 24px);max-width:620px;max-height:calc(100dvh - 32px);padding:18px;overflow:hidden;box-shadow:0 15px 50px #000a}#licenseDialog[open]{display:flex;flex-direction:column}.license-heading{display:flex;align-items:center;justify-content:space-between;gap:12px;flex:none}.license-heading h2{margin:0;font:23px Georgia,serif;color:#f4d788}#closeLicense{min-height:44px;flex:none}.license-source{font:12px/1.5 system-ui;color:#e2cba5;flex:none}#licenseText{margin:0;min-height:0;overflow:auto;overscroll-behavior:contain;white-space:pre-wrap;overflow-wrap:anywhere;text-align:left;user-select:text;-webkit-user-select:text;font:12px/1.55 ui-monospace,monospace;color:#f0e3ca;padding:12px;background:#170d09;border-radius:9px;touch-action:pan-y}


/* Paint overhanging rim tiles without reducing the wheel geometry. */
#game{position:absolute;left:-32px;top:-32px;width:calc(100% + 64px);height:calc(100% + 64px);pointer-events:none}

/* Keep long text and decorative overdraw out of intrinsic game sizing. */
#app>header,#stats,#stage{min-width:0;max-width:100%}
#wordGhostLayer{position:absolute;inset:0;overflow:hidden;pointer-events:none;z-index:3;contain:layout paint}
.word-ghost{position:absolute;white-space:nowrap;color:#ffe099;font:700 clamp(22px,6vw,32px)/1.15 Georgia,serif;text-shadow:0 -1px 0 #fff5ce,0 1px 0 #956022,0 2px 3px #160b01;-webkit-text-stroke:.25px #644018;transform:translate(-50%,-50%);will-change:transform,opacity}
.level-up-ghost{font-size:clamp(26.4px,7.2vw,38.4px)}
#viewWordHistory{display:block;width:85%;min-height:44px;margin:8px auto;font-size:16px}
#wordHistoryDialog{color:#f4dfac;background:linear-gradient(145deg,#48291b,#1f100a);border:1px solid #b18b43;border-radius:18px;width:calc(100% - 24px);max-width:430px;max-height:calc(100dvh - 32px);padding:18px;overflow:hidden;box-shadow:0 15px 50px #000a}
#wordHistoryDialog[open]{display:flex;flex-direction:column}
.history-heading{display:flex;align-items:center;justify-content:space-between;gap:12px;flex:none}
.history-heading h2{margin:0;font:23px Georgia,serif;color:#f4d788}
#closeWordHistory{min-height:44px;flex:none}
#wordHistoryList{min-height:0;overflow:auto;overscroll-behavior:contain;overflow-wrap:anywhere;touch-action:pan-y;padding:0 0 0 2rem;font:700 18px/1.7 system-ui;user-select:text;-webkit-user-select:text}
#wordHistoryEmpty{font:16px/1.5 system-ui}

/* Keep the existing status line in the clearance between preview and rim. */
#eventArea{position:relative;flex:none;height:58px;min-width:0;max-width:100%}

#eventArea #toast{position:absolute;left:9px;right:9px;margin:0;height:18px;line-height:18px;font-size:clamp(15px,4vw,19px);display:flex;align-items:center;justify-content:center}


#ringDropLayer{position:absolute;inset:0;overflow:hidden;pointer-events:none;z-index:3;contain:layout paint}
.ring-drop{position:absolute;display:block;pointer-events:none;will-change:transform;transform:translate(-50%,-50%)}

.difficulty-picker{margin:0 0 8px;padding:8px;border:1px solid #866637;border-radius:12px;min-width:0;font-family:system-ui}
.difficulty-picker legend{font-size:16px}.difficulty-picker label{display:flex;align-items:center;gap:10px;min-height:44px;font-size:18px;font-weight:700}
.difficulty-picker input{accent-color:#c9ac70;width:20px;height:20px}.difficulty-picker p{font-size:14px;line-height:1.35;margin:2px 0 5px}#difficultyStatus:empty{display:none}.difficulty-picker small{font-size:13px;color:#d2b57c}

/* Compact Game Over: four small cells and both actions visible together. */
.game-over .panel{padding:24px;max-height:calc(100dvh - 32px);overflow:hidden}
.game-over .panel h2{font-size:27px;line-height:1.1;margin:0 0 7px}
.game-over #instructions{font:14px/1.3 system-ui;margin:0 0 10px}
.game-over #gameSummary{grid-template-columns:repeat(2,minmax(0,1fr));gap:6px;margin:0 0 10px}
.game-over #gameSummary>div{padding:6px;min-width:0;border-radius:9px}
.game-over #gameSummary dt{font-size:12px;line-height:1.2}
.game-over #gameSummary dd{font-size:20px;line-height:1.15;margin:3px 0 0}
.game-over .end-actions{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
.game-over .end-actions #start,.game-over .end-actions #viewWordHistory{width:100%;min-height:44px;margin:0;padding:8px 4px;font:700 14px Georgia,serif}


#bouncingBombLayer{position:absolute;inset:0;overflow:hidden;pointer-events:none;z-index:4;contain:layout paint}
.bouncing-bomb{position:absolute;display:block;padding:0;border:0;border-radius:50%;background:none;pointer-events:auto;touch-action:manipulation;will-change:transform}
.bouncing-bomb:active:not(:disabled){filter:none}.bouncing-bomb canvas{width:100%;height:100%;pointer-events:none}


/* The existing enamel conveyor is anchored below the HUD by resize(). */
#incomingViewer{position:absolute;z-index:2;pointer-events:none;border:3px solid #c3973e;border-radius:7px;background:linear-gradient(165deg,#006d36,#003d20 40%,#002611 65%,#07552a);box-shadow:0 1px 0 #ffe7a0,inset 0 3px 8px #000b,inset 0 -1px 0 #b5f6bc44,0 2px 3px #190a06}
#incomingViewer::after{content:'';position:absolute;inset:1px;background:linear-gradient(160deg,#e8ffee22,transparent 45%);border-radius:3px;pointer-events:none}
#incomingCanvas{width:100%;height:100%;touch-action:auto}

#floodLetterLayer{position:absolute;inset:0;width:100%;height:100%;pointer-events:none;z-index:3}


/* Primary instruments share one size and normalized brass-channel overlay. */
#powerups{position:absolute;inset:0;z-index:2;pointer-events:none}
.powerup{position:absolute;display:block;width:var(--instrument-width);aspect-ratio:1.7;border:0;border-radius:50%;padding:0;background:var(--btn-spin) center/100% 100% no-repeat;pointer-events:auto;touch-action:manipulation;isolation:isolate}
#freeze{background-image:var(--btn-freeze)}
.powerup .powerup-name,#spinStatus{position:absolute;width:1px;height:1px;clip-path:inset(50%);overflow:hidden}
.powerup:disabled{filter:none;cursor:default}
.powerup::after{content:'';position:absolute;inset:10% 6%;border-radius:50%;background:#071222;opacity:.3;pointer-events:none;z-index:0}
.powerup.available::after,.powerup.power-active::after{opacity:0}
.powerup:active:not(:disabled){transform:translateY(2px);filter:brightness(.88)}
.perimeter{position:absolute;inset:0;width:100%;height:100%;overflow:visible;pointer-events:none;z-index:1;opacity:1}
.powerup.available .perimeter{animation:power-ready 2.2s ease-in-out infinite}
.powerup.ready-pulse .perimeter{animation:power-complete .65s ease-out}
.powerup.power-active .perimeter{opacity:1;filter:drop-shadow(0 0 1px #000)}
.powerup.power-paused .perimeter{animation-play-state:paused}
#freeze[data-phase="thawing"]::after{opacity:.16}
/* Both prerendered apertures share these normalized numeral bounds. */
.powerup-countdown{position:absolute;left:50%;top:calc(75.5% + 1px);width:24%;height:12%;transform:translate(-50%,-50%);display:flex;align-items:center;justify-content:center;color:#e7c270;font:700 calc(var(--instrument-width) * .085)/1 Georgia,serif;font-variant-numeric:tabular-nums;text-shadow:0 -1px 0 #fff3c655,0 1px 1px #000;z-index:2;pointer-events:none}
@keyframes power-ready{0%,100%{filter:none}50%{filter:drop-shadow(0 0 1px #000)}}
@keyframes power-complete{0%,100%{filter:none}40%{filter:drop-shadow(0 0 2px #000)}}

#settingsDialog a,#settingsDialog a:visited{color:#f4d788;text-shadow:0 1px 1px #321305,0 -1px 0 #ffeab44d;text-decoration:underline;text-underline-offset:3px}

/* A locally rendered knurled brass grip travels in a recessed mechanical groove. */
#speedControl{position:absolute;width:var(--instrument-width);pointer-events:auto}
.speed-instrument{--speed-scale:1;--speed-track-fill:linear-gradient(90deg,#a77b39 0 1px,transparent 1px calc(50% - .5px),#a77b39 calc(50% - .5px) calc(50% + .5px),transparent calc(50% + .5px) calc(100% - 1px),#a77b39 calc(100% - 1px)),linear-gradient(#030302,#1d1008 50%,#050301);display:flex;flex-direction:column;height:calc(44px * var(--speed-scale));min-width:0;padding:calc(2px * var(--speed-scale)) calc(6px * var(--speed-scale)) 0;border:1px solid transparent;border-radius:7px;background:var(--ui-speed-panel) center/100% 100% no-repeat}
.speed-labels{display:flex;justify-content:space-between;padding:0 calc(4px * var(--speed-scale));font:700 calc(12px * var(--speed-scale))/calc(14px * var(--speed-scale)) Georgia,serif;color:#d2b780;pointer-events:none}
/* Labels sit close to the groove without shifting the track or touch area. */
.speed-labels span{transform:translateY(calc(6px * var(--speed-scale)))}
#speedControl[data-speed="1"] .speed-labels span:nth-child(1),#speedControl[data-speed="2"] .speed-labels span:nth-child(2),#speedControl[data-speed="3"] .speed-labels span:nth-child(3){color:#fff5cf;text-shadow:0 0 4px #ffd46677}
#chipSpeed{--speed-thumb-width:24px;appearance:none;-webkit-appearance:none;display:block;width:100%;height:26px;min-width:0;margin:0;background:transparent;cursor:ew-resize;touch-action:none}
#chipSpeed::-webkit-slider-runnable-track{height:8px;border:1px solid #97713a;border-radius:4px;background:var(--speed-track-fill);box-shadow:inset 0 2px 3px #000,0 1px 0 #dfba6a66}
#chipSpeed::-webkit-slider-thumb{appearance:none;-webkit-appearance:none;width:var(--speed-thumb-width);height:14px;margin-top:-4px;border:0;border-radius:0;background:var(--ui-speed-grip) center/100% 100% no-repeat;filter:drop-shadow(0 2px 1px #000b)}
#chipSpeed::-moz-range-track{height:6px;border:1px solid #97713a;border-radius:4px;background:var(--speed-track-fill);box-shadow:inset 0 2px 3px #000}
#chipSpeed::-moz-range-thumb{width:var(--speed-thumb-width);height:14px;border:0;border-radius:0;background:var(--ui-speed-grip) center/100% 100% no-repeat;filter:drop-shadow(0 2px 1px #000b)}
#chipSpeed:focus-visible{outline:2px solid #fff0ae;outline-offset:2px;border-radius:4px}

/* display-layout.ts places these same controls and the canvas bomb rack together. */

/* One panel: the manual occupies the viewport; pause/results retain their layout. */
#help{background-image:var(--btn-help)}
#help:active{transform:translateY(2px);filter:brightness(.78) drop-shadow(0 1px 1px #0008)}
#overlay.manual{padding:max(12px,env(safe-area-inset-top)) max(12px,env(safe-area-inset-right)) max(12px,env(safe-area-inset-bottom)) max(12px,env(safe-area-inset-left));background:#130705b8;overscroll-behavior:none;touch-action:none}
.manual .panel{position:relative;display:flex;flex-direction:column;gap:10px;width:min(100%,560px);max-width:560px;height:88dvh;max-height:100%;padding:clamp(22px,5vw,32px);border:0;border-radius:22px;background:var(--ui-help-panel) center/100% 100% no-repeat;box-shadow:0 12px 50px #000b;overflow:hidden;text-align:left}
.manual .panel h2{flex:none;margin:0;text-align:center;font:bold clamp(23px,5vw,30px)/1.15 Georgia,serif;letter-spacing:.02em;text-shadow:0 2px 3px #160100;color:#ffe3a1}
#helpContent{display:none}
.manual #helpContent{display:block;flex:1;min-height:0;overflow-y:auto;overflow-x:hidden;overscroll-behavior:contain;touch-action:pan-y;scrollbar-width:thin;scrollbar-color:#c99d45 #390607;padding:0 10px 0 0;font:17px/1.5 system-ui;color:#fff0d4;overflow-wrap:anywhere;user-select:text;-webkit-user-select:text}
#helpContent::-webkit-scrollbar{width:5px}#helpContent::-webkit-scrollbar-thumb{background:#c99d45;border-radius:5px}
#helpContent section{padding:16px 0;border-bottom:1px solid #dfb85c55;scroll-margin-top:8px}
#helpContent section:first-child{padding-top:0}#helpContent section:last-child{border-bottom:0}
#helpContent h3{margin:0 0 10px;color:#ffdc83;font:bold 22px/1.2 Georgia,serif}
#helpContent ul{margin:10px 0 0;padding-left:22px}#helpContent li{margin:0 0 12px}#helpContent li::marker{color:#f4c963}
#helpContent p{font:inherit;color:inherit}
#helpContent strong{color:#ffe099}
.manual-art{display:block;width:126px;max-width:100%;height:auto;object-fit:contain;margin:8px auto 14px}
#helpContent canvas{width:100%;height:auto;touch-action:pan-y;max-height:150px;object-fit:contain}
#helpWord{max-width:250px;margin:auto}#helpRow{max-width:290px;margin:auto}
.manual-bombs{display:flex;align-items:center;justify-content:center;gap:16px}.manual-bombs .bomb-art{width:52px;margin:0}.manual-bombs .rack-art{width:170px;margin:0}
.manual-controls{margin:0}.manual-controls>div{padding:12px 0;border-bottom:1px solid #dfb85c33}.manual-controls dt{display:flex;align-items:center;gap:10px;font-weight:700;color:#ffe099}.manual-controls .manual-art{width:76px;margin:0}.manual-controls dd{margin:10px 0 0}
.manual .end-actions{flex:none;display:flex;gap:8px}.manual .end-actions button{flex:1;width:auto!important;margin:0!important;min-height:48px;font:700 16px Georgia,serif;border:2px solid #d5aa56;box-shadow:inset 0 1px 0 #ffedab,inset 0 -2px 2px #523008}
.manual #instructions,.manual #gameSummary,.manual #viewWordHistory{display:none!important}
/* Paused players can still reach the permanent toolbar. The manual blocks it. */
#overlay:not(.manual){pointer-events:none}#overlay .panel{pointer-events:auto}


/* The shared enamel frame stays fixed while Settings content scrolls inside. */
#settingsDialog{height:88dvh;max-height:calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 24px);overflow:hidden}
#settingsDialog[open]{display:flex;flex-direction:column}
/* The artwork's inner upper frame edge is at 30/1152 of its height.
   Titles share an exact 18px inset from that edge, independent of scrolling. */
#settingsDialog,.manual .panel{--panel-title-inset:18px;padding-top:calc(88dvh * .026041667 + var(--panel-title-inset) + 52px)}
#settingsDialog .settings-heading,.manual #heading{position:absolute;top:calc(2.6041667% + var(--panel-title-inset));left:24px;right:24px;margin:0;text-align:center}
#settingsDialog .settings-heading h2{margin:0;text-align:center}
.settings-content{display:flex;flex-direction:column;flex:1;min-height:0;overflow-y:auto;overflow-x:hidden;overscroll-behavior:contain;touch-action:pan-y;scrollbar-width:thin;scrollbar-color:#c99d45 #390607;padding-right:7px}
.settings-content>*{flex-shrink:0}
.settings-links{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;align-items:center;text-align:center;margin:0;font:16px/1.3 system-ui}
.settings-links a{display:flex;justify-content:center;align-items:center;min-height:44px}
.settings-audio{margin:0 0 8px}.settings-audio .volume-label{margin-top:0;font-size:16px}.settings-audio output{font-size:14px}

#settingsDialog #dictionaryLicense{margin:4px 0 0}
.manual-speed{--speed-scale:1.36363636;width:180px;max-width:100%;margin:8px auto 14px;pointer-events:none}
.manual-speed-slider{height:calc(26px * var(--speed-scale));display:flex;align-items:center}
.manual-speed-track{position:relative;display:block;width:100%;height:calc(8px * var(--speed-scale));border:1px solid #97713a;border-radius:4px;background:var(--speed-track-fill);box-shadow:inset 0 2px 3px #000,0 1px 0 #dfba6a66}
.manual-speed-grip{position:absolute;left:-1px;top:calc(-4px * var(--speed-scale));width:calc(24px * var(--speed-scale));height:calc(14px * var(--speed-scale));background:var(--ui-speed-grip) center/100% 100% no-repeat;filter:drop-shadow(0 2px 1px #000b)}



/* Exact water geometry comes from resize(); no sizing changes to the funnel. */
#centralPlay{position:absolute;z-index:2;min-height:0;min-width:0;padding:0;border:0;border-radius:50%;background:var(--btn-start) center/100% 100% no-repeat;aspect-ratio:1;touch-action:manipulation}
/* Repaint the same enamel texture only: the mask excludes brass and the triangle/shadow. */
#centralPlay::before{content:"";position:absolute;inset:0;pointer-events:none;border-radius:50%;background:inherit;filter:brightness(1.5);opacity:0;mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cpath fill='white' fill-rule='evenodd' d='M90 50a40 40 0 1 0-80 0 40 40 0 1 0 80 0ZM32 22 78 49 78 52 33 79Z'/%3E%3C/svg%3E") center/100% 100% no-repeat;animation:emerald-wait 2s ease-in-out infinite}
#centralPlay:active:not(:disabled){background-image:var(--btn-start-pressed);transform:none;filter:none}
#centralPlay:disabled::before,#centralPlay[hidden]::before{animation:none;opacity:0}
.app-backgrounded #centralPlay::before{animation-play-state:paused}
.central-play-departure{position:absolute;z-index:2;pointer-events:none;border-radius:50%}
@keyframes emerald-wait{0%,100%{opacity:0}50%{opacity:.38}}
@media(prefers-reduced-motion:reduce){#centralPlay::before{animation:none;opacity:0}}

#app.attract #centralPlay{z-index:5}

/* Wide display selection belongs to display-layout.ts; CSS only paints that layout. */
body[data-layout="wide"] h1{height:clamp(32px,7dvh,70px)}
body[data-layout="wide"] header{padding-top:4px}
body[data-layout="wide"] #eventArea{height:48px}
body[data-layout="wide"] #stats{width:min(100%,680px);margin-inline:auto}
body[data-layout="wide"] #objective{font-size:14px;padding:2px 0}
body[data-layout="wide"] #toolbar{padding-bottom:calc(8px + env(safe-area-inset-bottom))}

body[data-layout="wide"][data-compact="true"] h1{height:28px}
body[data-layout="wide"][data-compact="true"] #stats strong{height:28px;min-height:28px}
body[data-layout="wide"][data-compact="true"] #eventArea{height:44px}
body[data-layout="wide"][data-compact="true"] #objective{font-size:13px;padding:1px 0}
body[data-layout="wide"][data-compact="true"] #toolbar{padding-top:4px}
#copyDiagnostics{margin-top:8px;font:12px system-ui;background:transparent;min-height:36px}
#diagnosticText{width:100%;margin-top:8px;user-select:text;font:11px monospace}


/* Pirate presentation shares all layout, popup artwork and game controls. */
:root[data-theme="pirate"] body{background:#302b26 url("assets/themes/pirate/deck.webp") center/cover no-repeat fixed}
:root[data-theme="pirate"] #app{background:transparent;box-shadow:none}
#krakenLayer{position:fixed;inset:0;width:100%;height:100%;z-index:15;pointer-events:none;touch-action:auto}
#krakenLayer[hidden]{display:none}

/* Cosmic environment: pointer-transparent UFOs fly above the game interface. */
:root[data-theme="cosmic"] body{background:#020617 url("assets/themes/cosmic/space.webp") center top/cover no-repeat fixed}
:root[data-theme="cosmic"] #app{z-index:1;background:transparent;box-shadow:none}
#cosmicVisitors{position:fixed;inset:0;z-index:16;overflow:hidden;pointer-events:none}
#cosmicVisitors img{position:absolute;left:0;top:0;height:auto;pointer-events:none;will-change:transform}


:root[data-theme="tomb"] body{background:linear-gradient(#857b663d,#857b663d) center/cover no-repeat fixed,#a77d45 url("assets/themes/tomb/floor.webp") center/cover no-repeat fixed}
:root[data-theme="tomb"] #app{background:transparent;box-shadow:none}
:root[data-theme="tomb"] #krakenLayer{z-index:4}
:root[data-theme="tomb"] header,:root[data-theme="tomb"] #stats{position:relative;z-index:6}
:root[data-theme="tomb"] #powerups,:root[data-theme="tomb"] #centralPlay,:root[data-theme="tomb"] #incomingViewer{z-index:6}
:root[data-theme="lost"] body{background:linear-gradient(to top,transparent,#000b) center top/100% var(--lost-header-height,0px) no-repeat fixed,#15260a url("assets/themes/lost/forest.webp") center/cover no-repeat fixed}
:root[data-theme="lost"] #app{background:transparent;box-shadow:none}
:root[data-theme="lost"] #krakenLayer{z-index:4}
:root[data-theme="lost"] header,:root[data-theme="lost"] #stats{position:relative;z-index:6}
:root[data-theme="lost"] #powerups,:root[data-theme="lost"] #centralPlay,:root[data-theme="lost"] #incomingViewer{z-index:6}


.theme-picker .theme-label{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%)}
.theme-picker #themeDescription{margin:6px 0 0;min-height:2.7em}
.manual-theme{padding:8px 0;border-bottom:1px solid #dfb85c33}
.manual-theme:last-child{border-bottom:0}
.manual-theme-art{display:block;width:100%;height:auto;margin:0 auto}
.manual-theme p{margin:10px 0 0}


#themeSelect,.theme-choice{width:100%;min-height:44px;padding:9px 12px;text-align:left;font:1rem Georgia,serif;color:#ffe099;border:2px solid #b58a3b;border-radius:9px;background:linear-gradient(110deg,#ffffff14,transparent 45%),linear-gradient(#8c1b20,#54080e 52%,#350307);box-shadow:inset 0 1px 1px #ffe6a380,inset 0 -3px 7px #160000,0 2px 3px #0008;text-shadow:0 1px 1px #240000}
#themeSelect{display:flex;align-items:center;justify-content:space-between;gap:12px}
#themeSelect::after{content:'';width:8px;height:8px;border-right:2px solid #e9bd61;border-bottom:2px solid #e9bd61;transform:rotate(45deg);margin:-4px 3px 0 8px}
#themeDialog{width:min(90vw,420px);max-height:85dvh;overflow:auto;color:#ffe099;border:3px solid #b58a3b;border-radius:16px;background:linear-gradient(135deg,#7c141a,#300306);box-shadow:inset 0 1px 3px #ffe9ab80,0 12px 40px #000b;padding:16px}
.theme-choices{display:grid;gap:7px}.theme-choice{display:grid;grid-template-columns:1fr auto;gap:4px 8px;cursor:pointer}.theme-choice small{grid-column:1/-1;font: .85rem/1.35 Georgia,serif;color:#e8ce9a}.theme-choice[aria-pressed=true]{border-color:#ffe5a1;box-shadow:inset 0 0 0 1px #ecc56a,inset 0 2px 12px #ffbb391f,0 0 7px #e9ad3433}.theme-choice[aria-pressed=true]::after{content:'✓';grid-area:1/2;color:#ffe5a1}#themeSelect:focus-visible,.theme-choice:focus-visible{outline:2px solid #fff0bf;outline-offset:3px}

#themeDialog .settings-heading{display:flex;align-items:center;justify-content:space-between;height:auto;min-height:44px;margin-bottom:9px}#closeTheme{min-height:44px;padding:8px 14px;flex-shrink:0}


/* Brass toggles share one material in Settings and the welcome plaque. */
.enamel-toggle{display:flex!important;align-items:center;justify-content:center;gap:10px;min-height:44px;color:#f4d788;cursor:pointer;font:14px/1.25 Georgia,serif}
.enamel-toggle input{appearance:none;-webkit-appearance:none;flex:none;position:relative;width:42px;height:24px;margin:0;border:2px solid #d4aa55;border-radius:18px;background:linear-gradient(#160704,#7d1720 55%,#260607);box-shadow:inset 0 2px 4px #000b,0 1px 0 #ffe9a0}
.enamel-toggle input:before{content:'';position:absolute;top:2px;left:2px;width:16px;height:16px;border-radius:50%;background:linear-gradient(130deg,#fff0ad,#b38131 48%,#ffe4a0 68%,#6e461b);box-shadow:0 1px 3px #0009;transition:transform .16s}
.enamel-toggle input:checked{background:linear-gradient(#073426,#218658 55%,#042b1c)}
.enamel-toggle input:checked:before{transform:translateX(18px)}
.enamel-toggle input:focus-visible{outline:2px solid #fff1af;outline-offset:4px}
.welcome-preference{font-size:13px;opacity:.92;margin:4px 0 0;flex:none}
#welcome{position:fixed;inset:0;z-index:100;display:flex;align-items:center;justify-content:center;padding:12px;background:#0902028c;isolation:isolate}
.enamel-plaque{--brass:linear-gradient(135deg,#fff0ac 0%,#9a6729 15%,#eac575 31%,#fff0b8 48%,#ab7734 65%,#efd493 84%,#76501f);position:relative;width:min(500px,100%);padding:clamp(16px,3.5vw,28px);border:8px solid transparent;border-radius:28px;background:radial-gradient(ellipse at 30% -15%,#ffffff65,transparent 42%) padding-box,radial-gradient(ellipse at 70% 20%,#e03c4c45,transparent 62%) padding-box,linear-gradient(110deg,#30020c,#8f1027 30%,#650619 73%,#270209) padding-box,var(--brass) border-box;box-shadow:inset 0 0 0 2px #ffdf8b,inset 0 4px 5px #fff5,inset 0 0 24px #180006cc,0 0 0 2px #412b11,0 5px 0 #5f3e1e,0 20px 55px #000c;color:#ffe0a0;text-align:center;overflow:auto;overscroll-behavior:contain;text-shadow:0 1px 0 #fff3,0 2px 2px #250009;scrollbar-color:#ca9c4d #430410}
.welcome-logo{display:block;width:min(260px,82%);height:auto;margin:0 auto 8px}
#welcomeTitle{font:bold clamp(23px,5vw,32px)/1.15 Georgia,serif;margin:6px 0 12px;color:#ffe2a0;text-shadow:0 -1px 0 #fff0b8,0 2px 0 #7b4b13,0 3px 4px #220007}
#welcomeCopy p{font:16px/1.4 Georgia,serif;margin:8px 0 12px;color:#ffe9bc}
#welcomeCopy h3{font:bold 18px/1.2 Georgia,serif;margin:12px 0 4px}
#welcomeCopy .welcome-tagline{font-style:italic;color:#ffdc7d;letter-spacing:.06em}
#welcomeCopy hr{border:0;height:2px;margin:16px 15%;background:linear-gradient(90deg,transparent,#f4ce78,transparent);box-shadow:0 1px 1px #250008}
.welcome-actions{display:flex;align-items:center;justify-content:center;gap:14px;margin:18px 0 4px}
.welcome-actions button{min-height:48px;font:bold 16px Georgia,serif;border:3px solid #d4aa55;box-shadow:inset 0 1px 0 #fff0ac,inset 0 -2px 3px #160005,0 3px 0 #50320e}
#welcomeNext{min-width:150px;background:radial-gradient(ellipse at 40% -20%,#ffffff80,transparent 62%),linear-gradient(#168b5a,#07583b 53%,#032e23);color:#ffe7a3}
#welcomeSkip{font-size:13px;background:linear-gradient(#862031,#430513);opacity:.9}
.welcoming #toolbar{z-index:101;pointer-events:none;background:transparent}
.welcoming #toolbar button:not(.welcome-target),.welcoming #toolbar #updateStatus{opacity:.28}
.welcome-target{position:relative;z-index:102;outline:none;box-shadow:none!important}
#welcomeHand{position:fixed;z-index:103;font:42px/1 system-ui;color:#ffe3a0;text-shadow:0 2px 3px #20130b,0 0 5px #fff2c4;pointer-events:none;animation:forest-guide-tap 2s ease-in-out infinite;transform-origin:20% 15%}
/* Exact motion from Rocket Run styles/scenes.css; no shared runtime dependency. */
@keyframes forest-guide-tap{0%,18%,100%{transform:translate(14px,16px) rotate(-24deg);opacity:.9}37%,49%{transform:translate(0,0) rotate(-24deg) scale(.87);opacity:1}62%{transform:translate(14px,16px) rotate(-24deg);opacity:.9}}
.app-backgrounded #welcomeHand,html:not([data-frame-ready]) #welcomeHand{animation-play-state:paused}
html:not([data-frame-ready]) :is(#welcome,#welcomeHand){visibility:hidden}
#helpDrag,#helpReverse{display:block;max-width:100%;height:auto;margin:auto}
@media(max-height:700px){.enamel-plaque{padding:14px 18px;border-width:6px;border-radius:22px}.welcome-logo{width:180px}#welcomeTitle{font-size:24px;margin:4px 0 8px}#welcomeCopy p{font-size:14px;line-height:1.3;margin:6px 0}#welcomeCopy h3{font-size:16px;margin:9px 0 3px}#welcomeCopy hr{margin:10px 15%}.welcome-actions{margin:12px 0 2px}}
@media(prefers-reduced-motion:reduce){#welcomeHand{animation:none}.enamel-toggle input:before{transition:none}}
/* Shared pointer-transparent foreground also carries the mummy over controls. */
:root[data-theme="tomb"] #krakenLayer{z-index:7}

/* The existing touch-transparent foreground puts the T-Rex above controls. */
:root[data-theme="lost"] #krakenLayer{z-index:7}

/* Personal word dialogs use the same red enamel and brass palette as Settings. */
.word-dialog {
  width:min(420px,calc(100% - 28px));
  max-height:calc(100dvh - 28px);
  padding:clamp(14px,4vw,22px);
  color:#ffedc0;
  background:linear-gradient(135deg,#7c141a,#300306);
  border:3px solid #b58a3b;
  border-radius:16px;
  box-shadow:inset 0 1px 3px #ffe19c80,0 8px 24px #170204;
}
.word-dialog::backdrop { background:#130705b8; }
.word-dialog h2 { margin:0 0 8px;text-align:center;font-size:clamp(19px,5vw,24px); }
.word-dialog p { margin:8px 0 12px;font:15px/1.45 system-ui,sans-serif; }
.word-dialog-actions { display:grid;grid-template-columns:1fr 1fr;gap:8px;margin-top:10px; }
.word-dialog button,#manageExcludedWords { min-height:42px;font-size:14px; }
#manageExcludedWords { width:100%;margin-top:5px; }
#selectedWordChips { width:100%;height:auto;margin-bottom:8px; }
#excludedWordsDialog[open] { display:flex;flex-direction:column; }
#excludedWordsDialog > :not(ul) { flex:none; }
#excludedWordList { margin:0;min-height:0;padding:0 4px 0 0;overflow:auto;list-style:none;overscroll-behavior:contain; }
#excludedWordList li { display:flex;align-items:center;justify-content:space-between;gap:8px;padding:4px;border-bottom:1px solid #c2914e66; }
#excludedWordList li span { min-width:0;overflow-wrap:anywhere; }
.manual-word-hold { position:relative;width:min(280px,100%);margin:auto; }
.manual-word-hold canvas { width:100%;height:auto; }
.manual-word-hold span { position:absolute;z-index:1;left:50%;bottom:0;font:28px/1 system-ui;color:#ffe3a0;pointer-events:none; }

/* Static owner promotion belongs only to the final run summary. */
#rocketRunPromo{display:none}
#overlay.game-over:not(.manual) #rocketRunPromo{display:block;margin-top:12px}
#rocketRunPromo p{color:#ffdf96;font:700 16px/1.25 Georgia,serif;margin:0 0 8px;text-shadow:0 2px 2px #200600}
#rocketRunPromo a{display:flex;align-items:center;gap:10px;padding:9px;border:3px solid #bf923c;border-radius:13px;background:linear-gradient(135deg,#ffe6a0,#b27b27 8%,#391408 12%,#701c12 55%,#2a1008 88%,#e6bc62 94%,#9b6820);box-shadow:inset 0 2px 2px #fff4c9b0,inset 0 -3px 3px #1a0505,0 4px 1px #4d2c0a,0 6px 9px #0008;min-height:64px;touch-action:manipulation}
#rocketRunPromo a:active{transform:translateY(3px);box-shadow:inset 0 2px 4px #160400,0 1px 2px #0008}
#rocketRunPromo a:focus-visible{outline:3px solid #fff0bd;outline-offset:3px}
#rocketRunPromo .rocket-run-icon{width:22%;height:auto;border-radius:12%;flex:none}
#rocketRunPromo .rocket-run-logo{width:calc(78% - 10px);height:auto;object-fit:contain}
.game-over .panel{max-width:390px;overflow-y:auto}
@media(max-height:600px){.game-over .panel{padding:18px 22px}.game-over #rocketRunPromo{margin-top:8px}.game-over #rocketRunPromo a{padding:5px}.game-over #gameSummary dd{font-size:18px}}

/* Gameplay theme quick selector: the transparent frame is decorative and never receives input. */
#themeQuickSelect{position:absolute;z-index:6;display:block;pointer-events:none;user-select:none;-webkit-user-select:none}
#themeQuickSelect>img{display:block;width:100%;height:100%;pointer-events:none}
#themeQuickSelect .theme-quick-icon{position:absolute;display:block;min-width:0;min-height:0;margin:0;padding:0;border:0;border-radius:0;background:transparent;box-shadow:none;text-shadow:none;touch-action:manipulation;pointer-events:auto;transform:none;filter:none}
#themeQuickSelect .theme-quick-icon:active{transform:none;filter:none}
#themeQuickSelect .theme-quick-icon:focus-visible{outline:2px solid #ffe17a;outline-offset:1px}
#themeQuickSelect .theme-quick-icon[aria-pressed="true"]{z-index:1}
#themeQuickSelect .theme-quick-icon[aria-pressed="true"]::before{content:"";position:absolute;inset:1%;background:rgba(255,216,80,.16);clip-path:inherit;filter:drop-shadow(0 0 3px #fff2a3) drop-shadow(0 0 7px #ffb51e) drop-shadow(0 0 11px #d87808);mix-blend-mode:screen;pointer-events:none}
.theme-quick-classic{left:6.3%;top:13%;width:15%;height:72%;clip-path:ellipse(49% 49% at 50% 50%)}
.theme-quick-pirate{left:22.3%;top:11%;width:18%;height:77%;clip-path:polygon(12% 15%,31% 9%,42% 0,59% 0,72% 10%,91% 14%,100% 50%,88% 75%,70% 100%,50% 91%,29% 100%,10% 73%,0 47%)}
.theme-quick-cosmic{left:41.7%;top:14%;width:17%;height:74%;clip-path:polygon(24% 10%,50% 0,77% 10%,94% 29%,100% 49%,84% 56%,74% 99%,27% 99%,17% 57%,0 49%,6% 29%)}
.theme-quick-tomb{left:59.6%;top:10%;width:17%;height:79%;clip-path:polygon(48% 0,67% 5%,83% 20%,100% 60%,87% 75%,88% 90%,67% 100%,30% 100%,12% 90%,13% 75%,0 60%,18% 20%,34% 5%)}
.theme-quick-lost{left:78.4%;top:11%;width:18.5%;height:79%;clip-path:polygon(25% 3%,55% 0,83% 9%,100% 35%,90% 60%,97% 72%,80% 82%,94% 94%,68% 100%,43% 89%,19% 100%,0 80%,13% 59%,8% 36%)}
