:root {
  --color-bg: #161210;
  --color-bg-top: #181310;
  --color-panel: #1E1915;
  --color-panel-raised: #27211B;
  --color-border: #3A3128;
  --color-accent: #FF9E45;
  --color-accent-deep: #E07A1F;
  --color-text: #F2ECE3;
  --color-text-muted: #A89C8C;
  --color-success: #6FC98D;
  --color-warning: #E8C15C;
  --color-error: #E86A5A;
  --color-button-text: #1B120A;
  --color-flag-red: #C74545;
  --color-flag-blue: #3D5A99;
  --color-flag-white: #F4F0E8;
  --color-flag-green: #447C57;
  --color-transparent: transparent;
  --color-border-soft: rgba(58, 49, 40, .55);
  --color-border-faint: rgba(58, 49, 40, .38);
  --color-accent-glow: rgba(255, 158, 69, .20);
  --color-accent-haze: rgba(224, 122, 31, .09);
  --color-accent-shadow: rgba(224, 122, 31, .32);
  --color-accent-shadow-hover: rgba(224, 122, 31, .40);
  --color-success-soft: rgba(111, 201, 141, .16);
  --color-success-glow: rgba(111, 201, 141, .60);
  --color-shadow-heavy: rgba(0, 0, 0, .50);
  --color-shadow-mid: rgba(0, 0, 0, .38);
  --color-shadow-soft: rgba(0, 0, 0, .30);
  --color-shadow-inset: rgba(0, 0, 0, .25);
  --font-display: 'Inter', 'Noto Sans SC', 'Noto Sans JP', 'Noto Sans KR', -apple-system, 'PingFang SC', 'Hiragino Sans', 'Malgun Gothic', sans-serif;
  --font-body: 'Inter', 'Noto Sans SC', 'Noto Sans JP', 'Noto Sans KR', -apple-system, 'PingFang SC', 'Hiragino Sans', 'Malgun Gothic', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Consolas, 'Courier New', monospace;
  --radius-xs: 5px;
  --radius-sm: 8px;
  --radius-button: 10px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-pill: 999px;
  --shadow-card: 0 30px 70px var(--color-shadow-heavy), 0 8px 22px var(--color-shadow-mid);
  --shadow-soft: 0 2px 8px var(--color-shadow-soft);
  --shadow-button: 0 8px 26px var(--color-accent-shadow), 0 2px 6px var(--color-shadow-soft);
  --shadow-button-hover: 0 12px 32px var(--color-accent-shadow-hover), 0 2px 6px var(--color-shadow-soft);
  --page-width: 1240px;
  --content-width: 860px;
  --header-height: 68px;
  --gutter: 32px;
  --section-space: 96px;
  --focus-width: 2px;
  --transition-fast: 150ms ease;
  --transition-reveal: 600ms cubic-bezier(.2, .7, .2, 1);
  --toc-offset: 92px;
}

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

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

html.nav-open {
  overflow: hidden;
}

body {
  min-width: 320px;
  margin: 0;
  overflow-x: clip;
  background:
    radial-gradient(1100px 520px at 82% 18%, var(--color-accent-haze), var(--color-transparent) 65%),
    linear-gradient(180deg, var(--color-bg-top) 0%, var(--color-bg) 30%, var(--color-bg) 100%);
  color: var(--color-text);
  font-family: var(--font-body);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

img {
  height: auto;
}

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

button {
  border: 0;
}

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

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

p {
  margin-bottom: 1.15em;
}

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

li + li {
  margin-top: .45em;
}

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

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

h2 {
  margin-bottom: 20px;
  font-size: clamp(34px, 4vw, 48px);
  font-weight: 780;
  letter-spacing: -.01em;
}

h3 {
  margin-bottom: 14px;
  font-size: clamp(22px, 2.4vw, 28px);
  font-weight: 720;
}

h4 {
  margin-bottom: 10px;
  font-size: 18px;
  font-weight: 700;
}

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);
  color: var(--color-text);
  -webkit-overflow-scrolling: touch;
}

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

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

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

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

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

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

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

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

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

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

.text-link {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  color: var(--color-accent);
  font-weight: 650;
}

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

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

.surface-raised {
  background: var(--color-panel-raised);
}

.btn,
.btn-primary,
.btn-secondary,
.btn-login {
  display: inline-flex;
  min-width: 24px;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-button);
  cursor: pointer;
  font-weight: 700;
  line-height: 1.2;
  transition: transform var(--transition-fast), border-color var(--transition-fast), background var(--transition-fast), box-shadow var(--transition-fast), color var(--transition-fast);
}

.btn-primary {
  padding: 14px 36px;
  background: linear-gradient(135deg, var(--color-accent) 0%, var(--color-accent-deep) 100%);
  box-shadow: var(--shadow-button);
  color: var(--color-button-text);
  font-size: 16px;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-button-hover);
}

.btn-secondary,
.btn-login {
  border: 1px solid var(--color-border);
  background: var(--color-panel);
  color: var(--color-text);
}

.btn-secondary {
  padding: 13px 30px;
  font-size: 16px;
}

.btn-login {
  min-height: 38px;
  padding: 8px 20px;
  font-size: 14px;
}

