/* -------------------------------------------------------------
 * Vocabulary Game CSS - Rich Glassmorphism Aesthetics
 * ------------------------------------------------------------- */

:root {
  --bg: #090b11;
  --bg-gradient: radial-gradient(circle at 15% 20%, rgba(139, 92, 246, 0.15) 0%, transparent 40%),
                 radial-gradient(circle at 85% 80%, rgba(236, 72, 153, 0.12) 0%, transparent 45%),
                 #090b11;
  --panel: rgba(20, 24, 39, 0.7);
  --panel-border: rgba(255, 255, 255, 0.08);
  --ink: #f3f4f6;
  --muted: #9ca3af;
  
  /* Glowing themes */
  --theme-purple: #8b5cf6;
  --theme-purple-glow: rgba(139, 92, 246, 0.3);
  --theme-pink: #ec4899;
  --theme-pink-glow: rgba(236, 72, 153, 0.3);
  --theme-blue: #3b82f6;
  --theme-blue-glow: rgba(59, 130, 246, 0.3);
  --theme-teal: #14b8a6;
  --theme-teal-glow: rgba(20, 184, 166, 0.3);

  --correct: #10b981;
  --correct-bg: rgba(16, 185, 129, 0.15);
  --correct-border: rgba(16, 185, 129, 0.4);
  --wrong: #ef4444;
  --wrong-bg: rgba(239, 68, 68, 0.15);
  --wrong-border: rgba(239, 68, 68, 0.4);
  
  --shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.6);
  --radius: 24px;
}

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

body {
  font-family: 'Lexend', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  color: var(--ink);
  background: var(--bg-gradient);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 20px;
  overflow-x: hidden;
}

.container {
  width: min(960px, 95vw);
  margin: 16px auto 36px;
  position: relative;
  z-index: 10;
}

/* Glassmorphism Panel */
.glass-panel {
  background: var(--panel);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  padding: 35px;
  box-shadow: var(--shadow);
  animation: slideUp 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Header & Home Link */
.game-header {
  margin-bottom: 20px;
}

.home-link {
  display: inline-flex;
  align-items: center;
  color: var(--text-dim, #94a3b8);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  margin-bottom: 14px;
  transition: all 0.2s;
}

.home-link:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(192, 132, 252, 0.4);
  transform: translateY(-1px);
}

h1 {
  font-size: clamp(1.85rem, 4.5vw, 2.5rem);
  font-weight: 800;
  text-align: center;
  background: linear-gradient(135deg, #c084fc 0%, #f472b6 50%, #60a5fa 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 6px;
  letter-spacing: -0.5px;
}

.subtitle {
  text-align: center;
  color: var(--muted);
  font-size: 1.02rem;
  margin-bottom: 22px;
}

/* Global Stats Card */
.global-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 15px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  padding: 16px 20px;
  border-radius: 18px;
  margin-bottom: 24px;
  text-align: center;
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.stat-val {
  font-size: clamp(1.2rem, 3.5vw, 1.8rem);
  font-weight: 800;
  color: #fff;
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.1);
}

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

.stat-icon {
  font-size: 1.3rem;
  margin-bottom: 2px;
}

/* Topic / Theme Cards Grid */
.topics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 35px;
}

