/* =========================================================
   SkyLearn English: Weather & Natural Disasters
   Modern Design System, Glassmorphism & Atmospheric Themes
   ========================================================= */

:root {
  /* Color Palette - Default Sky Day */
  --bg-gradient-top: #38bdf8;
  --bg-gradient-bottom: #bae6fd;
  --header-bg: rgba(255, 255, 255, 0.75);
  --card-bg: rgba(255, 255, 255, 0.82);
  --card-border: rgba(255, 255, 255, 0.6);
  --card-shadow: 0 10px 30px rgba(2, 132, 199, 0.12);
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;

  /* Brand Accents */
  --accent-primary: #0284c7;
  --accent-primary-hover: #0369a1;
  --accent-gold: #f59e0b;
  --accent-gold-hover: #d97706;
  --accent-green: #10b981;
  --accent-red: #ef4444;
  --accent-purple: #8b5cf6;

  /* Glassmorphism Tokens */
  --glass-blur: blur(16px);
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --radius-full: 9999px;
  --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-spring: 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Theme: Stormy Atmosphere */
body.theme-storm {
  --bg-gradient-top: #1e293b;
  --bg-gradient-bottom: #334155;
  --header-bg: rgba(30, 41, 59, 0.85);
  --card-bg: rgba(30, 41, 59, 0.88);
  --card-border: rgba(148, 163, 184, 0.2);
  --card-shadow: 0 10px 35px rgba(0, 0, 0, 0.35);
  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --accent-primary: #38bdf8;
  --accent-primary-hover: #0284c7;
}

/* Theme: Starry Night */
body.theme-night {
  --bg-gradient-top: #0f172a;
  --bg-gradient-bottom: #1e1b4b;
  --header-bg: rgba(15, 23, 42, 0.85);
  --card-bg: rgba(23, 23, 56, 0.85);
  --card-border: rgba(129, 140, 248, 0.25);
  --card-shadow: 0 10px 35px rgba(0, 0, 0, 0.45);
  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --accent-primary: #818cf8;
  --accent-primary-hover: #6366f1;
}

/* Reset & Base */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--text-primary);
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  background: linear-gradient(180deg, var(--bg-gradient-top) 0%, var(--bg-gradient-bottom) 100%);
  transition: background 0.6s ease, color 0.4s ease;
  display: flex;
  flex-direction: column;
}

h1, h2, h3, h4, .font-heading {
  font-family: 'Outfit', sans-serif;
  letter-spacing: -0.02em;
}

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

/* Dynamic Weather Backdrop Elements */
.weather-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.weather-sun {
  position: absolute;
  top: -40px;
  right: 5%;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: radial-gradient(circle, #fde047 30%, rgba(251, 191, 36, 0.5) 60%, rgba(245, 158, 11, 0) 80%);
  filter: blur(8px);
  animation: pulseSun 8s infinite alternate ease-in-out;
  transition: opacity 0.5s ease;
}

body.theme-storm .weather-sun {
  opacity: 0.1;
}

body.theme-night .weather-sun {
  background: radial-gradient(circle, #f8fafc 25%, rgba(226, 232, 240, 0.3) 50%, rgba(255, 255, 255, 0) 75%);
  filter: blur(4px);
  width: 120px;
  height: 120px;
}

@keyframes pulseSun {
  0% { transform: scale(0.95); opacity: 0.85; }
  100% { transform: scale(1.1); opacity: 1; }
}

.cloud {
  position: absolute;
  background: rgba(255, 255, 255, 0.35);
  border-radius: 100px;
  filter: blur(20px);
}

.cloud-1 {
  width: 320px;
  height: 120px;
  top: 15%;
  left: -50px;
  animation: floatCloud1 45s infinite linear;
}

.cloud-2 {
  width: 480px;
  height: 140px;
  top: 35%;
  right: -100px;
  animation: floatCloud2 55s infinite linear;
}

.cloud-3 {
  width: 250px;
  height: 90px;
  bottom: 20%;
  left: 20%;
  animation: floatCloud1 60s infinite linear reverse;
}

@keyframes floatCloud1 {
  0% { transform: translateX(-150px); }
  100% { transform: translateX(calc(100vw + 200px)); }
}

@keyframes floatCloud2 {
  0% { transform: translateX(150px); }
  100% { transform: translateX(calc(-100vw - 200px)); }
}

/* Rain Effect Container */
.rain-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 0.6s ease;
}

body.theme-storm .rain-container {
  opacity: 0.7;
}

.raindrop {
  position: absolute;
  background: linear-gradient(transparent, rgba(186, 230, 253, 0.8));
  width: 2px;
  height: 24px;
  animation: fallRain 0.8s linear infinite;
}

@keyframes fallRain {
  0% { transform: translateY(-30px); }
  100% { transform: translateY(100vh); }
}

/* Container */
.container {
  width: 100%;
  max-width: 1140px;
  margin: 0 auto;
  padding: 0 20px;
  position: relative;
  z-index: 10;
}

/* ================= HEADER ================= */
.main-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--header-bg);
  backdrop-filter: var(--glass-blur);
  border-bottom: 1px solid var(--card-border);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
  transition: background 0.3s ease;
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  flex-wrap: wrap;
  gap: 16px;
}

