@import url('https://fonts.googleapis.com/css2?family=Fredoka:wght@500;600;700&family=Nunito:wght@600;700;800;900&display=swap');

:root {
  /* Gamified Color Palette */
  --bg: #F0F9FF; /* Soft sky blue */
  --bg-pattern: #E0F2FE;
  --surface: #FFFFFF;
  --surface-alt: #F8FAFC;
  --line: #CBD5E1;
  
  --text: #334155;
  --muted: #64748B;
  
  /* Primary: Vibrant Yellow/Honey */
  --primary: #FBBF24;
  --primary-dark: #D97706;
  --primary-light: #FEF3C7;
  
  /* Secondary: Bright Blue */
  --secondary: #38BDF8;
  --secondary-dark: #0284C7;
  --secondary-light: #E0F2FE;
  
  /* Accent: Playful Pink/Red */
  --accent: #FB7185;
  --accent-dark: #E11D48;
  --accent-light: #FFE4E6;
  
  /* Success: Mint Green */
  --success: #34D399;
  --success-dark: #059669;
  --success-light: #D1FAE5;
  
  /* Danger: Soft Red */
  --danger: #F87171;
  --danger-dark: #DC2626;
  --danger-light: #FEE2E2;

  /* Typography */
  --font-heading: 'Fredoka', system-ui, -apple-system, sans-serif;
  --font-body: 'Nunito', system-ui, -apple-system, sans-serif;
  
  /* Shadows - Solid 3D Game style */
  --shadow-card: 0 8px 0 var(--line);
  --shadow-card-hover: 0 4px 0 var(--line);
  --shadow-card-active: 0 0 0 var(--line);
  --shadow-btn: 0 6px 0 var(--line);
  
  /* Radii */
  --radius-xl: 32px;
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --radius-pill: 999px;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.5;
  font-weight: 700;
  background-image: radial-gradient(var(--bg-pattern) 3px, transparent 3px);
  background-size: 24px 24px;
}

h1, h2, h3, .theme-name, .mode-title, .flip-hint, .stats-value, .prompt-text, .section-title, .mistake-word {
  font-family: var(--font-heading);
}

button, input, select {
  font-family: inherit;
  border: none;
  outline: none;
}
button {
  cursor: pointer;
  user-select: none;
}

/* Animations */
@keyframes popIn {
  0% { opacity: 0; transform: scale(0.95) translateY(10px); }
  60% { opacity: 1; transform: scale(1.02) translateY(-2px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}

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

@keyframes slideBg {
  0% { background-position: 0 0; }
  100% { background-position: 20px 0; }
}

@keyframes bounceFeedback {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1) translateY(-4px); }
}

