/* Alberta Science 10 Study Tool Styling - styles.css */

/* ==========================================================================
   1. DESIGN SYSTEM VARIABLES & THEMES
   ========================================================================== */
:root {
  /* Common Core Tokens */
  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-xl: 32px;
  --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-bounce: 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
  --spacing-unit: 8px;
  
  /* Fonts */
  --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-dyslexic: 'Lexend', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

  /* HSL Colors for Units */
  --color-chem: HSL(270, 75%, 60%);
  --color-chem-bg: HSL(270, 60%, 15%);
  --color-phys: HSL(25, 95%, 55%);
  --color-phys-bg: HSL(25, 80%, 12%);
  --color-bio: HSL(145, 75%, 45%);
  --color-bio-bg: HSL(145, 60%, 12%);
  --color-clim: HSL(195, 85%, 50%);
  --color-clim-bg: HSL(195, 70%, 12%);
  --color-final: HSL(330, 80%, 55%);
  --color-final-bg: HSL(330, 65%, 12%);
}

/* THEME 1: Default Night Neon (Sleek Dark Glow) */
.theme-default {
  --bg-app: radial-gradient(circle at top, #1a162b 0%, #0d0a15 100%);
  --bg-card: rgba(30, 25, 45, 0.7);
  --bg-card-hover: rgba(45, 38, 68, 0.85);
  --border-glow: rgba(147, 51, 234, 0.25);
  --text-main: #f3f0ff;
  --text-muted: #a78bfa;
  --primary-glow: #a855f7;
  --primary-bg: #8b5cf6;
  --primary-text: #ffffff;
  --success: #10b981;
  --success-bg: rgba(16, 185, 129, 0.15);
  --error: #ef4444;
  --error-bg: rgba(239, 68, 68, 0.15);
  --accent: #f59e0b;
  --shadow-main: 0 8px 32px rgba(0, 0, 0, 0.5);
  --bionic-weight: 800;
  --bionic-color: #ffffff;
}

/* THEME 2: Warm Cream (Dyslexia Friendly, Low Glare) */
.theme-cream {
  --bg-app: #fbf8f3;
  --bg-card: #ffffff;
  --bg-card-hover: #f5efe6;
  --border-glow: #e4dccf;
  --text-main: #2b251d;
  --text-muted: #7c7263;
  --primary-glow: #d09c6a;
  --primary-bg: #c58953;
  --primary-text: #ffffff;
  --success: #2d8a4e;
  --success-bg: #e3f2e8;
  --error: #c53838;
  --error-bg: #fcebeb;
  --accent: #d97706;
  --shadow-main: 0 8px 24px rgba(43, 37, 29, 0.08);
  --bionic-weight: 700;
  --bionic-color: #1a150e;
}

/* THEME 3: Calm Sky (Cool Pastel, ADHD Focus) */
.theme-sky {
  --bg-app: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
  --bg-card: rgba(255, 255, 255, 0.85);
  --bg-card-hover: #ffffff;
  --border-glow: #90caf9;
  --text-main: #0d253f;
  --text-muted: #5c7b9e;
  --primary-glow: #29b6f6;
  --primary-bg: #0288d1;
  --primary-text: #ffffff;
  --success: #388e3c;
  --success-bg: #e8f5e9;
  --error: #d32f2f;
  --error-bg: #ffebee;
  --accent: #f57c00;
  --shadow-main: 0 8px 24px rgba(13, 37, 63, 0.08);
  --bionic-weight: 700;
  --bionic-color: #051424;
}

/* THEME 4: Muted Obsidian (Classic Deep Dark) */
.theme-dark {
  --bg-app: #121212;
  --bg-card: #1e1e1e;
  --bg-card-hover: #292929;
  --border-glow: #333333;
  --text-main: #e0e0e0;
  --text-muted: #9e9e9e;
  --primary-glow: #4fc3f7;
  --primary-bg: #0288d1;
  --primary-text: #ffffff;
  --success: #4caf50;
  --success-bg: rgba(76, 175, 80, 0.1);
  --error: #f44336;
  --error-bg: rgba(244, 67, 54, 0.1);
  --accent: #ff9800;
  --shadow-main: 0 8px 32px rgba(0, 0, 0, 0.7);
  --bionic-weight: 700;
  --bionic-color: #ffffff;
}

/* Font Assignments */
.font-outfit {
  font-family: var(--font-sans);
}
.font-lexend {
  font-family: var(--font-dyslexic);
  letter-spacing: 0.03em;
  word-spacing: 0.08em;
}

/* Spacing Overrides */
.spacing-1 {
  letter-spacing: 0.05em;
  word-spacing: 0.12em;
}
.spacing-2 {
  letter-spacing: 0.09em;
  word-spacing: 0.18em;
  line-height: 1.8;
}
.spacing-3 {
  letter-spacing: 0.13em;
  word-spacing: 0.24em;
  line-height: 2.0;
}

/* Bionic bold markup styling */
.bionic-word strong {
  font-weight: var(--bionic-weight);
  color: var(--bionic-color);
}

/* ==========================================================================
   2. LAYOUT & CORE WRAPPER
   ========================================================================== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  background: var(--bg-app);
  color: var(--text-main);
  min-height: 100vh;
  overflow-x: hidden;
  transition: background var(--transition-normal), color var(--transition-normal);
}

/* Confetti canvas */
#confetti-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 9999;
}