.logo-group {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo-icon-wrap {
  position: relative;
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, #0284c7, #38bdf8);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 18px rgba(2, 132, 199, 0.3);
}

.logo-emoji {
  font-size: 26px;
  animation: gentleBob 3s infinite ease-in-out;
}

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

.logo-text h1 {
  font-size: 1.45rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 8px;
  line-height: 1.2;
}

.badge-tag {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 8px;
  background: linear-gradient(135deg, #f59e0b, #ef4444);
  color: #fff;
  border-radius: var(--radius-full);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.subtitle {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

.header-stats {
  display: flex;
  align-items: center;
  gap: 12px;
}

.stat-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  padding: 6px 14px;
  border-radius: var(--radius-full);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.pill-icon {
  font-size: 18px;
}

.pill-data {
  display: flex;
  flex-direction: column;
}

.pill-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--text-muted);
}

.pill-value {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--accent-primary);
}

.streak-pill .pill-value {
  color: var(--accent-gold);
}

.icon-action-btn {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  width: 42px;
  height: 42px;
  border-radius: var(--radius-full);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 19px;
  transition: var(--transition-fast);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.icon-action-btn:hover {
  transform: scale(1.08);
  border-color: var(--accent-primary);
}

/* ================= NAV TABS ================= */
.nav-bar {
  padding-bottom: 8px;
}

.nav-tabs {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 4px 0 8px;
  scrollbar-width: none;
}

.nav-tabs::-webkit-scrollbar {
  display: none;
}

.nav-tab {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-full);
  font-family: 'Outfit', sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition-fast);
  white-space: nowrap;
}

.nav-tab:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.35);
}

.nav-tab.active {
  color: #fff;
  background: var(--accent-primary);
  box-shadow: 0 6px 18px rgba(2, 132, 199, 0.35);
  border-color: rgba(255, 255, 255, 0.3);
}

.tab-badge {
  font-size: 0.65rem;
  background: #ef4444;
  color: white;
  padding: 2px 6px;
  border-radius: var(--radius-full);
  font-weight: 700;
  text-transform: uppercase;
}

/* ================= MAIN CONTENT ================= */
.main-content {
  padding-top: 28px;
  padding-bottom: 50px;
  flex: 1;
}

.game-view {
  display: none;
  animation: fadeIn 0.4s ease forwards;
}

.game-view.active {
  display: block;
}

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

/* Common Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--radius-md);
  font-family: 'Outfit', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: var(--transition-spring);
  text-decoration: none;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-primary), #0369a1);
  color: #fff;
  box-shadow: 0 6px 20px rgba(2, 132, 199, 0.35);
}

.btn-primary:hover {
  box-shadow: 0 8px 24px rgba(2, 132, 199, 0.5);
  transform: translateY(-2px);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.6);
  color: var(--text-primary);
  border: 1px solid var(--card-border);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.85);
  transform: translateY(-2px);
}

.btn-outline {
  background: transparent;
  color: var(--text-primary);
  border: 1.5px solid var(--card-border);
}

.btn-outline:hover {
  background: rgba(255, 255, 255, 0.4);
  border-color: var(--accent-primary);
}

.btn-large {
  padding: 16px 36px;
  font-size: 1.15rem;
  border-radius: var(--radius-lg);
}

.btn-sm {
  padding: 8px 14px;
  font-size: 0.85rem;
  border-radius: var(--radius-sm);
}

/* ================= TAB 1: VOCABULARY LAB ================= */
.view-header {
  margin-bottom: 28px;
}

