/* ============================================================
   PIXEL DASH — Retro Platformer Styles
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');

/* ============================================================
   CSS VARIABLES & RESET
   ============================================================ */
:root {
  --bg-dark: #1a1a2e;
  --bg-darker: #0f0f1a;
  --yellow: #ffd700;
  --red: #ff4444;
  --blue: #4488ff;
  --green: #44cc44;
  --purple: #aa44ff;
  --white: #f0f0f0;
  --gray: #666;
  --gray-light: #999;
  --gray-dark: #333;
  --font-main: 'Press Start 2P', monospace, cursive;
}

*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg-dark);
  font-family: var(--font-main);
  color: var(--white);
  image-rendering: pixelated;
}

/* ============================================================
   SHARED SCREEN BASE
   ============================================================ */
.screen {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 1;
}

.screen.active {
  display: flex;
}

/* Screen transitions */
.screen.slide-in {
  animation: slideIn 0.4s ease-out forwards;
}
.screen.slide-out {
  animation: slideOut 0.4s ease-in forwards;
}
.screen.pixel-fade-in {
  animation: pixelFadeIn 0.5s steps(8) forwards;
}
.screen.pixel-fade-out {
  animation: pixelFadeOut 0.5s steps(8) forwards;
}

@keyframes slideIn {
  from { transform: translateX(100%); }
  to   { transform: translateX(0); }
}
@keyframes slideOut {
  from { transform: translateX(0); }
  to   { transform: translateX(-100%); }
}
@keyframes pixelFadeIn {
  from { opacity: 0; filter: blur(4px); }
  to   { opacity: 1; filter: blur(0); }
}
@keyframes pixelFadeOut {
  from { opacity: 1; filter: blur(0); }
  to   { opacity: 0; filter: blur(4px); }
}

/* ============================================================
   PIXEL BUTTON (shared)
   ============================================================ */
.pixel-btn {
  font-family: var(--font-main);
  font-size: 14px;
  padding: 14px 32px;
  color: var(--white);
  background: var(--bg-darker);
  border: none;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 2px;
  position: relative;
  transition: transform 0.1s, filter 0.1s;
  box-shadow:
    -4px -4px 0 0 #555,
     4px -4px 0 0 #555,
    -4px  4px 0 0 #555,
     4px  4px 0 0 #555,
     0   -4px 0 0 #777,
     0    4px 0 0 #333,
    -4px  0   0 0 #555,
     4px  0   0 0 #555;
}

.pixel-btn:hover {
  transform: translateY(-3px);
  filter: brightness(1.3);
  box-shadow:
    -4px -4px 0 0 var(--yellow),
     4px -4px 0 0 var(--yellow),
    -4px  4px 0 0 var(--yellow),
     4px  4px 0 0 var(--yellow),
     0   -4px 0 0 var(--yellow),
     0    4px 0 0 var(--yellow),
    -4px  0   0 0 var(--yellow),
     4px  0   0 0 var(--yellow),
     0    0  12px 2px rgba(255, 215, 0, 0.35);
  animation: btnBounce 0.35s ease;
}

.pixel-btn:active {
  transform: translateY(1px);
  filter: brightness(0.9);
}

@keyframes btnBounce {
  0%   { transform: translateY(-3px); }
  40%  { transform: translateY(-6px); }
  60%  { transform: translateY(-2px); }
  100% { transform: translateY(-3px); }
}

