/* ===================================================
   ENGLISH WORD QUEST - MODERN DESIGN SYSTEM
   =================================================== */

:root {
  /* Color Palette */
  --bg-main: #0a0d18;
  --bg-surface: rgba(18, 24, 38, 0.85);
  --bg-surface-elevated: rgba(26, 35, 56, 0.9);
  --bg-card: rgba(22, 30, 48, 0.7);
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-glow: rgba(99, 102, 241, 0.35);
  
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --primary-light: #818cf8;
  --primary-glow: rgba(99, 102, 241, 0.5);

  --secondary: #06b6d4;
  --secondary-hover: #0891b2;
  
  --accent-purple: #a855f7;
  --accent-pink: #ec4899;
  --accent-orange: #f97316;
  --accent-amber: #f59e0b;
  --accent-emerald: #10b981;
  --accent-rose: #f43f5e;

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --font-display: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --radius-full: 9999px;

  --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.45);
  --shadow-glow: 0 0 30px rgba(99, 102, 241, 0.35);
}

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

html, body {
  min-height: 100vh;
  background-color: var(--bg-main);
  color: var(--text-main);
  font-family: var(--font-body);
  overflow-x: hidden;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Background Ambient Orbs */
.app-background {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.glow-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.45;
  animation: floatOrb 18s ease-in-out infinite alternate;
}

.orb-1 {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, #4f46e5 0%, transparent 70%);
  top: -120px;
  left: -100px;
}

.orb-2 {
  width: 450px;
  height: 450px;
  background: radial-gradient(circle, #06b6d4 0%, transparent 70%);
  bottom: -100px;
  right: -80px;
  animation-duration: 22s;
  animation-delay: -5s;
}

.orb-3 {
  width: 380px;
  height: 380px;
  background: radial-gradient(circle, #a855f7 0%, transparent 70%);
  top: 40%;
  left: 55%;
  animation-duration: 25s;
  animation-delay: -10s;
}

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

/* Confetti Canvas */
#confettiCanvas {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 999;
}

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

/* Header */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.25rem;
  background: var(--bg-surface);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  margin-bottom: 1.5rem;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
  user-select: none;
  transition: transform 0.2s ease;
}

.brand-logo:hover {
  transform: scale(1.02);
}

.logo-icon {
  font-size: 1.8rem;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(6, 182, 212, 0.2));
  padding: 0.4rem 0.6rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-glow);
}

.logo-text h1 {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  line-height: 1.1;
}

