/* ============================================================
   RE / RANGE — 辐射发射暗室仿真台   深石墨蓝 + 磷光青 + 发射琥珀 / 仪器控制台美学   ============================================================ */

:root {
  --bg: #050a0e;
  --bg-2: #070f14;
  --panel: #080f14;
  --panel-2: #0b161c;
  --line: rgba(121, 186, 190, 0.14);
  --line-2: rgba(121, 205, 210, 0.26);
  --text: #d9e8e9;
  --text-soft: #a9c2c4;
  --muted: #6c8a90;
  --dim: #43595e;
  --teal: #58e7d8;
  --teal-dim: rgba(88, 231, 216, 0.12);
  --amber: #ffb45c;
  --amber-deep: #ff8f3c;
  --red: #ff5f6d;
  --green: #63e6a8;
  --mono: "Cascadia Mono", "SFMono-Regular", Consolas, "Liberation Mono", "Microsoft YaHei UI", monospace;
  --sans: "Microsoft YaHei UI", "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", sans-serif;
  --display: "Bahnschrift SemiCondensed", "Bahnschrift", "DIN Alternate", "Microsoft YaHei UI", sans-serif;
  --radius: 2px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body { height: 100%; }

body {
  background:
    radial-gradient(1100px 640px at 16% -8%, rgba(40, 125, 122, 0.17), transparent 62%),
    radial-gradient(900px 560px at 96% 6%, rgba(255, 150, 60, 0.05), transparent 60%),
    var(--bg);
  color: var(--text);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(88, 231, 216, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(88, 231, 216, 0.03) 1px, transparent 1px);
  background-size: 48px 48px;
  -webkit-mask-image: radial-gradient(ellipse at 50% 18%, #000 18%, transparent 76%);
  mask-image: radial-gradient(ellipse at 50% 18%, #000 18%, transparent 76%);
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.022;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

button, input, output { font: inherit; color: inherit; }
button { -webkit-tap-highlight-color: transparent; }
::selection { background: rgba(88, 231, 216, 0.28); color: #fff; }

:focus-visible {
  outline: 1px solid var(--teal);
  outline-offset: 2px;
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(88, 231, 216, 0.16); border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: rgba(88, 231, 216, 0.32); }

/* ------------------------------ shell ------------------------------ */

.app {
  position: relative;
  z-index: 1;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: 60px;
  flex: none;
  display: flex;
  align-items: center;
  gap: 26px;
  padding: 0 18px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(8, 16, 21, 0.92), rgba(5, 10, 14, 0.82));
  backdrop-filter: blur(8px);
  animation: rise 0.5s both;
}

.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }

.lab-back {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 28px;
  padding: 0 10px;
  border: 1px solid rgba(88, 231, 216, 0.22);
  background: rgba(8, 20, 24, 0.55);
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.14em;
  color: rgba(88, 231, 216, 0.9);
  text-decoration: none;
  transition: border-color 0.18s, background 0.18s, color 0.18s;
}
.lab-back:hover {
  border-color: rgba(88, 231, 216, 0.55);
  background: rgba(88, 231, 216, 0.08);
  color: var(--teal);
}
.lab-back .lb-arrow { font-size: 13px; line-height: 1; transform: translateY(-0.5px); }

.brand-mark {
  width: 34px;
  height: 34px;
  color: var(--teal);
  flex: none;
  filter: drop-shadow(0 0 7px rgba(88, 231, 216, 0.35));
}

.brand-copy h1 {
  font-family: var(--display);
  font-size: 19px;
  font-weight: 600;
  letter-spacing: 0.14em;
  line-height: 1;
  color: #eef8f8;
}

.brand-copy h1 i {
  font-style: normal;
  color: var(--amber);
  margin: 0 2px;
  opacity: 0.85;
}

.brand-copy p {
  margin-top: 5px;
  font-size: 9px;
  letter-spacing: 0.2em;
  color: var(--muted);
}

.top-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: 8px;
}

.meta-chip {
  display: flex;
  align-items: center;
  gap: 7px;
  height: 28px;
  padding: 0 10px;
  border: 1px solid var(--line);
  background: rgba(8, 17, 22, 0.6);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.06em;
  color: var(--muted);
  white-space: nowrap;
}

.meta-chip b {
  font-weight: 500;
  font-size: 9.5px;
  letter-spacing: 0.1em;
  color: var(--text-soft);
}

.pulse-dot {
  width: 5px;
  height: 5px;
  background: var(--green);
  border-radius: 50%;
  box-shadow: 0 0 0 0 rgba(99, 230, 168, 0.5);
  animation: dotPulse 2.4s infinite;
}

.top-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 14px;
}

.clock { text-align: right; line-height: 1; }

.clock span {
  display: block;
  font-family: var(--mono);
  font-size: 15px;
  letter-spacing: 0.08em;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.clock em {
  display: block;
  margin-top: 4px;
  font-style: normal;
  font-family: var(--mono);
  font-size: 7.5px;
  letter-spacing: 0.22em;
  color: var(--dim);
}

.help-btn {
  width: 28px;
  height: 28px;
  border: 1px solid var(--line-2);
  background: transparent;
  color: var(--text-soft);
  font-family: var(--mono);
  font-size: 13px;
  cursor: pointer;
  transition: 0.2s;
}

.help-btn:hover {
  color: var(--teal);
  border-color: var(--teal);
  background: var(--teal-dim);
  box-shadow: 0 0 14px -4px rgba(88, 231, 216, 0.5);
}

/* ------------------------------ workspace ------------------------------ */

.workspace {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 384px;
  grid-template-rows: minmax(0, 1fr) 252px;
  gap: 12px;
  padding: 12px;
}

/* ------------------------------ stage ------------------------------ */

.stage {
  position: relative;
  grid-column: 1;
  grid-row: 1;
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  background:
    radial-gradient(75% 55% at 50% 10%, rgba(44, 118, 118, 0.16), transparent 70%),
    radial-gradient(55% 50% at 50% 88%, rgba(255, 150, 60, 0.045), transparent 70%),
    #04090d;
  animation: rise 0.6s 0.05s both;
  transition: box-shadow 0.35s;
}

.stage::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  box-shadow: inset 0 0 90px rgba(0, 0, 0, 0.55);
}

.stage.scanning {
  box-shadow: inset 0 0 0 1px rgba(255, 180, 92, 0.22), 0 0 34px -18px rgba(255, 180, 92, 0.4);
}

#scene {
  position: absolute;
  inset: 0;
  display: block;
  cursor: grab;
  touch-action: none;
}

