/* ========== RESET & BASE ========== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root,
[data-theme="love"] {
  --bg: #1a0515;
  --accent: #ff69b4;
  --accent-strong: #ff1493;
}

html, body {
  width: 100%;
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  background: var(--bg, #1a0515);
  font-family: 'Nunito', sans-serif;
  color: #fff;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

/* ========== GAME CONTAINER ========== */
#game-container {
  width: 100%;
  height: 100%;
  height: var(--app-h, 100dvh);
  max-height: var(--app-h, 100dvh);
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1a0515 0%, #2a0a25 30%, #1a0515 60%, #200a20 100%);
  position: fixed;
  inset: 0;
  overflow: hidden;
}

/* Animated pink glow background */
#game-container::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background:
    radial-gradient(circle at 25% 35%, rgba(255, 105, 180, 0.07) 0%, transparent 50%),
    radial-gradient(circle at 75% 65%, rgba(255, 20, 147, 0.05) 0%, transparent 50%),
    radial-gradient(circle at 50% 50%, rgba(255, 182, 193, 0.03) 0%, transparent 40%);
  animation: bgPulse 10s ease-in-out infinite;
  pointer-events: none;
}

@keyframes bgPulse {
  0%, 100% { opacity: 0.6; transform: scale(1) rotate(0deg); }
  50% { opacity: 1; transform: scale(1.05) rotate(1deg); }
}

/* ========== SCREENS ========== */
.screen {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: safe center;
  text-align: center;
  padding: 20px;
  z-index: 10;
  width: 100%;
  height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
}

.screen.active {
  display: flex;
  animation: popIn 0.5s ease-out;
}

@keyframes popIn {
  0% { transform: scale(0.9); opacity: 0; }
  60% { transform: scale(1.02); }
  100% { transform: scale(1); opacity: 1; }
}

/* ========== TITLE SCREEN ========== */
.title-hearts {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}

.floating-heart {
  position: absolute;
  left: var(--x);
  font-size: clamp(20px, 3vw, 32px);
  animation: floatUp 7s ease-in-out infinite;
  animation-delay: var(--delay);
  opacity: 0.5;
}

@keyframes floatUp {
  0% { transform: translateY(100vh) rotate(0deg) scale(0.8); opacity: 0; }
  10% { opacity: 0.5; }
  90% { opacity: 0.5; }
  100% { transform: translateY(-80px) rotate(360deg) scale(1.1); opacity: 0; }
}

.game-title {
  font-family: 'Fredoka One', cursive;
  font-size: clamp(2.5rem, 8vw, 5rem);
  background: linear-gradient(135deg, #ff69b4, #ff1493, #ff69b4, #ffb6c1);
  background-size: 300% 300%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: gradientShift 4s ease-in-out infinite;
  filter: drop-shadow(0 0 30px rgba(255, 105, 180, 0.4));
  margin-bottom: 12px;
  z-index: 1;
}

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

.subtitle {
  font-size: clamp(0.95rem, 2.8vw, 1.3rem);
  color: rgba(255, 182, 213, 0.9);
  margin-bottom: 6px;
  font-style: italic;
  z-index: 1;
  max-width: 520px;
  line-height: 1.5;
}

.subtitle-small {
  font-size: clamp(0.8rem, 2.2vw, 1rem);
  color: rgba(255, 182, 213, 0.55);
  margin-bottom: 28px;
  z-index: 1;
}

.love-btn {
  font-family: 'Fredoka One', cursive;
  font-size: clamp(1.1rem, 3vw, 1.5rem);
  padding: 16px 48px;
  border: none;
  border-radius: 50px;
  background: linear-gradient(135deg, #ff69b4, #ff1493, #d63384);
  color: #fff;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 25px rgba(255, 20, 147, 0.4),
              0 0 60px rgba(255, 105, 180, 0.15);
  z-index: 1;
  margin-bottom: 28px;
  letter-spacing: 0.5px;
}

.love-btn:hover {
  transform: translateY(-3px) scale(1.06);
  box-shadow: 0 8px 35px rgba(255, 20, 147, 0.6),
              0 0 80px rgba(255, 105, 180, 0.25);
}

.love-btn:active {
  transform: translateY(0) scale(0.97);
}

.instructions {
  z-index: 1;
  background: rgba(255, 105, 180, 0.06);
  border-radius: 20px;
  padding: 20px 32px;
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 105, 180, 0.15);
  max-width: 460px;
}

.instructions p {
  margin: 8px 0;
  font-size: clamp(0.78rem, 2.2vw, 0.95rem);
  color: rgba(255, 255, 255, 0.65);
}

.instruction-note {
  margin-top: 14px !important;
  color: rgba(255, 182, 193, 0.7) !important;
  font-style: italic;
  font-size: clamp(0.72rem, 2vw, 0.88rem) !important;
}

/* Title screen high score */
.title-high-score {
  z-index: 1;
  font-family: 'Nunito', sans-serif;
  font-size: clamp(0.8rem, 2.2vw, 1rem);
  color: rgba(255, 182, 213, 0.4);
  margin-top: 16px;
}

.title-high-score span {
  font-family: 'Fredoka One', cursive;
  color: rgba(255, 105, 180, 0.6);
}

/* ========== GAME SCREEN ========== */
#game-screen {
  padding: 8px;
  gap: 6px;
  position: relative;
  justify-content: flex-start;
  overflow: hidden;
  touch-action: none;
}

