/* ==========================================================================
   WordMaster - Modern Gaming & Interactive Learning Stylesheet
   ========================================================================== */

:root {
  /* Color Palette */
  --bg-main: #080b16;
  --bg-card: rgba(18, 25, 48, 0.7);
  --bg-card-hover: rgba(26, 36, 68, 0.85);
  --border-glass: rgba(255, 255, 255, 0.08);
  --border-glass-glow: rgba(0, 242, 254, 0.35);

  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --accent-cyan: #00f2fe;
  --accent-blue: #4facfe;
  --accent-purple: #7928ca;
  --accent-pink: #ff0080;
  --accent-green: #00f5a0;
  --accent-orange: #ff9900;
  --accent-danger: #ef4444;

  /* Gradients */
  --grad-primary: linear-gradient(135deg, #7928ca 0%, #ff0080 100%);
  --grad-cyan: linear-gradient(135deg, #00f2fe 0%, #4facfe 100%);
  --grad-green: linear-gradient(135deg, #00f5a0 0%, #00d2ff 100%);
  --grad-orange: linear-gradient(135deg, #ff9900 0%, #ff5e62 100%);
  --grad-card: linear-gradient(145deg, rgba(255, 255, 255, 0.04) 0%, rgba(255, 255, 255, 0.01) 100%);

  /* Typography */
  --font-heading: 'Outfit', sans-serif;
  --font-body: 'Plus Jakarta Sans', sans-serif;

  /* Shadows & Glass */
  --glass-blur: blur(20px);
  --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 12px 36px -4px rgba(0, 0, 0, 0.5), 0 0 24px rgba(121, 40, 202, 0.15);
  --shadow-glow: 0 0 24px rgba(0, 242, 254, 0.25);
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-full: 9999px;

  /* Transitions */
  --trans-fast: 0.18s cubic-bezier(0.4, 0, 0.2, 1);
  --trans-spring: 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

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

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

body {
  font-family: var(--font-body);
  background-color: var(--bg-main);
  color: var(--text-primary);
  min-height: 100%;
  overflow-x: hidden;
  position: relative;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

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

/* Ambient Glowing Orbs Background */
.glow-orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.25;
  pointer-events: none;
  z-index: 0;
  animation: floatOrb 18s ease-in-out infinite alternate;
}

.orb-1 {
  width: 450px;
  height: 450px;
  background: var(--accent-purple);
  top: -80px;
  left: -80px;
}

.orb-2 {
  width: 500px;
  height: 500px;
  background: var(--accent-cyan);
  bottom: 5%;
  right: -100px;
  animation-duration: 22s;
}

.orb-3 {
  width: 350px;
  height: 350px;
  background: var(--accent-green);
  top: 45%;
  left: 50%;
  transform: translate(-50%, -50%);
  opacity: 0.12;
  animation-duration: 26s;
}

@keyframes floatOrb {
  0% { transform: translateY(0) scale(1); }
  50% { transform: translateY(40px) scale(1.08); }
  100% { transform: translateY(-30px) scale(0.95); }
}

/* App Wrapper Container */
.app-wrapper {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* Glass Card Utility */
.glass-card {
  background: var(--bg-card);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: all var(--trans-spring);
  position: relative;
}

/* Gradient Text */
.gradient-text {
  background: var(--grad-cyan);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  display: inline-block;
}

/* ==========================================================================
   Header & Navbar
   ========================================================================== */
.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
  user-select: none;
  transition: transform var(--trans-fast);
}

.logo:hover {
  transform: scale(1.03);
}

.logo-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: var(--grad-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 0 16px rgba(255, 0, 128, 0.4);
}

.logo-icon svg {
  width: 24px;
  height: 24px;
}

.brand-title {
  font-family: var(--font-heading);
  font-size: 1.45rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  display: block;
}

.brand-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  font-weight: 600;
  display: block;
}

.nav-controls {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.stat-pill {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-glass);
  padding: 0.45rem 0.9rem;
  border-radius: var(--radius-full);
  font-size: 0.88rem;
  font-weight: 600;
}

.pill-icon {
  font-size: 1.05rem;
}

.pill-val {
  color: var(--accent-cyan);
  font-family: var(--font-heading);
  font-weight: 700;
}

.icon-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid var(--border-glass);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
  font-size: 1.15rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--trans-fast);
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: var(--accent-cyan);
  transform: translateY(-2px);
}

/* ==========================================================================
   Main Screens Container
   ========================================================================== */
.main-container {
  flex: 1;
  padding: 2rem 0;
  display: flex;
  flex-direction: column;
}

.game-screen {
  display: none;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.35s ease, transform 0.35s ease;
}

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

/* ==========================================================================
   Screen 1: Lobby & Hero Section
   ========================================================================== */
.hero-section {
  text-align: center;
  margin-bottom: 2.2rem;
  padding: 1rem 0;
}

.badge-pill {
  display: inline-block;
  background: rgba(0, 242, 254, 0.1);
  color: var(--accent-cyan);
  border: 1px solid rgba(0, 242, 254, 0.3);
  padding: 0.35rem 1rem;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 1.2rem;
  letter-spacing: 0.5px;
}

.hero-title {
  font-family: var(--font-heading);
  font-size: clamp(2rem, 5vw, 3.25rem);
  font-weight: 900;
  line-height: 1.2;
  margin-bottom: 1rem;
  letter-spacing: -1px;
}

.hero-desc {
  color: var(--text-secondary);
  font-size: 1.1rem;
  max-width: 640px;
  margin: 0 auto;
}

/* Filter Panel */
.filter-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2rem;
  padding: 1.1rem 2rem;
  max-width: 780px;
  margin: 0 auto 2.5rem;
  flex-wrap: wrap;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.filter-label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.custom-select-wrapper {
  position: relative;
}

.game-select {
  appearance: none;
  background: rgba(10, 15, 30, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.92rem;
  font-weight: 600;
  padding: 0.55rem 2.2rem 0.55rem 1rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  outline: none;
  transition: border-color var(--trans-fast);
}

.custom-select-wrapper::after {
  content: "▾";
  position: absolute;
  right: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
  font-size: 0.9rem;
}

.game-select:focus {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 10px rgba(0, 242, 254, 0.3);
}

.game-select option {
  background: #0d1224;
  color: #fff;
}

/* Mode Cards Grid */
.mode-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(310px, 1fr));
  gap: 1.75rem;
}

.mode-card {
  padding: 2.2rem 1.8rem;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--border-glass);
  cursor: pointer;
}

