:root {
  --cyan: #00f0ff;
  --cyan-dim: rgba(0, 240, 255, 0.22);
  --magenta: #ff007f;
  --crimson: #ff2a55;
  --bg-dark: rgba(6, 10, 22, 0.78);
  --panel-border: rgba(0, 240, 255, 0.35);
  --text-main: #eef8ff;
  --text-dim: #8aa5bf;
  --ui-panel: rgba(6, 13, 26, .94);
  --ui-focus: #a5f5ff;
  --ui-track: rgba(96, 148, 177, .25);
  --ui-heading: 'Orbitron', sans-serif;
  --ui-copy: 'Rajdhani', system-ui, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #03050c;
  color: var(--text-main);
  font-family: 'Rajdhani', sans-serif;
}

#canvas-container {
  position: fixed;
  inset: 0;
  z-index: 1;
}

/* STYLISH ROTATING ★ LOCK-ON RETICLE */
.lock-reticle {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 12;
  pointer-events: none;
  width: 0;
  height: 0;
  will-change: transform;
}

.lock-ring {
  position: absolute;
  top: -28px;
  left: -28px;
  width: 56px;
  height: 56px;
  border: 1.5px solid rgba(0, 240, 255, 0.85);
  border-radius: 50%;
  border-top-color: transparent;
  border-bottom-color: transparent;
  box-shadow: 0 0 14px rgba(0, 240, 255, 0.55);
  animation: lockSpin 1.8s linear infinite;
}

.lock-star {
  position: absolute;
  top: 0;
  left: 0;
  transform: translate(-50%, -50%);
  font-size: 22px;
  color: #ffffff;
  text-shadow: 0 0 10px #00f0ff, 0 0 22px #00f0ff;
  animation: lockPulse 0.85s ease-in-out infinite alternate;
}

.lock-reticle.boss-lock .lock-ring {
  top: -36px;
  left: -36px;
  width: 72px;
  height: 72px;
  border-color: rgba(255, 0, 127, 0.9);
  border-top-color: transparent;
  border-bottom-color: transparent;
  box-shadow: 0 0 18px rgba(255, 0, 127, 0.65);
}

.lock-reticle.boss-lock .lock-star {
  font-size: 28px;
  text-shadow: 0 0 12px #ff007f, 0 0 26px #ff007f;
}

@keyframes lockSpin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes lockPulse {
  from { transform: translate(-50%, -50%) scale(0.92); opacity: 0.88; }
  to { transform: translate(-50%, -50%) scale(1.16); opacity: 1; }
}

#screen-flash {
  position: fixed;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.14s ease-out;
}

/* OVERLAYS */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.hidden {
  display: none !important;
}

#audio-panel {
  position: fixed;
  inset: 0;
  margin: auto;
  width: min(460px, calc(100% - 28px));
  max-height: calc(100% - 28px);
  overflow-y: auto;
  padding: 20px;
  border: 1px solid #5295b4;
  color: #e1f7ff;
  background: #0a1725;
  box-shadow: 0 14px 50px #010912b8;
  font: 500 13px / 1.45 system-ui, sans-serif;
}

#audio-panel::backdrop { background: rgba(2, 8, 17, .76); }

#audio-panel header,
#audio-panel footer,
.audio-cue-picker {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

#audio-panel h2 { font-size: 20px; }

.audio-sliders {
  display: grid;
  gap: 8px;
  margin: 16px 0;
}

.audio-sliders label {
  display: grid;
  align-items: center;
  grid-template-columns: 47px minmax(80px, 1fr) 66px;
  gap: 10px;
}

.audio-sliders input { width: 100%; accent-color: #55ceff; }
.audio-sliders output { text-align: right; font-variant-numeric: tabular-nums; }

.audio-cue-picker {
  border-top: 1px solid #28495d;
  padding-top: 14px;
}

.audio-cue-picker label {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.audio-cue-picker select {
  flex: 1;
  min-width: 0;
  height: 32px;
  padding: 0 6px;
  color: #e1f7ff;
  background: #101f31;
  border: 1px solid #35607b;
}

#audio-cue-file { overflow-wrap: anywhere; color: #9cc4dc; font: 11px monospace; }
#audio-preview-status { color: #a7deff; min-height: 1.45em; margin-top: 8px; }

/* TITLE SCREEN */
#title-screen {
  justify-content: space-between;
  align-items: stretch;
  overflow-y: auto;
  padding: 28px 44px 36px;
  background: linear-gradient(
    95deg,
    rgba(3, 6, 16, 0.90) 0%,
    rgba(3, 6, 16, 0.70) 46%,
    rgba(3, 6, 16, 0.15) 75%,
    rgba(3, 6, 16, 0.35) 100%
  );
}

.title-top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.title-audio-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 8px;
}

.brand-tag {
  font-family: 'Orbitron', sans-serif;
  font-size: 12px;
  letter-spacing: 3px;
  color: var(--cyan);
  padding: 6px 14px;
  border: 1px solid var(--panel-border);
  background: rgba(0, 240, 255, 0.08);
  clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 100%, 10px 100%);
}