/* Core topics grid: 4 main topics laid out 2x2 */
@media (min-width: 500px) {
  .topics-grid-core {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ---------- Dashboard: Extra Materials ở panel bên trái, chủ đề chính bên phải ---------- */
/* Riêng màn hình chọn chủ đề được nới rộng để bung tràn cân đối hai bên */
.container:has(> #dashboard-screen:not([style*="none"])) {
  width: min(1440px, 95vw);
}

.container:has(> #mode-screen:not([style*="none"])) {
  width: min(1140px, 95vw);
}

#dashboard-screen {
  padding: 28px 32px;
}

.topics-layout {
  display: grid;
  grid-template-columns: 310px 1fr;
  grid-template-areas: "side main";
  gap: 24px;
  align-items: stretch;
  margin-bottom: 24px;
}

.topics-main {
  grid-area: main;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topics-side {
  grid-area: side;
  padding: 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: var(--radius);
}

.topics-heading {
  font-size: 1.25rem;
  font-weight: 700;
  color: #fff;
  margin: 0 0 16px;
}

.topics-side .topics-heading {
  font-size: 1.1rem;
  margin-bottom: 14px;
}

.topics-layout .topics-grid {
  margin-bottom: 0;
}

/* 4 chủ đề chính giãn đều theo chiều cao panel bên trái */
.topics-main .topics-grid-core {
  flex: 1;
  grid-auto-rows: 1fr;
}

.topics-grid-extra {
  grid-template-columns: 1fr;
  gap: 12px;
}

/* Thẻ Extra dạng hàng gọn: biểu tượng bên trái, tên / mô tả / tiến độ bên phải */
.topics-side .topic-card {
  display: grid;
  grid-template-columns: 40px 1fr;
  grid-template-areas:
    "icon title"
    "icon meta"
    "bar  bar"
    "score score";
  column-gap: 12px;
  align-items: center;
  text-align: left;
  padding: 14px 16px 12px;
}

.topics-side .topic-icon {
  grid-area: icon;
  align-self: start;
  font-size: 1.9rem;
  margin: 0;
}

.topics-side .topic-title {
  grid-area: title;
  font-size: 0.98rem;
  margin: 0 0 2px;
}

/* Chừa chỗ cho huy hiệu boss (👾 n) ở góc khi thẻ có boss */
.topics-side .topic-card:has(.topic-boss-badge) .topic-title {
  padding-right: 44px;
}

.topics-side .topic-meta {
  grid-area: meta;
  font-size: 0.76rem;
  line-height: 1.4;
  margin: 0 0 10px;
}

.topics-side .topic-progress-container {
  grid-area: bar;
}

.topics-side .stage-card-score {
  grid-area: score;
}

.topics-side .topic-card:hover:not(.locked) {
  transform: translateX(4px);
}

.topics-side .topic-boss-badge {
  top: 10px;
  right: 10px;
}

/* Màn hình hẹp: panel chuyển xuống dưới các chủ đề chính */
@media (max-width: 900px) {
  .topics-layout {
    grid-template-columns: 1fr;
    grid-template-areas: "main" "side";
  }
  .topics-main .topics-grid-core {
    grid-auto-rows: auto;
  }
  .topics-grid-extra {
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  }
}

.topic-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--radius);
  padding: 28px 20px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  position: relative;
  overflow: hidden;
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.topic-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 5px;
  transition: all 0.3s;
}

/* Color codes for topics */
.topic-card[data-topic="ourLife"]::before { background: var(--theme-purple); }
.topic-card[data-topic="ourSociety"]::before { background: var(--theme-blue); }
.topic-card[data-topic="ourEnvironment"]::before { background: var(--theme-teal); }
.topic-card[data-topic="ourFuture"]::before { background: var(--theme-pink); }

.topic-card:hover:not(.locked) {
  transform: translateY(-8px);
  background: rgba(255, 255, 255, 0.05);
}

.topic-card[data-topic="ourLife"]:hover:not(.locked) {
  border-color: var(--theme-purple-glow);
  box-shadow: 0 12px 30px rgba(139, 92, 246, 0.2);
}

/* Locked Card Styling */
.topic-card.locked {
  opacity: 0.55;
  cursor: not-allowed;
}

.lock-badge {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: 600;
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.topic-icon {
  font-size: 2.8rem;
  margin-bottom: 15px;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
}

.topic-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 8px;
  color: #fff;
}

.topic-meta {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 18px;
}

.topic-progress-container {
  width: 100%;
  background: rgba(255, 255, 255, 0.06);
  height: 6px;
  border-radius: 99px;
  overflow: hidden;
  margin-top: auto;
}

