/* ===== COOKING BATTLE ARENA - PREMIUM CSS ===== */
@import url('https://fonts.googleapis.com/css2?family=Fredoka+One&family=Nunito:wght@400;600;700;800;900&display=swap');

:root {
  --primary: #FF6B2B;
  --secondary: #FFD700;
  --accent: #FF2D78;
  --bg-dark: #0D0D1A;
  --bg-mid: #1A1A2E;
  --bg-light: #16213E;
  --green: #00E676;
  --purple: #9C27B0;
  --cyan: #00BCD4;
  --red: #FF1744;
  --text: #FFFFFF;
  --text-dim: rgba(255,255,255,0.7);
  --shadow-glow: 0 0 30px rgba(255,107,43,0.5);
  --card-bg: rgba(255,255,255,0.05);
  --card-border: rgba(255,255,255,0.1);
}

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

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

/* Allow main menu to scroll without disturbing game canvas */
body.menu-open {
  overflow: auto;
}

/* ===== SCREENS ===== */
.screen {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 10;
  transition: opacity 0.4s ease, transform 0.4s ease;
  -webkit-overflow-scrolling: touch;
}
.screen.hidden {
  opacity: 0;
  pointer-events: none;
  transform: scale(0.95);
}

/* ===== ANIMATED BACKGROUND ===== */
.animated-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
}
.bg-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  animation: orbFloat 8s ease-in-out infinite;
  opacity: 0.3;
}
.bg-orb:nth-child(1) { width: 400px; height: 400px; background: #FF6B2B; top: -100px; left: -100px; animation-delay: 0s; }
.bg-orb:nth-child(2) { width: 300px; height: 300px; background: #9C27B0; top: 50%; right: -80px; animation-delay: 2s; }
.bg-orb:nth-child(3) { width: 250px; height: 250px; background: #FFD700; bottom: -80px; left: 30%; animation-delay: 4s; }
.bg-orb:nth-child(4) { width: 200px; height: 200px; background: #00BCD4; top: 20%; left: 50%; animation-delay: 1s; }

@keyframes orbFloat {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(30px, -30px) scale(1.1); }
  66% { transform: translate(-20px, 20px) scale(0.95); }
}

/* ===== MAIN MENU ===== */
#mainMenu {
  z-index: 20;
  background: linear-gradient(135deg, rgba(13,13,26,0.95) 0%, rgba(26,26,46,0.95) 100%);
  backdrop-filter: blur(10px);
  justify-content: flex-start;
  padding: 0 16px 32px;
}

/* Inner wrapper — centers content + allows scroll */
.menu-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  padding-top: 28px;
  gap: 0;
}

.menu-logo-wrap {
  position: relative;
  margin-bottom: 12px;
  animation: logoEntrance 0.8s cubic-bezier(0.34,1.56,0.64,1) forwards;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}
@keyframes logoEntrance {
  from { opacity: 0; transform: scale(0.5) translateY(-50px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.menu-icon {
  width: clamp(80px, 18vw, 110px);
  height: clamp(80px, 18vw, 110px);
  border-radius: 24px;
  border: 3px solid var(--secondary);
  box-shadow: 0 0 40px rgba(255,215,0,0.5), 0 0 80px rgba(255,107,43,0.3), inset 0 1px 0 rgba(255,255,255,0.2);
  object-fit: cover;
  display: block;
  margin: 0 auto 14px;
  flex-shrink: 0;
}

.game-title {
  font-family: 'Fredoka One', cursive;
  font-size: clamp(1.8rem, 5.5vw, 3.2rem);
  text-align: center;
  background: linear-gradient(135deg, #FFD700, #FF6B2B, #FF2D78);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: none;
  filter: drop-shadow(0 4px 20px rgba(255,107,43,0.6));
  line-height: 1.1;
}
.game-subtitle {
  font-size: clamp(0.65rem, 2vw, 0.9rem);
  text-align: center;
  color: var(--text-dim);
  letter-spacing: 3px;
  text-transform: uppercase;
  margin-top: 5px;
  font-weight: 700;
}

.thumbnail-img {
  width: min(92vw, 480px);
  max-height: 38vh;
  border-radius: 16px;
  border: 2px solid rgba(255,255,255,0.15);
  box-shadow: 0 16px 50px rgba(0,0,0,0.5), 0 0 40px rgba(255,107,43,0.2);
  margin: 14px auto;
  display: block;
  object-fit: cover;
  object-position: center top;
  flex-shrink: 0;
}

.menu-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: min(92vw, 320px);
  margin-top: 6px;
  flex-shrink: 0;
}

/* ===== BUTTONS ===== */
.btn {
  padding: 14px 28px;
  border: none;
  border-radius: 50px;
  font-family: 'Fredoka One', cursive;
  font-size: 1.15rem;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  letter-spacing: 1px;
  outline: none;
}
.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.2), transparent);
  pointer-events: none;
}
.btn:active { transform: scale(0.96) !important; }

.btn-primary {
  background: linear-gradient(135deg, #FF6B2B, #FF2D78);
  color: white;
  box-shadow: 0 8px 32px rgba(255,107,43,0.5), 0 2px 0 rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.3);
}
.btn-primary:hover { transform: translateY(-3px); box-shadow: 0 12px 40px rgba(255,107,43,0.7), 0 2px 0 rgba(0,0,0,0.3); }

.btn-secondary {
  background: linear-gradient(135deg, #9C27B0, #673AB7);
  color: white;
  box-shadow: 0 8px 32px rgba(156,39,176,0.4), 0 2px 0 rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.2);
}
.btn-secondary:hover { transform: translateY(-3px); box-shadow: 0 12px 40px rgba(156,39,176,0.6), 0 2px 0 rgba(0,0,0,0.3); }

.btn-success {
  background: linear-gradient(135deg, #00C853, #00E676);
  color: #0D0D1A;
  box-shadow: 0 8px 32px rgba(0,200,83,0.4), 0 2px 0 rgba(0,0,0,0.2), inset 0 1px 0 rgba(255,255,255,0.3);
}
.btn-success:hover { transform: translateY(-3px); box-shadow: 0 12px 40px rgba(0,200,83,0.6); }

.btn-outline {
  background: transparent;
  color: var(--text-dim);
  border: 2px solid rgba(255,255,255,0.2);
  box-shadow: none;
  font-size: 0.95rem;
}
.btn-outline:hover { border-color: rgba(255,255,255,0.5); color: white; transform: translateY(-2px); }

.btn-gold {
  background: linear-gradient(135deg, #FFD700, #FFA000);
  color: #1A0000;
  box-shadow: 0 8px 32px rgba(255,215,0,0.5), 0 2px 0 rgba(0,0,0,0.2), inset 0 1px 0 rgba(255,255,255,0.4);
  font-size: 1.3rem;
}
.btn-gold:hover { transform: translateY(-3px); box-shadow: 0 14px 44px rgba(255,215,0,0.7); }

.btn-sm {
  padding: 8px 18px;
  font-size: 0.85rem;
}

/* ===== TUTORIAL SCREEN ===== */
#tutorialScreen {
  z-index: 25;
  background: rgba(0,0,0,0.85);
  backdrop-filter: blur(12px);
  padding: 20px;
}
.tutorial-box {
  background: linear-gradient(135deg, rgba(26,26,46,0.98), rgba(22,33,62,0.98));
  border: 1px solid rgba(255,215,0,0.3);
  border-radius: 24px;
  padding: 28px;
  max-width: 600px;
  width: 92vw;
  box-shadow: 0 30px 80px rgba(0,0,0,0.6), 0 0 60px rgba(255,107,43,0.15);
  max-height: 88vh;
  overflow-y: auto;
}
.tutorial-title {
  font-family: 'Fredoka One', cursive;
  font-size: 1.8rem;
  text-align: center;
  background: linear-gradient(135deg, #FFD700, #FF6B2B);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 20px;
}
.tutorial-steps {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 24px;
}
.tutorial-step {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  background: rgba(255,255,255,0.04);
  border-radius: 14px;
  padding: 14px;
  border: 1px solid rgba(255,255,255,0.07);
  transition: transform 0.2s ease;
}
.tutorial-step:hover { transform: translateX(4px); border-color: rgba(255,107,43,0.3); }
.step-icon {
  font-size: 2rem;
  min-width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,107,43,0.15);
  border-radius: 12px;
  border: 1px solid rgba(255,107,43,0.3);
}
.step-text h4 { font-size: 1rem; font-weight: 800; color: var(--secondary); margin-bottom: 4px; }
.step-text p { font-size: 0.85rem; color: var(--text-dim); line-height: 1.5; }

.controls-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 20px;
}
.control-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255,255,255,0.04);
  border-radius: 10px;
  padding: 10px;
  font-size: 0.85rem;
}
.control-key {
  background: rgba(255,215,0,0.2);
  border: 1px solid var(--secondary);
  border-radius: 6px;
  padding: 4px 8px;
  font-family: monospace;
  font-weight: 700;
  color: var(--secondary);
  font-size: 0.8rem;
  white-space: nowrap;
}
.tut-btns { display: flex; gap: 12px; }
.tut-btns .btn { flex: 1; }

