/* Original ChessDGX developer-only tools; keep the lower flight controls clear. */
#shooter-debug{position:fixed;z-index:100000;right:max(8px,env(safe-area-inset-right));top:calc(env(safe-area-inset-top,0px) + 4px);width:60px;max-height:calc(100dvh - env(safe-area-inset-top,0px) - 60px);overflow:auto;border:1px solid #83e0cc;border-radius:8px;background:#0c2637f5;color:#f4fbff;font:11px/1.4 system-ui;text-align:left;touch-action:pan-y;box-sizing:border-box;scrollbar-color:#86b6c4 #0c2637}
#shooter-debug[open]{width:min(360px,calc(100vw - env(safe-area-inset-left,0px) - env(safe-area-inset-right,0px) - 16px));max-height:min(50dvh,calc(100dvh - env(safe-area-inset-top,0px) - 60px))}
#shooter-debug summary{display:flex;align-items:center;justify-content:center;gap:4px;min-height:28px;padding:0 6px;cursor:pointer;font-weight:700;list-style:none;box-sizing:border-box;user-select:none}
#shooter-debug summary::-webkit-details-marker{display:none}
#shooter-debug summary::before{content:'+';font-size:14px;color:#83e0cc}
#shooter-debug[open] summary::before{content:'−'}
#shooter-debug[open] summary{justify-content:flex-end;border-bottom:1px solid #38566a}
#shooter-debug .debug-heading{width:100%;margin:0;font-weight:700}
#shooter-debug .debug-body{display:flex;flex-wrap:wrap;gap:6px;padding:8px}
#shooter-debug pre{white-space:pre-wrap;overflow-wrap:anywhere;width:100%;margin:0 0 6px;font:12px/1.5 monospace}
#shooter-debug button,#shooter-debug select,#shooter-debug input[type=number]{min-height:44px;background:#214a62;color:#fff;border:1px solid #86b6c4;border-radius:6px;padding:6px;font:inherit;width:auto;max-width:100%;box-sizing:border-box;box-shadow:none;letter-spacing:normal}
#shooter-debug label{display:flex;align-items:center;gap:6px;min-height:44px}
#shooter-debug input[type=number]{width:60px}
#shooter-debug :focus-visible{outline:3px solid #ffd88e;outline-offset:-3px}

/* Dock alongside sound/pause; the panel floats without resizing the toolbar. */
#shooter-debug,#shooter-debug[open]{position:relative;pointer-events:auto;inset:auto;flex:0 0 32px;width:32px;height:32px;max-height:none;overflow:visible;align-self:center}
#shooter-debug summary,#shooter-debug[open] summary{height:32px;min-height:32px;padding:0;justify-content:center;border:0;font-size:22px}
#shooter-debug summary::before{content:none!important}
#shooter-debug .debug-body{position:fixed;right:max(8px,env(safe-area-inset-right));top:calc(env(safe-area-inset-top,0px) + 64px);width:min(360px,calc(100vw - 16px));max-height:50dvh;overflow:auto;background:#0c2637fa;border:1px solid #83e0cc;border-radius:8px;box-sizing:border-box}
#shooter-debug:not([open]) .debug-body{display:none}

#objectives{position:fixed;top:calc(env(safe-area-inset-top,0px) + 118px);left:8px;z-index:8;max-width:calc(100vw - 16px);font:12px/1.4 system-ui;color:#efffff;background:#123744dd;border:1px solid #76b7bf;border-radius:6px;padding:4px 8px;pointer-events:none;box-sizing:border-box}
html.shooter-debug-enabled #hud .status .row{display:flex;flex-wrap:wrap;justify-content:flex-end}
html.shooter-debug-enabled #hud .status .lives{flex:1 1 100%}

