:root {
  color-scheme: dark;

  --bg-0: #090b0e;
  --bg-1: rgba(17, 20, 24, 0.94);
  --bg-2: #1a1e24;
  --bg-3: #252a31;
  --bg-vibrancy: rgba(11, 13, 16, 0.86);
  --surface-rail: rgba(255, 255, 255, 0.025);
  --surface-inset: rgba(5, 7, 10, 0.34);

  --text-primary: #f5f7f9;
  --text-secondary: #a6adb6;
  --text-tertiary: #737d88;
  --text-mono: #91a2ad;

  --border: rgba(255, 255, 255, 0.075);
  --border-strong: rgba(255, 255, 255, 0.16);
  --border-accent: rgba(0, 212, 160, 0.42);

  --accent: #00d4a0;
  --accent-bright: #00ffbf;
  --accent-dim: rgba(0, 212, 160, 0.12);
  --accent-glow:
    0 0 10px rgba(0, 212, 160, 0.35),
    0 0 24px rgba(0, 212, 160, 0.15);

  --accent-blue: #0a84ff;
  --accent-blue-dim: rgba(10, 132, 255, 0.15);
  --accent-amber: #f2b84b;
  --accent-amber-dim: rgba(242, 184, 75, 0.12);
  --danger: #ff453a;

  /* Canvas/SVG plot palette — read by js/views/chart-utils.js at load.
     Change these to recolor every chart; the DOM picks up the same tokens. */
  --chart-active: #00D4A0;
  --chart-secondary: #00D4A0;
  --chart-grid: rgba(255, 255, 255, 0.055);
  --chart-axis: #91A2AD;
  --chart-muted: #737D88;
  --chart-bg: #0D1014;
  --chart-plot-border: rgba(255, 255, 255, 0.1);
  --chart-cursor: rgba(0, 212, 160, 0.6);
  --chart-active-glow: rgba(0, 212, 160, 0.4);

  --shadow-xs: 0 0 0 0.5px rgba(0, 0, 0, 0.55);
  --shadow-sm: 0 0 0 0.5px rgba(0, 0, 0, 0.55), 0 1px 8px rgba(0, 0, 0, 0.38);
  --shadow-md: 0 0 0 0.5px rgba(0, 0, 0, 0.6), 0 8px 24px rgba(0, 0, 0, 0.48);
  --shadow-lg:
    0 0 0 0.5px rgba(0, 0, 0, 0.55),
    0 8px 32px rgba(0, 0, 0, 0.55),
    0 24px 60px rgba(0, 0, 0, 0.3);

  --r-window: 10px;
  --r-card: 8px;
  --r-btn: 6px;
  --r-tag: 4px;
  --r-pill: 14px;

  --font:
    "IBM Plex Sans", "SF Pro Text", -apple-system, BlinkMacSystemFont,
    "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --font-display:
    "IBM Plex Sans", "SF Pro Display", -apple-system, BlinkMacSystemFont,
    "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --font-mono:
    "IBM Plex Mono", "SF Mono", "Menlo", "Monaco", "Cascadia Mono",
    "Roboto Mono", "Courier New", monospace;

  --s1: 4px;
  --s2: 8px;
  --s3: 12px;
  --s4: 16px;
  --s5: 20px;
  --s6: 24px;
  --s8: 32px;

  --ease: cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --t-fast: 120ms;
  --t-normal: 200ms;
}

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

html {
  min-width: 320px;
  min-height: 100vh;
  background-color: var(--bg-0);
}

body {
  min-height: 100vh;
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 13px;
  font-kerning: normal;
  font-synthesis-weight: none;
  line-height: 1.5;
  letter-spacing: 0;
  overflow-x: hidden;
  background-color: var(--bg-0);
  background-image:
    linear-gradient(180deg, rgba(0, 212, 160, 0.055), transparent 34%),
    linear-gradient(90deg, rgba(255, 255, 255, 0.028) 1px, transparent 1px),
    linear-gradient(rgba(255, 255, 255, 0.026) 1px, transparent 1px);
  background-size: auto, 40px 40px, 40px 40px;
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: rgba(0, 212, 160, 0.16);
}

a {
  color: var(--text-secondary);
  text-decoration: none;
  transition:
    color var(--t-fast) var(--ease),
    text-shadow var(--t-fast) var(--ease);
}

a:hover {
  color: var(--text-primary);
  text-shadow: 0 0 12px rgba(0, 212, 160, 0.2);
}

.skip-link {
  position: fixed;
  top: var(--s3);
  left: var(--s3);
  z-index: 300;
  padding: var(--s2) var(--s3);
  border: 0.5px solid var(--border-strong);
  border-radius: var(--r-btn);
  background: var(--bg-3);
  color: var(--text-primary);
  box-shadow: var(--shadow-md);
  transform: translateY(-160%);
  transition: transform var(--t-fast) var(--ease);
}

.skip-link:focus-visible {
  transform: translateY(0);
}

.visually-hidden {
  position: absolute;
  overflow: hidden;
  width: 1px;
  height: 1px;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.app-shell {
  width: min(1520px, 100%);
  margin: 0 auto;
  padding: 0 var(--s5) var(--s5);
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s5);
  min-height: 64px;
  margin: 0 calc(var(--s5) * -1);
  padding: 0 var(--s5);
  border-bottom: 0.5px solid var(--border-strong);
  background:
    linear-gradient(90deg, rgba(0, 212, 160, 0.09), transparent 38%),
    var(--bg-vibrancy);
  backdrop-filter: saturate(180%) blur(24px);
  -webkit-backdrop-filter: saturate(180%) blur(24px);
  box-shadow: var(--shadow-sm);
}

.brand-block {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.brand-kicker {
  color: var(--accent-amber);
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  line-height: 1;
  text-transform: uppercase;
}

.header-status {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2);
  justify-content: flex-end;
  min-width: 0;
  color: var(--text-tertiary);
  font-family: var(--font-mono);
  font-size: 10px;
  line-height: 1.2;
}

.header-status span {
  min-width: 0;
  padding: 5px 8px;
  border: 0.5px solid var(--border);
  border-radius: var(--r-tag);
  background: rgba(255, 255, 255, 0.035);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035);
}

.header-status strong {
  color: var(--text-primary);
  font-weight: 700;
}

.control-label,
.app-footer,
.phase-title-line,
.playback-time {
  font-family: var(--font-mono);
}

h1,
h2 {
  color: var(--text-primary);
  font-family: var(--font-display);
  letter-spacing: 0;
  text-wrap: balance;
}

h1 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1.15;
  white-space: nowrap;
}

h2 {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  line-height: 1.2;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.control-panel {
  position: sticky;
  top: 64px;
  z-index: 90;
  margin: 0 calc(var(--s5) * -1) var(--s4);
  border-bottom: 0.5px solid var(--border);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.038), transparent),
    rgba(15, 18, 22, 0.94);
  backdrop-filter: saturate(160%) blur(18px);
  -webkit-backdrop-filter: saturate(160%) blur(18px);
}

.control-label {
  color: var(--text-tertiary);
  font-family: var(--font);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0;
  line-height: 1.25;
  text-transform: none;
}

.control-panel-body {
  display: grid;
  grid-template-columns: minmax(340px, 1fr) minmax(170px, 0.34fr) minmax(150px, 0.28fr);
  gap: var(--s4);
  align-items: end;
  padding: var(--s3) var(--s5) var(--s4);
}

.control-group {
  display: grid;
  gap: var(--s1);
  min-width: 0;
}

.live-controls {
  display: none;
}

.segmented,
.live-row {
  display: flex;
  gap: 2px;
  align-items: center;
}

.segmented {
  width: fit-content;
  max-width: 100%;
  flex-wrap: wrap;
  padding: 2px;
  border-radius: var(--r-btn);
  background: var(--surface-inset);
  box-shadow:
    inset 0 0 0 0.5px rgba(255, 255, 255, 0.035),
    var(--shadow-xs);
}

button,
select,
input {
  min-height: 30px;
  border: 0.5px solid var(--border-strong);
  border-radius: var(--r-btn);
  background-color: #171c22;
  color: var(--text-primary);
  font: inherit;
  font-size: 12px;
  letter-spacing: 0;
  line-height: 1.2;
  touch-action: manipulation;
}