/* ===== LEVEL SELECT ===== */
#levelSelect {
  z-index: 22;
  background: linear-gradient(135deg, rgba(13,13,26,0.97), rgba(26,26,46,0.97));
  backdrop-filter: blur(10px);
  padding: 20px;
  overflow-y: auto;
}
.level-select-inner {
  width: min(92vw, 700px);
  max-height: 92vh;
  overflow-y: auto;
}
.screen-title {
  font-family: 'Fredoka One', cursive;
  font-size: clamp(1.6rem, 5vw, 2.4rem);
  text-align: center;
  background: linear-gradient(135deg, #FFD700, #FF6B2B);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 6px;
}
.screen-subtitle { text-align: center; color: var(--text-dim); font-size: 0.9rem; margin-bottom: 20px; }

.levels-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.level-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  padding: 16px 10px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}
.level-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent, rgba(255,107,43,0.1));
  opacity: 0;
  transition: opacity 0.2s ease;
}
.level-card:hover::before { opacity: 1; }
.level-card:hover { transform: translateY(-4px); border-color: rgba(255,107,43,0.5); box-shadow: 0 10px 30px rgba(0,0,0,0.3); }
.level-card.locked { opacity: 0.4; cursor: not-allowed; }
.level-card.locked:hover { transform: none; }
.level-card.complete { border-color: rgba(0,200,83,0.5); }
.level-num {
  font-family: 'Fredoka One', cursive;
  font-size: 1.6rem;
  color: var(--primary);
  display: block;
}
.level-name { font-size: 0.72rem; font-weight: 700; color: var(--text-dim); display: block; margin-top: 4px; line-height: 1.3; }
.level-stars { font-size: 0.7rem; margin-top: 6px; letter-spacing: 2px; }
.level-lock { font-size: 1.4rem; position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%); }

