:root {
  --ink: #111210;
  --muted: #666963;
  --paper: #f1f1ec;
  --surface: #ffffff;
  --line: #d8d9d2;
  --soft-line: #e9eae4;
  --blue: #4f66dd;
  --blue-soft: #e8ebff;
  --code: #151715;
  --code-text: #e7dfd2;
  color: var(--ink);
  background: var(--paper);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 82px; }
body { min-width: 320px; margin: 0; background: var(--paper); }
a { color: inherit; text-decoration: none; }
button, select { font: inherit; }
code, pre { font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace; }

.docs-topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 0 22px;
  border-bottom: 1px solid var(--line);
  background: rgb(241 241 236 / 94%);
  backdrop-filter: blur(18px);
}
.docs-brand { display: flex; align-items: center; gap: 9px; font-size: 14px; font-weight: 800; }
.docs-brand small { margin-left: 5px; color: var(--blue); font-size: 11px; letter-spacing: 0.08em; }
.brand-bot { position: relative; width: 23px; height: 23px; display: block; border-radius: 48% 52% 46% 54%; background: var(--ink); transform: rotate(-6deg); }
.brand-bot i { position: absolute; top: 6px; width: 4px; height: 8px; border-radius: 50%; background: white; }
.brand-bot i:first-child { left: 7px; }
.brand-bot i:last-child { left: 14px; }
.docs-topbar > div { display: flex; align-items: center; gap: 11px; }
.docs-topbar > div a { min-height: 36px; display: inline-flex; align-items: center; padding: 0 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); font-size: 12px; font-weight: 700; }
.docs-topbar .download { color: white; border-color: var(--ink); background: var(--ink); }
.version { color: var(--muted); font-family: "SFMono-Regular", Consolas, monospace; font-size: 11px; }

.docs-layout {
  width: min(1500px, 100%);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 210px minmax(560px, 820px) minmax(260px, 320px);
  justify-content: center;
  align-items: start;
}