.app-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--spacing-unit);
}

/* ==========================================================================
   3. HEADER & STATS BAR
   ========================================================================== */
.global-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: calc(2 * var(--spacing-unit)) var(--spacing-unit);
  border-bottom: 1px solid var(--border-glow);
  background: rgba(255, 255, 255, 0.01);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 1000;
}

.logo-btn {
  background: transparent;
  border: none;
  display: flex;
  align-items: center;
  gap: var(--spacing-unit);
  cursor: pointer;
  outline: none;
}

.logo-icon {
  font-size: 24px;
  animation: pulse-glow 2s infinite alternate;
}

.logo-text {
  font-size: 20px;
  font-weight: 800;
  color: var(--text-main);
  background: linear-gradient(90deg, var(--text-main), var(--primary-glow));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.header-right {
  display: flex;
  align-items: center;
  gap: calc(2 * var(--spacing-unit));
}

.stat-badge {
  background: var(--bg-card);
  border: 1px solid var(--border-glow);
  border-radius: var(--radius-xl);
  padding: 6px 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  font-size: 14px;
  box-shadow: var(--shadow-main);
  transition: transform var(--transition-bounce);
}

.stat-badge:hover {
  transform: scale(1.1);
}

.streak-badge {
  border-color: var(--accent);
  color: var(--accent);
}

.coins-badge {
  border-color: #ffd700;
  color: #ffd700;
}

/* XP Container */
.xp-level-container {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border-glow);
  padding: 4px 12px 4px 6px;
  border-radius: var(--radius-xl);
  min-width: 140px;
}

.level-indicator {
  background: var(--primary-bg);
  color: var(--primary-text);
  border-radius: 50%;
  width: 28px;
  height: 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  box-shadow: 0 0 10px var(--primary-glow);
}

.lvl-label {
  font-size: 6px;
  line-height: 1;
}

.lvl-number {
  font-size: 13px;
  font-weight: 800;
  line-height: 1;
}

.xp-progress-bar {
  flex-grow: 1;
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-sm);
  position: relative;
  overflow: visible;
}

.xp-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary-bg), var(--primary-glow));
  border-radius: var(--radius-sm);
  transition: width var(--transition-bounce);
}

.xp-text {
  position: absolute;
  top: 10px;
  left: 0;
  font-size: 9px;
  font-weight: 600;
  color: var(--text-muted);
}