.sub-logo {
  font-size: 0.72rem;
  color: var(--secondary);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.gradient-text {
  background: linear-gradient(135deg, #60a5fa 0%, #a78bfa 50%, #f472b6 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.stat-badge {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 600;
}

.stat-badge .badge-val {
  color: var(--accent-amber);
  font-family: var(--font-display);
  font-size: 1rem;
}

.icon-btn {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

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

/* Main View Screens */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.view-screen {
  display: none;
  animation: fadeIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

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

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

/* Hero Banner */
.hero-banner {
  text-align: center;
  padding: 2rem 1rem 1.5rem;
}

.hero-tag {
  display: inline-block;
  padding: 0.35rem 0.9rem;
  background: rgba(99, 102, 241, 0.15);
  border: 1px solid rgba(99, 102, 241, 0.3);
  color: var(--primary-light);
  font-size: 0.82rem;
  font-weight: 600;
  border-radius: var(--radius-full);
  margin-bottom: 1rem;
  letter-spacing: 0.3px;
}

.hero-title {
  font-family: var(--font-display);
  font-size: 2.2rem;
  font-weight: 800;
  line-height: 1.25;
  margin-bottom: 0.75rem;
}

.hero-desc {
  max-width: 580px;
  margin: 0 auto;
  color: var(--text-muted);
  font-size: 0.98rem;
}

/* Section Titles */
.section-title-wrap {
  margin-bottom: 1rem;
}

.section-title {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-main);
}

.section-sub {
  font-size: 0.82rem;
  color: var(--text-dim);
}

/* Mode Selection Cards */
.game-modes-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.mode-card {
  position: relative;
  background: var(--bg-surface);
  backdrop-filter: blur(12px);
  border: 2px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.4rem 1.2rem;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.mode-card:hover {
  transform: translateY(-4px);
  border-color: rgba(99, 102, 241, 0.5);
  box-shadow: var(--shadow-md), 0 0 20px rgba(99, 102, 241, 0.15);
}

.mode-card.selected {
  border-color: var(--primary);
  background: linear-gradient(165deg, rgba(30, 41, 69, 0.9), rgba(15, 23, 42, 0.95));
  box-shadow: 0 0 25px rgba(99, 102, 241, 0.35);
}

.mode-badge {
  position: absolute;
  top: 10px;
  right: 12px;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
}

.mode-card.selected .mode-badge {
  background: var(--primary);
  color: #fff;
}

.mode-icon-box {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  font-size: 1.6rem;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
  background: rgba(255, 255, 255, 0.05);
}

.mode-icon-box.orange { background: rgba(249, 115, 22, 0.15); border: 1px solid rgba(249, 115, 22, 0.3); }
.mode-icon-box.purple { background: rgba(168, 85, 247, 0.15); border: 1px solid rgba(168, 85, 247, 0.3); }
.mode-icon-box.cyan { background: rgba(6, 182, 212, 0.15); border: 1px solid rgba(6, 182, 212, 0.3); }

.mode-name {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 0.4rem;
}

.mode-desc {
  font-size: 0.83rem;
  color: var(--text-muted);
  line-height: 1.4;
  margin-bottom: 1rem;
  flex: 1;
}

.mode-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--border-subtle);
  padding-top: 0.75rem;
  margin-top: auto;
}

.mode-tag {
  font-size: 0.75rem;
  color: var(--text-dim);
  font-weight: 500;
}

.mode-card.selected .mode-tag {
  color: var(--primary-light);
}

.mode-arrow {
  color: var(--text-dim);
  font-weight: bold;
  transition: transform 0.2s ease;
}

.mode-card:hover .mode-arrow {
  transform: translateX(4px);
  color: var(--primary-light);
}

/* Category Chips */
.category-chips-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-bottom: 2rem;
}

.cat-chip {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  padding: 0.55rem 1rem;
  border-radius: var(--radius-full);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.2s ease;
}

.cat-chip:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
  border-color: rgba(255, 255, 255, 0.2);
}

.cat-chip.active {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.25), rgba(6, 182, 212, 0.25));
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 0 15px rgba(99, 102, 241, 0.3);
}

/* Primary Action Buttons */
.start-action-wrap {
  display: flex;
  justify-content: center;
  margin: 1.5rem 0 2rem;
}

.btn-primary-large {
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 50%, #06b6d4 100%);
  background-size: 200% 200%;
  border: none;
  color: #fff;
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  padding: 1rem 2.5rem;
  border-radius: var(--radius-full);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  transition: all 0.3s ease;
  box-shadow: 0 10px 25px rgba(79, 70, 229, 0.4);
  letter-spacing: 0.5px;
}

.btn-primary-large:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 14px 32px rgba(79, 70, 229, 0.6);
  background-position: right center;
}

.btn-primary-large:active {
  transform: translateY(1px) scale(0.98);
}

.btn-secondary-large {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 600;
  padding: 0.9rem 2rem;
  border-radius: var(--radius-full);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  transition: all 0.2s ease;
}

.btn-secondary-large:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.3);
}

.btn-secondary-sm {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-secondary-sm:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-main);
}

/* ===================================================
   SCREEN 2: GAMEPLAY INTERFACE
   =================================================== */

.game-hud {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
  background: var(--bg-surface);
  backdrop-filter: blur(12px);
  padding: 0.6rem 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

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

.question-tracker {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-main);
}

.category-indicator {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--secondary);
  background: rgba(6, 182, 212, 0.12);
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
  border: 1px solid rgba(6, 182, 212, 0.25);
}

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

.hud-stat-item {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.95rem;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-full);
}

