/* ============================================
   HAREKET ARENA — Ana Stil Dosyası
   GençTek Brand | Beyaz Tema | Kırmızı Vurgu
   ============================================ */

/* Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;500;600;700;800;900&family=Inter:wght@300;400;500;600;700&family=Rajdhani:wght@400;500;600;700&display=swap');

/* ============ CSS Variables ============ */
:root {
  /* Primary Red Theme — GençTek Brand Colors */
  --red-50: #fce4ec;
  --red-100: #f8bbd0;
  --red-200: #e57373;
  --red-300: #e53935;
  --red-400: #d50000;
  --red-500: #c40000;
  --red-600: #b40000;
  --red-700: #a00000;
  --red-800: #8b0000;
  --red-900: #6d0000;
  --red-accent: #d50000;
  --red-glow: rgba(213, 0, 0, 0.35);
  --red-glow-strong: rgba(213, 0, 0, 0.6);

  /* Light Background */
  --bg-white: #ffffff;
  --bg-light: #f8f8f8;
  --bg-subtle: #f0f0f0;

  /* Dark (for game screen only) */
  --bg-dark: #080808;
  --bg-darker: #030303;

  /* Cards — Light mode */
  --bg-card: rgba(255, 255, 255, 0.85);
  --bg-card-hover: rgba(255, 255, 255, 0.95);

  /* Text — Dark on white */
  --text-primary: #1a1a1a;
  --text-secondary: #555555;
  --text-muted: #999999;

  /* Borders */
  --border-light: rgba(0, 0, 0, 0.08);
  --border-light-hover: rgba(213, 0, 0, 0.3);
  --border-glass: rgba(0, 0, 0, 0.08);
  --border-glass-hover: rgba(213, 0, 0, 0.3);

  /* Shadows — subtle for light theme */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.1);
  --shadow-card: 0 2px 12px rgba(0, 0, 0, 0.06), 0 0 0 1px rgba(0, 0, 0, 0.04);
  --shadow-card-hover: 0 8px 30px rgba(213, 0, 0, 0.1), 0 0 0 1px rgba(213, 0, 0, 0.15);
  --shadow-glow: 0 4px 20px rgba(213, 0, 0, 0.15);
  --shadow-glow-intense: 0 8px 35px rgba(213, 0, 0, 0.25);

  /* Misc */
  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-xl: 32px;
  --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.6s cubic-bezier(0.4, 0, 0.2, 1);

  /* Fonts */
  --font-display: 'Orbitron', sans-serif;
  --font-body: 'Inter', sans-serif;
  --font-ui: 'Rajdhani', sans-serif;
}

/* ============ Reset & Base ============ */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg-white);
  color: var(--text-primary);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ============ App Container ============ */
#app {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background: var(--bg-white);
}

/* ============ Screen System ============ */
.screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.5s ease, visibility 0.5s ease;
  z-index: 1;
}

.screen.active {
  opacity: 1;
  visibility: visible;
  z-index: 10;
}

/* ============ Background Particles Canvas ============ */
#bg-particles {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

/* ============ Floating Red Blobs (Background Decoration) ============ */
.screen::before,
.screen::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
  opacity: 0;
  transition: opacity 0.8s ease;
}

.screen.active::before,
.screen.active::after {
  opacity: 1;
}

/* Blob 1 — top-right */
.screen::before {
  width: clamp(200px, 35vw, 500px);
  height: clamp(200px, 35vw, 500px);
  background: radial-gradient(circle, rgba(213, 0, 0, 0.08) 0%, rgba(213, 0, 0, 0.02) 50%, transparent 70%);
  top: -10%;
  right: -10%;
  animation: blobFloat1 14s ease-in-out infinite;
}

/* Blob 2 — bottom-left */
.screen::after {
  width: clamp(250px, 40vw, 600px);
  height: clamp(250px, 40vw, 600px);
  background: radial-gradient(circle, rgba(213, 0, 0, 0.06) 0%, rgba(213, 0, 0, 0.015) 50%, transparent 70%);
  bottom: -15%;
  left: -10%;
  animation: blobFloat2 18s ease-in-out infinite;
}

