* {
  box-sizing: border-box;
  user-select: none;
  -webkit-user-select: none;
}

:root {
  --ease-out-quint: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-press: cubic-bezier(0.2, 0, 0, 1);
  --t-fast: 130ms;
  --t-med: 160ms;
  /* Core Tactical Palette */
  --ui-navy-deep: #070c14;
  --ui-navy-surface: #0b1220;
  --ui-navy-top: #0e1b31;
  --ui-navy-bot: #071021;
  --ui-cyan: #2fd8ff;
  --ui-teal: #2ee6c0;
  --ui-amber: #fb923c;
  --ui-crimson: #ff4d5e;
  --accent-amber: #ffd644;
  --accent-vermilion: #ff5630;
  --accent-cyan: #2fd8ff;
  --ink-shadow: #070c18;
  /* Google Fonts selected from AMIX GAMES lineup */
  --font-jp: "Zen Kaku Gothic New", "Hiragino Kaku Gothic ProN", "Yu Gothic", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --font-display: "Anton", "JetBrains Mono", sans-serif;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  background: #060908;
  color: #eef5ff;
  font-family: var(--font-jp);
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-touch-callout: none;
}

/* =========================================================================
   FIRST-PERSON BALLISTIC HELMET & OPTICAL TARGETING VISOR INTERIOR (HMD-88M)
   - Viewport <= 1280x720: clean unobstructed native 1280x720 stage frame
   - Tier 1 (>= 1320x824): stepped brow ridge, azimuth tape, polycarbonate gussets, chin respirator
   - Tier 2 (>= 1480x824): wraparound cheek armor, optical pitch ladders, boom-mic + VHF TX meter
   ========================================================================= */
#app {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #060908;
  background-image:
    repeating-linear-gradient(0deg, rgba(22, 30, 26, 0.14) 0 2px, transparent 2px 6px),
    radial-gradient(ellipse at center, #111815 0%, #070a09 62%, #030504 100%);
  image-rendering: pixelated;
}

.console-chassis.visor-shell {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  max-width: 100vw;
  max-height: 100vh;
}

.visor-brow,
.visor-chin,
.visor-cheek,
.visor-glass-bevel {
  display: none;
}

.visor-mid-row {
  display: flex;
  align-items: stretch;
  justify-content: center;
}

.visor-viewport {
  display: flex;
  align-items: center;
  justify-content: center;
}

#stage-frame {
  position: relative;
  /* Exact 4x integer cap for 320x180 pixel art; scales cleanly on smaller/mobile viewports */
  width: min(100vw, 1280px, calc(min(100dvh, 720px) * 16 / 9));
  height: min(100dvh, 720px, calc(min(100vw, 1280px) * 9 / 16));
  background: #000;
  box-shadow: 0 0 0 2px #131c18;
  overflow: hidden;
  touch-action: none;
}

/* TIER 1 (>= 1320x824): Helmet Brow Ridge + Chin-Guard + Gasket + Inner Glass Gussets */
@media (min-width: 1320px) and (min-height: 824px) {
  .visor-brow {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    width: 100%;
    height: 44px;
    padding: 4px 20px 6px;
    background: linear-gradient(180deg, #27332c 0 4px, #1b231f 4px 36px, #0e1310 36px 100%);
    border-bottom: 2px solid #090d0b;
    clip-path: polygon(
      0 12px, 12px 12px, 12px 8px, 28px 8px, 28px 4px, 52px 4px, 52px 0,
      calc(100% - 52px) 0, calc(100% - 52px) 4px, calc(100% - 28px) 4px,
      calc(100% - 28px) 8px, calc(100% - 12px) 8px, calc(100% - 12px) 12px,
      100% 12px, 100% 100%, 0 100%
    );
    transition: transform 140ms cubic-bezier(0.22, 1, 0.36, 1);
  }

  .visor-shell.visor-ducking .visor-brow {
    transform: translateY(2px);
  }

  .visor-viewport {
    position: relative;
    padding: 6px;
    background: #0b0f0d;
    border: 2px solid #26322b;
    box-shadow: inset 0 0 0 2px #040605;
    transition: border-color 100ms steps(2);
  }

  .visor-shell.console-alert .visor-viewport {
    border-color: #ff3b5c;
    animation: visorAlertEdge 0.5s steps(2) infinite;
  }

  #stage-frame {
    box-shadow: none;
  }

  .visor-glass-bevel {
    display: block;
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 9;
    box-shadow:
      inset 0 2px 0 rgba(7, 11, 10, 0.72),
      inset 0 -2px 0 rgba(7, 11, 10, 0.72),
      inset 2px 0 0 rgba(7, 11, 10, 0.65),
      inset -2px 0 0 rgba(7, 11, 10, 0.65),
      inset 0 3px 0 rgba(130, 230, 255, 0.08);
  }

  .vg-corner {
    position: absolute;
    width: 24px;
    height: 16px;
    background: #0b0f0d;
  }

  .vg-tl {
    top: 0; left: 0;
    clip-path: polygon(0 0, 24px 0, 24px 4px, 16px 4px, 16px 8px, 8px 8px, 8px 12px, 4px 12px, 4px 16px, 0 16px);
  }
  .vg-tr {
    top: 0; right: 0;
    clip-path: polygon(0 0, 24px 0, 24px 16px, 20px 16px, 20px 12px, 16px 12px, 16px 8px, 8px 8px, 8px 4px, 0 4px);
  }
  .vg-bl {
    bottom: 0; left: 0;
    clip-path: polygon(0 0, 4px 0, 4px 4px, 8px 4px, 8px 8px, 16px 8px, 16px 12px, 24px 12px, 24px 16px, 0 16px);
  }
  .vg-br {
    bottom: 0; right: 0;
    clip-path: polygon(20px 0, 24px 0, 24px 16px, 0 16px, 0 12px, 8px 12px, 8px 8px, 16px 8px, 16px 4px, 20px 4px);
  }

  .vg-glint {
    position: absolute;
    top: 16px;
    left: 16px;
    width: 12px;
    height: 12px;
    background: rgba(205, 246, 255, 0.16);
    clip-path: polygon(8px 0, 12px 0, 12px 4px, 8px 4px, 8px 8px, 4px 8px, 4px 12px, 0 12px, 0 8px, 4px 8px, 4px 4px, 8px 4px);
  }

  .visor-optics-svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
    pointer-events: none;
  }

  /* Keep HUD clear of the 24x16 inner polycarbonate corner gussets */
  #hud-top {
    top: 10px;
    left: 28px;
    right: 28px;
  }

  #comms-box {
    left: 28px;
    bottom: 38px;
  }

  .visor-chin {
    display: grid;
    grid-template-columns: 1fr 220px 1fr;
    align-items: center;
    width: 100%;
    height: 38px;
    padding: 0 22px;
    background: linear-gradient(180deg, #101613 0 4px, #1a221e 4px 32px, #0d120f 32px 100%);
    border-top: 2px solid #26332c;
    clip-path: polygon(
      0 0, 100% 0, 100% calc(100% - 12px),
      calc(100% - 12px) calc(100% - 12px), calc(100% - 12px) calc(100% - 8px),
      calc(100% - 32px) calc(100% - 8px), calc(100% - 32px) calc(100% - 4px),
      calc(100% - 56px) calc(100% - 4px), calc(100% - 56px) 100%,
      56px 100%, 56px calc(100% - 4px), 32px calc(100% - 4px),
      32px calc(100% - 8px), 12px calc(100% - 8px), 12px calc(100% - 12px),
      0 calc(100% - 12px)
    );
  }
}

/* TIER 2 (>= 1480x824): Wraparound Cheek Armor + Boom-Mic & VHF Bone-Conduction TX Module */
@media (min-width: 1480px) and (min-height: 824px) {
  .visor-cheek {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    width: clamp(86px, calc((100vw - 1300px) / 2), 132px);
    padding: 14px 8px;
    background: #171e1a;
    border-top: 2px solid #2a362f;
    border-bottom: 2px solid #0d120f;
    position: relative;
  }

  .visor-cheek-left {
    border-left: 3px solid #28342d;
    box-shadow: inset -4px 0 0 #0d120f, inset 2px 0 0 #2f3e36;
    clip-path: polygon(
      12px 0, 100% 0, 100% 100%, 12px 100%,
      12px calc(100% - 28px), 4px calc(100% - 28px), 4px calc(100% - 84px),
      0 calc(100% - 84px), 0 84px, 4px 84px, 4px 28px, 12px 28px
    );
  }

  .visor-cheek-right {
    border-right: 3px solid #28342d;
    box-shadow: inset 4px 0 0 #0d120f, inset -2px 0 0 #2f3e36;
    clip-path: polygon(
      0 0, calc(100% - 12px) 0, calc(100% - 12px) 28px,
      calc(100% - 4px) 28px, calc(100% - 4px) 84px, 100% 84px,
      100% calc(100% - 84px), calc(100% - 4px) calc(100% - 84px),
      calc(100% - 4px) calc(100% - 28px), calc(100% - 12px) calc(100% - 28px),
      calc(100% - 12px) 100%, 0 100%
    );
  }
}

/* --- Brow Telemetry & HMD Azimuth Compass --- */
.brow-left,
.brow-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.brow-right {
  justify-content: flex-end;
  gap: 10px;
}

.visor-tag {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.12em;
  padding: 2px 6px;
  background: #223528;
  border: 1px solid #4e7a5c;
  color: #bceec9;
}

.brow-sector {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: #7ea08d;
  font-variant-numeric: tabular-nums;
}

.brow-compass {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2px 14px 0;
  background: #101613;
  border: 1px solid #27362e;
  border-bottom: 2px solid #090d0b;
}

.compass-scale {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: #6b8c79;
  font-variant-numeric: tabular-nums;
}

.compass-scale i {
  display: block;
  width: 2px;
  height: 5px;
  background: #3a5446;
}

.compass-n {
  color: #74e8ff;
  font-weight: 900;
}

.compass-caret {
  width: 8px;
  height: 4px;
  margin-top: 2px;
  background: #2ee6c0;
  clip-path: polygon(0 4px, 4px 0, 8px 4px);
  will-change: transform;
  transition: transform 70ms linear;
}

.vpip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: #6c8477;
  padding: 2px 5px;
  background: #101613;
  border: 1px solid #243029;
  transition: color 120ms, border-color 120ms, background-color 120ms;
}

.vpip i {
  display: block;
  width: 6px;
  height: 6px;
  background: #2b3831;
  border: 1px solid #080b0a;
}