.mode-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-lg);
  border-color: rgba(255, 255, 255, 0.2);
}

.card-glow-bg {
  position: absolute;
  top: -50px;
  right: -50px;
  width: 140px;
  height: 140px;
  border-radius: 50%;
  filter: blur(50px);
  opacity: 0.25;
  pointer-events: none;
  transition: opacity var(--trans-fast);
}

.mode-card:hover .card-glow-bg {
  opacity: 0.45;
}

.glow-purple { background: var(--accent-purple); }
.glow-cyan { background: var(--accent-cyan); }
.glow-green { background: var(--accent-green); }

.mode-badge {
  position: absolute;
  top: 1.25rem;
  right: 1.25rem;
  padding: 0.28rem 0.75rem;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-hot { background: rgba(255, 0, 128, 0.15); color: #ff3399; border: 1px solid rgba(255, 0, 128, 0.3); }
.badge-fast { background: rgba(0, 242, 254, 0.15); color: var(--accent-cyan); border: 1px solid rgba(0, 242, 254, 0.3); }
.badge-cool { background: rgba(0, 245, 160, 0.15); color: var(--accent-green); border: 1px solid rgba(0, 245, 160, 0.3); }

.mode-icon-box {
  width: 58px;
  height: 58px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.9rem;
  margin-bottom: 1.4rem;
  box-shadow: var(--shadow-sm);
}

.icon-purple { background: rgba(121, 40, 202, 0.2); border: 1px solid rgba(121, 40, 202, 0.4); }
.icon-cyan { background: rgba(0, 242, 254, 0.18); border: 1px solid rgba(0, 242, 254, 0.4); }
.icon-green { background: rgba(0, 245, 160, 0.18); border: 1px solid rgba(0, 245, 160, 0.4); }

.mode-title {
  font-family: var(--font-heading);
  font-size: 1.55rem;
  font-weight: 800;
  margin-bottom: 0.65rem;
}

.mode-desc {
  color: var(--text-secondary);
  font-size: 0.94rem;
  margin-bottom: 1.4rem;
  line-height: 1.55;
}

.mode-features {
  list-style: none;
  margin-bottom: 1.8rem;
  flex: 1;
}

.mode-features li {
  font-size: 0.86rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

/* Standard Buttons */
.btn-primary-gradient,
.btn-cyan-gradient,
.btn-green-gradient,
.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 0.85rem 1.6rem;
  border-radius: var(--radius-md);
  font-family: var(--font-heading);
  font-size: 0.98rem;
  font-weight: 700;
  border: none;
  cursor: pointer;
  transition: all var(--trans-fast);
  text-decoration: none;
  user-select: none;
}

.btn-primary-gradient {
  background: var(--grad-primary);
  color: #fff;
  box-shadow: 0 4px 20px rgba(255, 0, 128, 0.35);
}

.btn-primary-gradient:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(255, 0, 128, 0.5);
}

.btn-cyan-gradient {
  background: var(--grad-cyan);
  color: #080b16;
  box-shadow: 0 4px 20px rgba(0, 242, 254, 0.35);
}

.btn-cyan-gradient:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(0, 242, 254, 0.5);
}