/* Game screen keeps dark, no blobs */
#game-screen::before,
#game-screen::after {
  display: none;
}

@keyframes blobFloat1 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  25% { transform: translate(-40px, 30px) scale(1.1); }
  50% { transform: translate(-20px, 60px) scale(0.95); }
  75% { transform: translate(30px, 20px) scale(1.05); }
}

@keyframes blobFloat2 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  25% { transform: translate(30px, -40px) scale(1.08); }
  50% { transform: translate(50px, -15px) scale(0.92); }
  75% { transform: translate(-20px, -30px) scale(1.1); }
}

/* ============ Content Container (shared by menu screens) ============ */
.screen-container {
  position: relative;
  z-index: 1;
  background: rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 2px solid rgba(213, 0, 0, 0.12);
  border-radius: var(--radius-xl);
  padding: clamp(24px, 4vw, 48px);
  max-width: 700px;
  width: 92%;
  box-shadow: 
    0 8px 40px rgba(0, 0, 0, 0.06),
    0 0 0 1px rgba(213, 0, 0, 0.05),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
  animation: containerReveal 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.portrait-mode .screen-container {
  max-width: 450px;
  width: 90%;
  padding: 32px 24px;
}

.screen-container::before {
  content: '';
  position: absolute;
  top: 0;
  left: 20%;
  right: 20%;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--red-accent), transparent);
  border-radius: 0 0 4px 4px;
}

@keyframes containerReveal {
  0% { opacity: 0; transform: translateY(20px) scale(0.97); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

/* ============ Floating Blob Elements ============ */
.floating-blob {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
  filter: blur(20px);
}

.floating-blob.blob-1 {
  width: clamp(200px, 30vw, 450px);
  height: clamp(200px, 30vw, 450px);
  background: rgba(213, 0, 0, 0.18);
  top: -5%;
  right: -5%;
  animation: blobDrift1 12s ease-in-out infinite;
}

.floating-blob.blob-2 {
  width: clamp(250px, 35vw, 550px);
  height: clamp(250px, 35vw, 550px);
  background: rgba(213, 0, 0, 0.12);
  bottom: -10%;
  left: -5%;
  animation: blobDrift2 16s ease-in-out infinite;
}

.floating-blob.blob-3 {
  width: clamp(150px, 22vw, 320px);
  height: clamp(150px, 22vw, 320px);
  background: rgba(213, 0, 0, 0.14);
  top: 45%;
  left: 55%;
  animation: blobDrift3 20s ease-in-out infinite;
}

@keyframes blobDrift1 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  20% { transform: translate(-60px, 40px) scale(1.15); }
  40% { transform: translate(-30px, 80px) scale(0.9); }
  60% { transform: translate(50px, 50px) scale(1.1); }
  80% { transform: translate(30px, -20px) scale(0.95); }
}

@keyframes blobDrift2 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  20% { transform: translate(50px, -50px) scale(1.1); }
  40% { transform: translate(70px, -20px) scale(0.88); }
  60% { transform: translate(-30px, -60px) scale(1.15); }
  80% { transform: translate(-50px, 30px) scale(0.95); }
}

@keyframes blobDrift3 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  25% { transform: translate(-80px, -40px) scale(1.2); }
  50% { transform: translate(-40px, 50px) scale(0.85); }
  75% { transform: translate(60px, -30px) scale(1.1); }
}

/* ============ SPLASH SCREEN ============ */
#splash-screen {
  background: var(--bg-white);
  z-index: 100;
  gap: 0;
}

.splash-logo {
  width: clamp(200px, 35vw, 420px);
  height: auto;
  margin-bottom: 24px;
  opacity: 0;
  animation: logoReveal 1.2s cubic-bezier(0.16, 1, 0.3, 1) forwards 0.2s;
}

