/* ════════════════════════════════════════════════════════════════════════
   desktop-virtual-lab / ui / experiments-panel.css
   ────────────────────────────────────────────────────────────────────────
   右下角实验瓶 FAB + 预研功能 master-detail 面板。复用 style.css 设计 token
   (--surface-1/2/3 · --ink-1/2/3 · --line-1/2 · --float-* glass · --font-ui/mono)，
   单色无新色 (DESIGN.md §3.5)。z 层：FAB/panel 1000-1001（与 floating panels 同档，
   toast 1500 仍在其上）。
   ════════════════════════════════════════════════════════════════════════ */

/* Developer-Mode gate (B-5): the Experiments panel is an internal
   pre-research surface. Hidden unless `body.dev-mode` is set by
   apps/desktop-virtual-lab/dev-mode.js. Bootstrap is also lazy (main.js
   `mountOnce(setupExperiments)`), so on a fresh load the DOM isn't even
   created. v2 (DESIGN.md §8.11): the bottom-right flask FAB is gone — the
   entry is Setting ▸ Experiments; the panel now opens CENTERED. */
body:not(.dev-mode) #experiments-panel { display: none !important; }

/* ── Panel（master-detail，居中显示，不再锚定按钮） ── */
.exp-panel {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 560px;
  max-width: calc(100vw - 36px);
  height: 380px;
  max-height: calc(100vh - 120px);
  display: flex;
  flex-direction: column;
  border-radius: 14px;
  overflow: hidden;
  background: var(--float-bg);
  border: 1px solid var(--line-1);
  backdrop-filter: blur(var(--float-blur)) saturate(var(--float-sat));
  -webkit-backdrop-filter: blur(var(--float-blur)) saturate(var(--float-sat));
  box-shadow: var(--float-shadow), var(--float-edge);
  z-index: 1001;
}
/* CRITICAL: explicit `display: flex` above overrides UA `[hidden] {display:none}`
   (class selector beats the UA attribute rule). Re-assert so panel.hidden=true
   actually hides — else open/close toggle can't close. (Same pattern as
   .modal-backdrop[hidden] / .ins-body[hidden] in style.css.) */
.exp-panel[hidden] { display: none; }
.exp-panel.is-resizing { transition: none; user-select: none; }

/* Bottom-right resize grip (DESIGN.md §8.11 MB7) — two diagonal strokes,
   nwse cursor, ≥16px hit area. Mirrors .panel-floating-resize. */
.exp-resize {
  position: absolute;
  right: 2px;
  bottom: 2px;
  width: 16px;
  height: 16px;
  display: grid;
  place-items: center;
  cursor: nwse-resize;
  color: var(--ink-4);
  z-index: 1;
}
.exp-resize:hover { color: var(--ink-2); }

.exp-head {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 12px 11px 16px;
  border-bottom: 1px solid var(--line-1);
  cursor: grab;            /* drag handle (DESIGN.md §8.11 MB7) */
  user-select: none;
}
.exp-head.is-dragging { cursor: grabbing; }
.exp-head-titles { display: flex; flex-direction: column; gap: 1px; flex: 1 1 auto; min-width: 0; }
.exp-eyebrow {
  font-family: var(--font-ui); font-size: 13px; font-weight: 600; color: var(--ink-1);
}
.exp-sub {
  font-family: var(--font-mono); font-size: 10px; letter-spacing: .03em; color: var(--ink-3-v1);
}
.exp-close {
  flex: 0 0 auto; width: 28px; height: 28px; border-radius: 7px; cursor: pointer;
  display: grid; place-items: center;
  background: none; border: 1px solid transparent; color: var(--ink-3-v1);
  font-size: 14px; line-height: 1;
}
.exp-close:hover { color: var(--ink-1); border-color: var(--line-2); background: var(--surface-2); }

.exp-body { flex: 1 1 auto; display: flex; min-height: 0; }

