:root {
  --color-paper: #F7F1E5;
  --color-panel: #FFFCF6;
  --color-panel-muted: #EFE7D8;
  --color-border: #E1D7C4;
  --color-accent: #C8203C;
  --color-accent-dark: #9E1730;
  --color-accent-soft: rgba(200, 32, 60, 0.08);
  --color-text: #2A211A;
  --color-text-muted: #6E6257;
  --color-success: #1FA97C;
  --color-success-soft: rgba(31, 169, 124, 0.12);
  --color-warning: #D98A12;
  --color-error: #B3261E;
  --color-hero-top: #FBF7EF;
  --color-hero-bottom: #F1E9DA;
  --color-chrome-bottom: #F4EDE0;
  --color-footer: #2A211A;
  --color-footer-text: #F7F1E5;
  --color-footer-muted: #CFC2AE;
  --color-white-alpha: rgba(255, 255, 255, 0.85);
  --color-dot: rgba(74, 50, 30, 0.22);
  --color-shadow-tint: rgba(88, 31, 28, 0.10);
  --color-shadow-soft: rgba(88, 31, 28, 0.05);
  --color-cta-shadow: rgba(200, 32, 60, 0.28);
  --font-display: 'Inter', 'Noto Sans SC', 'Noto Sans JP', 'Noto Sans KR', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', system-ui, sans-serif;
  --font-body: 'Inter', 'Noto Sans SC', 'Noto Sans JP', 'Noto Sans KR', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, 'Liberation Mono', monospace;
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-pill: 999px;
  --wrap: 1200px;
  --reading-wrap: 800px;
  --gutter: 32px;
  --header-height: 64px;
  --section-space: 88px;
  --focus-ring: 2px solid var(--color-accent);
  --panel-shadow: inset 0 1px 0 var(--color-white-alpha), 0 24px 40px -16px var(--color-shadow-tint), 0 2px 6px var(--color-shadow-soft);
  --small-shadow: inset 0 1px 0 var(--color-white-alpha), 0 8px 20px -12px var(--color-shadow-tint), 0 1px 2px var(--color-shadow-soft);
}

*,
*::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: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

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

img {
  height: auto;
}

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

button,
summary {
  cursor: pointer;
}

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

p,
ul,
ol,
dl,
blockquote,
pre,
figure {
  margin-top: 0;
}

ul,
ol {
  padding-left: 1.25rem;
}

nav ul,
.footer-links,
.trust-list,
.platform-row,
.flag-row {
  margin: 0;
  padding: 0;
  list-style: none;
}

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

h1 {
  margin-bottom: 24px;
  font-size: clamp(52px, 5.2vw, 68px);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

h2 {
  margin-bottom: 20px;
  font-size: clamp(34px, 3.6vw, 48px);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.18;
}

h3 {
  margin-bottom: 12px;
  font-size: clamp(21px, 2vw, 27px);
  font-weight: 700;
  line-height: 1.3;
}

h4 {
  margin-bottom: 8px;
  font-size: 17px;
  line-height: 1.4;
}

p {
  margin-bottom: 1.15em;
}

strong {
  font-weight: 650;
}

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

code {
  overflow-wrap: anywhere;
}

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

pre code {
  overflow-wrap: normal;
  white-space: pre;
}

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

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

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

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

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

.section-tight {
  padding-top: 56px;
  padding-bottom: 56px;
}

.section-head {
  max-width: 760px;
  margin-bottom: 40px;
}

.section-head.is-centered {
  margin-inline: auto;
  text-align: center;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 28px;
  margin-bottom: 16px;
  color: var(--color-accent-dark);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.eyebrow::before {
  width: 7px;
  height: 7px;
  flex: none;
  border-radius: 50%;
  background: var(--color-success);
  content: "";
}

.lead {
  color: var(--color-text-muted);
  font-size: clamp(17px, 2vw, 20px);
  line-height: 1.75;
}

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

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

.highlight {
  color: var(--color-accent);
}

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

.surface,
.card,
.panel {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-panel);
  box-shadow: var(--small-shadow);
}

.card {
  padding: 24px;
}

.panel {
  padding: 32px;
  box-shadow: var(--panel-shadow);
}

.dot-field {
  background-color: var(--color-panel);
  background-image: radial-gradient(var(--color-dot) 1px, transparent 1.2px);
  background-size: 18px 18px;
}

.btn {
  display: inline-flex;
  min-width: 24px;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 20px;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 650;
  line-height: 1;
  text-align: center;
  transition: transform 150ms ease, border-color 150ms ease, box-shadow 150ms ease, background-color 150ms ease;
}

.btn svg {
  width: 16px;
  height: 16px;
  flex: none;
}

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

.btn-primary {
  border-color: var(--color-accent);
  background: linear-gradient(180deg, var(--color-accent), var(--color-accent-dark));
  color: var(--color-panel);
  box-shadow: 0 10px 22px -8px var(--color-cta-shadow), inset 0 1px 0 var(--color-white-alpha);
}

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

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

.btn-quiet {
  border-color: transparent;
  background: var(--color-accent-soft);
  color: var(--color-accent-dark);
}

.btn-small {
  min-height: 36px;
  padding-inline: 14px;
  font-size: 14px;
}

.badge,
.chip {
  display: inline-flex;
  min-height: 24px;
  max-width: 100%;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  overflow: hidden;
  border-radius: var(--radius-pill);
  background: var(--color-panel-muted);
  color: var(--color-text-muted);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.35;
  text-overflow: ellipsis;
}

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

.badge-accent {
  background: var(--color-accent-soft);
  color: var(--color-accent-dark);
}

.badge-warning {
  color: var(--color-warning);
}

.site-header {
  position: relative;
  z-index: 100;
  min-height: var(--header-height);
  border-bottom: 1px solid var(--color-border);
  background: var(--color-hero-top);
}

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

.site-brand {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  gap: 10px;
  flex: none;
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.site-brand img {
  width: 28px;
  height: 28px;
  flex: none;
  border-radius: 7px;
}

.brand-local {
  color: var(--color-text-muted);
  font-weight: 500;
}

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

.desktop-nav a {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  justify-content: center;
  padding: 6px 11px;
  border-radius: var(--radius-pill);
  color: var(--color-text-muted);
  font-size: 14px;
  font-weight: 500;
}

.desktop-nav a:hover {
  color: var(--color-text);
}

.desktop-nav a[aria-current="page"] {
  background: var(--color-accent-soft);
  color: var(--color-accent-dark);
  font-weight: 650;
}

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

.login-link {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-panel);
  box-shadow: var(--small-shadow);
  font-size: 14px;
  font-weight: 650;
}

.language-picker {
  position: relative;
}

.language-toggle,
.menu-toggle {
  display: inline-flex;
  min-width: 44px;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--color-text-muted);
}