.pixel-btn.btn-yellow  { background: #3a3500; color: var(--yellow); }
.pixel-btn.btn-red     { background: #3a0000; color: var(--red); }
.pixel-btn.btn-blue    { background: #001a3a; color: var(--blue); }
.pixel-btn.btn-green   { background: #003a00; color: var(--green); }
.pixel-btn.btn-purple  { background: #1a003a; color: var(--purple); }

.pixel-btn.primary {
  background: #1a2a4e;
  color: var(--blue);
  border-color: var(--blue);
}

.pixel-btn.primary:hover {
  color: #fff;
  filter: brightness(1.4);
}

/* ============================================================
   TITLE SCREEN
   ============================================================ */
#title-screen {
  background: var(--bg-dark);
  overflow: hidden;
  z-index: 100;
}

/* Animated pixel stars */
#title-screen .stars,
.stars {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.star {
  position: absolute;
  width: 4px;
  height: 4px;
  background: #fff;
  animation: twinkle 1.5s ease-in-out infinite alternate;
}
.star:nth-child(odd)  { animation-duration: 2s; }
.star:nth-child(3n)   { width: 2px; height: 2px; animation-duration: 1s; }
.star:nth-child(5n)   { width: 6px; height: 6px; animation-duration: 2.5s; }

@keyframes twinkle {
  0%   { opacity: 0.2; transform: scale(0.8); }
  100% { opacity: 1;   transform: scale(1.2); }
}

/* Title text */
.title-text {
  font-size: clamp(28px, 7vw, 64px);
  text-align: center;
  margin-bottom: 8px;
  text-shadow:
     4px  4px 0 #000,
    -4px  4px 0 #000,
     4px -4px 0 #000,
    -4px -4px 0 #000;
  animation: rainbowTitle 3s linear infinite;
  z-index: 1;
}

@keyframes rainbowTitle {
  0%   { color: #ff4444; }
  16%  { color: #ffd700; }
  33%  { color: #44cc44; }
  50%  { color: #4488ff; }
  66%  { color: #aa44ff; }
  83%  { color: #ff44aa; }
  100% { color: #ff4444; }
}

.title-subtitle {
  font-size: clamp(10px, 2vw, 16px);
  color: var(--gray-light);
  margin-bottom: 48px;
  text-align: center;
  z-index: 1;
  letter-spacing: 2px;
}

.title-buttons {
  display: flex;
  flex-direction: column;
  gap: 18px;
  z-index: 1;
}

.title-buttons .pixel-btn {
  min-width: 260px;
  text-align: center;
}

/* ============================================================
   WORLD MAP / LEVEL SELECT
   ============================================================ */
#world-map {
  background: var(--bg-dark);
  padding: 20px;
  overflow-y: auto;
  z-index: 100;
}

.world-map-container {
  width: 100%;
  max-width: 900px;
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.world-map-title {
  font-size: clamp(16px, 3vw, 24px);
  color: var(--yellow);
  text-align: center;
  text-shadow: 3px 3px 0 #000;
  margin-bottom: 8px;
}

/* World section */
.world-section {
  border: 4px solid var(--gray-dark);
  padding: 20px;
  position: relative;
}

.world-section.grasslands { border-color: var(--green);  background: rgba(68,204,68,0.06); }
.world-section.desert     { border-color: var(--yellow); background: rgba(255,215,0,0.06); }
.world-section.ice        { border-color: var(--blue);   background: rgba(68,136,255,0.06); }
.world-section.lava       { border-color: var(--red);    background: rgba(255,68,68,0.06); }
.world-section.sky        { border-color: var(--purple); background: rgba(170,68,255,0.06); }

.world-name {
  font-size: clamp(12px, 2.5vw, 18px);
  margin-bottom: 16px;
  letter-spacing: 3px;
  text-transform: uppercase;
}
.world-section.grasslands .world-name { color: var(--green); }
.world-section.desert     .world-name { color: var(--yellow); }
.world-section.ice        .world-name { color: var(--blue); }
.world-section.lava       .world-name { color: var(--red); }
.world-section.sky        .world-name { color: var(--purple); }

.level-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

/* Level node */
.level-node {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  cursor: pointer;
  background: var(--bg-darker);
  border: 4px solid var(--gray);
  transition: transform 0.2s, box-shadow 0.2s;
  position: relative;
}

.level-node:hover {
  transform: scale(1.15);
}

.level-node.current {
  animation: currentGlow 1s ease-in-out infinite alternate;
}

@keyframes currentGlow {
  from { box-shadow: 0 0  8px 2px var(--yellow); }
  to   { box-shadow: 0 0 20px 6px var(--yellow); }
}

.level-node.locked {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
}

.level-node.locked::after {
  content: '\1F512';
  font-size: 16px;
  position: absolute;
  bottom: -6px;
}

.level-node .level-number {
  font-size: 12px;
  font-family: var(--font-main);
}

/* Star indicators under level nodes */
.level-stars {
  display: flex;
  gap: 2px;
  margin-top: 4px;
  position: absolute;
  bottom: -18px;
}

.level-stars .star-icon {
  width: 10px;
  height: 10px;
  display: inline-block;
  clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
  background: var(--gray);
}

.level-stars .star-icon.earned {
  background: var(--yellow);
  filter: drop-shadow(0 0 3px rgba(255, 215, 0, 0.6));
}

/* World-colored level nodes */
.world-section.grasslands .level-node { border-color: var(--green); }
.world-section.desert     .level-node { border-color: var(--yellow); }
.world-section.ice        .level-node { border-color: var(--blue); }
.world-section.lava       .level-node { border-color: var(--red); }
.world-section.sky        .level-node { border-color: var(--purple); }

/* ============================================================
   HUD (in-game overlay)
   ============================================================ */
#hud {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 50;
  padding: 12px 20px;
  font-size: 12px;
  display: none;
}

#hud.active {
  display: block;
}

.hud-section {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.hud-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Lives — pixel hearts */
.hud-lives,
#hud-hearts {
  position: absolute;
  top: 12px;
  left: 20px;
  display: flex;
  gap: 6px;
  align-items: center;
}

.pixel-heart,
.heart {
  width: 24px;
  height: 22px;
  position: relative;
  display: inline-block;
  color: var(--red);
  font-size: 14px;
}

/* Pixel heart using box-shadow */
.pixel-heart::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 4px;
  background: transparent;
  box-shadow:
    /* Row 1 */
     4px  0 0 var(--red),
     8px  0 0 var(--red),
    16px  0 0 var(--red),
    20px  0 0 var(--red),
    /* Row 2 */
     0    4px 0 var(--red),
     4px  4px 0 #ff8888,
     8px  4px 0 #ff8888,
    12px  4px 0 var(--red),
    16px  4px 0 var(--red),
    20px  4px 0 var(--red),
    24px  4px 0 var(--red),
    /* Row 3 */
     0    8px 0 var(--red),
     4px  8px 0 #ff8888,
     8px  8px 0 var(--red),
    12px  8px 0 var(--red),
    16px  8px 0 var(--red),
    20px  8px 0 var(--red),
    24px  8px 0 var(--red),
    /* Row 4 */
     4px  12px 0 var(--red),
     8px  12px 0 var(--red),
    12px  12px 0 var(--red),
    16px  12px 0 var(--red),
    20px  12px 0 var(--red),
    /* Row 5 */
     8px  16px 0 var(--red),
    12px  16px 0 var(--red),
    16px  16px 0 var(--red),
    /* Row 6 */
    12px  20px 0 var(--red);
}

.pixel-heart.lost,
.heart.empty {
  opacity: 0.25;
  filter: grayscale(1);
}

/* Coins */
.hud-coins,
#hud-coins {
  position: absolute;
  top: 48px;
  left: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 10px;
  color: var(--yellow);
  text-shadow: 2px 2px 0 #000;
}

.coin-icon {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--yellow);
  border: 2px solid #b8960a;
  box-shadow:
    inset -3px -3px 0 0 #b8960a,
    inset  2px  2px 0 0 #fff5b0;
  animation: coinSpin 1.2s steps(4) infinite;
}

@keyframes coinSpin {
  0%   { transform: scaleX(1); }
  25%  { transform: scaleX(0.2); }
  50%  { transform: scaleX(1); }
  75%  { transform: scaleX(0.2); }
  100% { transform: scaleX(1); }
}

.coin-count {
  font-family: var(--font-main);
  font-size: 12px;
  color: var(--yellow);
  text-shadow: 2px 2px 0 #000;
}

/* Power-up slot */
.hud-powerup,
#hud-powerup {
  position: absolute;
  top: 76px;
  left: 20px;
  width: 40px;
  height: 40px;
  border: 3px solid var(--gray);
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
}

.hud-powerup.has-powerup,
#hud-powerup.has-powerup {
  border-color: var(--yellow);
  box-shadow: 0 0 8px rgba(255, 215, 0, 0.4);
}

/* Score */
.hud-score,
#hud-score {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 14px;
  text-shadow: 2px 2px 0 #000;
  color: var(--white);
  text-align: center;
}

.score-label {
  font-size: 8px;
  color: var(--gray-light);
  margin-bottom: 2px;
}

/* Timer */
.hud-timer,
#hud-timer {
  position: absolute;
  top: 12px;
  right: 20px;
  font-size: 14px;
  text-shadow: 2px 2px 0 #000;
  text-align: right;
  color: var(--blue);
}

.timer-label {
  font-size: 8px;
  color: var(--gray-light);
  margin-bottom: 2px;
}

.hud-timer.warning,
#hud-timer.warning {
  color: var(--red);
  animation: timerPulse 0.5s ease-in-out infinite alternate;
}

@keyframes timerPulse {
  from { opacity: 1; transform: scale(1); }
  to   { opacity: 0.6; transform: scale(1.1); }
}

/* Level label */
.hud-level-label,
#hud-level {
  position: absolute;
  top: 48px;
  right: 20px;
  font-size: 10px;
  color: var(--green);
  text-shadow: 2px 2px 0 #000;
}

/* Boss HP bar */
.boss-hp-bar,
#boss-hp-container {
  position: absolute;
  top: 50px;
  left: 50%;
  transform: translateX(-50%);
  width: 300px;
  max-width: 60vw;
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  z-index: 10;
  pointer-events: none;
}

