/* ==========================================================================
   WordHero (单词小英雄) - Design System & Modern Aesthetics
   ========================================================================== */

:root {
  /* Color Palette - Vibrant, High-contrast, Kid-friendly & Modern */
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-light: #e0e7ff;
  --primary-gradient: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
  
  --secondary: #06b6d4;
  --secondary-hover: #0891b2;
  --secondary-light: #cffafe;
  
  --success: #10b981;
  --success-hover: #059669;
  --success-light: #d1fae5;
  --success-border: #a7f3d0;
  
  --warning: #f59e0b;
  --warning-light: #fef3c7;
  
  --danger: #ef4444;
  --danger-hover: #dc2626;
  --danger-light: #fee2e2;
  --danger-border: #fca5a5;
  
  --purple: #8b5cf6;
  --purple-light: #ede9fe;
  
  /* Neutral Colors */
  --bg-page: #f8fafc;
  --bg-card: #ffffff;
  --bg-card-subtle: #f1f5f9;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  --border-color: #e2e8f0;
  --border-subtle: #edf2f7;
  
  /* Glassmorphism */
  --glass-bg: rgba(255, 255, 255, 0.85);
  --glass-border: rgba(255, 255, 255, 0.6);
  --glass-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.06), 0 4px 6px -2px rgba(0, 0, 0, 0.04);
  --card-shadow: 0 12px 24px -4px rgba(79, 70, 229, 0.08), 0 4px 8px -2px rgba(0, 0, 0, 0.04);
  --modal-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  
  /* Radii & Spacing */
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --radius-full: 9999px;
  
  /* Typography */
  --font-sans: 'Outfit', 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-mono: 'Fira Code', 'JetBrains Mono', Consolas, monospace;
  
  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  --transition-spring: 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Dark Theme Support */
[data-theme="dark"] {
  --bg-page: #0b0f19;
  --bg-card: #151c2c;
  --bg-card-subtle: #1e293b;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-light: #64748b;
  --border-color: #243048;
  --border-subtle: #1a2234;
  
  --glass-bg: rgba(21, 28, 44, 0.85);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.4);
  --card-shadow: 0 12px 24px -4px rgba(0, 0, 0, 0.3);
  
  --primary-light: rgba(99, 102, 241, 0.15);
  --success-light: rgba(16, 185, 129, 0.15);
  --danger-light: rgba(239, 68, 68, 0.15);
  --warning-light: rgba(245, 158, 11, 0.15);
}

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

body {
  font-family: var(--font-sans);
  background: var(--bg-page);
  color: var(--text-main);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  background-image: 
    radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.08) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(6, 182, 212, 0.08) 0px, transparent 50%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

button, input, textarea, select {
  font-family: inherit;
  font-size: 1rem;
}

button {
  cursor: pointer;
  border: none;
  outline: none;
  user-select: none;
  touch-action: manipulation;
}

/* ==========================================================================
   Header & Navigation
   ========================================================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  transition: all var(--transition-normal);
}

.header-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo-brand {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  text-decoration: none;
  color: var(--text-main);
}

.logo-avatar {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  object-fit: cover;
  box-shadow: 0 4px 10px rgba(99, 102, 241, 0.25);
  border: 2px solid white;
}

.logo-text h1 {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1.2;
}

.logo-text span {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
  letter-spacing: 0.03em;
}

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

/* Nav Tab Pills */
.nav-tabs {
  display: flex;
  background: var(--bg-card-subtle);
  padding: 0.25rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-color);
}

.nav-tab-btn {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 1rem;
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: var(--radius-full);
  color: var(--text-muted);
  background: transparent;
  transition: all var(--transition-fast);
}

.nav-tab-btn:hover {
  color: var(--text-main);
}

.nav-tab-btn.active {
  background: var(--bg-card);
  color: var(--primary);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.badge-counter {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.1rem 0.45rem;
  border-radius: var(--radius-full);
  background: var(--danger-light);
  color: var(--danger);
}

/* Icon Buttons */
.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  transition: all var(--transition-fast);
}

.btn-icon:hover {
  background: var(--bg-card-subtle);
  transform: translateY(-1px);
}

/* ==========================================================================
   Layout & Container
   ========================================================================== */