#scene:active { cursor: grabbing; }

.stage-chrome {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  padding: 16px 18px;
}

.stage-tl {
  position: absolute;
  top: 16px;
  left: 18px;
  padding: 10px 56px 26px 12px;
  margin: -10px -12px -26px -12px;
  background: radial-gradient(120% 130% at 0% 0%, rgba(4, 9, 13, 0.86) 0%, rgba(4, 9, 13, 0.5) 48%, rgba(4, 9, 13, 0) 74%);
}

.eyebrow {
  display: block;
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 500;
  letter-spacing: 0.24em;
  color: var(--muted);
  text-transform: uppercase;
}

.stage-tl .eyebrow { color: rgba(88, 231, 216, 0.62); }

.stage-tl h2 {
  margin-top: 7px;
  font-family: var(--display);
  font-size: 22px;
  font-weight: 500;
  letter-spacing: 0.05em;
  color: #eaf6f6;
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.6);
}

.stage-tl p {
  display: inline-block;
  margin-top: 6px;
  padding: 2px 7px;
  margin-left: -7px;
  background: rgba(4, 9, 13, 0.7);
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.13em;
  color: var(--muted);
}

.stage-tr {
  position: absolute;
  top: 18px;
  right: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-end;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 7px;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.12em;
  color: var(--muted);
}

.legend-item i { display: block; width: 14px; height: 2px; }

.lg-amber { background: var(--amber); box-shadow: 0 0 6px rgba(255, 180, 92, 0.7); }
.lg-teal { background: var(--teal); box-shadow: 0 0 6px rgba(88, 231, 216, 0.6); }
.lg-ghost { background: repeating-linear-gradient(90deg, #43595e 0 2px, transparent 2px 4px); }

.stage-bl { position: absolute; left: 18px; bottom: 16px; }

.hint {
  display: inline-block;
  padding: 5px 9px;
  border: 1px solid rgba(121, 186, 190, 0.12);
  background: rgba(3, 8, 11, 0.5);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.1em;
  color: #5d7a80;
}

.stage-br {
  position: absolute;
  right: 18px;
  bottom: 16px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
}

.live-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border: 1px solid rgba(88, 231, 216, 0.22);
  background: rgba(6, 15, 18, 0.72);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.16em;
  color: var(--teal);
  white-space: nowrap;
}

.live-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 8px var(--teal);
}