.vpip-opt i { background: #52f288; }
.vpip-opt   { color: #9ec8ae; }

.vpip-vls.on {
  color: #c8ffd9;
  border-color: #499e68;
  background: #13281b;
}
.vpip-vls.on i {
  background: #52f288;
}

.vpip-iff i { background: #ffbf47; }
.vpip-iff   { color: #b7ad88; }

.visor-shell.console-alert .vpip-iff {
  color: #ffd0d8;
  border-color: #ff3b5c;
  background: #2b0c13;
}
.visor-shell.console-alert .vpip-iff i {
  background: #ff3b5c;
  animation: visorBlink 0.4s steps(2) infinite;
}

/* --- Cheek Armor Details, Pitch Ladder, VHF Bone-Conduction & Boom-Mic --- */
.cheek-hinge {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 4px 8px;
  border-bottom: 2px solid #232e28;
}

.px-bolt {
  width: 8px;
  height: 8px;
  background: #34433b;
  border: 1px solid #0b0f0d;
  box-shadow: inset 2px 2px 0 #506459;
}

.cheek-code {
  font-family: var(--font-mono);
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: #637a6d;
}

.cheek-pitch {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  padding-right: 4px;
  font-family: var(--font-mono);
  font-size: 8px;
  font-weight: 800;
  color: #4d6b5c;
  font-variant-numeric: tabular-nums;
}

.cheek-pitch-right {
  align-items: flex-start;
  padding-right: 0;
  padding-left: 4px;
}

.cheek-pitch i {
  display: block;
  width: 10px;
  height: 2px;
  background: #2c4036;
}

.cheek-pitch i.major {
  width: 18px;
  background: #4e7d64;
}

.cheek-pad {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cheek-ribs {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 6px 4px;
  background: #101512;
  border: 1px solid #243029;
}

.cheek-ribs i {
  display: block;
  height: 4px;
  background: #080b0a;
  border-bottom: 1px solid #27342d;
}

.cheek-stamp {
  font-family: var(--font-mono);
  font-size: 8px;
  font-weight: 800;
  line-height: 1.35;
  letter-spacing: 0.12em;
  color: #53685c;
  text-align: center;
}

.vhf-module {
  background: #0d1511;
  border: 2px solid #24342b;
  padding: 6px 5px;
}

.vhf-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 8px;
  font-weight: 800;
  color: #6b9179;
}

.vhf-tx-led {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  color: #4f6b59;
}

.vhf-tx-led i {
  display: block;
  width: 5px;
  height: 5px;
  background: #203427;
  border: 1px solid #080d0a;
}

.vhf-bars {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 16px;
  margin: 6px 0 4px;
  padding: 2px;
  background: #070d0a;
  border: 1px solid #1b2c22;
}

.vhf-bars i {
  flex: 1;
  background: #214530;
  transform: scaleY(0.25);
  transform-origin: bottom center;
}

.vhf-bars i:nth-child(1) { height: 6px; animation-delay: 0s; }
.vhf-bars i:nth-child(2) { height: 11px; animation-delay: 0.1s; }
.vhf-bars i:nth-child(3) { height: 14px; animation-delay: 0.2s; }
.vhf-bars i:nth-child(4) { height: 9px; animation-delay: 0.3s; }
.vhf-bars i:nth-child(5) { height: 12px; animation-delay: 0.4s; }

.vhf-freq {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: #4f7860;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.visor-shell.console-radio-tx .vhf-module { border-color: #3f8a5b; }
.visor-shell.console-radio-tx .vhf-tx-led { color: #8af7ae; }
.visor-shell.console-radio-tx .vhf-tx-led i { background: #52f288; }
.visor-shell.console-radio-tx .vhf-freq { color: #7df2a4; }
.visor-shell.console-radio-tx .vhf-bars i {
  background: #52f288;
  animation: vhfStep 0.42s steps(3) infinite alternate;
}

.boom-mic {
  position: relative;
  height: 54px;
  margin-top: 6px;
}

.boom-pivot {
  position: absolute;
  right: 4px;
  top: 2px;
  width: 14px;
  height: 14px;
  background: #2a352f;
  border: 2px solid #0b0f0d;
  box-shadow: inset 2px 2px 0 #43544b;
}

.boom-stalk {
  position: absolute;
  right: 14px;
  top: 10px;
  width: 44px;
  height: 26px;
  border-right: 4px solid #26312b;
  border-bottom: 4px solid #26312b;
  box-shadow: inset -1px -1px 0 #0a0e0c;
}

.boom-capsule {
  position: absolute;
  left: 2px;
  bottom: 8px;
  width: 24px;
  height: 14px;
  background: #101513;
  border: 2px solid #2d3a33;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding-left: 3px;
}

.boom-capsule i {
  display: block;
  width: 4px;
  height: 4px;
  background: #23382b;
}

.visor-shell.console-radio-tx .boom-capsule i {
  background: #52f288;
}

.chin-wing {
  display: flex;
  align-items: center;
}

.chin-right {
  justify-content: flex-end;
}

.chin-stencil {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.14em;
  color: #5b7265;
}

.chin-vhf-mini,
.chin-controls-ref {
  display: none;
}

/* =========================================================================
   PC TOP/BOTTOM LETTERBOX TELEMETRY BARS (Horizontal Visor Mode)
   - Activates on PC windows (width >= 761px) when top & bottom black bands appear
     without side cheek bays (e.g. 16:10 MacBook 1280x800, 1280x900, 1100x850, 1024x768)
   - Uniform razor-thin 1px cyan hairlines + live aim-tracking compass + quiet 1-line controls
   ========================================================================= */
@media (min-width: 761px) and (max-width: 1319px) and (max-aspect-ratio: 16/10),
       (min-width: 1320px) and (max-height: 823px) and (max-aspect-ratio: 16/10) {
  .console-chassis:not(.is-title) {
    width: 100vw;
    height: 100dvh;
    max-width: none;
    max-height: none;
    justify-content: space-between;
    background: #060b14;
  }

  .console-chassis:not(.is-title) .visor-mid-row {
    width: 100%;
    flex: 0 0 auto;
    align-items: center;
  }

  .console-chassis:not(.is-title) .visor-viewport {
    width: 100%;
    padding: 0;
    border: 0;
    background: #000;
    box-shadow: none;
  }

  .console-chassis:not(.is-title) #stage-frame {
    width: min(100vw, 1280px, calc((100dvh - 64px) * 16 / 9));
    height: min(calc(100dvh - 64px), 720px, calc(min(100vw, 1280px) * 9 / 16));
    box-shadow: none;
  }

  .console-chassis:not(.is-title) .visor-brow {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    width: 100%;
    flex: 1 1 0;
    min-height: 32px;
    max-height: 54px;
    padding: 0 clamp(14px, 2.2vw, 28px);
    background:
      linear-gradient(#2fd8ff, #2fd8ff) 14px 100% / 10px 1px no-repeat,
      linear-gradient(#2fd8ff, #2fd8ff) calc(100% - 14px) 100% / 10px 1px no-repeat,
      linear-gradient(180deg, #060b14 0%, #091220 100%);
    border-bottom: 1px solid rgba(47, 216, 255, 0.30);
    clip-path: none;
  }

  .console-chassis:not(.is-title) .visor-tag {
    background: rgba(14, 32, 48, 0.85);
    border: 1px solid rgba(47, 216, 255, 0.42);
    color: #9ef2ff;
    font-size: 9px;
    padding: 1px 6px;
  }

  .console-chassis:not(.is-title) .brow-sector {
    color: #6b8ea8;
    font-size: 9.5px;
  }

  .console-chassis:not(.is-title) .brow-compass {
    background: transparent;
    border: 0;
    padding: 2px 10px 0;
  }

  .console-chassis:not(.is-title) .compass-scale {
    color: #5b7c96;
  }

  .console-chassis:not(.is-title) .compass-scale i {
    width: 1px;
    height: 4px;
    background: rgba(47, 216, 255, 0.32);
  }

  .console-chassis:not(.is-title) .vpip {
    background: transparent;
    border: 1px solid rgba(47, 216, 255, 0.22);
    color: #6c8da6;
    font-size: 8.5px;
    padding: 1px 5px;
  }

  .console-chassis:not(.is-title) .visor-chin {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 14px;
    width: 100%;
    flex: 1 1 0;
    min-height: 32px;
    max-height: 54px;
    padding: 0 clamp(14px, 2.2vw, 28px);
    background:
      repeating-linear-gradient(90deg, rgba(47, 216, 255, 0.26) 0 1px, transparent 1px 12px) center 0 / 280px 3px no-repeat,
      linear-gradient(180deg, #091220 0%, #060b14 100%);
    border-top: 1px solid rgba(47, 216, 255, 0.30);
    clip-path: none;
  }

  .console-chassis:not(.is-title) .chin-respirator,
  .console-chassis:not(.is-title) .chin-left .chin-stencil {
    display: none;
  }

  .console-chassis:not(.is-title) .chin-vhf-mini {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: var(--font-mono);
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.1em;
    color: #5d7f99;
  }

  .chin-vhf-bars {
    display: inline-flex;
    align-items: flex-end;
    gap: 2px;
    height: 9px;
  }

  .chin-vhf-bars i {
    display: block;
    width: 2px;
    background: rgba(47, 216, 255, 0.32);
  }
  .chin-vhf-bars i:nth-child(1) { height: 4px; }
  .chin-vhf-bars i:nth-child(2) { height: 9px; }
  .chin-vhf-bars i:nth-child(3) { height: 6px; }

  .visor-shell.console-radio-tx .chin-vhf-mini {
    color: #2ee6c0;
  }
  .visor-shell.console-radio-tx .chin-vhf-bars i {
    background: #2ee6c0;
    animation: vhfStep 0.42s steps(3) infinite alternate;
  }

  .console-chassis:not(.is-title) .chin-controls-ref {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: nowrap;
    gap: 8px;
    font-family: var(--font-mono);
    font-size: 9.5px;
    font-weight: 500;
    letter-spacing: 0.05em;
    color: #6f8da8;
    white-space: nowrap;
    overflow: hidden;
  }

  .console-chassis:not(.is-title) .chin-controls-ref i {
    font-style: normal;
    color: rgba(47, 216, 255, 0.36);
  }

  .console-chassis:not(.is-title) .chin-right .chin-stencil {
    color: #5d7f99;
    font-size: 8.5px;
  }
}

.chin-respirator {
  height: 30px;
  margin-top: -6px;
  background: #121815;
  border: 2px solid #2a3730;
  border-bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  clip-path: polygon(
    16px 0, calc(100% - 16px) 0, calc(100% - 16px) 4px,
    calc(100% - 8px) 4px, calc(100% - 8px) 8px, 100% 8px,
    100% 100%, 0 100%, 0 8px, 8px 8px, 8px 4px, 16px 4px
  );
}

.resp-grille {
  display: flex;
  gap: 6px;
}

.resp-grille i {
  display: block;
  width: 18px;
  height: 6px;
  background: #070a09;
  border-bottom: 1px solid #2b3831;
}

@keyframes visorBlink {
  0%, 49%   { opacity: 1; }
  50%, 100% { opacity: 0.25; }
}

@keyframes visorAlertEdge {
  0%, 49%   { border-color: #ff3b5c; }
  50%, 100% { border-color: #5a1824; }
}

@keyframes vhfStep {
  from { transform: scaleY(0.28); }
  to   { transform: scaleY(1); }
}

/* =========================================================================
   CANVAS & CORE UTILITIES
   ========================================================================= */
#gl-canvas, #hud-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  image-rendering: crisp-edges;
  image-rendering: pixelated;
}

#hud-canvas {
  pointer-events: none;
}

#stage-frame.playing {
  cursor: none;
}

.hidden {
  display: none !important;
}

/* =========================================================================
   CRISP HMD IN-GAME HUD (Projected Visor Optics — Razor-Sharp Over Any Sky)
   ========================================================================= */
#hud-top {
  position: absolute;
  top: 8px;
  left: 10px;
  right: 10px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  pointer-events: none;
  z-index: 10;
}

/* Projected HMD Corner-Bracket Telemetry Plate */
.hud-chip {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px 6px;
  background-color: rgba(7, 13, 24, 0.86);
  background-image:
    /* Double-nested cyan & teal corner L-brackets */
    linear-gradient(#2fd8ff, #2fd8ff), linear-gradient(#2fd8ff, #2fd8ff),
    linear-gradient(#2fd8ff, #2fd8ff), linear-gradient(#2fd8ff, #2fd8ff),
    linear-gradient(#2ee6c0, #2ee6c0), linear-gradient(#2ee6c0, #2ee6c0),
    linear-gradient(#2ee6c0, #2ee6c0), linear-gradient(#2ee6c0, #2ee6c0),
    /* Subtle bottom micro-ruler ticks */
    repeating-linear-gradient(90deg, rgba(47, 216, 255, 0.34) 0 1px, transparent 1px 6px);
  background-repeat: no-repeat, no-repeat, no-repeat, no-repeat, no-repeat, no-repeat, no-repeat, no-repeat, no-repeat;
  background-size:
    8px 1.5px, 1.5px 8px,
    8px 1.5px, 1.5px 8px,
    8px 1.5px, 1.5px 8px,
    8px 1.5px, 1.5px 8px,
    calc(100% - 22px) 2px;
  background-position:
    0 0, 0 0,
    100% 0, 100% 0,
    0 100%, 0 100%,
    100% 100%, 100% 100%,
    11px calc(100% - 1px);
  border: 1px solid rgba(47, 216, 255, 0.30);
  box-shadow:
    inset 0 1px 0 rgba(127, 212, 232, 0.14),
    2px 2px 0 rgba(2, 6, 14, 0.88);
}

.hud-left:has(.hp-fill.low) {
  border-color: rgba(255, 77, 94, 0.78);
  background-color: rgba(28, 7, 13, 0.90);
}
.hud-left:has(.hp-fill.low) .hp-num {
  color: #ff7a88;
}

.hud-stage-label {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.1em;
  padding: 1px 6px;
  background: rgba(14, 34, 48, 0.94);
  border: 1px solid rgba(46, 230, 192, 0.48);
  color: #a8ffe8;
}

.hp-num,
.score-val,
.combo-badge,
.missile-count {
  font-variant-numeric: tabular-nums;
}

.hp-num {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 800;
  min-width: 24px;
  text-align: right;
  color: #eafbff;
}

.bar-track {
  position: relative;
  /* 80px outer = 78px inner = exact 10 cells (10*6px + 9*2px dividers) with ZERO right-edge half-cell! */
  width: 80px;
  height: 8px;
  background: #060b14;
  border: 1px solid rgba(47, 216, 255, 0.40);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.72);
  overflow: hidden;
}

/* Slanted tactical cell dividers */
.bar-track::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.16) 0 1px, transparent 1px),
    repeating-linear-gradient(
      106deg,
      transparent 0 6px,
      rgba(5, 10, 18, 0.78) 6px 8px
    );
}

.bar-fill {
  height: 100%;
  width: 100%;
  transition: width 90ms linear;
}

.hp-fill {
  background: linear-gradient(90deg, #2ee6c0, #2fd8ff);
}

.hp-fill.low {
  background: linear-gradient(90deg, #ff3254, #fb923c);
}

.hud-center {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}

/* Daily Challenge Live Telemetry Strip */
#daily-hud-strip {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 3px 13px;
  white-space: nowrap;
  background:
    linear-gradient(135deg, rgba(255, 214, 68, 0.58) 0 6.0px, transparent 6.3px),
    linear-gradient(315deg, rgba(255, 214, 68, 0.58) 0 6.0px, transparent 6.3px),
    linear-gradient(180deg, rgba(20, 17, 10, 0.90), rgba(10, 12, 18, 0.92));
  border: 1px solid rgba(255, 214, 68, 0.52);
  clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.daily-hud-tag {
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.12em;
  color: #161104;
  background: var(--accent-amber);
  padding: 1px 6px;
}

.daily-hud-time {
  font-size: 12px;
  font-weight: 900;
  color: #fff9e6;
  letter-spacing: 0.08em;
}

.daily-hud-lv {
  font-size: 10px;
  font-weight: 900;
  color: #fb923c;
  padding: 1px 5px;
  border: 1px solid rgba(251, 146, 60, 0.55);
  background: rgba(251, 146, 60, 0.16);
}

.daily-hud-cond {
  font-family: var(--font-jp);
  font-size: 10px;
  font-weight: 700;
  color: #ffe8a8;
  letter-spacing: 0.04em;
}

/* Boss Telemetry Plate */
#boss-bar-wrap {
  position: relative;
  /* 288px = 264px inner track + 24px padding -> ZERO half-cell! */
  width: 288px;
  max-width: 86%;
  padding: 5px 12px 6px;
  text-align: center;
  background:
    linear-gradient(135deg, rgba(255, 77, 94, 0.72) 0 6.7px, transparent 7.0px),
    linear-gradient(225deg, rgba(255, 77, 94, 0.72) 0 6.7px, transparent 7.0px),
    linear-gradient(315deg, rgba(255, 77, 94, 0.72) 0 6.7px, transparent 7.0px),
    linear-gradient(45deg,  rgba(255, 77, 94, 0.72) 0 6.7px, transparent 7.0px),
    linear-gradient(180deg, rgba(24, 7, 13, 0.92), rgba(11, 5, 11, 0.94));
  border: 1px solid rgba(255, 77, 94, 0.68);
  clip-path: polygon(9px 0, calc(100% - 9px) 0, 100% 9px, 100% calc(100% - 9px), calc(100% - 9px) 100%, 9px 100%, 0 calc(100% - 9px), 0 9px);
}

.boss-title-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-bottom: 3px;
}

.boss-chev {
  width: 9px;
  height: 10px;
  color: #ff4d5e;
  flex-shrink: 0;
}

.boss-title {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.14em;
  color: #ffd8e0;
}

.boss-track {
  width: 100%;
  height: 8px;
  border-color: rgba(255, 95, 125, 0.58);
}

.boss-fill {
  background: linear-gradient(90deg, #ff2252 0%, #fb923c 82%, #ffd644 100%);
}

/* Friendly IFF Transponder Strip */
#allies-strip {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 3px 11px;
  white-space: nowrap;
  background: linear-gradient(180deg, rgba(8, 17, 26, 0.90), rgba(5, 11, 16, 0.92));
  border: 1px solid rgba(46, 230, 192, 0.42);
  clip-path: polygon(6px 0, 100% 0, 100% calc(100% - 6px), calc(100% - 6px) 100%, 0 100%, 0 6px);
}

.allies-label {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.12em;
  color: #8df2b3;
  margin-right: 3px;
}

.ally-pip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.06em;
  padding: 1px 6px 1px 5px;
  border: 1px solid rgba(82, 242, 136, 0.52);
  color: #dcffea;
  background: rgba(18, 52, 34, 0.72);
}

.ally-pip::before {
  content: "";
  display: block;
  width: 4px;
  height: 4px;
  background: #52f288;
}

.ally-pip.targeted {
  border-color: #ff99aa;
  color: #ffffff;
  background: #d91c42;
  animation: allyPulse 0.34s steps(2) infinite;
}

.ally-pip.targeted::before {
  background: #ffffff;
}

.ally-pip.dead {
  border-color: rgba(120, 140, 135, 0.28);
  color: rgba(145, 165, 160, 0.50);
  background: rgba(10, 14, 14, 0.68);
  text-decoration: line-through;
}

.ally-pip.dead::before {
  background: #2f3b38;
}

@keyframes allyPulse {
  0%   { opacity: 1; }
  50%  { opacity: 0.42; }
  100% { opacity: 1; }
}

/* Tactical Hazard Banner */
#alert-banner {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 5px 10px;
  background: rgba(18, 10, 7, 0.92);
  border: 1px solid rgba(251, 146, 60, 0.78);
  box-shadow:
    inset 0 1px 0 rgba(255, 214, 150, 0.16),
    inset 0 -1px 0 rgba(251, 146, 60, 0.22);
  color: #fff6dc;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.1em;
  filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.72));
  animation: alertSnap 130ms var(--ease-out-quint);
}

/* Crisp symmetrical 1px optical end-brackets framing both sides of the warning plate */
#alert-banner::before,
#alert-banner::after {
  content: "";
  position: absolute;
  top: -1px;
  bottom: -1px;
  width: 4px;
  border-top: 1px solid #fb923c;
  border-bottom: 1px solid #fb923c;
  pointer-events: none;
}

#alert-banner::before {
  left: -7px;
  border-left: 1px solid #fb923c;
}

#alert-banner::after {
  right: -7px;
  border-right: 1px solid #fb923c;
}

.alert-stripes-wrap {
  display: inline-flex;
  align-items: center;
  align-self: stretch;
  color: rgba(251, 146, 60, 0.62);
  flex-shrink: 0;
}

.alert-stripes-l {
  padding-right: 8px;
  border-right: 1px solid rgba(251, 146, 60, 0.32);
}

.alert-stripes-r {
  padding-left: 8px;
  border-left: 1px solid rgba(251, 146, 60, 0.32);
}

.alert-stripes {
  display: block;
  width: 24px;
  height: 12px;
}

.alert-stripes-r .alert-stripes {
  transform: scaleX(-1);
}

.alert-ico {
  width: 14px;
  height: 13px;
  color: #fb923c;
  flex-shrink: 0;
}

@keyframes alertSnap {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.hud-right {
  pointer-events: auto;
}

.score-val {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 800;
  color: #f4fffa;
  letter-spacing: 0.1em;
}

.combo-badge {
  background: #d9481c;
  border: 1px solid #ffd478;
  color: #fff8e6;
  font-size: 10px;
  font-weight: 900;
  padding: 1px 5px;
  font-family: var(--font-mono);
  box-shadow: 1px 1px 0 #060908;
  animation: comboPop 120ms var(--ease-out-quint);
}

@keyframes comboPop {
  from { transform: scale(1.18); }
  to   { transform: scale(1); }
}

.tool-row {
  display: flex;
  gap: 3px;
  margin-left: 4px;
  padding-left: 7px;
  border-left: 1px solid rgba(116, 232, 255, 0.25);
}

.mini-btn {
  background: rgba(10, 18, 17, 0.90);
  color: #8fb2a6;
  border: 1px solid rgba(116, 210, 195, 0.30);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.82);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.04em;
  padding: 2px 6px;
  cursor: pointer;
  transition: background-color 100ms var(--ease-out-quint), color 100ms, border-color 100ms, transform 70ms;
}

.mini-btn:hover {
  background: #1b3630;
  border-color: #74e8ff;
  color: #ffffff;
}

.mini-btn:active {
  transform: translateY(1px);
}

.mini-btn.active {
  border-color: rgba(46, 230, 192, 0.68);
  background: rgba(14, 42, 38, 0.92);
  color: #a8ffe8;
}

/* --- Lower-Left Tactical VHF Radio Sub-Display (semi-translucent navy + uniform 1px hairline frame) --- */
#comms-box {
  --comms-accent: #2ee6c0;
  position: absolute;
  left: 14px;
  bottom: 40px;
  max-width: 422px;
  min-width: 286px;
  display: flex;
  align-items: center;
  padding: 8px 16px 8px 13px;
  background:
    linear-gradient(225deg, rgba(47, 216, 255, 0.65) 0 8.8px, transparent 9.1px),
    linear-gradient(var(--comms-accent), var(--comms-accent)) 0 0 / 10px 1px no-repeat,
    linear-gradient(var(--comms-accent), var(--comms-accent)) 0 0 / 1px 10px no-repeat,
    linear-gradient(var(--comms-accent), var(--comms-accent)) 0 100% / 10px 1px no-repeat,
    linear-gradient(var(--comms-accent), var(--comms-accent)) 0 100% / 1px 10px no-repeat,
    linear-gradient(155deg, rgba(9, 18, 32, 0.64) 0%, rgba(5, 11, 20, 0.70) 100%);
  backdrop-filter: blur(2.5px);
  -webkit-backdrop-filter: blur(2.5px);
  border: 1px solid rgba(47, 216, 255, 0.36);
  clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 12px, 100% 100%, 0 100%);
  pointer-events: none;
  z-index: 12;
  animation: commsIn 130ms var(--ease-out-quint);
}

