:root {
  --green: #7C9473;
  --green-deep: #5a6e56;
  --brown: #A86F4D;
  --sand: #B5A273;
  --apricot: #E3C9A7;
  --sage: #6E8E82;
  --text: #4A4A43;
  --text-light: #7A7A70;
  --bg: #F5F2E9;
  --paper: #FFFDF8;
  --paper-ink: #3a3818;
  --shadow-sm: 0 2px 8px rgba(74, 74, 67, 0.06);
  --shadow-md: 0 4px 16px rgba(74, 74, 67, 0.08);
  --shadow-card: 0 2px 12px rgba(74, 74, 67, 0.07), 0 0 0 1px rgba(74, 74, 67, 0.04);
  --radius: 16px;
  --radius-sm: 10px;
  --font: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  scroll-padding-top: 5rem;
}

body {
  font-family: var(--font);
  color: var(--text);
  background: linear-gradient(180deg, #f9f4e5 0%, var(--bg) 8%, var(--bg) 100%);
  line-height: 1.75;
  min-height: 100vh;
  position: relative;
}

/* ─── Header ─── */
.page-header {
  text-align: center;
  padding: 2.5rem 1.5rem 1.5rem;
  background: radial-gradient(ellipse 60% 40% at 50% 70%, rgba(110, 142, 130, 0.06) 0%, transparent 70%);
  border-bottom: 1px solid rgba(74, 74, 67, 0.06);
}

.back-link {
  display: inline-block;
  font-size: 0.85rem;
  color: var(--sage);
  margin-bottom: 1.25rem;
  transition: color var(--transition);
}

.back-link:hover { color: var(--green); }

.page-header h1 {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.02em;
}

.subtitle {
  font-size: 0.85rem;
  color: var(--text-light);
  margin-top: 0.25rem;
  letter-spacing: 0.04em;
}

/* ─── TOC ─── */
.toc {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.35rem;
  padding: 0.75rem 0.5rem;
  background: rgba(245, 242, 233, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(74, 74, 67, 0.06);
  transition: background var(--transition);
}

.toc-label {
  font-size: 0.72rem;
  color: var(--text-light);
  margin-right: 0.4rem;
  font-weight: 500;
}

.toc a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-light);
  transition: all var(--transition);
  border: 1px solid transparent;
}

.toc a:hover {
  color: var(--green);
  border-color: rgba(124, 148, 115, 0.3);
  background: rgba(124, 148, 115, 0.06);
}

.toc a.active {
  color: var(--white);
  background: var(--sage);
  border-color: var(--sage);
}

/* ─── Progress ─── */
.course-progress {
  position: sticky;
  top: 3.5rem;
  z-index: 99;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 1.5rem;
  background: rgba(245, 242, 233, 0.85);
  backdrop-filter: blur(4px);
  max-width: 720px;
  margin: 0 auto;
}

.progress-bar {
  flex: 1;
  height: 4px;
  background: rgba(74, 74, 67, 0.1);
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--sage), var(--green));
  border-radius: 999px;
  transition: width 0.3s;
}

.progress-text {
  font-size: 0.7rem;
  color: var(--text-light);
  font-weight: 500;
  white-space: nowrap;
}

/* ─── Course ─── */
.course {
  max-width: 720px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

/* ─── Module ─── */
.module {
  padding: 2.5rem 0 3rem;
  border-bottom: 1px dashed rgba(74, 74, 67, 0.1);
}

.module:last-of-type { border-bottom: none; }

.module-num {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--sage);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  background: rgba(110, 142, 130, 0.1);
  padding: 0.2em 0.75em;
  border-radius: 999px;
  margin-bottom: 0.5rem;
}

.module h2 {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.01em;
  margin-bottom: 0.25rem;
}

.module-hook {
  font-size: 1rem;
  color: var(--text-light);
  font-style: italic;
  margin-bottom: 1.5rem;
  padding-left: 0.5rem;
  border-left: 3px solid var(--apricot);
}

.module-body p {
  margin-bottom: 1rem;
  font-size: 0.95rem;
  line-height: 1.85;
}

