:root {
  --pink: #ff8fab;
  --pink-soft: rgba(255, 182, 193, 0.32);
  --pink-border: rgba(255, 182, 193, 0.42);
  --blue: #7a9cc6;
  --blue-deep: #6a8caf;
  --text: #5a5a7a;
  --glass: rgba(255, 255, 255, 0.62);
  --glass-strong: rgba(255, 255, 255, 0.78);
  --shadow-pink: rgba(255, 143, 171, 0.28);
  --shadow-blue: rgba(173, 216, 230, 0.28);
  --radius-lg: 30px;
  --radius-md: 20px;
  --motion: cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  overflow-x: hidden;
  color: var(--text);
  font-family: "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  background:
    radial-gradient(circle at 18% 16%, rgba(255, 255, 255, 0.62), transparent 28%),
    radial-gradient(circle at 84% 12%, rgba(255, 235, 242, 0.72), transparent 34%),
    linear-gradient(120deg, #e0f7fa 0%, #fce4ec 50%, #e1f5fe 100%);
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  font: inherit;
}

code {
  padding: 2px 7px;
  border-radius: 8px;
  color: #d96f91;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(255, 182, 193, 0.28);
}

.container {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 1000;
  width: 260px;
  height: 100vh;
  overflow-y: auto;
  padding: 40px 0;
  border-right: 1px solid var(--pink-border);
  border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
  background: rgba(255, 255, 255, 0.7);
  box-shadow: 4px 0 20px var(--shadow-blue);
  backdrop-filter: blur(20px);
  transition: transform 0.4s var(--motion);
}

.sidebar h2 {
  padding: 0 30px 30px;
  color: var(--pink);
  font-size: 1.3rem;
  letter-spacing: 4px;
}

.sidebar ul {
  list-style: none;
}

.sidebar li {
  margin: 8px 15px;
}

.sidebar a {
  display: block;
  padding: 14px 20px;
  color: var(--blue);
  text-decoration: none;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  transition: all 0.34s var(--motion);
  cursor: pointer;
}

.sidebar a:hover,
.sidebar a.active {
  color: var(--pink);
  background: linear-gradient(135deg, rgba(255, 182, 193, 0.31), rgba(173, 216, 230, 0.31));
  box-shadow: 0 4px 15px rgba(255, 182, 193, 0.3);
  transform: translateX(8px);
}

.content {
  flex: 1;
  min-height: 100vh;
  margin-left: 260px;
  padding: 50px 60px;
}

.page {
  display: none;
  padding: 40px;
  min-height: calc(100vh - 100px);
  border: 1px solid rgba(255, 182, 193, 0.3);
  border-radius: var(--radius-lg);
  background: var(--glass);
  box-shadow: 0 10px 40px rgba(173, 216, 230, 0.2);
  backdrop-filter: blur(15px);
  animation: fadeIn 0.4s ease-out;
}

.page.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.page h1 {
  display: inline-block;
  margin-bottom: 25px;
  padding-bottom: 15px;
  color: var(--pink);
  border-bottom: 2px solid rgba(255, 182, 193, 0.4);
  font-size: 1.6rem;
}

.page p {
  max-width: 920px;
  margin-bottom: 15px;
  color: var(--blue-deep);
  line-height: 2;
}

.note {
  margin-top: 15px;
  color: var(--blue);
  font-size: 0.9rem;
}

.action-stack {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  margin: 28px 0 18px;
}

.pill-btn,
.collapse-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 12px 20px;
  border: 1px solid rgba(255, 182, 193, 0.4);
  border-radius: var(--radius-md);
  color: var(--blue);
  text-decoration: none;
  background: linear-gradient(135deg, rgba(255, 182, 193, 0.25), rgba(173, 216, 230, 0.25));
  cursor: pointer;
  transition: background 0.3s, color 0.3s, box-shadow 0.3s, transform 0.3s;
}

.pill-btn:hover,
.collapse-btn:hover {
  color: var(--pink);
  background: linear-gradient(135deg, rgba(255, 182, 193, 0.42), rgba(173, 216, 230, 0.42));
  box-shadow: 0 4px 15px rgba(255, 182, 193, 0.3);
  transform: translateY(-1px);
}

