/* =====================================================
   MR. F'S ULTIMATE GRAMMAR GUIDE — ENHANCED STYLESHEET
   ===================================================== */

:root {
  /* Core palette */
  --bg:         #f7f8fb;
  --bg-warm:    #fafaf8;
  --surface:    #ffffff;
  --border:     #e4e7ef;
  --border-lt:  #eef0f6;
  --text:       #1a1d2e;
  --text-soft:  #556078;
  --text-mute:  #6e7a94;
  --navy:       #162544;
  --navy-mid:   #1e3456;
  --navy-light: #2a4a78;

  /* Accent palette */
  --blue:       #2563eb; --blue-lt:   #eff6ff; --blue-mid:  #bfdbfe; --blue-dk: #1d4ed8;
  --green:      #16a34a; --green-lt:  #f0fdf4; --green-mid: #bbf7d0;
  --teal:       #0d9488; --teal-lt:   #f0fdfa; --teal-mid:  #99f6e4;
  --amber:      #d97706; --amber-lt:  #fffbeb; --amber-mid: #fde68a;
  --rose:       #e11d48; --rose-lt:   #fff1f2; --rose-mid:  #fecdd3;
  --purple:     #7c3aed; --purple-lt: #f5f3ff; --purple-mid:#ddd6fe;
  --orange:     #ea580c; --orange-lt: #fff7ed;
  --success:    #16a34a;

  /* Radii */
  --radius-sm: 6px; --radius: 10px; --radius-lg: 16px; --radius-xl: 24px;

  /* Shadows */
  --shadow-xs:  0 1px 2px rgba(0,0,0,0.04);
  --shadow-sm:  0 1px 4px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow:     0 4px 16px rgba(0,0,0,0.07), 0 1px 3px rgba(0,0,0,0.04);
  --shadow-lg:  0 12px 40px rgba(0,0,0,0.10), 0 4px 12px rgba(0,0,0,0.04);
  --shadow-xl:  0 20px 60px rgba(0,0,0,0.12), 0 8px 20px rgba(0,0,0,0.06);
  --shadow-blue:0 4px 16px rgba(37,99,235,0.20), 0 2px 4px rgba(37,99,235,0.08);

  /* Typography */
  --font-display: 'Fraunces', Georgia, serif;
  --font-body:    'Plus Jakarta Sans', system-ui, sans-serif;
  --font-mono:    'JetBrains Mono', monospace;

  /* Transitions */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ── RESET ───────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::selection { background: rgba(37,99,235,0.15); color: var(--text); }

::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: #c5cdd8; border-radius: 100px; }
::-webkit-scrollbar-thumb:hover { background: #a0aab8; }

/* ── ACCESSIBILITY ───────────────────────── */

/* Skip navigation link */
.skip-link {
  position: absolute;
  top: -100px;
  left: 16px;
  background: var(--blue);
  color: white;
  padding: 10px 20px;
  border-radius: var(--radius);
  font-size: 0.88rem;
  font-weight: 600;
  z-index: 9999;
  text-decoration: none;
  transition: top 0.2s;
}
.skip-link:focus {
  top: 16px;
  outline: 3px solid var(--blue);
  outline-offset: 2px;
}

/* Screen reader only — visually hidden but accessible */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Focus outlines — visible only for keyboard navigation */
*:focus { outline: none; }
*:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* Specific focus styles for dark-background elements */
.exp-sidebar *:focus-visible,
.practice-topbar *:focus-visible,
.home-header *:focus-visible {
  outline-color: #93c5fd;
}

/* Unit card focus (keyboard) */
.unit-card:focus-visible {
  outline: 3px solid var(--card-color, var(--blue));
  outline-offset: 2px;
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

/* Option button focus */
.option-btn:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: -1px;
  border-color: var(--blue);
  background: var(--blue-lt);
}

/* Nav item focus */
.unit-nav-item:focus-visible {
  outline-color: #93c5fd;
  outline-offset: -1px;
  background: rgba(255,255,255,0.07);
}

/* Button focus overrides for pill buttons */
.btn-practice:focus-visible,
.btn-next:focus-visible {
  outline-offset: 3px;
}
.btn-back:focus-visible,
.btn-back-white:focus-visible,
.btn-home:focus-visible {
  outline-offset: 2px;
}

/* Ensure reduced-motion preference is respected */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  html { scroll-behavior: auto; }
}

/* ── PAGES ───────────────────────────────── */
.page { display: none; min-height: 100vh; }
.page.active { display: block; animation: page-in 0.4s var(--ease-out) both; }
@keyframes page-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ══════════════════════════════════════════
   HOME HEADER
   ══════════════════════════════════════════ */
.home-header {
  background: linear-gradient(145deg, #162544 0%, #1a3058 40%, #1e3a6a 70%, #162544 100%);
  color: white;
  padding: 56px 24px 80px;
  position: relative;
  overflow: hidden;
}

/* Geometric pattern overlay */
.header-bg-pattern {
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 15% 85%, rgba(37,99,235,0.12) 0%, transparent 50%),
    radial-gradient(circle at 85% 15%, rgba(99,102,241,0.08) 0%, transparent 45%),
    radial-gradient(circle at 50% 50%, rgba(255,255,255,0.02) 0%, transparent 70%);
  pointer-events: none;
}
.header-bg-pattern::before {
  content: '';
  position: absolute;
  inset: 0;
  opacity: 0.03;
  background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='1'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

/* Wave bottom border */
.header-wave {
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  line-height: 0;
}
.header-wave svg { width: 100%; height: 48px; display: block; }

.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 48px;
  flex-wrap: wrap;
  position: relative;
  z-index: 1;
}

.header-text { flex: 1; min-width: 280px; }

.header-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #93c5fd;
  margin-bottom: 18px;
  padding: 6px 14px;
  background: rgba(147,197,253,0.08);
  border: 1px solid rgba(147,197,253,0.12);
  border-radius: 100px;
}

