:root {
  --color-paper: #FBF8F3;
  --color-panel: #FFFFFF;
  --color-ink: #221826;
  --color-ink-alt: #2A1F31;
  --color-line: #E4DCCE;
  --color-line-dark: rgba(251, 248, 243, .13);
  --color-accent: #8C2A56;
  --color-accent-dark: #6B1E41;
  --color-accent-soft: rgba(140, 42, 86, .08);
  --color-text: #241E28;
  --color-muted: #6E6473;
  --color-dark-text: #F0E9EE;
  --color-dark-muted: #A0929F;
  --color-success: #35845C;
  --color-success-soft: rgba(53, 132, 92, .15);
  --color-warning: #B98324;
  --color-error: #C0392B;
  --color-chrome: #F5F0E7;
  --color-white-soft: rgba(255, 255, 255, .75);
  --color-white-faint: rgba(255, 255, 255, .18);
  --color-white-line: rgba(255, 255, 255, .4);
  --color-route-line: rgba(228, 220, 206, .55);
  --color-shadow-soft: rgba(36, 30, 40, .07);
  --color-shadow-mid: rgba(34, 24, 38, .28);
  --color-shadow-deep: rgba(34, 24, 38, .4);
  --color-flag-red: #CE2B37;
  --color-flag-blue: #2C3E8F;
  --color-flag-navy: #25306B;
  --font-display: Georgia, 'Iowan Old Style', 'Noto Serif SC', 'Songti SC', 'SimSun', serif;
  --font-body: 'Inter', 'Noto Sans SC', 'PingFang SC', 'Microsoft YaHei', -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'SFMono-Regular', Consolas, 'Courier New', monospace;
  --radius-small: 6px;
  --radius-medium: 10px;
  --radius-pill: 999px;
  --shadow-window: 0 1px 2px var(--color-shadow-soft), 0 18px 34px -14px var(--color-shadow-mid), 0 46px 80px -34px var(--color-shadow-deep);
  --shadow-card: 0 16px 36px -28px var(--color-shadow-deep);
  --site-width: 1240px;
  --reading-width: 780px;
  --gutter: 32px;
  --header-height: 62px;
  --focus-size: 2px;
  --section-space: 96px;
  --toc-offset: 78px;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-height) + 16px);
  background: var(--color-paper);
}

html.nav-open {
  overflow: hidden;
}

