:root {
  --color-bg: #151515;
  --color-panel: #1b1b1b;
  --color-panel-raised: #232323;
  --color-panel-deep: #181818;
  --color-border: #3b3b39;
  --color-border-soft: #2e2e2c;
  --color-accent: #d2a056;
  --color-accent-dark: #98713a;
  --color-text: #eeede5;
  --color-text-muted: #a5a49d;
  --color-text-faint: #74736e;
  --color-success: #78b9bc;
  --color-warn: #d2a056;
  --color-error: #b77d77;
  --color-black: #000000;
  --color-white: #ffffff;
  --color-flag-red: #c94f4f;
  --color-flag-red-dark: #a9363b;
  --color-flag-blue: #365e91;
  --color-flag-blue-dark: #263f72;
  --color-flag-white: #f1f0e9;
  --color-flag-black: #242424;
  --color-flag-yellow: #d3ae4d;
  --font-display: "Inter", "Noto Sans SC", "Noto Sans JP", "Noto Sans KR", system-ui, sans-serif;
  --font-body: "Inter", "Noto Sans SC", "Noto Sans JP", "Noto Sans KR", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Consolas, monospace;
  --radius-xs: 3px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 18px;
  --radius-xl: 28px;
  --radius-pill: 999px;
  --shadow-panel: 0 24px 60px rgb(0 0 0 / 28%);
  --shadow-button: 0 8px 24px rgb(120 185 188 / 12%);
  --shadow-raised: 0 14px 34px rgb(0 0 0 / 20%);
  --page-width: 1320px;
  --content-width: 1120px;
  --reading-width: 768px;
  --panel-width: 1220px;
  --header-height: 76px;
  --gutter: clamp(16px, 4vw, 28px);
  --section-space: clamp(72px, 9vw, 132px);
  --toc-offset: 88px;
  --transition-fast: 180ms ease;
  --transition-slow: 520ms cubic-bezier(0.2, 0.75, 0.25, 1);
}

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

html {
  min-width: 320px;
  background: var(--color-bg);
  color-scheme: dark;
  scroll-behavior: smooth;
}

html.nav-open {
  overflow: hidden;
}

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

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

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

img {
  height: auto;
}

svg {
  display: block;
}

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

button,
select {
  cursor: pointer;
}

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

a,
button,
summary {
  -webkit-tap-highlight-color: transparent;
}

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

p:last-child,
ul:last-child,
ol:last-child {
  margin-bottom: 0;
}

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

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

:focus-visible {
  outline: 2px solid var(--color-success);
  outline-offset: 3px;
}

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

:not(pre) > code {
  padding: 0.14em 0.4em;
  border: 1px solid var(--color-border-soft);
  border-radius: var(--radius-xs);
  background: var(--color-panel-raised);
  color: var(--color-text);
  overflow-wrap: anywhere;
}

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

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