.btn-secondary:hover,
.btn-login:hover {
  border-color: var(--color-accent-deep);
  background: var(--color-panel-raised);
}

.btn[aria-disabled="true"],
.btn:disabled {
  cursor: not-allowed;
  opacity: .55;
  transform: none;
}

.badge,
.kicker,
.chip {
  display: inline-flex;
  max-width: 100%;
  min-height: 28px;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  background: var(--color-panel);
  color: var(--color-text-muted);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.25;
}

.badge,
.kicker {
  padding: 6px 14px;
}

.chip {
  overflow: hidden;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
}

.kicker-dot,
.status-dot {
  width: 7px;
  height: 7px;
  flex-shrink: 0;
  border-radius: var(--radius-pill);
  background: var(--color-success);
}

.status-dot {
  width: 9px;
  height: 9px;
  box-shadow: 0 0 8px var(--color-success-glow);
}

.site-header {
  position: relative;
  z-index: 50;
  border-bottom: 1px solid var(--color-border-soft);
  background: var(--color-bg);
}

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

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

.brand-mark {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
}

.brand-name {
  color: var(--color-text);
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 800;
  letter-spacing: .02em;
}

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

.main-nav {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 24px;
}

.main-nav a {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  color: var(--color-text-muted);
  font-size: 14px;
  font-weight: 520;
  letter-spacing: .01em;
  white-space: nowrap;
  transition: color var(--transition-fast);
}

.main-nav a:hover,
.main-nav a.is-active,
.main-nav a[aria-current="page"] {
  color: var(--color-text);
}

.main-nav a.is-active,
.main-nav a[aria-current="page"] {
  font-weight: 720;
}

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

.language-menu {
  position: relative;
}

.language-toggle {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  background: var(--color-transparent);
  color: var(--color-text-muted);
  cursor: pointer;
  font-size: 13px;
}

.language-toggle:hover {
  color: var(--color-text);
}

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

.language-popover.is-open {
  display: block;
}

.language-popover 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-popover a:hover,
.language-popover a[aria-current="true"] {
  background: var(--color-panel);
  color: var(--color-text);
}

.menu-toggle {
  display: none;
  width: 44px;
  min-width: 44px;
  height: 44px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-panel);
  color: var(--color-text);
  cursor: pointer;
}

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

.mobile-nav {
  position: fixed;
  inset: var(--header-height) 0 auto;
  z-index: 65;
  display: none;
  max-height: calc(100dvh - var(--header-height));
  overflow-y: auto;
  padding: 12px var(--gutter) 24px;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-panel);
  overscroll-behavior: contain;
}

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

.mobile-nav a {
  display: flex;
  width: 100%;
  min-height: 48px;
  align-items: center;
  padding: 11px 8px;
  border-bottom: 1px solid var(--color-border-faint);
  color: var(--color-text-muted);
}

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

.mobile-nav-languages {
  margin-top: 14px;
  padding-top: 6px;
}

.mobile-nav-label {
  padding: 8px;
  color: var(--color-text-muted);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .08em;
}

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

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

.site-footer {
  margin-top: var(--section-space);
  border-top: 1px solid var(--color-border);
  background: var(--color-panel);
}

.footer-main {
  display: grid;
  grid-template-columns: 1.25fr 1fr 1.15fr .8fr;
  gap: 44px;
  padding-top: 58px;
  padding-bottom: 44px;
}

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

.footer-heading {
  margin-bottom: 16px;
  color: var(--color-text);
  font-size: 13px;
  font-weight: 750;
  letter-spacing: .04em;
}

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

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

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

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

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

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

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

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

.prose {
  min-width: 0;
  color: var(--color-text-muted);
  font-size: 16px;
}

.prose h2,
.prose h3,
.prose h4,
.prose strong {
  color: var(--color-text);
}

.prose h2 {
  margin-top: 2.15em;
}

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

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

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

.prose > * {
  min-width: 0;
}

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

@media (max-width: 1120px) {
  .main-nav {
    gap: 15px;
  }

  .main-nav a {
    font-size: 13px;
  }

  .header-inner {
    gap: 20px;
  }
}

@media (max-width: 960px) {
  .main-nav,
  .language-menu {
    display: none;
  }

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

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

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

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

  h1 {
    font-size: clamp(34px, 10vw, 40px);
    line-height: 1.12;
    letter-spacing: -.01em;
  }

  h2 {
    font-size: clamp(29px, 8vw, 38px);
  }

  .section-head {
    margin-bottom: 28px;
  }

  .btn-login {
    padding-inline: 14px;
  }
}

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

  .wrap,
  .content-wrap {
    padding-inline: var(--gutter);
  }

  .brand-local {
    display: none;
  }

  .header-inner {
    gap: 10px;
    padding-inline: var(--gutter);
  }

  .header-tools {
    gap: 8px;
  }

  .mobile-nav {
    padding-inline: var(--gutter);
  }

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

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

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

  .btn-primary,
  .btn-secondary {
    padding-inline: 24px;
  }
}

@media (max-width: 380px) {
  .brand-name {
    font-size: 16px;
  }

  .btn-login {
    padding-inline: 11px;
  }
}

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

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

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