:root {
  color-scheme: light;
  --ink: #222220;
  --muted: #6f706d;
  --subtle: #969792;
  --line: #e8e8e4;
  --line-strong: #d9dad5;
  --soft: #f7f7f4;
  --page: #ffffff;
  --accent: #f54457;
  --link: #2f6fca;
  --radius: 10px;
  --radius-lg: 16px;
  --page-width: 940px;
  --shadow-sm: 0 1px 2px rgb(25 25 25 / 4%);
  --shadow-md: 0 12px 30px rgb(25 25 25 / 9%);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 76px;
}

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 16px;
  line-height: 1.72;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body::selection {
  background: rgb(245 68 87 / 16%);
}

a {
  color: inherit;
}

button,
input {
  font: inherit;
}

[hidden] {
  display: none !important;
}

:focus-visible {
  outline: 3px solid rgb(47 111 202 / 30%);
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  top: 8px;
  left: 12px;
  z-index: 100;
  padding: 8px 13px;
  border-radius: 7px;
  background: #20201e;
  color: #fff;
  font-size: 13px;
  text-decoration: none;
  transform: translateY(-150%);
  transition: transform 150ms ease;
}

.skip-link:focus {
  transform: translateY(0);
}

.reading-progress {
  position: fixed;
  inset: 0 0 auto;
  z-index: 80;
  height: 2px;
  pointer-events: none;
}

.reading-progress span {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  will-change: transform;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 56px;
  padding: 8px max(20px, calc((100vw - 1180px) / 2));
  border-bottom: 1px solid rgb(0 0 0 / 6%);
  background: rgb(255 255 255 / 91%);
  box-shadow: 0 1px 10px rgb(0 0 0 / 2%);
  backdrop-filter: blur(18px) saturate(1.4);
}

.brand {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
  color: #333330;
  font-size: 14px;
  font-weight: 680;
  letter-spacing: -0.01em;
  text-decoration: none;
}

.brand img {
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  border-radius: 7px;
  object-fit: cover;
}

.topnav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.topnav a,
.copy-link {
  min-height: 34px;
  padding: 6px 10px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #666762;
  cursor: pointer;
  font-size: 13px;
  text-decoration: none;
  transition: background-color 140ms ease, color 140ms ease;
}

.topnav a:hover,
.copy-link:hover,
.topnav a[aria-current] {
  background: var(--soft);
  color: #222220;
}

.hero-cover {
  width: 100%;
  height: clamp(230px, 32vw, 390px);
  background-color: #ecece8;
  background-position: center;
  background-size: cover;
}

.page {
  width: min(calc(100% - 40px), var(--page-width));
  margin: 0 auto;
  padding: 0 0 112px;
}

.detail-page {
  --page-width: 860px;
}

.page-head {
  position: relative;
  padding-top: 58px;
}

.page-head.has-cover {
  padding-top: 74px;
}

.page-icon {
  display: block;
  width: 92px;
  height: 92px;
  margin-bottom: 18px;
  border-radius: 18px;
  background: #fff;
  object-fit: cover;
  box-shadow: var(--shadow-sm);
}

.page-head.has-cover .page-icon {
  position: absolute;
  top: -48px;
  left: 0;
  width: 96px;
  height: 96px;
  margin: 0;
  border: 5px solid #fff;
  box-shadow: 0 3px 14px rgb(25 25 25 / 10%);
}

.page-emoji {
  display: block;
  margin-bottom: 17px;
  font-size: 62px;
  line-height: 1;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0 0 9px;
  color: #888984;
  font-size: 11px;
  font-weight: 720;
  letter-spacing: 0.12em;
  line-height: 1.4;
  text-transform: uppercase;
}

.eyebrow a {
  text-underline-offset: 3px;
}

.page-title {
  max-width: 840px;
  margin: 0;
  color: #20201e;
  font-family: "Songti SC", "STSong", "Noto Serif CJK SC", serif;
  font-size: clamp(36px, 5vw, 58px);
  font-weight: 750;
  letter-spacing: -0.04em;
  line-height: 1.22;
  text-wrap: balance;
  white-space: pre-line;
}

.detail-page .page-title {
  font-size: clamp(34px, 4.4vw, 52px);
}

