/* 统一界面外壳（LAB-TEMPLATE v1 §1.8 / §2）：左上信息卡、底部控制条、3D 标签、"?" 说明、隐藏界面、3D 主手柄的小胶囊。
   由 shared/shell.js 生成 DOM，实验页面只需要 <link rel="stylesheet" href="../../shared/shell.css">。
   颜色取自 shared/palette.js（shell.js 启动时写成 --lt-* 变量），这里的回退值与 palette 一致。 */

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

:root {
  --lt-panel: rgba(12, 17, 28, 0.72);
  --lt-panel-strong: rgba(12, 17, 28, 0.86);
  --lt-line: rgba(243, 245, 249, 0.10);
  --lt-sans: Outfit, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --lt-mono: "DM Mono", ui-monospace, Menlo, monospace;
  --lt-gutter: 20px;
}
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--lt-bgTop, #0d131f); color: var(--lt-text, #f3f5f9); font-family: var(--lt-sans); -webkit-font-smoothing: antialiased; }
body { overscroll-behavior: none; }
.lt-shell { position: fixed; inset: 0; pointer-events: none; z-index: 10; }
.lt-shell.lt-hidden .lt-ui { opacity: 0; visibility: hidden; }
.lt-ui { transition: opacity .25s; }
.lt-glass { background: var(--lt-panel); border: 1px solid var(--lt-line); border-radius: 16px; backdrop-filter: blur(14px) saturate(1.2); -webkit-backdrop-filter: blur(14px) saturate(1.2); box-shadow: 0 10px 34px rgba(0, 0, 0, 0.35); }

