*{box-sizing:border-box}html,body{margin:0;min-height:100%;background:#050918;color:#d8ecff;font-family:Consolas,monospace}body{padding:clamp(8px,2vw,24px);background:radial-gradient(ellipse at top,#182845,#050918 70%)}header,main,footer{max-width:1200px;margin:auto}header{display:flex;justify-content:space-between;align-items:baseline;gap:12px}h1{font-size:clamp(20px,4vw,34px);letter-spacing:.22em;color:#8cebe9;text-shadow:0 0 20px #38bed777}header p,footer{font-size:clamp(9px,1.4vw,12px);color:#9cb2cc;letter-spacing:.06em}#stage{position:relative;aspect-ratio:16/9;border:2px solid #385b75;box-shadow:0 0 0 5px #101a2b,0 12px 40px #0008;overflow:hidden;touch-action:none}canvas{width:100%;height:100%;display:block;image-rendering:pixelated;touch-action:none}#fullscreen{position:absolute;right:10px;top:10px;background:#08182bc9;border:1px solid #6f9ab5;color:#def6ff;border-radius:3px;font-size:23px;width:38px;height:38px;cursor:pointer}footer{display:flex;align-items:center;justify-content:space-between;gap:15px;flex-wrap:wrap;padding-top:20px}select{background:#15263a;color:#d8ecff;border:1px solid #56758f;padding:7px;border-radius:3px;font:inherit}#joystick{display:none;position:absolute;left:7%;bottom:8%;width:100px;height:100px;border:2px solid #82e4ed88;border-radius:50%;background:#26536a66;touch-action:none}#stick{position:absolute;left:50%;top:50%;width:42px;height:42px;border:1px solid #a8f7f5;background:#7ddfe688;border-radius:50%;transform:translate(-50%,-50%)}@media(pointer:coarse){#stage.joystick #joystick{display:block}}@media(max-width:600px){header{align-items:center}header p{max-width:125px;text-align:right}#joystick{width:75px;height:75px}#stick{width:32px;height:32px}}#stage:fullscreen{width:100vw;height:100vh;aspect-ratio:auto;border:0;display:flex;align-items:center;justify-content:center;background:#050918}#stage:fullscreen canvas{width:min(100vw,177.7778vh);height:min(100vh,56.25vw)}#stage:fullscreen #joystick{bottom:8%;left:7%}
#fireButton{display:none;position:absolute;right:8%;bottom:12%;width:76px;height:76px;border-radius:50%;border:2px solid #f9d58c;background:#aa592b99;color:#fff0ca;font-weight:bold;font-family:inherit;letter-spacing:.1em;touch-action:none;user-select:none;-webkit-user-select:none}#stage.manual-fire #fireButton{display:block}@media(pointer:fine){#fireButton{display:none!important}}@media(max-width:600px){#fireButton{width:55px;height:55px;font-size:10px}}#stage:fullscreen #fireButton{right:8%;bottom:12%}

#gameOverPanel[hidden]{display:none!important}#gameOverPanel{position:absolute;z-index:5;inset:0;display:flex;flex-direction:column;justify-content:center;align-items:center;gap:20px;background:#030a19cc;color:#ffcb9c;font-size:clamp(22px,5vw,44px);letter-spacing:.15em;text-align:center}#restartButton{cursor:pointer;background:#16364a;color:#c6fcff;border:2px solid #5de0ed;padding:12px 22px;font:700 16px Consolas,monospace;letter-spacing:.08em;touch-action:manipulation}#restartButton:focus-visible{outline:3px solid #fff;outline-offset:3px}

/* NEXORYS T07-IMP-06: compact, touch-friendly sound panel. */
#audioControls{position:absolute;z-index:7;top:10px;right:58px;font:12px Consolas,monospace;touch-action:manipulation}
#audioToggle{min-width:38px;height:38px;border:1px solid #6f9ab5;border-radius:3px;background:#08182be8;color:#def6ff;font:22px Consolas,monospace;cursor:pointer;touch-action:manipulation}
#audioPanel[hidden]{display:none!important}
#audioPanel{position:absolute;right:0;top:45px;width:min(250px,calc(100vw - 28px));max-height:min(330px,calc(100vh - 90px));overflow:auto;display:flex;flex-direction:column;gap:8px;padding:14px;background:#0a1a2bf5;color:#d8ecff;border:1px solid #527b96;border-radius:5px;box-shadow:0 8px 25px #0009;touch-action:pan-y}
#audioPanel strong{font-size:13px;letter-spacing:.1em}
#audioPanel label{display:flex;align-items:center;justify-content:space-between;gap:8px}
#audioPanel input[type=range]{width:100%;min-height:28px;accent-color:#75e0e6;touch-action:pan-x}
#audioPanel .audioMute{justify-content:flex-start;min-height:34px;cursor:pointer}
#audioPanel .audioMute input{width:19px;height:19px;accent-color:#75e0e6}
#audioPanel small{font-size:10px;line-height:1.4;color:#9fc1d7}
#audioToggle:focus-visible,#audioPanel input:focus-visible{outline:2px solid #fff;outline-offset:2px}
@media(max-width:600px){#audioControls{top:6px;right:49px}#audioToggle{width:34px;min-width:34px;height:34px;font-size:19px}#audioPanel{top:40px;width:min(235px,calc(100vw - 18px));padding:12px}}
#stage:fullscreen #audioControls{top:10px;right:58px}

/* T07-COR-01: keep sound controls reachable on narrow mobile stages. */
#audioTest{min-height:36px;padding:7px 10px;border:1px solid #75e0e6;background:#15344a;color:#d8ecff;font:700 12px Consolas,monospace;cursor:pointer;touch-action:manipulation}
#audioPanel small{display:block;min-height:28px;overflow-wrap:anywhere}
@media(max-width:600px){#audioControls{top:4px;right:48px}#audioToggle{min-width:36px;width:36px;height:36px}#audioPanel{position:fixed;top:clamp(12px,14vh,90px);left:12px;right:12px;width:auto;max-height:calc(100dvh - 24px);z-index:20;padding:14px;box-shadow:0 12px 35px #000d}}

/* T07-COR-02: standalone diagnostic section outside clipped game stage. */
#audioDiagnostics{max-width:1200px;margin:16px auto 0;padding:14px;border:1px solid #527b96;border-radius:5px;background:#0a1a2b;color:#d8ecff;font:12px Consolas,monospace;display:flex;flex-direction:column;gap:10px;overflow:visible}
#audioDiagnostics strong{color:#8cebe9;letter-spacing:.05em}
#audioDiagnosticsText{margin:0;padding:10px;background:#061322;border:1px solid #34546b;white-space:pre-wrap;overflow-wrap:anywhere;font:12px/1.6 Consolas,monospace;color:#d8ecff;user-select:text;-webkit-user-select:text}
#audioDiagnosticsTest{align-self:flex-start;max-width:100%;min-height:42px;padding:9px 12px;background:#15344a;border:1px solid #75e0e6;color:#d8ecff;font:700 12px Consolas,monospace;cursor:pointer;touch-action:manipulation}
/* First power-meter increment: only SPEED is available. */
#powerMeter{position:absolute;left:50%;bottom:8px;transform:translateX(-50%);width:62%;max-width:650px;text-align:center;font:11px Consolas,monospace;touch-action:manipulation}
#powerMeter small{display:block;color:#ffe3a1;font-size:10px;margin-bottom:5px;text-shadow:0 1px 3px #000}
#powerMeter>div{display:flex;gap:3px;padding:4px;background:#050c1de6;border:1px solid #45647d;border-radius:4px}
#powerMeter button,#powerMeter span{flex:1;min-width:0;padding:8px 2px;font:inherit;letter-spacing:0;border:1px solid #3e536b;border-radius:2px}
#powerMeter span{color:#66798e;background:#101b2b;display:flex;align-items:center;justify-content:center}
#upgradeButton{color:#a6bacd;background:#15263b;cursor:pointer;touch-action:manipulation}
#upgradeButton:disabled{cursor:default}
#upgradeButton.ready{color:#1b1321;background:#ffce7e;border-color:#fff0b9;box-shadow:0 0 12px #ffb44f77;font-weight:bold}
#upgradeButton:focus-visible{outline:2px solid white;outline-offset:2px}
@media(max-width:600px){#powerMeter{width:66%;bottom:4px;font-size:7px}#powerMeter small{font-size:7px;margin-bottom:3px}#powerMeter>div{gap:2px;padding:2px}#powerMeter button,#powerMeter span{padding:6px 1px}#powerMeter button{min-height:32px}}

#missileButton{color:#a6bacd;background:#15263b;cursor:pointer;touch-action:manipulation}
#missileButton:disabled{cursor:default}
#missileButton.equipped{border-color:#75d6d2;color:#75d6d2}
#missileButton.ready{color:#1b1321;background:#ffce7e;border-color:#fff0b9;box-shadow:0 0 12px #ffb44f77;font-weight:bold}
#missileButton:focus-visible{outline:2px solid white;outline-offset:2px}

#doubleButton{color:#a6bacd;background:#15263b;cursor:pointer;touch-action:manipulation}
#doubleButton:disabled{cursor:default}
#doubleButton.equipped{border-color:#b4a2ff;color:#b4a2ff}
#doubleButton.ready{color:#1b1321;background:#ffce7e;border-color:#fff0b9;box-shadow:0 0 12px #ffb44f77;font-weight:bold}
#doubleButton:focus-visible{outline:2px solid white;outline-offset:2px}

#laserButton{color:#a6bacd;background:#15263b;cursor:pointer;touch-action:manipulation}
#laserButton:disabled{cursor:default}
#laserButton.equipped{border-color:#69ebff;color:#69ebff}
#laserButton.ready{color:#1b1321;background:#ffce7e;border-color:#fff0b9;box-shadow:0 0 12px #ffb44f77;font-weight:bold}
#laserButton:focus-visible{outline:2px solid white;outline-offset:2px}

#optionButton{color:#a6bacd;background:#15263b;cursor:pointer;touch-action:manipulation}
#optionButton:disabled{cursor:default}
#optionButton.equipped{border-color:#ffbd64;color:#ffbd64}
#optionButton.ready{color:#1b1321;background:#ffce7e;border-color:#fff0b9;box-shadow:0 0 12px #ffb44f77;font-weight:bold}
#optionButton:focus-visible{outline:2px solid white;outline-offset:2px}

#shieldButton{color:#a6bacd;background:#15263b;cursor:pointer;touch-action:manipulation}
#shieldButton:disabled{cursor:default}
#shieldButton.equipped{border-color:#59e5cd;color:#59e5cd}
#shieldButton.ready{color:#1b1321;background:#ffce7e;border-color:#fff0b9;box-shadow:0 0 12px #ffb44f77;font-weight:bold}
#shieldButton:focus-visible{outline:2px solid white;outline-offset:2px}

[hidden]{display:none!important}
#stage.in-menu{min-height:620px;aspect-ratio:auto}
#stage.in-menu canvas{position:absolute;inset:0;opacity:.45}
#stage.in-menu #powerMeter,#stage.in-menu #joystick,#stage.in-menu #fireButton{display:none!important}
#menuPanel{position:absolute;inset:0;z-index:6;overflow:auto;touch-action:pan-y;background:linear-gradient(130deg,#091428f0,#152c44de);padding:58px 28px 28px}
.menu-screen{max-width:760px;margin:auto;display:flex;flex-direction:column;align-items:center;gap:20px;text-align:center}
.menu-screen h2{margin:0;color:#e3f4ff;font-size:clamp(22px,4vw,34px)}
.menu-screen p{line-height:1.6;margin:0;color:#adc8dd;max-width:590px}
.eyebrow{letter-spacing:.12em;color:#70d5db;font-size:11px}
.menu-screen button,#continueButton,#menuButton{font:700 13px Consolas,monospace;border:1px solid #577a98;background:#112b43;color:#daefff;border-radius:4px;min-height:44px;padding:12px 20px;cursor:pointer;touch-action:manipulation}
.menu-screen button:hover,.menu-screen button:focus-visible{background:#24475e;outline:2px solid #95edef;outline-offset:2px}
.menu-screen .primary{background:#8fe8df;color:#092434;border-color:#bdfff3;min-width:200px}
.menu-screen .title-logo{font-size:clamp(36px,8vw,78px);letter-spacing:.18em;color:#a2f4ed;text-shadow:0 0 35px #39a8b5}
#titleScreen{padding-top:20px}
#titleScreen>small:last-child{color:#8aaac3;line-height:1.6}
.menu-ship{width:170px;height:70px;background:linear-gradient(90deg,#63e2e5,#eaf8ff 70%,#72b8d5);clip-path:polygon(0 40%,30% 30%,40% 0,70% 30%,100% 50%,70% 70%,40% 100%,30% 70%,0 60%,15% 50%);animation:menu-flight 3s ease-in-out infinite}
@keyframes menu-flight{50%{transform:translateY(-10px)}}
@media(prefers-reduced-motion:reduce){.menu-ship{animation:none}}
.choice-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:12px;width:100%}
.choice-grid button{min-height:150px;text-align:left;border-top:3px solid #79ded8}
.choice-grid small{display:block;font-weight:400;font-size:11px;line-height:1.7;color:#a9c4d8;margin-top:14px}
.menu-screen label{display:flex;flex-direction:column;gap:8px;text-align:left;width:100%;font-size:11px;color:#a5cfdf}
.menu-screen select{width:100%;min-height:44px;font-size:12px}
.loadout-grid{display:grid;grid-template-columns:1fr 1fr;gap:16px;width:100%}
.menu-screen .menu-note{font-size:11px;max-width:720px}
.menu-actions{display:flex;gap:12px;flex-wrap:wrap;justify-content:center}
#continueButton{background:#286155;border-color:#8fe8df}
#menuButton{font-size:12px;min-height:36px;padding:8px 14px}
#gameOverPanel{gap:12px}
@media(max-width:600px){#stage.in-menu{min-height:730px}#menuPanel{padding:58px 14px 22px}.choice-grid{grid-template-columns:1fr;gap:8px}.choice-grid button{min-height:90px}.choice-grid small{margin-top:6px}.loadout-grid{gap:12px;grid-template-columns:1fr}.menu-screen{gap:14px}.eyebrow{font-size:9px}.menu-screen .menu-note{font-size:10px}#loadoutScreen{padding-bottom:20px}#gameOverPanel{letter-spacing:.05em;gap:7px}#gameOverPanel button{min-height:32px;padding:6px 12px;font-size:11px}}

.menu-screen .primary:hover,.menu-screen .primary:focus-visible{background:#b4fff1;color:#092434}
#fullscreen{z-index:7}

#stage.in-menu{touch-action:pan-y}
#stage.in-menu:fullscreen{min-height:0;height:100dvh}

#loadoutScreen{max-width:1040px;gap:16px}
#visualEquipment{width:100%;display:flex;flex-direction:column;align-items:center;gap:14px}
#presetCards{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px;width:100%}
.menu-screen .preset-card{display:flex;flex-direction:column;align-items:stretch;text-align:left;padding:12px;gap:5px;background:#0b1b31;border:2px solid #385772}
.preset-card>strong{color:#83dce1;font-size:11px;letter-spacing:.12em}
.preset-card>span{font-size:17px;color:#e5f5ff}
.preset-pictures{display:grid;gap:3px;margin-top:8px}
.preset-pictures>div{border-top:1px solid #244158;padding-top:5px}
.preset-pictures small{font-size:8px;color:#abc4d9;display:block}
.preset-pictures svg{display:block;width:100%;height:52px}
.menu-screen button[aria-pressed=true]{border-color:#9af4df;background:#173e4a;box-shadow:0 0 0 1px #9af4df44}
.preset-check{font-size:10px;color:#aac8d9;text-align:center;margin-top:6px;padding-top:8px;border-top:1px solid #385772}
.preset-card[aria-pressed=true] .preset-check{color:#b4ffe9}
.preset-card[aria-pressed=true] .preset-check::before{content:'✓ '}
#equipmentSummary{font-size:11px;color:#9ee5da;min-height:18px}
#customOptions{width:100%}
.variant-group{border:0;padding:0;margin:0 0 20px;text-align:left}
.variant-group legend{font-size:11px;color:#88dbe0;letter-spacing:.1em;padding:0;margin-bottom:10px}
.variant-cards{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px}
.menu-screen .variant-card{padding:10px;display:flex;flex-direction:column;gap:6px;align-items:stretch;text-align:left;border:2px solid #385772;background:#0b1b31}
.variant-card svg{display:block;width:100%;height:72px}
.variant-card small{font-size:10px;font-weight:400;color:#abc4d9;line-height:1.4}
.variant-card strong{font-size:12px}
#loadoutScreen .menu-actions{position:sticky;bottom:-28px;padding:12px;width:100%;background:#09192cf5;border-top:1px solid #385772;z-index:1}
@media(max-width:760px){#presetCards{grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}.preset-pictures svg{height:44px}.menu-screen .preset-card{padding:9px}.preset-pictures small{font-size:8px}.variant-cards{grid-template-columns:repeat(3,minmax(0,1fr));gap:5px}.menu-screen .variant-card{padding:5px}.variant-card svg{height:48px}.variant-card strong{font-size:10px}.variant-card small{font-size:8px}#loadoutScreen .menu-actions{bottom:-22px;padding:10px 4px;gap:6px}#loadoutScreen .menu-actions .primary{min-width:160px}}

.preset-pictures svg{height:34px}
.menu-screen .preset-card{padding:10px}
.preset-pictures>div{padding-top:3px}
@media(max-width:760px){.preset-pictures svg{height:40px}}

/* NEXORYS mobile menu redesign: title, difficulty, equipment */
#stage.in-menu{min-height:min(760px,calc(100dvh - 125px));background:radial-gradient(ellipse at 70% 20%,#163c5b 0%,#07152a 53%,#030914 100%)}
#menuPanel{background:linear-gradient(165deg,#071426e8,#102b44df 60%,#061020ef);scrollbar-color:#416982 transparent}
.menu-screen{position:relative}
.menu-screen h2{letter-spacing:.025em;text-wrap:balance}
#titleScreen{min-height:480px;justify-content:center;gap:24px;padding:18px 0 26px}
#titleScreen .title-logo{margin:0;line-height:1.1;letter-spacing:.12em;text-shadow:0 0 18px #35d9df77,0 0 50px #198ca688}
#titleScreen .menu-ship{width:min(270px,70vw);height:105px;filter:drop-shadow(0 0 18px #5cd8ed80)}
#titleScreen .primary{min-height:58px;padding:15px 32px;font-size:16px;box-shadow:0 0 26px #57dfdb33}
#difficultyScreen{max-width:850px;padding:10px 0 24px}
#difficultyScreen .choice-grid button{position:relative;background:linear-gradient(150deg,#142d47,#09192d);border:1px solid #466b83;border-top:3px solid #70dce3;border-radius:9px;transition:transform .15s,border-color .15s;line-height:1.5}
#difficultyScreen .choice-grid button:hover{transform:translateY(-2px);border-color:#a0f8ed}
#difficultyScreen .choice-grid button:nth-child(1){border-top-color:#7de7b6}
#difficultyScreen .choice-grid button:nth-child(3){border-top-color:#ffb27c}
#difficultyScreen .choice-grid small{color:#b5ccdf}
#loadoutScreen{padding-bottom:24px}
#presetCards{align-items:stretch}
.menu-screen .preset-card{border-radius:8px;transition:border-color .15s,background .15s}
.preset-pictures>div{min-width:0}
.preset-pictures small{overflow-wrap:anywhere}
#equipmentSummary{line-height:1.5}
#loadoutScreen .menu-actions{border-radius:8px 8px 0 0}
@media(max-width:760px){
  body:has(#stage.in-menu) header{display:none}
  body:has(#stage.in-menu) main{padding-top:0}
  #stage.in-menu{height:auto;min-height:100dvh;min-height:100svh;aspect-ratio:auto;border-left:0;border-right:0}
  #stage.in-menu #menuPanel{padding:56px 16px max(20px,env(safe-area-inset-bottom));}
  #stage.in-menu .menu-screen{gap:15px}
  #titleScreen{min-height:calc(100svh - 100px);gap:clamp(15px,4vh,30px);padding:20px 0 32px}
  #titleScreen .title-logo{font-size:clamp(40px,12vw,64px)}
  #titleScreen .menu-ship{height:clamp(75px,15vh,120px)}
  #titleScreen .primary{width:min(100%,340px)}
  #difficultyScreen{min-height:calc(100svh - 110px);justify-content:center;gap:16px}
  #difficultyScreen .choice-grid{gap:11px}
  #difficultyScreen .choice-grid button{min-height:100px;padding:15px 18px;font-size:15px}
  #difficultyScreen .choice-grid small{font-size:11px;margin-top:6px}
  #difficultyBack{align-self:stretch;max-width:360px}
  #loadoutScreen{gap:12px;padding-bottom:12px}
  #loadoutScreen h2{font-size:clamp(21px,6vw,29px)}
  #presetCards{grid-template-columns:repeat(2,minmax(0,1fr));gap:9px}
  .menu-screen .preset-card{padding:10px 8px;gap:4px}
  .preset-card>span{font-size:15px}
  .preset-pictures svg{height:38px}
  .preset-pictures small{font-size:8px;line-height:1.3}
  #loadoutScreen .menu-actions{position:sticky;bottom:0;flex-wrap:wrap;gap:8px;padding:10px 4px max(10px,env(safe-area-inset-bottom))}
  #loadoutScreen .menu-actions button{flex:1;min-width:120px}
  #customOptions .variant-cards{grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
  #customOptions .variant-card{padding:8px}
}
@media(max-width:390px){#stage.in-menu #menuPanel{padding-left:10px;padding-right:10px}.preset-pictures svg{height:32px}.preset-pictures small{font-size:7px}#loadoutScreen .menu-actions button{font-size:11px;padding:10px 8px;min-width:105px}}
@media(prefers-reduced-motion:reduce){#difficultyScreen .choice-grid button{transition:none}}

/* Type Select: preserve four comparable SNES-inspired columns on portrait screens. */
.option-preview{border-top:1px solid #244158;padding-top:6px;display:flex;flex-direction:column;gap:2px}
.option-preview>span{font-size:9px;color:#83dce1;letter-spacing:.08em}
.option-preview small{font-size:8px;color:#adc8dd}
.option-preview svg{width:100%;height:35px}
@media(max-width:760px){
 #presetCards{grid-template-columns:repeat(4,minmax(145px,1fr));overflow-x:auto;overscroll-behavior-x:contain;scroll-snap-type:x proximity;padding:4px 2px 12px;scrollbar-color:#6bd6df #0a1b2e}
 #presetCards>.preset-card{scroll-snap-align:start;min-width:0}
 #visualEquipment{min-width:0}
 #loadoutScreen{width:100%;max-width:100%}
}

/* Pause is a gameplay-only action positioned immediately left of the sound control. */
#pauseControls{position:absolute;z-index:8;top:10px;right:calc(58px + 48px);touch-action:manipulation}
#pauseButton{min-width:38px;height:38px;border:1px solid #6f9ab5;border-radius:3px;background:#08182be8;color:#def6ff;font:21px Consolas,monospace;cursor:pointer;touch-action:manipulation}
#pauseButton[hidden]{display:none!important}
#pauseButton:focus-visible,#resumeButton:focus-visible{outline:2px solid #fff;outline-offset:2px}
#pausePanel[hidden]{display:none!important}
#pausePanel{position:absolute;z-index:9;inset:0;background:#031025db;display:flex;flex-direction:column;justify-content:center;align-items:center;gap:18px;padding:24px;text-align:center;color:#d9f6ff}
#pausePanel h2{font:700 clamp(24px,5vw,40px) Consolas,monospace;letter-spacing:.12em;color:#96f3f3;margin:0}
#pausePanel p{font:14px/1.5 Consolas,monospace;margin:0}
#resumeButton{border:2px solid #8cefe6;background:#123d52;color:#e5ffff;border-radius:5px;min-height:50px;padding:12px 28px;font:700 16px Consolas,monospace;cursor:pointer}
@media(max-width:600px){#pauseControls{top:4px;right:calc(48px + 42px)}#pauseButton{width:36px;min-width:36px;height:36px;font-size:18px}}
#stage:fullscreen #pauseControls{top:10px;right:calc(58px + 48px)}
@media(max-width:600px){#stage:fullscreen #pauseControls{top:4px;right:calc(48px + 42px)}}

/* NEXORYS difficulty console: arcade-inspired composition, original graphics. */
#difficultyScreen{max-width:1020px;width:100%;min-height:650px;justify-content:center;gap:24px;padding:34px 0 42px}
.difficulty-head{display:flex;flex-direction:column;align-items:center;gap:12px}
.difficulty-head .eyebrow{color:#5fdfeb;letter-spacing:.28em;font-size:12px}
#difficultyScreen .difficulty-head h2{font:900 clamp(30px,4.8vw,54px)/1.12 Consolas,monospace;letter-spacing:.12em;color:#e5fbff;text-shadow:0 0 25px #24c6ff77}
.difficulty-head p{font:12px Consolas,monospace;letter-spacing:.28em;color:#86bcd3}
.difficulty-console{width:100%;display:grid;grid-template-columns:1.1fr .9fr;gap:20px;padding:18px;background:linear-gradient(145deg,#061527f5,#092c43f2);border:2px solid #2d83a9;box-shadow:inset 0 0 0 2px #06101e,0 0 30px #06a8f322;clip-path:polygon(0 13px,13px 0,calc(100% - 13px) 0,100% 13px,100% calc(100% - 13px),calc(100% - 13px) 100%,13px 100%,0 calc(100% - 13px))}
.difficulty-options{display:flex;flex-direction:column;gap:12px;justify-content:center}
#difficultyScreen .difficulty-option{position:relative;display:grid;grid-template-columns:16px 48px minmax(0,1fr) 20px;align-items:center;gap:12px;min-height:110px;padding:16px 18px;background:linear-gradient(100deg,#0c2037,#102d47);border:1px solid #32617d;border-left:4px solid #32617d;border-radius:3px;text-align:left;box-shadow:inset 0 1px #a5edff12;transition:background .15s,border-color .15s,transform .15s}
#difficultyScreen .difficulty-option:hover,#difficultyScreen .difficulty-option:focus-visible{background:linear-gradient(90deg,#114765,#11324a);border-color:#5ce5f3;transform:translateX(3px);outline:none}
#difficultyScreen .difficulty-option:focus-visible{box-shadow:0 0 0 2px #c4ffff,0 0 20px #00c9ff66}
#difficultyScreen .difficulty-option:nth-child(1){border-left-color:#6ff1b3}
#difficultyScreen .difficulty-option:nth-child(2){border-left-color:#6dddf8}
#difficultyScreen .difficulty-option:nth-child(3){border-left-color:#ffb36e}
.difficulty-pointer{font-size:16px;color:#79eefa;opacity:0}
.difficulty-option:hover .difficulty-pointer,.difficulty-option:focus-visible .difficulty-pointer{opacity:1}
.difficulty-emblem{font:40px/1 Consolas,monospace;color:#6be8fa;text-align:center;text-shadow:0 0 15px #00bfff88}
.difficulty-option:nth-child(1) .difficulty-emblem{color:#71efb6}
.difficulty-option:nth-child(3) .difficulty-emblem{color:#ffb16c}
.difficulty-copy{display:flex;flex-direction:column;gap:7px;min-width:0}
.difficulty-copy strong{font:900 clamp(17px,2vw,24px)/1.1 Consolas,monospace;letter-spacing:.1em;color:#e4faff}
.difficulty-copy strong em{font:400 10px Consolas,monospace;color:#80bad3;letter-spacing:.08em;margin-left:8px;font-style:normal}
.difficulty-copy small{font:700 11px Consolas,monospace;color:#7ae6ef;letter-spacing:.08em}
.difficulty-copy small b{color:#496e85}
.difficulty-copy>span{font:12px/1.4 Consolas,monospace;color:#b5cfe2}
.difficulty-arrow{font-size:30px;color:#5fbfd8}
.difficulty-visual{position:relative;min-height:355px;overflow:hidden;display:flex;align-items:center;justify-content:center;background:radial-gradient(ellipse at 45% 50%,#144968 0%,#081a32 48%,#041020 80%);border:1px solid #225773}
.difficulty-visual:before{content:"";position:absolute;inset:0;background-image:radial-gradient(#8eeaffaa 1px,transparent 1px),linear-gradient(#58caff0b 1px,transparent 1px),linear-gradient(90deg,#58caff0b 1px,transparent 1px);background-size:49px 43px,36px 36px,36px 36px}
.difficulty-orbit{position:absolute;width:235px;height:235px;border:1px solid #1fa6d44d;border-radius:50%;box-shadow:0 0 0 38px #1fa6d412,0 0 0 77px #1fa6d40b;transform:rotate(-25deg) scaleY(.6)}
.difficulty-ship{position:relative;width:190px;height:120px;filter:drop-shadow(0 0 19px #00bfff88);animation:difficulty-float 3s ease-in-out infinite}
.difficulty-ship:before{content:"";position:absolute;inset:8px 4px 10px;background:linear-gradient(135deg,#a6f7ff 0%,#318ab8 40%,#e0fbff 55%,#0b497b 100%);clip-path:polygon(0 32%,36% 28%,52% 0,75% 31%,100% 50%,75% 69%,52% 100%,36% 72%,0 68%,16% 50%)}
.difficulty-ship:after{content:"";position:absolute;left:16%;top:43%;width:34%;height:14%;background:#35e9ff;filter:blur(8px);border-radius:50%}
.difficulty-ship span{position:absolute;z-index:1;left:51%;top:43%;width:40%;height:14%;background:#092b50;clip-path:polygon(0 0,100% 50%,0 100%)}
.difficulty-trails{position:absolute;width:65%;height:2px;right:58%;top:52%;background:linear-gradient(90deg,transparent,#1feaff);box-shadow:0 0 14px #00dfff}
.difficulty-scan,.difficulty-status{position:absolute;font:10px Consolas,monospace;letter-spacing:.1em;color:#65b5d4}
.difficulty-scan{top:14px;left:14px}.difficulty-status{bottom:14px;right:14px;color:#73f3c5}
.difficulty-bottom{width:100%;display:flex;align-items:center;justify-content:space-between;gap:20px}
#difficultyScreen #difficultyBack{min-width:145px;background:#0a2137;border:1px solid #3e819e}
.difficulty-bottom>span{font:11px Consolas,monospace;color:#8cc9df;letter-spacing:.09em}
.difficulty-blink{color:#64e9f5;animation:difficulty-blink 1s steps(2) infinite}
@keyframes difficulty-float{50%{transform:translateY(-9px)}}@keyframes difficulty-blink{50%{opacity:.15}}
@media(max-width:760px){
 #difficultyScreen{min-height:calc(100svh - 115px);justify-content:flex-start;gap:18px;padding:8px 0 20px}
 #difficultyScreen .difficulty-head h2{font-size:clamp(25px,7.5vw,37px);letter-spacing:.07em}
 .difficulty-head .eyebrow{font-size:9px;letter-spacing:.12em}
 .difficulty-head p{font-size:10px;letter-spacing:.12em}
 .difficulty-console{display:flex;flex-direction:column-reverse;gap:12px;padding:11px}
 .difficulty-visual{min-height:160px}
 .difficulty-ship{transform:scale(.75);animation:none}
 .difficulty-orbit{transform:rotate(-25deg) scale(.45,.3)}
 #difficultyScreen .difficulty-option{grid-template-columns:10px 34px minmax(0,1fr) 14px;gap:8px;min-height:92px;padding:12px 9px}
 .difficulty-emblem{font-size:29px}
 .difficulty-copy strong{font-size:18px}
 .difficulty-copy strong em{font-size:9px;margin-left:4px}
 .difficulty-copy small{font-size:10px}
 .difficulty-copy>span{font-size:10px}
 .difficulty-arrow{font-size:22px}
 .difficulty-bottom{align-items:stretch;flex-direction:column-reverse;gap:10px}
 .difficulty-bottom>span{text-align:center;font-size:9px}
 #difficultyScreen #difficultyBack{width:100%}
}
@media(max-width:380px){.difficulty-visual{min-height:120px}.difficulty-head{gap:7px}#difficultyScreen .difficulty-option{min-height:83px}.difficulty-copy strong{font-size:16px}}
@media(prefers-reduced-motion:reduce){.difficulty-ship,.difficulty-blink{animation:none}#difficultyScreen .difficulty-option{transition:none}}

/* Original illustrated title screen — arcade / Gradius SNES-inspired composition. */
#titleScreen{max-width:1200px;width:100%;min-height:730px;position:relative;overflow:hidden;isolation:isolate;justify-content:flex-start;gap:0;padding:0;border:1px solid #207eae;box-shadow:inset 0 0 0 4px #041124,0 0 30px #0b8ed733}
#titleScreen .title-scene{position:absolute;inset:0;z-index:-2;pointer-events:none}
#titleScreen .title-art{width:100%;height:100%;display:block;object-fit:cover}
#titleScreen:after{content:"";position:absolute;inset:0;z-index:-1;pointer-events:none;background:linear-gradient(180deg,#02102366 0%,#02102300 30%,#02102300 62%,#021023b8 83%,#021023ee 100%)}
#titleScreen .title-content{width:100%;display:flex;flex-direction:column;align-items:center;gap:15px;padding:72px 20px 0}
#titleScreen .eyebrow{font-size:clamp(10px,1.3vw,15px);font-weight:700;letter-spacing:.3em;color:#5ef3ff;text-shadow:0 0 15px #07cbff}
#titleScreen .title-logo{font-family:Arial,Helvetica,sans-serif;font-size:clamp(56px,9vw,118px);font-weight:900;line-height:1.08;letter-spacing:.035em;color:#e6fbff;text-shadow:0 0 6px #8bf2ff,0 0 22px #03aaff,0 0 60px #005cc7;margin:0}
#titleScreen .title-orbit{position:relative;color:#a8f7ff;text-shadow:0 0 12px #03baff,0 0 36px #00baff}
#titleScreen .title-orbit:after{content:"";position:absolute;inset:12% -12%;border:2px solid #39e8ff;border-radius:50%;transform:rotate(-55deg) scaleX(.48);box-shadow:0 0 12px #0bdfff}
#titleScreen .title-motto{font:700 clamp(11px,1.45vw,17px) Consolas,monospace;letter-spacing:.25em;color:#c4f1ff;text-shadow:0 2px 9px #000}
#titleScreen .title-ship-space{height:clamp(195px,25vw,285px);flex-shrink:0}
#titleScreen #pressStart{display:flex;align-items:center;justify-content:space-around;gap:16px;width:min(610px,85%);min-height:84px;padding:18px 25px;border:4px solid #35f4ff;border-radius:8px;background:linear-gradient(110deg,#02d1e8ed,#0c709fdc 50%,#0ca1c8ed);box-shadow:inset 0 0 0 3px #b0ffff66,0 0 24px #0ddfffa0;color:#efffff;font:900 clamp(18px,2.5vw,31px) Consolas,monospace;letter-spacing:.16em;text-shadow:0 2px 5px #004768;transition:filter .15s,transform .15s}
#titleScreen #pressStart:hover,#titleScreen #pressStart:focus-visible{filter:brightness(1.2);transform:translateY(-2px);outline:2px solid #eaffff;outline-offset:3px}
#titleScreen #pressStart span{font-size:1.2em}
#titleScreen .title-help{font-size:13px;line-height:1.4;color:#b9d8f3;text-shadow:0 2px 5px #000}
#titleScreen .title-bottom{margin-top:auto;width:100%;padding:18px 24px 22px;display:flex;flex-direction:column;gap:15px}
#titleScreen .title-info{display:flex;flex-direction:column;gap:7px;padding:14px 18px;border:1px solid #268ab4;background:#05172cdb;text-align:left;box-shadow:inset 3px 0 #19dfff}
#titleScreen .title-info strong{font:700 13px Consolas,monospace;letter-spacing:.22em;color:#4aeaff}
#titleScreen .title-info span{font:12px/1.5 Consolas,monospace;color:#bdd9f3}
#titleScreen .title-keys{display:flex;justify-content:space-around;flex-wrap:wrap;gap:8px;border-top:1px solid #277b9b;padding-top:14px;color:#a5dbef;font:11px Consolas,monospace;letter-spacing:.06em}
#menuPanel:has(#titleScreen:not([hidden])){padding:14px;background:linear-gradient(135deg,#020d1c,#092440)}
@media(max-width:760px){
 #menuPanel:has(#titleScreen:not([hidden])){padding:0!important}
 #titleScreen{min-height:100svh;border-left:0;border-right:0}
 #titleScreen .title-content{padding:clamp(75px,12vh,120px) 12px 0;gap:14px}
 #titleScreen .eyebrow{font-size:9px;letter-spacing:.15em}
 #titleScreen .title-logo{font-size:clamp(45px,12.5vw,78px);letter-spacing:.015em}
 #titleScreen .title-motto{font-size:10px;letter-spacing:.1em}
 #titleScreen .title-ship-space{height:clamp(190px,29vh,320px)}
 #titleScreen #pressStart{width:min(92%,440px);min-height:65px;font-size:clamp(17px,5vw,24px);padding:12px 14px;letter-spacing:.08em}
 #titleScreen .title-help{font-size:11px;max-width:300px}
 #titleScreen .title-bottom{padding:14px 12px max(16px,env(safe-area-inset-bottom))}
 #titleScreen .title-info{padding:10px 12px}
 #titleScreen .title-info strong{font-size:11px}
 #titleScreen .title-info span{font-size:10px}
 #titleScreen .title-keys{font-size:9px;gap:10px}
}
@media(max-width:390px){#titleScreen .title-content{padding-top:66px}#titleScreen .title-ship-space{height:190px}#titleScreen .title-keys{font-size:8px}}
@media(prefers-reduced-motion:reduce){#titleScreen #pressStart{transition:none}}

/* Align sound and fullscreen controls to a shared mobile top-right grid. */
@media(max-width:760px){
 #stage.in-menu #audioControls{top:12px;right:62px;left:auto;margin:0}
 #stage.in-menu #fullscreen{top:12px;right:12px;left:auto;margin:0}
 #stage.in-menu #audioToggle,#stage.in-menu #fullscreen{box-sizing:border-box;width:38px;min-width:38px;height:38px;padding:0;display:flex;align-items:center;justify-content:center;line-height:1}
 #stage.in-menu #audioControls{z-index:11}
 #stage.in-menu #fullscreen{z-index:11}
}
@media(max-width:760px){
 #stage.in-menu:fullscreen #audioControls{top:12px;right:62px}
 #stage.in-menu:fullscreen #fullscreen{top:12px;right:12px}
}

/* Title layout repair: one frame, no nested panels, no clipped footer. */
#stage.in-menu:has(#titleScreen:not([hidden])){height:auto;min-height:0;overflow:visible;border:1px solid #385b75;box-shadow:none;background:#031020}
#stage.in-menu:has(#titleScreen:not([hidden])) #menuPanel{position:relative;inset:auto;overflow:visible;padding:0;background:transparent;min-height:0}
#stage.in-menu:has(#titleScreen:not([hidden])) #game{display:none}
#stage.in-menu #titleScreen{border:0;box-shadow:none;max-width:none;width:100%;min-height:760px;overflow:hidden}
#stage.in-menu #titleScreen .title-bottom{padding:14px 24px 20px;gap:10px}
#stage.in-menu #titleScreen .title-info{border:0;box-shadow:none;background:linear-gradient(90deg,#031122c9,#03112272);padding:10px 8px}
#stage.in-menu #titleScreen .title-keys{border-top:0;padding-top:8px}
#stage.in-menu #titleScreen .title-content{padding-top:45px}
#stage.in-menu #titleScreen .title-ship-space{height:clamp(190px,23vw,255px)}
#stage.in-menu #titleScreen #pressStart{min-height:74px}
@media(max-width:760px){
 #stage.in-menu:has(#titleScreen:not([hidden])){min-height:100svh;border:0}
 #stage.in-menu #titleScreen{min-height:100svh}
 #stage.in-menu #titleScreen .title-content{padding-top:clamp(75px,12vh,110px)}
 #stage.in-menu #titleScreen .title-ship-space{height:clamp(165px,27vh,260px)}
 #stage.in-menu #titleScreen #pressStart{min-height:64px}
 #stage.in-menu #titleScreen .title-bottom{padding:10px 12px max(16px,env(safe-area-inset-bottom))}
}
@media(max-width:400px){
 #stage.in-menu #titleScreen .title-content{padding-top:70px}
 #stage.in-menu #titleScreen .title-ship-space{height:160px}
}
#stage.in-menu:fullscreen:has(#titleScreen:not([hidden])){height:100dvh;overflow:auto}

/* Difficulty screen: flatten nested console and radar frames. */
#stage.in-menu:has(#difficultyScreen:not([hidden])){box-shadow:none}
#stage.in-menu:has(#difficultyScreen:not([hidden])) #menuPanel{background:transparent}
#difficultyScreen .difficulty-console{background:transparent;border:0;box-shadow:none;clip-path:none;padding:0;gap:clamp(16px,2vw,30px)}
#difficultyScreen .difficulty-options{gap:8px}
#difficultyScreen .difficulty-option{background:linear-gradient(90deg,#0b243b99,#102d4766);border:0;border-left:3px solid #32617d;border-radius:0;box-shadow:none}
#difficultyScreen .difficulty-option:nth-child(1){border-left-color:#6ff1b3}
#difficultyScreen .difficulty-option:nth-child(2){border-left-color:#6dddf8}
#difficultyScreen .difficulty-option:nth-child(3){border-left-color:#ffb36e}
#difficultyScreen .difficulty-visual{background:radial-gradient(ellipse at 45% 50%,#14496880 0%,#081a3200 72%);border:0}
#difficultyScreen .difficulty-visual:before{opacity:.45;mask-image:radial-gradient(ellipse,#000 15%,transparent 75%)}
#difficultyScreen .difficulty-bottom{border:0}
@media(max-width:760px){#difficultyScreen .difficulty-console{padding:0;gap:8px}#difficultyScreen .difficulty-visual{min-height:145px}}

/* SNES-inspired TYPE SELECT: one shared matrix, not four nested cards. */
#loadoutScreen{max-width:1120px;gap:13px}
#loadoutScreen #visualEquipment{gap:10px}
#presetCards.type-source-cards{display:none!important}
.type-matrix{display:grid;grid-template-columns:110px repeat(4,minmax(0,1fr));width:100%;border-top:2px solid #5bb5d6;border-bottom:2px solid #5bb5d6;background:#06182b70;gap:0}
.type-matrix>*{min-width:0;box-sizing:border-box;border-radius:0}
.type-corner,.type-column-heading{min-height:45px;display:flex;align-items:center;justify-content:center;background:#071e34;border-bottom:1px solid #366481;font:700 13px Consolas,monospace;letter-spacing:.1em;color:#8fefff}
.type-column-heading{border-top:0;border-left:0;border-right:0;cursor:pointer}
.type-row-label{display:flex;align-items:center;padding:10px;color:#75dfe8;font:700 12px Consolas,monospace;letter-spacing:.08em;border-bottom:1px solid #284963}
.type-cell{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:4px;min-height:91px;padding:5px 8px;background:transparent;border:0;border-left:1px solid #23445b;border-bottom:1px solid #284963;color:#c8e8f8;cursor:pointer;transition:background .12s}
.type-cell svg{display:block;width:100%;max-width:142px;height:57px;flex-shrink:0}
.type-cell-name{font:10px/1.2 Consolas,monospace;text-align:center;color:#b8d9e8}
.type-cell:hover,.type-column-heading:hover{background:#0e3a57}
.type-cell.is-selected,.type-column-heading.is-selected{background:#0b4d6280;box-shadow:inset 0 0 0 1px #6af2e6}
.type-cell:focus-visible,.type-column-heading:focus-visible{outline:2px solid #9bffff;outline-offset:-3px}
#loadoutScreen .menu-actions{background:transparent;border:0;box-shadow:none}
#loadoutScreen #equipmentSummary{max-width:950px}
@media(max-width:760px){
 #loadoutScreen{max-width:100%;width:100%;gap:9px}
 .type-matrix{grid-template-columns:66px repeat(4,minmax(130px,1fr));overflow-x:auto}
 #visualEquipment{overflow-x:auto;align-items:stretch}
 .type-matrix{min-width:586px}
 .type-corner,.type-column-heading{font-size:10px;min-height:38px}
 .type-row-label{font-size:9px;padding:5px}
 .type-cell{min-height:75px;padding:4px}
 .type-cell svg{height:44px}
 .type-cell-name{font-size:9px}
}
@media(prefers-reduced-motion:reduce){.type-cell{transition:none}}

/* TYPE SELECT SNES: categories across the top, four selectable type rows. */
#loadoutScreen .type-matrix{grid-template-columns:100px repeat(5,minmax(0,1fr));border:0;background:transparent}
#loadoutScreen .type-corner,#loadoutScreen .type-column-heading{border:0;border-bottom:2px solid #6cd6e4;background:#0821389c;letter-spacing:.04em}
#loadoutScreen .type-row-heading{font:700 15px Consolas,monospace;letter-spacing:.06em;color:#a3e9ef;background:#081f35aa;border:0;border-bottom:1px solid #345a75;cursor:pointer}
#loadoutScreen .type-row-heading.is-selected{background:#0d5663b0;color:#fff}
#loadoutScreen .type-cell{min-height:105px;border:0;border-bottom:1px solid #345a75;border-left:1px solid #25425b;background:#071c3280}
#loadoutScreen .type-cell.is-selected{background:#0e536499;box-shadow:inset 0 2px #72e8d9,inset 0 -2px #72e8d9}
#loadoutScreen .type-cell svg{height:62px}
#loadoutScreen.editing-equipment .type-matrix{display:none}
#loadoutScreen.editing-equipment #customOptions{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px;align-items:start}
#loadoutScreen.editing-equipment .variant-group{min-width:0;margin:0;padding:0;border:0}
#loadoutScreen.editing-equipment .variant-group legend{font:700 12px Consolas,monospace;color:#7de9f0;border-bottom:2px solid #3ba5c4;padding:10px 0;width:100%;text-align:center}
#loadoutScreen.editing-equipment .variant-cards{display:flex;flex-direction:column;gap:4px}
#loadoutScreen.editing-equipment .variant-card{border:0;border-bottom:1px solid #31546e;background:#092039ad;border-radius:0;padding:8px;align-items:center;text-align:center;min-height:112px}
#loadoutScreen.editing-equipment .variant-card[aria-pressed="true"]{background:#0e5b6b9c;box-shadow:inset 3px 0 #83f5df}
#loadoutScreen.editing-equipment .variant-card svg{height:58px;max-width:160px}
#loadoutScreen .menu-actions{position:static;padding:8px 0;min-height:0;background:transparent}
#loadoutScreen #customEquipment{margin:8px auto}
@media(max-width:760px){
 #loadoutScreen .type-matrix{min-width:730px;grid-template-columns:80px repeat(5,minmax(130px,1fr))}
 #loadoutScreen .type-cell{min-height:83px}
 #loadoutScreen .type-cell svg{height:46px}
 #loadoutScreen.editing-equipment #customOptions{grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
 #loadoutScreen.editing-equipment .variant-card{min-height:95px}
}

/* Simplify edit mode: flat equipment list, no secondary card containers. */
#stage.in-menu:has(#loadoutScreen:not([hidden])){box-shadow:none}
#stage.in-menu:has(#loadoutScreen:not([hidden])) #menuPanel{background:transparent}
#loadoutScreen.editing-equipment #customOptions{gap:0;column-gap:10px}
#loadoutScreen.editing-equipment .variant-group{background:transparent;box-shadow:none}
#loadoutScreen.editing-equipment .variant-cards{gap:0}
#loadoutScreen.editing-equipment .variant-card{background:transparent;box-shadow:none;border:0;border-bottom:1px solid #31546e;min-height:105px}
#loadoutScreen.editing-equipment .variant-card[aria-pressed="true"]{background:#10445170;box-shadow:inset 3px 0 #83f5df}
#loadoutScreen.editing-equipment #equipmentSummary{margin:0}
#loadoutScreen.editing-equipment .menu-note{margin:0}
#loadoutScreen.editing-equipment .menu-actions{border:0;box-shadow:none;background:transparent}

/* Equipment screen: one frame and natural content height, including bottom actions. */
#stage.in-menu:has(#loadoutScreen:not([hidden])){height:auto;min-height:0;overflow:visible;box-shadow:none}
#stage.in-menu:has(#loadoutScreen:not([hidden])) #menuPanel{position:relative;inset:auto;overflow:visible;min-height:0;padding:56px 22px 20px;background:transparent}
#stage.in-menu:has(#loadoutScreen:not([hidden])) canvas{display:none}
#stage.in-menu #loadoutScreen{max-width:1120px;gap:12px;padding:0}
#loadoutScreen #customEquipment{order:0;margin:0 auto 6px}
#loadoutScreen #visualEquipment{order:1}
#loadoutScreen #equipmentSummary{order:2;margin:2px 0}
#loadoutScreen .menu-note{order:3;margin:0}
#loadoutScreen .menu-actions{order:4;margin:0;padding:10px 0 0;position:static;bottom:auto;box-shadow:none;border:0;background:none}
#loadoutScreen .type-matrix{background:none}
#loadoutScreen .type-cell{border-left:0;border-right:0;border-bottom:1px solid #2a4a61;border-radius:0;box-shadow:none}
#loadoutScreen .type-cell.is-selected{box-shadow:inset 0 2px #72e8d9,inset 0 -2px #72e8d9}
#loadoutScreen .type-row-heading{border-radius:0}
@media(max-width:760px){
 #stage.in-menu:has(#loadoutScreen:not([hidden])) #menuPanel{padding:60px 10px 18px}
 #stage.in-menu:has(#loadoutScreen:not([hidden])){min-height:100svh}
 #loadoutScreen #visualEquipment{overflow-x:auto;max-width:100%}
}

/* Persistent side-by-side mode tabs, SNES-inspired. */
#loadoutScreen .equipment-mode-tabs{display:flex;justify-content:center;align-items:stretch;gap:0;margin:0 auto 6px;order:0}
#loadoutScreen .equipment-mode-tabs button{min-width:180px;min-height:46px;margin:0;padding:10px 20px;border:1px solid #4a7b9a;border-radius:0;background:#091b2e;color:#9ebcd0;font:700 13px Consolas,monospace;letter-spacing:.08em}
#loadoutScreen .equipment-mode-tabs button+button{border-left:0}
#loadoutScreen .equipment-mode-tabs button[aria-pressed="true"]{background:#0c5968;color:#edffff;border-color:#87f5e7;box-shadow:inset 0 -3px #7ef0e5}
#loadoutScreen .equipment-mode-tabs #customEquipment{margin:0}
@media(max-width:760px){#loadoutScreen .equipment-mode-tabs{width:min(100%,420px)}#loadoutScreen .equipment-mode-tabs button{min-width:0;flex:1;font-size:11px;padding:10px 8px}}

/* Four OPTION choices in the same edit-mode matrix, without extra cards. */
#loadoutScreen.editing-equipment #customOptions{grid-template-columns:repeat(5,minmax(0,1fr))}
#loadoutScreen .option-mini{font:700 clamp(17px,2vw,27px) Consolas,monospace;color:#ffbd72;letter-spacing:.08em;min-height:58px;display:flex;align-items:center;justify-content:center}
#loadoutScreen.editing-equipment .option-variant-group .variant-card{min-height:105px}
@media(max-width:760px){#loadoutScreen.editing-equipment #customOptions{grid-template-columns:repeat(2,minmax(0,1fr))}#loadoutScreen .option-mini{min-height:42px}}

/* SNES EDIT MODE: five weapon categories plus SPECIAL, with flat columns. */
#loadoutScreen.editing-equipment #customOptions{grid-template-columns:repeat(6,minmax(0,1fr))}
#loadoutScreen .type-matrix{grid-template-columns:100px repeat(6,minmax(0,1fr))}
@media(max-width:760px){#loadoutScreen .type-matrix{min-width:850px;grid-template-columns:80px repeat(6,minmax(125px,1fr))}#loadoutScreen.editing-equipment #customOptions{grid-template-columns:repeat(2,minmax(0,1fr))}}

/* Gameplay canvas must be visible after leaving equipment menus. */
#stage:not(.in-menu) #game{display:block!important;position:absolute;inset:0;width:100%;height:100%;opacity:1;visibility:visible;z-index:0}
#menuPanel[hidden]{display:none!important}

/* Difficulty: back navigation belongs in the upper-left, opposite audio/fullscreen. */
#difficultyScreen{position:relative}
#difficultyScreen .difficulty-head{position:relative}
#difficultyScreen #difficultyBack{position:absolute;left:0;top:0;min-width:0;width:auto;max-width:none;align-self:auto;padding:10px 15px;min-height:38px;z-index:2;background:#0a2137;border:1px solid #3e819e}
#difficultyScreen .difficulty-bottom{justify-content:flex-end}
@media(max-width:760px){
 #difficultyScreen #difficultyBack{left:0;top:0;width:auto;min-width:0;max-width:none;min-height:34px;padding:7px 10px;font-size:11px}
 #difficultyScreen .difficulty-head .eyebrow{padding-top:43px}
}

/* Equipment navigation: back/start aligned at top-left, like difficulty back. */
#loadoutScreen{position:relative}
#loadoutScreen .loadout-top-actions{position:absolute;top:0;left:0;z-index:4;display:flex;align-items:center;gap:8px;margin:0;padding:0}
#loadoutScreen .loadout-top-actions button{position:static;min-width:0;min-height:38px;padding:9px 13px;font:700 11px Consolas,monospace;white-space:nowrap}
#loadoutScreen .loadout-top-actions #loadoutBack{background:#0a2137;border:1px solid #3e819e}
#loadoutScreen .loadout-top-actions #startGame{background:#8ce6dd;color:#082434;border:1px solid #b5fff1}
@media(max-width:760px){
 #loadoutScreen .loadout-top-actions{position:relative;top:auto;left:auto;align-self:flex-start;order:-1;max-width:100%;flex-wrap:wrap;margin-bottom:8px}
 #loadoutScreen .loadout-top-actions button{min-height:34px;padding:8px 10px;font-size:10px}
}

/* Menu navigation: same compact audio-control visual language, aligned to stage top-left. */
#stage.in-menu #difficultyScreen #difficultyBack,
#stage.in-menu #loadoutScreen .loadout-top-actions button{
 border:1px solid #6f9ab5;border-radius:3px;background:#08182be8;color:#def6ff;
 box-shadow:none;text-shadow:none;min-height:38px;height:38px;padding:0 12px;
 font:700 11px Consolas,monospace;letter-spacing:0;white-space:nowrap;
 display:inline-flex;align-items:center;justify-content:center;
}
#stage.in-menu #loadoutScreen .loadout-top-actions #startGame{
 background:#08182be8;color:#def6ff;border-color:#6f9ab5;
}
#stage.in-menu #difficultyScreen .difficulty-head{position:static}
#stage.in-menu #difficultyScreen #difficultyBack{position:absolute;left:0;top:-46px;z-index:9}
#stage.in-menu #loadoutScreen .loadout-top-actions{position:absolute;left:0;top:-46px;z-index:9;display:flex;gap:8px;margin:0;padding:0}
#stage.in-menu #difficultyScreen,#stage.in-menu #loadoutScreen{position:relative}
@media(max-width:760px){
 #stage.in-menu #difficultyScreen #difficultyBack{top:-46px;left:0}
 #stage.in-menu #loadoutScreen .loadout-top-actions{position:absolute;top:-46px;left:0;max-width:none;flex-wrap:nowrap;margin:0}
 #stage.in-menu #difficultyScreen #difficultyBack,
 #stage.in-menu #loadoutScreen .loadout-top-actions button{height:38px;min-height:38px;padding:0 9px;font-size:10px}
 #stage.in-menu #difficultyScreen .difficulty-head .eyebrow{padding-top:0}
}

/* Equipment screen cleanup: remove redundant guidance and make selections legible. */
#loadoutScreen #equipmentSummary{display:none!important}
#loadoutScreen{gap:10px}
#loadoutScreen #visualEquipment{gap:0}
#loadoutScreen .type-matrix{margin-top:6px}
#loadoutScreen .type-cell{transition:background-color .12s,border-color .12s}
#loadoutScreen .type-cell:hover,#loadoutScreen .variant-card:hover{background-color:#123950}
#loadoutScreen .type-cell:focus-visible,#loadoutScreen .variant-card:focus-visible{outline:2px solid #9af8ee;outline-offset:-3px}
#loadoutScreen .type-cell .option-mini{font:700 clamp(15px,1.7vw,23px) Consolas,monospace;letter-spacing:.03em;min-height:0;color:#ffbd72;white-space:nowrap;line-height:1.3}
#loadoutScreen.editing-equipment #customOptions{column-gap:10px;row-gap:10px}
#loadoutScreen.editing-equipment .variant-group{min-width:0}
#loadoutScreen.editing-equipment .variant-card{width:100%;box-sizing:border-box}
@media(max-width:760px){
 #loadoutScreen .type-cell .option-mini{font-size:17px}
 #loadoutScreen.editing-equipment #customOptions{column-gap:8px;row-gap:12px}
}

/* SNES-style compact equipment selection: one illustration and one name. */
#loadoutScreen.editing-equipment #customOptions{align-items:stretch;column-gap:10px;row-gap:0}
#loadoutScreen.editing-equipment .variant-group{display:flex;flex-direction:column}
#loadoutScreen.editing-equipment .variant-group legend{flex:none}
#loadoutScreen.editing-equipment .variant-cards{display:grid;grid-template-columns:minmax(0,1fr);grid-template-rows:repeat(4,108px);gap:0;align-content:start}
#loadoutScreen.editing-equipment .variant-card{height:108px;min-height:108px;max-height:108px;overflow:hidden;justify-content:center;gap:5px;padding:8px 5px}
#loadoutScreen.editing-equipment .variant-card small{display:none}
#loadoutScreen.editing-equipment .variant-card svg{height:58px;max-width:160px;flex:none}
#loadoutScreen.editing-equipment .variant-card .option-mini{height:58px;min-height:58px;display:flex;align-items:center;justify-content:center}
#loadoutScreen.editing-equipment .variant-card strong{font-size:11px;line-height:1.2}
#loadoutScreen .type-cell{justify-content:center;gap:5px}
#loadoutScreen .type-cell .type-cell-name{font-size:10px}
@media(max-width:760px){#loadoutScreen.editing-equipment .variant-cards{grid-template-rows:repeat(4,108px)}}

/* Six equipment columns only; each row remains a selectable preset. */
#loadoutScreen .type-matrix{grid-template-columns:repeat(6,minmax(0,1fr))}
@media(max-width:760px){#loadoutScreen .type-matrix{min-width:750px;grid-template-columns:repeat(6,minmax(120px,1fr))}}

/* Responsive layout authority: one button per preset, natural menu height. */
html{overflow-x:clip}
body{min-width:0}
main,footer,.menu-screen,#visualEquipment{min-width:0}
#stage.in-menu,
#stage.in-menu:has(#titleScreen:not([hidden])),
#stage.in-menu:has(#difficultyScreen:not([hidden])),
#stage.in-menu:has(#loadoutScreen:not([hidden])){height:auto;min-height:0;aspect-ratio:auto;overflow:visible;touch-action:pan-y}
#stage.in-menu #menuPanel,
#stage.in-menu:has(#titleScreen:not([hidden])) #menuPanel,
#stage.in-menu:has(#loadoutScreen:not([hidden])) #menuPanel{position:relative;inset:auto;min-height:0;overflow:visible;padding:68px clamp(10px,2vw,24px) 20px}
#stage.in-menu #game{display:none}
#stage.in-menu .menu-screen{width:100%;max-width:1120px;min-height:0}
#stage.in-menu #titleScreen{min-height:min(760px,calc(100svh - 110px));padding:0}
#stage.in-menu #titleScreen .title-content{padding:clamp(20px,4vh,45px) 12px 0}
#stage.in-menu #titleScreen .title-ship-space{height:clamp(110px,22vh,230px)}
#stage.in-menu #difficultyScreen{padding:12px 0 20px;gap:20px}
#stage.in-menu #loadoutScreen{padding:0;gap:14px}
#stage.in-menu #loadoutScreen #visualEquipment{max-width:100%;width:100%;overflow:visible}
#loadoutScreen .type-matrix{display:flex;flex-direction:column;gap:12px;min-width:0;width:100%;border:0;margin:0;padding:0;overflow:visible;background:none}
#loadoutScreen .type-preset-row{display:flex;flex-direction:column;align-items:stretch;width:100%;min-width:0;padding:8px 10px;gap:6px;border:2px solid #345a75;border-radius:5px;background:#071c32;color:#e0f5ff;text-align:left;box-shadow:none;cursor:pointer;touch-action:manipulation}
#loadoutScreen .type-preset-row:hover{background:#11394b;border-color:#69cbd6}
#loadoutScreen .type-preset-row.is-selected{background:#0c3949;border-color:#88f1df;box-shadow:inset 3px 0 #88f1df}
#loadoutScreen .type-preset-row:focus-visible{outline:3px solid #c7fff3;outline-offset:2px}
.type-preset-heading{display:flex;justify-content:space-between;align-items:center;min-height:22px;color:#8be9e0;font-size:12px;letter-spacing:.1em}
.type-preset-check{font-size:17px;min-width:20px;text-align:right}
.type-preset-items{display:grid;grid-template-columns:repeat(6,minmax(0,1fr));gap:6px;min-width:0}
#loadoutScreen .type-preset-row .type-cell{display:flex;flex-direction:column;justify-content:center;align-items:center;min-width:0;min-height:0;padding:4px 2px;gap:4px;border:0;border-left:1px solid #31576a;background:transparent;box-shadow:none;border-radius:0}
#loadoutScreen .type-preset-row .type-cell:first-child{border-left:0}
.type-equipment-category{font-size:9px;color:#83c9db;letter-spacing:.03em}
#loadoutScreen .type-preset-row .type-cell svg{display:block;width:100%;height:42px;max-width:150px;flex:none}
#loadoutScreen .type-preset-row .type-cell-name{font-size:10px;line-height:1.25;overflow-wrap:anywhere;text-align:center}
#loadoutScreen .type-preset-row .option-mini{width:100%;height:42px;min-height:42px;font-size:clamp(13px,1.6vw,20px);letter-spacing:0;justify-content:center}
#loadoutScreen.editing-equipment #customOptions{grid-template-columns:repeat(6,minmax(0,1fr));gap:12px;width:100%;min-width:0}
#loadoutScreen.editing-equipment .variant-cards{grid-template-rows:none;grid-auto-rows:minmax(96px,auto)}
#loadoutScreen.editing-equipment .variant-card{height:auto;min-height:96px;max-height:none;overflow:visible;padding:8px 4px}
#loadoutScreen .equipment-mode-tabs{max-width:100%;width:min(420px,100%)}
#loadoutScreen .equipment-mode-tabs button{flex:1;min-width:0;padding:10px 8px;min-height:44px}
#stage.in-menu #loadoutScreen .loadout-top-actions{top:-56px;left:0;gap:6px}
#stage.in-menu #loadoutScreen .loadout-top-actions button{min-height:44px;height:44px;padding:0 10px}
#stage.in-menu #difficultyScreen #difficultyBack{top:-56px;min-height:44px}
#stage.in-menu:fullscreen,
#stage.in-menu:fullscreen:has(#titleScreen:not([hidden])),
#stage.in-menu:fullscreen:has(#loadoutScreen:not([hidden])){height:100dvh;min-height:0;overflow-y:auto;display:block;width:100%;border:0;padding:env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left)}
#stage:not(.in-menu):fullscreen #game{inset:auto;left:50%;top:50%;transform:translate(-50%,-50%);width:min(100vw,177.7778dvh);height:min(100dvh,56.25vw)}
@media(max-width:1000px){
 #loadoutScreen.editing-equipment #customOptions{grid-template-columns:repeat(3,minmax(0,1fr))}
 .difficulty-console{grid-template-columns:1fr;gap:12px}
 .difficulty-visual{min-height:160px;max-height:200px}
 #difficultyScreen .difficulty-option{min-height:90px}
 #stage.in-menu #titleScreen .title-logo{font-size:clamp(38px,9vw,76px)}
}
@media(max-width:600px){
 body{padding:8px}
 #stage.in-menu #menuPanel,#stage.in-menu:has(#titleScreen:not([hidden])) #menuPanel,#stage.in-menu:has(#loadoutScreen:not([hidden])) #menuPanel{padding:110px 8px 16px}
 #stage.in-menu #loadoutScreen .loadout-top-actions{top:-54px;left:0;position:absolute;flex-wrap:wrap;max-width:100%}
 #stage.in-menu #difficultyScreen #difficultyBack{top:-54px}
 #loadoutScreen .type-preset-row{padding:8px;gap:6px}
 .type-preset-items{grid-template-columns:repeat(3,minmax(0,1fr));gap:8px 4px}
 #loadoutScreen .type-preset-row .type-cell:nth-child(3n+1){border-left:0}
 #loadoutScreen .type-preset-row .type-cell svg{height:36px}
 #loadoutScreen .type-preset-row .option-mini{height:36px;min-height:36px;font-size:17px}
 #loadoutScreen .type-preset-row .type-cell-name{font-size:9px}
 .type-equipment-category{font-size:8px}
 #loadoutScreen.editing-equipment #customOptions{grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}
 #difficultyScreen .difficulty-option{grid-template-columns:12px 30px minmax(0,1fr) 12px;gap:8px;padding:12px 8px}
 .difficulty-copy strong{font-size:18px}.difficulty-copy strong em{display:block;margin:4px 0 0}
 #stage.in-menu #titleScreen #pressStart{width:100%;max-width:360px;min-width:0;min-height:54px;font-size:17px;padding:12px 16px}
 #stage.in-menu #titleScreen .title-bottom{padding:12px;gap:10px}
 #titleScreen .title-keys{font-size:9px;line-height:1.5;gap:8px}
 #stage.in-menu #titleScreen .title-content{padding:12px 8px 0;gap:14px}
 #stage.in-menu #titleScreen .eyebrow{font-size:8px;letter-spacing:.1em}
 #pausePanel{padding:12px;gap:10px}#pausePanel p{font-size:11px}#pausePanel h2{font-size:20px}
}
@media(orientation:landscape) and (max-height:600px){
 body{padding:4px 8px}
 body:has(#stage:not(.in-menu)) header{display:none}
 body:has(#stage:not(.in-menu)) main,body:has(#stage:not(.in-menu)) footer{max-width:min(1200px,calc((100dvh - 64px)*16/9))}
 body:has(#stage:not(.in-menu)) footer{padding-top:8px;gap:8px}
 body:has(#stage:not(.in-menu)) footer>span{display:none}
 footer select{padding:4px;min-height:30px;font-size:10px}
 #stage.in-menu #titleScreen{min-height:0}
 #stage.in-menu #titleScreen .title-ship-space{height:100px}
 #stage.in-menu #titleScreen .title-content{padding-top:10px}
 #stage.in-menu #titleScreen .title-bottom{padding:12px}
 #stage.in-menu #titleScreen #pressStart{min-height:48px}
 .difficulty-visual{display:none}
 #difficultyScreen .difficulty-options{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px}
 #difficultyScreen .difficulty-option{display:flex;flex-direction:column;align-items:flex-start;min-height:0;padding:12px;gap:4px}
 .difficulty-pointer,.difficulty-arrow,.difficulty-emblem{display:none}
 .difficulty-copy strong{font-size:17px}.difficulty-copy strong em{display:block;margin:4px 0 0}
 .difficulty-head .eyebrow{font-size:10px}.difficulty-head p{font-size:10px}
 .difficulty-head h2{font-size:28px!important}
}
@media(orientation:portrait) and (max-width:1024px){
 #stage:not(.in-menu):not(:fullscreen){overflow:visible;margin-bottom:120px}
 #stage:not(.in-menu):not(:fullscreen) #powerMeter{bottom:-112px;width:100%;max-width:none;font-size:10px}
 #stage:not(.in-menu):not(:fullscreen) #powerMeter>div{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:4px}
 #stage:not(.in-menu):not(:fullscreen) #powerMeter button{min-height:38px;font-size:9px;overflow-wrap:anywhere;padding:5px 2px}
 #stage:not(.in-menu):not(:fullscreen) #powerMeter small{font-size:10px;line-height:1.4}
 footer{line-height:1.5}
}

/* Keep back/start available while the grouped presets or edit list scroll. */
#stage.in-menu #loadoutScreen .loadout-top-actions{position:sticky;top:max(6px,env(safe-area-inset-top));left:auto;align-self:stretch;order:-1;z-index:10;max-width:100%;flex-wrap:wrap;margin:-54px 0 0;padding:4px;background:#071a2ff5;border-radius:4px}
@media(max-width:600px){
 #stage.in-menu #menuPanel,#stage.in-menu:has(#titleScreen:not([hidden])) #menuPanel,#stage.in-menu:has(#loadoutScreen:not([hidden])) #menuPanel{padding-top:68px}
}
@media(orientation:portrait) and (max-width:1024px){
 #stage:not(.in-menu):not(:fullscreen){margin-bottom:132px}
 #stage:not(.in-menu):not(:fullscreen) #powerMeter{bottom:-124px}
 #stage:not(.in-menu):not(:fullscreen) #powerMeter button{min-height:44px}
}

#stage:not(.in-menu):not(:fullscreen){box-sizing:content-box;aspect-ratio:16/9}
@media(orientation:portrait) and (max-width:1024px){
 #stage:not(.in-menu):not(:fullscreen){margin-top:48px}
 #stage:not(.in-menu):not(:fullscreen) #pauseControls,
 #stage:not(.in-menu):not(:fullscreen) #audioControls,
 #stage:not(.in-menu):not(:fullscreen) #fullscreen{top:-44px}
}

/* One viewport-sized menu frame; scroll only its content when space is short. */
body:has(#stage.in-menu){height:100dvh;min-height:0;display:flex;flex-direction:column;gap:10px;padding:12px clamp(8px,2vw,24px);overflow:hidden;box-sizing:border-box}
body:has(#stage.in-menu)>header{flex:none;width:100%;margin:0 auto;min-height:0}
body:has(#stage.in-menu)>header h1{margin:0;font-size:25px;line-height:1.3}
body:has(#stage.in-menu)>header p{margin:0}
body:has(#stage.in-menu)>main{flex:1 1 0;min-height:0;width:100%;margin:0 auto;padding:0}
body:has(#stage.in-menu)>footer{flex:none;width:100%;margin:0 auto;padding-top:0;min-height:0;gap:8px;line-height:1.4}
body:has(#stage.in-menu)>footer>span{display:none}
#stage.in-menu,
#stage.in-menu:has(#titleScreen:not([hidden])),
#stage.in-menu:has(#difficultyScreen:not([hidden])),
#stage.in-menu:has(#loadoutScreen:not([hidden])){height:100%;min-height:0;max-height:100%;width:100%;aspect-ratio:auto;overflow:hidden;box-sizing:border-box;margin:0}
#stage.in-menu #menuPanel,
#stage.in-menu:has(#titleScreen:not([hidden])) #menuPanel,
#stage.in-menu:has(#loadoutScreen:not([hidden])) #menuPanel{height:100%;min-height:0;max-height:100%;position:relative;inset:auto;overflow-y:auto;overflow-x:hidden;padding:12px;box-sizing:border-box;overscroll-behavior:contain}
#stage.in-menu:has(#titleScreen:not([hidden])) #menuPanel{padding:0}
#stage.in-menu #titleScreen{height:100%;min-height:0;max-height:none;overflow:visible;display:flex;flex-direction:column}
#stage.in-menu #titleScreen .title-content{flex:1 1 0;min-height:0;gap:clamp(7px,1.4dvh,15px);padding:48px 14px 0}
#stage.in-menu #titleScreen .title-logo{flex:none;font-size:clamp(32px,min(10vw,10dvh),104px);line-height:1.05}
#stage.in-menu #titleScreen .eyebrow{font-size:clamp(8px,1.3dvh,12px);letter-spacing:.1em;flex:none}
#stage.in-menu #titleScreen .title-motto{font-size:clamp(9px,1.5dvh,14px);flex:none}
#stage.in-menu #titleScreen .title-ship-space{flex:1 1 0;min-height:8px;height:auto}
#stage.in-menu #titleScreen #pressStart{flex:none;min-height:44px;height:clamp(44px,7dvh,70px);padding:8px 16px;width:min(100%,600px);min-width:0;font-size:clamp(15px,2.6dvh,27px)}
#stage.in-menu #titleScreen .title-help{flex:none;font-size:clamp(9px,1.3dvh,12px);line-height:1.4;max-width:100%}
#stage.in-menu #titleScreen .title-bottom{flex:none;margin-top:0;padding:12px 18px;gap:8px}
#stage.in-menu #titleScreen .title-info{padding:8px;gap:5px}
#stage.in-menu #titleScreen .title-info span{font-size:11px;line-height:1.4}
#stage.in-menu #titleScreen .title-info strong{font-size:11px}
#stage.in-menu #titleScreen .title-keys{padding-top:4px;font-size:10px;line-height:1.4;gap:7px}
#stage.in-menu #loadoutScreen{height:100%;min-height:0;max-height:100%;display:flex;flex-direction:column;gap:10px;overflow:visible;padding:0}
#stage.in-menu #loadoutScreen .loadout-top-actions{position:relative;top:auto;left:auto;order:-1;flex:none;margin:0;min-height:44px;padding:0 100px 0 0;gap:6px;background:transparent;align-self:stretch}
#stage.in-menu #loadoutScreen .loadout-top-actions button{min-height:44px;height:44px;padding:0 10px;white-space:normal}
#stage.in-menu #loadoutScreen>.eyebrow{flex:none;margin:0;font-size:10px}
#stage.in-menu #loadoutScreen>h2{flex:none;font-size:clamp(20px,3.8dvh,32px);line-height:1.15}
#stage.in-menu #loadoutScreen .equipment-mode-tabs{flex:none;min-height:44px;margin:0 auto;width:min(420px,100%)}
#stage.in-menu #loadoutScreen #visualEquipment{flex:1 1 0;min-height:0;width:100%;max-height:none;overflow:auto;display:block;overscroll-behavior:contain;padding:3px;scrollbar-gutter:stable}
#loadoutScreen.editing-equipment #customOptions{display:none!important}
#loadoutScreen .equipment-board,#loadoutScreen.editing-equipment .equipment-board{display:flex;flex-direction:column;gap:8px;width:100%;min-width:0;margin:0;padding:0;background:transparent}
#loadoutScreen .equipment-board[hidden]{display:none!important}
#loadoutScreen .equipment-row,#loadoutScreen.editing-equipment .equipment-row{display:flex;flex-direction:column;position:relative;align-items:stretch;width:100%;min-width:0;padding:22px 6px 6px;gap:0;border:2px solid #345a75;border-radius:4px;background:#071c32;box-sizing:border-box;box-shadow:none;color:#e0f5ff;text-align:left}
#loadoutScreen .equipment-row .type-preset-heading{position:absolute;top:3px;left:8px;right:8px;min-height:16px;line-height:16px;font-size:9px}
#loadoutScreen .equipment-row .type-preset-check{font-size:15px}
#loadoutScreen .equipment-row .type-preset-items{display:grid;grid-template-columns:repeat(6,minmax(0,1fr));gap:4px}
#loadoutScreen .equipment-row .type-cell,#loadoutScreen.editing-equipment .equipment-row .type-cell{display:flex;flex-direction:column;justify-content:center;align-items:center;gap:3px;min-width:0;min-height:0;height:clamp(62px,calc((100dvh - 380px)/4),80px);padding:4px 2px;border:0;border-left:1px solid #31576a;border-radius:0;box-shadow:none;background:transparent;box-sizing:border-box;overflow:hidden;letter-spacing:0}
#loadoutScreen .equipment-row .type-cell:first-child{border-left:0}
#loadoutScreen .equipment-row .type-cell svg,#loadoutScreen.editing-equipment .equipment-row .type-cell svg{width:100%;height:clamp(30px,5dvh,42px);max-width:145px;flex:none}
#loadoutScreen .equipment-row .type-equipment-category{font-size:8px;line-height:1.2;color:#88cbdc}
#loadoutScreen .equipment-row .type-cell-name{font-size:9px;line-height:1.3;text-align:center;overflow-wrap:anywhere}
#loadoutScreen .equipment-row .option-mini{width:100%;height:clamp(30px,5dvh,42px);min-height:0;font-size:clamp(12px,1.6vw,19px);white-space:nowrap;letter-spacing:0}
#loadoutScreen #typeMatrix .equipment-row.is-selected{border-color:#88f1df;background:#0c3949;box-shadow:inset 3px 0 #88f1df}
#loadoutScreen #editMatrix .type-cell.is-selected{background:#0d5662;box-shadow:inset 0 -2px #88f1df}
#loadoutScreen #editMatrix .type-cell:hover{background:#144356}
#loadoutScreen .equipment-row:focus-visible,#loadoutScreen #editMatrix .type-cell:focus-visible{outline:2px solid #c7fff3;outline-offset:-2px}
#stage.in-menu #difficultyScreen{min-height:0;width:100%;padding:48px 0 12px;gap:14px}
#stage.in-menu #difficultyScreen #difficultyBack{top:0;left:0;min-height:44px}
@media(max-width:600px){
 body:has(#stage.in-menu){padding:8px;gap:8px}
 #stage.in-menu #menuPanel,#stage.in-menu:has(#loadoutScreen:not([hidden])) #menuPanel{padding:8px}
 #stage.in-menu #loadoutScreen{gap:8px}
 #stage.in-menu #loadoutScreen .loadout-top-actions{padding-right:88px}
 #stage.in-menu #loadoutScreen .loadout-top-actions button{font-size:9px;padding:0 6px;max-width:100%}
 #loadoutScreen .equipment-row .type-preset-items{grid-template-columns:repeat(3,minmax(0,1fr));gap:5px 3px}
 #loadoutScreen .equipment-row .type-cell:nth-child(3n+1){border-left:0}
 #loadoutScreen .equipment-row .type-cell{height:70px}
 #stage.in-menu #titleScreen .title-content{padding-top:48px;gap:9px}
 #stage.in-menu #titleScreen .title-bottom{padding:10px;gap:7px}
 #stage.in-menu #titleScreen .title-keys{font-size:9px}
 #stage.in-menu #titleScreen .title-info span{font-size:10px}
}
@media(max-height:500px){
 body:has(#stage.in-menu){padding:6px 8px;gap:6px}
 body:has(#stage.in-menu)>header{display:none}
 body:has(#stage.in-menu)>footer select{min-height:28px;padding:3px;font-size:10px}
 #stage.in-menu #titleScreen{min-height:300px}
 #stage.in-menu #titleScreen .title-content{padding-top:44px;gap:6px}
 #stage.in-menu #titleScreen .title-info{padding:5px;gap:3px}
 #stage.in-menu #titleScreen .title-info span,#stage.in-menu #titleScreen .title-keys{font-size:9px}
 #stage.in-menu #titleScreen .title-bottom{padding:8px;gap:5px}
 #stage.in-menu #loadoutScreen{gap:6px}
 #stage.in-menu #loadoutScreen>.eyebrow{display:none}
 #stage.in-menu #loadoutScreen>h2{font-size:20px}
 #loadoutScreen .equipment-row .type-cell{height:62px}
}
/* Keep both selection modes geometrically identical at every breakpoint. */
@media(max-width:600px){
 #loadoutScreen .equipment-row .type-cell,
 #loadoutScreen.editing-equipment .equipment-row .type-cell{height:70px}
}
@media(max-height:500px){
 #loadoutScreen .equipment-row .type-cell,
 #loadoutScreen.editing-equipment .equipment-row .type-cell{height:62px}
}
/* Arcade options: settings stay in one dialog, available from title and pause. */
footer[hidden],#audioControls[hidden]{display:none!important}
#stage.in-menu #titleScreen .options-entry{flex:none;min-height:44px;width:min(100%,320px);margin:0 auto 18px;font-size:15px;letter-spacing:3px;background:#071c32d9;border:1px solid #63bfd4}
#stage.in-menu #titleScreen .title-content{padding-bottom:10px}
#optionsDialog{color:#ddf8ff;background:linear-gradient(135deg,#071528,#103650);border:2px solid #67cddd;border-radius:4px;box-sizing:border-box;width:min(560px,calc(100% - 24px));max-height:calc(100dvh - 24px);padding:18px;overflow:auto;font:13px monospace;z-index:100}
#optionsDialog::backdrop{background:#020915db}
#optionsDialog .options-heading{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:14px}
#optionsDialog h2{margin:0;color:#7cf1f7;letter-spacing:4px;font-size:23px}
#optionsDialog button,#optionsDialog select{min-height:44px;box-sizing:border-box;color:#ddf8ff;background:#081e32;border:1px solid #548ba7;padding:8px 12px;font:inherit}
#optionsDialog button:focus-visible,#optionsDialog select:focus-visible,#optionsDialog input:focus-visible{outline:2px solid #91fff0;outline-offset:2px}
#optionsDialog .options-body{display:grid;gap:14px}
#optionsDialog fieldset{min-width:0;margin:0;padding:12px;border:1px solid #345a75;display:grid;gap:12px}
#optionsDialog legend{color:#82dfeb;letter-spacing:2px;padding:0 6px}
#optionsDialog #controlSettings label{display:flex;align-items:center;justify-content:space-between;gap:12px}
#optionsDialog #controlSettings select{min-width:140px}
#optionsDialog #audioPanel{display:grid;position:static;width:auto;min-width:0;max-width:none;padding:0;background:transparent;border:0;box-shadow:none;gap:9px}
#optionsDialog #audioPanel>strong,#optionsDialog #audioStatus{display:none}
#optionsDialog #audioPanel label{display:flex;justify-content:space-between;align-items:center;gap:8px}
#optionsDialog input[type=range]{width:100%;min-height:30px;margin:0;accent-color:#66e7e0}
#optionsDialog .audioMute{min-height:36px;justify-content:flex-start!important}
#optionsDialog #fullscreen{position:static;width:100%;height:auto;font-size:13px;transform:none}
#pausePanel{gap:12px}
#pausePanel>button{min-height:44px}
#speedStatus{display:none}
@media(max-height:500px){#optionsDialog{padding:12px}.options-body{gap:8px!important}#optionsDialog fieldset{padding:8px}#stage.in-menu #titleScreen .options-entry{margin-bottom:8px}}
#powerMeter #speedStatus{display:none!important}
#optionsDialog .options-heading{position:sticky;top:-18px;background:#0a253b;z-index:1;padding:8px 0}
/* Touch controls use a separate deck below the view in portrait orientation. */
#stage:not(.in-menu) #pauseControls{right:8px;left:auto}
body.immersive{position:fixed;inset:0;width:100%;height:100dvh;overflow:auto;padding:8px;z-index:50}
body.immersive>header{display:none}
@media(orientation:portrait) and (max-width:1024px){
 #stage:not(.in-menu):not(:fullscreen){overflow:visible;margin-top:52px;margin-bottom:260px}
 #stage:not(.in-menu):not(:fullscreen) #pauseControls{top:-48px;right:0;left:auto}
 #stage:not(.in-menu) #pauseButton{width:44px;height:44px;min-width:44px}
 #stage:not(.in-menu):not(:fullscreen) #joystick{left:20px;bottom:-120px;width:100px;height:100px;background:#163c55;border-color:#82e4ed}
 #stage:not(.in-menu):not(:fullscreen) #stick{width:42px;height:42px}
 #stage:not(.in-menu):not(:fullscreen) #fireButton{right:20px;bottom:-110px;width:76px;height:76px}
 #stage:not(.in-menu):not(:fullscreen) #powerMeter{bottom:-232px}
 #stage:not(.in-menu) #pausePanel{position:fixed;inset:0;z-index:30;min-height:100dvh}
 body.immersive main{padding-top:0}
}
#stage.touch-controls.joystick:not(.in-menu) #joystick{display:block}
/* Compact arcade equipment cabinet, shared by both selection modes. */
#stage.in-menu:has(#loadoutScreen:not([hidden])) #menuPanel{background:radial-gradient(ellipse at 50% 0,#14224c,#030817 75%);padding:12px 18px}
#stage.in-menu #loadoutScreen{gap:8px}
#stage.in-menu #loadoutScreen>h2{text-transform:uppercase;font-size:clamp(20px,3.6dvh,30px);letter-spacing:.16em;color:#e7eaff;text-shadow:2px 2px #404080}
#stage.in-menu #loadoutScreen>.eyebrow{color:#8d9bcc;letter-spacing:.15em}
#stage.in-menu #loadoutScreen .equipment-mode-tabs{border:2px solid #737cb1;background:#020517;width:min(460px,100%)}
#stage.in-menu #loadoutScreen .equipment-mode-tabs button{background:transparent;border:0;min-height:44px;color:#8994c2;font-weight:bold;letter-spacing:.1em}
#stage.in-menu #loadoutScreen .equipment-mode-tabs button[aria-pressed=true]{background:#222b57;color:#fff6bc;box-shadow:inset 0 -3px #e9d78b;text-shadow:0 0 10px #d4a15d}
#loadoutScreen .equipment-columns{display:grid;grid-template-columns:repeat(6,minmax(0,1fr));gap:4px;padding:8px 10px 8px 64px;border-bottom:2px solid #6a78a3;color:#c4d5ff;font:bold 11px monospace;letter-spacing:.08em;text-align:center;position:sticky;top:0;z-index:3;background:#080e24}
#loadoutScreen .equipment-board,#loadoutScreen.editing-equipment .equipment-board{gap:5px}
#loadoutScreen .equipment-row,#loadoutScreen.editing-equipment .equipment-row{padding:5px 8px 5px 62px;border:2px solid transparent;border-radius:0;background:#080e22}
#loadoutScreen .equipment-row .type-preset-heading{left:5px;right:auto;top:50%;transform:translateY(-50%);width:50px;display:flex;flex-direction:column;align-items:center;gap:5px;font-size:10px;color:#98abd3}
#loadoutScreen .equipment-row .type-preset-check{color:#fff3a2;font-size:18px}
#loadoutScreen .equipment-row .type-cell,#loadoutScreen.editing-equipment .equipment-row .type-cell{height:clamp(66px,calc((100dvh - 370px)/4),104px);border-left:1px solid #28324d;padding:5px 3px;gap:5px}
#loadoutScreen .equipment-row .type-equipment-category{display:none}
#loadoutScreen .equipment-row .type-cell svg,#loadoutScreen.editing-equipment .equipment-row .type-cell svg{height:clamp(38px,6dvh,58px);max-width:165px}
#loadoutScreen .equipment-row .type-cell-name{font-size:10px;color:#b9caee;letter-spacing:.03em}
#loadoutScreen #typeMatrix .equipment-row.is-selected{border-color:#c4c9ff;background:#222748;box-shadow:inset 3px 0 #f4dc85}
#loadoutScreen #typeMatrix .equipment-row.is-selected .type-cell-name{color:#fff5b9}
#loadoutScreen #editMatrix .type-cell.is-selected{background:#293052;box-shadow:inset 0 0 0 2px #c4c9ff}
#loadoutScreen #editMatrix .type-cell.is-selected .type-cell-name{color:#fff5b9}
#loadoutScreen #editMatrix .type-cell:hover{background:#202a48}
#stage.in-menu #loadoutScreen .loadout-top-actions button{border-radius:0;background:#111a35;border-color:#697baa}
#stage.in-menu #loadoutScreen #startGame{color:#fff0b3;border-color:#d4c28a}
@media(max-width:600px){
 #stage.in-menu:has(#loadoutScreen:not([hidden])) #menuPanel{padding:8px}
 #loadoutScreen .equipment-columns{display:none}
 #loadoutScreen .equipment-row,#loadoutScreen.editing-equipment .equipment-row{padding:23px 4px 5px}
 #loadoutScreen .equipment-row .type-preset-heading{left:8px;right:8px;top:3px;transform:none;width:auto;flex-direction:row;justify-content:space-between;gap:4px;font-size:9px}
 #loadoutScreen .equipment-row .type-equipment-category{display:block;font-size:8px}
 #loadoutScreen .equipment-row .type-cell,#loadoutScreen.editing-equipment .equipment-row .type-cell{height:78px;gap:3px}
 #loadoutScreen .equipment-row .type-cell svg,#loadoutScreen.editing-equipment .equipment-row .type-cell svg{height:38px}
 #loadoutScreen .equipment-row .type-cell-name{font-size:9px}
}
#loadoutScreen #typeMatrix .equipment-row:hover{outline:none;background:#111b32;border-color:#58698c;box-shadow:none}
#loadoutScreen #typeMatrix .equipment-row.is-selected:hover{background:#222748;border-color:#c4c9ff;box-shadow:inset 3px 0 #f4dc85}
/* Pause actions share one arcade button style. */
#pausePanel>button{display:flex;align-items:center;justify-content:center;width:min(280px,85%);min-height:48px;padding:12px 20px;border:2px solid #7184b1;border-radius:2px;background:#111d38;color:#e1e9ff;font:700 14px Consolas,monospace;letter-spacing:.12em;cursor:pointer;box-shadow:inset 0 0 0 2px #070e22}
#pausePanel>#resumeButton{border-color:#87e7e4;background:#123b4b;color:#ecffff}
#pausePanel>button:hover{background:#293453;border-color:#e7dba6;color:#fff3bd}
#pausePanel>button:focus-visible{outline:2px solid #fff0af;outline-offset:4px}
#pausePanel>button:active{transform:translateY(1px)}
#pausePanel{gap:14px}
#pausePanel h2{margin-bottom:8px}
@media(max-height:400px){#pausePanel{gap:10px}#pausePanel h2{margin-bottom:0}#pausePanel>button{min-height:44px;padding:8px 16px}}
#stage.in-menu #titleScreen .record-score{flex:none;color:#e7d99e;font-size:12px;letter-spacing:.12em;text-align:center}
#optionsDialog #mobileSettings label{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap}
#optionsDialog #mobileSettings input[type=range]{flex:1;min-width:100px;width:50%}
#optionsDialog .gamepad-info{font-size:10px;line-height:1.6;color:#a8bad9;margin:0}
#stage #joystick{transform:scale(var(--touch-scale,1));transform-origin:center}
#stage #fireButton{transform:scale(var(--touch-scale,1));transform-origin:center}
.extra-arsenal{margin:8px 0;border:1px solid #6979a0;background:#0a122a;color:#d7def5;padding:10px;font:11px monospace}
.extra-arsenal summary{cursor:pointer;min-height:32px;line-height:32px;letter-spacing:.12em}
.extra-weapons{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:8px}
.extra-weapons button{min-width:0;min-height:90px;background:#111d35;border:1px solid #647291;color:#d4dcf6;padding:6px;font:10px monospace;cursor:pointer}
.extra-weapons button[aria-pressed=true]{border-color:#eadd9c;background:#283253}
.extra-weapons svg{width:100%;height:55px}
@media(orientation:portrait) and (max-width:1024px){
 #stage:not(.in-menu):not(:fullscreen) #joystick{left:var(--touch-x,20px);bottom:calc(-120px - var(--touch-y,0px))}
 #stage:not(.in-menu):not(:fullscreen) #fireButton{right:var(--touch-x,20px);bottom:calc(-110px - var(--touch-y,0px))}
 #stage.left-handed:not(.in-menu):not(:fullscreen) #joystick{left:auto;right:var(--touch-x,20px)}
 #stage.left-handed:not(.in-menu):not(:fullscreen) #fireButton{right:auto;left:var(--touch-x,20px)}
 #stage:not(.in-menu):not(:fullscreen) #powerMeter{bottom:-272px}
 #stage:not(.in-menu):not(:fullscreen){margin-bottom:290px}
}
@media(orientation:landscape){
 #stage:not(.in-menu) #joystick{left:calc(4% + var(--touch-x,20px));bottom:calc(6% + var(--touch-y,0px))}
 #stage:not(.in-menu) #fireButton{right:calc(4% + var(--touch-x,20px));bottom:calc(8% + var(--touch-y,0px))}
 #stage.left-handed:not(.in-menu) #joystick{left:auto;right:calc(4% + var(--touch-x,20px))}
 #stage.left-handed:not(.in-menu) #fireButton{right:auto;left:calc(4% + var(--touch-x,20px))}
}
@media(max-width:600px){.extra-weapons{grid-template-columns:repeat(2,minmax(0,1fr))}}
/* Arcade power bar: cyan is equipped; gold is the capsule selection. */
#powerMeter button{position:relative}
#powerMeter button.equipped{background:#123a46;color:#a6fff1;border-color:#4ba99f;box-shadow:inset 0 -3px #49b7aa}
#powerMeter button.selected-power{outline:2px solid #eedb92;outline-offset:1px}
#powerMeter button.ready{background:#665329;color:#fff6c7;border-color:#f4dfa0;box-shadow:inset 0 0 0 1px #c1a55a}
#powerMeter button.selected-power:disabled{color:#c6b98f;opacity:.8;border-color:#9b8e66}
#powerMeter button.ready:focus-visible{outline:3px solid #fff3c2;outline-offset:2px}
