/* ============================================================
   CSCD 240 Course Companion — Design System
   Eastern Washington University

   TABLE OF CONTENTS
   -----------------
   1. Design Tokens (custom properties)     :root
   2. Reset & Base                          *, html, body
   3. Links                                 a
   4. Navigation                            .site-nav
   5. Breadcrumbs                           .lesson-breadcrumb
   6. Lesson Layout                         .lesson-page, .lesson-header
   7. Lesson Content                        .lesson-content (prose, code, tables)
   8. Callouts & Blockquotes                blockquote, details
   9. Quiz Blocks                           .quiz-block
   10. Series Index                         .series-index, .lesson-list
   11. Skills Hub                           .skills-hub
   12. Skill Related / Cross-links          .skill-related-lesson, .cross-link
   13. Footer                               .site-footer
   14. Tables (global)                      .lesson-content table, .schedule-table
   15. Terminal Component                   .terminal
   16. Print Styles                         @media print
   17. Responsive                           @media (max-width)
   18. Homepage Layout                      .home, .series-row, .tool-link
   19. Update Toast                         .update-toast
   20. Dark Mode                            [data-theme="dark"]
   21. Focus & Accessibility                :focus-visible, .skip-link
   22. Utility                              .sr-only

   Design principles:
   - Typography-first: Let type hierarchy do the heavy lifting
   - Warm neutrals: #fafaf8 base, not sterile white
   - EWU brand: #a63d20 for branding, #2563eb for actions
   - No decoration without purpose
   ============================================================ */

/* --- Custom Properties (Design Tokens) --- */
:root {
  /* Brand */
  --ewu-red: #a63d20;
  --ewu-red-light: #c95018;
  --ewu-red-subtle: #fdf6f3;
  --ewu-red-hover: #8a3219;

  /* Neutrals */
  --surface-0: #fafaf8;
  --surface-1: #f4f3f1;
  --surface-2: #eae8e4;
  --surface-3: #ddd9d4;
  --border: #d4d0ca;
  --border-light: #e8e5e0;

  /* Text */
  --text-primary: #1a1a1a;
  --text-secondary: #4a4a4a;
  --text-tertiary: #6b6b6b;
  --text-inverse: #fafaf8;

  /* Semantic */
  --color-insight: #1d4ed8;
  --color-insight-bg: #eff5ff;
  --color-action: var(--color-insight);
  --color-action-subtle: var(--color-insight-bg);
  --color-pitfall: #b91c1c;
  --color-pitfall-bg: #fef2f2;
  --color-trick: #15803d;
  --color-trick-bg: #f0fdf4;
  --color-java: #7c3aed;
  --color-java-bg: #f5f3ff;
  --color-check: #92400e;
  --color-check-bg: #fffbeb;
  --color-bigpic: #1e3a5f;
  --color-bigpic-bg: #f0f4f8;
  --color-try: #0d9488;
  --color-try-bg: #f0fdfa;

  /* Gradients & effects */
  --glow-action: rgba(37, 99, 235, 0.08);
  --glow-trick: rgba(22, 163, 74, 0.08);
  --gradient-subtle: linear-gradient(135deg, var(--surface-0) 0%, var(--surface-1) 100%);

  /* Code */
  --code-bg: #1e1e2e;
  --code-text: #cdd6f4;
  --code-border: #313244;
  --code-inline-bg: #f0eeeb;
  --code-inline-text: #a63d20;

  /* Layout */
  --content-width: 680px;
  --content-wide: 800px;
  --nav-height: 56px;
  --section-gap: 3.5rem;

  /* Typography */
  --font-body: 'Source Serif 4', georgia, 'Times New Roman', serif;
  --font-heading: 'Inter', -apple-system, blinkmacsystemfont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', 'Consolas', monospace;
  --font-ui: 'Inter', -apple-system, blinkmacsystemfont, 'Segoe UI', sans-serif;

  /* Motion */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --duration-fast: 150ms;
  --duration-normal: 250ms;
}

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

html {
  font-size: 17px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  color: var(--text-primary);
  background-color: var(--surface-0);
  line-height: 1.72;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

::selection {
  background-color: rgba(166, 61, 32, 0.15);
  color: var(--text-primary);
}

/* --- Links --- */
a {
  color: var(--ewu-red);
  text-decoration: none;
  transition: color var(--duration-fast) var(--ease-out);
}

a:hover {
  color: var(--ewu-red-hover);
}

/* Links in prose content must be distinguishable without color alone (WCAG 1.4.1) */
.lesson-content a,
.cheat-sheet a,
.skill-page .lesson-content a {
  text-decoration: underline;
  text-decoration-color: rgba(166, 61, 32, 0.3);
  text-underline-offset: 2px;
}

.lesson-content a:hover,
.cheat-sheet a:hover,
.skill-page .lesson-content a:hover {
  text-decoration-color: var(--ewu-red);
}

/* --- Top Navigation Bar --- */
.site-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(250, 250, 248, 0.95);
  backdrop-filter: blur(16px) saturate(1.2);
  -webkit-backdrop-filter: blur(16px) saturate(1.2);
  border-bottom: 1px solid var(--border-light);
  height: var(--nav-height);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}

.site-nav__inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 1.5rem;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.site-nav__brand {
  font-family: var(--font-heading);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--ewu-red);
  letter-spacing: -0.01em;
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
}

.site-nav__brand:hover {
  color: var(--ewu-red-hover);
}

.site-nav__brand-accent {
  color: var(--ewu-red);
  font-weight: 700;
}

.site-nav__links {
  display: flex;
  gap: 0.125rem;
  list-style: none;
  align-items: center;
  flex: 1;
  justify-content: center;
}

.site-nav__links a {
  font-family: var(--font-ui);
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-secondary);
  padding: 0.35rem 0.6rem;
  border-radius: 6px;
  text-decoration: none;
  white-space: nowrap;
  transition: all var(--duration-fast) var(--ease-out);
}

.site-nav__links a:hover {
  color: var(--text-primary);
  background: var(--surface-1);
}

.site-nav__links a.active {
  color: var(--ewu-red);
  background: var(--ewu-red-subtle);
  font-weight: 600;
}

/* Right toolbar: search + auth — always visible */
.site-nav__toolbar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

/* Search button in nav */
.site-nav__search-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: none;
  border: 1px solid var(--border-light);
  border-radius: 6px;
  padding: 0.3rem 0.55rem;
  cursor: pointer;
  color: var(--text-tertiary);
  font-family: var(--font-ui);
  font-size: 0.78rem;
  transition: all var(--duration-fast) var(--ease-out);
}

.site-nav__search-btn:hover {
  color: var(--ewu-red);
  border-color: var(--ewu-red);
  background: var(--ewu-red-subtle);
}

/* Avatar/profile button — shared base for nav and homepage */
.site-nav__avatar-btn,
.home-avatar-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  background: var(--surface-1);
  cursor: pointer;
  font-family: var(--font-ui);
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--text-secondary);
  letter-spacing: 0.02em;
  transition: all var(--duration-fast) var(--ease-out);
  line-height: 1;
  padding: 0;
  position: relative;
  overflow: hidden;
}

.site-nav__avatar-btn:hover,
.home-avatar-btn:hover {
  border-color: var(--color-action);
  color: var(--color-action);
  background: var(--color-action-subtle);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.08);
}

.site-nav__avatar-btn svg,
.home-avatar-btn svg {
  width: 14px;
  height: 14px;
  color: var(--text-tertiary);
}

.site-nav__avatar-btn:hover svg,
.home-avatar-btn:hover svg {
  color: var(--color-action);
}

/* Initials text inside avatar button */
.site-nav__initials {
  font-family: var(--font-ui);
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1;
}

/* User avatar image fills the button circle when logged in */
.site-nav__avatar-btn .site-nav__user-avatar,
.home-avatar-btn .site-nav__user-avatar {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  border: none;
}

/* Login button */
.site-nav__login-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.65rem;
  border-radius: 6px;
  border: 1.5px solid var(--color-action);
  background: var(--color-insight-bg);
  cursor: pointer;
  font-family: var(--font-ui);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-action);
  transition: all var(--duration-fast) var(--ease-out);
  white-space: nowrap;
}

.site-nav__login-btn:hover {
  background: var(--color-action);
  color: #fff;
}

.site-nav__login-btn svg {
  width: 14px;
  height: 14px;
}