.live-pill.busy { border-color: rgba(255, 180, 92, 0.35); color: var(--amber); }
.live-pill.busy .live-dot { background: var(--amber); box-shadow: 0 0 8px var(--amber); animation: dotPulse 1s infinite; }
.live-pill.fail { border-color: rgba(255, 95, 109, 0.4); color: var(--red); }
.live-pill.fail .live-dot { background: var(--red); box-shadow: 0 0 8px var(--red); }
.live-pill.pass { border-color: rgba(99, 230, 168, 0.35); color: var(--green); }
.live-pill.pass .live-dot { background: var(--green); box-shadow: 0 0 8px var(--green); }

.mini-metrics { display: flex; gap: 16px; }

.mini-metrics span {
  display: block;
  font-family: var(--mono);
  font-size: 7.5px;
  letter-spacing: 0.16em;
  color: var(--dim);
}

.mini-metrics b {
  display: block;
  margin-top: 3px;
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 400;
  letter-spacing: 0.04em;
  color: var(--text-soft);
  font-variant-numeric: tabular-nums;
}

.scan-flash {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.4s;
  background: radial-gradient(120% 90% at 50% 100%, rgba(88, 231, 216, 0.09), transparent 62%);
}

.stage.scanning .scan-flash { opacity: 1; animation: flashPulse 2.6s ease-in-out infinite; }

/* ------------------------------ panel ------------------------------ */

.panel {
  grid-column: 2;
  grid-row: 1 / span 2;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(9, 17, 22, 0.96), rgba(6, 12, 16, 0.96));
  animation: rise 0.6s 0.1s both;
}

.panel-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0 14px 10px;
  scrollbar-width: thin;
  scrollbar-color: rgba(88, 231, 216, 0.3) transparent;
}

.panel-scroll::-webkit-scrollbar { width: 5px; }
.panel-scroll::-webkit-scrollbar-track { background: transparent; }
.panel-scroll::-webkit-scrollbar-thumb {
  background: rgba(88, 231, 216, 0.22);
  border-radius: 0;
}
.panel-scroll::-webkit-scrollbar-thumb:hover { background: rgba(88, 231, 216, 0.45); }

.panel-head {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0 6px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #091116 72%, rgba(9, 17, 22, 0.92));
}

.panel-no {
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.2em;
  color: var(--dim);
}

.group { padding: 9px 0 10px; border-bottom: 1px solid rgba(121, 186, 190, 0.09); }

.group-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 7px;
}

.group-head h3 {
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--text);
  display: flex;
  align-items: center;
}

.group-head h3::before {
  content: "";
  width: 3px;
  height: 9px;
  margin-right: 8px;
  background: var(--teal);
  opacity: 0.65;
  box-shadow: 0 0 8px rgba(88, 231, 216, 0.5);
}

.group-head > span {
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.18em;
  color: var(--dim);
  white-space: nowrap;
}

/* EUT picker */

.eut { position: relative; }

