


/* ===== RESET & BASE ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

:root {
  --primary: #ff6b35;
  --secondary: #00f2ff;
  --accent: #ffd700;
  --danger: #ff4757;
  --success: #2ed573;
  --dark: #1a1a2e;
  --darker: #0f0f1a;
  --blade-color: #00f2ff;
  --bg-gradient: linear-gradient(180deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: 'Poppins', sans-serif;
  background: var(--darker);
  touch-action: none;
}

/* ===== PRELOADER ===== */
#preloader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--darker);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  transition: opacity 0.5s, visibility 0.5s;
}

#preloader.hidden {
  opacity: 0;
  visibility: hidden;
}

.loader-content {
  text-align: center;
}

.loader-fruit {
  font-size: 80px;
  animation: loaderBounce 1s ease-in-out infinite;
}

@keyframes loaderBounce {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-30px) rotate(180deg); }
}

.loader-text {
  color: white;
  font-size: 24px;
  font-family: 'Fredoka One', cursive;
  margin: 20px 0;
}

.loader-bar {
  width: 200px;
  height: 6px;
  background: rgba(255,255,255,0.1);
  border-radius: 3px;
  overflow: hidden;
  margin: 0 auto;
}

.loader-progress {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  border-radius: 3px;
  transition: width 0.3s;
  animation: loadProgress 2s ease-in-out forwards;
}

@keyframes loadProgress {
  0% { width: 0%; }
  100% { width: 100%; }
}

/* ===== SCREENS ===== */
.screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.screen.hidden {
  opacity: 0;
  pointer-events: none;
  transform: scale(0.95);
}

.screen.overlay {
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 100;
}

/* ===== MAIN MENU ===== */
#main-menu {
  background: var(--bg-gradient);
  flex-direction: column;
  overflow: hidden;
}

.menu-bg-fruits {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: hidden;
}

.menu-content {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 20px;
  max-width: 450px;
  width: 100%;
}

.game-title {
  margin-bottom: 40px;
  position: relative;
}

.title-icon {
  font-size: 70px;
  display: block;
  animation: titleFloat 3s ease-in-out infinite;
  filter: drop-shadow(0 10px 20px rgba(255, 107, 53, 0.3));
}

@keyframes titleFloat {
  0%, 100% { transform: translateY(0) rotate(-5deg); }
  50% { transform: translateY(-15px) rotate(5deg); }
}

.game-title h1 {
  font-family: 'Fredoka One', cursive;
  font-size: 56px;
  color: white;
  line-height: 1;
  text-shadow: 0 4px 20px rgba(255, 107, 53, 0.5),
               0 0 60px rgba(255, 107, 53, 0.2);
  letter-spacing: 4px;
}

.title-sub {
  font-family: 'Fredoka One', cursive;
  font-size: 28px;
  color: var(--accent);
  text-shadow: 0 0 20px rgba(255, 215, 0, 0.5);
  letter-spacing: 10px;
}

/* ===== BUTTONS ===== */
.menu-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 30px;
}

.btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 24px;
  border: none;
  border-radius: 16px;
  font-family: 'Poppins', sans-serif;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  position: relative;
  overflow: hidden;
  color: white;
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(10px);
  text-align: left;
}

.btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
  transition: left 0.5s;
}

.btn:hover::before {
  left: 100%;
}

.btn:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.btn:active {
  transform: translateY(0) scale(0.98);
}

.btn-icon {
  font-size: 28px;
  width: 40px;
  text-align: center;
}

.btn-text {
  font-size: 18px;
  font-weight: 700;
}

.btn-desc {
  font-size: 11px;
  opacity: 0.6;
  display: block;
  font-weight: 400;
}