.header-title {
  font-family: var(--font-display);
  font-size: clamp(2rem, 4.5vw, 3.4rem);
  font-weight: 700;
  line-height: 1.12;
  margin-bottom: 20px;
  color: #fff;
  letter-spacing: -0.01em;
}
.header-title em {
  font-style: italic;
  background: linear-gradient(135deg, #93c5fd 0%, #a5b4fc 50%, #c4b5fd 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.header-sub {
  font-size: 1rem;
  color: rgba(255,255,255,0.7);
  max-width: 480px;
  line-height: 1.75;
  font-weight: 400;
}

.header-avatar-wrap { text-align: center; flex-shrink: 0; }
.avatar-frame {
  position: relative;
  display: inline-block;
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-xl), 0 0 0 1px rgba(255,255,255,0.08);
}
.avatar-frame::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--radius-xl);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.1);
  pointer-events: none;
}
.avatar-img {
  width: 230px;
  height: auto;
  display: block;
  object-fit: cover;
}
.avatar-caption {
  font-size: 0.75rem;
  color: rgba(255,255,255,0.55);
  margin-top: 12px;
  font-weight: 500;
  letter-spacing: 0.02em;
}

/* ══════════════════════════════════════════
   HOME MAIN
   ══════════════════════════════════════════ */
.home-main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 52px 24px 72px;
}

.units-intro { margin-bottom: 36px; }
.units-intro h2 {
  font-family: var(--font-display);
  font-size: 1.65rem;
  font-weight: 600;
  margin-bottom: 8px;
  letter-spacing: -0.01em;
}
.units-intro p { color: var(--text-soft); font-size: 0.95rem; }

.units-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

/* ── UNIT CARDS ──────────────────────────── */
.unit-card {
  background: var(--surface);
  border: 1px solid var(--border-lt);
  border-radius: var(--radius-lg);
  padding: 24px 26px;
  cursor: pointer;
  transition: transform 0.3s var(--ease-out), box-shadow 0.3s var(--ease-out), border-color 0.3s;
  position: relative;
  overflow: hidden;
}

/* Left accent bar */
.unit-card::before {
  content: '';
  position: absolute;
  top: 12px;
  left: 0;
  width: 3px;
  height: calc(100% - 24px);
  background: var(--card-color, var(--blue));
  border-radius: 0 3px 3px 0;
  opacity: 0.5;
  transition: opacity 0.3s, height 0.3s var(--ease-out);
}

/* Hover glow */
.unit-card::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle at 50% 0%, var(--card-color, var(--blue)), transparent 70%);
  opacity: 0;
  transition: opacity 0.4s;
  pointer-events: none;
}

.unit-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: color-mix(in srgb, var(--card-color, var(--blue)) 25%, var(--border));
}
.unit-card:hover::before { opacity: 1; top: 0; height: 100%; }
.unit-card:hover::after { opacity: 0.03; }

.unit-card-num {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-mute);
  margin-bottom: 8px;
}

.unit-card-title {
  font-family: var(--font-display);
  font-size: 1.08rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.35;
  margin-bottom: 10px;
  letter-spacing: -0.005em;
}

.unit-card-meta {
  font-size: 0.78rem;
  color: var(--text-mute);
  display: flex;
  align-items: center;
  gap: 6px;
}

.unit-card-arrow {
  position: absolute;
  right: 22px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.95rem;
  color: var(--text-mute);
  transition: all 0.3s var(--ease-out);
  opacity: 0.5;
}
.unit-card:hover .unit-card-arrow {
  color: var(--card-color, var(--blue));
  right: 18px;
  opacity: 1;
}