.main-content {
  flex: 1;
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

.view-section {
  display: none;
  animation: fadeIn 0.3s ease;
}

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

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

/* ==========================================================================
   Cards & Panels
   ========================================================================== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  box-shadow: var(--card-shadow);
  position: relative;
  transition: box-shadow var(--transition-normal);
}

.card:hover {
  box-shadow: 0 16px 32px -6px rgba(79, 70, 229, 0.1);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  padding-bottom: 0.875rem;
  border-bottom: 1px solid var(--border-subtle);
}

.card-title {
  font-size: 1.25rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.65rem 1.35rem;
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  transition: all var(--transition-normal);
  text-decoration: none;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--primary-gradient);
  color: white;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.btn-primary:hover {
  opacity: 0.95;
  box-shadow: 0 6px 16px rgba(79, 70, 229, 0.4);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg-card-subtle);
  color: var(--text-main);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background: var(--border-subtle);
}

.btn-success {
  background: var(--success);
  color: white;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.btn-success:hover {
  background: var(--success-hover);
}

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

.btn-danger:hover {
  background: var(--danger-hover);
}

.btn-lg {
  padding: 0.875rem 2rem;
  font-size: 1.1rem;
  border-radius: var(--radius-lg);
}

.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.825rem;
  border-radius: var(--radius-sm);
}

/* ==========================================================================
   Home & Word Importer View
   ========================================================================== */
.hero-welcome {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 2rem;
  align-items: center;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.08) 0%, rgba(6, 182, 212, 0.08) 100%);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  padding: 2.5rem;
  margin-bottom: 2rem;
  position: relative;
  overflow: hidden;
}

.hero-text h2 {
  font-size: 2.25rem;
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 0.75rem;
  letter-spacing: -0.02em;
}

.hero-text p {
  color: var(--text-muted);
  font-size: 1.05rem;
  margin-bottom: 1.5rem;
  max-width: 540px;
}

.hero-mascot-wrapper {
  display: flex;
  justify-content: center;
  position: relative;
}

.hero-mascot-img {
  width: 240px;
  height: 240px;
  border-radius: var(--radius-xl);
  object-fit: cover;
  box-shadow: 0 20px 40px -10px rgba(79, 70, 229, 0.35);
  border: 4px solid white;
  animation: floatMascot 4s ease-in-out infinite;
}

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

/* Import Tabs */
.import-method-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
  border-bottom: 2px solid var(--border-color);
  padding-bottom: 0.5rem;
}

.import-tab-btn {
  padding: 0.6rem 1.2rem;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-muted);
  border-radius: var(--radius-md);
  background: transparent;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: all var(--transition-fast);
}

.import-tab-btn.active {
  background: var(--primary-light);
  color: var(--primary);
}

.import-panel {
  display: none;
}

.import-panel.active {
  display: block;
}

/* Upload Dropzone */
.dropzone {
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-lg);
  padding: 3rem 1.5rem;
  text-align: center;
  background: var(--bg-card-subtle);
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
}

.dropzone:hover, .dropzone.dragover {
  border-color: var(--primary);
  background: var(--primary-light);
}

.dropzone-icon {
  font-size: 2.5rem;
  margin-bottom: 0.75rem;
  display: block;
}

.dropzone-text h4 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 0.35rem;
}

.dropzone-text p {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.file-input-hidden {
  display: none;
}

/* Image Studio & Correction Box */
.img-studio-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.05);
}

.img-studio-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.img-studio-badge {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--primary);
  background: var(--primary-light);
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-full);
}

.img-info-text {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-left: 0.5rem;
}

.img-canvas-wrapper {
  width: 100%;
  max-height: 440px;
  min-height: 200px;
  overflow: auto;
  display: flex;
  justify-content: center;
  align-items: center;
  background: rgba(0, 0, 0, 0.03);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  padding: 0.75rem;
}

[data-theme="dark"] .img-canvas-wrapper {
  background: rgba(255, 255, 255, 0.03);
}

#img-studio-canvas {
  max-width: 100%;
  max-height: 420px;
  object-fit: contain;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
  border-radius: var(--radius-sm);
  transition: filter var(--transition-fast);
}

.img-orientation-tip {
  font-size: 0.825rem;
  color: var(--text-muted);
  background: var(--bg-card-subtle);
  padding: 0.65rem 1rem;
  border-radius: var(--radius-md);
  border-left: 3px solid var(--primary);
  line-height: 1.45;
}

