/* Landing page — a scrollable document on the same dark ground as the theatre pages. */
:root {
  --bg: #0B1119; --bg-2: #0F1722; --panel: #121A26; --panel-2: #182231; --line: #1E2A3A; --line-2: #2A3848;
  --ink: #E6ECF4; --ink-2: #B9C3D3; --muted: #8A97AC; --dim: #55627A;
  --latent: #4ECDC4; --target: #F5B841; --prot-a: #5B8FF9; --prot-b: #E15C9C; --expl: #5AD469; --alert: #FF6B6B; --gold: #FFD166; --world-m: #F08A4B;
  --accent: #F5B841;
  --font-sans: 'IBM Plex Sans', 'PingFang SC', 'Hiragino Sans GB', 'Noto Sans CJK SC', 'Microsoft YaHei', system-ui, sans-serif;
  --font-mono: 'IBM Plex Mono', Menlo, Consolas, monospace;
  --font-display: 'Fraunces', 'Iowan Old Style', Georgia, serif;
  --measure: 66ch; --wrap: 1140px; --radius: 12px;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font-sans); font-size: 17px; line-height: 1.6; -webkit-font-smoothing: antialiased; }
a { color: var(--gold); text-decoration: none; border-bottom: 1px solid rgba(255, 209, 102, .35); }
a:hover { border-bottom-color: var(--gold); }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
code { font-family: var(--font-mono); font-size: .9em; }
::selection { background: rgba(245, 184, 65, .35); }
html[data-lang="en"] .zh { display: none !important; }
html[data-lang="zh"] .en { display: none !important; }
html[data-lang="zh"] body { font-size: 17.5px; }

/* ------------------------------------------------------------ header */
.site-header { position: sticky; top: 0; z-index: 20; background: rgba(11, 17, 25, .86); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.site-header .bar { max-width: var(--wrap); margin: 0 auto; padding: 12px 24px; display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.site-header .brand { font-family: var(--font-display); font-size: 18px; font-weight: 500; color: var(--ink); border: 0; margin-right: auto; white-space: nowrap; }
.site-header nav { display: flex; gap: 4px 14px; flex-wrap: wrap; align-items: center; }
.site-header nav a { font-size: 14px; color: var(--ink-2); border: 0; padding: 6px 2px; }
.site-header nav a:hover { color: var(--gold); }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; padding: 3px; background: var(--panel); }
.seg button { padding: 4px 12px; border-radius: 999px; color: var(--muted); font-size: 13.5px; font-weight: 500; }
.seg button.active { background: var(--panel-2); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }

/* ------------------------------------------------------------ layout */
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 24px; }
section.block { padding: 84px 0 24px; border-top: 1px solid var(--line); }
section.block:first-of-type { border-top: 0; }
.eyebrow { font-family: var(--font-mono); font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin: 0 0 14px; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 500; letter-spacing: -.008em; line-height: 1.12; text-wrap: balance; margin: 0; }
h1 { font-size: clamp(32px, 4.4vw, 56px); font-variation-settings: "SOFT" 40; }
h2 { font-size: clamp(26px, 3vw, 38px); margin-bottom: 18px; }
h3 { font-size: 22px; font-variation-settings: "SOFT" 30; }
.h2row { display: flex; align-items: baseline; gap: 12px; }
.copy-link { font-family: var(--font-mono); font-size: 12px; color: var(--dim); border: 1px solid var(--line); border-radius: 6px; padding: 2px 8px; opacity: .7; }
.copy-link:hover { color: var(--gold); border-color: var(--gold); opacity: 1; }
p { margin: 0 0 16px; max-width: var(--measure); color: var(--ink-2); text-wrap: pretty; }
p.lead { font-size: 1.2em; color: var(--ink); line-height: 1.5; }
p.def { font-size: 1.02em; color: var(--ink-2); border-left: 3px solid var(--latent); padding-left: 14px; }
blockquote.bottom-line { margin: 26px 0 0; padding: 18px 22px; border: 1px solid rgba(255, 209, 102, .5); background: rgba(255, 209, 102, .06); border-radius: var(--radius); max-width: 760px; }
blockquote.bottom-line p { margin: 0; color: var(--gold); font-weight: 500; font-size: 1.08em; max-width: none; }
.callout { border-left: 3px solid var(--latent); padding: 8px 18px; margin: 18px 0; background: var(--panel); border-radius: 0 var(--radius) var(--radius) 0; max-width: 760px; }
.callout p { margin: 6px 0; max-width: none; }
.big { font-family: var(--font-display); font-size: clamp(22px, 2.4vw, 30px); color: var(--ink); line-height: 1.3; margin: 18px 0 8px; max-width: 820px; text-wrap: balance; }
.scope { display: inline-flex; align-items: center; gap: 8px; font-family: var(--font-mono); font-size: 12px; letter-spacing: .04em; color: var(--muted); border: 1px solid var(--line-2); border-radius: 999px; padding: 4px 12px; margin: 0 0 18px; }
.scope::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--c, var(--muted)); }
.num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