button {
  padding: 0 var(--s2);
  cursor: pointer;
  transition:
    background-color var(--t-fast) var(--ease),
    border-color var(--t-fast) var(--ease),
    color var(--t-fast) var(--ease),
    box-shadow var(--t-fast) var(--ease),
    transform var(--t-fast) var(--ease);
}

button:hover,
select:hover,
input:hover {
  border-color: var(--border-accent);
}

button:focus-visible,
select:focus-visible,
input:focus-visible {
  outline: 2px solid rgba(0, 212, 160, 0.45);
  outline-offset: 2px;
  border-color: var(--accent);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.segmented button {
  height: 26px;
  min-height: 26px;
  border-color: transparent;
  border-radius: var(--r-tag);
  background: transparent;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
}

.segmented button:hover {
  background-color: rgba(255, 255, 255, 0.07);
  color: var(--text-primary);
}

.segmented button.is-active {
  border-color: var(--border-accent);
  background:
    linear-gradient(180deg, rgba(0, 255, 191, 0.13), rgba(0, 212, 160, 0.08));
  color: var(--accent);
  box-shadow: var(--shadow-xs), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

select {
  width: 100%;
  padding: 0 22px 0 var(--s2);
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%2398989D'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  box-shadow: var(--shadow-xs);
}

input {
  width: min(280px, 100%);
  padding: 0 var(--s2);
  font-family: var(--font-mono);
  font-size: 12px;
  box-shadow: var(--shadow-xs);
}

input[type="url"]:focus-visible,
input[type="number"]:focus-visible {
  box-shadow: var(--shadow-xs), 0 0 0 2px var(--accent-dim);
}

.live-row {
  gap: var(--s2);
}

.live-row input {
  flex: 1 1 240px;
  width: auto;
}

.live-readouts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px var(--s3);
  align-items: center;
  min-height: 22px;
  color: var(--text-tertiary);
  font-family: var(--font-mono);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  line-height: 1.35;
}

.live-readouts span {
  min-width: 0;
}

.live-readouts strong {
  color: var(--text-secondary);
  font-weight: 600;
}

.live-status {
  max-width: 100%;
  color: var(--text-tertiary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.live-status.is-connecting {
  color: var(--accent-blue);
}

.live-status.is-live {
  color: var(--accent);
  animation: pulse 1.5s ease-in-out infinite;
}

.live-status.is-error {
  color: var(--danger);
}

.playback-label {
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  font-family: var(--font-mono);
}

.advanced-toggle-btn {
  width: 100%;
  min-height: 54px;
  padding: var(--s3) var(--s4);
  background:
    linear-gradient(90deg, rgba(0, 212, 160, 0.085), rgba(242, 184, 75, 0.035), transparent 72%),
    rgba(21, 25, 30, 0.92);
  border: 0.5px solid rgba(255, 255, 255, 0.13);
  border-radius: var(--r-card);
  color: var(--text-secondary);
  font-family: var(--font);
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s3);
  box-shadow: var(--shadow-sm), inset 0 1px 0 rgba(255, 255, 255, 0.035);
  transition:
    background var(--t-fast) var(--ease),
    border-color var(--t-fast) var(--ease),
    color var(--t-fast) var(--ease);
}

.advanced-toggle-btn:hover {
  border-color: rgba(0, 212, 160, 0.32);
  background:
    linear-gradient(90deg, rgba(0, 212, 160, 0.12), rgba(242, 184, 75, 0.05), transparent 72%),
    rgba(25, 30, 36, 0.96);
  color: var(--text-primary);
}

.advanced-toggle-btn strong {
  display: block;
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  line-height: 1.1;
  text-transform: uppercase;
}

.advanced-toggle-btn small {
  display: block;
  margin-top: 4px;
  color: var(--text-tertiary);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0;
  line-height: 1.25;
}

.toggle-chevron {
  font-size: 14px;
  color: var(--accent);
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.4;
  }
}

#live-connect {
  border-color: rgba(10, 132, 255, 0.35);
  background: var(--accent-blue-dim);
  color: var(--accent-blue);
}

#live-connect:hover {
  background: rgba(10, 132, 255, 0.22);
}

#live-disconnect {
  background: transparent;
  color: var(--text-secondary);
}

.app-body {
  display: block;
}

.workbench {
  position: relative;
  display: grid;
  gap: var(--s3);
  overflow: hidden;
  border: 0.5px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--r-window);
  background:
    linear-gradient(135deg, rgba(0, 212, 160, 0.12), transparent 32%),
    linear-gradient(225deg, rgba(10, 132, 255, 0.08), transparent 34%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.012)),
    rgba(12, 15, 19, 0.96);
  padding: var(--s4);
  box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(255, 255, 255, 0.055);
}

.workbench::before {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.42), transparent 76%);
  content: "";
}

.workbench > * {
  position: relative;
}

.workbench-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--s5);
  align-items: end;
}

.workbench-title-block {
  display: grid;
  gap: var(--s2);
  min-width: 0;
}

.workbench-kicker,
.pipeline-step span,
.drop-rail,
.console-head span,
.toolbox-head span,
.metric-tile span {
  color: var(--accent-amber);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  line-height: 1.2;
  text-transform: uppercase;
}

.workbench-title-block h2 {
  max-width: 820px;
  color: var(--text-primary);
  font-size: clamp(28px, 3vw, 44px);
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1.02;
  overflow-wrap: anywhere;
  text-transform: none;
}

.workbench-title-block p {
  max-width: 780px;
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.workbench-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2);
  justify-content: flex-end;
}

.workbench-actions button,
.console-link {
  min-height: 34px;
  padding: 0 var(--s3);
  font-weight: 600;
}

.primary-action {
  border-color: rgba(0, 212, 160, 0.46);
  background:
    linear-gradient(180deg, rgba(0, 255, 191, 0.22), rgba(0, 212, 160, 0.11)),
    #13241f;
  color: var(--accent-bright);
  box-shadow: var(--shadow-xs), 0 0 22px rgba(0, 212, 160, 0.12);
}

.primary-action:hover {
  border-color: rgba(0, 255, 191, 0.72);
  background:
    linear-gradient(180deg, rgba(0, 255, 191, 0.28), rgba(0, 212, 160, 0.15)),
    #142b24;
}

.pipeline-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  overflow: hidden;
  border: 0.5px solid var(--border);
  border-radius: var(--r-card);
  background: rgba(5, 7, 10, 0.38);
}

.pipeline-step {
  position: relative;
  display: grid;
  gap: 3px;
  min-height: 64px;
  padding: var(--s3);
  border-right: 0.5px solid var(--border);
}

.pipeline-step:last-child {
  border-right: 0;
}

.pipeline-step.is-ready {
  background:
    linear-gradient(180deg, rgba(0, 212, 160, 0.08), transparent),
    rgba(255, 255, 255, 0.018);
}

.pipeline-step strong {
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 700;
}

.pipeline-step small {
  color: var(--text-tertiary);
  font-family: var(--font-mono);
  font-size: 10px;
  line-height: 1.35;
}

.workbench-grid {
  display: grid;
  grid-template-columns: minmax(280px, 1.05fr) minmax(260px, 1fr) minmax(220px, 0.82fr) minmax(230px, 0.82fr);
  gap: var(--s3);
  align-items: stretch;
}

.workbench-drop-zone,
.cohort-console,
.toolbox-console,
.workbench-metrics {
  min-width: 0;
  border: 0.5px solid var(--border);
  border-radius: var(--r-card);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.016)),
    rgba(9, 12, 15, 0.74);
  box-shadow: var(--shadow-sm), inset 0 1px 0 rgba(255, 255, 255, 0.035);
}

.workbench-drop-zone {
  display: grid;
  align-content: center;
  justify-items: start;
  gap: var(--s2);
  min-height: 188px;
  padding: var(--s4);
  border-style: dashed;
  border-color: rgba(0, 212, 160, 0.32);
  color: var(--text-secondary);
  text-align: left;
}

.workbench-drop-zone:hover,
.workbench-drop-zone.drag-over {
  border-color: var(--accent);
  background:
    linear-gradient(180deg, rgba(0, 212, 160, 0.13), rgba(0, 212, 160, 0.045)),
    rgba(9, 12, 15, 0.88);
  color: var(--text-primary);
  box-shadow: var(--shadow-md), var(--accent-glow);
}