.img-tools-bar {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.img-tools-group {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.img-tools-group .btn.active-enhance {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.img-extract-actions {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 0.85rem;
  margin-top: 0.25rem;
}

@media (max-width: 768px) {
  .img-extract-actions {
    grid-template-columns: 1fr;
  }
}

.btn-extract-main,
.btn-extract-sub {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.85rem 1.15rem;
  text-align: left;
  border-radius: var(--radius-md);
  cursor: pointer;
}

.btn-extract-main {
  background: var(--primary-gradient);
  color: #fff;
  border: none;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.35);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.btn-extract-main:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(99, 102, 241, 0.45);
}

.btn-icon-large {
  font-size: 1.6rem;
  flex-shrink: 0;
}

.btn-text-block {
  display: flex;
  flex-direction: column;
}

.btn-text-title {
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.2;
}

.btn-text-sub {
  font-size: 0.75rem;
  opacity: 0.85;
  margin-top: 0.2rem;
  line-height: 1.3;
}

/* OCR Progress */
.ocr-progress-box {
  margin-top: 1rem;
  padding: 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  display: none;
}

.ocr-progress-bar {
  width: 100%;
  height: 8px;
  background: var(--border-color);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-top: 0.5rem;
}

.ocr-progress-fill {
  width: 0%;
  height: 100%;
  background: var(--primary-gradient);
  transition: width 0.2s ease;
}

/* Textarea Input */
.paste-textarea {
  width: 100%;
  height: 160px;
  padding: 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-main);
  resize: vertical;
  line-height: 1.6;
  font-size: 0.95rem;
}

.paste-textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

/* Presets Bar */
.presets-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.75rem;
}

.preset-chip {
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-full);
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  font-size: 0.825rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.preset-chip:hover {
  background: var(--primary-light);
  color: var(--primary);
  border-color: var(--primary);
}

/* Word Bank Preview Table */
.word-table-wrapper {
  max-height: 380px;
  overflow-y: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  margin-top: 1rem;
}

.word-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.95rem;
}

.word-table th {
  position: sticky;
  top: 0;
  background: var(--bg-card-subtle);
  padding: 0.75rem 1rem;
  font-weight: 700;
  color: var(--text-muted);
  font-size: 0.85rem;
  border-bottom: 1px solid var(--border-color);
  z-index: 10;
}

.word-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-subtle);
}

.word-table tr:hover {
  background: var(--bg-card-subtle);
}

.word-table input.editable-cell {
  width: 100%;
  padding: 0.35rem 0.5rem;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-main);
  font-weight: 500;
}

.word-table input.editable-cell:focus {
  background: var(--bg-card);
  border-color: var(--primary);
  outline: none;
}

.word-table input.editable-cell.phonetic-input {
  font-family: 'Times New Roman', serif;
  color: var(--text-muted);
}

.word-table input.editable-cell.pos-input {
  color: var(--primary);
  font-weight: 700;
  font-size: 0.85rem;
}

/* Quick Add Word Panel */
.add-word-panel {
  background: var(--bg-card-subtle);
  border: 1px dashed var(--primary);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  margin-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  animation: fadeIn 0.2s ease-out;
}

.add-word-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
}

.add-word-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 0.8fr 1.8fr;
  gap: 0.75rem;
}

@media (max-width: 768px) {
  .add-word-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 480px) {
  .add-word-grid {
    grid-template-columns: 1fr;
  }
}

.form-label-sm {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.form-input-sm {
  width: 100%;
  padding: 0.45rem 0.65rem;
  font-size: 0.875rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-main);
  transition: all var(--transition-fast);
}

.form-input-sm:focus {
  border-color: var(--primary);
  outline: none;
  box-shadow: 0 0 0 2px var(--primary-light);
}

.add-word-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}


/* ==========================================================================
   Exam / Testing View
   ========================================================================== */
.exam-container {
  max-width: 760px;
  margin: 0 auto;
}

/* Anti-cheat Fullscreen & Shield Banner */
.shield-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.25rem;
  background: linear-gradient(90deg, #1e1b4b 0%, #312e81 100%);
  color: white;
  border-radius: var(--radius-lg);
  margin-bottom: 1.5rem;
  box-shadow: 0 4px 15px rgba(30, 27, 75, 0.2);
}