.view-intro h2 {
  font-size: 1.85rem;
  font-weight: 800;
  margin-bottom: 6px;
}

.view-intro p {
  color: var(--text-secondary);
  font-size: 1.05rem;
  max-width: 720px;
}

.filter-controls {
  margin-top: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.search-box {
  display: flex;
  align-items: center;
  background: var(--card-bg);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--card-border);
  padding: 10px 16px;
  border-radius: var(--radius-full);
  min-width: 280px;
  flex: 1;
  max-width: 440px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.04);
}

.search-icon {
  margin-right: 10px;
  font-size: 16px;
  opacity: 0.7;
}

.search-box input {
  border: none;
  background: transparent;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.95rem;
  width: 100%;
  outline: none;
}

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

.category-filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.filter-btn {
  padding: 8px 16px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  color: var(--text-secondary);
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  font-size: 0.88rem;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: var(--transition-fast);
}

.filter-btn:hover {
  color: var(--text-primary);
  border-color: var(--accent-primary);
}

.filter-btn.active {
  background: var(--accent-primary);
  color: #fff;
  border-color: var(--accent-primary);
}

/* Vocab Cards Grid */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 20px;
}

.vocab-card {
  background: var(--card-bg);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--card-shadow);
  display: flex;
  flex-direction: column;
  position: relative;
  transition: var(--transition-normal);
  overflow: hidden;
}

.vocab-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 16px 36px rgba(2, 132, 199, 0.22);
  border-color: rgba(2, 132, 199, 0.4);
}

.vocab-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}

.vocab-icon {
  font-size: 40px;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.1));
}

.tag-disaster {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.3);
  font-size: 0.7rem;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: var(--radius-full);
}

.tag-weather {
  background: rgba(2, 132, 199, 0.15);
  color: #0284c7;
  border: 1px solid rgba(2, 132, 199, 0.3);
  font-size: 0.7rem;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: var(--radius-full);
}

.vocab-word-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.vocab-word {
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--text-primary);
}

.vocab-ipa {
  font-size: 0.88rem;
  color: var(--accent-purple);
  font-style: italic;
  margin-bottom: 8px;
}

.vocab-meaning {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 10px;
  line-height: 1.35;
}

.vocab-example {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.45;
  background: rgba(0, 0, 0, 0.04);
  padding: 10px 12px;
  border-radius: var(--radius-md);
  margin-top: auto;
  border-left: 3px solid var(--accent-primary);
}

.speak-btn-card {
  width: 36px;
  height: 36px;
  background: var(--accent-primary);
  color: white;
  border: none;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
  transition: var(--transition-fast);
  box-shadow: 0 4px 10px rgba(2, 132, 199, 0.3);
}

.speak-btn-card:hover {
  transform: scale(1.12);
  background: var(--accent-primary-hover);
}

/* ================= TAB 2: QUIZ CHALLENGE ================= */
.game-start-card,
.quiz-active-card,
.game-result-card,
.game-panel {
  background: var(--card-bg);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-xl);
  padding: 36px 30px;
  box-shadow: var(--card-shadow);
  max-width: 780px;
  margin: 0 auto;
}

.game-start-card {
  text-align: center;
}

.start-badge {
  display: inline-block;
  padding: 6px 16px;
  background: rgba(2, 132, 199, 0.15);
  color: var(--accent-primary);
  font-size: 0.8rem;
  font-weight: 800;
  border-radius: var(--radius-full);
  margin-bottom: 14px;
}

.game-start-card h2 {
  font-size: 2.2rem;
  font-weight: 800;
  margin-bottom: 12px;
}

