@import url('https://fonts.googleapis.com/css2?family=Fraunces:ital,wght@0,400;0,700;0,900;1,400&family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
  --primary: #FF6B35;
  --primary-light: #FF8C5A;
  --primary-dark: #E55A25;
  --secondary: #FFD166;
  --accent: #06D6A0;
  --accent-dark: #05B589;
  --purple: #7B5EA7;
  --navy: #1A1A2E;
  --bg: #FAFAF8;
  --surface: #FFFFFF;
  --surface2: #F4F3F0;
  --text: #1A1A2E;
  --text-muted: #6B7280;
  --text-light: #9CA3AF;
  --border: #E5E7EB;
  --border-dark: #D1D5DB;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
  --radius-sm: 8px;
  --radius: 16px;
  --radius-lg: 24px;
  --nav-h: 68px;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'Plus Jakarta Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 16px;
  line-height: 1.6;
}

/* ── NAVBAR ── */
.navbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-h);
  background: var(--surface);
  border-bottom: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 100;
}

.nav-logo {
  font-family: 'Fraunces', serif;
  font-size: 1.5rem;
  font-weight: 900;
  color: var(--primary);
  text-decoration: none;
  letter-spacing: -0.5px;
}

.nav-logo span { color: var(--navy); }

.nav-links {
  display: flex;
  gap: 4px;
  list-style: none;
}

.nav-links a {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.875rem;
  transition: all 0.15s;
}

.nav-links a:hover,
.nav-links a.active {
  background: var(--surface2);
  color: var(--text);
}

.nav-links a.active { color: var(--primary); }

.nav-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.nav-xp {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--secondary);
  padding: 6px 14px;
  border-radius: 100px;
  font-weight: 700;
  font-size: 0.875rem;
  color: var(--navy);
}

.nav-streak {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  font-size: 0.875rem;
  color: var(--primary);
}

.nav-level {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.8rem;
}

/* ── PAGE WRAPPER ── */
.page {
  padding-top: calc(var(--nav-h) + 32px);
  padding-bottom: 60px;
  min-height: 100vh;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
}

.container-sm {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ── TYPOGRAPHY ── */
.page-title {
  font-family: 'Fraunces', serif;
  font-size: 2.25rem;
  font-weight: 900;
  line-height: 1.2;
  color: var(--navy);
  margin-bottom: 8px;
}

.page-subtitle {
  color: var(--text-muted);
  font-size: 1rem;
  margin-bottom: 32px;
}

h2 {
  font-family: 'Fraunces', serif;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 16px;
}

h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 8px;
}

/* ── CARDS ── */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 2px solid var(--border);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s, border-color 0.2s;
}

.card:hover { box-shadow: var(--shadow); }

.card-clickable {
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  display: block;
}

.card-clickable:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow);
}

/* ── BUTTONS ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 700;
  font-size: 0.9375rem;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
  text-decoration: none;
  white-space: nowrap;
}

.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(255,107,53,0.35);
}

.btn-secondary {
  background: var(--surface2);
  color: var(--text);
  border: 2px solid var(--border);
}

.btn-secondary:hover:not(:disabled) {
  border-color: var(--primary);
  color: var(--primary);
}

.btn-accent {
  background: var(--accent);
  color: white;
}

.btn-accent:hover:not(:disabled) {
  background: var(--accent-dark);
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 2px solid var(--border);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--surface2);
  color: var(--text);
}

.btn-lg { padding: 16px 32px; font-size: 1.0625rem; border-radius: var(--radius-sm); }
.btn-sm { padding: 8px 16px; font-size: 0.8125rem; }
.btn-full { width: 100%; }
.btn-round { border-radius: 100px; }

/* ── BADGE ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 100px;
  font-size: 0.75rem;
  font-weight: 700;
}

.badge-primary { background: rgba(255,107,53,0.12); color: var(--primary); }
.badge-accent { background: rgba(6,214,160,0.12); color: var(--accent-dark); }
.badge-secondary { background: rgba(255,209,102,0.25); color: #B87A00; }
.badge-purple { background: rgba(123,94,167,0.12); color: var(--purple); }
.badge-gray { background: var(--surface2); color: var(--text-muted); }

/* ── PROGRESS BAR ── */
.progress-bar {
  height: 8px;
  background: var(--surface2);
  border-radius: 100px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 100px;
  transition: width 0.5s ease;
}