.collapse-btn .arrow {
  display: inline-block;
  transition: transform 0.3s ease;
}

.collapse-btn.active .arrow {
  transform: rotate(90deg);
}

.collapse-content,
.sub-wrap,
.leaf-wrap {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.36s ease;
}

.collapse-content.active,
.sub-wrap.expanded,
.leaf-wrap.expanded {
  grid-template-rows: 1fr;
}

.collapse-inner,
.sub-inner,
.leaf-inner {
  overflow: hidden;
}

.feature-card {
  margin-top: 30px;
  padding: 25px;
  border: 1px solid rgba(255, 182, 193, 0.3);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.5);
}

.feature-title {
  display: inline-block;
  margin-bottom: 15px;
  padding-bottom: 10px;
  color: var(--pink);
  border-bottom: 2px solid rgba(255, 182, 193, 0.3);
  font-size: 1.2rem;
  font-weight: 700;
}

.feature-desc {
  color: var(--blue-deep);
  font-size: 0.95rem;
  line-height: 1.9;
}

.feature-desc + .feature-desc {
  margin-top: 10px;
}

.quick-links {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.quick-link {
  width: 100%;
  display: flex;
  align-items: center;
  padding: 12px 16px;
  color: var(--blue-deep);
  text-align: left;
  border: 1px solid rgba(255, 182, 193, 0.3);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.5);
  cursor: pointer;
  transition: background 0.25s, box-shadow 0.25s, transform 0.25s;
}

.quick-link:hover {
  background: linear-gradient(135deg, rgba(255, 182, 193, 0.2), rgba(173, 216, 230, 0.2));
  box-shadow: 0 3px 12px rgba(255, 182, 193, 0.22);
  transform: translateX(3px);
}

.quick-link-tag {
  color: var(--pink);
  font-weight: 600;
}

.quick-link-sep {
  margin: 0 8px;
  color: #c0c0c0;
}

.func-tree {
  margin: 20px 0 36px;
}

.tree-hint {
  margin-bottom: 15px;
  color: var(--blue);
  text-align: center;
  font-size: 0.85rem;
}

.tree-root {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.root-node {
  margin-bottom: 20px;
  padding: 12px 28px;
  color: #fff;
  border-radius: 25px;
  background: linear-gradient(135deg, var(--pink), var(--blue));
  box-shadow: 0 4px 20px rgba(255, 143, 171, 0.4);
  font-size: 1.1rem;
  font-weight: 700;
}

.branch-container {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.branch {
  display: flex;
  flex-direction: column;
}

.branch-node,
.sub-item {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  color: var(--blue);
  border: 2px solid rgba(255, 182, 193, 0.5);
  background: rgba(255, 255, 255, 0.8);
  box-shadow: 0 3px 15px rgba(173, 216, 230, 0.3);
  cursor: pointer;
  transition: background 0.25s, color 0.25s, box-shadow 0.25s;
}

.branch-node {
  min-height: 54px;
  padding: 12px 16px;
  border-radius: 18px;
  font-size: 0.9rem;
}

.sub-items {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 10px;
}

.sub-item {
  padding: 10px 14px;
  color: var(--pink);
  border-width: 1px;
  border-radius: 14px;
  font-size: 0.8rem;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.6);
}

.branch-node:hover,
.branch-node.expanded,
.sub-item:hover,
.sub-item.expanded {
  color: var(--pink);
  background: linear-gradient(135deg, rgba(255, 182, 193, 0.35), rgba(173, 216, 230, 0.32));
  box-shadow: 0 6px 20px rgba(255, 182, 193, 0.32);
}

.node-arrow,
.item-arrow {
  font-size: 0.72rem;
  transition: transform 0.3s ease;
}

.branch-node.expanded .node-arrow,
.sub-item.expanded .item-arrow {
  transform: rotate(90deg);
}

.leaf-items {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  padding: 0 10px;
  margin-top: 8px;
}

.leaf-item {
  padding: 6px 12px;
  color: var(--blue-deep);
  border: 1px solid rgba(173, 216, 230, 0.5);
  border-radius: 10px;
  background: rgba(173, 216, 230, 0.3);
  font-size: 0.75rem;
}

.media-shot {
  position: relative;
  min-height: 260px;
  margin-top: 20px;
  overflow: hidden;
  border: 1px solid rgba(255, 182, 193, 0.35);
  border-radius: 15px;
  background:
    radial-gradient(circle at 22% 28%, rgba(255, 143, 171, 0.25), transparent 28%),
    radial-gradient(circle at 78% 18%, rgba(122, 156, 198, 0.24), transparent 30%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.76), rgba(225, 245, 254, 0.68));
  box-shadow: 0 5px 20px rgba(173, 216, 230, 0.3);
  cursor: zoom-in;
}