.splash-divider {
  width: clamp(100px, 20vw, 240px);
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--red-accent), transparent);
  margin: 10px 0 16px;
  opacity: 0;
  animation: fadeIn 0.6s ease forwards 0.8s;
}

.splash-title {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 5vw, 4rem);
  font-weight: 900;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--red-accent);
  text-shadow: none;
  animation: fadeInUp 0.8s ease forwards 0.6s;
  opacity: 0;
}

.splash-subtitle {
  font-family: var(--font-ui);
  font-size: clamp(0.85rem, 1.8vw, 1.2rem);
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.3em;
  text-transform: uppercase;
  margin-top: 10px;
  opacity: 0;
  animation: fadeInUp 0.8s ease forwards 1s;
}

.splash-loader {
  margin-top: 40px;
  display: flex;
  gap: 10px;
  opacity: 0;
  animation: fadeIn 0.5s ease forwards 1.4s;
}

.splash-loader .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--red-accent);
  box-shadow: none;
  animation: loaderBounce 1.4s ease-in-out infinite;
}

.splash-loader .dot:nth-child(2) { animation-delay: 0.16s; }
.splash-loader .dot:nth-child(3) { animation-delay: 0.32s; }
.splash-loader .dot:nth-child(4) { animation-delay: 0.48s; }

@keyframes logoReveal {
  0% { opacity: 0; transform: scale(0.85) translateY(15px); }
  60% { opacity: 1; transform: scale(1.03) translateY(-4px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}

/* ============ MENU SCREEN ============ */
#menu-screen {
  background: var(--bg-white);
  gap: 20px;
  padding: 40px;
}

.menu-header {
  text-align: center;
  margin-bottom: 10px;
}

.menu-logo {
  width: clamp(130px, 18vw, 240px);
  height: auto;
  margin-bottom: 8px;
}

.menu-title {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 4rem);
  font-weight: 900;
  letter-spacing: 0.1em;
  color: var(--red-accent);
  position: relative;
}

.menu-tagline {
  font-family: var(--font-ui);
  font-size: clamp(0.8rem, 1.5vw, 1.1rem);
  color: var(--text-muted);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  margin-top: 8px;
}

/* Menu Cards Container */
.menu-cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  max-width: 600px;
  width: 100%;
}

.portrait-mode .menu-cards {
  grid-template-columns: 1fr;
  max-width: 320px;
}

/* Menu Card */
.menu-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 28px 20px;
  background: var(--bg-white);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--transition-normal);
  overflow: hidden;
  text-decoration: none;
  min-height: 140px;
  box-shadow: var(--shadow-card);
}

.menu-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--red-accent);
  opacity: 0;
  transition: opacity var(--transition-normal);
}

.menu-card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 0%, rgba(213, 0, 0, 0.04) 0%, transparent 70%);
  opacity: 0;
  transition: opacity var(--transition-normal);
}

.menu-card:hover {
  border-color: rgba(213, 0, 0, 0.2);
  transform: translateY(-4px) scale(1.02);
  box-shadow: var(--shadow-card-hover);
}

.menu-card:hover::before,
.menu-card:hover::after {
  opacity: 1;
}

.menu-card:active {
  transform: translateY(-2px) scale(0.98);
}

.menu-card-icon {
  font-size: 2.2rem;
  margin-bottom: 12px;
  position: relative;
  z-index: 1;
}

.menu-card-title {
  font-family: var(--font-display);
  font-size: clamp(0.75rem, 1.3vw, 1rem);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-primary);
  position: relative;
  z-index: 1;
  text-align: center;
}

.menu-card-desc {
  font-family: var(--font-ui);
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 6px;
  position: relative;
  z-index: 1;
  text-align: center;
}

/* Full width card */
.menu-card.full-width {
  grid-column: 1 / -1;
}

/* ============ SETTINGS PANEL ============ */
.settings-panel {
  max-width: 600px;
  width: 100%;
  padding: 30px;
}

