/* ==========================================================================
   Java 8 -> 21 × Spring Boot 3 Learning Hub Styles
   ========================================================================== */

:root {
  --font-sans: "Inter", "Noto Sans TC", "Microsoft JhengHei", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", "Cascadia Code", "Fira Code", Consolas, "Courier New", monospace;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --sidebar-width: 310px;
  --topbar-height: 58px;
  --transition: 160ms ease;
}

/* Dark Theme (Default) */
[data-theme="dark"] {
  --bg-app: #0d1117;
  --bg-sidebar: #11161f;
  --bg-surface: #161b22;
  --bg-surface-2: #1c222b;
  --bg-code: #0b0f14;
  --bg-hover: #212834;
  --bg-active: rgba(99, 102, 241, 0.16);

  --border: #28313e;
  --border-subtle: #1f2631;

  --text-primary: #e6edf3;
  --text-secondary: #9ba7b4;
  --text-muted: #6e7b8b;

  --accent: #818cf8;
  --accent-strong: #6366f1;
  --accent-soft: rgba(129, 140, 248, 0.14);

  --green: #34d399;
  --green-soft: rgba(52, 211, 153, 0.14);
  --amber: #fbbf24;
  --amber-soft: rgba(251, 191, 36, 0.14);
  --rose: #fb7185;
  --rose-soft: rgba(251, 113, 133, 0.13);
  --sky: #38bdf8;
  --sky-soft: rgba(56, 189, 248, 0.14);

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.28);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.36);

  /* Syntax highlighting */
  --syn-kw: #c084fc;
  --syn-anno: #fbbf24;
  --syn-type: #38bdf8;
  --syn-str: #86efac;
  --syn-num: #fb923c;
  --syn-com: #64748b;
}

/* Light Theme */
[data-theme="light"] {
  --bg-app: #f6f8fa;
  --bg-sidebar: #ffffff;
  --bg-surface: #ffffff;
  --bg-surface-2: #f1f5f9;
  --bg-code: #f8fafc;
  --bg-hover: #eef2f7;
  --bg-active: rgba(79, 70, 229, 0.10);

  --border: #dce3ec;
  --border-subtle: #e9eef5;

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;

  --accent: #4f46e5;
  --accent-strong: #4338ca;
  --accent-soft: rgba(79, 70, 229, 0.10);

  --green: #059669;
  --green-soft: rgba(5, 150, 105, 0.10);
  --amber: #d97706;
  --amber-soft: rgba(217, 119, 6, 0.12);
  --rose: #e11d48;
  --rose-soft: rgba(225, 29, 72, 0.10);
  --sky: #0284c7;
  --sky-soft: rgba(2, 132, 199, 0.10);

  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.08);

  /* Syntax highlighting */
  --syn-kw: #7c3aed;
  --syn-anno: #b45309;
  --syn-type: #0369a1;
  --syn-str: #15803d;
  --syn-num: #c2410c;
  --syn-com: #64748b;
}

/* Base Reset */
*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: var(--font-sans);
  background: var(--bg-app);
  color: var(--text-primary);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

button, input, textarea, select {
  font: inherit;
  color: inherit;
}

code {
  font-family: var(--font-mono);
  font-size: 0.88em;
}

/* Inline code in prose */
.prose-code, p code, li code, td code {
  background: var(--bg-surface-2);
  border: 1px solid var(--border-subtle);
  padding: 0.1em 0.38em;
  border-radius: 5px;
  color: var(--accent);
}

/* App Shell */
.app-shell {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: sticky;
  top: 0;
  z-index: 30;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--border-subtle);
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
}

.brand-logo {
  width: 42px;
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, #6366f1, #10b981);
  color: #fff;
  font-weight: 800;
  font-size: 13px;
  display: grid;
  place-items: center;
  box-shadow: var(--shadow-sm);
  letter-spacing: -0.5px;
  flex-shrink: 0;
}

.brand-text h1 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.25;
}

.brand-text p {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--text-muted);
}

/* Progress Card */
.progress-card {
  margin: 12px 14px 10px;
  padding: 12px 13px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.progress-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
  font-size: 12.5px;
}

.progress-label {
  color: var(--text-secondary);
  font-weight: 600;
}

.progress-value {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent);
  font-weight: 600;
}