@keyframes pulseGlow {
  0% { box-shadow: 0 0 5px #A78BFA, 0 0 10px #8B5CF6; filter: brightness(1); }
  100% { box-shadow: 0 0 15px #A78BFA, 0 0 25px #8B5CF6; filter: brightness(1.2); }
}

/* Layout */
.page-shell {
  width: min(100%, 800px);
  margin: 0 auto;
  padding: 24px 16px 40px;
}
.screen { display: none; }
.screen.is-active { 
  display: block; 
  animation: popIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards; 
}

/* Headers */
.hero, .subhero {
  text-align: center;
  margin-bottom: 24px;
  padding: 0 16px;
  position: relative;
}
.hero h1 {
  margin: 4px 0 0;
  font-size: clamp(1.6rem, 6vw, 2.2rem);
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.5px;
}
.subhero h1 {
  margin: 0;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
}
.hero-text {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 1.05rem;
  font-weight: 700;
}
.subhero .hero-text {
  margin: 4px 0 0;
  font-size: 0.95rem;
}
.subhero-title-area {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.subhero-title-content {
  flex: 1;
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}
.icon-button {
  width: 48px;
  height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 4px 0 var(--line);
  border: 2px solid var(--line);
  transition: all 0.15s ease;
  flex-shrink: 0;
}
.icon-button:active {
  transform: translateY(4px);
  box-shadow: 0 0 0 var(--line);
}
.icon-button.ghost {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  color: var(--muted);
}
.icon-button.ghost:hover {
  background: var(--surface);
  color: var(--text);
  border-color: var(--line);
  box-shadow: 0 4px 0 var(--line);
  transform: translateY(-2px);
}
.icon-button.ghost:active {
  transform: translateY(2px);
  box-shadow: 0 0 0 var(--line);
}

.subhero-controls {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.subhero-progress-wrapper {
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 200px;
  gap: 12px;
  background: var(--surface);
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  box-shadow: 0 4px 0 var(--line);
  border: 2px solid var(--line);
}

.subhero-progress {
  flex: 1;
  margin-top: 0;
}

.subhero-progress-text {
  font-weight: 900;
  color: var(--primary-dark);
  font-size: 1rem;
  background: var(--primary-light);
  padding: 2px 10px;
  border-radius: var(--radius-pill);
  white-space: nowrap;
  flex-shrink: 0;
}

/* Voice Switch */
.voice-switch-container {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  height: 48px; /* Fixed height for alignment */
  padding: 0 16px;
  border-radius: var(--radius-pill);
  box-shadow: 0 4px 0 var(--line);
  border: 2px solid var(--line);
  transition: transform 0.2s;
}
.voice-switch-container:hover {
  transform: translateY(-2px);
}
.voice-label {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--muted);
  transition: color 0.3s ease;
  user-select: none;
}
.voice-label.is-active {
  color: var(--text);
}
.voice-label-female.is-active {
  color: var(--accent-dark);
}
.voice-label-male.is-active {
  color: var(--secondary-dark);
}

.order-switch-container {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  height: 48px; /* Match voice switch height */
  padding: 0 16px;
  border-radius: var(--radius-pill);
  box-shadow: 0 4px 0 var(--line);
  border: 2px solid var(--line);
  cursor: pointer;
  user-select: none;
  transition: transform 0.2s, box-shadow 0.2s;
}
.order-switch-container:hover {
  transform: translateY(-2px);
}
.order-switch-container:active {
  transform: translateY(2px);
  box-shadow: 0 0 0 var(--line);
}
.order-switch-text {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--text);
  transition: color 0.2s;
}
.order-checkbox-custom {
  width: 24px;
  height: 24px;
  border-radius: 8px;
  background: var(--surface-alt);
  border: 2px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  color: transparent;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.05);
}
.order-switch-container[aria-checked="true"] .order-checkbox-custom {
  background: var(--secondary);
  border-color: var(--secondary-dark);
  color: white;
  box-shadow: none;
}
.order-switch-container[aria-checked="true"] .order-switch-text {
  color: var(--secondary-dark);
}
.order-switch-container[aria-checked="false"] .order-checkbox-custom svg {
  transform: scale(0.5);
  opacity: 0;
}
.order-switch-container[aria-checked="true"] .order-checkbox-custom svg {
  transform: scale(1);
  opacity: 1;
}

.voice-switch {
  position: relative;
  width: 60px;
  height: 32px;
  background-color: var(--accent); /* Female default pink */
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: background-color 0.3s;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
}
.voice-switch.is-male {
  background-color: var(--secondary); /* Male blue */
}
.voice-switch-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 28px;
  height: 28px;
  background-color: white;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
}
.voice-switch.is-male .voice-switch-knob {
  transform: translateX(28px);
  color: var(--secondary);
}
.voice-switch-knob svg {
  width: 16px;
  height: 16px;
}

/* Sections */
.section-block {
  margin-bottom: 32px;
}
.mistakes-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 12px;
}
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding: 0 8px;
}
.mistakes-section-head {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  min-height: 64px;
}
.mistakes-section-head > div {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  width: max-content;
  max-width: calc(100% - 140px);
}
.mistakes-section-head > button {
  margin-left: auto;
}
.section-title {
  margin: 0;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text);
}