.score-stat {
  background: rgba(245, 158, 11, 0.15);
  color: var(--accent-amber);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.streak-stat {
  background: rgba(244, 63, 94, 0.15);
  color: var(--accent-rose);
  border: 1px solid rgba(244, 63, 94, 0.3);
  transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.streak-stat.active {
  animation: pulseStreak 1s infinite alternate;
}

@keyframes pulseStreak {
  0% { transform: scale(1); box-shadow: 0 0 5px rgba(244, 63, 94, 0.3); }
  100% { transform: scale(1.08); box-shadow: 0 0 15px rgba(244, 63, 94, 0.6); }
}

.streak-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  opacity: 0.8;
}

/* Progress bar */
.progress-track {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-bottom: 1rem;
}

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

/* Timer Countdown (Quiz mode) */
.timer-container {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
  background: rgba(0, 0, 0, 0.2);
  padding: 0.35rem 0.8rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

.timer-bar-wrap {
  flex: 1;
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-full);
  overflow: hidden;
}

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

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

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

.timer-text {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text-main);
  min-width: 32px;
  text-align: right;
}

/* Question Card */
.question-card {
  position: relative;
  background: var(--bg-surface-elevated);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-glow);
  border-radius: var(--radius-xl);
  padding: 1.75rem 1.5rem;
  box-shadow: var(--shadow-lg), 0 0 35px rgba(99, 102, 241, 0.15);
  display: flex;
  flex-direction: column;
  min-height: 380px;
}

.card-clue-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.clue-tag {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--primary-light);
  background: rgba(99, 102, 241, 0.12);
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(99, 102, 241, 0.2);
}

.pronounce-btn {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(6, 182, 212, 0.2));
  border: 1px solid var(--border-glow);
  color: #fff;
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-full);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: all 0.2s ease;
}

.pronounce-btn:hover {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.4), rgba(6, 182, 212, 0.4));
  transform: scale(1.05);
  box-shadow: 0 0 12px rgba(99, 102, 241, 0.4);
}

.sound-wave {
  display: none;
  align-items: flex-end;
  gap: 2px;
  height: 12px;
}

.sound-wave span {
  width: 2.5px;
  height: 100%;
  background: #38bdf8;
  border-radius: 2px;
  animation: waveAnim 0.5s ease-in-out infinite alternate;
}

.sound-wave span:nth-child(2) { animation-delay: 0.15s; height: 60%; }
.sound-wave span:nth-child(3) { animation-delay: 0.3s; height: 80%; }

.pronounce-btn.speaking .sound-wave {
  display: flex;
}

@keyframes waveAnim {
  0% { height: 25%; }
  100% { height: 100%; }
}

.clue-meaning-box {
  text-align: center;
  padding: 0.5rem 0 1.25rem;
  border-bottom: 1px dashed var(--border-subtle);
  margin-bottom: 1.5rem;
}

.clue-vietnamese {
  font-family: var(--font-display);
  font-size: 1.65rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 0.3rem;
  letter-spacing: -0.3px;
}

.clue-hint-en {
  font-size: 0.95rem;
  color: var(--text-muted);
  font-style: italic;
}

/* ===================================================
   MODE 1: WORD SCRAMBLE STYLES
   =================================================== */

.game-interactive-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.answer-slots-container {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.6rem;
  min-height: 60px;
  margin-bottom: 1.5rem;
  padding: 0.5rem;
}

.letter-slot {
  width: 48px;
  height: 54px;
  border: 2px dashed rgba(255, 255, 255, 0.2);
  background: rgba(0, 0, 0, 0.25);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 800;
  color: #fff;
  transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  cursor: pointer;
  user-select: none;
}