.settings-group {
  margin-bottom: 24px;
}

.settings-label {
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--red-accent);
  margin-bottom: 12px;
  display: block;
}

.settings-options {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.settings-option {
  padding: 10px 20px;
  background: var(--bg-white);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-family: var(--font-ui);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  box-shadow: var(--shadow-sm);
}

.settings-option:hover {
  border-color: rgba(213, 0, 0, 0.2);
  color: var(--text-primary);
  box-shadow: var(--shadow-md);
}

.settings-option.selected {
  border-color: var(--red-accent);
  color: #ffffff;
  background: var(--red-accent);
  box-shadow: 0 4px 14px rgba(213, 0, 0, 0.25);
}

/* ============ BUTTONS ============ */
.btn {
  position: relative;
  padding: 14px 36px;
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-normal);
  overflow: hidden;
  outline: none;
}

.btn-primary {
  background: var(--red-accent);
  color: white;
  box-shadow: 0 4px 15px rgba(213, 0, 0, 0.25);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 22px rgba(213, 0, 0, 0.35);
  background: var(--red-500);
}

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

.btn-secondary {
  background: var(--bg-white);
  border: 1px solid var(--border-light);
  color: var(--text-secondary);
  box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
  border-color: rgba(213, 0, 0, 0.2);
  color: var(--text-primary);
  box-shadow: var(--shadow-md);
}

.btn-icon {
  width: 48px;
  height: 48px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 1.2rem;
}

.btn-back {
  position: absolute;
  top: 24px;
  left: 24px;
  z-index: 20;
}

/* ============ CALIBRATION SCREEN ============ */
#calibration-screen {
  background: var(--bg-white);
}

.calibration-container {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.calibration-video-wrapper {
  position: relative;
  width: 640px;
  max-width: 90vw;
  aspect-ratio: 4/3;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 2px solid var(--border-light);
  box-shadow: var(--shadow-lg);
}

.calibration-video-wrapper video,
.calibration-video-wrapper canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.calibration-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding: 30px;
  z-index: 5;
  pointer-events: none;
}

.calibration-instruction {
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 16px 28px;
  text-align: center;
  pointer-events: auto;
  box-shadow: var(--shadow-md);
}

.calibration-step {
  font-family: var(--font-display);
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--red-accent);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.calibration-text {
  font-family: var(--font-ui);
  font-size: 1.2rem;
  font-weight: 600;
  color: #1a1a1a;
}

.calibration-progress {
  display: flex;
  gap: 8px;
  margin-top: 20px;
}

.calibration-progress-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--bg-subtle);
  border: 2px solid var(--border-light);
  transition: all var(--transition-normal);
}

.calibration-progress-dot.active {
  background: var(--red-accent);
  border-color: var(--red-accent);
  box-shadow: 0 4px 10px rgba(213, 0, 0, 0.25);
}

.calibration-progress-dot.done {
  background: var(--red-700);
  border-color: var(--red-700);
}

.calibration-skip {
  position: absolute;
  bottom: 30px;
  right: 30px;
  pointer-events: auto;
  z-index: 10;
}

/* ============ GAME SCREEN ============ */
#game-screen {
  background: var(--bg-light);
  padding: 0;
}

#game-container {
  position: relative;
  width: 100%;
  height: 100%;
  margin: 0 auto;
  transition: width 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Portrait adjustments for headers */
.portrait-mode .menu-logo {
  width: clamp(100px, 25vw, 160px);
}

.portrait-mode .menu-title {
  font-size: clamp(1.5rem, 8vw, 2.5rem);
}

.portrait-mode .menu-welcome {
  font-size: 0.9rem;
  padding: 6px 16px;
}

.portrait-mode #game-container {
  box-shadow: 0 0 100px rgba(0, 0, 0, 0.5), 0 0 0 2px rgba(213, 0, 0, 0.2);
}

#game-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

#camera-video {
  display: none;
}