.docs-nav {
  position: sticky;
  top: 60px;
  max-height: calc(100svh - 60px);
  overflow: auto;
  padding: 28px 22px 42px;
  border-right: 1px solid var(--line);
}
.docs-nav p { margin: 22px 0 8px; color: #969990; font-size: 10px; font-weight: 800; letter-spacing: 0.09em; text-transform: uppercase; }
.docs-nav p:first-child { margin-top: 0; }
.docs-nav a { display: block; margin: 2px 0; padding: 7px 9px; border-radius: 7px; color: var(--muted); font-size: 12px; line-height: 1.2; }
.docs-nav a:hover { color: var(--ink); background: var(--surface); }
.docs-nav a.is-active { color: var(--blue); background: var(--blue-soft); font-weight: 750; }

.docs-content { min-width: 0; padding: 52px 54px 100px; border-right: 1px solid var(--line); background: var(--surface); }
.doc-intro { padding-bottom: 58px; border-bottom: 1px solid var(--line); }
.eyebrow { margin: 0 0 16px; color: var(--blue); font-family: "SFMono-Regular", Consolas, monospace; font-size: 11px; font-weight: 800; letter-spacing: 0.1em; }
.doc-intro h1 { margin: 0; font-size: clamp(42px, 5vw, 70px); letter-spacing: -0.065em; line-height: 0.96; }
.lede { max-width: 700px; margin: 24px 0 0; color: var(--muted); font-size: 17px; line-height: 1.75; }
.docs-content p code, .docs-content li code, .docs-content td code { padding: 2px 5px; border-radius: 5px; color: #3349b9; background: var(--blue-soft); font-size: 0.9em; }
.intro-actions { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 26px; }
.intro-actions a { min-height: 42px; display: inline-flex; align-items: center; padding: 0 15px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); font-size: 13px; font-weight: 750; }
.intro-actions a:first-child { color: white; border-color: var(--ink); background: var(--ink); }
.notice { display: grid; grid-template-columns: 120px 1fr; gap: 20px; margin-top: 30px; padding: 16px 18px; border-left: 3px solid #e2a54d; background: #fff8e8; }
.notice strong { font-size: 13px; }
.notice span { color: #716349; font-size: 12px; line-height: 1.6; }

.doc-section { padding: 62px 0 10px; }
.doc-section + .doc-section { margin-top: 12px; border-top: 1px solid var(--soft-line); }
.section-title { display: grid; grid-template-columns: 34px 1fr; gap: 13px; align-items: start; margin-bottom: 24px; }
.section-title > span { width: 29px; height: 29px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 50%; color: var(--muted); font-family: "SFMono-Regular", Consolas, monospace; font-size: 10px; }
.section-title p { margin: 1px 0 5px; color: var(--blue); font-family: "SFMono-Regular", Consolas, monospace; font-size: 10px; font-weight: 800; letter-spacing: 0.09em; }
.section-title h2 { margin: 0; font-size: clamp(27px, 3vw, 38px); letter-spacing: -0.045em; line-height: 1.05; }
.doc-section > p { margin: 0 0 20px; color: var(--muted); font-size: 14px; line-height: 1.75; }
.subheading { margin: 32px 0 14px; font-size: 17px; }

.quick-steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 0 0 18px; padding: 0; list-style: none; }
.quick-steps li { min-height: 128px; display: grid; align-content: start; gap: 9px; padding: 15px; border: 1px solid var(--line); border-radius: 11px; background: #f8f8f5; }
.quick-steps strong { font-size: 14px; }
.quick-steps span { color: var(--muted); font-size: 12px; line-height: 1.6; }

.code-block { overflow: hidden; margin: 20px 0 4px; border: 1px solid #272a27; border-radius: 12px; background: var(--code); }
.code-block > div { min-height: 42px; display: flex; align-items: center; justify-content: space-between; padding: 0 11px 0 15px; border-bottom: 1px solid #303330; }
.code-block > div span { color: #949990; font-size: 11px; }
.code-block button { min-width: 58px; height: 29px; border: 1px solid #3d423d; border-radius: 6px; color: white; background: #232623; font-size: 11px; cursor: pointer; }
.code-block button.is-copied { color: var(--ink); border-color: #9be0b5; background: #9be0b5; }
.code-block pre { margin: 0; padding: 19px; overflow: auto; color: var(--code-text); font-size: 13px; line-height: 1.7; white-space: pre-wrap; }
.code-block.compact pre { padding-block: 16px; }

.file-tree { display: grid; gap: 9px; margin: 18px 0; padding: 20px; border: 1px solid var(--line); border-radius: 11px; color: #32342f; background: #f8f8f5; font-family: "SFMono-Regular", Consolas, monospace; font-size: 13px; }
.file-tree strong { margin-bottom: 3px; }
.file-tree span { display: flex; justify-content: space-between; gap: 20px; }
.file-tree i { color: var(--muted); font-family: Inter, ui-sans-serif, sans-serif; font-size: 11px; font-style: normal; }
.tip { padding: 15px 17px; border-radius: 10px; background: var(--blue-soft); }
.tip strong { color: var(--ink); }

.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 11px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 12px 13px; border-bottom: 1px solid var(--soft-line); text-align: left; vertical-align: top; }
th { color: var(--muted); background: #f5f5f1; font-size: 11px; font-weight: 750; }
tbody tr:last-child td { border-bottom: 0; }
td { color: #4d504a; line-height: 1.5; }
td:first-child { color: var(--ink); font-weight: 700; }

.api-list, .method-list { display: grid; gap: 8px; }
.api-list article { display: grid; grid-template-columns: minmax(140px, 0.8fr) 120px minmax(220px, 1.4fr); gap: 16px; align-items: baseline; padding: 14px; border: 1px solid var(--line); border-radius: 10px; }
.api-list article > code { color: var(--blue); font-size: 13px; font-weight: 750; }
.api-list strong { color: var(--muted); font-size: 11px; font-weight: 650; }
.api-list p, .method-list p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.6; }
.method-list article { padding: 16px 17px; border-left: 3px solid var(--line); background: #f8f8f5; }
.method-list article:hover { border-left-color: var(--blue); }
.method-list h3 { margin: 0 0 7px; font-size: 14px; }
.method-list h3 code { color: #2e43b3; }

.token-list { display: flex; flex-wrap: wrap; gap: 7px; }
.token-list code { padding: 8px 10px; border: 1px solid var(--line); border-radius: 7px; color: #40433d; background: #f8f8f5; font-size: 11px; }
.token-list.exports code { color: #2e43b3; border-color: #cdd3f8; background: var(--blue-soft); }

.reference-groups { display: grid; gap: 18px; }
.reference-group { border: 1px solid var(--line); border-radius: 11px; overflow: hidden; }
.reference-group h3 { margin: 0; padding: 11px 13px; border-bottom: 1px solid var(--line); color: var(--muted); background: #f5f5f1; font-size: 11px; }
.state-reference { display: grid; grid-template-columns: repeat(3, 1fr); }
.state-reference button { min-width: 0; min-height: 54px; display: grid; align-content: center; gap: 3px; padding: 9px 11px; border: 0; border-right: 1px solid var(--soft-line); border-bottom: 1px solid var(--soft-line); color: var(--ink); background: white; text-align: left; cursor: pointer; }
.state-reference button:hover { background: var(--blue-soft); }
.state-reference strong { font-size: 12px; }
.state-reference code { overflow: hidden; color: var(--muted); font-size: 10px; text-overflow: ellipsis; }

.shape-reference { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
.shape-reference button { min-width: 0; min-height: 72px; display: flex; align-items: center; gap: 11px; padding: 8px 11px; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); background: #f8f8f5; text-align: left; cursor: pointer; }
.shape-reference button:hover { border-color: var(--blue); background: var(--blue-soft); }
.shape-reference morph-bot { flex: 0 0 auto; pointer-events: none; }
.shape-reference span { min-width: 0; display: grid; gap: 3px; }
.shape-reference strong { font-size: 12px; }
.shape-reference code { overflow: hidden; color: var(--muted); font-size: 10px; text-overflow: ellipsis; }

.effect-reference { display: grid; grid-template-columns: repeat(2, 1fr); gap: 7px; }
.effect-reference button { min-height: 62px; display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px; color: var(--ink); background: #f8f8f5; text-align: left; cursor: pointer; }
.effect-reference button:hover { border-color: var(--blue); background: var(--blue-soft); }
.effect-reference strong { font-family: "SFMono-Regular", Consolas, monospace; font-size: 12px; }
.effect-reference span { grid-column: 1; color: var(--muted); font-size: 11px; }
.effect-reference i { grid-column: 2; grid-row: 1 / 3; color: var(--blue); font-size: 14px; font-style: normal; }

.check-list { display: grid; gap: 9px; margin: 0; padding: 0; list-style: none; }
.check-list li { position: relative; padding: 13px 14px 13px 39px; border: 1px solid var(--line); border-radius: 9px; color: var(--muted); font-size: 13px; line-height: 1.6; }
.check-list li::before { content: "✓"; position: absolute; left: 14px; top: 13px; color: var(--blue); font-weight: 800; }

.live-api { position: sticky; top: 60px; max-height: calc(100svh - 60px); overflow: auto; padding: 25px 20px 36px; }
.live-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 13px; font-family: "SFMono-Regular", Consolas, monospace; font-size: 10px; font-weight: 800; letter-spacing: 0.08em; }
.live-heading i { display: flex; align-items: center; gap: 5px; color: #478f63; font-size: 10px; font-style: normal; font-weight: 650; letter-spacing: 0; }
.live-heading i::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: #54b477; }
.live-stage { min-height: 220px; display: grid; place-items: center; margin-bottom: 15px; overflow: hidden; border: 1px solid var(--line); border-radius: 13px; background-color: var(--surface); background-image: linear-gradient(var(--soft-line) 1px, transparent 1px), linear-gradient(90deg, var(--soft-line) 1px, transparent 1px); background-size: 24px 24px; }
.live-api label { display: grid; gap: 6px; margin-top: 10px; }
.live-api label span { color: var(--muted); font-size: 11px; font-weight: 700; }
.live-api select { width: 100%; height: 39px; padding: 0 9px; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); background: var(--surface); font-size: 12px; }
.live-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 12px; }
.live-actions button { min-height: 38px; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); background: var(--surface); font-size: 11px; font-weight: 720; cursor: pointer; }
.live-actions button:first-child { color: white; border-color: var(--blue); background: var(--blue); }
.live-actions button:hover { border-color: #aeb0aa; }
.snapshot-card { margin-top: 14px; overflow: hidden; border: 1px solid #2d302d; border-radius: 9px; background: var(--code); }
.snapshot-card span { display: block; padding: 10px 11px; border-bottom: 1px solid #303330; color: #92978f; font-family: "SFMono-Regular", Consolas, monospace; font-size: 9px; }
.snapshot-card pre { min-height: 144px; margin: 0; padding: 11px; overflow: auto; color: #c8d0ff; font-size: 9px; line-height: 1.55; }

button:focus-visible, a:focus-visible, select:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

@media (max-width: 1180px) {
  .docs-layout { grid-template-columns: 190px minmax(540px, 1fr); }
  .live-api { grid-column: 1 / -1; position: relative; top: auto; max-height: none; display: grid; grid-template-columns: 220px repeat(3, minmax(150px, 1fr)); gap: 10px 14px; align-items: end; border-top: 1px solid var(--line); }
  .live-heading { grid-column: 1 / -1; margin: 0; }
  .live-stage { grid-row: span 4; margin: 0; }
  .live-actions { grid-column: 2 / -1; }
  .snapshot-card { grid-column: 2 / -1; margin: 0; }
}

@media (max-width: 760px) {
  html { scroll-padding-top: 0; }
  .docs-topbar { position: relative; padding: 10px 15px; }
  .version, .docs-topbar > div a:not(.download) { display: none; }
  .docs-layout { display: block; }
  .docs-nav { position: relative; top: auto; max-height: none; display: flex; gap: 5px; padding: 12px 15px; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .docs-nav p { display: none; }
  .docs-nav a { flex: 0 0 auto; white-space: nowrap; }
  .docs-content { padding: 40px 17px 68px; border-right: 0; }
  .doc-intro h1 { font-size: 46px; }
  .lede { font-size: 15px; }
  .notice { grid-template-columns: 1fr; gap: 7px; }
  .quick-steps, .state-reference, .shape-reference, .effect-reference { grid-template-columns: 1fr; }
  .api-list article { grid-template-columns: 1fr; gap: 5px; }
  .file-tree span { display: grid; gap: 3px; }
  .live-api { display: block; padding: 30px 17px 45px; }
  .live-heading, .live-stage, .live-api label, .live-actions, .snapshot-card { margin-bottom: 13px; }
}

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