/* actions */
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 26px 0 10px; }
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--panel); color: var(--ink); font-size: 15px; font-weight: 500; line-height: 1.2; }
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent); color: #1A1204; border-color: transparent; }
.btn.primary:hover { filter: brightness(1.06); }
.btn small { font-family: var(--font-mono); font-size: 11px; color: inherit; opacity: .75; letter-spacing: .04em; }
.btn.primary small { opacity: .8; }
.biblio { font-size: 14px; color: var(--muted); margin-top: 18px; }
.biblio i { color: var(--ink-2); }

/* ------------------------------------------------------------ hero */
.hero { padding: 56px 24px 40px; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); gap: 40px; align-items: center; }
.hero-fig { position: relative; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg-2); overflow: hidden; }
.hero-fig canvas { display: block; width: 100%; max-width: 100%; height: auto; }
.hero-fig .fig-cap { padding: 12px 16px 14px; border-top: 1px solid var(--line); font-size: 13.5px; color: var(--muted); display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; align-items: baseline; }
.hero-fig .fig-cap b { color: var(--ink); font-weight: 500; }
.hero-fig .fig-cap .v { font-family: var(--font-mono); font-size: 16px; white-space: nowrap; display: inline-block; }
#design-fig { touch-action: none; }
#design-fig.dragging { cursor: grabbing !important; }
.mini { font: inherit; font-size: 13px; padding: 5px 12px; border-radius: 999px; border: 1px solid var(--line); background: transparent; color: var(--ink-2); cursor: pointer; }
.mini:hover { color: var(--ink); border-color: var(--ink-2); }
.vp { color: var(--latent); } .vm { color: var(--world-m); }

/* ------------------------------------------------------------ two worlds interactive */
.tw { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(280px, .85fr); gap: 28px; margin: 26px 0 8px; }
.tw-fig { border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg-2); overflow: hidden; }
.tw-fig canvas { display: block; width: 100%; max-width: 100%; height: auto; }
.tw-controls { padding: 12px 16px 16px; border-top: 1px solid var(--line); display: grid; gap: 8px; }
.tw-controls label { font-family: var(--font-mono); font-size: 13px; color: var(--gold); display: flex; justify-content: space-between; }
.tw-controls input[type=range] { width: 100%; accent-color: var(--gold); }
.tw-controls .hint { font-size: 12.5px; color: var(--dim); font-family: var(--font-mono); display: flex; justify-content: space-between; }
.tw-panel { display: grid; gap: 14px; align-content: start; }
.tw-card { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); padding: 14px 16px; }
.tw-card h4 { margin: 0 0 10px; font-family: var(--font-mono); font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 500; }
.tw-card table { width: 100%; border-collapse: collapse; font-size: 14px; }
.tw-card td, .tw-card th { padding: 5px 0; text-align: right; font-family: var(--font-mono); font-weight: 400; font-variant-numeric: tabular-nums; }
.tw-card td:first-child, .tw-card th:first-child { text-align: left; font-family: var(--font-sans); color: var(--ink-2); }
.tw-card th { color: var(--muted); font-size: 12px; }
.tw-card .frozen { color: var(--prot-a); font-family: var(--font-mono); font-size: 12.5px; margin-top: 8px; }
.gauge { display: grid; grid-template-columns: 86px 1fr 64px; align-items: center; gap: 10px; margin: 8px 0; font-family: var(--font-mono); font-size: 14px; }
.gauge .bar { height: 14px; border: 1px solid var(--dim); border-radius: 4px; overflow: hidden; background: var(--bg); }
.gauge .bar i { display: block; height: 100%; width: 0; transition: width .25s ease; }
.gauge.p i { background: var(--latent); } .gauge.m i { background: var(--world-m); }
.gauge .val { text-align: right; }
.tw-card .gap { margin-top: 8px; color: var(--alert); font-family: var(--font-mono); font-size: 14px; }
.tw-card .sub { font-size: 13px; color: var(--muted); margin: 6px 0 0; max-width: none; }
.mini-player { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 4px; }
.mini-player .cap { flex: 1 1 100%; font-size: 14.5px; color: var(--ink); min-height: 1.4em; border-left: 3px solid var(--accent); padding-left: 10px; }
.mini-player .cap:empty { display: none; }
.tw.playing .tw-card[data-beat] { opacity: .45; transition: opacity .3s; }
.tw.playing .tw-card.on { opacity: 1; box-shadow: inset 0 0 0 1px var(--gold); }

/* ------------------------------------------------------------ cards */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; margin: 22px 0 8px; }
.card { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); padding: 20px 22px 18px; }
.card .k { font-family: var(--font-mono); font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--c, var(--muted)); margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.card .k::before { content: ""; width: 10px; height: 10px; border-radius: 3px; background: var(--c, var(--muted)); }
.card h3 { font-size: 20px; margin-bottom: 10px; }
.card p { font-size: 15.5px; margin: 0; max-width: none; }
.card .stat { font-family: var(--font-mono); font-size: 26px; color: var(--ink); margin: 6px 0 10px; display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; line-height: 1.2; }
.card .stat small { font-size: 13px; color: var(--muted); font-family: var(--font-sans); }
.card .stat .vs { font-size: 13px; color: var(--dim); font-family: var(--font-sans); }
.card .stat .muted { color: var(--muted); }