#game-screen.active {
  animation: none;
}

#game-hud {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  max-width: 900px;
  padding: 10px 20px;
  background: rgba(255, 105, 180, 0.06);
  border-radius: 14px;
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 105, 180, 0.12);
  flex-shrink: 0;
}

.hud-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.hud-center {
  flex: 1;
}

.hud-label {
  font-size: 0.65rem;
  color: rgba(255, 182, 213, 0.5);
  text-transform: uppercase;
  letter-spacing: 1.5px;
}

.hud-value {
  font-family: 'Fredoka One', cursive;
  font-size: clamp(1.1rem, 3vw, 1.4rem);
  color: #ff69b4;
}

.hud-sublabel {
  font-size: 0.6rem;
  color: rgba(255, 182, 193, 0.4);
  font-style: italic;
  max-width: 160px;
  text-align: center;
  line-height: 1.2;
}

.hud-pause-btn {
  background: rgba(255, 105, 180, 0.08);
  border: 1px solid rgba(255, 105, 180, 0.15);
  border-radius: 10px;
  color: rgba(255, 182, 213, 0.7);
  font-size: 1.1rem;
  padding: 6px 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  -webkit-tap-highlight-color: transparent;
  flex-shrink: 0;
}

.hud-pause-btn:hover {
  background: rgba(255, 105, 180, 0.15);
  color: #ff69b4;
}

.hud-pause-btn:active {
  transform: scale(0.92);
}

/* Audio Controls Panel */
#audio-controls {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0;
  background: transparent;
  border: none;
  align-self: center;
  min-width: 150px;
  max-width: 170px;
  flex-shrink: 0;
}

.audio-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: rgba(255, 105, 180, 0.04);
  border: 1px solid rgba(255, 105, 180, 0.1);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: 'Nunito', sans-serif;
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.85rem;
  width: 100%;
  backdrop-filter: blur(12px);
  -webkit-tap-highlight-color: transparent;
}

.audio-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(255, 105, 180, 0.15);
}

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

.audio-btn-icon {
  font-size: 1.2rem;
  flex-shrink: 0;
  width: 24px;
  text-align: center;
}

.audio-btn-label {
  flex: 1;
  text-align: left;
  font-weight: 500;
}


#play-stack {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  width: 100%;
  align-items: center;
  justify-content: center;
}

/* Canvas wrapper - makes game fill available space */
#canvas-wrapper {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 0;
  padding: 4px;
  gap: 12px;
}

#board-column {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  min-width: 0;
  min-height: 0;
  max-height: 100%;
}

#game-canvas {
  border-radius: 10px 10px 0 0;
  box-shadow:
    0 0 40px rgba(255, 20, 147, 0.12),
    0 0 80px rgba(255, 105, 180, 0.06);
  border: 2px solid rgba(255, 105, 180, 0.2);
  border-bottom: none;
  max-width: 100%;
  image-rendering: auto;
  background: #000;
  display: block;
}

#board-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 28px;
  padding: 4px 8px 6px;
  background: #000;
  border: 2px solid rgba(255, 105, 180, 0.2);
  border-top: none;
  border-radius: 0 0 10px 10px;
}

.extra-lives,
.fruit-display {
  display: flex;
  align-items: center;
  gap: 4px;
  min-height: 22px;
  font-size: clamp(16px, 3vw, 22px);
  line-height: 1;
}

