:root {
  --font-display: "Inter", "Noto Sans SC", "Noto Sans JP", "Noto Sans KR", system-ui, sans-serif;
  --font-body: "Inter", "Noto Sans SC", "Noto Sans JP", "Noto Sans KR", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Consolas, monospace;

  --color-bg: #FFF7EC;
  --color-panel: #FFFCF7;
  --color-panel-muted: #F2ECE4;
  --color-border: #E8DDD1;
  --color-accent: #F29A52;
  --color-accent-dark: #C8682E;
  --color-text: #332E29;
  --color-muted: #756D65;
  --color-success: #4E8A69;
  --color-warn: #B8742D;
  --color-error: #B9574F;
  --color-white: #FFFFFF;
  --color-transparent: transparent;
  --color-glass: rgba(255, 252, 247, 0.82);
  --color-glass-strong: rgba(255, 255, 255, 0.91);
  --color-glass-soft: rgba(255, 255, 255, 0.58);
  --color-accent-soft: rgba(242, 154, 82, 0.15);
  --color-accent-medium: rgba(242, 154, 82, 0.28);
  --color-accent-glow: rgba(242, 154, 82, 0.38);
  --color-text-soft: rgba(51, 46, 41, 0.08);
  --color-text-shadow: rgba(51, 46, 41, 0.12);
  --color-text-shadow-deep: rgba(51, 46, 41, 0.18);
  --color-overlay: rgba(51, 46, 41, 0.42);
  --color-sun: rgba(255, 194, 128, 0.72);
  --color-apricot: rgba(242, 154, 82, 0.44);
  --color-cream: rgba(255, 237, 205, 0.74);
  --color-horizon: rgba(200, 104, 46, 0.12);
  --color-selected: #FFF4E9;
  --color-success-soft: rgba(78, 138, 105, 0.13);
  --color-warn-soft: rgba(184, 116, 45, 0.13);
  --color-error-soft: rgba(185, 87, 79, 0.13);
  --color-footer: #332E29;
  --color-footer-text: #FFF7EC;
  --color-footer-muted: #D7C9BB;
  --color-focus: rgba(200, 104, 46, 0.42);

  --radius-xs: 6px;
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --radius-pill: 999px;

  --shadow-nav: 0 1px 0 var(--color-glass-soft);
  --shadow-window: 0 34px 80px var(--color-text-shadow-deep), 0 8px 24px var(--color-text-shadow);
  --shadow-window-edge: 0 0 0 1px var(--color-glass-soft);
  --shadow-card: 0 10px 28px var(--color-text-soft);
  --shadow-card-high: 0 24px 58px var(--color-text-shadow);
  --shadow-button: 0 12px 26px var(--color-accent-glow);
  --shadow-taskbar: 0 16px 46px var(--color-text-shadow);

  --header-height: 76px;
  --content-width: 1320px;
  --reading-width: 820px;
  --gutter: clamp(16px, 4vw, 32px);
  --section-space: clamp(72px, 9vw, 128px);
  --toc-offset: 92px;
  --transition-fast: 180ms ease;
  --transition-slow: 540ms cubic-bezier(0.2, 0.72, 0.25, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  width: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: var(--toc-offset);
}

html.nav-open {
  overflow: hidden;
}

body {
  width: 100%;
  min-width: 0;
  min-height: 100%;
  margin: 0;
  overflow-x: clip;
  color: var(--color-text);
  background: var(--color-bg);
  font-family: var(--font-body);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

main,
header,
footer,
section,
article,
aside,
nav,
div,
li {
  min-width: 0;
}

img,
svg,
video,
canvas {
  display: block;
  max-width: 100%;
}

img {
  height: auto;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  color: inherit;
  font: inherit;
}

button,
summary {
  -webkit-tap-highlight-color: var(--color-transparent);
}

button {
  cursor: pointer;
}

:focus-visible {
  outline: 3px solid var(--color-focus);
  outline-offset: 3px;
}

::selection {
  color: var(--color-text);
  background: var(--color-accent-medium);
}

h1,
h2,
h3,
h4,
p,
ul,
ol,
blockquote,
figure {
  margin-top: 0;
}

h1,
h2,
h3,
h4 {
  color: var(--color-text);
  font-family: var(--font-display);
  text-wrap: balance;
}

h1,
.display-title {
  margin-bottom: 24px;
  font-size: clamp(48px, 6.2vw, 76px);
  font-weight: 320;
  line-height: 1.04;
  letter-spacing: -0.055em;
}

h2 {
  margin-bottom: 20px;
  font-size: clamp(31px, 4vw, 48px);
  font-weight: 420;
  line-height: 1.12;
  letter-spacing: -0.04em;
}

h3 {
  margin-bottom: 14px;
  font-size: clamp(21px, 2.4vw, 28px);
  font-weight: 650;
  line-height: 1.25;
  letter-spacing: -0.025em;
}

h4 {
  margin-bottom: 10px;
  font-size: 17px;
  font-weight: 720;
}

p {
  margin-bottom: 1.2em;
}

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

strong {
  font-weight: 720;
}

code,
kbd,
samp,
pre {
  font-family: var(--font-mono);
}

code {
  max-width: 100%;
  padding: 0.15em 0.38em;
  border-radius: var(--radius-xs);
  overflow-wrap: anywhere;
  color: var(--color-accent-dark);
  background: var(--color-accent-soft);
  font-size: 0.9em;
}

pre {
  max-width: 100%;
  margin: 24px 0;
  padding: 20px;
  overflow-x: auto;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-footer-text);
  background: var(--color-footer);
  line-height: 1.7;
  overscroll-behavior-inline: contain;
  -webkit-overflow-scrolling: touch;
}

pre code {
  padding: 0;
  color: inherit;
  background: var(--color-transparent);
  overflow-wrap: normal;
  white-space: pre;
}

table {
  border-spacing: 0;
  border-collapse: collapse;
}

.wrap {
  width: 100%;
  max-width: calc(var(--content-width) + (var(--gutter) * 2));
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.reading-wrap {
  width: 100%;
  max-width: calc(var(--reading-width) + (var(--gutter) * 2));
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.section {
  position: relative;
  overflow-x: clip;
  padding-top: var(--section-space);
  padding-bottom: var(--section-space);
}

.section-tight {
  padding-top: clamp(42px, 6vw, 72px);
  padding-bottom: clamp(42px, 6vw, 72px);
}

.section-muted {
  background: var(--color-panel-muted);
}

.section-heading {
  max-width: 760px;
  margin-bottom: clamp(32px, 5vw, 58px);
}

.section-heading p {
  max-width: 680px;
  margin-bottom: 0;
  color: var(--color-muted);
  font-size: 17px;
}

.eyebrow,
.badge,
.tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  overflow: hidden;
  border: 1px solid var(--color-accent-medium);
  border-radius: var(--radius-pill);
  color: var(--color-accent-dark);
  background: var(--color-glass);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.035em;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.eyebrow {
  padding: 9px 13px 9px 10px;
  box-shadow: 0 9px 22px var(--color-text-soft);
}

.badge,
.tag {
  padding: 7px 10px;
}

.badge-muted,
.tag-muted {
  color: var(--color-muted);
  border-color: var(--color-border);
  background: var(--color-panel);
}

.badge-success {
  color: var(--color-success);
  border-color: var(--color-success-soft);
  background: var(--color-success-soft);
}

.status-dot,
.eyebrow-dot {
  flex: 0 0 auto;
  width: 9px;
  height: 9px;
  border: 2px solid var(--color-white);
  border-radius: 50%;
  background: var(--color-accent);
  box-shadow: 0 0 0 3px var(--color-accent-soft);
}

.status-dot-success {
  background: var(--color-success);
  box-shadow: 0 0 0 3px var(--color-success-soft);
}

.text-accent {
  color: var(--color-accent-dark);
}

.title-accent {
  color: var(--color-accent-dark);
  font-weight: 470;
}

.title-brand {
  font-weight: 720;
}

.mono {
  font-family: var(--font-mono);
}

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

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 50px;
  padding: 0 23px;
  border: 1px solid var(--color-transparent);
  border-radius: var(--radius-pill);
  font-size: 15px;
  font-weight: 720;
  line-height: 1.2;
  text-align: center;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
}

.button svg {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
}

.button:hover {
  transform: translateY(-2px);
}

.button-primary {
  color: var(--color-white);
  background: linear-gradient(135deg, var(--color-accent), var(--color-accent-dark));
  box-shadow: var(--shadow-button);
}

.button-secondary {
  color: var(--color-text);
  border-color: var(--color-border);
  background: var(--color-glass-strong);
  box-shadow: 0 8px 24px var(--color-text-soft);
}

.button-quiet {
  min-height: 42px;
  color: var(--color-accent-dark);
  border-color: var(--color-accent-medium);
  background: var(--color-accent-soft);
}

.button[disabled],
.button.is-disabled {
  pointer-events: none;
  opacity: 0.5;
  transform: none;
  box-shadow: none;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.panel,
.card {
  min-width: 0;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-panel);
  box-shadow: var(--shadow-card);
}

.panel {
  padding: clamp(22px, 4vw, 38px);
}

.card {
  padding: 24px;
}

.tilt-card {
  transform: rotate(-0.45deg);
  transform-origin: center;
}

.site-header {
  position: relative;
  z-index: 80;
  height: var(--header-height);
  border-bottom: 1px solid var(--color-glass-soft);
  background: var(--color-glass-soft);
  box-shadow: var(--shadow-nav);
  backdrop-filter: blur(20px) saturate(120%);
}

.site-header-inner {
  display: flex;
  align-items: center;
  width: 100%;
  max-width: calc(var(--content-width) + (var(--gutter) * 2));
  height: 100%;
  margin-inline: auto;
  padding-inline: var(--gutter);
  gap: 18px;
}

.site-brand {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 10px;
  margin-right: auto;
}

.site-brand-logo {
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  border-radius: var(--radius-md);
  box-shadow: 0 8px 18px var(--color-accent-medium);
}

.site-brand-word {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 760;
  letter-spacing: -0.03em;
}

.site-brand-cn {
  margin-left: 3px;
  color: var(--color-muted);
  font-size: 13px;
  font-weight: 520;
  letter-spacing: 0.02em;
}

.desktop-nav {
  display: flex;
  align-items: center;
  gap: 2px;
  white-space: nowrap;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 38px;
  padding-inline: 8px;
  border-radius: var(--radius-sm);
  color: var(--color-muted);
  font-size: 13px;
  font-weight: 560;
  transition: color var(--transition-fast), background var(--transition-fast);
}

.nav-link svg {
  flex: 0 0 auto;
  width: 15px;
  height: 15px;
  stroke-width: 1.7;
}

.nav-link:hover,
.nav-link[aria-current="page"] {
  color: var(--color-text);
  background: var(--color-glass-strong);
}

.header-tools {
  position: relative;
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
}

.nav-login {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding-inline: 18px;
  border: 1px solid var(--color-accent-medium);
  border-radius: var(--radius-pill);
  color: var(--color-accent-dark);
  background: var(--color-glass-strong);
  box-shadow: 0 8px 20px var(--color-text-soft);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.language-control {
  position: relative;
}

.language-button,
.menu-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  color: var(--color-muted);
  background: var(--color-glass);
}

.language-button {
  gap: 7px;
  padding-inline: 12px;
  font-size: 12px;
  white-space: nowrap;
}

.language-button svg {
  width: 14px;
  height: 14px;
}

.language-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  display: none;
  width: 180px;
  padding: 7px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-panel);
  box-shadow: var(--shadow-card-high);
}

