/* FMAX user wiki (wiki/build.py). The app's own tokens (src/ui/app.css): FM27 violet, the same inks, lines and panels in
   light and dark, Pretendard. A docs page, not the app: one reading column, the table of contents at the left, this
   page's headings at the right on wide screens. */
:root {
  --font: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, system-ui, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, monospace;
  --fm-50: #f6f2fd; --fm-100: #ece4fa; --fm-200: #d8c8f3; --fm-300: #b99ce6; --fm-400: #9673d6;
  --fm-500: #7447c2; --fm-600: #6237ad; --fm-700: #4e2a8f; --fm-800: #3b2170; --fm-900: #241445;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --top-h: 56px; --side-w: 264px; --toc-w: 220px;
}
html[data-theme="light"] {
  color-scheme: light;
  --bg: #f4f2f8; --panel: #fff; --panel-2: #faf9fc;
  --ink: #1d1d1f; --ink2: #5e5e63; --ink3: #727277;
  --line: rgba(0, 0, 0, 0.07); --line-strong: rgba(0, 0, 0, 0.12);
  --hover: rgba(0, 0, 0, 0.04); --field: rgba(0, 0, 0, 0.045);
  --accent: var(--fm-500); --accent-ink: var(--fm-700); --accent-weak: rgba(116, 71, 194, 0.10);
  --ok: #30a46c; --ok-ink: #1f7a4d; --ok-bg: rgba(48, 164, 108, 0.10);
  --warn-ink: #9a4a07; --warn-bg: rgba(217, 119, 6, 0.10); --warn: #d97706;
  --shadow: 0 0 0 1px rgba(40, 20, 80, 0.06), 0 1px 2px rgba(40, 20, 80, 0.04), 0 8px 24px rgba(40, 20, 80, 0.06);
  --shot-shadow: 0 0 0 1px rgba(40, 20, 80, 0.08), 0 12px 32px rgba(40, 20, 80, 0.10);
}
html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0e0c13; --panel: #17141f; --panel-2: #1b1824;
  --ink: #f4f2f8; --ink2: #a39db3; --ink3: #8a849c;
  --line: rgba(255, 255, 255, 0.08); --line-strong: rgba(255, 255, 255, 0.14);
  --hover: rgba(255, 255, 255, 0.05); --field: rgba(255, 255, 255, 0.07);
  --accent: var(--fm-400); --accent-ink: var(--fm-300); --accent-weak: rgba(150, 115, 214, 0.16);
  --ok: #3ddc97; --ok-ink: #7be8b6; --ok-bg: rgba(61, 220, 151, 0.10);
  --warn-ink: #f6c66b; --warn-bg: rgba(242, 194, 48, 0.10); --warn: #f2c230;
  --shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.07), 0 10px 30px rgba(0, 0, 0, 0.35);
  --shot-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08), 0 14px 40px rgba(0, 0, 0, 0.5);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html { scroll-padding-top: calc(var(--top-h) + 16px); }
body { font-family: var(--font); font-size: 16px; line-height: 1.75; background: var(--bg); color: var(--ink); word-break: keep-all; overflow-wrap: anywhere; -webkit-font-smoothing: antialiased; }
a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

