/* ========================================
   Cat Seek - Minimalist Edition
   Premium Minimal Design
   game4.fun
======================================== */

/* ========================================
   Theme System
======================================== */

:root {
  /* Spacing */
  --space-xs: 6px;
  --space-sm: 12px;
  --space-md: 20px;
  --space-lg: 32px;
  --space-xl: 48px;
  --space-2xl: 64px;
  
  /* Border radius */
  --radius-sm: 12px;
  --radius-md: 20px;
  --radius-lg: 28px;
  --radius-full: 9999px;
  
  /* Safe areas */
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  
  /* Theme transition */
  --theme-transition: 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Midnight Theme (Default) */
[data-theme="midnight"] {
  --bg-deep: #050508;
  --bg-elevated: #0d0f14;
  --bg-surface: rgba(15, 17, 24, 0.85);
  --bg-glass: rgba(255, 255, 255, 0.03);
  --bg-glass-elevated: rgba(255, 255, 255, 0.06);
  
  --accent-primary: #5ac8d8;
  --accent-secondary: #7a8fa8;
  --accent-glow: rgba(90, 200, 216, 0.4);
  
  --text-primary: rgba(255, 255, 255, 0.95);
  --text-secondary: rgba(255, 255, 255, 0.5);
  --text-tertiary: rgba(255, 255, 255, 0.25);
  
  --prey-color-1: #5ac8d8;
  --prey-color-2: #7a8fa8;
  --prey-color-3: #a8b4c8;
  --prey-color-4: #88a8c8;
}

/* Aurora Theme */
[data-theme="aurora"] {
  --bg-deep: #040810;
  --bg-elevated: #0a1520;
  --bg-surface: rgba(10, 25, 40, 0.85);
  --bg-glass: rgba(100, 255, 220, 0.03);
  --bg-glass-elevated: rgba(100, 255, 220, 0.06);
  
  --accent-primary: #4eecd8;
  --accent-secondary: #7b68ee;
  --accent-glow: rgba(78, 236, 216, 0.4);
  
  --text-primary: rgba(220, 255, 250, 0.95);
  --text-secondary: rgba(200, 255, 245, 0.5);
  --text-tertiary: rgba(180, 255, 240, 0.25);
  
  --prey-color-1: #4eecd8;
  --prey-color-2: #7b68ee;
  --prey-color-3: #98f5e1;
  --prey-color-4: #b8a8ff;
}

/* Desert Theme */
[data-theme="desert"] {
  --bg-deep: #0f0a08;
  --bg-elevated: #1a1410;
  --bg-surface: rgba(30, 22, 18, 0.85);
  --bg-glass: rgba(255, 200, 150, 0.03);
  --bg-glass-elevated: rgba(255, 200, 150, 0.06);
  
  --accent-primary: #e8b87a;
  --accent-secondary: #c89660;
  --accent-glow: rgba(232, 184, 122, 0.4);
  
  --text-primary: rgba(255, 245, 235, 0.95);
  --text-secondary: rgba(255, 235, 220, 0.5);
  --text-tertiary: rgba(255, 225, 200, 0.25);
  
  --prey-color-1: #e8b87a;
  --prey-color-2: #c89660;
  --prey-color-3: #f0d0a0;
  --prey-color-4: #d8a870;
}

/* ========================================
   Reset & Base
======================================== */

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

html, body {
  height: 100%;
  overflow: hidden;
  touch-action: manipulation;
}

body {
  font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'SF Pro Display', sans-serif;
  background: var(--bg-deep);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  letter-spacing: 0.01em;
  transition: background var(--theme-transition), color var(--theme-transition);
}

/* Ambient background */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: 
    radial-gradient(ellipse 100% 80% at 50% 120%, var(--accent-glow) 0%, transparent 60%);
  pointer-events: none;
  z-index: 0;
  opacity: 0.3;
  transition: background var(--theme-transition), opacity var(--theme-transition);
}

