/* ============================================
   Starfield Survivor — Game Styles
   ============================================ */

/* ── Title Gradient ──────────────────────── */
.title-ss {
  background: linear-gradient(135deg, #06d6a0, #38bdf8, #a855f7) !important;
  background-size: 200% 200% !important;
  -webkit-background-clip: text !important;
  background-clip: text !important;
  -webkit-text-fill-color: transparent !important;
  animation: ssGradShift 5s ease infinite !important;
}

@keyframes ssGradShift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

/* ── Game Page Layout ────────────────────── */
.game-page {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
  padding: 0 16px;
}

/* ── Game Container ──────────────────────── */
.game-container {
  position: relative;
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  aspect-ratio: 4 / 3;
  max-height: calc(100vh - 140px);
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: #06080f;
  box-shadow:
    0 0 40px rgba(6, 214, 160, 0.06),
    0 0 80px rgba(168, 85, 247, 0.04);
}

#game-canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: none;
}

/* ── Screen Overlays ─────────────────────── */
.screen {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 20;
}

.screen--active {
  display: flex;
}

.overlay__bg {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, rgba(6, 8, 15, 0.7) 0%, rgba(6, 8, 15, 0.95) 100%);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.overlay__content {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 40px 32px;
  max-width: 420px;
}

.overlay__title {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 5vw, 2.8rem);
  font-weight: 900;
  letter-spacing: 0.05em;
  margin-bottom: 12px;
  background: linear-gradient(135deg, #06d6a0, #38bdf8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.overlay__title--fail {
  background: linear-gradient(135deg, #ef4444, #f97316);
  -webkit-background-clip: text;
  background-clip: text;
}

.overlay__subtitle {
  font-size: 1rem;
  color: var(--color-text-muted);
  line-height: 1.6;
  margin-bottom: 28px;
}

/* ── Title Screen Art ────────────────────── */
.title-art {
  position: relative;
  width: 120px;
  height: 120px;
  margin: 0 auto 24px;
}

.title-ship {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 0;
  height: 0;
  border-left: 18px solid transparent;
  border-right: 18px solid transparent;
  border-bottom: 40px solid #06d6a0;
  filter: drop-shadow(0 0 12px rgba(6, 214, 160, 0.7));
  animation: titleShipFloat 3s ease-in-out infinite;
}

.title-ship::after {
  content: '';
  position: absolute;
  bottom: -40px;
  left: -8px;
  width: 16px;
  height: 14px;
  background: rgba(6, 214, 160, 0.4);
  clip-path: polygon(20% 0%, 80% 0%, 100% 100%, 0% 100%);
  filter: blur(2px);
  animation: titleFlame 0.3s ease-in-out infinite alternate;
}

@keyframes titleShipFloat {
  0%, 100% { transform: translate(-50%, -50%) translateY(0); }
  50% { transform: translate(-50%, -50%) translateY(-6px); }
}

@keyframes titleFlame {
  0% { opacity: 0.6; transform: scaleY(0.8); }
  100% { opacity: 1; transform: scaleY(1.2); }
}

/* Orbiting debris dots on title art */
.title-debris {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.title-debris--1 {
  background: #fb923c;
  box-shadow: 0 0 8px rgba(251, 146, 60, 0.7);
  top: 15px;
  right: 18px;
  animation: titleDebrisDrift1 4s ease-in-out infinite;
}

.title-debris--2 {
  background: #a855f7;
  box-shadow: 0 0 8px rgba(168, 85, 247, 0.7);
  bottom: 25px;
  left: 12px;
  animation: titleDebrisDrift2 5s ease-in-out infinite;
}

.title-debris--3 {
  background: #f472b6;
  box-shadow: 0 0 8px rgba(244, 114, 182, 0.7);
  top: 40px;
  left: 8px;
  width: 4px;
  height: 4px;
  animation: titleDebrisDrift3 3.5s ease-in-out infinite;
}

.title-debris--4 {
  background: #38bdf8;
  box-shadow: 0 0 8px rgba(56, 189, 248, 0.7);
  bottom: 10px;
  right: 25px;
  width: 5px;
  height: 5px;
  animation: titleDebrisDrift1 4.5s ease-in-out -1s infinite;
}

@keyframes titleDebrisDrift1 {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(-6px, 5px); }
}

@keyframes titleDebrisDrift2 {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(5px, -4px); }
}

@keyframes titleDebrisDrift3 {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(4px, 6px); }
}

/* ── Title Hints ─────────────────────────── */
.title-hints {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 20px;
}

.control-hint {
  font-size: 0.75rem;
  color: rgba(193, 203, 216, 0.5);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-family: var(--font-body);
}

/* ── Game Over Stats ─────────────────────── */
.gameover-stats {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 24px 0;
  padding: 20px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.95rem;
}

.stat-row span:first-child {
  color: var(--color-text-muted);
}

.stat-row span:last-child {
  color: #ffffff;
  font-weight: 600;
  font-family: var(--font-display);
  letter-spacing: 0.04em;
}

.stat-row--highlight span:last-child {
  color: #facc15;
  text-shadow: 0 0 8px rgba(250, 204, 21, 0.4);
}

/* ── Buttons ─────────────────────────────── */
.btn {
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  border: none;
  cursor: pointer;
  padding: 14px 36px;
  border-radius: 8px;
  transition: transform 0.15s, box-shadow 0.15s, background 0.15s;
}

.btn--primary {
  background: linear-gradient(135deg, #06d6a0, #38bdf8);
  color: #06080f;
  box-shadow: 0 4px 20px rgba(6, 214, 160, 0.3);
}

.btn--primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 28px rgba(6, 214, 160, 0.5);
}

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

/* ── Responsive ──────────────────────────── */
@media (max-width: 600px) {
  .game-container {
    aspect-ratio: 3 / 4;
    border-radius: 8px;
  }

  .overlay__content {
    padding: 24px 20px;
  }

  .overlay__title {
    font-size: 1.6rem;
  }

  .title-hints {
    flex-direction: column;
    gap: 6px;
  }
}