/* The summary fits the border's inner box; no font baseline offset. */
#shooter-debug summary,#shooter-debug[open] summary{box-sizing:border-box;width:100%;height:100%;min-height:0;display:grid;place-items:center;line-height:1;letter-spacing:0;text-indent:0}
#shooter-debug summary svg{display:block;width:16px;height:16px}
#flight-options{flex:0 0 32px;width:32px;height:32px;min-height:32px;padding:0;border:1px solid #83e0cc;border-radius:9px;background:#123342;color:#efffff;font:20px/1 system-ui;display:grid;place-items:center;pointer-events:auto;align-self:center}
#flight-preferences{box-sizing:border-box;width:min(420px,calc(100vw - 24px));max-height:calc(100dvh - 32px);overflow:auto;padding:20px;background:#123342;color:#efffff;border:1px solid #83e0cc;border-radius:14px;font:16px/1.5 system-ui;text-align:start}
#flight-preferences::backdrop{background:#06101ccc}
#flight-preferences h2{font-size:22px;margin:0 0 18px}
#flight-preferences label{display:flex;align-items:center;justify-content:space-between;gap:12px;min-height:48px}
#flight-preferences input[type=range]{width:46%;accent-color:#83e0cc}
#flight-preferences select,#flight-preferences button{min-height:44px;background:#215369;color:#fff;border:1px solid #83e0cc;border-radius:8px;padding:8px 12px;font:inherit}
#flight-preferences button{margin:14px 8px 0 0}
#flight-preferences :focus-visible,#flight-options:focus-visible{outline:3px solid #ffdb87;outline-offset:2px}
.flight-low-life{outline:2px solid #ffbc80!important;background:#452737!important}
#shooter-debug summary{position:relative;font-size:0!important}
#shooter-debug summary::after{content:'';display:block;width:14px;height:14px;background:linear-gradient(#efffff,#efffff) center/3px 14px no-repeat,linear-gradient(#efffff,#efffff) center/14px 3px no-repeat}
#shooter-debug summary::after{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%)}

/* One physical target size for every flight toolbar control, across input modes. */
:root{--flight-tool-size:44px}
.hud .tools>button,#wrap #hud .status .row>#muteBtn,#wrap #hud .status .row>#pauseBtn,#flight-options,#shooter-debug,#shooter-debug[open]{box-sizing:border-box;flex:0 0 var(--flight-tool-size);width:var(--flight-tool-size);height:var(--flight-tool-size);min-width:var(--flight-tool-size);min-height:var(--flight-tool-size);max-width:var(--flight-tool-size);max-height:var(--flight-tool-size);padding:0;border:1px solid #83e0cc;border-radius:10px;background:#123342;color:#efffff;align-self:center;display:grid;place-items:center}
.hud .tools>button svg,#wrap #hud .status .row>button svg{width:20px;height:20px}
#flight-preferences dl{display:grid;grid-template-columns:1fr auto;gap:8px 16px;margin:16px 0}
#flight-preferences dt,#flight-preferences dd{margin:0;overflow-wrap:anywhere}
#flight-preferences dd{font-variant-numeric:tabular-nums}
#flight-preferences ul{padding-inline-start:20px}
#flight-preferences li{margin-block:12px}
#flight-preferences small{display:block;color:#c0dbe3}

@media(max-width:600px){.hud{flex-wrap:wrap}.hud .tools{flex:1 1 100%;gap:6px}.hud .panel{max-width:100%}.hud~.stack{top:calc(env(safe-area-inset-top,0px) + 150px)}}
/* Let the full four-button row use its true width; do not wrap only the gear. */
#wrap #hud .status .row{width:max-content;max-width:calc(100vw - 20px);display:flex;flex-wrap:wrap;gap:4px;justify-content:flex-end}
#wrap #hud .status .row .lives{flex:1 0 100%;box-sizing:border-box}
#wrap #hud .status .row{width:188px}
#objectives{top:calc(var(--flight-hud-bottom,112px) + 6px)}
#game-container~.stack{top:calc(var(--flight-hud-bottom,112px) + 42px)}
@media(max-width:360px){#wrap #hud .status{top:110px;width:calc(100% - 20px);max-width:none}#wrap #hud .score{width:calc(100% - 20px);max-width:none}#wrap #hud .status .row{width:100%;flex-wrap:nowrap}#wrap #hud .status .row .lives{flex:1 1 auto;min-width:0}}
#shooter-debug .debug-body{top:calc(var(--flight-hud-bottom,56px) + 8px);max-height:min(50dvh,calc(100dvh - var(--flight-hud-bottom,56px) - 24px))}
#shooter-debug,#shooter-debug[open]{display:block}
#wrap #hud.boss .buffs{position:static;transform:none;flex-direction:column;max-width:100%}

/* Keep controls above telemetry on phones; never wrap them below the score. */
@media (max-width:900px),(pointer:coarse){
 .hud .tools.flight-toolbar,#wrap #hud .status .row.flight-toolbar{position:fixed;top:calc(var(--flight-visible-top,0px) + max(8px,env(safe-area-inset-top,0px)));right:max(8px,env(safe-area-inset-right,0px));left:auto;width:max-content;max-width:calc(100vw - 16px);flex:none;flex-wrap:nowrap;z-index:30;gap:4px}
 .hud:has(.flight-toolbar){top:calc(max(8px,env(safe-area-inset-top,0px)) + 52px)}
 #wrap #hud .score,#wrap #hud .status{top:calc(max(8px,env(safe-area-inset-top,0px)) + 52px)}
}
@media(max-width:360px){#wrap #hud .status{top:calc(max(8px,env(safe-area-inset-top,0px)) + 152px)}}

/* Unified top cockpit: intrinsic rows, no independent floating telemetry. */
.hud.flight-cockpit,#wrap #hud .flight-cockpit{position:fixed;inset:auto;top:calc(var(--flight-visible-top,0px) + max(8px,env(safe-area-inset-top,0px)));left:max(8px,env(safe-area-inset-left,0px));right:max(8px,env(safe-area-inset-right,0px));display:grid;grid-template-columns:minmax(0,1fr) auto;gap:5px 8px;padding:6px 8px;border:1px solid #699dc5;border-radius:12px;background:#10283ced;z-index:2;pointer-events:none;line-height:1.3;font-variant-numeric:tabular-nums}
.flight-cockpit .panel,#wrap #hud .flight-cockpit .score,#wrap #hud .flight-cockpit .status{display:contents}
.hud.flight-cockpit .tools.flight-toolbar,#wrap #hud .flight-cockpit .status .row.flight-toolbar{position:static;inset:auto;grid-column:2;grid-row:1;width:max-content;max-width:none;flex-wrap:nowrap;gap:4px;align-self:center}
.flight-cockpit .score-line,#wrap #hScore{grid-row:1;grid-column:1;align-self:center;min-width:0}
.flight-cockpit .score-line strong,#wrap #hScore{font:800 clamp(17px,4.8vw,24px)/1.15 system-ui;color:#b6f1f6;letter-spacing:0;text-shadow:none;overflow-wrap:anywhere}
.flight-cockpit .meta{grid-row:2;grid-column:1;gap:8px;font-size:12px}
.flight-cockpit .sub{grid-row:2;grid-column:2;justify-self:end;white-space:normal;font-size:11px}
.flight-cockpit #weapon-levels,#wrap .flight-cockpit #hPower{grid-row:3;grid-column:1/-1;display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;margin:0;padding:4px 0;border:0;border-top:1px solid #426278;background:none;border-radius:0;letter-spacing:0}
.flight-cockpit .weapon-level{grid-template-columns:repeat(5,5px) minmax(22px,1fr);gap:2px;line-height:1.25}
.flight-cockpit .weapon-level span{grid-column:1/-1;white-space:normal;font-size:11px;color:#d9e6f4;overflow-wrap:anywhere}
.flight-cockpit #objectives{position:static;inset:auto;grid-column:1/-1;grid-row:4;width:auto;max-width:none;transform:none;padding:3px 0;border:0;border-top:1px solid #426278;border-radius:0;background:none;font-size:11px;white-space:normal}
.flight-cockpit .stack{position:static;inset:auto;grid-column:1/-1;grid-row:5;gap:4px;align-items:stretch}
.flight-cockpit .pills{justify-content:flex-start;gap:4px}
.flight-cockpit .pill{padding:2px 6px;font-size:11px;letter-spacing:0;box-shadow:none}
.flight-cockpit #boss-hud{max-width:none;font-size:11px}
#wrap .flight-cockpit .score .lbl{display:none}
#wrap .flight-cockpit #hSub{grid-row:2;grid-column:1/-1;font-size:11px;margin:0}
#wrap .flight-cockpit .coins{grid-row:3;grid-column:1;margin:0}
#wrap .flight-cockpit #hLives{grid-row:3;grid-column:2;justify-self:end;padding:0;border:0;background:none}
#wrap .flight-cockpit #hPower{grid-row:4}
#wrap .flight-cockpit #objectives{grid-row:5}
#wrap #hud .flight-cockpit #hBuffs{position:static;transform:none;grid-row:6;grid-column:1/-1;flex-direction:row;flex-wrap:wrap;justify-content:flex-start;gap:4px}
#wrap .flight-cockpit .chip{min-width:0;font-size:11px;padding:2px 5px}
#wrap #hud .flight-cockpit #hCombo{position:static;inset:auto;grid-row:7;grid-column:1/-1;transform:none;display:none;align-items:center;gap:6px}
#wrap #hud .flight-cockpit #hCombo.on{display:flex}
#wrap .flight-cockpit #hCombo b{font-size:14px;text-shadow:none}
#wrap .flight-cockpit #hCombo span,#wrap .flight-cockpit #hCombo small{font-size:10px;letter-spacing:0;margin:0}
#wrap .flight-cockpit #hCombo .bar{margin:0;width:48px}
@media(min-width:600px){
 .hud.flight-cockpit,#wrap #hud .flight-cockpit{grid-template-columns:minmax(120px,1fr) minmax(220px,2fr) auto}
 .hud.flight-cockpit .tools.flight-toolbar,#wrap #hud .flight-cockpit .status .row.flight-toolbar{grid-column:3}
 .flight-cockpit .meta{grid-row:1;grid-column:2}
 .flight-cockpit .sub{grid-row:2;grid-column:1;justify-self:start}
 .flight-cockpit #weapon-levels,#wrap .flight-cockpit #hPower{grid-row:2;grid-column:2/4;border:0;padding:0}
 .flight-cockpit #objectives{grid-row:3;grid-column:1/3}
 .flight-cockpit .stack{grid-row:3;grid-column:3}
 #wrap .flight-cockpit #hSub{grid-row:2;grid-column:1}
 #wrap .flight-cockpit .coins{grid-row:1;grid-column:2;padding-right:72px;box-sizing:border-box}
 #wrap .flight-cockpit #hLives{grid-row:1;grid-column:2;justify-self:end}
 #wrap .flight-cockpit #objectives{grid-row:3;grid-column:1/3}
 #wrap #hud .flight-cockpit #hBuffs{grid-row:3;grid-column:3}
 #wrap #hud .flight-cockpit #hCombo{grid-row:4}
}

/* Lightweight telemetry: transparent playfield, readable text, full-size touch targets. */
.hud.flight-cockpit,#wrap #hud .flight-cockpit{gap:2px 6px;padding:4px 6px;background:rgba(10,29,45,.24);border-color:rgba(131,224,204,.25);border-radius:8px;text-shadow:0 1px 3px #061521,0 0 2px #061521}
.flight-cockpit .score-line strong,#wrap #hScore{font-size:18px;text-shadow:0 1px 3px #061521}
.flight-cockpit #weapon-levels,#wrap .flight-cockpit #hPower{padding:1px 0;border:0;gap:6px;width:100%}
.flight-cockpit .weapon-level{display:flex;align-items:center;gap:3px;font-size:11px}
.flight-cockpit .weapon-level span{flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0}
.flight-cockpit .weapon-level i{display:none}
.flight-cockpit .weapon-level b{font-size:11px;flex:none}
.flight-cockpit #objectives{padding:1px 0;border:0}
.flight-cockpit .pill,#wrap .flight-cockpit .chip{background:rgba(10,29,45,.22);border-color:rgba(131,224,204,.3);padding:1px 4px;font-size:11px;min-height:0}
#wrap .flight-cockpit .chip .ico{font-size:12px;width:16px;height:16px}
#wrap .flight-cockpit .coins{font-size:12px}
#wrap .flight-cockpit .coins svg{width:14px;height:14px}
#wrap #hud .flight-cockpit #hCombo{gap:4px}
#wrap .flight-cockpit #hCombo b{font-size:12px}
#wrap .flight-cockpit #hCombo small,#wrap .flight-cockpit #hCombo .bar{display:none}
@media(max-width:599px){
 #wrap .flight-cockpit #hSub{grid-row:2;grid-column:1/-1}
 #wrap .flight-cockpit .coins{grid-row:3;grid-column:1}
 #wrap .flight-cockpit #hLives{grid-row:3;grid-column:2}
 #wrap #hud .flight-cockpit #hBuffs{grid-row:6;grid-column:1}
 #wrap #hud .flight-cockpit #hCombo{grid-row:6;grid-column:2;justify-self:end}
}