.page-subtitle {
  max-width: 620px;
  margin: 17px 0 0;
  color: var(--muted);
  font-size: 15px;
}

.resource-search {
  margin: 42px 0 0;
}

.resource-search > label {
  display: block;
  margin-bottom: 8px;
  color: #555651;
  font-size: 13px;
  font-weight: 650;
}

.search-control {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  background: #fff;
  box-shadow: var(--shadow-sm);
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

.search-control:focus-within {
  border-color: #a8bee0;
  box-shadow: 0 0 0 3px rgb(47 111 202 / 10%);
}

.search-control > span {
  color: #7e7f7a;
  font-size: 23px;
  line-height: 1;
  transform: rotate(-15deg);
}

.search-control input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 15px;
}

.search-control input::placeholder {
  color: #a1a29e;
}

.search-control small {
  color: #8a8b86;
  font-size: 12px;
  white-space: nowrap;
}

.search-empty {
  margin: 18px 0 0;
  padding: 20px;
  border-radius: 10px;
  background: var(--soft);
  color: var(--muted);
  font-size: 14px;
  text-align: center;
}

.content {
  margin-top: 42px;
  counter-reset: numbered;
}

.detail-page .content {
  max-width: 780px;
}

.block {
  margin: 7px 0;
}

.text-block {
  margin: 6px 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.text-spacer {
  min-height: 13px;
}

.text-block a,
.heading-block a,
.list-copy a,
td a,
th a {
  color: var(--link);
  text-decoration-color: rgb(47 111 202 / 40%);
  text-underline-offset: 3px;
}

.heading-block {
  margin: 26px 0 9px;
  font-weight: 730;
  letter-spacing: -0.012em;
  line-height: 1.42;
  white-space: pre-wrap;
}

.heading-level-1 {
  margin-top: 38px;
  font-size: 28px;
}

.heading-level-2 {
  font-size: 23px;
}

.heading-level-3 {
  font-size: 20px;
}

.heading-level-4 {
  font-size: 17px;
}

.toggle-section {
  margin: 42px 0 30px;
}

.toggle-title {
  margin: 0 0 17px;
  font-size: 26px;
  font-weight: 760;
  letter-spacing: -0.02em;
  line-height: 1.4;
  text-wrap: balance;
  white-space: pre-wrap;
}

.toggle-section.centered > .toggle-title {
  text-align: center;
}

.toggle-children {
  min-width: 0;
}

.columns {
  display: grid;
  grid-template-columns: repeat(var(--columns, 3), minmax(0, 1fr));
  gap: 14px;
  align-items: start;
}

.column {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 10px;
}

.column > .toggle-section {
  margin: 0;
  padding: 2px 0 10px;
}

.column > .toggle-section > .toggle-title {
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
  color: #555651;
  font-size: 16px;
}

.page-card {
  display: flex;
  min-height: 74px;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card-tint, #fff);
  color: #292927;
  text-decoration: none;
  box-shadow: var(--shadow-sm);
  transition: border-color 150ms ease, background-color 150ms ease, transform 150ms ease, box-shadow 150ms ease;
}

.page-card:hover {
  border-color: var(--line-strong);
  background: color-mix(in srgb, var(--card-tint, #fff) 85%, #fafaf8);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.page-card:active {
  box-shadow: var(--shadow-sm);
  transform: translateY(0) scale(0.99);
}

.card-icon {
  display: grid;
  width: 46px;
  height: 46px;
  flex: 0 0 auto;
  place-items: center;
  overflow: hidden;
  border-radius: 10px;
  background: #f0f0ed;
  color: #858680;
  font-size: 25px;
}

.card-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card-copy {
  min-width: 0;
  flex: 1;
}

.card-title {
  display: block;
  font-size: 15px;
  font-weight: 660;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.card-caption {
  display: -webkit-box;
  margin-top: 4px;
  overflow: hidden;
  color: #797a75;
  font-size: 12px;
  line-height: 1.4;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.card-arrow {
  flex: 0 0 auto;
  color: #b1b2ad;
  font-size: 23px;
  line-height: 1;
  opacity: 0;
  transform: translateX(-4px);
  transition: opacity 150ms ease, transform 150ms ease;
}

.page-card:hover .card-arrow,
.page-card:focus-visible .card-arrow {
  opacity: 1;
  transform: translateX(0);
}

.list-item {
  position: relative;
  padding-left: 27px;
}

.list-item::before {
  position: absolute;
  top: 0;
  left: 3px;
  width: 18px;
  color: #5f605c;
  font-variant-numeric: tabular-nums;
}

.list-item.bulleted::before {
  content: "•";
  font-size: 19px;
}

.list-item.numbered {
  counter-increment: numbered;
}

.list-item.numbered::before {
  content: counter(numbered) ".";
  font-size: 14px;
}

.list-item .list-item {
  margin-left: 12px;
}

.image-block {
  margin: 22px 0;
}

.image-block img,
.image-block video {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  margin: 0 auto;
  border-radius: 8px;
}

.image-block video {
  max-height: min(78vh, 780px);
  background: #111;
}

.image-block figcaption {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.image-placeholder {
  position: relative;
  min-height: 190px;
  overflow: hidden;
  border-radius: 8px;
  background: linear-gradient(90deg, #f2f2ef, #fafaf8, #f2f2ef);
  background-size: 200% 100%;
  animation: shimmer 1.45s infinite;
}

.image-placeholder.is-ready {
  min-height: 0;
  background: transparent;
  animation: none;
}

.asset-error-message {
  display: none;
}

.image-placeholder.has-error {
  display: grid;
  min-height: 140px;
  place-items: center;
  background: var(--soft);
  animation: none;
}

.image-placeholder.has-error img,
.image-placeholder.has-error video {
  display: none;
}

.image-placeholder.has-error .asset-error-message {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.simple-link,
.link-preview {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 12px 0;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  text-decoration: none;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

.simple-link:hover,
.link-preview:hover {
  border-color: var(--line-strong);
  box-shadow: 0 6px 20px rgb(25 25 25 / 7%);
}

.simple-link > span {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.simple-link strong {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  font-size: 14px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.simple-link i,
.link-preview > i {
  color: #979892;
  font-style: normal;
}

.link-preview-copy {
  display: flex;
  min-width: 0;
  flex: 1;
  flex-direction: column;
}

.link-preview-copy strong {
  font-size: 15px;
  line-height: 1.45;
}

.link-preview-copy small {
  display: -webkit-box;
  margin-top: 4px;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.link-preview-copy em {
  margin-top: 7px;
  overflow: hidden;
  color: #9a9b96;
  font-size: 11px;
  font-style: normal;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.table-scroll {
  max-width: 100%;
  margin: 18px 0 26px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  overscroll-behavior-inline: contain;
}

.table-scroll:focus-visible {
  outline-offset: 2px;
}

table {
  width: 100%;
  min-width: 560px;
  border-collapse: collapse;
  font-size: 14px;
}

th,
td {
  padding: 11px 13px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  overflow-wrap: anywhere;
}

th {
  background: var(--soft);
  color: #474844;
  font-weight: 680;
}

tr:last-child > * {
  border-bottom: 0;
}

tr > *:last-child {
  border-right: 0;
}

.mindmap {
  margin: 28px 0;
  padding: 20px;
  border: 1px solid var(--line);
  border-left: 4px solid #a8aaa4;
  border-radius: 10px;
  background: #fafaf8;
}

.mindmap > h2 {
  margin: 0 0 14px;
  font-size: 20px;
}

.mindmap-tree {
  padding-left: 15px;
  border-left: 1px solid #d8d9d4;
}

.muted-note {
  margin: 34px 0 0;
  color: #777873;
  font-size: 14px;
}

.error-state {
  width: min(calc(100% - 40px), 620px);
  margin: 14vh auto;
  padding: 40px 32px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  text-align: center;
  box-shadow: var(--shadow-sm);
}

.error-state > span {
  display: grid;
  width: 42px;
  height: 42px;
  margin: 0 auto 14px;
  place-items: center;
  border-radius: 50%;
  background: #fff0f1;
  color: var(--accent);
  font-weight: 800;
}

.error-state h1 {
  margin: 0 0 10px;
  font-size: 24px;
}

.error-state p {
  margin: 0 0 22px;
  color: var(--muted);
}

.error-state div {
  display: flex;
  justify-content: center;
  gap: 8px;
}

.error-state a,
.error-state button {
  display: inline-block;
  padding: 9px 16px;
  border: 1px solid #222220;
  border-radius: 8px;
  background: #222220;
  color: #fff;
  cursor: pointer;
  font-size: 14px;
  text-decoration: none;
}

.error-state a {
  border-color: var(--line-strong);
  background: #fff;
  color: #333330;
}

.back-to-top {
  position: fixed;
  right: 22px;
  bottom: 24px;
  z-index: 25;
  display: grid;
  width: 40px;
  height: 40px;
  padding: 0;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: rgb(255 255 255 / 94%);
  box-shadow: 0 8px 24px rgb(25 25 25 / 12%);
  color: #454641;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 150ms ease, transform 150ms ease;
}

.back-to-top.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.noscript {
  padding: 40px;
  text-align: center;
}

.loading-cover {
  height: clamp(230px, 32vw, 390px);
  background: #f2f2ef;
}

.loading-page {
  width: min(calc(100% - 40px), var(--page-width));
  margin: 0 auto;
  padding-top: 32px;
}

.loading-icon,
.loading-line {
  background: linear-gradient(90deg, #f0f0ed, #fafaf8, #f0f0ed);
  background-size: 200% 100%;
  animation: shimmer 1.45s infinite;
}

.loading-icon {
  width: 96px;
  height: 96px;
  margin-top: -80px;
  border: 5px solid #fff;
  border-radius: 18px;
}

.loading-line {
  width: 68%;
  height: 18px;
  margin-top: 16px;
  border-radius: 4px;
}

.loading-title {
  width: 76%;
  height: 54px;
  margin-top: 26px;
}

.loading-short {
  width: 42%;
}

@keyframes shimmer {
  to {
    background-position: -200% 0;
  }
}

@media (max-width: 800px) {
  .columns {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .home-page .column {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .home-page .column > .toggle-section,
  .home-page .column > .text-block {
    grid-column: 1 / -1;
  }
}

@media (max-width: 560px) {
  body {
    font-size: 15px;
  }

  .topbar {
    min-height: 52px;
    padding: 7px 12px;
  }

  .brand {
    gap: 8px;
  }

  .brand span {
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .topnav a[href="#page-content"] {
    display: none;
  }

  .topnav a,
  .copy-link {
    padding-inline: 8px;
  }

  .hero-cover,
  .loading-cover {
    height: 205px;
  }

  .page {
    width: min(calc(100% - 28px), var(--page-width));
    padding-bottom: 78px;
  }

  .page-head,
  .page-head.has-cover {
    padding-top: 54px;
  }

  .page-head.has-cover .page-icon {
    top: -39px;
    width: 80px;
    height: 80px;
    border-width: 4px;
    border-radius: 15px;
  }

  .page-icon {
    width: 74px;
    height: 74px;
    border-radius: 14px;
  }

  .page-emoji {
    font-size: 52px;
  }

  .page-title,
  .detail-page .page-title {
    font-size: 34px;
    letter-spacing: -0.035em;
    line-height: 1.26;
  }

  .page-subtitle {
    font-size: 14px;
  }

  .resource-search {
    margin-top: 34px;
  }

  .search-control {
    padding-inline: 12px;
  }

  .search-control small {
    display: none;
  }

  .content {
    margin-top: 34px;
  }

  .toggle-section {
    margin: 34px 0 26px;
  }

  .toggle-title {
    font-size: 22px;
  }

  .home-page .column {
    grid-template-columns: 1fr;
  }

  .page-card {
    min-height: 70px;
  }

  .card-arrow {
    display: none;
  }

  .image-placeholder {
    min-height: 140px;
  }

  .simple-link > span {
    display: none;
  }

  .back-to-top {
    right: 14px;
    bottom: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}

@media print {
  .topbar,
  .reading-progress,
  .resource-search,
  .back-to-top {
    display: none !important;
  }

  .page {
    width: 100%;
    padding-bottom: 0;
  }

  .hero-cover {
    height: 220px;
  }

  a {
    text-decoration: none;
  }
}