.language-toggle {
  gap: 6px;
  padding-inline: 10px;
  font-size: 13px;
}

.language-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 130;
  display: none;
  width: 164px;
  padding: 6px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-panel);
  box-shadow: var(--panel-shadow);
}

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

.language-menu a {
  display: flex;
  min-height: 40px;
  align-items: center;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  color: var(--color-text-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;
}

.menu-toggle svg {
  width: 20px;
  height: 20px;
}

.mobile-nav {
  display: none;
}

.mobile-nav-veil {
  display: none;
}

.site-footer {
  overflow-x: clip;
  border-top: 1px solid var(--color-border);
  background: var(--color-footer);
  color: var(--color-footer-text);
}

.footer-main {
  display: grid;
  grid-template-columns: minmax(240px, 1.25fr) repeat(3, minmax(150px, 1fr));
  gap: 48px;
  padding-top: 64px;
  padding-bottom: 48px;
}

.footer-brand p {
  max-width: 390px;
  margin-top: 18px;
  color: var(--color-footer-muted);
  font-size: 14px;
}

.footer-brand .site-brand {
  color: var(--color-footer-text);
}

.footer-column h2 {
  margin-bottom: 14px;
  color: var(--color-footer-text);
  font-size: 14px;
  letter-spacing: 0;
}

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

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

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

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

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

.reveal {
  transition: opacity 600ms ease, transform 600ms ease;
}

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

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

.prose {
  color: var(--color-text);
}

.prose h2,
.prose h3 {
  scroll-margin-top: calc(var(--header-height) + 72px);
}

.prose p,
.prose li {
  color: var(--color-text-muted);
}

.prose a:not(.btn) {
  color: var(--color-accent-dark);
  text-decoration: underline;
  text-decoration-color: var(--color-accent-soft);
  text-underline-offset: 3px;
}

.prose img,
.prose table,
.prose pre {
  margin-block: 28px;
}

#server-status {
  position: relative;
  display: block;
  width: 100%;
  max-width: 100%;
  margin-bottom: 32px;
  overflow: hidden;
}

body:has(.toc-tabs) section[id] {
  scroll-margin-top: calc(var(--header-height) + 76px);
}

@media (max-width: 1080px) {
  .desktop-nav a {
    padding-inline: 8px;
    font-size: 13px;
  }

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

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

@media (max-width: 900px) {
  .desktop-nav,
  .language-picker {
    display: none;
  }

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

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

  .mobile-nav-veil {
    position: fixed;
    inset: var(--header-height) 0 0;
    z-index: 105;
    background: var(--color-shadow-tint);
  }

  .site-header.is-menu-open .mobile-nav-veil {
    display: block;
  }

  .mobile-nav {
    position: absolute;
    top: 100%;
    right: 0;
    left: 0;
    z-index: 110;
    max-height: calc(100dvh - var(--header-height));
    padding: 12px var(--gutter) 20px;
    overflow-y: auto;
    overscroll-behavior: contain;
    border-bottom: 1px solid var(--color-border);
    background: var(--color-panel);
    box-shadow: 0 18px 30px -18px var(--color-shadow-tint);
  }

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

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

  .mobile-nav a[aria-current="page"],
  .mobile-nav a[aria-current="true"] {
    background: var(--color-accent-soft);
    color: var(--color-accent-dark);
    font-weight: 650;
  }

  .mobile-nav-languages {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--color-border);
  }
}

@media (max-width: 768px) {
  :root {
    --gutter: 20px;
    --section-space: 68px;
  }

  h1 {
    font-size: clamp(32px, 9vw, 40px);
  }

  h2 {
    font-size: clamp(28px, 7.5vw, 36px);
  }

  .panel {
    padding: 24px;
  }

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

  .footer-bottom {
    align-items: flex-start;
    flex-direction: column;
  }
}

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

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

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

  .decor,
  .stripe-halo,
  [class*="halo"] {
    max-width: 100%;
  }

  .btn {
    max-width: 100%;
  }

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

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

  .card {
    padding: 20px;
  }
}

@media (max-width: 390px) {
  .header-tools {
    gap: 4px;
  }

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

  .site-brand span:last-child {
    max-width: 86px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

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

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

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