.title-main {
  display: flex;
  align-items: center;
  flex: 1;
}

.title-left {
  width: min(100%, 650px);
}

.eyebrow {
  font-family: 'Orbitron', sans-serif;
  font-size: 12px;
  letter-spacing: 4px;
  color: var(--cyan);
  margin-bottom: 10px;
  text-shadow: 0 0 12px rgba(0, 240, 255, 0.6);
}

.game-title {
  font-family: 'Orbitron', sans-serif;
  font-weight: 900;
  font-size: clamp(44px, 5.4vw, 72px);
  line-height: 0.94;
  letter-spacing: 3px;
  margin-bottom: 30px;
  text-shadow: 0 0 32px rgba(0, 240, 255, 0.28);
}

.star-glow {
  color: #ffffff;
  text-shadow: 0 0 14px var(--cyan), 0 0 28px var(--cyan);
}

.accent-cyan {
  background: linear-gradient(90deg, #00f0ff, #60b5ff, #ff007f);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.subtitle {
  font-size: 17px;
  line-height: 1.45;
  color: #bfd6ec;
  margin-bottom: 24px;
  max-width: 560px;
}

.section-label {
  font-family: 'Orbitron', sans-serif;
  font-size: 10px;
  letter-spacing: 3px;
  color: rgba(168, 212, 240, 0.72);
  margin-bottom: 8px;
}

.label-sep {
  color: var(--cyan);
  margin: 0 4px;
}

.track-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

.track-card {
  text-align: left;
  background: rgba(6, 13, 28, 0.76);
  border: 1px solid rgba(255, 255, 255, 0.14);
  padding: 12px 13px;
  color: var(--text-main);
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
  clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 10px, 100% 100%, 0 100%);
  backdrop-filter: blur(8px);
}

.track-card:hover {
  border-color: rgba(0, 240, 255, 0.6);
  transform: translateY(-1px);
  background: rgba(10, 22, 46, 0.88);
}

.track-card.selected {
  border-color: var(--cyan);
  background: linear-gradient(135deg, rgba(0, 240, 255, 0.16), rgba(8, 16, 36, 0.92));
  box-shadow: 0 0 18px rgba(0, 240, 255, 0.2), inset 0 0 14px rgba(0, 240, 255, 0.1);
}

.track-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 7px;
}

.track-num {
  font-family: 'Orbitron', sans-serif;
  font-weight: 900;
  font-size: 16px;
  color: rgba(255, 255, 255, 0.35);
}

.track-card.selected .track-num {
  color: var(--cyan);
}

.track-diff {
  font-family: 'Orbitron', sans-serif;
  font-size: 9px;
  letter-spacing: 1.4px;
  padding: 2px 6px;
  border-radius: 2px;
}

.track-diff.cyan {
  color: var(--cyan);
  background: rgba(0, 240, 255, 0.14);
  border: 1px solid rgba(0, 240, 255, 0.38);
}

.track-diff.crimson {
  color: #ff6688;
  background: rgba(255, 42, 85, 0.14);
  border: 1px solid rgba(255, 42, 85, 0.42);
}

.track-name {
  font-family: 'Orbitron', sans-serif;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.9px;
  margin-bottom: 4px;
  color: #f4fbff;
}

.track-sub {
  font-family: 'Orbitron', sans-serif;
  font-size: 9px;
  letter-spacing: 1.4px;
  color: rgba(164, 206, 236, 0.7);
}

/* BUTTONS */
.sector-launch {
  display: grid;
  gap: 9px;
  margin-bottom: 25px;
}
.launch-mission h2 {
  color: var(--cyan);
  font: 700 clamp(19px, 3vw, 28px) / 1.2 var(--ui-heading);
  letter-spacing: .11em;
}
.launch-mission p {
  margin-top: 3px;
  color: var(--text-main);
  font: 700 15px / 1.15 var(--ui-copy);
  letter-spacing: .14em;
}
.sector-launch .launch-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}
.sector-launch #btn-start {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(100%, 330px);
  min-height: 64px;
  padding: 10px 24px;
  font-size: clamp(23px, 3.4vw, 34px);
  letter-spacing: .12em;
  background: linear-gradient(105deg, #81f7ff, #00c6f8 62%, #219aff);
}
.sector-launch #btn-start:focus-visible { box-shadow: inset 0 0 0 3px #fff; }
.sector-launch #btn-tutorial { min-height: 40px; }
.launch-note { color: var(--text-dim); font: 600 14px var(--ui-copy); }
.sector-launch + .section-label {
  border-top: 1px solid var(--panel-border);
  padding-top: 12px;
}

.btn-primary, .btn-secondary, .btn-ghost {
  font-family: 'Orbitron', sans-serif;
  font-weight: 700;
  letter-spacing: 2px;
  font-size: 15px;
  padding: 15px 34px;
  cursor: pointer;
  border: none;
  position: relative;
  overflow: hidden;
  transition: all 0.2s ease;
  clip-path: polygon(12px 0, 100% 0, calc(100% - 12px) 100%, 0 100%);
}

