:root {
  --ink: #132338;
  --ink-soft: #1e334d;
  --amber: #c7912e;
  --amber-soft: #e8c36a;
  --paper: #f3f1ec;
  --paper-2: #e8e4dc;
  --white: #fffcf7;
  --ok: #2f6b4f;
  --ok-bg: #e3f0e9;
  --lock: #7a8494;
  --warn: #9a4a2a;
  --warn-bg: #f7ebe4;
  --line: #d5cfc3;
  --shadow: 0 10px 30px rgba(19, 35, 56, 0.08);
  --radius: 14px;
  --font-display: "Noto Serif SC", "Songti SC", serif;
  --font-body: "DM Sans", "PingFang SC", "Microsoft YaHei", sans-serif;
  --sidebar: 280px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 0%, rgba(199, 145, 46, 0.12), transparent 40%),
    radial-gradient(circle at 90% 10%, rgba(30, 51, 77, 0.08), transparent 35%),
    linear-gradient(180deg, #efebe3 0%, var(--paper) 40%, #ebe6dc 100%);
  min-height: 100vh;
  line-height: 1.65;
}

a {
  color: var(--ink-soft);
  text-decoration-color: rgba(199, 145, 46, 0.55);
}

a:hover {
  color: var(--amber);
}

img {
  max-width: 100%;
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--ink);
  color: #fff;
  padding: 0.5rem 1rem;
  z-index: 1000;
}

.skip-link:focus {
  left: 1rem;
  top: 1rem;
}

.layout {
  display: grid;
  grid-template-columns: var(--sidebar) 1fr;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
  background: linear-gradient(180deg, var(--ink) 0%, var(--ink-soft) 100%);
  color: #f4efe6;
  padding: 1.25rem 1rem 2rem;
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.04);
}

.brand {
  font-family: var(--font-display);
  font-size: 1.25rem;
  line-height: 1.35;
  margin: 0 0 0.35rem;
  color: #fff;
}

.brand-sub {
  margin: 0 0 1.25rem;
  color: var(--amber-soft);
  font-size: 0.85rem;
}

.nav-section {
  margin: 1.25rem 0 0.5rem;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(232, 195, 106, 0.75);
}

.nav-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-list a {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: #e8e2d6;
  text-decoration: none;
  padding: 0.45rem 0.55rem;
  border-radius: 8px;
  font-size: 0.92rem;
  border: 1px solid transparent;
}

.nav-list a:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}

.nav-list a.active {
  background: rgba(199, 145, 46, 0.18);
  border-color: rgba(199, 145, 46, 0.35);
  color: #fff;
}

.nav-list a.locked {
  opacity: 0.45;
  cursor: not-allowed;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.35rem;
  height: 1.35rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.12);
}

.badge.done {
  background: var(--ok);
  color: #fff;
}

.badge.lock {
  background: rgba(122, 132, 148, 0.55);
}

.main {
  padding: 1.5rem 1.75rem 3rem;
  max-width: 980px;
}

.topbar {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.menu-btn,
.btn {
  appearance: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.95rem;
  border-radius: 999px;
  padding: 0.65rem 1.15rem;
  transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.menu-btn {
  background: var(--ink);
  color: #fff;
}

.btn-primary {
  background: linear-gradient(135deg, var(--amber) 0%, #a9741f 100%);
  color: #fff;
  font-weight: 650;
  box-shadow: 0 8px 18px rgba(199, 145, 46, 0.28);
}

.btn-primary:hover {
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--white);
  color: var(--ink);
  border: 1px solid var(--line);
}

.btn-ghost {
  background: transparent;
  color: var(--ink-soft);
  border: 1px dashed var(--line);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.hero {
  background:
    linear-gradient(135deg, rgba(19, 35, 56, 0.96), rgba(30, 51, 77, 0.92)),
    repeating-linear-gradient(
      -45deg,
      rgba(255, 255, 255, 0.03) 0,
      rgba(255, 255, 255, 0.03) 2px,
      transparent 2px,
      transparent 10px
    );
  color: #f7f2e8;
  border-radius: calc(var(--radius) + 4px);
  padding: 1.75rem 1.75rem 1.5rem;
  box-shadow: var(--shadow);
  margin-bottom: 1.5rem;
  position: relative;
  overflow: hidden;
}

.hero::after {
  content: "";
  position: absolute;
  right: -40px;
  top: -40px;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(199, 145, 46, 0.35), transparent 70%);
}

.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  margin: 0 0 0.6rem;
  position: relative;
  z-index: 1;
}

.hero p {
  margin: 0;
  max-width: 46rem;
  color: rgba(247, 242, 232, 0.86);
  position: relative;
  z-index: 1;
}

.progress-bar-wrap {
  margin-top: 1.25rem;
  position: relative;
  z-index: 1;
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.88rem;
  margin-bottom: 0.4rem;
  color: var(--amber-soft);
}

.progress-track {
  height: 10px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--amber-soft), var(--amber));
  border-radius: inherit;
  transition: width 0.35s ease;
}

