:root {
  --bg: #f4f7fb;
  --panel: #f9fbff;
  --panel-2: #ffffff;
  --text: #182033;
  --muted: #667085;
  --soft: #dbe7f7;
  --line: #d6e0ef;
  --accent: #2f7df6;
  --accent-2: #1d5fd1;
  --accent-soft: #e7f0ff;
  --green: #2563eb;
  --shadow: 0 22px 80px rgba(31, 86, 174, .12);
  --radius: 24px;
  --mono: "SFMono-Regular", "Cascadia Code", "Consolas", monospace;
  --sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei UI", "Noto Sans CJK SC", sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--sans);
  color: var(--text);
  background:
    radial-gradient(circle at 20% 0%, rgba(47, 125, 246, .12), transparent 34%),
    radial-gradient(circle at 85% 12%, rgba(96, 116, 91, .12), transparent 30%),
    var(--bg);
  min-height: 100vh;
  letter-spacing: .01em;
}

button, textarea {
  font-family: inherit;
}

button {
  cursor: pointer;
}

.grain {
  pointer-events: none;
  position: fixed;
  inset: 0;
  opacity: .35;
  mix-blend-mode: multiply;
  background-image:
    linear-gradient(rgba(34,31,26,.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(34,31,26,.025) 1px, transparent 1px);
  background-size: 28px 28px;
  z-index: 0;
}

.sidebar {
  position: fixed;
  z-index: 10;
  top: 20px;
  left: max(20px, calc((100vw - 1240px) / 2));
  bottom: 20px;
  width: 286px;
  padding: 18px;
  border: 1px solid rgba(216, 205, 189, .85);
  background: rgba(251, 248, 240, .78);
  backdrop-filter: blur(22px);
  border-radius: 28px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 4px 12px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  color: #f8fbff;
  font-weight: 800;
  background: linear-gradient(135deg, #4a90ff, #1d5fd1);
  box-shadow: 0 12px 30px rgba(29, 95, 209, .25);
}

.brand strong {
  display: block;
  font-size: 17px;
}

.brand span {
  color: var(--muted);
  font-size: 12px;
}

.module-nav {
  display: grid;
  gap: 8px;
}

.nav-item {
  width: 100%;
  border: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  padding: 12px;
  border-radius: 18px;
  color: var(--muted);
  background: transparent;
  transition: .18s ease;
}

.nav-item:hover {
  background: rgba(47, 125, 246, .08);
  color: var(--text);
}

.nav-item.active {
  background: var(--text);
  color: #f8fbff;
  box-shadow: 0 10px 28px rgba(34, 31, 26, .18);
}

.nav-index {
  min-width: 28px;
  height: 28px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: rgba(47, 125, 246, .13);
  color: var(--accent-2);
  font-weight: 700;
  font-size: 12px;
}

.nav-item.active .nav-index {
  background: rgba(255,255,255,.16);
  color: #f8fbff;
}

.nav-text strong {
  display: block;
  font-size: 14px;
  margin-bottom: 2px;
}

.nav-text span {
  font-size: 12px;
  opacity: .78;
}

.sidebar-card {
  margin-top: auto;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(255,253,248,.66);
}

.tiny-label {
  text-transform: uppercase;
  color: var(--accent-2);
  font-weight: 800;
  letter-spacing: .12em;
  font-size: 11px;
}

.progress-ring {
  position: relative;
  width: 132px;
  margin: 12px auto;
}

.progress-ring svg {
  display: block;
  width: 132px;
  height: 132px;
  transform: rotate(-90deg);
}

.progress-ring circle {
  fill: transparent;
  stroke-width: 10;
}

.ring-bg { stroke: #d9e7fb; }
.ring-value {
  stroke: var(--accent);
  stroke-linecap: round;
  stroke-dasharray: 301.59;
  stroke-dashoffset: 301.59;
  transition: .35s ease;
}

.ring-text {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  align-content: center;
}

.ring-text strong {
  font-size: 24px;
}

.ring-text span {
  color: var(--muted);
  font-size: 12px;
}

.shell {
  position: relative;
  z-index: 1;
  width: min(914px, calc(100vw - 346px));
  margin-left: calc(max(20px, (100vw - 1240px) / 2) + 326px);
  padding: 20px 0 60px;
}

.topbar {
  position: sticky;
  top: 14px;
  z-index: 8;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 58px;
  padding: 0 14px 0 20px;
  border: 1px solid rgba(216, 205, 189, .86);
  border-radius: 999px;
  background: rgba(251, 248, 240, .72);
  backdrop-filter: blur(22px);
  box-shadow: 0 14px 44px rgba(31, 86, 174, .08);
}

.breadcrumb {
  color: var(--muted);
  font-size: 14px;
}

.breadcrumb span {
  color: var(--text);
  font-weight: 650;
}

.top-actions {
  display: flex;
  gap: 8px;
}

.pill-btn,
.ghost-btn,
.big-btn {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255,253,248,.72);
  color: var(--text);
  padding: 10px 14px;
  transition: .18s ease;
}

.pill-btn:hover,
.ghost-btn:hover,
.big-btn.secondary:hover {
  transform: translateY(-1px);
  border-color: rgba(183,105,54,.5);
  background: #fffdf8;
}

.pill-btn.primary,
.big-btn {
  border-color: transparent;
  color: #f8fbff;
  background: var(--text);
  box-shadow: 0 14px 32px rgba(34,31,26,.16);
}

.pill-btn.primary:hover,
.big-btn:hover {
  transform: translateY(-1px);
  background: #111827;
}

.big-btn {
  padding: 13px 18px;
  font-weight: 750;
}

.big-btn.secondary {
  color: var(--text);
  background: rgba(255,253,248,.68);
  box-shadow: none;
  border-color: var(--line);
}

.full { width: 100%; }

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, .8fr);
  gap: 20px;
  margin-top: 20px;
}

