:root {
  --bg-deep: #04060d;
  --glass-bg: rgba(9, 13, 26, 0.62);
  --glass-bg-strong: rgba(8, 12, 24, 0.78);
  --glass-border: rgba(145, 215, 255, 0.16);
  --glass-border-bright: rgba(145, 215, 255, 0.34);
  --text-main: #eef6ff;
  --text-dim: rgba(190, 214, 245, 0.65);
  --accent-cyan: #48f5ff;
  --accent-gold: #ffcf56;
  --accent-magenta: #ff4fa3;
  --accent-crimson: #ff3e66;
  --font-display: 'Orbitron', 'Segoe UI', system-ui, sans-serif;
  --font-ui: 'Space Grotesk', 'Segoe UI', system-ui, sans-serif;
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg-deep);
  color: var(--text-main);
  font-family: var(--font-ui);
  -webkit-font-smoothing: antialiased;
}

#app {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

#game-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

.hidden {
  display: none !important;
}

/* ==================== HUD ==================== */
.hud {
  position: fixed;
  top: 14px;
  left: 18px;
  right: 18px;
  z-index: 20;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  pointer-events: none;
}

.hud-group {
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: auto;
}

.hud-center {
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.hud-pill {
  background: var(--glass-bg);
  backdrop-filter: blur(16px) saturate(150%);
  -webkit-backdrop-filter: blur(16px) saturate(150%);
  border: 1px solid var(--glass-border);
  border-radius: 14px;
  padding: 8px 14px;
  box-shadow:
    0 10px 30px rgba(0, 0, 0, 0.42),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.hud-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.16em;
  color: var(--text-dim);
  text-transform: uppercase;
}

.hud-value {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--text-main);
  text-shadow: 0 0 16px rgba(72, 245, 255, 0.35);
}

.hud-value.dim {
  font-size: 16px;
  color: rgba(215, 232, 255, 0.72);
  text-shadow: none;
}

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

.combo-badge {
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 800;
  color: #140d02;
  background: linear-gradient(135deg, #ffe27a, #ff9d2e);
  padding: 2px 7px;
  border-radius: 999px;
  box-shadow: 0 0 16px rgba(255, 198, 72, 0.65);
  animation: popBounce 0.25s cubic-bezier(0.2, 1.4, 0.4, 1);
}

@keyframes popBounce {
  0% { transform: scale(0.6); }
  100% { transform: scale(1); }
}

/* Stage Pill & Ring */
.stage-pill {
  flex-direction: row;
  align-items: center;
  gap: 14px;
  padding: 6px 14px 6px 16px;
}

.stage-meta {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.stage-tag {
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.2em;
  color: var(--accent-cyan);
}

.stage-name {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.09em;
  color: var(--text-main);
}

.progress-ring-wrap {
  position: relative;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.progress-ring {
  width: 38px;
  height: 38px;
  transform: rotate(-90deg);
}

.ring-bg {
  fill: none;
  stroke: rgba(255, 255, 255, 0.1);
  stroke-width: 3.2;
}

.ring-fg {
  fill: none;
  stroke: var(--accent-gold);
  stroke-width: 3.2;
  stroke-linecap: round;
  stroke-dasharray: 100.53;
  stroke-dashoffset: 100.53;
  transition: stroke-dashoffset 0.28s ease-out;
  filter: drop-shadow(0 0 6px rgba(255, 207, 86, 0.75));
}

.ring-text {
  position: absolute;
  font-family: var(--font-display);
  font-size: 9px;
  font-weight: 700;
  color: var(--text-main);
}

/* Overdrive Banner */
.overdrive-banner {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 14px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(255, 205, 65, 0.22), rgba(72, 245, 255, 0.22));
  border: 1px solid rgba(255, 224, 115, 0.65);
  box-shadow: 0 0 24px rgba(255, 207, 86, 0.45);
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.16em;
  color: #fff6cf;
  animation: overdriveGlow 0.9s ease-in-out infinite alternate;
}

.od-pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ffe174;
  box-shadow: 0 0 12px #ffe174;
}

@keyframes overdriveGlow {
  from { box-shadow: 0 0 16px rgba(255, 207, 86, 0.4); }
  to { box-shadow: 0 0 30px rgba(72, 245, 255, 0.75); }
}

/* Gap Charges */
.gap-pill {
  min-width: 118px;
}

.gap-pips {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 3px;
}

.gap-pip {
  position: relative;
  width: 28px;
  height: 7px;
  border-radius: 999px;
  background: rgba(72, 245, 255, 0.12);
  border: 1px solid rgba(72, 245, 255, 0.28);
  overflow: hidden;
}

.gap-pip-fill {
  height: 100%;
  width: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #32e2ff, #a9fbff);
  box-shadow: 0 0 10px rgba(72, 245, 255, 0.85);
  transition: width 0.08s linear;
}

.gap-pip.charging .gap-pip-fill {
  background: linear-gradient(90deg, rgba(72, 245, 255, 0.45), rgba(145, 230, 255, 0.75));
  box-shadow: none;
}

/* Lives */
.lives-icons {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 2px;
  min-height: 18px;
}

.life-prism {
  width: 13px;
  height: 13px;
  transform: rotate(45deg);
  border-radius: 2px;
  background: linear-gradient(135deg, #ffffff, #48f5ff 55%, #1d8cff);
  box-shadow: 0 0 10px rgba(72, 245, 255, 0.8);
  transition: transform 0.25s ease, opacity 0.25s ease;
}

.life-prism.lost {
  opacity: 0.16;
  transform: rotate(45deg) scale(0.75);
  box-shadow: none;
}

/* Icon Buttons */
.hud-actions {
  display: flex;
  gap: 6px;
}

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  color: var(--text-main);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: all 0.18s ease;
}

.icon-btn svg {
  width: 18px;
  height: 18px;
}

.icon-btn:hover {
  border-color: var(--accent-cyan);
  background: rgba(20, 34, 62, 0.8);
  box-shadow: 0 0 16px rgba(72, 245, 255, 0.25);
  transform: translateY(-1px);
}

/* ==================== OVERLAYS ==================== */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: safe center;
  justify-content: center;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px;
  background: radial-gradient(circle at center, rgba(5, 9, 20, 0.25) 0%, rgba(3, 5, 12, 0.66) 100%);
  animation: fadeIn 0.28s ease-out;
}

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