.btn-primary {
  background: linear-gradient(90deg, #00d8ff, #0077ff);
  color: #020814;
  box-shadow: 0 0 26px rgba(0, 240, 255, 0.45);
  width: fit-content;
}

.btn-primary:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 0 38px rgba(0, 240, 255, 0.75);
}

.btn-secondary {
  background: rgba(0, 240, 255, 0.14);
  color: var(--cyan);
  border: 1px solid var(--cyan);
}

.btn-secondary:hover {
  background: rgba(0, 240, 255, 0.26);
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.06);
  color: #cfe4f7;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.14);
}

.icon-btn, .icon-btn-sm {
  font-family: 'Orbitron', sans-serif;
  background: rgba(8, 16, 32, 0.72);
  color: var(--cyan);
  border: 1px solid var(--panel-border);
  cursor: pointer;
  backdrop-filter: blur(6px);
  transition: all 0.18s ease;
}

.icon-btn {
  padding: 8px 14px;
  font-size: 11px;
  letter-spacing: 1.5px;
}

.icon-btn-sm {
  width: 38px;
  height: 38px;
  font-size: 15px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.icon-btn:hover, .icon-btn-sm:hover {
  background: rgba(0, 240, 255, 0.2);
  box-shadow: 0 0 14px rgba(0, 240, 255, 0.35);
}

.controls-mini {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 10px;
  font-family: 'Orbitron', sans-serif;
  font-size: 9px;
  letter-spacing: 0.9px;
  color: rgba(180, 214, 240, 0.68);
}

kbd {
  font-family: 'Orbitron', sans-serif;
  font-size: 9px;
  padding: 1px 5px;
  margin-right: 4px;
  border: 1px solid rgba(0, 240, 255, 0.38);
  background: rgba(0, 240, 255, 0.1);
  color: #e8f8ff;
  border-radius: 2px;
}

#summit-intro {
  position: fixed;
  inset: 0;
  z-index: 18;
  pointer-events: none;
}

#summit-intro.warning {
  background: radial-gradient(ellipse at center, #2a0a10 0%, #0b060b 65%, #050408 100%);
}

.summit-warning {
  position: absolute;
  inset: 6% 0;
  display: none;
  place-items: center;
  border-block: 1px solid #e4494f;
  background: repeating-linear-gradient(0deg, transparent 0 5px, rgba(227, 57, 64, .055) 5px 6px);
  box-shadow: inset 0 0 6rem #4f0b15;
  color: #fff0eb;
  font: 900 clamp(3rem, 13.6vw, 13rem) / 1 'Orbitron', sans-serif;
  letter-spacing: .025em;
  text-shadow: 0 0 .22em #ff3147;
  opacity: 0;
}

.summit-warning::before,
.summit-warning::after {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: clamp(8px, 2.3vh, 22px);
  background: repeating-linear-gradient(125deg, #cf323e 0 22px, transparent 22px 41px);
}

.summit-warning::after { inset: auto 0 0; }
#summit-intro.warning .summit-warning { display: grid; }
#summit-intro.lit .summit-warning { opacity: 1; }

#summit-intro.cinematic::before,
#summit-intro.cinematic::after {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 7.5vh;
  background: #05060a;
}

#summit-intro.cinematic::after { inset: auto 0 0; }

.summit-name,
.summit-skip {
  position: absolute;
  color: #eff6ff;
  z-index: 1;
  display: none;
}

.summit-name {
  bottom: 12vh;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  font: 700 clamp(14px, 3.2vw, 42px) / 1.2 'Orbitron', sans-serif;
  letter-spacing: .24em;
  white-space: nowrap;
  text-shadow: 0 2px 18px #05060a, 0 0 18px #ce895e;
}

.summit-skip {
  right: 2.3vw;
  bottom: 2.7vh;
  color: #a7afb8;
  font-size: 12px;
  letter-spacing: .10em;
}

#summit-intro.named .summit-name,
#summit-intro.cinematic .summit-skip { display: block; }

/* ULTRA-MINIMAL REZ-STYLE HUD */
#hud {
  position: fixed;
  inset: 0;
  z-index: 10;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 24px 32px 28px;
}

#hud::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 43%, rgba(224, 23, 48, .17) 70%, rgba(213, 18, 40, .57) 100%);
  box-shadow: inset 0 0 62px 8px rgba(246, 40, 61, .38);
  opacity: var(--hurt-flash, 0);
}

.hud-minimal-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.hud-phase-block {
  position: fixed;
  top: 22px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: min(440px, 60vw);
}

.hud-phase-label {
  font-family: 'Orbitron', sans-serif;
  font-size: 11px;
  letter-spacing: 5px;
  color: rgba(210, 240, 255, 0.78);
  text-shadow: 0 0 12px rgba(0, 240, 255, 0.5);
}

.boss-bar-wrap {
  width: 100%;
}

.boss-hp-line {
  height: 3px;
  width: 100%;
  background: linear-gradient(90deg, #ff007f, #ff5577, #ffffff);
  box-shadow: 0 0 12px #ff007f;
  transition: width 0.08s linear;
}

.hud-top-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
  pointer-events: auto;
  opacity: 0.78;
  transition: opacity 0.2s;
}