.panel {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem 1.35rem;
  box-shadow: var(--shadow);
  margin-bottom: 1.15rem;
}

.panel h2,
.panel h3,
.content h2,
.content h3 {
  font-family: var(--font-display);
  margin-top: 0;
}

.content h2 {
  font-size: 1.35rem;
  border-bottom: 2px solid rgba(199, 145, 46, 0.35);
  padding-bottom: 0.35rem;
  margin: 1.75rem 0 0.85rem;
}

.content h3 {
  font-size: 1.08rem;
  margin: 1.25rem 0 0.55rem;
}

.content p,
.content li {
  color: #2a3648;
}

.lead {
  font-size: 1.05rem;
  color: var(--ink-soft);
}

.muted {
  color: var(--lock);
  font-size: 0.92rem;
}

.chapter-audio-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem 0.75rem;
  margin: -0.35rem 0 1.15rem;
  padding: 0.65rem 0.85rem;
  background: linear-gradient(90deg, rgba(199, 145, 46, 0.08), rgba(19, 35, 56, 0.03));
  border: 1px solid rgba(199, 145, 46, 0.28);
  border-left: 3px solid var(--amber, #c7912e);
  border-radius: var(--radius);
}

.chapter-audio-bar .chapter-audio-hint {
  flex: 1 1 10rem;
  min-width: 0;
}

.chapter-audio-bar .btn {
  flex: 0 0 auto;
}

@media (max-width: 560px) {
  .chapter-audio-bar {
    padding: 0.6rem 0.7rem;
  }
}

.map-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.9rem;
}