.topic-progress-fill {
  height: 100%;
  width: 0%;
  border-radius: 99px;
  transition: width 0.4s ease;
}

.topic-card[data-topic="ourLife"] .topic-progress-fill { background: var(--theme-purple); }

/* Play Mode Select Section */
.mode-selection-screen {
  animation: fadeIn 0.4s ease-out;
}

.mode-header {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-bottom: 25px;
}

.btn-back {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #fff;
  padding: 10px 18px;
  border-radius: 12px;
  cursor: pointer;
  font-family: inherit;
  font-weight: 600;
  font-size: 0.92rem;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transition: all 0.25s ease;
}

.btn-back:hover {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.35);
  transform: translateX(-3px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
}

.current-topic-badge {
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-ourLife {
  background: rgba(139, 92, 246, 0.15);
  color: #c084fc;
  border: 1px solid rgba(139, 92, 246, 0.4);
}

.badge-ourSociety {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.4);
}

.badge-demographicTerms {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.4);
}

.badge-ourEnvironment {
  background: rgba(20, 184, 166, 0.15);
  color: #2dd4bf;
  border: 1px solid rgba(20, 184, 166, 0.4);
}

.badge-ourFuture {
  background: rgba(236, 72, 153, 0.15);
  color: #f472b6;
  border: 1px solid rgba(236, 72, 153, 0.4);
}

.badge-phrasalVerbs {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.4);
}

.badge-collocations {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.4);
}

.badge-examIdioms {
  background: rgba(244, 63, 94, 0.15);
  color: #fb7185;
  border: 1px solid rgba(244, 63, 94, 0.4);
}

.modes-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  margin-top: 15px;
}

@media (min-width: 640px) {
  .modes-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.mode-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 20px;
  padding: 30px 25px;
  cursor: pointer;
  display: flex;
  gap: 20px;
  align-items: flex-start;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.mode-card:hover {
  transform: translateY(-5px);
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: 0 10px 25px rgba(0,0,0,0.2);
}

.mode-card-icon {
  font-size: 2.2rem;
  background: rgba(255, 255, 255, 0.03);
  padding: 12px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.mode-card-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.mode-card-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: #fff;
}

.mode-card-desc {
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.45;
}

/* -------------------------------------------------------------
 * 3D Flashcard UI
 * ------------------------------------------------------------- */
.flashcard-container {
  perspective: 1200px;
  width: min(500px, 100%);
  margin: 30px auto;
  position: relative;
}

.flashcard {
  width: 100%;
  height: 320px;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.7s cubic-bezier(0.175, 0.885, 0.32, 1.15);
  cursor: pointer;
}

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

.card-face {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  border-radius: var(--radius);
  padding: 30px 25px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  box-shadow: var(--shadow);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.card-front {
  background: linear-gradient(135deg, #1e1b4b 0%, #0f172a 100%);
}

.card-back {
  background: linear-gradient(135deg, #090d16 0%, #1e112d 100%);
  transform: rotateY(180deg);
}

/* Front Details */
.card-front .word-term {
  font-size: 2.1rem;
  font-weight: 800;
  color: #fff;
  margin-bottom: 6px;
  text-align: center;
  letter-spacing: -0.5px;
}

.word-type {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  color: #c084fc;
  background: rgba(139, 92, 246, 0.15);
  padding: 2px 8px;
  border-radius: 6px;
  margin-bottom: 12px;
}

.word-ipa {
  font-size: 1.1rem;
  color: var(--muted);
  font-family: 'Segoe UI', Arial, sans-serif;
  margin-bottom: 25px;
}

/* Pronunciation Audio Button */
.btn-speak {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #fff;
  padding: 10px 20px;
  border-radius: 50px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s;
}

.btn-speak:hover {
  background: rgba(139, 92, 246, 0.2);
  border-color: var(--theme-purple);
  transform: scale(1.05);
}

.card-hint {
  position: absolute;
  bottom: 20px;
  font-size: 0.8rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
  opacity: 0.75;
}

/* Back Details */
.card-back .word-meaning {
  font-size: 1.45rem;
  font-weight: 700;
  color: #10b981;
  margin-bottom: 20px;
  text-align: center;
}

.example-container {
  width: 100%;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  padding: 15px 18px;
  border-radius: 12px;
  text-align: left;
}

.example-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--muted);
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.example-en {
  font-size: 1rem;
  font-weight: 500;
  color: #f3f4f6;
  line-height: 1.45;
  margin-bottom: 6px;
}

.example-vi {
  font-size: 0.9rem;
  color: var(--muted);
  font-style: italic;
  line-height: 1.4;
}

/* Flashcard Navigation Controllers */
.flashcard-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: min(500px, 100%);
  margin: 20px auto 0;
  gap: 15px;
}

.btn-nav-card {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #fff;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  transition: all 0.2s;
}

.btn-nav-card:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.12);
  transform: scale(1.05);
}