/* Grids */
.theme-grid, .mode-grid, .stats-grid {
  display: grid;
  gap: 16px;
}
.theme-grid { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.mode-grid { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.stats-grid { grid-template-columns: repeat(2, 1fr); }
@media(min-width: 600px) {
  .stats-grid { grid-template-columns: repeat(4, 1fr); }
  .mode-grid { grid-template-columns: repeat(3, 1fr); }
}

/* Base Cards */
.theme-card, .mode-card, .mistake-item, .stats-grid > article {
  background: var(--surface);
  border-radius: var(--radius-xl);
  padding: 24px;
  box-shadow: var(--shadow-card);
  border: 2px solid var(--line);
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s ease, border-color 0.2s;
  position: relative;
}
.theme-card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  text-align: left;
  gap: 8px;
}
.theme-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  width: 100%;
}
.theme-progress-text {
  font-weight: 900;
  color: var(--muted);
  font-size: 1rem;
  background: var(--surface-alt);
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  border: 2px solid var(--line);
  white-space: nowrap; /* Prevent numbers from wrapping */
  flex-shrink: 0; /* Prevent the badge from shrinking */
}
.theme-progress-bar {
  height: 12px;
  background: var(--line);
  border-radius: var(--radius-pill);
  margin-top: 12px;
  overflow: hidden;
  width: 100%;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.05);
}
.theme-progress-bar span {
  display: block;
  height: 100%;
  background-color: var(--success);
  background-image: linear-gradient(45deg, rgba(255,255,255,0.2) 25%, transparent 25%, transparent 50%, rgba(255,255,255,0.2) 50%, rgba(255,255,255,0.2) 75%, transparent 75%, transparent);
  background-size: 20px 20px;
  animation: slideBg 1s linear infinite;
  border-radius: var(--radius-pill);
  transition: width 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.theme-card:hover, .mode-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-card-hover);
  border-color: var(--primary);
}
.theme-card:active, .mode-card:active {
  transform: translateY(4px);
  box-shadow: var(--shadow-card-active);
}
.theme-card.is-active, .mode-card.is-active {
  border-color: var(--primary);
  background: var(--primary-light);
}

/* Theme Cards specific */
.theme-name {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
}
.theme-meta {
  margin: 0;
  font-size: 0.95rem;
  color: var(--muted);
  font-weight: 800;
}

