:root {
  color-scheme: dark;
  --bg: #111111;
  --surface: #181b20;
  --surface-2: #20252b;
  --surface-3: #0b0f14;
  --line: #303945;
  --text: #f4f5f6;
  --muted: #a7afba;
  --soft: #737d8c;
  --green: #35d38a;
  --cyan: #20d5e5;
  --amber: #f7c83e;
  --orange: #ff7a2e;
  --rose: #ff5c7a;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    linear-gradient(135deg, rgba(32, 213, 229, 0.06), transparent 24rem),
    linear-gradient(180deg, #111111 0%, #11151a 46%, #0d0f12 100%);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

button,
a {
  -webkit-tap-highlight-color: transparent;
}

.app-topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: minmax(220px, 0.8fr) minmax(360px, 1.4fr) auto;
  gap: 18px;
  align-items: center;
  min-height: 76px;
  padding: 14px clamp(18px, 4vw, 56px);
  border-bottom: 1px solid var(--line);
  background: rgba(17, 17, 17, 0.94);
  backdrop-filter: blur(12px);
}

.brand-mark {
  display: inline-grid;
  grid-template-columns: 46px 1fr;
  gap: 12px;
  align-items: center;
}

.brand-glyph {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border: 1px solid #4a5564;
  border-radius: 8px;
  background: #0e141a;
  color: var(--green);
  font-weight: 800;
}

.brand-mark strong,
.brand-mark small {
  display: block;
}

.brand-mark small,
.eyebrow,
.product-card em,
.sample-card small,
.receipt-row small {
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
}

.top-nav {
  display: flex;
  justify-content: center;
  gap: 8px;
  min-width: 0;
}

.top-nav a,
.launch-chip,
.domain-buttons button {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--text);
}

.top-nav a {
  padding: 10px 12px;
  font-size: 14px;
  white-space: nowrap;
}

.top-nav a:hover,
.launch-chip:hover,
.domain-buttons button:hover,
.domain-buttons button.is-active {
  border-color: var(--cyan);
  color: var(--cyan);
}

.launch-chip {
  padding: 11px 14px;
  color: var(--amber);
  white-space: nowrap;
}

main {
  display: grid;
  gap: 22px;
}

.workbench {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr) 290px;
  gap: 18px;
  min-height: 0;
  padding: 18px clamp(18px, 4vw, 56px) 24px;
  background: transparent;
}

.domain-rail,
.viewer-surface,
.receipt-panel,
.product-card,
.sample-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.domain-rail,
.receipt-panel {
  align-self: start;
  padding: 16px;
}

.rail-heading {
  display: grid;
  gap: 4px;
  margin-bottom: 14px;
}

.rail-heading span,
.section-heading .eyebrow {
  color: var(--soft);
  font: 11px/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  text-transform: uppercase;
}

.rail-heading strong {
  font-size: 17px;
}

.domain-buttons {
  display: grid;
  gap: 8px;
}

.domain-buttons button {
  width: 100%;
  min-height: 40px;
  padding: 0 10px;
  cursor: pointer;
  font-weight: 700;
  text-align: left;
}

.viewer-surface {
  overflow: hidden;
  min-width: 0;
  background: var(--surface-3);
}

.viewer-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
  background: #171d22;
}

.viewer-header h1 {
  margin: 5px 0 0;
  font-size: clamp(24px, 3vw, 42px);
  line-height: 1.05;
  letter-spacing: 0;
}