.module-body p strong {
  color: var(--text);
}

.module-body a {
  color: var(--sage);
  text-decoration: underline;
}

/* ─── Insight Box ─── */
.insight-box {
  background: rgba(110, 142, 130, 0.06);
  border-left: 4px solid var(--sage);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 1.25rem 1.25rem;
  margin: 1.5rem 0;
}

.insight-box strong {
  display: block;
  font-size: 0.8rem;
  color: var(--sage);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
}

.insight-box p {
  font-size: 0.88rem;
  color: var(--text);
  margin-bottom: 0.5rem;
}

.insight-box p:last-child { margin-bottom: 0; }

/* ─── Closing ─── */
.closing {
  margin-top: 1.5rem;
  padding: 1rem 1.25rem;
  background: rgba(227, 201, 167, 0.15);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  color: var(--text);
  line-height: 1.7;
}

/* ─── Exercise ─── */
.exercise {
  margin: 1.75rem 0;
  padding: 1.5rem;
  background: var(--paper);
  border: 1px solid rgba(74, 74, 67, 0.08);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
}

.exercise h4 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--brown);
  margin-bottom: 0.75rem;
}

.exercise > p {
  font-size: 0.88rem;
  color: var(--text-light);
  margin-bottom: 1rem;
}

/* ─── Scene Cards ─── */
.scene-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.scene-card {
  text-align: center;
  padding: 1rem 0.5rem;
  background: rgba(245, 242, 233, 0.6);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(74, 74, 67, 0.04);
}

.scene-img {
  font-size: 2rem;
  margin-bottom: 0.25rem;
}

.scene-card p:first-of-type {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.25rem;
}

.scene-hint {
  font-size: 0.78rem !important;
  color: var(--text-light) !important;
  line-height: 1.5 !important;
}

/* ─── Timeline ─── */
.timeline-demo {
  margin: 1.5rem 0;
}

.timeline-prompt {
  font-size: 0.88rem;
  color: var(--text-light);
  margin-bottom: 0.75rem;
}

.timeline-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.timeline-tab {
  padding: 0.4rem 0.9rem;
  border: 1px solid rgba(74, 74, 67, 0.15);
  border-radius: 999px;
  background: var(--white);
  font-size: 0.82rem;
  color: var(--text-light);
  cursor: pointer;
  font-family: var(--font);
  transition: all var(--transition);
}

.timeline-tab:hover {
  border-color: var(--sage);
  color: var(--sage);
}

.timeline-tab.active {
  background: var(--sage);
  color: var(--white);
  border-color: var(--sage);
}

.timeline-chain {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  padding: 1rem;
  background: rgba(245, 242, 233, 0.6);
  border-radius: var(--radius-sm);
}

.timeline-node {
  font-size: 0.78rem;
  color: var(--text);
  padding: 0.35rem 0.6rem;
  background: var(--white);
  border-radius: 6px;
  border: 1px solid rgba(74, 74, 67, 0.08);
}

.timeline-arrow {
  font-size: 0.8rem;
  color: var(--text-light);
  font-weight: bold;
}

/* ─── Formula Cards ─── */
.formula-cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
  margin: 1.25rem 0;
}

.formula-card {
  padding: 1.25rem;
  background: rgba(245, 242, 233, 0.6);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(74, 74, 67, 0.06);
}

.formula-icon { font-size: 1.5rem; margin-bottom: 0.5rem; }

.formula-card h4 {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.3rem;
}

.formula-card p {
  font-size: 0.8rem;
  color: var(--text-light);
  line-height: 1.55;
  margin: 0;
}

/* ─── Sliders ─── */
.slider-group {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin: 1rem 0;
}

.slider-group label {
  font-size: 0.88rem;
  color: var(--text);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.slider-val {
  font-weight: 600;
  color: var(--sage);
  font-size: 0.9rem;
  min-width: 1.5rem;
  text-align: right;
}

.slider {
  -webkit-appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: rgba(74, 74, 67, 0.12);
  outline: none;
}

.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--sage);
  cursor: pointer;
  border: 2px solid var(--white);
  box-shadow: 0 1px 4px rgba(0,0,0,0.15);
}

