:root {
  --color-page: #FBF7EE;
  --color-surface: #FFFDF6;
  --color-surface-warm: #F3EBDB;
  --color-line: #E5DBC4;
  --color-brand: #3A4FC1;
  --color-brand-strong: #2C3B99;
  --color-brand-soft: #E9ECF9;
  --color-brand-mist: #F1F3FC;
  --color-ink: #2A241B;
  --color-ink-muted: #6E6353;
  --color-success: #2E7D4F;
  --color-warning: #B07818;
  --color-danger: #B3372B;
  --color-white: #FFFFFF;
  --color-black: #000000;
  --color-transparent: transparent;
  --color-paper-noise: rgba(42, 36, 27, .035);
  --color-line-soft: rgba(229, 219, 196, .6);
  --color-brand-border: rgba(58, 79, 193, .18);
  --color-brand-border-strong: rgba(58, 79, 193, .35);
  --color-brand-glow: rgba(58, 79, 193, .13);
  --color-brand-shadow: rgba(58, 79, 193, .28);
  --color-brand-shadow-deep: rgba(58, 79, 193, .38);
  --color-ink-shadow: rgba(42, 36, 27, .08);
  --color-ink-shadow-soft: rgba(42, 36, 27, .05);
  --color-success-glow: rgba(46, 125, 79, .14);
  --color-switch-shadow: rgba(44, 59, 153, .4);
  --color-flag-red: #C73935;
  --color-flag-red-bright: #E5484D;
  --color-flag-blue: #294C9B;
  --color-flag-blue-dark: #243E7C;
  --color-flag-gold: #E6B94C;
  --color-flag-white: #FFFFFF;
  --color-flag-black: #211E1A;

  --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', 'SFMono-Regular', Consolas, 'Liberation Mono', 'Courier New', monospace;

  --radius-card: 20px;
  --radius-control: 14px;
  --radius-small: 10px;
  --radius-pill: 999px;
  --header-height: 76px;
  --content-max: 1280px;
  --header-max: 1380px;
  --text-max: 760px;
  --gutter: clamp(16px, 4vw, 48px);
  --section-space: clamp(68px, 9vw, 124px);
  --focus-size: 2px;
  --shadow-card: 0 1px 2px var(--color-ink-shadow-soft), 0 10px 28px var(--color-ink-shadow), 0 36px 72px -28px var(--color-brand-shadow);
  --shadow-soft: 0 1px 2px var(--color-ink-shadow-soft), 0 8px 20px var(--color-ink-shadow);
  --shadow-button: 0 3px 12px var(--color-brand-shadow), 0 12px 28px -10px var(--color-brand-shadow-deep);
  --transition-fast: 150ms ease;
  --transition-reveal: 620ms cubic-bezier(.22, .8, .25, 1);
}

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

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

html.nav-open {
  overflow: hidden;
}

