/* PDE Skill Tree - Clean & Refined */

:root {
  --color-bg: #ffffff;
  --color-bg-subtle: #f8f9fa;
  --color-bg-muted: #f1f3f4;

  --color-text: #1a1a1a;
  --color-text-secondary: #4a4a4a;
  --color-text-muted: #6b6b6b;

  --color-border: #e0e0e0;
  --color-border-light: #eeeeee;

  --color-accent: #5046e5;
  --color-accent-light: #ededfd;
  --color-success: #0d9488;
  --color-success-light: #e6f7f5;
  --color-warning: #b45309;
  --color-warning-light: #fef3e2;

  /* Problem levels */
  --level-1-bg: #e8f5e9;
  --level-1-text: #1b5e20;
  --level-2-bg: #fff8e1;
  --level-2-text: #f57f17;
  --level-3-bg: #fff3e0;
  --level-3-text: #e65100;
  --level-4-bg: #ffebee;
  --level-4-text: #c62828;
  --level-5-bg: #f3e5f5;
  --level-5-text: #6a1b9a;

  --font-sans: 'Source Sans Pro', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-serif: 'Source Serif Pro', Georgia, serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', Consolas, monospace;

  --max-width: 52rem;
  --radius: 8px;
  --radius-lg: 12px;
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  padding: 0;
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.7;
  color: var(--color-text);
  background: var(--color-bg);
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-sans);
  font-weight: 600;
  line-height: 1.3;
  margin-top: 2rem;
  margin-bottom: 1rem;
  color: var(--color-text);
}

h1 { font-size: 2.25rem; margin-top: 0; }
h2 {
  font-size: 1.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--color-border-light);
}
h3 { font-size: 1.35rem; }
h4 { font-size: 1.1rem; }

p { margin: 1rem 0; }

a {
  color: var(--color-accent);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--color-bg-muted);
  padding: 0.15em 0.4em;
  border-radius: 4px;
}

pre {
  background: var(--color-bg-subtle);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1rem;
  overflow-x: auto;
}
pre code {
  background: none;
  padding: 0;
}

blockquote {
  border-left: 4px solid var(--color-accent);
  margin: 1.5rem 0;
  padding: 0.5rem 1.5rem;
  background: var(--color-bg-subtle);
}

hr {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: 2.5rem 0;
}

/* Header */
.site-header {
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.site-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--color-text);
}
.site-title:hover {
  color: var(--color-accent);
  text-decoration: none;
}

.nav-links {
  display: flex;
  gap: 2rem;
}
.nav-links a {
  color: var(--color-text-secondary);
  font-weight: 500;
}
.nav-links a:hover {
  color: var(--color-accent);
  text-decoration: none;
}

/* Main Content */
.main-content {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2rem;
}

/* Hero */
.hero {
  text-align: center;
  padding: 3rem 0;
  margin-bottom: 2rem;
}

.hero h1 {
  font-size: 2.75rem;
  margin-bottom: 0.5rem;
}

.hero .subtitle {
  font-size: 1.25rem;
  color: var(--color-text-secondary);
  margin-top: 0;
}

.hero .textbook-info {
  margin-top: 1.5rem;
  padding: 1rem 1.5rem;
  background: var(--color-bg-subtle);
  border-radius: var(--radius);
  display: inline-block;
}

/* Chapter Grid */
.chapter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  margin: 2rem 0;
}

.chapter-card {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  transition: box-shadow 0.2s, border-color 0.2s;
}
.chapter-card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  border-color: var(--color-accent);
}

.chapter-card h3 {
  margin-top: 0;
  font-size: 1.15rem;
}

.chapter-card .section-list {
  margin: 0.5rem 0;
  padding-left: 0;
  list-style: none;
}

.chapter-card .section-list li {
  padding: 0.25rem 0;
  border-bottom: 1px solid var(--color-border-light);
}
.chapter-card .section-list li:last-child {
  border-bottom: none;
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
}

th, td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--color-border);
}

