/* ORME Lab — "noble-metal spectrometer" theme
   Palette: cold indigo instrument, platinum-group metals, one coherent-teal signal. */
:root {
  --void: #090c14;
  --void-2: #0d1220;
  --panel: #121826;
  --panel-2: #161d2e;
  --line: #24304a;
  --line-soft: #1a2236;
  --platinum: #dfe6f2;
  --muted: #8792a8;
  --muted-2: #5d6884;
  --gold: #c9a86a;
  --coherent: #35d6c4;   /* not ruled out / coherent signal */
  --ruled: #d66a4a;      /* ruled out */
  --spin-up: #e0b15a;
  --spin-dn: #6aa6d6;
  --shadow: 0 1px 0 rgba(255,255,255,0.03), 0 12px 32px rgba(0,0,0,0.5);
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: radial-gradient(120% 120% at 50% -10%, #101728 0%, var(--void) 60%);
  color: var(--platinum);
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 13px;
  line-height: 1.5;
  overflow: hidden;
}
h1, h2, h3, .display { font-family: "Space Grotesk", system-ui, sans-serif; }

/* ---- shell layout: left rail | stage | right rail ---- */
#shell {
  display: grid;
  grid-template-columns: 288px minmax(0, 1fr) 320px;
  grid-template-rows: 1fr auto;
  height: 100vh;
  max-width: 100vw;
  overflow: hidden;
}
#stage { position: relative; grid-row: 1; grid-column: 2; overflow: hidden; min-width: 0; }
#stage canvas { display: block; max-width: 100%; }

.rail {
  grid-row: 1 / span 2;
  background: linear-gradient(180deg, var(--panel) 0%, var(--void-2) 100%);
  border-right: 1px solid var(--line);
  padding: 18px 16px;
  overflow-y: auto;
  overflow-x: hidden;
  min-width: 0;   /* let grid items shrink instead of forcing overflow */
}
.rail.right { grid-column: 3; border-right: none; border-left: 1px solid var(--line); }
.rail.left { grid-column: 1; }

/* ---- wordmark ---- */
.brand { display: flex; align-items: center; gap: 9px; margin-bottom: 4px; }
.brand .emblem { border-radius: 50%; flex: none; box-shadow: 0 0 0 1px var(--line), 0 0 14px rgba(201,168,106,0.25); }
.brand .mark { font-size: 20px; font-weight: 700; letter-spacing: -0.02em; }
.brand .mark em { color: var(--gold); font-style: normal; }
.brand .ver { font-size: 10px; color: var(--muted-2); letter-spacing: 0.14em; }
.tagline { color: var(--muted); font-size: 11px; margin: 0 0 20px; }

/* ---- view tabs ---- */
.tabbar { display: flex; gap: 4px; margin: 0 0 20px; padding: 3px; background: var(--void-2);
  border: 1px solid var(--line); border-radius: 5px; }
.tab { flex: 1; font-family: "Space Grotesk", sans-serif; font-size: 12px; font-weight: 600;
  color: var(--muted); background: transparent; border: none; border-radius: 3px; padding: 7px 8px;
  cursor: pointer; transition: all .12s ease; }
.tab:hover { color: var(--platinum); }
.tab.active { color: var(--void); background: var(--gold); }

/* ---- control groups ---- */
.group { margin-bottom: 20px; }
.eyebrow {
  font-size: 10px; letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--muted-2); margin-bottom: 9px; display: flex; justify-content: space-between;
}
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  font-family: inherit; font-size: 12px; color: var(--muted);
  background: var(--panel-2); border: 1px solid var(--line);
  padding: 6px 9px; border-radius: 3px; cursor: pointer; transition: all .12s ease;
}
.chip:hover { border-color: var(--gold); color: var(--platinum); }
.chip[aria-pressed="true"] {
  color: var(--void); background: var(--gold); border-color: var(--gold); font-weight: 600;
}
.chip.spin[aria-pressed="true"] { background: var(--spin-up); border-color: var(--spin-up); }

select.field {
  width: 100%; font-family: inherit; font-size: 12px; color: var(--platinum);
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 3px;
  padding: 7px 8px; cursor: pointer;
}