.game-start-card p {
  color: var(--text-secondary);
  font-size: 1.1rem;
  max-width: 580px;
  margin: 0 auto 30px;
  line-height: 1.6;
}

.quiz-highlights {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-bottom: 35px;
  flex-wrap: wrap;
}

.highlight-item {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.4);
  padding: 10px 18px;
  border-radius: var(--radius-full);
  font-weight: 600;
  font-size: 0.95rem;
  border: 1px solid var(--card-border);
}

.h-icon {
  font-size: 20px;
}

/* Quiz Active Screen */
.quiz-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--card-border);
}

.question-progress {
  flex: 1;
  max-width: 280px;
}

.progress-text {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-muted);
  display: block;
  margin-bottom: 6px;
}

.progress-bar-track {
  width: 100%;
  height: 8px;
  background: rgba(0, 0, 0, 0.08);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  width: 10%;
  background: linear-gradient(90deg, var(--accent-primary), #06b6d4);
  border-radius: var(--radius-full);
  transition: width 0.3s ease;
}

.quiz-timer {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(239, 68, 68, 0.12);
  color: #ef4444;
  padding: 8px 16px;
  border-radius: var(--radius-full);
  font-weight: 700;
  font-size: 1.1rem;
}

.quiz-timer.warning {
  animation: pulseWarning 0.6s infinite alternate;
}

@keyframes pulseWarning {
  0% { transform: scale(1); background: rgba(239, 68, 68, 0.15); }
  100% { transform: scale(1.08); background: rgba(239, 68, 68, 0.35); }
}

.quiz-score-badge {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--accent-gold);
}

.question-category-tag {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  background: rgba(2, 132, 199, 0.15);
  color: var(--accent-primary);
  margin-bottom: 12px;
}

.question-prompt-wrap {
  text-align: center;
  padding: 20px 10px;
  margin-bottom: 24px;
}

.question-illustration {
  font-size: 64px;
  margin-bottom: 14px;
  filter: drop-shadow(0 6px 12px rgba(0,0,0,0.12));
  animation: gentleBob 3s infinite ease-in-out;
}

.question-text {
  font-size: 1.45rem;
  font-weight: 700;
  line-height: 1.4;
  margin-bottom: 12px;
}

.speech-listen-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: rgba(255, 255, 255, 0.4);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-full);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--accent-primary);
  cursor: pointer;
  transition: var(--transition-fast);
}

.speech-listen-btn:hover {
  background: var(--accent-primary);
  color: white;
}

/* Options Grid */
.options-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 24px;
}

@media (max-width: 640px) {
  .options-grid {
    grid-template-columns: 1fr;
  }
}

.option-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  background: rgba(255, 255, 255, 0.55);
  border: 2px solid var(--card-border);
  border-radius: var(--radius-md);
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
  text-align: left;
  transition: var(--transition-fast);
}

.option-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.9);
  border-color: var(--accent-primary);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(2, 132, 199, 0.15);
}

.option-prefix {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  font-weight: 800;
  flex-shrink: 0;
}

.option-btn.correct {
  background: rgba(16, 185, 129, 0.2);
  border-color: var(--accent-green);
  color: #065f46;
}

body.theme-storm .option-btn.correct,
body.theme-night .option-btn.correct {
  color: #34d399;
}

.option-btn.correct .option-prefix {
  background: var(--accent-green);
  color: white;
}

.option-btn.wrong {
  background: rgba(239, 68, 68, 0.2);
  border-color: var(--accent-red);
  color: #991b1b;
  animation: shake 0.4s ease;
}

body.theme-storm .option-btn.wrong,
body.theme-night .option-btn.wrong {
  color: #f87171;
}

.option-btn.wrong .option-prefix {
  background: var(--accent-red);
  color: white;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-8px); }
  40%, 80% { transform: translateX(8px); }
}

/* Answer feedback */
.answer-feedback {
  background: rgba(255, 255, 255, 0.45);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  animation: fadeIn 0.3s ease;
}

.feedback-badge {
  font-size: 1.05rem;
  font-weight: 800;
}

