/* MDT prototype. Dark engine for the twin, light sheet for reading pages. */
@font-face { font-family: "Manrope"; src: url("../fonts/manrope-latin-300-normal.woff2") format("woff2"); font-weight: 300; font-display: swap; }
@font-face { font-family: "Manrope"; src: url("../fonts/manrope-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Manrope"; src: url("../fonts/manrope-latin-500-normal.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Manrope"; src: url("../fonts/manrope-latin-600-normal.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url("../fonts/jetbrains-mono-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url("../fonts/jetbrains-mono-latin-500-normal.woff2") format("woff2"); font-weight: 500; font-display: swap; }

:root {
  --bg: #020308;
  --ink: #e9f1ff;
  --ink2: rgba(233, 241, 255, 0.72);
  --muted: rgba(233, 241, 255, 0.5);
  --faint: rgba(233, 241, 255, 0.28);
  --line: rgba(150, 190, 255, 0.13);
  --line2: rgba(150, 190, 255, 0.22);
  --glass: rgba(8, 13, 26, 0.58);
  --glass2: rgba(14, 22, 42, 0.72);
  --cyan: #6fe7ff;
  --heat: #ffb05c;
  --magenta: #ff5fd2;
  --green: #6cffb0;
  --warn: #ffd36b;
  --neg: #ff5c7a;
  --r: 16px;
  --sans: "Manrope", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --left: 312px;
  --right: 300px;
  --dockh: 86px;
  --chartsh: 190px;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); font-family: var(--sans); font-weight: 400; -webkit-font-smoothing: antialiased; overflow: hidden; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
#stage { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; touch-action: none; }
#labels { position: fixed; inset: 0; pointer-events: none; z-index: 3; }
.res-label { position: absolute; transform: translate(-50%, -140%); font: 500 11px/1 var(--mono); color: #0b0f1a; background: var(--warn); padding: 4px 7px; border-radius: 6px; white-space: nowrap; box-shadow: 0 0 20px rgba(255, 211, 107, 0.45); }
.res-label::after { content: ""; position: absolute; left: 50%; bottom: -5px; width: 1px; height: 5px; background: var(--warn); }

/* ---------- top bar ---------- */
.top { position: fixed; top: 0; left: 0; right: 0; height: 60px; display: flex; align-items: center; gap: 24px; padding: 0 20px; z-index: 20; background: linear-gradient(180deg, rgba(2, 3, 8, 0.85), rgba(2, 3, 8, 0)); }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.mark { width: 22px; height: 22px; border-radius: 50%; border: 1px solid rgba(111, 231, 255, 0.6); display: grid; place-items: center; box-shadow: 0 0 18px rgba(111, 231, 255, 0.35); }
.mark i { width: 8px; height: 8px; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 12px var(--cyan); animation: breathe 3.2s ease-in-out infinite; }
@keyframes breathe { 50% { transform: scale(0.7); opacity: 0.7; } }
.word { font-weight: 600; letter-spacing: 0.18em; font-size: 14px; }
.tag { font-size: 12px; color: var(--muted); letter-spacing: 0.02em; }
.nav { display: flex; gap: 4px; margin-left: 8px; }
.nav a { text-decoration: none; font-size: 13px; color: var(--ink2); padding: 7px 11px; border-radius: 999px; transition: background 0.2s, color 0.2s; }
.nav a:hover { color: var(--ink); background: rgba(255, 255, 255, 0.05); }
.nav a.on { color: #04101a; background: var(--cyan); }
.tools { margin-left: auto; display: flex; gap: 6px; }
.icon-btn { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line); background: rgba(10, 16, 30, 0.5); display: grid; place-items: center; color: var(--ink2); transition: 0.2s; }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn:hover { color: var(--ink); border-color: var(--line2); }
#btn-sound .wave { opacity: 0.25; }
#btn-sound[aria-pressed="true"] { color: var(--cyan); border-color: rgba(111, 231, 255, 0.5); }
#btn-sound[aria-pressed="true"] .wave { opacity: 1; }
#btn-menu { display: none; }

.flag { position: fixed; top: 64px; left: 50%; transform: translateX(-50%); z-index: 15; display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--ink2); padding: 7px 14px; border-radius: 999px; background: rgba(8, 13, 26, 0.6); border: 1px solid var(--line); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); max-width: min(760px, calc(100vw - 32px)); }
.flag b { color: var(--warn); font-weight: 600; }
.flag .short { display: none; }
.flag .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--warn); box-shadow: 0 0 10px var(--warn); flex: none; }