.btn-nav-card:disabled {
  opacity: 0.25;
  cursor: not-allowed;
}

.card-progress-text {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--muted);
}

.flashcard-action-bar {
  display: flex;
  justify-content: center;
  gap: 15px;
  margin-top: 25px;
}

.btn-learn-status {
  padding: 12px 24px;
  border-radius: 12px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  border: none;
  transition: all 0.25s;
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-mark-learned {
  background: #10b981;
  color: #fff;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.2);
}

.btn-mark-learned:hover {
  background: #059669;
  transform: translateY(-2px);
}

.btn-unlearned {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--ink);
}

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

/* -------------------------------------------------------------
 * Vocabulary Mastery flashcards: richer card + spaced repetition
 * (scoped to #flashcard-screen; Exam Idioms shares this stylesheet)
 * ------------------------------------------------------------- */
.card-filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-bottom: 20px;
}

.card-filter-btn.active {
  color: #fff;
  background: rgba(139, 92, 246, 0.2);
  border-color: var(--theme-purple);
}

#flashcard-screen .flashcard {
  height: 440px;
}

#flashcard-screen .card-face {
  -webkit-backface-visibility: hidden;
}

#flashcard-screen .card-back {
  justify-content: flex-start;
  overflow-y: auto;
  padding: 26px 22px 18px;
  scrollbar-width: thin;
}

#flashcard-screen .card-back .word-meaning {
  margin-bottom: 8px;
}

.card-srs-badge {
  position: absolute;
  top: 16px;
  right: 16px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
}

.card-srs-badge:empty {
  display: none;
}

.card-srs-badge.is-review {
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.45);
  color: #fbbf24;
}

.card-srs-badge.is-mastered {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.45);
  color: #34d399;
}

.word-icon {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.3rem;
  background: rgba(139, 92, 246, 0.12);
  border: 1px solid rgba(139, 92, 246, 0.3);
  margin-bottom: 12px;
}

#flashcard-screen .word-type {
  text-transform: none;
  letter-spacing: 0.3px;
}

#flashcard-screen .word-ipa {
  margin-bottom: 20px;
}

.audio-row {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.word-definition {
  font-size: 0.95rem;
  color: #e2e8f0;
  line-height: 1.5;
  text-align: center;
  font-style: italic;
  margin-bottom: 16px;
}

.word-definition:empty {
  display: none;
}

.example-en mark {
  background: rgba(251, 191, 36, 0.18);
  color: #fcd34d;
  border-radius: 4px;
  padding: 0 3px;
  font-weight: 700;
}

.word-relations {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 14px;
}

.word-relations:empty {
  display: none;
}

.relation-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  text-align: left;
}

.relation-label {
  flex: 0 0 92px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
}

.relation-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.relation-chip {
  font-size: 0.8rem;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid;
}

.relation-chip.syn {
  color: #6ee7b7;
  background: rgba(16, 185, 129, 0.1);
  border-color: rgba(16, 185, 129, 0.35);
}

.relation-chip.ant {
  color: #fca5a5;
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.35);
}