/* ── FOOTER ──────────────────────────────── */
.site-footer {
  background: var(--navy);
  color: rgba(255,255,255,0.5);
  text-align: center;
  padding: 24px 20px;
  font-size: 0.8rem;
}
.footer-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}
.footer-icon { opacity: 0.3; }

/* ══════════════════════════════════════════
   EXPLANATION LAYOUT
   ══════════════════════════════════════════ */
.exp-layout { display: flex; min-height: 100vh; align-items: stretch; }

.exp-sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--navy);
  color: white;
  padding: 24px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  border-right: 1px solid rgba(255,255,255,0.05);
}

/* Sidebar scrollbar */
.exp-sidebar::-webkit-scrollbar { width: 4px; }
.exp-sidebar::-webkit-scrollbar-track { background: transparent; }
.exp-sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 100px; }

.sidebar-avatar-wrap { text-align: center; padding: 8px 0; }
.avatar-img-small {
  width: 140px;
  height: auto;
  border-radius: var(--radius);
  display: block;
  margin: 0 auto;
  object-fit: cover;
  box-shadow: 0 4px 16px rgba(0,0,0,0.25);
}
.sidebar-unit-label {
  font-size: 0.7rem;
  color: rgba(255,255,255,0.55);
  margin-top: 8px;
  letter-spacing: 0.04em;
}

.unit-nav { display: flex; flex-direction: column; gap: 2px; margin-top: 8px; }
.unit-nav-item {
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.77rem;
  color: rgba(255,255,255,0.65);
  cursor: pointer;
  transition: all 0.2s;
  border: none;
  background: none;
  text-align: left;
  width: 100%;
  line-height: 1.35;
  font-family: var(--font-body);
  display: flex;
  align-items: center;
  gap: 8px;
}
.unit-nav-item:hover {
  background: rgba(255,255,255,0.07);
  color: rgba(255,255,255,0.85);
}
.unit-nav-item.active {
  background: rgba(147,197,253,0.12);
  color: #93c5fd;
  font-weight: 600;
  box-shadow: inset 3px 0 0 #93c5fd;
}

/* ── EXPLANATION MAIN ────────────────────── */
.exp-main {
  flex: 1;
  padding: 44px 52px;
  max-width: 860px;
  min-width: 0;
}

.exp-header {
  margin-bottom: 36px;
  padding-bottom: 24px;
  border-bottom: 2px solid var(--border);
  position: relative;
}

.exp-unit-num {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  background: var(--blue-lt);
  color: var(--blue);
  padding: 5px 14px;
  border-radius: 100px;
  margin-bottom: 14px;
}

.exp-title {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 3vw, 2.3rem);
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.exp-footer {
  margin-top: 52px;
  padding-top: 32px;
  border-top: 2px solid var(--border);
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}
.practice-cta-text { color: var(--text-soft); font-size: 0.95rem; }

/* ══════════════════════════════════════════
   EXPLANATION CONTENT
   ══════════════════════════════════════════ */
.exp-content { line-height: 1.8; }

.exp-content h3 {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text);
  margin: 36px 0 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-lt);
  letter-spacing: -0.005em;
}
.exp-content h3:first-child { margin-top: 0; }

.exp-content h4 {
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-soft);
  margin: 22px 0 10px;
}

.exp-content p { margin-bottom: 14px; font-size: 0.97rem; }
.exp-content ul, .exp-content ol { padding-left: 22px; margin-bottom: 14px; }
.exp-content li { margin-bottom: 7px; font-size: 0.97rem; }
.exp-content strong { font-weight: 600; color: var(--text); }
.exp-content em { font-style: italic; }

.exp-content .note {
  font-size: 0.88rem;
  color: var(--text-soft);
  font-style: italic;
  background: var(--amber-lt);
  border-left: 3px solid var(--amber);
  padding: 10px 16px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin: 12px 0;
}

/* ── INFO GRID / CARDS ───────────────────── */
.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 14px;
  margin: 20px 0;
}

.info-card {
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  font-size: 0.93rem;
  transition: box-shadow 0.3s, transform 0.3s var(--ease-out);
}
.info-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.info-card h4 {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 12px;
  margin-top: 0 !important;
  padding-bottom: 0 !important;
  border: none !important;
  display: flex;
  align-items: center;
  gap: 6px;
}