/* ========================================
   Screen Management
======================================== */

.screen {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-lg);
  padding-top: calc(var(--safe-top) + var(--space-lg));
  padding-bottom: calc(var(--safe-bottom) + var(--space-lg));
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.5s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.5s;
  z-index: 1;
}

.screen.active {
  opacity: 1;
  visibility: visible;
}

/* ========================================
   START SCREEN - Minimalist
======================================== */

#start-screen {
  background: transparent;
}

.start-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-lg);
}

/* The START Button - Glowing Elegance */
.start-button {
  position: relative;
  width: 160px;
  height: 160px;
  border: none;
  border-radius: 50%;
  background: var(--bg-glass);
  backdrop-filter: blur(40px) saturate(120%);
  -webkit-backdrop-filter: blur(40px) saturate(120%);
  cursor: pointer;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.start-button::before {
  content: '';
  position: absolute;
  inset: 2px;
  border-radius: 50%;
  background: linear-gradient(135deg, 
    rgba(255,255,255,0.1) 0%, 
    transparent 50%,
    rgba(255,255,255,0.02) 100%);
  pointer-events: none;
}

.start-button::after {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: 50%;
  background: linear-gradient(135deg, 
    var(--accent-primary) 0%, 
    transparent 50%,
    var(--accent-secondary) 100%);
  opacity: 0.3;
  z-index: -1;
  filter: blur(15px);
  transition: opacity 0.4s ease, filter 0.4s ease;
}

.start-button:hover::after {
  opacity: 0.6;
  filter: blur(25px);
}

.start-button:hover {
  transform: scale(1.05);
  box-shadow: 
    0 0 60px var(--accent-glow),
    inset 0 0 30px rgba(255,255,255,0.05);
}

.start-button:active {
  transform: scale(0.98);
}

/* Cat Paw Emoji - Neon Glow Effect */
.paw-emoji {
  font-size: 52px;
  line-height: 1;
  text-shadow: 
    0 0 8px var(--accent-primary),
    0 0 16px var(--accent-glow),
    0 0 32px var(--accent-glow),
    0 0 48px rgba(var(--accent-primary), 0.3);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  animation: pawGlow 2s ease-in-out infinite;
}

@keyframes pawGlow {
  0%, 100% {
    text-shadow: 
      0 0 8px var(--accent-primary),
      0 0 16px var(--accent-glow),
      0 0 32px var(--accent-glow);
    transform: scale(1);
  }
  50% {
    text-shadow: 
      0 0 12px var(--accent-primary),
      0 0 24px var(--accent-glow),
      0 0 48px var(--accent-glow),
      0 0 64px var(--accent-glow);
    transform: scale(1.08);
  }
}

.start-button:hover .paw-emoji {
  text-shadow: 
    0 0 16px var(--accent-primary),
    0 0 32px var(--accent-glow),
    0 0 64px var(--accent-glow),
    0 0 80px var(--accent-glow);
  transform: scale(1.15);
}

.start-text {
  font-family: 'Outfit', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--text-primary);
  transition: color var(--theme-transition);
}

/* Hint text */
.start-hint {
  font-size: 0.8rem;
  font-weight: 300;
  color: var(--text-tertiary);
  letter-spacing: 0.1em;
  transition: color var(--theme-transition);
}

/* ========================================
   CONTROL PANEL - Minimalist Glass
======================================== */

.control-panel {
  position: fixed;
  bottom: calc(var(--safe-bottom) + var(--space-xl));
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md) var(--space-lg);
  background: var(--bg-glass);
  backdrop-filter: blur(40px) saturate(120%);
  -webkit-backdrop-filter: blur(40px) saturate(120%);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-full);
  z-index: 100;
  transition: background var(--theme-transition), border-color var(--theme-transition);
}

