@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: 600; src: url(/lab/vendor/fonts/outfit/outfit-latin-600-normal.woff2) format('woff2'); }
@font-face { font-family: Outfit; font-weight: 800; src: url(/lab/vendor/fonts/outfit/outfit-latin-800-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 {
  --ink: #e8eef7;
  --dim: #8fa0b8;
  --panel: rgba(11, 20, 36, 0.72);
  --line: rgba(140, 180, 230, 0.16);
  --cyan: #5fd8ff;
  --amber: #ffb54d;
  --cn: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #05080e; color: var(--ink); overflow: hidden; font-family: Outfit, var(--cn); -webkit-font-smoothing: antialiased; }
#stage { position: fixed; inset: 0; }
#stage canvas { display: block; width: 100%; height: 100%; touch-action: none; }
#nogl { position: fixed; inset: 0; display: grid; place-items: center; padding: 40px; font-size: 18px; line-height: 1.7; text-align: center; color: var(--ink); }
#nogl[hidden] { display: none; }
#ui { position: fixed; inset: 0; pointer-events: none; }
#ui.hidden > *:not(#btn-hide), #ui.bare > * { display: none !important; }
#ui > * { pointer-events: auto; }

#intro { position: absolute; left: 28px; top: 24px; width: 318px; pointer-events: none; }
#intro > * { pointer-events: auto; }
.kicker { font: 600 11px/1 Outfit, var(--cn); letter-spacing: 0.22em; color: var(--amber); opacity: 0.9; }
h1 { margin: 10px 0 8px; font: 800 30px/1.18 Outfit, var(--cn); letter-spacing: 0.02em; }
h1 span { display: block; }
h1 .accent { color: var(--amber); text-shadow: 0 0 18px rgba(255, 170, 60, 0.35); }
.hook { margin: 0 0 14px; font-size: 13.5px; line-height: 1.6; color: #b9c6d8; }
#cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 10px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 8px 9px 7px; backdrop-filter: blur(8px); }
.card .lbl { font-size: 10.5px; color: var(--dim); white-space: nowrap; }
.card .val { margin-top: 3px; display: flex; align-items: baseline; gap: 3px; }
.card b { font: 500 19px/1 'DM Mono', monospace; color: var(--cyan); letter-spacing: -0.02em; }
.card i { font: 400 10.5px 'DM Mono', monospace; color: var(--dim); font-style: normal; }
#story { background: var(--panel); border: 1px solid var(--line); border-left: 2px solid var(--amber); border-radius: 10px; padding: 10px 12px; font-size: 13px; line-height: 1.65; color: #d6dfeb; backdrop-filter: blur(8px); min-height: 40px; }
#story b { color: var(--amber); font-weight: 600; }

#panel { position: absolute; right: 18px; top: 18px; width: 284px; max-height: calc(100% - 90px); overflow-y: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; backdrop-filter: blur(10px); scrollbar-width: none; }
.drawer-handle { display: none; }
.grp { border-bottom: 1px solid var(--line); }
.grp:last-child { border-bottom: 0; }
.grp h3 { margin: 0; padding: 10px 14px; font: 600 12.5px Outfit, var(--cn); color: var(--ink); cursor: pointer; display: flex; align-items: center; gap: 8px; user-select: none; }
.grp h3::before { content: ''; width: 5px; height: 5px; border-right: 1.5px solid var(--dim); border-bottom: 1.5px solid var(--dim); transform: rotate(-45deg); transition: transform .2s; }
.grp.open h3::before { transform: rotate(45deg); }
.grp h3 em { margin-left: auto; font: 400 10.5px 'DM Mono', var(--cn); color: var(--dim); font-style: normal; }
.grp .body { display: none; padding: 0 14px 12px; }
.grp.open .body { display: block; }
.seg { display: flex; gap: 3px; padding: 3px; background: rgba(0, 0, 0, 0.28); border-radius: 8px; margin-top: 6px; }
.seg button { flex: 1; min-width: 0; padding: 6px 2px; font: 500 12px Outfit, var(--cn); color: var(--dim); background: transparent; border: 0; border-radius: 6px; cursor: pointer; transition: background .15s, color .15s; }
.seg button:hover { color: var(--ink); }
.seg button.on { background: rgba(95, 216, 255, 0.16); color: var(--cyan); box-shadow: inset 0 0 0 1px rgba(95, 216, 255, 0.35); }
input[type=range] { width: 100%; accent-color: var(--amber); margin: 6px 0 0; }
.ticks { display: flex; justify-content: space-between; font: 400 10px 'DM Mono', monospace; color: var(--dim); }
.row { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--dim); margin-top: 8px; }
.row input { flex: 1; margin: 0; }
.row em { font: 400 11px 'DM Mono', monospace; font-style: normal; width: 34px; text-align: right; color: var(--ink); }
.chips { margin-top: 8px; display: grid; gap: 5px; }
.chiprow { display: flex; align-items: center; gap: 4px; font-size: 11.5px; color: var(--dim); }
.chiprow > span { width: 38px; flex: none; }
.chiprow button { width: 22px; height: 22px; flex: none; border-radius: 6px; border: 1px solid rgba(255, 255, 255, 0.12); cursor: pointer; padding: 0; }
.chiprow button.on { outline: 2px solid var(--cyan); outline-offset: 1px; }
.chiprow em { margin-left: auto; font: 400 11px 'DM Mono', monospace; font-style: normal; color: var(--ink); }
.tools { display: flex; gap: 6px; margin-top: 8px; }
.tools button { flex: 1; padding: 6px; font: 500 12px Outfit, var(--cn); color: var(--ink); background: rgba(255, 255, 255, 0.05); border: 1px solid var(--line); border-radius: 7px; cursor: pointer; }
.tools button:hover { border-color: rgba(95, 216, 255, 0.5); }

#btn-hide { position: absolute; right: 18px; bottom: 18px; padding: 7px 12px; font: 500 12px Outfit, var(--cn); color: var(--dim); background: var(--panel); border: 1px solid var(--line); border-radius: 8px; cursor: pointer; }
#tip { position: absolute; pointer-events: none; padding: 6px 9px; background: rgba(8, 14, 26, 0.9); border: 1px solid rgba(95, 216, 255, 0.35); border-radius: 8px; font: 400 11.5px/1.5 'DM Mono', var(--cn); color: var(--ink); white-space: nowrap; transform: translate(14px, 14px); }
#tip b { color: var(--cyan); font-weight: 500; }
#help { position: absolute; inset: 0; background: rgba(2, 5, 10, 0.6); display: grid; place-items: center; backdrop-filter: blur(3px); }
#help[hidden] { display: none; }
.help-card { position: relative; width: min(620px, calc(100% - 32px)); max-height: calc(100% - 60px); overflow-y: auto; background: rgba(12, 22, 40, 0.96); border: 1px solid var(--line); border-radius: 14px; padding: 18px 24px; font-size: 13.5px; line-height: 1.7; color: #cfd9e6; }
.help-card h2 { font: 600 15px Outfit, var(--cn); color: var(--amber); margin: 6px 0 4px; }
.help-card ul { margin: 0 0 8px; padding-left: 18px; }
.help-card ul.small { font-size: 12.5px; color: #aebbd0; }
.help-card b { color: var(--cyan); font-weight: 500; }
.help-card .x { position: absolute; right: 12px; top: 8px; background: none; border: 0; color: var(--dim); font-size: 22px; cursor: pointer; }

@media (max-width: 700px) {
  #intro { left: 14px; top: 12px; width: calc(100% - 28px); }
  .kicker { display: none; }
  h1 { font-size: 20px; margin: 6px 0 4px; }
  h1 span { display: inline; }
  h1 .accent { margin-left: 6px; }
  .hook { display: none; }
  #cards { gap: 5px; margin-bottom: 6px; }
  .card { padding: 6px 7px; }
  .card b { font-size: 15px; }
  .card .lbl { font-size: 9.5px; }
  #story { font-size: 12px; padding: 7px 10px; line-height: 1.55; }
  #panel { left: 0; right: 0; top: auto; bottom: 0; width: auto; max-height: 46%; border-radius: 14px 14px 0 0; transform: translateY(calc(100% - 38px)); transition: transform .3s; }
  #panel.up { transform: none; }
  .drawer-handle { display: flex; align-items: center; justify-content: center; gap: 8px; height: 38px; font-size: 12.5px; color: var(--dim); cursor: pointer; flex-direction: column; }
  .drawer-handle span { width: 36px; height: 4px; border-radius: 2px; background: rgba(255, 255, 255, 0.25); }
  #btn-hide { bottom: auto; top: 12px; right: 12px; padding: 5px 8px; font-size: 11px; }
}