.media-shot::after {
  content: attr(data-preview-title);
  position: absolute;
  right: 18px;
  bottom: 16px;
  color: rgba(106, 140, 175, 0.82);
  font-size: 0.85rem;
  font-weight: 700;
}

.media-shot:hover {
  transform: scale(1.01);
  transition: transform 0.3s ease;
}

.media-topbar {
  display: flex;
  gap: 7px;
  padding: 16px;
}

.media-topbar span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(255, 143, 171, 0.72);
}

.media-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  padding: 18px;
}

.media-grid i {
  min-height: 70px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.68);
  border: 1px solid rgba(255, 182, 193, 0.28);
}

.media-panel {
  position: absolute;
  left: 32px;
  right: 32px;
  bottom: 34px;
  padding: 28px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid rgba(255, 182, 193, 0.28);
}

.media-panel strong {
  display: block;
  color: var(--pink);
  font-size: 1.45rem;
}

.media-panel p {
  margin: 8px 0 0;
  color: var(--blue);
  line-height: 1.6;
}

.media-shot--nav {
  display: grid;
  grid-template-columns: 0.7fr 1fr;
  gap: 22px;
  padding: 28px;
}

.nav-lines,
.nav-card {
  min-height: 200px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.54);
  border: 1px solid rgba(255, 182, 193, 0.26);
}

.nav-lines {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 25px 18px;
}

.nav-lines b,
.nav-card i {
  display: block;
  height: 18px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(255, 143, 171, 0.45), rgba(122, 156, 198, 0.32));
}

.nav-card {
  display: grid;
  align-content: center;
  gap: 16px;
  padding: 26px;
}

.media-shot--media {
  display: grid;
  place-items: center;
}

.play-mark {
  width: 82px;
  height: 82px;
  display: grid;
  place-items: center;
  padding-left: 6px;
  color: #fff;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--pink), var(--blue));
  box-shadow: 0 14px 30px rgba(255, 143, 171, 0.32);
  font-size: 2rem;
}

.menu-btn,
.toc-btn {
  position: fixed;
  width: 50px;
  height: 50px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 4px 20px rgba(255, 182, 193, 0.4);
  color: var(--pink);
  cursor: pointer;
  z-index: 1001;
  transition: transform 0.3s, box-shadow 0.3s;
}

.menu-btn {
  display: none;
  top: 20px;
  left: 20px;
}

.toc-btn {
  top: 20px;
  right: 20px;
  font-size: 1.2rem;
}

.menu-btn span {
  display: block;
  width: 22px;
  height: 2px;
  margin: 5px auto;
  border-radius: 2px;
  background: var(--pink);
  transition: all 0.3s;
}

.menu-btn.active span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

.menu-btn.active span:nth-child(2) {
  opacity: 0;
}

.menu-btn.active span:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}

.menu-btn:hover,
.toc-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 25px rgba(255, 182, 193, 0.5);
}

.overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 999;
  opacity: 0;
  background: rgba(0, 0, 0, 0.3);
  transition: opacity 0.3s;
}

.overlay.active {
  opacity: 1;
}

.toc-modal {
  position: fixed;
  inset: 0;
  z-index: 2001;
  display: flex;
  align-items: center;
  justify-content: center;
  visibility: hidden;
  pointer-events: none;
}

.toc-modal.active,
.toc-modal.closing {
  visibility: visible;
  pointer-events: auto;
}