/* User menu (shown when logged in) */
.site-nav__user-menu {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

/* Standalone user avatar (outside button) — hidden in new layout */
.site-nav__user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
}

.site-nav__logout-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid var(--border-light);
  background: transparent;
  cursor: pointer;
  color: var(--text-tertiary);
  transition: all var(--duration-fast) var(--ease-out);
  padding: 0;
}

.site-nav__logout-btn:hover {
  color: var(--ewu-red);
  border-color: var(--ewu-red);
  background: var(--ewu-red-subtle);
}

/* Auth dropdown modal */
.auth-dropdown {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 5rem;
}

.auth-dropdown__backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(2px);
}

.auth-dropdown__panel {
  position: relative;
  background: var(--surface-0);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  max-width: 340px;
  width: 90%;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
}

.auth-dropdown__title {
  font-family: var(--font-ui);
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 0.25rem;
}

.auth-dropdown__subtitle {
  font-family: var(--font-ui);
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin: 0 0 1rem;
}

.auth-dropdown__provider {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  padding: 0.65rem 1rem;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  background: var(--surface-0);
  cursor: pointer;
  font-family: var(--font-ui);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-primary);
  transition: all var(--duration-fast) var(--ease-out);
  margin-bottom: 0.5rem;
}

.auth-dropdown__provider:hover {
  border-color: var(--color-action);
  background: var(--color-action-subtle);
}

.auth-dropdown__note {
  font-family: var(--font-ui);
  font-size: 0.7rem;
  color: var(--text-tertiary);
  margin: 0.75rem 0 0;
  line-height: 1.5;
}

/* Merge modal (shown after login when local/server progress differs) */
.sync-merge-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(3px);
}

.sync-merge-panel {
  background: var(--surface-0);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.75rem;
  max-width: 420px;
  width: 92%;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
}

.sync-merge-title {
  font-family: var(--font-ui);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 0.35rem;
}

.sync-merge-subtitle {
  font-family: var(--font-ui);
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin: 0 0 1.25rem;
  line-height: 1.5;
}

.sync-merge-compare {
  border: 1px solid var(--border-light, #e8e5e0);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 1.25rem;
}

.sync-merge-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  padding: 0.45rem 0.75rem;
  font-family: var(--font-ui);
  font-size: 0.78rem;
  border-bottom: 1px solid var(--border-light, #e8e5e0);
}

.sync-merge-row:last-child {
  border-bottom: none;
}

.sync-merge-header {
  background: var(--surface-1);
  font-weight: 600;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-tertiary);
}

.sync-merge-label {
  color: var(--text-secondary);
  font-weight: 500;
}

.sync-merge-local,
.sync-merge-server {
  text-align: center;
  font-weight: 600;
  color: var(--text-primary);
}

.sync-merge-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.sync-merge-btn {
  flex: 1;
  min-width: 100px;
  padding: 0.55rem 0.75rem;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  background: var(--surface-0);
  cursor: pointer;
  font-family: var(--font-ui);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-primary);
  transition: all var(--duration-fast) var(--ease-out);
}

.sync-merge-btn:hover {
  border-color: var(--color-action);
  background: var(--color-action-subtle);
}

.sync-merge-btn--primary {
  background: var(--color-action, #2563eb);
  color: #fff;
  border-color: var(--color-action, #2563eb);
}

.sync-merge-btn--primary:hover {
  background: #1d4ed8;
  border-color: #1d4ed8;
}

.site-nav__search-key {
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--text-tertiary);
  background: var(--surface-1);
  padding: 0.1rem 0.35rem;
  border-radius: 3px;
  border: 1px solid var(--border-light);
  line-height: 1;
}

/* Mobile nav toggle */
.site-nav__toggle {
  display: none;
  background: none;
  border: none;
  padding: 0.5rem;
  cursor: pointer;
  color: var(--text-secondary);
  order: -1;
}

.site-nav__toggle svg {
  width: 20px;
  height: 20px;
}

@media (max-width: 768px) {
  .site-nav__toggle {
    display: block;
  }

  .site-nav__inner {
    gap: 0.5rem;
  }

  .site-nav__links {
    display: none;
    position: absolute;
    top: var(--nav-height);
    left: 0;
    right: 0;
    background: var(--surface-0);
    border-bottom: 1px solid var(--border-light);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
    flex-direction: column;
    padding: 0.5rem 1rem;
    gap: 0;
    z-index: 99;
  }

  .site-nav__links.open {
    display: flex;
  }

  .site-nav__links a {
    padding: 0.65rem 0.75rem;
    font-size: 0.85rem;
    border-radius: 8px;
  }

  /* Toolbar stays visible on mobile */
  .site-nav__toolbar {
    margin-left: auto;
  }

  /* Hide keyboard hint on mobile */
  .site-nav__search-key {
    display: none;
  }

  /* Login button stays fully visible on mobile — it's a primary action */
}

/* --- Page Container --- */
.page-container {
  flex: 1;
  width: 100%;
}

/* --- Schedule Table --- */
.schedule-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.schedule-table th {
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  text-align: left;
  padding: 0.6rem 0.75rem;
  border-bottom: 2px solid var(--border);
}

.schedule-table td {
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-secondary);
}

.schedule-table tr:hover td {
  background: var(--surface-1);
}

.schedule-table td:first-child {
  font-family: var(--font-ui);
  font-weight: 600;
  color: var(--text-primary);
  width: 3rem;
}

/* --- Lesson Layout --- */
.lesson-page {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 2.5rem 1.5rem 4rem;
}

/* Breadcrumb / lesson meta */
.lesson-breadcrumb {
  font-family: var(--font-ui);
  font-size: 0.75rem;
  color: var(--text-tertiary);
  margin-bottom: 1.5rem;
  padding: 0.5rem 0.75rem;
  background: var(--surface-1);
  border-radius: 6px;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.lesson-breadcrumb a {
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
}

.lesson-breadcrumb a:hover {
  color: var(--ewu-red);
}

.lesson-breadcrumb__sep {
  color: var(--text-tertiary);
  font-size: 0.7rem;
}

/* Lesson header */
.lesson-header {
  margin-bottom: var(--section-gap);
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border-light);
}

.lesson-header__tags {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.lesson-tag {
  font-family: var(--font-ui);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  padding: 0.25rem 0.65rem;
  border-radius: 100px;
  background: var(--surface-1);
  color: var(--text-tertiary);
}

.lesson-tag--series {
  background: var(--ewu-red-subtle);
  color: var(--ewu-red);
}

.lesson-header h1 {
  font-family: var(--font-heading);
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.2;
  color: var(--text-primary);
  margin-bottom: 0.6rem;
}

.lesson-header .subtitle {
  font-size: 1.05rem;
  color: var(--text-secondary);
  line-height: 1.55;
  font-style: normal;
}

/* --- Prerequisite Skill Tree --- */
.prereq-tree {
  border: 1px solid var(--border-light);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: var(--section-gap);
  background: var(--surface-0);
}

[data-theme="dark"] .prereq-tree {
  background: var(--surface-1);
}

.prereq-tree__header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 1.25rem;
  background: var(--surface-1);
  border-bottom: 1px solid var(--border-light);
  font-family: var(--font-ui);
}

.prereq-tree__icon {
  color: var(--text-tertiary);
  display: flex;
  align-items: center;
}

.prereq-tree__title {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-tertiary);
}

.prereq-tree__status {
  margin-left: auto;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-tertiary);
}

.prereq-tree__status.complete {
  color: var(--color-trick);
}

.prereq-tree__list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.prereq-tree__item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 1.25rem;
  border-bottom: 1px solid var(--border-light);
  font-size: 0.88rem;
  transition: background var(--duration-fast) var(--ease-out);
}

.prereq-tree__item:last-child {
  border-bottom: none;
}

.prereq-tree__item:hover {
  background: var(--surface-1);
}

.prereq-tree__check {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all var(--duration-fast) var(--ease-out);
  font-size: 0.65rem;
  color: transparent;
}

.prereq-tree__item.completed .prereq-tree__check {
  background: var(--color-trick);
  border-color: var(--color-trick);
  color: white;
}

.prereq-tree__item.not-started .prereq-tree__check {
  border-color: var(--border);
  border-style: dashed;
}

.prereq-tree__link-text {
  color: var(--text-secondary);
}

.prereq-tree__item a {
  color: var(--text-primary);
  text-decoration: none;
  font-weight: 500;
}

.prereq-tree__item a:hover {
  color: var(--ewu-red);
}