.fruit-display {
  justify-content: flex-end;
  letter-spacing: 1px;
}

/* ========== RIGHT SIDEBAR (ghost panel + audio controls) ========== */
#right-sidebar {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-self: center;
  flex-shrink: 0;
}

#ghost-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px 14px;
  background: rgba(255, 105, 180, 0.04);
  border-radius: 16px;
  border: 1px solid rgba(255, 105, 180, 0.1);
  backdrop-filter: blur(12px);
  align-self: center;
  min-width: 150px;
  max-width: 170px;
  flex-shrink: 0;
}

.ghost-panel-title {
  font-family: 'Fredoka One', cursive;
  font-size: 0.85rem;
  color: rgba(255, 182, 213, 0.7);
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-bottom: 2px;
}

.ghost-entry {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  transition: all 0.3s ease;
}

.ghost-entry.active {
  background: rgba(255, 255, 255, 0.06);
  box-shadow: 0 0 12px rgba(var(--glow-r, 255), var(--glow-g, 105), var(--glow-b, 180), 0.12);
}

.ghost-entry.scared {
  background: rgba(155, 89, 182, 0.12);
}

.ghost-entry.eaten {
  opacity: 0.3;
}

.ghost-icon {
  width: 28px;
  height: 28px;
  border-radius: 50% 50% 40% 40%;
  background: var(--ghost-color);
  flex-shrink: 0;
  box-shadow: 0 0 8px color-mix(in srgb, var(--ghost-color) 40%, transparent);
  position: relative;
}

.ghost-icon::before,
.ghost-icon::after {
  content: '';
  position: absolute;
  width: 5px;
  height: 6px;
  background: #fff;
  border-radius: 50%;
  top: 8px;
}

.ghost-icon::before { left: 6px; }
.ghost-icon::after { right: 6px; }

.ghost-entry.scared .ghost-icon {
  background: #9b59b6;
  box-shadow: 0 0 8px rgba(155, 89, 182, 0.4);
}

.ghost-info {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.ghost-name {
  font-family: 'Fredoka One', cursive;
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.85);
  line-height: 1.2;
}

.ghost-status {
  font-size: 0.62rem;
  color: rgba(255, 182, 213, 0.4);
  font-style: italic;
  line-height: 1.2;
}

.ghost-entry.active .ghost-status {
  color: rgba(255, 182, 213, 0.65);
}

.ghost-panel-hint {
  font-size: 0.62rem;
  color: rgba(255, 182, 193, 0.35);
  text-align: center;
  line-height: 1.5;
  margin-top: 4px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 105, 180, 0.08);
}

/* Hide right sidebar on small/mobile screens */
@media (max-width: 768px) {
  #right-sidebar {
    display: none;
  }
}

@media (max-height: 500px) {
  #right-sidebar {
    display: none;
  }
}

@media (pointer: coarse) and (max-width: 900px) {
  #right-sidebar {
    display: none;
  }
}

/* ========== PAUSE OVERLAY ========== */
#pause-overlay {
  display: none;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(26, 5, 21, 0.88);
  z-index: 100;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(10px);
}

#pause-overlay.active {
  display: flex;
  animation: popIn 0.3s ease-out;
}

.pause-title {
  font-family: 'Fredoka One', cursive;
  font-size: clamp(2.5rem, 8vw, 4.5rem);
  color: #ff69b4;
  margin-bottom: 12px;
  filter: drop-shadow(0 0 20px rgba(255, 105, 180, 0.4));
}

.pause-msg {
  font-size: clamp(1rem, 3vw, 1.3rem);
  color: rgba(255, 182, 213, 0.8);
  margin-bottom: 8px;
}

.pause-hint {
  font-size: clamp(0.75rem, 2vw, 0.9rem);
  color: rgba(255, 182, 213, 0.4);
  margin-bottom: 24px;
}

/* ========== MOBILE CONTROLS ========== */
#mobile-controls {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  padding-bottom: 8px;
}

.ctrl-row {
  display: flex;
  gap: 4px;
}

.ctrl-btn {
  width: 58px;
  height: 58px;
  border: none;
  border-radius: 16px;
  background: rgba(255, 105, 180, 0.12);
  color: #ff69b4;
  font-size: 1.4rem;
  cursor: pointer;
  transition: all 0.12s;
  border: 1px solid rgba(255, 105, 180, 0.18);
  backdrop-filter: blur(10px);
  -webkit-tap-highlight-color: transparent;
}