.title-card, .modal-card {
  position: relative;
  margin: auto;
  width: min(620px, 94vw);
  padding: 32px 34px 26px;
  border-radius: 26px;
  background: linear-gradient(165deg, rgba(12, 18, 36, 0.78), rgba(6, 9, 20, 0.86));
  backdrop-filter: blur(22px) saturate(160%);
  -webkit-backdrop-filter: blur(22px) saturate(160%);
  border: 1px solid rgba(130, 215, 255, 0.22);
  box-shadow:
    0 32px 80px rgba(0, 0, 0, 0.68),
    0 0 60px rgba(56, 210, 255, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.14);
  text-align: center;
  overflow: hidden;
  flex-shrink: 0;
}

.title-card::before, .modal-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 12%;
  right: 12%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(72, 245, 255, 0.85), rgba(255, 207, 86, 0.85), transparent);
}

.modal-card {
  width: min(460px, 92vw);
  padding: 34px 32px 30px;
}

.title-eyebrow, .modal-eyebrow {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.34em;
  color: var(--accent-cyan);
  margin-bottom: 10px;
  text-transform: uppercase;
}

.game-title {
  font-family: var(--font-display);
  font-size: clamp(46px, 8.2vw, 76px);
  font-weight: 900;
  letter-spacing: 0.16em;
  line-height: 1;
  padding-left: 0.16em;
  background: linear-gradient(180deg, #ffffff 0%, #c6f3ff 42%, #5ce8ff 68%, #ffcf56 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 26px rgba(72, 245, 255, 0.45));
  margin-bottom: 6px;
}

.title-subtitle {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.48em;
  padding-left: 0.48em;
  color: rgba(255, 219, 128, 0.88);
  margin-bottom: 26px;
}

.how-to-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 22px;
}

.how-item {
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(160, 210, 255, 0.1);
  border-radius: 14px;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.how-key {
  font-family: var(--font-display);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--text-main);
}