.info-card.blue   { background: var(--blue-lt);   border: 1px solid var(--blue-mid);   } .info-card.blue h4   { color: var(--blue);   }
.info-card.teal   { background: var(--teal-lt);   border: 1px solid var(--teal-mid);   } .info-card.teal h4   { color: var(--teal);   }
.info-card.green  { background: var(--green-lt);  border: 1px solid var(--green-mid);  } .info-card.green h4  { color: var(--green);  }
.info-card.purple { background: var(--purple-lt); border: 1px solid var(--purple-mid); } .info-card.purple h4 { color: var(--purple); }
.info-card.amber  { background: var(--amber-lt);  border: 1px solid var(--amber-mid);  } .info-card.amber h4  { color: var(--amber);  }
.info-card.rose   { background: var(--rose-lt);   border: 1px solid var(--rose-mid);   } .info-card.rose h4   { color: var(--rose);   }
.info-card.orange { background: var(--orange-lt); border: 1px solid #fed7aa;           } .info-card.orange h4 { color: var(--orange); }

/* ── TENSE SECTIONS ──────────────────────── */
.tense-section {
  margin: 20px 0;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
}

.tense-header {
  padding: 12px 20px;
  font-weight: 700;
  font-size: 0.82rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: white;
}
.tense-header.green  { background: var(--green);  }
.tense-header.blue   { background: var(--blue);   }
.tense-header.purple { background: var(--purple); }
.tense-header.teal   { background: var(--teal);   }
.tense-header.amber  { background: var(--amber);  }
.tense-header.rose   { background: var(--rose);   }
.tense-header.orange { background: var(--orange);  }

.tense-body { padding: 20px 22px; background: var(--surface); }
.tense-body p { margin-bottom: 10px; font-size: 0.95rem; }
.tense-body ul { font-size: 0.93rem; }

/* ── EXAMPLE BLOCK ───────────────────────── */
.example-block {
  background: var(--bg-warm);
  border: 1px solid var(--border-lt);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  margin: 18px 0;
  font-size: 0.93rem;
  box-shadow: var(--shadow-xs);
}
.example-block p { margin-bottom: 10px; }
.example-block p:last-child { margin-bottom: 0; }
.example-block h4 {
  color: var(--text);
  font-size: 0.85rem;
  margin-bottom: 10px;
  margin-top: 0 !important;
}

/* ── LABELS ──────────────────────────────── */
.label {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: 5px;
  margin-right: 6px;
  vertical-align: middle;
}
.label.simple   { background: #e0f2fe; color: #0369a1; }
.label.prog     { background: #dcfce7; color: #15803d; }
.label.perf     { background: #f3e8ff; color: #7c3aed; }
.label.perfprog { background: #fff7ed; color: #c2410c; }
.label.good     { background: #dcfce7; color: #15803d; }
.label.bad      { background: #fee2e2; color: #dc2626; }
.label.def      { background: #dbeafe; color: #1d4ed8; }
.label.nondef   { background: #fce7f3; color: #be185d; }

/* ── TENSE TABLE ─────────────────────────── */
.tense-table-wrap {
  overflow-x: auto;
  margin: 20px 0;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
}
.tense-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  min-width: 460px;
}
.tense-table th {
  background: var(--navy);
  color: white;
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  font-size: 0.78rem;
  letter-spacing: 0.03em;
}
.tense-table th:first-child { border-radius: var(--radius-lg) 0 0 0; }
.tense-table th:last-child { border-radius: 0 var(--radius-lg) 0 0; }
.tense-table td {
  padding: 11px 16px;
  border-bottom: 1px solid var(--border-lt);
  font-family: var(--font-mono);
  font-size: 0.82rem;
}
.tense-table tr:last-child td { border-bottom: none; }
.tense-table tr:nth-child(even) td { background: #f8f9fc; }
.tense-table td.row-head {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.85rem;
  background: #f0f4f8;
  color: var(--text-soft);
  font-style: italic;
}

/* ── COMPARE TABLE ───────────────────────── */
.compare-table-wrap {
  overflow-x: auto;
  margin: 20px 0;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
}
.compare-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.compare-table th {
  padding: 12px 16px;
  text-align: left;
  font-weight: 700;
  font-size: 0.78rem;
  background: #f0f4f8;
  color: var(--text-soft);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 2px solid var(--border);
}
.compare-table td {
  padding: 11px 16px;
  border-bottom: 1px solid var(--border-lt);
  font-size: 0.91rem;
  vertical-align: top;
}
.compare-table tr:last-child td { border-bottom: none; }

/* ── ACADEMIC BOX ────────────────────────── */
.academic-box {
  margin: 32px 0 10px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--blue-mid);
  box-shadow: 0 0 0 4px rgba(37,99,235,0.04), var(--shadow-sm);
}
.academic-label {
  display: flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, var(--blue), var(--blue-dk));
  color: white;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 10px 20px;
}
.academic-box-body {
  background: var(--blue-lt);
  padding: 20px 22px;
  font-size: 0.93rem;
}
.academic-box-body p { margin-bottom: 10px; }
.academic-box-body p:last-child { margin-bottom: 0; }
.academic-box-body ul { padding-left: 20px; }
.academic-box-body li { margin-bottom: 6px; }

/* ══════════════════════════════════════════
   BUTTONS
   ══════════════════════════════════════════ */
.btn-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: 1.5px solid rgba(255,255,255,0.18);
  color: rgba(255,255,255,0.7);
  padding: 8px 18px;
  border-radius: 100px;
  font-family: var(--font-body);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s;
}
.btn-back:hover {
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.35);
  color: white;
}

.exp-layout .btn-back,
.practice-topbar .btn-back {
  border-color: var(--border);
  color: var(--text-soft);
  background: var(--surface);
}
.exp-layout .btn-back:hover,
.practice-topbar .btn-back:hover {
  border-color: var(--blue);
  color: var(--blue);
  background: var(--blue-lt);
}

.btn-back-white {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1.5px solid var(--border);
  color: var(--text-soft);
  background: var(--surface);
  padding: 12px 24px;
  border-radius: 100px;
  font-family: var(--font-body);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s;
}
.btn-back-white:hover {
  border-color: var(--blue);
  color: var(--blue);
  background: var(--blue-lt);
}

.btn-practice {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, var(--blue), var(--blue-dk));
  color: white;
  border: none;
  padding: 13px 28px;
  border-radius: 100px;
  font-family: var(--font-body);
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s var(--ease-out);
  box-shadow: var(--shadow-blue);
  letter-spacing: 0.01em;
  position: relative;
  overflow: hidden;
}
.btn-practice::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent 30%, rgba(255,255,255,0.12) 50%, transparent 70%);
  transform: translateX(-100%);
  transition: transform 0.5s;
}
.btn-practice:hover::before { transform: translateX(100%); }
.btn-practice:hover {
  background: linear-gradient(135deg, var(--blue-dk), #1e40af);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(37,99,235,0.3), 0 2px 6px rgba(37,99,235,0.15);
}

.btn-home {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--navy);
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 100px;
  font-family: var(--font-body);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s;
}
.btn-home:hover { background: var(--navy-light); transform: translateY(-1px); }

/* ══════════════════════════════════════════
   PRACTICE PAGE
   ══════════════════════════════════════════ */
.practice-layout { min-height: 100vh; background: var(--bg); }

.practice-topbar {
  background: var(--navy);
  padding: 18px 32px 0;
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}
.topbar-row {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 12px;
}
.practice-title-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex: 1;
}
.practice-unit-label {
  font-size: 0.85rem;
  font-weight: 700;
  color: #93c5fd;
  letter-spacing: 0.01em;
}
.practice-q-counter {
  font-size: 0.78rem;
  color: rgba(255,255,255,0.4);
  font-family: var(--font-mono);
}

.progress-track {
  height: 4px;
  background: rgba(255,255,255,0.08);
  border-radius: 100px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #60a5fa, #a78bfa, #34d399);
  background-size: 200% 100%;
  border-radius: 100px;
  transition: width 0.5s var(--ease-out);
  animation: shimmer-progress 4s ease infinite;
}
@keyframes shimmer-progress {
  0%   { background-position: 0% 50%; }
  100% { background-position: 200% 50%; }
}

.practice-body {
  max-width: 720px;
  margin: 0 auto;
  padding: 44px 24px 64px;
}

/* ── QUESTION CARD ───────────────────────── */
.question-card {
  background: var(--surface);
  border: 1px solid var(--border-lt);
  border-radius: var(--radius-xl);
  padding: 36px;
  box-shadow: var(--shadow);
  animation: card-in 0.35s var(--ease-out) both;
}
@keyframes card-in {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.question-text {
  font-size: 1.08rem;
  color: var(--text);
  line-height: 1.75;
  margin-bottom: 28px;
  font-weight: 400;
}
.question-text strong { font-weight: 700; }

/* ── MCQ OPTIONS ─────────────────────────── */
.options-list { display: flex; flex-direction: column; gap: 10px; }

.option-btn {
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  text-align: left;
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  line-height: 1.55;
}
.option-btn:hover:not(:disabled) {
  border-color: var(--blue);
  background: var(--blue-lt);
  color: var(--blue);
  transform: translateX(4px);
}

.option-btn .opt-letter {
  font-size: 0.72rem;
  font-weight: 700;
  min-width: 24px;
  height: 24px;
  background: var(--border);
  color: var(--text-soft);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
  transition: all 0.2s;
}
.option-btn:hover:not(:disabled) .opt-letter { background: var(--blue); color: white; }

.option-btn.correct { border-color: var(--green); background: var(--green-lt); color: #15803d; }
.option-btn.correct .opt-letter { background: var(--green); color: white; }
.option-btn.incorrect { border-color: var(--rose); background: var(--rose-lt); color: var(--rose); animation: shake 0.4s ease; }
.option-btn.incorrect .opt-letter { background: var(--rose); color: white; }
.option-btn:disabled { cursor: not-allowed; opacity: 0.65; }
.option-btn.correct:disabled, .option-btn.incorrect:disabled { opacity: 1; }

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

/* ── FEEDBACK ────────────────────────────── */
.feedback-wrap { margin-top: 20px; }

.feedback-box {
  border-radius: var(--radius);
  padding: 14px 18px;
  font-size: 0.92rem;
  line-height: 1.65;
  display: none;
  animation: fade-up 0.25s var(--ease-out);
}
@keyframes fade-up {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.feedback-box.show { display: block; }
.feedback-box.fb-correct {
  background: var(--green-lt);
  border: 1px solid var(--green-mid);
  color: #15803d;
}
.feedback-box.fb-hint {
  background: var(--amber-lt);
  border: 1px solid var(--amber-mid);
  color: #92400e;
}
.feedback-box .hint-label {
  font-weight: 700;
  margin-right: 6px;
  font-size: 0.8rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.btn-next {
  display: none;
  margin-top: 20px;
  background: linear-gradient(135deg, var(--teal), #0f766e);
  color: white;
  border: none;
  padding: 13px 28px;
  border-radius: 100px;
  font-family: var(--font-body);
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s var(--ease-out);
  box-shadow: 0 4px 12px rgba(13,148,136,0.2);
}
.btn-next.show { display: inline-flex; align-items: center; gap: 8px; }
.btn-next:hover {
  background: linear-gradient(135deg, #0f766e, #115e59);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(13,148,136,0.3);
}

/* ══════════════════════════════════════════
   COMPLETION
   ══════════════════════════════════════════ */
.completion-panel { max-width: 720px; margin: 0 auto; padding: 44px 24px 64px; }
.completion-inner {
  background: var(--surface);
  border: 1px solid var(--border-lt);
  border-radius: var(--radius-xl);
  padding: 44px;
  box-shadow: var(--shadow-lg);
  display: flex;
  gap: 36px;
  align-items: flex-start;
  flex-wrap: wrap;
  animation: card-in 0.4s var(--ease-out) both;
}
.completion-avatar {
  width: 160px;
  height: auto;
  border-radius: var(--radius-lg);
  flex-shrink: 0;
  object-fit: cover;
  box-shadow: var(--shadow);
}
.completion-text-wrap { flex: 1; min-width: 240px; }

.completion-title {
  font-family: var(--font-display);
  font-size: 1.85rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 12px;
  letter-spacing: -0.01em;
}
.completion-score {
  font-family: var(--font-mono);
  font-size: 2.4rem;
  font-weight: 500;
  background: linear-gradient(135deg, var(--blue), var(--purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 16px;
}
.completion-msg {
  font-size: 0.97rem;
  color: var(--text-soft);
  line-height: 1.75;
  margin-bottom: 28px;
}
.completion-btns { display: flex; gap: 12px; flex-wrap: wrap; }

/* ══════════════════════════════════════════
   PROGRESS TRACKING
   ══════════════════════════════════════════ */

/* Summary bar on home page */
.progress-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: var(--blue-lt);
  border: 1px solid var(--blue-mid);
  border-radius: var(--radius-lg);
  padding: 14px 20px;
  margin-bottom: 24px;
  animation: fade-up 0.35s var(--ease-out) both;
}
.progress-summary-left {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--blue);
  font-size: 0.88rem;
  font-weight: 600;
}
.progress-summary-text { color: var(--text-soft); font-weight: 500; }
.progress-summary-text strong { color: var(--blue); font-weight: 700; }

.progress-reset-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: none;
  border: 1px solid var(--blue-mid);
  color: var(--text-mute);
  padding: 6px 14px;
  border-radius: 100px;
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}
.progress-reset-btn:hover {
  border-color: var(--rose);
  color: var(--rose);
  background: var(--rose-lt);
}

/* Progress badge on unit cards */
.unit-card-badge {
  position: absolute;
  top: 14px;
  right: 14px;
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 100px;
  letter-spacing: 0.02em;
  animation: badge-in 0.3s var(--ease-spring) both;
}
@keyframes badge-in {
  from { opacity: 0; transform: scale(0.7); }
  to   { opacity: 1; transform: scale(1); }
}

.unit-card-badge.perfect {
  background: linear-gradient(135deg, #dcfce7, #bbf7d0);
  color: #15803d;
  border: 1px solid var(--green-mid);
}
.unit-card-badge.good {
  background: var(--blue-lt);
  color: var(--blue);
  border: 1px solid var(--blue-mid);
}
.unit-card-badge.needs-work {
  background: var(--amber-lt);
  color: var(--amber);
  border: 1px solid var(--amber-mid);
}

.unit-card-badge svg { flex-shrink: 0; }

/* Sidebar nav progress dots */
.nav-progress-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-left: auto;
  flex-shrink: 0;
}
.nav-progress-dot.perfect { background: var(--green); }
.nav-progress-dot.good    { background: #60a5fa; }
.nav-progress-dot.partial { background: var(--amber); }

/* ══════════════════════════════════════════
   ABOUT SECTION
   ══════════════════════════════════════════ */
.about-section {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px 64px;
}

.about-inner {
  display: flex;
  align-items: flex-start;
  gap: 36px;
  background: var(--surface);
  border: 1px solid var(--border-lt);
  border-radius: var(--radius-xl);
  padding: 40px 44px;
  box-shadow: var(--shadow-sm);
}

.about-avatar-wrap { flex-shrink: 0; }
.about-avatar {
  width: 120px;
  height: auto;
  border-radius: var(--radius-lg);
  object-fit: cover;
  box-shadow: var(--shadow);
}

.about-text { flex: 1; min-width: 0; }

.about-heading {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 14px;
  letter-spacing: -0.01em;
}

.about-text p {
  font-size: 0.95rem;
  color: var(--text-soft);
  line-height: 1.8;
  margin-bottom: 12px;
}
.about-text p:last-child { margin-bottom: 0; }

/* ══════════════════════════════════════════
   MOBILE SIDEBAR NAV
   ══════════════════════════════════════════ */
.sidebar-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.mobile-nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: var(--radius-sm);
  color: rgba(255,255,255,0.7);
  cursor: pointer;
  transition: all 0.2s;
  padding: 0;
}
.mobile-nav-toggle:hover {
  background: rgba(255,255,255,0.12);
  color: white;
}
.mobile-nav-toggle .close-icon { display: none; }
.mobile-nav-toggle.open .hamburger-icon { display: none; }
.mobile-nav-toggle.open .close-icon { display: block; }

/* ══════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════ */
@media (max-width: 768px) {
  .exp-layout { flex-direction: column; }

  .exp-sidebar {
    width: 100%; height: auto; position: sticky; top: 0; z-index: 20;
    flex-direction: column; padding: 14px 16px;
    gap: 0;
    box-shadow: 0 4px 16px rgba(0,0,0,0.2);
  }
  .sidebar-avatar-wrap { display: none; }

  .sidebar-top-row {
    width: 100%;
  }

  .mobile-nav-toggle { display: flex; }

  .unit-nav {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s var(--ease-out), opacity 0.25s, margin 0.3s;
    opacity: 0;
    flex-direction: column;
    margin-top: 0;
  }
  .unit-nav.mobile-open {
    max-height: 600px;
    opacity: 1;
    margin-top: 12px;
    padding-bottom: 4px;
  }

  .unit-nav-item.active { box-shadow: inset 3px 0 0 #93c5fd; }
  .exp-main { padding: 28px 20px; }
  .practice-topbar { padding: 14px 20px 0; }
  .topbar-row { flex-wrap: wrap; gap: 10px; }
  .practice-body { padding: 28px 16px 48px; }
  .question-card { padding: 24px 20px; }
  .completion-inner { padding: 28px 22px; }
  .info-grid { grid-template-columns: 1fr; }

  .progress-summary { flex-direction: column; align-items: flex-start; gap: 10px; }
  .about-inner { padding: 28px 24px; gap: 24px; }
  .about-avatar { width: 100px; }
}

@media (max-width: 600px) {
  .units-grid { grid-template-columns: 1fr; }
  .header-avatar-wrap { display: none; }
  .home-header { padding: 40px 20px 72px; }
}

@media (max-width: 480px) {
  .completion-avatar { display: none; }
  .completion-btns { flex-direction: column; }
  .about-inner { flex-direction: column; padding: 28px 22px; gap: 20px; }
  .about-avatar { width: 80px; }
}

/* ══════════════════════════════════════════
   PRINT STYLESHEET
   ══════════════════════════════════════════ */
@media print {
  /* Reset page basics */
  * {
    background: transparent !important;
    color: #111 !important;
    box-shadow: none !important;
    text-shadow: none !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  body {
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 11pt;
    line-height: 1.6;
    color: #111;
    background: white;
  }

  /* Hide non-content elements */
  .home-header,
  .site-footer,
  .exp-sidebar,
  .practice-topbar,
  .btn-back,
  .btn-practice,
  .btn-next,
  .btn-home,
  .btn-back-white,
  .exp-footer,
  .progress-summary,
  .progress-reset-btn,
  .unit-card-arrow,
  .unit-card-badge,
  .mobile-nav-toggle,
  .header-wave,
  .header-bg-pattern,
  .skip-link,
  .about-avatar-wrap,
  .completion-panel,
  #page-practice {
    display: none !important;
  }

  /* Page layout */
  .page { display: block !important; min-height: 0; padding: 0; }
  #app { min-height: 0; }

  /* Home page print */
  .home-main { padding: 0; max-width: 100%; }

  .units-intro h2 {
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 18pt;
    border-bottom: 2px solid #333;
    padding-bottom: 6pt;
    margin-bottom: 12pt;
  }

  .units-grid {
    display: block;
    columns: 2;
    column-gap: 20pt;
  }

  .unit-card {
    break-inside: avoid;
    page-break-inside: avoid;
    border: 1pt solid #ccc;
    border-radius: 4pt;
    padding: 10pt 12pt;
    margin-bottom: 10pt;
  }
  .unit-card::before,
  .unit-card::after { display: none; }

  .unit-card-title {
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 11pt;
    font-weight: bold;
  }
  .unit-card-num { font-size: 8pt; }
  .unit-card-meta { font-size: 8pt; }

  /* About section print */
  .about-section { padding: 20pt 0 0; }
  .about-inner {
    border: 1pt solid #ccc;
    border-radius: 4pt;
    padding: 14pt 16pt;
  }
  .about-heading {
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 14pt;
    border-bottom: 1pt solid #ccc;
    padding-bottom: 4pt;
    margin-bottom: 8pt;
  }
  .about-text p { font-size: 10pt; line-height: 1.5; }

  /* Explanation page print */
  .exp-layout {
    display: block;
    min-height: 0;
  }

  .exp-main {
    max-width: 100%;
    padding: 0;
  }

  /* Print header with unit info */
  .exp-header {
    border-bottom: 2pt solid #333;
    padding-bottom: 8pt;
    margin-bottom: 16pt;
  }
  .exp-header::after {
    content: 'Mr. F\'s Ultimate Grammar Guide';
    display: block;
    font-size: 8pt;
    color: #666 !important;
    margin-top: 6pt;
    font-style: italic;
  }

  .exp-unit-num {
    font-size: 8pt;
    padding: 2pt 8pt;
    border: 1pt solid #999;
    border-radius: 3pt;
  }

  .exp-title {
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 18pt;
  }

  /* Content typography for print */
  .exp-content {
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 11pt;
    line-height: 1.55;
  }
  .exp-content h3 {
    font-size: 13pt;
    margin-top: 18pt;
    border-bottom: 1pt solid #ccc;
    page-break-after: avoid;
    break-after: avoid;
  }
  .exp-content h4 {
    font-size: 10pt;
    page-break-after: avoid;
    break-after: avoid;
  }
  .exp-content p { font-size: 10.5pt; }
  .exp-content li { font-size: 10.5pt; }

  /* Info cards */
  .info-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8pt;
  }
  .info-card {
    border: 1pt solid #bbb;
    border-radius: 4pt;
    padding: 10pt 12pt;
    break-inside: avoid;
    page-break-inside: avoid;
  }
  .info-card h4 { font-size: 9pt; }

  /* Tense sections */
  .tense-section {
    border: 1pt solid #bbb;
    break-inside: avoid;
    page-break-inside: avoid;
    margin: 10pt 0;
  }
  .tense-header {
    background: #333 !important;
    color: white !important;
    padding: 6pt 12pt;
    font-size: 9pt;
  }
  .tense-body { padding: 10pt 12pt; }
  .tense-body p { font-size: 10pt; }

  /* Tables */
  .tense-table-wrap,
  .compare-table-wrap {
    border: 1pt solid #bbb;
    break-inside: avoid;
    page-break-inside: avoid;
  }
  .tense-table th,
  .compare-table th {
    background: #333 !important;
    color: white !important;
    font-size: 8pt;
    padding: 6pt 10pt;
  }
  .tense-table td,
  .compare-table td {
    font-size: 9pt;
    padding: 5pt 10pt;
    border-bottom: 0.5pt solid #ddd;
  }

  /* Example blocks */
  .example-block {
    border: 1pt solid #ccc;
    border-radius: 4pt;
    padding: 8pt 12pt;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  /* Academic box */
  .academic-box {
    border: 1.5pt solid #333;
    break-inside: avoid;
    page-break-inside: avoid;
  }
  .academic-label {
    background: #333 !important;
    color: white !important;
    font-size: 8pt;
    padding: 5pt 12pt;
  }
  .academic-box-body {
    padding: 10pt 14pt;
    font-size: 10pt;
  }

  /* Labels in print */
  .label {
    border: 0.5pt solid #999;
    font-size: 7pt;
    padding: 1pt 5pt;
  }

  /* Note styling */
  .exp-content .note {
    border-left: 2pt solid #666;
    padding: 6pt 10pt;
    font-size: 9.5pt;
  }

  /* Links */
  a[href]::after {
    content: ' (' attr(href) ')';
    font-size: 8pt;
    color: #666 !important;
  }

  /* Page margins */
  @page {
    margin: 2cm;
    size: A4;
  }

  @page :first {
    margin-top: 2.5cm;
  }
}