.radar-feedback {
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  background: rgba(227, 201, 167, 0.15);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  color: var(--text);
  line-height: 1.6;
}

/* ─── Overlay Demo ─── */
.overlay-demo {
  margin: 1rem 0;
}

.overlay-container {
  position: relative;
  height: 8rem;
  background: linear-gradient(135deg, rgba(181, 162, 115, 0.1), rgba(227, 201, 167, 0.1));
  border-radius: var(--radius-sm);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.overlay-base {
  position: absolute;
  font-size: 3rem;
  z-index: 1;
}

.overlay-art {
  position: absolute;
  font-size: 2.5rem;
  z-index: 2;
  background: rgba(255, 253, 248, 0.85);
  padding: 0.5rem;
  border-radius: var(--radius-sm);
  text-align: center;
  transition: opacity 0.1s;
}

.overlay-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.overlay-controls span {
  font-size: 0.78rem;
  color: var(--text-light);
  white-space: nowrap;
}

.overlay-note {
  font-size: 0.82rem;
  color: var(--text-light);
  margin-top: 0.5rem;
  font-style: italic;
}

/* ─── Combinator ─── */
.combinator {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 1rem 0;
  flex-wrap: wrap;
}

.combo-slots {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.combo-slot {
  display: inline-flex;
  align-items: center;
  padding: 0.5rem 1rem;
  background: var(--white);
  border: 2px dashed rgba(74, 74, 67, 0.2);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text);
  min-width: 5rem;
  justify-content: center;
}

.combo-plus {
  font-size: 1.2rem;
  color: var(--brown);
  font-weight: 700;
}

.combo-btn {
  padding: 0.5rem 1rem;
  border: 1px solid rgba(168, 111, 77, 0.3);
  border-radius: 999px;
  background: var(--white);
  color: var(--brown);
  font-size: 0.82rem;
  cursor: pointer;
  font-family: var(--font);
  transition: all var(--transition);
}

.combo-btn:hover {
  background: rgba(168, 111, 77, 0.08);
  border-color: var(--brown);
}

.combo-question {
  font-size: 1rem;
  color: var(--brown);
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.combo-input {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid rgba(74, 74, 67, 0.15);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 0.88rem;
  color: var(--text);
  background: var(--white);
  resize: vertical;
  transition: border-color var(--transition);
}

.combo-input:focus {
  outline: none;
  border-color: var(--sage);
}

.combo-examples {
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  background: rgba(245, 242, 233, 0.6);
  border-radius: var(--radius-sm);
}

.combo-examples p {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-light);
  margin-bottom: 0.5rem;
}

.combo-examples ul {
  list-style: none;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.combo-examples li {
  font-size: 0.78rem;
  color: var(--text-light);
  white-space: nowrap;
}

/* ─── Timer ─── */
.timer {
  text-align: center;
  margin: 1rem 0;
  padding: 1.5rem;
  background: rgba(110, 142, 130, 0.06);
  border-radius: var(--radius-sm);
}

.timer-display {
  font-size: 3rem;
  font-weight: 700;
  color: var(--sage);
  font-variant-numeric: tabular-nums;
  margin-bottom: 0.75rem;
  letter-spacing: 0.05em;
}

.timer-btn {
  padding: 0.6rem 1.5rem;
  border: none;
  border-radius: 999px;
  background: var(--sage);
  color: var(--white);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  font-family: var(--font);
  transition: all var(--transition);
}

.timer-btn:hover { background: var(--green); }
.timer-btn:disabled { opacity: 0.5; cursor: default; }
.timer-btn.running { background: var(--brown); }

/* ─── Steps ─── */
.steps {
  margin: 0.75rem 0 1.25rem 1.25rem;
  font-size: 0.88rem;
  color: var(--text);
  line-height: 2;
}

/* ─── AI Chat ─── */
.ai-chat {
  border: 1px solid rgba(74, 74, 67, 0.12);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--white);
}

.chat-messages {
  max-height: 300px;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.chat-msg {
  max-width: 85%;
  padding: 0.6rem 0.9rem;
  border-radius: 12px;
  font-size: 0.85rem;
  line-height: 1.6;
  animation: fadeIn 0.3s;
}

.chat-msg p { margin-bottom: 0.25rem; }
.chat-msg p:last-child { margin-bottom: 0; }

.chat-ai {
  align-self: flex-start;
  background: rgba(245, 242, 233, 0.8);
  color: var(--text);
  border-bottom-left-radius: 4px;
}

.chat-user {
  align-self: flex-end;
  background: rgba(124, 148, 115, 0.12);
  color: var(--text);
  border-bottom-right-radius: 4px;
}

.chat-input-row {
  display: flex;
  border-top: 1px solid rgba(74, 74, 67, 0.08);
}

.chat-input {
  flex: 1;
  padding: 0.75rem 1rem;
  border: none;
  font-family: var(--font);
  font-size: 0.88rem;
  color: var(--text);
  background: transparent;
  outline: none;
}

.chat-send {
  padding: 0.75rem 1.25rem;
  border: none;
  background: var(--sage);
  color: var(--white);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  font-family: var(--font);
  transition: background var(--transition);
}

.chat-send:hover { background: var(--green); }

.chat-note {
  font-size: 0.72rem;
  color: var(--text-light);
  padding: 0.5rem 1rem;
  text-align: center;
  border-top: 1px solid rgba(74, 74, 67, 0.05);
}

/* ─── Exercise Prompt ─── */
.exercise-prompt {
  margin-top: 1rem !important;
  font-size: 0.9rem !important;
  color: var(--text) !important;
}

/* ─── Submit Button ─── */
.submit-btn {
  display: block;
  width: 100%;
  margin-top: 0.75rem;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--sage), var(--green));
  color: var(--white);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font);
  transition: all var(--transition);
}