.progress-track {
  height: 7px;
  border-radius: 999px;
  background: var(--bg-surface-2);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #6366f1, #10b981);
  transition: width 260ms ease;
}

.progress-stats {
  display: flex;
  justify-content: space-between;
  margin-top: 9px;
  font-size: 11.5px;
  color: var(--text-secondary);
}

.progress-stats span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
}
.dot-todo { background: var(--text-muted); opacity: 0.45; }
.dot-review { background: var(--amber); }
.dot-done { background: var(--green); }
.dot-note { background: var(--sky); }

/* View Tabs */
.view-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  margin: 0 14px 10px;
  padding: 4px;
  background: var(--bg-surface-2);
  border-radius: var(--radius-md);
}

.view-tab {
  border: none;
  background: transparent;
  padding: 7px 6px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
}

.view-tab:hover {
  color: var(--text-primary);
}

.view-tab.active {
  background: var(--bg-surface);
  color: var(--accent);
  box-shadow: var(--shadow-sm);
}

/* Search & Filters */
.sidebar-controls {
  padding: 0 14px 10px;
  border-bottom: 1px solid var(--border-subtle);
}

.track-pills {
  display: flex;
    flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 8px;
}

.track-pill {
    flex: 1 1 5.5rem;
  border: 1px solid var(--border);
  background: var(--bg-surface);
  padding: 5px 4px;
  border-radius: var(--radius-sm);
    font-size: .875rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.track-pill:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.track-pill.active {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
  color: #fff;
}

.search-box {
  position: relative;
  margin-bottom: 8px;
}

.search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 12px;
  opacity: 0.65;
  pointer-events: none;
}

.search-box input {
  width: 100%;
  padding: 7px 10px 7px 30px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  outline: none;
  transition: border-color var(--transition);
}

.search-box input:focus {
  border-color: var(--accent);
}

.filter-pills {
  display: flex;
  gap: 5px;
}

.filter-pill {
  flex: 1;
  border: 1px solid var(--border);
  background: transparent;
  padding: 4px 6px;
  border-radius: 999px;
  font-size: 11.5px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
}

.filter-pill:hover {
  background: var(--bg-hover);
}

.filter-pill.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
}

/* Lesson Nav List (Collapsible Tree) */
.lesson-nav {
  flex: 1;
  overflow-y: auto;
  padding: 8px 10px 24px;
}

.phase-group {
  margin-bottom: 8px;
}

.phase-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 9px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  font-size: 12.2px;
  font-weight: 700;
  color: var(--text-secondary);
  cursor: pointer;
  text-align: left;
  transition: all var(--transition);
}

.phase-toggle:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.phase-group.has-active > .phase-toggle {
  color: var(--accent);
  background: var(--accent-soft);
}

.phase-toggle-left {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.phase-title-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.phase-toggle-right {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.phase-chevron {
  display: inline-block;
  font-size: 11px;
  transition: transform 160ms ease;
  opacity: 0.75;
}

.phase-group.collapsed .phase-chevron {
  transform: rotate(-90deg);
}

.phase-items {
  margin-left: 11px;
  padding-left: 8px;
  margin-top: 3px;
  border-left: 1px solid var(--border);
}

.phase-group.collapsed .phase-items {
  display: none;
}

.phase-count {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
}

.lesson-item {
  width: 100%;
  display: flex;
  align-items: flex-start;
  gap: 9px;
  text-align: left;
  padding: 8px 10px;
  margin-bottom: 3px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  cursor: pointer;
  transition: all var(--transition);
}

.lesson-item:hover {
  background: var(--bg-hover);
}

.lesson-item.active {
  background: var(--bg-active);
  border-color: rgba(129, 140, 248, 0.35);
}

.lesson-status-dot {
  margin-top: 6px;
  flex-shrink: 0;
}

.lesson-item-body {
  flex: 1;
  min-width: 0;
}

.lesson-item-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.35;
}

.lesson-item.active .lesson-item-title {
  color: var(--accent);
  font-weight: 600;
}

.lesson-item-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
  font-size: 11px;
  color: var(--text-muted);
}

.note-indicator {
  color: var(--sky);
  font-weight: 600;
}

/* Main Area */
.main-wrapper {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: var(--topbar-height);
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  background: var(--bg-app);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(8px);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.breadcrumb {
  font-size: 13px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-surface);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
}

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

.btn-primary {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
  color: #fff;
}

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

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