.how-desc {
  font-size: 12px;
  line-height: 1.38;
  color: var(--text-dim);
}

.accent-gold { color: var(--accent-gold) !important; }
.accent-cyan { color: var(--accent-cyan) !important; }
.accent-crimson { color: var(--accent-crimson) !important; }

/* Sector Picker */
.sector-picker {
  margin-bottom: 24px;
}

.picker-label {
  display: block;
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.24em;
  color: var(--text-dim);
  margin-bottom: 10px;
}

.sector-buttons {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
}

.sector-btn {
  position: relative;
  min-width: 72px;
  padding: 8px 10px;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(160, 210, 255, 0.14);
  color: var(--text-dim);
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: all 0.18s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.sector-swatch {
  width: 24px;
  height: 3px;
  border-radius: 999px;
}

.sector-btn:hover {
  background: rgba(255, 255, 255, 0.09);
  color: var(--text-main);
  transform: translateY(-1px);
}

.sector-btn.active {
  background: rgba(72, 245, 255, 0.14);
  border-color: var(--accent-cyan);
  color: #ffffff;
  box-shadow: 0 0 18px rgba(72, 245, 255, 0.26);
}

/* Control Scheme Picker */
.scheme-picker {
  margin-bottom: 18px;
}

.scheme-picker-compact {
  margin-bottom: 20px;
}

.scheme-buttons {
  display: inline-flex;
  gap: 8px;
  padding: 4px;
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(160, 210, 255, 0.14);
}

.scheme-btn {
  padding: 7px 16px;
  border-radius: 9px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-dim);
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: all 0.16s ease;
}

.scheme-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.06);
}

.scheme-btn.active {
  background: rgba(72, 245, 255, 0.16);
  border-color: var(--accent-cyan);
  color: #ffffff;
  box-shadow: 0 0 16px rgba(72, 245, 255, 0.24);
}

.scheme-desc {
  margin-top: 7px;
  font-size: 12px;
  line-height: 1.35;
  color: var(--text-dim);
}

/* Primary & Secondary Buttons */
.title-cta-row {
  display: flex;
  justify-content: center;
  margin-bottom: 18px;
}

.primary-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-width: 230px;
  padding: 15px 30px;
  border-radius: 14px;
  border: 1px solid rgba(165, 247, 255, 0.65);
  background: linear-gradient(135deg, #1698ff 0%, #24e3ff 52%, #ffd45e 100%);
  color: #05101e;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 900;
  letter-spacing: 0.16em;
  cursor: pointer;
  box-shadow:
    0 12px 34px rgba(36, 227, 255, 0.34),
    inset 0 1px 1px rgba(255, 255, 255, 0.7);
  transition: transform 0.16s ease, box-shadow 0.2s ease, filter 0.2s ease;
  overflow: hidden;
}

.primary-btn:hover {
  transform: translateY(-2px) scale(1.015);
  box-shadow:
    0 16px 44px rgba(36, 227, 255, 0.52),
    0 0 28px rgba(255, 212, 94, 0.35);
  filter: brightness(1.06);
}

.primary-btn:active {
  transform: translateY(0) scale(0.99);
}

.btn-hint {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.14em;
  padding: 3px 6px;
  border-radius: 6px;
  background: rgba(5, 16, 30, 0.18);
  color: #05101e;
}

.secondary-btn, .ghost-btn {
  width: 100%;
  padding: 12px 20px;
  border-radius: 12px;
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  cursor: pointer;
  transition: all 0.16s ease;
}

.secondary-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(160, 215, 255, 0.24);
  color: var(--text-main);
}

.secondary-btn:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: var(--accent-cyan);
}

.ghost-btn {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-dim);
}

.ghost-btn:hover {
  color: var(--text-main);
  border-color: rgba(255, 255, 255, 0.26);
}

.title-footer {
  font-size: 12.5px;
  color: var(--text-dim);
}

.title-footer strong {
  color: var(--accent-gold);
  font-weight: 600;
}

.title-version {
  margin-top: 10px;
  font-family: var(--font-display);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.16em;
  color: rgba(190, 214, 245, 0.48);
}

/* Modal specifics */
.modal-title {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 900;
  letter-spacing: 0.1em;
  margin-bottom: 22px;
}

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

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

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}

