:root {
  color-scheme: light;
  --bg: #f6f7f2;
  --surface: #ffffff;
  --surface-strong: #eef6f1;
  --text: #17201f;
  --muted: #63706d;
  --line: #dbe2da;
  --accent: #0b7a75;
  --accent-dark: #075552;
  --accent-soft: #d9efed;
  --gold: #c9831f;
  --danger: #b6463a;
  --shadow: 0 18px 45px rgba(19, 39, 35, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background:
    linear-gradient(180deg, rgba(11, 122, 117, 0.12), rgba(246, 247, 242, 0) 320px),
    var(--bg);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  line-height: 1.6;
}

a {
  color: var(--accent-dark);
}

button,
input {
  font: inherit;
}

.app-header {
  max-width: 1120px;
  margin: 0 auto;
  padding: 44px 20px 24px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 24px;
  align-items: end;
}

.header-copy h1 {
  margin: 0;
  max-width: 760px;
  font-size: clamp(2.1rem, 7vw, 4.8rem);
  line-height: 1.02;
  letter-spacing: 0;
}

.intro {
  max-width: 640px;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 1.08rem;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent-dark);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.route-card {
  background: var(--accent-dark);
  color: #fff;
  border-radius: 8px;
  padding: 20px;
  box-shadow: var(--shadow);
}

.route-card span {
  display: block;
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.82rem;
  margin-bottom: 8px;
}

.route-card strong {
  display: block;
  font-size: 1.15rem;
  line-height: 1.35;
}

main {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 20px 56px;
}

.top-tabs {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  gap: 8px;
  padding: 12px 0;
  background: rgba(246, 247, 242, 0.88);
  backdrop-filter: blur(14px);
  overflow-x: auto;
}

.top-tabs a {
  flex: 0 0 auto;
  min-width: 76px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  padding: 8px 14px;
  text-align: center;
  text-decoration: none;
  font-weight: 700;
}

.section {
  padding: 34px 0;
}

.section-heading {
  margin-bottom: 18px;
}

.section-heading h2 {
  margin: 0;
  font-size: clamp(1.45rem, 4vw, 2.2rem);
  line-height: 1.18;
  letter-spacing: 0;
}

.choice-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.choice-card,
.script-panel,
.check-group,
.term-card,
.mistake-card,
.source-section,
.guide-toc,
.guide-content {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.choice-card {
  padding: 18px;
  min-height: 100%;
}

.choice-card.is-recommended {
  border-color: rgba(11, 122, 117, 0.45);
  background: linear-gradient(180deg, var(--surface-strong), var(--surface));
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  padding: 2px 10px;
  font-size: 0.76rem;
  font-weight: 800;
}

.choice-card h3 {
  margin: 14px 0 8px;
  font-size: 1.25rem;
}

.choice-card p,
.source-section p {
  color: var(--muted);
}

dl {
  margin: 16px 0 0;
}

dl div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid var(--line);
  padding: 10px 0;
}

dt {
  color: var(--muted);
}

dd {
  margin: 0;
  text-align: right;
  font-weight: 700;
}

.segmented {
  display: inline-grid;
  grid-template-columns: repeat(3, minmax(90px, 1fr));
  gap: 4px;
  width: min(100%, 460px);
  padding: 4px;
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
}

.segment {
  min-height: 42px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-weight: 800;
}

.segment.is-active {
  background: var(--accent);
  color: #fff;
}

.script-panel {
  padding: 22px;
  box-shadow: var(--shadow);
}

.script-panel header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: start;
  margin-bottom: 18px;
}

.script-panel h3 {
  margin: 0 0 8px;
  font-size: 1.55rem;
}

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

.script-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  border-radius: 999px;
  background: var(--surface-strong);
  color: var(--accent-dark);
  padding: 3px 10px;
  font-size: 0.82rem;
  font-weight: 800;
}

.script-body {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 20px;
}

.script-body h4 {
  margin: 0 0 10px;
  font-size: 1rem;
}

.script-panel ol,
.script-panel ul {
  margin: 0;
  padding-left: 1.2rem;
}

.script-panel li + li {
  margin-top: 8px;
}

.key-box {
  background: #f9fbf7;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}

.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}

.ghost-button {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  padding: 9px 14px;
  cursor: pointer;
  font-weight: 800;
}

#progress-text {
  color: var(--muted);
  font-weight: 800;
}

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

.check-group {
  padding: 16px;
}

.check-group h3 {
  margin: 0 0 12px;
  font-size: 1.05rem;
}

.check-item {
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 10px;
  align-items: start;
  padding: 10px 0;
  border-top: 1px solid var(--line);
  color: var(--text);
}

.check-item input {
  width: 18px;
  height: 18px;
  margin-top: 3px;
  accent-color: var(--accent);
}

.check-item span {
  min-width: 0;
}