.btn-danger:hover {
  border-color: var(--rose);
  background: var(--rose-soft);
}

.btn-ghost {
  background: transparent;
}

.icon-btn {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  background: var(--bg-surface);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 15px;
  transition: all var(--transition);
}

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

.file-btn {
  cursor: pointer;
}

/* Main Content Container */
.main-content {
  width: 100%;
  max-width: 1040px;
  margin: 0 auto;
  padding: 28px 28px 72px;
}

/* Lesson Hero */
.lesson-hero {
  margin-bottom: 22px;
}

.lesson-hero-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.phase-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
}

.status-switcher {
  display: inline-flex;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 3px;
  gap: 3px;
}

.status-btn {
  border: none;
  background: transparent;
  padding: 5px 11px;
  border-radius: 5px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
}

.status-btn:hover {
  color: var(--text-primary);
}

.status-btn.active[data-status="todo"] {
  background: var(--bg-surface-2);
  color: var(--text-primary);
}

.status-btn.active[data-status="review"] {
  background: var(--amber-soft);
  color: var(--amber);
}

.status-btn.active[data-status="done"] {
  background: var(--green-soft);
  color: var(--green);
}

.lesson-title {
  margin: 0 0 10px;
  font-size: 27px;
  font-weight: 800;
  line-height: 1.3;
  letter-spacing: -0.3px;
}

.lesson-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.tag {
  font-size: 11.5px;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--bg-surface-2);
  border: 1px solid var(--border);
  color: var(--text-secondary);
}

/* Cards */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.card-title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.summary-text {
  margin: 0 0 14px;
  color: var(--text-primary);
  font-size: 15px;
}

.legacy-callout {
  background: var(--amber-soft);
  border-left: 3px solid var(--amber);
  padding: 12px 15px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 13.8px;
  color: var(--text-primary);
}

.legacy-callout strong {
  color: var(--amber);
}

/* GitBook Companion Banner (for Track 1) */
.gitbook-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 16px;
  margin-bottom: 18px;
  border-radius: var(--radius-md);
  background: var(--sky-soft);
  border: 1px solid rgba(56, 189, 248, 0.3);
  font-size: 13.8px;
}

.gitbook-banner a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  background: var(--accent-strong);
  color: #fff;
  text-decoration: none;
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
}

.gitbook-banner a:hover {
  background: var(--accent);
}

/* GitBook-style Long-form Textbook Article */
.article-toc {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 14px;
  margin-bottom: 18px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 12.5px;
}

.article-toc-label {
  color: var(--text-muted);
  font-weight: 700;
  margin-right: 4px;
}

.toc-link {
  color: var(--accent);
  text-decoration: none;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  font-weight: 500;
}

.toc-link:hover {
  background: var(--accent-strong);
  color: #fff;
}

.article-card {
  padding: 26px 28px;
}

.article-section {
  padding-bottom: 24px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border-subtle);
}

.article-section:last-child {
  padding-bottom: 0;
  margin-bottom: 0;
  border-bottom: none;
}

.article-section h3 {
  margin: 0 0 12px;
  font-size: 18.5px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.2px;
}

.article-section p {
  margin: 0 0 12px;
  font-size: 14.8px;
  line-height: 1.78;
  color: var(--text-primary);
}

.article-section ul {
  margin: 6px 0 14px;
  padding-left: 20px;
}

.article-section li {
  margin-bottom: 7px;
  font-size: 14.4px;
  line-height: 1.7;
}

.section-code-block {
  margin: 14px 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--bg-code);
}

.section-code-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 13px;
  background: var(--bg-surface-2);
  border-bottom: 1px solid var(--border);
  font-size: 12.2px;
  font-weight: 600;
  color: var(--text-secondary);
}

.section-code-block pre {
  margin: 0;
  padding: 14px 16px;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.65;
}

.code-output {
  border-top: 1px dashed var(--border);
  background: rgba(16, 185, 129, 0.06);
  padding: 10px 16px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--green);
  white-space: pre-wrap;
}

