:root {
  --bg: #030405;
  --panel: rgba(8, 11, 12, 0.92);
  --panel-2: rgba(12, 17, 18, 0.9);
  --panel-3: rgba(20, 28, 28, 0.92);
  --grid: rgba(119, 255, 205, 0.08);
  --line: rgba(128, 255, 218, 0.22);
  --line-strong: rgba(255, 179, 71, 0.42);
  --acid: #c8ff63;
  --lime: #7cffbf;
  --amber: #ffb347;
  --amber-2: #ff8f3f;
  --red: #ff5f59;
  --red-soft: rgba(255, 95, 89, 0.16);
  --text: #edf8f0;
  --muted: #7d9388;
  --steel: #172022;
  --cyan: #8be8ff;
  --shadow: 0 28px 80px rgba(0, 0, 0, 0.45);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at top right, rgba(255, 95, 89, 0.12), transparent 20%),
    radial-gradient(circle at 20% 0%, rgba(200, 255, 99, 0.12), transparent 24%),
    linear-gradient(transparent 35px, var(--grid) 36px),
    linear-gradient(90deg, transparent 35px, var(--grid) 36px),
    linear-gradient(180deg, #050708 0%, #090c0d 34%, #030405 100%);
  background-size: auto, auto, 36px 36px, 36px 36px, auto;
  color: var(--text);
  font-family: "Bank Gothic", "Eurostile", "OCR A Extended", "Share Tech Mono", monospace;
}

body {
  position: relative;
  overflow-x: hidden;
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
}

body::before {
  background:
    linear-gradient(to bottom, rgba(255,255,255,0.04), transparent 12%),
    repeating-linear-gradient(
      to bottom,
      rgba(255,255,255,0.028) 0,
      rgba(255,255,255,0.028) 1px,
      transparent 1px,
      transparent 4px
    );
  mix-blend-mode: screen;
  opacity: 0.3;
}

body::after {
  background:
    linear-gradient(125deg, transparent 0 62%, rgba(255, 179, 71, 0.05) 62% 66%, transparent 66%),
    linear-gradient(300deg, transparent 0 68%, rgba(124, 255, 191, 0.05) 68% 71%, transparent 71%);
  animation: sweep 11s linear infinite;
  opacity: 0.9;
}

@keyframes sweep {
  from { transform: translate3d(-2%, 0, 0); }
  50% { transform: translate3d(2%, 0, 0); }
  to { transform: translate3d(-2%, 0, 0); }
}

a {
  color: inherit;
  text-decoration: none;
}

.shell {
  width: min(1360px, calc(100vw - 28px));
  margin: 18px auto 54px;
  position: relative;
  z-index: 1;
}

.masthead,
.section,
.footer-note {
  position: relative;
  overflow: hidden;
}

.masthead::before,
.section::before,
.footer-note::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.03), transparent 38%);
  pointer-events: none;
}

.masthead {
  border: 1px solid var(--line);
  clip-path: polygon(0 0, calc(100% - 24px) 0, 100% 24px, 100% 100%, 24px 100%, 0 calc(100% - 24px));
  background:
    linear-gradient(135deg, rgba(200,255,99,0.14), rgba(200,255,99,0.02) 42%, rgba(255,95,89,0.09)),
    linear-gradient(180deg, rgba(255,255,255,0.03), transparent 40%),
    var(--panel);
  box-shadow: var(--shadow), 0 0 0 1px rgba(255,255,255,0.04) inset;
}

.masthead-top {
  display: grid;
  grid-template-columns: 190px 1fr 190px;
  gap: 18px;
  align-items: center;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(90deg, rgba(255,179,71,0.06), transparent 15%, transparent 85%, rgba(124,255,191,0.05));
}

.masthead-code,
.masthead-status {
  position: relative;
  font-size: 11px;
  line-height: 1.7;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--muted);
}

.masthead-code::before,
.masthead-status::before {
  content: "";
  display: block;
  width: 48px;
  height: 3px;
  margin-bottom: 10px;
  background: linear-gradient(90deg, var(--amber), transparent);
}

.masthead-title {
  text-align: center;
}

.masthead-title h1 {
  margin: 0;
  font-size: clamp(34px, 4vw, 68px);
  line-height: 0.9;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--acid);
  text-shadow: 0 0 24px rgba(200,255,99,0.16);
}

.masthead-title p {
  margin: 10px 0 0;
  font-size: 11px;
  letter-spacing: 0.36em;
  text-transform: uppercase;
  color: var(--amber);
}

.masthead-bottom {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 22px;
  padding: 22px;
}

.mission-grid {
  align-items: stretch;
}

.declaration,
.telemetry-card,
.archive-item,
.run-card,
.log-block,
.finding-card,
.witness-card,
.map-card,
.dossier-card {
  position: relative;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255,255,255,0.025), transparent 72%), var(--panel-2);
  box-shadow: 0 0 0 1px rgba(255,255,255,0.025) inset;
}

