/* Storia site */
:root {
  --bg: #faf8f5;
  --bg-alt: #f3efe9;
  --surface: #ffffff;
  --surface-2: #f4f1ec;
  --ink: #1a1714;
  --ink-2: #3d3833;
  --muted: #6b645c;
  --line: #e6e0d8;
  --line-strong: #d3cbc0;
  --accent: #ad4722;
  --accent-2: #923a1b;
  --control: #8a8178;
  --accent-ink: #ffffff;
  --accent-soft: #f8e7df;
  --panel: #1c1a18;
  --panel-2: #2a2724;
  --panel-ink: #ece7e1;
  --panel-muted: #9c948b;
  --code-bg: #f1ede7;
  --shadow: 0 1px 2px rgba(40,30,20,.06), 0 2px 6px rgba(40,30,20,.05);
  --shadow-lg: 0 30px 60px -24px rgba(40,25,15,.35);
  --serif: "Fraunces", "Noto Serif JP", Georgia, serif;
  --sans: "Manrope", "Noto Sans JP", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --max: 1200px;
  --radius: 10px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #12100e; --bg-alt: #181512; --surface: #1d1a17; --surface-2: #25211d; --ink: #f2ede7; --ink-2: #d2cac1;
    --muted: #9a9187; --line: #2d2824; --line-strong: #3d3731; --accent: #e07a55; --accent-2: #f08c67; --accent-soft: #3a241b; --accent-ink: #12100e; --control: #6f675f;
    --panel: #0c0b0a; --panel-2: #1f1c19; --code-bg: #1b1815;
    --shadow: 0 1px 2px rgba(0,0,0,.4); --shadow-lg: 0 30px 60px -24px rgba(0,0,0,.8);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #12100e; --bg-alt: #181512; --surface: #1d1a17; --surface-2: #25211d; --ink: #f2ede7; --ink-2: #d2cac1;
  --muted: #9a9187; --line: #2d2824; --line-strong: #3d3731; --accent: #e07a55; --accent-2: #f08c67; --accent-soft: #3a241b; --accent-ink: #12100e; --control: #6f675f;
  --panel: #0c0b0a; --panel-2: #1f1c19; --code-bg: #1b1815;
  --shadow: 0 1px 2px rgba(0,0,0,.4); --shadow-lg: 0 30px 60px -24px rgba(0,0,0,.8);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 84px; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--sans); font-size: 16px; line-height: 1.65; -webkit-font-smoothing: antialiased; overflow-x: hidden; }
a { color: inherit; }
img, svg { display: block; max-width: 100%; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.skip { position: absolute; left: 16px; top: -60px; z-index: 100; background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 8px; font-weight: 700; text-decoration: none; }
.skip:focus { top: 12px; }
main:focus { outline: none; }
.accent { color: var(--accent); }
.container { max-width: var(--max); margin: 0 auto; padding: 0 28px; }
@media (max-width: 640px) { .container { padding: 0 16px; } }
:lang(ja) h1, :lang(ja) h2, :lang(ja) h3 { word-break: auto-phrase; }
h1, h2, h3 { font-family: var(--serif); font-optical-sizing: auto; }

/* ---------- header ---------- */
.site-header { position: sticky; top: 0; z-index: 50; background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-bottom: 1px solid transparent; transition: border-color .2s; }
.site-header.scrolled { border-bottom-color: var(--line); }
.site-header .container { display: flex; align-items: center; gap: 28px; height: 72px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; flex-shrink: 0; }
.logo { width: 34px; height: 34px; border-radius: 9px; background: #161616; color: #ececec; display: grid; place-items: center; flex-shrink: 0; }
.logo svg { width: 20px; height: 20px; }
.brand .word { font-family: var(--serif); font-weight: 600; font-size: 23px; letter-spacing: -.01em; }
.nav { display: flex; align-items: center; gap: 4px; }
.nav a { text-decoration: none; font-size: 14.5px; font-weight: 600; padding: 8px 14px; border-radius: 999px; color: var(--ink-2); }
.nav a:hover { background: var(--surface-2); color: var(--ink); }
.nav a[aria-current="page"] { background: var(--ink); color: var(--bg); }
.header-tools { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 38px; min-width: 38px; padding: 0 8px; border: 1px solid transparent; background: none; color: var(--ink-2); border-radius: 999px; cursor: pointer; text-decoration: none; font: 600 13px var(--sans); }
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.icon-btn svg { width: 19px; height: 19px; }
.lang { position: relative; }
.lang > button { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--control); background: var(--surface); color: var(--ink); font: 600 13px var(--sans); height: 38px; padding: 0 12px; border-radius: 999px; cursor: pointer; }
.lang > button svg { width: 16px; height: 16px; color: var(--muted); }
.lang ul { position: absolute; right: 0; top: calc(100% + 6px); min-width: 160px; list-style: none; margin: 0; padding: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg); z-index: 60; }
.lang ul[hidden] { display: none; }
.lang li a { display: block; padding: 10px 12px; border-radius: 8px; text-decoration: none; font-size: 14px; font-weight: 600; }
.lang li a:hover { background: var(--surface-2); }
.lang li a[aria-current="true"] { color: var(--accent); }
.menu-btn { display: none; }
@media (max-width: 860px) {
  .nav { display: none; position: absolute; top: 72px; left: 0; right: 0; flex-direction: column; align-items: stretch; padding: 8px 16px 16px; background: var(--bg); border-bottom: 1px solid var(--line); }
  .nav.open { display: flex; }
  .menu-btn { display: inline-flex; }
  .hide-sm { display: none !important; }
}

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 12px 22px; border-radius: 999px; font: 700 15px var(--sans); text-decoration: none; cursor: pointer; border: 1px solid transparent; transition: background .15s, transform .15s, border-color .15s; }
.btn svg { width: 18px; height: 18px; }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: var(--accent-2); transform: translateY(-1px); }
.btn.secondary { background: transparent; color: var(--ink); border-color: var(--control); }
.btn.secondary:hover { border-color: var(--ink); }
.btn.small { padding: 8px 16px; font-size: 13.5px; }
.actions { display: flex; gap: 12px; flex-wrap: wrap; }
.link { color: var(--accent); text-decoration: none; font-weight: 700; font-size: 14px; display: inline-flex; align-items: center; gap: 6px; }
.link svg { width: 16px; height: 16px; transition: transform .15s; }
.link:hover svg { transform: translateX(3px); }