/* ===== GAME HUD ===== */
#gameHUD {
  position: fixed;
  inset: 0;
  z-index: 30;
  pointer-events: none;
  display: none;
}
#gameHUD.active { display: block; }

.hud-top {
  position: absolute;
  top: 0; left: 0; right: 0;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 10px 12px;
  background: linear-gradient(180deg, rgba(0,0,0,0.8) 0%, transparent 100%);
  pointer-events: all;
  gap: 8px;
}

/* Timer */
.hud-timer {
  background: linear-gradient(135deg, rgba(26,26,46,0.9), rgba(13,13,26,0.9));
  border: 2px solid var(--secondary);
  border-radius: 16px;
  padding: 8px 16px;
  text-align: center;
  box-shadow: 0 0 20px rgba(255,215,0,0.3), inset 0 1px 0 rgba(255,255,255,0.1);
  min-width: 90px;
}
.timer-label { font-size: 0.6rem; letter-spacing: 2px; color: var(--secondary); font-weight: 800; text-transform: uppercase; }
.timer-value {
  font-family: 'Fredoka One', cursive;
  font-size: 2rem;
  color: white;
  line-height: 1;
  transition: color 0.3s;
}
.timer-value.urgent { color: var(--red); animation: timerPulse 0.5s ease-in-out infinite; }
@keyframes timerPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); color: #FF6B2B; }
}

