/* ==========================================================================
   English 9-12 Master Learning & Exam System - Core Styles
   Modern, Ultra-responsive, Accessible, Glassmorphism & High Contrast
   ========================================================================== */

:root {
  /* Color Palette */
  --primary: #3b82f6;
  --primary-dark: #1d4ed8;
  --primary-light: #60a5fa;
  --primary-gradient: linear-gradient(135deg, #2563eb 0%, #4f46e5 100%);
  --secondary: #8b5cf6;
  --secondary-gradient: linear-gradient(135deg, #7c3aed 0%, #a855f7 100%);
  
  --success: #10b981;
  --success-bg: #ecfdf5;
  --success-border: #a7f3d0;
  
  --warning: #f59e0b;
  --warning-bg: #fffbeb;
  --warning-border: #fde68a;
  
  --danger: #ef4444;
  --danger-bg: #fef2f2;
  --danger-border: #fecaca;

  /* Difficulty Colors - High Contrast WCAG AA compliant */
  --easy-color: #047857;
  --easy-bg: #ecfdf5;
  --medium-color: #b45309;
  --medium-bg: #fef3c7;
  --hard-color: #b91c1c;
  --hard-bg: #fee2e2;

  /* Neutral tones - Light Mode (Default) */
  --bg-main: #f8fafc;
  --bg-surface: #ffffff;
  --bg-surface-glass: rgba(255, 255, 255, 0.85);
  --bg-alt: #f1f5f9;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-sub: #334155;
  --border-color: #cbd5e1;
  --border-focus: #2563eb;
  
  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);

  /* Font Scaling & Accessibility */
  --app-font-scale: 1;
  --exercise-font-boost: 1;

  /* Geometry */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

html {
  font-size: calc(16px * var(--app-font-scale, 1));
  transition: font-size 0.18s ease;
}

/* Dark Mode support */
[data-theme="dark"] {
  --bg-main: #0f172a;
  --bg-surface: #1e293b;
  --bg-surface-glass: rgba(30, 41, 59, 0.88);
  --bg-alt: #334155;
  --text-main: #f8fafc;
  --text-muted: #cbd5e1;
  --text-sub: #e2e8f0;
  --border-color: #475569;
  --success-bg: rgba(16, 185, 129, 0.2);
  --warning-bg: rgba(245, 158, 11, 0.2);
  --danger-bg: rgba(239, 68, 68, 0.2);
  --easy-color: #6ee7b7;
  --easy-bg: rgba(16, 185, 129, 0.22);
  --medium-color: #fde047;
  --medium-bg: rgba(245, 158, 11, 0.22);
  --hard-color: #fca5a5;
  --hard-bg: rgba(239, 68, 68, 0.22);
}

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

/* Font Awesome Protection: Bảo đảm các icon font không bao giờ bị ghi đè font-family */
.fa, .fas, .far, .fal, .fad, .fab,
.fa-solid, .fa-regular, .fa-brands,
[class^="fa-"], [class*=" fa-"],
[class^="fas"], [class*=" fas"],
[class^="far"], [class*=" far"],
[class^="fab"], [class*=" fab"] {
  font-family: "Font Awesome 6 Free" !important;
}

.fa::before, .fas::before, .far::before, .fal::before, .fad::before,
.fa-solid::before, .fa-regular::before,
[class^="fa-"]::before, [class*=" fa-"]::before,
[class^="fas"]::before, [class*=" fas"]::before,
[class^="far"]::before, [class*=" far"]::before {
  font-family: "Font Awesome 6 Free" !important;
}

.fab, .fa-brands,
.fab::before, .fa-brands::before,
[class^="fab"]::before, [class*=" fab"]::before {
  font-family: "Font Awesome 6 Brands" !important;
}

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.68;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea, optgroup {
  font-family: inherit;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  letter-spacing: -0.012em;
}

/* Exam Paper Serif Mode (Bộ Giáo Dục & Đào Tạo Mode) */
body[data-font-mode="serif"],
[data-font-mode="serif"] button,
[data-font-mode="serif"] input,
[data-font-mode="serif"] select,
[data-font-mode="serif"] textarea,
[data-font-mode="serif"] h1,
[data-font-mode="serif"] h2,
[data-font-mode="serif"] h3,
[data-font-mode="serif"] h4,
[data-font-mode="serif"] h5,
[data-font-mode="serif"] h6,
.exam-serif-paper {
  font-family: 'Times New Roman', Times, 'Liberation Serif', serif !important;
}

/* Layout Container */
.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1.25rem;
  width: 100%;
}

/* Header & Top Bar */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-surface-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
  height: auto;
  padding: 0.5rem 0;
  gap: 0.85rem;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--text-main);
  min-width: 0;
  flex: 1 1 auto;
  max-width: 520px;
}