.boss-hp-bar.visible,
#boss-hp-container.active {
  display: flex;
}

.boss-name,
#boss-name {
  font-size: 10px;
  color: var(--red);
  text-shadow: 2px 2px 0 #000;
  letter-spacing: 2px;
}

.hp-track,
#boss-hp-bar {
  width: 100%;
  height: 16px;
  background: var(--bg-darker);
  border: 3px solid var(--gray);
  position: relative;
  overflow: hidden;
}

.hp-fill,
#boss-hp-fill {
  height: 100%;
  background: linear-gradient(180deg, #ff6666, var(--red), #cc0000);
  transition: width 0.4s ease;
  box-shadow: inset 0 -2px 0 rgba(0,0,0,0.3), inset 0 2px 0 rgba(255,255,255,0.2);
}

.hp-fill.low {
  background: linear-gradient(180deg, #ff8800, #cc3300, #880000);
  animation: hpFlash 0.4s steps(2) infinite;
}

@keyframes hpFlash {
  0%   { filter: brightness(1); }
  50%  { filter: brightness(1.5); }
  100% { filter: brightness(1); }
}

/* ============================================================
   PAUSE MENU
   ============================================================ */
#pause-menu {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 100;
  gap: 24px;
}

#pause-menu.active {
  display: flex;
}