.feedback-badge.success {
  color: var(--accent-green);
}

.feedback-badge.error {
  color: var(--accent-red);
}

.feedback-explanation {
  flex: 1;
  font-size: 0.92rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

/* Quiz Result Screen */
.game-result-card {
  text-align: center;
}

.result-trophy {
  font-size: 72px;
  margin-bottom: 12px;
  animation: bounceIn 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes bounceIn {
  0% { transform: scale(0.3); opacity: 0; }
  70% { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(1); }
}

.result-stats-board {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin: 28px 0;
}

@media (max-width: 600px) {
  .result-stats-board {
    grid-template-columns: 1fr;
  }
}

.r-stat {
  background: rgba(255, 255, 255, 0.4);
  border: 1px solid var(--card-border);
  padding: 16px;
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.r-stat-label {
  font-size: 0.8rem;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--text-muted);
}

.r-stat-val {
  font-size: 1.6rem;
  font-weight: 800;
}

.r-stat-val.highlight {
  color: var(--accent-primary);
}

.r-stat-val.gold {
  color: var(--accent-gold);
}

.r-stat-val.fire {
  color: #ef4444;
}

.result-actions {
  display: flex;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
}

/* ================= TAB 3: WORD SCRAMBLE ================= */
.scramble-panel {
  max-width: 820px;
}

.game-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 24px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--card-border);
}

.panel-info h2 {
  font-size: 1.7rem;
  font-weight: 800;
  margin-bottom: 4px;
}

.panel-info p {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.scramble-round-info {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
}

.scramble-score-pill {
  background: rgba(245, 158, 11, 0.15);
  color: var(--accent-gold);
  padding: 6px 14px;
  border-radius: var(--radius-full);
}

.scramble-clue-card {
  display: flex;
  align-items: center;
  gap: 20px;
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid var(--card-border);
  padding: 20px;
  border-radius: var(--radius-lg);
  margin-bottom: 24px;
}

.clue-icon-large {
  font-size: 54px;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.1));
}

.clue-content {
  flex: 1;
}

.clue-type {
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--accent-primary);
  text-transform: uppercase;
  margin-bottom: 4px;
}

.clue-meaning {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.clue-sentence {
  font-size: 0.95rem;
  font-style: italic;
  color: var(--text-secondary);
}

.btn-voice-hint {
  padding: 10px 16px;
  background: rgba(2, 132, 199, 0.12);
  border: 1px solid rgba(2, 132, 199, 0.25);
  color: var(--accent-primary);
  border-radius: var(--radius-full);
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-fast);
  white-space: nowrap;
}

.btn-voice-hint:hover {
  background: var(--accent-primary);
  color: white;
}

/* Slots & Letters */
.slots-label {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 10px;
}

.answer-slots-wrap,
.scrambled-letters-wrap {
  margin-bottom: 22px;
}

.answer-slots {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  min-height: 58px;
  padding: 8px;
  background: rgba(0, 0, 0, 0.05);
  border-radius: var(--radius-md);
  align-items: center;
}

.slot-tile {
  width: 48px;
  height: 52px;
  background: var(--card-bg);
  border: 2px dashed var(--card-border);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Outfit', sans-serif;
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-primary);
  cursor: pointer;
  transition: var(--transition-fast);
  user-select: none;
}

.slot-tile.filled {
  border-style: solid;
  border-color: var(--accent-primary);
  background: #fff;
  box-shadow: 0 4px 10px rgba(2, 132, 199, 0.18);
  animation: popIn 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

body.theme-storm .slot-tile.filled,
body.theme-night .slot-tile.filled {
  background: rgba(56, 189, 248, 0.18);
}

.letters-pool {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  min-height: 56px;
  padding: 6px 0;
}

.pool-tile {
  width: 48px;
  height: 52px;
  background: var(--card-bg);
  border: 2px solid var(--card-border);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Outfit', sans-serif;
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--text-primary);
  cursor: pointer;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.06);
  transition: var(--transition-fast);
  user-select: none;
}

.pool-tile:hover {
  transform: translateY(-3px);
  border-color: var(--accent-primary);
  box-shadow: 0 6px 14px rgba(2, 132, 199, 0.2);
}