.brand-icon {
  width: 44px;
  height: 44px;
  min-width: 44px;
  border-radius: var(--radius-md);
  background: var(--primary-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 1.35rem;
  box-shadow: 0 4px 10px rgba(37, 99, 235, 0.25);
  flex-shrink: 0;
}

.brand-text {
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.brand-title, .brand-text h1 {
  font-size: 0.98rem;
  line-height: 1.25;
  font-weight: 800;
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.01em;
  margin: 0;
  white-space: normal;
}

.brand-subtitle, .brand-text span {
  font-size: 0.76rem;
  color: var(--text-muted);
  font-weight: 600;
  line-height: 1.25;
  display: block;
  margin-top: 2px;
  white-space: normal;
}

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

/* Grade Selector Pills */
.grade-nav {
  display: flex;
  align-items: center;
  background: var(--bg-alt);
  padding: 4px;
  border-radius: var(--radius-full);
  gap: 4px;
}

.grade-btn {
  border: none;
  background: transparent;
  padding: 6px 16px;
  border-radius: var(--radius-full);
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
}

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

.grade-btn.active {
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.35);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.6rem 1.2rem;
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  cursor: pointer;
  border: 1px solid transparent;
  transition: var(--transition);
  text-decoration: none;
  line-height: 1.2;
  user-select: none;
}

.btn-primary {
  background: var(--primary-gradient);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}

.btn-primary:hover {
  opacity: 0.95;
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.35);
}

.btn-secondary {
  background: var(--bg-alt);
  color: var(--text-main);
  border-color: var(--border-color);
}

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

.btn-teacher {
  background: var(--secondary-gradient);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(124, 58, 237, 0.25);
}

.btn-teacher:hover {
  opacity: 0.95;
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(124, 58, 237, 0.35);
}

.btn-success {
  background: var(--success);
  color: #ffffff;
}

.btn-outline-danger {
  border-color: var(--danger);
  color: var(--danger);
  background: transparent;
}

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

.btn-icon {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: var(--radius-md);
  background: var(--bg-alt);
  color: var(--text-main);
  border: 1px solid var(--border-color);
}

.btn-icon:hover {
  background: var(--border-color);
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

.badge-easy {
  background: var(--easy-bg);
  color: var(--easy-color);
}

.badge-medium {
  background: var(--medium-bg);
  color: var(--medium-color);
}

.badge-hard {
  background: var(--hard-bg);
  color: var(--hard-color);
}

.badge-pill {
  border-radius: 999px;
  padding: 0.2rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 600;
}

/* Navigation Tabs Sub-header */
.sub-nav {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  padding: 0.5rem 0;
}

.nav-pills {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  overflow-x: auto;
  scrollbar-width: thin;
}

.nav-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  border: none;
  background: transparent;
  white-space: nowrap;
  transition: var(--transition);
}

.nav-pill:hover {
  color: var(--text-main);
  background: var(--bg-alt);
}

.nav-pill.active {
  color: var(--primary);
  background: rgba(59, 130, 246, 0.1);
}

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

/* Media Queries for Tablet and Smartphone */
@media (max-width: 768px) {
  .container {
    padding: 0 0.85rem;
  }

  .header-inner {
    height: auto;
    padding: 0.6rem 0;
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .brand-icon {
    width: 36px;
    height: 36px;
    font-size: 1.1rem;
  }

  .brand-text h1 {
    font-size: 1rem;
  }

  .brand-text span {
    font-size: 0.72rem;
  }

  .header-actions {
    gap: 0.4rem;
  }

  .btn-teacher {
    padding: 0.45rem 0.75rem;
    font-size: 0.8rem;
  }

  .grade-nav {
    order: 3;
    width: 100%;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    padding: 3px;
    gap: 2px;
  }

  .grade-btn {
    padding: 6px 2px;
    font-size: 0.82rem;
    text-align: center;
  }

  .sub-nav {
    padding: 0.35rem 0;
  }

  .nav-pills {
    padding-bottom: 2px;
    -webkit-overflow-scrolling: touch;
  }

  .nav-pill {
    padding: 0.4rem 0.75rem;
    font-size: 0.82rem;
  }

  .main-wrapper {
    padding: 1.25rem 0 6.5rem; /* space for bottom floating bar */
  }
}

@media (max-width: 480px) {
  .brand-text span {
    display: none; /* Keep header compact on very small phones */
  }

  .btn {
    padding: 0.5rem 0.85rem;
    font-size: 0.82rem;
  }

  .app-footer {
    padding: 1.25rem 0;
    font-size: 0.78rem;
  }
}

/* Author Badge & Room Indicators */
.author-banner-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.28rem 0.75rem;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.12), rgba(99, 102, 241, 0.12));
  border: 1px solid rgba(59, 130, 246, 0.3);
  border-radius: 9999px;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--primary);
  white-space: nowrap;
}