.workbench-drop-zone.has-import-log {
  align-content: start;
}

.workbench-drop-zone strong {
  max-width: 520px;
  color: var(--text-primary);
  font-size: 19px;
  font-weight: 700;
  line-height: 1.12;
}

.workbench-drop-zone small {
  max-width: 420px;
  color: var(--text-tertiary);
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.45;
}

.drop-formats {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s1);
  margin-top: var(--s1);
}

.drop-formats span {
  min-height: 22px;
  padding: 3px 7px;
  border: 0.5px solid rgba(0, 212, 160, 0.22);
  border-radius: var(--r-tag);
  background: rgba(0, 212, 160, 0.055);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 10px;
  line-height: 1.4;
}

.import-log {
  display: grid;
  width: 100%;
  gap: 6px;
  margin-top: var(--s1);
  text-align: left;
}

.import-headline {
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.35;
}

.import-row {
  display: grid;
  grid-template-columns: 68px minmax(0, 1fr);
  gap: var(--s1);
  width: 100%;
  padding: 5px 7px;
  border: 0.5px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--r-tag);
  background: rgba(255, 255, 255, 0.035);
  color: var(--text-tertiary);
  font-family: var(--font-mono);
  font-size: 10px;
  line-height: 1.3;
}

.import-row strong {
  color: var(--accent);
  font-size: 10px;
  text-transform: uppercase;
}

.import-row span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.import-row.is-skipped strong {
  color: var(--accent-amber);
}

.import-row.is-rejected strong {
  color: #ff786d;
}

.cohort-console,
.toolbox-console {
  display: grid;
  align-content: start;
  gap: var(--s3);
  padding: var(--s4);
}

.console-head,
.toolbox-head {
  display: grid;
  gap: var(--s2);
}

.console-head select {
  min-height: 34px;
}

.scenario-detail {
  min-height: 42px;
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.45;
}

.baseline-summary {
  display: grid;
  gap: var(--s2);
  min-width: 0;
  padding: var(--s3);
  border: 0.5px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--r-btn);
  background: rgba(255, 255, 255, 0.028);
}

.baseline-label {
  color: var(--accent-amber);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  line-height: 1.2;
  text-transform: uppercase;
}

.baseline-summary strong {
  min-width: 0;
  overflow: hidden;
  color: var(--text-primary);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.baseline-facts {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s1);
}

.baseline-facts span {
  padding: 2px 6px;
  border: 0.5px solid var(--border);
  border-radius: var(--r-tag);
  color: var(--text-tertiary);
  font-family: var(--font-mono);
  font-size: 10px;
  line-height: 1.45;
}

.workbench-baseline-control {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.workbench-baseline-control span {
  color: var(--accent-amber);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  line-height: 1.2;
  text-transform: uppercase;
}

.workbench-baseline-control select {
  min-height: 34px;
}

.toolbox-head strong {
  color: var(--text-primary);
  font-size: 17px;
  font-weight: 700;
  line-height: 1.15;
}

.workbench-status {
  min-height: 46px;
  padding: var(--s3);
  border: 0.5px solid rgba(0, 212, 160, 0.2);
  border-radius: var(--r-btn);
  background: rgba(0, 212, 160, 0.07);
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.35;
}

.workbench-status.is-ready {
  border-color: rgba(0, 212, 160, 0.38);
  background: rgba(0, 212, 160, 0.105);
  color: var(--text-primary);
}

.workbench-status.is-draft {
  border-color: rgba(242, 184, 75, 0.24);
  background: rgba(242, 184, 75, 0.07);
}

.comparison-readout {
  display: grid;
  gap: var(--s2);
}

.comparison-row {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(96px, auto) minmax(92px, auto);
  gap: var(--s2);
  align-items: start;
  min-height: 52px;
  padding: var(--s3);
  border: 0.5px solid var(--border);
  border-radius: var(--r-btn);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-tertiary);
  font-family: var(--font-mono);
  font-size: 10px;
}

.comparison-row strong {
  grid-column: 1 / -1;
  color: var(--accent);
  font-family: var(--font);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.35;
}

.comparison-name {
  overflow: hidden;
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 12px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.empty-comparison {
  padding: var(--s2) 0;
  color: var(--text-tertiary);
  font-family: var(--font-mono);
  font-size: 10px;
  line-height: 1.4;
}

.comparison-disclaimer {
  margin: var(--s2) 0 0;
  color: var(--text-tertiary);
  font-size: 11px;
  line-height: 1.4;
}

.console-link {
  width: fit-content;
  border-color: rgba(10, 132, 255, 0.32);
  background: rgba(10, 132, 255, 0.1);
  color: #64d2ff;
}

.console-link:hover {
  border-color: rgba(100, 210, 255, 0.56);
  background: rgba(10, 132, 255, 0.18);
}

.readiness-panel {
  display: grid;
  gap: 3px;
  min-height: 48px;
  padding: var(--s3);
  border: 0.5px solid rgba(242, 184, 75, 0.18);
  border-radius: var(--r-btn);
  background: rgba(242, 184, 75, 0.06);
}

.readiness-panel.is-ready {
  border-color: rgba(0, 212, 160, 0.34);
  background: rgba(0, 212, 160, 0.08);
}

.readiness-panel span {
  color: var(--text-tertiary);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  line-height: 1.2;
  text-transform: uppercase;
}

.readiness-panel strong {
  color: var(--text-primary);
  font-size: 13px;
  line-height: 1.3;
}

.toolbox-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--s2);
}

.toolbox-list span {
  min-height: 34px;
  padding: var(--s2);
  border: 0.5px solid var(--border);
  border-radius: var(--r-btn);
  background: rgba(255, 255, 255, 0.032);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.25;
}

.quality-list {
  display: grid;
  gap: var(--s1);
}

.quality-item {
  display: grid;
  grid-template-columns: minmax(96px, 0.45fr) minmax(0, 1fr);
  gap: var(--s2);
  align-items: center;
  min-height: 28px;
  padding: var(--s1) var(--s2);
  border-left: 2px solid var(--border-strong);
  background: rgba(255, 255, 255, 0.02);
}

.quality-item.is-ready {
  border-left-color: var(--accent);
}

.quality-item.is-warn {
  border-left-color: var(--accent-amber);
}

.quality-item.is-waiting {
  border-left-color: var(--text-tertiary);
}

.quality-item span {
  color: var(--text-tertiary);
  font-family: var(--font-mono);
  font-size: 10px;
}

.quality-item strong {
  min-width: 0;
  overflow-wrap: anywhere;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.25;
}

.workbench-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
  overflow: hidden;
}

.metric-tile {
  display: grid;
  align-content: center;
  gap: 3px;
  min-height: 92px;
  padding: var(--s3);
  border-right: 0.5px solid var(--border);
  border-bottom: 0.5px solid var(--border);
}

.metric-tile:nth-child(2n) {
  border-right: 0;
}

.metric-tile:nth-last-child(-n + 2) {
  border-bottom: 0;
}

.metric-tile strong {
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 28px;
  font-weight: 700;
  line-height: 1;
}

.metric-tile small {
  color: var(--text-tertiary);
  font-size: 11px;
  line-height: 1.25;
}

.session-sidebar {
  display: grid;
  align-content: start;
  gap: var(--s3);
  border: 0.5px solid rgba(242, 184, 75, 0.14);
  border-radius: var(--r-card);
  background:
    linear-gradient(180deg, rgba(242, 184, 75, 0.055), transparent 42%),
    var(--bg-1);
  padding: var(--s4);
  box-shadow: var(--shadow-sm), inset 0 1px 0 rgba(255, 255, 255, 0.035);
}

.session-sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s2);
}

.session-sidebar-head span,
.session-message,
.session-control-label {
  color: var(--text-tertiary);
  font-family: var(--font-mono);
  font-size: 10px;
  line-height: 1.35;
}

.drop-zone {
  display: grid;
  place-items: center;
  gap: 2px;
  width: 100%;
  min-height: 96px;
  padding: var(--s4);
  border: 1px dashed var(--border-strong);
  border-radius: var(--r-card);
  background: var(--surface-inset);
  color: var(--text-secondary);
  text-align: center;
}

