:root {
  color-scheme: dark;
  --bg: #07111f;
  --surface: #0f1f33;
  --surface-2: #0a1929;
  --line: #24405b;
  --line-bright: #326587;
  --text: #f8fafc;
  --muted: #a8b3c7;
  --mint: #20e2cf;
  --cyan: #38bdf8;
  --violet: #a66cff;
  --orange: #ff983a;
  --gray: #9caec1;
  --red: #f05252;
  --radius: 18px;
  font-family: "Segoe UI", Tahoma, Arial, sans-serif;
}

* { box-sizing: border-box; }
html { background: var(--bg); scroll-behavior: smooth; }
body {
  min-width: 320px;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 50% 18%, rgba(16, 86, 114, .16), transparent 32rem),
    linear-gradient(180deg, #07111f 0%, #06101d 100%);
}
button, input, select { font: inherit; }
button { color: inherit; }

.topbar {
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(20px, 4vw, 64px);
  border-bottom: 1px solid rgba(83, 139, 174, .22);
  background: rgba(5, 17, 30, .86);
  backdrop-filter: blur(18px);
  position: sticky;
  top: 0;
  z-index: 20;
}
.brand { display: flex; align-items: center; gap: 13px; color: var(--mint); text-decoration: none; font-size: clamp(18px, 2vw, 26px); font-weight: 750; direction: ltr; }
.brand b { color: white; }
.brand-mark { width: 32px; height: 32px; position: relative; display: inline-block; }
.brand-mark i { width: 9px; height: 9px; border-radius: 50%; position: absolute; background: var(--mint); box-shadow: 0 0 14px rgba(32, 226, 207, .65); }
.brand-mark i:nth-child(1) { inset: 2px auto auto 11px; }
.brand-mark i:nth-child(2) { inset: 12px auto auto 1px; }
.brand-mark i:nth-child(3) { inset: 12px 1px auto auto; }
.brand-mark i:nth-child(4) { inset: auto auto 1px 11px; }
.brand-mark::before, .brand-mark::after { content: ""; position: absolute; inset: 15px 4px; height: 2px; background: var(--mint); }
.brand-mark::after { transform: rotate(90deg); }
.synthetic-notice { margin: 0; color: #d7fdf7; display: flex; align-items: center; gap: 8px; font-weight: 650; }
.synthetic-notice span { color: var(--mint); font-size: 22px; }

.lab-shell { width: min(1760px, 100%); margin: auto; padding: 22px clamp(14px, 2vw, 30px) 36px; }
.workspace { display: grid; grid-template-columns: minmax(248px, .78fr) minmax(470px, 1.55fr) minmax(260px, .8fr); gap: 14px; align-items: stretch; direction: rtl; }
.panel, .scene-panel, .alnart-reference, .evidence-spectrum, .review-gate {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(160deg, rgba(16, 36, 57, .96), rgba(8, 25, 41, .96));
  box-shadow: 0 22px 55px rgba(0, 0, 0, .18);
}
.panel { padding: 22px; direction: rtl; }
.panel-heading { padding-bottom: 16px; border-bottom: 1px solid rgba(91, 139, 172, .2); margin-bottom: 18px; }
.panel-heading h1, .panel-heading h2, .scene-toolbar h2 { margin: 0 0 6px; font-size: 24px; }
.panel-heading p, .scene-toolbar p { margin: 0; color: var(--muted); font-size: 13px; }

.field { display: grid; gap: 8px; margin: 0 0 19px; }
.field > span, .field legend { color: #eef6ff; font-weight: 700; font-size: 14px; }
.field input[type="text"], .field input:not([type]), .field select, #compound, #duration {
  width: 100%; border: 1px solid #40617c; background: #0b1c2e; color: white; border-radius: 10px; padding: 11px 13px; outline: none;
}
.field input:focus, .field select:focus { border-color: var(--mint); box-shadow: 0 0 0 3px rgba(32, 226, 207, .12); }
.field small { color: var(--muted); font-size: 11px; display: flex; justify-content: space-between; }
.group-field { border: 0; padding: 0; }
.segmented { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; direction: ltr; }
.segmented input { position: absolute; opacity: 0; }
.segmented span { display: grid; place-items: center; padding: 9px; border: 1px solid #385876; border-radius: 9px; background: #0b1c2e; font-weight: 750; cursor: pointer; transition: .2s ease; }
.segmented input:checked + span { color: #031118; background: var(--mint); border-color: var(--mint); box-shadow: 0 0 18px rgba(32, 226, 207, .24); }
.range-field > span { display: flex; justify-content: space-between; align-items: center; }
output { color: var(--mint); font-size: 18px; }
input[type="range"] { accent-color: var(--mint); cursor: pointer; width: 100%; }
.primary-action, .secondary-action, .icon-action, .timeline button {
  border-radius: 10px; border: 1px solid #41637e; cursor: pointer; transition: transform .2s ease, border-color .2s ease, background .2s ease;
}
.primary-action { width: 100%; border-color: var(--mint); background: linear-gradient(90deg, #20e2cf, #2ff1d0); color: #031118; padding: 13px 16px; font-weight: 850; font-size: 16px; }
.primary-action:hover { transform: translateY(-1px); box-shadow: 0 9px 26px rgba(32, 226, 207, .18); }
.primary-action:disabled { opacity: .62; cursor: wait; }
.secondary-action { width: 100%; margin-top: 9px; background: transparent; padding: 10px; color: #dce8f3; }
.secondary-action:hover, .icon-action:hover { border-color: var(--mint); }
.layer-toggle { margin-top: 11px; border: 1px solid rgba(56, 189, 248, .25); border-radius: 10px; padding: 9px 10px; display: flex; align-items: center; gap: 8px; color: #c9d9e6; font-size: 12px; cursor: pointer; }
.layer-toggle input { accent-color: var(--cyan); }
.run-status { min-height: 42px; margin: 18px 0 0; border: 1px solid rgba(32, 226, 207, .28); background: rgba(32, 226, 207, .06); color: #bffaf1; border-radius: 10px; padding: 10px; font-size: 12px; }

.scene-panel { min-width: 0; overflow: hidden; direction: rtl; display: grid; grid-template-rows: auto minmax(430px, 1fr) auto auto; }
.scene-toolbar { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px 12px; gap: 12px; }
.icon-action { background: #0b1c2e; padding: 8px 11px; font-size: 12px; }
.icon-action.is-active { color: var(--mint); border-color: var(--mint); }
.scene-wrap { position: relative; overflow: hidden; min-height: 430px; background: radial-gradient(circle at 50% 45%, rgba(32, 226, 207, .1), transparent 42%), linear-gradient(180deg, rgba(5, 17, 30, .35), rgba(3, 13, 24, .75)); }
#cohort-canvas { display: block; width: 100%; height: 100%; min-height: 430px; touch-action: none; cursor: grab; }
#cohort-canvas:active { cursor: grabbing; }
.scene-readout { position: absolute; top: 22%; right: 18px; border: 1px solid var(--mint); border-radius: 11px; background: rgba(6, 24, 37, .86); padding: 9px 12px; box-shadow: 0 0 22px rgba(32, 226, 207, .16); display: grid; text-align: center; }
.scene-readout span { font-size: 11px; color: var(--muted); }
.scene-readout strong { color: var(--mint); font-size: 23px; }
.cnt-readout { position: absolute; top: 18px; left: 18px; border: 1px solid rgba(56, 189, 248, .62); border-radius: 11px; background: rgba(6, 24, 37, .86); padding: 9px 12px; box-shadow: 0 0 22px rgba(56, 189, 248, .12); display: grid; text-align: left; direction: ltr; max-width: 230px; }
.cnt-readout span { font-size: 10px; color: #9adcf8; }
.cnt-readout strong { font-size: 15px; color: white; margin: 3px 0; }
.cnt-readout small { color: var(--muted); font-size: 10px; }
.participant-detail { position: absolute; left: 16px; bottom: 16px; max-width: 230px; background: rgba(5, 16, 28, .94); border: 1px solid #496a85; border-radius: 11px; padding: 10px 12px; font-size: 12px; box-shadow: 0 12px 30px rgba(0, 0, 0, .3); }
.participant-detail b { color: var(--mint); display: block; font-size: 14px; margin-bottom: 3px; }
.timeline { display: grid; grid-template-columns: 42px auto 1fr; align-items: center; gap: 13px; padding: 12px 18px; direction: ltr; border-top: 1px solid rgba(80, 127, 158, .18); }
.timeline button { height: 38px; background: transparent; color: var(--mint); border-color: var(--mint); font-weight: 850; }
.timeline span { font-size: 13px; font-weight: 700; direction: rtl; }
.scene-meta { display: grid; grid-template-columns: repeat(3, 1fr); margin: 0 18px 18px; border: 1px solid rgba(67, 105, 131, .42); border-radius: 11px; overflow: hidden; }
.scene-meta div { padding: 10px; display: flex; justify-content: center; gap: 8px; border-left: 1px solid rgba(67, 105, 131, .42); }
.scene-meta div:last-child { border-left: 0; }
.scene-meta dt { color: var(--muted); font-size: 12px; }
.scene-meta dd { margin: 0; font-weight: 750; font-size: 12px; }

.results-panel { display: flex; flex-direction: column; }
.distribution { display: grid; grid-template-columns: minmax(108px, .75fr) 1fr; align-items: center; gap: 15px; direction: ltr; }
.donut { aspect-ratio: 1; border-radius: 50%; display: grid; place-content: center; text-align: center; position: relative; background: conic-gradient(var(--gray) 0 100%); box-shadow: inset 0 0 20px rgba(0, 0, 0, .16); }
.donut::after { content: ""; position: absolute; inset: 20%; border-radius: 50%; background: #0c1c2c; box-shadow: 0 0 0 1px rgba(93, 139, 169, .18); }
.donut strong, .donut span { z-index: 1; }
.donut strong { font-size: clamp(26px, 3vw, 42px); line-height: 1; }
.donut span { color: var(--muted); font-size: 11px; margin-top: 4px; }
.legend { margin: 0; direction: rtl; }
.legend div { display: flex; justify-content: space-between; align-items: center; padding: 7px 0; }
.legend dt { color: #dbe6ef; font-size: 12px; display: flex; align-items: center; gap: 6px; }
.legend dd { margin: 0; font-weight: 800; }
.legend i { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.high { background: var(--mint); }.mid { background: var(--orange); }.uncertain { background: var(--gray); }
.metric-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 20px 0; }
.metric-row div { border: 1px solid #36536d; border-radius: 9px; padding: 9px 4px; display: grid; text-align: center; }
.metric-row strong { font-size: 20px; }.metric-row span { color: var(--muted); font-size: 10px; }
.metric-row div:nth-child(1) strong { color: var(--mint); }.metric-row div:nth-child(2) strong { color: var(--orange); }.metric-row div:nth-child(3) strong { color: var(--gray); }
.chart-block { margin-top: auto; }
.chart-block h3 { margin: 0 0 8px; font-size: 14px; }
#response-chart { width: 100%; height: 170px; display: block; border: 1px solid rgba(59, 94, 119, .42); border-radius: 10px; background: rgba(5, 16, 28, .35); }
.result-boundary { margin-top: 14px; border-right: 3px solid var(--violet); background: rgba(166, 108, 255, .07); padding: 10px 12px; font-size: 11px; }
.result-boundary b { color: #d8bfff; }.result-boundary p { color: var(--muted); margin: 4px 0 0; }

.evidence-zone { display: grid; grid-template-columns: minmax(250px, .72fr) minmax(250px, .82fr) minmax(500px, 1.5fr); gap: 14px; margin-top: 14px; direction: ltr; }
.alnart-reference, .cnt-reference { direction: rtl; padding: 18px 20px; display: flex; gap: 16px; align-items: center; border-color: rgba(166, 108, 255, .62); }
.cnt-reference { border: 1px solid rgba(56, 189, 248, .58); border-radius: var(--radius); background: linear-gradient(160deg, rgba(16, 36, 57, .96), rgba(8, 25, 41, .96)); }
.mito-mark { flex: 0 0 62px; width: 62px; height: 62px; display: grid; place-items: center; border: 2px solid var(--violet); color: var(--violet); border-radius: 50% 45% 52% 42%; font-size: 40px; transform: rotate(-18deg); }
.cnt-mark { flex: 0 0 54px; width: 54px; height: 54px; display: grid; place-items: center; border: 2px solid var(--cyan); color: var(--cyan); border-radius: 14px; font-size: 30px; font-family: Georgia, serif; }
.alnart-reference h2, .cnt-reference h2, .evidence-spectrum h2 { margin: 0 0 5px; font-size: 18px; }
.alnart-reference p, .cnt-reference p { margin: 0 0 5px; color: #dce6ee; font-size: 12px; }
.alnart-reference small, .cnt-reference small { color: var(--muted); font-size: 10px; }
.evidence-spectrum { direction: rtl; padding: 18px 20px; }
.spectrum-heading { display: flex; align-items: end; justify-content: space-between; gap: 15px; margin-bottom: 10px; }
.spectrum-heading p { margin: 0; color: var(--muted); font-size: 11px; }
.spectrum-band { display: grid; grid-template-columns: repeat(5, 1fr); border-radius: 999px; overflow: hidden; direction: ltr; }
.spectrum-band span { color: #06111b; padding: 8px 5px; text-align: center; font-size: 10px; font-weight: 900; }
.simulated { background: #20e2cf; }.computed { background: #38bdf8; }.verified { background: #a66cff; }.open { background: #ffb33a; }.rejected { background: #ff5d64; }
.evidence-spectrum ul { list-style: none; padding: 0; margin: 10px 0 0; display: flex; flex-wrap: wrap; gap: 7px 14px; color: var(--muted); font-size: 10px; }
.evidence-spectrum li b { color: #e8f2f9; }
.review-gate { margin-top: 14px; padding: 24px; direction: rtl; }
.review-gate-heading { display: flex; justify-content: space-between; align-items: end; gap: 20px; padding-bottom: 18px; border-bottom: 1px solid rgba(91, 139, 172, .2); }
.review-gate-heading h2 { margin: 0 0 6px; font-size: clamp(21px, 2.2vw, 30px); }
.review-gate-heading p { margin: 0; color: var(--muted); font-size: 13px; }
.review-gate-heading > strong { color: var(--mint); font-size: 11px; letter-spacing: .08em; direction: ltr; white-space: nowrap; }
.gate-path { list-style: none; margin: 20px 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; counter-reset: gate; direction: rtl; }
.gate-path li { min-width: 0; display: grid; grid-template-columns: 38px 1fr auto; align-items: center; gap: 10px; padding: 14px; border: 1px solid #36536d; border-radius: 12px; background: rgba(5, 16, 28, .36); }
.gate-path li > span { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; border: 1px solid currentColor; font-size: 11px; font-weight: 850; direction: ltr; }
.gate-path b, .gate-path small { display: block; }
.gate-path b { margin-bottom: 4px; font-size: 13px; }
.gate-path small { color: var(--muted); font-size: 10px; line-height: 1.55; }
.gate-path em { font-style: normal; font-size: 9px; font-weight: 900; direction: ltr; }
.gate-verified { color: #d7c7ff; border-color: rgba(166, 108, 255, .45) !important; }
.gate-open { color: #ffd18a; border-color: rgba(255, 179, 58, .4) !important; }
.review-register { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; direction: rtl; }
.review-register article { min-width: 0; border-top: 2px solid #3d617b; background: rgba(10, 25, 41, .66); padding: 16px; }
.review-register h3 { margin: 10px 0 7px; font-size: 15px; direction: ltr; text-align: right; }
.review-register p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.65; }
.review-state { display: inline-block; font-size: 9px; line-height: 1; font-weight: 900; letter-spacing: .04em; direction: ltr; }
.state-verified { color: #cbb4ff; }.state-computed { color: #8bdefd; }.state-open { color: #ffc86f; }
.deployment-boundary { margin: 18px 0 0; padding: 12px 14px; border-right: 3px solid var(--red); background: rgba(240, 82, 82, .06); color: var(--muted); font-size: 11px; }
.deployment-boundary b { color: #ff9da1; }
.footer-note { max-width: 1760px; margin: auto; padding: 0 30px 30px; text-align: center; color: #8294a8; font-size: 11px; }

@media (max-width: 1120px) {
  .workspace { grid-template-columns: minmax(250px, .78fr) minmax(470px, 1.4fr); }
  .results-panel { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; gap: 15px 24px; }
  .results-panel .panel-heading, .result-boundary { grid-column: 1 / -1; }
  .chart-block { margin-top: 0; }
  .evidence-zone { grid-template-columns: 1fr 1fr; }
  .evidence-spectrum { grid-column: 1 / -1; }
  .review-register { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 780px) {
  .topbar { height: 62px; padding: 0 15px; }.brand { font-size: 17px; }.synthetic-notice { font-size: 11px; }
  .lab-shell { padding: 12px 10px 24px; }
  .workspace, .evidence-zone { grid-template-columns: 1fr; }
  .scene-panel { grid-row: 1; min-height: 650px; }.setup-panel { grid-row: 2; }.results-panel { grid-row: 3; display: flex; }
  .scene-wrap, #cohort-canvas { min-height: 430px; }.scene-toolbar { align-items: start; }.scene-toolbar p { max-width: 250px; }
  .evidence-zone { grid-template-columns: 1fr; }.spectrum-heading { align-items: start; flex-direction: column; }
  .review-gate-heading { align-items: start; flex-direction: column; }
  .gate-path { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .synthetic-notice span { display: none; }.brand-mark { width: 26px; height: 26px; transform: scale(.82); }
  .panel { padding: 17px; }.scene-panel { min-height: 590px; }.scene-wrap, #cohort-canvas { min-height: 370px; }
  .scene-toolbar h2, .panel-heading h1, .panel-heading h2 { font-size: 20px; }
  .scene-readout { right: 9px; top: 16%; }.timeline { grid-template-columns: 38px auto 1fr; padding: 10px; gap: 8px; }
  .cnt-readout { left: 9px; top: 9px; max-width: 180px; }
  .scene-meta { margin: 0 10px 12px; }.scene-meta div { display: grid; gap: 2px; text-align: center; }
  .distribution { grid-template-columns: 130px 1fr; }.alnart-reference { align-items: start; }.mito-mark { flex-basis: 50px; width: 50px; height: 50px; }
  .spectrum-band span { writing-mode: vertical-rl; min-height: 80px; display: grid; place-content: center; }
  .review-gate { padding: 17px; }
  .review-register { grid-template-columns: 1fr; }
  .gate-path li { grid-template-columns: 34px 1fr auto; padding: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
