/* Match the previous capital height while retaining VT323's clear descenders. */
@font-face{font-family:VT323;src:url('./assets/fonts/VT323-Regular.ttf') format('truetype');font-weight:400;font-style:normal;font-display:swap;size-adjust:160%}
/* VT323 has no arrow glyphs; retain the game's original four movement symbols. */
@font-face{font-family:TrenchersArrows;src:url('./assets/coastal-pixel-text.ttf?v=43') format('truetype');font-weight:400;font-style:normal;font-display:swap;unicode-range:U+2190-2193}
*{box-sizing:border-box}html,body{margin:0;width:100%;height:100%;overflow:hidden;background:#10222d;color:#fffbe2;font-family:VT323,monospace}main{height:100%;display:flex;align-items:center;justify-content:center}.game-shell{width:min(100vw,calc((100svh - 80px)*64/39))}#stage{position:relative;width:100%;aspect-ratio:64/39;overflow:hidden;background:#6bc9e6;outline:none;touch-action:none}#stage>canvas{position:absolute;inset:0;width:100%!important;height:100%!important;display:block;image-rendering:pixelated;image-rendering:crisp-edges}#loading{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;background:#142633;z-index:5;flex-direction:column;gap:24px;color:#ffda57;font:400 clamp(12px,2vw,24px)/1.5 VT323,monospace}#loading.hidden{display:none}#pause{position:absolute;z-index:3;left:50%;top:45%;transform:translate(-50%,-50%);background:#142633e8;padding:18px 24px;text-align:center;max-width:85%;font-size:14px;line-height:1.6}button:focus-visible{outline:2px solid #fffde9;outline-offset:4px}
/* Flat, stepped pixel frame. */
.pixel-dialog{position:fixed;inset:0;margin:auto;width:min(656px,calc(100vw - 32px));max-height:calc(100svh - 32px);padding:16px;overflow:auto;overscroll-behavior:contain;touch-action:auto;border:4px solid #10232c;box-shadow:0 -4px #426673,0 4px #426673,-4px 0 #426673,4px 0 #426673,inset 0 0 0 4px #426673;background:#152f3b;color:#fffbe2;font-family:VT323,monospace;font-size:16px;font-weight:400}.pixel-dialog::backdrop{background:#07172238}.inventory-header{display:flex;align-items:center;justify-content:center;position:relative;min-height:48px;margin-bottom:16px}.inventory-header h1{margin:0;font:400 32px/1 VT323,monospace;letter-spacing:0;text-shadow:4px 4px #0b1e29}.inventory-header button{position:absolute;right:0;top:0;width:36px;height:36px;padding:0;border:2px solid #537e8b;box-shadow:2px 2px #0b1e29;background:#1a3540;color:#fffbe2;font:400 16px VT323,monospace;cursor:pointer}#inventory-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px}.inventory-cell{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:8px;min-width:0;height:136px;padding:8px 4px;border:2px solid #527887;box-shadow:inset 2px 2px #2d515e,2px 2px #0b202a;background:#132b36;color:#fffbe2;font:400 16px/1 VT323,monospace;cursor:pointer}.inventory-cell img{width:96px;height:96px;max-width:100%;object-fit:contain;image-rendering:pixelated;pointer-events:none}.inventory-cell span{white-space:nowrap}.inventory-cell:hover,.inventory-cell:focus-visible{background:#234553;border-color:#a2c2bd;outline:none}.inventory-cell.selected{border-color:#efcc70;box-shadow:inset 2px 2px #79643a,2px 2px #0b202a;background:#28434b;color:#ffe698}.pixel-dialog footer{font-size:8px;line-height:16px;text-align:right;color:#819fa6;letter-spacing:1px}#stage[data-inventory-open=true] #pause{display:none}
.command-panel{display:flex;align-items:center;gap:24px;height:48px;padding:10px 16px;border-top:4px solid #426673;background:#10222d;font-family:VT323,monospace;color:#fffbe2;touch-action:auto}#command-form{flex:1;min-width:0;display:flex;align-items:center;gap:12px;height:24px;font-size:16px;line-height:24px}.prompt-symbol{color:#f2d27d}.prompt-entry{position:relative;flex:1;min-width:0;height:24px;overflow:hidden}#command-input{width:100%;height:24px;padding:0;border:0;border-radius:0;outline:none;background:transparent;color:#fffbe2;font:400 16px/24px VT323,monospace;letter-spacing:0;caret-color:transparent}#prompt-cursor{position:absolute;top:2px;left:0;width:1ch;height:18px;background:#fffbe2;pointer-events:none;animation:cursor-blink 1s steps(1,end) infinite}#prompt-cursor[hidden]{display:none}#command-form:focus-within .prompt-symbol{color:#fffbe2}@keyframes cursor-blink{50%{visibility:hidden}}

@media(max-width:700px),(max-height:650px){.pixel-dialog{width:min(472px,calc(100vw - 24px));padding:12px;max-height:calc(100svh - 24px)}.inventory-header{min-height:32px;margin-bottom:12px}.inventory-header h1{font-size:24px;text-shadow:2px 2px #0b1e29}.inventory-header button{width:28px;height:28px;font-size:16px}#inventory-grid{gap:8px}.inventory-cell{height:88px;gap:4px;padding:4px 2px;font-size:8px}.inventory-cell img{width:64px;height:64px}.pixel-dialog footer{letter-spacing:0}.command-panel{padding-left:12px;padding-right:12px}}
@media(max-width:380px){.inventory-cell{height:76px}.inventory-cell img{width:52px;height:52px}#inventory-grid{gap:6px}.inventory-header h1{font-size:16px}.command-panel{padding-left:8px;padding-right:8px}}
@media(prefers-reduced-motion:reduce){#prompt-cursor{animation:none}}



.status-bar{height:32px;display:flex;align-items:center;justify-content:space-between;gap:12px;padding:0 16px;background:#fffbe2;color:#10232c;font:400 16px/1 VT323,monospace;white-space:nowrap;text-transform:uppercase}
.status-bar button{border:0;border-radius:0;padding:0;background:transparent;color:inherit;font:inherit;cursor:pointer;min-height:32px}
.status-bar button:focus-visible{outline:2px solid #426673;outline-offset:0}
.player-selector{display:flex;align-items:center;gap:4px}
.player-selector>span{margin-right:4px}
.status-bar .player-swatch{width:24px;flex:0 0 24px;display:grid;place-items:center}
.player-swatch>span{display:block;width:14px;height:14px;background:#b2693f;box-shadow:inset 0 0 0 1px rgba(16,35,44,.25)}
.player-swatch[data-player-tone="tan"]>span{background:#dcae89}
.player-swatch[aria-pressed="true"]>span{outline:2px solid #10232c;outline-offset:2px}
.player-swatch:hover>span{box-shadow:inset 0 0 0 2px #fffbe2}
#response-dialog{width:min(656px,calc(100vw - 32px));padding:28px;text-align:left}
#command-response{margin:0 0 24px;font:400 16px/1.6 VT323,monospace;overflow-wrap:anywhere;white-space:pre-line}
#stage[data-response-open=true] #pause{display:none}
@media(max-width:480px){.status-bar{padding:0 12px;font-size:12px}#response-dialog{padding:20px}#command-response{font-size:12px}}

#command-response:focus{outline:none}

.status-toggles{display:flex;align-items:center;gap:24px}
@media(max-width:560px){.status-bar{font-size:8px;gap:8px}.status-toggles{gap:12px}}


/* Consistent mixed-case lettering throughout the interface. */
.pixel-dialog,.pixel-dialog h1,.pixel-dialog button,#command-response,#command-input{font-family:VT323,monospace}


/* Inventory opens on its title; close controls share item hover colors. */
#inventory-title:focus,#item-detail-name:focus{outline:none}
#inventory-close:hover,#inventory-close:focus-visible,#item-detail-close:hover,#item-detail-close:focus-visible{background:#234553;border-color:#a2c2bd;outline:none}
#item-detail-dialog{width:min(400px,calc(100vw - 32px));padding:32px 24px 24px;text-align:center}
#item-detail-dialog::backdrop{background:#07172270}
#item-detail-close{position:absolute;right:12px;top:12px;width:32px;height:32px;padding:0;border:2px solid #537e8b;box-shadow:2px 2px #0b1e29;background:#1a3540;color:#fffbe2;font:400 16px VT323,monospace;cursor:pointer}
#item-detail-image{display:block;width:240px;height:240px;max-width:100%;object-fit:contain;image-rendering:pixelated;margin:8px auto 20px}
#item-detail-name{margin:0 0 16px;font:400 24px/1.25 VT323,monospace;color:#fffbe2}
#item-detail-description{margin:0;font:400 16px/1.6 VT323,monospace;color:#c6d8d0}
@media(max-height:600px),(max-width:480px){#item-detail-dialog{padding:24px 20px 20px}#item-detail-image{width:168px;height:168px;margin:8px auto 12px}#item-detail-name{font-size:16px}#item-detail-description{font-size:12px}}


/* Empty ending frame: artwork/text will be added by future fumble events. */
#death-dialog{width:min(520px,calc(100vw - 32px));height:min(280px,60svh);outline:none}
#death-close{position:absolute;right:12px;top:12px;width:32px;height:32px;padding:0;border:2px solid #537e8b;box-shadow:2px 2px #0b1e29;background:#1a3540;color:#fffbe2;font:400 16px VT323,monospace;cursor:pointer}
#death-close:hover,#death-close:focus-visible{background:#234553;border-color:#a2c2bd;outline:none}
#stage[data-fumble-active=true] #pause{display:none}
#stage[data-transition-active=true] #pause{display:none}
@media(max-width:380px){.status-bar{padding:0 8px}.status-toggles{gap:8px}}

.inventory-cell.empty{cursor:default;pointer-events:none}

#telephone-dialog{width:min(356px,calc(100vw - 32px));padding:24px}
#telephone-dialog .inventory-header h1{font-size:24px}
#telephone-title:focus,#telephone-call-dialog:focus{outline:none}
#telephone-number{width:100%;height:48px;margin:0 0 16px;padding:10px 8px;border:2px solid #527887;border-radius:0;background:#0b202a;color:#efcc70;font:400 16px VT323,monospace;outline:none}
.telephone-keys{display:grid;grid-template-columns:repeat(3,1fr);gap:8px}
.telephone-keys button,.telephone-actions button{min-height:48px;border:2px solid #527887;box-shadow:inset 2px 2px #2d515e,2px 2px #0b202a;background:#132b36;color:#fffbe2;font:400 24px VT323,monospace;cursor:pointer;border-radius:0}
.telephone-actions{display:grid;grid-template-columns:1fr .8fr 1.2fr;gap:8px;margin-top:16px}
.telephone-actions button{font-size:16px}
#telephone-call{background:#28434b;border-color:#efcc70;color:#ffe698}
#telephone-call:disabled{opacity:.45;cursor:default}
.telephone-keys button:hover,.telephone-keys button:focus-visible,.telephone-actions button:not(:disabled):hover,.telephone-actions button:focus-visible,#telephone-close:hover,#telephone-close:focus-visible,#telephone-call-close:hover,#telephone-call-close:focus-visible{background:#234553;border-color:#a2c2bd;outline:none}
#telephone-call-dialog{width:min(520px,calc(100vw - 32px));height:min(260px,60svh)}
#telephone-call-close{position:absolute;right:12px;top:12px;width:32px;height:32px;padding:0;border:2px solid #537e8b;box-shadow:2px 2px #0b1e29;background:#1a3540;color:#fffbe2;font:400 16px VT323,monospace;cursor:pointer}
#stage[data-phone-open=true] #pause{display:none}
@media(max-height:600px){#telephone-dialog{padding:16px}#telephone-dialog .inventory-header{margin-bottom:8px}#telephone-number{height:36px;margin-bottom:8px}.telephone-keys button{min-height:36px;font-size:16px}.telephone-keys{gap:6px}.telephone-actions{margin-top:8px}.telephone-actions button{min-height:36px}}

.status-totals{display:flex;align-items:center;gap:24px}
#response-item-image{display:block;width:240px;height:240px;max-width:100%;object-fit:contain;image-rendering:pixelated;margin:0 auto 20px}
#response-item-image[hidden]{display:none}
@media(max-width:760px),(max-height:590px){.status-bar{font-size:8px}.status-totals{gap:12px}.status-toggles{gap:12px}}
@media(max-width:380px){.status-totals{gap:8px}.status-toggles{gap:8px}}
@media(max-width:350px){.status-bar{height:64px;flex-wrap:wrap;justify-content:center;gap:0}.status-totals,.status-toggles{justify-content:space-between;width:100%;height:32px}.game-shell{width:min(100vw,calc((100svh - 112px)*64/39))}}
@media(max-height:600px),(max-width:480px){#response-item-image{width:168px;height:168px;margin-bottom:16px}}

#death-message{margin:38px 0 0;font:400 16px/1.65 VT323,monospace;text-transform:none;white-space:pre-line;color:var(--text,#e9ecd6)}
#death-dialog:has(#death-message:not([hidden])){height:fit-content;min-height:220px;max-height:80svh;overflow:auto}

#loading.load-error{flex-direction:column;gap:12px;padding:20px;text-align:center;overflow:auto;font-size:clamp(11px,2.4vw,16px)}#loading.load-error p{margin:0;max-width:36em}#loading.load-error button{font:inherit;color:#fffbe2;background:#244550;border:2px solid #77948d;padding:8px 18px;cursor:pointer}#loading.load-error details{font-size:.8em;overflow-wrap:anywhere}#loading.load-error summary{cursor:pointer;margin-bottom:8px}

.finale-dialog{max-width:min(90vw,620px);border-width:6px;animation:ending-reveal .35s steps(5,end);}
.finale-dialog h1{font-size:clamp(19px,3vw,29px);color:#f1d28c;outline:none;}
.finale-dialog .ending-tagline{color:inherit;margin-top:1.5rem;}
@keyframes ending-reveal{from{opacity:0;transform:translateY(8px)}to{opacity:1;transform:translateY(0)}}
@media(prefers-reduced-motion:reduce){.finale-dialog{animation:none}}

/* Scenario illustrations keep their complete composition at every viewport. */
.outcome-art{display:block;width:100%;height:auto;max-height:none;image-rendering:pixelated;margin:0 auto 20px;border:2px solid #426673;}
.outcome-art[hidden]{display:none;}
.pixel-dialog:has(.outcome-art:not([hidden])){height:fit-content;min-height:0;max-height:calc(100svh - 32px);overflow:auto;}
#death-dialog:has(.outcome-art:not([hidden])){width:min(656px,calc(100vw - 32px));height:fit-content;min-height:0;max-height:calc(100svh - 32px);padding-top:52px;}
#death-dialog:has(.outcome-art:not([hidden])) #death-message{margin-top:0;}
.finale-dialog .outcome-art+.ending-tagline{margin-top:0;}
@media(max-width:480px){.outcome-art{margin-bottom:16px;}#death-message{font-size:12px;}#death-dialog:has(.outcome-art:not([hidden])){padding-top:48px;}}

/* Both endings share the cast roll, with the original pixel type and palette. */
#credits-screen{position:fixed;inset:0;margin:0;padding:0;border:0;width:100vw;height:100svh;max-width:none;max-height:none;overflow:hidden;background:#000;color:#fffbe2;outline:none;}
#credits-screen::backdrop{background:#000;}
#credits-screen .credits-roll{position:absolute;top:100%;left:0;width:100%;padding:0 24px;text-align:center;box-sizing:border-box;}
#credits-title{margin:0 0 48px;font:400 clamp(24px,4vw,40px)/1.5 VT323,monospace;outline:none;}
.credits-cast{margin:0;font:400 clamp(16px,2.4vw,24px)/1.5 VT323,monospace;}
.credits-cast dt{color:#a9c5c3;}
.credits-cast dd{margin:4px 0 40px;overflow-wrap:anywhere;}
.credits-cast a{color:inherit;text-decoration:underline;text-underline-offset:4px;}
.credits-cast a:hover,.credits-cast a:focus-visible{color:#ffdb57;}
.credits-status{position:fixed;bottom:16px;left:16px;right:16px;z-index:1;margin:0;text-align:center;background:#000;font:400 16px VT323,monospace;}
.credits-status:empty{display:none;}
.credits-close{position:fixed;top:16px;right:16px;z-index:1;border:0;padding:10px;background:#000;color:#fffbe2;font:400 20px VT323,monospace;cursor:pointer;}
#credits-screen[open] .credits-roll{animation:credits-roll 60s linear both;}
@keyframes credits-roll{from{top:100%;transform:translateY(0)}to{top:0;transform:translateY(-100%)}}
@media(prefers-reduced-motion:reduce){#credits-screen{overflow-y:auto;}#credits-screen[open] .credits-roll{position:relative;animation:none;top:0;transform:none;padding-top:64px;}}

/* Keep both swatches and every status control within a narrow game frame. */
@media(max-width:880px),(max-height:650px){
 .status-bar{font-size:8px}
 .status-totals,.status-toggles{gap:12px}
}
@media(max-width:560px),(max-height:420px){
 .status-bar{height:64px;flex-wrap:wrap;justify-content:center;gap:0;font-size:8px}
 .status-totals,.status-toggles{justify-content:space-between;width:100%;height:32px}
 .game-shell{width:min(100vw,calc((100svh - 112px)*64/39))}
}

/* The title uses the live coastal scenery at the game's native aspect ratio. */
.title-active .game-shell{width:min(100vw,calc(100svh*64/39))}
.title-active .status-bar,.title-active .command-panel,.title-active .hotkey-bar,.title-active #pause{display:none}
#title-screen{position:absolute;inset:0;z-index:4;width:100%;height:100%;margin:0;padding:0;border:0;border-radius:0;background:transparent;color:#fffbe2;container-type:inline-size;touch-action:manipulation}
#title-screen[hidden]{display:none}
#title-screen:focus-visible{outline:none}
#title-poster{position:absolute;inset:0;width:100%;height:100%;image-rendering:pixelated;image-rendering:crisp-edges;pointer-events:none}
#title-poster[hidden]{display:none}
#title-logo-wrap{position:absolute;top:4%;left:14.8%;width:64%;pointer-events:none}
#title-logo{display:block;width:100%;height:auto;image-rendering:pixelated;image-rendering:crisp-edges}
@supports (mask-image:url("")) or (-webkit-mask-image:url("")){
 #title-logo-wrap::after{content:'';position:absolute;inset:0;pointer-events:none;image-rendering:pixelated;background:linear-gradient(110deg,transparent 43%,rgba(255,255,230,.12)47%,rgba(255,255,240,.65)50%,rgba(255,255,230,.12)53%,transparent 57%);background-size:300% 100%;background-position:100% 0;opacity:0;-webkit-mask:url('./assets/ui/trenchers-logo-gold-mask.svg') center/100% 100% no-repeat;mask:url('./assets/ui/trenchers-logo-gold-mask.svg') center/100% 100% no-repeat;animation:logo-shine 4.4s linear infinite}
}
@keyframes logo-shine{0%,72%{background-position:100% 0;opacity:0}73%{background-position:100% 0;opacity:1}95%{background-position:0 0;opacity:1}96%,100%{background-position:0 0;opacity:0}}
@media(prefers-reduced-motion:reduce){#title-logo-wrap::after{animation:none;opacity:0}}
#title-menu{position:absolute;top:39.6%;left:0;width:100%;display:flex;flex-direction:column;align-items:center;gap:clamp(4px,.8cqw,10px)}
#title-menu button{position:relative;min-width:11em;margin:0;padding:.15em .5em;border:0;background:none;color:#ffda57;font:400 clamp(9.6px,1.6cqw,19.2px)/1.35 VT323,monospace;text-align:left;text-shadow:2px 2px #10232c;cursor:pointer}
#title-menu button::before,#title-menu button::after{content:'';position:absolute;left:-.45em;top:50%;width:.6em;height:.75em;transform:translateY(-50%);background:currentColor;clip-path:polygon(0 0,25% 0,25% 16%,50% 16%,50% 33%,75% 33%,75% 42%,100% 42%,100% 58%,75% 58%,75% 66%,50% 66%,50% 83%,25% 83%,25% 100%,0 100%);visibility:hidden}
#title-menu button::before{background:#000;transform:translate(2px,calc(-50% + 2px))}
#title-menu button.selected::before,#title-menu button.selected::after,#title-menu button:hover::before,#title-menu button:hover::after{visibility:visible}
#title-menu button:focus-visible{outline:none}
#title-menu button[hidden],#title-connect[hidden],#title-wallet-actions[hidden]{display:none}
#title-wallet-controls{position:absolute;top:16px;right:16px;z-index:2;display:flex;flex-direction:column;align-items:flex-end;gap:8px;font:400 clamp(9.6px,1.6cqw,19.2px)/1.35 VT323,monospace}
#title-connect{padding:.4em .6em;border:2px solid #ffda57;background:#10232ccc;color:#ffda57;font:inherit;text-shadow:2px 2px #10232c;cursor:pointer}
#title-connect:hover{background:#234553}#title-connect:disabled{opacity:.65;cursor:default}
#title-wallet-actions{display:flex;flex-direction:column;min-width:100%;padding:6px;border:2px solid #537e8b;background:#152f3b;box-shadow:2px 2px #0b1e29}
#title-wallet-actions button{padding:.5em .6em;border:0;background:none;color:#fffbe2;font:inherit;text-align:left;white-space:nowrap;cursor:pointer}
#title-wallet-actions button:hover,#title-wallet-actions button:focus-visible{background:#234553;color:#ffda57;outline:none}
#title-wallet-actions button:disabled{opacity:.65;cursor:default}
#title-wallet-status{position:absolute;top:60px;right:16px;max-width:80%;margin:0;color:#fffbe2;font:400 clamp(8px,1cqw,12px)/1.4 VT323,monospace;text-align:right;text-shadow:1px 1px #10232c}
#title-wallet-status:empty{display:none}
.title-dialog{width:min(680px,calc(100vw - 32px));padding:28px;font-size:16px;line-height:1.6}
.title-dialog::backdrop{background:#071722a6}
.title-dialog .inventory-header{justify-content:flex-start;padding-right:44px;margin-bottom:20px}
.title-dialog .inventory-header h1{font-size:24px;line-height:1.4;outline:none}
.title-dialog [data-title-dialog-close]:not(:disabled):is(:hover,:focus-visible),#wallet-close:not(:disabled):is(:hover,:focus-visible){background:#234553;border-color:#a2c2bd;outline:none}
.title-dialog p{margin:0 0 20px}
.title-dialog .title-dialog-lead{color:#ffda57}
.title-dialog .title-dialog-note{color:#a2c2bd;font-size:12px;line-height:1.6;margin-bottom:0}
.price-options{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px;margin:24px 0;padding:0;border:0;min-width:0}
.price-options legend{padding:0;margin-bottom:12px;color:#a2c2bd;font-size:12px}
.price-option{position:relative;display:flex;flex-direction:column;gap:12px;padding:20px 12px;border:2px solid #537e8b;box-shadow:2px 2px #0b1e29;background:#10232c;text-align:center;cursor:pointer}
.price-option input{position:absolute;inset:0;width:100%;height:100%;margin:0;opacity:0;cursor:pointer}
.price-option:has(input:checked){border-color:#ffda57;background:#234553;box-shadow:inset 0 0 0 2px #10232c,2px 2px #0b1e29}
.price-option:has(input:focus-visible){outline:2px solid #fffbe2;outline-offset:3px}
.price-option:hover{background:#234553}
.price-name{color:#a2c2bd;font-size:12px}
.price-option strong{color:#ffda57;font-size:20px;font-weight:400;white-space:nowrap}
.price-caption{font-size:12px;line-height:1.6}
.buy-game-button{display:block;width:100%;min-height:48px;padding:12px;margin:0 0 16px;border:2px solid #ffda57;background:#ffda57;color:#10232c;box-shadow:3px 3px #0b1e29;font:400 16px/1.4 VT323,monospace;cursor:pointer}
.buy-game-button:hover{background:#fff1a8}.buy-game-button:focus-visible{outline:2px solid #fffbe2;outline-offset:3px}.buy-game-button:disabled{opacity:.65;cursor:default}
.title-dialog [hidden]{display:none!important}
@media(max-width:600px){.title-dialog{padding:20px;font-size:12px}.title-dialog .inventory-header h1{font-size:20px}.price-options{grid-template-columns:1fr;gap:10px}.price-option{display:grid;grid-template-columns:1fr auto;gap:4px 12px;padding:12px 16px;text-align:left;align-items:center}.price-option strong{font-size:16px;grid-column:2;grid-row:1/3}.price-caption{grid-column:1;font-size:10px}.title-dialog .title-dialog-note{font-size:10px}}

/* Solid progress fill advances only as startup resources finish loading. */
.pixel-loading-bar{width:min(240px,56vw);height:28px;padding:4px;border:4px solid #ffedac;box-shadow:4px 4px #091a23;background:#0b202a;overflow:hidden}
.pixel-loading-bar>span{display:block;width:0;height:12px;background:#ffda57}

/* Scene overlays leave the score and command bars unobstructed. */
.scene-tools{position:absolute;inset:0;z-index:2;display:flex;align-items:flex-end;gap:16px;padding:0 16px 10px;pointer-events:none;font:400 clamp(8px,calc(1.12vw - 1.6px),14.4px)/1.4 VT323,monospace;color:#fffbe2;text-shadow:-1px -1px #000,0 -1px #000,1px -1px #000,-1px 0 #000,1px 0 #000,-1px 1px #000,0 1px #000,1px 1px #000}
.scene-tools button{pointer-events:auto;touch-action:manipulation;padding:0;border:0;background:none;color:inherit;font:inherit;text-shadow:inherit;cursor:pointer}
.scene-tools button:hover,.scene-tools button:focus-visible{color:#ffda57;outline:none}
.scene-tools kbd{border:0;color:#ffe67e;font:inherit}
.hotkey-bar{display:flex;flex-wrap:wrap;justify-content:flex-end;align-items:center;gap:8px;min-width:0;max-width:100%;margin-left:auto;white-space:nowrap}
.hotkey-bar button{display:flex;align-items:center;gap:6px;min-height:1.5em}
#full-game-shortcut-group:not([hidden]){display:flex;flex-shrink:0;align-items:center}
#full-game-shortcut{color:#ffe67e;min-height:1.5em;white-space:nowrap}
.movement-legend{line-height:1.5}
.arrow-keys{font-family:TrenchersArrows,VT323,monospace;display:inline-block;vertical-align:middle;transform:translateY(-.12em)}
.movement-divider{margin-left:4px;margin-right:2px}
.arrow-keys .left-arrow{margin-left:2px}
.arrow-keys .right-arrow{margin-left:4px}
@media(max-width:560px){.scene-tools{gap:10px;padding-left:10px;padding-right:10px}.hotkey-bar{gap:5px}.hotkey-bar button{gap:4px}}
.title-active .scene-tools,#stage[data-transition-active=true] .scene-tools,#stage[data-fumble-active=true] .scene-tools{display:none}
#map-dialog{width:fit-content;max-width:calc(100vw - 32px);padding:8px;overflow:hidden}
#world-map{display:block;width:auto;height:auto;max-width:calc(100vw - 56px);max-height:calc(100svh - 56px);image-rendering:pixelated}
#map-close{position:absolute;top:12px;right:12px;width:28px;height:28px;border:2px solid #537e8b;background:#152f3b;color:#fffbe2;font:400 14px VT323,monospace;cursor:pointer}
#map-dialog:focus{outline:none}
#map-close:is(:hover,:focus-visible){background:#234553;border-color:#a2c2bd;outline:none}
#stage[data-map-open=true] #pause{display:none}
#title-music-toggle{position:absolute;right:16px;bottom:12px;z-index:4;padding:4px;border:0;border-radius:0;background:transparent;color:#ffda57;font:400 12px/24px VT323,monospace;text-shadow:2px 2px #10232c;cursor:pointer;touch-action:manipulation}
#title-music-toggle[hidden],body:not(.title-active) #title-music-toggle{display:none}

.wallet-dialog{width:min(480px,calc(100vw - 32px));padding:24px}
.wallet-dialog .inventory-header{padding:0 36px 0 0;justify-content:flex-start}
.wallet-dialog .inventory-header h1{font-size:24px;line-height:1.4;text-shadow:none;outline:none}
#wallet-explanation{margin:0 0 20px;color:#c7d9d1;font-size:12px;line-height:1.6}
#wallet-options{display:grid;gap:12px}
.wallet-option{display:flex;align-items:center;justify-content:space-between;width:100%;min-height:52px;padding:12px 16px;border:2px solid #537e8b;background:#10232c;color:#fffbe2;font:400 16px/1.5 VT323,monospace;text-decoration:none;cursor:pointer;text-align:left}
.wallet-option:hover,.wallet-option:focus-visible{background:#234553;color:#ffda57;outline:2px solid #ffda57;outline-offset:2px}
.wallet-option:disabled{opacity:.55;cursor:wait}
.wallet-option span{font-size:12px;color:#a2c2bd}

#game-wallet-button{text-transform:none;white-space:nowrap}
#game-wallet-button[hidden]{display:none}
#game-wallet-button:hover{color:#537e8b}
#game-wallet-dialog .inventory-header h1{font-size:24px;outline:none}
#game-wallet-address{margin:0 0 20px;color:#ffda57;text-align:center}
.game-wallet-actions{display:grid;gap:12px}
#game-wallet-status{margin:16px 0 0;font-size:12px;line-height:1.5}
#game-wallet-status:empty{display:none}
#game-wallet-close:not(:disabled):is(:hover,:focus-visible){background:#234553;border-color:#a2c2bd;outline:none}
#wallet-session{margin-bottom:16px}
#wallet-address{margin:0 0 12px;color:#a2c2bd;font-size:12px;overflow-wrap:anywhere}
#wallet-continue{color:#ffda57}
#wallet-status{margin:16px 0 0;color:#a2c2bd;font-size:12px;line-height:1.6}
#wallet-status:empty{display:none}
.wallet-dialog [hidden]{display:none!important}
@media(max-width:480px){.wallet-dialog{padding:20px}.wallet-dialog .inventory-header h1{font-size:20px}}

#leaderboard-dialog{width:min(760px,calc(100vw - 32px));max-height:85svh;overflow:hidden}
#leaderboard-dialog[open]{display:flex;flex-direction:column}
#leaderboard-dialog .inventory-header{flex-shrink:0;margin-bottom:8px}
#leaderboard-dialog [hidden]{display:none!important}
#leaderboard-close:not(:disabled):is(:hover,:focus-visible),#leaderboard-retry:is(:hover,:focus-visible),#leaderboard-pages button:not(:disabled):is(:hover,:focus-visible){background:#234553;border-color:#a2c2bd;outline:none}
#leaderboard-dialog .leaderboard-scroll{min-height:0;overflow:auto}
#leaderboard-table caption{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
#leaderboard-table{width:100%;border-collapse:collapse;font-size:14px;line-height:1.4;margin:8px 0}
#leaderboard-table thead{position:sticky;top:0;background:#152f3b}
#leaderboard-table th{text-align:left;color:#ffda57;font-weight:normal}
#leaderboard-table th,#leaderboard-table td{padding:6px 8px;border-bottom:2px solid #315462;white-space:nowrap}
#leaderboard-table td:last-child,#leaderboard-table th:last-child{text-align:right}
#leaderboard-table tr[data-self=true]{color:#ffda57}
#leaderboard-standing{position:sticky;bottom:0;background:#152f3b}
#leaderboard-standing td{border-top:4px solid #527786;padding-top:12px}
#leaderboard-pages{display:flex;align-items:center;justify-content:space-between;flex-shrink:0;gap:12px;font-size:12px;margin-top:16px}
#leaderboard-pages button{padding:8px;border:2px solid #537e8b;box-shadow:2px 2px #0b1e29;background:#1a3540;color:#fffbe2;font:inherit;cursor:pointer}
#leaderboard-pages button:disabled{opacity:.4;cursor:default}
.scene-links{display:flex;align-items:center;gap:1.2em;flex-shrink:0}
.scene-links button{color:#fffbe2;white-space:nowrap;min-height:1.5em}
@media(max-width:600px){#leaderboard-table,#leaderboard-pages{font-size:10px}#leaderboard-table th,#leaderboard-table td{padding:8px 4px}.scene-links{gap:.7em}}