.drop-zone strong {
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 600;
}

.drop-zone span {
  color: var(--text-tertiary);
  font-family: var(--font-mono);
  font-size: 10px;
}

.drop-zone.drag-over {
  border-color: var(--accent);
  background: var(--accent-dim);
  color: var(--accent);
  box-shadow: var(--accent-glow);
}

.session-message {
  min-height: 16px;
}

.session-message.is-error {
  color: var(--danger);
}

.session-list {
  display: grid;
  gap: var(--s1);
}

.session-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 24px;
  gap: var(--s1);
  align-items: center;
  min-height: 30px;
  border-bottom: 0.5px solid var(--border);
}

.session-toggle {
  display: flex;
  min-width: 0;
  height: 28px;
  min-height: 28px;
  align-items: center;
  gap: var(--s2);
  border: 0;
  background: transparent;
  color: var(--text-secondary);
  padding: 0;
  text-align: left;
}

.session-toggle:hover {
  background: transparent;
  color: var(--text-primary);
}

.session-dot,
.legend-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--session-color, var(--accent));
}

.session-item.is-inactive .session-dot {
  border: 1px solid var(--session-color, var(--accent));
  background: transparent;
}

.session-name {
  min-width: 0;
  overflow: hidden;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.session-remove {
  width: 24px;
  min-width: 24px;
  height: 24px;
  min-height: 24px;
  border: 0;
  background: transparent;
  color: var(--text-tertiary);
  font-size: 16px;
  line-height: 1;
}

.session-remove:hover {
  background: rgba(255, 69, 58, 0.12);
  color: var(--danger);
}

.session-controls {
  display: grid;
  gap: var(--s3);
  padding-top: var(--s2);
  border-top: 0.5px solid var(--border);
}

.session-control-block {
  display: grid;
  gap: var(--s1);
  min-width: 0;
}

.session-mode {
  width: 100%;
}

.session-mode button {
  flex: 1 1 auto;
  min-width: 54px;
  font-size: 11px;
}

.session-legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s1) var(--s3);
  align-items: center;
  padding: var(--s1) var(--s4);
  border-bottom: 0.5px solid var(--border);
  background: rgba(17, 17, 19, 0.28);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 10px;
  line-height: 1.4;
}

.session-legend[hidden] {
  display: none;
}

.legend-item {
  display: inline-flex;
  min-width: 0;
  max-width: 180px;
  align-items: center;
}

.legend-dot {
  display: inline-block;
  margin-right: 4px;
  vertical-align: middle;
}

.legend-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard {
  display: flex;
  flex-direction: column;
  gap: var(--s5);
  scroll-margin-top: 100px;
}

#home-views {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s4);
  align-items: start;
}

#advanced-views {
  grid-template-columns: 1fr;
  gap: var(--s4);
}

.panel {
  position: relative;
  min-width: 0;
  overflow: hidden;
  border: 0.5px solid var(--border);
  border-radius: var(--r-card);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.015)),
    var(--bg-1);
  box-shadow: var(--shadow-sm), inset 0 1px 0 rgba(255, 255, 255, 0.035);
}

.panel::before {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 1px;
  background: linear-gradient(90deg, rgba(0, 212, 160, 0.45), transparent 48%, rgba(242, 184, 75, 0.2));
  content: "";
  opacity: 0.45;
  pointer-events: none;
}

.panel-psd {
  border-color: rgba(0, 212, 160, 0.22);
  box-shadow:
    0 0 0 0.5px rgba(0, 212, 160, 0.08),
    0 20px 50px rgba(0, 0, 0, 0.46),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.panel-psd::before {
  opacity: 0.9;
}

.panel-psd,
.panel-centroid,
.panel-playback,
.panel-monitor {
  grid-column: 1 / -1;
}

/* Any expanded collapsible panel stretches full width … */
.panel-collapsible.is-expanded {
  grid-column: 1 / -1;
}

/* … except Geometry Stack + Channel Grid, which stay paired in their columns */
.panel-geometry.is-expanded,
.panel-grid.is-expanded {
  grid-column: auto;
}

.panel-phase {
  grid-column: 1 / -1;
}

.panel-network,
.panel-tda {
  grid-column: 1 / -1;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s2);
  padding: var(--s3) var(--s4);
  border-bottom: 0.5px solid var(--border);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.012)),
    rgba(14, 17, 21, 0.78);
}

.panel-head > div {
  min-width: 0;
}

.panel-head h2,
.panel-head p {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.panel-head h2 {
  color: var(--text-primary);
}

.panel-head p {
  margin-top: 2px;
  color: var(--text-tertiary);
  font-family: var(--font-mono);
  font-size: 10px;
  line-height: 1.35;
}

.psd-layout {
  display: grid;
  grid-template-columns: minmax(500px, 1fr) minmax(250px, 0.36fr);
  gap: 0.5px;
  background: rgba(255, 255, 255, 0.08);
}

.chart {
  display: block;
  width: 100%;
  max-width: 100%;
  background-color: rgba(13, 16, 20, 0.94);
  background-image:
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 20px 20px;
  touch-action: manipulation;
}

.chart-heatmap,
.chart-overlay {
  height: 500px;
}

.chart-wide {
  height: 220px;
}

.chart-stack {
  height: 380px;
}

.chart-phase {
  width: 100%;
  max-width: 760px;
  height: 460px;
  margin: 0 auto;
}

.chart-polar,
.chart-kuramoto {
  width: 100%;
  max-width: 480px;
  height: 430px;
  margin: 0 auto;
}

.chart-tda-scatter,
.chart-tda-barcode {
  height: 320px;
}

.panel-playback {
  position: sticky;
  top: 132px;
  z-index: 80;
  border-color: rgba(242, 184, 75, 0.22);
  box-shadow:
    0 0 0 0.5px rgba(242, 184, 75, 0.08),
    var(--shadow-md);
  backdrop-filter: saturate(160%) blur(18px);
  -webkit-backdrop-filter: saturate(160%) blur(18px);
}

.panel-playback::before {
  background: linear-gradient(90deg, var(--accent-amber), rgba(0, 212, 160, 0.4), transparent 62%);
  opacity: 0.85;
}

.playback-bar {
  padding: var(--s3) var(--s4);
  border: 0.5px solid var(--border);
  border-width: 0.5px 0 0;
  background:
    linear-gradient(90deg, rgba(242, 184, 75, 0.08), rgba(0, 212, 160, 0.05), transparent 64%),
    rgba(22, 25, 30, 0.94);
}

.playback-shell {
  display: flex;
  align-items: center;
  gap: var(--s3);
}

.playback-actions {
  display: flex;
  flex-shrink: 0;
  gap: var(--s3);
  align-items: center;
}

.playback-toggle {
  display: flex;
  width: 64px;
  height: 40px;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  border-color: rgba(242, 184, 75, 0.42);
  border-radius: var(--r-pill);
  background: var(--accent-amber-dim);
  color: var(--accent-amber);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  box-shadow: var(--shadow-xs);
}

.playback-toggle:hover,
.playback-toggle[aria-label="Pause playback"] {
  background: rgba(242, 184, 75, 0.2);
  box-shadow:
    0 0 10px rgba(242, 184, 75, 0.3),
    0 0 24px rgba(0, 212, 160, 0.12);
}

.playback-toggle[aria-label="Pause playback"] {
  background: var(--accent-amber);
  color: var(--bg-0);
}

.playback-speeds {
  display: flex;
  flex-wrap: nowrap;
  gap: 2px;
  padding: 2px;
  border-radius: var(--r-btn);
  background: var(--bg-3);
  box-shadow: var(--shadow-xs);
}

.playback-speeds button {
  width: 28px;
  min-width: 28px;
  height: 22px;
  min-height: 22px;
  border-color: transparent;
  border-radius: var(--r-tag);
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
}

.playback-speeds button.is-active {
  background: var(--accent-dim);
  color: var(--accent);
}

.playback-range {
  flex: 1;
  width: 100%;
  min-height: 20px;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  cursor: pointer;
  accent-color: var(--accent);
  -webkit-appearance: none;
  appearance: none;
}

.playback-range::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 999px;
  background:
    linear-gradient(
      to right,
      var(--accent-amber) 0%,
      var(--accent) var(--progress, 0%),
      var(--bg-3) var(--progress, 0%),
      var(--bg-3) 100%
    );
}