/* Score */
.hud-score {
  background: linear-gradient(135deg, rgba(26,26,46,0.9), rgba(13,13,26,0.9));
  border: 2px solid var(--primary);
  border-radius: 16px;
  padding: 8px 16px;
  text-align: center;
  box-shadow: 0 0 20px rgba(255,107,43,0.3), inset 0 1px 0 rgba(255,255,255,0.1);
}
.score-label { font-size: 0.6rem; letter-spacing: 2px; color: var(--primary); font-weight: 800; text-transform: uppercase; }
.score-value { font-family: 'Fredoka One', cursive; font-size: 1.7rem; color: white; line-height: 1; }

/* Combo */
.hud-combo {
  background: linear-gradient(135deg, rgba(26,26,46,0.9), rgba(13,13,26,0.9));
  border: 2px solid var(--accent);
  border-radius: 16px;
  padding: 8px 14px;
  text-align: center;
  box-shadow: 0 0 20px rgba(255,45,120,0.3), inset 0 1px 0 rgba(255,255,255,0.1);
  transition: all 0.2s ease;
}
.combo-label { font-size: 0.6rem; letter-spacing: 2px; color: var(--accent); font-weight: 800; text-transform: uppercase; }
.combo-value { font-family: 'Fredoka One', cursive; font-size: 1.5rem; color: white; line-height: 1; }
.hud-combo.combo-active { box-shadow: 0 0 40px rgba(255,45,120,0.7), inset 0 1px 0 rgba(255,255,255,0.2); transform: scale(1.05); }

/* HUD Buttons */
.hud-btns { display: flex; gap: 8px; align-items: flex-start; }
.hud-btn {
  background: rgba(26,26,46,0.9);
  border: 2px solid rgba(255,255,255,0.15);
  border-radius: 12px;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  pointer-events: all;
  font-size: 1.1rem;
  transition: all 0.2s ease;
  color: white;
}
.hud-btn:hover { border-color: rgba(255,255,255,0.4); transform: scale(1.1); }
.hud-btn:active { transform: scale(0.95); }

/* Order Queue */
.orders-panel {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  display: flex;
  gap: 10px;
  padding: 10px 12px;
  overflow-x: auto;
  background: linear-gradient(0deg, rgba(0,0,0,0.85) 0%, transparent 100%);
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.orders-panel::-webkit-scrollbar { display: none; }

.order-ticket {
  background: linear-gradient(135deg, rgba(26,26,46,0.95), rgba(13,13,26,0.95));
  border: 2px solid rgba(255,255,255,0.15);
  border-radius: 16px;
  padding: 10px 12px;
  min-width: 110px;
  max-width: 120px;
  flex-shrink: 0;
  pointer-events: none;
  position: relative;
  overflow: hidden;
  transition: border-color 0.3s;
}
.order-ticket::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  border-radius: 16px 16px 0 0;
  background: var(--ticket-color, #FF6B2B);
}
.order-dish-icon { font-size: 2rem; display: block; text-align: center; margin-bottom: 4px; }
.order-dish-name { font-size: 0.68rem; font-weight: 800; text-align: center; color: var(--secondary); display: block; }
.order-time-bar {
  height: 4px;
  border-radius: 2px;
  background: rgba(255,255,255,0.1);
  margin-top: 6px;
  overflow: hidden;
}
.order-time-fill {
  height: 100%;
  border-radius: 2px;
  background: var(--ticket-color, #FF6B2B);
  transition: width 0.1s linear, background 0.3s;
}
.order-ticket.urgent { border-color: var(--red); animation: urgentPulse 0.6s ease-in-out infinite; }
@keyframes urgentPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255,23,68,0); }
  50% { box-shadow: 0 0 0 6px rgba(255,23,68,0.3); }
}