#eigenEnergy { font-family: "IBM Plex Mono", monospace; font-size: 10px; color: var(--coherent); letter-spacing: normal; text-transform: none; }
.klm-row { display: flex; gap: 8px; margin-top: 8px; }
.klm-row label { flex: 1; display: flex; align-items: center; gap: 5px; font-size: 11px; color: var(--muted); }
.klm-row .field { flex: 1; padding: 5px 6px; }
.klm-row .field:disabled { opacity: 0.4; cursor: not-allowed; }
.cube-row { display: flex; gap: 6px; margin-top: 8px; }
.cube-row .chip { cursor: pointer; }

.slider-row { display: flex; align-items: center; gap: 10px; }
input[type=range] {
  -webkit-appearance: none; appearance: none; flex: 1; height: 3px;
  background: var(--line); border-radius: 2px; outline: none;
}
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 14px; height: 14px; border-radius: 50%;
  background: var(--gold); cursor: pointer; border: 2px solid var(--void);
}
input[type=range]::-moz-range-thumb {
  width: 14px; height: 14px; border-radius: 50%; background: var(--gold);
  cursor: pointer; border: 2px solid var(--void);
}
.slider-val { font-size: 12px; color: var(--platinum); min-width: 58px; text-align: right; }

/* ---- readout metrics ---- */
.metric { display: flex; justify-content: space-between; align-items: baseline;
  padding: 5px 0; border-bottom: 1px dashed var(--line-soft); }
.metric .k { color: var(--muted); font-size: 11px; }
.metric .v { font-size: 13px; font-variant-numeric: tabular-nums; }
.eyebrow-hint { color: var(--muted-2); font-size: 9px; letter-spacing: 0.1em; text-transform: none; opacity: 0.7; }
.metric.tappable { cursor: pointer; margin: 0 -8px; padding-left: 8px; padding-right: 8px; border-radius: 3px;
  transition: background .12s ease, box-shadow .12s ease; outline: none; }
.metric.tappable:hover { background: var(--panel-2); }
.metric.tappable:hover .k { color: var(--platinum); }
.metric.tappable:focus-visible { box-shadow: inset 0 0 0 1px var(--gold); }
.metric.tappable .k::after { content: " ⓘ"; color: var(--muted-2); opacity: 0; font-size: 9px; transition: opacity .12s ease; }
.metric.tappable:hover .k::after, .metric.tappable:focus-visible .k::after { opacity: 0.8; }
#vBadge[role="button"] { cursor: pointer; }
#vBadge[role="button"]:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

.flag { font-size: 10px; padding: 1px 6px; border-radius: 2px; letter-spacing: 0.06em; }
.flag.on { background: rgba(53,214,196,0.15); color: var(--coherent); }
.flag.off { background: rgba(214,106,74,0.15); color: var(--ruled); }

/* ---- gate cascade ---- */
.gate { display: flex; align-items: center; gap: 9px; padding: 7px 0; }
.gate .led {
  width: 10px; height: 10px; border-radius: 50%; flex: none;
  background: var(--line); box-shadow: 0 0 0 2px var(--void-2);
  transition: background .2s ease, box-shadow .2s ease;
}
.gate.pass .led { background: var(--coherent); box-shadow: 0 0 10px var(--coherent); }
.gate.fail .led { background: var(--ruled); box-shadow: 0 0 8px rgba(214,106,74,0.6); }
.gate .lbl { flex: 1; font-size: 11px; color: var(--muted); }
.gate.pass .lbl, .gate.fail .lbl { color: var(--platinum); }
.gate .num { font-size: 11px; color: var(--muted-2); font-variant-numeric: tabular-nums; }
.gate.tappable { cursor: pointer; margin: 0 -8px; padding-left: 8px; padding-right: 8px; border-radius: 3px; transition: background .12s ease; outline: none; }
.gate.tappable:hover { background: var(--panel-2); }
.gate.tappable:focus-visible { box-shadow: inset 0 0 0 1px var(--gold); }