.room-indicator-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.28rem 0.65rem;
  border-radius: 6px;
  background: rgba(16, 185, 129, 0.1);
  color: #059669;
  border: 1px solid rgba(16, 185, 129, 0.25);
  white-space: nowrap;
}

/* ==========================================================================
   GRAMMAR COMPREHENSIVE HUB (29 CHUYÊN ĐỀ • 40 CÂU/BÀI) STYLES
   ========================================================================== */
.grammar-hero {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.08) 0%, rgba(124, 58, 237, 0.08) 100%);
  border: 1px solid rgba(59, 130, 246, 0.2);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  margin-bottom: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.grammar-controls {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  margin-bottom: 1.5rem;
}

.grammar-search-bar {
  position: relative;
  width: 100%;
}

.grammar-search-bar i {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 1rem;
}

.grammar-search-input {
  width: 100%;
  padding: 0.75rem 1rem 0.75rem 2.75rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  color: var(--text-main);
  transition: var(--transition);
}

.grammar-search-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.18);
}

.grammar-tier-pills {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.grammar-tier-btn {
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-full);
  font-size: 0.82rem;
  font-weight: 600;
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  color: var(--text-sub);
  cursor: pointer;
  transition: var(--transition);
}

.grammar-tier-btn:hover {
  background: var(--bg-alt);
  color: var(--text-main);
}

.grammar-tier-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
}

/* Master-Detail Layout */
.grammar-layout {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 1.5rem;
  align-items: start;
}

.grammar-sidebar {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1rem;
  position: sticky;
  top: 85px;
  max-height: calc(100vh - 110px);
  overflow-y: auto;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.grammar-sidebar-header {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  padding: 0.25rem 0.5rem 0.5rem;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 0.25rem;
}

.grammar-topic-item {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.65rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-main);
  text-align: left;
  cursor: pointer;
  transition: var(--transition);
  width: 100%;
}

.grammar-topic-item:hover {
  background: var(--bg-alt);
}

.grammar-topic-item.active {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.12), rgba(99, 102, 241, 0.12));
  border-color: rgba(59, 130, 246, 0.35);
  font-weight: 600;
}

.grammar-topic-item.active .topic-item-num {
  background: var(--primary);
  color: #ffffff;
}

.topic-item-num {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  height: 26px;
  border-radius: 6px;
  background: var(--bg-alt);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  flex-shrink: 0;
  margin-top: 2px;
}

.topic-item-info {
  flex: 1;
  min-width: 0;
}

.topic-item-title {
  font-size: 0.86rem;
  line-height: 1.35;
  white-space: normal;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.topic-item-meta {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

/* Main Detail Area */
.grammar-main {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  min-width: 0;
}

.topic-header-banner {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.topic-header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.topic-main-title {
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.3;
}

.subtopics-tags-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.85rem;
}

.subtopic-tag {
  font-size: 0.76rem;
  background: var(--bg-alt);
  color: var(--text-sub);
  padding: 0.2rem 0.55rem;
  border-radius: 4px;
  border: 1px solid var(--border-color);
}

/* Theory Card */
.theory-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.theory-card-header {
  padding: 1rem 1.5rem;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.06), rgba(99, 102, 241, 0.06));
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
}

.theory-card-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.theory-card-body {
  padding: 1.5rem;
  font-size: 0.95rem;
  line-height: 1.7;
}

/* Theory Elements */
.theory-section {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

.theory-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding-bottom: 0.35rem;
  border-bottom: 2px solid rgba(59, 130, 246, 0.25);
}

.theory-table-wrapper {
  overflow-x: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  margin: 0.5rem 0;
}

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

.theory-table th {
  background: var(--bg-alt);
  color: var(--text-main);
  padding: 0.65rem 0.85rem;
  font-weight: 700;
  border-bottom: 1px solid var(--border-color);
}

.theory-table td {
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid var(--border-color);
  vertical-align: top;
}

.theory-table tr:last-child td {
  border-bottom: none;
}

.formula-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 0.85rem;
  margin: 0.75rem 0;
}

.formula-card {
  background: var(--bg-alt);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.formula-badge {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--primary);
  background: rgba(59, 130, 246, 0.12);
  display: inline-block;
  align-self: flex-start;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
}

.formula-code {
  font-family: monospace;
  font-weight: 700;
  font-size: 0.95rem;
  color: #2563eb;
}

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

.formula-eg {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-style: italic;
  margin-top: 0.2rem;
}

.theory-callout {
  display: flex;
  gap: 0.85rem;
  padding: 1rem 1.15rem;
  border-radius: var(--radius-md);
  margin: 0.75rem 0;
  font-size: 0.88rem;
}