/* Gamified Theme Progress Rewards */
.theme-card.progress-25 {
  border-color: #FDBA74; /* Bronze/Orange tint */
  background: #FFF7ED;
}
.theme-card.progress-25 .theme-progress-bar span {
  background-color: #F97316;
}
.theme-card.progress-25::after {
  content: "🥉";
  position: absolute;
  top: -12px;
  right: -12px;
  font-size: 28px;
  filter: drop-shadow(0 4px 4px rgba(0,0,0,0.15));
  animation: popIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.theme-card.progress-50 {
  border-color: #94A3B8; /* Silver tint */
  background: #F8FAFC;
}
.theme-card.progress-50 .theme-progress-bar span {
  background-color: #64748B;
}
.theme-card.progress-50::after {
  content: "🥈";
  position: absolute;
  top: -12px;
  right: -12px;
  font-size: 32px;
  filter: drop-shadow(0 4px 4px rgba(0,0,0,0.15));
  animation: popIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.theme-card.progress-75 {
  border-color: #FBBF24; /* Gold tint */
  background: #FEF3C7;
  box-shadow: 0 8px 0 #D97706, 0 0 15px rgba(251, 191, 36, 0.3);
}
.theme-card.progress-75 .theme-progress-bar span {
  background-color: #D97706;
}
.theme-card.progress-75::after {
  content: "🥇";
  position: absolute;
  top: -16px;
  right: -16px;
  font-size: 36px;
  filter: drop-shadow(0 4px 4px rgba(0,0,0,0.2));
  animation: popIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.theme-card.progress-100 {
  border-color: #A78BFA; /* Diamond/Purple tint */
  background: #F5F3FF;
  box-shadow: 0 8px 0 #7C3AED, 0 0 20px rgba(139, 92, 246, 0.4);
}
.theme-card.progress-100 .theme-progress-bar span {
  background: linear-gradient(90deg, #F87171, #FBBF24, #34D399, #38BDF8, #A78BFA);
  box-shadow: 0 0 10px #A78BFA, 0 0 20px #8B5CF6;
  animation: pulseGlow 2s ease-in-out infinite alternate;
}
.theme-card.progress-100::after {
  content: "👑";
  position: absolute;
  top: -18px;
  right: -18px;
  font-size: 42px;
  filter: drop-shadow(0 4px 6px rgba(0,0,0,0.3));
  animation: popIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.theme-card.progress-100 .theme-progress-text {
  background: #7C3AED;
  color: white;
  border-color: #5B21B6;
}

/* Mode Cards specific */
.mode-card {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 16px;
  padding: 20px;
  cursor: pointer;
}
.mode-card-content {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
}
.mode-icon {
  width: 56px;
  height: 56px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-lg);
  font-size: 28px;
}
.mode-card[data-mode-select="flashcard"] .mode-icon { background: var(--primary-light); color: var(--primary-dark); }
.mode-card[data-mode-select="spelling"] .mode-icon { background: var(--accent-light); color: var(--accent-dark); }
.mode-card[data-mode-select="meaning"] .mode-icon { background: var(--success-light); color: var(--success-dark); }
.mode-title {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 700;
}
.mode-desc {
  margin: 6px 0 0;
  font-size: 0.95rem;
  color: var(--muted);
  font-weight: 700;
}

/* Practice Panel */
.practice-panel {
  background: var(--surface);
  border-radius: 36px;
  padding: 32px 24px;
  box-shadow: var(--shadow-card);
  border: 2px solid var(--line);
  margin-bottom: 32px;
}
.practice-counter-wrap {
  display: flex;
  justify-content: center;
  margin: 0 auto 18px;
}
header.subhero {
  text-align: center;
}
.practice-counter-wrap span {
  background: #fff7e6;
  color: var(--primary-dark);
  padding: 6px 18px;
  border-radius: var(--radius-pill);
  font-size: 1rem;
  font-weight: 900;
  border: 2px solid #f4d08a;
  box-shadow: none;
  line-height: 1;
}
.practice-view { display: none; }
.practice-view.is-active { display: block; animation: popIn 0.4s ease; }

/* Flip Card */
.flip-card {
  perspective: 1200px;
  width: 100%;
  min-height: 320px;
  margin-bottom: 24px;
  cursor: pointer;
}
.flip-card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 320px;
  text-align: center;
  transition: transform 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  transform-style: preserve-3d;
}
.flip-card.is-flipped .flip-card-inner {
  transform: rotateY(180deg);
}
.flip-face {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  background: var(--surface-alt);
  border: 4px solid var(--line);
  border-radius: 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 24px;
  box-shadow: inset 0 -6px 0 rgba(0,0,0,0.05);
}
.flip-back {
  transform: rotateY(180deg);
  border-color: var(--primary);
  background: var(--primary-light);
}
.flip-hint {
  color: var(--muted);
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 2px;
  margin: 0 0 16px;
  font-weight: 700;
}
#flashWord {
  font-size: clamp(1.8rem, 7vw, 3.4rem);
  font-weight: 700;
  margin: 0;
  color: var(--text);
  line-height: 1.15;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
  text-align: center;
}
#flashPos {
  color: var(--secondary-dark);
  font-weight: 800;
  font-size: 1.2rem;
  margin: 16px 0 0;
  background: var(--secondary-light);
  padding: 4px 12px;
  border-radius: var(--radius-pill);
}
#flashMeaning {
  font-size: clamp(1.8rem, 6vw, 2.8rem);
  font-weight: 700;
  margin: 0;
  color: var(--text);
}
.flip-example {
  color: var(--text);
  margin: 24px 0 0;
  font-size: 1.15rem;
  line-height: 1.6;
  font-weight: 700;
  opacity: 0.8;
}

/* Buttons */
.practice-actions {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
  width: 100%;
}
.practice-actions button {
  flex: 1;
  min-width: 140px;
}

.primary-button, .secondary-button, .ghost-button, .option-button {
  min-height: 64px;
  border-radius: var(--radius-lg);
  font-size: 1.15rem;
  font-weight: 900;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  border: 2px solid transparent;
}
.primary-button {
  background: var(--primary);
  color: var(--text);
  border-color: var(--primary-dark);
  box-shadow: 0 6px 0 var(--primary-dark);
}
.primary-button:active {
  transform: translateY(6px);
  box-shadow: 0 0 0 var(--primary-dark);
}
.secondary-button {
  background: var(--secondary);
  color: white;
  border-color: var(--secondary-dark);
  box-shadow: 0 6px 0 var(--secondary-dark);
}
.secondary-button:active {
  transform: translateY(6px);
  box-shadow: 0 0 0 var(--secondary-dark);
}
.ghost-button {
  background: var(--surface);
  color: var(--text);
  border-color: var(--line);
  box-shadow: 0 6px 0 var(--line);
}
.ghost-button:active {
  transform: translateY(6px);
  box-shadow: 0 0 0 var(--line);
}