.playback-range::-webkit-slider-thumb {
  width: 14px;
  height: 14px;
  margin-top: -5.5px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: var(--accent-glow);
  cursor: pointer;
  transition: transform var(--t-fast) var(--ease);
  -webkit-appearance: none;
  appearance: none;
}

.playback-range::-webkit-slider-thumb:hover {
  transform: scale(1.18);
}

.playback-range::-moz-range-track {
  height: 3px;
  border-radius: 2px;
  background: var(--bg-3);
}

.playback-range::-moz-range-progress {
  height: 3px;
  border-radius: 2px;
  background: var(--accent);
}

.playback-range::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: var(--accent-glow);
  cursor: pointer;
}

.playback-time {
  min-width: 72px;
  color: var(--text-secondary);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

.monitor-panel {
  transition:
    height var(--t-normal) var(--ease),
    border-color var(--t-normal) var(--ease),
    box-shadow var(--t-normal) var(--ease);
}

.monitor-panel.static-mode {
  display: flex;
  height: 40px;
  align-items: center;
  justify-content: center;
}

.monitor-panel.live-mode {
  height: auto;
  border-color: var(--border-accent);
}

.monitor-static {
  color: var(--text-tertiary);
  font-family: var(--font-mono);
  font-size: 10px;
}

.monitor-live {
  display: none;
}

.monitor-panel.live-mode .monitor-live {
  display: grid;
  gap: var(--s3);
  padding: var(--s3) var(--s4);
  background: linear-gradient(180deg, rgba(0, 212, 160, 0.06), transparent 48%);
}

.monitor-panel.live-mode .monitor-static {
  display: none;
}

.monitor-head,
.monitor-actions,
.monitor-status-row {
  display: flex;
  align-items: center;
}

.monitor-head {
  justify-content: space-between;
  gap: var(--s3);
}

.monitor-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: var(--s2);
}

.monitor-actions button,
.monitor-toggle {
  height: 26px;
  min-height: 26px;
  border: 0.5px solid var(--border-strong);
  border-radius: var(--r-btn);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
  font-size: 11px;
}

.monitor-actions button {
  padding: 0 var(--s2);
}

.monitor-toggle {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  padding: 0 var(--s2);
  cursor: pointer;
  user-select: none;
}

.monitor-toggle input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.monitor-led {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-tertiary);
  box-shadow: none;
}

.monitor-toggle:has(input:checked) {
  border-color: var(--border-accent);
  background: var(--accent-dim);
  color: var(--accent);
}

.monitor-toggle:has(input:checked) .monitor-led {
  background: var(--accent);
  box-shadow: var(--accent-glow);
}

.monitor-toggle:focus-within {
  outline: 2px solid rgba(0, 212, 160, 0.45);
  outline-offset: 2px;
  border-color: var(--accent);
}

.monitor-builder {
  display: grid;
  grid-template-columns: minmax(96px, 0.55fr) minmax(180px, 1fr) 72px minmax(96px, 0.55fr) minmax(96px, 0.55fr);
  gap: var(--s3);
  align-items: end;
}

.monitor-field {
  display: grid;
  gap: var(--s1);
  min-width: 0;
}

.monitor-field > span,
.monitor-kicker {
  color: var(--text-tertiary);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.05em;
  line-height: 1.1;
  text-transform: uppercase;
}

.monitor-field select,
.monitor-field input {
  width: 100%;
  height: 26px;
  min-height: 26px;
  border-color: var(--border);
  font-size: 11px;
}

.monitor-input-suffix {
  position: relative;
}

.monitor-input-suffix input {
  padding-right: 24px;
}

.monitor-input-suffix span {
  position: absolute;
  top: 50%;
  right: var(--s2);
  color: var(--text-tertiary);
  font-family: var(--font-mono);
  font-size: 10px;
  transform: translateY(-50%);
  pointer-events: none;
}

.monitor-status {
  display: grid;
  gap: var(--s2);
  padding: var(--s3);
  border: 0.5px solid var(--border);
  border-radius: var(--r-btn);
  background: var(--surface-inset);
}

.monitor-status-row {
  gap: var(--s3);
  min-width: 0;
}

.monitor-status-current {
  align-items: baseline;
}

.monitor-state {
  min-width: 92px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0;
}

.monitor-state.is-idle {
  color: var(--text-secondary);
}

.monitor-state.is-building {
  color: var(--accent);
}

.monitor-state.is-triggered {
  color: var(--accent-bright);
  text-shadow: var(--accent-glow);
}

.progress-track {
  overflow: hidden;
  flex: 1 1 160px;
  height: 4px;
  border-radius: 2px;
  background: var(--bg-3);
}

.progress-fill {
  width: 0%;
  height: 100%;
  border-radius: 2px;
  background: var(--accent);
  box-shadow: var(--accent-glow);
  transition: width 200ms linear;
}

.monitor-progress-text,
.monitor-current {
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}

.monitor-current {
  min-width: 0;
  overflow-wrap: anywhere;
}

.monitor-log {
  position: relative;
  max-height: 200px;
  overflow: auto;
  border: 0.5px solid var(--border);
  border-radius: var(--r-btn);
  background: var(--bg-1);
}

.monitor-log-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-mono);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}

.monitor-log-table th,
.monitor-log-table td {
  padding: 7px var(--s2);
  border-bottom: 0.5px solid var(--border);
  text-align: left;
  white-space: nowrap;
}

.monitor-log-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--bg-2);
  color: var(--text-tertiary);
  font-weight: 600;
  text-transform: uppercase;
}

.monitor-log-table td {
  color: var(--text-secondary);
}

.monitor-log-table tr.is-new td {
  background: var(--accent-dim);
  color: var(--text-primary);
  transition: background-color var(--t-normal) var(--ease);
}

.monitor-log-empty {
  padding: var(--s3);
  color: var(--text-tertiary);
  font-family: var(--font-mono);
  font-size: 10px;
  text-align: center;
}

.phase-space {
  display: grid;
  background: rgba(13, 16, 20, 0.94);
}

.phase-controls {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) repeat(3, minmax(130px, 0.72fr)) 76px;
  gap: var(--s3);
  align-items: end;
  padding: var(--s2) var(--s4);
  border-bottom: 0.5px solid var(--border);
  background:
    linear-gradient(90deg, rgba(0, 212, 160, 0.055), transparent 60%),
    rgba(13, 16, 20, 0.94);
}

.phase-control {
  display: grid;
  gap: var(--s1);
  min-width: 0;
}

.phase-control span {
  color: var(--text-tertiary);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.05em;
  line-height: 1.1;
  text-transform: uppercase;
}

.phase-mode {
  flex-wrap: nowrap;
}

.phase-mode button {
  min-width: 112px;
  font-size: 11px;
  white-space: nowrap;
}

.phase-tau {
  width: 48px;
  text-align: center;
}

.phase-title-line {
  min-height: 32px;
  padding: var(--s2) var(--s4);
  border-bottom: 0.5px solid var(--border);
  background: var(--surface-inset);
  color: var(--text-mono);
  font-size: 10px;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.channel-grid {
  min-height: 260px;
  padding: var(--s3);
  background-color: rgba(13, 16, 20, 0.94);
  background-image:
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 20px 20px;
}

.grid-mode-bar,
.network-controls {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2) var(--s3);
  align-items: center;
  padding: var(--s2) var(--s3);
  border-bottom: 0.5px solid var(--border);
  background: var(--surface-inset);
}

.grid-mode-bar > span,
.network-control > span {
  color: var(--text-tertiary);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.05em;
  line-height: 1.1;
  text-transform: uppercase;
}

.channel-grid-map {
  min-height: 320px;
}

.grid-selection {
  padding: var(--s2) var(--s3);
  border-top: 0.5px solid var(--border);
  background: var(--surface-inset);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.35;
}

.channel-grid svg {
  display: block;
  width: 100%;
  height: auto;
  min-height: 260px;
  max-height: 420px;
}

.polar-chronomap,
.kuramoto-view,
.channel-network,
.tda-view {
  display: grid;
  background-color: rgba(13, 16, 20, 0.94);
  background-image:
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 20px 20px;
}

.polar-chronomap,
.kuramoto-view {
  min-height: 430px;
}