.language-control.is-open .language-menu {
  display: grid;
}

.language-menu a {
  display: flex;
  align-items: center;
  min-height: 42px;
  padding-inline: 12px;
  border-radius: var(--radius-sm);
  color: var(--color-muted);
  font-size: 13px;
}

.language-menu a:hover,
.language-menu a[aria-current="true"] {
  color: var(--color-text);
  background: var(--color-selected);
}

.menu-toggle {
  display: none;
  width: 44px;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
}

.menu-toggle-lines,
.menu-toggle-lines::before,
.menu-toggle-lines::after {
  width: 18px;
  height: 2px;
  border-radius: var(--radius-pill);
  background: var(--color-text);
  transition: transform var(--transition-fast), opacity var(--transition-fast);
}

.menu-toggle-lines {
  position: relative;
}

.menu-toggle-lines::before,
.menu-toggle-lines::after {
  position: absolute;
  left: 0;
  content: "";
}

.menu-toggle-lines::before {
  top: -6px;
}

.menu-toggle-lines::after {
  top: 6px;
}

.menu-toggle[aria-expanded="true"] .menu-toggle-lines {
  background: var(--color-transparent);
}

.menu-toggle[aria-expanded="true"] .menu-toggle-lines::before {
  top: 0;
  transform: rotate(45deg);
}

