:root {
  --color-page: #FAF5EB;
  --color-panel: #FFFCF4;
  --color-panel-soft: #F2EADA;
  --color-line: #E4D9C4;
  --color-brand: #26304D;
  --color-brand-deep: #171E33;
  --color-text: #2A2417;
  --color-muted: #6F6656;
  --color-success: #3E7C4F;
  --color-warning: #DC9A1F;
  --color-warning-deep: #B87A12;
  --color-error: #B0402F;
  --color-rose: #D57A8D;
  --color-flag-red: #C43A2E;
  --color-flag-blue: #31518F;
  --color-flag-white: #FFFDF8;
  --color-flag-black: #2E2A26;
  --color-flag-gold: #E3B33A;
  --color-paper-alpha: rgba(255, 252, 244, .86);
  --color-paper-glass: rgba(255, 252, 244, .68);
  --color-brand-faint: rgba(38, 48, 77, .07);
  --color-success-faint: rgba(62, 124, 79, .12);
  --color-warning-faint: rgba(220, 154, 31, .10);
  --color-warning-line: rgba(220, 154, 31, .50);
  --color-shadow-soft: rgba(38, 48, 77, .08);
  --color-shadow-deep: rgba(38, 48, 77, .22);
  --color-veil: rgba(23, 30, 51, .42);
  --color-flag-edge: rgba(42, 36, 23, .16);
  --color-glow-amber: rgba(220, 154, 31, .42);
  --color-glow-rose: rgba(213, 122, 141, .36);
  --color-glow-cream: rgba(255, 252, 244, .92);
  --font-display: 'Inter', 'Noto Sans SC', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --font-body: 'Inter', 'Noto Sans SC', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  --font-mono: 'JetBrains Mono', 'SFMono-Regular', Consolas, 'Liberation Mono', monospace;
  --radius-small: 8px;
  --radius-medium: 12px;
  --radius-large: 18px;
  --radius-pill: 999px;
  --shadow-panel: 0 2px 6px var(--color-shadow-soft), 0 28px 52px -20px var(--color-shadow-deep);
  --shadow-float: 0 2px 6px var(--color-shadow-soft), 0 18px 36px -14px var(--color-shadow-deep);
  --header-height: 64px;
  --gutter: clamp(16px, 3vw, 32px);
  --content-width: 1240px;
  --reading-width: 780px;
  --section-space: clamp(64px, 9vw, 112px);
  --focus-ring: 2px solid var(--color-warning);
  --toc-offset: 126px;
  --motion-fast: 150ms;
  --motion-normal: 420ms;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-height) + 16px);
  -webkit-text-size-adjust: 100%;
}

html.nav-open {
  overflow: hidden;
}

body {
  min-width: 320px;
  margin: 0;
  overflow-x: clip;
  color: var(--color-text);
  background: var(--color-page);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.75;
  text-rendering: optimizeLegibility;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  content: "";
  pointer-events: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix type='saturate' values='0'/></filter><rect width='160' height='160' filter='url(%23n)' opacity='.05'/></svg>");
  background-size: 160px 160px;
}

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

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

img {
  height: auto;
}

svg {
  flex-shrink: 0;
}

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

button,
summary,
[role="tab"],
a {
  -webkit-tap-highlight-color: transparent;
}

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

p a,
.prose li a {
  color: var(--color-brand);
  text-decoration: underline;
  text-decoration-color: var(--color-warning);
  text-underline-offset: .18em;
}

ul,
ol {
  margin: 0;
  padding: 0;
}

nav ul {
  list-style: none;
}

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

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

h1 {
  margin-bottom: 24px;
  font-size: clamp(52px, 5.3vw, 72px);
  font-weight: 900;
  letter-spacing: -.018em;
}

h2 {
  margin-bottom: 18px;
  font-size: clamp(32px, 4vw, 48px);
  font-weight: 850;
  letter-spacing: -.012em;
}

h3 {
  margin-bottom: 12px;
  font-size: clamp(21px, 2.4vw, 28px);
  font-weight: 800;
}

h4 {
  margin-bottom: 8px;
  font-size: 18px;
  font-weight: 750;
}

p {
  margin-bottom: 1.15em;
}

strong {
  font-weight: 750;
}

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

code {
  overflow-wrap: anywhere;
}

pre {
  max-width: 100%;
  overflow-x: auto;
  padding: 20px;
  border: 1px solid var(--color-line);
  border-radius: var(--radius-small);
  background: var(--color-brand-deep);
  color: var(--color-panel);
  -webkit-overflow-scrolling: touch;
}

pre code {
  overflow-wrap: normal;
}

::selection {
  color: var(--color-brand-deep);
  background: var(--color-warning-faint);
}

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

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