.declaration {
  padding: 18px 18px 18px 22px;
}

.eyebrow {
  display: inline-block;
  margin-bottom: 12px;
  padding: 4px 8px 4px 10px;
  border-left: 3px solid var(--amber);
  background: rgba(255, 179, 71, 0.08);
  font-size: 10px;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--amber);
}

.declaration p {
  margin: 0;
  max-width: 58ch;
  font-size: 15px;
  line-height: 1.76;
  color: var(--text);
}

.mission-copy h2 {
  margin: 0 0 14px;
  max-width: 18ch;
  font-size: clamp(24px, 3vw, 42px);
  line-height: 1.05;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--text);
}

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

.telemetry-card {
  padding: 14px 14px 14px 16px;
  clip-path: polygon(0 0, calc(100% - 16px) 0, 100% 16px, 100% 100%, 0 100%);
}

.telemetry-card::after,
.run-card::after,
.archive-item::after,
.log-block::after,
.finding-card::after,
.witness-card::after,
.map-card::after,
.dossier-card::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 18px;
  height: 18px;
  background: linear-gradient(135deg, rgba(255,179,71,0.4), rgba(255,179,71,0.06));
  clip-path: polygon(100% 0, 0 0, 100% 100%);
}

.telemetry-label,
.metric-label {
  font-size: 10px;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--muted);
}

.telemetry-value {
  margin-top: 10px;
  font-size: clamp(22px, 2vw, 28px);
  line-height: 0.95;
  color: var(--lime);
}

.main-grid {
  display: grid;
  grid-template-columns: 1.12fr 0.88fr;
  gap: 22px;
  margin-top: 22px;
}

.findings-grid,
.witness-grid,
.experiment-map {
  display: grid;
  gap: 14px;
}

.findings-grid,
.experiment-map {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.witness-grid {
  grid-template-columns: 1.25fr 1fr 1fr 1fr;
}

.section {
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(255,255,255,0.028), transparent 45%),
    var(--panel);
  box-shadow: 0 0 0 1px rgba(255,255,255,0.03) inset, var(--shadow);
}

.section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 15px 18px;
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(90deg, rgba(255,179,71,0.08), transparent 20%, transparent 80%, rgba(124,255,191,0.05));
}

.section-title {
  font-size: 14px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--acid);
}

.section-meta {
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
}

.section-body {
  padding: 18px;
}

.subsection-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.run-grid,
.archive-list,
.archive-groups {
  display: grid;
  gap: 14px;
}

.chamber-feed {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px;
}

.feed-column {
  min-width: 0;
}

.archive-group {
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255,255,255,0.022), transparent 72%), var(--panel-2);
  box-shadow: 0 0 0 1px rgba(255,255,255,0.025) inset;
}

.archive-group-header {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  background:
    linear-gradient(90deg, rgba(255,179,71,0.06), transparent 20%, transparent 80%, rgba(124,255,191,0.04));
}

.archive-group-title {
  font-size: 13px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--acid);
}

.archive-group-meta {
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  text-align: right;
}

.archive-run-list {
  display: grid;
  gap: 10px;
  padding: 12px 14px 14px;
}

.run-card {
  padding: 16px 16px 18px;
  clip-path: polygon(0 0, calc(100% - 16px) 0, 100% 16px, 100% 100%, 0 100%);
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.run-card:hover,
.archive-item:hover,
.finding-card:hover,
.witness-card:hover,
.map-card:hover,
.dossier-card:hover {
  transform: translateY(-2px);
  border-color: var(--line-strong);
  box-shadow: 0 0 0 1px rgba(255,255,255,0.025) inset, 0 18px 34px rgba(0,0,0,0.28);
}

.run-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-left: 5px solid var(--acid);
  pointer-events: none;
}

.run-card.fail::before { border-left-color: var(--red); }
.run-card.pass::before { border-left-color: var(--lime); }

.finding-card,
.witness-card,
.map-card,
.dossier-card {
  padding: 16px 16px 18px;
  clip-path: polygon(0 0, calc(100% - 16px) 0, 100% 16px, 100% 100%, 0 100%);
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.finding-card::before,
.witness-card::before,
.map-card::before,
.dossier-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-left: 5px solid var(--amber);
  pointer-events: none;
}

.witness-card.featured::before {
  border-left-color: var(--acid);
}

.finding-tag,
.map-tag {
  margin-bottom: 10px;
  color: var(--amber);
  font-size: 10px;
  letter-spacing: 0.26em;
  text-transform: uppercase;
}