.hero-copy,
.hero-panel,
.learning-map,
.lesson-card,
.rail-card,
.concept-desk,
.prompt-lab,
.quiz-panel,
.footer {
  border: 1px solid rgba(216, 205, 189, .88);
  background: rgba(251, 248, 240, .72);
  backdrop-filter: blur(18px);
  border-radius: 30px;
  box-shadow: var(--shadow);
}

.hero-copy {
  padding: clamp(28px, 5vw, 58px);
  min-height: 430px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  gap: 8px;
  font-size: 13px;
  font-weight: 800;
  color: var(--accent-2);
  background: var(--accent-soft);
  border-radius: 999px;
  padding: 8px 12px;
}

.hero h1 {
  max-width: 740px;
  font-size: clamp(38px, 6vw, 68px);
  line-height: .98;
  letter-spacing: -.055em;
  margin: 18px 0 18px;
}

.hero p {
  max-width: 720px;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.85;
}

.hero-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 22px;
}

.hero-panel {
  padding: 22px;
  display: grid;
  gap: 14px;
  align-content: center;
  background:
    radial-gradient(circle at 90% 8%, rgba(47, 125, 246, .12), transparent 42%),
    rgba(251, 248, 240, .72);
}

.chat-card {
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 18px;
  background: rgba(255,253,248,.76);
}

.chat-card.user {
  margin-left: 26px;
  background: #e9f2ff;
}

.chat-card.ai {
  margin-right: 26px;
}

.chat-card span {
  display: block;
  color: var(--accent-2);
  font-size: 12px;
  font-weight: 850;
  margin-bottom: 8px;
}

.chat-card p {
  margin: 0;
  color: var(--text);
  line-height: 1.75;
}

.learning-map,
.concept-desk,
.prompt-lab,
.quiz-panel {
  margin-top: 20px;
  padding: 24px;
}

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.section-head h2 {
  margin: 8px 0 0;
  font-size: 28px;
  letter-spacing: -.03em;
}

.section-head p {
  max-width: 520px;
  color: var(--muted);
  line-height: 1.75;
  margin: 0;
}

.map-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.map-card {
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 18px;
  background: rgba(255,253,248,.72);
  transition: .18s ease;
}

.map-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 52px rgba(31, 86, 174, .10);
}

.map-card.done {
  border-color: rgba(96,116,91,.35);
  background: rgba(96,116,91,.09);
}

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

.map-num {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: var(--text);
  color: #f8fbff;
  font-weight: 800;
}

.map-status {
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
}

.map-card h3 {
  margin: 0 0 10px;
  font-size: 18px;
}

.map-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
  font-size: 14px;
}

.content-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 312px;
  gap: 20px;
  margin-top: 20px;
  align-items: start;
}

.lesson-card {
  padding: 30px;
}

.lesson-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.badge {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 10px;
  color: var(--muted);
  background: rgba(255,253,248,.72);
  font-size: 12px;
  font-weight: 750;
}

.lesson-card h2 {
  font-size: clamp(30px, 4vw, 46px);
  line-height: 1.05;
  letter-spacing: -.045em;
  margin: 0 0 14px;
}

.lesson-intro {
  color: var(--muted);
  line-height: 1.9;
  font-size: 17px;
  margin-bottom: 22px;
}

.lesson-section {
  border-top: 1px solid var(--line);
  padding-top: 22px;
  margin-top: 22px;
}

.lesson-section h3 {
  font-size: 22px;
  letter-spacing: -.02em;
  margin: 0 0 10px;
}

.lesson-section p,
.lesson-section li {
  color: var(--muted);
  line-height: 1.85;
}

.lesson-section ul {
  padding-left: 20px;
}

.compare-grid,
.timeline,
.example-grid {
  display: grid;
  gap: 12px;
}

.compare-grid,
.example-grid {
  grid-template-columns: repeat(2, 1fr);
}

.mini-card,
.timeline-item,
.callout {
  border: 1px solid var(--line);
  background: rgba(255,253,248,.72);
  border-radius: 22px;
  padding: 16px;
}

.mini-card strong,
.timeline-item strong {
  display: block;
  margin-bottom: 8px;
}

.mini-card p,
.timeline-item p,
.callout p {
  margin: 0;
}

.timeline {
  position: relative;
}