/* ------------------------------------------------------------ figures in sections */
.fig { border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg-2); overflow: hidden; margin: 22px 0 10px; }
.fig canvas { display: block; width: 100%; max-width: 100%; height: auto; }
.fig .fig-cap { padding: 10px 16px 12px; border-top: 1px solid var(--line); font-size: 13.5px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 6px 20px; }
.fig .fig-cap b { color: var(--ink); font-weight: 500; }
.two-col { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 32px; align-items: start; }
.target-switch { display: inline-flex; border: 1px solid var(--line-2); border-radius: 999px; padding: 3px; background: var(--panel); margin: 8px 0 4px; }
.target-switch button { padding: 6px 14px; border-radius: 999px; color: var(--muted); font-size: 14px; font-weight: 500; }
.target-switch button.active { background: var(--panel-2); color: var(--ink); }
.legend { display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: 13px; color: var(--muted); }
.legend span::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 7px; vertical-align: -1px; background: var(--c); }

/* ------------------------------------------------------------ citation / closing */
.cite-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); gap: 28px; margin-top: 26px; }
.cite-box { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); padding: 18px 20px; }
.cite-box h4 { margin: 0 0 10px; font-family: var(--font-mono); font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); font-weight: 500; display: flex; justify-content: space-between; align-items: center; }
.cite-box pre { margin: 0; font-family: var(--font-mono); font-size: 12.5px; line-height: 1.5; color: var(--ink-2); white-space: pre-wrap; word-break: break-word; }
.cite-box .plain { font-size: 14.5px; color: var(--ink-2); margin: 0; max-width: none; }
.copy-btn { font-family: var(--font-mono); font-size: 12px; color: var(--gold); border: 1px solid rgba(255, 209, 102, .5); border-radius: 6px; padding: 3px 10px; }
.copy-btn:hover { background: rgba(255, 209, 102, .1); }
.res-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.res-list li { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; border-bottom: 1px solid var(--line); padding: 8px 0; font-size: 15px; }
.res-list li span { color: var(--muted); font-size: 13px; font-family: var(--font-mono); }
.toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%) translateY(20px); background: var(--panel-2); color: var(--ink); border: 1px solid var(--line-2); border-radius: 999px; padding: 10px 18px; font-size: 14px; opacity: 0; pointer-events: none; transition: all .25s; z-index: 30; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ------------------------------------------------------------ footer */
.site-foot { border-top: 1px solid var(--line); margin-top: 60px; padding: 28px 0 60px; color: var(--muted); font-size: 13.5px; line-height: 1.6; }
.site-foot .wrap { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 22px; }
.site-foot h4 { margin: 0 0 6px; font-family: var(--font-mono); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--dim); font-weight: 500; }

/* ------------------------------------------------------------ responsive */
@media (max-width: 900px) {
  .hero, .tw, .two-col, .cite-grid { grid-template-columns: minmax(0, 1fr); }
  .hero { padding: 40px 24px 24px; }
  section.block { padding: 60px 0 16px; }
  .site-header .brand { font-size: 16px; }
  .site-header nav a { font-size: 13px; }
}

/* typeset prose formulas (CPV.mathText.html) */
.mt { font-family: var(--font-sans); color: inherit; white-space: nowrap; font-variant-numeric: tabular-nums; }
.mt-i { font-style: italic; } .mt-r { font-style: normal; } .mt-b { font-weight: 600; }
.mt-txt { white-space: pre; }
.mt-sp { display: inline-block; }
.mt-rel { margin: 0 .26em; } .mt-bin { margin: 0 .18em; } .mt-pun { margin-right: .16em; }
.mt-big { font-size: 1.25em; line-height: 0; vertical-align: -.08em; }
.mt-sub, .mt-sup { font-size: .72em; line-height: 0; position: relative; }
.mt-sub { top: .24em; } .mt-sup { top: -.5em; }
.mt-sub.mt-after { margin-left: -.42em; }
.mt-acc { position: relative; display: inline-block; line-height: 1; }
.mt-hat { position: absolute; left: .08em; right: 0; top: -.32em; text-align: center; font-size: 1em; line-height: 1; font-style: normal; }
.mt-frac { display: inline-flex; flex-direction: column; align-items: center; vertical-align: middle; font-size: .92em; line-height: 1.25; margin: 0 .12em; }
.mt-num { padding: 0 .18em .05em; border-bottom: 1px solid currentColor; } .mt-den { padding: .05em .18em 0; }
.mt-d { display: block; text-align: center; margin: .55em 0; overflow-x: auto; white-space: nowrap; font-size: 1.04em; }