.pause-title {
  font-size: clamp(24px, 5vw, 48px);
  color: var(--yellow);
  text-shadow:
     4px  4px 0 #000,
    -4px  4px 0 #000,
     4px -4px 0 #000,
    -4px -4px 0 #000;
  margin-bottom: 24px;
  animation: pausePulse 1.5s ease-in-out infinite alternate;
}

@keyframes pausePulse {
  from { opacity: 0.8; }
  to   { opacity: 1; }
}

.pause-buttons {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.pause-buttons .pixel-btn {
  min-width: 220px;
  text-align: center;
}

/* ============================================================
   LEVEL COMPLETE
   ============================================================ */
#level-complete {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 100;
  gap: 20px;
}

#level-complete.active {
  display: flex;
}

.level-complete-title {
  font-size: clamp(20px, 5vw, 42px);
  color: var(--green);
  text-shadow:
     4px  4px 0 #000,
    -4px  4px 0 #000,
     4px -4px 0 #000,
    -4px -4px 0 #000;
  animation: levelClearBounce 0.8s ease infinite;
}

@keyframes levelClearBounce {
  0%   { transform: translateY(0) scale(1); }
  30%  { transform: translateY(-12px) scale(1.05); }
  50%  { transform: translateY(0) scale(1); }
  70%  { transform: translateY(-6px) scale(1.02); }
  100% { transform: translateY(0) scale(1); }
}

