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

html, body {
  width: 100%;
  height: 100%;
  height: 100dvh; /* progressive enhancement — dynamic viewport height accounts for iOS Safari's toolbar showing/hiding, where plain 100% can misjudge the visible area after rotating. Browsers without dvh support just keep the 100% above */
  overflow: hidden;
  background: #05070d;
  font-family: 'Segoe UI', 'Trebuchet MS', system-ui, sans-serif;
  color: #dff6ff;
  touch-action: none;
  overscroll-behavior: none;
  -webkit-user-select: none;
  user-select: none;
}

#game-container {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  height: 100dvh;
}

#game-canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  background: #05070d;
}

#hud {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 14px 18px;
  pointer-events: none;
  font-size: 14px;
  letter-spacing: 1px;
  text-shadow: 0 0 6px rgba(0,0,0,0.9);
}

#hud-left {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

#hud-score {
  font-weight: 800;
  font-size: 18px;
  color: #ffffff;
  letter-spacing: 1px;
}

#score-value {
  color: #7fe8ff;
}

#combo-value {
  color: #ffd23f;
  font-size: 13px;
  margin-left: 4px;
}

#hud-speed {
  font-weight: 700;
  color: #7fe8ff;
}

#speed-label {
  color: #ffffff;
}

#hint-text {
  color: rgba(223, 246, 255, 0.55);
  font-size: 12px;
}

#active-effects {
  display: flex;
  gap: 6px;
  margin-top: 2px;
}

.effect-badge {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1px;
  padding: 3px 7px;
  border-radius: 6px;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.effect-badge.visible {
  opacity: 1;
}

#effect-shield {
  color: #bfe9ff;
  background: rgba(191, 233, 255, 0.12);
  border: 1px solid rgba(191, 233, 255, 0.4);
}

#effect-speed {
  color: #7fe8ff;
  background: rgba(127, 232, 255, 0.12);
  border: 1px solid rgba(127, 232, 255, 0.4);
}

#effect-magnet {
  color: #ffd166;
  background: rgba(255, 209, 102, 0.12);
  border: 1px solid rgba(255, 209, 102, 0.4);
}

#challenge-banner {
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  max-width: 90%;
  padding: 5px 14px;
  border-radius: 8px;
  background: rgba(10, 16, 26, 0.55);
  border: 1px solid rgba(255, 209, 102, 0.35);
  color: #ffd166;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
}

#challenge-banner.complete {
  border-color: rgba(127, 232, 255, 0.6);
  color: #7fe8ff;
  box-shadow: 0 0 14px rgba(127, 232, 255, 0.4);
}

#jetpack-meter {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

#jetpack-label {
  font-weight: 700;
  color: #ffb454;
  font-size: 12px;
}

#jetpack-bar {
  width: 110px;
  height: 10px;
  border-radius: 5px;
  background: rgba(255, 180, 84, 0.15);
  border: 1px solid rgba(255, 180, 84, 0.4);
  overflow: hidden;
}

#jetpack-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #ff8a2b, #ffd23f);
  box-shadow: 0 0 8px rgba(255, 170, 60, 0.7);
  transition: width 0.1s linear;
}

#release-cue {
  position: absolute;
  top: 68px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 24px;
  font-weight: 800;
  letter-spacing: 3px;
  color: #ffd23f;
  text-shadow: 0 0 16px rgba(255, 178, 63, 0.9), 0 0 4px rgba(0, 0, 0, 0.85);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.1s ease;
}

#release-cue.visible {
  opacity: 1;
}

#sector-indicator {
  --sector-accent: #7fe8ff;
  position: absolute;
  top: 30%;
  left: 50%;
  transform: translateX(-50%) translateY(-8px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  text-align: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.5s ease, transform 0.5s ease;
}

#sector-indicator.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

#sector-indicator-num {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 4px;
  color: rgba(223, 246, 255, 0.6);
}