.wrap {
  width: min(100%, calc(var(--page-width) + (var(--gutter) * 2)));
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.wrap-content {
  width: min(100%, calc(var(--content-width) + (var(--gutter) * 2)));
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.reading-wrap {
  width: min(100%, 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);
  overflow-x: clip;
}

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

.section-heading {
  max-width: 820px;
  margin-bottom: clamp(30px, 5vw, 58px);
}

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

.kicker,
.eyebrow {
  width: fit-content;
  max-width: 100%;
  min-height: 27px;
  margin: 0 0 12px;
  padding: 0 11px;
  display: inline-flex;
  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-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.eyebrow-dot,
.status-dot {
  width: 6px;
  height: 6px;
  flex: 0 0 auto;
  border-radius: var(--radius-pill);
  background: var(--color-accent);
}

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

h1,
.hero-title {
  margin-bottom: 22px;
  font-size: clamp(52px, 5vw, 72px);
  line-height: 1.1;
  letter-spacing: -0.02em;
}

h2 {
  margin-bottom: 20px;
  font-size: clamp(34px, 4vw, 52px);
  line-height: 1.14;
  letter-spacing: -0.018em;
}

h3 {
  margin-bottom: 14px;
  font-size: clamp(22px, 2.4vw, 30px);
  line-height: 1.25;
}

h4 {
  margin-bottom: 10px;
  font-size: 18px;
  line-height: 1.35;
}

.title-nowrap {
  white-space: nowrap;
}

.lead {
  max-width: 760px;
  color: var(--color-text-muted);
  font-size: clamp(18px, 2vw, 22px);
  line-height: 1.6;
}

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

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

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

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

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

.button {
  min-width: 122px;
  min-height: 42px;
  padding: 0 19px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-panel);
  color: var(--color-text);
  font-size: 14px;
  font-weight: 550;
  line-height: 1.2;
  text-align: center;
  transition:
    transform var(--transition-fast),
    background-color var(--transition-fast),
    border-color var(--transition-fast),
    color var(--transition-fast);
}

.button:hover {
  transform: translateY(-1px);
  border-color: var(--color-text-muted);
}

.button:active {
  transform: translateY(0);
}

.button svg {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  stroke: currentColor;
  stroke-width: 1.8;
  fill: none;
}

.button-primary {
  border-color: var(--color-success);
  background: var(--color-success);
  color: var(--color-bg);
  box-shadow: var(--shadow-button);
}

.button-primary:hover {
  border-color: var(--color-text);
  background: var(--color-text);
  color: var(--color-bg);
}

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

.button-quiet {
  border-color: transparent;
  background: transparent;
  color: var(--color-text-muted);
}

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

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

.badge,
.chip,
.tag {
  max-width: 100%;
  min-height: 27px;
  padding: 4px 10px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  overflow: hidden;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  background: var(--color-panel);
  color: var(--color-text-muted);
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.35;
  text-overflow: ellipsis;
}

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

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

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

.nav-shell {
  width: min(var(--page-width), calc(100% - 56px));
  height: 100%;
  margin-inline: auto;
  display: flex;
  align-items: center;
  gap: 20px;
}

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

.brand-logo {
  width: 35px;
  height: 35px;
  flex: 0 0 auto;
  border-radius: var(--radius-pill);
}

.brand-copy {
  min-width: 0;
  display: inline-flex;
  align-items: baseline;
  gap: 7px;
  white-space: nowrap;
}

.brand-en {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

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

.primary-nav {
  min-width: 0;
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 2px;
}

.nav-link {
  min-height: 38px;
  padding: 0 9px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border-radius: var(--radius-sm);
  color: var(--color-text-muted);
  font-size: 13px;
  line-height: 1.2;
  white-space: nowrap;
  transition:
    color var(--transition-fast),
    background-color var(--transition-fast);
}

.nav-link svg {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
  stroke: currentColor;
  stroke-width: 1.6;
  fill: none;
}

.nav-link:hover,
.nav-link[aria-current="page"] {
  background: var(--color-panel-raised);
  color: var(--color-text);
}

.header-tools {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.language-menu {
  position: relative;
}

.language-switch {
  min-height: 38px;
  padding: 0 11px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--color-border-soft);
  border-radius: var(--radius-sm);
  background: var(--color-bg);
  color: var(--color-text-muted);
  font-size: 12px;
  white-space: nowrap;
}

.language-switch svg {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  stroke: currentColor;
  stroke-width: 1.7;
  fill: none;
}

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

.language-menu.is-open .language-popover {
  display: grid;
}

.language-popover a {
  min-height: 40px;
  padding: 8px 10px;
  display: flex;
  align-items: center;
  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);
}

.login-button {
  min-height: 38px;
  padding: 0 15px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-panel-raised);
  color: var(--color-text);
  font-size: 13px;
  white-space: nowrap;
  transition:
    border-color var(--transition-fast),
    background-color var(--transition-fast);
}

.login-button:hover {
  border-color: var(--color-text-muted);
  background: var(--color-panel);
}

.login-button svg {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
  stroke: currentColor;
  stroke-width: 1.7;
  fill: none;
}

.menu-toggle {
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  display: none;
  place-items: center;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-panel);
  color: var(--color-text);
}

.menu-toggle svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  stroke-width: 1.7;
  fill: none;
}

.mobile-nav {
  display: none;
}

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

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

.footer-grid {
  padding-top: 62px;
  padding-bottom: 44px;
  display: grid;
  grid-template-columns: minmax(240px, 1.3fr) repeat(3, minmax(150px, 1fr));
  gap: 40px;
}

.footer-brand {
  max-width: 360px;
}

.footer-brand-line {
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 11px;
}

.footer-brand-line img {
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
}

.footer-brand-line strong {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 600;
}