.viewer-badges,
.mini-tags {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.tag,
.mini-tags span {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border: 1px solid #46515f;
  border-radius: 999px;
  color: #dce6f1;
  font: 12px/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.signal-board {
  display: grid;
  grid-template-rows: auto auto;
  min-height: 0;
}

.signal-svg {
  min-width: 0;
  padding: 18px;
}

.signal-svg svg {
  display: block;
  width: 100%;
  height: auto;
  min-height: 0;
  aspect-ratio: 960 / 450;
}

.svg-bg {
  fill: #080d13;
  stroke: #222c38;
}

.grid-line {
  stroke: rgba(154, 169, 188, 0.22);
  stroke-width: 1;
}

.grid-line.faint {
  stroke: rgba(154, 169, 188, 0.10);
}

.lane-line {
  fill: none;
  stroke-width: 5;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.94;
}

.lane-1 {
  opacity: 0.66;
}

.lane-2 {
  opacity: 0.44;
}

.lane-ribbon {
  opacity: 0.18;
}

.lane-ribbon path {
  stroke: none;
}

.lane-dot {
  fill: #f4f5f6;
  opacity: 0.92;
}

.domain-node circle {
  fill: rgba(255, 255, 255, 0.03);
  stroke-width: 3;
}

.domain-node text,
.svg-caption,
.svg-title {
  fill: #dbe2eb;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.domain-node text {
  font-size: 14px;
  text-anchor: middle;
}

.svg-title {
  font-size: 18px;
  font-weight: 700;
}

.svg-caption {
  fill: #9aa6b5;
  font-size: 14px;
}

.svg-witness-card rect {
  fill: rgba(24, 31, 39, 0.9);
  stroke: rgba(244, 245, 246, 0.16);
}

.svg-witness-card text {
  fill: #dbe2eb;
  font: 12px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.metric-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  border-top: 1px solid var(--line);
  background: var(--line);
}

.metric-strip article {
  position: relative;
  min-height: 92px;
  padding: 14px;
  overflow: hidden;
  background: #171d22;
}

.metric-strip article::after {
  content: "";
  position: absolute;
  left: 0;
  right: calc(100% - var(--meter));
  bottom: 0;
  height: 4px;
  background: var(--accent);
}

.metric-strip small {
  display: block;
  color: var(--muted);
  font: 12px/1.2 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.metric-strip strong {
  display: block;
  margin-top: 8px;
  font-size: 32px;
}

.receipt-panel h2 {
  margin: 0 0 13px;
  font-size: 18px;
}

#receipt-list {
  display: grid;
  gap: 10px;
}

.receipt-row {
  display: grid;
  grid-template-columns: 10px 1fr;
  gap: 10px;
  align-items: start;
  padding: 10px;
  border: 1px solid #29323d;
  border-radius: 8px;
  background: #111820;
}

.receipt-row > span {
  width: 10px;
  height: 42px;
  border-radius: 999px;
}

.receipt-row strong {
  display: block;
  font-size: 13px;
}

.receipt-row small {
  display: block;
  margin-top: 4px;
  line-height: 1.35;
}

.portfolio-band,
.samples-band {
  padding: 10px clamp(18px, 4vw, 56px) 30px;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 12px;
}

.section-heading h2 {
  margin: 0;
  font-size: clamp(24px, 3vw, 34px);
}

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

.product-card {
  display: grid;
  gap: 12px;
  min-height: 240px;
  padding: 15px;
  background: #191d22;
}

.product-card-head {
  display: grid;
  gap: 4px;
}

.product-card-head strong {
  font-size: 20px;
}

.product-card p {
  margin: 0;
  color: #c5ccd5;
  line-height: 1.45;
}

.mini-tags {
  justify-content: flex-start;
}

.product-card a {
  align-self: end;
  display: inline-flex;
  justify-content: center;
  min-height: 38px;
  padding: 10px 12px;
  border: 1px solid #46515f;
  border-radius: 8px;
  color: var(--green);
}

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

.sample-card {
  overflow: hidden;
  cursor: pointer;
  background: #171b20;
}

.sample-card:hover {
  border-color: var(--accent);
}

.sample-thumb {
  padding: 12px 12px 0;
}

.sample-thumb svg {
  display: block;
  width: 100%;
}

.sample-card-body {
  display: grid;
  gap: 5px;
  padding: 12px 14px 15px;
}

.sample-card-body strong {
  overflow-wrap: anywhere;
  font-size: 16px;
}

.sample-card-body p {
  margin: 0;
  color: #c5ccd5;
}

@media (max-width: 1120px) {
  .app-topbar {
    grid-template-columns: 1fr;
  }

  .top-nav {
    justify-content: flex-start;
    overflow-x: auto;
    padding-bottom: 3px;
  }

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

  .domain-rail {
    position: static;
  }

  .domain-buttons {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }

  .receipt-panel {
    order: 3;
  }

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

@media (max-width: 720px) {
  .app-topbar,
  .workbench,
  .portfolio-band,
  .samples-band {
    padding-left: 12px;
    padding-right: 12px;
  }

  .domain-buttons,
  .metric-strip,
  .product-grid,
  .sample-grid {
    grid-template-columns: 1fr;
  }

  .viewer-header,
  .section-heading {
    display: grid;
  }

  .viewer-badges {
    justify-content: flex-start;
  }
}