th {
  background: var(--color-bg-subtle);
  font-weight: 600;
}

tr:hover {
  background: var(--color-bg-subtle);
}

/* Mermaid */
.mermaid {
  margin: 1.5rem 0;
  text-align: center;
}

/* Equation Box */
.equation-box {
  background: linear-gradient(135deg, #f8faf9 0%, #f0f5f3 100%);
  border: 1px solid #c8d8d3;
  border-left: 4px solid #3d8b7a;
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 1.25rem 1.75rem;
  margin: 1.5rem 0;
  text-align: center;
  box-shadow: 0 2px 8px rgba(61, 139, 122, 0.08);
}

/* Tables inside equation boxes */
.equation-box table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin: 0.75rem 0;
  text-align: left;
  background: #fff;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.equation-box th {
  background: linear-gradient(180deg, #3d8b7a 0%, #357a6b 100%);
  color: #fff;
  font-weight: 600;
  padding: 0.875rem 1rem;
  font-size: 0.9rem;
  letter-spacing: 0.02em;
  border: none;
}

.equation-box th:first-child {
  border-radius: var(--radius) 0 0 0;
}

.equation-box th:last-child {
  border-radius: 0 var(--radius) 0 0;
}

.equation-box td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #e8eeec;
  color: var(--color-text-secondary);
}

.equation-box tr:last-child td {
  border-bottom: none;
}

.equation-box tr:nth-child(even) td {
  background: #f8faf9;
}

.equation-box tr:hover td {
  background: #eef5f3;
}

/* Skill nodes */
.skill-tree-container {
  margin: 2rem 0;
  padding: 1.5rem;
  background: var(--color-bg-subtle);
  border-radius: var(--radius-lg);
}