.footer-brand p {
  color: var(--color-text-muted);
  font-size: 14px;
}

.footer-column h2 {
  margin-bottom: 15px;
  color: var(--color-text);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.footer-links {
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
  list-style: none;
}

.footer-links a {
  display: inline-flex;
  color: var(--color-text-muted);
  font-size: 13px;
  transition: color var(--transition-fast);
}

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

.footer-language-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.footer-language-list a {
  min-height: 31px;
  padding: 5px 9px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--color-border-soft);
  border-radius: var(--radius-sm);
  color: var(--color-text-muted);
  font-size: 12px;
}

.footer-bottom {
  min-height: 64px;
  padding-top: 18px;
  padding-bottom: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-top: 1px solid var(--color-border-soft);
  color: var(--color-text-faint);
  font-family: var(--font-mono);
  font-size: 10px;
}

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

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

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

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

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

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

.prose > * {
  max-width: 100%;
}

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

.prose h2 {
  margin-top: 2.3em;
  font-size: clamp(28px, 3vw, 40px);
}

.prose h3 {
  margin-top: 1.8em;
  font-size: clamp(21px, 2vw, 27px);
}

.prose a {
  color: var(--color-success);
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

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

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

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

.tilt,
.tilt-card {
  transform: rotate(-0.35deg);
}

@media (max-width: 1180px) {
  .brand {
    min-width: auto;
  }

  .brand-local,
  .primary-nav .nav-link svg {
    display: none;
  }

  .primary-nav .nav-link {
    padding-inline: 7px;
  }

  .language-switch span {
    display: none;
  }
}

@media (max-width: 980px) {
  .nav-shell {
    width: min(100% - 32px, var(--page-width));
  }

  .primary-nav {
    display: none;
  }

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

  .menu-toggle {
    display: grid;
  }

  .mobile-nav-veil {
    position: fixed;
    inset: var(--header-height) 0 0;
    z-index: 90;
    border: 0;
    background: var(--color-black);
    opacity: 0.72;
  }

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

  .mobile-nav {
    width: min(390px, 100%);
    max-height: calc(100dvh - var(--header-height));
    padding: 12px;
    position: fixed;
    top: var(--header-height);
    right: 0;
    z-index: 110;
    overflow-y: auto;
    overscroll-behavior: contain;
    border-left: 1px solid var(--color-border);
    border-bottom: 1px solid var(--color-border);
    background: var(--color-panel-deep);
  }

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

  .mobile-nav-list,
  .mobile-language-list {
    margin: 0;
    padding: 0;
    display: grid;
    list-style: none;
  }

  .mobile-nav-list a,
  .mobile-language-list a {
    width: 100%;
    min-height: 48px;
    padding: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-radius: var(--radius-sm);
    color: var(--color-text-muted);
  }

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

  .mobile-nav-list svg {
    width: 17px;
    height: 17px;
    flex: 0 0 auto;
    stroke: currentColor;
    stroke-width: 1.6;
    fill: none;
  }

  .mobile-language-list {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--color-border-soft);
  }

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

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

@media (max-width: 768px) {
  :root {
    --header-height: 66px;
    --toc-offset: 78px;
  }

  h1,
  .hero-title {
    font-size: clamp(28px, 9vw, 40px);
    line-height: 1.14;
    letter-spacing: -0.015em;
  }

  h2 {
    font-size: clamp(30px, 8vw, 40px);
  }

  .section-heading {
    margin-bottom: 34px;
  }

  .button-row {
    align-items: stretch;
  }

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

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

  body {
    font-size: 15px;
  }

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

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

  .desktop-language {
    display: none;
  }

  .login-button {
    min-height: 36px;
    padding-inline: 12px;
  }

  .login-button svg {
    display: none;
  }

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

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

  .button-row .button {
    flex: 1 1 140px;
  }

  .footer-grid {
    padding-top: 46px;
    grid-template-columns: minmax(0, 1fr);
    gap: 32px;
  }

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

  .absolute-decoration,
  .decor-disc,
  .decor-watermark {
    display: none;
  }

  table {
    max-width: 100%;
  }
}

@media (max-width: 390px) {
  .nav-shell {
    width: calc(100% - 24px);
    gap: 8px;
  }

  .brand-copy {
    gap: 0;
  }

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

  .button {
    width: 100%;
  }
}

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

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

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