@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: #07090d;
  --panel: rgba(10, 18, 32, 0.66);
  --panel-b: rgba(120, 190, 255, 0.14);
  --ink: #e8eef6;
  --dim: #8fa2b8;
  --cyan: #52e0ff;
  --amber: #ffb347;
  --orange: #ff8a3d;
  --cn: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --sans: 'Outfit', var(--cn);
  --mono: 'DM Mono', ui-monospace, var(--cn);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); font-family: var(--sans); overflow: hidden; }
#stage { position: fixed; inset: 0; }
#stage canvas { display: block; width: 100%; height: 100%; touch-action: none; }
#dip { position: fixed; inset: 0; background: #000; opacity: 0; pointer-events: none; }

/* ---------- 3D labels ---------- */
#leaders { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; }
#leaders line { stroke: rgba(200, 230, 255, 0.55); stroke-width: 1; }
#leaders circle { fill: #fff; }
#labels { position: fixed; inset: 0; pointer-events: none; }
.lbl { position: absolute; transform: translate(-50%, -50%); white-space: nowrap; font-size: 12px; line-height: 1;
  padding: 6px 10px 6px 9px; border-radius: 999px; background: rgba(8, 16, 30, 0.72); border: 1px solid rgba(140, 200, 255, 0.28);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); color: var(--ink); transition: opacity .25s; display: flex; gap: 6px; align-items: center; }