/* Icon Button */
.icon-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-glow);
  color: var(--text-main);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform var(--transition-bounce), border-color var(--transition-fast);
}

.icon-btn:hover {
  transform: rotate(30deg) scale(1.1);
  border-color: var(--primary-glow);
}

/* ==========================================================================
   4. SCREENS SYSTEM
   ========================================================================== */
.main-content {
  flex-grow: 1;
  position: relative;
  padding: calc(2 * var(--spacing-unit)) 0;
}

.app-screen {
  display: none;
  opacity: 0;
  transform: translateY(15px);
  transition: opacity var(--transition-normal), transform var(--transition-normal);
}

.app-screen.active-screen {
  display: block;
  opacity: 1;
  transform: translateY(0);
}

/* Generic Screen headers */
.game-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: calc(3 * var(--spacing-unit));
  padding-bottom: var(--spacing-unit);
  border-bottom: 1px dashed var(--border-glow);
}

.game-header h2 {
  font-size: 20px;
  font-weight: 700;
}

.back-btn {
  background: transparent;
  border: 1px solid var(--border-glow);
  color: var(--text-muted);
  padding: 6px 14px;
  border-radius: var(--radius-xl);
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.back-btn:hover {
  background: var(--bg-card-hover);
  color: var(--text-main);
}

/* ==========================================================================
   5. SCREEN 1: DASHBOARD
   ========================================================================== */
.welcome-banner {
  background: var(--bg-card);
  border: 1px solid var(--border-glow);
  border-radius: var(--radius-lg);
  padding: calc(3 * var(--spacing-unit));
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: calc(3 * var(--spacing-unit));
  margin-bottom: calc(4 * var(--spacing-unit));
  box-shadow: var(--shadow-main);
  backdrop-filter: blur(10px);
}

.welcome-text h1 {
  font-size: 28px;
  font-weight: 800;
  margin-bottom: var(--spacing-unit);
}

.welcome-text p {
  color: var(--text-muted);
  max-width: 600px;
  line-height: 1.5;
}

/* Radial Progress Circle widget */
.overall-progress-card {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 140px;
}

.progress-ring-container {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.progress-ring-circle {
  transition: stroke-dashoffset 0.6s ease;
  transform: rotate(-90deg);
  transform-origin: 50% 50%;
}

.progress-ring-text {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.progress-percentage {
  font-size: 22px;
  font-weight: 800;
  color: var(--text-main);
}

.progress-label {
  font-size: 9px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Dynamic Units Container */
.units-card-container {
  display: grid;
  grid-template-columns: 1fr;
  gap: calc(3 * var(--spacing-unit));
}

@media (min-width: 768px) {
  .units-card-container {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Unit Cards */
.unit-card {
  background: var(--bg-card);
  border: 1px solid var(--border-glow);
  border-radius: var(--radius-lg);
  padding: calc(3 * var(--spacing-unit));
  display: flex;
  flex-direction: column;
  gap: calc(2 * var(--spacing-unit));
  transition: transform var(--transition-bounce), border-color var(--transition-fast);
  box-shadow: var(--shadow-main);
  position: relative;
  overflow: hidden;
}

.unit-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 6px;
  height: 100%;
  background: var(--unit-accent);
}

.unit-card:hover {
  transform: translateY(-4px);
  border-color: var(--unit-accent);
}

/* Custom properties mapped for each unit accent */
.unit-card.theme-chemistry { --unit-accent: var(--color-chem); }
.unit-card.theme-physics { --unit-accent: var(--color-phys); }
.unit-card.theme-biology { --unit-accent: var(--color-bio); }
.unit-card.theme-climate { --unit-accent: var(--color-clim); }
.unit-card.theme-final { --unit-accent: var(--color-final); }

.unit-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.unit-info-left {
  display: flex;
  align-items: center;
  gap: calc(1.5 * var(--spacing-unit));
}

.unit-icon {
  font-size: 28px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-md);
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 0 10px rgba(255,255,255,0.05);
}

.unit-details h3 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 2px;
}

.unit-details span {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.unit-badge-status {
  background: var(--unit-accent);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: var(--radius-xl);
  box-shadow: 0 0 10px var(--unit-accent);
}

.unit-progress-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.unit-progress-header {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}

.unit-progress-track {
  height: 6px;
  background: rgba(255,255,255,0.08);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.unit-progress-fill {
  height: 100%;
  background: var(--unit-accent);
  border-radius: var(--radius-sm);
  transition: width var(--transition-bounce);
}

/* Play game modes drawer/grid inside card */
.unit-modes-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--spacing-unit);
  margin-top: var(--spacing-unit);
}

.mode-btn {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-glow);
  border-radius: var(--radius-md);
  padding: 10px;
  color: var(--text-main);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  transition: background var(--transition-fast), border-color var(--transition-fast), transform var(--transition-bounce);
}

.mode-btn span:first-child {
  font-size: 18px;
}

.mode-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--unit-accent);
  transform: scale(1.03);
}

