:root {
  color-scheme: light;
  --bg: #f7f8fa;
  --paper: #ffffff;
  --ink: #142033;
  --muted: #667085;
  --line: #cfd7e3;
  --line-strong: #9dadc4;
  --blue: #1769e0;
  --blue-soft: #eef5ff;
  --blue-pale: #f7faff;
  --amber-soft: #fff8e8;
  --amber-line: #dba53b;
  --header-height: 64px;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
  overflow-x: hidden;
}

body {
  margin: 0;
  min-width: 320px;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button {
  font: inherit;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  height: var(--header-height);
  display: grid;
  grid-template-columns: 220px 1fr 180px;
  align-items: center;
  gap: 24px;
  padding: 0 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
}

.page-label {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.page-label strong {
  color: var(--blue);
  font-variant-numeric: tabular-nums;
}

.map-nav {
  display: flex;
  justify-content: center;
  gap: 6px;
}

.map-nav button {
  min-height: 38px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  font-weight: 650;
  transition: background 120ms ease, color 120ms ease, border-color 120ms ease;
}

.map-nav button span {
  margin-right: 7px;
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}

.map-nav button:hover {
  color: var(--ink);
  background: var(--blue-pale);
}

.map-nav button.active {
  color: var(--blue);
  border-color: #c8dcfa;
  background: var(--blue-soft);
}

.key-hint {
  justify-self: end;
  color: var(--muted);
  font-size: 11px;
}

.deck {
  min-height: calc(100svh - var(--header-height));
}

.map-slide {
  min-height: calc(100svh - var(--header-height));
  padding: clamp(22px, 3vh, 36px) clamp(26px, 4vw, 64px) 20px;
  background-color: var(--paper);
  background-image:
    linear-gradient(rgba(23, 105, 224, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(23, 105, 224, 0.035) 1px, transparent 1px);
  background-size: 28px 28px;
}

.map-slide[hidden] {
  display: none;
}

.map-slide.active {
  animation: slide-in 160ms ease-out both;
}

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

.slide-head {
  width: min(1500px, 100%);
  min-height: 92px;
  margin: 0 auto 18px;
  display: grid;
  grid-template-columns: 1fr minmax(360px, 0.75fr);
  align-items: end;
  gap: 48px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line-strong);
}

.slide-head p {
  margin: 0 0 7px;
  color: var(--blue);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.14em;
}

.slide-head h1 {
  margin: 0;
  font-size: clamp(34px, 4.2vw, 60px);
  line-height: 0.98;
  letter-spacing: -0.055em;
}

.slide-head .slide-thesis {
  margin: 0;
  padding-bottom: 3px;
  color: var(--ink);
  font-size: clamp(15px, 1.45vw, 20px);
  font-weight: 650;
  line-height: 1.55;
  letter-spacing: -0.01em;
}

.mindmap {
  width: min(1500px, 100%);
  height: min(64vh, 540px);
  min-height: 450px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 210px 66px minmax(0, 1fr);
  align-items: stretch;
}

.root-node {
  align-self: center;
  position: relative;
  padding: 25px 22px;
  border-radius: 10px;
  background: var(--blue);
  color: white;
}

.root-node::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 100%;
  width: 66px;
  border-top: 2px solid var(--blue);
}

.root-node small {
  display: block;
  margin-bottom: 11px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.root-node strong {
  display: block;
  font-size: 25px;
  line-height: 1.25;
  letter-spacing: -0.035em;
}

.root-node p {
  margin: 13px 0 0;
  color: rgba(255, 255, 255, 0.76);
  font-size: 12px;
  line-height: 1.55;
}

.map-trunk {
  position: relative;
}

.map-trunk::before {
  content: "";
  position: absolute;
  top: 10%;
  bottom: 10%;
  left: 50%;
  border-left: 2px solid var(--blue);
}

.branches {
  display: grid;
  grid-template-rows: repeat(5, minmax(0, 1fr));
  min-width: 0;
}

.branch {
  position: relative;
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  align-items: center;
  gap: 18px;
  min-height: 0;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}

.branch:last-child {
  border-bottom: 0;
}

.branch::before {
  content: "";
  position: absolute;
  right: 100%;
  top: 50%;
  width: 33px;
  border-top: 2px solid var(--blue);
}

.branch h2 {
  margin: 0;
  padding: 11px 14px;
  border-left: 3px solid var(--blue);
  background: var(--blue-soft);
  font-size: 15px;
  line-height: 1.3;
}

.branch h2 span {
  display: block;
  margin-bottom: 4px;
  color: var(--blue);
  font-size: 9px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.12em;
}

.leaves {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  min-width: 0;
}

.leaves p {
  position: relative;
  margin: 0;
  min-height: 48px;
  display: flex;
  align-items: center;
  padding: 9px 12px 9px 24px;
  border: 1px solid #dce5f2;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.92);
  font-size: clamp(11px, 1vw, 14px);
  font-weight: 580;
  line-height: 1.38;
}

.leaves p::before {
  content: "";
  position: absolute;
  left: 11px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--blue);
}

.leaves b {
  margin-right: 3px;
  color: var(--blue);
}

.boundary-branch h2 {
  border-left-color: var(--amber-line);
  background: var(--amber-soft);
}

.boundary-branch h2 span {
  color: #a56900;
}

.boundary-branch .leaves p::before {
  background: var(--amber-line);
}

.talk-order {
  width: min(1500px, 100%);
  min-height: 42px;
  margin: 12px auto 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  color: var(--muted);
  font-size: 11px;
}

.talk-order b {
  color: var(--ink);
}

.talk-order i {
  color: var(--blue);
  font-style: normal;
}

@media (max-width: 1100px) {
  .topbar {
    grid-template-columns: 150px 1fr 120px;
    padding-inline: 18px;
  }

  .page-label span,
  .key-hint {
    display: none;
  }

  .mindmap {
    grid-template-columns: 180px 52px minmax(0, 1fr);
  }

  .root-node::after {
    width: 52px;
  }

  .branch {
    grid-template-columns: 158px minmax(0, 1fr);
    gap: 12px;
  }

  .leaves {
    gap: 7px;
  }

  .leaves p {
    padding-left: 20px;
  }

  .leaves p::before {
    left: 8px;
  }
}

@media (max-width: 760px) {
  :root {
    --header-height: auto;
  }

  .topbar {
    position: sticky;
    display: block;
    height: auto;
    padding: 10px 12px;
  }

  .page-label,
  .key-hint {
    display: none;
  }

  .map-nav {
    justify-content: stretch;
    gap: 4px;
  }

  .map-nav button {
    flex: 1;
    min-height: 40px;
    padding: 0 6px;
    font-size: 11px;
  }

  .map-nav button span {
    display: none;
  }

  .map-slide {
    min-height: 100svh;
    padding: 22px 16px 36px;
  }

  .slide-head {
    display: block;
    min-height: 0;
    margin-bottom: 22px;
  }

  .slide-head h1 {
    font-size: 38px;
  }

  .slide-head .slide-thesis {
    margin-top: 14px;
    font-size: 15px;
  }

  .mindmap {
    height: auto;
    min-height: 0;
    display: block;
  }

  .root-node {
    margin-bottom: 16px;
  }

  .root-node::after,
  .map-trunk {
    display: none;
  }

  .branches {
    display: block;
  }

  .branch {
    display: block;
    padding: 12px 0;
  }

  .branch::before {
    display: none;
  }

  .branch h2 {
    margin-bottom: 9px;
  }

  .leaves {
    display: block;
  }

  .leaves p {
    min-height: 0;
    margin-top: 6px;
    font-size: 13px;
  }

  .talk-order {
    flex-wrap: wrap;
    gap: 6px 10px;
    justify-content: flex-start;
    margin-top: 22px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
  }
}