.hud-top-actions:hover {
  opacity: 1;
}

.hud-chip-btn {
  font-family: 'Orbitron', sans-serif;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.6px;
  height: 30px;
  padding: 0 11px;
  color: #b8eeff;
  background: rgba(4, 12, 24, 0.68);
  border: 1px solid rgba(0, 240, 255, 0.32);
  cursor: pointer;
  backdrop-filter: blur(6px);
  transition: border-color 0.16s, background 0.16s, color 0.16s;
}

.hud-chip-btn:hover {
  border-color: #00f0ff;
  background: rgba(0, 240, 255, 0.18);
  color: #ffffff;
}

.hud-pause-btn {
  min-width: 32px;
  padding: 0 9px;
  letter-spacing: 2px;
}

.hud-vitals {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 6px 8px;
  background: rgba(4, 12, 24, 0.52);
  border-left: 2px solid rgba(0, 240, 255, 0.65);
  backdrop-filter: blur(4px);
}

.vital-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.vital-tag {
  font-family: 'Orbitron', sans-serif;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 1.2px;
  color: rgba(180, 224, 248, 0.8);
  width: 20px;
}

.hud-minimal-bottom {
  display: flex;
  flex-direction: column;
  gap: 7px;
  width: 200px;
}

.thin-gauge {
  width: 100%;
  height: 3px;
  background: rgba(255, 255, 255, 0.14);
  overflow: hidden;
}

.thin-fill {
  height: 100%;
  width: 100%;
  transition: width 0.08s linear;
}

.hp-line {
  position: relative;
  background: #00f0ff;
  box-shadow: 0 0 10px #00f0ff;
  transition: width 0.08s linear, background-color 0.12s ease-out;
}

.hp-row .thin-gauge {
  position: relative;
  height: 6px;
  background: rgba(144, 179, 205, .24);
}

.hp-trail {
  position: absolute;
  inset: 0 auto 0 0;
  width: 100%;
  background: #ffb37d;
}

.hp-line.hp-hit {
  background: #ff6976;
  box-shadow: 0 0 10px #ff324c;
  transition: width 0.08s linear;
}

.hp-line.hp-heal {
  background: #5bff91;
  box-shadow: 0 0 10px #5bff91;
}

.energy-line {
  background: #ffffff;
  box-shadow: 0 0 8px rgba(0, 240, 255, 0.8);
  opacity: 0.85;
}

/* === SUB MODULE LOADOUT CARDS & HUD === */
.sub-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 22px;
}

.sub-card {
  background: rgba(6, 13, 28, 0.76);
  border: 1px solid rgba(255, 255, 255, 0.14);
  padding: 11px 12px;
  text-align: left;
  color: #dceeff;
  cursor: pointer;
  transition: border-color 0.16s, background 0.16s, transform 0.16s, box-shadow 0.16s;
  clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 10px, 100% 100%, 0 100%);
  backdrop-filter: blur(8px);
}

.sub-card:hover {
  border-color: rgba(0, 240, 255, 0.65);
  background: rgba(10, 26, 48, 0.84);
  transform: translateY(-1px);
}

.sub-card.selected {
  border-color: #00f0ff;
  background: rgba(0, 180, 255, 0.18);
  box-shadow: 0 0 14px rgba(0, 240, 255, 0.28) inset, 0 0 12px rgba(0, 240, 255, 0.22);
}

.sub-card.selected.slot-e {
  border-color: #ffe066;
  background: rgba(255, 210, 70, 0.13);
  box-shadow: 0 0 14px rgba(255, 214, 90, 0.22) inset, 0 0 12px rgba(255, 214, 90, 0.18);
}

.sub-slot-badge {
  display: none;
  font-family: 'Orbitron', sans-serif;
  font-size: 9px;
  font-weight: 800;
  padding: 1px 5px;
  border-radius: 2px;
  background: #00f0ff;
  color: #020814;
  letter-spacing: 0.5px;
}

.sub-card.slot-q .sub-slot-badge {
  display: inline-block;
  background: #00f0ff;
  color: #020814;
}

.sub-card.slot-e .sub-slot-badge {
  display: inline-block;
  background: #ffe066;
  color: #161002;
}

.sub-card-top {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}

.sub-card-top .sub-tag {
  margin-left: auto;
}

.sub-name {
  font-family: 'Orbitron', sans-serif;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.6px;
  color: #ffffff;
  white-space: nowrap;
}

.sub-tag {
  font-family: 'Orbitron', sans-serif;
  font-size: 9px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 2px;
  letter-spacing: 0.8px;
  white-space: nowrap;
}

.sub-tag.cyan {
  background: rgba(0, 240, 255, 0.18);
  color: #66f6ff;
  border: 1px solid rgba(0, 240, 255, 0.45);
}

.sub-tag.gold {
  background: rgba(255, 214, 90, 0.18);
  color: #ffe680;
  border: 1px solid rgba(255, 214, 90, 0.48);
}

.sub-tag.crimson {
  background: rgba(255, 50, 130, 0.18);
  color: #ff7ab6;
  border: 1px solid rgba(255, 50, 130, 0.48);
}