.ctrl-btn:active {
  background: rgba(255, 20, 147, 0.35);
  transform: scale(0.9);
  box-shadow: 0 0 15px rgba(255, 20, 147, 0.3);
}

@media (pointer: coarse), (max-width: 768px) {
  #mobile-controls {
    display: flex;
  }

  #game-screen {
    padding: 4px 6px max(6px, env(safe-area-inset-bottom));
    gap: 4px;
  }

  #game-hud {
    padding: 6px 10px;
    max-width: 100%;
    border-radius: 10px;
  }

  .hud-label {
    font-size: 0.55rem;
  }

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

  .hud-sublabel {
    display: none;
  }

  .hud-pause-btn {
    padding: 4px 10px;
  }

  #play-stack {
    justify-content: center;
    gap: 10px;
  }

  #canvas-wrapper {
    padding: 0;
    gap: 0;
    min-height: 0;
    flex: 0 1 auto;
    width: 100%;
    justify-content: center;
    align-items: flex-start;
  }

  #board-column {
    width: max-content;
    max-width: 100%;
    height: auto;
    max-height: 100%;
    align-items: stretch;
  }

  #board-footer {
    width: 100%;
  }

  #game-canvas {
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 100%;
  }

  #mobile-controls {
    padding-bottom: 2px;
    gap: 2px;
  }

  .ctrl-btn {
    width: 50px;
    height: 50px;
    border-radius: 14px;
  }
}

@media (pointer: coarse) and (max-height: 740px) {
  .ctrl-btn {
    width: 44px;
    height: 44px;
  }
}

/* ========== GAME OVER ========== */
.gameover-title {
  font-family: 'Fredoka One', cursive;
  font-size: clamp(2.2rem, 8vw, 4rem);
  color: #ff69b4;
  margin-bottom: 12px;
  filter: drop-shadow(0 0 20px rgba(255, 105, 180, 0.3));
}

.gameover-msg {
  font-size: clamp(1rem, 3vw, 1.3rem);
  color: rgba(255, 182, 213, 0.8);
  margin-bottom: 20px;
  max-width: 400px;
  line-height: 1.6;
  white-space: pre-line;
}

.final-score {
  font-family: 'Fredoka One', cursive;
  font-size: clamp(1.2rem, 3.5vw, 1.6rem);
  color: #ff1493;
  margin-bottom: 8px;
}

.high-score-display {
  font-family: 'Nunito', sans-serif;
  font-size: 0.9rem;
  color: rgba(255, 182, 193, 0.45);
  margin-bottom: 24px;
}