.action-btn-green, .action-btn-pink {
  min-height: 48px;
  padding: 0 20px;
  border-radius: var(--radius-pill);
  font-size: 1rem;
  font-weight: 900;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  border: 2px solid transparent;
  color: white;
}
.action-btn-green {
  background: var(--success);
  border-color: var(--success-dark);
  box-shadow: 0 6px 0 var(--success-dark);
}
.action-btn-green:active {
  transform: translateY(6px);
  box-shadow: 0 0 0 var(--success-dark);
}
.action-btn-pink {
  background: var(--accent);
  border-color: var(--accent-dark);
  box-shadow: 0 6px 0 var(--accent-dark);
}
.action-btn-pink:active {
  transform: translateY(6px);
  box-shadow: 0 0 0 var(--accent-dark);
}

/* Specific buttons */
#flashMasteredButton {
  background: var(--success);
  border-color: var(--success-dark);
  box-shadow: 0 6px 0 var(--success-dark);
  color: white;
}
#flashMasteredButton:active { box-shadow: 0 0 0 var(--success-dark); }
#flashUnknownButton {
  background: var(--danger);
  border-color: var(--danger-dark);
  box-shadow: 0 6px 0 var(--danger-dark);
  color: white;
}
#flashUnknownButton:active { box-shadow: 0 0 0 var(--danger-dark); }

/* Audio Button */
.word-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  width: 100%;
}
.flip-front .word-row {
  flex-wrap: wrap;
}
.flip-front .audio-button {
  flex-shrink: 0;
}
.prompt-text-row {
  margin: 0 0 32px;
}
.audio-button {
  background: var(--secondary);
  color: white;
  border-radius: 50%;
  width: 56px;
  height: 56px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s, box-shadow 0.15s;
  border: 2px solid var(--secondary-dark);
  box-shadow: 0 6px 0 var(--secondary-dark);
  flex-shrink: 0;
  animation: float 3s ease-in-out infinite;
}
.audio-button:active {
  transform: translateY(6px);
  box-shadow: 0 0 0 var(--secondary-dark);
  animation: none;
}
.audio-button:hover {
  filter: brightness(1.1);
}

/* Spelling View */
.practice-label {
  color: var(--muted);
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 2px;
  margin: 0 0 16px;
  text-align: center;
  font-weight: 800;
}
.prompt-text {
  font-size: clamp(2rem, 7vw, 2.8rem);
  font-weight: 700;
  text-align: center;
  margin: 0 0 32px;
  color: var(--text);
}
.practice-note {
  text-align: center;
  color: var(--accent);
  font-weight: 800;
  margin: -16px 0 24px;
}
.answer-box {
  display: block;
  margin-bottom: 32px;
}
.answer-box span {
  display: none;
}
.answer-box input {
  width: 100%;
  min-height: 80px;
  border-radius: var(--radius-xl);
  border: 4px solid var(--line);
  background: var(--surface-alt);
  padding: 0 24px;
  font-size: 1.8rem;
  font-weight: 900;
  color: var(--text);
  text-align: center;
  transition: all 0.2s ease;
  box-shadow: inset 0 4px 6px rgba(0,0,0,0.05);
}
.answer-box input:focus {
  border-color: var(--secondary);
  background: var(--surface);
  box-shadow: 0 0 0 8px var(--secondary-light), inset 0 4px 6px rgba(0,0,0,0.05);
}
.feedback-text {
  text-align: center;
  min-height: 32px;
  margin: 24px 0;
  font-size: 1.25rem;
  font-weight: 900;
}
.feedback-text.is-success { color: var(--success-dark); animation: bounceFeedback 0.4s ease; }
.feedback-text.is-error { color: var(--danger-dark); animation: popIn 0.3s ease; }

.answer-panel {
  display: none;
  background: var(--success-light);
  color: var(--success-dark);
  padding: 24px;
  border-radius: var(--radius-lg);
  border: 3px solid var(--success);
  text-align: center;
  font-size: 1.4rem;
  font-weight: 900;
  margin-bottom: 24px;
}
.answer-panel.is-visible {
  display: block;
  animation: popIn 0.3s ease;
}