/* ---- hypothesis registry overlay ---- */
.reg-overlay { position: fixed; inset: 0; z-index: 30; overflow-y: auto;
  background: radial-gradient(120% 120% at 50% -10%, #101728 0%, var(--void) 60%); }
.reg-inner { max-width: 1080px; margin: 0 auto; padding: 34px 28px 60px; }
.reg-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px;
  border-bottom: 1px solid var(--line); padding-bottom: 20px; margin-bottom: 26px; }
.reg-eyebrow { font-size: 10px; letter-spacing: 0.24em; text-transform: uppercase; color: var(--muted-2); }
.reg-title { font-size: 30px; font-weight: 700; letter-spacing: -0.02em; margin: 4px 0 10px; }
.reg-sub { color: var(--muted); font-size: 13px; line-height: 1.6; max-width: 780px; margin: 0; }
.reg-head .chip { flex: none; white-space: nowrap; }
.reg-section-label { font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--gold);
  margin: 28px 0 12px; }
.reg-section-label span { color: var(--muted-2); letter-spacing: 0.04em; text-transform: none; }
.reg-provenance { font-size: 13px; line-height: 1.65; color: var(--muted-2); max-width: 760px;
  border-left: 2px solid var(--line); padding: 4px 0 4px 14px; }
.reg-provenance strong { color: var(--gold); font-weight: 600; }
.hyp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 14px; }
.hyp { background: linear-gradient(180deg, var(--panel) 0%, var(--void-2) 100%);
  border: 1px solid var(--line); border-radius: 6px; padding: 15px 16px; }
.hyp-head { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; margin-bottom: 9px; }
.hyp-id { font-family: "IBM Plex Mono", monospace; font-size: 13px; font-weight: 600; color: var(--platinum);
  letter-spacing: 0.04em; }
.hyp-status { font-size: 9px; letter-spacing: 0.1em; text-transform: uppercase; padding: 2px 7px; border-radius: 2px; }
.hyp-status--modeled { background: rgba(53,214,196,0.15); color: var(--coherent); }
.hyp-status--partial { background: rgba(201,168,106,0.15); color: var(--gold); }
.hyp-status--premise { background: rgba(106,166,214,0.15); color: var(--spin-dn); }
.hyp-status--roadmap { background: var(--panel-2); color: var(--muted-2); }
.hyp-evidence { margin-left: auto; font-size: 9px; color: var(--muted-2); border: 1px solid var(--line);
  border-radius: 2px; padding: 2px 6px; white-space: nowrap; }
.hyp-statement { color: var(--platinum); font-size: 12.5px; line-height: 1.5; margin: 0 0 10px; }
.hyp-fields { margin: 0; font-size: 11.5px; }
.hyp-fields dt { font-size: 9px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted-2); margin-top: 8px; }
.hyp-fields dd { margin: 2px 0 0; color: var(--muted); line-height: 1.5; }
.hyp-fields code { color: var(--gold); font-size: 11px; }
.hyp-link { margin-top: 12px; font-family: "IBM Plex Mono", monospace; font-size: 11px; color: var(--coherent);
  background: transparent; border: 1px solid var(--line); border-radius: 3px; padding: 6px 10px; cursor: pointer;
  transition: all .12s ease; }
.hyp-link:hover { border-color: var(--coherent); background: rgba(53,214,196,0.08); }
.hyp-link:focus-visible { outline: 2px solid var(--coherent); outline-offset: 2px; }
.hyp-flash { animation: hypFlash 1.6s ease-out; }
@keyframes hypFlash {
  0%, 20% { box-shadow: inset 0 0 0 1px var(--gold), 0 0 22px rgba(201,168,106,0.5); border-color: var(--gold); }
  100% { box-shadow: none; }
}
/* related-hypothesis chips inside the metric inspector */
.mm-hyp { font-family: "IBM Plex Mono", monospace; font-size: 11px; font-weight: 600; color: var(--gold);
  background: var(--void); border: 1px solid var(--line); border-radius: 3px; padding: 3px 8px; margin: 2px 4px 2px 0;
  cursor: pointer; transition: all .12s ease; }
.mm-hyp:hover { border-color: var(--gold); background: rgba(201,168,106,0.12); }
.mm-hyp:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* ---- metric inspector modal ---- */
.mm-overlay { position: fixed; inset: 0; z-index: 40; display: flex; align-items: center; justify-content: center;
  background: rgba(5, 8, 14, 0.66); backdrop-filter: blur(3px); padding: 24px; }
