@font-face { font-family: "Outfit"; font-weight: 300; src: url("/lab/vendor/fonts/outfit/outfit-latin-300-normal.woff2") format("woff2"); }
@font-face { font-family: "Outfit"; font-weight: 400; src: url("/lab/vendor/fonts/outfit/outfit-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Outfit"; font-weight: 500; src: url("/lab/vendor/fonts/outfit/outfit-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Outfit"; font-weight: 600; src: url("/lab/vendor/fonts/outfit/outfit-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Outfit"; font-weight: 700; src: url("/lab/vendor/fonts/outfit/outfit-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "DM Mono"; font-weight: 400; src: url("/lab/vendor/fonts/dm-mono/dm-mono-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "DM Mono"; font-weight: 500; src: url("/lab/vendor/fonts/dm-mono/dm-mono-latin-500-normal.woff2") format("woff2"); }

:root {
  --bg: #05080f;
  --panel: rgba(10, 18, 34, 0.72);
  --panel-line: rgba(140, 180, 235, 0.16);
  --text: #e8eef7;
  --muted: #8d9bb3;
  --cyan: #5fd8ff;
  --amber: #ffb347;
  --red: #ff5a4e;
  --green: #52f0a0;
  --sans: "Outfit", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --mono: "DM Mono", "PingFang SC", monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-family: var(--sans); overflow: hidden; -webkit-font-smoothing: antialiased; }
#stage { position: fixed; inset: 0; }
#stage canvas { display: block; width: 100%; height: 100%; touch-action: none; }
button { font-family: inherit; }

.ui { position: fixed; inset: 0; pointer-events: none; transition: opacity .35s; }
.ui.hidden { opacity: 0; }
.ui.hidden * { pointer-events: none !important; }

/* ---------- left block ---------- */
.hud-left { position: absolute; left: 28px; top: 24px; width: 330px; pointer-events: none; }
.kicker { font: 600 10.5px/1 var(--sans); letter-spacing: .22em; color: var(--cyan); opacity: .9; }
.title { margin: 10px 0 8px; font-weight: 700; font-size: 30px; line-height: 1.12; letter-spacing: .01em; }
.title span { display: block; }
.title .accent { color: var(--amber); }
.hook { margin: 0 0 14px; font-size: 13px; line-height: 1.55; color: #b9c5d8; max-width: 320px; }
.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 8px; }
.card { background: var(--panel); border: 1px solid var(--panel-line); border-radius: 10px; padding: 8px 9px 7px; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.card-label { font-size: 11px; color: var(--muted); white-space: nowrap; }
.card-value { margin-top: 3px; display: flex; align-items: baseline; gap: 3px; white-space: nowrap; }
.card .num { font: 500 21px/1.1 var(--mono); color: var(--cyan); letter-spacing: -.02em; }
.card .unit { font-size: 11px; color: var(--muted); }
.card.flash .num { color: var(--amber); }
.narration { background: var(--panel); border: 1px solid var(--panel-line); border-radius: 12px; padding: 9px 12px 10px; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.narration-head { display: flex; align-items: center; gap: 7px; font-size: 11px; color: var(--muted); letter-spacing: .06em; }
.narration-head .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--amber); box-shadow: 0 0 8px var(--amber); }
.narration p { margin: 5px 0 0; font-size: 13px; line-height: 1.6; color: #d7e0ec; }
.narration b { color: var(--amber); font-weight: 600; }

/* ---------- right panel ---------- */
.hud-right { position: absolute; right: 20px; top: 20px; width: 272px; max-height: calc(100% - 90px); pointer-events: auto; background: var(--panel); border: 1px solid var(--panel-line); border-radius: 14px; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); display: flex; flex-direction: column; }
.panel-scroll { overflow-y: auto; padding: 10px 12px 10px; }
.drawer-handle { display: none; }
.group { padding: 7px 0 8px; border-bottom: 1px solid rgba(140, 180, 235, 0.08); }
.group:last-of-type { border-bottom: none; }
.group-label { display: flex; align-items: baseline; gap: 6px; font-size: 11.5px; color: #c6d2e4; margin-bottom: 6px; letter-spacing: .03em; }
.group-label .hint { font-size: 10px; color: var(--muted); }
.group-label .val { margin-left: auto; font: 500 12px var(--mono); color: var(--amber); }
.collapsible .group-label { cursor: pointer; }
.collapsible .group-label::after { content: "▾"; margin-left: auto; color: var(--muted); font-size: 10px; }
.collapsible.collapsed .seg { display: none; }
.collapsible.collapsed .group-label { margin-bottom: 0; }
.slider-row { display: flex; align-items: center; gap: 8px; margin: 2px 0; }
.sl-name { font-size: 11px; color: var(--muted); width: 26px; }
.slider-row .val { font: 500 11.5px var(--mono); color: var(--cyan); width: 30px; text-align: right; }
input[type=range] { -webkit-appearance: none; appearance: none; flex: 1; width: 100%; height: 22px; background: transparent; cursor: pointer; margin: 0; }
input[type=range]::-webkit-slider-runnable-track { height: 3px; border-radius: 3px; background: linear-gradient(90deg, rgba(95, 216, 255, .7), rgba(95, 216, 255, .18)); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; margin-top: -5.5px; border-radius: 50%; background: #fff; border: 3px solid var(--cyan); box-shadow: 0 0 10px rgba(95, 216, 255, .6); }
input[type=range]::-moz-range-track { height: 3px; border-radius: 3px; background: rgba(95, 216, 255, .5); }
input[type=range]::-moz-range-thumb { width: 10px; height: 10px; border-radius: 50%; background: #fff; border: 3px solid var(--cyan); }
#cycle::-webkit-slider-thumb { border-color: var(--amber); box-shadow: 0 0 10px rgba(255, 179, 71, .6); }
#cycle::-webkit-slider-runnable-track { background: linear-gradient(90deg, rgba(255, 179, 71, .7), rgba(255, 179, 71, .18)); }
#grp-cycle.disabled { opacity: .4; }
#grp-cycle.disabled input { pointer-events: none; }
.seg { display: grid; gap: 4px; }
.seg-2 { grid-template-columns: 1fr 1fr; }
.seg-3 { grid-template-columns: repeat(3, 1fr); }
.seg-preset { grid-template-columns: repeat(3, 1fr); }
.seg button { background: rgba(255, 255, 255, 0.04); border: 1px solid rgba(140, 180, 235, 0.14); color: #c9d4e5; font-size: 11.5px; padding: 6px 2px; border-radius: 8px; cursor: pointer; transition: background .15s, border-color .15s, color .15s; white-space: nowrap; }
.seg button:hover { background: rgba(95, 216, 255, 0.10); border-color: rgba(95, 216, 255, .4); }
.seg button.on { background: rgba(95, 216, 255, 0.16); border-color: var(--cyan); color: #fff; }
.seg button.act { color: var(--amber); border-color: rgba(255, 179, 71, .35); }
.seg button.act:hover { background: rgba(255, 179, 71, .12); }
.seg button.act.red { color: #ff8a80; border-color: rgba(255, 90, 78, .4); }
.seg button.act.red:hover { background: rgba(255, 90, 78, .12); }
.row-actions { display: flex; gap: 6px; padding-top: 8px; }
.ghost { flex: 1; background: transparent; border: 1px solid rgba(140, 180, 235, 0.2); color: #b7c4d8; font-size: 11.5px; padding: 6px 8px; border-radius: 8px; cursor: pointer; }
.ghost:hover { border-color: var(--cyan); color: #fff; }
.ghost.round { flex: 0 0 30px; padding: 6px 0; font-weight: 700; }

.ui-toggle { position: fixed; right: 18px; bottom: 18px; width: 38px; height: 38px; border-radius: 50%; background: var(--panel); border: 1px solid var(--panel-line); color: #b7c4d8; cursor: pointer; display: grid; place-items: center; z-index: 5; }
.ui-toggle:hover { color: #fff; border-color: var(--cyan); }
body.ui0 .ui-toggle { display: none; }

.help { position: fixed; inset: 0; background: rgba(3, 6, 12, .55); display: grid; place-items: center; pointer-events: auto; z-index: 10; }
.help[hidden] { display: none; }
.help-card { position: relative; width: min(560px, calc(100% - 32px)); max-height: calc(100% - 60px); overflow-y: auto; background: rgba(12, 20, 36, .95); border: 1px solid var(--panel-line); border-radius: 16px; padding: 18px 22px 16px; }
.help-card h2 { font-size: 15px; margin: 6px 0 8px; color: var(--cyan); font-weight: 600; }
.help-card ul { margin: 0 0 10px; padding-left: 18px; font-size: 13px; line-height: 1.65; color: #d0d9e7; }
.help-card ul.small { font-size: 12px; color: #aab7cb; }
.help-card kbd { font-family: var(--mono); background: rgba(255,255,255,.08); padding: 0 5px; border-radius: 4px; }
.help-close { position: absolute; right: 12px; top: 10px; background: none; border: none; color: #9fb0c8; font-size: 22px; cursor: pointer; }

.nogl { position: fixed; inset: 0; display: grid; place-items: center; background: var(--bg); z-index: 20; padding: 24px; }
.nogl[hidden] { display: none; }
.nogl div { max-width: 460px; }
.nogl h2 { color: var(--amber); }
.nogl p { color: #c3cfdf; line-height: 1.7; }
.loading { position: fixed; inset: 0; display: flex; gap: 12px; align-items: center; justify-content: center; background: var(--bg); color: var(--muted); font-size: 13px; z-index: 15; transition: opacity .5s; }
.loading.done { display: none; }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid rgba(95, 216, 255, .2); border-top-color: var(--cyan); animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
canvas.grab { cursor: grab; }
canvas.pointer { cursor: pointer; }
canvas.ew { cursor: ew-resize; }
canvas.grabbing { cursor: grabbing; }

/* ---------- phone ---------- */
@media (max-width: 699px) {
  .hud-left { left: 14px; top: 12px; width: calc(100% - 28px); }
  .kicker { font-size: 9px; }
  .title { font-size: 21px; margin: 6px 0 4px; }
  .title span { display: inline; }
  .title .accent::before { content: " "; }
  .hook { display: none; }
  .cards { gap: 5px; margin-bottom: 6px; }
  .card { padding: 6px 7px 5px; border-radius: 8px; }
  .card .num { font-size: 16px; }
  .card-label { font-size: 10px; }
  .narration { padding: 7px 10px 8px; }
  .narration p { font-size: 12px; line-height: 1.5; }
  .hud-right { left: 0; right: 0; top: auto; bottom: 0; width: auto; max-height: 62%; border-radius: 16px 16px 0 0; transform: translateY(calc(100% - 44px)); transition: transform .35s cubic-bezier(.2,.8,.2,1); }
  .hud-right.open { transform: translateY(0); }
  .drawer-handle { display: flex; align-items: center; justify-content: center; height: 44px; flex: 0 0 44px; background: none; border: none; cursor: pointer; }
  .drawer-handle span { width: 42px; height: 4px; border-radius: 3px; background: rgba(200, 215, 240, .45); }
  .drawer-handle::after { content: "控制面板"; margin-left: 10px; font-size: 12px; color: var(--muted); }
  .ui-toggle { bottom: auto; top: 12px; right: 12px; width: 32px; height: 32px; }
}