/* ========== LEVEL UP ========== */
.levelup-title {
  font-family: 'Fredoka One', cursive;
  font-size: clamp(2rem, 7vw, 3.5rem);
  background: linear-gradient(135deg, #ffd700, #ff69b4, #ff1493);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 12px;
  filter: drop-shadow(0 0 20px rgba(255, 215, 0, 0.3));
}

.levelup-msg {
  font-size: clamp(1rem, 3vw, 1.3rem);
  color: rgba(255, 182, 213, 0.8);
  margin-bottom: 28px;
  max-width: 420px;
  line-height: 1.6;
  white-space: pre-line;
}

/* ========== WIN SCREEN ========== */
.win-title {
  font-family: 'Fredoka One', cursive;
  font-size: clamp(2rem, 7vw, 3.5rem);
  background: linear-gradient(135deg, #ffd700, #ff69b4, #ff1493, #ffd700);
  background-size: 300% 300%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: gradientShift 3s ease-in-out infinite;
  margin-bottom: 16px;
  filter: drop-shadow(0 0 25px rgba(255, 215, 0, 0.3));
}

.win-msg {
  font-size: clamp(1rem, 2.8vw, 1.2rem);
  color: rgba(255, 182, 213, 0.85);
  margin-bottom: 12px;
  max-width: 440px;
  line-height: 1.6;
}

.win-msg-love {
  font-size: clamp(1.1rem, 3vw, 1.4rem);
  color: #ff69b4;
  font-style: italic;
  margin-bottom: 24px;
  font-weight: 700;
}

/* ========== SCROLLBAR ========== */
::-webkit-scrollbar { display: none; }

/* ========== THEME PICKER ========== */
.theme-picker {
  display: flex;
  gap: 12px;
  z-index: 1;
  margin-bottom: 22px;
  flex-wrap: wrap;
  justify-content: center;
  width: 100%;
  max-width: 400px;
  padding: 0 4px;
}

.theme-card {
  flex: 1 1 132px;
  width: auto;
  min-width: 0;
  max-width: 168px;
  padding: 14px 12px 16px;
  border-radius: 16px;
  border: 1px solid rgba(255, 105, 180, 0.22);
  background: rgba(255, 105, 180, 0.06);
  color: #fff;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  font-family: 'Nunito', sans-serif;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

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

.theme-card.selected {
  border-color: #ff69b4;
  box-shadow: 0 0 0 2px rgba(255, 105, 180, 0.35), 0 8px 24px rgba(255, 20, 147, 0.2);
  background: rgba(255, 105, 180, 0.12);
}

.theme-card-swatch {
  width: 72px;
  height: 40px;
  border-radius: 8px;
  margin-bottom: 4px;
}

.theme-swatch-love {
  background:
    linear-gradient(135deg, #1a0515 0%, #4a1238 50%, #1a0515 100%);
  box-shadow: inset 0 0 0 2px #ff4da6;
}

.theme-swatch-classic {
  background: #000;
  box-shadow: inset 0 0 0 2px #2121ff;
  position: relative;
}

.theme-swatch-classic::after {
  content: '';
  position: absolute;
  inset: 10px 24px;
  background: #ffff00;
  clip-path: polygon(0 0, 100% 50%, 0 100%);
  border-radius: 2px;
}

.theme-card-name {
  font-family: 'Fredoka One', cursive;
  font-size: 0.95rem;
  letter-spacing: 0.3px;
}

.theme-card-desc {
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.55);
  line-height: 1.3;
}

.secondary-btn {
  margin-top: 10px;
  background: transparent;
  border: 1px solid rgba(255, 105, 180, 0.35);
  box-shadow: none;
}

.secondary-btn:hover {
  background: rgba(255, 105, 180, 0.1);
}

.life-pac {
  width: 18px;
  height: 18px;
  display: inline-block;
  background: conic-gradient(#ffff00 0 42deg, transparent 42deg 78deg, #ffff00 78deg);
  border-radius: 50%;
  transform: rotate(180deg);
}

/* ========== CLASSIC THEME ========== */
[data-theme="classic"] {
  --bg: #000;
  --accent: #ffff00;
  --accent-strong: #ffb897;
}

[data-theme="classic"] html,
[data-theme="classic"],
[data-theme="classic"] body {
  background: #000;
  font-family: 'Press Start 2P', monospace;
  color: #fff;
}

[data-theme="classic"] #game-container {
  background: #000;
}

[data-theme="classic"] #game-container::before {
  display: none;
}

[data-theme="classic"] .title-hearts {
  display: none;
}

[data-theme="classic"] .game-title {
  font-family: 'Press Start 2P', monospace;
  font-size: clamp(1.35rem, 4.5vw, 2.4rem);
  background: none;
  -webkit-text-fill-color: #ffff00;
  color: #ffff00;
  animation: none;
  filter: none;
  letter-spacing: 3px;
  line-height: 1.4;
}

[data-theme="classic"] .subtitle,
[data-theme="classic"] .subtitle-small {
  font-family: 'Press Start 2P', monospace;
  font-style: normal;
  color: #dedeff;
  font-size: clamp(0.52rem, 1.6vw, 0.7rem);
  line-height: 1.8;
}

[data-theme="classic"] .subtitle-small {
  color: #8888cc;
  margin-bottom: 22px;
}

[data-theme="classic"] .theme-card {
  border-radius: 0;
  border: 2px solid #2121ff;
  background: #000;
  font-family: 'Press Start 2P', monospace;
}

[data-theme="classic"] .theme-card.selected {
  border-color: #ffff00;
  box-shadow: 0 0 0 1px #ffff00;
  background: #101018;
}

[data-theme="classic"] .theme-card-name {
  font-family: 'Press Start 2P', monospace;
  font-size: 0.55rem;
  color: #ffff00;
}

[data-theme="classic"] .theme-card-desc {
  font-family: 'Press Start 2P', monospace;
  font-size: 0.42rem;
  color: #9aa0ff;
  line-height: 1.6;
}

[data-theme="classic"] .love-btn {
  font-family: 'Press Start 2P', monospace;
  background: #000;
  color: #ffff00;
  border: 3px solid #ffff00;
  border-radius: 0;
  box-shadow: none;
  letter-spacing: 2px;
  font-size: clamp(0.7rem, 2.2vw, 0.95rem);
}

[data-theme="classic"] .love-btn:hover {
  transform: none;
  background: #ffff00;
  color: #000;
  box-shadow: none;
}

[data-theme="classic"] .secondary-btn {
  border-color: #2121ff;
  color: #dedeff;
  margin-top: 12px;
}

[data-theme="classic"] .secondary-btn:hover {
  background: #2121ff;
  color: #fff;
  border-color: #2121ff;
}

[data-theme="classic"] .instructions {
  background: transparent;
  border: 2px solid #2121ff;
  border-radius: 0;
  backdrop-filter: none;
}

[data-theme="classic"] .instructions p {
  font-family: 'Press Start 2P', monospace;
  font-size: clamp(0.42rem, 1.4vw, 0.55rem);
  color: #c8c8ff;
  line-height: 1.7;
}

[data-theme="classic"] .instruction-note {
  color: #ffff00 !important;
  font-style: normal !important;
  font-size: clamp(0.4rem, 1.3vw, 0.5rem) !important;
}

[data-theme="classic"] .title-high-score {
  font-family: 'Press Start 2P', monospace;
  color: #fff;
  font-size: 0.55rem;
}

[data-theme="classic"] .title-high-score span {
  font-family: 'Press Start 2P', monospace;
  color: #ffff00;
}

[data-theme="classic"] #game-hud {
  background: transparent;
  border: none;
  border-radius: 0;
  backdrop-filter: none;
  max-width: 720px;
}

[data-theme="classic"] .hud-label,
[data-theme="classic"] .hud-value,
[data-theme="classic"] .hud-sublabel {
  font-family: 'Press Start 2P', monospace;
}

[data-theme="classic"] .hud-label {
  color: #fff;
  font-size: 0.45rem;
}

[data-theme="classic"] .hud-value {
  color: #ffff00;
  font-size: clamp(0.7rem, 2vw, 0.95rem);
}

[data-theme="classic"] .hud-sublabel {
  color: #9aa0ff;
  font-style: normal;
}

[data-theme="classic"] .hud-pause-btn {
  background: #000;
  border: 2px solid #2121ff;
  border-radius: 0;
  color: #ffff00;
}

[data-theme="classic"] .hud-pause-btn:hover {
  background: #2121ff;
  color: #fff;
}

[data-theme="classic"] #board-column {
  position: relative;
}