.relation-chip.coll {
  color: #93c5fd;
  background: rgba(59, 130, 246, 0.1);
  border-color: rgba(59, 130, 246, 0.35);
}

#flashcard-screen .card-front .card-hint {
  left: 16px;
  right: 16px;
  justify-content: center;
  text-align: center;
}

#flashcard-screen .card-hint-inline {
  position: static;
  margin-top: 16px;
  align-self: center;
}

#flashcard-screen .flashcard-action-bar {
  margin-top: 0;
  gap: 10px;
}

.btn-srs {
  padding: 12px 20px;
  white-space: nowrap;
  border-radius: 12px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid;
  transition: all 0.2s;
}

.btn-srs:hover {
  transform: translateY(-2px);
}

.btn-srs-review {
  color: #fbbf24;
  background: rgba(245, 158, 11, 0.08);
  border-color: rgba(245, 158, 11, 0.4);
}

.btn-srs-review.active,
.btn-srs-review:hover {
  background: rgba(245, 158, 11, 0.2);
}

.btn-srs-mastered {
  color: #34d399;
  background: rgba(16, 185, 129, 0.08);
  border-color: rgba(16, 185, 129, 0.4);
}

.btn-srs-mastered.active,
.btn-srs-mastered:hover {
  background: rgba(16, 185, 129, 0.2);
}

.btn-srs.active {
  box-shadow: 0 0 0 2px currentColor inset;
}

.srs-hint {
  text-align: center;
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.5;
  margin-top: 16px;
}

@media (max-width: 560px) {
  #flashcard-screen .flashcard-controls {
    flex-wrap: wrap;
  }

  #flashcard-screen .flashcard-action-bar {
    order: 3;
    width: 100%;
  }

  #flashcard-screen .flashcard-action-bar .btn-srs {
    flex: 1;
    justify-content: center;
    padding: 12px 10px;
  }

  #flashcard-screen .btn-back {
    white-space: nowrap;
  }

  .relation-row {
    flex-direction: column;
    gap: 4px;
  }

  .relation-label {
    flex-basis: auto;
  }
}

/* -------------------------------------------------------------
 * Game Screen Generic Layout
 * ------------------------------------------------------------- */
.game-play-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.game-title-text {
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.game-progress-bar-container {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 99px;
  margin-bottom: 25px;
  overflow: hidden;
}

.game-progress-bar-fill {
  height: 100%;
  width: 0%;
  background: var(--theme-purple);
  border-radius: 99px;
  transition: width 0.35s ease;
}

/* -------------------------------------------------------------
 * Multiple Choice Quiz Screen
 * ------------------------------------------------------------- */
.quiz-question-box {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.04);
  padding: 25px;
  border-radius: 18px;
  margin-bottom: 25px;
  text-align: center;
}

.quiz-question-word {
  font-size: 2.2rem;
  font-weight: 800;
  color: #fff;
  margin-bottom: 6px;
  letter-spacing: -0.5px;
}

.quiz-question-ipa {
  font-size: 1.05rem;
  color: var(--muted);
  margin-bottom: 12px;
}

.quiz-question-hint {
  font-size: 0.95rem;
  color: var(--muted);
  font-style: italic;
}

.quiz-options-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-bottom: 25px;
}

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

.quiz-option-btn {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  color: var(--ink);
  padding: 16px 20px;
  border-radius: 14px;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 500;
  transition: all 0.2s;
  position: relative;
}

.quiz-option-btn:hover:not(.locked) {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(255, 255, 255, 0.15);
  transform: translateY(-2px);
}

.quiz-option-btn.locked {
  cursor: default;
}

.quiz-option-btn.correct {
  background: var(--correct-bg);
  border-color: var(--correct);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 0 15px rgba(16, 185, 129, 0.15);
}

.quiz-option-btn.correct::after {
  content: '✓';
  position: absolute;
  right: 18px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--correct);
  font-weight: 800;
  font-size: 1.2rem;
}