/* ── 左列：标题列表 ── */
.exp-list {
  flex: 0 0 178px; min-width: 0;
  border-right: 1px solid var(--line-1);
  padding: 8px; overflow-y: auto;
  display: flex; flex-direction: column; gap: 2px;
}
.exp-item {
  display: flex; flex-direction: column; gap: 2px; text-align: left; width: 100%;
  cursor: pointer; appearance: none;
  background: none; border: 1px solid transparent; border-radius: 8px;
  padding: 8px 10px;
}
.exp-item:hover { background: var(--surface-2); }
.exp-item.is-active { background: var(--surface-2); border-color: var(--line-2); }
.exp-item-title {
  font-family: var(--font-ui); font-size: 12.5px; color: var(--ink-1);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.exp-item-dot { margin-right: 5px; font-size: 9px; color: var(--ink-2-v1); }
.exp-item-tag {
  font-family: var(--font-mono); font-size: 9.5px; letter-spacing: .02em; color: var(--ink-3-v1);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.exp-item.is-active .exp-item-title { color: var(--ink-1); }
.exp-empty {
  padding: 18px 12px; text-align: center;
  font-family: var(--font-ui); font-size: 12px; color: var(--ink-3-v1);
}

/* ── 右侧：细则 ── */
.exp-detail { flex: 1 1 auto; min-width: 0; padding: 16px 18px; overflow-y: auto; }
.exp-detail-title {
  margin: 0 0 6px; font-family: var(--font-ui); font-size: 14px; font-weight: 600; color: var(--ink-1);
}
.exp-detail-desc {
  margin: 0 0 14px; font-family: var(--font-ui); font-size: 12px; line-height: 1.55; color: var(--ink-2-v1);
}
.exp-detail-desc b { color: var(--ink-1); font-weight: 600; }
.exp-detail-foot {
  margin: 14px 0 0; padding-top: 10px; border-top: 1px solid var(--line-1);
  font-family: var(--font-ui); font-size: 11px; line-height: 1.5; color: var(--ink-3-v1);
}
.exp-detail-foot code {
  font-family: var(--font-mono); font-size: 10.5px; color: var(--ink-2-v1);
}
.exp-detail-err {
  font-family: var(--font-mono); font-size: 11.5px; color: var(--ink-1);
}

/* ── capability status board (per-experiment maturity, monochrome §3.5) ──
   States differ by glyph (● ◐ ○) + ink weight, never hue. */
.exp-board { margin: 0 0 16px; }
.exp-board-rows { display: flex; flex-direction: column; }
.exp-cap {
  display: flex; gap: 9px; align-items: baseline;
  padding: 7px 0; border-top: 1px solid var(--line-1);
}
.exp-cap:first-child { border-top: none; padding-top: 2px; }
.exp-cap-glyph {
  flex: 0 0 auto; width: 12px; text-align: center;
  font-size: 10.5px; line-height: 1.5; color: var(--ink-3-v1);
}
.exp-cap[data-state="wired"]   .exp-cap-glyph { color: var(--ink-1); }
.exp-cap[data-state="partial"] .exp-cap-glyph { color: var(--ink-2-v1); }
.exp-cap-main { min-width: 0; flex: 1 1 auto; }
.exp-cap-label {
  display: flex; align-items: baseline; gap: 8px;
  font-family: var(--font-ui); font-size: 12px; color: var(--ink-1);
}
.exp-cap[data-state="pending"] .exp-cap-label { color: var(--ink-2-v1); }
.exp-cap-state {
  margin-left: auto; flex: 0 0 auto;
  font-family: var(--font-mono); font-size: 9px; letter-spacing: .04em; text-transform: uppercase;
  color: var(--ink-3-v1);
}
.exp-cap-note {
  margin-top: 3px;
  font-family: var(--font-ui); font-size: 10.5px; line-height: 1.5; color: var(--ink-3-v1);
}
.exp-legend {
  display: flex; flex-wrap: wrap; gap: 3px 14px;
  margin-top: 11px; padding-top: 10px; border-top: 1px solid var(--line-1);
  font-family: var(--font-mono); font-size: 9px; letter-spacing: .02em; color: var(--ink-3-v1);
}
.exp-legend b { color: var(--ink-1); font-weight: 400; }

/* run button */
.exp-run-btn {
  cursor: pointer;
  font-family: var(--font-mono); font-size: 11.5px; color: var(--ink-1);
  background: var(--surface-1); border: 1px solid var(--ink-1);
  border-radius: 7px; padding: 7px 14px;
}
.exp-run-btn:hover { background: var(--surface-2); }
.exp-run-btn:disabled { opacity: .6; cursor: default; }
.exp-run-out { margin-top: 12px; }

/* ── M9 env snapshot (read-only agent interface demo) ── */
.m9-line {
  font-family: var(--font-mono); font-size: 10.5px; color: var(--ink-2-v1);
  padding: 2px 0; letter-spacing: .01em;
}
.m9-line code { color: var(--ink-1); }
.m9-snap {
  margin: 6px 0; padding: 9px 11px; max-height: 220px; overflow: auto;
  background: var(--surface-1); border: 1px solid var(--line-1); border-radius: 8px;
  font-family: var(--font-mono); font-size: 10px; line-height: 1.5; color: var(--ink-2-v1);
  white-space: pre; tab-size: 2;
}
.m9-noop { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line-1); color: var(--ink-3-v1); }
.m9-noop.ok code { color: var(--ink-1); }
.m9-noop.fail { color: var(--ink-1); font-weight: 600; }
.m9-noop-note { color: var(--ink-3-v1); }

/* ── self-check result list (moved from related-panel.css) ──
   Monochrome: pass/fail differ by ✓/✗ glyph + weight, not hue (§3.5). */
.m8sc-head {
  font-family: var(--font-mono); font-size: 11.5px; color: var(--ink-1);
  padding: 2px 0 7px; letter-spacing: .02em;
}
.m8sc-head.fail { font-weight: 600; }
.m8sc-row {
  display: flex; align-items: baseline; gap: 8px; padding: 3px 0;
  font-family: var(--font-mono); font-size: 10.5px; color: var(--ink-3-v1);
  border-top: 1px solid var(--line-1);
}
.m8sc-mark { flex: 0 0 auto; width: 10px; color: var(--ink-2-v1); }
.m8sc-row.fail .m8sc-mark { color: var(--ink-1); font-weight: 700; }
.m8sc-name { color: var(--ink-2-v1); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.m8sc-detail { color: var(--ink-3-v1); margin-left: auto; text-align: right; opacity: .85; flex: 0 0 auto; }

@media (max-width: 620px) {
  .exp-panel { width: calc(100vw - 36px); height: 70vh; }
  .exp-list { flex-basis: 130px; }
}