.reading {
  width: 100%;
  max-width: var(--reading-width);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.section {
  padding-top: var(--section-space);
  padding-bottom: var(--section-space);
}

.section-soft {
  border-block: 1px solid var(--color-line);
  background: var(--color-panel);
}

.no-break {
  white-space: nowrap;
}

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

.highlight-text {
  color: transparent;
  background: linear-gradient(94deg, var(--color-warning), var(--color-warning-deep));
  background-clip: text;
  -webkit-background-clip: text;
}

.eyebrow,
.badge,
.tag {
  display: inline-flex;
  min-height: 28px;
  max-width: 100%;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--color-line);
  border-radius: var(--radius-pill);
  background: var(--color-panel);
  color: var(--color-muted);
  font-size: 13px;
  line-height: 1.35;
}

.eyebrow {
  padding: 5px 15px 5px 10px;
}

.badge,
.tag {
  padding: 4px 11px;
  overflow: hidden;
}

.badge-warning,
.tag-warning {
  border-color: var(--color-warning-line);
  background: var(--color-warning-faint);
  color: var(--color-warning-deep);
}

.status-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 8px;
  border-radius: 50%;
  background: var(--color-success);
  box-shadow: 0 0 0 3px var(--color-success-faint);
}

.button,
.btn {
  display: inline-flex;
  min-height: 48px;
  min-width: 24px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 30px;
  border: 1px solid transparent;
  border-radius: var(--radius-small);
  cursor: pointer;
  font-weight: 750;
  line-height: 1.3;
  text-align: center;
  transition: color var(--motion-fast), background var(--motion-fast), border-color var(--motion-fast), transform var(--motion-fast), box-shadow var(--motion-fast);
}

.button-primary,
.btn-solid {
  color: var(--color-panel);
  background: var(--color-brand);
  box-shadow: 0 2px 5px var(--color-shadow-soft), 0 14px 26px -12px var(--color-shadow-deep);
}

.button-primary:hover,
.btn-solid:hover {
  background: var(--color-brand-deep);
  transform: translateY(-1px);
}

.button-secondary,
.btn-line {
  border-color: var(--color-line);
  color: var(--color-brand);
  background: transparent;
}

.button-secondary:hover,
.btn-line:hover {
  border-color: var(--color-brand);
  background: var(--color-panel);
}

.button-muted {
  border-color: var(--color-line);
  background: var(--color-panel-soft);
  color: var(--color-muted);
}

.button[disabled],
.btn[disabled] {
  cursor: not-allowed;
  opacity: .58;
  transform: none;
}

.button-small {
  min-height: 38px;
  padding: 7px 16px;
  font-size: 14px;
}

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

.panel,
.card {
  border: 1px solid var(--color-line);
  border-radius: var(--radius-medium);
  background: var(--color-panel);
  box-shadow: 0 1px 2px var(--color-shadow-soft);
}

.panel-raised,
.card:hover {
  box-shadow: var(--shadow-float);
}

.site-head {
  position: relative;
  z-index: 80;
  border-bottom: 1px solid var(--color-line);
  background: var(--color-page);
}

.head-inner {
  display: flex;
  min-height: var(--header-height);
  align-items: center;
  gap: 28px;
}

.brand {
  display: inline-flex;
  min-height: 44px;
  flex: 0 0 auto;
  align-items: center;
  gap: 10px;
}

.brand img {
  width: 34px;
  height: 34px;
}

.brand-name {
  color: var(--color-brand);
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 850;
  letter-spacing: .01em;
}

.brand-local {
  color: var(--color-muted);
  font-size: 14px;
  font-weight: 550;
}

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

.desktop-nav > a,
.more-button {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border: 0;
  border-radius: var(--radius-small);
  color: var(--color-muted);
  background: transparent;
  cursor: pointer;
  font-size: 14px;
}

.desktop-nav > a:hover,
.desktop-nav > a.is-active,
.more-button:hover,
.nav-more.is-active > .more-button {
  color: var(--color-brand);
  background: var(--color-panel-soft);
}

.desktop-nav > a.is-active,
.nav-more.is-active > .more-button {
  font-weight: 700;
}

.nav-more,
.language-menu {
  position: relative;
}

.more-panel,
.language-panel {
  position: absolute;
  top: calc(100% + 7px);
  z-index: 95;
  min-width: 180px;
  padding: 7px;
  border: 1px solid var(--color-line);
  border-radius: var(--radius-medium);
  visibility: hidden;
  opacity: 0;
  background: var(--color-panel);
  box-shadow: var(--shadow-float);
  transform: translateY(6px);
  transition: opacity var(--motion-fast), visibility var(--motion-fast), transform var(--motion-fast);
}

.more-panel {
  left: 0;
}

.language-panel {
  right: 0;
}

.nav-more:hover .more-panel,
.nav-more:focus-within .more-panel,
.language-menu.is-open .language-panel {
  visibility: visible;
  opacity: 1;
  transform: translateY(0);
}

.more-panel a,
.language-panel a {
  display: flex;
  min-height: 42px;
  align-items: center;
  padding: 8px 12px;
  border-radius: var(--radius-small);
  color: var(--color-muted);
  font-size: 14px;
}

.more-panel a:hover,
.language-panel a:hover,
.language-panel a[aria-current="true"] {
  color: var(--color-brand);
  background: var(--color-panel-soft);
}