#sector-indicator-name {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: 3px;
  color: var(--sector-accent);
  text-shadow: 0 0 18px var(--sector-accent), 0 0 4px rgba(0, 0, 0, 0.85);
}

#zone-hints {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 1;
  transition: opacity 0.5s ease;
}

#zone-hints.hidden {
  opacity: 0;
}

#zone-divider {
  position: absolute;
  top: 18%;
  bottom: 18%;
  left: 50%;
  width: 1px;
  transform: translateX(-50%);
  background: repeating-linear-gradient(
    to bottom,
    rgba(223, 246, 255, 0.22) 0 6px,
    transparent 6px 16px
  );
}

#zone-hint-left,
#zone-hint-right {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 2px;
  padding: 12px 16px;
  border-radius: 12px;
  text-shadow: 0 0 6px rgba(0, 0, 0, 0.9);
}

.zone-hint-icon {
  font-size: 24px;
}

#zone-hint-left {
  left: 10%;
  color: #ffb454;
  background: rgba(255, 180, 84, 0.08);
  border: 1px solid rgba(255, 180, 84, 0.3);
}

#zone-hint-right {
  right: 10%;
  color: #7fe8ff;
  background: rgba(127, 232, 255, 0.08);
  border: 1px solid rgba(127, 232, 255, 0.3);
}

.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: radial-gradient(ellipse at center, rgba(8,14,26,0.85) 0%, rgba(3,5,10,0.96) 75%);
  text-align: center;
  padding: 24px;
  transition: opacity 0.15s ease;
  overflow-y: auto; /* enough phases have piled onto the start screen that it can now be
                        taller than a phone-in-landscape viewport — scroll rather than
                        clip the top/bottom content when that happens */
}

.overlay.hidden {
  display: none;
}

#start-overlay h1 {
  font-size: clamp(38px, 9vw, 64px);
  letter-spacing: 6px;
  color: #7fe8ff;
  text-shadow: 0 0 18px rgba(89, 220, 255, 0.7);
}

#death-overlay h2 {
  font-size: clamp(24px, 6vw, 36px);
  letter-spacing: 3px;
  color: #ff6b6b;
  text-shadow: 0 0 16px rgba(255, 90, 90, 0.6);
}

.subtitle {
  color: rgba(223, 246, 255, 0.65);
  letter-spacing: 3px;
  font-size: 13px;
  text-transform: uppercase;
}

.instructions {
  max-width: 480px;
  line-height: 1.7;
  color: rgba(223, 246, 255, 0.85);
  font-size: 14px;
  margin: 10px 0 6px;
}

.best-score-line {
  color: #ffd23f;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 2px;
}

#skin-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  max-width: 360px;
  max-height: 42vh;
  overflow-y: auto;
  margin: 8px 0;
}

.skin-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 8px;
  background: rgba(127, 232, 255, 0.05);
  border: 1px solid rgba(127, 232, 255, 0.15);
}

.skin-swatch {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.4);
}

.skin-name {
  flex: 1;
  text-align: left;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1px;
  color: rgba(223, 246, 255, 0.9);
}