/* the `hidden` attribute must win over the display:flex above */
.mm-overlay[hidden] { display: none; }
.mm-card { position: relative; width: min(560px, 100%); max-height: 86vh; overflow-y: auto;
  background: linear-gradient(180deg, var(--panel) 0%, var(--void-2) 100%);
  border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); padding: 22px 24px 20px; }
.mm-close { position: absolute; top: 12px; right: 12px; width: 28px; height: 28px; border-radius: 4px;
  background: transparent; border: 1px solid var(--line); color: var(--muted); cursor: pointer; font-size: 13px; line-height: 1; }
.mm-close:hover { color: var(--platinum); border-color: var(--gold); }
.mm-eyebrow { font-size: 10px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--muted-2); }
.mm-title { font-size: 22px; font-weight: 700; letter-spacing: -0.01em; margin: 4px 0 10px; }
.mm-value { font-family: "IBM Plex Mono", monospace; font-size: 13px; color: var(--muted); margin-bottom: 16px; }
.mm-value #mmValue { color: var(--gold); font-weight: 600; }
.mm-fields { margin: 0; }
.mm-fields dt { font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--coherent); margin-top: 14px; }
.mm-fields dd { margin: 4px 0 0; font-size: 13px; line-height: 1.6; color: var(--platinum); }
.mm-fields dd:nth-of-type(2) { font-family: "IBM Plex Mono", monospace; font-size: 12px; color: var(--muted);
  background: var(--void); border: 1px solid var(--line-soft); border-radius: 4px; padding: 8px 10px; overflow-x: auto; }
.mm-source { margin-top: 16px; padding-top: 12px; border-top: 1px dashed var(--line-soft); font-size: 11px; color: var(--muted-2); }
.mm-source code { color: var(--gold); }

/* ---- verdict bar (bottom) ---- */
#verdict {
  grid-row: 2; grid-column: 2; border-top: 1px solid var(--line);
  background: var(--void-2); padding: 12px 20px; display: flex; align-items: center;
  gap: 12px 16px; flex-wrap: wrap;
}
#verdict .badge {
  font-family: "Space Grotesk", sans-serif; font-weight: 600; font-size: 12px;
  letter-spacing: 0.08em; padding: 5px 12px; border-radius: 3px; white-space: nowrap;
}
#verdict .badge.ok { background: rgba(53,214,196,0.14); color: var(--coherent); border: 1px solid rgba(53,214,196,0.4); }
#verdict .badge.no { background: rgba(214,106,74,0.14); color: var(--ruled); border: 1px solid rgba(214,106,74,0.4); }
#verdict .line { color: var(--muted); font-size: 12px; white-space: normal; overflow: visible; min-width: 0; flex: 1 1 240px; }
#verdict .evidence { flex: none; font-size: 10px; letter-spacing: 0.04em; color: var(--gold);
  border: 1px solid var(--line); border-radius: 3px; padding: 4px 9px; white-space: nowrap; }
#verdict .cband { flex: none; font-family: "Space Grotesk", sans-serif; font-weight: 700; font-size: 11px;
  letter-spacing: 0.08em; padding: 5px 11px; border-radius: 3px; white-space: nowrap; cursor: pointer; border: 1px solid transparent; }
#verdict .cband:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.cband--veryhigh { background: rgba(53,214,196,0.20); color: var(--coherent); border-color: rgba(53,214,196,0.5); }
.cband--high { background: rgba(53,214,196,0.12); color: var(--coherent); border-color: rgba(53,214,196,0.32); }
.cband--medium { background: rgba(201,168,106,0.15); color: var(--gold); border-color: rgba(201,168,106,0.4); }
.cband--low { background: var(--panel-2); color: var(--muted); border-color: var(--line); }

/* ---- stage overlays ---- */
.stage-tag {
  position: absolute; top: 16px; left: 18px; font-size: 10px; letter-spacing: 0.2em;
  text-transform: uppercase; color: var(--muted-2); pointer-events: none;
}
.stage-title {
  position: absolute; top: 30px; left: 18px; font-family: "Space Grotesk", sans-serif;
  font-size: 26px; font-weight: 700; letter-spacing: -0.02em; pointer-events: none;
}
.stage-title .sub { font-size: 13px; color: var(--muted); font-weight: 400; display: block; margin-top: 2px; }
.legend {
  position: absolute; bottom: 14px; left: 18px; display: flex; gap: 16px;
  font-size: 10px; color: var(--muted-2); pointer-events: none;
}
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 5px; vertical-align: middle; }