.skill-node {
  display: inline-block;
  padding: 0.5rem 1rem;
  margin: 0.25rem;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 500;
}
.skill-node.prereq { background: #e0f2fe; color: #0369a1; }
.skill-node.core { background: #fef3c7; color: #b45309; }
.skill-node.advanced { background: #d1fae5; color: #047857; }
.skill-node.mastery { background: #fce7f3; color: #be185d; }

/* Collapsible sections */
details {
  margin: 1rem 0;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
}

summary {
  padding: 1rem 1.25rem;
  background: var(--color-bg-subtle);
  cursor: pointer;
  font-weight: 600;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

summary::-webkit-details-marker {
  display: none;
}

summary::before {
  content: '▸';
  font-size: 0.85rem;
  color: var(--color-accent);
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

details[open] > summary::before {
  transform: rotate(90deg);
}

summary:hover {
  background: var(--color-bg-muted);
}

details[open] summary {
  border-bottom: 1px solid var(--color-border);
}

details > *:not(summary) {
  padding: 0 1.25rem;
}

/* Content inside details - improved spacing and readability */
details > p,
details > div {
  margin: 1rem 0;
  padding: 0 1.25rem;
  line-height: 1.7;
  color: var(--color-text-secondary);
}

details > p:first-of-type {
  margin-top: 1.25rem;
}

details > p:last-child {
  margin-bottom: 1.25rem;
}

/* Bold text inside details (for quiz answers) */
details strong {
  color: var(--color-accent);
  font-weight: 600;
}

details ul, details ol {
  padding-left: 2.5rem;
  margin: 1rem 0;
}

details li {
  margin: 0.4rem 0;
  line-height: 1.6;
}

/* Quiz-specific styling for Self-Assessment Quiz sections */
h2 + p + details,
h2 + details,
h3 + p + details,
h3 + details {
  border-left: 3px solid var(--color-accent);
}

h2 + p + details summary,
h2 + details summary,
h3 + p + details summary,
h3 + details summary {
  background: linear-gradient(135deg, var(--color-bg-subtle) 0%, var(--color-accent-light) 100%);
}

h2 + p + details summary:hover,
h2 + details summary:hover,
h3 + p + details summary:hover,
h3 + details summary:hover {
  background: linear-gradient(135deg, var(--color-bg-muted) 0%, #dddcfc 100%);
}

/* ========================================
   PROBLEM CONTAINERS
   ======================================== */
.problem-container {
  margin: 2rem auto;
  max-width: 42rem;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.problem-container:hover {
  border-color: var(--color-accent);
  box-shadow: 0 2px 8px rgba(80, 70, 229, 0.08);
}

.problem-header {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.875rem 1.25rem;
  background: var(--color-bg-subtle);
  border-bottom: 1px solid var(--color-border-light);
}

.problem-level {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}

.level-1 { background: var(--level-1-bg); color: var(--level-1-text); }
.level-2 { background: var(--level-2-bg); color: var(--level-2-text); }
.level-3 { background: var(--level-3-bg); color: var(--level-3-text); }
.level-4 { background: var(--level-4-bg); color: var(--level-4-text); }
.level-5 { background: var(--level-5-bg); color: var(--level-5-text); }

.problem-title {
  font-weight: 600;
  font-size: 1rem;
  margin: 0;
  color: var(--color-text);
}

.problem-statement {
  margin: 0;
  padding: 1.25rem 1.5rem;
  background: var(--color-bg);
}

.problem-statement ol,
.problem-statement ul {
  margin: 0.75rem 0;
  padding-left: 1.75rem;
}

.problem-statement li {
  margin: 0.4rem 0;
  line-height: 1.6;
}

.problem-statement ol[type="a"] {
  list-style-type: lower-alpha;
}

/* ========================================
   TOGGLE BUTTONS (Thought Process + Solution)
   Quiet, academic style - content is primary
   ======================================== */
.toggle-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  padding: 0.75rem 1.25rem;
  border-top: 1px solid var(--color-border-light);
  align-items: flex-start;
}

/* Both toggles - simple text links */
.thinking-toggle,
.solution-toggle {
  border: none;
  margin: 0;
  background: transparent;
  overflow: visible;
}

/* Shared summary styling - looks like a link */
.thinking-toggle summary,
.solution-toggle summary {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0;
  background: transparent;
  border: none;
  color: var(--color-text-muted);
  font-weight: 500;
  font-size: 0.85rem;
  cursor: pointer;
  list-style: none;
  text-decoration: underline;
  text-decoration-color: var(--color-border);
  text-underline-offset: 3px;
}

.thinking-toggle summary::-webkit-details-marker,
.solution-toggle summary::-webkit-details-marker {
  display: none;
}

.thinking-toggle summary::before,
.solution-toggle summary::before {
  content: '▶';
  font-size: 0.65rem;
  display: inline-block;
  opacity: 0.4;
}

.thinking-toggle[open] summary::before,
.solution-toggle[open] summary::before {
  content: '▼';
}

.thinking-toggle summary:hover,
.solution-toggle summary:hover {
  color: var(--color-text-secondary);
  text-decoration-color: var(--color-text-muted);
}

.thinking-toggle[open] summary,
.solution-toggle[open] summary {
  color: var(--color-text-secondary);
  text-decoration: none;
}

.thinking-toggle[open] summary::before,
.solution-toggle[open] summary::before {
  opacity: 0.5;
}

/* Content reveal */
.thinking-content,
.solution-content {
  margin-top: 0.625rem;
  padding: 0.875rem 1rem;
  background: var(--color-bg-subtle);
  border-radius: var(--radius);
  color: var(--color-text-secondary);
  line-height: 1.7;
  font-size: 0.9rem;
}

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

/* Lists inside toggle content */
.thinking-content ul,
.thinking-content ol,
.solution-content ul,
.solution-content ol {
  margin: 0.5rem 0;
  padding-left: 1.25rem;
}

.thinking-content li,
.solution-content li {
  margin: 0.25rem 0;
}

/* ========================================
   CHECKBOXES
   ======================================== */
.problem-checkbox-container {
  padding: 0.5rem 1.25rem 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.problem-checkbox {
  display: none;
}

.problem-checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  padding: 0.35rem 0.6rem;
  margin: -0.35rem -0.6rem;
  background: transparent;
  border-radius: 4px;
  font-weight: 500;
  font-size: 0.8rem;
  color: var(--color-text-muted);
  transition: all 0.15s ease;
  user-select: none;
}

.problem-checkbox-label:hover {
  color: var(--color-text-secondary);
  background: var(--color-bg-muted);
}

.problem-checkbox-label .checkbox-icon {
  width: 15px;
  height: 15px;
  border: 1.5px solid var(--color-border);
  border-radius: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  flex-shrink: 0;
  background: var(--color-bg);
}

.problem-checkbox-label:hover .checkbox-icon {
  border-color: var(--color-accent);
}

.problem-checkbox-label.checked {
  color: var(--color-accent);
}

.problem-checkbox-label.checked .checkbox-icon {
  border-color: var(--color-accent);
  background: var(--color-accent);
}

.problem-checkbox-label.checked .checkbox-icon::after {
  content: '✓';
  color: white;
  font-size: 9px;
  font-weight: bold;
}

/* ========================================
   MASTERY CHECKLIST
   ======================================== */
.mastery-checklist {
  background: var(--color-success-light);
  border: 1px solid var(--color-success);
  border-radius: var(--radius);
  padding: 1rem 1.5rem;
  margin: 1.5rem 0;
}

.mastery-checklist h4 {
  margin-top: 0;
  color: var(--color-success);
}

.mastery-checklist ul {
  list-style: none;
  padding: 0;
}

.mastery-checklist li {
  padding: 0.3rem 0;
  padding-left: 1.5rem;
  position: relative;
}

.mastery-checklist li::before {
  content: '○';
  position: absolute;
  left: 0;
  color: var(--color-success);
}

/* ========================================
   PAGE COMPLETION
   ======================================== */
.page-complete-container {
  margin-top: 3rem;
  padding: 1.5rem;
  background: var(--color-bg-subtle);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
}

.page-progress {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.page-complete-checkbox {
  display: none;
}

.page-complete-label {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius);
  border: 2px solid var(--color-accent);
  background: var(--color-bg);
  font-weight: 600;
  font-size: 1rem;
  transition: all 0.15s;
  user-select: none;
}

.page-complete-label:hover {
  background: var(--color-accent-light);
}

.page-complete-label .checkbox-icon {
  width: 22px;
  height: 22px;
  border: 2px solid var(--color-accent);
  border-radius: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.page-progress.completed .page-complete-label {
  border-color: var(--color-success);
  background: var(--color-success-light);
  color: var(--color-success);
}

.page-progress.completed .page-complete-label .checkbox-icon {
  border-color: var(--color-success);
  background: var(--color-success);
}

.page-progress.completed .page-complete-label .checkbox-icon::after {
  content: '✓';
  color: white;
  font-size: 13px;
  font-weight: bold;
}

.page-progress-status {
  color: var(--color-text-muted);
  font-size: 0.9rem;
}

/* Progress Bar */
.progress-summary {
  margin-top: 1.5rem;
  padding: 1rem;
  background: var(--color-bg);
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
}

.progress-bar-container {
  height: 10px;
  background: var(--color-bg-muted);
  border-radius: 5px;
  overflow: hidden;
  margin-bottom: 0.5rem;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--color-accent), var(--color-success));
  border-radius: 5px;
  transition: width 0.4s ease;
}

.progress-text {
  font-size: 0.9rem;
  color: var(--color-text-muted);
  font-weight: 500;
}

/* Completion checkmarks */
.completed-link {
  color: var(--color-success) !important;
}

.completion-checkmark {
  color: var(--color-success);
  font-weight: bold;
}

/* ========================================
   HIERARCHICAL PROGRESS DISPLAY
   ======================================== */
.progress-hierarchy {
  margin-top: 1rem;
}

.progress-toggle-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: none;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 0.5rem 1rem;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--color-text-secondary);
  transition: all 0.15s;
  width: 100%;
  justify-content: center;
}

.progress-toggle-btn:hover {
  border-color: var(--color-accent);
  color: var(--color-accent);
}

.progress-toggle-btn .toggle-icon {
  font-size: 0.75rem;
  transition: transform 0.2s;
}

.progress-hierarchy-details {
  margin-top: 1rem;
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius);
  overflow: hidden;
}

/* Chapter level */
.progress-chapter {
  border-bottom: 1px solid var(--color-border-light);
}

.progress-chapter:last-child {
  border-bottom: none;
}

.progress-chapter-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.875rem 1rem;
  background: var(--color-bg-subtle);
  border: none;
  cursor: pointer;
  text-align: left;
  font-size: 0.95rem;
  transition: background 0.15s;
}

.progress-chapter-header:hover {
  background: var(--color-bg-muted);
}

.progress-chapter-header .toggle-icon {
  font-size: 0.7rem;
  color: var(--color-text-muted);
  flex-shrink: 0;
}

.progress-chapter-header .chapter-name {
  flex: 1;
  font-weight: 600;
  color: var(--color-text);
}

.progress-chapter-header .chapter-progress {
  font-size: 0.85rem;
  color: var(--color-text-secondary);
  font-weight: 500;
}

/* Mini progress bars */
.progress-bar-mini-container {
  height: 4px;
  background: var(--color-bg-muted);
  margin: 0 1rem;
}

.progress-bar-mini {
  height: 100%;
  background: linear-gradient(90deg, var(--color-accent), var(--color-success));
  transition: width 0.3s ease;
}

/* Section level */
.progress-sections {
  background: var(--color-bg);
}

.progress-section {
  border-top: 1px solid var(--color-border-light);
}

.progress-section-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.625rem 1rem 0.625rem 2rem;
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  font-size: 0.9rem;
  transition: background 0.15s;
}

.progress-section-header:hover {
  background: var(--color-bg-subtle);
}

.progress-section-header .toggle-icon {
  font-size: 0.65rem;
  color: var(--color-text-muted);
  flex-shrink: 0;
}

.progress-section-header .section-name {
  flex: 1;
  color: var(--color-text-secondary);
}

.progress-section-header .section-progress {
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

.progress-section .progress-bar-mini-container {
  margin: 0 1rem 0 2rem;
  height: 3px;
}

/* Page level */
.progress-pages {
  padding: 0.5rem 1rem 0.75rem 3rem;
  background: var(--color-bg-subtle);
}

.progress-page {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3rem 0;
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

.progress-page.completed {
  color: var(--color-success);
}

.progress-page .page-status {
  font-size: 0.9rem;
  width: 1rem;
  text-align: center;
}

.progress-page .page-name {
  text-transform: capitalize;
}

.progress-page .page-link {
  color: var(--color-text-muted);
  text-decoration: none;
  transition: color 0.2s ease;
}

.progress-page .page-link:hover {
  color: var(--color-accent);
  text-decoration: underline;
}

.progress-page.completed .page-link {
  color: var(--color-success);
}

.progress-page.completed .page-link:hover {
  color: var(--color-accent);
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .progress-chapter-header {
    padding: 0.75rem;
    font-size: 0.9rem;
  }

  .progress-section-header {
    padding-left: 1.5rem;
    font-size: 0.85rem;
  }

  .progress-pages {
    padding-left: 2rem;
  }

  .progress-section .progress-bar-mini-container {
    margin-left: 1.5rem;
  }
}

/* Footer */
.site-footer {
  margin-top: 4rem;
  padding: 2rem;
  background: var(--color-bg-subtle);
  border-top: 1px solid var(--color-border);
  text-align: center;
}

.footer-content {
  max-width: var(--max-width);
  margin: 0 auto;
}

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

/* Responsive */
@media (max-width: 768px) {
  .nav-container {
    flex-direction: column;
    gap: 1rem;
  }

  .nav-links {
    gap: 1rem;
  }

  .hero h1 {
    font-size: 2rem;
  }

  .main-content {
    padding: 1rem;
  }

  h1 { font-size: 1.75rem; }
  h2 { font-size: 1.5rem; }

  .problem-container {
    max-width: 100%;
    margin: 1.5rem 0;
    border-radius: var(--radius);
  }

  .toggle-buttons {
    gap: 1rem;
    padding: 0.625rem 1rem;
  }

  .thinking-toggle summary,
  .solution-toggle summary {
    font-size: 0.8rem;
  }

  .thinking-content,
  .solution-content {
    padding: 0.75rem 0.875rem;
    font-size: 0.85rem;
  }
}

/* ========================================
   UPDATE BANNER (for cache invalidation)
   ======================================== */
.update-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 0.75rem 1rem;
  background: linear-gradient(135deg, var(--color-accent) 0%, #6366f1 100%);
  color: white;
  font-weight: 500;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
  from {
    transform: translateY(-100%);
  }
  to {
    transform: translateY(0);
  }
}

.update-banner span {
  font-size: 0.95rem;
}

.update-banner button {
  padding: 0.4rem 1rem;
  border: none;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.15s;
}

.update-banner button:first-of-type {
  background: white;
  color: var(--color-accent);
}

.update-banner button:first-of-type:hover {
  background: #f0f0f0;
}

.update-banner button.dismiss {
  background: transparent;
  color: white;
  padding: 0.4rem 0.6rem;
  opacity: 0.8;
}

.update-banner button.dismiss:hover {
  opacity: 1;
}

/* ========================================
   COMING SOON BANNER
   ======================================== */
.coming-soon-banner {
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  border: 1px solid #f59e0b;
  border-left: 4px solid #f59e0b;
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 1rem 1.5rem;
  margin: 1.5rem 0;
  text-align: center;
}

.coming-soon-banner p {
  margin: 0.25rem 0;
  color: #92400e;
}

.coming-soon-banner p:first-child {
  font-size: 1.1rem;
  font-weight: 600;
  color: #78350f;
}

/* Print */
@media print {
  .site-header, .site-footer, .nav-links,
  .problem-checkbox-container, .page-complete-container,
  .toggle-buttons, .update-banner, .coming-soon-banner {
    display: none;
  }

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

/* ========================================
   SKILL TREE CTA (INDEX PAGE)
   ======================================== */
.skill-tree-cta {
  background: linear-gradient(135deg, var(--color-accent-light) 0%, #e0e7ff 100%);
  border: 1px solid var(--color-accent);
  border-radius: var(--radius-lg);
  padding: 1.5rem 2rem;
  margin: 1.5rem 0;
  text-align: center;
}

.skill-tree-cta p {
  margin: 0 0 1rem 0;
  color: var(--color-text-secondary);
  font-size: 1.05rem;
}

.cta-button {
  display: inline-block;
  padding: 0.875rem 2rem;
  background: var(--color-accent);
  color: white;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 1rem;
  text-decoration: none;
  transition: all 0.2s;
  box-shadow: 0 2px 8px rgba(80, 70, 229, 0.3);
}

.cta-button:hover {
  background: #4338ca;
  text-decoration: none;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(80, 70, 229, 0.4);
}

/* ========================================
   INTERACTIVE SKILL TREE PAGE
   ======================================== */
.skill-tree-page {
  max-width: 100%;
  margin: 0;
}

.skill-tree-page .main-content {
  max-width: 100%;
  padding: 1rem 2rem;
}

.skill-tree-header {
  text-align: center;
  margin-bottom: 1.5rem;
}

.skill-tree-header h1 {
  margin-bottom: 0.25rem;
}

.skill-tree-header .subtitle {
  color: var(--color-text-secondary);
  font-size: 1.1rem;
  margin: 0;
}

/* Controls */
.skill-tree-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: var(--color-bg-subtle);
  border-radius: var(--radius-lg);
  margin-bottom: 1rem;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.filter-group label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-text-secondary);
}

.filter-group select {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-bg);
  font-size: 0.9rem;
  cursor: pointer;
}

.filter-group select:hover {
  border-color: var(--color-accent);
}

.view-controls {
  display: flex;
  gap: 0.5rem;
  margin-left: auto;
}

.control-btn {
  padding: 0.5rem 1rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-bg);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}

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

.control-btn.active {
  background: var(--color-accent);
  color: white;
  border-color: var(--color-accent);
}

/* Progress Summary */
.skill-tree-progress {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1.5rem;
  padding: 1rem 1.5rem;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  margin-bottom: 1rem;
}

.progress-stats {
  display: flex;
  gap: 1.5rem;
}

.stat {
  text-align: center;
}

.stat-value {
  display: block;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-accent);
}

