:root {
  --ink: #07182d; --ink-2: #3c4a5d; --ink-3: #6b7788;
  --line: #d9dee6; --line-2: #e9edf2; --surface: #ffffff; --surface-2: #f4f6f9;
  --blue: #0a60ff; --blue-d: #0848c4; --cyan: #049fd9;
  --canvas: #060d19;
  --gh: 56px; --sb: 34px;
  --font: Inter, "Segoe UI", "Noto Sans", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--canvas); color: var(--ink); font: 14px/1.5 var(--font); overflow: hidden; -webkit-font-smoothing: antialiased; }
button, select, input { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: fixed; left: 8px; top: -60px; z-index: 100; background: var(--ink); color: #fff; padding: 8px 14px; border-radius: 4px; }
.skip:focus { top: 8px; }
[hidden] { display: none !important; }

/* ---------- global header */
.gh { position: fixed; top: 0; left: 0; right: 0; height: var(--gh); z-index: 30; display: flex; align-items: center; gap: 20px; padding: 0 24px; background: var(--surface); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-size: 19px; font-weight: 600; letter-spacing: -.01em; flex: none; }
.brand .mark { width: 26px; height: 26px; color: var(--ink); }
.search { position: relative; flex: 1; max-width: 620px; margin-left: 8px; }
.search input { width: 100%; height: 38px; padding: 0 40px 0 38px; border: 1px solid #b6bfcc; border-radius: 4px; background: var(--surface); outline: none; }
.search input::placeholder { color: var(--ink-3); }
.search input:hover { border-color: var(--ink-2); }
.search input:focus { border-color: var(--blue); box-shadow: 0 0 0 1px var(--blue); }
.search .ico { position: absolute; left: 11px; top: 10px; width: 18px; height: 18px; color: var(--ink-3); pointer-events: none; }
.search .slash { position: absolute; right: 10px; top: 8px; font: 12px var(--font); color: var(--ink-3); border: 1px solid var(--line); border-radius: 3px; padding: 1px 7px; background: var(--surface-2); }
.suggest { position: absolute; top: 44px; left: 0; right: 0; margin: 0; padding: 4px 0; list-style: none; background: var(--surface); border: 1px solid var(--line); border-radius: 4px; box-shadow: 0 8px 24px #07182d26; max-height: 62vh; overflow: auto; }
.suggest li { padding: 8px 14px; cursor: pointer; border-left: 3px solid transparent; }
.suggest li.on, .suggest li:hover { background: var(--surface-2); border-left-color: var(--blue); }
.suggest b { display: block; font-weight: 600; }
.suggest small { display: block; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.suggest mark { background: none; color: var(--blue); font-weight: 600; }
.gh-actions { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.sel select { height: 36px; padding: 0 28px 0 12px; border: 1px solid #b6bfcc; border-radius: 4px; background: var(--surface); cursor: pointer; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='m1 1 4 4 4-4' fill='none' stroke='%2307182d' stroke-width='1.5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; }
.sel select:hover { border-color: var(--ink-2); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 18px; border-radius: 999px; border: 1px solid transparent; background: none; font-weight: 500; cursor: pointer; text-decoration: none; color: var(--ink); white-space: nowrap; transition: background .12s, border-color .12s, color .12s; }
.btn.sm { height: 30px; padding: 0 14px; font-size: 13px; }
.btn.primary { background: var(--blue); color: #fff; }
.btn.primary:hover { background: var(--blue-d); }
.btn.outline { border-color: var(--ink); }
.btn.outline:hover { background: var(--ink); color: #fff; }
.btn.ghost:hover { background: var(--surface-2); }
.btn:disabled { opacity: .45; cursor: default; pointer-events: none; }

/* ---------- canvas */
#stage { position: fixed; top: var(--gh); left: 0; right: 0; bottom: var(--sb); background: radial-gradient(ellipse at 50% 40%, #0d1b30 0%, var(--canvas) 70%); outline: none; transition: right .2s; }
body.docked #stage { right: 380px; }
#stage canvas.gl { display: block; width: 100%; height: 100%; touch-action: none; }
.labels { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.label { position: absolute; left: 0; top: 0; font-size: 11.5px; letter-spacing: .01em; white-space: nowrap; color: #c3cfdf; text-shadow: 0 1px 3px #000c; will-change: transform; }
.label.root { font-size: 13px; font-weight: 600; color: #fff; }
.label.sel, .label.hov { color: #fff; font-weight: 600; }

/* ---------- hero (empty state) */
.hero { position: fixed; z-index: 10; left: clamp(24px, 6vw, 88px); top: calc(var(--gh) + (100vh - var(--gh) - var(--sb)) / 2); transform: translateY(-50%); max-width: 600px; color: #fff; transition: opacity .3s, visibility .3s; }
.hero.gone { opacity: 0; visibility: hidden; pointer-events: none; }
.eyebrow { margin: 0 0 14px; font-size: 13px; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; color: #5cc8ee; }
.hero h1 { margin: 0 0 16px; font-size: clamp(32px, 4.6vw, 52px); line-height: 1.1; font-weight: 500; letter-spacing: -.02em; }
.lead { margin: 0 0 26px; font-size: 17px; line-height: 1.55; color: #c3cfdf; max-width: 540px; }
.chips { display: flex; flex-wrap: wrap; gap: 10px; }
.chips button { height: 38px; padding: 0 18px; border-radius: 999px; border: 1px solid #fff; background: none; color: #fff; font-weight: 500; cursor: pointer; transition: background .12s, color .12s; }
.chips button:hover { background: #fff; color: var(--ink); }
.chips button:focus-visible { outline-color: #fff; }
.hint { margin: 26px 0 0; font-size: 13px; color: #8d9db3; }

/* ---------- panels */
.card, .pop { position: fixed; z-index: 15; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 4px 18px #00000040; }
.legend { left: 20px; bottom: calc(var(--sb) + 16px); padding: 12px 14px 12px; width: 220px; }
.legend h3, .settings h3, .dock h4 { margin: 0 0 8px; font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }
.legend button { display: flex; align-items: center; gap: 9px; width: 100%; background: none; border: 0; padding: 4px 4px; cursor: pointer; text-align: left; border-radius: 4px; }
.legend button:hover { background: var(--surface-2); }
.legend button.off { opacity: .4; }
.legend i { width: 10px; height: 10px; border-radius: 50%; flex: none; background: currentColor; }
.legend span { flex: 1; color: var(--ink); }
.legend em { font-style: normal; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.legend .key { margin: 10px 4px 0; padding-top: 10px; border-top: 1px solid var(--line-2); color: var(--ink-2); font-size: 12px; line-height: 1.5; }

.settings { top: calc(var(--gh) + 8px); right: 24px; width: 300px; padding: 16px 18px 14px; z-index: 40; }
.settings h3:not(:first-child) { margin-top: 16px; }
.settings label { display: block; margin: 10px 0; }
.settings label.rng { color: var(--ink); }
.settings output { float: right; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.settings input[type=range] { width: 100%; accent-color: var(--blue); margin: 6px 0 0; display: block; }
.settings label.chk { display: flex; align-items: center; gap: 9px; cursor: pointer; }
.settings input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--blue); }

.dock { position: fixed; z-index: 20; top: var(--gh); right: 0; bottom: var(--sb); width: 380px; background: var(--surface); border-left: 1px solid var(--line); overflow: auto; }
.dock .thumb { width: 100%; height: 190px; object-fit: cover; display: block; background: var(--surface-2); border-bottom: 1px solid var(--line); }
.dock .body { padding: 18px 20px 24px; }
.dock .close { position: absolute; top: 10px; right: 10px; background: #fffffff0; border: 1px solid var(--line); }
.dock h2 { margin: 0 0 6px; font-size: 22px; line-height: 1.25; font-weight: 600; letter-spacing: -.01em; }
.dock .sub { color: var(--ink-2); margin-bottom: 6px; }
.tag { display: inline-flex; align-items: center; gap: 6px; padding: 1px 10px 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 500; border: 1px solid var(--line); background: var(--surface-2); color: var(--ink); margin-right: 6px; }
.tag i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dock p.ext { color: var(--ink-2); margin: 12px 0 4px; font-size: 13.5px; line-height: 1.6; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; margin: 18px 0; background: var(--line); border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.stats div { background: var(--surface); padding: 10px 12px; }
.stats b { display: block; font-size: 20px; font-weight: 500; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.stats small { color: var(--ink-3); font-size: 12px; line-height: 1.3; display: block; }
.meter { height: 4px; background: var(--line-2); margin-top: 6px; border-radius: 2px; overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--blue); }
.btn.expand { width: 100%; height: 42px; margin: 6px 0 4px; background: var(--blue); color: #fff; font-size: 14px; font-weight: 600; }
.btn.expand:hover:not(:disabled) { background: var(--blue-d); }
.btn.expand:disabled { background: var(--surface-2); color: var(--ink-2); cursor: default; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 6px; }
.dock h4 { margin: 22px 0 8px; }
.rel { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line-2); }
.rel li { display: flex; align-items: center; gap: 10px; padding: 8px 4px; border-bottom: 1px solid var(--line-2); cursor: pointer; }
.rel li:hover { background: var(--surface-2); }
.rel li i { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.rel li span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rel li small { color: var(--ink-2); font-variant-numeric: tabular-nums; }

.tip { position: fixed; z-index: 50; pointer-events: none; max-width: 290px; padding: 9px 12px; border-radius: 6px; background: var(--ink); color: #fff; font-size: 12.5px; box-shadow: 0 6px 20px #0006; }
.tip b { display: block; font-size: 13.5px; font-weight: 600; }
.tip small { display: block; color: #b6c3d4; }

/* ---------- status bar */
.sb { position: fixed; left: 0; right: 0; bottom: 0; height: var(--sb); z-index: 25; display: flex; align-items: center; gap: 14px; padding: 0 20px; background: var(--surface); border-top: 1px solid var(--line); font-size: 12.5px; color: var(--ink-2); }
.sb .spacer { flex: 1; }
.prog { width: 80px; height: 3px; background: var(--line-2); overflow: hidden; border-radius: 2px; }
.prog i { display: block; height: 100%; width: 0; background: var(--blue); }
.prog.busy i { width: 40%; animation: slide 1.1s infinite ease-in-out; }
@keyframes slide { 0% { margin-left: -40%; } 100% { margin-left: 100%; } }
.tl { background: none; border: 0; color: var(--blue); cursor: pointer; padding: 4px 2px; font-size: 12.5px; }
.tl:hover { color: var(--blue-d); text-decoration: underline; }
.badge { padding: 0 9px; border: 1px solid var(--line); border-radius: 3px; color: var(--ink-2); font-size: 11.5px; line-height: 20px; background: var(--surface-2); }
.sb.err #stStatus { color: #c4262e; font-weight: 500; }

/* ---------- article reader */
.drawer { position: fixed; z-index: 60; top: var(--gh); bottom: var(--sb); right: 0; width: min(1000px, 100vw); background: var(--surface); border-left: 1px solid var(--line); display: flex; flex-direction: column; box-shadow: -12px 0 40px #00000055; animation: in .18s ease-out; }
@keyframes in { from { transform: translateX(24px); opacity: 0; } }
.drawer-head { display: flex; gap: 10px; align-items: center; padding: 12px 20px; border-bottom: 1px solid var(--line); }
.drawer-title { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.drawer-title strong { font-size: 18px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.drawer-title small { color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.drawer-body { flex: 1; display: flex; min-height: 0; }
.drawer-side { width: 260px; flex: none; border-right: 1px solid var(--line); background: var(--surface-2); overflow: auto; padding: 0 8px 16px; font-size: 13px; }
.tabs { display: flex; position: sticky; top: 0; background: var(--surface-2); border-bottom: 1px solid var(--line); margin: 0 -8px 10px; padding: 0 8px; }
.tabs button { flex: 1; background: none; border: 0; border-bottom: 2px solid transparent; padding: 11px 2px 9px; cursor: pointer; color: var(--ink-2); font-weight: 500; font-size: 13px; }
.tabs button:hover { color: var(--ink); }
.tabs button.on { color: var(--ink); border-bottom-color: var(--blue); }
.tabpane a { display: block; padding: 5px 8px; color: var(--ink); text-decoration: none; border-radius: 3px; cursor: pointer; }
.tabpane a:hover { background: #e3e9f1; }
.tabpane a.l2 { padding-left: 20px; color: var(--ink-2); } .tabpane a.l3 { padding-left: 32px; color: var(--ink-3); }
.tabpane ol { margin: 0; padding-left: 22px; } .tabpane li { margin: 0 0 9px; color: var(--ink-2); word-break: break-word; }
.tabpane li small { display: block; } .tabpane li small a { display: inline; padding: 0; color: var(--blue); }
.tabpane h5 { margin: 16px 4px 6px; color: var(--ink-3); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; font-weight: 600; }
.tabpane .row { display: flex; justify-content: space-between; gap: 10px; padding: 4px 8px; color: var(--ink-2); }
.tabpane .row span:last-child { color: var(--ink); font-variant-numeric: tabular-nums; }
.article { flex: 1; overflow: auto; padding: 28px 40px 72px; background: var(--surface); color: var(--ink); font: 15.5px/1.7 var(--font); }
.article h1, .article h2, .article h3, .article h4 { font-weight: 500; line-height: 1.25; letter-spacing: -.01em; color: var(--ink); }
.article h2 { border-bottom: 1px solid var(--line); padding-bottom: 6px; margin: 1.8em 0 .7em; font-size: 1.55em; }
.article h3 { font-size: 1.2em; margin-top: 1.4em; }
.article a { color: var(--blue); text-decoration: none; cursor: pointer; } .article a:hover { text-decoration: underline; }
.article a.cx-redlink { color: #c4262e; cursor: default; }
.article img { max-width: 100%; height: auto; }
.article .infobox { float: right; clear: right; margin: 4px 0 18px 28px; width: 310px; max-width: 45%; font-size: 13px; line-height: 1.45; background: var(--surface-2); border: 1px solid var(--line); border-collapse: collapse; }
.article .infobox th, .article .infobox td { padding: 5px 8px; vertical-align: top; text-align: left; border-bottom: 1px solid var(--line-2); }
.article .infobox-above { text-align: center !important; font-weight: 600; background: var(--ink); color: #fff; font-size: 15px; }
.article .thumb, .article figure { margin: 4px 0 14px 24px; float: right; clear: right; max-width: 260px; font-size: 12.5px; line-height: 1.45; background: var(--surface-2); border: 1px solid var(--line); padding: 6px; color: var(--ink-2); }
.article .thumb.tleft { float: left; margin: 4px 24px 14px 0; }
.article .thumbcaption, .article figcaption { padding: 4px 2px 0; }
.article table { border-collapse: collapse; max-width: 100%; }
.article .wikitable { background: var(--surface); border: 1px solid var(--line); font-size: 13.5px; line-height: 1.45; margin: 1.2em 0; display: block; overflow-x: auto; }
.article .wikitable th, .article .wikitable td { border: 1px solid var(--line); padding: 6px 10px; }
.article .wikitable th { background: var(--surface-2); font-weight: 600; }
.article sup.reference { font-size: 75%; line-height: 0; } .article .hatnote { color: var(--ink-2); font-style: italic; padding-left: 1.6em; margin-bottom: .6em; }
.article ol.references { font-size: 13.5px; line-height: 1.55; }
.article .mw-heading { clear: both; }
.article .lic { margin-top: 3.5em; padding-top: 1em; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--ink-3); }
.article .load { color: var(--ink-2); padding: 48px 0; text-align: center; }
.nojs { position: fixed; inset: 0; display: grid; place-items: center; color: #fff; }

@media (max-width: 900px) {
  :root { --gh: 104px; }
  .gh { flex-wrap: wrap; height: var(--gh); padding: 8px 14px; gap: 8px; align-content: flex-start; }
  .search { order: 3; flex: 1 0 100%; max-width: none; margin: 0; }
  .gh-actions { gap: 6px; } .btn { padding: 0 12px; }
  body.docked #stage { right: 0; }
  .dock { top: auto; width: auto; left: 0; max-height: 56vh; border-left: 0; border-top: 1px solid var(--line); box-shadow: 0 -8px 30px #0006; }
  .legend { display: none; }
  .drawer-side { display: none; } .article { padding: 18px; }
  .article .infobox { float: none; width: 100%; max-width: 100%; margin: 0 0 1em; }
  .hero { left: 20px; right: 20px; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
