:root {
  --color-bg: #0E1F58;
  --color-panel: #142A6B;
  --color-panel-raised: #1B357E;
  --color-panel-high: #24408F;
  --color-border: #2B4691;
  --color-border-strong: #3D5CB3;
  --color-accent: #F2CF7E;
  --color-accent-deep: #D9AB45;
  --color-text: #F3F1E8;
  --color-text-muted: #A9B3D6;
  --color-text-dim: #7684B0;
  --color-success: #6FD9A3;
  --color-warning: #F2A65A;
  --color-error: #F0716A;
  --color-flag-red: #D0342C;
  --color-flag-blue: #2C4C9C;
  --color-flag-white: #FBFBF8;
  --color-flag-black: #1B1B1F;
  --color-flag-gold: #E8B430;
  --color-overlay: rgba(3, 10, 38, 0.72);
  --color-border-soft: rgba(43, 70, 145, 0.62);
  --color-grid: rgba(169, 179, 214, 0.10);
  --color-accent-tint: rgba(242, 207, 126, 0.12);
  --color-accent-glow: rgba(242, 207, 126, 0.17);
  --color-success-halo: rgba(111, 217, 163, 0.28);
  --color-shadow-deep: rgba(3, 10, 38, 0.82);
  --color-shadow-mid: rgba(3, 10, 38, 0.62);
  --color-shadow-soft: rgba(3, 10, 38, 0.55);
  --font-display: 'Inter', 'Noto Sans SC', 'Noto Sans JP', 'Noto Sans KR', 'PingFang SC', 'Hiragino Sans', 'Microsoft YaHei', system-ui, sans-serif;
  --font-body: 'Inter', 'Noto Sans SC', 'Noto Sans JP', 'Noto Sans KR', 'PingFang SC', 'Hiragino Sans', 'Microsoft YaHei', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', 'Cascadia Mono', Menlo, Consolas, monospace;
  --radius-panel: 20px;
  --radius-button: 14px;
  --radius-small: 10px;
  --radius-pill: 999px;
  --header-height: 72px;
  --content-width: 1240px;
  --reading-width: 780px;
  --gutter: 32px;
  --section-space: 104px;
  --shadow-window: 0 34px 72px -26px var(--color-shadow-deep), 0 12px 28px -12px var(--color-shadow-mid);
  --shadow-pill: 0 14px 26px -12px var(--color-shadow-soft);
  --shadow-tile: 0 18px 40px -18px var(--color-shadow-deep);
  --focus-ring: 2px solid var(--color-accent);
  --toc-offset: 136px;
}

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