body {
  min-width: 320px;
  margin: 0;
  overflow-x: clip;
  color: var(--color-ink);
  background-color: var(--color-page);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='matrix' values='0 0 0 0 .17 0 0 0 0 .14 0 0 0 0 .10 0 0 0 .035 0'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E");
  font-family: var(--font-body);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

img {
  height: auto;
}

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

button {
  border: 0;
  cursor: pointer;
}

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

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

p {
  margin-bottom: 1.1em;
}

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

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

:not(pre) > code {
  overflow-wrap: anywhere;
  color: var(--color-brand-strong);
  background: var(--color-brand-mist);
  border: 1px solid var(--color-brand-border);
  border-radius: var(--radius-small);
  padding: .12em .38em;
}

pre {
  max-width: 100%;
  overflow-x: auto;
  padding: 20px;
  color: var(--color-surface);
  background: var(--color-ink);
  border-radius: var(--radius-control);
  overscroll-behavior-inline: contain;
}

pre code {
  white-space: pre;
}

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

h1 {
  margin-bottom: 26px;
  font-size: clamp(52px, 5.1vw, 72px);
  font-weight: 500;
  letter-spacing: -.012em;
  line-height: 1.14;
}

h2 {
  margin-bottom: 20px;
  font-size: clamp(34px, 4vw, 52px);
  font-weight: 500;
  letter-spacing: -.01em;
  line-height: 1.18;
}

h3 {
  margin-bottom: 12px;
  font-size: clamp(21px, 2.4vw, 28px);
  font-weight: 600;
  line-height: 1.3;
}

::selection {
  color: var(--color-white);
  background: var(--color-brand);
}

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

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

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

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

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

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

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

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

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

.section-heading p {
  color: var(--color-ink-muted);
  font-size: clamp(16px, 2vw, 19px);
}

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

.card {
  padding: clamp(20px, 3vw, 30px);
  box-shadow: var(--shadow-soft);
}

.panel {
  padding: clamp(24px, 4vw, 42px);
}

.badge,
.chip {
  display: inline-flex;
  min-height: 28px;
  max-width: 100%;
  align-items: center;
  gap: 8px;
  overflow: hidden;
  padding: 5px 12px;
  color: var(--color-brand-strong);
  background: var(--color-brand-soft);
  border: 1px solid var(--color-brand-border);
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 650;
  line-height: 1.35;
}

.badge-dot {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  background: var(--color-brand);
  border-radius: 50%;
}

.btn {
  display: inline-flex;
  min-width: 24px;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 28px;
  border: 1px solid var(--color-transparent);
  border-radius: var(--radius-pill);
  font-weight: 650;
  line-height: 1.25;
  transition: color var(--transition-fast), background-color var(--transition-fast), border-color var(--transition-fast), transform var(--transition-fast);
}

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

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

.btn-primary {
  color: var(--color-white);
  background: var(--color-brand);
  box-shadow: var(--shadow-button);
}

.btn-primary:hover {
  background: var(--color-brand-strong);
}

.btn-secondary {
  color: var(--color-brand-strong);
  background: var(--color-surface);
  border-color: var(--color-brand-border-strong);
}

.btn-secondary:hover {
  background: var(--color-brand-mist);
  border-color: var(--color-brand);
}

.btn-quiet {
  min-height: 40px;
  color: var(--color-brand-strong);
  background: var(--color-brand-soft);
}

.btn-disabled,
.btn[aria-disabled="true"] {
  color: var(--color-ink-muted);
  background: var(--color-surface-warm);
  border-color: var(--color-line);
  box-shadow: none;
  cursor: not-allowed;
  transform: none;
}

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

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

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

/* Shared header */
.site-header {
  position: relative;
  z-index: 100;
  min-height: var(--header-height);
  border-bottom: 1px solid var(--color-line-soft);
}

.header-inner {
  width: 100%;
  max-width: var(--header-max);
  min-height: var(--header-height);
  margin-inline: auto;
  padding-inline: clamp(16px, 3vw, 36px);
  display: flex;
  align-items: center;
  gap: 18px;
}

.brand {
  display: inline-flex;
  min-width: max-content;
  min-height: 44px;
  align-items: center;
  gap: 10px;
}

.brand-logo {
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
}

.brand-word {
  color: var(--color-ink);
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 750;
  letter-spacing: .02em;
}

.brand-word-em {
  color: var(--color-brand);
}

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

.desktop-nav {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-inline: auto;
}

.desktop-nav a {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  padding: 7px 12px;
  color: var(--color-ink-muted);
  border-radius: var(--radius-pill);
  font-size: 13.5px;
  white-space: nowrap;
  transition: color var(--transition-fast), background-color var(--transition-fast);
}

.desktop-nav a:hover {
  color: var(--color-ink);
  background: var(--color-surface-warm);
}

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

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

.language-menu {
  position: relative;
}

.language-button {
  min-width: 44px;
  min-height: 44px;
  padding: 7px 10px;
  color: var(--color-ink-muted);
  background: var(--color-transparent);
  border-radius: var(--radius-pill);
  font-size: 13px;
}

.language-button:hover {
  background: var(--color-surface-warm);
}

.language-popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 164px;
  padding: 8px;
  visibility: hidden;
  opacity: 0;
  transform: translateY(-6px);
  color: var(--color-ink);
  background: var(--color-surface);
  border: 1px solid var(--color-line);
  border-radius: var(--radius-control);
  box-shadow: var(--shadow-card);
  transition: opacity var(--transition-fast), transform var(--transition-fast), visibility var(--transition-fast);
}

.language-menu.open .language-popover {
  visibility: visible;
  opacity: 1;
  transform: none;
}

.language-popover a {
  display: flex;
  min-height: 42px;
  align-items: center;
  padding: 8px 10px;
  border-radius: var(--radius-small);
  font-size: 13px;
}