.sub-spec {
  font-family: 'Orbitron', sans-serif;
  font-size: 9px;
  letter-spacing: 1.2px;
  color: rgba(164, 206, 236, 0.72);
}

.pause-sub-label {
  font-family: 'Orbitron', sans-serif;
  font-size: 10px;
  letter-spacing: 2px;
  color: rgba(140, 224, 255, 0.85);
  margin: 10px 0 6px;
  text-align: left;
}

.pause-loadout-readonly {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 16px;
}

.pause-loadout-pill {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 9px;
  background: rgba(6, 16, 30, 0.72);
  border: 1px solid rgba(0, 224, 255, 0.28);
  font-family: 'Orbitron', sans-serif;
  font-size: 10px;
  letter-spacing: 0.8px;
  color: #dceeff;
}

.hud-minimal-bottom {
  width: 236px;
}

.hud-sub-stack {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 3px;
}

.hud-sub-box {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 5px 8px;
  background: rgba(4, 12, 24, 0.58);
  border-left: 2px solid rgba(0, 240, 255, 0.45);
  backdrop-filter: blur(4px);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.hud-sub-key.key-e {
  border-color: rgba(255, 224, 102, 0.72);
  color: #ffe066;
  background: rgba(255, 224, 102, 0.14);
}

.hud-sub-box.ready {
  border-left-color: #00f0ff;
  box-shadow: 0 0 12px rgba(0, 240, 255, 0.22);
}

.hud-sub-box.active {
  border-left-color: #ffe680;
  box-shadow: 0 0 16px rgba(0, 240, 255, 0.42);
}

.hud-sub-box.empty {
  opacity: 0.55;
  border-left-color: rgba(255, 255, 255, 0.25);
}

.hud-sub-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: 'Orbitron', sans-serif;
}

.hud-sub-key {
  font-size: 9px;
  font-weight: 700;
  padding: 1px 4px;
  border: 1px solid rgba(0, 240, 255, 0.6);
  color: #00f0ff;
  background: rgba(0, 240, 255, 0.12);
}

.hud-sub-name {
  font-size: 10px;
  letter-spacing: 1px;
  color: #e8f6ff;
}

.hud-sub-val {
  margin-left: auto;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.8px;
  color: #70f4ff;
}

.hud-sub-box.active .hud-sub-val {
  color: #ffe680;
}

.sub-line {
  background: linear-gradient(90deg, #00d8ff, #8cf7ff);
  box-shadow: 0 0 8px rgba(0, 240, 255, 0.75);
}

.hud-sub-box.active .sub-line {
  background: linear-gradient(90deg, #00f0ff, #ffe680, #ffffff);
}

.hud-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
}

.hud-track-info {
  width: 310px;
  background: var(--bg-dark);
  border-left: 3px solid var(--cyan);
  padding: 10px 14px;
  backdrop-filter: blur(8px);
  clip-path: polygon(0 0, 100% 0, calc(100% - 12px) 100%, 0 100%);
}

.hud-label {
  font-family: 'Orbitron', sans-serif;
  font-size: 11px;
  letter-spacing: 2px;
  color: var(--cyan);
  margin-bottom: 6px;
}

.progress-shell {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.12);
  margin-bottom: 6px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #00f0ff, #ff007f);
  box-shadow: 0 0 12px var(--cyan);
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  font-family: 'Orbitron', sans-serif;
  font-size: 12px;
  color: #d8ecff;
}

.hud-style-box {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--bg-dark);
  border: 1px solid rgba(0, 240, 255, 0.25);
  padding: 8px 18px;
  backdrop-filter: blur(8px);
  clip-path: polygon(10px 0, 100% 0, calc(100% - 10px) 100%, 0 100%);
}

.rank-letter {
  font-family: 'Orbitron', sans-serif;
  font-weight: 900;
  font-size: 38px;
  line-height: 1;
  color: var(--cyan);
  text-shadow: 0 0 18px rgba(0, 240, 255, 0.8);
  min-width: 44px;
  text-align: center;
}

.rank-letter.rank-s {
  color: #ffdd44;
  text-shadow: 0 0 20px rgba(255, 200, 40, 0.9);
}

.rank-letter.rank-sss {
  color: #ff2a85;
  text-shadow: 0 0 22px rgba(255, 0, 128, 0.95);
}

.style-label {
  font-family: 'Orbitron', sans-serif;
  font-size: 9px;
  letter-spacing: 2px;
  color: var(--text-dim);
}

.combo-num {
  font-family: 'Orbitron', sans-serif;
  font-weight: 900;
  font-size: 20px;
  color: #ffffff;
}

.score-num {
  font-family: 'Orbitron', sans-serif;
  font-size: 12px;
  color: var(--cyan);
}

.hud-top-actions {
  display: flex;
  gap: 8px;
  pointer-events: auto;
}

/* CENTER CROSSHAIR & LOCK HINT */
#crosshair {
  position: fixed;
  top: 50%;
  left: 50%;
  width: 14px;
  height: 14px;
  transform: translate(-50%, -50%);
  border: 1.5px solid rgba(0, 240, 255, 0.72);
  border-radius: 50%;
  box-shadow: 0 0 8px rgba(0, 240, 255, 0.55);
  pointer-events: none;
}