html {
  max-width: 100%;
  overflow-x: hidden;
  overflow-x: clip;
  color-scheme: dark;
  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: hidden;
  background: var(--color-bg);
  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 {
  display: block;
  max-width: 100%;
  height: auto;
}

svg {
  display: block;
  flex-shrink: 0;
}

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

button {
  border: 0;
  cursor: pointer;
}

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

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

ul,
ol {
  padding: 0;
}

ul {
  list-style: none;
}

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

h1 {
  font-size: clamp(52px, 5.2vw, 72px);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.012em;
}

h2 {
  font-size: clamp(34px, 4vw, 52px);
  font-weight: 800;
  line-height: 1.16;
  letter-spacing: -0.01em;
}

h3 {
  font-size: clamp(21px, 2.2vw, 28px);
  font-weight: 750;
  line-height: 1.3;
}

h4 {
  font-size: 18px;
  line-height: 1.4;
}

strong {
  color: var(--color-text);
  font-weight: 700;
}

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

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

code {
  overflow-wrap: anywhere;
  color: var(--color-accent);
}

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

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

summary {
  cursor: pointer;
}

a:focus-visible,
button:focus-visible,
summary:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[role="tab"]: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-wrap {
  width: 100%;
  max-width: calc(var(--reading-width) + (var(--gutter) * 2));
  margin-inline: auto;
  padding-inline: var(--gutter);
}

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

.section-compact {
  padding-top: 64px;
  padding-bottom: 64px;
}

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

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

.section-lead {
  margin-top: 18px;
  color: var(--color-text-muted);
  font-size: 18px;
}

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

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

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

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

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

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

.panel-raised,
.card-raised {
  background: var(--color-panel-raised);
  box-shadow: var(--shadow-pill);
}

.badge,
.chip,
.fact-chip {
  display: inline-flex;
  min-height: 30px;
  max-width: 100%;
  align-items: center;
  gap: 8px;
  padding: 4px 12px;
  overflow: hidden;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  background: var(--color-panel);
  color: var(--color-text-muted);
  font-size: 13px;
  line-height: 1.4;
  text-overflow: ellipsis;
}

.badge-accent,
.fact-chip {
  border-color: var(--color-accent);
  color: var(--color-text);
}

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

.btn {
  display: inline-flex;
  min-width: 24px;
  min-height: 52px;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 12px 30px;
  border: 1px solid transparent;
  border-radius: var(--radius-button);
  font-size: 15px;
  font-weight: 750;
  line-height: 1.2;
  text-align: center;
  transition: transform 150ms ease, background-color 150ms ease, border-color 150ms ease, color 150ms ease;
}

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

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

.btn-primary,
.btn-gold {
  background: var(--color-accent);
  color: var(--color-bg);
}

.btn-primary:hover,
.btn-gold:hover {
  background: var(--color-accent-deep);
}

.btn-secondary,
.btn-ghost {
  border-color: var(--color-border);
  background: transparent;
  color: var(--color-text);
}

.btn-secondary:hover,
.btn-ghost:hover {
  border-color: var(--color-border-strong);
  background: var(--color-panel);
}

.btn-quiet {
  min-height: 44px;
  border-color: var(--color-border);
  background: var(--color-panel-raised);
  color: var(--color-text);
}

.btn-small {
  min-height: 40px;
  padding: 9px 18px;
  border-radius: var(--radius-small);
  font-size: 14px;
}

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

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

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

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

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

.header-inner,
.topbar-in {
  display: flex;
  height: 100%;
  align-items: center;
  gap: 34px;
}

.site-brand,
.brand {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 11px;
  min-height: 44px;
}

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

.brand-word {
  color: var(--color-text);
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

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

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

.nav-link,
.nav-more-button,
.topnav > a,
.topnav-more {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 14px;
  border-radius: var(--radius-small);
  background: transparent;
  color: var(--color-text-muted);
  font-size: 15px;
  font-weight: 550;
}

.nav-link:hover,
.nav-more-button:hover,
.topnav > a:hover,
.topnav-more:hover {
  background: var(--color-panel);
  color: var(--color-text);
}

.nav-link.is-active,
.topnav > a.is-here {
  color: var(--color-text);
}

.nav-group {
  position: relative;
}

.nav-more-button svg,
.language-button svg,
.topnav-more svg {
  width: 12px;
  height: 12px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.nav-dropdown,
.language-menu {
  position: absolute;
  top: calc(100% + 8px);
  min-width: 190px;
  padding: 8px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-small);
  background: var(--color-panel);
  box-shadow: var(--shadow-pill);
  visibility: hidden;
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity 150ms ease, transform 150ms ease, visibility 150ms ease;
}

.nav-group:hover .nav-dropdown,
.nav-group:focus-within .nav-dropdown,
.nav-dropdown.is-open,
.language-menu.is-open {
  visibility: visible;
  opacity: 1;
  transform: none;
}

.nav-dropdown a,
.language-menu a {
  display: flex;
  min-height: 44px;
  align-items: center;
  padding: 9px 12px;
  border-radius: 8px;
  color: var(--color-text-muted);
}

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

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

.language-picker {
  position: relative;
}

.language-button,
.lang-pick {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 10px;
  border-radius: var(--radius-small);
  background: transparent;
  color: var(--color-text-muted);
  font-size: 14px;
}

.language-button:hover,
.lang-pick:hover {
  background: var(--color-panel);
  color: var(--color-text);
}

.language-menu {
  right: 0;
}

.login-button,
.btn-login {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  padding: 8px 20px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-small);
  background: var(--color-panel-raised);
  color: var(--color-text);
  font-size: 14px;
  font-weight: 650;
}

.login-button:hover,
.btn-login:hover {
  border-color: var(--color-border-strong);
  background: var(--color-panel-high);
}

.menu-button {
  display: none;
  width: 44px;
  min-width: 44px;
  height: 44px;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-small);
  background: var(--color-panel);
  color: var(--color-text);
}

.menu-button svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 2;
}

.mobile-nav {
  display: none;
}

.mobile-nav a {
  width: 100%;
  min-height: 48px;
  align-items: center;
  padding: 12px 16px;
  border-radius: var(--radius-small);
  color: var(--color-text-muted);
}

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

.mobile-language-label {
  padding: 16px 16px 6px;
  color: var(--color-text-dim);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
}

.nav-veil {
  display: none;
}

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

.footer-main {
  display: grid;
  grid-template-columns: minmax(240px, 1.35fr) repeat(3, minmax(150px, 1fr));
  gap: 44px;
  padding-top: 72px;
  padding-bottom: 52px;
}

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

.footer-title {
  margin-bottom: 16px;
  color: var(--color-text);
  font-size: 14px;
  font-weight: 750;
}

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

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

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

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

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

.prose > * + * {
  margin-top: 1.25em;
}

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

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

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

.prose ul {
  padding-left: 1.2em;
  list-style: disc;
}

.prose ol {
  padding-left: 1.35em;
}

.prose li + li {
  margin-top: 0.5em;
}

.prose table {
  width: 100%;
  border-collapse: collapse;
}

.prose th,
.prose td {
  padding: 14px;
  border: 1px solid var(--color-border);
  text-align: left;
}

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

@media (max-width: 1040px) {
  .desktop-nav .nav-link:nth-of-type(n+4) {
    display: none;
  }

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

@media (max-width: 768px) {
  :root {
    --header-height: 64px;
    --gutter: 20px;
    --section-space: 76px;
    --toc-offset: 124px;
  }

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

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

  .header-inner,
  .topbar-in {
    gap: 12px;
  }

  .desktop-nav,
  .topnav {
    display: none;
  }

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

  .language-picker,
  .lang-pick {
    display: none;
  }

  .login-button,
  .btn-login {
    min-height: 40px;
    padding-inline: 15px;
  }

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

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

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

  .mobile-nav a {
    display: flex;
  }

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

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

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

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

  .btn {
    min-height: 48px;
    padding-inline: 24px;
  }
}

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

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

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

  .brand-local {
    display: none;
  }

  .footer-main {
    padding-top: 56px;
  }

  .prose > .data-table {
    display: block;
    max-width: 100%;
    min-width: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

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

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

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