:root {
  --color-bg: #fffcf7;
  --color-panel: #ffffff;
  --color-panel-soft: #f5f4ee;
  --color-panel-glass: rgba(255, 255, 255, 0.82);
  --color-border: #dfe2de;
  --color-border-strong: #cbd2d0;
  --color-accent: #f45d48;
  --color-accent-dark: #c94332;
  --color-accent-soft: #fff0ea;
  --color-text: #10243a;
  --color-text-muted: #617184;
  --color-text-faint: #8996a4;
  --color-success: #17a99a;
  --color-success-dark: #0d7f75;
  --color-success-soft: #e9f8f5;
  --color-warn: #f29b38;
  --color-error: #c83e45;
  --color-ribbon-coral: #ff7864;
  --color-ribbon-orange: #ffab43;
  --color-ribbon-teal: #37cabb;
  --color-ribbon-light: #ffe3c1;
  --color-grid: rgba(16, 36, 58, 0.055);
  --color-shadow: rgba(16, 36, 58, 0.12);
  --color-shadow-deep: rgba(16, 36, 58, 0.18);
  --color-accent-glow: rgba(244, 93, 72, 0.2);
  --color-success-glow: rgba(23, 169, 154, 0.22);
  --color-ribbon-fade: rgba(255, 255, 255, 0);
  --gradient-accent: linear-gradient(135deg, var(--color-accent), var(--color-warn));
  --gradient-ribbon: linear-gradient(112deg, var(--color-ribbon-orange), var(--color-ribbon-coral) 48%, var(--color-ribbon-teal));
  --gradient-ribbon-highlight: linear-gradient(90deg, var(--color-ribbon-fade), var(--color-ribbon-light), var(--color-ribbon-fade));
  --gradient-title: linear-gradient(105deg, var(--color-accent-dark), var(--color-accent), var(--color-success));
  --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, monospace;
  --radius-xs: 8px;
  --radius-sm: 12px;
  --radius-md: 18px;
  --radius-lg: 28px;
  --radius-xl: 38px;
  --radius-pill: 999px;
  --shadow-button: 0 10px 28px var(--color-accent-glow);
  --shadow-card: 0 34px 90px var(--color-shadow), 0 10px 28px var(--color-shadow);
  --shadow-card-deep: 0 44px 110px var(--color-shadow-deep);
  --page-width: 1320px;
  --reading-width: 768px;
  --header-height: 78px;
  --gutter: clamp(16px, 4vw, 32px);
  --section-space: clamp(64px, 9vw, 118px);
  --toc-offset: 92px;
  --transition-fast: 160ms ease;
  --transition-reveal: 560ms cubic-bezier(.22, .8, .28, 1);
}

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

html {
  min-width: 0;
  scroll-behavior: smooth;
  background: var(--color-bg);
}

html.nav-open {
  overflow: hidden;
}

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

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

img {
  height: auto;
}

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

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

button {
  color: inherit;
}

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

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

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

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

:not(pre) > code {
  padding: 0.12em 0.38em;
  border-radius: var(--radius-xs);
  overflow-wrap: anywhere;
  color: var(--accent-dark);
  background: var(--color-accent-soft);
}

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

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

table {
  border-collapse: collapse;
}

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

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

h2 {
  margin-bottom: 1rem;
  font-size: clamp(32px, 3.6vw, 48px);
  line-height: 1.16;
  letter-spacing: -0.018em;
}

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

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

.wrap {
  width: 100%;
  max-width: calc(var(--page-width) + (var(--gutter) * 2));
  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 {
  position: relative;
  padding-top: var(--section-space);
  padding-bottom: var(--section-space);
  overflow-x: clip;
}

.section-soft {
  background: var(--color-panel-soft);
}

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

.section-heading p {
  margin-bottom: 0;
  color: var(--color-text-muted);
  font-size: clamp(16px, 1.8vw, 20px);
}

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

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

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

.card {
  box-shadow: 0 18px 52px var(--color-shadow);
}

.panel {
  padding: clamp(22px, 4vw, 40px);
}

.tilt {
  transform: rotate(-0.45deg);
}

.badge,
.tag,
.fact-pill {
  max-width: 100%;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  padding: 5px 11px;
  overflow: hidden;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  color: var(--color-text-muted);
  background: var(--color-panel);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
}

.badge-dot,
.status-dot,
.icon-disc {
  flex-shrink: 0;
}

.badge-dot,
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-pill);
  background: var(--color-success);
  box-shadow: 0 0 0 5px var(--color-success-glow);
}

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

.button,
.cta {
  min-height: 50px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 0 22px;
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  cursor: pointer;
  font-size: 15px;
  font-weight: 750;
  line-height: 1.2;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), background-color var(--transition-fast), border-color var(--transition-fast);
}

.button:hover,
.cta:hover {
  transform: translateY(-2px);
}