.network-controls {
  align-items: end;
}

.network-control {
  display: grid;
  gap: var(--s1);
  min-width: 150px;
}

.network-threshold {
  min-width: min(280px, 100%);
}

.network-threshold input {
  width: 100%;
  min-height: 26px;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  accent-color: var(--accent);
}

.network-toggle {
  display: inline-flex;
  height: 30px;
  align-items: center;
  gap: var(--s2);
  padding: 0 var(--s2);
  border: 0.5px solid var(--border-strong);
  border-radius: var(--r-btn);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
  font-size: 12px;
}

.network-toggle input {
  width: 14px;
  min-height: 14px;
  box-shadow: none;
  accent-color: var(--accent);
}

.network-graph svg {
  display: block;
  width: 100%;
  max-width: 720px;
  height: auto;
  aspect-ratio: 720 / 520;
  margin: 0 auto;
  min-height: 0;
}

.network-node {
  cursor: pointer;
}

.network-node text,
.network-legend text {
  fill: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 10px;
  text-anchor: middle;
}

.network-legend text {
  text-anchor: start;
  fill: var(--text-tertiary);
}

.network-node:focus-visible circle,
.network-node:hover circle {
  stroke: var(--accent);
  stroke-width: 2.5;
  filter: drop-shadow(0 0 8px rgba(0, 212, 160, 0.6));
}

.tda-view {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5px;
  background: var(--border);
}

.tda-panel {
  display: grid;
  min-width: 0;
  background: var(--bg-1);
}

.tda-subtitle {
  min-height: 30px;
  padding: var(--s2) var(--s3);
  border-bottom: 0.5px solid var(--border);
  color: var(--text-mono);
  font-family: var(--font-mono);
  font-size: 10px;
  line-height: 1.35;
}

.electrode {
  cursor: pointer;
}

.electrode.is-muted {
  opacity: 0.34;
}

.electrode text {
  pointer-events: none;
  fill: rgba(255, 255, 255, 0.75);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  text-anchor: middle;
  dominant-baseline: middle;
}

.electrode circle {
  transition:
    stroke-width var(--t-fast) var(--ease),
    filter var(--t-fast) var(--ease),
    transform var(--t-fast) var(--ease);
}

.electrode:focus-visible circle,
.electrode:hover circle {
  stroke: var(--accent);
  stroke-width: 2.5;
  filter: drop-shadow(0 0 8px rgba(0, 212, 160, 0.62));
}

/* ── Panel collapse system ────────────────────────────────────── */

.panel-collapsible .panel-head {
  cursor: pointer;
  user-select: none;
}

.panel-collapsible .panel-head:hover,
.panel-collapsible .panel-head:focus-visible {
  background: var(--bg-2);
}

.panel-collapsible .panel-head:focus-visible {
  outline: 2px solid rgba(0, 212, 160, 0.45);
  outline-offset: -2px;
}

.panel-body {
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.28s ease-out;
}

.panel-collapsible.is-expanded .panel-body {
  max-height: 3000px;
  transition: max-height 0.38s ease-in;
}

.panel-collapse-toggle {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 22px;
  min-width: 22px;
  height: 22px;
  min-height: 22px;
  padding: 0;
  border: 0.5px solid var(--border-strong);
  border-radius: var(--r-tag);
  background: var(--bg-2);
  color: var(--text-tertiary);
  cursor: pointer;
  font-size: 17px;
  font-weight: 400;
  line-height: 1;
  transition:
    background var(--t-fast) var(--ease),
    color var(--t-fast) var(--ease),
    border-color var(--t-fast) var(--ease);
}

.panel-toggle-icon {
  pointer-events: none;
}

.panel-collapsible .panel-head:hover .panel-collapse-toggle,
.panel-collapsible .panel-head:focus-visible .panel-collapse-toggle {
  background: var(--bg-3);
  color: var(--text-primary);
}

.panel-collapsible.is-expanded .panel-collapse-toggle {
  border-color: var(--border-accent);
  background: var(--accent-dim);
  color: var(--accent);
}

.app-footer {
  padding: var(--s4) 0 0;
  border-top: 0.5px solid var(--border);
  margin-top: var(--s5);
  color: var(--text-tertiary);
  font-family: var(--font-mono);
  font-size: 10px;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.report-dialog {
  width: min(920px, calc(100vw - 32px));
  max-height: min(780px, calc(100vh - 32px));
  padding: 0;
  border: 0.5px solid var(--border-strong);
  border-radius: var(--r-window);
  background: rgba(12, 15, 19, 0.98);
  color: var(--text-primary);
  box-shadow: var(--shadow-lg);
}

.report-dialog::backdrop {
  background: rgba(0, 0, 0, 0.68);
  backdrop-filter: blur(8px);
}

.report-dialog-shell {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  max-height: min(780px, calc(100vh - 32px));
}

.report-dialog-head,
.report-dialog-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s3);
  padding: var(--s4);
  border-bottom: 0.5px solid var(--border);
}

.report-dialog-actions {
  justify-content: flex-end;
  border-top: 0.5px solid var(--border);
  border-bottom: 0;
}

.report-dialog-head span,
.report-preview-section span,
.report-preview-status span {
  color: var(--accent-amber);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  line-height: 1.2;
  text-transform: uppercase;
}

.report-dialog-head h2 {
  margin-top: 5px;
  color: var(--text-primary);
  font-size: 22px;
  line-height: 1.15;
}

.report-close {
  width: 34px;
  min-width: 34px;
  min-height: 34px;
  padding: 0;
  font-size: 20px;
  line-height: 1;
}

.report-preview {
  display: grid;
  gap: var(--s3);
  overflow: auto;
  padding: var(--s4);
}

.explain-output {
  margin: 0 var(--s4);
  padding: var(--s3);
  border: 1px solid var(--border, rgba(255, 255, 255, 0.12));
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.5;
  white-space: pre-wrap;
  max-height: 320px;
  overflow: auto;
}

.explain-output.is-error {
  color: #ff8585;
  border-color: rgba(255, 133, 133, 0.4);
}

.explain-ask {
  margin: var(--s2) var(--s4) 0;
  padding: var(--s2) var(--s3);
  border: 1px solid var(--border, rgba(255, 255, 255, 0.12));
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-primary);
  font-size: 13px;
  font-family: inherit;
}

.explain-ask::placeholder {
  color: var(--text-tertiary);
}

.report-preview-status {
  display: grid;
  gap: 5px;
  padding: var(--s3);
  border: 0.5px solid rgba(242, 184, 75, 0.24);
  border-radius: var(--r-btn);
  background: rgba(242, 184, 75, 0.07);
}

.report-preview-status.is-ready {
  border-color: rgba(0, 212, 160, 0.36);
  background: rgba(0, 212, 160, 0.09);
}

.report-preview-status strong {
  color: var(--text-primary);
  font-size: 13px;
  line-height: 1.35;
}

.report-preview-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--s2);
}

.report-preview-section {
  display: grid;
  align-content: start;
  gap: 6px;
  min-width: 0;
  min-height: 118px;
  padding: var(--s3);
  border: 0.5px solid var(--border);
  border-radius: var(--r-btn);
  background: rgba(255, 255, 255, 0.028);
}

.report-preview-section strong {
  min-width: 0;
  overflow: hidden;
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.report-preview-section p {
  color: var(--text-tertiary);
  font-size: 11px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.report-markdown {
  overflow: auto;
  max-height: 320px;
  padding: var(--s3);
  border: 0.5px solid var(--border);
  border-radius: var(--r-btn);
  background: #050709;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.55;
  white-space: pre-wrap;
}

.tooltip {
  position: fixed;
  z-index: 200;
  max-width: min(280px, calc(100vw - 24px));
  padding: var(--s2) var(--s3);
  border: 0.5px solid var(--border-strong);
  border-radius: var(--r-btn);
  background: rgba(20, 20, 22, 0.96);
  color: var(--text-primary);
  font-size: 11px;
  line-height: 1.35;
  pointer-events: none;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.15);
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.25);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.001ms !important;
  }
}