.eut-current {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.eut-current:hover { border-color: var(--line-2); background: #0d1a21; }
.eut-current[aria-expanded="true"] { border-color: rgba(88, 231, 216, 0.4); }

.eut-glyph {
  width: 32px;
  height: 32px;
  flex: none;
  display: grid;
  place-items: center;
  border: 1px dashed rgba(255, 180, 92, 0.28);
  background: rgba(255, 180, 92, 0.05);
  color: var(--amber);
  font-family: var(--mono);
  font-size: 16px;
}

.eut-copy { min-width: 0; }

.eut-copy b {
  display: block;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.eut-copy small {
  display: block;
  margin-top: 3px;
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.05em;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.eut-caret {
  margin-left: auto;
  color: var(--muted);
  font-size: 12px;
  line-height: 1;
  transition: transform 0.22s;
}

.eut.open .eut-caret { transform: rotate(180deg); }

.eut-menu {
  position: absolute;
  top: calc(100% + 5px);
  left: 0;
  right: 0;
  z-index: 40;
  display: none;
  max-height: 274px;
  overflow-y: auto;
  border: 1px solid var(--line-2);
  background: #09141a;
  box-shadow: 0 22px 50px -12px rgba(0, 0, 0, 0.85), 0 0 0 1px rgba(0, 0, 0, 0.4);
}

.eut.open .eut-menu { display: block; animation: menuIn 0.18s ease-out; }

.eut-opt {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border: 0;
  border-bottom: 1px solid rgba(121, 186, 190, 0.08);
  background: transparent;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s;
}

.eut-opt:last-child { border-bottom: 0; }
.eut-opt:hover { background: rgba(88, 231, 216, 0.07); }

.eut-opt .og {
  width: 20px;
  flex: none;
  text-align: center;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--amber);
  opacity: 0.8;
}

.eut-opt .oc { min-width: 0; flex: 1; }

.eut-opt .oc b {
  display: block;
  font-size: 10.5px;
  font-weight: 500;
  color: var(--text-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.eut-opt .oc small {
  display: block;
  margin-top: 2px;
  font-family: var(--mono);
  font-size: 8px;
  color: var(--dim);
  letter-spacing: 0.04em;
}

.eut-opt .ot {
  font-family: var(--mono);
  font-size: 7.5px;
  letter-spacing: 0.08em;
  color: var(--dim);
  border: 1px solid var(--line);
  padding: 2px 4px;
  white-space: nowrap;
}

.eut-opt.active { background: rgba(88, 231, 216, 0.09); box-shadow: inset 2px 0 0 var(--teal); }
.eut-opt.active .oc b { color: var(--teal); }

.eut-note {
  margin-top: 7px;
  padding-left: 9px;
  border-left: 1px solid var(--line-2);
  font-size: 9.5px;
  line-height: 1.55;
  color: var(--muted);
}

/* sliders */

.slider-row { margin-bottom: 7px; }
.slider-row:last-child { margin-bottom: 0; }

.slider-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 2px;
}

.slider-head label {
  font-size: 10px;
  letter-spacing: 0.05em;
  color: var(--text-soft);
}

.slider-head output {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--teal);
  font-variant-numeric: tabular-nums;
}

.range {
  -webkit-appearance: none;
  appearance: none;
  display: block;
  width: 100%;
  height: 18px;
  margin: 0;
  background: transparent;
  cursor: pointer;
}

.range::-webkit-slider-runnable-track {
  height: 2px;
  background: linear-gradient(
    90deg,
    var(--teal) 0,
    var(--teal) var(--p, 0%),
    rgba(121, 186, 190, 0.18) var(--p, 0%),
    rgba(121, 186, 190, 0.18) 100%
  );
}

.range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 8px;
  height: 15px;
  margin-top: -6.5px;
  border: 1px solid var(--teal);
  border-radius: 1px;
  background: #0a171c;
  box-shadow: 0 0 9px rgba(88, 231, 216, 0.55);
  transition: background 0.2s, box-shadow 0.2s;
}

.range:hover::-webkit-slider-thumb { background: var(--teal); box-shadow: 0 0 13px rgba(88, 231, 216, 0.8); }
.range:disabled { opacity: 0.4; cursor: default; }

.range::-moz-range-track { height: 2px; background: rgba(121, 186, 190, 0.18); }
.range::-moz-range-progress { height: 2px; background: var(--teal); }
.range::-moz-range-thumb {
  width: 8px;
  height: 15px;
  border: 1px solid var(--teal);
  border-radius: 1px;
  background: #0a171c;
  box-shadow: 0 0 9px rgba(88, 231, 216, 0.55);
}

/* segmented rows */

.field-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 6px;
}

.pair-rows {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 0 12px;
}

.pair-rows .field-row { gap: 6px; }
.pair-rows .field-label { font-size: 9px; }
.pair-rows .seg button { padding: 4px 7px; }

.field-label {
  font-size: 10px;
  letter-spacing: 0.05em;
  color: var(--text-soft);
  white-space: nowrap;
}

.seg {
  display: flex;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.22);
}

.seg button {
  padding: 4px 9px;
  border: 0;
  border-left: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: 0.16s;
  white-space: nowrap;
}

.seg button:first-child { border-left: 0; }
.seg button:hover { color: var(--text); background: rgba(88, 231, 216, 0.05); }
.seg button.on {
  color: var(--teal);
  background: linear-gradient(180deg, rgba(88, 231, 216, 0.16), rgba(88, 231, 216, 0.07));
  box-shadow: inset 0 -1px 0 rgba(88, 231, 216, 0.5);
}

