/* ============================================================
   FitQuest Design System — 10-Foot UI
   High contrast, massive fonts, dark mode, glassmorphism
   ============================================================ */

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

:root {
  /* Core palette */
  --bg-primary: #0a0a1a;
  --bg-secondary: #12122a;
  --bg-card: rgba(255,255,255,0.04);
  --bg-glass: rgba(255,255,255,0.06);
  --text-primary: #f0f0ff;
  --text-secondary: #8888aa;
  --text-muted: #555577;

  /* Accent colors */
  --accent-fire: #ff6b35;
  --accent-electric: #00d4ff;
  --accent-xp: #a855f7;
  --accent-success: #22c55e;
  --accent-danger: #ef4444;
  --accent-warning: #f59e0b;
  --accent-boss: #ff2222;

  /* Gradients */
  --grad-fire: linear-gradient(135deg, #ff6b35, #ff3366);
  --grad-electric: linear-gradient(135deg, #00d4ff, #7c3aed);
  --grad-xp: linear-gradient(135deg, #a855f7, #ec4899);
  --grad-boss: linear-gradient(135deg, #ff2222, #ff6600);
  --grad-success: linear-gradient(135deg, #22c55e, #06b6d4);

  /* Sizing */
  --font-mega: clamp(3rem, 8vw, 6rem);
  --font-hero: clamp(2rem, 5vw, 4rem);
  --font-title: clamp(1.5rem, 3.5vw, 2.5rem);
  --font-large: clamp(1.2rem, 2.5vw, 1.8rem);
  --font-body: clamp(1rem, 2vw, 1.4rem);
  --font-small: clamp(0.85rem, 1.5vw, 1.1rem);
  --radius: 1rem;
  --radius-lg: 1.5rem;
}

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

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: 'Outfit', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ── Animated BG ─────────────────────────────────────── */
body::before {
  content: '';
  position: fixed; inset: 0; z-index: -1;
  background:
    radial-gradient(ellipse at 20% 50%, rgba(0,212,255,0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(168,85,247,0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 80%, rgba(255,107,53,0.05) 0%, transparent 50%);
  animation: bgPulse 8s ease-in-out infinite alternate;
}
@keyframes bgPulse {
  0% { opacity: 0.6; }
  100% { opacity: 1; }
}

/* ── Screens ─────────────────────────────────────────── */
.screen { display: none; min-height: 100vh; padding: 1.5rem; max-width: 1400px; margin: 0 auto; }
.screen.active { display: flex; flex-direction: column; animation: fadeIn 0.4s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: none; } }

/* ── Login Screen ────────────────────────────────────── */
#login-screen {
  justify-content: center; align-items: center; gap: 2rem; text-align: center;
}
.login-logo { font-family: 'Orbitron', sans-serif; font-size: var(--font-mega); font-weight: 900; background: var(--grad-electric); -webkit-background-clip: text; -webkit-text-fill-color: transparent; text-shadow: none; }
.pin-input {
  font-family: 'Orbitron', sans-serif; font-size: var(--font-hero); text-align: center;
  width: 280px; padding: 1rem; border: 2px solid rgba(0,212,255,0.3); border-radius: var(--radius);
  background: var(--bg-glass); color: var(--text-primary); letter-spacing: 1rem;
  outline: none; transition: border-color 0.3s;
}
.pin-input:focus { border-color: var(--accent-electric); box-shadow: 0 0 30px rgba(0,212,255,0.2); }
.pin-input::placeholder { letter-spacing: 0.5rem; font-size: var(--font-large); }
.login-error { color: var(--accent-danger); font-size: var(--font-large); min-height: 2rem; }

/* ── Buttons ─────────────────────────────────────────── */
.btn {
  font-family: 'Outfit', sans-serif; font-size: var(--font-large); font-weight: 700;
  padding: 1rem 2.5rem; border: none; border-radius: var(--radius); cursor: pointer;
  transition: all 0.3s ease; position: relative; overflow: hidden; text-transform: uppercase; letter-spacing: 0.05em;
}
.btn::after {
  content: ''; position: absolute; inset: 0; background: rgba(255,255,255,0.1);
  transform: translateX(-100%); transition: transform 0.3s;
}
.btn:hover::after { transform: translateX(0); }
.btn:active { transform: scale(0.97); }

.btn-primary { background: var(--grad-electric); color: #fff; }
.btn-fire { background: var(--grad-fire); color: #fff; }
.btn-xp { background: var(--grad-xp); color: #fff; }
.btn-success { background: var(--grad-success); color: #fff; }
.btn-boss { background: var(--grad-boss); color: #fff; animation: bossGlow 1s ease-in-out infinite alternate; }
.btn-outline {
  background: transparent; border: 2px solid rgba(255,255,255,0.2); color: var(--text-primary);
}
.btn-lg { font-size: var(--font-title); padding: 1.5rem 3rem; border-radius: var(--radius-lg); }
.btn-sm { font-size: var(--font-small); padding: 0.6rem 1.2rem; }

/* ── Cards ───────────────────────────────────────────── */
.card {
  background: var(--bg-glass); border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius-lg); padding: 1.5rem; backdrop-filter: blur(10px);
  transition: transform 0.3s, box-shadow 0.3s;
}
.card:hover { transform: translateY(-2px); box-shadow: 0 8px 32px rgba(0,0,0,0.3); }

/* ── Dashboard ───────────────────────────────────────── */
#dashboard-screen { gap: 1.5rem; }
.dash-header { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 1rem; }
.dash-title { font-family: 'Orbitron', sans-serif; font-size: var(--font-title); font-weight: 900; }
.dash-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1.5rem; }

.stat-value { font-family: 'Outfit', sans-serif; font-size: var(--font-hero); font-weight: 900; letter-spacing: -0.02em; }
.stat-label { font-size: var(--font-body); color: var(--text-secondary); margin-top: 0.3rem; }
.stat-fire .stat-value { color: var(--accent-fire); }
.stat-xp .stat-value { color: var(--accent-xp); }
.stat-electric .stat-value { color: var(--accent-electric); }

/* ── Streak flames ───────────────────────────────────── */
.streak-flames { font-size: 2rem; animation: flicker 0.5s ease-in-out infinite alternate; }
@keyframes flicker { from { opacity: 0.7; filter: brightness(1); } to { opacity: 1; filter: brightness(1.3); } }

/* ── Mascot ──────────────────────────────────────────── */
.mascot-container { text-align: center; padding: 2rem 1rem; }
.mascot-display { font-size: 5rem; animation: mascotBounce 2s ease-in-out infinite; display: inline-block; }
@keyframes mascotBounce { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
.mascot-name { font-family: 'Orbitron', sans-serif; font-size: var(--font-large); margin-top: 0.5rem; }
.mascot-mood { font-size: var(--font-body); color: var(--text-secondary); }
.hunger-bar { height: 8px; background: rgba(255,255,255,0.1); border-radius: 4px; margin-top: 0.5rem; overflow: hidden; }
.hunger-fill { height: 100%; background: var(--grad-success); transition: width 0.5s; border-radius: 4px; }

/* ── Workout Screen ──────────────────────────────────── */
#workout-screen { gap: 1rem; justify-content: center; }
.workout-phase-label {
  font-family: 'Orbitron', sans-serif; font-size: var(--font-title); text-align: center;
  text-transform: uppercase; letter-spacing: 0.1em;
}
.workout-timer {
  font-family: 'Orbitron', sans-serif; font-size: var(--font-mega); font-weight: 900;
  text-align: center; line-height: 1;
}
.workout-timer.work { color: var(--accent-electric); }
.workout-timer.rest { color: var(--accent-fire); }
.workout-timer.warmup { color: var(--accent-success); }
.workout-timer.cooldown { color: var(--accent-xp); }

/* Split screen */
.split-screen { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
.split-panel {
  background: var(--bg-glass); border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius-lg); padding: 2rem; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 1rem;
}
.split-panel-label {
  font-family: 'Orbitron', sans-serif; font-size: var(--font-large);
  padding: 0.3rem 1rem; border-radius: 0.5rem;
}
.split-panel.adult .split-panel-label { background: var(--grad-electric); }
.split-panel.child .split-panel-label { background: var(--grad-xp); }
.exercise-name { font-size: var(--font-title); font-weight: 700; }
.exercise-desc { font-size: var(--font-body); color: var(--text-secondary); line-height: 1.5; }
.exercise-animation {
  width: 100%; max-width: 300px; aspect-ratio: 1; background: var(--bg-card);
  border-radius: var(--radius); display: flex; align-items: center; justify-content: center;
  font-size: 5rem;
}

/* Progress bar */
.workout-progress { height: 6px; background: rgba(255,255,255,0.1); border-radius: 3px; overflow: hidden; }
.workout-progress-fill { height: 100%; background: var(--grad-electric); transition: width 0.3s; border-radius: 3px; }

.exercise-counter { text-align: center; font-size: var(--font-body); color: var(--text-secondary); }

/* ── RPE Screen ──────────────────────────────────────── */
#rpe-screen { justify-content: center; align-items: center; gap: 2rem; text-align: center; }
.rpe-title { font-family: 'Orbitron', sans-serif; font-size: var(--font-title); }
.rpe-user-label { font-size: var(--font-large); color: var(--text-secondary); margin-bottom: 1rem; }
.rpe-buttons { display: flex; gap: 1.5rem; flex-wrap: wrap; justify-content: center; }
.rpe-btn {
  font-size: var(--font-large); padding: 2rem 2.5rem; border-radius: var(--radius-lg);
  border: 2px solid rgba(255,255,255,0.1); background: var(--bg-glass); color: var(--text-primary);
  cursor: pointer; transition: all 0.3s; min-width: 200px; text-align: center;
}
.rpe-btn:hover { transform: scale(1.05); }
.rpe-btn.easy { border-color: var(--accent-success); }
.rpe-btn.easy:hover { background: rgba(34,197,94,0.2); }
.rpe-btn.right { border-color: var(--accent-electric); }
.rpe-btn.right:hover { background: rgba(0,212,255,0.2); }
.rpe-btn.hard { border-color: var(--accent-danger); }
.rpe-btn.hard:hover { background: rgba(239,68,68,0.2); }

/* ── Victory Flex ────────────────────────────────────── */
#victory-screen { justify-content: center; align-items: center; gap: 1.5rem; text-align: center; }
.victory-title {
  font-family: 'Orbitron', sans-serif; font-size: var(--font-hero); font-weight: 900;
  background: var(--grad-fire); -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  animation: victoryPulse 1s ease-in-out infinite alternate;
}
@keyframes victoryPulse { from { transform: scale(1); } to { transform: scale(1.05); } }
.camera-feed {
  width: 100%; max-width: 640px; aspect-ratio: 4/3; background: #000; border-radius: var(--radius-lg);
  overflow: hidden; position: relative; border: 3px solid rgba(255,255,255,0.1);
}
.camera-feed video, .camera-feed canvas { width: 100%; height: 100%; object-fit: cover; }
.camera-countdown {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-family: 'Orbitron', sans-serif; font-size: var(--font-mega); font-weight: 900;
  color: #fff; background: rgba(0,0,0,0.5); z-index: 2;
}
.flash { animation: cameraFlash 0.3s ease; }
@keyframes cameraFlash { 0% { opacity: 0; } 50% { opacity: 1; background: #fff; } 100% { opacity: 0; } }

/* ── Stats Screen ────────────────────────────────────── */
#stats-screen { gap: 1.5rem; }
.stats-header { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; }
.chart-container { width: 100%; aspect-ratio: 2/1; background: var(--bg-glass); border-radius: var(--radius-lg); padding: 1rem; }
.chart-container canvas { width: 100%!important; height: 100%!important; }

.milestone-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1rem; }
.milestone-card {
  background: var(--bg-glass); border-radius: var(--radius); padding: 1rem; text-align: center;
  border: 1px solid rgba(255,255,255,0.05); transition: all 0.3s;
}
.milestone-card.unlocked { border-color: rgba(168,85,247,0.3); }
.milestone-card.locked { opacity: 0.4; filter: grayscale(1); }
.milestone-icon { font-size: 2.5rem; margin-bottom: 0.5rem; }
.milestone-name { font-weight: 700; font-size: var(--font-body); }
.milestone-desc { font-size: var(--font-small); color: var(--text-secondary); margin-top: 0.3rem; }

/* ── Gallery ─────────────────────────────────────────── */
.gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1rem; }
.gallery-item {
  aspect-ratio: 4/3; border-radius: var(--radius); overflow: hidden; cursor: pointer;
  transition: transform 0.3s; border: 2px solid rgba(255,255,255,0.05);
}
.gallery-item:hover { transform: scale(1.05); }
.gallery-item img { width: 100%; height: 100%; object-fit: cover; }

/* ── Boss Battle ─────────────────────────────────────── */
.boss-mode { animation: bossFlash 0.5s ease-in-out infinite alternate; }
.boss-mode .split-panel { border-color: var(--accent-boss); box-shadow: 0 0 40px rgba(255,34,34,0.3); }
@keyframes bossGlow { from { box-shadow: 0 0 10px rgba(255,34,34,0.5); } to { box-shadow: 0 0 30px rgba(255,102,0,0.7); } }
@keyframes bossFlash { from { background: rgba(255,0,0,0.03); } to { background: rgba(255,0,0,0.08); } }

/* ── Chaos Mode ──────────────────────────────────────── */
.chaos-mode-1 { filter: hue-rotate(90deg); }
.chaos-mode-2 { animation: chaosShake 0.3s infinite; filter: saturate(2); }
.chaos-mode-3 { filter: hue-rotate(180deg) contrast(1.2); }
.chaos-mode-4 { animation: chaosRotate 4s linear infinite; }
.chaos-mode-5 { filter: invert(1); }
@keyframes chaosShake {
  0%,100% { transform: translateX(0); } 25% { transform: translateX(-5px); }
  50% { transform: translateX(5px); } 75% { transform: translateX(-3px); }
}
@keyframes chaosRotate { from { filter: hue-rotate(0deg); } to { filter: hue-rotate(360deg); } }

/* ── XP Popup ────────────────────────────────────────── */
.xp-popup {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
  font-family: 'Orbitron', sans-serif; font-size: var(--font-hero); font-weight: 900;
  background: var(--grad-xp); -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  pointer-events: none; z-index: 100; animation: xpFloat 1.5s ease-out forwards;
}
@keyframes xpFloat {
  0% { opacity: 1; transform: translate(-50%, -50%) scale(0.5); }
  50% { opacity: 1; transform: translate(-50%, -80%) scale(1.2); }
  100% { opacity: 0; transform: translate(-50%, -120%) scale(1); }
}

/* ── Milestone Popup ─────────────────────────────────── */
.milestone-popup {
  position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.7); z-index: 200; animation: fadeIn 0.3s;
}
.milestone-popup-content {
  background: var(--bg-secondary); border: 2px solid rgba(168,85,247,0.5);
  border-radius: var(--radius-lg); padding: 3rem; text-align: center;
  max-width: 500px; animation: milestoneSlam 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
@keyframes milestoneSlam {
  0% { transform: scale(0) rotate(-10deg); } 100% { transform: scale(1) rotate(0); }
}

/* ── Responsive ──────────────────────────────────────── */
@media (max-width: 768px) {
  .split-screen { grid-template-columns: 1fr; }
  .dash-grid { grid-template-columns: 1fr; }
  .rpe-buttons { flex-direction: column; align-items: center; }
  .screen { padding: 1rem; }
}

/* ── Utility ─────────────────────────────────────────── */
.hidden { display: none!important; }
.text-center { text-align: center; }
.mt-1 { margin-top: 0.5rem; } .mt-2 { margin-top: 1rem; } .mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; } .mb-2 { margin-bottom: 1rem; }
.gap-1 { gap: 0.5rem; } .gap-2 { gap: 1rem; }
.flex { display: flex; } .flex-col { flex-direction: column; }
.items-center { align-items: center; } .justify-center { justify-content: center; }
.w-full { width: 100%; }