.btn-play {
  background: linear-gradient(135deg, #ff6b35, #ff4757);
  border-color: #ff6b35;
  box-shadow: 0 4px 15px rgba(255, 107, 53, 0.4);
}

.btn-arcade {
  background: linear-gradient(135deg, #5352ed, #6c5ce7);
  border-color: #5352ed;
  box-shadow: 0 4px 15px rgba(83, 82, 237, 0.4);
}

.btn-zen {
  background: linear-gradient(135deg, #2ed573, #1abc9c);
  border-color: #2ed573;
  box-shadow: 0 4px 15px rgba(46, 213, 115, 0.4);
}

.btn-settings {
  background: rgba(255, 255, 255, 0.08);
}

.high-score-display {
  color: var(--accent);
  font-family: 'Fredoka One', cursive;
  font-size: 20px;
  text-shadow: 0 0 20px rgba(255, 215, 0, 0.3);
}

/* ===== SETTINGS ===== */
#settings-screen {
  background: var(--bg-gradient);
}

.settings-content {
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(20px);
  border-radius: 24px;
  padding: 30px;
  max-width: 400px;
  width: 90%;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.settings-content h2 {
  color: white;
  font-family: 'Fredoka One', cursive;
  font-size: 28px;
  text-align: center;
  margin-bottom: 24px;
}

.setting-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.setting-item:last-of-type {
  border-bottom: none;
}

.setting-item label {
  color: rgba(255, 255, 255, 0.8);
  font-size: 16px;
  font-weight: 600;
}

.toggle {
  width: 52px;
  height: 28px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 14px;
  cursor: pointer;
  position: relative;
  transition: background 0.3s;
}

.toggle[data-active="true"] {
  background: var(--success);
}

.toggle-slider {
  width: 22px;
  height: 22px;
  background: white;
  border-radius: 50%;
  position: absolute;
  top: 3px;
  left: 3px;
  transition: transform 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.toggle[data-active="true"] .toggle-slider {
  transform: translateX(24px);
}

.blade-colors {
  display: flex;
  gap: 8px;
}

.color-option {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  border: 3px solid transparent;
  transition: all 0.3s;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.color-option.active {
  border-color: white;
  transform: scale(1.2);
}

.bg-options {
  display: flex;
  gap: 6px;
}

.bg-option {
  padding: 6px 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.7);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.3s;
  border: 2px solid transparent;
}

.bg-option.active {
  background: var(--primary);
  color: white;
  border-color: rgba(255, 255, 255, 0.3);
}

.btn-back {
  width: 100%;
  justify-content: center;
  margin-top: 20px;
}

/* ===== GAME HUD ===== */
#game-hud {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 15px 20px;
  z-index: 50;
  pointer-events: none;
  padding-top: max(15px, env(safe-area-inset-top));
}

#game-hud > * {
  pointer-events: auto;
}

.hud-left, .hud-right {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.hud-right {
  align-items: flex-end;
}

.score-display {
  display: flex;
  flex-direction: column;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(10px);
  border-radius: 12px;
  padding: 8px 16px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.score-label {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.5);
  font-weight: 700;
  letter-spacing: 2px;
}

.score-value {
  font-family: 'Fredoka One', cursive;
  font-size: 32px;
  color: white;
  line-height: 1;
  text-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
}

.combo-display {
  background: linear-gradient(135deg, var(--accent), var(--primary));
  border-radius: 8px;
  padding: 4px 12px;
  animation: comboPulse 0.5s ease-in-out infinite alternate;
}

.combo-display.hidden {
  display: none;
}

@keyframes comboPulse {
  from { transform: scale(1); }
  to { transform: scale(1.1); }
}

#combo-text {
  font-family: 'Fredoka One', cursive;
  font-size: 16px;
  color: white;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* Timer */
#timer-display {
  position: relative;
  width: 60px;
  height: 60px;
}

#timer-display.hidden {
  display: none;
}

.timer-svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.timer-bg {
  fill: none;
  stroke: rgba(255, 255, 255, 0.1);
  stroke-width: 4;
}

.timer-progress {
  fill: none;
  stroke: var(--secondary);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-dasharray: 163.36;
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 1s linear, stroke 0.3s;
}

.timer-progress.warning {
  stroke: var(--danger);
}

#timer-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: white;
  font-family: 'Fredoka One', cursive;
  font-size: 20px;
}

/* Lives */
.lives-display {
  display: flex;
  gap: 4px;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(10px);
  border-radius: 10px;
  padding: 6px 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.life {
  font-size: 18px;
  transition: all 0.3s;
}

.life.lost {
  filter: grayscale(1);
  opacity: 0.3;
  transform: scale(0.8);
}

.best-display {
  font-size: 12px;
  color: var(--accent);
  font-weight: 600;
  background: rgba(0, 0, 0, 0.4);
  border-radius: 8px;
  padding: 4px 10px;
}

.btn-pause {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 20px;
  cursor: pointer;
  transition: all 0.3s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-pause:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* ===== GAME CANVAS ===== */
#game-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  cursor: crosshair;
}

#splash-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 10;
}