/* Level Banner */
.level-banner {
  position: absolute;
  top: 70px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, rgba(156,39,176,0.9), rgba(103,58,183,0.9));
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 50px;
  padding: 6px 20px;
  font-family: 'Fredoka One', cursive;
  font-size: 0.95rem;
  color: white;
  letter-spacing: 1px;
  pointer-events: none;
  box-shadow: 0 4px 20px rgba(156,39,176,0.5);
  white-space: nowrap;
}

/* ===== CANVAS ===== */
#gameCanvas {
  position: fixed;
  inset: 0;
  display: none;
  touch-action: none;
  cursor: pointer;
}
#gameCanvas.active { display: block; }

/* ===== TAP HINT (replaces D-pad) ===== */
#mobileControls {
  position: fixed;
  inset: 0;
  z-index: 35;
  pointer-events: none;
  display: none;
}
#mobileControls.active { display: block; }

/* Tap hint bar at bottom center */
.tap-hint {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.55);
  border: 1px solid rgba(255,215,0,0.35);
  border-radius: 50px;
  padding: 7px 20px;
  font-family: 'Fredoka One', cursive;
  font-size: 0.82rem;
  color: rgba(255,215,0,0.9);
  letter-spacing: 1.5px;
  pointer-events: none;
  backdrop-filter: blur(6px);
  animation: tapHintPulse 2s ease-in-out infinite;
  white-space: nowrap;
}
@keyframes tapHintPulse {
  0%,100% { opacity:0.7; transform:translateX(-50%) scale(1); }
  50% { opacity:1; transform:translateX(-50%) scale(1.03); }
}

/* Quick-serve button — bottom right */
.quick-serve-btn {
  position: absolute;
  bottom: 60px;
  right: 16px;
  background: linear-gradient(135deg, rgba(0,200,83,0.85), rgba(0,150,60,0.85));
  border: 2px solid #00E676;
  border-radius: 50px;
  padding: 12px 20px;
  font-family: 'Fredoka One', cursive;
  font-size: 0.9rem;
  color: white;
  cursor: pointer;
  pointer-events: all;
  letter-spacing: 1px;
  box-shadow: 0 4px 20px rgba(0,200,83,0.4);
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.1s, box-shadow 0.1s;
}
.quick-serve-btn:active { transform: scale(0.93); box-shadow: 0 2px 10px rgba(0,200,83,0.3); }

/* ===== OVERLAY SCREENS ===== */
.overlay-screen {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(0,0,0,0.85);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  display: none;
}
.overlay-screen.active { display: flex; }

.result-box {
  background: linear-gradient(135deg, rgba(26,26,46,0.99), rgba(13,13,26,0.99));
  border-radius: 28px;
  padding: 36px 32px;
  max-width: 440px;
  width: 90vw;
  text-align: center;
  border: 1px solid rgba(255,255,255,0.1);
  box-shadow: 0 40px 100px rgba(0,0,0,0.6);
}
.result-title {
  font-family: 'Fredoka One', cursive;
  font-size: 2.2rem;
  margin-bottom: 8px;
}
.result-stars { font-size: 2.5rem; margin: 12px 0; letter-spacing: 6px; }
.result-stats { display: flex; gap: 16px; justify-content: center; margin: 16px 0; flex-wrap: wrap; }
.result-stat {
  background: rgba(255,255,255,0.05);
  border-radius: 14px;
  padding: 10px 16px;
  border: 1px solid rgba(255,255,255,0.08);
}
.result-stat-val { font-family: 'Fredoka One', cursive; font-size: 1.6rem; color: var(--secondary); display: block; }
.result-stat-lbl { font-size: 0.72rem; color: var(--text-dim); letter-spacing: 1px; text-transform: uppercase; }
.result-btns { display: flex; gap: 12px; margin-top: 20px; }
.result-btns .btn { flex: 1; }