.menu-toggle[aria-expanded="true"] .menu-toggle-lines::after {
  top: 0;
  transform: rotate(-45deg);
}

.mobile-drawer {
  position: fixed;
  top: var(--header-height);
  right: 0;
  left: 0;
  z-index: 82;
  display: none;
  max-height: calc(100dvh - var(--header-height));
  padding: 12px var(--gutter) 22px;
  overflow-y: auto;
  border-top: 1px solid var(--color-border);
  background: var(--color-panel);
  box-shadow: var(--shadow-card-high);
  overscroll-behavior: contain;
}

.mobile-drawer.is-open {
  display: block;
}

.mobile-drawer-list,
.mobile-language-list {
  display: grid;
  margin: 0;
  padding: 0;
  list-style: none;
}

.mobile-drawer a {
  display: flex;
  width: 100%;
  min-height: 48px;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--color-muted);
  font-size: 15px;
  font-weight: 620;
}

.mobile-drawer a svg {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
}

.mobile-drawer a:hover,
.mobile-drawer a[aria-current="page"],
.mobile-drawer a[aria-current="true"] {
  color: var(--color-text);
  background: var(--color-selected);
}

.mobile-language-title {
  margin: 14px 12px 4px;
  color: var(--color-muted);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.mobile-language-list {
  border-top: 1px solid var(--color-border);
  padding-top: 8px;
}

.nav-veil {
  position: fixed;
  inset: var(--header-height) 0 0;
  z-index: 70;
  display: none;
  border: 0;
  background: var(--color-overlay);
}

.nav-veil.is-open {
  display: block;
}

.site-footer {
  position: relative;
  overflow-x: clip;
  color: var(--color-footer-text);
  background: var(--color-footer);
}

.footer-main {
  display: grid;
  grid-template-columns: minmax(240px, 1.25fr) repeat(3, minmax(150px, 1fr));
  gap: clamp(28px, 5vw, 70px);
  padding-top: 72px;
  padding-bottom: 54px;
}

.footer-brand {
  max-width: 340px;
}

.footer-brand-line {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  margin-bottom: 18px;
}

.footer-brand-line img {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
}

.footer-brand-name {
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 760;
}

.footer-brand p {
  color: var(--color-footer-muted);
  font-size: 14px;
  line-height: 1.8;
}

.footer-column h2 {
  margin-bottom: 18px;
  color: var(--color-footer-text);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.footer-links {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.footer-links a {
  color: var(--color-footer-muted);
  font-size: 14px;
  transition: color var(--transition-fast);
}

.footer-links a:hover {
  color: var(--color-footer-text);
}

.footer-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 76px;
  border-top: 1px solid var(--color-text-shadow-deep);
  color: var(--color-footer-muted);
  font-size: 12px;
}

.footer-legal {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
}

.prose {
  color: var(--color-text);
  font-size: 17px;
  line-height: 1.86;
}

.prose > * {
  max-width: 100%;
}

.prose h2 {
  margin-top: 2.2em;
  scroll-margin-top: var(--toc-offset);
}

.prose h3 {
  margin-top: 1.8em;
  scroll-margin-top: var(--toc-offset);
}

.prose a:not(.button) {
  color: var(--color-accent-dark);
  text-decoration: underline;
  text-decoration-color: var(--color-accent-medium);
  text-underline-offset: 0.2em;
}

.prose ul,
.prose ol {
  padding-left: 1.4em;
}

.prose li {
  margin-bottom: 0.55em;
}

.prose img {
  border-radius: var(--radius-lg);
}

.reveal {
  transition: opacity var(--transition-slow), transform var(--transition-slow);
}

.reveal.pending {
  opacity: 0;
  transform: translateY(16px);
}

.reveal.shown {
  opacity: 1;
  transform: none;
}

body:has(.toc-tabs) section[id],
body:has(.toc-tabs) h2[id],
body:has(.toc-tabs) h3[id] {
  scroll-margin-top: var(--toc-offset);
}

.toc-shell-release {
  display: contents;
}

@media (max-width: 1180px) {
  .desktop-nav {
    display: none;
  }

  .header-tools {
    margin-left: auto;
  }

  .menu-toggle {
    display: inline-flex;
  }
}

@media (max-width: 760px) {
  :root {
    --header-height: 68px;
    --toc-offset: 82px;
  }

  h1,
  .display-title {
    font-size: clamp(42px, 13vw, 58px);
  }

  h2 {
    font-size: clamp(29px, 9vw, 40px);
  }

  .footer-main {
    grid-template-columns: 1fr 1fr;
  }

  .footer-brand {
    grid-column: 1 / -1;
  }

  .footer-bottom {
    align-items: flex-start;
    flex-direction: column;
    justify-content: center;
    padding-top: 22px;
    padding-bottom: 22px;
  }
}

@media (max-width: 640px) {
  .tilt-card,
  [class*="tilt"] {
    transform: none;
  }

  .site-header-inner {
    gap: 8px;
  }

  .site-brand {
    gap: 8px;
  }

  .site-brand-logo {
    width: 36px;
    height: 36px;
  }

  .site-brand-word {
    font-size: 17px;
  }

  .site-brand-cn {
    display: none;
  }

  .language-control {
    display: none;
  }

  .nav-login {
    min-height: 40px;
    padding-inline: 14px;
  }

  .header-tools {
    margin-left: auto;
  }

  .button-row {
    align-items: stretch;
    flex-direction: column;
  }

  .button-row .button {
    width: 100%;
  }

  .panel,
  .card {
    padding: 20px;
  }

  .footer-main {
    grid-template-columns: 1fr;
  }

  .footer-brand {
    grid-column: auto;
  }

  .prose {
    font-size: 16px;
    line-height: 1.78;
  }
}

@media (max-width: 380px) {
  .nav-login {
    padding-inline: 11px;
    font-size: 12px;
  }

  .site-brand-logo {
    width: 34px;
    height: 34px;
  }
}

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

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

  .reveal,
  .reveal.pending {
    opacity: 1;
    transform: none;
  }
}