#comms-box.mode-radio {
  background:
    linear-gradient(225deg, var(--comms-accent) 0 8.8px, transparent 9.1px),
    linear-gradient(var(--comms-accent), var(--comms-accent)) 0 0 / 10px 1px no-repeat,
    linear-gradient(var(--comms-accent), var(--comms-accent)) 0 0 / 1px 10px no-repeat,
    linear-gradient(var(--comms-accent), var(--comms-accent)) 0 100% / 10px 1px no-repeat,
    linear-gradient(var(--comms-accent), var(--comms-accent)) 0 100% / 1px 10px no-repeat,
    linear-gradient(155deg, rgba(8, 19, 26, 0.64) 0%, rgba(5, 11, 18, 0.70) 100%);
  border-color: rgba(46, 230, 192, 0.44);
}

@keyframes commsIn {
  from { opacity: 0; transform: translate3d(-8px, 0, 0); }
  to   { opacity: 1; transform: translate3d(0, 0, 0); }
}

#comms-portrait {
  width: 100%;
  height: 100%;
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.comms-body {
  flex: 1;
  min-width: 0;
}

.comms-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding-bottom: 3px;
  margin-bottom: 4px;
  border-bottom: 1px solid rgba(120, 240, 156, 0.18);
}

.comms-channel {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.08em;
  padding: 1px 5px;
  background: rgba(82, 242, 136, 0.14);
  border: 1px solid rgba(82, 242, 136, 0.52);
  color: #9cffbf;
}

.comms-speaker {
  font-size: 11px;
  font-weight: 600;
  color: var(--comms-accent);
  letter-spacing: 0.04em;
}

.comms-wave {
  margin-left: auto;
  display: none;
  align-items: flex-end;
  gap: 2px;
  height: 10px;
}

#comms-box.mode-radio .comms-wave {
  display: flex;
}

.comms-wave i {
  display: block;
  width: 2px;
  background: var(--comms-accent);
  animation: radioWave 0.42s steps(3) infinite alternate;
}

.comms-wave i:nth-child(1) { height: 4px; animation-delay: 0s; }
.comms-wave i:nth-child(2) { height: 10px; animation-delay: 0.14s; }
.comms-wave i:nth-child(3) { height: 6px; animation-delay: 0.28s; }

@keyframes radioWave {
  from { transform: scaleY(0.30); opacity: 0.6; }
  to   { transform: scaleY(1.0); opacity: 1.0; }
}

.comms-text {
  font-size: 12.5px;
  font-weight: 400;
  line-height: 1.55;
  color: #f3fff6;
  letter-spacing: 0.03em;
}

/* --- Lower-Center Unified HMD Weapon Readiness Pod --- */
#hud-bottom {
  position: absolute;
  bottom: 8px;
  left: 10px;
  right: 10px;
  display: flex;
  justify-content: center;
  pointer-events: none;
  z-index: 10;
}