/* Star rating */
.star-rating {
  display: flex;
  gap: 12px;
  margin: 16px 0;
}

.star-rating .star {
  width: 40px;
  height: 40px;
  clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
  background: var(--gray-dark);
  transition: transform 0.3s;
}

.star-rating .star.earned {
  background: var(--yellow);
  filter: drop-shadow(0 0 6px rgba(255, 215, 0, 0.7));
  animation: starPop 0.4s ease forwards;
}

.star-rating .star.earned:nth-child(2) { animation-delay: 0.2s; }
.star-rating .star.earned:nth-child(3) { animation-delay: 0.4s; }

@keyframes starPop {
  0%   { transform: scale(0) rotate(-30deg); }
  60%  { transform: scale(1.3) rotate(10deg); }
  100% { transform: scale(1) rotate(0deg); }
}

/* Level stats */
.level-stats {
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 12px;
  text-align: center;
  background: rgba(0, 0, 0, 0.4);
  padding: 16px 32px;
  border: 2px solid var(--gray-dark);
}

.level-stats .stat-row {
  display: flex;
  justify-content: space-between;
  gap: 32px;
}

.level-stats .stat-label {
  color: var(--gray-light);
}

.level-stats .stat-value {
  color: var(--yellow);
}

.level-complete-buttons {
  display: flex;
  gap: 16px;
  margin-top: 12px;
  flex-wrap: wrap;
  justify-content: center;
}

/* ============================================================
   GAME OVER
   ============================================================ */
#game-over {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.9);
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 100;
  gap: 32px;
}

#game-over.active {
  display: flex;
}

.game-over-title {
  font-size: clamp(24px, 6vw, 56px);
  color: var(--red);
  text-shadow:
     4px  4px 0 #000,
    -4px  4px 0 #000,
     4px -4px 0 #000,
    -4px -4px 0 #000,
     0    0  20px rgba(255, 68, 68, 0.5);
  animation: gameOverShake 0.6s ease-in-out infinite;
}

@keyframes gameOverShake {
  0%   { transform: translate(0, 0); }
  15%  { transform: translate(-4px, 2px); }
  30%  { transform: translate(3px, -3px); }
  45%  { transform: translate(-2px, 1px); }
  60%  { transform: translate(4px, -2px); }
  75%  { transform: translate(-3px, 3px); }
  100% { transform: translate(0, 0); }
}

.game-over-buttons {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  justify-content: center;
}

/* ============================================================
   LOGIN SCREEN
   ============================================================ */
#login-screen {
  position: absolute;
  inset: 0;
  background: var(--bg-dark);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 100;
  gap: 20px;
}

#login-screen h2 {
  font-size: clamp(14px, 3vw, 20px);
  color: var(--yellow);
  margin-bottom: 10px;
  text-shadow: 3px 3px 0 #000;
}

.login-box {
  width: 90%;
  max-width: 400px;
  padding: 32px;
  background: var(--bg-darker);
  border: 4px solid var(--gray-dark);
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: center;
}

.login-tabs {
  display: flex;
  gap: 0;
  width: 100%;
}

.login-tab {
  flex: 1;
  font-family: var(--font-main);
  font-size: 10px;
  padding: 12px;
  background: var(--bg-dark);
  color: var(--gray);
  border: 2px solid var(--gray-dark);
  cursor: pointer;
  text-align: center;
  transition: background 0.2s, color 0.2s;
}