.shield-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.9rem;
}

.shield-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.65rem;
  background: rgba(16, 185, 129, 0.2);
  border: 1px solid rgba(16, 185, 129, 0.4);
  color: #34d399;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
}

.shield-badge.warning {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.4);
  color: #f87171;
}

/* Exam Progress Header */
.exam-progress-bar-container {
  margin-bottom: 1.5rem;
}

.exam-meta-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.streak-tag {
  color: #f97316;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  animation: pulseScale 1s ease infinite alternate;
}

@keyframes pulseScale {
  from { transform: scale(1); }
  to { transform: scale(1.05); }
}

.progress-track {
  width: 100%;
  height: 10px;
  background: var(--bg-card-subtle);
  border-radius: var(--radius-full);
  overflow: hidden;
  border: 1px solid var(--border-color);
}

.progress-fill {
  height: 100%;
  background: var(--primary-gradient);
  width: 0%;
  border-radius: var(--radius-full);
  transition: width 0.3s ease;
}

/* Exam Flashcard Card */
.exam-card {
  background: var(--bg-card);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 2.75rem 2rem;
  text-align: center;
  box-shadow: var(--card-shadow);
  position: relative;
  transition: all var(--transition-normal);
}

.exam-card.shake {
  animation: shakeEffect 0.5s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
  border-color: var(--danger);
}

.exam-card.success-pulse {
  animation: successPulse 0.4s ease;
  border-color: var(--success);
}

@keyframes shakeEffect {
  10%, 90% { transform: translate3d(-2px, 0, 0); }
  20%, 80% { transform: translate3d(4px, 0, 0); }
  30%, 50%, 70% { transform: translate3d(-6px, 0, 0); }
  40%, 60% { transform: translate3d(6px, 0, 0); }
}

@keyframes successPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.02); }
  100% { transform: scale(1); }
}

.prompt-chinese {
  font-size: 2.75rem;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 0.5rem;
  letter-spacing: -0.01em;
}

.prompt-hint-box {
  min-height: 28px;
  margin-bottom: 1.75rem;
}

.hint-letters {
  font-family: var(--font-mono);
  font-size: 1.4rem;
  letter-spacing: 0.3em;
  color: var(--primary);
  font-weight: 700;
}

.exam-input-group {
  max-width: 440px;
  margin: 0 auto 1.5rem;
  position: relative;
}

.exam-input {
  width: 100%;
  padding: 1rem 1.25rem;
  font-size: 1.5rem;
  font-weight: 700;
  font-family: var(--font-sans);
  text-align: center;
  border: 2px solid var(--border-color);
  border-radius: var(--radius-lg);
  background: var(--bg-card-subtle);
  color: var(--text-main);
  letter-spacing: 0.04em;
  transition: all var(--transition-fast);
}

.exam-input:focus {
  outline: none;
  background: var(--bg-card);
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-light);
}

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

/* Audio Pronunciation Button */
.btn-speaker {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: var(--radius-full);
  background: var(--secondary-light);
  color: var(--secondary);
  border: 1px solid rgba(6, 182, 212, 0.3);
  font-size: 1.25rem;
  transition: all var(--transition-fast);
}

.btn-speaker:hover {
  transform: scale(1.1);
  background: var(--secondary);
  color: white;
}

/* Live Feedback Box below input */
.live-feedback {
  margin-top: 1.25rem;
  padding: 0.875rem;
  border-radius: var(--radius-md);
  font-size: 1.05rem;
  font-weight: 700;
  display: none;
}

.live-feedback.correct {
  display: block;
  background: var(--success-light);
  color: var(--success-hover);
  border: 1px solid var(--success-border);
}

.live-feedback.wrong {
  display: block;
  background: var(--danger-light);
  color: var(--danger-hover);
  border: 1px solid var(--danger-border);
}

/* ==========================================================================
   Report & Statistics View
   ========================================================================== */
.report-header-banner {
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  color: white;
  border-radius: var(--radius-xl);
  padding: 2.5rem 2rem;
  text-align: center;
  margin-bottom: 2rem;
  box-shadow: 0 15px 35px -5px rgba(79, 70, 229, 0.4);
  position: relative;
  overflow: hidden;
}

.report-badge-trophy {
  font-size: 4rem;
  margin-bottom: 0.5rem;
  display: block;
}