@media (max-width: 1120px) {
  .app-header {
    padding-top: var(--s2);
    padding-bottom: var(--s2);
  }

  .workbench-head {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .workbench-actions {
    justify-content: flex-start;
  }

  .pipeline-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .pipeline-step:nth-child(2n) {
    border-right: 0;
  }

  .pipeline-step:nth-child(-n + 2) {
    border-bottom: 0.5px solid var(--border);
  }

  .workbench-grid {
    grid-template-columns: 1fr 1fr;
  }

  .workbench-drop-zone {
    grid-column: 1 / -1;
    min-height: 168px;
  }

  .report-preview-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .control-panel {
    top: 64px;
  }

  .control-panel-body {
    grid-template-columns: 1fr 1fr;
  }

  .control-group-filter {
    grid-column: 1 / -1;
  }

  #home-views {
    grid-template-columns: 1fr;
  }

  .panel-collapsible.is-expanded {
    grid-column: 1;
  }

  .panel-phase {
    grid-column: 1 / -1;
  }

  .panel-network,
  .panel-tda {
    grid-column: 1 / -1;
  }

  .playback-shell {
    align-items: stretch;
  }

  .monitor-builder {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .phase-controls {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .psd-layout {
    grid-template-columns: 1fr;
  }

  .chart-overlay {
    height: 360px;
  }

  .channel-grid {
    min-height: auto;
  }

  .tda-view {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .app-shell {
    width: 100%;
    padding-right: var(--s3);
    padding-left: var(--s3);
  }

  .app-header,
  .control-panel {
    margin-right: calc(var(--s3) * -1);
    margin-left: calc(var(--s3) * -1);
  }

  .app-header {
    align-items: flex-start;
    flex-direction: column;
    gap: var(--s2);
    min-height: auto;
    padding-top: var(--s3);
    padding-bottom: var(--s3);
  }

  h1 {
    font-size: 18px;
  }

  .workbench {
    padding: var(--s4);
  }

  .workbench-title-block h2 {
    font-size: 28px;
    line-height: 1.08;
  }

  .workbench-title-block p {
    font-size: 13px;
  }

  .workbench-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .workbench-actions button,
  .console-link {
    width: 100%;
  }

  .report-dialog {
    width: min(100vw - 18px, 680px);
    max-height: calc(100vh - 18px);
  }

  .report-dialog-shell {
    max-height: calc(100vh - 18px);
  }

  .report-dialog-head {
    align-items: flex-start;
    flex-direction: row;
  }

  .report-dialog-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .report-dialog-actions button {
    width: 100%;
  }

  .report-preview-grid {
    grid-template-columns: 1fr;
  }

  .pipeline-strip,
  .workbench-grid,
  .workbench-metrics {
    grid-template-columns: 1fr;
  }

  .pipeline-step,
  .pipeline-step:nth-child(2n),
  .pipeline-step:nth-child(-n + 2) {
    border-right: 0;
    border-bottom: 0.5px solid var(--border);
  }

  .pipeline-step:last-child {
    border-bottom: 0;
  }

  .workbench-drop-zone {
    min-height: 172px;
    padding: var(--s4);
  }

  .workbench-drop-zone strong {
    font-size: 17px;
  }

  .import-row {
    grid-template-columns: 1fr;
  }

  .import-row span {
    white-space: normal;
  }

  .comparison-row {
    grid-template-columns: 1fr;
  }

  .comparison-row strong {
    grid-column: auto;
  }

  .comparison-name {
    white-space: normal;
  }

  .baseline-summary strong {
    white-space: normal;
  }

  .quality-item {
    grid-template-columns: 1fr;
  }

  .toolbox-list {
    grid-template-columns: 1fr;
  }

  .metric-tile,
  .metric-tile:nth-child(2n),
  .metric-tile:nth-last-child(-n + 2) {
    border-right: 0;
    border-bottom: 0.5px solid var(--border);
  }

  .metric-tile:last-child {
    border-bottom: 0;
  }

  .header-status {
    justify-content: flex-start;
    width: 100%;
  }

  .header-status span {
    padding: 4px 6px;
  }

  .control-panel {
    position: relative;
    top: auto;
  }

  .control-panel-body {
    padding-right: var(--s3);
    padding-left: var(--s3);
  }

  .control-panel-body {
    grid-template-columns: 1fr;
    gap: var(--s3);
  }

  .live-row,
  .playback-actions,
  .playback-speeds,
  .phase-mode {
    flex-wrap: wrap;
  }

  input {
    width: 100%;
  }

  .session-mode {
    width: fit-content;
  }

  .live-row input {
    flex-basis: 100%;
  }

  .psd-layout {
    display: block;
  }

  .playback-shell {
    display: grid;
    grid-template-columns: 1fr;
  }

  .panel-playback {
    top: 82px;
  }

  .playback-time {
    text-align: left;
  }

  .monitor-head,
  .monitor-status-row {
    align-items: stretch;
    flex-direction: column;
  }

  .panel-head {
    align-items: flex-start;
  }

  .panel-head h2,
  .panel-head p {
    overflow: visible;
    text-overflow: clip;
    white-space: normal;
  }

  .monitor-actions {
    justify-content: flex-start;
  }

  .monitor-builder {
    grid-template-columns: 1fr;
  }

  .phase-controls {
    grid-template-columns: 1fr;
  }

  .chart-heatmap {
    height: 560px;
  }

  .chart-wide {
    height: 280px;
  }

  .chart-stack {
    height: 500px;
  }

  .chart-phase {
    height: 420px;
  }

  .chart-polar,
  .chart-kuramoto {
    height: 390px;
  }

  .network-controls {
    display: grid;
    grid-template-columns: 1fr;
  }

  .network-graph svg {
    height: 420px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}

/* ============================================================================
   RESKIN 01 "SIGNAL" — token overrides + editorial treatment + hero entrance
   Appended last so :root values win. Logic/data/canvas untouched; canvas plots
   keep reading --chart-* (only --chart-secondary changes → hot red).
   ========================================================================== */
:root {
  --bg-0: #0A0B0E;
  --bg-1: rgba(16, 18, 22, 0.94);
  --bg-2: #181B20;
  --bg-3: #23262C;

  --text-primary:   #F4F7F8;
  --text-secondary: #9AA3A8;
  --text-tertiary:  #636C72;
  --text-mono:      #8A99A3;

  --accent:        #00D4A0;
  --accent-bright: #00FFBF;
  --accent-dim:    rgba(0, 212, 160, 0.13);
  --border-accent: rgba(0, 212, 160, 0.42);

  --danger:  #FF1627;
  --hot:     #FF1627;
  --hot-dim: rgba(255, 22, 39, 0.16);

  --chart-active:      #00D4A0;
  --chart-secondary:   #FF1627;
  --chart-grid:        rgba(255, 255, 255, 0.05);
  --chart-axis:        #8A99A3;
  --chart-muted:       #636C72;
  --chart-bg:          #0B0D11;
  --chart-plot-border: rgba(255, 255, 255, 0.10);
  --chart-cursor:      rgba(0, 212, 160, 0.6);
  --chart-active-glow: rgba(0, 212, 160, 0.4);

  --font:         "IBM Plex Sans", "SF Pro Text", system-ui, sans-serif;
  --font-display: "Archivo Expanded", "Archivo", "IBM Plex Sans", system-ui, sans-serif;
  --font-mono:    "IBM Plex Sans", system-ui, sans-serif;
  --display-weight: 800;
  --display-tracking: -0.015em;

  --ease:     cubic-bezier(0.22, 0.61, 0.36, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --t-fast: 140ms; --t-normal: 280ms; --t-slow: 680ms;

  --hero-glow: 0.9; --hero-scanlines: 1; --hero-glitch: 1;
  --hero-grade-hue: 0deg; --hero-grade-sat: 1.05;
}

/* editorial display treatment */
.app-header h1,
#workbench-title,
.session-comparison h2,
.report-preview h2,
.panel-card h2 {
  font-family: var(--font-display);
  font-weight: var(--display-weight);
  letter-spacing: var(--display-tracking);
  text-transform: uppercase;
  line-height: 0.9;
}
.brand-kicker,
.workbench-kicker,
.control-label {
  font-family: var(--font);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.brand-kicker, .workbench-kicker { color: var(--accent); }

.pipeline-step.is-active { position: relative; }
.pipeline-step.is-active::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px;
  background: var(--hot);
}
.pipeline-step.is-ready span { color: var(--accent); }

.metric-value, .stat-value, [data-metric-value], .metric-tile strong {
  font-family: var(--font-display);
  font-weight: var(--display-weight);
  letter-spacing: var(--display-tracking);
}

.primary-action { background: var(--accent); color: #06120E; }
.hot-action { background: var(--hot); color: #fff; }

.primary-action, button[type="button"], .panel-card, .metric-tile {
  transition: transform var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease),
              border-color var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
}
.primary-action:hover { transform: translateY(-1px); box-shadow: 0 6px 30px rgba(0,212,160,0.4); }
.primary-action:active { transform: translateY(1px); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---- HERO ENTRANCE (additive; heavy effects HERE ONLY, never behind plots) -- */
.nm-hero { position: relative; height: 100vh; min-height: 720px; overflow: hidden; background: #000; display: grid; isolation: isolate; }
.nm-hero-vis { position: absolute; inset: 0; z-index: 0; overflow: hidden; }
.nm-hero-img { position: absolute; inset: -3%; width: 106%; height: 106%; object-fit: cover; object-position: 72% 14%;
  filter: hue-rotate(var(--hero-grade-hue)) saturate(var(--hero-grade-sat)) contrast(1.06); animation: nmDrift 26s ease-in-out infinite alternate; }
@keyframes nmDrift { 0%{transform:scale(1.02) translate(0,0);} 100%{transform:scale(1.06) translate(-1.4%,-1%);} }
.ghost { position: absolute; inset: -3%; width: 106%; height: 106%; background-image: var(--hero-src); background-size: cover; background-position: 72% 14%; mix-blend-mode: screen; pointer-events: none; will-change: transform, opacity; }
.ghost.r { filter: hue-rotate(-22deg) saturate(2.4) brightness(1.05); animation: nmGhostR 5.5s steps(1) infinite; opacity: 0; }
.ghost.c { filter: hue-rotate(150deg) saturate(2.2) brightness(1.05); animation: nmGhostC 5.5s steps(1) infinite; opacity: 0; }
@keyframes nmGhostR { 0%,86%,100%{opacity:0;transform:translate(0,0);} 87%{opacity:calc(.5*var(--hero-glitch));transform:translate(-6px,1px);} 90%{opacity:calc(.35*var(--hero-glitch));transform:translate(4px,-1px);} 93%{opacity:calc(.45*var(--hero-glitch));transform:translate(-3px,0);} 96%{opacity:0;} }
@keyframes nmGhostC { 0%,86%,100%{opacity:0;transform:translate(0,0);} 87%{opacity:calc(.5*var(--hero-glitch));transform:translate(6px,-1px);} 90%{opacity:calc(.35*var(--hero-glitch));transform:translate(-4px,1px);} 93%{opacity:calc(.45*var(--hero-glitch));transform:translate(3px,0);} 96%{opacity:0;} }
.slice { position: absolute; inset: -3%; width: 106%; height: 106%; overflow: hidden; pointer-events: none; background-image: var(--hero-src); background-size: cover; background-position: 72% 14%; filter: saturate(var(--hero-grade-sat)) contrast(1.06); opacity: 0; will-change: transform, opacity; }
.slice.s1 { clip-path: inset(22% 0 74% 0); animation: nmSliceA 6.4s steps(1) infinite; }
.slice.s2 { clip-path: inset(48% 0 49% 0); animation: nmSliceB 7.9s steps(1) infinite; }
.slice.s3 { clip-path: inset(67% 0 28% 0); animation: nmSliceA 5.1s steps(1) infinite 1.2s; }
@keyframes nmSliceA { 0%,90%,100%{opacity:0;transform:translateX(0);} 91%{opacity:var(--hero-glitch);transform:translateX(14px);} 93%{opacity:var(--hero-glitch);transform:translateX(-20px);} 95%{opacity:0;} }
@keyframes nmSliceB { 0%,92%,100%{opacity:0;transform:translateX(0);} 93%{opacity:var(--hero-glitch);transform:translateX(-26px);} 96%{opacity:0;} }
.nm-hero-trace { position: absolute; inset: 0; z-index: 2; pointer-events: none; opacity: 0.5; mix-blend-mode: screen; }
.nm-hero-trace .sweep { position: absolute; left: 30%; right: 0; height: 1px; top: 0; background: linear-gradient(90deg, transparent, var(--accent) 40%, var(--accent-bright) 50%, var(--accent) 60%, transparent); box-shadow: 0 0 10px var(--accent); animation: nmSweep 7s var(--ease-out) infinite; }
@keyframes nmSweep { 0%{top:8%;opacity:0;} 8%{opacity:.8;} 46%{opacity:.8;} 60%{top:82%;opacity:0;} 100%{top:82%;opacity:0;} }
.nm-hero-glow { position: absolute; z-index: 0; inset: -5% -10% 0 30%; background: radial-gradient(46% 44% at 64% 40%, var(--hot), transparent 70%); filter: blur(90px); opacity: calc(0.46*var(--hero-glow)); pointer-events: none; animation: nmGlow 9s ease-in-out infinite; }
@keyframes nmGlow { 0%,100%{opacity:calc(0.34*var(--hero-glow));} 50%{opacity:calc(0.5*var(--hero-glow));} }
.nm-hero-scrim { position: absolute; inset: 0; z-index: 1; pointer-events: none; background: linear-gradient(95deg,#000 8%,rgba(0,0,0,.6) 34%,transparent 60%), linear-gradient(0deg,#000 4%,rgba(0,0,0,.38) 22%,transparent 46%); }
.nm-hero-scan { position: absolute; inset: 0; z-index: 3; pointer-events: none; opacity: calc(0.5*var(--hero-scanlines)); mix-blend-mode: multiply; background: repeating-linear-gradient(to bottom,transparent 0 2px,rgba(0,0,0,.5) 2px 3px); animation: nmFlicker 3.5s steps(2) infinite; }
@keyframes nmFlicker { 0%,100%{opacity:calc(0.5*var(--hero-scanlines));} 50%{opacity:calc(0.38*var(--hero-scanlines));} }
.nm-hero-tear { position: absolute; inset: 0; z-index: 4; pointer-events: none; opacity: 0; mix-blend-mode: screen; background: linear-gradient(transparent 38%,rgba(255,22,39,.5) 39%,transparent 40%,transparent 63%,rgba(0,212,160,.4) 64%,transparent 65%); animation: nmTear 8.5s steps(1) infinite; }
@keyframes nmTear { 0%,94%,100%{opacity:0;transform:translateY(0);} 95%{opacity:var(--hero-glitch);transform:translateY(-4px);} 97%{opacity:0;} }
.nm-hero-type { position: relative; z-index: 5; align-self: end; padding: 0 clamp(18px,3vw,44px) clamp(36px,5vw,72px); max-width: 1500px; }
.nm-hero-word { font-family: var(--font-display); font-weight: var(--display-weight); letter-spacing: var(--display-tracking); text-transform: uppercase; font-size: clamp(52px,10.6vw,178px); line-height: 0.8; color: #fff; margin: 0; }
.nm-hero-word .x { color: var(--hot); text-shadow: 0 0 calc(34px*var(--hero-glow)) var(--hot); }
.nm-hero-foot { margin-top: clamp(16px,2.4vw,30px); display: flex; align-items: center; gap: clamp(16px,2vw,28px); flex-wrap: wrap; }
.nm-hero-promise { font-size: clamp(20px,2vw,30px); line-height: 1.05; color: #fff; font-weight: 500; margin: 0; }
.nm-hero-promise b { color: var(--accent); font-weight: 600; }
.nm-hero-type > * { opacity: 0; transform: translateY(26px); animation: nmRise .85s var(--ease-out) forwards; }
.nm-hero-word { animation-delay: .40s; }
.nm-hero-foot { animation: none; opacity: 1; transform: none; }
.nm-hero-promise { animation-delay: .62s; }
.nm-hero-foot .primary-action { animation-delay: .78s; }
@keyframes nmRise { to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .nm-hero *, .nm-hero *::before, .nm-hero *::after { animation: none !important; }
  .nm-hero-type > * { opacity: 1 !important; transform: none !important; }
  .ghost, .slice, .nm-hero-tear, .nm-hero-trace { display: none !important; }
}