.skin-action-btn {
  pointer-events: auto;
  background: linear-gradient(180deg, #29e0ff, #0aa7c9);
  border: none;
  color: #04141a;
  font-weight: 800;
  letter-spacing: 1px;
  padding: 8px 14px;
  font-size: 11px;
  border-radius: 6px;
  cursor: pointer;
  margin-top: 0;
  white-space: nowrap;
}

.skin-action-btn:disabled {
  opacity: 0.45;
  cursor: default;
}

kbd {
  background: rgba(127, 232, 255, 0.12);
  border: 1px solid rgba(127, 232, 255, 0.4);
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 12px;
}

.death-stats {
  color: rgba(223, 246, 255, 0.8);
  font-size: 15px;
  margin-bottom: 6px;
}

button {
  pointer-events: auto;
  background: linear-gradient(180deg, #29e0ff, #0aa7c9);
  border: none;
  color: #04141a;
  font-weight: 800;
  letter-spacing: 2px;
  padding: 14px 34px;
  font-size: 16px;
  border-radius: 8px;
  cursor: pointer;
  box-shadow: 0 0 22px rgba(41, 224, 255, 0.5);
  margin-top: 8px;
}

button:active {
  transform: translateY(1px);
}

.death-buttons {
  display: flex;
  gap: 12px;
  align-items: center;
}

.secondary-btn {
  background: transparent;
  border: 1px solid rgba(127, 232, 255, 0.4);
  color: #7fe8ff;
  box-shadow: none;
  padding: 14px 26px;
}

.restart-hint {
  color: rgba(223, 246, 255, 0.5);
  font-size: 12px;
  margin-top: 4px;
}

#fullscreen-btn {
  display: none;
  position: absolute;
  top: 12px;
  right: 14px;
  z-index: 20;
  background: rgba(10, 16, 26, 0.55);
  border: 1px solid rgba(127, 232, 255, 0.35);
  color: #cdeeff;
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 1px;
  padding: 7px 12px;
  border-radius: 6px;
  box-shadow: none;
  margin-top: 0;
}

@media (pointer: coarse) {
  #fullscreen-btn {
    display: inline-block;
  }
}

#sound-toggle-btn {
  position: absolute;
  bottom: 12px;
  right: 14px;
  z-index: 20;
  display: inline-block;
  background: rgba(10, 16, 26, 0.55);
  border: 1px solid rgba(127, 232, 255, 0.35);
  color: #cdeeff;
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 1px;
  padding: 7px 12px;
  border-radius: 6px;
  box-shadow: none;
  margin-top: 0;
}

#rotate-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: radial-gradient(ellipse at center, rgba(8, 14, 26, 0.97) 0%, rgba(2, 4, 10, 0.99) 80%);
  text-align: center;
  padding: 24px;
  cursor: pointer; /* tappable as a manual re-check if auto-detection ever gets stuck */
}

#rotate-overlay.hidden {
  display: none;
}

.rotate-icon {
  font-size: 56px;
  animation: rotate-hint 1.6s ease-in-out infinite;
}

@keyframes rotate-hint {
  0%, 100% { transform: rotate(0deg); }
  50% { transform: rotate(-90deg); }
}

.rotate-title {
  font-size: 19px;
  letter-spacing: 2px;
  color: #7fe8ff;
  text-transform: uppercase;
  text-shadow: 0 0 14px rgba(89, 220, 255, 0.5);
}

.rotate-sub {
  font-size: 13px;
  color: rgba(223, 246, 255, 0.6);
  max-width: 280px;
  line-height: 1.5;
}

.rotate-retry-hint {
  font-size: 11px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: rgba(127, 232, 255, 0.45);
  margin-top: 6px;
}

#ios-install-hint.hidden {
  display: none;
}

/* phone-in-landscape is short (often 300-420px tall) — tighten the start/cosmetics/
   death screens so they fit without needing to scroll in the common case. Placed at
   the end of the file on purpose: several of these selectors tie in specificity with
   earlier rules (e.g. #start-overlay h1), and CSS resolves same-specificity ties by
   source order, so this has to come last to actually win */
@media (max-height: 450px) {
  .overlay {
    gap: 5px;
    padding: 10px 24px;
  }
  #start-overlay h1 {
    font-size: clamp(22px, 6vw, 34px);
  }
  .subtitle {
    font-size: 11px;
  }
  .instructions {
    font-size: 12px;
    line-height: 1.3;
    margin: 3px 0 2px;
  }
  .best-score-line {
    font-size: 11px;
  }
  .overlay button {
    padding: 7px 22px;
    font-size: 13px;
    margin-top: 3px;
  }
  #skin-list {
    max-height: 30vh;
    gap: 5px;
  }
  .skin-row {
    padding: 5px 10px;
  }
}