.progress-bar-fill.accent { background: var(--accent); }
.progress-bar-fill.purple { background: var(--purple); }

/* ── GRID ── */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }

/* ── STAT CARD ── */
.stat-card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 2px solid var(--border);
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-card .stat-icon {
  width: 40px; height: 40px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 8px;
  font-size: 1.25rem;
}

.stat-card .stat-value {
  font-family: 'Fraunces', serif;
  font-size: 2rem;
  font-weight: 900;
  line-height: 1;
  color: var(--navy);
}

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

/* ── LEVEL BADGE ── */
.level-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 100px;
  font-weight: 800;
  font-size: 0.8125rem;
}

.level-a1 { background: #DCFCE7; color: #166534; }
.level-a2 { background: #D1FAE5; color: #065F46; }
.level-b1 { background: #FEF3C7; color: #92400E; }
.level-b2 { background: #FED7AA; color: #9A3412; }
.level-c1 { background: #EDE9FE; color: #5B21B6; }
.level-c2 { background: #FCE7F3; color: #9D174D; }

/* ── TABS ── */
.tabs {
  display: flex;
  gap: 4px;
  background: var(--surface2);
  padding: 4px;
  border-radius: var(--radius-sm);
  margin-bottom: 24px;
  width: fit-content;
}

.tab-btn {
  padding: 8px 20px;
  border-radius: 6px;
  border: none;
  background: transparent;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  color: var(--text-muted);
  transition: all 0.15s;
}

.tab-btn.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.tab-content { display: none; }
.tab-content.active { display: block; }

/* ── INPUT ── */
.input-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.input-group label {
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--text);
}

.input, .textarea {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.9375rem;
  color: var(--text);
  background: var(--surface);
  transition: border-color 0.15s;
  outline: none;
}

.input:focus, .textarea:focus { border-color: var(--primary); }

.textarea { resize: vertical; min-height: 100px; line-height: 1.6; }

/* ── SECTION HEADER ── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

/* ── TOAST ── */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 999;
}

.toast {
  background: var(--navy);
  color: white;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.3s ease;
  max-width: 320px;
}

.toast.success { background: var(--accent-dark); }
.toast.error { background: #EF4444; }
.toast.warning { background: #F59E0B; }

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

/* ── MODAL ── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex; align-items: center; justify-content: center;
  z-index: 200;
  padding: 24px;
}

.modal-overlay.hidden { display: none; }

.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 32px;
  max-width: 520px;
  width: 100%;
  box-shadow: var(--shadow-lg);
}

/* ── LOADING ── */
.spinner {
  width: 24px; height: 24px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── HERO BANNER ── */
.hero-banner {
  background: var(--navy);
  border-radius: var(--radius-lg);
  padding: 40px;
  color: white;
  position: relative;
  overflow: hidden;
  margin-bottom: 32px;
}

.hero-banner::before {
  content: '';
  position: absolute;
  top: -40px; right: -40px;
  width: 200px; height: 200px;
  background: var(--primary);
  border-radius: 50%;
  opacity: 0.15;
}

.hero-banner::after {
  content: '';
  position: absolute;
  bottom: -60px; right: 80px;
  width: 160px; height: 160px;
  background: var(--secondary);
  border-radius: 50%;
  opacity: 0.1;
}

.hero-banner h1 {
  font-family: 'Fraunces', serif;
  font-size: 2rem;
  font-weight: 900;
  margin-bottom: 8px;
  line-height: 1.2;
}

.hero-banner p { opacity: 0.75; margin-bottom: 24px; }

/* ── HAMBURGER ── */
.nav-hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  padding: 6px;
  border: none;
  background: none;
}
.nav-hamburger span {
  display: block;
  width: 22px; height: 2px;
  background: var(--navy);
  border-radius: 2px;
  transition: all 0.25s;
}
.nav-hamburger.open span:nth-child(1) { transform: rotate(45deg) translate(5px,5px); }
.nav-hamburger.open span:nth-child(2) { opacity: 0; }
.nav-hamburger.open span:nth-child(3) { transform: rotate(-45deg) translate(5px,-5px); }

.mobile-menu {
  display: none;
  position: fixed;
  top: var(--nav-h);
  left: 0; right: 0;
  bottom: 0;
  background: var(--surface);
  z-index: 99;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: menuSlideDown 0.2s ease;
}
@keyframes menuSlideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.mobile-menu.open { display: block; }
.mobile-menu a {
  display: block;
  padding: 16px 24px;
  font-weight: 600;
  font-size: 1.0625rem;
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
}
.mobile-menu a:hover { background: var(--surface2); }
.mobile-menu a.active { color: var(--primary); background: rgba(255,107,53,0.04); }

/* ── RESPONSIVE ── */
@media (max-width: 900px) {
  .nav-links { display: none; }
  .nav-hamburger { display: flex; }
  .nav-streak { display: none; }
}

@media (max-width: 768px) {
  :root { --nav-h: 58px; }
  .navbar { padding: 0 16px; }
  .container, .container-sm { padding: 0 14px; }
  .page { padding-top: calc(var(--nav-h) + 18px); padding-bottom: 40px; }
  .page-title { font-size: 1.375rem; margin-bottom: 6px; }
  .page-subtitle { font-size: 0.8125rem; margin-bottom: 18px; }

  .grid-2 { grid-template-columns: 1fr; }
  .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); gap: 10px; }

  .hero-banner { padding: 18px 16px; border-radius: var(--radius); }
  .hero-banner h1 { font-size: 1.25rem; }
  .hero-banner p { font-size: 0.8125rem; margin-bottom: 16px; }

  .stat-card { padding: 14px 16px; }
  .stat-card .stat-value { font-size: 1.5rem; }
  .stat-card .stat-icon { width: 32px; height: 32px; margin-bottom: 6px; }

  /* Chat pages */
  .chat-layout { grid-template-columns: 1fr !important; }
  .sidebar { display: none; }
  .voice-hero { flex-direction: column; align-items: flex-start; gap: 16px; padding: 20px; }

  /* Lessons */
  .lessons-layout { grid-template-columns: 1fr !important; }
  .lessons-nav {
    position: static;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
    margin-bottom: 20px;
  }
  .lesson-nav-group { margin-bottom: 0; }
  .lesson-hero { padding: 20px; }
  .lesson-hero h1 { font-size: 1.375rem; }

  /* Flashcard */
  .fc-layout { grid-template-columns: 1fr !important; }
  .flashcard-scene { height: 200px; }
  .flashcard-word { font-size: 1.75rem; }

  /* Series */
  .show-grid { grid-template-columns: repeat(2, 1fr) !important; }
  .video-embed { aspect-ratio: 16/9; height: auto !important; }

  /* Games */
  .games-hub { grid-template-columns: repeat(2, 1fr) !important; }
  .word-match-grid { grid-template-columns: repeat(3, 1fr); }

  /* Stats */
  .stats-grid { grid-template-columns: repeat(2, 1fr) !important; }

  /* Dashboard feature grid */
  .feature-grid { grid-template-columns: repeat(2, 1fr) !important; }

  /* Setup */
  .setup-card { padding: 20px 16px; }

  /* Tables */
  .rule-table { font-size: 0.8125rem; }
  .rule-table th, .rule-table td { padding: 8px 10px; }

  /* Modal */
  .modal { padding: 20px 16px; }

  /* Navbar */
  .nav-logo { font-size: 1.25rem; }
  .nav-xp { display: none; }
  .nav-level { width: 30px; height: 30px; font-size: 0.7rem; }

  /* Cards */
  .card { padding: 16px; border-radius: var(--radius); }

  /* Section header responsive */
  .section-header { flex-wrap: wrap; gap: 8px; }

  /* Stats two-column layout */
  .stats-two-col { grid-template-columns: 1fr !important; }
  .achievement-grid { grid-template-columns: 1fr !important; }
  .rank-card { padding: 16px; }
}

@media (max-width: 480px) {
  :root { --nav-h: 54px; }
  .navbar { padding: 0 12px; }
  .container, .container-sm { padding: 0 12px; }

  .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .show-grid { grid-template-columns: 1fr !important; }
  .games-hub { grid-template-columns: 1fr !important; }
  .stats-grid { grid-template-columns: repeat(2, 1fr) !important; }
  .feature-grid { grid-template-columns: repeat(2, 1fr) !important; }
  .lessons-nav { grid-template-columns: 1fr; }
  .word-match-grid { grid-template-columns: repeat(2, 1fr); }
  .fc-actions { flex-wrap: wrap; justify-content: center; }
  .daily-challenge { flex-direction: column; }
  #dailyProgress { display: none; }

  .dialogue-line { padding: 10px 12px; gap: 8px; }
  .dialogue-speaker { min-width: 60px; font-size: 0.75rem; }
  .dialogue-text { font-size: 0.875rem; }

  .voice-btn-big { width: 64px; height: 64px; }
  .voice-btn-big svg { width: 26px; height: 26px; }

  .btn { padding: 10px 16px; font-size: 0.875rem; }
  .btn-sm { padding: 7px 12px; font-size: 0.75rem; }
}

/* ── CHAT ── */
.chat-container {
  display: flex;
  flex-direction: column;
  height: calc(100vh - var(--nav-h) - 180px);
  min-height: 400px;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: var(--radius) var(--radius) 0 0;
}

.message {
  display: flex;
  gap: 12px;
  max-width: 80%;
  animation: msgIn 0.2s ease;
}

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

.message.user { margin-left: auto; flex-direction: row-reverse; }

.msg-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
  font-weight: 700;
}

.message.ai .msg-avatar { background: var(--primary); color: white; }
.message.user .msg-avatar { background: var(--navy); color: white; }

.msg-bubble {
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 0.9375rem;
  line-height: 1.6;
}

.message.ai .msg-bubble {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 4px 16px 16px 16px;
}

.message.user .msg-bubble {
  background: var(--primary);
  color: white;
  border-radius: 16px 4px 16px 16px;
}

.msg-correction {
  margin-top: 8px;
  padding: 10px 14px;
  background: rgba(6,214,160,0.1);
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 0.8125rem;
  color: var(--accent-dark);
}

.chat-input-area {
  background: var(--surface);
  border: 2px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
  padding: 16px;
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.chat-input-area textarea {
  flex: 1;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.9375rem;
  resize: none;
  min-height: 44px;
  max-height: 120px;
  outline: none;
  transition: border-color 0.15s;
  line-height: 1.5;
}

.chat-input-area textarea:focus { border-color: var(--primary); }

.btn-voice {
  width: 44px; height: 44px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
  color: var(--text-muted);
  flex-shrink: 0;
}

.btn-voice:hover { border-color: var(--primary); color: var(--primary); }
.btn-voice.recording { background: #FEE2E2; border-color: #EF4444; color: #EF4444; animation: pulse 1s infinite; }

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

/* ── FLASHCARD ── */
.flashcard-scene {
  perspective: 1000px;
  width: 100%;
  max-width: 440px;
  height: 260px;
  margin: 0 auto 24px;
  cursor: pointer;
}

.flashcard-inner {
  position: relative;
  width: 100%; height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.flashcard-scene.flipped .flashcard-inner { transform: rotateY(180deg); }

.flashcard-front, .flashcard-back {
  position: absolute; inset: 0;
  backface-visibility: hidden;
  border-radius: var(--radius-lg);
  border: 2px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px;
  text-align: center;
}

.flashcard-front { background: var(--surface); }
.flashcard-back { background: var(--navy); color: white; transform: rotateY(180deg); }

.flashcard-word {
  font-family: 'Fraunces', serif;
  font-size: 2.5rem;
  font-weight: 900;
  color: var(--navy);
  margin-bottom: 8px;
}

.flashcard-back .flashcard-word { color: white; }

.flashcard-example {
  font-size: 0.875rem;
  color: rgba(255,255,255,0.7);
  font-style: italic;
  margin-top: 12px;
}

/* ── QUIZ ── */
.quiz-option {
  width: 100%;
  padding: 16px 20px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  cursor: pointer;
  text-align: left;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--text);
  transition: all 0.15s;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.quiz-option:hover:not(:disabled) { border-color: var(--primary); background: rgba(255,107,53,0.04); }
.quiz-option.correct { border-color: var(--accent); background: rgba(6,214,160,0.1); color: var(--accent-dark); }
.quiz-option.wrong { border-color: #EF4444; background: rgba(239,68,68,0.08); color: #B91C1C; }

.quiz-option-letter {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--surface2);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: 0.8125rem;
  flex-shrink: 0;
}

/* ── GAMES ── */
.game-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 2px solid var(--border);
  overflow: hidden;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  color: inherit;
  display: block;
}

.game-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: var(--primary); }

.game-card-image {
  height: 140px;
  display: flex; align-items: center; justify-content: center;
  font-size: 4rem;
}

.game-card-body { padding: 20px; }

/* ── WORD MATCH GAME ── */
.word-match-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.word-tile {
  padding: 14px 10px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  cursor: pointer;
  text-align: center;
  font-weight: 600;
  font-size: 0.875rem;
  transition: all 0.15s;
  user-select: none;
}

.word-tile:hover { border-color: var(--primary); background: rgba(255,107,53,0.04); }
.word-tile.selected { border-color: var(--primary); background: rgba(255,107,53,0.1); color: var(--primary); }
.word-tile.matched { border-color: var(--accent); background: rgba(6,214,160,0.1); color: var(--accent-dark); pointer-events: none; }
.word-tile.wrong { border-color: #EF4444; background: rgba(239,68,68,0.08); animation: shake 0.3s; }

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

/* ── SERIES ── */
.series-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 2px solid var(--border);
  overflow: hidden;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  color: inherit;
}

.series-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: var(--primary); }

.series-card-header {
  height: 100px;
  display: flex; align-items: center; justify-content: center;
  font-size: 3rem;
  font-weight: 900;
  font-family: 'Fraunces', serif;
  color: white;
}

.series-card-body { padding: 16px 20px; }

.dialogue-box {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.dialogue-line {
  display: flex;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  align-items: flex-start;
  cursor: pointer;
  transition: background 0.15s;
}

.dialogue-line:last-child { border-bottom: none; }
.dialogue-line:hover { background: var(--surface2); }

.dialogue-speaker {
  font-weight: 700;
  font-size: 0.8125rem;
  color: var(--primary);
  min-width: 80px;
  padding-top: 2px;
}

.dialogue-text { flex: 1; font-size: 0.9375rem; line-height: 1.5; }

.dialogue-translation {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-top: 4px;
  font-style: italic;
}

/* ── NEWS ── */
.article-card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 2px solid var(--border);
  padding: 24px;
  transition: all 0.2s;
  cursor: pointer;
}

.article-card:hover { border-color: var(--primary); box-shadow: var(--shadow); }

/* ── STATS ── */
.achievement {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  border-radius: var(--radius);
  border: 2px solid var(--border);
  background: var(--surface);
  transition: all 0.2s;
}

.achievement.locked { opacity: 0.4; filter: grayscale(1); }
.achievement-icon { font-size: 2rem; flex-shrink: 0; }
.achievement-info { flex: 1; }
.achievement-name { font-weight: 700; font-size: 0.9375rem; }
.achievement-desc { font-size: 0.8125rem; color: var(--text-muted); }

/* ── SETUP SCREEN ── */
.setup-screen {
  position: fixed; inset: 0;
  background: var(--bg);
  z-index: 300;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}

.setup-screen.hidden { display: none; }

.setup-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 40px;
  max-width: 480px;
  width: 100%;
  border: 2px solid var(--border);
  box-shadow: var(--shadow-lg);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
