:root {
  --bg: #0d0f16;
  --panel: rgba(255, 255, 255, 0.06);
  --panel-border: rgba(255, 255, 255, 0.12);
  --text: #e8ecff;
  --muted: #9aa3c4;
  --accent: #7cf6f0;
  color-scheme: dark;
}

[data-theme="light"] {
  --panel: rgba(255, 255, 255, 0.78);
  --panel-border: rgba(0, 0, 0, 0.1);
  --text: #1a1d2e;
  --muted: #5a6380;
  --accent: #0891b2;
  color-scheme: light;
}

[data-theme="light"] body {
  background: radial-gradient(circle at 20% 20%, #dde8f5, #f0f4f8 40%),
    radial-gradient(circle at 80% 10%, #e8e0f5, transparent 40%),
    radial-gradient(circle at 50% 80%, #d8eef0, transparent 45%), #f0f4f8;
}

[data-theme="light"] .rich code {
  background: rgba(0, 0, 0, 0.08);
}

/* ─── Top Progress Bar ───────────────────────── */
.top-progress-bar {
  position: fixed;
  top: 0;
  right: 0;
  left: 0;
  height: 4px;
  background: rgba(255, 255, 255, 0.08);
  z-index: 100;
}

.top-progress-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #7cf6f0, #64c6ff);
  transition: width 0.4s ease;
}

[data-theme="light"] .top-progress-bar {
  background: rgba(0, 0, 0, 0.07);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: 'Space Grotesk', 'Segoe UI', sans-serif;
  background: radial-gradient(circle at 20% 20%, #182235, #0d0f16 40%), radial-gradient(circle at 80% 10%, #1c1232, transparent 40%), radial-gradient(circle at 50% 80%, #113034, transparent 45%), #0d0f16;
  color: var(--text);
}

.layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  min-height: 100vh;
}

.sidebar {
  border-left: 1px solid var(--panel-border);
  background: var(--panel);
  padding: 16px;
  display: grid;
  gap: 12px;
  align-content: start;
}

.top-links { display: flex; gap: 8px; flex-wrap: wrap; }
.top-links a {
  color: var(--text);
  text-decoration: none;
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 7px 10px;
  background: rgba(255,255,255,0.06);
}

h1,h2,h3 { margin: 0; }
h1 { font-size: 28px; }

.muted { color: var(--muted); margin: 0; }

.progress-text { font-weight: 700; }
.progress-track { height: 10px; background: rgba(255,255,255,0.09); border-radius: 999px; overflow: hidden; }
.progress-fill { height: 100%; width: 0; background: linear-gradient(90deg,#7cf6f0,#64c6ff); }

.module-list { display: grid; gap: 10px; max-height: calc(100vh - 220px); overflow: auto; padding-left: 4px; }
.module { border: 1px solid var(--panel-border); border-radius: 12px; padding: 10px; background: rgba(255,255,255,0.03); }
.module-title { font-weight: 700; margin-bottom: 8px; }
.lesson-btn {
  width: 100%;
  text-align: right;
  margin-top: 6px;
  border: 1px solid var(--panel-border);
  background: rgba(255,255,255,0.08);
  color: var(--text);
  border-radius: 10px;
  padding: 8px 10px;
  cursor: pointer;
}
.lesson-btn.active { border-color: rgba(124,246,240,0.8); background: rgba(124,246,240,0.18); color: var(--accent); }
.lesson-btn.done::after { content: ' ✓'; color: #9effd8; }

.content { padding: 20px; display: grid; gap: 12px; align-content: start; }
.lesson-head {
  border: 1px solid var(--panel-border);
  background: var(--panel);
  border-radius: 16px;
  padding: 14px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}
.badge { color: var(--muted); font-size: 13px; margin-bottom: 4px; }
.lesson-actions { display: flex; gap: 8px; flex-wrap: wrap; }
button {
  border: none;
  border-radius: 12px;
  padding: 10px 14px;
  font-weight: 600;
  color: #081019;
  background: linear-gradient(135deg, #7cf6f0, #64c6ff);
  cursor: pointer;
}
button.ghost {
  color: var(--text);
  background: rgba(255,255,255,0.08);
  border: 1px solid var(--panel-border);
}

.card {
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  padding: 14px;
  background: var(--panel);
}

.rich p { margin: 0 0 10px; line-height: 1.7; }
.rich code { background: rgba(255,255,255,0.12); padding: 2px 6px; border-radius: 8px; }
.two-col { display: grid; gap: 16px; grid-template-columns: 1fr 1fr; }

ul { margin: 10px 0 0; padding-right: 18px; display: grid; gap: 8px; }

.resource-list {
  list-style: none;
  padding-right: 0;
}

.resource-list li {
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.04);
}

.resource-list a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

.resource-list a:hover {
  text-decoration: underline;
}

.resource-note {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

/* ─── Inline Code ───────────────────────── */
.inline-code {
  background: rgba(124, 246, 240, 0.15);
  padding: 1px 5px;
  border-radius: 5px;
  font-size: 13px;
  font-family: 'Fira Mono', 'Consolas', monospace;
}

[data-theme="light"] .inline-code {
  background: rgba(8, 145, 178, 0.12);
}

/* ─── Quiz Mode ───────────────────────── */
.quiz-card {
  background: rgba(124, 246, 240, 0.04);
  border-color: rgba(124, 246, 240, 0.2);
}

.quiz-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.quiz-question {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.5;
  padding: 8px 0;
  min-height: 48px;
}

.quiz-actions {
  display: flex;
  gap: 10px;
}

.quiz-score {
  font-size: 18px;
  font-weight: 700;
  text-align: center;
  padding: 8px 0;
  color: var(--accent);
}

@media (max-width: 980px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { border-left: none; border-bottom: 1px solid var(--panel-border); }
  .module-list { max-height: 340px; }
  .two-col { grid-template-columns: 1fr; }
}