.stat-label {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.progress-bar-large {
  flex: 1;
  min-width: 200px;
  height: 12px;
  background: var(--color-bg-muted);
  border-radius: 6px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--color-accent), var(--color-success));
  border-radius: 6px;
  transition: width 0.4s ease;
}

.progress-percentage {
  font-weight: 600;
  color: var(--color-text-secondary);
  min-width: 100px;
  text-align: right;
}

/* Legend */
.skill-tree-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  justify-content: center;
  padding: 0.75rem 1rem;
  background: var(--color-bg-subtle);
  border-radius: var(--radius);
  margin-bottom: 1rem;
  font-size: 0.85rem;
}

.legend-section {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.legend-title {
  font-weight: 600;
  color: var(--color-text-secondary);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--color-text-muted);
}

.legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.legend-dot.completed {
  background: var(--color-success);
}

.legend-dot.available {
  background: var(--color-accent);
}

.legend-dot.locked {
  background: #9ca3af;
}

.legend-shape {
  width: 14px;
  height: 14px;
  border: 2px solid var(--color-text-muted);
}

.legend-shape.beginner {
  border-radius: 50%;
}

.legend-shape.intermediate {
  border-radius: 3px;
}

.legend-shape.advanced {
  clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
  background: var(--color-text-muted);
  border: none;
}

