:root {
  color-scheme: dark;
  --ink: #f9f6ff;
  --muted: #c9c1d9;
  --faint: #988eab;
  --night: #100b1b;
  --night-soft: #1a1229;
  --panel: rgba(39, 27, 59, 0.86);
  --panel-strong: #2a1d3d;
  --line: rgba(218, 192, 255, 0.22);
  --gold: #f4ce82;
  --violet: #bd9cff;
  --rose: #ffb3ca;
  --safe: #a6e0c2;
  --warning: #ffd99b;
  --shadow: 0 24px 80px rgba(4, 2, 9, 0.42);
  font-family: Pretendard, "Noto Sans KR", "Apple SD Gothic Neo", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-width: 280px;
  color: var(--ink);
  background:
    radial-gradient(circle at 85% 6%, rgba(127, 83, 181, 0.24), transparent 31rem),
    radial-gradient(circle at 8% 32%, rgba(164, 101, 118, 0.14), transparent 30rem),
    var(--night);
  font-size: 16px;
  line-height: 1.72;
}

a { color: var(--gold); text-underline-offset: 0.2em; }
a:hover { color: #ffe3a9; }
a:focus-visible, button:focus-visible { outline: 3px solid var(--gold); outline-offset: 4px; }

.skip-link {
  position: fixed;
  left: 1rem;
  top: -5rem;
  z-index: 100;
  padding: 0.7rem 1rem;
  color: #18101f;
  background: var(--gold);
  border-radius: 0.6rem;
  font-weight: 800;
}

.skip-link:focus { top: 1rem; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid var(--line);
  background: rgba(16, 11, 27, 0.9);
  backdrop-filter: blur(18px);
}

.header-inner, .footer-inner, .page-shell {
  width: min(1120px, calc(100% - 2rem));
  margin-inline: auto;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
  gap: 1rem;
}

.brand { display: inline-flex; align-items: center; gap: 0.65rem; color: var(--ink); font-weight: 900; text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 2.25rem; height: 2.25rem; border: 1px solid rgba(244, 206, 130, 0.42); border-radius: 50%; color: var(--gold); background: linear-gradient(145deg, #38234c, #20142f); }

.site-nav ul, .footer-links { display: flex; flex-wrap: wrap; align-items: center; gap: 0.3rem 0.85rem; margin: 0; padding: 0; list-style: none; }
.site-nav a, .footer-links a { color: var(--muted); text-decoration: none; }
.site-nav a { display: inline-block; padding: 0.6rem 0.25rem; }
.site-nav a[aria-current="page"] { color: var(--gold); font-weight: 800; }

.page-shell { padding-block: 4.5rem 5rem; }
.page-heading { max-width: 850px; margin-bottom: 2.5rem; }
.eyebrow { margin: 0 0 0.55rem; color: var(--violet); font-weight: 900; letter-spacing: 0.11em; text-transform: uppercase; }
h1, h2, h3 { line-height: 1.25; text-wrap: balance; }
h1 { margin: 0; font-size: clamp(2.25rem, 6vw, 4.2rem); letter-spacing: -0.045em; }
h2 { margin: 0 0 1rem; font-size: clamp(1.35rem, 3vw, 1.8rem); color: #fff8e8; }
h3 { margin: 1.7rem 0 0.45rem; color: var(--gold); }
.lede { max-width: 760px; margin: 1.2rem 0 0; color: var(--muted); font-size: 1.08rem; }

.beta-badge { display: inline-flex; align-items: center; gap: 0.45rem; margin-top: 1.2rem; padding: 0.42rem 0.72rem; border: 1px solid rgba(189, 156, 255, 0.42); border-radius: 99rem; color: #ded0ff; background: rgba(88, 55, 130, 0.3); font-weight: 800; font-size: 0.88rem; }
.beta-badge::before { content: ""; width: 0.48rem; height: 0.48rem; border-radius: 50%; background: var(--violet); box-shadow: 0 0 0.8rem var(--violet); }

.content-grid { display: grid; grid-template-columns: minmax(190px, 250px) minmax(0, 1fr); gap: 2rem; align-items: start; }
.toc { position: sticky; top: 96px; padding: 1.15rem; border: 1px solid var(--line); border-radius: 1rem; background: rgba(29, 20, 45, 0.72); }
.toc strong { color: var(--gold); }
.toc ol { margin: 0.65rem 0 0; padding-left: 1.25rem; }
.toc a { color: var(--muted); text-decoration: none; }

.content-stack { min-width: 0; display: grid; gap: 1rem; }
.content-section, .hero-card, .link-card {
  border: 1px solid var(--line);
  border-radius: 1.1rem;
  background: linear-gradient(145deg, var(--panel), rgba(28, 19, 43, 0.92));
  box-shadow: var(--shadow);
}
.content-section { padding: clamp(1.2rem, 3vw, 2rem); scroll-margin-top: 100px; }
.content-section > :last-child { margin-bottom: 0; }

.notice, .warning, .safe-note { margin: 1.1rem 0; padding: 1rem 1.1rem; border-radius: 0.8rem; }
.notice { border-left: 4px solid var(--violet); background: rgba(137, 100, 196, 0.16); }
.warning { border-left: 4px solid var(--warning); background: rgba(146, 91, 22, 0.18); }
.safe-note { border-left: 4px solid var(--safe); background: rgba(61, 143, 104, 0.16); }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 0.8rem; }
table { width: 100%; min-width: 640px; border-collapse: collapse; }
th, td { padding: 0.85rem 0.9rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: var(--gold); background: rgba(10, 6, 17, 0.38); }
tr:last-child td { border-bottom: 0; }

.meta-list { display: grid; grid-template-columns: minmax(130px, 0.35fr) 1fr; margin: 0; }
.meta-list dt, .meta-list dd { margin: 0; padding: 0.65rem 0; border-bottom: 1px solid var(--line); }
.meta-list dt { color: var(--faint); font-weight: 800; }
.meta-list dd { overflow-wrap: anywhere; }

.card-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; margin-top: 1.5rem; }
.link-card { display: block; padding: 1.35rem; color: var(--ink); text-decoration: none; transition: transform 160ms ease, border-color 160ms ease; }
.link-card:hover { transform: translateY(-3px); border-color: rgba(244, 206, 130, 0.5); }
.link-card strong { display: block; color: var(--gold); font-size: 1.1rem; }
.link-card span { display: block; margin-top: 0.35rem; color: var(--muted); }

.button-row { display: flex; flex-wrap: wrap; gap: 0.7rem; margin-top: 1.25rem; }
.button { display: inline-flex; align-items: center; justify-content: center; min-height: 46px; padding: 0.7rem 1rem; border: 1px solid rgba(244, 206, 130, 0.46); border-radius: 0.75rem; color: #1a1022; background: linear-gradient(135deg, #ffe1a4, #e8ba6d); font-weight: 900; text-decoration: none; }
.button.secondary { color: var(--ink); background: rgba(79, 53, 110, 0.55); border-color: var(--line); }

code { padding: 0.12rem 0.35rem; border: 1px solid var(--line); border-radius: 0.35rem; color: #ebdcff; background: rgba(10, 6, 18, 0.5); font-size: 0.92em; }
ul, ol { padding-left: 1.35rem; }
li + li { margin-top: 0.35rem; }
.muted { color: var(--muted); }

.site-footer { border-top: 1px solid var(--line); color: var(--faint); background: rgba(8, 5, 14, 0.72); }
.footer-inner { display: flex; justify-content: space-between; gap: 1rem; padding-block: 1.5rem; }

@media (max-width: 840px) {
  .header-inner { align-items: flex-start; flex-direction: column; padding-block: 0.85rem; }
  .site-header { position: static; }
  .content-grid { grid-template-columns: 1fr; }
  .toc { position: static; }
  .card-grid { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  body { font-size: 15px; }
  .header-inner, .footer-inner, .page-shell { width: min(100% - 1.2rem, 1120px); }
  .page-shell { padding-block: 2.6rem 3.5rem; }
  .site-nav ul { gap: 0.15rem 0.7rem; }
  .footer-inner { flex-direction: column; }
  .meta-list { grid-template-columns: 1fr; }
  .meta-list dt { padding-bottom: 0; border-bottom: 0; }
  .meta-list dd { padding-top: 0.1rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
