:root {
  color-scheme: dark;
  --bg: #090906;
  --panel: #151510;
  --line: #303024;
  --line-bright: #616148;
  --ink: #f5f2de;
  --muted: #a5a38c;
  --dim: #6e6d59;
  --yellow: #ffcc00;
  --yellow-soft: #ffe67c;
  --coldcard-red: #e20000;
  --mono: "SFMono-Regular", "Cascadia Code", "Roboto Mono", Consolas, monospace;
  --sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
}

body {
  display: flex;
  flex-direction: column;
  min-width: 320px;
  overflow: hidden;
  color: var(--ink);
  background: var(--bg);
  font-family: var(--sans);
}

.identity-bar {
  position: relative;
  z-index: 20;
  display: grid;
  flex: 0 0 auto;
  grid-template-columns: minmax(390px, 1fr) minmax(280px, 390px);
  gap: 20px;
  align-items: center;
  min-height: 78px;
  padding: 10px 16px;
  border-top: 4px solid var(--coldcard-red);
  border-bottom: 1px solid var(--line);
  background: #10100c;
  box-shadow: 0 10px 28px rgb(0 0 0 / 24%);
}

.identity-title {
  display: flex;
  gap: 18px;
  align-items: center;
  min-width: 0;
}

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

.identity-brand {
  display: block;
  flex: none;
  width: 154px;
  height: 22px;
}

.firmware-scope {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 9px 11px;
  border: 1px solid var(--line-bright);
  border-radius: 8px;
  background: var(--panel);
  font-family: var(--mono);
  white-space: nowrap;
}

.firmware-versions {
  display: grid;
  gap: 3px;
}

.firmware-scope-label {
  color: var(--yellow);
  font-size: 0.55rem;
  letter-spacing: 0.1em;
}

.firmware-scope strong {
  display: block;
  color: var(--ink);
  font-size: 0.65rem;
  font-weight: 700;
}

.graph-viewport {
  position: relative;
  flex: 1 1 auto;
  width: 100%;
  min-height: 0;
  overflow: auto;
  background:
    radial-gradient(circle at 11% 7%, rgb(255 204 0 / 7%), transparent 31rem),
    radial-gradient(circle at 67% 49%, rgb(110 213 255 / 4%), transparent 28rem),
    var(--bg);
  scrollbar-color: var(--line-bright) transparent;
  scrollbar-width: thin;
}

.seed-graph {
  display: block;
  width: 100%;
  height: 100%;
  min-width: 1100px;
  min-height: 619px;
  background-image:
    linear-gradient(rgb(255 255 255 / 2.2%) 1px, transparent 1px),
    linear-gradient(90deg, rgb(255 255 255 / 2.2%) 1px, transparent 1px);
  background-size: 42px 42px;
}

.noscript-source {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: rgb(11 11 8 / 92%);
  box-shadow: 0 12px 35px rgb(0 0 0 / 42%);
  font-family: var(--mono);
  font-size: 0.67rem;
  text-decoration: none;
  backdrop-filter: blur(12px);
  transition: border-color 120ms ease, color 120ms ease;
}

.security-advisory {
  display: flex;
  width: 100%;
  min-width: 0;
  max-width: 420px;
  min-height: 56px;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  justify-self: end;
  padding: 9px 14px;
  border: 1px solid #ff4d4d;
  border-radius: 8px;
  color: #fff;
  background: var(--coldcard-red);
  box-shadow: 0 12px 35px rgb(0 0 0 / 42%);
  font-family: var(--mono);
  text-decoration: none;
  transition: background-color 120ms ease, border-color 120ms ease;
}

.security-advisory-copy {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.security-advisory strong {
  font-size: 0.67rem;
  letter-spacing: 0.12em;
}

.security-advisory-copy > span {
  overflow: hidden;
  font-size: 0.68rem;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.security-advisory-arrow {
  flex: none;
  font-size: 1.15rem;
  font-weight: 800;
}

.security-advisory:hover,
.security-advisory:focus-visible {
  border-color: #fff;
  background: #f01818;
  outline: none;
}

.noscript-source:hover,
.noscript-source:focus-visible {
  border-color: var(--yellow);
  color: var(--yellow-soft);
  outline: none;
}

.flow-node,
.node-chip {
  outline: none;
}

.lane-band {
  pointer-events: none;
}

.lane-band-runtime {
  fill: rgb(110 213 255 / 3%);
}

.lane-band-generation {
  fill: rgb(255 204 0 / 2.6%);
}

.lane-header {
  fill: #151510;
  stroke: #5b5a45;
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
  transition: fill 120ms ease, stroke 120ms ease;
}

.lane-divider {
  stroke: #5b5a45;
  stroke-width: 1.5;
  stroke-dasharray: 5 7;
  vector-effect: non-scaling-stroke;
  transition: stroke 120ms ease;
}

.lane-label {
  fill: var(--ink);
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.11em;
  transition: fill 120ms ease;
}

.flow-node {
  cursor: alias;
}

.flow-node rect {
  fill: rgb(20 20 15 / 96%);
  stroke: var(--node-color, #565642);
  stroke-width: 1.5;
  vector-effect: non-scaling-stroke;
  transition: fill 120ms ease, filter 120ms ease, stroke-width 120ms ease;
}

.flow-node:hover rect,
.flow-node:focus rect {
  fill: #202017;
  stroke-width: 2.5;
  filter: drop-shadow(0 0 11px var(--node-glow, rgb(255 204 0 / 20%)));
}

.node-title,
.node-expression {
  pointer-events: none;
}

.node-title {
  fill: var(--ink);
  font-family: var(--sans);
  font-size: 18.5px;
  font-weight: 650;
  letter-spacing: -0.025em;
}

.node-expression {
  fill: var(--muted);
  font-family: var(--mono);
  font-size: var(--expression-size, 10px);
}

.flow-edge {
  fill: none;
  stroke: #696953;
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
}

.edge-group {
  pointer-events: none;
}

.node-chip {
  cursor: alias;
}

.node-chip rect {
  fill: #10100c;
  stroke: #4b4a3a;
  vector-effect: non-scaling-stroke;
}

.node-chip text {
  fill: var(--dim);
  font-family: var(--mono);
  font-size: 9.5px;
  pointer-events: none;
}

.node-chip:hover rect,
.node-chip:focus rect {
  stroke: var(--yellow);
}

.node-chip:hover text,
.node-chip:focus text {
  fill: var(--yellow-soft);
}

.noscript-source {
  position: fixed;
  z-index: 30;
  top: 50%;
  right: auto;
  bottom: auto;
  left: 50%;
  transform: translate(-50%, -50%);
}

@media (max-width: 1000px) {
  .identity-bar {
    grid-template-columns: minmax(0, 1fr);
  }

  .security-advisory {
    max-width: none;
  }
}

@media (max-width: 720px) {
  .identity-bar {
    grid-template-columns: minmax(0, 1fr);
    gap: 6px;
    min-height: 64px;
    padding: 7px 9px;
  }

  .identity-title {
    gap: 8px;
  }

  .identity-brand {
    width: 120px;
    height: auto;
  }

  .firmware-scope-label {
    display: none;
  }

  .firmware-scope {
    padding: 6px 7px;
  }

  .firmware-scope strong {
    font-size: 0.56rem;
  }

  .seed-graph {
    width: 1280px;
    height: 720px;
  }

  .security-advisory {
    min-height: 44px;
    padding: 7px 10px;
  }

  .security-advisory strong,
  .security-advisory-copy > span {
    font-size: 0.57rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition-duration: 0.01ms !important;
  }
}