/* ---------- hero ---------- */
.hero { padding: 72px 0 40px; text-align: center; position: relative; }
.hero::before { content: ""; position: absolute; inset: 0 0 auto; height: 560px; pointer-events: none;
  background: radial-gradient(60% 60% at 50% 0%, color-mix(in srgb, var(--accent) 14%, transparent), transparent 70%); }
.hero > * { position: relative; }
.pill { display: inline-flex; align-items: center; gap: 10px; padding: 6px 8px 6px 6px; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; font-size: 13.5px; font-weight: 600; text-decoration: none; box-shadow: var(--shadow); }
.pill b { background: var(--accent); color: var(--accent-ink); font-size: 12px; padding: 3px 10px; border-radius: 999px; }
.pill svg { width: 15px; height: 15px; color: var(--muted); margin-right: 4px; }
.hero h1 { font-size: clamp(42px, 6.6vw, 80px); line-height: 1.04; font-weight: 600; letter-spacing: -.025em; margin: 28px auto 22px; max-width: 900px; }
.hero h1 .accent { font-style: italic; font-weight: 500; }
.hero .sub { font-size: 19px; color: var(--ink-2); margin: 0 auto 34px; max-width: 660px; }
.hero .actions { justify-content: center; }
.hero .meta { margin: 22px 0 0; display: flex; justify-content: center; gap: 22px; flex-wrap: wrap; font-size: 13px; font-weight: 600; color: var(--muted); }
.hero .meta span { display: inline-flex; align-items: center; gap: 7px; }
.hero .meta svg { width: 15px; height: 15px; color: var(--accent); }
@media (max-width: 640px) { .hero { padding: 44px 0 24px; } .hero .sub { font-size: 16.5px; } }