.map-card {
  display: block;
  text-decoration: none;
  color: inherit;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1rem 0.9rem;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.map-card:hover {
  transform: translateY(-2px);
  border-color: rgba(199, 145, 46, 0.55);
}

.map-card.locked {
  opacity: 0.55;
  filter: grayscale(0.25);
}

.map-card .num {
  font-family: var(--font-display);
  font-size: 1.5rem;
  color: var(--amber);
  margin: 0;
}

.map-card h3 {
  margin: 0.2rem 0 0.35rem;
  font-size: 1.05rem;
}

.map-card p {
  margin: 0;
  font-size: 0.88rem;
  color: #5a6575;
}

.status-pill {
  display: inline-block;
  margin-top: 0.7rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: var(--paper-2);
  color: var(--ink-soft);
}

.status-pill.done {
  background: var(--ok-bg);
  color: var(--ok);
}

.status-pill.current {
  background: rgba(199, 145, 46, 0.18);
  color: #8a5f14;
}

.status-pill.locked {
  background: #eceff3;
  color: var(--lock);
}

.flow {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
}

.flow span {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.35rem 0.7rem;
  font-size: 0.86rem;
}

.flow .arrow {
  border: none;
  background: transparent;
  color: var(--amber);
  font-weight: 700;
  padding: 0;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
  margin: 0.75rem 0 1rem;
}

th,
td {
  border: 1px solid var(--line);
  padding: 0.55rem 0.65rem;
  text-align: left;
  vertical-align: top;
}

th {
  background: var(--paper);
  font-weight: 650;
}

.callout {
  border-left: 4px solid var(--amber);
  background: rgba(199, 145, 46, 0.08);
  padding: 0.85rem 1rem;
  border-radius: 0 10px 10px 0;
  margin: 1rem 0;
}

.callout.warn {
  border-left-color: var(--warn);
  background: var(--warn-bg);
}

.callout.ok {
  border-left-color: var(--ok);
  background: var(--ok-bg);
}

.chapter-recap {
  border-left: 4px solid var(--amber);
  background: linear-gradient(180deg, #fff9ef 0%, var(--white) 48%);
}

.chapter-recap h2 {
  margin-top: 0;
}

.chapter-recap h3 {
  margin: 1.1rem 0 0.45rem;
  font-size: 1.02rem;
  color: var(--ink-soft);
}

.chapter-recap h3:first-of-type {
  margin-top: 0.65rem;
}

.chapter-recap ol {
  padding-left: 1.25rem;
}

.chapter-recap li {
  margin: 0.35rem 0;
}

.skills-toc a {
  display: inline-block;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
  font-size: 0.88rem;
  text-decoration: none;
  color: var(--ink-soft);
}

.skills-toc a:hover {
  border-color: rgba(199, 145, 46, 0.55);
  color: #6b4508;
}

.skills-block {
  margin: 1.5rem 0 1.75rem;
  scroll-margin-top: 1rem;
}

.skills-block h2 {
  font-family: var(--font-display);
  font-size: 1.28rem;
  border-bottom: 2px solid rgba(199, 145, 46, 0.4);
  padding-bottom: 0.35rem;
}

.skills-block table {
  font-size: 0.86rem;
}

.chapter-recap .skills-related {
  margin: 0.85rem 0 0.25rem;
  padding: 0.65rem 0.8rem;
  background: rgba(19, 35, 56, 0.04);
  border-radius: 10px;
  font-size: 0.92rem;
}

.chapter-recap .skills-related a {
  font-weight: 650;
}

.exam-hub {
  display: grid;
  gap: 1rem;
  margin: 1rem 0 1.5rem;
}

.exam-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.15rem 1.25rem;
  box-shadow: var(--shadow);
}

.exam-card.locked {
  opacity: 0.72;
  background: #f7f5f1;
}

.exam-card.passed {
  border-color: rgba(47, 107, 79, 0.35);
  box-shadow: 0 10px 28px rgba(47, 107, 79, 0.1);
}

.exam-card-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.exam-card-top h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.15rem;
}

.exam-score {
  margin: 0.45rem 0 0.35rem;
  font-weight: 650;
  color: var(--ink-soft);
}

.exam-lock-hint {
  margin: 0.35rem 0 0.5rem;
  font-size: 0.88rem;
  color: var(--warn);
}

.exam-graduate {
  background: linear-gradient(135deg, rgba(47, 107, 79, 0.12), rgba(199, 145, 46, 0.15));
  border: 1px solid rgba(47, 107, 79, 0.35);
  border-radius: var(--radius);
  padding: 0.95rem 1.1rem;
  margin-bottom: 0.25rem;
  color: var(--ink);
}

.exam-result-pass {
  border-left: 4px solid var(--ok);
  background: var(--ok-bg);
}

.exam-result-fail {
  border-left: 4px solid var(--warn);
  background: var(--warn-bg);
}

.exam-hint {
  margin: 0.75rem 0 0;
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
  background: rgba(19, 35, 56, 0.05);
  font-size: 0.9rem;
}

.checklist {
  list-style: none;
  padding: 0;
  margin: 0.5rem 0 0;
}

.checklist li {
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
  padding: 0.45rem 0;
  border-bottom: 1px dashed var(--line);
}

.checklist input {
  margin-top: 0.3rem;
  accent-color: var(--amber);
}

.quiz {
  display: grid;
  gap: 1rem;
}

.quiz-item {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.9rem 1rem;
  background: #fffaf2;
}

.quiz-item.correct {
  border-color: rgba(47, 107, 79, 0.45);
  background: var(--ok-bg);
}

.quiz-item.wrong {
  border-color: rgba(154, 74, 42, 0.4);
  background: var(--warn-bg);
}

.quiz-options {
  display: grid;
  gap: 0.35rem;
  margin-top: 0.55rem;
}

.quiz-options label {
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
  cursor: pointer;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 1.25rem;
}

.module-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 1rem;
  align-items: center;
  margin-bottom: 1rem;
  font-size: 0.9rem;
  color: #5a6575;
}

.tag {
  display: inline-block;
  background: rgba(19, 35, 56, 0.08);
  color: var(--ink);
  border-radius: 999px;
  padding: 0.15rem 0.55rem;
  font-size: 0.78rem;
  font-weight: 650;
}