/* ---- plasmon spectrum ---- */
#plasmon { width: 100%; max-width: 100%; height: 96px; display: block; background: var(--void-2);
  border: 1px solid var(--line); border-radius: 4px; }
.spec-caption { font-size: 10px; color: var(--muted-2); margin-top: 6px; display: flex; justify-content: space-between; }

/* ---- ranking ---- */
#rank { width: 100%; border-collapse: collapse; font-size: 11px; margin-top: 4px; }
#rank th { text-align: left; color: var(--muted-2); font-weight: 400; padding: 4px 6px;
  border-bottom: 1px solid var(--line); font-size: 10px; letter-spacing: 0.08em; }
#rank td { padding: 4px 6px; border-bottom: 1px solid var(--line-soft); font-variant-numeric: tabular-nums; }
#rank tr { cursor: pointer; }
#rank tr:hover td { background: var(--panel-2); }
#rank tr.cur td { background: rgba(201,168,106,0.1); }
#rank td.ro { color: var(--ruled); }
#rank td.ok { color: var(--coherent); }

.hint { font-size: 10px; color: var(--muted-2); margin-top: 8px; line-height: 1.4; }

/* ---- lab scientist drawer ---- */
#scientist {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 5;
  background: linear-gradient(180deg, rgba(13,18,32,0.72) 0%, rgba(9,12,20,0.96) 40%);
  backdrop-filter: blur(6px); border-top: 1px solid var(--line);
}
.sci-header {
  width: 100%; display: flex; align-items: center; gap: 10px;
  background: transparent; border: none; cursor: pointer; color: var(--platinum);
  font-family: "Space Grotesk", sans-serif; padding: 11px 18px; text-align: left;
}
.sci-header:hover { background: rgba(201,168,106,0.06); }
.sci-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--coherent);
  box-shadow: 0 0 8px var(--coherent); flex: none; }
.sci-title { font-weight: 700; font-size: 14px; letter-spacing: -0.01em; }
.sci-hint { color: var(--muted-2); font-size: 11px; flex: 1; font-family: "IBM Plex Mono", monospace; }
.sci-caret { color: var(--muted-2); font-size: 10px; transition: transform .18s ease; }
.sci-header[aria-expanded="true"] .sci-caret { transform: rotate(180deg); }

.sci-body { max-height: 46vh; overflow-y: auto; padding: 4px 18px 18px; }
.sci-analysis { font-size: 12.5px; line-height: 1.55; }
.sci-analysis .reading { color: var(--platinum); margin: 0 0 10px; }
.sci-analysis .reading .ro { color: var(--ruled); font-weight: 600; }
.sci-analysis .reading .ok { color: var(--coherent); font-weight: 600; }
.sci-block-label { font-size: 10px; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--muted-2); margin: 12px 0 6px; }
.sci-analysis ul { margin: 0; padding-left: 18px; }
.sci-analysis li { color: var(--muted); margin-bottom: 5px; }
.sci-analysis li::marker { color: var(--gold); }
.sci-analysis .caveat { color: var(--muted); }
.sci-analysis .caveat::marker { color: var(--ruled); }