/* ---- top bar ---- */
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; height: var(--top-h); padding: 0 20px; background: color-mix(in srgb, var(--bg) 86%, transparent); backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); }
.brand { flex: none; display: flex; align-items: center; gap: 8px; color: var(--ink); font-size: 15px; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand b { font-weight: 700; letter-spacing: -0.01em; }
.brand span:last-child { color: var(--ink2); }
.logo { position: relative; flex: none; width: 22px; height: 22px; border-radius: 6px; background: linear-gradient(#fff, #fff) 50% 50% / 100% 1.6px no-repeat, var(--fm-500); }
.logo::before { content: ""; position: absolute; top: 2px; right: 2px; width: 5.5px; height: 5.5px; border-radius: 50%; background: #3dd68c; box-shadow: 0 0 0 1.2px var(--fm-500); z-index: 1; }
.logo::after { content: ""; position: absolute; inset: 5px; border: 1.6px solid #fff; border-radius: 50%; }
.ver { padding: 2px 8px; border-radius: 999px; background: var(--accent-weak); color: var(--accent-ink); font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.search { position: relative; display: flex; align-items: center; gap: 8px; flex: 0 1 360px; min-width: 0; margin-left: auto; height: 36px; padding: 0 10px; border-radius: 10px; background: var(--field); color: var(--ink3); }
.search input { flex: 1; width: 0; min-width: 0; border: 0; background: none; color: var(--ink); font: inherit; font-size: 14px; outline: none; }
.search input::placeholder { color: var(--ink3); }
.search input::-webkit-search-cancel-button { display: none; }
.search kbd, .keys kbd { min-width: 20px; padding: 1px 6px; border-radius: 5px; background: var(--panel); box-shadow: inset 0 -1px 0 var(--line-strong), 0 0 0 1px var(--line); font: 600 12px/1.5 var(--font); color: var(--ink2); text-align: center; }
.results { position: absolute; top: 42px; right: 0; width: min(480px, calc(100vw - 32px)); max-height: min(60vh, 520px); overflow: auto; padding: 6px; border-radius: 14px; background: var(--panel); box-shadow: var(--shadow), 0 16px 40px rgba(0, 0, 0, 0.18); }
.results a { display: block; padding: 8px 10px; border-radius: 10px; color: var(--ink); }
.results a:hover, .results a.is-on { background: var(--accent-weak); text-decoration: none; }
.results a b { display: block; font-size: 14px; font-weight: 600; }
.results a small { display: block; color: var(--ink3); font-size: 12.5px; line-height: 1.5; }
.results a small mark { background: none; color: var(--accent-ink); font-weight: 600; }
.results .empty { padding: 12px; color: var(--ink3); font-size: 14px; }
.theme-btn, .menu-btn { display: grid; place-items: center; flex: none; width: 36px; height: 36px; border: 0; border-radius: 10px; background: none; color: var(--ink2); cursor: pointer; }
.theme-btn:hover, .menu-btn:hover { background: var(--hover); color: var(--ink); }
html[data-theme="light"] .theme-btn .sun, html[data-theme="dark"] .theme-btn .moon { display: none; }
.menu-btn { display: none; }
.get { flex: none; padding: 7px 14px; border-radius: 10px; background: var(--fm-500); color: #fff; font-size: 14px; font-weight: 600; }
.get:hover { background: var(--fm-600); text-decoration: none; }
/* the same page in the other language (build.py other_lang) */
.lang { flex: none; padding: 7px 10px; border-radius: 10px; color: var(--ink2); font-size: 14px; font-weight: 600; }
.lang:hover { background: var(--hover); color: var(--ink); text-decoration: none; }

/* ---- layout ---- */
.shell { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr) var(--toc-w); max-width: 1440px; margin: 0 auto; }
.side { position: sticky; top: var(--top-h); align-self: start; height: calc(100vh - var(--top-h)); overflow: auto; padding: 24px 12px 40px 20px; }
.nav-sec { margin-bottom: 20px; }
.nav-sec b { display: block; padding: 0 10px 6px; color: var(--ink3); font-size: 12.5px; font-weight: 600; }
.nav-sec a { display: block; padding: 5px 10px; border-radius: 8px; color: var(--ink2); font-size: 14.5px; line-height: 1.5; }
.nav-sec a:hover { background: var(--hover); color: var(--ink); text-decoration: none; }
.nav-sec a.is-on { background: var(--accent-weak); color: var(--accent-ink); font-weight: 600; }
.doc { min-width: 0; padding: 40px 48px 80px; }
.doc article { max-width: 760px; }
.toc { position: sticky; top: var(--top-h); align-self: start; max-height: calc(100vh - var(--top-h)); overflow: auto; padding: 40px 20px 40px 0; font-size: 13.5px; }
.toc b { display: block; margin-bottom: 8px; color: var(--ink3); font-size: 12.5px; font-weight: 600; }
.toc a { display: block; padding: 3px 0 3px 10px; border-left: 2px solid var(--line); color: var(--ink2); line-height: 1.5; }
.toc a.lv3 { padding-left: 22px; font-size: 13px; }
.toc a:hover { color: var(--ink); text-decoration: none; }
.toc a.is-on { border-left-color: var(--accent); color: var(--accent-ink); }

/* ---- the page ---- */
.crumb { margin-bottom: 6px; color: var(--accent-ink); font-size: 14px; font-weight: 600; }
h1 { font-size: 34px; line-height: 1.3; font-weight: 700; letter-spacing: -0.02em; }
.lead { margin-top: 12px; color: var(--ink2); font-size: 18px; line-height: 1.65; }
h2 { position: relative; margin: 52px 0 14px; padding-top: 4px; font-size: 24px; line-height: 1.4; font-weight: 700; letter-spacing: -0.01em; }
h3 { position: relative; margin: 32px 0 10px; font-size: 19px; line-height: 1.45; font-weight: 650; }
.hash { position: absolute; left: -22px; color: var(--ink3); opacity: 0; font-weight: 400; }
h2:hover .hash, h3:hover .hash { opacity: 1; text-decoration: none; }
article p { margin: 12px 0; }
article ul, article ol { margin: 12px 0; padding-left: 24px; }
article li { margin: 4px 0; }
article li > ul, article li > ol { margin: 4px 0; }
article li::marker { color: var(--ink3); }
article ol > li::marker { font-weight: 600; font-variant-numeric: tabular-nums; }
strong { font-weight: 650; }
code { padding: 1px 6px; border-radius: 6px; background: var(--field); font: 0.88em/1.5 var(--mono); }
.keys { display: inline-flex; align-items: center; gap: 3px; vertical-align: 1px; }
.keys i { color: var(--ink3); font-style: normal; font-size: 12px; }
.table { margin: 16px 0; overflow-x: auto; border-radius: 12px; box-shadow: 0 0 0 1px var(--line); }
table { width: 100%; border-collapse: collapse; font-size: 14.5px; line-height: 1.6; }
th { padding: 10px 14px; background: var(--panel-2); color: var(--ink2); font-weight: 600; text-align: left; white-space: nowrap; }
td { padding: 10px 14px; border-top: 1px solid var(--line); vertical-align: top; }
html[data-theme="light"] .table { background: var(--panel); }
.note { margin: 18px 0; padding: 14px 18px; border-radius: 12px; background: var(--accent-weak); font-size: 15px; line-height: 1.7; }
.note > b { display: flex; align-items: center; gap: 8px; color: var(--accent-ink); font-size: 14px; font-weight: 650; }
.note > b::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.note p { margin: 4px 0 0; }
.note.is-warn { background: var(--warn-bg); } .note.is-warn > b { color: var(--warn-ink); }
.note.is-now { background: var(--ok-bg); } .note.is-now > b { color: var(--ok-ink); }
.shot { margin: 22px 0 26px; }
.shot a { display: block; cursor: zoom-in; }
.shot img { display: block; width: auto; max-width: 100%; height: auto; margin: 0 auto; border-radius: 12px; box-shadow: var(--shot-shadow); background: var(--panel); }
html[data-theme="light"] .for-dark, html[data-theme="dark"] .for-light { display: none; }
.shot figcaption { margin-top: 10px; color: var(--ink2); font-size: 14px; line-height: 1.6; text-align: center; }
.pn { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; max-width: 760px; margin-top: 64px; }
.pn a { display: block; padding: 14px 18px; border-radius: 12px; box-shadow: 0 0 0 1px var(--line); color: var(--ink); font-weight: 600; }
.pn a:hover { box-shadow: 0 0 0 1px var(--accent); text-decoration: none; }
.pn small { display: block; color: var(--ink3); font-size: 13px; font-weight: 500; }
.pn .next { grid-column: 2; text-align: right; }

/* ---- front page cards ---- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin: 20px 0; }
.cards a { display: block; padding: 16px 18px; border-radius: 14px; background: var(--panel); box-shadow: var(--shadow); color: var(--ink); }
.cards a:hover { box-shadow: 0 0 0 1.5px var(--accent), var(--shadow); text-decoration: none; }
.cards b { display: block; font-size: 16px; }
.cards small { display: block; margin-top: 4px; color: var(--ink2); font-size: 14px; line-height: 1.55; }

/* ---- screenshot zoom ---- */
.zoom { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 24px; background: rgba(10, 8, 16, 0.72); cursor: zoom-out; }
.zoom img { max-width: 100%; max-height: 100%; border-radius: 12px; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5); }

/* ---- narrow screens ---- */
@media (max-width: 1180px) { .shell { grid-template-columns: var(--side-w) minmax(0, 1fr); } .toc { display: none; } }
@media (max-width: 860px) {
  :root { --top-h: 52px; }
  .shell { grid-template-columns: minmax(0, 1fr); }
  .menu-btn { display: grid; }
  .side { position: fixed; top: var(--top-h); left: 0; z-index: 15; width: min(300px, 86vw); background: var(--bg); box-shadow: 0 0 0 1px var(--line), 12px 0 32px rgba(0, 0, 0, 0.18); transform: translateX(-105%); transition: transform 220ms var(--ease-out); }
  body.is-menu .side { transform: none; }
  .doc { padding: 28px 20px 64px; }
  h1 { font-size: 28px; }
  .ver, .search kbd { display: none; }
  .top { padding: 0 12px; gap: 6px; }
  .brand span:last-child { display: none; }
  .get { padding: 7px 10px; }
  .hash { display: none; }
}
@media (max-width: 520px) { .get { display: none; } .pn { grid-template-columns: 1fr; } .pn .next { grid-column: 1; } }
@media (prefers-reduced-motion: reduce) { .side { transition: none; } }