.bottom-gauges {
  display: flex;
  align-items: center;
  gap: 0;
  background-color: rgba(7, 13, 24, 0.88);
  background-image:
    linear-gradient(#2fd8ff, #2fd8ff), linear-gradient(#2fd8ff, #2fd8ff),
    linear-gradient(#2fd8ff, #2fd8ff), linear-gradient(#2fd8ff, #2fd8ff),
    linear-gradient(#2ee6c0, #2ee6c0), linear-gradient(#2ee6c0, #2ee6c0),
    linear-gradient(#2ee6c0, #2ee6c0), linear-gradient(#2ee6c0, #2ee6c0),
    repeating-linear-gradient(90deg, rgba(47, 216, 255, 0.28) 0 1px, transparent 1px 7px);
  background-repeat: no-repeat;
  background-size:
    8px 1.5px, 1.5px 8px,
    8px 1.5px, 1.5px 8px,
    8px 1.5px, 1.5px 8px,
    8px 1.5px, 1.5px 8px,
    calc(100% - 24px) 2px;
  background-position:
    0 0, 0 0,
    100% 0, 100% 0,
    0 100%, 0 100%,
    100% 100%, 100% 100%,
    12px calc(100% - 1px);
  border: 1px solid rgba(47, 216, 255, 0.32);
  box-shadow:
    inset 0 1px 0 rgba(127, 212, 232, 0.14),
    2px 2px 0 rgba(2, 6, 14, 0.88);
}

.micro-gauge {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 11px 6px;
  background: transparent;
  border: 0;
}

.micro-gauge + .micro-gauge {
  border-left: 1px solid rgba(47, 216, 255, 0.24);
}

.micro-gauge:has(.ammo-fill.empty) .missile-tag,
.micro-gauge:has(.ammo-fill.empty) .missile-count {
  color: #ff6178;
}

.ammo-track,
.missile-track {
  /* 64px outer = 62px inner = exact 8 cells (8*6px + 7*2px dividers) with ZERO right-edge half-cell! */
  width: 64px;
  height: 7px;
}

.ammo-fill {
  background: linear-gradient(90deg, #ff9922, #ffe866);
}

.ammo-fill.empty {
  background: #ff2e51;
}

.missile-tag {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.1em;
  color: #8ee6ff;
}

.missile-fill {
  background: linear-gradient(90deg, #2298ff, #6bfaff);
}

.missile-count {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 800;
  color: #fff099;
  min-width: 28px;
  text-align: right;
}

/* Clickable Air Support (F-15J) Readiness Module inside Lower HMD Pod */
.air-support-btn {
  pointer-events: auto;
  cursor: pointer;
  color: inherit;
  font: inherit;
  transition: background-color 110ms ease, filter 110ms ease;
}

.air-support-btn:hover {
  background: rgba(116, 212, 255, 0.14);
}

.air-support-btn.ready {
  background: rgba(42, 128, 210, 0.18);
}

.air-support-btn.active {
  background: rgba(82, 232, 255, 0.24);
}

.air-support-btn.empty {
  opacity: 0.62;
}

.air-tag {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  color: #9ce6ff;
}

.air-tag kbd {
  font-family: var(--font-mono);
  font-size: 8px;
  font-weight: 900;
  line-height: 1;
  padding: 1px 3px;
  border: 1px solid rgba(156, 230, 255, 0.52);
  background: rgba(16, 36, 52, 0.85);
  color: #e2f8ff;
}

.air-track {
  /* 40px outer = 38px inner = exact 5 cells (5*6px + 4*2px dividers) — ZERO right-edge half-cell! */
  width: 40px;
  height: 7px;
}

.air-fill {
  background: linear-gradient(90deg, #4db8ff, #9ef4ff);
}

.air-support-btn.active .air-fill {
  background: linear-gradient(90deg, #ffaa33, #ffe866);
}

.air-support-btn.rearming .air-fill {
  background: linear-gradient(90deg, #5a7a96, #8cb4d6);
}

.air-support-btn.empty .air-count {
  color: #8ea0b2;
}

.air-support-btn.active .air-count {
  color: #ffe866;
}

/* =========================================================================
   TITLE SCREEN OVERLAY: FULL-VIEWPORT LAUNCHER (DESKTOP) + SEPARATED BOTTOM TACTICAL DOCK
   - While .console-chassis.is-title is active on desktop/landscape:
     1) Helmet visor chrome hides so the full browser viewport opens up (not locked to 16:9).
     2) Live pixel-art summer scenery fills the upper showcase cleanly with object-fit: cover (zero distortion!).
     3) Command bar & 8-Stage Sector Strip sit in a dedicated dark-navy bottom launcher dock BELOW the townscape.
     4) Pressing SORTIE / DAILY / CO-OP / VR SIM transitions straight into the native 16:9 HMD-88M combat visor!
   ========================================================================= */
@media (min-width: 761px), (orientation: landscape) {
  .console-chassis.is-title {
    width: 100vw;
    height: 100dvh;
    max-width: none;
    max-height: none;
  }

  .console-chassis.is-title .visor-brow,
  .console-chassis.is-title .visor-chin,
  .console-chassis.is-title .visor-cheek,
  .console-chassis.is-title .visor-glass-bevel {
    display: none !important;
  }

  .console-chassis.is-title .visor-mid-row,
  .console-chassis.is-title .visor-viewport {
    width: 100%;
    height: 100%;
    padding: 0;
    border: 0;
    box-shadow: none;
    background: #060b14;
  }

  .console-chassis.is-title #stage-frame {
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
    box-shadow: none;
    background: #060b14;
  }

  /* Keep pixel-art scenery 100% undistorted above the dedicated bottom tactical dock */
  .console-chassis.is-title #gl-canvas {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: auto;
    width: 100%;
    height: calc(100% - 178px);
    object-fit: cover;
    object-position: center 76%;
  }

  .console-chassis.is-title #hud-canvas {
    display: none;
  }

  .console-chassis.is-title #title-overlay {
    /* Subtle atmospheric top darkening for crisp white logo contrast over bright clouds across all 8 stages */
    background: linear-gradient(
      180deg,
      rgba(5, 11, 24, 0.52) 0%,
      rgba(5, 11, 24, 0.24) 17%,
      rgba(5, 11, 24, 0.0) 36%
    );
  }

  .console-chassis.is-title .title-top-row {
    width: 100%;
    max-width: 1520px;
    margin: 0 auto;
    padding: clamp(22px, 3.4vh, 38px) clamp(26px, 3.2vw, 44px) 12px;
  }

  .console-chassis.is-title .title-bottom-dock {
    position: relative;
    padding-top: 12px;
    gap: 9px;
    background:
      repeating-linear-gradient(90deg, rgba(47, 216, 255, 0.34) 0 2px, transparent 2px 10px) center 0 / 260px 2px no-repeat,
      linear-gradient(180deg, rgba(11, 21, 39, 0.98) 0%, #060b14 100%);
    border-top: 1px solid rgba(47, 216, 255, 0.48);
    box-shadow:
      inset 0 1px 0 rgba(127, 212, 232, 0.16),
      0 -12px 30px rgba(3, 7, 16, 0.62);
  }

  .console-chassis.is-title .title-command-bar,
  .console-chassis.is-title .sector-strip-wrap {
    width: 100%;
    max-width: 1520px;
    margin: 0 auto;
    padding: 0 clamp(22px, 3.2vw, 44px);
  }

  .console-chassis.is-title .stage-btn {
    min-height: 66px;
  }
}

#title-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  z-index: 20;
  /* Directional edge scrims ONLY — center sky & townscape stay completely open */
  background:
    radial-gradient(ellipse 62% 48% at 14% 12%, rgba(5, 11, 26, 0.62) 0%, rgba(5, 11, 26, 0.22) 52%, transparent 100%),
    linear-gradient(to top, rgba(4, 8, 18, 0.92) 0%, rgba(4, 8, 18, 0.68) 20%, rgba(4, 8, 18, 0.0) 40%);
  pointer-events: auto;
}

.title-top-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding: clamp(20px, 3.2%, 30px) clamp(26px, 3%, 36px) 0;
}

.title-hero {
  max-width: 72%;
  text-align: left;
  animation: posterReveal 240ms var(--ease-out-quint) both;
}

@keyframes posterReveal {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 読み上げと検索のための文字（見た目はロゴ） */
.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.title-logo-heading {
  margin: clamp(10px, 1.8vh, 20px) 0 0;
  line-height: 0;
}

.title-logo-svg {
  display: block;
  width: clamp(320px, 36vw, 490px);
  height: auto;
  overflow: visible;
}

/* Pure Crisp White SUMMER + INVASION + 夏空の迎撃戦 (ZERO outline, ZERO drop-shadow!) */
.logo-group-summer {
  fill: #ffffff;
  stroke: none;
  transform-box: fill-box;
  transform-origin: left center;
  animation: logoSummerIn 420ms var(--ease-out-quint) 60ms both;
}

.logo-group-invasion {
  fill: #ffffff;
  stroke: none;
  transform-box: fill-box;
  transform-origin: left center;
  animation: logoInvasionIn 460ms var(--ease-out-quint) 170ms both;
}

.logo-group-jp path {
  fill: #ffffff;
  stroke: none;
  transform-box: fill-box;
  transform-origin: center;
  animation: logoJpGlyphIn 380ms var(--ease-out-quint) both;
}

.logo-group-jp path:nth-child(1) { animation-delay: 300ms; }
.logo-group-jp path:nth-child(2) { animation-delay: 345ms; }
.logo-group-jp path:nth-child(3) { animation-delay: 390ms; }
.logo-group-jp path:nth-child(4) { animation-delay: 435ms; }
.logo-group-jp path:nth-child(5) { animation-delay: 480ms; }
.logo-group-jp path:nth-child(6) { animation-delay: 525ms; }

@keyframes logoSummerIn {
  from {
    opacity: 0;
    transform: translateY(-8px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes logoInvasionIn {
  from {
    opacity: 0;
    transform: translateX(-10px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

@keyframes logoJpGlyphIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.title-top-util {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.util-ghost-btn {
  background:
    linear-gradient(225deg, rgba(47, 216, 255, 0.62) 0 6.0px, transparent 6.3px),
    rgba(7, 14, 28, 0.78);
  color: #d8f2ff;
  border: 1px solid rgba(47, 216, 255, 0.38);
  clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 8px, 100% 100%, 0 100%);
  padding: 5px 12px 5px 10px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
  cursor: pointer;
  transition:
    background-color var(--t-fast) var(--ease-out-quint),
    border-color var(--t-fast) var(--ease-out-quint),
    color var(--t-fast) var(--ease-out-quint),
    transform var(--t-fast) var(--ease-out-quint);
}

.util-ghost-btn:hover {
  background:
    linear-gradient(225deg, #2fd8ff 0 6.0px, transparent 6.3px),
    rgba(16, 34, 64, 0.92);
  border-color: var(--accent-cyan);
  color: #ffffff;
  transform: translateY(-1px);
}

.util-ghost-btn:active {
  transform: translateY(0) scale(0.97);
}

/* Compact Upper-Right Daily Challenge Tactical Dispatch Card (uniform 1px chamfered hairline frame + corner L-ticks) */
.daily-dispatch-btn {
  width: 242px;
  margin-top: 4px;
  padding: 9px 14px 8px 12px;
  text-align: left;
  background:
    linear-gradient(225deg, rgba(255, 214, 68, 0.72) 0 8.8px, transparent 9.1px),
    linear-gradient(#ffd644, #ffd644) 0 0 / 10px 1px no-repeat,
    linear-gradient(#ffd644, #ffd644) 0 0 / 1px 10px no-repeat,
    linear-gradient(#ffd644, #ffd644) 0 100% / 10px 1px no-repeat,
    linear-gradient(#ffd644, #ffd644) 0 100% / 1px 10px no-repeat,
    linear-gradient(150deg, rgba(16, 28, 50, 0.90) 0%, rgba(7, 15, 30, 0.94) 100%);
  border: 1px solid rgba(255, 214, 68, 0.44);
  clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 12px, 100% 100%, 0 100%);
  filter: drop-shadow(3px 3px 0 rgba(3, 6, 14, 0.82));
  color: #eef6ff;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 3px;
  transition:
    transform var(--t-fast) var(--ease-out-quint),
    background-color var(--t-fast) var(--ease-out-quint),
    border-color var(--t-fast) var(--ease-out-quint),
    filter var(--t-fast) var(--ease-out-quint);
}

.daily-dispatch-btn:hover {
  background:
    linear-gradient(225deg, #ffd644 0 8.8px, transparent 9.1px),
    linear-gradient(#ffd644, #ffd644) 0 0 / 12px 1px no-repeat,
    linear-gradient(#ffd644, #ffd644) 0 0 / 1px 12px no-repeat,
    linear-gradient(#ffd644, #ffd644) 0 100% / 12px 1px no-repeat,
    linear-gradient(#ffd644, #ffd644) 0 100% / 1px 12px no-repeat,
    linear-gradient(150deg, rgba(24, 42, 72, 0.95) 0%, rgba(10, 21, 42, 0.97) 100%);
  border-color: var(--accent-amber);
  transform: translateY(-2px);
  filter: drop-shadow(4px 5px 0 rgba(3, 6, 14, 0.9));
}

.daily-dispatch-btn:active {
  transform: translateY(1px) scale(0.985);
  transition-duration: 55ms;
}

.daily-dispatch-btn:focus-visible {
  outline: 2px solid var(--accent-amber);
  outline-offset: 2px;
}

.daily-disp-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.daily-disp-badge {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.14em;
  color: #161004;
  background: var(--accent-amber);
  padding: 1px 5px;
}

.daily-disp-date {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 800;
  color: #ffe58f;
  font-variant-numeric: tabular-nums;
}

.daily-disp-stage {
  font-size: 11.5px;
  font-weight: 800;
  color: #ffffff;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.daily-disp-cond {
  font-size: 10px;
  font-weight: 600;
  color: #9cecff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.daily-disp-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-top: 4px;
  padding-top: 4px;
  border-top: 1px solid rgba(255, 214, 68, 0.22);
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 800;
  color: #cfe0f5;
  font-variant-numeric: tabular-nums;
}

@keyframes dispatchArrowBlink {
  0%, 100% {
    opacity: 1;
    transform: translateX(0);
  }
  50% {
    opacity: 0.28;
    transform: translateX(2px);
  }
}

.daily-disp-go {
  color: var(--accent-amber);
  letter-spacing: 0.08em;
  display: inline-block;
  animation: dispatchArrowBlink 1.35s ease-in-out infinite;
  transition: transform var(--t-fast) var(--ease-out-quint);
}

.daily-dispatch-btn:hover .daily-disp-go {
  animation: none;
  opacity: 1;
  transform: translateX(2px);
}

/* Compact Upper-Right Online Co-op 2P Dispatch Pill (uniform 1px chamfered hairline frame) */
.coop-dispatch-btn {
  width: 242px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 13px 7px 10px;
  background:
    linear-gradient(225deg, rgba(46, 230, 192, 0.70) 0 7.4px, transparent 7.7px),
    linear-gradient(#2ee6c0, #2ee6c0) 0 0 / 8px 1px no-repeat,
    linear-gradient(#2ee6c0, #2ee6c0) 0 0 / 1px 8px no-repeat,
    linear-gradient(150deg, rgba(11, 27, 36, 0.90) 0%, rgba(6, 15, 24, 0.94) 100%);
  border: 1px solid rgba(46, 230, 192, 0.44);
  clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 10px, 100% 100%, 0 100%);
  filter: drop-shadow(2px 2px 0 rgba(3, 6, 14, 0.84));
  color: #e6fff6;
  cursor: pointer;
  transition:
    transform var(--t-fast) var(--ease-out-quint),
    background-color var(--t-fast) var(--ease-out-quint),
    border-color var(--t-fast) var(--ease-out-quint);
}

.coop-dispatch-btn:hover {
  background:
    linear-gradient(225deg, #2ee6c0 0 7.4px, transparent 7.7px),
    linear-gradient(#62ffd8, #62ffd8) 0 0 / 10px 1px no-repeat,
    linear-gradient(#62ffd8, #62ffd8) 0 0 / 1px 10px no-repeat,
    linear-gradient(150deg, rgba(16, 42, 52, 0.96) 0%, rgba(8, 22, 32, 0.98) 100%);
  border-color: #62ffd8;
  transform: translateY(-1px);
}

.coop-dispatch-btn.connected {
  background:
    linear-gradient(225deg, #52f288 0 7.4px, transparent 7.7px),
    linear-gradient(150deg, rgba(16, 48, 36, 0.95) 0%, rgba(8, 24, 20, 0.97) 100%);
  border-color: #52f288;
}

.coop-disp-badge {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.12em;
  color: #051614;
  background: #2ee6c0;
  padding: 2px 5px;
}

.coop-disp-label {
  flex: 1;
  text-align: left;
  font-size: 11px;
  font-weight: 800;
  color: #eafff6;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.coop-disp-arrow {
  font-size: 10px;
  color: #2ee6c0;
  display: inline-block;
  animation: dispatchArrowBlink 1.35s ease-in-out 0.35s infinite;
}

.coop-dispatch-btn:hover .coop-disp-arrow {
  animation: none;
  opacity: 1;
  transform: translateX(2px);
}

/* In-Game Co-op 2P Status Strip (uniform 1px chamfered ribbon) */
#coop-hud-strip {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 3px 13px;
  white-space: nowrap;
  background:
    linear-gradient(135deg, rgba(46, 230, 192, 0.65) 0 6.0px, transparent 6.3px),
    linear-gradient(315deg, rgba(46, 230, 192, 0.65) 0 6.0px, transparent 6.3px),
    linear-gradient(180deg, rgba(10, 24, 34, 0.92), rgba(6, 13, 22, 0.94));
  border: 1px solid rgba(46, 230, 192, 0.50);
  clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.coop-hud-tag {
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.1em;
  color: #06180d;
  background: #52f288;
  padding: 1px 5px;
}

.coop-hud-role {
  font-size: 10px;
  font-weight: 800;
  color: #b4ffcf;
}

.coop-hud-partner {
  font-size: 10px;
  font-weight: 800;
  color: #74e8ff;
}

.coop-hud-partner.covering {
  color: #ffe455;
}

.coop-hud-rtt {
  font-size: 9.5px;
  font-weight: 700;
  color: rgba(180, 232, 200, 0.78);
}

/* Online Co-op Lobby Modal (uniform 1px emerald hairline frame) */
.coop-card {
  width: min(650px, 94%);
  border-color: rgba(46, 230, 192, 0.48);
  background:
    linear-gradient(225deg, rgba(46, 230, 192, 0.72) 0 13.0px, transparent 13.4px),
    linear-gradient(45deg, rgba(46, 230, 192, 0.56) 0 10.2px, transparent 10.6px),
    linear-gradient(#2ee6c0, #2ee6c0) 0 0 / 16px 1px no-repeat,
    linear-gradient(#2ee6c0, #2ee6c0) 0 0 / 1px 16px no-repeat,
    repeating-linear-gradient(90deg, rgba(46, 230, 192, 0.34) 0 2px, transparent 2px 9px) 26px 6px / 140px 2px no-repeat,
    linear-gradient(160deg, rgba(14, 27, 49, 0.96) 0%, rgba(7, 16, 33, 0.98) 100%);
}

.coop-desc {
  margin: 4px 0 12px;
  font-size: 12px;
  line-height: 1.55;
  color: #c8e6de;
}

.coop-desc strong {
  color: #9cffbf;
}

.coop-status-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: rgba(6, 14, 14, 0.90);
  border: 1px solid rgba(116, 232, 255, 0.28);
  margin-bottom: 12px;
  font-size: 12px;
  color: #e4f8ff;
}

.coop-status-dot {
  width: 8px;
  height: 8px;
  flex-shrink: 0;
  background: #6a8290;
  border: 1px solid #04080a;
}
.coop-status-bar.waiting .coop-status-dot,
.coop-status-bar.connecting .coop-status-dot {
  background: #ffd644;
  animation: visorBlink 0.7s steps(2) infinite;
}
.coop-status-bar.connected {
  border-color: rgba(82, 242, 136, 0.65);
  background: rgba(10, 28, 18, 0.92);
}
.coop-status-bar.connected .coop-status-dot {
  background: #52f288;
}
.coop-status-bar.error {
  border-color: rgba(255, 78, 98, 0.65);
  background: rgba(34, 10, 14, 0.92);
}
.coop-status-bar.error .coop-status-dot {
  background: #ff4e62;
}

.coop-room-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 14px;
  margin-bottom: 12px;
  background: rgba(10, 26, 20, 0.92);
  border: 1px solid rgba(82, 242, 136, 0.55);
}

.coop-room-code-wrap {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.coop-room-label {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.18em;
  color: #8af7ae;
}

.coop-room-code {
  font-family: var(--font-mono);
  font-size: 30px;
  font-weight: 900;
  letter-spacing: 0.22em;
  color: #ffffff;
  line-height: 1;
}

.coop-room-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.coop-room-selection {
  font-size: 11.5px;
  font-weight: 700;
  color: #ffe89e;
}

.coop-copy-btn {
  padding: 5px 12px;
  font-size: 11px;
}

.coop-panels {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.coop-panel {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 13px;
  background:
    linear-gradient(225deg, rgba(47, 216, 255, 0.52) 0 7.4px, transparent 7.7px),
    linear-gradient(160deg, rgba(14, 27, 49, 0.90), rgba(7, 16, 33, 0.94));
  border: 1px solid rgba(47, 216, 255, 0.28);
  clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 10px, 100% 100%, 0 100%);
}

.coop-panel-head {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.14em;
  color: var(--accent-cyan);
}

.coop-panel p {
  margin: 0;
  font-size: 11.5px;
  line-height: 1.5;
  color: #bdd8f2;
}

.coop-join-row {
  display: flex;
  gap: 6px;
}

.coop-code-input {
  width: 96px;
  flex-shrink: 0;
  padding: 8px 10px;
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 900;
  letter-spacing: 0.18em;
  text-align: center;
  color: #ffffff;
  background: #060d1c;
  border: 1px solid rgba(116, 232, 255, 0.52);
  outline: none;
  user-select: text;
  -webkit-user-select: text;
}

.coop-code-input:focus {
  border-color: #52f288;
}

.coop-action-btn {
  padding: 8px 14px;
  font-size: 12.5px;
  flex: 1;
}

.coop-ready-actions {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.coop-ready-actions > button {
  flex: 1;
}

.coop-daily-launch-btn {
  border-color: rgba(255, 214, 68, 0.65);
  color: #ffe888;
}

.coop-guest-wait {
  padding: 10px 12px;
  margin-bottom: 12px;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  color: #a8ffd0;
  background: rgba(12, 32, 22, 0.78);
  border: 1px dashed rgba(82, 242, 136, 0.52);
}

.coop-foot-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding-top: 10px;
  border-top: 1px solid rgba(130, 195, 255, 0.18);
}

.coop-foot-btns {
  display: flex;
  gap: 8px;
}

/* Lower Tactical Dock */
.title-bottom-dock {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.title-command-bar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  padding: 0 clamp(22px, 3%, 36px);
}

.title-controls-note {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 12px;
  font-size: 11px;
  font-weight: 600;
  color: #cfe4ff;
  padding-bottom: 4px;
}

.ctrl-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.ctrl-item.ctrl-key {
  color: #fff0b8;
}

.title-controls-note kbd {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 800;
  line-height: 1;
  padding: 3px 5px;
  color: #eef7ff;
  background: rgba(10, 18, 36, 0.86);
  border: 1px solid rgba(135, 205, 255, 0.45);
  box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.6);
}

.ctrl-item.ctrl-key kbd {
  border-color: rgba(255, 214, 68, 0.68);
  color: #ffe888;
}

.command-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

/* Compact 3-Position Hardware Difficulty Switch */
.diff-switch {
  display: inline-flex;
  align-items: stretch;
  background: linear-gradient(180deg, rgba(11, 21, 38, 0.90), rgba(7, 13, 24, 0.94));
  border: 1px solid rgba(47, 216, 255, 0.36);
  clip-path: polygon(6px 0, 100% 0, 100% calc(100% - 6px), calc(100% - 6px) 100%, 0 100%, 0 6px);
  padding: 2px;
  gap: 2px;
}

.diff-btn {
  background: transparent;
  border: 1px solid transparent;
  color: rgba(180, 214, 240, 0.76);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.1em;
  padding: 7px 10px;
  cursor: pointer;
  transition:
    background-color var(--t-fast) var(--ease-out-quint),
    color var(--t-fast) var(--ease-out-quint),
    border-color var(--t-fast) var(--ease-out-quint),
    transform 60ms;
}

.diff-btn:hover {
  color: #ffffff;
  background: rgba(24, 48, 82, 0.72);
}

.diff-btn:active {
  transform: translateY(1px);
}

.diff-btn.active {
  color: #ffffff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

.diff-btn.diff-easy.active {
  background: rgba(18, 72, 62, 0.92);
  border-color: #2ee6c0;
  color: #ccfff4;
}

.diff-btn.diff-normal.active {
  background: rgba(16, 58, 92, 0.94);
  border-color: #2fd8ff;
  color: #e0fbff;
}

.diff-btn.diff-hard.active {
  background: rgba(108, 22, 36, 0.94);
  border-color: #ff4d5e;
  color: #ffe2e6;
}

.diff-btn:focus-visible {
  outline: 2px solid var(--accent-cyan);
  outline-offset: 1px;
}

.primary-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background:
    linear-gradient(135deg, rgba(255, 232, 180, 0.72) 0 6.7px, transparent 7.0px),
    linear-gradient(315deg, rgba(255, 214, 148, 0.65) 0 6.7px, transparent 7.0px),
    linear-gradient(180deg, #ff6e38 0%, #e02e42 100%);
  color: #ffffff;
  border: 1px solid #ffd694;
  clip-path: polygon(9px 0, 100% 0, 100% calc(100% - 9px), calc(100% - 9px) 100%, 0 100%, 0 9px);
  font-size: 14px;
  font-weight: 900;
  letter-spacing: 0.12em;
  padding: 10px 24px;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 244, 214, 0.45);
  filter: drop-shadow(0 3px 0 #6e101c) drop-shadow(0 6px 14px rgba(0, 0, 0, 0.46));
  transition:
    transform var(--t-fast) var(--ease-out-quint),
    filter var(--t-fast) var(--ease-out-quint);
}

.primary-btn:hover {
  transform: translateY(-2px);
  filter: brightness(1.07) drop-shadow(0 5px 0 #6e101c) drop-shadow(0 9px 18px rgba(0, 0, 0, 0.54));
}

.primary-btn:active {
  transform: translateY(2px);
  transition-duration: 55ms;
  filter: drop-shadow(0 1px 0 #6e101c) drop-shadow(0 2px 6px rgba(0, 0, 0, 0.5));
}

.sortie-btn {
  padding: 10px 24px 10px 26px;
  gap: 12px;
  flex-shrink: 0;
}

.sortie-main {
  font-size: clamp(16px, 1.6vw, 20px);
  font-weight: 900;
  letter-spacing: 0.2em;
  line-height: 1;
}

.sortie-sub {
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.14em;
  color: rgba(255, 242, 210, 0.9);
  padding-left: 10px;
  border-left: 1px solid rgba(255, 232, 185, 0.45);
}

.sortie-arrow {
  font-size: 11px;
  line-height: 1;
  transition: transform var(--t-fast) var(--ease-out-quint);
}

.sortie-btn:hover .sortie-arrow {
  transform: translateX(3px);
}

.secondary-btn {
  background:
    linear-gradient(225deg, rgba(47, 216, 255, 0.56) 0 6.0px, transparent 6.3px),
    linear-gradient(45deg, rgba(47, 216, 255, 0.45) 0 6.0px, transparent 6.3px),
    linear-gradient(165deg, rgba(14, 27, 49, 0.92), rgba(7, 16, 33, 0.94));
  color: #dcf2ff;
  border: 1px solid rgba(47, 216, 255, 0.42);
  clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 8px, 100% 100%, 8px 100%, 0 calc(100% - 8px));
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 10px 18px;
  cursor: pointer;
  transition:
    background-color var(--t-fast) var(--ease-out-quint),
    border-color var(--t-fast) var(--ease-out-quint),
    color var(--t-fast) var(--ease-out-quint),
    transform var(--t-fast) var(--ease-out-quint);
}

.secondary-btn:hover {
  background:
    linear-gradient(225deg, #2fd8ff 0 6.0px, transparent 6.3px),
    linear-gradient(45deg, #2fd8ff 0 6.0px, transparent 6.3px),
    linear-gradient(165deg, rgba(24, 48, 86, 0.96), rgba(12, 26, 52, 0.98));
  border-color: var(--accent-cyan);
  color: #ffffff;
  transform: translateY(-1px);
}

.secondary-btn:active {
  transform: translateY(1px) scale(0.985);
  transition-duration: 55ms;
}

/* Single-Row 8-Sector Selector Strip */
.sector-strip-wrap {
  padding: 0 clamp(22px, 3%, 36px);
}

.sector-strip-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 5px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.16em;
  color: rgba(168, 214, 255, 0.8);
}

.stage-selector {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 5px;
}

/* Tactical Stage Index Plates */
.stage-btn {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 62px;
  background:
    linear-gradient(315deg, rgba(47, 216, 255, 0.56) 0 6.7px, transparent 7.0px),
    linear-gradient(#2fd8ff, #2fd8ff) 0 0 / 8px 1px no-repeat,
    linear-gradient(#2fd8ff, #2fd8ff) 0 0 / 1px 8px no-repeat,
    linear-gradient(165deg, rgba(11, 21, 39, 0.88) 0%, rgba(6, 12, 24, 0.92) 100%);
  border: 1px solid rgba(47, 216, 255, 0.30);
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - 9px), calc(100% - 9px) 100%, 0 100%);
  color: #d7ecff;
  padding: 7px 8px 7px;
  cursor: pointer;
  text-align: left;
  transition:
    transform var(--t-fast) var(--ease-out-quint),
    background-color var(--t-fast) var(--ease-out-quint),
    border-color var(--t-fast) var(--ease-out-quint),
    filter var(--t-fast) var(--ease-out-quint);
}

.stage-btn:hover {
  background:
    linear-gradient(315deg, #2fd8ff 0 6.7px, transparent 7.0px),
    linear-gradient(#2fd8ff, #2fd8ff) 0 0 / 10px 1px no-repeat,
    linear-gradient(#2fd8ff, #2fd8ff) 0 0 / 1px 10px no-repeat,
    linear-gradient(165deg, rgba(18, 36, 68, 0.94) 0%, rgba(10, 20, 42, 0.96) 100%);
  border-color: rgba(47, 216, 255, 0.72);
  transform: translateY(-2px);
}

.stage-btn:active {
  transform: translateY(0) scale(0.985);
  transition-duration: 55ms;
}

.stage-btn.selected {
  background:
    linear-gradient(315deg, #ffd644 0 6.7px, transparent 7.0px),
    linear-gradient(#ffd644, #ffd644) 0 0 / 12px 1px no-repeat,
    linear-gradient(#ffd644, #ffd644) 0 0 / 1px 12px no-repeat,
    linear-gradient(#ffd644, #ffd644) 100% 0 / 12px 1px no-repeat,
    linear-gradient(#ffd644, #ffd644) 100% 0 / 1px 12px no-repeat,
    linear-gradient(165deg, rgba(24, 48, 88, 0.96) 0%, rgba(12, 26, 52, 0.97) 100%);
  border-color: rgba(255, 214, 68, 0.88);
  transform: translateY(-3px);
  filter: drop-shadow(0 5px 10px rgba(0, 0, 0, 0.45));
}

.stage-btn:focus-visible,
.primary-btn:focus-visible,
.secondary-btn:focus-visible,
.util-ghost-btn:focus-visible {
  outline: 2px solid var(--accent-cyan);
  outline-offset: 2px;
}

.stage-btn-num {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 800;
  color: var(--accent-cyan);
  letter-spacing: 0.1em;
  line-height: 1;
}

.stage-btn.selected .stage-btn-num {
  color: var(--accent-amber);
}

.stage-btn.selected .stage-btn-num::before {
  content: "▸ ";
}

.stage-btn-name {
  font-size: clamp(10px, 0.92vw, 11.5px);
  font-weight: 800;
  line-height: 1.25;
  color: #ffffff;
  margin-top: 3px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.stage-btn-tag {
  font-family: var(--font-mono);
  font-size: 9px;
  color: rgba(176, 206, 240, 0.85);
  margin-top: 4px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.stage-btn-tag > span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-rank {
  font-family: var(--font-mono);
  font-weight: 900;
  font-size: 10px;
  line-height: 1;
  padding: 2px 4px;
  flex-shrink: 0;
}

.card-rank.rank-S { background: #ffcf33; color: #161005; }
.card-rank.rank-A { background: #5eeeff; color: #061822; }
.card-rank.rank-B { background: #74e898; color: #071c10; }
.card-rank.rank-C { background: #8da2bd; color: #0d1420; }

@media (max-width: 860px) {
  .stage-selector {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  .stage-btn {
    min-height: 52px;
  }
  .sortie-sub {
    display: none;
  }
}

.credit-footer {
  width: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 2px;
  font-size: 10px;
  color: rgba(196, 218, 244, 0.78);
  background: rgba(4, 7, 15, 0.78);
  border-top: 1px solid rgba(130, 195, 255, 0.18);
  padding: 5px 14px;
}

.credit-footer a {
  color: #8eeeff;
  text-decoration: none;
  border-bottom: 1px solid rgba(142, 238, 255, 0.4);
  transition: color var(--t-fast) var(--ease-out-quint), border-color var(--t-fast) var(--ease-out-quint);
}

.credit-footer a:hover {
  color: #ffffff;
  border-bottom-color: #ffffff;
}

.credit-footer .sep {
  opacity: 0.4;
}

/* --- Emotional Aftermath Floating Caption (Soft ambient dim veil + clean flat editorial title over live sky & smoke) --- */
#aftermath-banner {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0 4% 12%; /* 中央より少し上（屋根や電線に重ならない高さ） */
  text-align: center;
  pointer-events: none;
  z-index: 11;
  background: radial-gradient(
    ellipse 80% 60% at 50% 40%,
    rgba(4, 9, 20, 0.38) 0%,
    rgba(4, 9, 20, 0.22) 56%,
    rgba(4, 9, 20, 0.14) 100%
  );
  animation: aftermathVeilIn 680ms var(--ease-out-quint) both;
}

.aftermath-inner {
  animation: aftermathIn 420ms var(--ease-out-quint) 90ms both;
}

@keyframes aftermathVeilIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes aftermathIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.aftermath-en {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.42em;
  color: #ffe694;
}

.aftermath-en::before,
.aftermath-en::after {
  content: "";
  display: inline-block;
  width: 28px;
  height: 1px;
  background: rgba(255, 230, 148, 0.72);
}

.aftermath-jp {
  margin-top: 6px;
  font-size: clamp(20px, 2.8vw, 30px);
  font-weight: 900;
  letter-spacing: 0.22em;
  line-height: 1.5;
  color: #ffffff;
}
.aftermath-jp span {
  display: inline-block;
  white-space: nowrap;
}
.aftermath-jp .dash {
  white-space: pre;
}
@media (max-width: 640px) {
  .aftermath-jp .dash {
    display: none;
  }
}

/* --- Borderless Quiet Sky-Gaze GAME OVER Overlay (ZERO box / background / drop-shadow!) --- */
#defeat-overlay {
  position: absolute;
  inset: 0;
  z-index: 25;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: transparent;
  cursor: pointer;
  pointer-events: auto;
  animation: defeatFadeIn 1250ms var(--ease-out-quint) both;
}

@keyframes defeatFadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.defeat-title {
  font-family: var(--font-display);
  font-size: clamp(42px, 6.8vw, 82px);
  font-weight: 400;
  letter-spacing: 0.22em;
  padding-left: 0.22em;
  color: #ffffff;
  line-height: 1;
}

.defeat-prompt {
  font-family: var(--font-mono);
  font-size: clamp(10px, 1.1vw, 12px);
  font-weight: 700;
  letter-spacing: 0.26em;
  padding-left: 0.26em;
  color: rgba(240, 248, 255, 0.90);
  animation: defeatPromptIn 0.9s ease-out both, defeatPromptPulse 2.1s 0.9s ease-in-out infinite;
}

/* 後から出す案内の場所を先に取っておく（display:none だと、出た瞬間に GAME OVER の文字がずれる） */
#defeat-prompt.hidden {
  display: block !important;
  visibility: hidden;
  animation: none;
}

@keyframes defeatPromptIn {
  from { opacity: 0; }
  to   { opacity: 0.45; }
}

@keyframes defeatPromptPulse {
  0%, 100% { opacity: 0.45; }
  50%      { opacity: 0.96; }
}

/* --- Modals: Tactical Debrief Result & License Dossier --- */
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, rgba(6, 12, 24, 0.56) 0%, rgba(3, 6, 14, 0.84) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 30;
  backdrop-filter: blur(4px);
  animation: backdropIn var(--t-med) var(--ease-out-quint) both;
}

@keyframes backdropIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Tactical Debrief & Co-op Modal Frame */
.modal-card {
  position: relative;
  width: min(620px, 92%);
  background:
    linear-gradient(225deg, rgba(47, 216, 255, 0.72) 0 13.0px, transparent 13.4px),
    linear-gradient(45deg, rgba(46, 230, 192, 0.56) 0 10.2px, transparent 10.6px),
    linear-gradient(#2fd8ff, #2fd8ff) 0 0 / 16px 1px no-repeat,
    linear-gradient(#2fd8ff, #2fd8ff) 0 0 / 1px 16px no-repeat,
    repeating-linear-gradient(90deg, rgba(47, 216, 255, 0.34) 0 2px, transparent 2px 9px) 26px 6px / 140px 2px no-repeat,
    linear-gradient(160deg, rgba(14, 27, 49, 0.96) 0%, rgba(7, 16, 33, 0.98) 100%);
  border: 1px solid rgba(47, 216, 255, 0.46);
  clip-path: polygon(0 0, calc(100% - 18px) 0, 100% 18px, 100% 100%, 14px 100%, 0 calc(100% - 14px));
  padding: 24px 26px 22px;
  text-align: left;
  filter: drop-shadow(0 20px 36px rgba(0, 0, 0, 0.72));
  animation: cardSettle 190ms var(--ease-out-quint) both;
}

@keyframes cardSettle {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

#result-overlay.is-defeat .result-card {
  border-color: rgba(255, 77, 94, 0.62);
  background:
    linear-gradient(225deg, rgba(255, 77, 94, 0.78) 0 13.0px, transparent 13.4px),
    linear-gradient(45deg, rgba(255, 77, 94, 0.56) 0 10.2px, transparent 10.6px),
    linear-gradient(#ff4d5e, #ff4d5e) 0 0 / 16px 1px no-repeat,
    linear-gradient(#ff4d5e, #ff4d5e) 0 0 / 1px 16px no-repeat,
    linear-gradient(160deg, rgba(26, 12, 22, 0.96) 0%, rgba(12, 7, 14, 0.98) 100%);
}
#result-overlay.is-defeat .result-eyebrow {
  color: #ff6e7f;
}

.result-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(130, 195, 255, 0.2);
}

.result-heading {
  flex: 1;
  min-width: 0;
}

.result-eyebrow {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.24em;
  color: var(--accent-cyan);
}

.result-title {
  margin: 5px 0 6px;
  font-size: clamp(22px, 2.8vw, 29px);
  font-weight: 900;
  letter-spacing: 0.1em;
  color: #ffffff;
  line-height: 1.15;
}

.result-sub {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.55;
  color: #bfd7f5;
}

.rank-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
  padding-left: 18px;
  border-left: 1px solid rgba(130, 195, 255, 0.2);
}

.rank-label {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.2em;
  color: #8fc8ff;
}

.rank-badge {
  font-family: var(--font-display);
  font-size: 42px;
  font-weight: 400;
  line-height: 1;
  min-width: 62px;
  text-align: center;
  padding: 6px 14px;
  border: 2px solid rgba(255, 255, 255, 0.7);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
}

.rank-badge.rank-S { background: linear-gradient(180deg, #ffe866 0%, #ff9922 100%); color: #1a0f00; border-color: #fff6c2; }
.rank-badge.rank-A { background: linear-gradient(180deg, #7ef6ff 0%, #2698e6 100%); color: #041524; border-color: #d6fbff; }
.rank-badge.rank-B { background: linear-gradient(180deg, #8df5a8 0%, #2cb866 100%); color: #041c0d; }
.rank-badge.rank-C { background: linear-gradient(180deg, #b8c8dc 0%, #6c7f99 100%); color: #0c1420; }

.rank-best {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.14em;
  white-space: nowrap;
  color: #ffe866;
  background: rgba(255, 165, 30, 0.2);
  border: 1px solid #ffd54f;
  padding: 2px 6px;
}

.result-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: rgba(130, 195, 255, 0.22);
  border: 1px solid rgba(130, 195, 255, 0.26);
  margin: 16px 0 20px;
}

.stat-box {
  background: rgba(10, 19, 39, 0.96);
  padding: 10px 12px;
}

.stat-box span {
  display: block;
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 700;
  color: #7eb6ec;
  letter-spacing: 0.12em;
}

.stat-box strong {
  display: block;
  margin-top: 4px;
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  color: #f4f9ff;
}

.stat-box:first-child strong {
  color: #ffe577;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

@media (prefers-reduced-motion: reduce) {
  .visor-shell.console-alert .visor-viewport,
  .visor-shell.console-alert .vpip-iff i,
  .visor-shell.console-radio-tx .vhf-bars i,
  .comms-wave i,
  .title-hero,
  .logo-group-summer,
  .logo-group-invasion,
  .logo-group-jp path,
  .daily-disp-go,
  .coop-disp-arrow,
  .tut-disp-arrow,
  #aftermath-banner,
  .modal-backdrop,
  .modal-card {
    animation: none !important;
  }
  .stage-btn,
  .primary-btn,
  .secondary-btn,
  .util-ghost-btn,
  .daily-dispatch-btn,
  .daily-disp-go,
  .diff-btn,
  .air-support-btn,
  .sortie-arrow {
    transition: none;
  }
}

/* =========================================================================
   MOBILE / SMARTPHONE PORTRAIT-ONLY HANDHELD LAYOUT
   - Desktop: completely untouched (mobile deck & rotate notice stay display: none)
   - Portrait Phone (<= 640px portrait): 16:9 top viewport + handheld tactical control deck
   - Touch Phone Rotated Sideways: clean portrait-orientation notice
   ========================================================================= */
#mobile-portrait-deck,
#mobile-rotate-notice {
  display: none;
}

@media (hover: none) and (pointer: coarse) and (orientation: landscape) and (max-height: 500px) {
  #mobile-rotate-notice {
    position: fixed;
    inset: 0;
    z-index: 60;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(5, 9, 8, 0.94);
  }

  .rotate-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 18px 24px;
    background: #0a1322;
    border: 1px solid rgba(47, 216, 255, 0.44);
    text-align: center;
  }

  .rotate-tag {
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.16em;
    color: var(--accent-cyan);
  }

  .rotate-card strong {
    font-size: 15px;
    font-weight: 800;
    color: #f0faff;
  }

  .rotate-card span {
    font-size: 12px;
    color: #9dc2bc;
  }
}

/* --- Portrait Smartphone Handheld Tactical Deck (e.g. 390x844 iPhone / Android) --- */
@media (max-width: 640px) and (orientation: portrait) {
  #app {
    align-items: stretch;
    justify-content: flex-start;
  }

  .console-chassis.visor-shell {
    width: 100vw;
    height: 100dvh;
    max-width: 100vw;
    max-height: 100dvh;
    align-items: stretch;
    justify-content: flex-start;
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
    background: #070b0a;
  }

  .visor-mid-row,
  .visor-viewport {
    width: 100%;
    flex-shrink: 0;
  }

  #stage-frame {
    width: 100vw;
    height: calc(100vw * 9 / 16);
    max-height: 44dvh;
    box-shadow: 0 2px 0 #1f2e28;
  }

  /* 遊んでいる間は、左右を少し切って景色を大きく見せる（照準に合わせて横に動く。main.js の _updateView）
     下の操作パネルに 350px 以上を残す */
  .console-chassis:not(.is-title) #stage-frame {
    width: 100vw;
    height: max(calc(100vw * 9 / 16), min(90vw, calc(100dvh - 360px)));
    max-height: none;
  }
  .console-chassis:not(.is-title) #gl-canvas,
  .console-chassis:not(.is-title) #hud-canvas {
    inset: 0 auto auto 0;
    width: auto;
    height: 100%;
    max-width: none;
    aspect-ratio: 16 / 9;
    transform: translate3d(var(--pan, 0px), 0, 0);
  }

  /* Hide in-frame comms in portrait (relocated cleanly into lower deck!) */
  #comms-box {
    display: none !important;
  }

  .air-tag kbd,
  .daily-hud-cond,
  .allies-label {
    display: none;
  }

  #hud-top {
    top: 4px;
    left: 5px;
    right: 5px;
    gap: 4px;
  }
  .hud-chip {
    padding: 2px 5px;
    gap: 4px;
  }
  .hud-stage-label {
    font-size: 8.5px;
    padding: 1px 4px;
  }
  .bar-track {
    width: 44px;
    height: 6px;
  }
  .hp-num {
    font-size: 9.5px;
    min-width: 18px;
  }
  .score-val {
    font-size: 10.5px;
    letter-spacing: 0.04em;
  }
  .tool-row {
    margin-left: 2px;
    padding-left: 4px;
    gap: 2px;
  }
  .mini-btn {
    font-size: 9px;
    padding: 2px 5px;
  }
  #boss-bar-wrap {
    width: 152px;
    padding: 2px 6px;
  }
  .boss-title {
    font-size: 7.5px;
    margin-bottom: 1px;
  }
  #allies-strip {
    padding: 1px 4px;
    gap: 2px;
  }
  .ally-pip {
    font-size: 7.5px;
    padding: 1px 3px;
  }
  #daily-hud-strip {
    padding: 1px 5px;
    gap: 4px;
  }
  .daily-hud-tag,
  .daily-hud-lv {
    font-size: 7.5px;
  }
  .daily-hud-time {
    font-size: 9.5px;
  }

  #hud-bottom {
    bottom: 4px;
    left: 4px;
    right: 4px;
  }
  .micro-gauge {
    padding: 2px 5px;
    gap: 4px;
  }
  .ammo-track,
  .missile-track {
    width: 34px;
    height: 6px;
  }
  .air-track {
    width: 26px;
    height: 6px;
  }
  .missile-tag {
    font-size: 7.5px;
  }
  .missile-count {
    font-size: 8.5px;
    min-width: 20px;
  }

  /* Portrait Full-Height Title Screen: Top 16:9 Live Art + Clean Scroll-Free Tactical Deck Below */
  #title-overlay {
    position: fixed;
    inset: 0;
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
    justify-content: flex-start;
    overflow-y: auto;
    background: linear-gradient(
      180deg,
      rgba(5, 11, 24, 0.50) 0,
      rgba(5, 11, 24, 0.12) calc(100vw * 9 / 16 - 32px),
      rgba(6, 11, 18, 0.96) calc(100vw * 9 / 16),
      #060b10 100%
    );
  }

  .title-top-row {
    flex-direction: column;
    align-items: stretch;
    justify-content: space-between;
    padding: 12px 14px 8px;
    gap: 10px;
  }

  .title-hero {
    max-width: 100%;
    min-height: calc(100vw * 9 / 16 - 20px);
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
  }
  .title-logo-heading {
    margin-top: 6px;
  }
  .title-logo-svg {
    width: clamp(230px, 68vw, 290px);
  }
  .title-controls-note,
  .sortie-sub {
    display: none;
  }

  .title-top-util {
    align-items: stretch;
    gap: 8px;
  }
  .daily-dispatch-btn,
  .coop-dispatch-btn {
    width: 100%;
    margin-top: 0;
    padding: 8px 11px;
  }
  .util-ghost-btn {
    align-self: flex-end;
    font-size: 9.5px;
    padding: 5px 10px;
  }

  .title-bottom-dock {
    flex: 1;
    gap: 10px;
    padding-top: 2px;
  }
  .title-command-bar {
    padding: 0 14px;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  .command-actions {
    width: 100%;
    justify-content: space-between;
    gap: 8px;
  }
  .diff-switch {
    flex: 0 0 auto;
  }
  .diff-btn {
    padding: 9px 8px;
    font-size: 9.5px;
  }
  .sortie-btn {
    flex: 1;
    padding: 10px 14px;
    gap: 8px;
  }
  .sortie-main {
    font-size: 16px;
  }

  .sector-strip-wrap {
    padding: 0 14px;
  }
  .sector-strip-meta {
    font-size: 9px;
    margin-bottom: 6px;
  }
  .stage-selector {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }
  .stage-btn {
    min-height: 54px;
    padding: 6px 8px;
  }
  .stage-btn.selected {
    transform: none;
  }
  .stage-btn-name {
    font-size: 11.5px;
    -webkit-line-clamp: 1;
  }

  .credit-footer {
    margin-top: auto;
    flex-wrap: wrap;
    font-size: 9px;
    padding: 8px 12px;
    text-align: center;
  }

  /* Portrait Handheld Gameplay Control Deck directly below the 16:9 viewport! */
  .console-chassis.is-playing #mobile-portrait-deck {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    width: 100%;
    padding: 8px 10px max(12px, env(safe-area-inset-bottom));
    gap: 8px;
    background: linear-gradient(180deg, #0c1310 0%, #070b09 100%);
    touch-action: none;
  }

  .deck-radio-strip {
    display: flex;
    align-items: center;
    gap: 7px;
    min-height: 36px;
    padding: 6px 12px 6px 10px;
    background:
      linear-gradient(225deg, rgba(46, 230, 192, 0.72) 0 7.4px, transparent 7.7px),
      linear-gradient(#2ee6c0, #2ee6c0) 0 0 / 8px 1px no-repeat,
      linear-gradient(#2ee6c0, #2ee6c0) 0 0 / 1px 8px no-repeat,
      linear-gradient(155deg, rgba(10, 22, 34, 0.95), rgba(6, 12, 22, 0.97));
    border: 1px solid rgba(46, 230, 192, 0.42);
    clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 10px, 100% 100%, 0 100%);
  }
  .deck-radio-badge {
    flex-shrink: 0;
    font-size: 9.5px;
    font-weight: 700;
    color: #2ee6c0;
    max-width: 108px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .deck-radio-text {
    font-size: 11px;
    line-height: 1.35;
    color: #effffa;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .deck-aim-pad {
    position: relative;
    flex: 1;
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #070e19;
    background-image:
      linear-gradient(#2fd8ff, #2fd8ff), linear-gradient(#2fd8ff, #2fd8ff),
      linear-gradient(#2fd8ff, #2fd8ff), linear-gradient(#2fd8ff, #2fd8ff),
      linear-gradient(#2ee6c0, #2ee6c0), linear-gradient(#2ee6c0, #2ee6c0),
      linear-gradient(#2ee6c0, #2ee6c0), linear-gradient(#2ee6c0, #2ee6c0),
      linear-gradient(rgba(47, 216, 255, 0.08) 1px, transparent 1px),
      linear-gradient(90deg, rgba(47, 216, 255, 0.08) 1px, transparent 1px);
    background-repeat: no-repeat, no-repeat, no-repeat, no-repeat, no-repeat, no-repeat, no-repeat, no-repeat, repeat, repeat;
    background-size:
      12px 2px, 2px 12px,
      12px 2px, 2px 12px,
      12px 2px, 2px 12px,
      12px 2px, 2px 12px,
      24px 24px, 24px 24px;
    background-position:
      0 0, 0 0,
      100% 0, 100% 0,
      0 100%, 0 100%,
      100% 100%, 100% 100%,
      0 0, 0 0;
    border: 1px solid rgba(47, 216, 255, 0.36);
    box-shadow: inset 0 0 24px rgba(0, 0, 0, 0.72);
    touch-action: none;
  }
  .deck-aim-crosshair {
    position: absolute;
    width: 34px;
    height: 34px;
    border: 1px solid rgba(47, 216, 255, 0.42);
    border-radius: 50%;
    pointer-events: none;
  }
  .deck-aim-crosshair::before,
  .deck-aim-crosshair::after {
    content: "";
    position: absolute;
    background: rgba(47, 216, 255, 0.40);
  }
  .deck-aim-crosshair::before {
    left: 50%; top: -8px; width: 1px; height: 50px;
  }
  .deck-aim-crosshair::after {
    top: 50%; left: -8px; height: 1px; width: 50px;
  }
  .deck-aim-label {
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.14em;
    color: rgba(142, 224, 240, 0.68);
    pointer-events: none;
    margin-top: 66px;
  }

  .deck-fire {
    position: absolute;
    right: 10px;
    bottom: 10px;
    width: clamp(92px, 31vw, 128px);
    max-height: calc(100% - 20px);
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 0;
    color: #ffffff;
    background:
      linear-gradient(315deg, rgba(255, 150, 120, 0.85) 0 8.2px, transparent 8.5px),
      linear-gradient(#ff8a6a, #ff8a6a) 0 0 / 12px 2px no-repeat,
      linear-gradient(#ff8a6a, #ff8a6a) 0 0 / 2px 12px no-repeat,
      linear-gradient(170deg, rgba(168, 42, 34, 0.96), rgba(92, 18, 24, 0.96));
    border: 1px solid rgba(255, 122, 92, 0.78);
    clip-path: polygon(0 0, 100% 0, 100% calc(100% - 11px), calc(100% - 11px) 100%, 0 100%);
    touch-action: none;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
    cursor: pointer;
  }
  .deck-fire strong {
    font-size: 21px;
    font-weight: 900;
    letter-spacing: 0.12em;
    padding-left: 0.12em;
  }
  .deck-fire span {
    font-family: var(--font-mono);
    font-size: 9.5px;
    font-weight: 800;
    color: #ffd0c2;
  }
  .deck-fire strong,
  .deck-fire span {
    pointer-events: none;
  }
  .deck-fire.active {
    background: linear-gradient(170deg, #ff6a45, #d8301f);
    border-color: #ffd9a8;
  }
  .deck-fire.empty {
    opacity: 0.6;
  }
  @media (max-width: 350px) {
    .deck-aim-label {
      display: none;
    }
  }

  .deck-action-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    flex-shrink: 0;
  }
  .deck-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    height: 60px;
    padding: 5px 6px;
    background:
      linear-gradient(315deg, rgba(47, 216, 255, 0.60) 0 6.0px, transparent 6.3px),
      linear-gradient(#2fd8ff, #2fd8ff) 0 0 / 8px 1px no-repeat,
      linear-gradient(#2fd8ff, #2fd8ff) 0 0 / 1px 8px no-repeat,
      linear-gradient(170deg, #101f36, #08101e);
    border: 1px solid rgba(47, 216, 255, 0.42);
    clip-path: polygon(0 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%);
    color: #eefaff;
    touch-action: none;
    cursor: pointer;
  }
  .deck-btn strong {
    font-size: 12.5px;
    font-weight: 900;
    letter-spacing: 0.05em;
  }
  .deck-btn span {
    font-family: var(--font-mono);
    font-size: 9.5px;
    font-weight: 800;
    color: #9deaff;
  }
  .deck-btn-cover {
    border-color: rgba(255, 214, 68, 0.48);
    background:
      linear-gradient(315deg, rgba(255, 214, 68, 0.65) 0 6.0px, transparent 6.3px),
      linear-gradient(#ffd644, #ffd644) 0 0 / 8px 1px no-repeat,
      linear-gradient(#ffd644, #ffd644) 0 0 / 1px 8px no-repeat,
      linear-gradient(170deg, #161d2c, #0a0f18);
  }
  .deck-btn-cover span { color: #ffe58a; }
  .deck-btn-cover.active {
    background: rgba(215, 148, 22, 0.45);
    border-color: #ffe87a;
  }
  .deck-btn-missile.ready {
    background:
      linear-gradient(315deg, #2fd8ff 0 6.0px, transparent 6.3px),
      linear-gradient(170deg, rgba(18, 52, 78, 0.90), rgba(10, 28, 46, 0.94));
    border-color: #2fd8ff;
  }
  .deck-btn-missile.locking {
    background: rgba(168, 122, 14, 0.56);
    border-color: #ffe455;
  }
  .deck-btn-missile.empty,
  .deck-btn-air.empty {
    opacity: 0.55;
  }
  .deck-btn-air.ready {
    background:
      linear-gradient(315deg, #74dcff 0 6.0px, transparent 6.3px),
      linear-gradient(170deg, rgba(22, 68, 114, 0.85), rgba(11, 34, 60, 0.92));
    border-color: #84dcff;
  }
  .deck-btn-air.active {
    background: rgba(74, 168, 210, 0.45);
    border-color: #ffe455;
  }
  .deck-btn-air.active span {
    color: #ffe866;
  }

  /* Full-Screen Modals & Borderless Defeat Tap Target in Portrait */
  #defeat-overlay {
    position: fixed;
    inset: 0;
    padding-bottom: 40dvh;
  }
  .defeat-title {
    font-size: clamp(30px, 9vw, 44px);
    letter-spacing: 0.22em;
    padding-left: 0.22em;
  }
  #result-overlay,
  #coop-overlay {
    position: fixed;
    inset: 0;
    padding: 14px;
  }
  .coop-panels {
    grid-template-columns: 1fr;
  }
  .modal-card {
    width: 100%;
    max-height: 88dvh;
    overflow-y: auto;
    padding: 16px;
  }
  .result-header {
    gap: 12px;
    padding-bottom: 12px;
  }
  .result-title {
    font-size: 20px;
  }
  .rank-badge {
    font-size: 32px;
    min-width: 52px;
    padding: 4px 10px;
  }
  .result-stats {
    grid-template-columns: repeat(2, 1fr);
    margin: 12px 0 14px;
  }
  .modal-actions {
    justify-content: stretch;
  }
  .modal-actions > button {
    flex: 1 1 45%;
  }
}

/* ===== VR Training Simulator Dispatch Button & Drill Objective HUD (uniform 1px hairline chamfered plates) ===== */
.tutorial-dispatch-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 242px;
  padding: 7px 13px 7px 10px;
  text-align: left;
  cursor: pointer;
  color: #e6f8ff;
  background:
    linear-gradient(225deg, rgba(47, 216, 255, 0.70) 0 7.4px, transparent 7.7px),
    linear-gradient(#2fd8ff, #2fd8ff) 0 0 / 8px 1px no-repeat,
    linear-gradient(#2fd8ff, #2fd8ff) 0 0 / 1px 8px no-repeat,
    linear-gradient(155deg, rgba(12, 26, 48, 0.92), rgba(7, 15, 29, 0.96));
  border: 1px solid rgba(47, 216, 255, 0.44);
  clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 10px, 100% 100%, 0 100%);
  filter: drop-shadow(2px 2px 0 rgba(3, 6, 14, 0.84));
  transition: transform 0.08s, border-color 0.12s, background 0.12s;
}

.tutorial-dispatch-btn:hover {
  transform: translateY(-1px);
  border-color: rgba(47, 216, 255, 0.92);
  background:
    linear-gradient(225deg, #2fd8ff 0 7.4px, transparent 7.7px),
    linear-gradient(#2fd8ff, #2fd8ff) 0 0 / 10px 1px no-repeat,
    linear-gradient(#2fd8ff, #2fd8ff) 0 0 / 1px 10px no-repeat,
    linear-gradient(155deg, rgba(18, 38, 68, 0.96), rgba(10, 22, 42, 0.98));
}

.tutorial-dispatch-btn.done {
  border-color: rgba(46, 230, 192, 0.56);
}

.tut-disp-badge {
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 900;
  letter-spacing: 0.1em;
  color: #061220;
  background: #2fd8ff;
  padding: 2px 5px;
  flex-shrink: 0;
}

.tut-disp-label {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.03em;
  color: #eef9ff;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tut-disp-arrow {
  font-size: 10px;
  color: #2fd8ff;
  display: inline-block;
  animation: dispatchArrowBlink 1.35s ease-in-out 0.7s infinite;
}

.tutorial-dispatch-btn:hover .tut-disp-arrow {
  animation: none;
  opacity: 1;
  transform: translateX(2px);
}

#tutorial-hud {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 6px 14px 7px 11px;
  min-width: 344px;
  max-width: 560px;
  background:
    linear-gradient(225deg, rgba(47, 216, 255, 0.70) 0 8.1px, transparent 8.4px),
    linear-gradient(#2fd8ff, #2fd8ff) 0 0 / 10px 1px no-repeat,
    linear-gradient(#2fd8ff, #2fd8ff) 0 0 / 1px 10px no-repeat,
    linear-gradient(160deg, rgba(10, 22, 40, 0.90), rgba(6, 13, 25, 0.94));
  border: 1px solid rgba(47, 216, 255, 0.48);
  clip-path: polygon(0 0, calc(100% - 11px) 0, 100% 11px, 100% 100%, 0 100%);
  filter: drop-shadow(0 3px 10px rgba(0, 0, 0, 0.45));
  pointer-events: none;
}

.tut-hud-top {
  display: flex;
  align-items: center;
  gap: 8px;
}

.tut-hud-badge {
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 900;
  letter-spacing: 0.08em;
  color: #07121e;
  background: #63f8ff;
  padding: 1px 5px;
  flex-shrink: 0;
}

.tut-hud-title {
  font-size: 11.5px;
  font-weight: 700;
  color: #ffdd94;
  letter-spacing: 0.03em;
  flex: 1;
  white-space: nowrap;
}

.tut-hud-progress {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 800;
  color: #78f8c4;
  padding: 1px 6px;
  background: rgba(14, 42, 34, 0.8);
  border: 1px solid rgba(110, 245, 190, 0.42);
  flex-shrink: 0;
}

.tut-skip-btn {
  pointer-events: auto;
  cursor: pointer;
  font-family: inherit;
  font-size: 9.5px;
  font-weight: 700;
  color: #c8e8ff;
  background: rgba(14, 28, 44, 0.9);
  border: 1px solid rgba(116, 210, 255, 0.42);
  padding: 2px 6px;
  flex-shrink: 0;
}

.tut-skip-btn:hover {
  border-color: #63f8ff;
  color: #ffffff;
}

.tut-hud-desc {
  font-size: 11px;
  font-weight: 400;
  color: #d8f2ff;
  letter-spacing: 0.02em;
  line-height: 1.35;
}

@media (max-width: 760px) and (orientation: portrait) {
  .tutorial-dispatch-btn {
    width: 100%;
  }
  #tutorial-hud {
    min-width: 0;
    max-width: 96vw;
    padding: 4px 7px;
  }
  .tut-hud-badge {
    font-size: 8px;
  }
  .tut-hud-title {
    font-size: 9.5px;
  }
  .tut-hud-desc {
    font-size: 9px;
  }
}

/* --- フッター・一時停止・未開放 --- */
.credit-footer p { margin: 0; }
.credit-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 2px 8px; line-height: 1.6; }
.credit-thanks { font-size: 9px; line-height: 1.5; color: rgba(196, 218, 244, 0.66); letter-spacing: 0.04em; }
.pause-card { width: min(380px, 90%); }
.pause-note { margin: 4px 0 0; font-size: 12px; color: #ffd166; }
.pause-actions { display: grid; gap: 10px; margin-top: 18px; }
.pause-actions button { width: 100%; min-height: 44px; touch-action: manipulation; }
.stage-btn.locked, .daily-dispatch-btn.locked { opacity: 0.55; cursor: not-allowed; filter: saturate(0.4); }
.stage-btn.locked .stage-btn-name { letter-spacing: 0.12em; }
.stage-lock { display: inline-flex; align-items: center; gap: 5px; }
.stage-lock::before { content: ''; width: 8px; height: 7px; border: 1px solid currentColor; box-shadow: inset 0 0 0 4px currentColor; margin-top: 4px; position: relative; border-radius: 1px; }
html.dev body::after { content: 'DEV'; position: fixed; left: 4px; top: 4px; z-index: 9999; padding: 2px 6px; font: 700 10px/1.4 monospace; color: #111; background: #ffd166; pointer-events: none; }

/* 一時停止・音：見た目はそのまま、押せる範囲を 44px に */
.mini-btn { position: relative; touch-action: manipulation; }
@media (hover: none) and (pointer: coarse) {
  #hud-top .mini-btn { min-width: 30px; min-height: 28px; }
  #hud-top .mini-btn::after { content: ''; position: absolute; inset: -8px -7px; }
  #hud-top .tool-row { gap: 14px; }
}
.daily-dispatch-btn.locked .daily-disp-go { display: none; }
@media (max-width: 760px) and (orientation: portrait) {
  .daily-dispatch-btn.locked .daily-disp-stage, .daily-dispatch-btn.locked .daily-disp-foot { display: none; }
}

/* --- オンライン協力：同意・確認 --- */
#ask-overlay { z-index: 80; }
#ask-title { font-size: 20px; }
#pause-overlay:has(~ #ask-overlay:not(.hidden)) .modal-card { visibility: hidden; }
.ask-text { margin: 8px 0 0; font-size: 13px; line-height: 1.8; color: #d8e8fb; }
.coop-consent p { margin: 10px 0 0; font-size: 13px; line-height: 1.8; color: #d8e8fb; }
.coop-consent strong { color: #fff; }
.coop-consent-row { display: flex; align-items: center; gap: 10px; min-height: 44px; margin-top: 12px; font-size: 14px; font-weight: 700; cursor: pointer; }
.coop-consent-row.hidden { display: none; }
.coop-consent-row input { width: 22px; height: 22px; accent-color: #ff5a36; }
.coop-consent button:disabled { opacity: 0.45; cursor: not-allowed; }
.coop-code-input { text-transform: uppercase; }
.coop-about-btn { min-height: 40px; padding: 0; border: 0; background: none; color: #8eeeff; font: inherit; font-size: 12px; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.coop-status-text { overflow-wrap: anywhere; user-select: text; -webkit-user-select: text; }

/* --- 図形（Adobe Stock の素材から作った WebP を型にして、今の文字色で塗る） --- */
.ui-shape { display: block; background: currentColor; -webkit-mask: var(--shape) center / contain no-repeat; mask: var(--shape) center / contain no-repeat; }
.ui-warn { --shape: url('./image/ui/warn.webp'); }
.ui-chev { --shape: url('./image/ui/chev.webp'); }
.ui-hazard { --shape: url('./image/ui/hazard.webp'); }
.ui-flip { transform: scaleX(-1); }

/* --- 縦持ち：味方・ボス・警告を2段目に移し、右上の一時停止と音をいつも画面の中に置く --- */
@media (max-width: 640px) and (orientation: portrait) {
  #hud-top .hud-left { flex: 0 1 auto; min-width: 0; }
  #hud-top .hud-right { flex: 0 0 auto; margin-left: auto; }
  #hud-top .hud-center { position: absolute; top: calc(100% + 5px); left: 0; right: 0; width: auto; max-width: none; margin: 0; transform: none; align-items: center; }
  #alert-banner .alert-stripes-wrap { display: none; }
  #alert-banner { padding: 3px 8px; gap: 6px; font-size: 10px; line-height: 1.35; letter-spacing: 0.02em; }
  #alert-banner-text { font-size: 10px; line-height: 1.35; letter-spacing: 0.02em; }
}
@media (max-width: 360px) and (orientation: portrait) {
  #hud-top .tool-row { gap: 10px; }
  .deck-radio-text { -webkit-line-clamp: 3; }
}

/* ---- はじめの画面（読み込み → タップ） ---- */
html.booting #title-overlay,
html.booting #title-overlay * { animation-play-state: paused !important; }

#boot {
  position: fixed;
  inset: 0;
  z-index: 58;
  overflow: hidden;
  color: #fff;
  background: linear-gradient(180deg, #0c4fb4 0%, #147bea 100%);
  transition: opacity 650ms ease 160ms, visibility 0s 820ms;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
#boot.ready { cursor: pointer; }
.boot-lock {
  position: absolute;
  left: 50%;
  top: 47%;
  width: clamp(230px, 22vw, 290px);
  padding: 30px 34px;
  transform: translate(-50%, -50%);
}
.boot-lock img {
  display: block;
  width: 100%;
  height: auto;
  filter: brightness(0) invert(1);
  -webkit-user-drag: none;
  pointer-events: none;
}
/* 四すみの枠。--g（あと何 px 離れているか）を js が減らす */
.boot-lock i {
  position: absolute;
  width: 26px;
  height: 26px;
  border: 0 solid currentColor;
  transform: translate(calc(var(--g, 160px) * var(--sx)), calc(var(--g, 160px) * var(--sy) * 0.62));
}
.boot-lock i:nth-child(1) { --sx: -1; --sy: -1; left: 0; top: 0; border-width: 3px 0 0 3px; }
.boot-lock i:nth-child(2) { --sx: 1; --sy: -1; right: 0; top: 0; border-width: 3px 3px 0 0; }
.boot-lock i:nth-child(3) { --sx: -1; --sy: 1; left: 0; bottom: 0; border-width: 0 0 3px 3px; }
.boot-lock i:nth-child(4) { --sx: 1; --sy: 1; right: 0; bottom: 0; border-width: 0 3px 3px 0; }
#boot.ready .boot-lock i { color: var(--accent-amber); animation: bootLock 360ms steps(4) both; }
@keyframes bootLock {
  0%, 50% { opacity: 1; }
  25%, 75% { opacity: 0.15; }
  100% { opacity: 1; }
}
.boot-foot {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(47% + clamp(120px, 13vw, 160px));
  display: grid;
  justify-items: center;
  font: 700 15px/1 var(--font-mono);
}
.boot-foot > * { grid-area: 1 / 1; }
#boot-num { padding: 20px 0; font-variant-numeric: tabular-nums; }
#boot-start {
  padding: 20px 28px;
  border: 0;
  color: inherit;
  background: none;
  font: inherit;
  font-size: 17px;
  cursor: pointer;
  visibility: hidden;
}
#boot.ready #boot-num { visibility: hidden; }
#boot.ready #boot-start { visibility: visible; animation: bootTap 1.5s steps(1) 360ms infinite; }
@keyframes bootTap {
  0%, 66% { opacity: 1; }
  67%, 100% { opacity: 0.25; }
}
#boot-start:focus { outline: none; }
#boot.kbd #boot-start:focus-visible { outline: 2px solid currentColor; outline-offset: -8px; }
/* タップ：枠が外へ広がり、青が町の空に変わる */
#boot.off { opacity: 0; visibility: hidden; pointer-events: none; }
#boot.off .boot-lock i { animation: none; transform: translate(calc(60vmax * var(--sx)), calc(60vmax * var(--sy) * 0.62)); transition: transform 620ms cubic-bezier(0.5, 0, 0.75, 0); }
#boot.off .boot-lock img { opacity: 0; transition: opacity 200ms ease; }
#boot.off .boot-foot { opacity: 0; }
@media (prefers-reduced-motion: reduce) {
  #boot.ready .boot-lock i, #boot.ready #boot-start { animation: none; }
  #boot.off .boot-lock i { transform: none; transition: none; }
}

/* タイトルの SOUND と VOICE（SOUND が OFF の間、VOICE は押せない） */
.title-audio { display: flex; justify-content: flex-end; gap: 8px; }
.title-audio .util-ghost-btn { min-width: 8.6em; }
.util-ghost-btn:disabled, #btn-pause-voice:disabled { opacity: 0.45; cursor: default; }

/* ---- モニターごしの質感（敵や弾が見づらくならないように、ごく薄く） ---- */
.scan {
  position: absolute;
  inset: 0;
  z-index: 7;
  overflow: hidden;
  pointer-events: none;
  background:
    repeating-linear-gradient(0deg, rgba(3, 12, 34, 0.17) 0 1px, rgba(3, 12, 34, 0) 1px 3px),
    radial-gradient(130% 130% at 50% 50%, rgba(3, 12, 34, 0) 66%, rgba(3, 12, 34, 0.24));
}
.scan::before,
#cut i::before {
  content: '';
  position: absolute;
  inset: -128px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='128' height='128'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.95' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='128' height='128' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: scanNoise 0.9s steps(1) infinite;
}
.scan::before { opacity: 0.055; }
@keyframes scanNoise {
  0% { transform: translate(0, 0); }
  20% { transform: translate(-61px, 37px); }
  40% { transform: translate(43px, -72px); }
  60% { transform: translate(-92px, 54px); }
  80% { transform: translate(78px, -29px); }
}

/* ---- 面の切り替え ---- */
#cut {
  position: absolute;
  inset: 0;
  z-index: 8;
  display: none;
  overflow: hidden;
  pointer-events: none;
}
#cut.start { z-index: 16; }
#cut.on { display: block; animation: cutIn 70ms linear both; }
@keyframes cutIn { from { opacity: 0; } }
#cut i {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 50.3%;
  overflow: hidden;
  background: repeating-linear-gradient(0deg, rgba(120, 200, 255, 0.1) 0 1px, rgba(120, 200, 255, 0) 1px 3px), #0a1730;
  transition: transform 260ms cubic-bezier(0.6, 0, 0.8, 0.2);
}
#cut i:nth-child(2) { top: auto; bottom: 0; }
#cut i::before { opacity: 0.3; }
#cut.open i:nth-child(1) { transform: translateY(-101%); }
#cut.open i:nth-child(2) { transform: translateY(101%); }
#cut p {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  display: none;
  margin: 0;
  color: #fff;
  text-align: center;
  transform: translateY(-50%);
}
#cut.start p { display: block; }
#cut.open p { opacity: 0; }
#cut span { display: block; margin-bottom: 8px; color: var(--accent-amber); font: 700 13px/1.4 var(--font-mono); letter-spacing: 0.08em; }
#cut b { display: block; font-size: clamp(19px, 2.6vw, 30px); font-weight: 900; line-height: 1.5; letter-spacing: 0.06em; }
@media (prefers-reduced-motion: reduce) {
  .scan::before, #cut i::before { animation: none; }
  #cut i { transition: none; }
}