.sci-chat { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.sci-msg { padding: 9px 12px; border-radius: 5px; font-size: 12.5px; line-height: 1.55; white-space: pre-wrap; }
.sci-msg.you { background: var(--panel-2); border: 1px solid var(--line); color: var(--platinum); align-self: flex-end; max-width: 82%; }
.sci-msg.claude { background: rgba(53,214,196,0.06); border: 1px solid rgba(53,214,196,0.28); color: var(--platinum); }
.sci-msg.err { background: rgba(214,106,74,0.1); border: 1px solid rgba(214,106,74,0.4); color: var(--ruled); }
.sci-msg.pending { color: var(--muted-2); font-style: italic; }

.sci-ask { display: flex; gap: 8px; margin-top: 12px; }
.sci-ask input { flex: 1; font-family: "IBM Plex Mono", monospace; font-size: 12px;
  color: var(--platinum); background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 4px; padding: 8px 10px; }
.sci-ask input:focus { outline: none; border-color: var(--gold); }

.sci-settings { margin-top: 14px; border-top: 1px dashed var(--line-soft); padding-top: 10px; }
.sci-settings summary { cursor: pointer; font-size: 11px; color: var(--muted); font-family: "IBM Plex Mono", monospace; }
.sci-settings summary:hover { color: var(--platinum); }
.sci-key-row { display: flex; gap: 8px; margin-top: 8px; }
.sci-key-row input { flex: 1; font-family: "IBM Plex Mono", monospace; font-size: 12px;
  color: var(--platinum); background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 4px; padding: 7px 9px; }
.sci-key-row .field { width: 108px; flex: none; }
.sci-key-actions { display: flex; align-items: center; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.sci-settings code { background: var(--void); border: 1px solid var(--line-soft); border-radius: 3px; padding: 0 4px; color: var(--gold); font-size: 11px; }
#sciProxyState .ok, .sci-analysis .ok { color: var(--coherent); }
#sciProxyState .ro { color: var(--ruled); }
#sciProxyState .off { color: var(--muted-2); }
.sci-via { margin-top: 6px; font-size: 10px; color: var(--muted-2); font-style: italic; }

@media (prefers-reduced-motion: reduce) { * { animation: none !important; } }
@media (max-width: 1080px) {
  #shell { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 46vh auto auto; }
  .rail, .rail.right { grid-column: 1; grid-row: auto; border: none; border-top: 1px solid var(--line); }
  #stage { grid-column: 1; grid-row: 2; }
  #verdict { grid-column: 1; grid-row: auto; }
}

/* ---- Autonomous lab-loop tab -------------------------------------------- */
.loop-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-top: 8px; }
.loop-card { background: var(--void-2); border: 1px solid var(--line); border-radius: 5px;
  padding: 14px 16px; }
.loop-card p { color: var(--muted); font-size: 12.5px; line-height: 1.6; margin: 6px 0 0; }
.loop-card code, .loop-digest, #loop code { font-family: "IBM Plex Mono", ui-monospace, monospace; }
.loop-card code, #loop code { font-size: 11.5px; color: var(--gold); }
.loop-h { font-family: "Space Grotesk", sans-serif; font-size: 13px; font-weight: 600;
  letter-spacing: 0.01em; color: var(--platinum); margin: 0; }
.loop-digest { background: var(--void); border: 1px solid var(--line-soft); border-radius: 5px;
  padding: 16px 18px; color: var(--muted); font-size: 12px; line-height: 1.65;
  white-space: pre-wrap; overflow-x: auto; max-width: 780px; }
@media (max-width: 720px) { .loop-grid { grid-template-columns: 1fr; } }

/* Patent-claim live-input widgets */
.patent-widget { border: 1px solid var(--line, #2a2a2a); border-radius: 8px; padding: 12px; margin: 10px 0; }
.patent-widget .pw-title { font-weight: 600; margin-bottom: 8px; }
.patent-widget label { display: inline-flex; gap: 6px; align-items: center; margin-right: 14px; }
.patent-widget .pw-out { margin-top: 10px; font-size: 0.9em; opacity: 0.9; white-space: pre-line; }

/* ---- Research dossier (Phase 1) ---------------------------------------- */
.research-banner {
  background: var(--void-2, #0d1220); border: 1px solid var(--line);
  border-left: 3px solid var(--coherent); border-radius: 5px;
  color: var(--muted); font-size: 12.5px; line-height: 1.6;
  padding: 12px 14px; margin: 0 0 16px; max-width: 820px;
}
.research-entry {
  background: var(--void-2, #0d1220); border: 1px solid var(--line);
  border-radius: 6px; padding: 14px 16px; margin: 10px 0; box-shadow: var(--shadow);
}
.research-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.research-title { font-size: 15px; color: var(--platinum); margin: 0; }
.research-statement { color: var(--muted); font-size: 13px; line-height: 1.6; margin: 8px 0 0; max-width: 820px; }
.research-prov { color: var(--muted-2, #6b7690); font-size: 11px; font-family: "IBM Plex Mono", ui-monospace, monospace; margin: 8px 0 0; }
.research-actions { display: flex; align-items: center; gap: 14px; margin-top: 12px; }
.research-badge { font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase;
  border: 1px solid var(--line); border-radius: 999px; padding: 3px 9px; white-space: nowrap; }
.research-badge.lvl-1 { color: var(--muted); }
.research-badge.lvl-2 { color: var(--gold); border-color: var(--gold); }
.research-badge.lvl-3 { color: var(--coherent); border-color: var(--coherent); }
.research-load {
  background: transparent; color: var(--coherent); border: 1px solid var(--coherent);
  border-radius: 5px; padding: 6px 12px; font-size: 12px; cursor: pointer;
}
.research-load:hover { background: rgba(53,214,196,0.10); }
.research-noload { color: var(--muted-2, #6b7690); font-size: 11.5px; font-style: italic; }
.research-doc { color: var(--gold); font-size: 12px; text-decoration: none; }
.research-doc:hover { text-decoration: underline; }
.load-toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%) translateY(10px);
  background: var(--panel); color: var(--platinum); border: 1px solid var(--coherent);
  border-radius: 6px; padding: 9px 16px; font-size: 12.5px; box-shadow: var(--shadow);
  opacity: 0; pointer-events: none; transition: opacity 0.2s, transform 0.2s; z-index: 60;
}
.load-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---- Vibration mode: 3D viewer panel (Phase 2) ------------------------ */
#vibPanel {
  position: absolute; left: 14px; bottom: 14px; z-index: 4;
  width: min(360px, 42%); background: rgba(9,12,20,0.82);
  border: 1px solid var(--line); border-radius: 6px; padding: 10px 12px;
  backdrop-filter: blur(3px);
}
#irSpectrum { display: block; width: 100%; height: 64px; }
#vibPanel .spec-caption { color: var(--muted); font-size: 11px; margin: 4px 0 8px; display: block; }
.ce-readout { border-top: 1px solid var(--line-soft); padding-top: 8px; }
.ce-readout .ce-head { color: var(--platinum); font-size: 11.5px; margin-bottom: 6px; }
.ce-readout .ce-row { display: flex; justify-content: space-between; gap: 10px; font-size: 11.5px; padding: 2px 0; }
.ce-readout .ce-k { color: var(--muted); }
.ce-readout .ce-v { color: var(--coherent); font-family: "IBM Plex Mono", ui-monospace, monospace; text-align: right; }
#vibControls .klm-row { display: flex; gap: 10px; margin-top: 8px; flex-wrap: wrap; }
#vibControls .klm-row label { font-size: 11px; color: var(--muted); }

/* ---- Record + export (Phase 3) ---------------------------------------- */
#recordPanel { margin-top: 22px; border-top: 1px solid var(--line); padding-top: 16px; }
.record-h { font-size: 14px; color: var(--platinum); margin: 0 0 4px; }
.record-note { color: var(--muted); font-size: 12px; line-height: 1.6; margin: 0 0 12px; max-width: 780px; }
.record-field { display: block; font-size: 11px; color: var(--muted); margin-bottom: 8px; }
.record-field .field { display: block; width: 100%; margin-top: 3px; box-sizing: border-box; }
.record-field textarea.field { resize: vertical; font-family: inherit; }
.record-actions { display: flex; gap: 10px; flex-wrap: wrap; margin: 4px 0 14px; align-items: center; }
.rec-entries { display: flex; flex-direction: column; gap: 8px; }
.rec-empty { color: var(--muted-2, #6b7690); font-size: 12px; font-style: italic; margin: 0; }
.rec-entry { background: var(--void-2, #0d1220); border: 1px solid var(--line); border-radius: 5px; padding: 10px 12px; }
.rec-entry-head { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.rec-entry-title { color: var(--platinum); font-size: 13px; }
.rec-entry-when { color: var(--muted-2, #6b7690); font-size: 10.5px; font-family: "IBM Plex Mono", ui-monospace, monospace; }
.rec-entry-hyp { color: var(--muted); font-size: 12px; line-height: 1.5; margin: 6px 0 0; }
.rec-entry-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.rec-btn { background: transparent; color: var(--muted); border: 1px solid var(--line); border-radius: 4px; padding: 4px 9px; font-size: 11px; cursor: pointer; }
.rec-btn:hover { color: var(--coherent); border-color: var(--coherent); }