.quiz-option-btn.wrong {
  background: var(--wrong-bg);
  border-color: var(--wrong);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 0 15px rgba(239, 68, 68, 0.15);
}

.quiz-option-btn.wrong::after {
  content: '✗';
  position: absolute;
  right: 18px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--wrong);
  font-weight: 800;
  font-size: 1.2rem;
}

/* Explanation Panel */
.game-explanation {
  background: rgba(255, 255, 255, 0.02);
  border-left: 4px solid var(--theme-purple);
  padding: 16px 20px;
  border-radius: 0 12px 12px 0;
  margin-bottom: 25px;
  animation: slideDown 0.3s ease-out;
  text-align: left;
}

.game-explanation-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--theme-purple);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.game-explanation-content {
  font-size: 0.92rem;
  line-height: 1.5;
  color: var(--ink);
}

.game-footer-actions {
  display: flex;
  justify-content: flex-end;
}

.btn-game-next {
  background: var(--theme-purple);
  color: #fff;
  border: none;
  padding: 12px 28px;
  border-radius: 12px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 4px 15px var(--theme-purple-glow);
  transition: all 0.2s;
}

.btn-game-next:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px var(--theme-purple-glow);
}

/* -------------------------------------------------------------
 * Spelling / Writing Mode UI
 * ------------------------------------------------------------- */
.spelling-box {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.04);
  padding: 30px;
  border-radius: 18px;
  margin-bottom: 25px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
}

.spelling-meaning {
  font-size: 1.45rem;
  font-weight: 700;
  color: #c084fc;
}

.spelling-ipa {
  font-size: 1.05rem;
  color: var(--muted);
  font-family: 'Segoe UI', sans-serif;
}

.spelling-example-fill {
  background: rgba(255, 255, 255, 0.02);
  border: 1px dashed rgba(255, 255, 255, 0.1);
  padding: 12px 18px;
  border-radius: 12px;
  font-size: 1rem;
  line-height: 1.5;
  color: #e2e8f0;
}

.spelling-example-fill strong {
  color: var(--theme-purple);
  background: rgba(139, 92, 246, 0.1);
  padding: 2px 8px;
  border-radius: 6px;
  border-bottom: 2px solid var(--theme-purple);
}

.spelling-input-wrapper {
  width: 100%;
  max-width: 320px;
  position: relative;
  margin-top: 10px;
}

.spelling-input {
  width: 100%;
  background: rgba(0, 0, 0, 0.3);
  border: 2px solid rgba(255, 255, 255, 0.1);
  color: #fff;
  font-size: 1.4rem;
  font-weight: 700;
  text-align: center;
  padding: 12px 16px;
  border-radius: 14px;
  font-family: inherit;
  letter-spacing: 0.5px;
  transition: all 0.25s;
}

.spelling-input:focus {
  outline: none;
  border-color: var(--theme-purple);
  box-shadow: 0 0 15px var(--theme-purple-glow);
  background: rgba(0, 0, 0, 0.5);
}

.spelling-input.correct {
  border-color: var(--correct);
  box-shadow: 0 0 15px rgba(16, 185, 129, 0.2);
  background: rgba(16, 185, 129, 0.05);
}

.spelling-input.wrong {
  border-color: var(--wrong);
  box-shadow: 0 0 15px rgba(239, 68, 68, 0.2);
  background: rgba(239, 68, 68, 0.05);
}

.spelling-hints-row {
  display: flex;
  gap: 12px;
  margin-top: 5px;
}

.btn-spelling-hint {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  color: var(--muted);
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
}

.btn-spelling-hint:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.btn-spelling-hint:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* -------------------------------------------------------------
 * Matching Game Mode UI
 * ------------------------------------------------------------- */
.matching-timer-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255, 255, 255, 0.03);
  padding: 10px 18px;
  border-radius: 12px;
  margin-bottom: 20px;
  font-size: 0.95rem;
  font-weight: 600;
}