.seg.pol button i {
  font-style: normal;
  margin-right: 3px;
  color: var(--dim);
}
.seg.pol button.on i { color: var(--teal); }

.seg button:disabled { opacity: 0.4; cursor: default; }

.spec-line {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 5px 7px;
  margin-top: 6px;
  padding-top: 7px;
  border-top: 1px dashed rgba(121, 186, 190, 0.1);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.03em;
  color: var(--dim);
}

.spec-line b { font-weight: 400; color: var(--text-soft); margin-right: 3px; }

/* actions */

.btn {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 12px;
  border: 1px solid var(--line-2);
  background: var(--panel-2);
  color: var(--text);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.05em;
  cursor: pointer;
  overflow: hidden;
  transition: transform 0.15s, border-color 0.2s, box-shadow 0.2s, filter 0.2s;
}

.btn + .btn { margin-top: 7px; }

.btn-icon {
  width: 15px;
  flex: none;
  text-align: center;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--teal);
}

.btn-text { white-space: nowrap; }

.btn-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 7px;
  margin-top: 6px;
}

.btn-row .btn {
  padding: 8px 9px;
  gap: 6px;
  margin-top: 0;
}

.btn-row .btn kbd { display: none; }

.btn kbd, .btn small { margin-left: auto; }

.btn kbd {
  font-family: var(--mono);
  font-size: 7.5px;
  letter-spacing: 0.1em;
  padding: 2px 5px;
  border: 1px solid currentColor;
  border-radius: 1px;
  opacity: 0.45;
}

.btn small {
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.16em;
  opacity: 0.58;
}

.btn.primary {
  border-color: rgba(255, 196, 123, 0.75);
  background: linear-gradient(180deg, #ffc47b, #ffab45);
  color: #1d1205;
  box-shadow: 0 8px 22px -14px rgba(255, 170, 70, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.btn.primary .btn-icon { color: #4a2c08; }
.btn.primary:hover { filter: brightness(1.05); transform: translateY(-1px); }
.btn.primary:active { transform: translateY(0); }

.btn.primary.scanning {
  background: linear-gradient(180deg, #ff8089, #e84753);
  border-color: rgba(255, 140, 148, 0.7);
  color: #21070a;
  box-shadow: 0 8px 22px -14px rgba(255, 80, 90, 0.9);
}

.btn.primary.busy {
  background: linear-gradient(180deg, #c9a26b, #a97f42);
  border-color: rgba(201, 162, 107, 0.5);
  color: #241708;
}

.btn.secondary:hover {
  border-color: rgba(88, 231, 216, 0.45);
  background: #0e1c23;
  transform: translateY(-1px);
}

.btn:disabled { cursor: default; opacity: 0.75; transform: none; }

.mini-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 6px;
}

.mini-sep { flex: 1; }

.link-btn {
  border: 0;
  background: transparent;
  padding: 2px 0;
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.06em;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.18s;
}

.link-btn:hover { color: var(--teal); }

.link-btn kbd {
  font-family: var(--mono);
  font-size: 7px;
  border: 1px solid var(--line);
  padding: 1px 3px;
  margin-left: 3px;
  color: var(--dim);
}

.progress {
  height: 2px;
  margin-top: 6px;
  background: rgba(121, 186, 190, 0.12);
  overflow: hidden;
}

.progress-fill {
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--teal), #a6fff3);
  box-shadow: 0 0 10px rgba(88, 231, 216, 0.8);
  transition: width 0.12s linear;
}

/* verdict */

.verdict {
  position: relative;
  padding: 9px 11px 8px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(12, 24, 30, 0.85), rgba(7, 13, 17, 0.9));
  transition: border-color 0.3s, background 0.3s;
}

.verdict::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--dim);
  transition: background 0.3s;
}

.v-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.12em;
  color: var(--muted);
}

.v-top b {
  font-size: 8px;
  font-weight: 500;
  letter-spacing: 0.14em;
  color: var(--dim);
  text-align: right;
}

.v-hero {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin: 5px 0 6px;
}

.v-hero > span {
  font-family: var(--mono);
  font-size: 28px;
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.03em;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  transition: color 0.3s;
}

.v-hero > small {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--muted);
}

.v-side { margin-left: auto; text-align: right; }