.mode-btn:active {
  transform: scale(0.98);
}

/* ==========================================================================
   6. SCREEN 2: TINDER SWIPE
   ========================================================================== */
.swipe-game-container {
  max-width: 480px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: calc(2 * var(--spacing-unit));
}

.swipe-instruction {
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
}

.swiper-area {
  position: relative;
  width: 100%;
  height: 380px;
  perspective: 1000px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Swipe Flags */
.swipe-flag {
  position: absolute;
  top: 30px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 18px;
  font-weight: 800;
  z-index: 100;
  opacity: 0;
  transform: rotate(-10deg);
  pointer-events: none;
  transition: opacity var(--transition-fast);
}

.review-flag {
  left: 20px;
  border: 3px solid var(--error);
  color: var(--error);
  background: var(--bg-app);
}

.gotit-flag {
  right: 20px;
  border: 3px solid var(--success);
  color: var(--success);
  background: var(--bg-app);
  transform: rotate(10deg);
}

.card-deck {
  position: relative;
  width: 90%;
  height: 90%;
}

/* Tinder Card base */
.tinder-card {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: var(--radius-lg);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  cursor: grab;
  transform-style: preserve-3d;
  transition: transform var(--transition-bounce), opacity var(--transition-normal);
  user-select: none;
}

.tinder-card:active {
  cursor: grabbing;
}

/* Card faces */
.card-face {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: var(--radius-lg);
  backface-visibility: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: calc(3 * var(--spacing-unit));
  text-align: center;
  border: 2px solid var(--border-glow);
}

.card-face-front {
  background: var(--bg-card);
  color: var(--text-main);
}

.card-face-front::after {
  content: '👆 Tap to reveal definition';
  position: absolute;
  bottom: 20px;
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
}

.card-face-back {
  background: var(--bg-card-hover);
  color: var(--text-main);
  transform: rotateY(180deg);
  border-color: var(--primary-glow);
}

.card-face-back::after {
  content: '👈 Swipe Left (Review)   |   Swipe Right (Got It) 👉';
  position: absolute;
  bottom: 20px;
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
}

/* Term styling */
.tinder-card .term-display {
  font-size: 26px;
  font-weight: 800;
  margin-bottom: var(--spacing-unit);
  color: var(--primary-glow);
}

.tinder-card .definition-display {
  font-size: 16px;
  line-height: 1.6;
  font-weight: 500;
}

/* Card flipped state */
.tinder-card.is-flipped {
  transform: rotateY(180deg);
}

/* Bottom Actions */
.swipe-action-buttons {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: calc(2 * var(--spacing-unit));
  width: 100%;
}

.swipe-action-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-glow);
  color: var(--text-main);
  padding: 12px 20px;
  border-radius: var(--radius-xl);
  font-weight: 700;
  cursor: pointer;
  transition: transform var(--transition-bounce), background var(--transition-fast);
  box-shadow: var(--shadow-main);
}