.pool-tile.used {
  opacity: 0.25;
  pointer-events: none;
  border-style: dashed;
}

@keyframes popIn {
  0% { transform: scale(0.7); }
  100% { transform: scale(1); }
}

.scramble-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.scramble-alert {
  margin-top: 16px;
  padding: 12px 18px;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 0.95rem;
  animation: fadeIn 0.3s ease;
}

.scramble-alert.success {
  background: rgba(16, 185, 129, 0.18);
  border: 1px solid var(--accent-green);
  color: #065f46;
}

body.theme-storm .scramble-alert.success,
body.theme-night .scramble-alert.success {
  color: #34d399;
}

.scramble-alert.error {
  background: rgba(239, 68, 68, 0.18);
  border: 1px solid var(--accent-red);
  color: #991b1b;
}

body.theme-storm .scramble-alert.error,
body.theme-night .scramble-alert.error {
  color: #f87171;
}

/* ================= TAB 4: MEMORY MATCH ================= */
.memory-panel {
  max-width: 880px;
}

.memory-stats-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.mem-stat {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.45);
  padding: 8px 14px;
  border-radius: var(--radius-full);
  font-size: 0.9rem;
  font-weight: 600;
  border: 1px solid var(--card-border);
}

.memory-board {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin: 20px 0;
  perspective: 1000px;
}

@media (max-width: 680px) {
  .memory-board {
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
  }
}

@media (max-width: 460px) {
  .memory-board {
    grid-template-columns: repeat(2, 1fr);
  }
}

.memory-card {
  height: 120px;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  border-radius: var(--radius-md);
}

.memory-card.flipped,
.memory-card.matched {
  transform: rotateY(180deg);
}

.card-face {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 10px;
  backface-visibility: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  border: 1.5px solid var(--card-border);
}

.card-front {
  background: linear-gradient(135deg, rgba(2, 132, 199, 0.85), rgba(14, 165, 233, 0.85));
  color: white;
  font-size: 32px;
}

.card-front::after {
  content: '❓';
  font-size: 28px;
  opacity: 0.85;
}

.card-back {
  background: var(--card-bg);
  transform: rotateY(180deg);
  border-color: var(--accent-primary);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
}

.card-back .card-icon {
  font-size: 32px;
}

.card-back .card-text {
  font-size: 0.95rem;
  font-weight: 800;
  line-height: 1.2;
}

.card-back .card-subtext {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.memory-card.matched .card-back {
  background: rgba(16, 185, 129, 0.15);
  border-color: var(--accent-green);
  animation: matchedPulse 0.5s ease;
}

@keyframes matchedPulse {
  0% { transform: rotateY(180deg) scale(0.95); }
  50% { transform: rotateY(180deg) scale(1.08); }
  100% { transform: rotateY(180deg) scale(1); }
}

/* Modal Victory Memory */
.memory-win-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.win-modal-content {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-xl);
  padding: 36px 30px;
  text-align: center;
  max-width: 480px;
  width: 100%;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
  animation: bounceIn 0.5s ease;
}

.win-badge {
  display: inline-block;
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-green);
  font-size: 0.8rem;
  font-weight: 800;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  margin-bottom: 12px;
}

.win-summary {
  background: rgba(0, 0, 0, 0.04);
  padding: 16px;
  border-radius: var(--radius-md);
  margin: 20px 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 1rem;
}

.modal-buttons {
  display: flex;
  justify-content: center;
  gap: 12px;
}

/* ================= FOOTER ================= */
.main-footer {
  margin-top: auto;
  border-top: 1px solid var(--card-border);
  background: var(--header-bg);
  backdrop-filter: var(--glass-blur);
  padding: 20px 0;
  text-align: center;
  font-size: 0.9rem;
}

.footer-sub {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Helpers */
.hidden {
  display: none !important;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .logo-text h1 {
    font-size: 1.2rem;
  }
  .subtitle {
    display: none;
  }
  .cards-grid {
    grid-template-columns: 1fr;
  }
  .game-panel-header {
    flex-direction: column;
  }
}