.timer-indicator {
  color: #ffb703;
  display: flex;
  align-items: center;
  gap: 6px;
}

.matching-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 25px;
  perspective: 800px;
}

@media (min-width: 500px) {
  .matching-grid {
    grid-template-columns: repeat(2, 1fr);
    max-width: 540px;
    margin-left: auto;
    margin-right: auto;
  }
}

.matching-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.07);
  padding: 18px 12px;
  border-radius: 14px;
  min-height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 0.92rem;
  font-weight: 600;
  color: #f3f4f6;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.1);
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
  user-select: none;
}

.matching-card:hover:not(.matched):not(.selected) {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.15);
  transform: translateY(-2px);
}

.matching-card.selected {
  background: rgba(139, 92, 246, 0.15);
  border-color: var(--theme-purple);
  box-shadow: 0 0 15px rgba(139, 92, 246, 0.25);
  transform: scale(1.02);
}

.matching-card.matched {
  background: rgba(16, 185, 129, 0.12);
  border-color: var(--correct);
  color: rgba(255, 255, 255, 0.4);
  cursor: default;
  transform: scale(0.98);
  box-shadow: none;
}

.matching-card.mismatch {
  background: rgba(239, 68, 68, 0.15);
  border-color: var(--wrong);
  box-shadow: 0 0 15px rgba(239, 68, 68, 0.25);
  animation: shake 0.4s ease-in-out;
}

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

/* -------------------------------------------------------------
 * Result Page / Score Overlay
 * ------------------------------------------------------------- */
.results-screen-content {
  text-align: center;
  animation: fadeIn 0.5s ease-out;
}

.trophy-illustration {
  font-size: 5rem;
  margin-bottom: 15px;
  filter: drop-shadow(0 4px 12px rgba(251, 191, 36, 0.3));
  display: inline-block;
  animation: float 2s infinite ease-in-out;
}

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

.results-stats-row {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin: 25px 0 35px;
}

.res-stat-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  padding: 15px 25px;
  border-radius: 16px;
  min-width: 130px;
}

.res-stat-val {
  font-size: 1.6rem;
  font-weight: 800;
  color: #fff;
}

.res-stat-label {
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
  margin-top: 4px;
}

.res-stat-val.xp-gain {
  color: #fcd34d;
}

.results-buttons {
  display: flex;
  flex-direction: column;
  gap: 15px;
  align-items: center;
}

@media (min-width: 480px) {
  .results-buttons {
    flex-direction: row;
    justify-content: center;
  }
}

.btn-res {
  padding: 14px 28px;
  border-radius: 12px;
  font-size: 0.95rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-res-primary {
  background: var(--theme-purple);
  color: #fff;
  border: none;
  box-shadow: 0 4px 15px var(--theme-purple-glow);
}

.btn-res-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px var(--theme-purple-glow);
}

.btn-res-secondary {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #fff;
}

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

/* General Layout utilities */
.reset-history-wrapper {
  margin-top: 35px;
  display: flex;
  justify-content: center;
}

.btn-danger-outline {
  background: transparent;
  color: #f87171;
  border: 1px dashed rgba(248, 113, 113, 0.4);
  padding: 10px 20px;
  border-radius: 10px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  transition: all 0.2s;
}

.btn-danger-outline:hover {
  background: rgba(248, 113, 113, 0.08);
  border-color: #ef4444;
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.1);
}

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

/* Custom Scrollbar for overflow elements */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.15);
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Instruction banner for sentence completion */
.instruction-banner {
  background: rgba(245, 158, 11, 0.08);
  border-left: 4px solid #f59e0b;
  color: #fbbf24;
  padding: 12px 16px;
  border-radius: 6px;
  font-size: 0.85rem;
  line-height: 1.5;
  font-style: italic;
  margin-bottom: 15px;
}

.sentence-question-text {
  font-size: 1.15rem;
  color: #fff;
  font-weight: 500;
  line-height: 1.6;
  margin: 0;
}