.theory-callout.tip {
  background: rgba(245, 158, 11, 0.09);
  border-left: 4px solid #f59e0b;
  color: var(--text-main);
}

.theory-callout i {
  color: #f59e0b;
  font-size: 1.15rem;
  margin-top: 2px;
  flex-shrink: 0;
}

.theory-list {
  padding-left: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-size: 0.92rem;
}

/* Exercise Cards */
.exercise-section-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.exercise-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-color);
}

.exercise-section-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

/* Subjective Item Styling */
.subjective-item {
  background: var(--bg-alt);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  transition: var(--transition);
}

.subjective-question-text {
  font-size: 0.96rem;
  font-weight: 600;
  color: var(--text-main);
  line-height: 1.5;
  white-space: pre-line;
}

.subjective-input-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.subjective-input-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.subjective-input {
  flex: 1;
  padding: 0.65rem 0.95rem;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  color: var(--text-main);
  font-size: 0.92rem;
  font-family: inherit;
  transition: var(--transition);
}

.subjective-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.subjective-input.correct {
  border-color: #10b981;
  background: rgba(16, 185, 129, 0.08);
}

.subjective-input.incorrect {
  border-color: #ef4444;
  background: rgba(239, 68, 68, 0.08);
}

.subj-feedback-box {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  line-height: 1.5;
  margin-top: 0.25rem;
}

.subj-feedback-box.correct {
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  color: #065f46;
}

.subj-feedback-box.incorrect {
  background: #fffbeb;
  border: 1px solid #fde68a;
  color: #92400e;
}

.subj-feedback-box.solution {
  background: rgba(59, 130, 246, 0.08);
  border: 1px solid rgba(59, 130, 246, 0.25);
  color: var(--text-main);
}

/* Floating / Sticky Submission Bar */
.grammar-bottom-bar {
  position: sticky;
  bottom: 1rem;
  background: var(--bg-surface-glass);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 0.85rem 1.5rem;
  box-shadow: var(--shadow-xl);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  z-index: 50;
}

@media (max-width: 960px) {
  .grammar-layout {
    grid-template-columns: 1fr;
  }
  .grammar-sidebar {
    position: static;
    max-height: 280px;
  }
}

/* ==========================================================================
   Accessibility & Customizable Font Size Scaling Styles
   ========================================================================== */

/* Enhanced exercise scaling */
.question-card,
.theory-card,
.reading-passage-card,
.passage-box,
.reading-box,
.option-item,
.explanation-box,
.dialogue-card,
.dialogue-box,
.speaking-audio-deck,
.vocab-card,
.unit-card,
.cloze-passage,
.audio-script-box,
.exam-passage-text {
  font-size: calc(1em * var(--exercise-font-boost, 1));
}

/* Header Font Size Widget */
.font-size-widget {
  display: inline-flex;
  align-items: center;
  background: var(--bg-alt);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-full);
  padding: 2px 4px;
  position: relative;
  box-shadow: var(--shadow-sm);
  user-select: none;
}

.font-size-btn {
  background: transparent;
  border: none;
  color: var(--text-main);
  padding: 3px 7px;
  border-radius: var(--radius-full);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  min-width: 28px;
  height: 28px;
}

.font-size-btn:hover {
  background: rgba(37, 99, 235, 0.15);
  color: var(--primary);
}

.font-size-label-btn {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--primary-dark);
  font-weight: 800;
  font-size: 0.8rem;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  min-width: 58px;
  justify-content: center;
  transition: var(--transition);
}

[data-theme="dark"] .font-size-label-btn {
  color: var(--primary-light);
}

.font-size-label-btn:hover {
  border-color: var(--primary);
  background: var(--primary-gradient);
  color: #ffffff;
}

/* Font Size Dropdown Popover */
.font-size-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 250px;
  background: var(--bg-surface);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xl);
  padding: 0.85rem;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  animation: fadeInDown 0.18s ease-out;
}

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

.font-size-dropdown-header {
  font-weight: 800;
  font-size: 0.84rem;
  color: var(--primary-dark);
  display: flex;
  align-items: center;
  gap: 0.4rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.4rem;
}

[data-theme="dark"] .font-size-dropdown-header {
  color: var(--primary-light);
}

.font-size-presets {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.35rem;
}

.font-preset-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.45rem 0.65rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: var(--bg-alt);
  color: var(--text-main);
  font-size: 0.84rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
}

.font-preset-item:hover {
  background: rgba(37, 99, 235, 0.12);
  border-color: var(--primary);
  color: var(--primary-dark);
}

.font-preset-item.active {
  background: var(--primary-gradient);
  color: #ffffff;
  border-color: transparent;
}

.font-preset-item .preset-tag {
  font-size: 0.74rem;
  opacity: 0.9;
  font-weight: 600;
}