.prereq-tree__item.completed a {
  color: var(--color-trick);
}

/* --- Lesson Content Typography --- */
.lesson-content {
  line-height: 1.72;
  font-size: 1rem;
}

.lesson-content > * + * {
  margin-top: 1.25rem;
}

.lesson-content h2 {
  font-family: var(--font-heading);
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--text-primary);
  margin-top: var(--section-gap);
  margin-bottom: 0.25rem;
  padding-top: 0.5rem;
}

.lesson-content h3 {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-top: 2.25rem;
  margin-bottom: 0.2rem;
}

.lesson-content h4 {
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-top: 1.75rem;
}

.lesson-content p {
  color: var(--text-primary);
}

.lesson-content strong {
  font-weight: 600;
  color: var(--text-primary);
}

.lesson-content em {
  font-style: italic;
}

.lesson-content ul, .lesson-content ol {
  padding-left: 1.25rem;
}

.lesson-content li {
  margin-bottom: 0.3rem;
}

.lesson-content li::marker {
  color: var(--text-tertiary);
}

.lesson-content hr {
  border: none;
  height: 1px;
  background: var(--border-light);
  margin: var(--section-gap) 0;
}

/* --- Code Blocks (Dark Terminal Aesthetic) --- */
.lesson-content code {
  font-family: var(--font-mono);
  font-size: 0.84em;
  font-variant-ligatures: none;
}

.lesson-content p code,
.lesson-content li code,
.lesson-content td code,
.lesson-content details code {
  background: var(--code-inline-bg);
  color: var(--code-inline-text);
  padding: 0.12em 0.3em;
  border-radius: 3px;
  font-size: 0.84em;
}

.lesson-content pre {
  background: var(--code-bg);
  color: var(--code-text);
  border: 1px solid var(--code-border);
  border-radius: 10px;
  padding: 1.25rem 1.5rem;
  overflow-x: auto;
  font-size: 0.82rem;
  line-height: 1.6;
  margin: 1.75rem 0;
  position: relative;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12), 0 0 0 1px rgba(0, 0, 0, 0.06);
}

.lesson-content pre code {
  background: none;
  color: inherit;
  padding: 0;
  font-size: inherit;
}

/* Code block language label */
.lesson-content pre[data-lang]::before {
  content: attr(data-lang);
  position: absolute;
  top: 0;
  right: 0;
  font-family: var(--font-ui);
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #585b70;
  padding: 0.35rem 0.75rem;
  border-bottom-left-radius: 6px;
}

/* Copy button on code blocks */
.code-copy-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 5px;
  color: #9399b2;
  font-family: var(--font-ui);
  font-size: 0.65rem;
  padding: 0.25rem 0.55rem;
  cursor: pointer;
  opacity: 0;
  transition: opacity var(--duration-fast) var(--ease-out);
}

.lesson-content pre:hover .code-copy-btn {
  opacity: 1;
}

.code-copy-btn:hover,
.code-copy-btn:focus-visible {
  opacity: 1;
  background: rgba(255, 255, 255, 0.14);
  color: #cdd6f4;
}

.code-copy-btn.copied {
  color: var(--color-trick);
}

/* --- Terminal Playground --- */
.terminal {
  margin: 2rem 0;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--code-border);
  background: var(--code-bg);
}

.terminal__titlebar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.85rem;
  background: #181825;
  border-bottom: 1px solid var(--code-border);
}

.terminal__dots {
  display: flex;
  gap: 5px;
}