.letter-slot.filled {
  border-style: solid;
  border-color: var(--primary-light);
  background: linear-gradient(180deg, #4338ca 0%, #312e81 100%);
  box-shadow: 0 4px 0 #1e1b4b, 0 6px 14px rgba(67, 56, 202, 0.4);
  transform: translateY(-2px);
  animation: popIn 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.letter-slot.hinted {
  border-color: var(--accent-amber);
  background: linear-gradient(180deg, #b45309 0%, #78350f 100%);
  box-shadow: 0 4px 0 #451a03, 0 6px 14px rgba(180, 83, 9, 0.4);
}

.scramble-tiles-pool {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-bottom: 1.5rem;
  min-height: 60px;
}

.tile-btn {
  width: 48px;
  height: 54px;
  border: none;
  background: linear-gradient(180deg, #334155 0%, #1e293b 100%);
  color: #f8fafc;
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 800;
  border-radius: var(--radius-md);
  box-shadow: 0 4px 0 #0f172a, 0 6px 12px rgba(0, 0, 0, 0.3);
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.tile-btn:hover:not(:disabled) {
  transform: translateY(-3px);
  box-shadow: 0 7px 0 #0f172a, 0 10px 16px rgba(0, 0, 0, 0.4);
  background: linear-gradient(180deg, #475569 0%, #334155 100%);
}

.tile-btn:active:not(:disabled) {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #0f172a;
}

.tile-btn:disabled {
  opacity: 0.25;
  cursor: not-allowed;
  transform: translateY(2px);
  box-shadow: none;
}

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

.btn-subtle {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.88rem;
  padding: 0.65rem 1.1rem;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-subtle:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text-main);
}

.hint-btn:hover {
  color: var(--accent-amber);
  border-color: rgba(245, 158, 11, 0.4);
}

.btn-action-primary {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  border: none;
  color: #fff;
  font-family: var(--font-display);
  font-size: 0.98rem;
  font-weight: 700;
  padding: 0.65rem 1.6rem;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.35);
}

.btn-action-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(16, 185, 129, 0.5);
}

/* ===================================================
   MODE 2: QUIZ MULTIPLE CHOICE STYLES
   =================================================== */

.quiz-target-word {
  text-align: center;
  font-family: var(--font-display);
  font-size: 2.3rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: 0.5px;
  margin-bottom: 0.15rem;
}

.quiz-phonetic {
  text-align: center;
  font-size: 1rem;
  color: var(--secondary);
  font-family: monospace;
  margin-bottom: 1.5rem;
}

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

.quiz-option-btn {
  background: rgba(30, 41, 69, 0.7);
  border: 2px solid var(--border-subtle);
  color: var(--text-main);
  padding: 1rem 1.2rem;
  border-radius: var(--radius-lg);
  font-family: var(--font-body);
  font-size: 1.05rem;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
}

.quiz-option-btn:hover:not(:disabled) {
  background: rgba(45, 58, 92, 0.85);
  border-color: var(--primary-light);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.opt-badge {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.88rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  flex-shrink: 0;
}

.quiz-option-btn.correct {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.25), rgba(5, 150, 105, 0.35)) !important;
  border-color: var(--accent-emerald) !important;
  color: #fff !important;
  box-shadow: 0 0 20px rgba(16, 185, 129, 0.4);
}

.quiz-option-btn.correct .opt-badge {
  background: var(--accent-emerald);
  color: #fff;
}

.quiz-option-btn.wrong {
  background: linear-gradient(135deg, rgba(244, 63, 94, 0.25), rgba(225, 29, 72, 0.35)) !important;
  border-color: var(--accent-rose) !important;
  color: #fff !important;
  animation: shake 0.4s ease;
}

.quiz-option-btn.wrong .opt-badge {
  background: var(--accent-rose);
  color: #fff;
}

/* ===================================================
   MODE 3: MISSING LETTERS STYLES
   =================================================== */

.missing-slots-container {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.missing-slot {
  width: 46px;
  height: 52px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 800;
  user-select: none;
}

.missing-slot.revealed {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
}

.missing-slot.blank {
  background: rgba(0, 0, 0, 0.3);
  border: 2px solid var(--secondary);
  color: #38bdf8;
  box-shadow: 0 0 12px rgba(6, 182, 212, 0.25);
  cursor: pointer;
}

.missing-slot.blank.active {
  border-color: #fff;
  box-shadow: 0 0 16px rgba(255, 255, 255, 0.6);
  transform: scale(1.06);
}

/* Virtual Keyboard */
.virtual-keyboard-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  align-items: center;
  margin-bottom: 1.25rem;
}

.keyboard-row {
  display: flex;
  gap: 0.35rem;
}

.kb-key {
  width: 36px;
  height: 44px;
  background: rgba(30, 41, 69, 0.8);
  border: 1px solid var(--border-subtle);
  color: #fff;
  border-radius: var(--radius-sm);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  user-select: none;
}

.kb-key:hover:not(:disabled) {
  background: var(--primary);
  transform: translateY(-2px);
}

.kb-key:disabled {
  opacity: 0.25;
  cursor: not-allowed;
}

.missing-controls {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
}

/* Feedback Banner inside Card */
.feedback-banner {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-md);
  margin-top: 1rem;
  font-weight: 700;
  font-size: 0.95rem;
  animation: popIn 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.feedback-banner.success {
  display: flex;
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.4);
  color: #34d399;
}

.feedback-banner.error {
  display: flex;
  background: rgba(244, 63, 94, 0.15);
  border: 1px solid rgba(244, 63, 94, 0.4);
  color: #fb7185;
}

/* ===================================================
   SCREEN 3: RESULT MODAL
   =================================================== */

.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(5, 7, 15, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 100;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  animation: fadeIn 0.2s ease;
}

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

.modal-card {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-glow);
  border-radius: var(--radius-xl);
  padding: 2.2rem 1.8rem;
  max-width: 560px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg), 0 0 50px rgba(99, 102, 241, 0.25);
  text-align: center;
  animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.result-trophy {
  font-size: 3.5rem;
  margin-bottom: 0.5rem;
  animation: bounceTrophy 1.5s infinite alternate ease-in-out;
}

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