.font-size-slider-wrap {
  border-top: 1px dashed var(--border-color);
  padding-top: 0.5rem;
}

/* Floating Accessibility Pill (Bottom Right) */
.floating-font-pill {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  background: var(--bg-surface-glass);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-full);
  padding: 6px 12px;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-main);
  user-select: none;
}

.floating-font-pill:hover {
  transform: translateY(-2px);
  border-color: var(--primary);
  box-shadow: 0 12px 24px rgba(37, 99, 235, 0.25);
  color: var(--primary);
}

.floating-font-pill .font-icon-wrap {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--primary-gradient);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
}





/* ==========================================================================
   SENTENCE TRANSFORMATION (VIẾT LẠI CÂU KHÔNG ĐỔI NGHĨA) STYLES
   ========================================================================== */

/* Hero Banner */
.st-master-hero {
  background: linear-gradient(135deg, #1e1b4b 0%, #312e81 50%, #4338ca 100%);
  color: #ffffff;
  padding: 2.2rem 2.4rem;
  border-radius: 20px;
  margin-bottom: 2rem;
  box-shadow: 0 16px 36px rgba(49, 46, 129, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.16);
  position: relative;
  overflow: hidden;
}

.st-master-hero::after {
  content: '';
  position: absolute;
  top: -40%;
  right: -10%;
  width: 320px;
  height: 320px;
  background: radial-gradient(circle, rgba(129, 140, 248, 0.25) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}

.st-hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(255, 255, 255, 0.16);
  backdrop-filter: blur(8px);
  padding: 0.4rem 1rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: #fde047;
  text-transform: uppercase;
  margin-bottom: 0.85rem;
}

.st-hero-title {
  font-size: 1.85rem;
  font-weight: 900;
  line-height: 1.25;
  margin: 0 0 0.65rem 0;
  letter-spacing: -0.01em;
}

.st-hero-subtitle {
  font-size: 0.98rem;
  opacity: 0.92;
  line-height: 1.6;
  max-width: 900px;
  margin: 0 0 1.2rem 0;
}

.st-hero-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.st-hero-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 0.4rem 0.95rem;
  border-radius: 10px;
  font-size: 0.82rem;
  font-weight: 700;
}

/* Unit Selector Horizontal Scroll */
.st-unit-selector-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.75rem;
  box-shadow: var(--shadow-sm);
}

.st-unit-selector-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.9rem;
}

.st-section-title {
  font-weight: 800;
  font-size: 0.96rem;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.st-unit-pills-wrap {
  display: flex;
  gap: 0.65rem;
  overflow-x: auto;
  padding-bottom: 6px;
  scrollbar-width: thin;
}

.st-unit-pill {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 0.65rem 1rem;
  border-radius: 12px;
  border: 1.5px solid var(--border-color);
  background: var(--bg-surface);
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 140px;
  text-align: left;
}

.st-unit-pill:hover {
  border-color: var(--primary);
  background: rgba(37, 99, 235, 0.05);
  transform: translateY(-2px);
}

.st-unit-pill.active {
  background: linear-gradient(135deg, #2563eb, #3b82f6);
  color: #ffffff;
  border-color: #2563eb;
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.3);
}

.st-pill-num {
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  opacity: 0.85;
}

.st-pill-title {
  font-size: 0.88rem;
  font-weight: 700;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 130px;
}

.st-pill-progress {
  font-size: 0.72rem;
  font-weight: 800;
  background: rgba(0, 0, 0, 0.18);
  padding: 1px 6px;
  border-radius: 6px;
  margin-top: 4px;
}

.st-unit-pill.active .st-pill-progress {
  background: rgba(255, 255, 255, 0.25);
  color: #ffffff;
}

/* Active Unit Card */
.st-active-unit-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 18px;
  padding: 1.5rem;
  margin-bottom: 1.75rem;
  box-shadow: var(--shadow-sm);
}

.st-unit-meta-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.st-unit-badge-lg {
  display: inline-block;
  background: rgba(37, 99, 235, 0.1);
  color: #2563eb;
  font-size: 0.8rem;
  font-weight: 800;
  padding: 0.25rem 0.75rem;
  border-radius: 6px;
  letter-spacing: 0.06em;
  margin-bottom: 0.4rem;
}

[data-theme="dark"] .st-unit-badge-lg {
  background: rgba(96, 165, 250, 0.15);
  color: #93c5fd;
}

.st-unit-main-title {
  font-size: 1.45rem;
  font-weight: 900;
  color: var(--text-main);
  margin: 0;
}