/* ===== PAUSE SCREEN ===== */
.pause-content, .gameover-content {
  text-align: center;
  max-width: 350px;
  width: 90%;
}

.pause-content h2 {
  font-family: 'Fredoka One', cursive;
  font-size: 42px;
  color: white;
  margin-bottom: 30px;
  text-shadow: 0 0 30px rgba(255, 255, 255, 0.2);
}

.pause-content .btn,
.gameover-buttons .btn {
  width: 100%;
  justify-content: center;
  margin-bottom: 10px;
}

/* ===== GAME OVER ===== */
.gameover-title {
  font-family: 'Fredoka One', cursive;
  font-size: 48px;
  color: white;
  margin-bottom: 20px;
  text-shadow: 0 0 40px rgba(255, 71, 87, 0.5);
  animation: gameoverShake 0.5s ease-out;
}

@keyframes gameoverShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-10px) rotate(-2deg); }
  50% { transform: translateX(10px) rotate(2deg); }
  75% { transform: translateX(-5px) rotate(-1deg); }
}

.final-score {
  margin: 20px 0;
}

.final-score-label {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.5);
  letter-spacing: 3px;
  font-weight: 700;
}

.final-score-value {
  font-family: 'Fredoka One', cursive;
  font-size: 72px;
  color: var(--accent);
  text-shadow: 0 0 40px rgba(255, 215, 0, 0.4);
  animation: scoreCount 0.5s ease-out;
}

@keyframes scoreCount {
  from { transform: scale(0); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.final-stats {
  display: flex;
  justify-content: center;
  gap: 30px;
  margin: 20px 0;
}

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

.stat-value {
  font-family: 'Fredoka One', cursive;
  font-size: 28px;
  color: white;
}

.stat-label {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.4);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.new-best {
  font-family: 'Fredoka One', cursive;
  font-size: 24px;
  color: var(--accent);
  margin: 15px 0;
  animation: newBest 0.5s ease-in-out infinite alternate;
}

.new-best.hidden {
  display: none;
}

@keyframes newBest {
  from { transform: scale(1); text-shadow: 0 0 20px rgba(255, 215, 0, 0.3); }
  to { transform: scale(1.1); text-shadow: 0 0 40px rgba(255, 215, 0, 0.6); }
}

.gameover-buttons {
  margin-top: 25px;
}

/* ===== FLOATING SCORE TEXT ===== */
.float-score {
  position: fixed;
  font-family: 'Fredoka One', cursive;
  font-size: 36px;
  color: white;
  pointer-events: none;
  z-index: 200;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
  animation: floatUp 1s ease-out forwards;
}

@keyframes floatUp {
  0% { 
      opacity: 1; 
      transform: translateY(0) scale(0.5); 
  }
  50% {
      opacity: 1;
      transform: translateY(-40px) scale(1.2);
  }
  100% { 
      opacity: 0; 
      transform: translateY(-100px) scale(0.8); 
  }
}

/* ===== CRITICAL HIT FLASH ===== */
.screen-flash {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1000;
  animation: flashRed 0.3s ease-out;
}

@keyframes flashRed {
  0% { background: rgba(255, 0, 0, 0.4); }
  100% { background: transparent; }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 380px) {
  .game-title h1 {
      font-size: 42px;
  }
  .title-icon {
      font-size: 56px;
  }
  .btn {
      padding: 12px 18px;
  }
  .btn-text {
      font-size: 16px;
  }
  .score-value {
      font-size: 26px;
  }
}

@media (min-width: 768px) {
  .game-title h1 {
      font-size: 72px;
  }
  .title-icon {
      font-size: 90px;
  }
}

/* ===== BACKGROUND THEMES ===== */
.bg-classic {
  background: linear-gradient(180deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
}

.bg-wooden {
  background: linear-gradient(180deg, #3e2723 0%, #4e342e 50%, #5d4037 100%);
}

.bg-dark {
  background: linear-gradient(180deg, #0a0a0a 0%, #1a1a1a 50%, #0d0d0d 100%);
}

.bg-nature {
  background: linear-gradient(180deg, #1b5e20 0%, #2e7d32 50%, #388e3c 100%);
}