.login-tab.active {
  background: var(--bg-darker);
  color: var(--yellow);
  border-bottom-color: var(--bg-darker);
}

.login-tab:hover:not(.active) {
  color: var(--white);
}

.pixel-input,
#login-screen input {
  font-family: var(--font-main);
  font-size: 10px;
  padding: 12px 16px;
  width: 100%;
  max-width: 300px;
  background: var(--bg-dark);
  color: var(--white);
  border: 3px solid var(--gray-dark);
  outline: none;
  transition: border-color 0.2s;
}

.pixel-input:focus,
#login-screen input:focus {
  border-color: var(--yellow);
  box-shadow: 0 0 8px rgba(255, 215, 0, 0.3);
}

.pixel-input::placeholder,
#login-screen input::placeholder {
  color: var(--gray);
  font-family: var(--font-main);
  font-size: 8px;
}

.login-box .pixel-btn {
  width: 100%;
  text-align: center;
}

.btn-row {
  display: flex;
  gap: 10px;
  margin-top: 6px;
}

.guest-btn,
#skip-login {
  font-size: 9px;
  color: var(--gray-light);
  background: transparent;
  border: 2px dashed var(--gray);
  font-family: var(--font-main);
  padding: 10px;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}

.guest-btn:hover,
#skip-login:hover {
  color: var(--yellow);
  border-color: var(--yellow);
}

#login-status {
  font-size: 8px;
  color: var(--red);
  height: 14px;
  font-family: var(--font-main);
}

/* ============================================================
   SETTINGS
   ============================================================ */
#settings-screen {
  position: absolute;
  inset: 0;
  background: var(--bg-dark);
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 100;
  gap: 24px;
}

#settings-screen.active {
  display: flex;
}

.settings-title {
  font-size: clamp(16px, 3vw, 28px);
  color: var(--yellow);
  text-shadow: 3px 3px 0 #000;
}

.settings-panel {
  width: 90%;
  max-width: 500px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 24px;
  background: var(--bg-darker);
  border: 4px solid var(--gray-dark);
}

.setting-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.setting-label {
  font-size: 10px;
  color: var(--gray-light);
  letter-spacing: 1px;
}

/* Pixel styled range slider */
.pixel-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 12px;
  background: var(--bg-dark);
  border: 3px solid var(--gray-dark);
  outline: none;
  cursor: pointer;
}

.pixel-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 24px;
  background: var(--yellow);
  border: 3px solid #b8960a;
  cursor: pointer;
}

.pixel-slider::-moz-range-thumb {
  width: 20px;
  height: 24px;
  background: var(--yellow);
  border: 3px solid #b8960a;
  border-radius: 0;
  cursor: pointer;
}

.pixel-slider:hover::-webkit-slider-thumb {
  box-shadow: 0 0 8px rgba(255, 215, 0, 0.5);
}

/* Controls display */
.controls-display {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px 16px;
  font-size: 10px;
}

.control-key {
  padding: 4px 10px;
  background: var(--bg-dark);
  color: var(--yellow);
  border: 2px solid var(--gray-dark);
  text-align: center;
  min-width: 50px;
  font-family: var(--font-main);
}

.control-action {
  color: var(--gray-light);
  display: flex;
  align-items: center;
}

/* ============================================================
   ADMIN PANEL
   ============================================================ */
#admin-panel {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.9);
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 200;
  gap: 16px;
}

#admin-panel.active {
  display: flex;
}

.admin-title,
#admin-panel h3 {
  font-size: clamp(12px, 3vw, 20px);
  color: var(--red);
  text-shadow:
     3px  3px 0 #000,
     0    0  12px rgba(255, 68, 68, 0.6);
  letter-spacing: 3px;
  margin-bottom: 16px;
  text-align: center;
}

.admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  max-width: 600px;
  width: 90%;
}