.btn-green-gradient {
  background: var(--grad-green);
  color: #080b16;
  box-shadow: 0 4px 20px rgba(0, 245, 160, 0.35);
}

.btn-green-gradient:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(0, 245, 160, 0.5);
}

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

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.25);
}

.btn-large {
  padding: 1rem 2rem;
  font-size: 1.05rem;
}

.btn-compact {
  padding: 0.6rem 1.2rem;
  font-size: 0.9rem;
}

.btn-hint {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: rgba(255, 153, 0, 0.12);
  color: var(--accent-orange);
  border: 1px solid rgba(255, 153, 0, 0.3);
  padding: 0.75rem 1.2rem;
  border-radius: var(--radius-md);
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all var(--trans-fast);
}

.btn-hint:hover {
  background: rgba(255, 153, 0, 0.22);
  border-color: var(--accent-orange);
}

/* ==========================================================================
   Screen 2: Gameplay Arena
   ========================================================================== */
.game-hud {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1.5rem;
  margin-bottom: 1.2rem;
  border-radius: var(--radius-md);
}

.hud-left, .hud-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.game-tag-badge {
  background: rgba(0, 242, 254, 0.12);
  color: var(--accent-cyan);
  border: 1px solid rgba(0, 242, 254, 0.25);
  font-weight: 700;
  font-size: 0.85rem;
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-full);
}

.hud-center {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.lives-container {
  display: flex;
  gap: 0.3rem;
  font-size: 1.3rem;
}

.heart {
  filter: grayscale(1) opacity(0.35);
  transition: transform var(--trans-spring), filter var(--trans-fast);
}

.heart.active {
  filter: grayscale(0) opacity(1);
  transform: scale(1.05);
}

.combo-badge {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--grad-orange);
  color: #fff;
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 0.85rem;
  padding: 0.3rem 0.8rem;
  border-radius: var(--radius-full);
  box-shadow: 0 0 14px rgba(255, 153, 0, 0.5);
  animation: pulseGlow 1.2s infinite;
}

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

.score-display {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
}

.score-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 600;
}

.score-val {
  font-family: var(--font-heading);
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--accent-cyan);
}

/* Speed Quiz Timer Bar */
.timer-container {
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-full);
  margin-bottom: 1.2rem;
  overflow: hidden;
  display: none;
}

.timer-container.active {
  display: block;
}

.timer-bar {
  height: 100%;
  width: 100%;
  background: var(--grad-cyan);
  border-radius: var(--radius-full);
  transition: width 0.1s linear, background-color 0.3s;
}