.finding-card h3,
.map-card h3 {
  margin: 0 0 10px;
  font-size: 16px;
  line-height: 1.3;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.finding-card p,
.map-card p,
.witness-note,
.dossier-copy {
  margin: 0;
  color: var(--text);
  font-size: 14px;
  line-height: 1.7;
}

.witness-line {
  margin-bottom: 12px;
  color: var(--amber);
  font-size: 10px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
}

.witness-note {
  margin-bottom: 14px;
}

.witness-card.featured {
  background:
    linear-gradient(135deg, rgba(200,255,99,0.1), rgba(200,255,99,0.02) 42%, rgba(255,95,89,0.05)),
    linear-gradient(180deg, rgba(255,255,255,0.025), transparent 72%),
    var(--panel-2);
}

.witness-meta {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.run-topline {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.run-name {
  font-size: 18px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.run-organism {
  margin-top: 6px;
  color: var(--amber);
  font-size: 10px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
}

.run-state {
  align-self: flex-start;
  padding: 5px 8px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(0,0,0,0.26);
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
}

.run-metrics,
.run-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

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

.dossier-wide {
  grid-column: span 2;
}

.snapshot-strip {
  display: grid;
  grid-template-columns: 170px 1fr auto;
  gap: 14px;
  align-items: center;
  margin-bottom: 18px;
}

.snapshot-label {
  font-size: 11px;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--amber);
}

.snapshot-meta {
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}

.snapshot-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.snapshot-controls button {
  border: 1px solid var(--line);
  background: rgba(0,0,0,0.28);
  color: var(--text);
  padding: 7px 10px;
  font: inherit;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  cursor: pointer;
}

.snapshot-controls button.live {
  color: var(--acid);
  border-color: var(--line-strong);
}

.snapshot-controls input[type="range"] {
  width: min(420px, 34vw);
  accent-color: var(--amber);
}

.metric {
  position: relative;
  padding-top: 10px;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.metric-value {
  margin-top: 7px;
  font-size: 16px;
  color: var(--text);
}

.run-actions,
.run-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.action {
  padding: 10px 12px;
  border: 1px solid var(--line);
  background:
    linear-gradient(135deg, rgba(255,255,255,0.02), transparent 60%),
    rgba(0, 0, 0, 0.34);
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  transition: transform 150ms ease, border-color 150ms ease, background 150ms ease;
}

.action:hover {
  transform: translateY(-1px);
  border-color: var(--line-strong);
}

.action.primary {
  background:
    linear-gradient(135deg, rgba(200,255,99,0.2), rgba(200,255,99,0.04)),
    rgba(0,0,0,0.24);
  color: var(--acid);
}

.action.disabled {
  opacity: 0.55;
  cursor: default;
}

.archive-item {
  padding: 14px 14px 14px 16px;
  clip-path: polygon(0 0, calc(100% - 16px) 0, 100% 16px, 100% 100%, 0 100%);
}

.archive-item-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 7px;
}

.archive-item h3 {
  margin: 0;
  font-size: 13px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.archive-badge {
  padding: 4px 7px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(0,0,0,0.22);
  color: var(--amber);
  font-size: 9px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  white-space: nowrap;
}

.archive-item p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.65;
}

.empty-state {
  padding: 26px;
  border: 1px dashed var(--line);
  background: rgba(0,0,0,0.18);
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 10px;
}

.footer-note {
  margin-top: 22px;
  padding: 15px 18px;
  border: 1px solid var(--line);
  background:
    linear-gradient(90deg, rgba(255,95,89,0.08), transparent 20%, transparent 80%, rgba(124,255,191,0.05)),
    rgba(0,0,0,0.26);
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.run-shell {
  display: grid;
  gap: 22px;
}

.log-block {
  min-height: 220px;
  padding: 16px 16px 16px 18px;
}

.log-block pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.65;
  font-size: 13px;
  color: var(--text);
}

body.alert-ratchet .masthead,
body.alert-ratchet .section {
  box-shadow: var(--shadow), 0 0 24px rgba(139, 232, 255, 0.12);
}

body.alert-ontology .masthead,
body.alert-ontology .section,
body.alert-ontology .log-block {
  box-shadow: var(--shadow), 0 0 28px rgba(255, 179, 71, 0.1);
}

body.alert-edge::after {
  opacity: 1;
  animation-duration: 5s;
}

body.alert-edge .section,
body.alert-edge .log-block,
body.alert-edge .telemetry-card {
  border-color: rgba(255, 95, 89, 0.24);
}

@media (max-width: 980px) {
  .masthead-top,
  .masthead-bottom,
  .main-grid,
  .run-summary,
  .run-metrics,
  .snapshot-strip,
  .findings-grid,
  .witness-grid,
  .experiment-map,
  .dossier-grid,
  .chamber-feed {
    grid-template-columns: 1fr;
  }

  .archive-group summary,
  .archive-group-header,
  .archive-item-topline {
    flex-direction: column;
    align-items: flex-start;
  }

  .masthead-top {
    text-align: center;
  }

  .shell {
    width: min(100vw - 18px, 1360px);
  }

  .dossier-wide {
    grid-column: span 1;
  }
}