/* Mini camera preview */
.camera-preview {
  position: absolute;
  bottom: 20px;
  right: 20px;
  width: 200px;
  aspect-ratio: 4/3;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 2px solid var(--border-light);
  opacity: 0.8;
  z-index: 15;
  transition: opacity var(--transition-fast);
  box-shadow: var(--shadow-md);
}

.camera-preview:hover {
  opacity: 1;
}

.camera-preview video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
}

/* ============ HUD ============ */
.game-hud {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  padding: 20px 30px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  z-index: 20;
  pointer-events: none;
}

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

.hud-center {
  align-items: center;
}

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

.hud-score {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 3vw, 2.5rem);
  font-weight: 900;
  color: #1a1a1a;
  text-shadow: 0 1px 3px rgba(255, 255, 255, 0.7);
  transition: transform 0.15s ease;
}

.hud-score.bump {
  transform: scale(1.3);
}

.hud-score-label {
  font-family: var(--font-ui);
  font-size: 0.7rem;
  font-weight: 600;
  color: #888;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.hud-combo {
  font-family: var(--font-display);
  font-size: clamp(1rem, 2vw, 1.6rem);
  font-weight: 700;
  color: var(--red-accent);
  text-shadow: 0 0 15px var(--red-glow);
  opacity: 0;
  transform: scale(0.5);
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.hud-combo.visible {
  opacity: 1;
  transform: scale(1);
}

.hud-combo.mega {
  color: #ffd700;
  text-shadow: 0 0 15px rgba(255, 215, 0, 0.6);
  animation: megaPulse 0.5s ease-in-out infinite;
}

.hud-timer {
  font-family: var(--font-display);
  font-size: clamp(1.2rem, 2.5vw, 2rem);
  font-weight: 700;
  color: #1a1a1a;
}

.hud-timer.warning {
  color: var(--red-accent);
  animation: timerPulse 0.5s ease-in-out infinite;
}

.hud-timer-label {
  font-family: var(--font-ui);
  font-size: 0.7rem;
  font-weight: 600;
  color: #888;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.hud-level {
  padding: 6px 16px;
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  font-family: var(--font-display);
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--red-accent);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  backdrop-filter: blur(5px);
  box-shadow: var(--shadow-sm);
}

.hud-powerups {
  display: flex;
  gap: 8px;
}

.hud-powerup {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  font-size: 1.2rem;
  backdrop-filter: blur(5px);
  box-shadow: var(--shadow-sm);
  animation: powerupPulse 2s ease-in-out infinite;
}

/* ============ COUNTDOWN OVERLAY ============ */
.countdown-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.6);
  z-index: 50;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

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

.countdown-number {
  font-family: var(--font-display);
  font-size: clamp(6rem, 15vw, 12rem);
  font-weight: 900;
  color: var(--red-accent);
  text-shadow: 0 4px 20px rgba(213, 0, 0, 0.2);
  animation: countdownPop 1s ease-out;
}

/* ============ GAME OVER SCREEN ============ */
#gameover-screen {
  background: var(--bg-white);
}

.gameover-container {
  text-align: center;
  max-width: 500px;
  width: 90%;
}

.gameover-title {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 900;
  letter-spacing: 0.1em;
  color: var(--red-accent);
  text-shadow: none;
  margin-bottom: 30px;
}

.gameover-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-bottom: 36px;
}

.stat-card {
  background: var(--bg-white);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow-card);
}