.head-tools {
  display: flex;
  margin-left: auto;
  align-items: center;
  gap: 10px;
}

.language-button,
.menu-toggle {
  display: inline-flex;
  min-width: 44px;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 9px;
  border: 0;
  border-radius: var(--radius-small);
  color: var(--color-muted);
  background: transparent;
  cursor: pointer;
  font-size: 14px;
}

.language-button:hover,
.menu-toggle:hover {
  color: var(--color-brand);
  background: var(--color-panel-soft);
}

.login-button {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  padding: 8px 21px;
  border-radius: var(--radius-small);
  color: var(--color-panel);
  background: var(--color-brand);
  font-size: 14px;
  font-weight: 700;
}

.login-button:hover {
  background: var(--color-brand-deep);
}

.menu-toggle {
  display: none;
}

.menu-toggle-lines,
.menu-toggle-lines::before,
.menu-toggle-lines::after {
  width: 20px;
  height: 2px;
  border-radius: var(--radius-pill);
  background: currentColor;
}

.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;
}

.mobile-drawer {
  display: none;
}

.drawer-veil {
  display: none;
}

.site-footer {
  position: relative;
  z-index: 2;
  border-top: 1px solid var(--color-line);
  background: var(--color-panel-soft);
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.3fr 1fr 1fr .85fr;
  gap: 42px;
  padding-top: 64px;
  padding-bottom: 48px;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  color: var(--color-brand);
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 850;
}

.footer-brand img {
  width: 36px;
  height: 36px;
}

.footer-intro {
  max-width: 32em;
  color: var(--color-muted);
  font-size: 14px;
}

.footer-column h2 {
  margin-bottom: 15px;
  font-size: 15px;
  letter-spacing: .02em;
}

.footer-links {
  display: grid;
  gap: 5px;
  list-style: none;
}

.footer-links a {
  display: inline-flex;
  min-height: 32px;
  align-items: center;
  color: var(--color-muted);
  font-size: 14px;
}

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

.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 14px 24px;
  padding-top: 22px;
  padding-bottom: 30px;
  border-top: 1px solid var(--color-line);
  color: var(--color-muted);
  font-size: 13px;
}

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

.prose {
  overflow-wrap: break-word;
}

.prose h2,
.prose h3 {
  margin-top: 1.8em;
}

.prose ul,
.prose ol {
  margin: 0 0 1.2em 1.4em;
  padding-left: .6em;
}

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

.reveal {
  transition: opacity var(--motion-normal) ease, transform var(--motion-normal) ease;
}

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

.reveal.shown {
  opacity: 1;
  transform: translateY(0);
}

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

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

  *,
  *::before,
  *::after {
    animation: none !important;
    scroll-behavior: auto !important;
    transition: none !important;
  }

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

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

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

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

  .mobile-drawer {
    position: absolute;
    top: 100%;
    right: var(--gutter);
    left: var(--gutter);
    z-index: 93;
    max-height: calc(100dvh - var(--header-height) - 16px);
    overflow-y: auto;
    padding: 10px;
    border: 1px solid var(--color-line);
    border-radius: var(--radius-medium);
    background: var(--color-panel);
    box-shadow: var(--shadow-float);
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }

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

  .mobile-drawer a {
    display: flex;
    width: 100%;
    min-height: 46px;
    align-items: center;
    padding: 10px 13px;
    border-radius: var(--radius-small);
    color: var(--color-muted);
  }

  .mobile-drawer a:hover,
  .mobile-drawer a.is-active,
  .mobile-drawer a[aria-current="true"] {
    color: var(--color-brand);
    background: var(--color-panel-soft);
  }

  .mobile-language-title {
    padding: 14px 13px 5px;
    color: var(--color-muted);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .06em;
  }

  .drawer-veil.is-open {
    position: fixed;
    inset: var(--header-height) 0 0;
    z-index: 70;
    display: block;
    border: 0;
    background: var(--color-veil);
  }

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

@media (max-width: 768px) {
  h1 {
    font-size: clamp(28px, 9.8vw, 40px);
    line-height: 1.14;
    letter-spacing: -.01em;
  }

  h2 {
    font-size: clamp(27px, 8vw, 36px);
  }

  .head-inner {
    gap: 8px;
  }

  .brand-local,
  .language-button span {
    display: none;
  }

  .login-button {
    padding-inline: 15px;
  }

  .footer-grid {
    grid-template-columns: 1fr;
    gap: 30px;
  }

  .footer-bottom {
    display: block;
  }

  .footer-legal {
    margin-top: 12px;
  }
}

@media (max-width: 640px) {
  :root {
    --gutter: 16px;
  }

  .section {
    padding-top: 62px;
    padding-bottom: 62px;
  }

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

  .tilt,
  [class*="tilt-"] {
    transform: none !important;
  }

  .absolute-decoration,
  .hero-orb,
  .section-glow {
    inset-inline: 0;
    max-width: 100%;
  }
}