.swipe-action-btn.btn-no {
  border-color: var(--error);
  color: var(--error);
}

.swipe-action-btn.btn-no:hover {
  background: var(--error);
  color: #fff;
  transform: scale(1.05);
}

.swipe-action-btn.btn-yes {
  border-color: var(--success);
  color: var(--success);
}

.swipe-action-btn.btn-yes:hover {
  background: var(--success);
  color: #fff;
  transform: scale(1.05);
}

.swipe-action-btn.btn-flip {
  border-color: var(--primary-glow);
  color: var(--primary-glow);
}

.swipe-action-btn.btn-flip:hover {
  background: var(--primary-bg);
  color: #fff;
  transform: scale(1.05);
}

/* ==========================================================================
   7. SCREEN 3: DUALINGO SPEED RUN (QUIZ)
   ========================================================================== */
.quiz-game-container {
  max-width: 600px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: calc(3 * var(--spacing-unit));
  position: relative;
  overflow: hidden;
}

/* Timer progress bar */
.timer-container {
  width: 150px;
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.timer-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #f43f5e);
  width: 100%;
  transition: width 0.1s linear;
}

/* Question card */
.question-card {
  background: var(--bg-card);
  border: 1px solid var(--border-glow);
  border-radius: var(--radius-lg);
  padding: calc(3 * var(--spacing-unit)) calc(4 * var(--spacing-unit));
  position: relative;
  box-shadow: var(--shadow-main);
}

.speak-btn {
  position: absolute;
  top: 15px;
  right: 15px;
  background: rgba(255,255,255,0.05);
  border: none;
  font-size: 16px;
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background var(--transition-fast);
}

.speak-btn:hover {
  background: rgba(255,255,255,0.15);
}

.question-text {
  font-size: 18px;
  font-weight: 600;
  line-height: 1.6;
}

/* Quiz Answers */
.quiz-choices-grid {
  display: flex;
  flex-direction: column;
  gap: calc(1.5 * var(--spacing-unit));
}

.choice-btn {
  background: var(--bg-card);
  border: 2px solid var(--border-glow);
  color: var(--text-main);
  padding: calc(2 * var(--spacing-unit)) calc(3 * var(--spacing-unit));
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: transform var(--transition-bounce), border-color var(--transition-fast), background var(--transition-fast);
  box-shadow: var(--shadow-main);
}

.choice-btn:hover {
  border-color: var(--primary-glow);
  background: var(--bg-card-hover);
  transform: translateY(-2px);
}

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

.choice-prefix {
  width: 28px;
  height: 28px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-glow);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 12px;
  flex-shrink: 0;
}

/* Choice States */
.choice-btn.is-correct {
  border-color: var(--success);
  background: var(--success-bg);
  box-shadow: 0 0 15px rgba(16, 185, 129, 0.2);
}

.choice-btn.is-correct .choice-prefix {
  background: var(--success);
  color: #fff;
  border-color: var(--success);
}

.choice-btn.is-incorrect {
  border-color: var(--error);
  background: var(--error-bg);
  animation: shake 0.4s ease;
}

.choice-btn.is-incorrect .choice-prefix {
  background: var(--error);
  color: #fff;
  border-color: var(--error);
}

/* Feedback Drawer slide up */
.feedback-panel {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  background: var(--bg-card-hover);
  border: 2px solid var(--primary-glow);
  border-radius: var(--radius-lg);
  padding: calc(3 * var(--spacing-unit));
  box-shadow: var(--shadow-main);
  transform: translateY(110%);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.4s ease;
  display: flex;
  flex-direction: column;
  gap: calc(2 * var(--spacing-unit));
  z-index: 100;
  backdrop-filter: blur(12px);
}