.timer-bar.warning {
  background: var(--grad-orange);
}

.timer-bar.danger {
  background: var(--accent-danger);
}

/* Arena Main Box */
.play-arena {
  padding: 2.2rem 2.5rem;
  position: relative;
  overflow: hidden;
}

.arena-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.meta-tag {
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.3rem 0.85rem;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.06);
}

.tag-category {
  color: var(--accent-cyan);
  border: 1px solid rgba(0, 242, 254, 0.2);
}

.tag-difficulty {
  color: var(--accent-green);
  border: 1px solid rgba(0, 245, 160, 0.2);
}

.meta-question-count {
  font-size: 0.9rem;
  color: var(--text-secondary);
  font-weight: 600;
}

/* Audio Control Bar */
.audio-control-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.speech-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  background: rgba(0, 242, 254, 0.12);
  border: 1px solid rgba(0, 242, 254, 0.35);
  color: var(--accent-cyan);
  padding: 0.6rem 1.3rem;
  border-radius: var(--radius-full);
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--trans-fast);
}

.speech-action-btn:hover {
  background: rgba(0, 242, 254, 0.25);
  transform: scale(1.04);
  box-shadow: 0 0 16px rgba(0, 242, 254, 0.3);
}

.speech-btn-slow {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.15);
  color: var(--text-secondary);
}

.speech-btn-slow:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, 0.3);
}

.phonetic-text {
  font-family: var(--font-heading);
  color: var(--text-muted);
  font-size: 1.15rem;
  letter-spacing: 1px;
}

/* Clue & Meaning Box */
.clue-box {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-md);
  padding: 1.4rem 1.8rem;
  text-align: center;
  margin-bottom: 2rem;
}

.clue-part-of-speech {
  display: inline-block;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  font-weight: 800;
  color: var(--accent-purple);
  background: rgba(121, 40, 202, 0.15);
  padding: 0.2rem 0.7rem;
  border-radius: var(--radius-full);
  margin-bottom: 0.6rem;
}

.clue-meaning {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

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

/* Hidden view utility */
.mode-view.hidden,
.hidden {
  display: none !important;
}

/* ==========================================================================
   Game Mode 1: Word Scramble
   ========================================================================== */
.scramble-instruction {
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-bottom: 1.4rem;
}

.answer-slots-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  min-height: 64px;
  margin-bottom: 1.8rem;
  flex-wrap: wrap;
}

.letter-slot {
  width: 52px;
  height: 56px;
  border-radius: var(--radius-md);
  border: 2px dashed rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.03);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-heading);
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--accent-cyan);
  cursor: pointer;
  transition: all var(--trans-spring);
  user-select: none;
}

.letter-slot.filled {
  border: 2px solid var(--accent-cyan);
  background: rgba(0, 242, 254, 0.15);
  box-shadow: 0 4px 14px rgba(0, 242, 254, 0.25);
  animation: bounceIn 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.letter-slot.filled:hover {
  transform: translateY(-3px);
  background: rgba(239, 68, 68, 0.2);
  border-color: var(--accent-danger);
  color: #fff;
}

.scramble-letters-pool {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.letter-tile {
  width: 54px;
  height: 58px;
  border-radius: var(--radius-md);
  background: var(--grad-card);
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-heading);
  font-size: 1.6rem;
  font-weight: 800;
  color: #fff;
  cursor: pointer;
  user-select: none;
  transition: all var(--trans-fast);
}

.letter-tile:hover {
  transform: translateY(-4px);
  border-color: var(--accent-cyan);
  box-shadow: 0 8px 20px rgba(0, 242, 254, 0.35);
  background: rgba(0, 242, 254, 0.12);
}

.letter-tile.used {
  opacity: 0.2;
  pointer-events: none;
  transform: scale(0.9);
  border-style: dashed;
}

.scramble-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
}

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

/* ==========================================================================
   Game Mode 2: Speed Quiz
   ========================================================================== */
.quiz-question-title {
  text-align: center;
  font-family: var(--font-heading);
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: 1.8rem;
  color: var(--text-primary);
}