.stage { max-width: 920px; margin: 56px auto 0; }
.terminal { background: var(--panel); color: var(--panel-ink); border-radius: 14px; box-shadow: var(--shadow-lg); overflow: hidden; font-family: var(--mono); font-size: 13px; line-height: 1.75; text-align: left; border: 1px solid #2c2926; }
.terminal .bar { display: flex; align-items: center; gap: 7px; padding: 12px 16px; border-bottom: 1px solid #2c2926; }
.terminal .bar i { width: 11px; height: 11px; border-radius: 50%; background: #3a3632; }
.terminal .bar b { margin: 0 auto; font-weight: 500; font-size: 12px; color: var(--panel-muted); transform: translateX(-20px); }
.terminal pre { margin: 0; padding: 18px 22px 22px; min-height: 290px; white-space: pre-wrap; word-break: break-word; overflow: hidden; }
.terminal .ln { display: block; }
.terminal .ln[hidden] { display: none; }
.terminal .p { color: #e07a55; }
.terminal .c { color: #f5c16c; }
.terminal .d { color: var(--panel-muted); }
.terminal .g { color: #9bd49b; }
.terminal .a { color: #8cc8e8; }
.terminal .w { color: #ffffff; }
.cursor { display: inline-block; width: 8px; height: 15px; background: var(--panel-ink); vertical-align: -2px; animation: blink 1s steps(1) 4; }
@keyframes blink { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .cursor { animation: none; } }

/* ---------- sections ---------- */
.section { padding: 96px 0; }
.section.alt { background: var(--bg-alt); }
.head { max-width: 720px; margin: 0 auto 48px; text-align: center; }
.kicker { font-size: 12.5px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); margin: 0 0 12px; }
.head h2 { font-size: clamp(32px, 4.2vw, 48px); line-height: 1.1; font-weight: 600; letter-spacing: -.02em; margin: 0 0 16px; }
.head p { color: var(--ink-2); font-size: 17.5px; margin: 0; }
@media (max-width: 640px) { .section { padding: 64px 0; } }

/* bento */
.bento { display: grid; grid-template-columns: repeat(12, 1fr); gap: 18px; }
.tile { grid-column: span 6; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 28px; display: flex; flex-direction: column; gap: 14px; min-width: 0; box-shadow: var(--shadow); }
.tile.w7 { grid-column: span 7; }
.tile.w5 { grid-column: span 5; }
.tile .tag { font-size: 12px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.tile .tag svg { width: 16px; height: 16px; color: var(--accent); }
.tile h3 { font-size: 27px; line-height: 1.15; font-weight: 600; letter-spacing: -.015em; margin: 0; }
.tile p { margin: 0; color: var(--ink-2); font-size: 15.5px; }
.tile .visual { margin-top: auto; padding-top: 8px; }
.tile .link { margin-top: 2px; }
@media (max-width: 960px) { .tile, .tile.w7, .tile.w5 { grid-column: span 12; } }

.screen { background: var(--panel); color: var(--panel-ink); border-radius: 12px; padding: 18px 20px; font-family: var(--mono); font-size: 12.5px; line-height: 1.75; overflow: hidden; }
.screen pre { margin: 0; white-space: pre-wrap; word-break: break-word; font: inherit; }
.screen .t { font-size: 11px; color: var(--panel-muted); margin-bottom: 10px; }
.screen .k { color: var(--panel-muted); }
.screen .g { color: #9bd49b; }
.screen .y { color: #f5c16c; }
.screen .r { color: #f08c78; }
.screen .a { color: #8cc8e8; }
.bars { display: grid; gap: 14px; font-family: var(--sans); }
.bar-row .lbl { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 6px; }
.bar-row .lbl b { font-family: var(--mono); font-weight: 500; }
.bar-row .track { height: 10px; border-radius: 6px; background: var(--panel-2); overflow: hidden; }
.bar-row .fill { height: 100%; border-radius: 6px; background: #8a8178; }
.bar-row.win .fill { background: var(--accent); }
.bar-note { margin-top: 12px; font-size: 11.5px; color: var(--panel-muted); font-family: var(--sans); }
.people { display: grid; gap: 10px; font-family: var(--sans); }
.person { display: grid; grid-template-columns: 76px 1fr 64px; gap: 12px; align-items: center; font-size: 13px; }
.person .track { height: 8px; border-radius: 6px; background: var(--panel-2); position: relative; }
.person .track i { position: absolute; inset: 0 auto 0 0; border-radius: 6px; background: #9bd49b; }
.person .track s { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--panel-muted); text-decoration: none; }
.person.over .track i { background: #f08c78; }
.person em { font-style: normal; font-family: var(--mono); font-size: 11.5px; color: var(--panel-muted); text-align: right; }
.person.over em { color: #f5c16c; }
.screen svg.diagram { width: 100%; height: auto; }
.mc { background: #1d1d1d; border-radius: 6px; padding: 12px 14px; font-size: 12.5px; text-align: center; line-height: 1.7; }
.mc .rows { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; text-align: left; margin: 8px 0; padding: 6px 0; border-top: 1px solid #333; border-bottom: 1px solid #333; }
.mc .rows span { display: flex; justify-content: space-between; }
.mc .rows i { font-style: normal; color: #9bd49b; }
.facts { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.facts div { background: var(--surface-2); border-radius: 12px; padding: 16px 18px; }
.facts b { display: block; font-family: var(--serif); font-size: 36px; font-weight: 600; line-height: 1.05; }
.facts b small { font-size: 20px; color: var(--accent); margin-left: 2px; }
.facts span { display: block; font-size: 13px; color: var(--muted); margin-top: 4px; }

/* programs */
.programs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; border: 1px solid var(--line); border-radius: 18px; overflow: hidden; background: var(--surface); }
.program { padding: 26px 24px; border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; }
.program:last-child { border-right: 0; }
.program h3 { font-size: 22px; font-weight: 600; margin: 6px 0 0; }
.program p { margin: 0; font-size: 14.5px; color: var(--ink-2); }
.program .req { font-size: 12.5px; font-weight: 700; color: var(--muted); }
.program .link { margin-top: auto; padding-top: 8px; }
@media (max-width: 960px) { .programs { grid-template-columns: repeat(2, 1fr); } .program:nth-child(2) { border-right: 0; } .program:nth-child(-n+2) { border-bottom: 1px solid var(--line); } }
@media (max-width: 560px) { .programs { grid-template-columns: 1fr; } .program { border-right: 0; border-bottom: 1px solid var(--line); } .program:last-child { border-bottom: 0; } }

.closing { background: var(--panel); color: var(--panel-ink); border-radius: 24px; padding: 56px; display: grid; grid-template-columns: 1.1fr 1fr; gap: 48px; align-items: center; }
.closing h2 { font-size: clamp(30px, 3.6vw, 42px); font-weight: 600; line-height: 1.12; margin: 0 0 14px; color: #fff; }
.closing p { color: var(--panel-muted); margin: 0 0 26px; }
.closing .btn.secondary { color: #fff; border-color: #8a8178; }
.closing .btn.secondary:hover { border-color: #fff; }
.closing pre { margin: 0; background: #000; border-radius: 12px; padding: 18px 20px; font-family: var(--mono); font-size: 13px; line-height: 1.8; white-space: pre-wrap; word-break: break-word; }
@media (max-width: 900px) { .closing { grid-template-columns: 1fr; padding: 32px 24px; gap: 28px; } }

/* ---------- footer ---------- */
.site-footer { border-top: 1px solid var(--line); padding: 56px 0 36px; font-size: 14px; color: var(--muted); }
.site-footer .top { display: grid; grid-template-columns: 1.4fr repeat(3, 1fr); gap: 32px; }
.site-footer .about p { margin: 14px 0 0; max-width: 300px; }
.site-footer h2 { margin: 4px 0 12px; font-family: var(--sans); font-size: 13px; font-weight: 800; color: var(--ink); }
.site-footer ul { list-style: none; margin: 0; padding: 0; }
.site-footer li { margin: 7px 0; }
.site-footer a { text-decoration: none; }
.site-footer a:hover { color: var(--accent); }
.site-footer .bottom { margin-top: 44px; padding-top: 22px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; font-size: 12.5px; }
@media (max-width: 820px) { .site-footer .top { grid-template-columns: 1fr 1fr; } .site-footer .about { grid-column: 1 / -1; } }

/* ---------- code ---------- */
code, pre, kbd { font-family: var(--mono); font-size: .88em; }
:not(pre) > code { background: var(--code-bg); border: 1px solid var(--line); padding: 1px 6px; border-radius: 5px; overflow-wrap: anywhere; }
pre { margin: 0; }
.codeblock { position: relative; margin: 20px 0; }
.codeblock pre, .hl pre, pre.plain { background: var(--panel); color: var(--panel-ink); border-radius: 10px; padding: 16px 18px; overflow-x: auto; line-height: 1.65; font-size: 13.5px; }
.copy { position: absolute; top: 8px; right: 8px; opacity: 0; transition: opacity .15s; height: 28px; font-size: 12px; padding: 0 10px; background: var(--panel-2); border: 1px solid #45403a; color: #eee; border-radius: 6px; cursor: pointer; font-family: var(--sans); }
.codeblock:hover .copy, .copy:focus { opacity: 1; }
@media (hover: none) { .copy { opacity: 1; } }
.hl .c, .hl .ch, .hl .cm, .hl .cp, .hl .cpf, .hl .c1, .hl .cs { color: #8a8279; font-style: italic; }
.hl .k, .hl .kc, .hl .kd, .hl .kn, .hl .kp, .hl .kr, .hl .kt, .hl .ow { color: #f08c78; }
.hl .nt, .hl .nb, .hl .bp { color: #8cc8e8; }
.hl .s, .hl .sa, .hl .sb, .hl .sc, .hl .dl, .hl .sd, .hl .s2, .hl .se, .hl .sh, .hl .si, .hl .sx, .hl .sr, .hl .s1, .hl .ss { color: #9bd49b; }
.hl .m, .hl .mb, .hl .mf, .hl .mh, .hl .mi, .hl .il, .hl .mo { color: #f5c16c; }
.hl .nf, .hl .nc, .hl .fm { color: #e7b7f5; }
.hl .na, .hl .nv, .hl .no { color: #b8d4f0; }
.hl .o, .hl .p { color: #d6cfc7; }
.hl .gp { color: #8a8279; user-select: none; }

/* ---------- docs ---------- */
.docs { display: grid; grid-template-columns: 264px minmax(0, 1fr) 224px; gap: 48px; max-width: 1400px; margin: 0 auto; padding: 0 28px; }
.sidebar { position: sticky; top: 72px; align-self: start; height: calc(100vh - 72px); overflow-y: auto; padding: 28px 12px 40px 0; }
.sidebar .group { margin-bottom: 20px; }
.sidebar .group-title { font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 0 0 6px; padding-left: 12px; }
.sidebar a { display: block; text-decoration: none; font-size: 14.5px; font-weight: 500; padding: 6px 12px; border-radius: 8px; color: var(--ink-2); }
.sidebar a:hover { background: var(--surface-2); }
.sidebar a[aria-current="page"] { color: var(--accent); background: var(--accent-soft); font-weight: 700; }
.search { position: relative; margin-bottom: 22px; }
.search input { width: 100%; height: 40px; padding: 0 12px 0 36px; border: 1px solid var(--control); background: var(--surface); color: var(--ink); border-radius: 999px; font: 14px var(--sans); }
.search input:focus { outline: none; border-color: var(--accent); }
.search svg { position: absolute; left: 12px; top: 12px; width: 16px; height: 16px; color: var(--muted); }
.search-results { position: absolute; left: 0; right: -140px; top: 46px; z-index: 30; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg); max-height: 60vh; overflow-y: auto; display: none; }
.search-results.open { display: block; }
.search-results a { display: block; margin: 0; padding: 10px 14px; border-radius: 0; border-bottom: 1px solid var(--line); }
.search-results a:last-child { border-bottom: 0; }
.search-results a.active, .search-results a:hover { background: var(--accent-soft); }
.search-results .r-title { font-weight: 700; font-size: 14px; color: var(--ink); }
.search-results .r-sec { font-size: 12px; color: var(--muted); }
.search-results .r-text { font-size: 12.5px; color: var(--ink-2); margin-top: 2px; }
.search-results mark { background: var(--accent-soft); color: var(--accent); padding: 0 1px; }
.search-results .empty { padding: 14px; font-size: 13px; color: var(--muted); }

.doc { padding: 36px 0 80px; min-width: 0; }
.doc .crumbs { font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 8px; }
.doc .crumbs a { color: var(--ink-2); text-decoration: underline; text-underline-offset: 3px; font-weight: 600; }
.doc h1 { font-size: clamp(34px, 4.2vw, 46px); font-weight: 600; letter-spacing: -.02em; line-height: 1.12; margin: 0 0 12px; }
.doc .summary { font-size: 18px; color: var(--muted); margin: 0 0 32px; }
.doc h2 { font-size: 28px; font-weight: 600; line-height: 1.25; margin: 48px 0 12px; letter-spacing: -.01em; }
.doc h3 { font-size: 20px; font-weight: 600; margin: 30px 0 8px; }
.doc h4 { font-size: 16px; margin: 24px 0 6px; }
.doc p, .doc li { color: var(--ink-2); }
.doc strong { color: var(--ink); font-weight: 700; }
.doc a { color: var(--accent); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; font-weight: 600; }
.doc a:hover { text-decoration-thickness: 2px; }
.doc a.headerlink, .doc .pager a { text-decoration: none; }
.doc .headerlink { margin-left: 8px; color: var(--muted); opacity: 0; font-weight: 400; font-family: var(--sans); }
.doc h2:hover .headerlink, .doc h3:hover .headerlink { opacity: 1; }
.doc ul, .doc ol { padding-left: 22px; }
.doc li { margin: 4px 0; }
.doc hr { border: 0; border-top: 1px solid var(--line); margin: 40px 0; }
.doc blockquote { margin: 20px 0; padding: 4px 20px; border-left: 3px solid var(--line-strong); color: var(--muted); }
.table-wrap { overflow-x: auto; margin: 20px 0; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.doc table { border-collapse: collapse; width: 100%; font-size: 14px; }
.doc th, .doc td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
.doc th { background: var(--surface-2); font-weight: 700; color: var(--ink); }
.doc tr:last-child td { border-bottom: 0; }
.doc td code { white-space: nowrap; }
.admonition { margin: 24px 0; padding: 14px 18px; border: 1px solid var(--line); border-left: 4px solid var(--accent); background: var(--surface); border-radius: 10px; }
.admonition .admonition-title { margin: 0 0 4px; font-weight: 800; font-size: 14px; color: var(--ink); }
.admonition p:last-child { margin-bottom: 0; }
.admonition.warning, .admonition.danger { border-left-color: #d9a21b; }
.admonition.tip { border-left-color: #4f9d69; }

.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 64px; }
.pager a { display: block; padding: 14px 18px; border: 1px solid var(--line); border-radius: 12px; text-decoration: none; background: var(--surface); }
.pager a:hover { border-color: var(--accent); text-decoration: none; }
.pager .dir { display: block; font-size: 12.5px; color: var(--muted); font-weight: 600; }
.pager .t { font-family: var(--serif); font-size: 18px; font-weight: 600; color: var(--ink); }
.pager .next { text-align: right; grid-column: 2; }

.toc { position: sticky; top: 72px; align-self: start; padding: 36px 0; font-size: 13px; max-height: calc(100vh - 72px); overflow-y: auto; }
.toc .title { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 0 0 10px; }
.toc ul { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--line); }
.toc li a { display: block; padding: 4px 0 4px 14px; margin-left: -1px; text-decoration: none; color: var(--muted); border-left: 2px solid transparent; }
.toc li.l3 a { padding-left: 26px; }
.toc li a:hover { color: var(--ink); }
.toc li a.active { color: var(--accent); border-left-color: var(--accent); font-weight: 600; }
.docs-menu { display: none; }
@media (max-width: 1180px) { .docs { grid-template-columns: 240px minmax(0, 1fr); } .toc { display: none; } }
@media (max-width: 860px) {
  .docs { grid-template-columns: minmax(0, 1fr); gap: 0; padding: 0 16px; }
  .sidebar { display: none; position: static; height: auto; border-bottom: 1px solid var(--line); padding: 16px 0; }
  .sidebar.open { display: block; }
  .docs-menu { display: flex; margin: 16px 0 0; width: 100%; justify-content: space-between; border: 1px solid var(--line); background: var(--surface); border-radius: 12px; }
  .search-results { right: 0; }
  .doc { padding-top: 24px; }
}

/* ---------- downloads ---------- */
.page-head { padding: 72px 0 36px; text-align: center; }
.page-head h1 { font-size: clamp(40px, 5.6vw, 64px); font-weight: 600; letter-spacing: -.025em; line-height: 1.05; margin: 18px 0 16px; }
.page-head p { font-size: 18px; color: var(--ink-2); margin: 0 auto; max-width: 640px; }
.release { max-width: 920px; margin: 0 auto; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow); overflow: hidden; }
.release .rhead { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 22px 26px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.release .rhead h2 { font-size: 26px; font-weight: 600; margin: 0; }
.release .rhead span { font-size: 13.5px; color: var(--muted); font-weight: 600; }
.file { display: grid; grid-template-columns: auto 1fr auto; gap: 18px; align-items: center; padding: 20px 26px; border-bottom: 1px solid var(--line); scroll-margin-top: 90px; }
.file:last-child { border-bottom: 0; }
.file:target { background: var(--accent-soft); }
.file h3 { font-family: var(--sans); font-size: 16.5px; font-weight: 800; margin: 0; }
.file p { margin: 2px 0 0; font-size: 14px; color: var(--ink-2); }
.file .meta { margin-top: 4px; font-size: 12.5px; color: var(--muted); display: flex; gap: 12px; flex-wrap: wrap; }
.file .meta code { font-size: 11px; }
.file .sha { max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: inline-block; vertical-align: bottom; }
@media (max-width: 640px) { .file { grid-template-columns: auto 1fr; padding: 18px; } .file .btn { grid-column: 1 / -1; } }
.dl-note { max-width: 920px; margin: 16px auto 0; font-size: 13.5px; color: var(--muted); text-align: center; }
.dl-note a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; font-weight: 700; }
.history { max-width: 920px; margin: 0 auto; }
.history h2 { font-size: 30px; font-weight: 600; margin: 0 0 28px; }
.entry { position: relative; padding: 0 0 32px 36px; }
.entry::before { content: ""; position: absolute; left: 7px; top: 8px; bottom: 0; width: 2px; background: var(--line); }
.entry:last-child::before { bottom: auto; height: 12px; }
.entry::after { content: ""; position: absolute; left: 0; top: 4px; width: 16px; height: 16px; border-radius: 50%; background: var(--bg); border: 3px solid var(--accent); }
.entry .when { display: flex; gap: 12px; align-items: baseline; flex-wrap: wrap; }
.entry .when b { font-family: var(--serif); font-size: 22px; font-weight: 600; }
.entry .when time { font-size: 13px; color: var(--muted); font-weight: 600; }
.entry ul { list-style: none; margin: 10px 0 10px; padding: 0; }
.entry li { display: flex; gap: 10px; font-size: 14.5px; padding: 3px 0; color: var(--ink-2); }
.entry li a { font-family: var(--mono); font-size: 13px; color: var(--muted); text-decoration: none; flex-shrink: 0; padding-top: 1px; }
.entry li a:hover { color: var(--accent); }
.entry .files { display: flex; gap: 8px; flex-wrap: wrap; }
.entry .files a { font-size: 12.5px; font-weight: 700; text-decoration: none; padding: 4px 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); }
.entry .files a:hover { border-color: var(--accent); color: var(--accent); }

.notfound { text-align: center; padding: 120px 0; }
.notfound .code { font-family: var(--serif); font-size: 110px; font-weight: 600; color: var(--accent); line-height: 1; }
.notfound h1 { font-size: 30px; }
.notfound p { color: var(--ink-2); }
.notfound .actions { justify-content: center; }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.tile .screen .bar-note { color: var(--panel-muted); font-size: 11.5px; margin: 12px 0 0; }
.lang-short { display: none; }
@media (max-width: 480px) {
  .site-header .container { gap: 10px; }
  .header-tools { gap: 2px; }
  .lang-long { display: none; }
  .lang-short { display: inline; }
  .lang > button { padding: 0 10px; }
  .brand .word { font-size: 20px; }
}
.beta { display: inline-block; vertical-align: middle; margin-left: 10px; font-family: var(--sans); font-size: 12px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--accent-ink); background: var(--accent); padding: 3px 10px; border-radius: 999px; }
.entry .when .beta { margin-left: 0; }
.beta-head { max-width: 920px; margin: 48px auto 16px; font-size: 26px; font-weight: 600; }
.release.is-beta { border-style: dashed; border-color: var(--control); }
.beta-note { margin: 8px 0 0; font-size: 13.5px; color: var(--ink-2); }
.release .rhead .beta { color: var(--accent-ink); font-size: 12px; font-weight: 800; }

/* ---------- how it works ---------- */
.arch-fig { margin: 0 auto; max-width: 1100px; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 28px; box-shadow: var(--shadow); }
.arch-wrap { overflow-x: auto; }
.arch { min-width: 760px; width: 100%; height: auto; font-family: var(--sans); }
.arch .n rect { fill: var(--surface-2); stroke: var(--control); stroke-width: 1.5; }
.arch .n.main rect { fill: var(--accent); stroke: var(--accent); }
.arch .nt { text-anchor: middle; dominant-baseline: middle; font-size: 15px; font-weight: 800; fill: var(--ink); }
.arch .ns { text-anchor: middle; dominant-baseline: middle; font-size: 11.5px; font-family: var(--mono); fill: var(--muted); }
.arch .n.main .nt, .arch .n.main .ns { fill: var(--accent-ink); }
.arch .e { stroke: var(--muted); stroke-width: 1.6; }
.arch .e.dash { stroke-dasharray: 5 5; }
.arch .ah { fill: var(--muted); }
.arch .el { text-anchor: middle; font-size: 11.5px; font-weight: 700; fill: var(--muted); paint-order: stroke; stroke: var(--surface); stroke-width: 5px; stroke-linejoin: round; }
.arch .gh { text-anchor: middle; font-size: 12px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; fill: var(--accent); }
.arch .sep { stroke: var(--line); stroke-width: 1; stroke-dasharray: 2 6; }
.arch-steps { margin: 20px 0 0; padding-left: 22px; color: var(--ink-2); font-size: 14.5px; display: grid; gap: 4px; }
@media (max-width: 640px) { .arch-fig { padding: 16px; } }

.roles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; }
.role { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 28px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 14px; scroll-margin-top: 90px; }
.role-head { display: flex; gap: 14px; align-items: center; }
.role-head .logo { width: 44px; height: 44px; border-radius: 12px; }
.role-head .logo svg { width: 24px; height: 24px; }
.role h3 { font-size: 26px; font-weight: 600; margin: 0; line-height: 1.1; }
.role-sub { margin: 2px 0 0; font-size: 13px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--accent); }
.role dl { margin: 0; display: grid; grid-template-columns: 150px 1fr; gap: 10px 16px; font-size: 14.5px; }
.role dt { font-weight: 800; color: var(--ink); }
.role dd { margin: 0; color: var(--ink-2); }
.role .link { margin-top: auto; }
@media (max-width: 900px) { .roles { grid-template-columns: 1fr; } }
@media (max-width: 520px) { .role dl { grid-template-columns: 1fr; gap: 2px; } .role dd { margin-bottom: 10px; } .role { padding: 22px; } }

.layers { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.layer { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 22px; text-decoration: none; transition: border-color .15s, transform .15s; }
.layer:hover { border-color: var(--accent); transform: translateY(-2px); }
.layer h3 { font-size: 21px; font-weight: 600; margin: 0 0 8px; }
.layer p { margin: 0; font-size: 14.5px; color: var(--ink-2); }
@media (max-width: 900px) { .layers { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .layers { grid-template-columns: 1fr; } }

.two { display: grid; grid-template-columns: 1fr 1fr; gap: 56px; }
@media (max-width: 960px) { .two { grid-template-columns: 1fr; gap: 48px; } }
.sub-h { font-size: clamp(26px, 3vw, 34px); font-weight: 600; letter-spacing: -.015em; margin: 0 0 10px; }
.sub-p { color: var(--ink-2); margin: 0 0 24px; }
.journey { list-style: none; margin: 0; padding: 0; counter-reset: j; }
.journey li { counter-increment: j; position: relative; padding: 0 0 22px 48px; }
.journey li::before { content: counter(j); position: absolute; left: 0; top: 0; width: 30px; height: 30px; border-radius: 50%; background: var(--surface); border: 2px solid var(--control); display: grid; place-items: center; font-size: 13px; font-weight: 800; }
.journey li::after { content: ""; position: absolute; left: 15px; top: 32px; bottom: 2px; width: 2px; background: var(--line); }
.journey li:last-child::after { display: none; }
.journey p { margin: 6px 0 0; color: var(--ink-2); font-size: 15px; }
.who { display: inline-block; font-size: 12px; font-weight: 800; padding: 3px 10px; border-radius: 999px; }
.who-server { background: var(--accent); color: var(--accent-ink); }
.who-relay { background: var(--surface-2); color: var(--ink); border: 1px solid var(--control); }
.who-worker { background: var(--ink); color: var(--bg); }
.steps-list { list-style: none; margin: 16px 0 0; padding: 0; counter-reset: s2; display: grid; gap: 14px; }
.steps-list li { counter-increment: s2; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px 16px 58px; position: relative; }
.steps-list li::before { content: counter(s2); position: absolute; left: 18px; top: 16px; font-family: var(--serif); font-size: 24px; font-weight: 600; color: var(--accent); line-height: 1; }
.steps-list h3 { font-family: var(--sans); font-size: 16px; font-weight: 800; margin: 0 0 4px; }
.steps-list p { margin: 0; font-size: 14.5px; color: var(--ink-2); }

table.plain { border-collapse: collapse; width: 100%; font-size: 14.5px; }
table.plain th, table.plain td { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.plain thead th { background: var(--surface-2); font-weight: 800; color: var(--ink); }
table.plain tbody th { font-weight: 800; color: var(--ink); white-space: nowrap; }
table.plain td { color: var(--ink-2); }
table.plain tr:last-child th, table.plain tr:last-child td { border-bottom: 0; }
@media (max-width: 640px) { table.plain tbody th { white-space: normal; } }

.setups { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; }
.setup { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 26px 26px 22px; box-shadow: var(--shadow); }
.setup-n { position: absolute; top: 22px; right: 24px; font-family: var(--serif); font-size: 34px; font-weight: 600; color: var(--line-strong); line-height: 1; }
.setup h3 { font-size: 23px; font-weight: 600; margin: 0 0 6px; }
.setup > p { margin: 0 0 16px; color: var(--ink-2); font-size: 15px; }
.flow { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.chip { font-size: 13px; font-weight: 800; padding: 6px 12px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--control); }
.chip-storia { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.chip-players { background: transparent; }
.flow .arrow { color: var(--muted); font-weight: 800; }
.setup .uses { margin: 14px 0 0; font-size: 12.5px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
@media (max-width: 860px) { .setups { grid-template-columns: 1fr; } }