.result-title {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 800;
  margin-bottom: 0.3rem;
}

.result-subtitle {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 1.5rem;
}

.result-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.stat-card {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.85rem 0.5rem;
}

.stat-card .stat-icon {
  font-size: 1.2rem;
  margin-bottom: 0.2rem;
}

.stat-card .stat-number {
  font-family: var(--font-display);
  font-size: 1.45rem;
  font-weight: 800;
  color: #fff;
}

.stat-card .stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.new-record-alert {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.2), rgba(234, 88, 12, 0.2));
  border: 1px solid var(--accent-amber);
  color: #fbbf24;
  font-weight: 800;
  font-size: 0.85rem;
  padding: 0.6rem 1rem;
  border-radius: var(--radius-md);
  margin-bottom: 1.25rem;
  animation: pulseStreak 1s infinite alternate;
}

/* Vocabulary Review List */
.vocab-review-section {
  text-align: left;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1rem;
  margin-bottom: 1.75rem;
}

.review-header h4 {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--secondary);
  margin-bottom: 0.75rem;
}

.vocab-review-list {
  max-height: 180px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding-right: 0.35rem;
}

/* Scrollbar styling */
.vocab-review-list::-webkit-scrollbar,
.modal-card::-webkit-scrollbar {
  width: 6px;
}
.vocab-review-list::-webkit-scrollbar-thumb,
.modal-card::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
}

.review-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.04);
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
}

.review-item-left {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
}

.review-word {
  font-weight: 700;
  color: #fff;
}

.review-phonetic {
  font-size: 0.75rem;
  color: var(--secondary);
  font-family: monospace;
}

.review-meaning {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.review-speak-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  color: var(--text-muted);
  transition: color 0.15s ease;
}

.review-speak-btn:hover {
  color: var(--primary-light);
}

.result-actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* Footer */
.app-footer {
  text-align: center;
  font-size: 0.82rem;
  color: var(--text-dim);
  margin-top: auto;
  padding-top: 1.5rem;
}

/* ===================================================
   KEYFRAME ANIMATIONS
   =================================================== */

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

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

/* ===================================================
   RESPONSIVE DESIGN
   =================================================== */

@media (max-width: 768px) {
  .hero-title {
    font-size: 1.7rem;
  }

  .game-modes-grid {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .mode-card {
    padding: 1rem;
  }

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

  .kb-key {
    width: 30px;
    height: 40px;
    font-size: 0.95rem;
  }

  .letter-slot, .tile-btn {
    width: 40px;
    height: 48px;
    font-size: 1.25rem;
  }

  .question-card {
    padding: 1.25rem 1rem;
    min-height: auto;
  }

  .clue-vietnamese {
    font-size: 1.4rem;
  }
}