.admin-grid .pixel-btn,
#admin-panel .pixel-btn {
  font-size: 9px;
  padding: 10px 16px;
  background: #2a0000;
  color: var(--red);
  width: 100%;
}

.admin-grid .pixel-btn:hover,
#admin-panel .pixel-btn:hover {
  box-shadow:
    -4px -4px 0 0 var(--red),
     4px -4px 0 0 var(--red),
    -4px  4px 0 0 var(--red),
     4px  4px 0 0 var(--red),
     0   -4px 0 0 var(--red),
     0    4px 0 0 var(--red),
    -4px  0   0 0 var(--red),
     4px  0   0 0 var(--red),
     0    0  12px 2px rgba(255, 68, 68, 0.4);
}

#admin-world-select {
  display: flex;
  gap: 6px;
  justify-content: center;
}

#admin-world-select select {
  font-family: var(--font-main);
  font-size: 8px;
  padding: 4px;
  background: var(--bg-darker);
  color: var(--white);
  border: 2px solid var(--gray);
}

.admin-close {
  margin-top: 16px;
}

/* ============================================================
   GAME CANVAS / WRAPPER
   ============================================================ */
#game-wrapper {
  position: relative;
  width: 960px;
  height: 540px;
  max-width: 100vw;
  max-height: 100vh;
  margin: auto;
}

#game-canvas,
canvas {
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  background: #000;
  border: 3px solid #444;
}

#game-canvas {
  position: absolute;
  inset: 0;
  z-index: 0;
  border: none;
}

#game-canvas canvas {
  width: 100%;
  height: 100%;
}

/* ============================================================
   SCROLLBAR (pixel styled)
   ============================================================ */
::-webkit-scrollbar {
  width: 12px;
}
::-webkit-scrollbar-track {
  background: var(--bg-darker);
}
::-webkit-scrollbar-thumb {
  background: var(--gray-dark);
  border: 2px solid var(--bg-darker);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--gray);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 600px) {
  .pixel-btn {
    font-size: 10px;
    padding: 10px 20px;
    min-width: auto;
  }

  .title-buttons .pixel-btn {
    min-width: 200px;
  }

  .level-node {
    width: 48px;
    height: 48px;
  }

  .level-node .level-number {
    font-size: 9px;
  }

  .level-stars .star-icon {
    width: 8px;
    height: 8px;
  }

  .hud-score, .hud-timer, .hud-level-label,
  .hud-coins, .hud-lives,
  #hud-score, #hud-timer, #hud-level,
  #hud-coins, #hud-hearts {
    font-size: 9px;
  }

  .boss-hp-bar,
  #boss-hp-container {
    width: 200px;
  }

  .login-box {
    padding: 20px;
  }

  .star-rating .star {
    width: 28px;
    height: 28px;
  }

  .level-stats {
    padding: 12px 16px;
    font-size: 9px;
  }

  .admin-grid {
    grid-template-columns: 1fr;
  }

  .game-over-buttons,
  .level-complete-buttons {
    flex-direction: column;
    align-items: center;
  }

  #game-wrapper {
    width: 100vw;
    height: 100vh;
  }
}

@media (max-width: 400px) {
  .title-text {
    font-size: 22px;
  }

  .title-subtitle {
    font-size: 8px;
  }

  .world-section {
    padding: 12px;
  }

  .level-grid {
    gap: 10px;
  }

  .level-node {
    width: 40px;
    height: 40px;
  }
}

/* ============================================================
   UTILITY CLASSES
   ============================================================ */
.hidden      { display: none !important; }
.text-yellow { color: var(--yellow); }
.text-red    { color: var(--red); }
.text-blue   { color: var(--blue); }
.text-green  { color: var(--green); }
.text-purple { color: var(--purple); }
.text-center { text-align: center; }
.mt-8        { margin-top: 8px; }
.mt-16       { margin-top: 16px; }
.mb-8        { margin-bottom: 8px; }
.mb-16       { margin-bottom: 16px; }
.gap-8       { gap: 8px; }
.gap-16      { gap: 16px; }