[data-theme="classic"] #board-column::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    repeating-linear-gradient(
      to bottom,
      rgba(255, 255, 255, 0.015) 0px,
      rgba(255, 255, 255, 0.015) 1px,
      rgba(0, 0, 0, 0.12) 2px,
      rgba(0, 0, 0, 0.12) 3px
    );
  z-index: 2;
}

[data-theme="classic"] #game-canvas {
  border-radius: 0;
  border: 2px solid #2121ff;
  border-bottom: none;
  box-shadow: none;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

[data-theme="classic"] #board-footer {
  border-radius: 0;
  border: 2px solid #2121ff;
  border-top: none;
}

[data-theme="classic"] #ghost-panel,
[data-theme="classic"] .audio-btn {
  background: #000;
  border: 2px solid #2121ff;
  border-radius: 0;
  backdrop-filter: none;
}

[data-theme="classic"] .ghost-panel-title,
[data-theme="classic"] .ghost-name,
[data-theme="classic"] .audio-btn-label {
  font-family: 'Press Start 2P', monospace;
  color: #ffff00;
}

[data-theme="classic"] .ghost-panel-title {
  font-size: 0.48rem;
}

[data-theme="classic"] .ghost-name {
  font-size: 0.48rem;
}

[data-theme="classic"] .ghost-status,
[data-theme="classic"] .ghost-panel-hint {
  font-family: 'Press Start 2P', monospace;
  font-style: normal;
  color: #9aa0ff;
  font-size: 0.38rem;
  line-height: 1.5;
}

[data-theme="classic"] .ghost-entry {
  border-radius: 0;
  background: transparent;
}