/* ---------- intro ---------- */
.intro { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; pointer-events: none; transition: opacity 1.2s ease; }
.intro.gone { opacity: 0; }
.intro-inner { text-align: center; padding: 0 24px; pointer-events: auto; }
.intro-kicker { font: 500 12px/1 var(--mono); letter-spacing: 0.4em; color: var(--cyan); margin-bottom: 26px; opacity: 0; animation: rise 1.2s 0.2s forwards; }
.intro-title { margin: 0; font-weight: 300; font-size: clamp(30px, 5.2vw, 68px); line-height: 1.08; letter-spacing: -0.02em; }
.intro-title span { display: block; opacity: 0; transform: translateY(14px); animation: rise 1.4s forwards; }
.intro-title span:nth-child(1) { animation-delay: 0.5s; }
.intro-title span:nth-child(2) { animation-delay: 1.2s; background: linear-gradient(90deg, #7ad8ff, #9dffb8 40%, #ffd36b 70%, #ff6fae); -webkit-background-clip: text; background-clip: text; color: transparent; }
.intro-title span:nth-child(3) { animation-delay: 1.9s; color: var(--ink2); }
.intro-sub { margin: 26px auto 0; max-width: 520px; color: var(--muted); font-size: 15px; line-height: 1.6; opacity: 0; animation: rise 1.2s 2.6s forwards; }
.intro-skip { margin-top: 30px; padding: 12px 22px; border-radius: 999px; border: 1px solid rgba(111, 231, 255, 0.45); background: rgba(111, 231, 255, 0.08); color: var(--ink); font-size: 14px; opacity: 0; animation: rise 1.2s 3s forwards; transition: background 0.2s; }
.intro-skip:hover { background: rgba(111, 231, 255, 0.18); }
@keyframes rise { to { opacity: 1; transform: none; } }

/* ---------- panels ---------- */
.panel { position: fixed; top: 104px; bottom: calc(var(--dockh) + var(--chartsh) + 26px); z-index: 10; overflow-y: auto; overflow-x: hidden; padding: 6px 16px 16px; border-radius: var(--r); background: var(--glass); border: 1px solid var(--line); backdrop-filter: blur(18px) saturate(140%); -webkit-backdrop-filter: blur(18px) saturate(140%); box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.04); transition: transform 0.7s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.7s; scrollbar-width: thin; scrollbar-color: rgba(150, 190, 255, 0.2) transparent; }
.panel.left { left: 16px; width: var(--left); }
.panel.right { right: 16px; width: var(--right); }
body.pre .panel.left { transform: translateX(-120%); opacity: 0; }
body.pre .panel.right { transform: translateX(120%); opacity: 0; }
body.pre .dock, body.pre .charts, body.pre .flag { opacity: 0; transform: translateY(20px); }
body.charts-off .panel { bottom: calc(var(--dockh) + 22px); }
.sec { padding: 14px 0; border-bottom: 1px solid var(--line); }
.sec:last-child { border-bottom: 0; }
.sec-h { display: flex; align-items: center; justify-content: space-between; font-size: 10.5px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); margin-bottom: 10px; }
.mini { font-size: 11px; letter-spacing: 0.04em; text-transform: none; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line2); background: transparent; color: var(--ink2); }
.mini:hover { color: var(--ink); border-color: rgba(111, 231, 255, 0.5); }
.pill { font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; padding: 3px 8px; border-radius: 999px; }
.pill.synth { color: var(--warn); border: 1px solid rgba(255, 211, 107, 0.35); background: rgba(255, 211, 107, 0.06); }
.pill.real { color: var(--green); border: 1px solid rgba(108, 255, 176, 0.35); background: rgba(108, 255, 176, 0.06); }