.hud-lock-hint {
  position: fixed;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  font-family: 'Orbitron', sans-serif;
  font-size: 10px;
  letter-spacing: 2px;
  color: rgba(180, 220, 255, 0.65);
  background: rgba(5, 10, 22, 0.55);
  padding: 4px 12px;
  border: 1px solid rgba(0, 240, 255, 0.22);
}

/* CENTER CALLOUT */
.hud-callout {
  align-self: center;
  font-family: 'Orbitron', sans-serif;
  font-weight: 900;
  font-size: 26px;
  letter-spacing: 4px;
  color: #ffffff;
  text-shadow: 0 0 18px var(--cyan), 0 0 36px rgba(0, 240, 255, 0.6);
  opacity: 0;
  transform: translateY(10px) scale(0.95);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.hud-callout.show {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.hud-overclock {
  position: absolute;
  top: clamp(66px, 13vh, 122px);
  left: 50%;
  transform: translateX(-50%);
  width: min(320px, calc(100vw - 36px));
  padding: 10px 22px 11px;
  text-align: center;
  color: #e8fcff;
  background: linear-gradient(90deg, transparent, rgba(3, 19, 36, .93) 24% 76%, transparent);
  border-block: 1px solid rgba(100, 220, 255, .48);
}

.hud-overclock strong {
  display: block;
  font: 900 clamp(21px, 4.3vw, 34px) / 1.1 'Orbitron', sans-serif;
  letter-spacing: .12em;
  text-shadow: 0 0 12px #35b3ff, 0 2px 8px #04111f;
}

.overclock-track {
  margin-top: 8px;
  height: 4px;
  background: rgba(125, 214, 255, .22);
}

.overclock-fill {
  height: 100%;
  background: linear-gradient(90deg, #4087ff, #69e4ff 75%, #effdff);
  box-shadow: 0 0 9px #69dfff;
  transform: scaleX(var(--overclock-left, 0));
  transform-origin: left;
}

/* BOTTOM BAR */
.hud-bottom {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
}

.hud-gauges {
  width: 340px;
  background: var(--bg-dark);
  border-left: 3px solid var(--cyan);
  padding: 12px 16px;
  backdrop-filter: blur(8px);
  clip-path: polygon(0 0, calc(100% - 14px) 0, 100% 100%, 0 100%);
}

.gauge-row {
  margin-bottom: 10px;
}

.gauge-header {
  display: flex;
  justify-content: space-between;
  font-family: 'Orbitron', sans-serif;
  font-size: 10px;
  letter-spacing: 1.5px;
  margin-bottom: 4px;
  color: #c8e3fa;
}

.bar-bg {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.12);
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  width: 100%;
  transition: width 0.08s linear;
}

.hp-fill {
  background: linear-gradient(90deg, #00ff9d, #00e0ff);
  box-shadow: 0 0 10px rgba(0, 255, 180, 0.6);
}

.hp-fill.low {
  background: linear-gradient(90deg, #ff2a55, #ff7733);
  box-shadow: 0 0 12px rgba(255, 42, 85, 0.8);
}

.energy-fill {
  background: linear-gradient(90deg, #0099ff, #00f0ff, #ffffff);
  box-shadow: 0 0 12px rgba(0, 240, 255, 0.8);
}

.stance-pills {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.stance-pill {
  font-family: 'Orbitron', sans-serif;
  font-size: 9px;
  letter-spacing: 1px;
  padding: 3px 7px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #9ab5cf;
  background: rgba(255, 255, 255, 0.04);
}

.stance-pill.active {
  border-color: var(--cyan);
  color: #ffffff;
  background: rgba(0, 240, 255, 0.2);
  box-shadow: 0 0 10px rgba(0, 240, 255, 0.35);
}

/* SPEEDOMETER */
.hud-speed {
  text-align: right;
  background: var(--bg-dark);
  border-right: 3px solid var(--magenta);
  padding: 12px 18px;
  min-width: 230px;
  backdrop-filter: blur(8px);
  clip-path: polygon(14px 0, 100% 0, 100% 100%, 0 100%);
}

.speed-state {
  font-family: 'Orbitron', sans-serif;
  font-size: 11px;
  letter-spacing: 3px;
  color: var(--cyan);
  margin-bottom: 2px;
}

.speed-value-row {
  display: flex;
  align-items: baseline;
  justify-content: flex-end;
  gap: 6px;
}

.speed-num {
  font-family: 'Orbitron', sans-serif;
  font-weight: 900;
  font-size: 46px;
  line-height: 1;
  color: #ffffff;
  text-shadow: 0 0 16px rgba(0, 240, 255, 0.55);
}

.speed-unit {
  font-family: 'Orbitron', sans-serif;
  font-size: 13px;
  color: var(--text-dim);
}

.speed-ticks {
  width: 100%;
  height: 5px;
  background: rgba(255, 255, 255, 0.12);
  margin-top: 6px;
  overflow: hidden;
}

.speed-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #00f0ff, #ff007f);
}

/* MODALS */
.modal-card {
  background: rgba(6, 11, 24, 0.92);
  border: 1px solid var(--cyan);
  padding: 34px 42px;
  text-align: center;
  min-width: 380px;
  max-width: 560px;
  box-shadow: 0 0 40px rgba(0, 240, 255, 0.25);
  backdrop-filter: blur(12px);
  clip-path: polygon(18px 0, 100% 0, 100% calc(100% - 18px), calc(100% - 18px) 100%, 0 100%, 0 18px);
}

.modal-card h2 {
  font-family: 'Orbitron', sans-serif;
  font-size: 28px;
  margin-bottom: 22px;
  letter-spacing: 2px;
}

.modal-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: stretch;
}

.modal-actions .btn-primary {
  width: 100%;
}

.results-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 26px;
}

.res-stat {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.res-label {
  font-family: 'Orbitron', sans-serif;
  font-size: 9px;
  letter-spacing: 1.5px;
  color: var(--text-dim);
}

.res-val {
  font-family: 'Orbitron', sans-serif;
  font-weight: 700;
  font-size: 18px;
}

.rank-big {
  font-size: 28px;
  color: #ffdd44;
  text-shadow: 0 0 16px rgba(255, 215, 64, 0.8);
}

.cyan-text {
  color: var(--cyan);
}

@media (max-width: 768px) {
  #title-screen { padding: 18px; }
  .track-cards { grid-template-columns: 1fr; }
  .hud-track-info, .hud-gauges { width: 220px; }
  .results-grid { grid-template-columns: 1fr 1fr; }
}


/* STAGE 02 REAL OSM DISTRICT PICKER & MINIMAL SPEED PILL */
.osm-picker {
  margin-top: -10px;
  margin-bottom: 18px;
  padding: 12px 14px;
  background: rgba(8, 14, 30, 0.78);
  border: 1px solid rgba(0, 240, 255, 0.28);
  backdrop-filter: blur(8px);
}

.osm-preset-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.osm-chip {
  font-family: 'Rajdhani', 'Meiryo', sans-serif;
  font-weight: 700;
  font-size: 13px;
  padding: 5px 12px;
  color: #cfe4f7;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.16);
  cursor: pointer;
  transition: all 0.18s ease;
}

.osm-chip:hover {
  border-color: rgba(0, 240, 255, 0.6);
  color: #ffffff;
}

.osm-chip.selected {
  color: #03101e;
  background: linear-gradient(90deg, #00e8ff, #6ad7ff);
  border-color: #00f0ff;
  box-shadow: 0 0 14px rgba(0, 240, 255, 0.35);
}

.osm-custom-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

#osm-custom-input {
  flex: 1;
  background: rgba(4, 9, 20, 0.85);
  border: 1px solid rgba(0, 240, 255, 0.28);
  color: #eef8ff;
  padding: 7px 11px;
  font-size: 13px;
  font-family: 'Rajdhani', 'Meiryo', sans-serif;
  outline: none;
  user-select: text;
}

#osm-custom-input:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 10px rgba(0, 240, 255, 0.25);
}

.osm-status {
  font-family: 'Orbitron', sans-serif;
  font-size: 10px;
  letter-spacing: 1px;
  color: #7eeeff;
  white-space: nowrap;
}

.hud-speed-pill {
  font-family: 'Orbitron', sans-serif;
  font-weight: 800;
  font-size: 12px;
  letter-spacing: 1.2px;
  color: #aef4ff;
  height: 30px;
  padding: 0 11px;
  border: 1px solid rgba(0, 240, 255, 0.35);
  background: rgba(4, 10, 24, 0.68);
  backdrop-filter: blur(6px);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.hud-speed-pill span {
  font-size: 10px;
  opacity: 0.72;
}

.hud-speed-pill.overdrive {
  color: #ffe266;
  border-color: rgba(255, 224, 72, 0.75);
  box-shadow: 0 0 16px rgba(255, 210, 60, 0.35);
}
#tutorial-panel {
  position: fixed;
  z-index: 11;
  left: 50%;
  top: clamp(56px, 7.5vh, 80px);
  transform: translateX(-50%);
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 16px;
  width: min(580px, calc(100vw - 28px));
  padding: 10px 20px;
  pointer-events: none;
}
#tutorial-panel, #controls-dialog, #audio-panel, .modal-card {
  border: 1px solid var(--panel-border);
  border-top: 2px solid var(--cyan);
  background: var(--ui-panel);
  color: var(--text-main);
  box-shadow: 0 12px 32px #0009, inset 0 1px 0 var(--cyan-dim);
  font-family: var(--ui-copy);
}
#controls-dialog::backdrop, #audio-panel::backdrop { background: rgba(2, 8, 17, .78); }
#tutorial-panel h2, #controls-dialog h2, #audio-panel h2, .modal-card h2 {
  font-family: var(--ui-heading);
  letter-spacing: .08em;
}
#controls-dialog header, #audio-panel header {
  padding-bottom: 10px;
  border-bottom: 1px solid var(--panel-border);
}
#controls-dialog footer, #audio-panel footer {
  padding-top: 10px;
  border-top: 1px solid var(--panel-border);
}
.in-tutorial .hud-minimal-bottom { display: none; }
#tutorial-panel [hidden], #tutorial-panel[hidden], #btn-tutorial[hidden] { display: none; }
.training-icon {
  display: grid;
  place-items: center;
  align-self: center;
  width: 58px;
  height: 58px;
  border: 1px solid var(--panel-border);
  background: var(--cyan-dim);
  color: var(--ui-focus);
  font-size: 34px;
  line-height: 1;
}
.training-progress { display: flex; gap: 5px; margin-bottom: 7px; }
.training-progress span { width: 20px; height: 3px; background: var(--ui-track); }
.training-progress .done { background: var(--cyan); opacity: .55; }
.training-progress .current { background: var(--ui-focus); box-shadow: 0 0 9px var(--cyan); }
#controls-dialog h2 { margin: 0; font-size: 1.22rem; }
#tutorial-panel h2 { margin: 0; font-size: clamp(23px, 4.1vw, 34px); line-height: 1.12; }
.training-body { min-width: 0; }
.training-tip { margin: 5px 0 8px; color: var(--text-main); font-size: clamp(16px, 2.8vw, 21px); line-height: 1.16; font-weight: 600; }
.training-buttons, .training-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
#controls-rows button {
  padding: 3px 7px;
  border: 1px solid var(--panel-border);
  border-bottom-width: 2px;
  background: rgba(11, 28, 44, .8);
  color: var(--text-main);
  font-family: var(--ui-copy);
  font-size: .77rem;
  font-weight: 700;
  letter-spacing: .035em;
}
.training-actions { pointer-events: auto; }
.training-actions button { padding: 9px 15px; font-size: .92rem; }
.training-buttons { gap: 7px; }
.training-buttons kbd {
  display: inline-block;
  min-width: 46px;
  max-width: 100%;
  padding: 4px 10px;
  border: 1px solid #75dcff;
  border-bottom-width: 3px;
  background: #103954;
  color: #f2feff;
  font: 700 clamp(24px, 3.55vw, 32px) / 1.05 var(--ui-copy);
  text-align: center;
  overflow-wrap: anywhere;
}
.training-actions kbd {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 6px;
  border: 1px solid var(--panel-border);
  background: #071829;
  color: var(--text-main);
  font: 700 clamp(19px, 2.6vw, 23px) / 1.05 var(--ui-copy);
}
.training-ok {
  position: absolute;
  right: 18px;
  top: -16px;
  padding: 4px 9px;
  border: 1px solid #76ffc4;
  background: #0b2b24;
  color: #94ffcb;
  font: 700 17px var(--ui-heading);
}
#tutorial-panel.training-cleared {
  border-top-color: #76ffc4;
}
.training-cleared h2 { color: #94ffcb; }
#tutorial-panel progress { width: min(225px, 100%); height: 6px; accent-color: var(--cyan); display: block; margin-top: 8px; }
#tutorial-panel.dodge-now { border-color: #ffb667; box-shadow: 0 0 24px #ff985755; }
.dodge-now .training-icon, .dodge-now kbd { color: #ffde9b; border-color: #ffb46e; }
#controls-dialog {
  width: min(700px, calc(100vw - 24px));
  max-height: min(84vh, 750px);
  margin: auto;
  padding: 16px;
}
#controls-dialog[open] { display: flex; flex-direction: column; gap: 11px; }
#controls-dialog header, #controls-dialog footer {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}
.binding-scroll { overflow: auto; }
.binding-head, #controls-rows > div {
  display: grid;
  grid-template-columns: 1.15fr 1fr 1fr;
  align-items: center;
  gap: 6px;
  padding: 5px 0;
  border-bottom: 1px solid var(--ui-track);
  font-size: .92rem;
}
.binding-head { color: var(--text-dim); font-weight: 700; letter-spacing: .08em; }
#controls-rows button {
  min-height: 36px;
  cursor: pointer;
}
#controls-rows button:hover, #controls-rows button:focus-visible { background: var(--cyan-dim); }
#controls-status { margin: 0; font-size: .95rem; color: var(--text-dim); }
#controls-status.listening { color: var(--ui-focus); background: var(--cyan-dim); padding: 6px 8px; cursor: crosshair; }
button:focus-visible, #controls-rows button:focus { outline: 2px solid var(--ui-focus); outline-offset: 2px; }
@media (max-width: 540px) {
  #tutorial-panel { padding: 10px 12px; gap: 10px; }
  .training-icon { width: 38px; height: 38px; font-size: 23px; }
  .binding-head, #controls-rows > div { font-size: .72rem; }
  .game-title { font-size: clamp(25px, 7.2vw, 42px); letter-spacing: 1.5px; }
}
@media (max-height: 460px) {
  #tutorial-panel { padding-top: 7px; padding-bottom: 7px; }
  .training-progress { margin-bottom: 3px; }
  .training-tip { margin: 2px 0 4px; }
  .sector-launch { margin-bottom: 14px; }
  .game-title { margin-bottom: 15px; }
}