.report-score-display {
  font-size: 3.5rem;
  font-weight: 800;
  line-height: 1;
  margin-bottom: 0.5rem;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.stat-box {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  text-align: center;
  box-shadow: var(--card-shadow);
}

.stat-box-num {
  font-size: 1.85rem;
  font-weight: 800;
  color: var(--primary);
  margin-bottom: 0.25rem;
}

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

/* Anti-Cheat Violation Warning Log Card */
.violation-card {
  background: #fff1f2;
  border: 1px solid #fecdd3;
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  margin-bottom: 2rem;
}

[data-theme="dark"] .violation-card {
  background: rgba(225, 29, 72, 0.1);
  border-color: rgba(225, 29, 72, 0.3);
}

.violation-card h4 {
  color: #be123c;
  font-size: 1.05rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.violation-list {
  list-style: none;
  font-size: 0.875rem;
  color: var(--text-main);
}

.violation-list li {
  padding: 0.35rem 0;
  border-bottom: 1px dashed rgba(225, 29, 72, 0.2);
}

/* Result Table Actions & Parent Mode */
.result-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1rem;
}

.parent-mode-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.85rem;
  background: var(--purple-light);
  color: var(--purple);
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 700;
}

/* ==========================================================================
   Memory Reinforcement & Flashcard View
   ========================================================================== */
.flashcard-stage {
  perspective: 1000px;
  max-width: 520px;
  height: 320px;
  margin: 2rem auto;
}

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

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

.flashcard-face {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: var(--radius-xl);
  padding: 2.5rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  box-shadow: 0 15px 35px -5px rgba(0, 0, 0, 0.1);
  border: 2px solid var(--border-color);
  background: var(--bg-card);
}

.flashcard-back {
  transform: rotateY(180deg);
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.05) 0%, rgba(6, 182, 212, 0.05) 100%);
}

.flashcard-word {
  font-size: 3rem;
  font-weight: 800;
  color: var(--primary);
  margin-bottom: 0.5rem;
}

.flashcard-chinese {
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--text-main);
}

/* ==========================================================================
   Modals & Popups
   ========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

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

.modal-content {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 460px;
  padding: 2rem;
  box-shadow: var(--modal-shadow);
  animation: modalPop 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalPop {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.modal-title {
  font-size: 1.35rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.modal-desc {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}

.form-group {
  margin-bottom: 1.25rem;
}

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 0.4rem;
  color: var(--text-muted);
}

.form-control {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  color: var(--text-main);
  font-size: 1rem;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

/* Violation Fullscreen Warning Popup */
.violation-popup {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: #dc2626;
  color: white;
  padding: 1rem 1.75rem;
  border-radius: var(--radius-full);
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  box-shadow: 0 10px 25px rgba(220, 38, 38, 0.5);
  z-index: 200;
  animation: slideDown 0.3s ease;
  max-width: 90vw;
}

@keyframes slideDown {
  from { opacity: 0; transform: translate(-50%, -20px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

/* ==========================================================================
   Footer
   ========================================================================== */
.site-footer {
  margin-top: auto;
  border-top: 1px solid var(--border-color);
  padding: 1.5rem 0;
  background: var(--bg-card);
  font-size: 0.85rem;
  color: var(--text-muted);
  text-align: center;
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  margin-top: 0.5rem;
}

.footer-links a {
  color: var(--primary);
  text-decoration: none;
}

.footer-links a:hover {
  text-decoration: underline;
}

/* Responsive */
@media (max-width: 768px) {
  .hero-welcome {
    grid-template-columns: 1fr;
    text-align: center;
    padding: 1.75rem;
  }
  
  .hero-text p {
    margin: 0 auto 1.5rem;
  }
  
  .hero-mascot-img {
    width: 180px;
    height: 180px;
  }
  
  .prompt-chinese {
    font-size: 2.1rem;
  }
  
  .exam-input {
    font-size: 1.25rem;
  }
  
  .header-container {
    padding: 0.5rem 1rem;
  }
  
  .nav-tabs {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    border-radius: 0;
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    justify-content: space-around;
    padding: 0.5rem;
    z-index: 50;
    border-top: 1px solid var(--border-color);
  }
  
  .main-content {
    padding-bottom: 5rem;
  }
}