.terminal__dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.terminal__dot--red { background: #f38ba8; }
.terminal__dot--yellow { background: #f9e2af; }
.terminal__dot--green { background: #a6e3a1; }

.terminal__title {
  font-family: var(--font-ui);
  font-size: 0.68rem;
  color: #a6adc8;
  flex: 1;
  text-align: center;
  margin-right: 2rem;
}

.terminal__body {
  padding: 1rem 1.25rem;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  line-height: 1.65;
  color: var(--code-text);
  overflow-x: auto;
}

.terminal__body .prompt {
  color: #a6adc8;
  user-select: none;
}

.terminal__body .command {
  color: #cdd6f4;
}

.terminal__body .output {
  color: #9399b2;
}

.terminal__body .highlight-output {
  color: #a6e3a1;
}

.terminal__body .error-output {
  color: #f38ba8;
}

.terminal__body .comment {
  color: #585b70;
  font-style: italic;
}

/* Shell prompts personalized with GitHub username (added by JS) */
.personalized-prompt {
  transition: color 0.2s ease;
}

/* --- Callout Blocks --- */
.lesson-content blockquote {
  position: relative;
  margin: 2rem 0;
  padding: 1.1rem 1.25rem 1.1rem 1.25rem;
  border-radius: 8px;
  border: 1px solid var(--border-light);
  border-left: 3px solid var(--color-insight);
  background: var(--color-insight-bg);
  font-size: 0.92rem;
  line-height: 1.65;
}

.lesson-content blockquote p {
  color: var(--text-primary);
}

.lesson-content blockquote p:first-child strong:first-child {
  font-family: var(--font-ui);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  display: block;
  margin-bottom: 0.45rem;
}

.lesson-content blockquote p + p {
  margin-top: 0.5rem;
}

/* Callout variants */
.lesson-content blockquote.callout-key-insight {
  background: var(--color-insight-bg);
  border-color: var(--color-insight-bg);
  border-left-color: var(--color-insight);
}

.lesson-content blockquote.callout-key-insight p:first-child strong:first-child {
  color: var(--color-insight);
}

.lesson-content blockquote.callout-common-pitfall {
  background: var(--color-pitfall-bg);
  border-color: var(--color-pitfall-bg);
  border-left-color: var(--color-pitfall);
}

.lesson-content blockquote.callout-common-pitfall p:first-child strong:first-child {
  color: var(--color-pitfall);
}

.lesson-content blockquote.callout-the-trick {
  background: var(--color-trick-bg);
  border-color: var(--color-trick-bg);
  border-left-color: var(--color-trick);
}

.lesson-content blockquote.callout-the-trick p:first-child strong:first-child {
  color: var(--color-trick);
}

.lesson-content blockquote.callout-sanity-check {
  background: var(--color-check-bg);
  border-color: var(--color-check-bg);
  border-left-color: var(--color-check);
}

.lesson-content blockquote.callout-sanity-check p:first-child strong:first-child {
  color: var(--color-check);
}

.lesson-content blockquote.callout-from-java {
  background: var(--color-java-bg);
  border-color: var(--color-java-bg);
  border-left-color: var(--color-java);
}

.lesson-content blockquote.callout-from-java p:first-child strong:first-child {
  color: var(--color-java);
}

.lesson-content blockquote.callout-big-picture {
  background: var(--color-bigpic-bg);
  border-color: var(--color-bigpic-bg);
  border-left-color: var(--color-bigpic);
}

.lesson-content blockquote.callout-big-picture p:first-child strong:first-child {
  color: var(--color-bigpic);
}

.lesson-content blockquote.callout-try-it {
  background: var(--color-try-bg);
  border-color: var(--color-try-bg);
  border-left-color: var(--color-try);
}

.lesson-content blockquote.callout-try-it p:first-child strong:first-child {
  color: var(--color-try);
}

/* --- Quick Check (Details/Summary) --- */
.lesson-content details {
  margin: 1.75rem 0;
  border: 1px solid var(--border-light);
  border-left: 3px solid var(--ewu-red, #a63d20);
  border-radius: 6px;
  overflow: hidden;
  background: var(--surface-0);
}

.lesson-content details summary {
  display: block;
  position: relative;
  font-family: var(--font-ui);
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-primary);
  padding: 1rem 1.25rem 1rem 2.75rem;
  cursor: pointer;
  user-select: none;
  background: transparent;
  transition: background var(--duration-fast) var(--ease-out);
  list-style: none;
}

.lesson-content details summary::-webkit-details-marker {
  display: none;
}

.lesson-content details summary::before {
  content: "";
  position: absolute;
  left: 1rem;
  top: 1rem;
  width: 20px;
  height: 20px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%23a63d20' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='9 18 15 12 9 6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  transition: transform 0.2s var(--ease-out);
}

.lesson-content details[open] summary::before {
  transform: rotate(90deg);
}

.lesson-content details summary:hover {
  background: var(--surface-1);
}

.lesson-content details[open] summary {
  border-bottom: 1px solid var(--border-light);
  color: var(--ewu-red, #a63d20);
}

.lesson-content details > :not(summary) {
  padding: 0 1.25rem 0 3.25rem;
}

.lesson-content details > p:last-child,
.lesson-content details > ul:last-child,
.lesson-content details > ol:last-child {
  padding-bottom: 1.25rem;
}

.lesson-content details > p:first-of-type {
  padding-top: 1.1rem;
  font-size: 0.95rem;
  line-height: 1.65;
  color: var(--text-secondary);
}

/* --- Inline Quiz Component --- */

/* --- Quiz / Check Your Understanding --- */
.quiz-block {
  margin: 2.5rem 0;
  border: 2px solid var(--color-check, #d97706);
  border-radius: 10px;
  overflow: hidden;
  background: var(--surface-0);
  transition: border-color 0.3s ease;
}

.quiz-block.quiz-completed {
  border-color: var(--color-trick, #16a34a);
}

.quiz-block__header {
  font-family: var(--font-ui);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-check, #d97706);
  padding: 0.75rem 1.5rem;
  background: var(--color-check-bg, #fffbeb);
  border-bottom: 1px solid rgba(217, 119, 6, 0.15);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.3s ease;
}

.quiz-completed .quiz-block__header {
  color: var(--color-trick, #16a34a);
  background: var(--color-trick-bg, #f0fdf4);
  border-bottom-color: rgba(22, 163, 74, 0.15);
}

.quiz-block__header-icon {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 2px solid var(--color-check, #d97706);
  color: var(--color-check, #d97706);
  transition: all 0.3s ease;
}

.quiz-completed .quiz-block__header-icon {
  border-color: var(--color-trick, #16a34a);
  background: var(--color-trick, #16a34a);
  color: white;
}

.quiz-block__question {
  padding: 1.25rem 1.5rem 0.75rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.5;
}

.quiz-block__options {
  padding: 0 1.5rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.quiz-option {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border: 1.5px solid var(--border-light);
  border-radius: 8px;
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
  font-size: 0.88rem;
  line-height: 1.5;
  background: var(--surface-0);
}

.quiz-option:hover:not(.disabled) {
  border-color: var(--color-check, #d97706);
  background: var(--color-check-bg, #fffbeb);
  transform: translateX(2px);
}

.quiz-option__marker {
  font-family: var(--font-ui);
  font-size: 0.72rem;
  font-weight: 700;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: var(--surface-1);
  color: var(--text-tertiary);
  border: 1.5px solid var(--border-light);
  transition: all var(--duration-fast) var(--ease-out);
}

.quiz-option:hover:not(.disabled) .quiz-option__marker {
  border-color: var(--color-check, #d97706);
  color: var(--color-check, #d97706);
}

.quiz-option__text {
  flex: 1;
  color: var(--text-secondary);
}

/* Quiz answer states */
.quiz-option.correct {
  border-color: var(--color-trick, #16a34a);
  background: var(--color-trick-bg, #f0fdf4);
  transform: none;
}

.quiz-option.correct .quiz-option__marker {
  background: var(--color-trick, #16a34a);
  color: white;
  border-color: var(--color-trick, #16a34a);
}

.quiz-option.selected.correct .quiz-option__text {
  color: var(--text-primary);
  font-weight: 500;
}

.quiz-option.incorrect {
  border-color: var(--color-pitfall, #dc2626);
  background: var(--color-pitfall-bg, #fef2f2);
  transform: none;
}

.quiz-option.incorrect .quiz-option__marker {
  background: var(--color-pitfall, #dc2626);
  color: white;
  border-color: var(--color-pitfall, #dc2626);
}

.quiz-option.disabled {
  cursor: default;
  pointer-events: none;
  opacity: 0.85;
}

.quiz-option.disabled:not(.correct, .incorrect) {
  opacity: 0.55;
}

.quiz-block__explanation {
  display: none;
  padding: 1rem 1.5rem 1.25rem;
  border-top: 1px solid var(--border-light);
  background: var(--surface-1);
  font-size: 0.88rem;
  line-height: 1.65;
  color: var(--text-secondary);
}

.quiz-block__explanation.visible {
  display: block;
}

.quiz-block__explanation strong {
  color: var(--text-primary);
}

/* --- Lesson Navigation (Prev/Next) --- */
.lesson-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-top: var(--section-gap);
  padding-top: 2rem;
  border-top: 1px solid var(--border-light);
}

.lesson-nav__link {
  display: block;
  padding: 1rem 1.25rem;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  text-decoration: none;
  transition: all var(--duration-normal) var(--ease-out);
}

.lesson-nav__link:hover {
  border-color: var(--ewu-red);
  background: var(--ewu-red-subtle);
}

.lesson-nav__link--prev {
  text-align: left;
}

.lesson-nav__link--next {
  text-align: right;
}

.lesson-nav__label {
  font-family: var(--font-ui);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin-bottom: 0.25rem;
}

.lesson-nav__title {
  font-family: var(--font-heading);
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-primary);
}

@media (max-width: 600px) {
  .lesson-nav {
    grid-template-columns: 1fr;
  }
}

/* --- Series Index Page --- */
.series-index {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 2.5rem 1.5rem 4rem;
}

.series-index__header {
  margin-bottom: 2.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-light);
}

.series-index__header h1 {
  font-family: var(--font-heading);
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
}

.series-index__header p {
  font-size: 1rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.lesson-list {
  list-style: none;
  padding: 0;
}

.lesson-list__item {
  /* No borders — rows use card-style hover instead */
}

.lesson-list__link {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  padding: 0.875rem 0.75rem;
  margin: 0 -0.75rem;
  text-decoration: none;
  transition: all var(--duration-fast) var(--ease-out);
  border-radius: 8px;
}

.lesson-list__link:hover {
  background: var(--surface-1);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.lesson-list__num {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: var(--surface-1);
  border: 1px solid var(--border-light);
  font-family: var(--font-ui);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-secondary);
  white-space: nowrap;
  flex-shrink: 0;
  transition: all var(--duration-fast) var(--ease-out);
}

.lesson-list__link:hover .lesson-list__num {
  background: var(--ewu-red);
  border-color: var(--ewu-red);
  color: #fff;
  box-shadow: 0 1px 4px rgba(166, 61, 32, 0.25);
}

.lesson-list__info {
  flex: 1;
}

.lesson-list__title {
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.15rem;
}

.lesson-list__desc {
  font-size: 0.82rem;
  color: var(--text-tertiary);
  line-height: 1.45;
}

.lesson-list__time {
  font-family: var(--font-ui);
  font-size: 0.72rem;
  color: var(--text-tertiary);
  white-space: nowrap;
}

/* --- Skills Hub Page --- */
.skills-hub {
  max-width: var(--content-wide);
  margin: 0 auto;
  padding: 2.5rem 1.5rem 4rem;
}

.skills-hub__header {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.skills-hub__header h1 {
  font-family: var(--font-heading);
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0;
}

.skills-hub__subtitle {
  font-size: 0.92rem;
  color: var(--text-secondary);
  margin: 0.15rem 0 0 0;
}

.skills-hub__profile {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.skills-hub__achievements {
  margin-bottom: 2rem;
}

@media (max-width: 600px) {
  .skills-hub__header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }
}

/* --- Skill: Related Lesson Link --- */
.skill-related-lesson {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1rem;
  margin-bottom: 1.5rem;
  background: var(--color-insight-bg, #eff5ff);
  border-radius: 6px;
  font-size: 0.88rem;
  color: var(--text-secondary);
}

.skill-related-lesson svg {
  flex-shrink: 0;
  color: var(--color-insight, #2563eb);
}

.skill-related-lesson a {
  color: var(--color-insight, #2563eb);
  font-weight: 500;
  text-decoration: none;
}

.skill-related-lesson a:hover {
  text-decoration: underline;
}

/* --- Cross-Links (Lessons ↔ Skills ↔ CTF) --- */
.cross-link {
  border: 1px solid var(--border-light);
  border-radius: 10px;
  overflow: hidden;
  margin-top: 2rem;
  background: var(--surface-0);
}

[data-theme="dark"] .cross-link {
  background: var(--surface-1);
}

.cross-link__header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.25rem;
  background: var(--surface-1);
  border-bottom: 1px solid var(--border-light);
  font-family: var(--font-ui);
}

.cross-link__header svg {
  color: var(--text-tertiary);
  flex-shrink: 0;
}

.cross-link__title {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-tertiary);
}

.cross-link--skills .cross-link__header svg {
  color: var(--ewu-red, #a63d20);
}

.cross-link--ctf .cross-link__header svg {
  color: var(--color-trick, #16a34a);
}

.cross-link--prereq-reading .cross-link__header svg {
  color: var(--color-insight, #2563eb);
}

.cross-link__list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.cross-link__item {
  border-bottom: 1px solid var(--border-light);
}

.cross-link__item:last-child {
  border-bottom: none;
}

.cross-link__item a {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 1.25rem;
  color: var(--text-primary);
  text-decoration: none;
  font-family: var(--font-ui);
  font-size: 0.88rem;
  transition: background 0.15s;
}

.cross-link__item a:hover {
  background: var(--surface-1);
}

[data-theme="dark"] .cross-link__item a:hover {
  background: var(--surface-2, #2a2a3a);
}

.cross-link__icon {
  flex-shrink: 0;
  font-size: 0.85rem;
}

.cross-link__xp {
  margin-left: auto;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--ewu-red, #a63d20);
  background: rgba(166, 61, 32, 0.08);
  padding: 0.15rem 0.5rem;
  border-radius: 10px;
}

[data-theme="dark"] .cross-link__xp {
  background: rgba(166, 61, 32, 0.2);
}

/* ============================================================
   9b. CTF Practice Widgets
   ============================================================ */

/* ── CTF Hero — dark tactical panel ── */

.ctf-hero {
  background: #111116;
  border: 1px solid #222230;
  border-radius: 12px;
  padding: 2rem 2rem 1.5rem;
  margin-bottom: 1.5rem;
  text-align: center;
  position: relative;
  overflow: hidden;
  color: #e4e2dd;
}

.ctf-hero::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, #a63d20, #1d4ed8, #22d3ee);
  opacity: 0.7;
}

.ctf-hero::after {
  content: '';
  position: absolute;
  top: -80px; left: 50%; transform: translateX(-50%);
  width: 400px; height: 300px;
  background: radial-gradient(ellipse, rgba(34,211,238,0.04) 0%, transparent 70%);
  pointer-events: none;
}

.ctf-hero__badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: #22d3ee;
  background: rgba(34,211,238,0.08);
  border: 1px solid rgba(34,211,238,0.15);
  padding: 0.25rem 0.65rem;
  border-radius: 4px;
  margin-bottom: 0.75rem;
  position: relative;
}

.ctf-hero__badge::before {
  content: '';
  width: 5px; height: 5px;
  border-radius: 50%;
  background: #22d3ee;
  animation: ctf-pulse 2s ease-in-out infinite;
}

@keyframes ctf-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.ctf-hero__title {
  font-family: var(--font-ui);
  font-size: 1.6rem;
  font-weight: 800;
  color: #e4e2dd;
  margin-bottom: 0.3rem;
  letter-spacing: -0.02em;
  position: relative;
}

.ctf-hero__subtitle {
  color: #7d7b74;
  font-size: 0.85rem;
  margin-bottom: 1rem;
  position: relative;
}

.ctf-hero__stats {
  display: flex;
  justify-content: center;
  gap: 2rem;
  margin-bottom: 1.25rem;
  position: relative;
}

.ctf-hero__stat {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.ctf-hero__stat-val {
  font-family: var(--font-mono);
  font-size: 1.3rem;
  font-weight: 700;
  color: #e4e2dd;
}

.ctf-hero__stat-lbl {
  font-family: var(--font-mono);
  font-size: 0.55rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #5a5854;
}

.ctf-hero__actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  position: relative;
}

.ctf-hero__cta {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: linear-gradient(135deg, #1d4ed8, #4a90f4);
  color: #fff;
  padding: 0.65rem 1.35rem;
  border-radius: 8px;
  font-family: var(--font-ui);
  font-size: 0.85rem;
  font-weight: 700;
  text-decoration: none;
  transition: all 0.2s cubic-bezier(0.16,1,0.3,1);
  box-shadow: 0 2px 12px rgba(29,78,216,0.2);
}

.ctf-hero__cta:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(74,144,244,0.3);
  color: #fff;
}

.ctf-hero__cta--outline {
  background: transparent;
  color: #7d7b74;
  border: 1px solid #2a2a32;
  box-shadow: none;
}

.ctf-hero__cta--outline:hover {
  border-color: #3a3a42;
  color: #e4e2dd;
  box-shadow: none;
}

/* Countdown */
.ctf-countdown {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  color: #22d3ee;
  background: rgba(34,211,238,0.06);
  border: 1px solid rgba(34,211,238,0.12);
  padding: 0.3rem 0.75rem;
  border-radius: 4px;
}

/* Progress bar */
.ctf-progress {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.ctf-progress__track {
  flex: 1;
  height: 6px;
  background: var(--surface-1);
  border-radius: 3px;
  overflow: hidden;
}

.ctf-progress__bar {
  height: 100%;
  background: var(--color-trick);
  border-radius: 3px;
  transition: width 0.3s ease;
  width: 0;
}

.ctf-progress__text {
  font-family: var(--font-ui);
  font-size: 0.7rem;
  color: var(--text-secondary);
  white-space: nowrap;
}

/* Section heading */
.ctf-section-heading {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.ctf-section-heading::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--border), transparent);
}

/* Challenge grid */
.ctf-challenge-grid {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 2rem;
}

/* Individual challenge card */
.ctf-challenge {
  background: var(--surface-1);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 1.25rem;
  transition: border-color 0.2s;
}

.ctf-challenge[data-state="solved"] {
  border-color: var(--color-trick);
}

.ctf-challenge[data-state="wrong"] {
  border-color: var(--color-pitfall);
}

.ctf-challenge__header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.ctf-challenge__tier {
  font-family: var(--font-ui);
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.15rem 0.4rem;
  border-radius: 3px;
}

.ctf-challenge__tier--quickfire {
  color: var(--color-action);
  background: rgba(37, 99, 235, 0.08);
}

.ctf-challenge__tier--warmup {
  color: var(--color-check);
  background: rgba(217, 119, 6, 0.08);
}

.ctf-challenge__points {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-secondary);
  margin-left: auto;
}

.ctf-challenge__status-icon {
  font-size: 0.85rem;
  color: var(--color-trick);
  min-width: 1rem;
  text-align: center;
}

.ctf-challenge__name {
  font-family: var(--font-ui);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--heading);
  margin-bottom: 0.5rem;
}

.ctf-challenge__body {
  font-size: 0.85rem;
  line-height: 1.6;
}

.ctf-challenge__description {
  margin-bottom: 0.75rem;
}

.ctf-challenge__description p {
  margin-bottom: 0.4rem;
}

.ctf-challenge__description code {
  font-family: var(--font-mono);
  font-size: 0.8em;
  background: rgba(166, 61, 32, 0.08);
  color: var(--ewu-red);
  padding: 0.1em 0.3em;
  border-radius: 3px;
}

.ctf-challenge__description pre {
  background: #1e1e2e;
  color: #cdd6f4;
  padding: 0.75rem 1rem;
  border-radius: 6px;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  margin: 0.5rem 0;
}

/* Text input */
.ctf-challenge__input-row {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.ctf-challenge__flag-input {
  flex: 1;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  background: var(--surface-0);
  color: var(--text-primary);
}

.ctf-challenge__flag-input:focus {
  outline: 2px solid var(--color-action);
  outline-offset: -1px;
}

.ctf-challenge__flag-input:disabled {
  opacity: 0.6;
}

.ctf-challenge__submit {
  font-family: var(--font-ui);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 6px;
  background: var(--ewu-red);
  color: #fff;
  cursor: pointer;
  transition: transform 0.15s, filter 0.15s;
}

.ctf-challenge__submit:hover:not(:disabled) {
  transform: translateY(-1px);
  filter: brightness(1.1);
}

.ctf-challenge__submit:disabled {
  opacity: 0.6;
  cursor: default;
}

/* Multiple choice */
.ctf-challenge__mc-options {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-top: 0.5rem;
}

.ctf-mc-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  background: var(--surface-0);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.85rem;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s, background-color 0.15s, transform 0.1s;
}

.ctf-mc-option:hover:not(:disabled) {
  border-color: var(--color-action);
  background: rgba(37, 99, 235, 0.04);
  transform: translateX(2px);
}

.ctf-mc-option__marker {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  background: rgba(37, 99, 235, 0.08);
  color: var(--color-action);
  font-family: var(--font-ui);
  font-size: 0.7rem;
  font-weight: 700;
  flex-shrink: 0;
}

.ctf-mc-option--disabled {
  opacity: 0.6;
  cursor: default;
}

/* Feedback */
.ctf-challenge__feedback {
  margin-top: 0.5rem;
  font-family: var(--font-ui);
  font-size: 0.8rem;
  font-weight: 600;
  min-height: 1.25rem;
}

.ctf-feedback--correct {
  color: var(--color-trick);
}

.ctf-feedback--wrong {
  color: var(--color-pitfall);
}

/* Shake animation */
@keyframes ctf-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-4px); }
  40% { transform: translateX(4px); }
  60% { transform: translateX(-2px); }
  80% { transform: translateX(2px); }
}

.ctf-shake {
  animation: ctf-shake 0.4s ease-in-out;
}

/* Past practice sets */
.ctf-past-set {
  margin-bottom: 1rem;
}

.ctf-past-set > summary {
  font-family: var(--font-ui);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0.5rem 0;
}

.ctf-past-set__challenges {
  padding-top: 0.5rem;
}

/* Resources panel */
.ctf-resources-panel {
  margin-top: 2rem;
  border-top: 1px solid var(--border-subtle);
  padding-top: 1rem;
}

.ctf-resources-toggle {
  font-family: var(--font-ui);
  font-size: 1rem;
  font-weight: 700;
  color: var(--heading);
  cursor: pointer;
  padding: 0.5rem 0;
}

/* Loading state */
.ctf-loading {
  color: var(--text-secondary);
  font-style: italic;
  text-align: center;
  padding: 2rem;
}

/* Dark mode overrides */
[data-theme="dark"] .ctf-hero {
  background: #0d0d12;
  border-color: #1a1a22;
}

[data-theme="dark"] .ctf-challenge {
  background: var(--surface-1);
}

[data-theme="dark"] .ctf-challenge__flag-input {
  background: var(--surface-0);
  border-color: var(--border-subtle);
  color: var(--text-primary);
}

[data-theme="dark"] .ctf-mc-option {
  background: var(--surface-0);
  border-color: var(--border-subtle);
  color: var(--text-primary);
}

/* --- Footer --- */
.site-footer {
  border-top: 1px solid var(--border-light);
  padding: 2rem 1.5rem;
  text-align: center;
  font-family: var(--font-ui);
  font-size: 0.72rem;
  color: var(--text-secondary);
}

.site-footer a {
  color: var(--text-secondary);
}

.site-footer a:hover {
  color: var(--ewu-red);
}

/* --- Tables --- */
.lesson-content table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  margin: 1.5rem 0;
}

.lesson-content th {
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: 0.75rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  text-align: left;
  padding: 0.6rem 0.75rem;
  border-bottom: 2px solid var(--border);
  color: var(--text-secondary);
}

.lesson-content td {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-secondary);
}

.lesson-content tr:hover td {
  background: var(--surface-1);
}

/* --- Images --- */
.lesson-content img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  margin: 1.5rem 0;
}

/* --- Progress Indicator (Reading Position) --- */
.reading-progress {
  position: fixed;
  top: var(--nav-height);
  left: 0;
  width: 0%;
  height: 2px;
  background: var(--ewu-red);
  z-index: 99;
  transition: width 50ms linear;
}

/* --- Print Styles --- */
@media print {
  .site-nav, .site-footer, .lesson-nav, .reading-progress,
  .code-copy-btn, .update-toast, .cscd240-dashboard {
    display: none !important;
  }

  body {
    font-size: 11pt;
    color: black;
    background: white;
    -webkit-font-smoothing: auto;
  }

  .lesson-page {
    max-width: 100%;
    padding: 1cm;
  }

  .lesson-header {
    border-bottom: 2pt solid black;
  }

  .lesson-content pre {
    background: #f5f5f5 !important;
    color: black !important;
    border: 1px solid #ccc;
    border-radius: 0;
    break-inside: avoid;
    font-size: 9pt;
  }

  .lesson-content pre code {
    color: black !important;
  }

  .lesson-content blockquote {
    border: 1px solid #ccc;
    border-left: 3px solid #666;
    background: #fafafa !important;
    break-inside: avoid;
  }

  .lesson-content h2, .lesson-content h3 {
    break-after: avoid;
  }

  .lesson-content img {
    max-width: 100%;
    break-inside: avoid;
  }

  .quiz-block {
    border: 1px solid #ccc;
    break-inside: avoid;
  }

  .quiz-block__header {
    background: #f0f0f0 !important;
  }

  .quiz-option {
    border: 1px solid #ddd;
  }

  .quiz-option[data-correct="true"]::after {
    content: " (correct)";
    font-weight: bold;
    color: #333;
  }

  .terminal {
    border: 1px solid #ccc;
    break-inside: avoid;
  }

  .terminal__titlebar {
    background: #f0f0f0 !important;
  }

  .terminal__body {
    background: #f5f5f5 !important;
    color: black !important;
  }

  a[href]::after {
    content: none; /* don't print URLs inline — too noisy */
  }

  .prereq-tree {
    border: 1px solid #ccc;
    background: #fafafa !important;
  }
}

/* --- Responsive --- */
@media (max-width: 600px) {
  html {
    font-size: 16px;
  }

  .lesson-page {
    padding: 1.5rem 1.25rem 3rem;
  }

  .lesson-header h1 {
    font-size: 1.6rem;
  }

  .lesson-content pre {
    border-radius: 0;
    margin-left: -1.25rem;
    margin-right: -1.25rem;
    padding: 1rem 1.25rem;
  }

  .quiz-block {
    border-radius: 0;
    margin-left: -1.25rem;
    margin-right: -1.25rem;
    border-left: none;
    border-right: none;
  }
}

/* --- Update Toast --- */
.update-toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%) translateY(calc(100% + 2rem));
  z-index: 200;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--text-primary);
  color: var(--text-inverse);
  padding: 0.65rem 0.75rem 0.65rem 1.1rem;
  border-radius: 10px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18), 0 2px 8px rgba(0, 0, 0, 0.1);
  font-family: var(--font-ui);
  font-size: 0.82rem;
  font-weight: 500;
  opacity: 0;
  transition: transform 400ms var(--ease-out), opacity 400ms var(--ease-out);
  pointer-events: none;
  white-space: nowrap;
}

.update-toast.visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.update-toast__text {
  flex: 1;
}

.update-toast__btn {
  background: var(--ewu-red);
  color: white;
  border: none;
  border-radius: 6px;
  padding: 0.35rem 0.85rem;
  font-family: var(--font-ui);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--duration-fast) var(--ease-out);
}

.update-toast__btn:hover {
  background: var(--ewu-red-hover);
}

.update-toast__dismiss {
  background: none;
  border: none;
  color: rgba(250, 250, 248, 0.5);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 0 0.2rem;
  line-height: 1;
  transition: color var(--duration-fast) var(--ease-out);
}

.update-toast__dismiss:hover {
  color: var(--text-inverse);
}

@media (max-width: 600px) {
  .update-toast {
    left: 1rem;
    right: 1rem;
    transform: translateX(0) translateY(calc(100% + 2rem));
    border-radius: 10px;
  }

  .update-toast.visible {
    transform: translateX(0) translateY(0);
  }
}

/* --- Homepage Layout --- */
.home {
  max-width: var(--content-wide, 800px);
  margin: 0 auto;
  padding: 0 1.5rem 1.25rem;
}

.home-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 1.25rem 0 0.75rem;
}

.home-header h1 {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--text-primary);
  margin: 0;
  line-height: 1.2;
}

.home-header h1 span {
  font-weight: 400;
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-left: 0.5rem;
}

.home-header__right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-family: var(--font-ui);
  font-size: 0.75rem;
  color: var(--text-tertiary);
}

/* .home-avatar-btn base styles are shared with .site-nav__avatar-btn above */

@media (max-width: 600px) {
  .home-header__meta { display: none; }
}

.home-dashboard {
  margin-bottom: 1rem;
}

.home-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

@media (min-width: 700px) {
  .home-grid {
    grid-template-columns: 1fr 220px;
    gap: 2rem;
  }
}

.home-label {
  font-family: var(--font-ui);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin: 0 0 0.5rem;
}

/* Series rows */
.series-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border-light);
  text-decoration: none;
  transition: all var(--duration-fast) var(--ease-out);
}

.series-row:first-of-type {
  border-top: 1px solid var(--border-light);
}

.series-row:hover {
  background: var(--surface-1);
  margin: 0 -0.5rem;
  padding-left: 0.5rem;
  padding-right: 0.5rem;
  border-radius: 6px;
}

.series-row__num {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: var(--surface-1);
  border: 1px solid var(--border-light);
  font-family: var(--font-ui);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-secondary);
  flex-shrink: 0;
  transition: all var(--duration-fast) var(--ease-out);
}

.series-row:hover .series-row__num {
  background: var(--color-action);
  border-color: var(--color-action);
  color: #fff;
  box-shadow: 0 1px 4px rgba(37, 99, 235, 0.25);
}

.series-row__info {
  flex: 1;
  min-width: 0;
}

.series-row__name {
  font-family: var(--font-heading);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.series-row__meta {
  font-family: var(--font-ui);
  font-size: 0.75rem;
  color: var(--text-tertiary);
}

.series-row__bar {
  width: 80px;
  height: 5px;
  background: var(--surface-2);
  border-radius: 3px;
  overflow: hidden;
  flex-shrink: 0;
}

.series-row__bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--color-action) 0%, #60a5fa 100%);
  border-radius: 3px;
  width: 0%;
  transition: width 0.5s var(--ease-out);
  box-shadow: 0 0 6px rgba(37, 99, 235, 0.3);
}

.series-row__count {
  font-family: var(--font-ui);
  font-size: 0.75rem;
  color: var(--text-tertiary);
  min-width: 36px;
  text-align: right;
}

.series-row__start-badge {
  font-family: var(--font-ui);
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--color-action);
  background: var(--color-action-subtle);
  padding: 0.15rem 0.5rem;
  border-radius: 100px;
  min-width: 36px;
  text-align: center;
  letter-spacing: 0.02em;
}

/* Tool links */
.tool-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem;
  margin-bottom: 0.25rem;
  border-radius: 6px;
  text-decoration: none;
  font-family: var(--font-ui);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all var(--duration-fast) var(--ease-out);
  border: 1px solid transparent;
  width: 100%;
  background: none;
  cursor: pointer;
  text-align: left;
}

.tool-link:hover {
  background: var(--surface-1);
  border-color: var(--border-light);
  color: var(--text-primary);
  transform: translateX(2px);
  box-shadow: -2px 0 0 var(--color-action);
}

.tool-link svg {
  flex-shrink: 0;
  color: var(--text-tertiary);
}

.tool-link:hover svg {
  color: var(--color-action);
}

.tool-link__kbd {
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--text-tertiary);
  background: var(--surface-1);
  padding: 0.15rem 0.35rem;
  border-radius: 3px;
  border: 1px solid var(--border-light);
  line-height: 1;
  margin-left: auto;
}

/* Schedule (collapsed) */
.home-schedule {
  margin-top: 1rem;
  border-top: 1px solid var(--border-light);
  padding-top: 0.5rem;
}

.home-schedule summary {
  font-family: var(--font-ui);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  cursor: pointer;
  padding: 0.25rem 0;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  user-select: none;
}

.home-schedule summary::-webkit-details-marker { display: none; }

.home-schedule summary::after {
  content: "";
  display: inline-block;
  border-left: 3.5px solid transparent;
  border-right: 3.5px solid transparent;
  border-top: 4.5px solid var(--text-tertiary);
  transition: transform var(--duration-fast) var(--ease-out);
}

.home-schedule details[open] summary::after {
  transform: rotate(180deg);
}

.home-schedule .schedule-table {
  margin-top: 0.75rem;
  font-size: 0.75rem;
}

.home-schedule .schedule-table td,
.home-schedule .schedule-table th {
  padding: 0.25rem 0.5rem;
}

/* --- Dark Mode --- */
[data-theme="dark"] {
  --surface-0: #1e1e2e;
  --surface-1: #262637;
  --surface-2: #2e2e40;
  --surface-3: #3b3b50;
  --border: #45475a;
  --border-light: #353547;
  --text-primary: #cdd6f4;
  --text-secondary: #bac2de;
  --text-tertiary: #a6adc8;
  --text-inverse: #1e1e2e;
  --ewu-red-subtle: rgba(166, 61, 32, 0.15);
  --code-bg: #181825;
  --code-border: #313244;
  --code-inline-bg: #262637;
  --code-inline-text: #fab387;
  --color-insight: #89b4fa;
  --color-insight-bg: rgba(137, 180, 250, 0.08);
  --color-pitfall: #f38ba8;
  --color-pitfall-bg: rgba(243, 139, 168, 0.08);
  --color-trick: #a6e3a1;
  --color-trick-bg: rgba(166, 227, 161, 0.08);
  --color-java-bg: rgba(203, 166, 247, 0.08);
  --color-check: #f9e2af;
  --color-check-bg: rgba(249, 226, 175, 0.08);
  --color-bigpic-bg: rgba(137, 180, 250, 0.06);
  --color-try-bg: rgba(148, 226, 213, 0.08);
  --color-action: #89b4fa;
  --color-action-subtle: rgba(137, 180, 250, 0.1);
}

[data-theme="dark"] .quiz-option {
  background: var(--surface-1);
}

[data-theme="dark"] .quiz-block {
  background: var(--surface-1);
}

[data-theme="dark"] .quiz-block__header {
  background: rgba(217, 119, 6, 0.08);
}

[data-theme="dark"] .quiz-completed .quiz-block__header {
  background: rgba(22, 163, 74, 0.08);
}

[data-theme="dark"] .lesson-content details {
  background: var(--surface-1);
  border-color: var(--border-light);
  border-left-color: var(--ewu-red, #a63d20);
}

[data-theme="dark"] .lesson-content details summary::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%23fab387' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='9 18 15 12 9 6'/%3E%3C/svg%3E");
}

/* Homepage dark mode */
[data-theme="dark"] .series-row:hover { background: var(--surface-2); }
[data-theme="dark"] .tool-link:hover { background: var(--surface-2); }

[data-theme="dark"] .tool-link__kbd {
  background: var(--surface-2);
  border-color: var(--border);
}

[data-theme="dark"] .home-schedule .schedule-table tr:hover td {
  background: var(--surface-2);
}

[data-theme="dark"] .home-avatar-btn {
  background: var(--surface-2);
  border-color: var(--border);
}
[data-theme="dark"] .series-row__start-badge { background: rgba(37, 99, 235, 0.15); }

[data-theme="dark"] .site-nav {
  background: rgba(30, 30, 46, 0.95);
}

/* --- Accessibility: Focus Styles --- */
*:focus-visible {
  outline: 2px solid var(--ewu-red);
  outline-offset: 2px;
}

button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--ewu-red);
  outline-offset: 2px;
  border-radius: 3px;
}

/* Skip to content link */
.skip-link {
  position: absolute;
  top: -100%;
  left: 1rem;
  padding: 0.5rem 1rem;
  background: var(--ewu-red);
  color: var(--text-inverse);
  font-family: var(--font-ui);
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: 0 0 6px 6px;
  z-index: 200;
  text-decoration: none;
}

.skip-link:focus {
  top: 0;
}

/* --- Instructor Dashboard --- */
.dash-status {
  text-align: center;
  padding: 3rem 1.5rem;
}

.dash-status__text {
  font-family: var(--font-ui);
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 1rem;
}

.dash-btn {
  font-family: var(--font-ui);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.4rem 1rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface-1);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 150ms ease;
}

.dash-btn:hover {
  background: var(--surface-2);
  border-color: var(--border);
  color: var(--text-primary);
}

.dash-btn--primary {
  background: var(--color-action);
  color: var(--text-inverse);
  border-color: var(--color-action);
}

.dash-btn--primary:hover {
  opacity: 0.9;
  color: var(--text-inverse);
}

.dash-btn--sm {
  font-size: 0.7rem;
  padding: 0.25rem 0.6rem;
  vertical-align: middle;
  margin-left: 0.5rem;
}

/* Stats bar */
.dash-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  margin-bottom: 2rem;
}