.check-item:has(input:checked) span {
  color: var(--muted);
  text-decoration: line-through;
}

.two-column {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 24px;
  align-items: start;
}

.search-box {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
  color: var(--muted);
  font-weight: 800;
}

.search-box input {
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  padding: 0 14px;
  outline-color: var(--accent);
}

.term-list,
.mistake-list {
  display: grid;
  gap: 12px;
}

.term-card,
.mistake-card {
  padding: 14px;
}

.term-card h3,
.mistake-card h3 {
  margin: 0 0 6px;
  font-size: 1rem;
}

.term-card p,
.mistake-card p {
  margin: 0;
  color: var(--muted);
}

.mistake-card {
  border-left: 4px solid var(--gold);
}

.source-section {
  padding: 22px;
}

.guide-heading {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: end;
}

.doc-link {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--accent-dark);
  padding: 9px 14px;
  text-decoration: none;
  font-weight: 800;
}

.guide-layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.guide-toc {
  position: sticky;
  top: 64px;
  max-height: calc(100vh - 86px);
  overflow: auto;
  padding: 16px;
}

.guide-toc .search-box {
  margin-bottom: 12px;
}

#guide-toc {
  display: grid;
  gap: 4px;
}

.toc-link {
  border-radius: 6px;
  color: var(--text);
  padding: 7px 8px;
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 750;
}

.toc-link:hover {
  background: var(--surface-strong);
}

.toc-link-sub {
  color: var(--muted);
  padding-left: 20px;
  font-size: 0.86rem;
  font-weight: 650;
}

.guide-content {
  padding: 22px;
  overflow: hidden;
}

.guide-section {
  scroll-margin-top: 76px;
  padding: 18px 0;
  border-top: 1px solid var(--line);
}

.guide-section:first-child {
  border-top: 0;
  padding-top: 0;
}

.guide-content h1,
.guide-content h2,
.guide-content h3,
.guide-content h4 {
  line-height: 1.25;
  letter-spacing: 0;
  scroll-margin-top: 76px;
}

.guide-content h1 {
  margin: 0 0 16px;
  font-size: 2rem;
}

.guide-content h2 {
  margin: 0 0 14px;
  font-size: 1.55rem;
}

.guide-content h3 {
  margin: 22px 0 10px;
  font-size: 1.18rem;
}

.guide-content h4 {
  margin: 18px 0 8px;
}

.guide-content p,
.guide-content li,
.guide-content blockquote {
  color: var(--text);
}

.guide-content blockquote {
  margin: 14px 0;
  border-left: 4px solid var(--accent);
  background: var(--surface-strong);
  padding: 12px 14px;
}

.guide-content code {
  border-radius: 4px;
  background: var(--accent-soft);
  padding: 0 4px;
  color: var(--accent-dark);
}

.guide-content ul,
.guide-content ol {
  padding-left: 1.35rem;
}

.guide-content li + li {
  margin-top: 6px;
}

.table-scroll {
  width: 100%;
  overflow-x: auto;
  margin: 14px 0;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.guide-content table {
  width: 100%;
  min-width: 620px;
  border-collapse: collapse;
  background: var(--surface);
}

.guide-content th,
.guide-content td {
  border-bottom: 1px solid var(--line);
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
}

.guide-content th {
  background: var(--surface-strong);
  color: var(--accent-dark);
  font-weight: 850;
}

.guide-content tr:last-child td {
  border-bottom: 0;
}

.loading-text,
.guide-empty {
  margin: 0;
  border-radius: 8px;
  background: var(--surface-strong);
  color: var(--muted);
  padding: 16px;
  font-weight: 750;
}

.guide-content.is-filtering .guide-section:not([hidden]) {
  border-color: rgba(11, 122, 117, 0.35);
}

@media (max-width: 900px) {
  .app-header,
  .script-body,
  .two-column,
  .guide-layout {
    grid-template-columns: 1fr;
  }

  .choice-grid {
    grid-template-columns: 1fr;
  }

  .checklist-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .script-panel header {
    display: block;
  }

  .script-meta {
    justify-content: flex-start;
    margin-top: 14px;
  }

  .guide-toc {
    position: static;
    max-height: none;
  }
}

@media (max-width: 560px) {
  .app-header {
    padding-top: 28px;
  }

  main {
    padding-inline: 14px;
  }

  .checklist-grid {
    grid-template-columns: 1fr;
  }

  .segmented {
    grid-template-columns: 1fr;
    border-radius: 8px;
  }

  .segment {
    border-radius: 6px;
  }

  .guide-heading {
    display: block;
  }

  .doc-link {
    display: inline-flex;
    margin-top: 14px;
  }

  .guide-content {
    padding: 16px;
  }

  .guide-content h1 {
    font-size: 1.55rem;
  }
}