.quiz-options-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.1rem;
  margin-bottom: 1.5rem;
}

.quiz-option-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 1.25rem 1.4rem;
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: all var(--trans-fast);
  text-align: left;
}

.quiz-option-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--accent-cyan);
  transform: translateY(-3px);
  box-shadow: 0 6px 18px rgba(0, 242, 254, 0.2);
}

.option-key {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--text-secondary);
}

.quiz-option-btn.correct {
  background: rgba(0, 245, 160, 0.2) !important;
  border-color: var(--accent-green) !important;
  box-shadow: 0 0 20px rgba(0, 245, 160, 0.4) !important;
  color: #fff !important;
}

.quiz-option-btn.wrong {
  background: rgba(239, 68, 68, 0.2) !important;
  border-color: var(--accent-danger) !important;
  box-shadow: 0 0 20px rgba(239, 68, 68, 0.4) !important;
  animation: shake 0.45s ease-in-out;
}

/* ==========================================================================
   Game Mode 3: Listening Master
   ========================================================================== */
.listening-wave-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.2rem;
  margin-bottom: 2rem;
}

.sound-wave {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 48px;
}

.sound-wave span {
  display: block;
  width: 6px;
  height: 12px;
  background: var(--accent-cyan);
  border-radius: var(--radius-full);
  animation: waveBar 1.2s ease-in-out infinite;
}

.sound-wave span:nth-child(2) { animation-delay: 0.2s; }
.sound-wave span:nth-child(3) { animation-delay: 0.4s; }
.sound-wave span:nth-child(4) { animation-delay: 0.6s; }
.sound-wave span:nth-child(5) { animation-delay: 0.8s; }

@keyframes waveBar {
  0%, 100% { height: 10px; opacity: 0.4; }
  50% { height: 42px; opacity: 1; background: var(--accent-purple); }
}

.listening-prompt {
  color: var(--text-secondary);
  font-size: 0.96rem;
  text-align: center;
}

.listening-input-form {
  max-width: 540px;
  margin: 0 auto;
}

.input-wrapper {
  position: relative;
  margin-bottom: 1.5rem;
}

.game-input {
  width: 100%;
  background: rgba(10, 15, 30, 0.9);
  border: 2px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-md);
  padding: 1rem 3.2rem 1rem 1.4rem;
  font-family: var(--font-heading);
  font-size: 1.4rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: 1px;
  outline: none;
  transition: all var(--trans-fast);
}

.game-input:focus {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 20px rgba(0, 242, 254, 0.35);
}

.input-clear-btn {
  position: absolute;
  right: 1.2rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 0.25rem;
}

.input-clear-btn:hover {
  color: #fff;
}

.listening-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
}

/* ==========================================================================
   Feedback Toast Banner (In-game)
   ========================================================================== */
.feedback-banner {
  margin-top: 2rem;
  border-radius: var(--radius-md);
  padding: 1.2rem 1.6rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.2rem;
  animation: bounceIn 0.3s ease;
}

.feedback-banner.success {
  background: rgba(0, 245, 160, 0.15);
  border: 1px solid var(--accent-green);
  box-shadow: 0 0 20px rgba(0, 245, 160, 0.25);
}

.feedback-banner.wrong {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid var(--accent-danger);
  box-shadow: 0 0 20px rgba(239, 68, 68, 0.25);
}

.feedback-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  font-weight: 800;
  color: #fff;
  flex-shrink: 0;
}

.feedback-banner.success .feedback-icon {
  background: var(--accent-green);
}

.feedback-banner.wrong .feedback-icon {
  background: var(--accent-danger);
}

.feedback-info {
  flex: 1;
}

.feedback-title {
  font-family: var(--font-heading);
  font-size: 1.2rem;
  font-weight: 800;
  margin-bottom: 0.2rem;
}

.feedback-sub {
  font-size: 0.88rem;
  color: var(--text-secondary);
}

/* ==========================================================================
   Screen 3: Game Over & Summary
   ========================================================================== */
