:root {
  --bg-deep: #0a0a12;
  --bg-panel: rgba(255, 255, 255, 0.05);
  --border-subtle: rgba(255, 255, 255, 0.08);
  --text-primary: #f0f0f5;
  --text-muted: #8888a0;
  --accent-cyan: #00e5ff;
  --accent-pink: #ec4899;
  --font: 'Outfit', system-ui, sans-serif;
}

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

body {
  font-family: var(--font);
  background: var(--bg-deep);
  color: var(--text-primary);
  height: 100vh;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

#game-canvas {
  position: fixed;
  inset: 0;
  display: block;
  width: 100vw;
  height: 100vh;
  touch-action: none;
}

/* ---- Back link / mute ---- */
.back-link {
  position: fixed;
  top: 1.2rem;
  left: 1.4rem;
  z-index: 5;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.4rem 0.8rem;
  border-radius: 100px;
  background: rgba(10, 10, 18, 0.5);
  backdrop-filter: blur(6px);
  transition: color 0.2s;
}

.back-link:hover {
  color: var(--accent-cyan);
}

.mute-btn {
  position: fixed;
  top: 1.1rem;
  left: 9.5rem;
  z-index: 5;
  font-size: 1rem;
  line-height: 1;
  padding: 0.45rem 0.6rem;
  border-radius: 100px;
  border: 1px solid var(--border-subtle);
  background: rgba(10, 10, 18, 0.5);
  color: var(--text-primary);
  cursor: pointer;
  backdrop-filter: blur(6px);
}

.mute-btn:hover {
  border-color: var(--accent-cyan);
}

/* ---- HUD ---- */
.hud {
  position: fixed;
  bottom: 1.4rem;
  left: 1.4rem;
  z-index: 5;
  display: flex;
  gap: 0.8rem;
}

.hud-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 78px;
  padding: 0.6rem 1rem;
  background: rgba(10, 10, 18, 0.5);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  backdrop-filter: blur(6px);
}

.hud-label {
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.hud-value {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--accent-cyan);
  text-shadow: 0 0 12px rgba(0, 229, 255, 0.5);
}

.hud-value--lives {
  color: var(--accent-pink);
  text-shadow: 0 0 12px rgba(236, 72, 153, 0.5);
  letter-spacing: 0.15em;
}

.hud-value--warn {
  color: #ff5c5c;
  text-shadow: 0 0 12px rgba(255, 92, 92, 0.6);
}

.hud-tier {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-top: -0.15rem;
}

.hud-bar {
  display: block;
  width: 100%;
  height: 4px;
  margin-top: 0.35rem;
  border-radius: 100px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
}

.hud-bar__fill {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: 100px;
  background: linear-gradient(90deg, var(--accent-cyan), #7ff4ff);
  box-shadow: 0 0 8px rgba(0, 229, 255, 0.6);
  transition: width 0.15s ease;
}

/* ---- Combo badge ---- */
.combo {
  position: fixed;
  bottom: 6.4rem;
  left: 1.6rem;
  z-index: 5;
  font-size: 1.05rem;
  font-weight: 700;
  color: #ffd24a;
  text-shadow: 0 0 14px rgba(255, 210, 74, 0.7);
  opacity: 0;
  transform: scale(0.8);
  transition: opacity 0.15s, transform 0.15s;
  pointer-events: none;
}

.combo--on {
  opacity: 1;
  transform: scale(1);
}

/* ---- Power-up badges ---- */
.powerups {
  position: fixed;
  bottom: 8.6rem;
  left: 1.6rem;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.3rem;
  pointer-events: none;
}

.powerup-badge {
  font-size: 0.88rem;
  font-weight: 700;
  padding: 0.2rem 0.7rem;
  border-radius: 100px;
  background: rgba(10, 10, 18, 0.55);
  border: 1px solid var(--border-subtle);
  backdrop-filter: blur(6px);
  text-shadow: 0 0 12px currentColor;
  font-variant-numeric: tabular-nums;
}

/* ---- Leaderboard ---- */
.board {
  position: fixed;
  top: 1.2rem;
  right: 1.4rem;
  z-index: 5;
  min-width: 190px;
  padding: 0.7rem 0.9rem;
  background: rgba(10, 10, 18, 0.55);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  backdrop-filter: blur(6px);
}

.board-title {
  display: block;
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

.board-list {
  list-style: none;
}

.board-row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.82rem;
  padding: 0.12rem 0;
}

.board-row--you {
  font-weight: 700;
  color: var(--accent-cyan);
}

.board-row--dead {
  opacity: 0.45;
}

.board-rank {
  width: 1em;
  text-align: right;
  color: var(--text-muted);
  font-size: 0.72rem;
}

.board-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 6px currentColor;
}