/* Submode Segmented Control */
.st-submode-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.st-submode-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  padding: 0.9rem 1.2rem;
  border-radius: 12px;
  font-weight: 800;
  font-size: 0.95rem;
  cursor: pointer;
  border: 2px solid var(--border-color);
  background: var(--bg-surface);
  color: var(--text-main);
  transition: all 0.2s ease;
}

.st-submode-btn:hover {
  border-color: var(--primary);
  background: rgba(37, 99, 235, 0.04);
}

.st-submode-btn.active {
  border-color: #2563eb;
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.1), rgba(59, 130, 246, 0.15));
  color: #2563eb;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.12);
}

[data-theme="dark"] .st-submode-btn.active {
  color: #93c5fd;
  border-color: #60a5fa;
  background: rgba(37, 99, 235, 0.2);
}

.st-mode-score-badge {
  background: rgba(0, 0, 0, 0.08);
  padding: 0.2rem 0.6rem;
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 800;
}

.st-submode-btn.active .st-mode-score-badge {
  background: #2563eb;
  color: #ffffff;
}

[data-theme="dark"] .st-submode-btn.active .st-mode-score-badge {
  background: #60a5fa;
  color: #0f172a;
}

.st-submode-desc {
  font-size: 0.86rem;
  color: var(--text-muted);
  line-height: 1.55;
  background: var(--bg-surface-soft, rgba(0,0,0,0.03));
  padding: 0.65rem 1rem;
  border-radius: 8px;
  border-left: 3px solid var(--primary);
}

/* Question Cards */
.st-questions-container {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  margin-bottom: 2.5rem;
}

.st-question-card {
  background: var(--bg-surface);
  border: 1.5px solid var(--border-color);
  border-radius: 16px;
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.st-question-card:hover {
  box-shadow: var(--shadow-md);
}

.st-question-card.card-correct {
  border-color: #10b981;
  background: linear-gradient(180deg, var(--bg-surface) 0%, rgba(16, 185, 129, 0.02) 100%);
}

.st-question-card.card-incorrect {
  border-color: #ef4444;
  background: linear-gradient(180deg, var(--bg-surface) 0%, rgba(239, 68, 68, 0.02) 100%);
}

.st-q-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.st-q-number {
  font-size: 0.92rem;
  font-weight: 800;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.st-status-badge {
  font-size: 0.78rem;
  font-weight: 800;
  padding: 0.25rem 0.65rem;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.st-status-badge.badge-correct {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
}

.st-status-badge.badge-incorrect {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}

/* Original Sentence Box */
.st-original-box {
  background: var(--bg-surface-soft, rgba(0, 0, 0, 0.03));
  border-left: 4px solid var(--primary);
  border-radius: 0 10px 10px 0;
  padding: 0.85rem 1.15rem;
  margin-bottom: 1rem;
}

[data-theme="dark"] .st-original-box {
  background: rgba(255, 255, 255, 0.04);
}

.st-orig-label {
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--primary);
  display: block;
  margin-bottom: 0.3rem;
}

.st-orig-text {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.55;
  margin: 0;
}

.st-instruction-line {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

/* MCQ Options */
.st-options-grid {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin-bottom: 1rem;
}

.st-opt-item {
  display: flex;
  align-items: center;
  padding: 0.85rem 1.1rem;
  border-radius: 12px;
  border: 1.5px solid var(--border-color);
  background: var(--bg-surface);
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.st-opt-item:hover:not(.opt-disabled) {
  border-color: var(--primary);
  background: rgba(37, 99, 235, 0.04);
  transform: translateX(4px);
}

.st-opt-letter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--bg-surface-soft, rgba(0,0,0,0.06));
  font-weight: 800;
  font-size: 0.85rem;
  margin-right: 0.85rem;
  flex-shrink: 0;
  color: var(--text-main);
}

.st-opt-text {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-main);
  line-height: 1.5;
  flex-grow: 1;
}

.st-opt-icon {
  margin-left: 0.75rem;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.st-opt-item.opt-selected {
  border-color: #2563eb;
  background: rgba(37, 99, 235, 0.08);
}

.st-opt-item.opt-correct {
  border-color: #10b981;
  background: rgba(16, 185, 129, 0.1);
}

.st-opt-item.opt-correct .st-opt-letter {
  background: #10b981;
  color: #ffffff;
}

.st-opt-item.opt-incorrect {
  border-color: #ef4444;
  background: rgba(239, 68, 68, 0.1);
}

.st-opt-item.opt-incorrect .st-opt-letter {
  background: #ef4444;
  color: #ffffff;
}

.st-opt-item.opt-disabled {
  cursor: default;
  opacity: 0.85;
}

/* Explanation Container */
.st-exp-container {
  margin-top: 1rem;
  padding: 1rem 1.15rem;
  background: var(--bg-surface-soft, rgba(0,0,0,0.03));
  border-radius: 10px;
  border-left: 3px solid #2563eb;
}

.st-grammar-badge {
  font-size: 0.84rem;
  font-weight: 700;
  color: #2563eb;
  background: rgba(37, 99, 235, 0.08);
  padding: 0.35rem 0.75rem;
  border-radius: 6px;
  display: inline-block;
  margin-bottom: 0.55rem;
}

[data-theme="dark"] .st-grammar-badge {
  color: #93c5fd;
  background: rgba(59, 130, 246, 0.18);
}

.st-exp-text {
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--text-main);
}

/* Essay Specific Styles */
.st-prompt-box {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
  background: rgba(37, 99, 235, 0.06);
  border: 1px dashed var(--primary);
  padding: 0.75rem 1.1rem;
  border-radius: 10px;
  margin-bottom: 0.85rem;
}

.st-prompt-text {
  color: var(--primary);
  font-size: 1.02rem;
}

.st-input-wrap {
  margin-bottom: 0.85rem;
}

.st-essay-input {
  width: 100%;
  box-sizing: border-box;
  padding: 0.85rem 1rem;
  border-radius: 10px;
  border: 1.5px solid var(--border-color);
  background: var(--bg-surface);
  color: var(--text-main);
  font-size: 1rem;
  font-family: inherit;
  line-height: 1.5;
  resize: vertical;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.st-essay-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.st-essay-input.is-correct {
  border-color: #10b981;
  background: rgba(16, 185, 129, 0.04);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

.st-essay-input.is-incorrect {
  border-color: #ef4444;
  background: rgba(239, 68, 68, 0.04);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15);
}

.st-essay-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-bottom: 0.85rem;
}

.st-hint-box {
  background: rgba(245, 158, 11, 0.08);
  border-left: 3px solid #f59e0b;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  font-size: 0.88rem;
  line-height: 1.55;
  color: var(--text-main);
  margin-bottom: 0.85rem;
}

.st-model-ans-box {
  background: var(--bg-surface-soft, rgba(0,0,0,0.03));
  border: 1.5px solid var(--border-color);
  border-radius: 12px;
  padding: 1.1rem 1.25rem;
  margin-top: 0.85rem;
}

.st-target-line {
  margin-bottom: 0.65rem;
}

.st-target-tag {
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  color: #10b981;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-bottom: 0.25rem;
}

.st-target-text {
  font-size: 1.02rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.55;
  margin: 0;
}

.st-acceptable-wrap {
  background: var(--bg-surface);
  border: 1px dashed var(--border-color);
  padding: 0.65rem 0.9rem;
  border-radius: 8px;
  margin-top: 0.65rem;
}

.st-acc-tag {
  font-size: 0.74rem;
  font-weight: 800;
  color: var(--text-muted);
  text-transform: uppercase;
  display: block;
  margin-bottom: 0.3rem;
}

.st-acc-list {
  margin: 0;
  padding-left: 1.2rem;
  font-size: 0.88rem;
  color: var(--text-main);
  line-height: 1.55;
}

/* Bottom Nav */
.st-bottom-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-color);
}