.dash-stat {
  background: var(--surface-1);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 1rem;
  text-align: center;
}

.dash-stat--warn .dash-stat__value {
  color: var(--color-pitfall);
}

.dash-stat__value {
  display: block;
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.dash-stat__label {
  display: block;
  font-family: var(--font-ui);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin-top: 0.25rem;
}

/* Section titles */
.dash-section-title {
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 2rem 0 0.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-light);
}

.dash-section-title--warn {
  color: var(--color-pitfall);
  border-bottom-color: rgba(185, 28, 28, 0.2);
}

.dash-section-desc {
  font-family: var(--font-ui);
  font-size: 0.8rem;
  color: var(--text-tertiary);
  margin-bottom: 0.75rem;
}

/* At-risk alert cards */
.dash-alert-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 2rem;
}

.dash-alert-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.6rem 1rem;
  background: var(--color-pitfall-bg);
  border: 1px solid rgba(185, 28, 28, 0.15);
  border-left: 3px solid var(--color-pitfall);
  border-radius: 6px;
  font-family: var(--font-ui);
  font-size: 0.82rem;
}

.dash-alert-card__name {
  font-weight: 600;
  color: var(--text-primary);
  min-width: 120px;
}

.dash-alert-card__detail {
  color: var(--text-tertiary);
  flex: 1;
}