/* Canvas Container */
.skill-tree-container {
  position: relative;
  width: 100%;
  min-height: 600px;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

#skill-tree-canvas {
  display: block;
  cursor: grab;
}

#skill-tree-canvas:active {
  cursor: grabbing;
}

/* Zoom Controls */
.zoom-controls {
  position: absolute;
  bottom: 1rem;
  right: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.zoom-btn {
  width: 36px;
  height: 36px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-bg);
  font-size: 1.25rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

/* Detail Panel */
.skill-detail-panel {
  position: fixed;
  top: 0;
  right: -400px;
  width: 380px;
  max-width: 90vw;
  height: 100vh;
  background: var(--color-bg);
  border-left: 1px solid var(--color-border);
  box-shadow: -4px 0 20px rgba(0, 0, 0, 0.1);
  z-index: 200;
  transition: right 0.3s ease;
  overflow-y: auto;
}

.skill-detail-panel.open {
  right: 0;
}

.close-panel {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 32px;
  height: 32px;
  border: none;
  background: var(--color-bg-muted);
  border-radius: 50%;
  font-size: 1.25rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.close-panel:hover {
  background: var(--color-accent);
  color: white;
}

.panel-content {
  padding: 1.5rem;
}

.panel-header {
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--color-border-light);
}

.panel-header h2 {
  margin: 0 0 0.75rem 0;
  font-size: 1.35rem;
  padding-right: 2rem;
}

.panel-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.badge {
  display: inline-block;
  padding: 0.25rem 0.6rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.course-badge {
  background: #e0f2fe;
  color: #0369a1;
}

.course-badge.math161 { background: #dbeafe; color: #1d4ed8; }
.course-badge.math162 { background: #ede9fe; color: #6d28d9; }
.course-badge.math163 { background: #fce7f3; color: #be185d; }
.course-badge.math241 { background: #ffedd5; color: #c2410c; }

.difficulty-badge {
  background: var(--color-bg-muted);
  color: var(--color-text-secondary);
}

.difficulty-badge.beginner { background: #d1fae5; color: #047857; }
.difficulty-badge.intermediate { background: #fef3c7; color: #b45309; }
.difficulty-badge.advanced { background: #fee2e2; color: #b91c1c; }

.time-badge {
  background: var(--color-bg-subtle);
  color: var(--color-text-muted);
}

/* Panel Meta */
.panel-meta {
  display: grid;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.meta-item {
  display: flex;
  gap: 0.5rem;
}

.meta-label {
  font-weight: 600;
  color: var(--color-text-secondary);
  font-size: 0.85rem;
  min-width: 110px;
}

.meta-value {
  color: var(--color-text);
  font-size: 0.9rem;
}

/* Panel Sections */
.panel-section {
  margin-bottom: 1.5rem;
}

.panel-section h3 {
  font-size: 1rem;
  margin: 0 0 0.75rem 0;
  color: var(--color-text-secondary);
}

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

.prereq-list li,
.unlock-list li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  margin-bottom: 0.5rem;
  background: var(--color-bg-subtle);
  border-radius: var(--radius);
  font-size: 0.9rem;
  transition: all 0.15s;
}

.prereq-list li:hover,
.unlock-list li:hover {
  background: var(--color-bg-muted);
}

.prereq-item.completed {
  background: var(--color-success-light);
}

.prereq-item.available {
  background: var(--color-accent-light);
}

.prereq-item.locked {
  background: var(--color-bg-muted);
  opacity: 0.7;
}

.prereq-status {
  font-size: 1rem;
  width: 1.5rem;
  text-align: center;
}

.prereq-name,
.unlock-name {
  flex: 1;
}

.prereq-type {
  font-size: 0.7rem;
  padding: 0.15rem 0.4rem;
  border-radius: 3px;
  text-transform: uppercase;
  font-weight: 600;
}

.prereq-type.strong {
  background: #fee2e2;
  color: #b91c1c;
}

.prereq-type.helpful {
  background: #e0f2fe;
  color: #0369a1;
}

.no-items {
  color: var(--color-text-muted);
  font-style: italic;
}

/* Panel Actions */
.panel-actions {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--color-border-light);
}

.skill-complete-toggle {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
}

.skill-complete-toggle input {
  display: none;
}

.toggle-slider {
  position: relative;
  width: 48px;
  height: 26px;
  background: var(--color-bg-muted);
  border-radius: 13px;
  transition: all 0.2s;
}

.toggle-slider::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  background: white;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  transition: all 0.2s;
}

.skill-complete-toggle input:checked + .toggle-slider {
  background: var(--color-success);
}

.skill-complete-toggle input:checked + .toggle-slider::after {
  transform: translateX(22px);
}

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

.panel-link-btn {
  display: block;
  text-align: center;
  padding: 0.75rem 1rem;
  background: var(--color-accent);
  color: white;
  border-radius: var(--radius);
  font-weight: 600;
  text-decoration: none;
  transition: all 0.15s;
}

.panel-link-btn:hover {
  background: #4338ca;
  text-decoration: none;
}

/* Responsive */
@media (max-width: 768px) {
  .skill-tree-controls {
    flex-direction: column;
    align-items: stretch;
  }

  .filter-group {
    justify-content: space-between;
  }

  .view-controls {
    margin-left: 0;
    justify-content: center;
  }

  .skill-tree-progress {
    flex-direction: column;
    text-align: center;
  }

  .progress-stats {
    justify-content: center;
  }

  .progress-percentage {
    text-align: center;
  }

  .skill-tree-legend {
    flex-direction: column;
    align-items: flex-start;
  }

  .skill-detail-panel {
    width: 100%;
    max-width: 100%;
  }
}

@media print {
  .skill-tree-page {
    display: none;
  }
}