.st-bottom-center {
  font-size: 0.88rem;
  color: var(--text-muted);
}

@media (max-width: 768px) {
  .st-master-hero {
    padding: 1.5rem 1.25rem;
  }
  .st-hero-title {
    font-size: 1.4rem;
  }
  .st-submode-tabs {
    grid-template-columns: 1fr;
  }
  .st-unit-meta-top {
    flex-direction: column;
  }
  .st-bottom-nav {
    flex-direction: column;
    align-items: stretch;
  }
}

/* Unit Card Skill Action Buttons */
.unit-card-btn-wf {
  border-color: #f59e0b !important;
  color: #b45309 !important;
  background: var(--bg-surface) !important;
  font-weight: 700 !important;
  transition: all 0.2s ease !important;
}
.unit-card-btn-wf:hover {
  background: rgba(245, 158, 11, 0.12) !important;
  transform: translateY(-2px);
}
[data-theme="dark"] .unit-card-btn-wf {
  border-color: #fbbf24 !important;
  color: #fde68a !important;
}

.unit-card-btn-st {
  border-color: #6366f1 !important;
  color: #4338ca !important;
  background: var(--bg-surface) !important;
  font-weight: 700 !important;
  transition: all 0.2s ease !important;
.st-exp-text {
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--text-main);
}

/* Essay Specific Styles */
.st-prompt-box {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
  background: rgba(37, 99, 235, 0.06);
  border: 1px dashed var(--primary);
  padding: 0.75rem 1.1rem;
  border-radius: 10px;
  margin-bottom: 0.85rem;
}

.st-prompt-text {
  color: var(--primary);
  font-size: 1.02rem;
}

.st-input-wrap {
  margin-bottom: 0.85rem;
}