.dash-alert-card__days {
  font-weight: 600;
  color: var(--color-pitfall);
  white-space: nowrap;
}

/* Roster table */
.dash-table-wrap {
  overflow-x: auto;
  margin-bottom: 0.5rem;
}

.dash-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-ui);
  font-size: 0.82rem;
}

.dash-table thead {
  background: var(--surface-1);
}

.dash-table th {
  font-weight: 600;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  padding: 0.6rem 0.75rem;
  text-align: left;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}

.dash-th--sortable {
  cursor: pointer;
  user-select: none;
}

.dash-th--sortable:hover {
  color: var(--text-primary);
}

.dash-th--sortable::after {
  content: '';
  display: inline-block;
  width: 0;
  height: 0;
  margin-left: 0.35rem;
  vertical-align: middle;
}

.dash-th--asc::after {
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-bottom: 5px solid var(--text-secondary);
}

.dash-th--desc::after {
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid var(--text-secondary);
}

.dash-table td {
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-primary);
}

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

.dash-table tr:hover {
  background: var(--surface-1);
}

.dash-td--mono {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--text-secondary);
}

.dash-td--num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.dash-row--warn {
  background: rgba(185, 28, 28, 0.03);
}

.dash-row--warn:hover {
  background: rgba(185, 28, 28, 0.06);
}