.feedback-panel.active-panel {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.feedback-header {
  display: flex;
  align-items: center;
  gap: var(--spacing-unit);
}

.feedback-icon {
  font-size: 24px;
}

.feedback-title {
  font-size: 20px;
  font-weight: 800;
}

.xp-earned {
  margin-left: auto;
  background: var(--accent);
  color: #fff;
  padding: 4px 10px;
  border-radius: var(--radius-xl);
  font-size: 12px;
  font-weight: 800;
  box-shadow: 0 0 8px var(--accent);
}

.feedback-explanation {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-main);
}

.primary-action-btn {
  background: var(--primary-bg);
  color: var(--primary-text);
  border: none;
  padding: 14px;
  border-radius: var(--radius-md);
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
  transition: transform var(--transition-bounce), background var(--transition-fast);
  box-shadow: 0 4px 15px rgba(139, 92, 246, 0.4);
}

.primary-action-btn:hover {
  background: var(--primary-glow);
  transform: scale(1.03);
}

.primary-action-btn:active {
  transform: scale(0.98);
}

/* ==========================================================================
   8. SCREEN 4: MATCH MAKER
   ========================================================================== */
.match-game-container {
  max-width: 800px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: calc(2 * var(--spacing-unit));
}

.match-moves-combo {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 700;
  font-size: 14px;
}

.combo-gauge {
  background: var(--accent);
  color: #fff;
  padding: 4px 12px;
  border-radius: var(--radius-xl);
  animation: pulse-glow 1.5s infinite alternate;
}

.match-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: calc(1.5 * var(--spacing-unit));
}

@media (min-width: 600px) {
  .match-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.match-card {
  background: var(--bg-card);
  border: 2px solid var(--border-glow);
  border-radius: var(--radius-md);
  padding: calc(2 * var(--spacing-unit));
  min-height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: transform var(--transition-bounce), border-color var(--transition-fast), background var(--transition-fast);
  box-shadow: var(--shadow-main);
  user-select: none;
}

.match-card:hover {
  transform: translateY(-3px);
  border-color: var(--primary-glow);
  background: var(--bg-card-hover);
}

.match-card.is-selected {
  border-color: var(--primary-bg);
  background: rgba(139, 92, 246, 0.1);
  transform: scale(1.05);
}

.match-card.is-correct {
  border-color: var(--success);
  background: var(--success-bg);
  animation: bounce-pop 0.5s ease;
  pointer-events: none;
}

.match-card.is-incorrect {
  border-color: var(--error);
  background: var(--error-bg);
  animation: shake 0.4s ease;
}

.match-card.is-cleared {
  opacity: 0.15;
  pointer-events: none;
  border-color: transparent;
  background: transparent;
  box-shadow: none;
  transform: scale(0.9);
}

/* ==========================================================================
   9. SCREEN 5: VAULT CODE CRACKER (NUMERICAL)
   ========================================================================== */
.code-game-container {
  max-width: 480px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: calc(2.5 * var(--spacing-unit));
  position: relative;
  overflow: hidden;
}

.vault-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: calc(2 * var(--spacing-unit));
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border-glow);
  padding: calc(3 * var(--spacing-unit));
  border-radius: var(--radius-lg);
  backdrop-filter: blur(10px);
}

/* CSS safe wheel design */
.vault-dial-wrapper {
  position: relative;
  width: 140px;
  height: 140px;
}