.st-essay-input {
  width: 100%;
  box-sizing: border-box;
  padding: 0.85rem 1rem;
  border-radius: 10px;
  border: 1.5px solid var(--border-color);
  background: var(--bg-surface);
  color: var(--text-main);
  font-size: 1rem;
  font-family: inherit;
  line-height: 1.5;
  resize: vertical;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.st-essay-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.st-essay-input.is-correct {
  border-color: #10b981;
  background: rgba(16, 185, 129, 0.04);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

.st-essay-input.is-incorrect {
  border-color: #ef4444;
  background: rgba(239, 68, 68, 0.04);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15);
}

.st-essay-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-bottom: 0.85rem;
}

.st-hint-box {
  background: rgba(245, 158, 11, 0.08);
  border-left: 3px solid #f59e0b;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  font-size: 0.88rem;
  line-height: 1.55;
  color: var(--text-main);
  margin-bottom: 0.85rem;
}

.st-model-ans-box {
  background: var(--bg-surface-soft, rgba(0,0,0,0.03));
  border: 1.5px solid var(--border-color);
  border-radius: 12px;
  padding: 1.1rem 1.25rem;
  margin-top: 0.85rem;
}

.st-target-line {
  margin-bottom: 0.65rem;
}

.st-target-tag {
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  color: #10b981;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-bottom: 0.25rem;
}

.st-target-text {
  font-size: 1.02rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.55;
  margin: 0;
}

.st-acceptable-wrap {
  background: var(--bg-surface);
  border: 1px dashed var(--border-color);
  padding: 0.65rem 0.9rem;
  border-radius: 8px;
  margin-top: 0.65rem;
}

.st-acc-tag {
  font-size: 0.74rem;
  font-weight: 800;
  color: var(--text-muted);
  text-transform: uppercase;
  display: block;
  margin-bottom: 0.3rem;
}

.st-acc-list {
  margin: 0;
  padding-left: 1.2rem;
  font-size: 0.88rem;
  color: var(--text-main);
  line-height: 1.55;
}

/* Bottom Nav */
.st-bottom-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-color);
}

.st-bottom-center {
  font-size: 0.88rem;
  color: var(--text-muted);
}

@media (max-width: 768px) {
  .st-master-hero {
    padding: 1.5rem 1.25rem;
  }
  .st-hero-title {
    font-size: 1.4rem;
  }
  .st-submode-tabs {
    grid-template-columns: 1fr;
  }
  .st-unit-meta-top {
    flex-direction: column;
  }
  .st-bottom-nav {
    flex-direction: column;
    align-items: stretch;
  }
}

/* Unit Card Skill Action Buttons */
.unit-card-btn-wf {
  border-color: #f59e0b !important;
  color: #b45309 !important;
  background: var(--bg-surface) !important;
  font-weight: 700 !important;
  transition: all 0.2s ease !important;
}
.unit-card-btn-wf:hover {
  background: rgba(245, 158, 11, 0.12) !important;
  transform: translateY(-2px);
}
[data-theme="dark"] .unit-card-btn-wf {
  border-color: #fbbf24 !important;
  color: #fde68a !important;
}

.unit-card-btn-st {
  border-color: #6366f1 !important;
  color: #4338ca !important;
  background: var(--bg-surface) !important;
  font-weight: 700 !important;
  transition: all 0.2s ease !important;
}
.unit-card-btn-st:hover {
  background: rgba(99, 102, 241, 0.12) !important;
  transform: translateY(-2px);
}
[data-theme="dark"] .unit-card-btn-st {
  border-color: #818cf8 !important;
  color: #c7d2fe !important;
}

/* ====================================================
   EXAM LISTENING MODE & CLUE HIGHLIGHTING
   ==================================================== */
.listening-clue-highlight {
  background: #fef08a !important;
  color: #854d0e !important;
  padding: 2px 6px !important;
  border-radius: 4px !important;
  font-weight: 700 !important;
  border: 1px solid #facc15 !important;
  display: inline !important;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}
[data-theme="dark"] .listening-clue-highlight {
  background: #713f12 !important;
  color: #fef08a !important;
  border-color: #a16207 !important;
}

.clue-tag {
  font-size: 0.7rem !important;
  background: #ea580c !important;
  color: #ffffff !important;
  padding: 1px 6px !important;
  border-radius: 4px !important;
  margin-left: 6px !important;
  vertical-align: middle !important;
  font-weight: 800 !important;
  display: inline-block !important;
  letter-spacing: 0.3px !important;
}

.exam-listening-mode-banner {
  transition: all 0.3s ease;
}

.exam-listening-mode-banner:hover {
  box-shadow: 0 8px 24px rgba(0,0,0,0.25) !important;
}

.listening-score-banner {
  animation: fadeIn 0.4s ease;
}
