/* ───────────────────────────────────────────────────────────────────────────
   Star Drifter – UI-Stile
   Spielfläche = Canvas; HUD und Bildschirme liegen als Overlays darüber.
   ─────────────────────────────────────────────────────────────────────────── */

:root {
  --bg: #05060f;
  --cyan: #5ad1ff;
  --cyan-dim: #2a7fa8;
  --magenta: #ff6ad5;
  --gold: #ffd34d;
  --danger: #ff5a5a;
  --text: #dce6ff;
  --dim: #7e8bb5;
  --panel: rgba(12, 18, 40, 0.82);
  --border: rgba(90, 209, 255, 0.25);
}

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

html, body {
  height: 100%;
  background: #02030a;
  color: var(--text);
  font-family: 'Rajdhani', system-ui, sans-serif;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  /* Sternennebel hinter der Spielfläche */
  background:
    radial-gradient(ellipse at 20% 10%, rgba(90, 209, 255, 0.08), transparent 45%),
    radial-gradient(ellipse at 85% 90%, rgba(255, 106, 213, 0.08), transparent 45%),
    #02030a;
  -webkit-user-select: none;
  user-select: none;
  touch-action: none;
}

/* Bühne mit festem Seitenverhältnis (480:720), skaliert auf den Viewport.
   - Desktop: bis 620px breit, durch die Höhe begrenzt (94vh lässt etwas Rand).
   - Mobile: nutzt die volle Breite (100vw). */
#stage {
  position: relative;
  width: min(620px, 100vw, calc(94vh * 0.6667));
  aspect-ratio: 480 / 720;
  box-shadow: 0 0 60px rgba(90, 209, 255, 0.15), 0 0 0 1px var(--border);
  border-radius: 14px;
  overflow: hidden;
}

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

.hidden { display: none !important; }

/* ── HUD ─────────────────────────────────────────────────────────────────── */
.hud {
  position: absolute;
  inset: 0;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 14px;
}
.hud-header { display: flex; flex-direction: column; gap: 8px; }
.hud-top { display: flex; align-items: flex-start; gap: 10px; }
.hud-stat {
  font-family: 'Orbitron', sans-serif;
  font-weight: 700;
  font-size: 22px;
  line-height: 1;
  text-shadow: 0 0 12px rgba(90, 209, 255, 0.5);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.hud-cap { font-size: 9px; letter-spacing: 2px; color: var(--dim); font-family: 'Rajdhani'; }
.hud-stat.coins { margin-left: auto; color: var(--gold); font-size: 18px; align-self: center; text-shadow: 0 0 12px rgba(255, 211, 77, 0.5); }
.icon-btn {
  pointer-events: auto;
  width: 36px; height: 36px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--cyan);
  border-radius: 8px;
  font-family: 'Orbitron', sans-serif;
  font-weight: 700;
  cursor: pointer;
  backdrop-filter: blur(4px);
}
.icon-btn:hover { background: rgba(90, 209, 255, 0.15); }
.hud-bottom { display: flex; justify-content: space-between; align-items: flex-end; }
.hud-lives { font-size: 18px; letter-spacing: 2px; filter: drop-shadow(0 0 6px rgba(255, 90, 90, 0.6)); }
.hud-effects { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-start; min-height: 22px; }

/* Feuerknopf (Touch + Maus). Auf dem Desktop zusätzlich per Leertaste. */
.fire-btn {
  pointer-events: auto;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 2px solid rgba(255, 157, 60, 0.6);
  background: radial-gradient(circle at 50% 40%, rgba(255, 157, 60, 0.35), rgba(12, 18, 40, 0.85));
  color: #fff;
  font-size: 30px;
  cursor: pointer;
  backdrop-filter: blur(4px);
  box-shadow: 0 0 20px rgba(255, 157, 60, 0.3);
  transition: transform 0.06s, box-shadow 0.12s;
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
}
.fire-btn:active {
  transform: scale(0.92);
  box-shadow: 0 0 30px rgba(255, 157, 60, 0.6);
  background: radial-gradient(circle at 50% 40%, rgba(255, 157, 60, 0.6), rgba(12, 18, 40, 0.9));
}
.chip {
  font-family: 'Orbitron', sans-serif;
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 20px;
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--cyan);
}

/* ── Bildschirm-Overlays ─────────────────────────────────────────────────── */
.screen {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at center, rgba(5, 8, 22, 0.7), rgba(2, 3, 10, 0.92));
  backdrop-filter: blur(3px);
  padding: 24px;
}
.screen-inner {
  width: 100%;
  max-width: 360px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  text-align: center;
}