.vault-outer-ring {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: radial-gradient(circle, #3a3250 30%, #1e192c 80%);
  border: 6px solid #4a3e68;
  box-shadow: 0 10px 20px rgba(0,0,0,0.4), inset 0 0 15px rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 1.5s cubic-bezier(0.25, 1, 0.5, 1);
}

.vault-outer-ring.unlocked {
  transform: rotate(360deg);
  border-color: var(--success);
}

.vault-inner-wheel {
  font-size: 40px;
  filter: drop-shadow(0 0 10px rgba(0,0,0,0.5));
}

.vault-slots {
  display: flex;
  gap: 12px;
}

.vault-slot {
  width: 44px;
  height: 54px;
  background: rgba(0,0,0,0.3);
  border: 2px solid var(--border-glow);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 800;
  color: var(--primary-glow);
  box-shadow: inset 0 2px 8px rgba(0,0,0,0.8);
}

.vault-slot.active-slot {
  border-color: var(--primary-bg);
  box-shadow: inset 0 2px 8px rgba(0,0,0,0.8), 0 0 8px var(--primary-bg);
}

.vault-unlock-btn {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  padding: 14px;
  width: 100%;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.4);
  transition: transform var(--transition-bounce), background var(--transition-fast);
}

.vault-unlock-btn:hover {
  transform: scale(1.02);
  filter: brightness(1.1);
}

/* Keypad styling */
.keypad-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.key-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-glow);
  color: var(--text-main);
  padding: 16px;
  border-radius: var(--radius-md);
  font-size: 20px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--shadow-main);
  transition: transform var(--transition-fast), background var(--transition-fast);
}

.key-btn:hover {
  background: var(--bg-card-hover);
  transform: scale(1.05);
}

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

.key-btn.danger {
  color: var(--error);
  font-size: 14px;
}

/* ==========================================================================
   10. DRAWER: ACCESSIBILITY DRAWER & OVERLAYS
   ========================================================================== */
.drawer-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0,0,0,0.6);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-normal);
  z-index: 2000;
  backdrop-filter: blur(4px);
}

.drawer-overlay.active-drawer {
  opacity: 1;
  pointer-events: auto;
}

.drawer-panel {
  position: absolute;
  top: 0;
  right: 0;
  width: 100%;
  max-width: 420px;
  height: 100%;
  background: var(--bg-card);
  border-left: 1px solid var(--border-glow);
  box-shadow: -10px 0 30px rgba(0,0,0,0.3);
  transform: translateX(100%);
  transition: transform var(--transition-normal);
  display: flex;
  flex-direction: column;
}

.drawer-overlay.active-drawer .drawer-panel {
  transform: translateX(0);
}

.drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: calc(2.5 * var(--spacing-unit));
  border-bottom: 1px solid var(--border-glow);
}

.drawer-header h3 {
  font-size: 18px;
  font-weight: 800;
}

.drawer-body {
  padding: calc(2.5 * var(--spacing-unit));
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: calc(3 * var(--spacing-unit));
  flex-grow: 1;
}

/* Toggle Switches */
.control-group {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.control-group-column {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.control-label {
  display: flex;
  flex-direction: column;
}

.control-label span {
  font-weight: 700;
  font-size: 15px;
}

.control-label small {
  color: var(--text-muted);
  font-size: 11px;
  margin-top: 2px;
}

.control-label-row {
  display: flex;
  justify-content: space-between;
  font-weight: 700;
  font-size: 15px;
}

/* iOS-style Switch */
.switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 26px;
  flex-shrink: 0;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider-round {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255,255,255,0.1);
  transition: .3s;
  border-radius: 34px;
  border: 1px solid var(--border-glow);
}

.slider-round:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
}

input:checked + .slider-round {
  background-color: var(--success);
}

input:checked + .slider-round:before {
  transform: translateX(22px);
}

/* Spacing Slider */
.spacing-slider {
  -webkit-appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: rgba(255,255,255,0.1);
  outline: none;
}

.spacing-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--primary-bg);
  cursor: pointer;
  box-shadow: 0 0 10px var(--primary-glow);
  transition: transform 0.1s;
}

.spacing-slider::-webkit-slider-thumb:hover {
  transform: scale(1.15);
}

/* Themes list in settings drawer */
.theme-options {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.theme-opt {
  padding: 10px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-glow);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: border-color var(--transition-fast), background var(--transition-fast);
}