.stat-value {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 900;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.stat-label {
  font-family: var(--font-ui);
  font-size: 0.8rem;
  color: var(--text-muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.gameover-new-high {
  font-family: var(--font-display);
  font-size: 1rem;
  color: #d4a017;
  text-shadow: none;
  margin-bottom: 24px;
  animation: megaPulse 1s ease-in-out infinite;
}

.gameover-buttons {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
}

/* ============ GAME OVER EXTRAS ============ */
.gameover-rank {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
  letter-spacing: 0.1em;
}

.gameover-message {
  font-family: var(--font-ui);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-secondary);
  line-height: 1.4;
  margin-bottom: 30px;
  padding: 0 20px;
  font-style: italic;
}

/* ============ MENU WELCOME ============ */
.menu-welcome {
  font-family: var(--font-ui);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--red-accent);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  margin-bottom: 20px;
  background: rgba(213, 0, 0, 0.05);
  padding: 8px 24px;
  border-radius: var(--radius-sm);
  display: inline-block;
  animation: fadeInDown 0.8s ease backwards 0.3s;
}

/* ============ LEADERBOARD SCREEN ============ */
#leaderboard-screen {
  background: var(--bg-white);
  padding: 40px;
}

.leaderboard-container {
  max-width: 500px;
  width: 100%;
}

.leaderboard-title {
  font-family: var(--font-display);
  font-size: clamp(1.2rem, 3vw, 2rem);
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--text-primary);
  text-align: center;
  margin-bottom: 24px;
}

.leaderboard-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.leaderboard-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 20px;
  background: var(--bg-white);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-fast);
}

.leaderboard-row:nth-child(1) {
  border-color: #d4a017;
  background: rgba(255, 215, 0, 0.06);
}

.leaderboard-row:nth-child(2) {
  border-color: #aaa;
  background: rgba(192, 192, 192, 0.05);
}

.leaderboard-row:nth-child(3) {
  border-color: #cd7f32;
  background: rgba(205, 127, 50, 0.05);
}

.leaderboard-rank {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text-muted);
  min-width: 32px;
}

.leaderboard-row:nth-child(1) .leaderboard-rank { color: #d4a017; }
.leaderboard-row:nth-child(2) .leaderboard-rank { color: #aaa; }
.leaderboard-row:nth-child(3) .leaderboard-rank { color: #cd7f32; }

.leaderboard-name {
  font-family: var(--font-ui);
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  flex: 1;
}

.leaderboard-score-val {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--red-accent);
}

.leaderboard-empty {
  text-align: center;
  padding: 40px;
  color: var(--text-muted);
  font-family: var(--font-ui);
  font-size: 1rem;
}

/* ============ SETTINGS SCREEN ============ */
#settings-screen {
  background: var(--bg-white);
  padding: 40px;
  gap: 20px;
}

.screen-title {
  font-family: var(--font-display);
  font-size: clamp(1.2rem, 3vw, 2rem);
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--text-primary);
  text-align: center;
  margin-bottom: 10px;
}

