:root {
  --bg: #130a22;
  --panel: #1d1033;
  --raised: #2a1a4a;
  --line: #3e2a68;
  --ink: #f8f1ff;
  --muted: #bfb0d9;
  --pink: #ff5c93;
  --orange: #ffa23f;
  --violet: #9b6bff;
  --on-accent: #1c0a17;
  --focus: #ffd166;
  --radius: 12px;
  --font-display: "Unbounded", system-ui, sans-serif;
  --font-body: "Figtree", system-ui, sans-serif;
  --lamp: linear-gradient(90deg, var(--pink), var(--orange));
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Figtree", system-ui, sans-serif;
  font-size: 18px;
  line-height: 1.6;
}
img { max-width: 100%; height: auto; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--pink); text-underline-offset: 4px; }
a:hover { color: var(--orange); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.wrap { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 24px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--focus); color: var(--on-accent); padding: 8px 16px; border-radius: var(--radius); z-index: 10; }
.skip:focus { left: 8px; }

/* header: lamp strip + dock */
.topline { height: 6px; background: var(--lamp); }
.bar { padding: 16px 0; }
.bar-in { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: 12px; color: var(--ink); text-decoration: none; }
.brand:hover { color: var(--ink); }
.mark { display: block; border-radius: var(--radius); }
.brand-name { font-family: var(--font-display); font-weight: 800; font-size: 16px; line-height: 1.2; }
.bar-nav { display: flex; align-items: center; gap: 16px; }
.dock { display: inline-flex; gap: 4px; padding: 4px; background: var(--panel); border: 1px solid var(--line); border-radius: 999px; }
.dock a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px; border-radius: 999px; color: var(--muted); font-weight: 700; font-size: 14px; text-decoration: none; }
.dock a:hover { color: var(--ink); background: var(--raised); }
.dock a[aria-current="page"] { background: var(--pink); color: var(--on-accent); }
.codes-link { color: var(--muted); font-weight: 700; font-size: 14px; text-decoration: none; padding: 8px 0; border-bottom: 2px solid transparent; }
.codes-link:hover { color: var(--ink); }
.codes-link[aria-current="page"] { color: var(--orange); border-bottom-color: var(--orange); }

/* hero */
.hero { padding: 32px 0 24px; }
.hero-doc { padding: 48px 0 24px; }
.crumbs { margin: 0 0 12px; font-size: 14px; color: var(--muted); }
.crumbs a { color: var(--muted); text-decoration: none; border-bottom: 1px solid var(--line); }
.crumbs a:hover { color: var(--ink); }
.crumbs [aria-current] { color: var(--ink); }
.kicker { margin: 0 0 8px; color: var(--orange); font-size: 12px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; }
.h1 { margin: 0 0 12px; font-family: var(--font-display); font-weight: 800; font-size: 48px; line-height: 1.2; }
.lede { margin: 0; max-width: 62ch; color: var(--muted); font-size: 18px; line-height: 1.6; }
.stamp { margin: 12px 0 0; color: var(--muted); font-size: 14px; }

/* tool bench */
.bench { margin-bottom: 48px; }

/* codes status card */
.status { display: flex; align-items: center; gap: 24px; margin: 24px 0 16px; padding: 24px; max-width: 640px; background: var(--panel); border: 1px solid var(--line); border-left: 6px solid var(--orange); border-radius: var(--radius); }
.status-n { margin: 0; font-family: var(--font-body); font-weight: 700; font-size: 48px; line-height: 1.2; color: var(--orange); }
.status-t { margin: 0; font-weight: 700; font-size: 18px; }
.status-d { margin: 4px 0 0; color: var(--muted); font-size: 14px; }