/* ===== NOTIFICATIONS ===== */
.notif-container {
  position: fixed;
  top: 80px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 6px;
  pointer-events: none;
  align-items: center;
}
.notif {
  background: rgba(26,26,46,0.95);
  border-radius: 50px;
  padding: 8px 20px;
  font-family: 'Fredoka One', cursive;
  font-size: 1rem;
  color: white;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  border: 1px solid rgba(255,255,255,0.1);
  animation: notifIn 0.3s cubic-bezier(0.34,1.56,0.64,1) forwards;
  white-space: nowrap;
}
.notif.success { border-color: var(--green); box-shadow: 0 8px 24px rgba(0,230,118,0.3); }
.notif.error { border-color: var(--red); box-shadow: 0 8px 24px rgba(255,23,68,0.3); }
.notif.combo { border-color: var(--accent); box-shadow: 0 8px 24px rgba(255,45,120,0.4); font-size: 1.3rem; }
.notif.gold { border-color: var(--secondary); box-shadow: 0 8px 24px rgba(255,215,0,0.4); }
@keyframes notifIn {
  from { opacity: 0; transform: translateY(-20px) scale(0.8); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.notif.fade-out { animation: notifOut 0.3s ease forwards; }
@keyframes notifOut {
  from { opacity: 1; transform: scale(1); }
  to { opacity: 0; transform: scale(0.8) translateY(-10px); }
}

/* ===== UPGRADE PANEL ===== */
.upgrade-panel {
  position: fixed;
  top: 70px; right: -280px;
  width: 260px;
  z-index: 40;
  background: linear-gradient(135deg, rgba(26,26,46,0.98), rgba(13,13,26,0.98));
  border: 1px solid rgba(255,215,0,0.3);
  border-radius: 20px 0 0 20px;
  padding: 16px;
  transition: right 0.3s ease;
  box-shadow: -8px 0 30px rgba(0,0,0,0.4);
}
.upgrade-panel.open { right: 0; }
.upgrade-title { font-family: 'Fredoka One', cursive; font-size: 1.1rem; color: var(--secondary); margin-bottom: 12px; }
.upgrade-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255,255,255,0.04);
  border-radius: 12px;
  padding: 10px;
  margin-bottom: 8px;
  border: 1px solid rgba(255,255,255,0.06);
  cursor: pointer;
  pointer-events: all;
  transition: all 0.2s;
}
.upgrade-item:hover { border-color: rgba(255,215,0,0.4); background: rgba(255,215,0,0.05); }
.upgrade-icon { font-size: 1.5rem; }
.upgrade-info { flex: 1; }
.upgrade-name { font-size: 0.8rem; font-weight: 800; color: white; }
.upgrade-desc { font-size: 0.68rem; color: var(--text-dim); }
.upgrade-cost { font-family: 'Fredoka One', cursive; font-size: 0.85rem; color: var(--secondary); white-space: nowrap; }

/* ===== SCROLL HIDE ===== */
.level-select-inner::-webkit-scrollbar,
.tutorial-box::-webkit-scrollbar { width: 4px; }
.level-select-inner::-webkit-scrollbar-track,
.tutorial-box::-webkit-scrollbar-track { background: rgba(255,255,255,0.05); border-radius: 2px; }
.level-select-inner::-webkit-scrollbar-thumb,
.tutorial-box::-webkit-scrollbar-thumb { background: rgba(255,107,43,0.5); border-radius: 2px; }