.code-output-label {
  display: block;
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.section-callout {
  margin: 14px 0 4px;
  padding: 12px 15px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 13.8px;
  line-height: 1.7;
}

.section-callout.info {
  background: var(--sky-soft);
  border-left: 3px solid var(--sky);
}

.section-callout.tip {
  background: var(--green-soft);
  border-left: 3px solid var(--green);
}

.section-callout.warn {
  background: var(--amber-soft);
  border-left: 3px solid var(--amber);
}

.section-table-wrap {
  margin: 14px 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow-x: auto;
}

/* Code Comparison Grid */
.code-compare-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.code-panel {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--bg-code);
  display: flex;
  flex-direction: column;
}

.code-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 13px;
  font-size: 12.5px;
  font-weight: 700;
  border-bottom: 1px solid var(--border);
}

.code-panel.before .code-panel-header {
  background: var(--rose-soft);
  color: var(--rose);
}

.code-panel.after .code-panel-header {
  background: var(--green-soft);
  color: var(--green);
}

.copy-btn {
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-size: 11.5px;
  padding: 3px 8px;
  border-radius: 5px;
  cursor: pointer;
}

.copy-btn:hover {
  color: var(--text-primary);
  border-color: var(--accent);
}

.code-panel pre {
  margin: 0;
  padding: 14px 15px;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 12.8px;
  line-height: 1.6;
  color: var(--text-primary);
  flex: 1;
}

/* Syntax Tokens */
.tok-kw { color: var(--syn-kw); font-weight: 600; }
.tok-anno { color: var(--syn-anno); }
.tok-type { color: var(--syn-type); }
.tok-str { color: var(--syn-str); }
.tok-num { color: var(--syn-num); }
.tok-com { color: var(--syn-com); font-style: italic; }

/* Key Points & Pitfalls */
.points-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.point-list {
  margin: 0;
  padding-left: 19px;
}

.point-list li {
  margin-bottom: 8px;
  font-size: 14px;
  color: var(--text-primary);
}

.pitfall-box {
  background: var(--rose-soft);
  border: 1px solid rgba(251, 113, 133, 0.28);
  border-radius: var(--radius-md);
  padding: 14px 16px;
}

.pitfall-box h4, .keypoint-box h4 {
  margin: 0 0 10px;
  font-size: 14px;
}

.pitfall-box h4 { color: var(--rose); }

.keypoint-box {
  background: var(--sky-soft);
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: var(--radius-md);
  padding: 14px 16px;
}

.keypoint-box h4 { color: var(--sky); }

/* Practice Checklist */
.practice-goal {
  margin: 0 0 12px;
  font-size: 14px;
  color: var(--text-secondary);
}

.checklist {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.check-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface-2);
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  font-size: 13.8px;
  transition: background var(--transition);
}

.check-row:hover {
  background: var(--bg-hover);
}

.check-row input[type="checkbox"] {
  margin-top: 4px;
  accent-color: var(--accent-strong);
  width: 15px;
  height: 15px;
  cursor: pointer;
}

.check-row.checked span {
  text-decoration: line-through;
  color: var(--text-muted);
}

/* Quiz */
.quiz-question {
  font-size: 14.5px;
  font-weight: 600;
  margin: 0 0 12px;
}

.quiz-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.quiz-option {
  text-align: left;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-surface-2);
  font-size: 13.8px;
  cursor: pointer;
  transition: all var(--transition);
}

.quiz-option:hover:not(:disabled) {
  border-color: var(--accent);
  background: var(--bg-hover);
}

.quiz-option.correct {
  border-color: var(--green);
  background: var(--green-soft);
  color: var(--text-primary);
  font-weight: 600;
}

.quiz-option.wrong {
  border-color: var(--rose);
  background: var(--rose-soft);
}

.quiz-explain {
  margin-top: 12px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface-2);
  border-left: 3px solid var(--accent);
  font-size: 13.5px;
}

/* Notes Editor */
.notes-card {
  border-color: rgba(129, 140, 248, 0.35);
}

.notes-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.snippet-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  border: 1px solid var(--border);
  background: var(--bg-surface-2);
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  color: var(--text-secondary);
  cursor: pointer;
}

.chip:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.note-mode-toggle {
  display: inline-flex;
  background: var(--bg-surface-2);
  border-radius: var(--radius-sm);
  padding: 2px;
}

.mode-btn {
  border: none;
  background: transparent;
  padding: 4px 10px;
  border-radius: 5px;
  font-size: 12px;
  cursor: pointer;
  color: var(--text-secondary);
}

.mode-btn.active {
  background: var(--bg-surface);
  color: var(--accent);
  font-weight: 600;
}