.theme-opt.btn-theme-default { background: #1e192c; color: #f3f0ff; }
.theme-opt.btn-theme-cream { background: #fbf8f3; color: #2b251d; }
.theme-opt.btn-theme-sky { background: #bbdefb; color: #0d253f; }
.theme-opt.btn-theme-dark { background: #121212; color: #e0e0e0; }

.theme-opt.active {
  border-color: var(--primary-bg);
  box-shadow: 0 0 8px var(--primary-glow);
}

/* ==========================================================================
   11. MODAL OVERLAYS (LEVEL UP)
   ========================================================================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0,0,0,0.8);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 3000;
  padding: calc(3 * var(--spacing-unit));
}

.modal-overlay.active-modal {
  display: flex;
}

.levelup-card {
  background: var(--bg-card);
  border: 2px solid var(--accent);
  border-radius: var(--radius-xl);
  padding: calc(4 * var(--spacing-unit));
  max-width: 400px;
  width: 100%;
  text-align: center;
  box-shadow: 0 15px 40px rgba(0,0,0,0.5);
  animation: scale-up 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
  display: flex;
  flex-direction: column;
  gap: calc(2 * var(--spacing-unit));
  backdrop-filter: blur(12px);
}

.levelup-badge {
  font-size: 72px;
  animation: bounce-pulse 2s infinite alternate;
}

.levelup-card h2 {
  font-size: 32px;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: 0.05em;
  background: linear-gradient(135deg, var(--accent), #f43f5e);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.levelup-card .subtitle {
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
}

.level-stats {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: calc(2 * var(--spacing-unit));
  margin: calc(2 * var(--spacing-unit)) 0;
}

.level-stats .old-level,
.level-stats .new-level {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 800;
}

.level-stats .old-level {
  background: rgba(255,255,255,0.05);
  border: 2px solid var(--border-glow);
  color: var(--text-muted);
}

.level-stats .new-level {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 0 20px var(--accent);
  animation: pulse-glow-heavy 1.5s infinite alternate;
}

.level-stats .arrow {
  font-size: 24px;
  color: var(--text-muted);
}

.reward-text {
  font-size: 15px;
}

.reward-text strong {
  color: #ffd700;
}

/* ==========================================================================
   12. FOOTER & MISC
   ========================================================================== */
.app-footer {
  text-align: center;
  padding: calc(3 * var(--spacing-unit)) 0;
  border-top: 1px solid var(--border-glow);
  margin-top: calc(4 * var(--spacing-unit));
}

.app-footer p {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
}

/* Floating XP popup text animation */
.floating-xp {
  position: absolute;
  font-weight: 800;
  color: #ffd700;
  font-size: 18px;
  pointer-events: none;
  z-index: 1000;
  animation: float-fade 1.2s cubic-bezier(0.1, 0.8, 0.3, 1) forwards;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
}

/* ==========================================================================
   13. KEYFRAME ANIMATIONS
   ========================================================================== */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}

@keyframes scale-up {
  0% { transform: scale(0.8); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes float-fade {
  0% { transform: translateY(0) scale(1); opacity: 1; }
  100% { transform: translateY(-80px) scale(1.1); opacity: 0; }
}

@keyframes bounce-pop {
  0% { transform: scale(1); }
  50% { transform: scale(1.08); }
  100% { transform: scale(1); }
}

@keyframes bounce-pulse {
  0% { transform: translateY(0) scale(1); }
  100% { transform: translateY(-10px) scale(1.05); }
}

@keyframes pulse-glow {
  0% { filter: drop-shadow(0 0 2px rgba(255,255,255,0.1)); }
  100% { filter: drop-shadow(0 0 10px var(--primary-glow)); }
}

@keyframes pulse-glow-heavy {
  0% { box-shadow: 0 0 10px var(--accent); }
  100% { box-shadow: 0 0 30px var(--accent); }
}