.stat-box {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(160, 210, 255, 0.12);
  border-radius: 13px;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.16em;
  color: var(--text-dim);
}

.stat-val {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: var(--text-main);
}

.new-best-pill {
  display: inline-block;
  margin-bottom: 18px;
  padding: 5px 14px;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(255, 212, 94, 0.25), rgba(255, 110, 180, 0.22));
  border: 1px solid rgba(255, 212, 94, 0.65);
  color: var(--accent-gold);
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.2em;
  box-shadow: 0 0 20px rgba(255, 207, 86, 0.3);
}

.go-pax-note {
  margin: -4px 0 18px;
  font-size: 12.5px;
  line-height: 1.45;
  color: #9cb27d;
}

/* Practice Mode Indicator */
.pax-badge {
  position: fixed;
  left: 16px;
  bottom: 14px;
  z-index: 40;
  pointer-events: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px 4px 7px;
  border-radius: 999px;
  background: rgba(12, 17, 14, 0.56);
  border: 1px solid rgba(143, 167, 114, 0.3);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.pax-svg {
  width: 44px;
  height: 18px;
  display: block;
}

.pax-label {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: #9bb37e;
}

/* Stage Intro Banner */
.stage-banner {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 25;
  pointer-events: none;
  text-align: center;
  padding: 20px 44px;
  border-radius: 20px;
  background: rgba(6, 10, 22, 0.72);
  backdrop-filter: blur(14px);
  border: 1px solid rgba(120, 225, 255, 0.3);
  box-shadow: 0 0 50px rgba(56, 215, 255, 0.25);
  animation: bannerPulse 1.85s ease forwards;
}

@keyframes bannerPulse {
  0% { opacity: 0; transform: translate(-50%, -44%) scale(0.92); }
  16% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  80% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -54%) scale(1.03); }
}

.banner-eyebrow {
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.34em;
  color: var(--accent-cyan);
  margin-bottom: 4px;
}

.banner-title {
  font-family: var(--font-display);
  font-size: clamp(24px, 4vw, 38px);
  font-weight: 900;
  letter-spacing: 0.14em;
  color: #ffffff;
  text-shadow: 0 0 24px rgba(72, 245, 255, 0.65);
  margin-bottom: 6px;
}

.banner-sub {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.22em;
  color: rgba(255, 220, 128, 0.9);
}

/* Bottom Controls Hint */
.controls-bar {
  position: fixed;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 15;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 16px;
  border-radius: 999px;
  background: rgba(8, 12, 24, 0.52);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(160, 215, 255, 0.12);
  font-size: 11.5px;
  color: var(--text-dim);
  pointer-events: none;
  white-space: nowrap;
}

.controls-bar kbd {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.09);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: var(--text-main);
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 700;
}

.controls-bar .sep {
  opacity: 0.35;
}

/* Touch Controls */
.touch-controls {
  position: fixed;
  bottom: 18px;
  left: 18px;
  right: 18px;
  z-index: 22;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  pointer-events: none;
}

.dpad {
  position: relative;
  width: 144px;
  height: 144px;
  pointer-events: auto;
}

.dpad-btn {
  position: absolute;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: rgba(12, 20, 40, 0.65);
  border: 1px solid rgba(110, 220, 255, 0.35);
  color: #eef6ff;
  font-size: 16px;
  display: grid;
  place-items: center;
  backdrop-filter: blur(10px);
}

.dpad-btn:active {
  background: rgba(72, 245, 255, 0.32);
}

.dpad-btn.up { top: 0; left: 48px; }
.dpad-btn.down { bottom: 0; left: 48px; }
.dpad-btn.left { top: 48px; left: 0; }
.dpad-btn.right { top: 48px; right: 0; }

/* First-person touch layout: only left & right buttons */
.touch-controls.first-person .dpad {
  width: 148px;
  height: 64px;
}

.touch-controls.first-person .dpad-btn.up,
.touch-controls.first-person .dpad-btn.down {
  display: none;
}

.touch-controls.first-person .dpad-btn.left,
.touch-controls.first-person .dpad-btn.right {
  top: 4px;
  width: 62px;
  height: 56px;
  font-size: 20px;
}