.dash-table-note {
  font-family: var(--font-ui);
  font-size: 0.82rem;
  color: var(--text-tertiary);
  text-align: center;
  padding: 1.5rem 0;
}

/* Dashboard responsive */
@media (max-width: 600px) {
  .dash-stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .dash-alert-card {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
  }

  .dash-table {
    font-size: 0.76rem;
  }

  .dash-table th,
  .dash-table td {
    padding: 0.4rem 0.5rem;
  }
}

/* Dashboard dark mode */
[data-theme="dark"] .dash-stat {
  background: var(--surface-1);
  border-color: var(--border);
}

[data-theme="dark"] .dash-alert-card {
  background: rgba(185, 28, 28, 0.08);
  border-color: rgba(185, 28, 28, 0.2);
}

[data-theme="dark"] .dash-table thead {
  background: var(--surface-1);
}

[data-theme="dark"] .dash-row--warn {
  background: rgba(185, 28, 28, 0.06);
}

[data-theme="dark"] .dash-row--warn:hover {
  background: rgba(185, 28, 28, 0.1);
}

/* --- Assignments (instructor + student) --- */

.dash-form {
  background: var(--surface-1);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}

.dash-form__row {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  align-items: flex-end;
}

.dash-form__field {
  display: flex;
  flex-direction: column;
  flex: 1;
  position: relative;
}