.title {
  font-family: 'Orbitron', sans-serif;
  font-weight: 900;
  font-size: clamp(34px, 11vw, 52px);
  line-height: 0.95;
  letter-spacing: 2px;
  color: var(--cyan);
  text-shadow: 0 0 24px rgba(90, 209, 255, 0.6);
}
.title span { display: block; color: var(--magenta); text-shadow: 0 0 24px rgba(255, 106, 213, 0.6); }
.tagline { color: var(--dim); letter-spacing: 4px; font-size: 13px; text-transform: uppercase; margin-bottom: 4px; }

.subtitle {
  font-family: 'Orbitron', sans-serif;
  font-weight: 700;
  font-size: 30px;
  letter-spacing: 3px;
  color: var(--cyan);
  text-shadow: 0 0 20px rgba(90, 209, 255, 0.5);
}
.subtitle.danger { color: var(--danger); text-shadow: 0 0 20px rgba(255, 90, 90, 0.6); }

.menu-stats {
  display: flex;
  gap: 14px;
  width: 100%;
  margin: 6px 0;
}
.menu-stats > div {
  flex: 1;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.menu-stats .cap { font-size: 10px; letter-spacing: 2px; color: var(--dim); }
.menu-stats strong { font-family: 'Orbitron', sans-serif; font-size: 20px; color: var(--gold); }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  pointer-events: auto;
  width: 100%;
  font-family: 'Orbitron', sans-serif;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 1px;
  padding: 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
  transition: transform 0.08s, background 0.15s, box-shadow 0.15s;
}
.btn:hover { background: rgba(90, 209, 255, 0.12); box-shadow: 0 0 18px rgba(90, 209, 255, 0.2); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary {
  background: linear-gradient(135deg, var(--cyan), var(--cyan-dim));
  color: #04121b;
  border: none;
  box-shadow: 0 0 24px rgba(90, 209, 255, 0.35);
}
.btn-primary:hover { box-shadow: 0 0 32px rgba(90, 209, 255, 0.55); }

.hint { color: var(--dim); font-size: 12px; margin-top: 6px; line-height: 1.5; }

/* ── Game Over ───────────────────────────────────────────────────────────── */
.newbest {
  font-family: 'Orbitron', sans-serif;
  color: var(--gold);
  font-size: 14px;
  letter-spacing: 2px;
  animation: pulse 1s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }
.result {
  width: 100%;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.result-row { display: flex; justify-content: space-between; align-items: center; font-size: 15px; }
.result-row span { color: var(--dim); }
.result-row strong { font-family: 'Orbitron', sans-serif; color: var(--text); font-size: 17px; }

/* ── Shop / Hangar ───────────────────────────────────────────────────────── */
.store-inner { max-width: 100%; height: 100%; justify-content: flex-start; padding-top: 6px; }
.store-head { display: flex; align-items: center; justify-content: space-between; width: 100%; }
.store-balance { font-family: 'Orbitron', sans-serif; color: var(--gold); font-size: 18px; }
.store-list {
  width: 100%;
  flex: 1;
  overflow-y: auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 4px;
  -webkit-overflow-scrolling: touch;
}
.ship-card {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-align: center;
}
.ship-card.is-selected { border-color: var(--cyan); box-shadow: 0 0 18px rgba(90, 209, 255, 0.3); }
.ship-badge {
  position: absolute; top: 6px; right: 6px;
  font-family: 'Orbitron', sans-serif;
  font-size: 8px; letter-spacing: 1px;
  color: var(--gold);
  border: 1px solid rgba(255, 211, 77, 0.5);
  border-radius: 4px;
  padding: 2px 4px;
}
.ship-icon {
  width: 42px; height: 42px;
  background: var(--c);
  clip-path: polygon(50% 0, 100% 100%, 50% 78%, 0 100%);
  filter: drop-shadow(0 0 10px var(--c));
}
.ship-name { font-family: 'Orbitron', sans-serif; font-weight: 700; font-size: 14px; }
.ship-desc { font-size: 12px; color: var(--dim); line-height: 1.3; min-height: 30px; }
.ship-stats { display: flex; gap: 10px; font-size: 12px; color: var(--cyan); }
.ship-btn {
  width: 100%;
  margin-top: 4px;
  font-family: 'Orbitron', sans-serif;
  font-size: 12px;
  padding: 8px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(90, 209, 255, 0.1);
  color: var(--cyan);
  cursor: pointer;
  transition: background 0.15s;
}
.ship-btn:hover { background: rgba(90, 209, 255, 0.22); }
.ship-btn.selected { background: var(--cyan); color: #04121b; border: none; cursor: default; }
.ship-btn.premium { background: linear-gradient(135deg, var(--magenta), #b83a8f); color: #fff; border: none; }
.ship-btn.locked, .ship-btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* Scrollbar im Shop */
.store-list::-webkit-scrollbar { width: 4px; }
.store-list::-webkit-scrollbar-thumb { background: var(--cyan-dim); border-radius: 4px; }