.touch-controls.first-person .dpad-btn.left { left: 0; }
.touch-controls.first-person .dpad-btn.right { right: 0; }

.touch-gap-btn {
  width: 78px;
  height: 78px;
  border-radius: 50%;
  pointer-events: auto;
  background: radial-gradient(circle at 35% 35%, rgba(72, 245, 255, 0.45), rgba(14, 30, 58, 0.85));
  border: 2px solid rgba(72, 245, 255, 0.8);
  color: #ffffff;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.14em;
  box-shadow: 0 0 24px rgba(72, 245, 255, 0.4);
}

.touch-gap-btn:active {
  transform: scale(0.94);
  background: rgba(72, 245, 255, 0.7);
  color: #04101e;
}

/* Title Best Score + High Scores Row */
.title-best-row {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 14px;
  padding: 5px 7px 5px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(160, 210, 255, 0.16);
}

.title-best-badge {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  color: var(--text-dim);
}

.title-best-badge strong {
  color: var(--accent-gold);
  font-weight: 800;
  margin-left: 4px;
  letter-spacing: 0.08em;
}

.hs-open-btn {
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(72, 245, 255, 0.12);
  border: 1px solid rgba(72, 245, 255, 0.38);
  color: var(--text-main);
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: all 0.16s ease;
}

.hs-open-btn:hover, .hs-open-btn:focus-visible {
  background: rgba(72, 245, 255, 0.24);
  border-color: var(--accent-cyan);
  box-shadow: 0 0 16px rgba(72, 245, 255, 0.28);
  outline: none;
}

/* High Scores & Game Over Modals */
.scores-modal {
  width: min(560px, 95vw);
  padding: 24px 26px 22px;
}

.scores-modal-title {
  font-size: 24px;
  margin-bottom: 10px;
}

.go-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  text-align: left;
  margin-bottom: 10px;
}

.go-header-left .modal-eyebrow {
  margin-bottom: 2px;
}

.go-header-left .scores-modal-title {
  margin-bottom: 0;
}

.go-compact-stats {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.go-mini-stat {
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(160, 210, 255, 0.14);
  border-radius: 11px;
  padding: 6px 12px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1px;
}

.go-mini-stat .stat-val {
  font-size: 16px;
}

.go-status-line {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--accent-gold);
  margin: 0 0 12px;
  line-height: 1.4;
}

.go-status-line.is-pax {
  color: #9cb27d;
}

.go-status-line.is-muted {
  color: var(--text-dim);
}

/* Tabs */
.score-tabs {
  display: inline-flex;
  gap: 6px;
  padding: 4px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(160, 210, 255, 0.14);
  margin-bottom: 12px;
}

.score-tab {
  padding: 6px 15px;
  border-radius: 8px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-dim);
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: all 0.16s ease;
}

.score-tab:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.06);
}

.score-tab.active {
  background: rgba(72, 245, 255, 0.16);
  border-color: var(--accent-cyan);
  color: #ffffff;
  box-shadow: 0 0 14px rgba(72, 245, 255, 0.22);
}

/* 10-Row High Score List */
.scores-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 10px;
  text-align: left;
}

.score-row-item {
  display: grid;
  grid-template-columns: 34px 52px minmax(72px, 1fr) 82px 84px;
  align-items: center;
  gap: 8px;
  padding: 6px 11px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(160, 210, 255, 0.08);
  font-size: 13px;
  line-height: 1.25;
}

.score-row-item.is-current {
  background: linear-gradient(90deg, rgba(72, 245, 255, 0.18), rgba(255, 207, 86, 0.15));
  border-color: rgba(255, 212, 94, 0.65);
  box-shadow: 0 0 18px rgba(72, 245, 255, 0.2);
}

.sc-rank {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 700;
  color: var(--text-dim);
}

.score-row-item.is-top1 .sc-rank {
  color: var(--accent-gold);
}

.sc-name {
  font-family: var(--font-display);
  font-size: 12.5px;
  font-weight: 800;
  letter-spacing: 0.14em;
  color: var(--accent-cyan);
}

.score-row-item.is-current .sc-name {
  color: #ffffff;
}

.sc-score {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--text-main);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.sc-level {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-dim);
  text-align: right;
  white-space: nowrap;
}