.note-textarea {
  width: 100%;
  min-height: 170px;
  padding: 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-code);
  font-family: var(--font-mono);
  font-size: 13.3px;
  line-height: 1.65;
  resize: vertical;
  outline: none;
}

.note-textarea:focus {
  border-color: var(--accent);
}

.note-preview {
  min-height: 170px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-code);
  font-size: 14px;
}

.note-preview h3, .note-preview h4 {
  margin: 12px 0 6px;
}

.note-preview pre {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  overflow-x: auto;
}

.note-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-muted);
}

/* Lesson Prev/Next Footer */
.lesson-footer-nav {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 24px;
}

.nav-card-btn {
  flex: 1;
  max-width: 48%;
  display: flex;
  flex-direction: column;
  padding: 13px 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  text-align: left;
  transition: all var(--transition);
}

.nav-card-btn.next {
  text-align: right;
  margin-left: auto;
}

.nav-card-btn:hover {
  border-color: var(--accent);
  background: var(--bg-hover);
}

.nav-card-label {
  font-size: 11.5px;
  color: var(--text-muted);
}

.nav-card-title {
  font-size: 13.8px;
  font-weight: 600;
  color: var(--text-primary);
  margin-top: 3px;
}

/* Cheat Sheet Tables */
.table-wrap {
  overflow-x: auto;
}

.ref-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

.ref-table th, .ref-table td {
  text-align: left;
  padding: 11px 13px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.ref-table th {
  background: var(--bg-surface-2);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

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

/* Notes Overview & Custom Notes */
.notes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

.note-summary-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.note-summary-card h3 {
  margin: 0;
  font-size: 15px;
}

.note-snippet {
  font-size: 13.2px;
  color: var(--text-secondary);
  white-space: pre-wrap;
  max-height: 140px;
  overflow: hidden;
  background: var(--bg-code);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  font-family: var(--font-mono);
}

.custom-note-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.form-input {
  width: 100%;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-code);
  font-size: 14px;
  outline: none;
}

.form-input:focus {
  border-color: var(--accent);
}

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
  border: 1px dashed var(--border);
  border-radius: var(--radius-lg);
}

/* Toast */
.toast {
  position: fixed;
  bottom: 22px;
  right: 22px;
  background: var(--bg-surface);
  border: 1px solid var(--accent);
  color: var(--text-primary);
  padding: 10px 16px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  font-size: 13.5px;
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: all 200ms ease;
  z-index: 60;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

/* Responsive */
.mobile-only {
  display: none;
}

.sidebar-overlay {
  display: none;
}

@media (max-width: 980px) {
  .code-compare-grid,
  .points-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 820px) {
  .mobile-only {
    display: inline-grid;
  }

  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    transform: translateX(-100%);
    transition: transform 220ms ease;
    box-shadow: var(--shadow-md);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-overlay.show {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 25;
  }

  .topbar {
    padding: 0 14px;
  }

  .topbar-actions .btn {
    padding: 6px 8px;
    font-size: 12px;
  }

  .main-content {
    padding: 18px 14px 56px;
  }

  .lesson-title {
    font-size: 22px;
  }
}
/* Learning guidance added for the zero-experience curriculum. */
.learning-meta { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; }
.learning-guide p { line-height: 1.8; }
.prerequisite-link { background: transparent; border: 0; color: var(--accent, #8baaff); font: inherit; text-align: left; text-decoration: underline; text-underline-offset: .2em; cursor: pointer; padding: .15rem .25rem; }
.prerequisite-link:focus-visible, .run-instructions summary:focus-visible { outline: 2px solid currentColor; outline-offset: 3px; }
.reading-note, .code-context { color: var(--text-secondary); font-size: .9rem; line-height: 1.7; }
.code-context { padding: .6rem 1rem; overflow-wrap: anywhere; border-bottom: 1px solid var(--border-color, #596175); }
.run-instructions { padding: .75rem 1rem; }
.run-instructions summary { cursor: pointer; font-size: .9rem; }
.run-instructions p { font-size: .9rem; }
.summary-text, .article-section p, .article-section li, .point-list,
.practice-goal, .check-row, .quiz-question, .quiz-option, .legacy-callout,
.ref-table { font-size: 1rem; }
.lesson-item-title, .progress-label, .code-output, .section-code-block pre { font-size: .875rem; }