.gameover-card {
  max-width: 620px;
  margin: 1.5rem auto;
  padding: 3rem 2.5rem;
  text-align: center;
}

.gameover-trophy {
  font-size: 4.5rem;
  margin-bottom: 1.2rem;
  animation: pulseGlow 1.8s infinite;
}

.gameover-title {
  font-family: var(--font-heading);
  font-size: 2.2rem;
  font-weight: 900;
  margin-bottom: 0.5rem;
}

.gameover-subtitle {
  color: var(--text-secondary);
  font-size: 1.05rem;
  margin-bottom: 2rem;
}

.score-showcase {
  display: flex;
  align-items: center;
  justify-content: space-around;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  margin-bottom: 2rem;
}

.showcase-item {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.showcase-num {
  font-family: var(--font-heading);
  font-size: 2.2rem;
  font-weight: 900;
}

.showcase-lbl {
  font-size: 0.82rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}

.showcase-divider {
  width: 1px;
  height: 48px;
  background: rgba(255, 255, 255, 0.1);
}

.new-record-banner {
  background: rgba(255, 153, 0, 0.15);
  color: var(--accent-orange);
  border: 1px solid rgba(255, 153, 0, 0.35);
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 0.95rem;
  margin-bottom: 2rem;
}

.gameover-buttons {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.2rem;
  flex-wrap: wrap;
}

/* ==========================================================================
   Modals & Popups
   ========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(4, 7, 18, 0.8);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  animation: fadeIn 0.2s ease;
}

.modal-box {
  width: 100%;
  max-width: 580px;
  padding: 2.2rem;
  background: #0f162e;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: var(--shadow-lg);
  animation: modalPop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.modal-title {
  font-family: var(--font-heading);
  font-size: 1.45rem;
  font-weight: 800;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.4rem;
  cursor: pointer;
}

.modal-close:hover {
  color: #fff;
}

.stat-grid-modal {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.modal-stat-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  padding: 1.2rem;
  border-radius: var(--radius-md);
  text-align: center;
}

.modal-stat-val {
  font-family: var(--font-heading);
  font-size: 1.85rem;
  font-weight: 900;
  margin-bottom: 0.2rem;
}

.text-cyan { color: var(--accent-cyan); }
.text-green { color: var(--accent-green); }
.text-purple { color: var(--accent-purple); }

.modal-stat-label {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 600;
}

.stat-tips-box {
  background: rgba(0, 242, 254, 0.08);
  border: 1px solid rgba(0, 242, 254, 0.2);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.55;
  margin-bottom: 1.5rem;
}

.stat-tips-box strong {
  color: var(--accent-cyan);
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.btn-danger-outline {
  background: none;
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: var(--accent-danger);
  padding: 0.6rem 1rem;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all var(--trans-fast);
}

.btn-danger-outline:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: var(--accent-danger);
}

/* Toast Notification */
.toast-popup {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(18, 25, 48, 0.95);
  border: 1px solid var(--accent-cyan);
  color: #fff;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-full);
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.95rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 15px rgba(0, 242, 254, 0.3);
  z-index: 10000;
  transition: all var(--trans-fast);
  pointer-events: none;
}

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

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

@keyframes modalPop {
  0% { transform: scale(0.92); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

/* ==========================================================================
   Footer
   ========================================================================== */
.app-footer {
  text-align: center;
  padding: 2rem 0;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: auto;
}

/* ==========================================================================
   Responsive Adaptations
   ========================================================================== */
@media (max-width: 768px) {
  .app-wrapper {
    padding: 0 1rem;
  }

  .quiz-options-grid {
    grid-template-columns: 1fr;
  }

  .play-arena {
    padding: 1.5rem 1.2rem;
  }

  .game-hud {
    padding: 0.75rem 1rem;
    flex-wrap: wrap;
    gap: 0.75rem;
  }

  .hud-left, .hud-center, .hud-right {
    gap: 0.6rem;
  }

  .letter-slot, .letter-tile {
    width: 44px;
    height: 48px;
    font-size: 1.3rem;
  }

  .stat-grid-modal {
    grid-template-columns: 1fr;
  }
}