.sc-date {
  font-size: 11.5px;
  color: rgba(190, 214, 245, 0.56);
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.scores-msg {
  font-size: 13px;
  color: var(--text-dim);
  margin: 6px 0 12px;
  line-height: 1.45;
}

/* Initials Input (min 16px to avoid iOS zoom; selectable even with global user-select:none) */
.initials-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 10px 0 14px;
}

.initials-label {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.initials-input {
  width: 96px;
  padding: 7px 12px;
  border-radius: 10px;
  background: rgba(6, 12, 26, 0.85);
  border: 1px solid rgba(72, 245, 255, 0.48);
  color: #ffffff;
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.24em;
  text-align: center;
  text-transform: uppercase;
  user-select: text;
  -webkit-user-select: text;
  outline: none;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.initials-input:focus {
  border-color: var(--accent-gold);
  box-shadow: 0 0 18px rgba(255, 207, 86, 0.32);
}

.go-actions-row {
  flex-direction: row;
  gap: 10px;
}

.go-actions-row .primary-btn {
  flex: 1.4;
  min-width: 0;
  padding: 13px 18px;
}

.go-actions-row .ghost-btn {
  flex: 0.8;
  width: auto;
  padding: 13px 14px;
}

.scores-actions {
  margin-top: 8px;
}

/* Low, wide windows (e.g. 900x560): 2 columns of 5 rows */
@media (max-height: 640px) and (min-width: 640px) {
  .scores-modal {
    width: min(840px, 95vw);
    padding: 16px 20px 14px;
  }
  .scores-modal-title {
    font-size: 20px;
    margin-bottom: 6px;
  }
  .go-header {
    margin-bottom: 6px;
  }
  .go-status-line {
    margin-bottom: 8px;
    font-size: 12.5px;
  }
  .score-tabs {
    margin-bottom: 8px;
  }
  .scores-list.two-col-wide {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: repeat(5, auto);
    grid-auto-flow: column;
    column-gap: 12px;
    row-gap: 4px;
    margin-bottom: 8px;
  }
  .score-row-item {
    grid-template-columns: 28px 44px minmax(60px, 1fr) 68px 74px;
    gap: 6px;
    padding: 4px 9px;
    font-size: 12px;
  }
  .sc-name, .sc-score {
    font-size: 12px;
  }
  .sc-level, .sc-date {
    font-size: 11px;
  }
  .initials-wrap {
    margin: 6px 0 10px;
  }
  .go-actions-row .primary-btn,
  .go-actions-row .ghost-btn {
    padding: 10px 14px;
  }
}

/* Narrow screens: drop date column first (covers 375x667) */
@media (max-width: 520px) {
  .scores-modal {
    padding: 18px 14px 16px;
  }
  .go-header {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 8px;
  }
  .score-row-item {
    grid-template-columns: 30px 48px minmax(68px, 1fr) 74px;
    padding: 6px 9px;
    gap: 6px;
  }
  .sc-date {
    display: none;
  }
  .go-actions-row {
    flex-direction: column;
  }
  .go-actions-row .primary-btn,
  .go-actions-row .ghost-btn {
    width: 100%;
    flex: none;
  }
}

/* Very narrow screens (320x568): also drop level column */
@media (max-width: 350px) {
  .scores-modal {
    padding: 14px 10px 14px;
  }
  .score-row-item {
    grid-template-columns: 28px 46px minmax(64px, 1fr);
    padding: 5px 8px;
    gap: 6px;
    font-size: 12px;
  }
  .sc-level {
    display: none;
  }
  .initials-wrap {
    gap: 8px;
  }
  .initials-input {
    width: 84px;
  }
}

@media (max-width: 760px) {
  .how-to-strip {
    grid-template-columns: 1fr;
  }
  .best-pill, .controls-bar {
    display: none !important;
  }
  .hud {
    top: 8px;
    left: 10px;
    right: 10px;
  }
  .hud-pill {
    padding: 6px 10px;
  }
  .hud-value {
    font-size: 16px;
  }
  .stage-name {
    display: none;
  }
  .pax-badge {
    left: 10px;
    bottom: auto;
    top: 66px;
  }
}