.board-name {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.board-score {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.board-city {
  display: block;
  margin-top: 0.45rem;
  font-size: 0.68rem;
  color: var(--text-muted);
}

/* ---- Minimap ---- */
.minimap {
  position: fixed;
  bottom: 1.4rem;
  right: 1.4rem;
  z-index: 5;
  width: 160px;
  height: 160px;
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
}

/* ---- Toasts ---- */
.toasts {
  position: fixed;
  top: 4.5rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 6;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  pointer-events: none;
}

.toast {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  padding: 0.35rem 1rem;
  background: rgba(10, 10, 18, 0.65);
  border: 1px solid var(--border-subtle);
  border-radius: 100px;
  backdrop-filter: blur(6px);
  animation: toast-in 2.6s ease forwards;
  text-shadow: 0 0 10px currentColor;
}

.toast--big {
  font-size: 1.15rem;
  font-weight: 700;
}

@keyframes toast-in {
  0% { opacity: 0; transform: translateY(-8px) scale(0.9); }
  8% { opacity: 1; transform: translateY(0) scale(1); }
  80% { opacity: 1; }
  100% { opacity: 0; transform: translateY(-6px); }
}

/* ---- Overlays ---- */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(6, 6, 12, 0.72);
  backdrop-filter: blur(5px);
  transition: opacity 0.25s;
}

.overlay--hidden {
  opacity: 0;
  pointer-events: none;
}

.overlay--pause {
  background: rgba(6, 6, 12, 0.55);
}

.overlay-content {
  max-width: 460px;
  padding: 2.4rem 2.6rem;
  text-align: center;
  background: rgba(14, 14, 24, 0.9);
  border: 1px solid var(--border-subtle);
  border-radius: 22px;
  box-shadow: 0 0 60px rgba(0, 229, 255, 0.12);
}

.overlay-content h2 {
  font-size: 2rem;
  font-weight: 700;
  background: linear-gradient(90deg, var(--accent-cyan), var(--accent-pink));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 0.8rem;
}

.overlay-content p {
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.55;
  margin-bottom: 1.4rem;
}

.hint-row {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.9rem;
  margin-bottom: 1.6rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

kbd {
  display: inline-block;
  padding: 0.1rem 0.45rem;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  margin-right: 0.2rem;
}

.theme-select {
  margin-bottom: 1.4rem;
}

.theme-select__label {
  display: block;
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.55rem;
}

.theme-cards {
  display: flex;
  gap: 0.7rem;
  justify-content: center;
}

.theme-card {
  flex: 1;
  max-width: 180px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  padding: 0.75rem 0.6rem;
  font-family: var(--font);
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}

.theme-card:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.25);
}

.theme-card--selected {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 18px rgba(0, 229, 255, 0.35);
}

.theme-card__icon {
  font-size: 1.5rem;
  line-height: 1.2;
}

.theme-card__name {
  font-weight: 700;
  font-size: 0.92rem;
}

.theme-card__desc {
  font-size: 0.68rem;
  color: var(--text-muted);
  line-height: 1.3;
}

.btn-start {
  font-family: var(--font);
  font-size: 1.05rem;
  font-weight: 700;
  color: #061014;
  padding: 0.75rem 2.2rem;
  border: none;
  border-radius: 100px;
  background: linear-gradient(90deg, var(--accent-cyan), #4dd0ff);
  box-shadow: 0 0 24px rgba(0, 229, 255, 0.45);
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}

.btn-start:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 34px rgba(0, 229, 255, 0.65);
}

.end-stats {
  display: flex;
  justify-content: center;
  gap: 1.6rem;
  margin-bottom: 1.6rem;
}

.end-stat {
  display: flex;
  flex-direction: column;
}

.end-stat__value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent-cyan);
  text-shadow: 0 0 12px rgba(0, 229, 255, 0.5);
}

.end-stat__label {
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* ---- Small screens ---- */
@media (max-width: 720px) {
  .board {
    top: auto;
    bottom: 8.2rem;
    right: 0.8rem;
    min-width: 150px;
    padding: 0.5rem 0.7rem;
  }

  .board-row {
    font-size: 0.72rem;
  }

  .minimap {
    width: 110px;
    height: 110px;
    bottom: 1rem;
    right: 0.8rem;
  }

  .hud {
    bottom: 1rem;
    left: 0.8rem;
    gap: 0.45rem;
  }

  .hud-panel {
    min-width: 62px;
    padding: 0.45rem 0.6rem;
  }

  .hud-value {
    font-size: 1.05rem;
  }

  .overlay-content {
    margin: 1rem;
    padding: 1.8rem 1.5rem;
  }
}