/* Meaning View Options */
.option-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 32px;
}
.option-button {
  background: var(--surface);
  color: var(--text);
  border: 3px solid var(--line);
  box-shadow: 0 6px 0 var(--line);
  text-align: left;
  justify-content: flex-start;
  padding: 0 24px;
  font-size: 1.2rem;
}
.option-button:active {
  transform: translateY(6px);
  box-shadow: 0 0 0 var(--line);
}
.option-button.is-correct {
  background: var(--success-light);
  border-color: var(--success-dark);
  color: var(--success-dark);
  box-shadow: 0 6px 0 var(--success-dark);
  animation: bounceFeedback 0.4s ease;
}
.option-button.is-correct:active { box-shadow: 0 0 0 var(--success-dark); }
.option-button.is-wrong {
  background: var(--danger-light);
  border-color: var(--danger-dark);
  color: var(--danger-dark);
  box-shadow: 0 6px 0 var(--danger-dark);
}
.option-button.is-wrong:active { box-shadow: 0 0 0 var(--danger-dark); }

/* Stats */
.stats-label {
  margin: 0;
  color: var(--muted);
  font-size: 1rem;
  font-weight: 800;
}
.stats-value {
  margin: 8px 0 0;
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--primary-dark);
}

/* Progress & Mistakes */
.mistake-list, .single-progress-card {
  display: grid;
  gap: 16px;
}

.mistake-item {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.mistake-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}
.mistake-word {
  margin: 0;
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--danger-dark);
}
.mistake-meta {
  margin: 4px 0 0;
  font-size: 1rem;
  color: var(--muted);
  font-weight: 800;
}
.mistake-note {
  margin: 0;
  color: var(--text);
  font-weight: 800;
  font-size: 1.1rem;
}
.mistake-actions {
  margin-top: 16px;
  display: flex;
  gap: 12px;
}
.mistake-actions button {
  flex: 1;
  min-height: 56px;
  font-size: 1rem;
}
.empty-hint {
  text-align: center;
  padding: 48px 20px;
  color: var(--muted);
  background: var(--surface-alt);
  border-radius: var(--radius-xl);
  border: 4px dashed var(--line);
  font-weight: 800;
  font-size: 1.2rem;
}

/* Word List */
.word-list-container {
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.list-group-header {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--primary-dark);
  padding-bottom: 12px;
  border-bottom: 4px solid var(--primary-light);
  margin-top: 24px;
}
.list-group-header:first-child {
  margin-top: 0;
}
.list-group-items {
  display: grid;
  gap: 16px;
}
.list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
  padding: 20px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  border: 2px solid var(--line);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.list-item:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-card-hover);
  border-color: var(--primary);
}
.list-item:active {
  transform: translateY(4px);
  box-shadow: var(--shadow-card-active);
}
.list-item.is-mastered {
  border-color: var(--success);
  background: var(--success-light);
}
.list-item-content {
  display: flex;
  align-items: baseline;
  gap: 16px;
  flex-wrap: wrap;
}
.list-item-word {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text);
  font-family: var(--font-heading);
}
.list-item.is-mastered .list-item-word {
  color: var(--success-dark);
}
.list-item-pos {
  font-size: 1rem;
  color: var(--secondary-dark);
  font-weight: 800;
  background: var(--secondary-light);
  padding: 2px 10px;
  border-radius: var(--radius-pill);
}
.list-item-meaning {
  font-size: 1.1rem;
  color: var(--muted);
  font-weight: 800;
}
.list-item-audio {
  width: 48px;
  height: 48px;
  color: white;
  background: var(--secondary);
  border-color: var(--secondary-dark);
  box-shadow: 0 4px 0 var(--secondary-dark);
  pointer-events: none;
}

@media (max-width: 600px) {
  .section-head {
    justify-content: center !important;
  }
  .mistakes-section-head {
    justify-content: flex-end !important;
  }
  .mistakes-section-head > div {
    max-width: calc(100% - 132px);
  }
}

@media (max-width: 480px) {
  .page-shell {
    padding-top: 16px;
  }
  .theme-card, .mode-card, .mistake-item, .stats-grid > article {
    padding: 20px;
  }
  .practice-panel {
    padding: 24px 16px;
    border-radius: 28px;
  }
  .flip-face {
    padding: 24px 16px;
    border-radius: 24px;
  }
}