.control-section {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.control-label {
  font-size: 0.65rem;
  font-weight: 500;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  transition: color var(--theme-transition);
}

.control-divider {
  width: 1px;
  height: 24px;
  background: rgba(255, 255, 255, 0.08);
}

/* Speed Dots */
.speed-dots {
  display: flex;
  gap: 8px;
}

.speed-dot {
  width: 10px;
  height: 10px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  cursor: pointer;
  transition: all 0.25s ease;
}

.speed-dot:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.2);
}

.speed-dot.active {
  background: var(--accent-primary);
  box-shadow: 0 0 12px var(--accent-glow);
}

/* Theme Buttons */
.theme-buttons {
  display: flex;
  gap: 6px;
}

.theme-btn {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.25s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.theme-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: scale(1.1);
}

.theme-btn.active {
  background: var(--bg-glass-elevated);
  box-shadow: 0 0 15px var(--accent-glow);
}

/* Language Toggle Button */
.lang-toggle {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.lang-toggle:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: scale(1.1);
}

.lang-toggle:active {
  transform: scale(0.95);
}

.lang-code {
  font-family: 'Outfit', sans-serif;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--accent-primary);
  letter-spacing: 0.02em;
  transition: all 0.3s ease;
}

.lang-toggle:hover .lang-code {
  text-shadow: 0 0 10px var(--accent-glow);
}

/* Panel Share Button */
.panel-share-btn {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 12px var(--accent-glow);
}

.panel-share-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 4px 20px var(--accent-glow);
}

.panel-share-btn:active {
  transform: scale(0.95);
}

.share-icon {
  width: 16px;
  height: 16px;
  color: var(--bg-deep);
}

/* Footer */
.footer {
  position: absolute;
  bottom: calc(var(--safe-bottom) + var(--space-md));
  opacity: 0;
}

.footer-brand {
  font-size: 0.7rem;
  color: var(--text-tertiary);
  letter-spacing: 0.1em;
  transition: color var(--theme-transition);
}

/* ========================================
   Glass Panel
======================================== */

.glass-panel {
  background: var(--bg-glass);
  backdrop-filter: blur(40px) saturate(120%);
  -webkit-backdrop-filter: blur(40px) saturate(120%);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  transition: background var(--theme-transition), border-color var(--theme-transition);
}

.glass-panel::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255,255,255,0.03) 0%, transparent 40%);
  pointer-events: none;
  border-radius: inherit;
}

/* ========================================
   Game Screen
======================================== */

#game-screen {
  padding: 0;
}

.game-hud {
  position: fixed;
  top: calc(var(--safe-top) + var(--space-md));
  left: var(--space-md);
  right: var(--space-md);
  display: flex;
  justify-content: space-between;
  z-index: 50;
  pointer-events: none;
}

.hud-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-glass);
  backdrop-filter: blur(24px);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-md);
  transition: background var(--theme-transition);
}

.hud-label {
  font-size: 0.6rem;
  font-weight: 500;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.hud-value {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.score-display .hud-value {
  color: var(--accent-primary);
}

.combo-display .hud-value {
  color: var(--accent-secondary);
}

#game-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
}

/* Feedback Overlay */
.feedback-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 40;
}

.feedback-text {
  font-size: 1.5rem;
  font-weight: 600;
  animation: feedbackFade 0.5s ease-out forwards;
}

.feedback-text.hit {
  color: var(--accent-primary);
}

.feedback-text.miss {
  color: rgba(255, 120, 120, 0.7);
}

.feedback-text.combo {
  color: var(--accent-secondary);
  font-size: 1.2rem;
}

@keyframes feedbackFade {
  0% {
    opacity: 1;
    transform: scale(0.8) translateY(0);
  }
  100% {
    opacity: 0;
    transform: scale(1) translateY(-30px);
  }
}

/* Countdown Overlay */
.countdown-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(5, 5, 8, 0.95);
  z-index: 60;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.countdown-overlay.active {
  opacity: 1;
  visibility: visible;
}