.mol-current { display: flex; gap: 12px; align-items: center; }
.mol-swatch { width: 38px; height: 38px; border-radius: 12px; flex: none; position: relative; overflow: hidden; box-shadow: 0 0 22px var(--sw, rgba(111, 231, 255, 0.3)); background: radial-gradient(circle at 35% 35%, rgba(255, 255, 255, 0.8), var(--sw, #6fe7ff) 38%, rgba(0, 0, 0, 0.6) 100%); }
.mol-title { font-weight: 500; font-size: 15px; }
.mol-sub { color: var(--muted); font-size: 12px; margin-top: 2px; line-height: 1.4; }
.mol-list { margin-top: 12px; display: grid; gap: 4px; }
.mol-list[hidden] { display: none; }
.mol-group { font-size: 10.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--faint); margin: 8px 0 4px; }
.mol-item { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 10px; border: 1px solid transparent; background: transparent; text-align: left; width: 100%; }
.mol-item:hover { background: rgba(255, 255, 255, 0.04); border-color: var(--line); }
.mol-item.on { border-color: rgba(111, 231, 255, 0.45); background: rgba(111, 231, 255, 0.06); }
.mol-item .sw { width: 12px; height: 12px; border-radius: 50%; flex: none; box-shadow: 0 0 10px currentColor; }
.mol-item .nm { font-size: 13px; }
.mol-item .pk { margin-left: auto; font: 11px var(--mono); color: var(--muted); }

.slider { display: block; margin-bottom: 14px; }
.sl-top { display: flex; justify-content: space-between; align-items: baseline; font-size: 13px; color: var(--ink2); margin-bottom: 6px; }
.sl-top output { font: 500 13px var(--mono); color: var(--ink); }
.sl-scale { display: flex; justify-content: space-between; font: 10px var(--mono); color: var(--faint); margin-top: 3px; }
input[type="range"] { -webkit-appearance: none; appearance: none; width: 100%; height: 22px; background: transparent; margin: 0; }
input[type="range"]::-webkit-slider-runnable-track { height: 4px; border-radius: 4px; background: linear-gradient(90deg, var(--a, #4f8cff), var(--b, #ff6a4f)); opacity: 0.85; }
input[type="range"]::-moz-range-track { height: 4px; border-radius: 4px; background: linear-gradient(90deg, var(--a, #4f8cff), var(--b, #ff6a4f)); }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%; background: #fff; margin-top: -6px; box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.12), 0 0 18px rgba(111, 231, 255, 0.6); }
input[type="range"]::-moz-range-thumb { width: 16px; height: 16px; border-radius: 50%; background: #fff; border: 0; box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.12), 0 0 18px rgba(111, 231, 255, 0.6); }
#in-pH { --a: #ff6a88; --b: #6a8cff; }
#in-time { --a: #b98cff; --b: #6fe7ff; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips button { font-size: 12px; padding: 6px 11px; border-radius: 999px; border: 1px solid var(--line); background: transparent; color: var(--ink2); transition: 0.2s; }
.chips button:hover { border-color: var(--line2); color: var(--ink); }
.chips button.on { background: rgba(111, 231, 255, 0.12); border-color: rgba(111, 231, 255, 0.55); color: var(--ink); }
.toggles { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.toggles label { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ink2); cursor: pointer; }
.toggles input { appearance: none; -webkit-appearance: none; width: 28px; height: 16px; border-radius: 999px; background: rgba(255, 255, 255, 0.12); position: relative; transition: 0.2s; margin: 0; flex: none; }
.toggles input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 12px; height: 12px; border-radius: 50%; background: #cfd9ea; transition: 0.2s; }
.toggles input:checked { background: rgba(111, 231, 255, 0.55); }
.toggles input:checked::after { left: 14px; background: #fff; }

.mut-hint { font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.mut-card .mc-h { display: flex; align-items: baseline; gap: 10px; }
.mut-card .mc-res { font: 500 20px var(--mono); }
.mut-card .mc-info { font-size: 12px; color: var(--muted); }
.mut-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 5px; margin-top: 10px; }
.mut-grid button { padding: 6px 0 5px; border-radius: 8px; border: 1px solid var(--line); background: var(--c, transparent); font: 500 12px var(--mono); line-height: 1.1; transition: transform 0.15s, border-color 0.15s; }
.mut-grid button small { display: block; font-size: 9.5px; opacity: 0.75; font-weight: 400; }
.mut-grid button:hover { transform: translateY(-1px); border-color: rgba(255, 255, 255, 0.5); }
.mut-grid button.wt { outline: 1px dashed rgba(255, 255, 255, 0.4); opacity: 0.6; }
.mut-legend { display: flex; justify-content: space-between; font: 10px var(--mono); color: var(--faint); margin-top: 6px; }
.mut-applied { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.mut-tag { font: 500 12px var(--mono); padding: 5px 9px; border-radius: 999px; background: rgba(255, 211, 107, 0.12); border: 1px solid rgba(255, 211, 107, 0.4); color: var(--warn); display: flex; gap: 6px; align-items: center; }
.mut-tag button { border: 0; background: none; padding: 0; color: inherit; opacity: 0.7; font-size: 13px; line-height: 1; }

.btn-row { display: grid; gap: 8px; }
.btn { padding: 10px 14px; border-radius: 12px; border: 1px solid rgba(111, 231, 255, 0.5); background: linear-gradient(180deg, rgba(111, 231, 255, 0.16), rgba(111, 231, 255, 0.06)); font-size: 13px; text-align: left; transition: 0.2s; }
.btn:hover { background: rgba(111, 231, 255, 0.22); }
.btn.ghost { border-color: var(--line2); background: transparent; }
.btn.ghost:hover { border-color: rgba(111, 231, 255, 0.5); }
.next-list { margin-top: 10px; display: grid; gap: 4px; }
.next-item { display: grid; grid-template-columns: 58px 1fr auto; align-items: center; gap: 8px; font-size: 12px; color: var(--ink2); padding: 5px 6px; border-radius: 8px; background: transparent; border: 1px solid transparent; text-align: left; width: 100%; }
.next-item:hover { border-color: var(--line); background: rgba(255, 255, 255, 0.03); }
.next-item b { font: 500 12px var(--mono); color: var(--ink); }
.next-item .bar { height: 4px; border-radius: 4px; background: linear-gradient(90deg, var(--cyan), rgba(111, 231, 255, 0.15)); }
.next-item span:last-child { font: 11px var(--mono); color: var(--muted); }
.next-cap { font-size: 11.5px; color: var(--muted); line-height: 1.5; margin-top: 4px; }

.design .row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.design label { font-size: 11px; color: var(--muted); display: grid; gap: 4px; }
.design input[type="number"] { width: 100%; padding: 7px 9px; border-radius: 9px; border: 1px solid var(--line2); background: rgba(0, 0, 0, 0.25); font: 13px var(--mono); }
.design .go { margin-top: 8px; width: 100%; }
.design-out { margin-top: 10px; display: grid; gap: 3px; max-height: 190px; overflow: auto; }
.design-out button { display: grid; grid-template-columns: 70px 1fr 1fr; gap: 6px; font: 11.5px var(--mono); color: var(--ink2); padding: 5px 6px; border-radius: 7px; border: 1px solid transparent; background: transparent; text-align: left; }
.design-out button:hover { border-color: var(--line); color: var(--ink); }
.design-out b { color: var(--ink); font-weight: 500; }

/* ---------- readout ---------- */
.ro-head { padding: 14px 0 12px; border-bottom: 1px solid var(--line); }
.ro-kind { font-size: 10.5px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--cyan); display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.ro-kind .legend { letter-spacing: 0.02em; text-transform: none; color: var(--muted); font-size: 10.5px; display: flex; align-items: center; gap: 4px; white-space: nowrap; }
.ro-kind .legend .dsrc { margin-left: 6px; }
.dsrc { display: inline-block; width: 6px; height: 6px; border-radius: 50%; flex: none; }
.dsrc.real { background: var(--green); box-shadow: 0 0 6px var(--green); }
.dsrc.calc { background: var(--cyan); box-shadow: 0 0 6px var(--cyan); }
.dsrc.synth { background: var(--warn); box-shadow: 0 0 6px var(--warn); }
.metric .k .dsrc { margin-top: 2px; }
.ro-name { font-weight: 300; font-size: 26px; letter-spacing: -0.01em; margin-top: 6px; line-height: 1.15; word-break: break-word; }
.ro-meta { font: 11.5px var(--mono); color: var(--muted); margin-top: 8px; line-height: 1.6; }
.ro-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--line); border-radius: 12px; overflow: hidden; margin: 14px 0; border: 1px solid var(--line); }
.metric { background: rgba(6, 10, 22, 0.88); padding: 11px 12px 10px; position: relative; }
.metric .k { font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); display: flex; justify-content: space-between; gap: 4px; }
.metric .k i { font-style: normal; letter-spacing: 0.04em; text-transform: none; }
.metric .v { font: 400 22px/1.15 var(--mono); margin-top: 6px; letter-spacing: -0.02em; }
.metric .v small { font-size: 12px; color: var(--muted); margin-left: 3px; letter-spacing: 0; }
.metric .u { font: 10.5px var(--mono); color: var(--faint); margin-top: 3px; }
.metric .spark { position: absolute; left: 0; bottom: 0; height: 2px; background: var(--c, var(--cyan)); box-shadow: 0 0 10px var(--c, var(--cyan)); transition: width 0.4s; }
.src { font-size: 9px; letter-spacing: 0.06em; text-transform: uppercase; padding: 1px 5px; border-radius: 4px; }
.src.real { color: var(--green); background: rgba(108, 255, 176, 0.08); }
.src.synth { color: var(--warn); background: rgba(255, 211, 107, 0.08); }
.src.calc { color: var(--cyan); background: rgba(111, 231, 255, 0.08); }
.ro-props { display: grid; gap: 7px; font-size: 12px; }
.prop { display: flex; justify-content: space-between; gap: 10px; color: var(--ink2); }
.prop span:last-child { font: 12px var(--mono); color: var(--ink); text-align: right; }
.ro-learn { margin-top: 14px; padding: 12px; border-radius: 12px; background: rgba(255, 211, 107, 0.05); border: 1px solid rgba(255, 211, 107, 0.2); font-size: 12px; color: var(--ink2); line-height: 1.5; }
.ro-learn b { font: 500 13px var(--mono); color: var(--ink); }

/* ---------- dock ---------- */
.dock { position: fixed; left: 16px; right: 16px; bottom: 14px; height: var(--dockh); z-index: 12; display: grid; grid-template-columns: 1.25fr 1fr auto; gap: 18px; align-items: center; padding: 10px 16px; border-radius: var(--r); background: var(--glass); border: 1px solid var(--line); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); transition: opacity 0.8s, transform 0.8s; }
.scalebar { min-width: 0; }
.sb-track { position: relative; height: 34px; display: grid; grid-template-columns: repeat(5, 1fr); }
.sb-track::before { content: ""; position: absolute; left: 10%; right: 10%; top: 9px; height: 1px; background: linear-gradient(90deg, rgba(111, 231, 255, 0.1), rgba(111, 231, 255, 0.5), rgba(255, 95, 210, 0.5)); }
.sb-stop { position: relative; background: none; border: 0; padding: 0; display: grid; justify-items: center; gap: 6px; color: var(--muted); font-size: 11.5px; }
.sb-stop i { width: 9px; height: 9px; border-radius: 50%; border: 1px solid rgba(111, 231, 255, 0.6); background: var(--bg); position: relative; z-index: 1; margin-top: 5px; transition: 0.3s; }
.sb-stop.on { color: var(--ink); }
.sb-stop.on i { background: var(--cyan); box-shadow: 0 0 12px var(--cyan); transform: scale(1.3); }
.sb-cursor { position: absolute; top: 3px; width: 13px; height: 13px; border-radius: 50%; border: 1px solid #fff; transform: translateX(-50%); pointer-events: none; box-shadow: 0 0 14px rgba(255, 255, 255, 0.7); transition: left 0.08s linear; }
.sb-read { display: flex; gap: 10px; align-items: baseline; margin-top: 4px; }
.sb-label { font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--faint); }
.sb-val { font: 500 13px var(--mono); }
.sb-stage { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.timebar { min-width: 0; }
.tb-top { display: flex; justify-content: space-between; align-items: baseline; }
.tb-val { font: 500 12px var(--mono); }
.tb-procs { display: flex; gap: 5px; overflow: hidden; margin-top: 2px; white-space: nowrap; mask-image: linear-gradient(90deg, #000 85%, transparent); }
.proc { font-size: 10.5px; padding: 3px 7px; border-radius: 999px; border: 1px solid var(--line); color: var(--faint); flex: none; transition: 0.3s; }
.proc.resolved { color: var(--ink); border-color: rgba(111, 231, 255, 0.55); background: rgba(111, 231, 255, 0.08); }
.proc.blur { color: var(--muted); border-style: dashed; }
.dock-charts { align-self: stretch; padding: 0 16px; border-radius: 12px; border: 1px solid var(--line2); background: transparent; font-size: 12px; color: var(--ink2); }
.dock-charts[aria-expanded="true"] { color: var(--ink); border-color: rgba(111, 231, 255, 0.5); }

/* ---------- charts ---------- */
.charts { position: fixed; left: 16px; right: 16px; bottom: calc(var(--dockh) + 22px); height: var(--chartsh); z-index: 11; display: grid; grid-template-columns: 1fr 1fr 1fr 1.6fr 1fr; gap: 10px; transition: opacity 0.6s, transform 0.6s; }
body.charts-off .charts { opacity: 0; transform: translateY(20px); pointer-events: none; }
.chart { margin: 0; border-radius: 14px; background: var(--glass); border: 1px solid var(--line); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); padding: 9px 10px 6px; display: flex; flex-direction: column; min-width: 0; }
.chart figcaption { font-size: 10.5px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chart figcaption em { font-style: normal; text-transform: none; letter-spacing: 0; color: var(--faint); margin-left: 6px; }
.chart canvas { flex: 1; width: 100%; min-height: 0; display: block; }

/* ---------- command bar ---------- */
.cmd { position: fixed; inset: 0; z-index: 40; display: grid; place-items: start center; padding-top: 16vh; background: rgba(2, 3, 8, 0.45); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.cmd[hidden] { display: none; }
.cmd-box { width: min(680px, calc(100vw - 32px)); border-radius: 18px; background: var(--glass2); border: 1px solid var(--line2); box-shadow: 0 30px 90px rgba(0, 0, 0, 0.6); overflow: hidden; }
#cmd-in { width: 100%; padding: 18px 20px; border: 0; background: transparent; font-size: 16px; outline: none; }
.cmd-out { border-top: 1px solid var(--line); padding: 12px 20px; font-size: 13.5px; color: var(--ink2); line-height: 1.6; min-height: 20px; max-height: 40vh; overflow: auto; }
.cmd-out:empty { display: none; }
.cmd-out code { font: 12.5px var(--mono); color: var(--cyan); }
.cmd-foot { display: flex; justify-content: space-between; padding: 9px 20px; font: 11px var(--mono); color: var(--faint); border-top: 1px solid var(--line); }

.toast { position: fixed; left: 50%; top: 104px; transform: translate(-50%, -10px); z-index: 45; padding: 10px 16px; border-radius: 12px; background: var(--glass2); border: 1px solid var(--line2); font-size: 13px; opacity: 0; transition: 0.35s; pointer-events: none; max-width: calc(100vw - 32px); }
.toast.on { opacity: 1; transform: translate(-50%, 0); }

.mtabs { display: none; }

/* ---------- reading sheet (light) ---------- */
.sheet { position: fixed; inset: 0; z-index: 25; overflow-y: auto; background: rgba(2, 3, 8, 0.35); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); animation: fadein 0.4s; }
.sheet[hidden] { display: none; }
@keyframes fadein { from { opacity: 0; } }
.sheet-inner { max-width: 880px; margin: 112px auto 60px; background: #f5f7fb; color: #0c1424; border-radius: 22px; padding: 56px 64px 64px; box-shadow: 0 40px 120px rgba(0, 0, 0, 0.5); animation: sheetin 0.6s cubic-bezier(0.2, 0.8, 0.2, 1); }
@keyframes sheetin { from { transform: translateY(40px); opacity: 0; } }
.sheet-close { position: fixed; top: 66px; right: max(20px, calc(50vw - 440px - 10px)); z-index: 26; padding: 8px 14px; border-radius: 999px; border: 1px solid rgba(255, 255, 255, 0.25); background: rgba(8, 13, 26, 0.7); color: #fff; font-size: 12.5px; }
.sheet h1 { font-weight: 300; font-size: 44px; line-height: 1.08; letter-spacing: -0.025em; margin: 0 0 18px; }
.sheet h2 { font-weight: 500; font-size: 22px; letter-spacing: -0.01em; margin: 44px 0 12px; }
.sheet h3 { font-weight: 600; font-size: 15px; margin: 26px 0 8px; }
.sheet p, .sheet li { font-size: 16px; line-height: 1.7; color: #26324a; }
.sheet .lede { font-size: 19px; line-height: 1.6; color: #1a2640; }
.sheet .kicker { font: 500 11px var(--mono); letter-spacing: 0.22em; text-transform: uppercase; color: #1f5cff; margin-bottom: 18px; }
.sheet table { width: 100%; border-collapse: collapse; margin: 16px 0 8px; font-size: 14px; }
.sheet th { text-align: left; font-weight: 600; font-size: 12px; letter-spacing: 0.04em; color: #fff; background: #13293d; padding: 10px 12px; }
.sheet td { padding: 10px 12px; vertical-align: top; color: #26324a; border-bottom: 1px solid #e3e8f2; line-height: 1.5; }
.sheet tr:nth-child(even) td { background: #eef2f8; }
.sheet .num { font-family: var(--mono); font-size: 13px; white-space: nowrap; }
.sheet .note { font-size: 13.5px; color: #56627a; }
.sheet .callout { border-radius: 14px; padding: 18px 20px; background: #fff; border: 1px solid #dfe5f0; margin: 20px 0; }
.sheet .callout.warn { background: #fff8e6; border-color: #f2dca0; }
.sheet .grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 18px 0; }
.sheet .card { background: #fff; border: 1px solid #dfe5f0; border-radius: 14px; padding: 18px 18px 14px; }
.sheet .card h3 { margin-top: 0; }
.sheet .card p { font-size: 14.5px; }
.sheet .layers { counter-reset: l; display: grid; gap: 10px; margin: 16px 0; padding: 0; list-style: none; }
.sheet .layers li { counter-increment: l; background: #fff; border: 1px solid #dfe5f0; border-radius: 14px; padding: 14px 18px 14px 56px; position: relative; }
.sheet .layers li::before { content: counter(l); position: absolute; left: 18px; top: 14px; width: 26px; height: 26px; border-radius: 50%; background: #13293d; color: #fff; font: 500 12px/26px var(--mono); text-align: center; }
.sheet .status { display: inline-block; font: 500 11px var(--mono); padding: 3px 8px; border-radius: 6px; }
.sheet .status.fail { background: #ffe6ea; color: #b0122f; }
.sheet .status.pass { background: #e2f8ec; color: #0c7a42; }
.sheet .status.todo { background: #eef2f8; color: #4a5773; }
.sheet .fig { background: #0b1222; border-radius: 14px; padding: 16px; margin: 18px 0; }
.sheet .fig canvas { width: 100%; height: 260px; display: block; }
.sheet .fig .cap { color: #9fb0cc; font-size: 12.5px; margin-top: 8px; line-height: 1.5; }
.sheet .foot { margin-top: 48px; padding-top: 18px; border-top: 1px solid #dfe5f0; font-size: 13px; color: #6a7690; }
.sheet a { color: #1f5cff; }

.nojs { position: fixed; inset: 0; display: grid; place-items: center; color: #fff; }

/* ---------- responsive ---------- */
@media (max-width: 1280px) {
  :root { --left: 290px; --right: 270px; }
  .tag { display: none; }
  .charts { grid-template-columns: 1fr 1fr 1fr 1.4fr; }
  .charts .chart:last-child { display: none; }
}
@media (max-width: 1060px) {
  .nav a { padding: 7px 8px; font-size: 12.5px; }
  .charts { grid-template-columns: 1fr 1fr 1.4fr; }
  .charts .chart:nth-child(1) { display: none; }
}
@media (max-width: 900px) {
  :root { --dockh: 0px; }
  html, body { overflow: hidden; }
  .top { height: 54px; padding: 0 14px; }
  .nav { display: none; position: fixed; top: 54px; left: 12px; right: 12px; flex-direction: column; padding: 8px; border-radius: 16px; background: var(--glass2); border: 1px solid var(--line2); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); }
  .nav.open { display: flex; }
  .nav a { font-size: 15px; padding: 11px 12px; }
  #btn-menu { display: grid; }
  .flag { top: 58px; font-size: 11px; padding: 6px 12px; border-radius: 12px; white-space: nowrap; }
  .flag .long { display: none; }
  .flag .short { display: inline; }
  .panel, .charts, .dock { display: none; }
  .panel.show, .charts.show, .dock.show { display: block; }
  .panel.show, .charts.show, .dock.show { position: fixed; left: 8px; right: 8px; top: auto; bottom: 66px; width: auto; max-height: 58vh; overflow-y: auto; transform: none; opacity: 1; z-index: 22; }
  .charts.show { display: grid; grid-template-columns: 1fr; height: auto; gap: 8px; padding: 0; background: none; border: 0; }
  .charts.show .chart { display: flex !important; height: 170px; }
  .dock.show { display: grid; grid-template-columns: 1fr; height: auto; gap: 12px; padding: 14px; }
  .dock-charts { display: none; }
  body.pre .panel, body.pre .dock, body.pre .charts { transform: none; }
  .mtabs { display: grid; grid-template-columns: repeat(4, 1fr); position: fixed; left: 8px; right: 8px; bottom: 8px; height: 50px; z-index: 23; border-radius: 16px; background: var(--glass2); border: 1px solid var(--line2); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); padding: 4px; gap: 4px; padding-bottom: max(4px, env(safe-area-inset-bottom)); }
  .mtabs button { border: 0; border-radius: 12px; background: transparent; font-size: 13px; color: var(--ink2); }
  .mtabs button.on { background: rgba(111, 231, 255, 0.14); color: var(--ink); }
  body.pre .mtabs { opacity: 0; }
  .sheet-inner { margin: 64px 10px 40px; padding: 34px 22px 40px; border-radius: 18px; }
  .sheet h1 { font-size: 32px; }
  .sheet .grid2 { grid-template-columns: 1fr; }
  .sheet table { display: block; overflow-x: auto; }
  .sheet-close { top: 60px; right: 14px; }
  .intro-sub { font-size: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