.v-side b {
  display: block;
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 400;
  color: var(--text-soft);
  letter-spacing: 0.02em;
}

.v-side em {
  display: block;
  margin-top: 3px;
  font-style: normal;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.06em;
  color: var(--dim);
}

.v-detail {
  display: flex;
  align-items: baseline;
  gap: 11px;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.05em;
  color: var(--dim);
}

.v-detail b { font-weight: 400; color: var(--text-soft); margin-left: 4px; }
.v-detail #vDistance { margin-left: auto; }

.v-note {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px dashed rgba(121, 186, 190, 0.12);
  font-size: 9.2px;
  line-height: 1.45;
  color: var(--muted);
}

.verdict.pass { border-color: rgba(99, 230, 168, 0.3); background: linear-gradient(180deg, rgba(12, 30, 25, 0.7), rgba(7, 14, 15, 0.9)); }
.verdict.pass::before { background: var(--green); box-shadow: 0 0 10px rgba(99, 230, 168, 0.5); }
.verdict.pass .v-top b, .verdict.pass .v-hero > span { color: var(--green); }
.verdict.pass .v-note { color: #7ca99a; }

.verdict.fail { border-color: rgba(255, 95, 109, 0.34); background: linear-gradient(180deg, rgba(34, 13, 17, 0.72), rgba(10, 9, 12, 0.9)); }
.verdict.fail::before { background: var(--red); box-shadow: 0 0 10px rgba(255, 95, 109, 0.55); }
.verdict.fail .v-top b, .verdict.fail .v-hero > span { color: var(--red); }
.verdict.fail .v-note { color: #b98289; }

.verdict.scanning { border-color: rgba(255, 180, 92, 0.3); }
.verdict.scanning::before { background: var(--amber); box-shadow: 0 0 10px rgba(255, 180, 92, 0.5); }
.verdict.scanning .v-top b, .verdict.scanning .v-hero > span { color: var(--amber); }

.verdict.stale { opacity: 0.7; }
.verdict.stale .v-hero > span { color: var(--dim); }

/* peaks */

.peak-table { margin-top: 2px; }

.peak-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 62px 62px;
  align-items: center;
  gap: 8px;
  padding: 3px 0;
  border-bottom: 1px dashed rgba(121, 186, 190, 0.1);
  font-family: var(--mono);
  font-size: 9.5px;
  font-variant-numeric: tabular-nums;
}

.peak-row.head {
  padding: 0 0 4px;
  border-bottom: 1px solid var(--line);
  font-size: 7.5px;
  letter-spacing: 0.14em;
  color: var(--dim);
}

.peak-row:not(.head) span:first-child { color: var(--text-soft); }
.peak-row span:nth-child(2) { color: var(--muted); text-align: right; }
.peak-row span:nth-child(3) { text-align: right; }

.peak-row .m-pass { color: var(--green); }
.peak-row .m-fail { color: var(--red); }
.peak-row .m-warn { color: var(--amber); }

.peak-empty {
  padding: 7px 0 2px;
  font-size: 9px;
  line-height: 1.6;
  color: var(--dim);
}

.disclaimer {
  margin: 12px 0 2px;
  font-family: var(--mono);
  font-size: 7.5px;
  line-height: 1.7;
  letter-spacing: 0.03em;
  color: #385056;
  text-align: center;
}

/* ------------------------------ scope ------------------------------ */

.scope {
  grid-column: 1;
  grid-row: 2;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(9, 17, 22, 0.92), rgba(5, 10, 13, 0.96));
  animation: rise 0.6s 0.15s both;
  overflow: hidden;
}

.scope-head {
  flex: none;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 9px 15px;
  border-bottom: 1px solid var(--line);
}

.scope-title .eyebrow { margin-bottom: 3px; color: var(--dim); }

.scope-title h3 {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--text);
  display: flex;
  align-items: baseline;
  gap: 7px;
}

.scope-title h3 small {
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 400;
  letter-spacing: 0.1em;
  color: var(--teal);
  padding: 2px 5px;
  border: 1px solid rgba(88, 231, 216, 0.2);
  background: rgba(88, 231, 216, 0.05);
}

.scope-title h3 small.warn { color: var(--amber); border-color: rgba(255, 180, 92, 0.25); background: rgba(255, 180, 92, 0.05); }