.button:focus-visible,
.cta:focus-visible,
.nav-link:focus-visible,
.menu-toggle:focus-visible,
.language-button:focus-visible {
  outline: 3px solid var(--color-success-glow);
  outline-offset: 3px;
}

.button-primary,
.cta-primary {
  color: var(--color-panel);
  background: var(--color-accent);
  box-shadow: var(--shadow-button);
}

.button-primary:hover,
.cta-primary:hover {
  background: var(--color-accent-dark);
}

.button-secondary,
.cta-secondary {
  border-color: var(--color-border-strong);
  color: var(--color-text);
  background: var(--color-panel);
  box-shadow: 0 8px 24px var(--color-shadow);
}

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

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

.site-header {
  position: relative;
  z-index: 100;
  height: var(--header-height);
  border-bottom: 1px solid var(--color-border);
  background: var(--color-panel-glass);
  backdrop-filter: blur(18px);
}

.header-inner {
  width: 100%;
  max-width: calc(var(--page-width) + (var(--gutter) * 2));
  height: 100%;
  display: flex;
  align-items: center;
  gap: 24px;
  margin-inline: auto;
  padding-inline: var(--gutter);
}

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

.brand-logo {
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  border-radius: var(--radius-sm);
  filter: drop-shadow(0 7px 9px var(--color-accent-glow));
}

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

.brand-en {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

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

.primary-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  margin-left: auto;
}

.nav-link {
  position: relative;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 9px;
  border-radius: var(--radius-xs);
  color: var(--color-text-muted);
  font-size: 13px;
  font-weight: 650;
  white-space: nowrap;
  transition: color var(--transition-fast), background-color var(--transition-fast);
}

.nav-link svg,
.login-button svg,
.menu-toggle svg,
.language-button svg {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
}

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

.nav-link[aria-current="page"]::after {
  position: absolute;
  right: 10px;
  bottom: 4px;
  left: 10px;
  height: 2px;
  border-radius: var(--radius-pill);
  content: "";
  background: var(--color-accent);
}

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

.language-box {
  position: relative;
}

.language-button {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 10px;
  border: 0;
  border-radius: var(--radius-xs);
  color: var(--color-text-muted);
  background: transparent;
  cursor: pointer;
  font-size: 12px;
  font-weight: 650;
}

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

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

.language-menu a {
  min-height: 42px;
  display: flex;
  align-items: center;
  padding: 0 11px;
  border-radius: var(--radius-xs);
  color: var(--color-text-muted);
  font-size: 13px;
}

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

.login-button {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 17px;
  border: 1px solid var(--color-text);
  border-radius: var(--radius-pill);
  color: var(--color-panel);
  background: var(--color-text);
  font-size: 13px;
  font-weight: 750;
  white-space: nowrap;
  box-shadow: 0 8px 20px var(--color-shadow);
}

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

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

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

.mobile-nav ul {
  display: grid;
  gap: 3px;
  margin: 0;
  padding: 0;
  list-style: none;
}

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

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

.mobile-nav svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

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

.mobile-language-links a {
  color: var(--color-text-muted);
  font-size: 14px;
}

.site-footer {
  position: relative;
  padding-top: 70px;
  padding-bottom: 30px;
  overflow-x: clip;
  color: var(--color-panel);
  background: var(--color-text);
}

.footer-grid {
  display: grid;
  grid-template-columns: minmax(240px, 1.35fr) repeat(3, minmax(150px, 1fr));
  gap: 42px;
}

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

.footer-brand .brand-local,
.footer-brand p,
.footer-column a {
  color: var(--color-border-strong);
}

.footer-brand p {
  max-width: 380px;
  margin-top: 20px;
}

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

.footer-column ul {
  display: grid;
  gap: 9px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.footer-column a {
  font-size: 13px;
}

.footer-column a:hover {
  color: var(--color-panel);
}

.footer-bottom {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  margin-top: 54px;
  padding-top: 24px;
  border-top: 1px solid var(--color-text-muted);
  color: var(--color-border-strong);
  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;
}

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

.toc-sticky-host {
  position: sticky;
  z-index: 35;
  top: var(--toc-host-top, var(--toc-offset));
}

@media (max-width: 1120px) {
  .primary-nav {
    display: none;
  }

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

  .menu-toggle {
    display: grid;
  }
}

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

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

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

  .brand {
    min-width: 0;
  }

  .brand-local,
  .language-box {
    display: none;
  }

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

  .login-button {
    min-height: 40px;
    padding-inline: 14px;
  }

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

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

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

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

  .grid,
  [class*="-grid"] {
    min-width: 0;
  }

  .card,
  .panel,
  .section,
  main,
  article {
    min-width: 0;
  }

  .header-inner {
    gap: 9px;
  }

  .brand-copy {
    display: none;
  }

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

  .login-button {
    font-size: 12px;
  }

  .login-button svg {
    display: none;
  }

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

  .footer-bottom {
    flex-direction: column;
  }
}

@media (max-width: 360px) {
  .login-button {
    padding-inline: 11px;
  }
}

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

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

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