.toc-overlay {
  position: absolute;
  inset: 0;
  opacity: 0;
  background: rgba(0, 0, 0, 0.45);
  transition: opacity 0.3s ease;
}

.toc-modal.active .toc-overlay {
  opacity: 1;
}

.toc-content {
  position: relative;
  width: min(360px, 90vw);
  max-height: 80vh;
  overflow-y: auto;
  padding: 30px;
  border: 1px solid rgba(255, 182, 193, 0.3);
  border-radius: 25px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 20px 60px rgba(255, 143, 171, 0.35);
  opacity: 0;
  transform: scale(0.9) translateY(20px);
  transition: transform 0.35s cubic-bezier(0.34, 1.3, 0.64, 1), opacity 0.3s ease;
}

.toc-modal.active .toc-content {
  opacity: 1;
  transform: scale(1) translateY(0);
}

.toc-modal.closing .toc-overlay {
  opacity: 0;
}

.toc-modal.closing .toc-content {
  opacity: 0;
  transform: scale(0.9) translateY(-20px);
}

.toc-title {
  margin-bottom: 20px;
  padding-bottom: 15px;
  color: var(--pink);
  border-bottom: 2px solid rgba(255, 182, 193, 0.3);
  text-align: center;
  font-size: 1.2rem;
  font-weight: 700;
}

.toc-list {
  list-style: none;
}

.toc-list a {
  display: block;
  margin-bottom: 5px;
  padding: 12px 15px;
  color: var(--blue);
  border-radius: 12px;
  text-decoration: none;
  transition: all 0.3s;
}

.toc-list a:hover {
  color: var(--pink);
  padding-left: 20px;
  background: linear-gradient(135deg, rgba(255, 182, 193, 0.2), rgba(173, 216, 230, 0.2));
}

.toc-close {
  position: absolute;
  top: 15px;
  right: 15px;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 50%;
  color: var(--pink);
  background: rgba(255, 182, 193, 0.2);
  cursor: pointer;
  font-size: 1.2rem;
  transition: all 0.3s;
}

.toc-close:hover {
  background: rgba(255, 182, 193, 0.4);
  transform: rotate(90deg);
}

.img-viewer {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 2000;
  align-items: center;
  justify-content: center;
  padding: 32px;
  background: rgba(0, 0, 0, 0.9);
  cursor: zoom-out;
}

.img-viewer.active {
  display: flex;
}

.img-viewer img {
  max-width: min(960px, 95vw);
  max-height: 90vh;
  border-radius: 12px;
  box-shadow: 0 10px 50px rgba(0, 0, 0, 0.5);
}

.img-viewer .close-btn {
  position: absolute;
  top: 20px;
  right: 30px;
  border: 0;
  color: #fff;
  background: transparent;
  cursor: pointer;
  font-size: 2rem;
  opacity: 0.85;
}

@media (max-width: 980px) {
  .content {
    padding: 42px 34px;
  }

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

@media (max-width: 768px) {
  .menu-btn {
    display: block;
  }

  .overlay {
    display: block;
    pointer-events: none;
  }

  .overlay.active {
    pointer-events: auto;
  }

  .sidebar {
    transform: translateX(-110%);
  }

  .sidebar.active {
    transform: translateX(0);
  }

  .content {
    margin-left: 0;
    padding: 88px 16px 24px;
  }

  .page {
    min-height: calc(100vh - 112px);
    padding: 28px 20px;
    border-radius: 24px;
  }

  .page h1 {
    font-size: 1.45rem;
  }

  .action-stack {
    align-items: stretch;
    flex-direction: column;
  }

  .pill-btn,
  .collapse-btn {
    width: 100%;
  }

  .feature-card {
    padding: 20px;
  }

  .branch-container {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .branch-node {
    min-height: 50px;
    padding: 10px 12px;
    font-size: 0.84rem;
  }

  .media-shot {
    min-height: 220px;
  }

  .media-shot--nav {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .branch-container {
    grid-template-columns: 1fr;
  }

  .sidebar {
    width: 78vw;
  }

  .toc-btn {
    right: 16px;
  }

  .menu-btn {
    left: 16px;
  }
}

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