body {
  margin: 0;
  min-width: 320px;
  overflow-x: clip;
  background: var(--color-paper);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

img,
video {
  display: block;
  max-width: 100%;
  height: auto;
}

svg {
  flex-shrink: 0;
}

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

a:not(.btn):not(.nav-link):not(.brand):not(.footer-link) {
  text-underline-offset: .18em;
}

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

button {
  cursor: pointer;
}

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

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

h1 {
  margin-bottom: 20px;
  font-size: clamp(52px, 5.2vw, 72px);
  line-height: 1.12;
  letter-spacing: .01em;
}

h2 {
  margin-bottom: 18px;
  font-size: clamp(34px, 4vw, 52px);
  line-height: 1.16;
}

h3 {
  margin-bottom: 12px;
  font-size: clamp(23px, 2.6vw, 30px);
  line-height: 1.25;
}

p {
  margin-bottom: 18px;
}

ul,
ol {
  padding-left: 1.35em;
}

hr {
  border: 0;
  border-top: 1px solid var(--color-line);
}

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

:not(pre) > code {
  overflow-wrap: anywhere;
  border: 1px solid var(--color-line);
  border-radius: var(--radius-small);
  background: var(--color-accent-soft);
  padding: .1em .35em;
  color: var(--color-accent-dark);
}

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

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

:where(a, button, summary, input, select, textarea, [role="tab"]):focus-visible {
  outline: var(--focus-size) solid var(--color-accent);
  outline-offset: 3px;
}

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

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

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

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

.section-compact {
  padding-top: calc(var(--section-space) * .62);
  padding-bottom: calc(var(--section-space) * .62);
}

.section-dark {
  background: var(--color-ink);
  color: var(--color-dark-text);
}

.section-dark h2,
.section-dark h3 {
  color: var(--color-dark-text);
}

.eyebrow {
  margin-bottom: 12px;
  color: var(--color-accent);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.lead {
  max-width: 760px;
  color: var(--color-muted);
  font-size: clamp(17px, 2vw, 21px);
  line-height: 1.65;
}

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

.mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.text-link {
  color: var(--color-accent);
  font-weight: 600;
}

.text-link:hover {
  color: var(--color-accent-dark);
  text-decoration: underline;
}

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

.badge-dot {
  width: 7px;
  height: 7px;
  flex: 0 0 7px;
  border-radius: 50%;
  background: var(--color-success);
}

.tag {
  border-color: var(--color-accent);
  background: var(--color-accent-soft);
  color: var(--color-accent-dark);
  font-family: var(--font-mono);
}

.btn {
  display: inline-flex;
  min-width: 24px;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: var(--radius-small);
  padding: 11px 28px;
  font-weight: 600;
  letter-spacing: .01em;
  line-height: 1.35;
  text-align: center;
  transition: background-color .16s ease, border-color .16s ease, color .16s ease, transform .16s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-primary {
  border-color: var(--color-accent);
  background: var(--color-accent);
  color: var(--color-panel);
}

.btn-primary:hover {
  border-color: var(--color-accent-dark);
  background: var(--color-accent-dark);
}

.btn-secondary {
  border-color: var(--color-line);
  background: var(--color-panel);
  color: var(--color-text);
}

.btn-secondary:hover {
  border-color: var(--color-muted);
}

.btn-dark {
  border-color: var(--color-dark-text);
  background: var(--color-dark-text);
  color: var(--color-ink);
}

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

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

.card {
  padding: 28px;
  box-shadow: var(--shadow-card);
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.reveal {
  transition: opacity .56s ease, transform .56s ease;
}

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

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

.site-header {
  position: relative;
  z-index: 90;
  height: var(--header-height);
  border-bottom: 1px solid var(--color-line);
  background: var(--color-paper);
}

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

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

.brand-logo {
  width: 32px;
  height: 32px;
}

.brand-word {
  font-family: var(--font-display);
  font-size: 19px;
  letter-spacing: .02em;
}

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

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

.nav-link {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  color: var(--color-muted);
  font-size: 14px;
  transition: color .16s ease;
}

.nav-link:hover,
.nav-link.is-active {
  color: var(--color-text);
}

.nav-link.is-active {
  font-weight: 600;
}

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

.login-link {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--color-accent);
  border-radius: var(--radius-small);
  padding: 7px 17px;
  color: var(--color-accent);
  font-size: 13.5px;
  font-weight: 600;
}

.login-link:hover {
  background: var(--color-accent);
  color: var(--color-panel);
}

.language-picker {
  position: relative;
}

.language-button {
  display: inline-flex;
  min-width: 44px;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  border: 0;
  background: transparent;
  color: var(--color-muted);
  font-size: 13px;
}

.language-menu {
  position: absolute;
  top: calc(100% + 7px);
  right: 0;
  z-index: 95;
  display: none;
  width: 154px;
  border: 1px solid var(--color-line);
  border-radius: var(--radius-small);
  background: var(--color-panel);
  box-shadow: var(--shadow-card);
  padding: 6px;
}

.language-picker.is-open .language-menu {
  display: block;
}

.language-menu a {
  display: flex;
  min-height: 40px;
  align-items: center;
  border-radius: var(--radius-small);
  padding: 8px 10px;
  color: var(--color-muted);
  font-size: 13px;
}

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

.menu-toggle {
  display: none;
  width: 44px;
  min-width: 44px;
  height: 44px;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  border: 0;
  background: transparent;
}

.menu-toggle-lines,
.menu-toggle-lines::before,
.menu-toggle-lines::after {
  display: block;
  width: 20px;
  height: 1px;
  background: var(--color-text);
  transition: transform .16s ease;
}

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

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

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

.mobile-nav {
  position: absolute;
  top: var(--header-height);
  right: 0;
  left: 0;
  z-index: 94;
  display: none;
  max-height: calc(100dvh - var(--header-height));
  overflow-y: auto;
  overscroll-behavior: contain;
  border-bottom: 1px solid var(--color-line);
  background: var(--color-panel);
  padding: 10px var(--gutter) 18px;
}

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

.mobile-nav a {
  display: flex;
  width: 100%;
  min-height: 48px;
  align-items: center;
  border-bottom: 1px solid var(--color-line);
  color: var(--color-muted);
  font-size: 15px;
}

.mobile-nav a.is-active {
  color: var(--color-accent);
  font-weight: 600;
}

.mobile-language-title {
  margin: 17px 0 5px;
  color: var(--color-muted);
  font-size: 12px;
  letter-spacing: .12em;
}

.mobile-language-links {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
}

.mobile-language-links a {
  min-height: 44px;
}

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

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

.site-footer {
  border-top: 1px solid var(--color-line-dark);
  background: var(--color-ink);
  color: var(--color-dark-muted);
}

.footer-main {
  display: grid;
  grid-template-columns: 1.3fr 1fr 1.4fr;
  gap: 56px;
  padding-top: 66px;
  padding-bottom: 50px;
}

.footer-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--color-dark-text);
  font-family: var(--font-display);
  font-size: 21px;
}

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

.footer-intro {
  max-width: 360px;
  margin-top: 16px;
  font-size: 13.5px;
}

.footer-title {
  margin-bottom: 15px;
  color: var(--color-dark-text);
  font-family: var(--font-display);
  font-size: 17px;
}

.footer-links {
  display: grid;
  gap: 8px;
}

.footer-link {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  color: var(--color-dark-muted);
  font-size: 13px;
}

.footer-link:hover {
  color: var(--color-dark-text);
}

.footer-keywords,
.footer-languages {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
}

.footer-keywords a,
.footer-languages a {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  color: var(--color-dark-muted);
  font-size: 12.5px;
}

.footer-keywords a:hover,
.footer-languages a:hover {
  color: var(--color-dark-text);
}

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

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

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

.prose h2 {
  margin-top: 64px;
}

.prose h3 {
  margin-top: 38px;
}

.prose a {
  color: var(--color-accent);
  text-decoration: underline;
}

.prose table {
  border-collapse: collapse;
}

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

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

  .nav-link {
    font-size: 13px;
  }

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

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

@media (max-width: 860px) {
  :root {
    --gutter: 22px;
    --section-space: 72px;
  }

  h1 {
    font-size: clamp(36px, 7vw, 40px);
  }

  .desktop-nav,
  .language-picker {
    display: none;
  }

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

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

  .card-grid {
    grid-template-columns: 1fr;
  }
}

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

  h1 {
    font-size: clamp(28px, 10vw, 40px);
    line-height: 1.15;
  }

  h2 {
    font-size: clamp(28px, 9vw, 38px);
  }

  .brand-word {
    font-size: 18px;
  }

  .brand-local {
    display: none;
  }

  .login-link {
    padding-inline: 12px;
  }

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

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

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

  .footer-bottom {
    display: grid;
  }

  .tilt-card,
  [data-tilt-card],
  .decorative-tilt {
    transform: none;
  }

  .hero-atmosphere,
  .decorative-field,
  [aria-hidden="true"].absolute-decor {
    overflow-x: clip;
  }

  .card {
    padding: 22px;
  }
}

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

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

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