.dash-form__field--fixed {
  flex: 0 0 auto;
  width: 180px;
}

.dash-form__label {
  font-family: var(--font-ui);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-tertiary);
  margin-bottom: 0.3rem;
}

.dash-form__input {
  font-family: var(--font-ui);
  font-size: 0.85rem;
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--surface-0);
  color: var(--text-primary);
  outline: none;
  transition: border-color 150ms ease;
}

.dash-form__input:focus {
  border-color: var(--color-action);
}

.dash-form__input--textarea {
  resize: vertical;
  min-height: 2.5rem;
}

.dash-form__slugs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.35rem;
}

.dash-form__slug-tag {
  font-family: var(--font-mono, monospace);
  font-size: 0.7rem;
  background: var(--color-action-subtle, #eff5ff);
  color: var(--color-action);
  padding: 0.15rem 0.5rem;
  border-radius: 100px;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.dash-form__slug-tag button {
  font-size: 0.65rem;
  background: none;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

.dash-form__slug-tag button:hover {
  color: var(--color-pitfall);
}

.dash-slug-dropdown {
  position: absolute;
  z-index: 10;
  background: var(--surface-0);
  border: 1px solid var(--border);
  border-radius: 5px;
  max-height: 200px;
  overflow-y: auto;
  width: 100%;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  margin-top: 0.25rem;
}

.dash-slug-option {
  font-family: var(--font-ui);
  font-size: 0.8rem;
  padding: 0.4rem 0.6rem;
  cursor: pointer;
  color: var(--text-primary);
}

.dash-slug-option:hover {
  background: var(--color-action-subtle, #eff5ff);
}

.assign-card {
  background: var(--surface-1);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: flex-start;
  gap: 1rem;
}

.assign-card__body {
  flex: 1;
  min-width: 0;
}

.assign-card__title {
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.assign-card__meta {
  font-family: var(--font-ui);
  font-size: 0.75rem;
  color: var(--text-tertiary);
  margin-top: 0.25rem;
}

.assign-card__desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 0.35rem;
}

.assign-card__slugs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-top: 0.4rem;
}

.assign-card__slug {
  font-family: var(--font-mono, monospace);
  font-size: 0.65rem;
  background: var(--color-action-subtle, #eff5ff);
  color: var(--color-action);
  padding: 0.1rem 0.45rem;
  border-radius: 100px;
  text-decoration: none;
}

.assign-card__slug:hover {
  background: var(--color-action);
  color: var(--text-inverse);
}

.assign-card__actions {
  flex-shrink: 0;
  display: flex;
  gap: 0.35rem;
}

.assign-card--overdue .assign-card__meta {
  color: var(--color-pitfall);
}

.assign-empty {
  text-align: center;
  padding: 2rem;
  color: var(--text-tertiary);
  font-size: 0.85rem;
}

/* Student assignment view */
.assign-student-card {
  background: var(--surface-1);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 1.25rem;
  margin-bottom: 0.75rem;
}

.assign-student-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.assign-student-card__title {
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.assign-student-card__due {
  font-family: var(--font-ui);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-tertiary);
  white-space: nowrap;
}

.assign-student-card__due--soon {
  color: var(--color-check);
}

.assign-student-card__due--overdue {
  color: var(--color-pitfall);
}

.assign-student-card__desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 0.4rem;
}

.assign-student-card__items {
  margin-top: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.assign-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  padding: 0.35rem 0.6rem;
  border-radius: 5px;
  background: var(--surface-0);
  border: 1px solid var(--border-light);
  text-decoration: none;
  color: var(--text-primary);
  transition: border-color 150ms ease;
}

.assign-item:hover {
  border-color: var(--color-action);
}

.assign-item__check {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--border);
  flex-shrink: 0;
}

.assign-item--done .assign-item__check {
  background: var(--color-trick);
  border-color: var(--color-trick);
}

.assign-item--done .assign-item__check::after {
  content: "\2713";
  color: white;
  font-size: 0.65rem;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

.assign-progress-bar {
  height: 4px;
  background: var(--border-light);
  border-radius: 2px;
  margin-top: 0.5rem;
  overflow: hidden;
}

.assign-progress-bar__fill {
  height: 100%;
  background: var(--color-trick);
  border-radius: 2px;
  transition: width 300ms ease;
}

@media (max-width: 600px) {
  .dash-form__row {
    flex-direction: column;
  }

  .dash-form__field--fixed {
    width: 100%;
  }

  .assign-card {
    flex-direction: column;
  }

  .assign-student-card__header {
    flex-direction: column;
    align-items: flex-start;
  }
}

[data-theme="dark"] .dash-form {
  background: var(--surface-1);
  border-color: var(--border);
}

[data-theme="dark"] .assign-card {
  background: var(--surface-1);
  border-color: var(--border);
}

[data-theme="dark"] .assign-student-card {
  background: var(--surface-1);
  border-color: var(--border);
}

[data-theme="dark"] .assign-item {
  background: var(--surface-0);
  border-color: var(--border);
}

/* --- Utility --- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  border: 0;
}