.scope-readout {
  margin-left: auto;
  display: flex;
  align-items: baseline;
  gap: 7px;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}

.ro-f { font-size: 15px; letter-spacing: 0.03em; color: var(--text); }
.ro-level { font-size: 10px; color: var(--amber); min-width: 54px; }
.ro-det {
  font-size: 7.5px;
  letter-spacing: 0.12em;
  color: var(--dim);
  border: 1px solid var(--line);
  padding: 2px 4px;
}

.scope-legend {
  display: flex;
  gap: 13px;
  padding-left: 15px;
  border-left: 1px solid var(--line);
}

.scope-legend span {
  display: flex;
  align-items: center;
  gap: 5px;
  font-family: var(--mono);
  font-size: 7.5px;
  letter-spacing: 0.06em;
  color: var(--muted);
  white-space: nowrap;
}

.scope-legend i { display: block; width: 10px; height: 2px; }
.scope-legend b { font-weight: 400; }
.dot.teal { background: var(--teal); }
.dot.amber { background: var(--amber); }
.dot.line { background: repeating-linear-gradient(90deg, #8fa6ab 0 3px, transparent 3px 5px); }

.scope-body {
  position: relative;
  flex: 1;
  min-height: 0;
  padding: 4px 6px 6px;
}

#spectrum { display: block; }

/* ------------------------------ toast ------------------------------ */

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 90;
  transform: translate(-50%, 10px);
  padding: 8px 14px;
  border: 1px solid var(--line-2);
  background: rgba(9, 20, 25, 0.94);
  color: var(--text-soft);
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.08em;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s, transform 0.22s;
  box-shadow: 0 16px 40px -16px #000;
}

.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ------------------------------ modal ------------------------------ */

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(2, 6, 8, 0.72);
  backdrop-filter: blur(7px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s, visibility 0.25s;
}

.modal.open { opacity: 1; visibility: visible; }

.modal-card {
  position: relative;
  width: min(740px, 100%);
  max-height: 88vh;
  overflow-y: auto;
  padding: 26px 30px 22px;
  border: 1px solid var(--line-2);
  background:
    radial-gradient(600px 300px at 100% 0%, rgba(255, 180, 92, 0.05), transparent 60%),
    linear-gradient(180deg, #0a151b, #060d11);
  box-shadow: 0 40px 100px -30px #000, inset 0 1px 0 rgba(255, 255, 255, 0.04);
  transform: translateY(14px) scale(0.99);
  transition: transform 0.28s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.modal.open .modal-card { transform: none; }

.modal-x {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 28px;
  height: 28px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  transition: 0.18s;
}

.modal-x:hover { color: var(--red); border-color: rgba(255, 95, 109, 0.5); }

.modal-card h2 {
  margin: 6px 0 9px;
  font-family: var(--display);
  font-size: 25px;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: #edf8f8;
}

.modal-lead {
  font-size: 11.5px;
  line-height: 1.8;
  color: var(--text-soft);
  max-width: 60ch;
}

.modal-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 20px;
  margin: 20px 0 4px;
}

.modal-grid > div {
  padding-left: 11px;
  border-left: 1px solid rgba(88, 231, 216, 0.28);
}

.modal-grid h4 {
  margin-bottom: 5px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--teal);
}

.modal-grid p {
  font-size: 10px;
  line-height: 1.75;
  color: var(--muted);
}

.formula-box {
  margin: 18px 0;
  padding: 11px 13px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.32);
}

.formula-box > span {
  display: block;
  font-family: var(--mono);
  font-size: 7.5px;
  letter-spacing: 0.2em;
  color: var(--dim);
}

.formula-box code {
  display: block;
  margin: 8px 0 6px;
  font-family: var(--mono);
  font-size: 10px;
  line-height: 1.7;
  letter-spacing: 0.01em;
  color: var(--teal);
  word-break: break-word;
}

.formula-box code sub { font-size: 7px; }
.formula-box small { font-size: 8.5px; line-height: 1.6; color: var(--muted); }

.modal-table { margin: 16px 0; border: 1px solid var(--line); }

.mt-row {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr;
  padding: 6px 10px;
  border-bottom: 1px solid rgba(121, 186, 190, 0.08);
  font-family: var(--mono);
  font-size: 9.5px;
  color: var(--text-soft);
}

.mt-row:last-child { border-bottom: 0; }
.mt-row span:not(:first-child) { text-align: right; }