/* ---- 左上信息卡 */
.lt-card { position: absolute; left: var(--lt-gutter); top: var(--lt-gutter); width: 318px; padding: 16px 18px 15px; pointer-events: auto; }
.lt-card h1 { margin: 0 0 12px; font-size: 26px; line-height: 1.18; font-weight: 700; letter-spacing: .01em; }
.lt-card h1 span { display: block; }
.lt-card h1 span + span { color: var(--lt-accent, #ffc94a); }
.lt-readouts { display: grid; grid-template-columns: repeat(var(--n, 3), 1fr); gap: 6px; margin-bottom: 12px; }
.lt-ro { background: rgba(243, 245, 249, 0.05); border: 1px solid var(--lt-line); border-radius: 10px; padding: 7px 9px 6px; min-width: 0; }
.lt-ro .k { font-size: 11.5px; color: var(--lt-textDim, #9aa6b8); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lt-ro .v { font-family: var(--lt-mono); font-size: 20px; font-weight: 500; line-height: 1.25; white-space: nowrap; }
.lt-ro .v small { font-family: var(--lt-sans); font-size: 11px; color: var(--lt-textDim, #9aa6b8); margin-left: 3px; font-weight: 500; }
.lt-ro.long .v { font-size: 16.5px; }
.lt-ro.bad { border-color: color-mix(in srgb, var(--lt-problem, #ff4d4f) 70%, transparent); }
.lt-ro.bad .v { color: var(--lt-problem, #ff4d4f); }
.lt-now { margin: 0; font-size: 14px; line-height: 1.55; color: #dfe5ee; }
.lt-now .tag { display: inline-block; font-size: 12px; font-weight: 600; color: var(--lt-bgTop, #0d131f); background: var(--lt-neutral, #f3f5f9); border-radius: 6px; padding: 0 6px; margin-right: 7px; line-height: 19px; vertical-align: 1px; }
.lt-now .tag.bad { background: var(--lt-problem, #ff4d4f); color: #fff; }
.lt-now b { color: #fff; font-weight: 600; }
.lt-chart { margin-top: 12px; display: none; }
.lt-chart.on { display: block; }
.lt-chart canvas { display: block; width: 100%; height: auto; border-radius: 10px; background: rgba(0, 0, 0, 0.22); }

/* ---- 底部控制条 */
.lt-bar { position: absolute; left: 50%; bottom: var(--lt-gutter); transform: translateX(-50%); display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 18px; pointer-events: auto; max-width: calc(100vw - 2 * var(--lt-gutter) - 120px); }
.lt-row { display: contents; }
.lt-sep { width: 1px; align-self: stretch; margin: 4px 2px; background: var(--lt-line); }
.lt-bar button { font: 500 14px/1 var(--lt-sans); color: #dfe5ee; background: transparent; border: 0; border-radius: 11px; height: 40px; min-width: 40px; padding: 0 12px; cursor: pointer; white-space: nowrap; transition: background .15s, color .15s; }
.lt-bar button:hover { background: rgba(243, 245, 249, 0.08); }
.lt-bar button.on { background: var(--lt-neutral, #f3f5f9); color: var(--lt-bgTop, #0d131f); font-weight: 600; }
.lt-seg { display: flex; gap: 2px; background: rgba(243, 245, 249, 0.05); border-radius: 13px; padding: 2px; }
.lt-play { width: 40px; padding: 0 !important; display: grid; place-items: center; }
.lt-play svg { width: 16px; height: 16px; fill: currentColor; }
.lt-speed-cycle, .lt-view-toggle { display: none; }
.lt-slider { display: flex; align-items: center; gap: 10px; min-width: 250px; padding: 0 4px; }
.lt-slider label { font-size: 13px; color: var(--lt-textDim, #9aa6b8); white-space: nowrap; }
.lt-slider output { font-family: var(--lt-mono); font-size: 15px; color: #fff; min-width: 70px; white-space: nowrap; }
.lt-slider output small { font-family: var(--lt-sans); font-size: 11px; color: var(--lt-textDim, #9aa6b8); margin-left: 2px; }
.lt-slider input { flex: 1; min-width: 110px; }
input[type=range].lt-range { -webkit-appearance: none; appearance: none; height: 40px; background: transparent; cursor: pointer; }
input[type=range].lt-range::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: linear-gradient(90deg, var(--lt-accent, #ffc94a) var(--p, 30%), rgba(243, 245, 249, 0.18) var(--p, 30%)); }
input[type=range].lt-range::-moz-range-track { height: 4px; border-radius: 2px; background: rgba(243, 245, 249, 0.18); }
input[type=range].lt-range::-moz-range-progress { height: 4px; border-radius: 2px; background: var(--lt-accent, #ffc94a); }
input[type=range].lt-range::-webkit-slider-thumb { -webkit-appearance: none; width: 20px; height: 20px; margin-top: -8px; border-radius: 50%; background: #fff; border: 3px solid var(--lt-accent, #ffc94a); box-shadow: 0 0 12px rgba(255, 201, 74, 0.6); }
input[type=range].lt-range::-moz-range-thumb { width: 16px; height: 16px; border-radius: 50%; background: #fff; border: 3px solid var(--lt-accent, #ffc94a); }

/* ---- 右下角："?" 和 隐藏界面 */
.lt-corner { position: absolute; right: var(--lt-gutter); bottom: var(--lt-gutter); display: flex; gap: 8px; pointer-events: auto; }
.lt-round { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; color: #dfe5ee; font: 600 17px/1 var(--lt-sans); cursor: pointer; padding: 0; }
.lt-round svg { width: 18px; height: 18px; }
.lt-restore { position: fixed; right: var(--lt-gutter); bottom: var(--lt-gutter); pointer-events: auto; opacity: 0.55; z-index: 11; }
.lt-restore[hidden] { display: none; }

/* ---- 说明浮层 */
.lt-help { position: absolute; right: var(--lt-gutter); bottom: calc(var(--lt-gutter) + 58px); width: min(460px, calc(100vw - 2 * var(--lt-gutter))); max-height: min(70vh, 620px); overflow: auto; padding: 18px 20px; pointer-events: auto; background: var(--lt-panel-strong); font-size: 13.5px; line-height: 1.6; color: #dfe5ee; }
.lt-help[hidden] { display: none; }
.lt-help h2 { font-size: 15px; margin: 4px 0 6px; color: #fff; }
.lt-help ul { margin: 0 0 10px; padding-left: 18px; }
.lt-help li { margin: 3px 0; }
.lt-help .disclaimer { color: var(--lt-textDim, #9aa6b8); font-size: 12.5px; margin: 10px 0 0; }
.lt-help-close { position: absolute; right: 10px; top: 8px; width: 32px; height: 32px; border: 0; background: transparent; color: #dfe5ee; font-size: 20px; cursor: pointer; }

/* ---- 3D 标签：深色半透明小胶囊 + 白字 + 细引线；被点名时放大、变金色 */
.lt-labels, .lt-leaders { position: absolute; inset: 0; pointer-events: none; }
/* an <svg> is a replaced element: inset alone leaves it at 300×150 and clips the leader lines */
.lt-leaders { width: 100%; height: 100%; }
.lt-leaders line { stroke: rgba(243, 245, 249, 0.55); stroke-width: 1; }
.lt-leaders circle { fill: #fff; }
.lt-leaders .called line, .lt-leaders line.called { stroke: var(--lt-accent, #ffc94a); }
.lt-leaders circle.called { fill: var(--lt-accent, #ffc94a); }
.lt-tag { position: absolute; left: 0; top: 0; display: flex; align-items: center; gap: 6px; padding: 5px 11px 5px 9px; border-radius: 999px; background: rgba(10, 14, 22, 0.78); border: 1px solid rgba(243, 245, 249, 0.16); font-size: 13px; line-height: 1.2; color: #fff; white-space: nowrap; transition: opacity .2s, background .2s, border-color .2s, scale .2s; will-change: transform; }
.lt-tag i { width: 6px; height: 6px; border-radius: 50%; background: var(--dot, #fff); flex: none; }
.lt-tag b { font-family: var(--lt-mono); font-weight: 500; }
.lt-tag.off { opacity: 0; }
.lt-tag.called { background: rgba(38, 28, 6, 0.9); border-color: var(--lt-accent, #ffc94a); color: var(--lt-accent, #ffc94a); scale: 1.12; }
.lt-tag.bad { border-color: var(--lt-problem, #ff4d4f); }
.lt-tag.bad b { color: var(--lt-problem, #ff4d4f); }
.lt-tag.badge { padding: 4px 10px; font-size: 12.5px; }

/* ---- 3D 主手柄旁的胶囊（shared/handle.js） */
.lt-handle-pill { position: absolute; left: 0; top: 0; padding: 5px 11px; border-radius: 999px; background: rgba(38, 28, 6, 0.86); border: 1px solid var(--lt-accent, #ffc94a); color: var(--lt-accent, #ffc94a); font-size: 13px; line-height: 1.2; white-space: nowrap; pointer-events: none; transition: scale .15s, background .15s; will-change: transform; }
.lt-handle-pill b { font-family: var(--lt-mono); font-weight: 500; color: #fff; }
.lt-handle-pill.hot { scale: 1.1; background: rgba(70, 50, 8, 0.95); }
.lt-handle-pill[hidden] { display: none; }

/* ---- 手机：控制条贴底，最多两行；按钮高度 ≥ 40px */
@media (max-width: 699px) {
  :root { --lt-gutter: 12px; }
  .lt-card { left: var(--lt-gutter); right: var(--lt-gutter); top: calc(var(--lt-gutter) + env(safe-area-inset-top)); width: auto; padding: 11px 13px 11px; border-radius: 14px; }
  .lt-card h1 { font-size: 19px; margin-bottom: 8px; padding-right: 96px; }
  .lt-card h1 span { display: inline; }
  .lt-card h1 span + span::before { content: " "; }
  .lt-readouts { margin-bottom: 8px; }
  .lt-ro { padding: 5px 8px; }
  .lt-ro .v { font-size: 17px; }
  .lt-now { font-size: 13px; line-height: 1.5; }
  .lt-bar { left: 0; right: 0; bottom: 0; transform: none; max-width: none; border-radius: 16px 16px 0 0; flex-direction: column; align-items: stretch; gap: 6px; padding: 8px var(--lt-gutter) calc(8px + env(safe-area-inset-bottom)); }
  .lt-row { display: flex; align-items: center; gap: 6px; }
  .lt-sep, .lt-speeds, .lt-views { display: none !important; }
  .lt-speed-cycle, .lt-view-toggle { display: block; }
  .lt-bar button { padding: 0 8px; font-size: 13.5px; height: 42px; }
  .lt-slider { flex: 1; min-width: 0; gap: 8px; padding: 0 2px; }
  .lt-slider output { min-width: 64px; }
  .lt-slider input { min-width: 60px; }
  .lt-scenarios { flex: 1; }
  .lt-scenarios button { flex: 1; padding: 0 4px; }
  .lt-view-toggle { background: rgba(243, 245, 249, 0.08) !important; }
  .lt-corner { top: calc(var(--lt-gutter) + 7px + env(safe-area-inset-top)); right: calc(var(--lt-gutter) + 7px); bottom: auto; gap: 6px; }
  .lt-corner .lt-round { width: 40px; height: 40px; background: rgba(243, 245, 249, 0.06); box-shadow: none; }
  .lt-help { top: 72px; bottom: auto; right: var(--lt-gutter); max-height: calc(100vh - 220px); }
  .lt-tag { font-size: 11.5px; padding: 4px 9px 4px 8px; }
  .lt-chart { margin-top: 8px; }
  .lt-chart canvas { width: auto; max-width: 100%; max-height: 104px; margin: 0 auto; }
  .lt-handle-pill { font-size: 12px; }
}