/* ============ PAUSE OVERLAY ============ */
.pause-overlay {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(12px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
  z-index: 50;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.pause-overlay.visible {
  opacity: 1;
  visibility: visible;
}

.pause-title {
  font-family: var(--font-display);
  font-size: 3rem;
  font-weight: 900;
  color: var(--red-accent);
  letter-spacing: 0.15em;
}

/* ============ VISUAL EFFECTS ============ */
.screen-flash {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 100;
  opacity: 0;
}

.screen-flash.red {
  background: radial-gradient(circle, rgba(255, 23, 68, 0.4), transparent);
  animation: flashFade 0.4s ease-out forwards;
}

.screen-flash.gold {
  background: radial-gradient(circle, rgba(255, 215, 0, 0.3), transparent);
  animation: flashFade 0.3s ease-out forwards;
}

.screen-shake {
  animation: screenShake 0.4s ease-out;
}

/* ============ FLOATING TEXT ============ */
.floating-text {
  position: absolute;
  font-family: var(--font-display);
  font-weight: 800;
  pointer-events: none;
  z-index: 30;
  animation: floatUp 1s ease-out forwards;
}

/* ============ ANIMATIONS ============ */
@keyframes titlePulse {
  0%, 100% { text-shadow: 0 0 10px var(--red-glow), 0 0 30px var(--red-glow), 0 0 60px rgba(213, 0, 0, 0.25); }
  50% { text-shadow: 0 0 15px var(--red-glow-strong), 0 0 40px var(--red-glow), 0 0 80px rgba(213, 0, 0, 0.35); }
}

@keyframes titleFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

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

@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-20px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes loaderBounce {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}

@keyframes countdownPop {
  0% { transform: scale(2); opacity: 0; }
  50% { transform: scale(0.9); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes megaPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

@keyframes timerPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

@keyframes powerupPulse {
  0%, 100% { box-shadow: 0 0 5px rgba(213, 0, 0, 0.2); }
  50% { box-shadow: 0 0 15px rgba(213, 0, 0, 0.4); }
}

@keyframes flashFade {
  from { opacity: 1; }
  to { opacity: 0; }
}

@keyframes screenShake {
  0%, 100% { transform: translate(0); }
  20% { transform: translate(-5px, 3px); }
  40% { transform: translate(5px, -3px); }
  60% { transform: translate(-3px, 5px); }
  80% { transform: translate(3px, -5px); }
}

@keyframes floatUp {
  0% { opacity: 1; transform: translateY(0) scale(1); }
  100% { opacity: 0; transform: translateY(-80px) scale(1.5); }
}

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(30px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes borderGlow {
  0%, 100% { border-color: rgba(213, 0, 0, 0.15); }
  50% { border-color: rgba(213, 0, 0, 0.4); }
}

/* ============ DEVELOPER CREDIT ============ */
.dev-credit {
  display: block;
  margin-top: 18px;
  font-family: var(--font-body);
  font-size: 0.65rem;
  font-weight: 400;
  color: var(--text-muted);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  opacity: 0.45;
  text-align: center;
  user-select: none;
  transition: opacity var(--transition-fast);
}

.dev-credit:hover {
  opacity: 0.7;
}

/* Splash screen credit positioned at bottom */
#splash-screen .dev-credit {
  position: absolute;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  margin-top: 0;
  opacity: 0;
  animation: fadeIn 0.5s ease forwards 1.8s;
}

/* ============ RESPONSIVE ============ */
@media (max-width: 768px) {
  .menu-cards {
    grid-template-columns: 1fr;
  }
  
  .gameover-stats {
    grid-template-columns: 1fr;
  }
  
  .game-hud {
    padding: 12px 16px;
  }
  
  .camera-preview {
    width: 120px;
  }
}

@media (min-width: 1920px) {
  .menu-cards {
    max-width: 700px;
    gap: 20px;
  }
  
  .menu-card {
    padding: 36px 24px;
    min-height: 160px;
  }
}

/* ============ SCROLLBAR ============ */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: var(--bg-darker);
}

::-webkit-scrollbar-thumb {
  background: var(--red-900);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--red-700);
}

/* ============ NAME INPUT MODAL ============ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.modal-overlay.visible {
  opacity: 1;
  visibility: visible;
}

.modal-box {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 36px;
  max-width: 400px;
  width: 90%;
  backdrop-filter: blur(20px);
  text-align: center;
}

.modal-title {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 20px;
}

.modal-input {
  width: 100%;
  padding: 14px 18px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-ui);
  font-size: 1.1rem;
  font-weight: 600;
  text-align: center;
  outline: none;
  transition: border-color var(--transition-fast);
  margin-bottom: 20px;
}

.modal-input:focus {
  border-color: var(--red-accent);
  box-shadow: 0 0 15px rgba(213, 0, 0, 0.2);
}

.modal-input::placeholder {
  color: var(--text-muted);
}

/* ============ DEVELOPER CREDITS ============ */
.dev-credit {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-ui);
  font-size: 0.65rem;
  color: var(--text-muted);
  opacity: 0.45;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 600;
  pointer-events: none;
  z-index: 10;
  white-space: nowrap;
  transition: opacity 0.3s ease;
}

.portrait-mode .dev-credit {
  font-size: 0.55rem;
  bottom: 8px;
}

.dev-credit:hover {
  opacity: 0.7;
}