/* ===== RUSH MODE INDICATOR ===== */
.rush-indicator {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: linear-gradient(90deg, #FF2D78, #FF6B2B, #FFD700);
  z-index: 45;
  display: none;
  animation: rushPulse 1s ease infinite;
}
.rush-indicator.active { display: block; }
@keyframes rushPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.rush-label {
  position: fixed;
  top: 70px; left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, #FF2D78, #FF6B2B);
  border-radius: 50px;
  padding: 4px 16px;
  font-family: 'Fredoka One', cursive;
  font-size: 0.85rem;
  color: white;
  z-index: 46;
  display: none;
  animation: rushPulse 0.5s ease infinite;
  letter-spacing: 2px;
  pointer-events: none;
}
.rush-label.active { display: block; }

/* ===== PAUSED SCREEN ===== */
#pauseScreen {
  z-index: 55;
}
.pause-box {
  background: linear-gradient(135deg, rgba(26,26,46,0.99), rgba(13,13,26,0.99));
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 24px;
  padding: 32px;
  max-width: 360px;
  width: 88vw;
  text-align: center;
  box-shadow: 0 30px 80px rgba(0,0,0,0.6);
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: center;
}
.pause-title {
  font-family: 'Fredoka One', cursive;
  font-size: 2rem;
  background: linear-gradient(135deg, #FFD700, #FF6B2B);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.pause-box .btn { width: 100%; }

/* ===== RESPONSIVE ===== */
@media (max-width: 600px) {
  .hud-top { padding: 8px; gap: 6px; }
  .timer-value { font-size: 1.6rem; }
  .score-value { font-size: 1.4rem; }
  .combo-value { font-size: 1.2rem; }
  .hud-btn { width: 38px; height: 38px; font-size: 1rem; }
  .order-ticket { min-width: 90px; max-width: 100px; padding: 8px 8px; }
  .order-dish-icon { font-size: 1.6rem; }
  .levels-grid { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 10px; }
  .thumbnail-img { max-height: 32vh; }
  .menu-icon { width: clamp(70px, 15vw, 90px) !important; height: clamp(70px, 15vw, 90px) !important; }
  .game-title { font-size: clamp(1.5rem, 7vw, 2.2rem); }
  .menu-inner { padding-top: 16px; }
}

/* Short screens (landscape mobile / small viewport height) */
@media (max-height: 600px) {
  .menu-icon { width: 72px !important; height: 72px !important; margin-bottom: 8px !important; }
  .game-title { font-size: 1.6rem !important; }
  .game-subtitle { font-size: 0.6rem !important; margin-top: 2px; }
  .thumbnail-img { max-height: 26vh !important; margin: 8px auto !important; }
  .menu-buttons { gap: 7px !important; margin-top: 4px !important; }
  .btn { padding: 11px 22px !important; font-size: 1rem !important; }
  .btn-gold { font-size: 1.1rem !important; }
  .menu-inner { padding-top: 10px; }
}

@media (max-width: 400px) {
  .hud-top { gap: 4px; }
  .hud-timer, .hud-score, .hud-combo { padding: 6px 10px; }
  .timer-label, .score-label, .combo-label { font-size: 0.55rem; }
  .dpad-btn { width: 44px; height: 44px; font-size: 1rem; }
}

/* ===== LOADING SCREEN ===== */
#loadingScreen {
  z-index: 60;
  background: var(--bg-dark);
  justify-content: center !important;
}
.loading-logo {
  font-family: 'Fredoka One', cursive;
  font-size: 2rem;
  background: linear-gradient(135deg, #FFD700, #FF6B2B);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 20px;
  text-align: center;
}
.loading-bar-wrap {
  width: 280px;
  height: 8px;
  background: rgba(255,255,255,0.1);
  border-radius: 4px;
  overflow: hidden;
}
.loading-bar {
  height: 100%;
  border-radius: 4px;
  background: linear-gradient(90deg, #FF6B2B, #FFD700);
  width: 0%;
  transition: width 0.3s ease;
  box-shadow: 0 0 10px rgba(255,107,43,0.6);
}
.loading-text { color: var(--text-dim); font-size: 0.85rem; margin-top: 12px; letter-spacing: 1px; }