.language-popover a:hover,
.language-popover a[aria-current="true"] {
  color: var(--color-brand-strong);
  background: var(--color-brand-soft);
}

.header-login {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  padding: 8px 21px;
  color: var(--color-white);
  background: var(--color-brand);
  border-radius: var(--radius-pill);
  box-shadow: 0 2px 8px var(--color-brand-shadow);
  font-size: 13.5px;
  font-weight: 650;
}

.header-login:hover {
  background: var(--color-brand-strong);
}

.menu-toggle {
  display: none;
  width: 44px;
  min-width: 44px;
  height: 44px;
  align-items: center;
  justify-content: center;
  padding: 10px;
  color: var(--color-ink);
  background: var(--color-surface-warm);
  border-radius: 50%;
}

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

.mobile-nav {
  display: none;
}

.nav-veil {
  display: none;
}

/* Shared footer */
.site-footer {
  margin-top: var(--section-space);
  color: var(--color-surface-warm);
  background: var(--color-ink);
}

.footer-grid {
  display: grid;
  grid-template-columns: minmax(220px, 1.2fr) repeat(2, minmax(180px, 1fr));
  gap: clamp(30px, 6vw, 80px);
  padding-top: 64px;
  padding-bottom: 48px;
}

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

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

.footer-title {
  margin-bottom: 14px;
  color: var(--color-white);
  font-size: 14px;
  font-weight: 700;
}

.footer-links {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px 18px;
}

.footer-links a,
.footer-keywords a,
.footer-languages a {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  color: var(--color-line);
  font-size: 13px;
}

.footer-links a:hover,
.footer-keywords a:hover,
.footer-languages a:hover {
  color: var(--color-white);
}

.footer-keywords,
.footer-languages {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 14px;
}

.footer-bottom {
  min-height: 68px;
  padding-block: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  color: var(--color-line);
  border-top: 1px solid var(--color-ink-muted);
  font-size: 12px;
}

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

.prose {
  max-width: 820px;
  min-width: 0;
  margin-inline: auto;
}

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

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

.prose a {
  color: var(--color-brand-strong);
  text-decoration: underline;
  text-underline-offset: .18em;
}

.prose img,
.prose iframe {
  max-width: 100%;
}

.prose blockquote {
  margin-inline: 0;
}

.prose ol {
  counter-reset: prose-step;
  list-style: none;
  padding-left: 0;
}

.prose ol > li {
  position: relative;
  min-height: 34px;
  padding-left: 46px;
  counter-increment: prose-step;
}

.prose ol > li::before {
  content: counter(prose-step);
  position: absolute;
  top: 0;
  left: 0;
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--color-white);
  background: var(--color-brand);
  border-radius: 50%;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
}

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

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

  .language-menu {
    display: none;
  }

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

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

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

  .mobile-nav {
    position: absolute;
    z-index: 110;
    top: 100%;
    right: 16px;
    left: 16px;
    max-height: calc(100dvh - var(--header-height) - 16px);
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 10px;
    color: var(--color-ink);
    background: var(--color-surface);
    border: 1px solid var(--color-line);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-card);
  }

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

  .mobile-nav a {
    width: 100%;
    min-height: 48px;
    display: flex;
    align-items: center;
    padding: 11px 14px;
    border-radius: var(--radius-control);
  }

  .mobile-nav a:hover,
  .mobile-nav a.active {
    color: var(--color-brand-strong);
    background: var(--color-brand-soft);
  }

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

@media (max-width: 768px) {
  .no-break {
    white-space: normal;
  }

  h1 {
    font-size: clamp(32px, 9.5vw, 40px);
    line-height: 1.14;
  }

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

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

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

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

@media (max-width: 640px) {
  .wrap,
  .text-wrap {
    padding-inline: max(16px, var(--gutter));
  }

  .brand-local {
    display: none;
  }

  .header-inner {
    gap: 8px;
  }

  .header-tools {
    margin-left: auto;
    gap: 7px;
  }

  .header-login {
    min-width: 56px;
    padding-inline: 14px;
  }

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

  .btn {
    min-height: 46px;
    padding-inline: 22px;
  }

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

  .card,
  .panel {
    border-radius: var(--radius-control);
  }
}

@media (max-width: 390px) {
  .brand-word {
    font-size: 17px;
  }

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

  .header-login {
    padding-inline: 12px;
  }

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

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

  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }

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