.submit-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(110, 142, 130, 0.3);
}

/* ─── Showcase ─── */
.showcase-preview {
  margin-top: 1.25rem;
}

.showcase-card {
  background: linear-gradient(135deg, var(--paper), rgba(227, 201, 167, 0.15));
  border: 1px solid rgba(181, 162, 115, 0.3);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-card);
}

.showcase-card-header {
  background: linear-gradient(135deg, var(--green), var(--sage));
  color: var(--white);
  padding: 0.75rem 1.25rem;
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.showcase-card-body {
  padding: 1.5rem;
  font-size: 0.95rem;
  color: var(--text);
  line-height: 1.8;
  font-style: italic;
  min-height: 3rem;
}

.showcase-card-footer {
  padding: 0.6rem 1.25rem;
  font-size: 0.72rem;
  color: var(--text-light);
  border-top: 1px solid rgba(74, 74, 67, 0.06);
  text-align: right;
}

.showcase-action {
  margin-top: 0.75rem;
  font-size: 0.85rem;
  color: var(--sage);
  text-align: center;
  font-weight: 500;
}

/* ─── Footer ─── */
.course-footer {
  text-align: center;
  padding: 3rem 1.5rem 2.5rem;
  border-top: 1px solid rgba(74, 74, 67, 0.08);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.course-footer p {
  font-size: 0.95rem;
  color: var(--text);
  margin-bottom: 0.5rem;
}

.course-footer a {
  font-size: 0.85rem;
  color: var(--text-light);
  transition: color var(--transition);
}

.course-footer a:hover { color: var(--green); }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ─── Responsive ─── */
@media (max-width: 640px) {
  .scene-cards { grid-template-columns: 1fr; }
  .formula-cards { grid-template-columns: 1fr; }
  .timeline-chain { flex-direction: column; align-items: stretch; }
  .timeline-arrow { text-align: center; transform: rotate(90deg); }
  .toc { gap: 0.15rem; padding: 0.6rem 0.3rem; }
  .toc a { width: 1.75rem; height: 1.75rem; font-size: 0.75rem; }
  .module { padding: 2rem 0 2.5rem; }
}

@media (max-width: 480px) {
  .course { padding: 1.5rem 1rem 3rem; }
  .module h2 { font-size: 1.35rem; }
}