[data-theme="classic"] .ghost-entry.scared {
  background: rgba(33, 33, 255, 0.25);
}

[data-theme="classic"] .ghost-icon {
  width: 22px;
  height: 22px;
  border-radius: 0;
  box-shadow: none;
  clip-path: polygon(
    22% 0%, 78% 0%,
    100% 28%, 100% 78%,
    86% 100%, 70% 80%, 50% 100%, 30% 80%, 14% 100%,
    0% 78%, 0% 28%
  );
}

[data-theme="classic"] .ghost-icon::before,
[data-theme="classic"] .ghost-icon::after {
  width: 4px;
  height: 5px;
  border-radius: 0;
  top: 5px;
}

[data-theme="classic"] .ghost-icon::before { left: 4px; }
[data-theme="classic"] .ghost-icon::after { right: 4px; }

[data-theme="classic"] .ghost-entry.scared .ghost-icon {
  background: #2121de;
  box-shadow: none;
}

[data-theme="classic"] .life-pac {
  width: 14px;
  height: 14px;
  background: conic-gradient(#ffff00 0 40deg, transparent 40deg 80deg, #ffff00 80deg);
  border-radius: 50%;
  transform: rotate(180deg);
}

[data-theme="classic"] .audio-btn {
  font-family: 'Press Start 2P', monospace;
  font-size: 0.45rem;
  color: #dedeff;
}

[data-theme="classic"] .audio-btn:hover {
  box-shadow: none;
  background: #101040;
}

[data-theme="classic"] #pause-overlay {
  background: rgba(0, 0, 0, 0.92);
  backdrop-filter: none;
}

[data-theme="classic"] .pause-title,
[data-theme="classic"] .gameover-title,
[data-theme="classic"] .final-score {
  font-family: 'Press Start 2P', monospace;
  color: #ffff00;
  filter: none;
}

[data-theme="classic"] .pause-msg,
[data-theme="classic"] .pause-hint,
[data-theme="classic"] .gameover-msg,
[data-theme="classic"] .high-score-display {
  font-family: 'Press Start 2P', monospace;
  font-size: clamp(0.5rem, 1.6vw, 0.7rem);
  color: #dedeff;
  line-height: 1.8;
}

[data-theme="classic"] .ctrl-btn {
  border-radius: 0;
  background: #000;
  border: 2px solid #2121ff;
  color: #ffff00;
}

[data-theme="classic"] .ctrl-btn:active {
  background: #2121ff;
  color: #fff;
  box-shadow: none;
}

/* Compact title / end screens so small phones keep the name + play button on screen */
@media (max-height: 740px) {
  #title-screen,
  #gameover-screen,
  #win-screen,
  #levelup-screen {
    padding: 12px 12px 20px;
    gap: 0;
  }

  .game-title {
    font-size: clamp(1.7rem, 8vw, 2.7rem);
    margin-bottom: 6px;
  }

  .subtitle {
    margin-bottom: 4px;
  }

  .subtitle-small {
    margin-bottom: 12px;
  }

  .theme-picker {
    margin-bottom: 12px;
    gap: 8px;
  }

  .theme-card {
    padding: 10px 8px 12px;
  }

  .theme-card-swatch {
    width: 56px;
    height: 32px;
    margin-bottom: 2px;
  }

  .love-btn {
    margin-bottom: 12px;
    padding: 12px 28px;
  }

  .instructions {
    padding: 12px 16px;
  }

  .instructions p {
    margin: 4px 0;
  }

  .title-high-score {
    margin-top: 10px;
  }
}

@media (max-width: 380px) {
  .theme-card-name {
    font-size: 0.85rem;
  }

  .theme-card-desc {
    font-size: 0.62rem;
  }
}

/* Phone landscape: sit the pad beside the maze so it no longer covers lives */
@media (pointer: coarse) and (orientation: landscape) {
  #game-screen {
    padding: 2px 6px;
    gap: 2px;
  }

  #game-hud {
    padding: 2px 10px;
    max-width: none;
  }

  .hud-label {
    font-size: 0.48rem;
  }

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

  #play-stack {
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 8px;
  }

  #canvas-wrapper {
    flex: 1 1 auto;
    min-width: 0;
  }

  #mobile-controls {
    padding: 0 4px 0 0;
    gap: 3px;
  }

  .ctrl-btn {
    width: 42px;
    height: 42px;
    font-size: 1.05rem;
  }
}