.countdown-number {
  font-size: 6rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.04em;
  animation: countdownScale 0.7s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes countdownScale {
  0% {
    opacity: 0;
    transform: scale(1.5);
  }
  60% {
    opacity: 1;
    transform: scale(0.95);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

/* ========================================
   Game Over Screen
======================================== */

.result-panel {
  width: 100%;
  max-width: 340px;
  text-align: center;
  animation: fadeIn 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.result-title {
  font-size: 1.6rem;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.01em;
  margin-bottom: var(--space-md);
}

.new-record {
  display: inline-block;
  padding: var(--space-sm) var(--space-lg);
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  color: var(--bg-deep);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  border-radius: var(--radius-full);
  margin-bottom: var(--space-lg);
  animation: subtleGlow 2s ease-in-out infinite;
}

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

@keyframes subtleGlow {
  0%, 100% { box-shadow: 0 4px 20px var(--accent-glow); }
  50% { box-shadow: 0 4px 35px var(--accent-glow); }
}

.score-breakdown {
  margin-bottom: var(--space-xl);
}

.score-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-md);
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.score-row:last-child {
  border-bottom: none;
}

.score-row span:first-child {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.score-num {
  font-size: 1.3rem;
  font-weight: 600;
}

.score-row.final .score-num {
  font-size: 1.8rem;
  color: var(--accent-primary);
}

.score-row.best .score-num {
  color: var(--accent-secondary);
}

/* Action Buttons */
.action-buttons {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.neon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-md) var(--space-xl);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  border: none;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.neon-btn.primary {
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  color: var(--bg-deep);
  box-shadow: 0 4px 20px var(--accent-glow);
}

.neon-btn.primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px var(--accent-glow);
}

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

.neon-btn.secondary {
  background: var(--bg-glass-elevated);
  color: var(--text-primary);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.neon-btn.secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.15);
}

/* ========================================
   Touch Effects
======================================== */

.touch-ripple {
  position: fixed;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: 2px solid var(--accent-primary);
  pointer-events: none;
  z-index: 35;
  animation: rippleFade 0.4s ease-out forwards;
}

@keyframes rippleFade {
  0% {
    transform: translate(-50%, -50%) scale(0.6);
    opacity: 0.6;
  }
  100% {
    transform: translate(-50%, -50%) scale(1.8);
    opacity: 0;
  }
}

.hit-effect {
  position: fixed;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--accent-primary) 0%, transparent 70%);
  pointer-events: none;
  z-index: 36;
  animation: hitFade 0.3s ease-out forwards;
}

@keyframes hitFade {
  0% {
    transform: translate(-50%, -50%) scale(0.4);
    opacity: 0.5;
  }
  100% {
    transform: translate(-50%, -50%) scale(1.3);
    opacity: 0;
  }
}

/* ========================================
   Responsive
======================================== */

@media (min-width: 768px) {
  .start-button {
    width: 180px;
    height: 180px;
  }
  
  .paw-icon {
    width: 56px;
    height: 56px;
  }
  
  .start-text {
    font-size: 0.95rem;
  }
  
  .result-panel {
    max-width: 400px;
    padding: var(--space-2xl);
  }
  
  .action-buttons {
    flex-direction: row;
    justify-content: center;
  }
}

@media (max-height: 500px) and (orientation: landscape) {
  .start-button {
    width: 120px;
    height: 120px;
  }
  
  .paw-icon {
    width: 36px;
    height: 36px;
  }
  
  .start-text {
    font-size: 0.75rem;
  }
  
  .control-panel {
    bottom: var(--space-md);
  }
}

/* Mobile small screens */
@media (max-width: 380px) {
  .control-panel {
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
  }
  
  .lang-toggle,
  .panel-share-btn {
    width: 32px;
    height: 32px;
  }
  
  .lang-code {
    font-size: 0.6rem;
  }
  
  .share-icon {
    width: 14px;
    height: 14px;
  }
}