/* prose */
.doc { padding-bottom: 64px; }
.doc-grid { display: grid; grid-template-columns: minmax(0, 70ch); gap: 48px; }
.doc-grid.has-aside { grid-template-columns: minmax(0, 70ch) minmax(240px, 320px); justify-content: space-between; }
.aside { position: sticky; top: 24px; align-self: start; }
.aside .related { margin-top: 0; }
.aside .related h2 { margin: 0 0 16px; font-size: 22px; }
.aside .rel-grid { grid-template-columns: 1fr; }
.prose { max-width: 70ch; }
.prose > :first-child { margin-top: 0; }
.prose h2 { margin: 48px 0 16px; font-family: var(--font-display); font-weight: 600; font-size: 28px; line-height: 1.2; }
.prose h3 { margin: 32px 0 12px; font-family: var(--font-display); font-weight: 600; font-size: 22px; line-height: 1.2; }
.prose p { margin: 0 0 16px; }
.prose ul { margin: 0 0 24px; padding-left: 24px; }
.prose li { margin-bottom: 8px; }
.prose strong { color: var(--ink); }
.prose img { display: block; width: 100%; margin: 24px 0; border-radius: var(--radius); border: 1px solid var(--line); background: var(--panel); }
.prose ol { list-style: none; counter-reset: step; margin: 0 0 32px; padding: 0; display: grid; gap: 12px; }
.prose ol > li { counter-increment: step; position: relative; margin: 0; padding: 16px 16px 16px 64px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.prose ol > li::before { content: counter(step); position: absolute; left: 16px; top: 12px; font-family: var(--font-display); font-weight: 800; font-size: 28px; line-height: 1.2; color: var(--orange); }
.prose blockquote { margin: 24px 0; padding: 12px 16px; border-left: 4px solid var(--violet); background: var(--panel); border-radius: 0 var(--radius) var(--radius) 0; color: var(--muted); }
.prose blockquote p:last-child { margin-bottom: 0; }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 48px 0; }
.prose code { padding: 4px 8px; background: var(--raised); border-radius: var(--radius); font-size: 16px; }
.prose table { width: 100%; border-collapse: collapse; margin: 24px 0; font-size: 16px; }
.prose th, .prose td { padding: 8px 12px; border-bottom: 1px solid var(--line); text-align: left; }

/* related cards */
.related { margin-top: 48px; }
.related h2 { margin-top: 0; }
.rel-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.rel-card { display: flex; flex-direction: column; gap: 8px; padding: 16px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink); text-decoration: none; }
.rel-card:hover { border-color: var(--pink); color: var(--ink); }
.rel-t { font-family: var(--font-display); font-weight: 600; font-size: 16px; line-height: 1.2; }
.rel-d { color: var(--muted); font-size: 14px; line-height: 1.6; }

/* faq */
.faq { margin-top: 48px; }
.faq h2 { margin-top: 0; }
.qa { margin-bottom: 8px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.qa summary { padding: 16px 48px 16px 16px; cursor: pointer; font-weight: 700; font-size: 16px; list-style: none; position: relative; }
.qa summary::-webkit-details-marker { display: none; }
.qa summary::after { content: "+"; position: absolute; right: 16px; top: 12px; color: var(--orange); font-size: 22px; font-weight: 500; line-height: 1.2; }
.qa[open] summary::after { content: "\2212"; }
.qa-a { padding: 0 16px 16px; color: var(--muted); font-size: 16px; }
.qa-a p { margin: 0; }

/* footer */
.foot { border-top: 1px solid var(--line); background: var(--panel); padding: 48px 0 24px; }
.foot-in { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 32px; }
.foot-name { margin: 0 0 8px; font-family: var(--font-display); font-weight: 800; font-size: 16px; }
.foot-text { margin: 0; color: var(--muted); font-size: 14px; max-width: 40ch; }
.foot-col { display: flex; flex-direction: column; gap: 8px; }
.foot-h { margin: 0 0 4px; color: var(--orange); font-size: 12px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; }
.foot-col a { color: var(--muted); font-size: 14px; text-decoration: none; }
.foot-col a:hover { color: var(--ink); text-decoration: underline; }
.foot-legal { margin-top: 32px; padding-top: 24px; border-top: 1px solid var(--line); }
.foot-legal p { margin: 0 0 8px; color: var(--muted); font-size: 14px; }

@media (max-width: 960px) {
  .doc-grid.has-aside { grid-template-columns: minmax(0, 1fr); }
  .aside { position: static; }
  .aside .rel-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 900px) {
  .foot-in { grid-template-columns: 1fr 1fr; }
  .foot-brand { grid-column: 1 / -1; }
}

@media (max-width: 640px) {
  body { font-size: 16px; }
  .wrap { padding: 0 16px; }
  .h1 { font-size: 28px; }
  .hero { padding: 24px 0 16px; }
  .hero-doc { padding: 32px 0 16px; }
  .lede { font-size: 16px; }
  .prose h2 { font-size: 22px; margin-top: 32px; }
  .prose h3 { font-size: 18px; }
  .rel-grid, .aside .rel-grid { grid-template-columns: 1fr; }
  .foot-in { grid-template-columns: 1fr; }
  .status { flex-direction: column; align-items: flex-start; gap: 8px; }
  .bench { margin-bottom: 32px; }
}