.footer-note {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
  font-size: 0.85rem;
  color: var(--lock);
}

.sidebar-backdrop {
  display: none;
}

@media (max-width: 900px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: min(86vw, 300px);
    z-index: 40;
    transform: translateX(-105%);
    transition: transform 0.2s ease;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(19, 35, 56, 0.45);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 30;
  }

  .sidebar-backdrop.show {
    opacity: 1;
    pointer-events: auto;
  }

  .topbar {
    display: flex;
  }

  .main {
    padding: 1rem 1rem 2.5rem;
  }
}

/* —— 术语点击与弹窗 —— */
button.term {
  appearance: none;
  border: none;
  margin: 0;
  font: inherit;
  font-weight: 650;
  color: #6b4508;
  cursor: pointer;
  padding: 0 0.18em;
  border-radius: 3px;
  border-bottom: 2px solid #b07818;
  background: rgba(199, 145, 46, 0.22);
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
  line-height: inherit;
  box-shadow: none;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

button.term:hover,
button.term:focus-visible {
  color: #3d2804;
  border-bottom-color: #8a5f14;
  background: rgba(199, 145, 46, 0.38);
  outline: 2px solid rgba(138, 95, 20, 0.45);
  outline-offset: 1px;
}

body.term-modal-open {
  overflow: hidden;
}

.term-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  background: rgba(19, 35, 56, 0.55);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.term-modal-backdrop.show {
  opacity: 1;
  pointer-events: auto;
}

.term-modal {
  width: min(100%, 440px);
  background: var(--white);
  border-radius: calc(var(--radius) + 2px);
  border: 1px solid var(--line);
  box-shadow: 0 24px 60px rgba(19, 35, 56, 0.28);
  padding: 1.35rem 1.4rem 1.25rem;
  position: relative;
  transform: translateY(8px);
  transition: transform 0.2s ease;
}

.term-modal-backdrop.show .term-modal {
  transform: translateY(0);
}

.term-modal-close {
  position: absolute;
  right: 0.7rem;
  top: 0.55rem;
  width: 2rem;
  height: 2rem;
  border: none;
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
}

.term-modal-close:hover {
  background: var(--paper-2);
}

.term-modal-kicker {
  margin: 0 0 0.25rem;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--amber);
  font-weight: 700;
}

.term-modal h3 {
  font-family: var(--font-display);
  margin: 0 0 0.35rem;
  font-size: 1.45rem;
  padding-right: 1.5rem;
}

.term-modal-en {
  margin: 0 0 0.75rem;
  color: #5a6575;
  font-size: 0.92rem;
}

.term-modal-def {
  margin: 0 0 0.85rem;
  color: #2a3648;
  line-height: 1.7;
}

.term-modal-tip {
  margin: 0 0 1rem;
  padding: 0.7rem 0.85rem;
  border-radius: 10px;
  background: rgba(199, 145, 46, 0.1);
  border-left: 3px solid var(--amber);
  font-size: 0.9rem;
  color: var(--ink-soft);
}

.term-modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  justify-content: flex-end;
}

.term-modal-tts-hint {
  margin: 0.65rem 0 0;
  width: 100%;
  text-align: right;
  font-size: 0.82rem;
}

.term-modal-badge-wrap {
  margin: 0 0 0.45rem;
  min-height: 0;
}

.term-badge-slang {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background: rgba(154, 74, 42, 0.14);
  color: var(--warn);
  border: 1px solid rgba(154, 74, 42, 0.35);
}

.term-badge-slang.inline {
  margin-left: 0.25rem;
  vertical-align: middle;
}

.term-badge-slang[hidden] {
  display: none !important;
}

.tts-selection-bar {
  position: absolute;
  z-index: 90;
  display: none;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.4rem;
  background: var(--ink);
  border: 1px solid rgba(199, 145, 46, 0.55);
  border-radius: 999px;
  box-shadow: 0 10px 28px rgba(19, 35, 56, 0.28);
}

.tts-selection-bar.show {
  display: inline-flex;
}

.tts-selection-bar .btn {
  padding: 0.4rem 0.75rem;
  font-size: 0.85rem;
}

.tts-selection-bar .tts-sel-close {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.25);
  min-width: 2rem;
  padding-left: 0.5rem;
  padding-right: 0.5rem;
}