.timeline-item {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 14px;
}

.timeline-item time {
  font-weight: 850;
  color: var(--accent-2);
}

.callout {
  margin-top: 14px;
  border-color: rgba(183,105,54,.28);
  background: rgba(240,222,208,.45);
}

.done-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid var(--line);
  margin-top: 28px;
  padding-top: 20px;
}

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

.complete-btn {
  border: 0;
  border-radius: 999px;
  padding: 12px 16px;
  color: #f8fbff;
  background: var(--accent-2);
  font-weight: 800;
  box-shadow: 0 14px 28px rgba(143,79,46,.16);
}

.complete-btn.done {
  background: var(--green);
}

.right-rail {
  display: grid;
  gap: 14px;
  position: sticky;
  top: 92px;
}

.rail-card {
  padding: 18px;
  border-radius: 24px;
  box-shadow: none;
}

.rail-card ul {
  margin: 12px 0 0;
  padding-left: 18px;
}

.rail-card li {
  color: var(--muted);
  line-height: 1.65;
  font-size: 14px;
  margin-bottom: 8px;
}

.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.tag-cloud span {
  border-radius: 999px;
  padding: 7px 10px;
  background: rgba(183,105,54,.10);
  color: var(--accent-2);
  font-size: 12px;
  font-weight: 750;
}

.rail-card.quote p {
  margin: 0;
  color: var(--text);
  line-height: 1.8;
  font-weight: 650;
}

.concept-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

.concept-card {
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 18px;
  background: rgba(255,253,248,.72);
}

.concept-card h3 {
  margin: 0 0 8px;
  letter-spacing: -.02em;
}

.concept-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.75;
  font-size: 14px;
}

.lab-grid {
  display: grid;
  grid-template-columns: .95fr 1.05fr;
  gap: 16px;
}

.lab-form {
  display: grid;
  gap: 12px;
}

.lab-form label {
  display: grid;
  gap: 8px;
}

.lab-form span {
  font-size: 13px;
  color: var(--text);
  font-weight: 800;
}

textarea {
  width: 100%;
  min-height: 80px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 13px 14px;
  outline: none;
  color: var(--text);
  background: rgba(255,253,248,.78);
  line-height: 1.65;
}

textarea:focus {
  border-color: rgba(183,105,54,.68);
  box-shadow: 0 0 0 4px rgba(183,105,54,.10);
}

.output-card,
.quiz-box {
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(255,253,248,.72);
  padding: 16px;
}

.output-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.output-head span {
  font-weight: 850;
}

pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: var(--mono);
  color: #1e293b;
  line-height: 1.75;
  font-size: 13px;
}

.quiz-question {
  border-bottom: 1px solid var(--line);
  padding: 14px 0;
}

.quiz-question:first-child {
  padding-top: 0;
}

.quiz-question:last-child {
  border-bottom: 0;
}

.quiz-question h3 {
  font-size: 16px;
  margin: 0 0 12px;
}

.quiz-options {
  display: grid;
  gap: 8px;
}

.quiz-option {
  border: 1px solid var(--line);
  background: rgba(251,248,240,.7);
  border-radius: 16px;
  padding: 10px 12px;
  text-align: left;
  color: var(--muted);
}

.quiz-option.correct {
  border-color: rgba(96,116,91,.35);
  background: rgba(96,116,91,.10);
  color: var(--green);
  font-weight: 800;
}

.quiz-option.wrong {
  border-color: rgba(183,105,54,.35);
  background: rgba(183,105,54,.10);
  color: var(--accent-2);
  font-weight: 800;
}

.quiz-result {
  margin-top: 14px;
  border-radius: 18px;
  background: var(--text);
  color: #f8fbff;
  padding: 14px 16px;
  font-weight: 800;
}

.footer {
  margin-top: 20px;
  padding: 20px 24px;
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  box-shadow: none;
}

@media (max-width: 1120px) {
  .sidebar {
    position: static;
    width: auto;
    margin: 14px;
  }

  .shell {
    width: auto;
    margin: 0;
    padding: 0 14px 40px;
  }

  .module-nav {
    grid-template-columns: repeat(2, 1fr);
  }

  .hero,
  .content-layout,
  .lab-grid {
    grid-template-columns: 1fr;
  }

  .right-rail {
    position: static;
    grid-template-columns: repeat(3, 1fr);
  }

  .map-grid,
  .concept-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 720px) {
  .module-nav,
  .right-rail,
  .map-grid,
  .concept-grid,
  .compare-grid,
  .example-grid {
    grid-template-columns: 1fr;
  }

  .topbar {
    height: auto;
    border-radius: 24px;
    padding: 14px;
    align-items: flex-start;
    gap: 12px;
    flex-direction: column;
  }

  .section-head,
  .done-row,
  .footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .hero-copy {
    min-height: auto;
  }

  .hero h1 {
    font-size: 42px;
  }

  .lesson-card,
  .learning-map,
  .concept-desk,
  .prompt-lab,
  .quiz-panel {
    padding: 20px;
  }

  .timeline-item {
    grid-template-columns: 1fr;
  }
}