.lbl .n { font-weight: 500; }
.lbl .val { font-family: var(--mono); color: var(--cyan); }
.lbl .drag { font-size: 10px; color: #111; background: var(--amber); padding: 2px 6px; border-radius: 999px; }
.lbl.warm .val { color: var(--amber); }
.lbl.hidden { opacity: 0; }

/* ---------- HUD ---------- */
#ui { transition: opacity .3s; }
#ui.off { opacity: 0; pointer-events: none; }
#ui.off * { pointer-events: none !important; }
#hud { position: fixed; left: 28px; top: 24px; width: 336px; pointer-events: none; }
.kicker { font-size: 11px; letter-spacing: .22em; color: var(--cyan); font-weight: 500; }
h1 { margin: 8px 0 8px; font-size: 34px; line-height: 1.14; font-weight: 700; letter-spacing: .02em; font-family: var(--cn); }
h1 span { display: block; }
h1 .accent { color: var(--amber); text-shadow: 0 0 24px rgba(255, 150, 60, .35); }
.hook { margin: 0 0 14px; font-size: 13px; line-height: 1.6; color: #b9c6d6; max-width: 320px; }
.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.card { background: var(--panel); border: 1px solid var(--panel-b); border-radius: 12px; padding: 9px 10px 8px; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.card .k { font-size: 11px; color: var(--dim); }
.card .v { margin-top: 3px; display: flex; align-items: baseline; gap: 4px; }
.card b { font-family: var(--mono); font-weight: 500; font-size: 22px; color: var(--cyan); letter-spacing: -.02em; }
.card i { font-style: normal; font-size: 11px; color: var(--dim); }
.narr { margin-top: 8px; background: var(--panel); border: 1px solid var(--panel-b); border-left: 2px solid var(--amber); border-radius: 12px;
  padding: 10px 12px; font-size: 13px; line-height: 1.65; color: #d5deea; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); font-family: var(--cn); }
.narr b { color: var(--amber); font-weight: 600; }

/* ---------- panel ---------- */
#panel { position: fixed; right: 20px; top: 20px; width: 272px; background: var(--panel); border: 1px solid var(--panel-b); border-radius: 14px;
  padding: 6px 12px 10px; backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); font-family: var(--cn); }
.drawer-handle { display: none; }
.grp { border-bottom: 1px solid rgba(140, 190, 255, .09); }
.grp:last-child { border-bottom: 0; }
.grp h3 { margin: 0; padding: 8px 0 5px; font-size: 11px; letter-spacing: .16em; color: var(--dim); font-weight: 500; cursor: pointer; display: flex; justify-content: space-between; user-select: none; }
.grp h3 em { font-style: normal; }
.grp h3 em::after { content: '−'; color: var(--dim); }
.grp:not(.open) h3 em::after { content: '+'; }
.grp:not(.open) .body { display: none; }
.body { padding-bottom: 8px; display: flex; flex-direction: column; gap: 6px; }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; background: rgba(0, 0, 0, .25); border-radius: 9px; padding: 3px; }
.seg3 { grid-template-columns: repeat(3, 1fr); }
.seg4 { grid-template-columns: repeat(4, 1fr); }
button { font-family: inherit; }
.seg button, .presets button, .tools button, .tog { border: 0; background: transparent; color: #c4d0de; font-size: 12px; padding: 5px 0; border-radius: 7px; cursor: pointer; transition: background .15s, color .15s; }
.seg button:hover, .presets button:hover, .tools button:hover, .tog:hover { background: rgba(120, 190, 255, .10); }
.seg button.on { background: rgba(82, 224, 255, .18); color: #fff; box-shadow: inset 0 0 0 1px rgba(82, 224, 255, .45); }
.sl { display: grid; grid-template-columns: 34px 1fr 62px; align-items: center; gap: 8px; font-size: 12px; color: var(--dim); }
.sl b { font-family: var(--mono); font-weight: 500; color: var(--cyan); text-align: right; font-size: 12px; }
.sl.sm { grid-template-columns: 28px 1fr 42px; flex: 1; }
input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 4px; border-radius: 4px; background: rgba(140, 190, 255, .2); outline: none; }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 10px rgba(82, 224, 255, .7); cursor: grab; }
input[type=range]:disabled { opacity: .35; }
.row { display: flex; gap: 8px; align-items: center; }
.tog { padding: 6px 12px; background: rgba(0, 0, 0, .25); }
.tog.on { background: rgba(255, 179, 71, .2); color: #fff; box-shadow: inset 0 0 0 1px rgba(255, 179, 71, .55); }
.presets { display: grid !important; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.presets button { background: rgba(0, 0, 0, .25); }
.presets button.on { box-shadow: inset 0 0 0 1px rgba(255, 179, 71, .55); color: #fff; }
.tools { justify-content: space-between; }
.tools button { background: rgba(0, 0, 0, .25); padding: 6px 12px; }
#b-help { width: 32px; padding: 6px 0; font-weight: 600; }
#b-hide { position: fixed; right: 20px; bottom: 18px; border: 1px solid var(--panel-b); background: var(--panel); color: var(--dim); font-size: 12px;
  border-radius: 999px; padding: 7px 14px; cursor: pointer; font-family: var(--cn); backdrop-filter: blur(8px); }
#b-hide:hover { color: #fff; }
body.noui #b-hide { opacity: .5; }
body.rec #b-hide { display: none; }

/* ---------- help ---------- */
.help { position: fixed; inset: 0; background: rgba(2, 5, 10, .55); display: flex; align-items: center; justify-content: center; z-index: 20; font-family: var(--cn); }
.help.hidden, #nogl.hidden { display: none; }
.help-card { position: relative; width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 40px); overflow: auto; background: rgba(10, 18, 32, .94); border: 1px solid var(--panel-b); border-radius: 16px; padding: 18px 22px; }
.help-card h2 { font-size: 15px; margin: 6px 0 8px; color: var(--amber); }
.help-card ul { margin: 0 0 10px; padding-left: 18px; font-size: 13px; line-height: 1.7; color: #d3dce8; }
.help-card ul.small { font-size: 12px; color: #b6c3d3; }
.help-card kbd { font-family: var(--mono); background: rgba(255, 255, 255, .1); border-radius: 4px; padding: 0 5px; }
.help-card .x { position: absolute; right: 12px; top: 10px; border: 0; background: transparent; color: var(--dim); font-size: 22px; cursor: pointer; }
#nogl { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; text-align: center; padding: 24px; font-family: var(--cn); }
#nogl h2 { color: var(--amber); }

/* ---------- mobile ---------- */
@media (max-width: 699px) {
  #hud { left: 16px; right: 16px; top: 14px; width: auto; }
  .kicker { font-size: 10px; }
  h1 { font-size: 23px; margin: 4px 0 4px; }
  h1 span { display: inline; }
  h1 .accent { margin-left: .3em; }
  .hook { display: none; }
  .card { padding: 6px 8px; }
  .card b { font-size: 16px; }
  .card .k { font-size: 10px; }
  .cards { gap: 6px; }
  .narr { font-size: 11.5px; padding: 6px 9px; line-height: 1.5; margin-top: 6px; }
  #panel { left: 0; right: 0; top: auto; bottom: 0; width: auto; border-radius: 16px 16px 0 0; padding: 0 14px 12px; max-height: 58vh; overflow: auto;
    transform: translateY(calc(100% - 128px)); transition: transform .3s; }
  #panel.open { transform: none; }
  .drawer-handle { display: flex; justify-content: center; padding: 8px 0 4px; cursor: pointer; }
  .drawer-handle span { width: 40px; height: 4px; border-radius: 4px; background: rgba(200, 220, 255, .35); }
  .grp[data-g=preset], .grp[data-g=view] { }
  #b-hide { display: none; }
  .lbl { font-size: 10px; padding: 4px 8px; }
}