.mt-head {
  font-size: 7.5px;
  letter-spacing: 0.1em;
  color: var(--dim);
  background: rgba(88, 231, 216, 0.035);
}

.mt-row:not(.mt-head) span:first-child { color: var(--muted); }

.keys {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin: 16px 0 10px;
}

.keys span {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 8.5px;
  color: var(--muted);
}

kbd {
  font-family: var(--mono);
  font-size: 8px;
  padding: 1.5px 4px;
  border: 1px solid rgba(121, 186, 190, 0.25);
  background: rgba(255, 255, 255, 0.03);
  border-radius: 1px;
  color: var(--text-soft);
}

.fine {
  margin-top: 12px;
  padding-top: 11px;
  border-top: 1px solid var(--line);
  font-size: 8.5px;
  line-height: 1.7;
  color: #40575c;
}

/* ------------------------------ animations ------------------------------ */

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

@keyframes dotPulse {
  0% { box-shadow: 0 0 0 0 rgba(99, 230, 168, 0.45); }
  70% { box-shadow: 0 0 0 6px rgba(99, 230, 168, 0); }
  100% { box-shadow: 0 0 0 0 rgba(99, 230, 168, 0); }
}

@keyframes flashPulse {
  0%, 100% { opacity: 0.55; }
  50% { opacity: 1; }
}

@keyframes menuIn {
  from { opacity: 0; transform: translateY(-5px); }
  to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001s !important; transition-duration: 0.001s !important; }
}

/* ------------------------------ responsive ------------------------------ */

@media (max-width: 1240px) {
  .workspace { grid-template-columns: minmax(0, 1fr) 356px; }
  .topbar { gap: 18px; }
  .meta-chip { padding: 0 8px; }
}

@media (max-width: 1100px) {
  .hide-md { display: none; }
  .workspace { grid-template-columns: minmax(0, 1fr) 338px; }
  .stage-tl h2 { font-size: 19px; }
}

@media (max-width: 960px) {
  body { overflow: auto; }
  .app { height: auto; min-height: 100vh; }
  .workspace {
    height: auto;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto;
  }
  .stage { grid-column: 1; grid-row: 1; height: 56vh; min-height: 360px; }
  .scope { grid-column: 1; grid-row: 2; height: 280px; }
  .panel { grid-column: 1; grid-row: 3; }
  .panel-scroll { overflow: visible; }
  .panel-head { position: static; }
  .panel { display: block; }
  .top-meta .meta-chip:nth-child(2) { display: none; }
}

@media (max-width: 700px) {
  .topbar { height: 54px; padding: 0 12px; gap: 10px; }
  .lab-back { padding: 0 8px; }
  .lab-back .lb-text { display: none; }
  .lab-back .lb-arrow { font-size: 14px; }
  .brand-mark { width: 28px; height: 28px; }
  .brand-copy h1 { font-size: 15px; letter-spacing: 0.1em; }
  .brand-copy p { display: none; }
  .top-meta { display: none; }
  .clock span { font-size: 12px; }
  .help-btn { width: 26px; height: 26px; }
  .workspace { padding: 8px; gap: 8px; }
  .stage { height: 46vh; min-height: 300px; }
  .stage-tl { top: 12px; left: 12px; }
  .stage-tl h2 { font-size: 16px; }
  .stage-tl p { display: none; }
  .stage-tr { display: none; }
  .stage-bl { display: none; }
  .stage-br { right: 12px; bottom: 12px; gap: 8px; }
  .mini-metrics { gap: 10px; }
  .scope { height: 250px; }
  .scope-head { gap: 10px; padding: 8px 10px; }
  .scope-legend { display: none; }
  .scope-readout { gap: 5px; }
  .scope-title h3 { font-size: 11px; }
  .modal { padding: 12px; }
  .modal-card { padding: 20px 18px 16px; }
  .modal-card h2 { font-size: 20px; }
  .modal-grid { grid-template-columns: 1fr; gap: 12px; }
  .modal-lead { font-size: 10.5px; }
  .keys { gap: 6px 10px; }
}

@media (max-height: 760px) and (min-width: 961px) {
  .workspace { grid-template-rows: minmax(0, 1fr) 244px; }
  .stage-tl h2 { font-size: 19px; }
  .group { padding: 11px 0 12px; }
  .panel-scroll { padding-bottom: 10px; }
}
