:root {
  --text: #9fb7ca;
  --text-h: #f2f8ff;
  --bg: #03070d;
  --panel: rgba(7, 20, 35, 0.74);
  --panel-strong: rgba(7, 24, 44, 0.94);
  --border: rgba(145, 213, 255, 0.22);
  --accent: #35c8ff;
  --accent-soft: rgba(53, 200, 255, 0.16);
  --ice: #e8f7ff;
  --blue: #0e7ee6;
  --shadow: rgba(0, 0, 0, 0.42);

  --sans: system-ui, 'Segoe UI', Roboto, sans-serif;
  --mono: ui-monospace, Consolas, monospace;

  font: 18px/145% var(--sans);
  color-scheme: dark;
  color: var(--text);
  background: var(--bg);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at 50% 0%, rgba(53, 200, 255, 0.2), transparent 34rem),
    radial-gradient(circle at 84% 28%, rgba(14, 126, 230, 0.18), transparent 28rem),
    linear-gradient(180deg, #03070d 0%, #07111f 52%, #03070d 100%);
}

#root {
  min-height: 100svh;
  box-sizing: border-box;
  padding: clamp(1.25rem, 3vw, 2.5rem);
}

#root::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  content: '';
  background:
    linear-gradient(115deg, transparent 0 36%, rgba(255, 255, 255, 0.035) 36% 37%, transparent 37% 100%),
    radial-gradient(circle at 48% 22%, rgba(232, 247, 255, 0.08), transparent 0.18rem);
  background-size: auto, 5.5rem 5.5rem;
  mask-image: linear-gradient(180deg, black, transparent 84%);
}

h1,
h2 {
  font-weight: 800;
  color: var(--text-h);
}

h1 {
  max-width: min(1120px, 100%);
  margin: 0 auto 0.85rem;
  text-align: center;
  font-size: clamp(2.2rem, 4.2vw, 4rem);
  line-height: 1;
  letter-spacing: 0;
}

.zoom-view {
  display: block;
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  animation: zoom-view-enter 300ms ease-in-out;
}

@keyframes zoom-view-enter {
  from {
    opacity: 0;
    transform: scale(0.96);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.zoom-view-locked {
  pointer-events: none;
}

.zoom-node {
  cursor: pointer;
}

.zoom-node-fading {
  animation: zoom-node-fade 300ms ease-in-out forwards;
}

@keyframes zoom-node-fade {
  to {
    opacity: 0;
  }
}

.zoom-box {
  fill: var(--panel);
  stroke: var(--border);
  stroke-width: 1.5;
  transform-origin: center;
  transition:
    fill 0.15s ease,
    stroke 0.15s ease;
}

.zoom-box-hover {
  fill: var(--accent-soft);
  stroke: var(--accent);
}

.zoom-box-exiting {
  animation: zoom-box-exit 300ms ease-in-out forwards;
}

@keyframes zoom-box-exit {
  to {
    transform: scale(2.4);
    opacity: 0;
  }
}

.zoom-label {
  font: 500 16px/1 var(--sans);
  fill: var(--text-h);
  pointer-events: none;
  transform-box: fill-box;
  transform-origin: center;
  animation: label-flip 300ms ease;
}

@keyframes label-flip {
  from {
    transform: scaleY(0);
    opacity: 0;
  }
  to {
    transform: scaleY(1);
    opacity: 1;
  }
}

.zoom-node-badge {
  pointer-events: none;
}

.zoom-badge-circle {
  fill: var(--accent);
}

.zoom-badge-plus {
  font: 700 13px/1 var(--sans);
  fill: #001423;
  pointer-events: none;
}

.zoom-edge {
  stroke: var(--text);
  stroke-width: 1.5;
  opacity: 0.6;
}

.zoom-arrowhead-path {
  fill: var(--text);
  opacity: 0.6;
}

.zoom-edge-label {
  font: 500 12px/1 var(--sans);
  fill: var(--text);
  paint-order: stroke;
  stroke: var(--bg);
  stroke-width: 3px;
}

.system-map-shell {
  width: min(1360px, 100%);
  margin: 1.2rem auto 0;
}

.system-map {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  min-height: 680px;
  margin: 0;
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  background:
    radial-gradient(circle at 42% 36%, rgba(53, 200, 255, 0.16), transparent 32%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.055), transparent 44%),
    rgba(2, 8, 16, 0.74);
  box-shadow: 0 34px 90px var(--shadow);
  animation: zoom-view-enter 300ms ease-in-out;
}

.system-map::before {
  position: absolute;
  inset: 4%;
  content: '';
  border-radius: 999px;
  background: radial-gradient(circle, rgba(53, 200, 255, 0.1), transparent 68%);
  filter: blur(16px);
}

.system-map::after {
  position: absolute;
  inset: auto 0 0;
  height: 34%;
  pointer-events: none;
  content: '';
  background:
    linear-gradient(135deg, transparent 0 36%, rgba(232, 247, 255, 0.12) 36% 38%, transparent 38% 100%),
    linear-gradient(45deg, transparent 0 60%, rgba(53, 200, 255, 0.08) 60% 61%, transparent 61% 100%);
  opacity: 0.55;
}

.system-connections {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}

.system-edge {
  stroke: rgba(113, 215, 255, 0.58);
  stroke-width: 0.16;
  stroke-linecap: round;
  stroke-dasharray: 0.8 1.1;
}

.system-arrowhead-path {
  fill: rgba(113, 215, 255, 0.78);
}

.system-component {
  position: absolute;
  z-index: 2;
  display: grid;
  place-items: center;
  gap: 0.35rem;
  border: 1px solid rgba(145, 213, 255, 0.3);
  border-radius: 10px;
  padding: 0.6rem;
  color: var(--ice);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.12), transparent 42%),
    var(--panel);
  box-shadow:
    inset 0 0 28px rgba(53, 200, 255, 0.08),
    0 16px 42px rgba(0, 0, 0, 0.26);
  font: inherit;
  cursor: pointer;
  transform-origin: center;
  transition:
    border-color 0.16s ease,
    box-shadow 0.16s ease,
    opacity 0.16s ease,
    transform 0.16s ease;
}

.system-component:hover,
.system-component:focus-visible {
  outline: none;
  border-color: rgba(53, 200, 255, 0.84);
  box-shadow:
    inset 0 0 30px rgba(53, 200, 255, 0.14),
    0 0 34px rgba(53, 200, 255, 0.24),
    0 16px 42px rgba(0, 0, 0, 0.32);
  transform: translateY(-2px);
}

.system-component-enterable::before {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  content: '';
  background: radial-gradient(circle at 50% 0%, rgba(53, 200, 255, 0.16), transparent 45%);
}

.system-component-dimmed {
  opacity: 0.22;
}

.system-component-zooming {
  z-index: 5;
  animation: system-component-zoom 320ms ease-in-out forwards;
}

@keyframes system-component-zoom {
  to {
    transform: translateY(-8px) scale(1.52);
    opacity: 0;
    filter: blur(2px);
  }
}

.system-glyph {
  position: relative;
  display: block;
  width: min(72%, 132px);
  min-width: 54px;
  height: 44%;
  min-height: 38px;
}

.system-labels {
  position: relative;
  display: grid;
  gap: 0.1rem;
  text-align: center;
}

.system-label {
  color: var(--ice);
  font: 900 clamp(0.88rem, 1.5vw, 1.18rem)/1 var(--sans);
  letter-spacing: 0.02em;
}

.system-revealed-label {
  color: var(--text);
  font: 700 clamp(0.62rem, 0.95vw, 0.82rem)/1.15 var(--sans);
}

.system-reveal-control {
  position: absolute;
  right: 0.42rem;
  bottom: 0.38rem;
  z-index: 3;
  border: 1px solid rgba(232, 247, 255, 0.18);
  border-radius: 999px;
  padding: 0.16rem 0.38rem;
  color: rgba(232, 247, 255, 0.74);
  background: rgba(3, 7, 13, 0.58);
  font: 800 0.58rem/1 var(--sans);
  text-transform: uppercase;
  opacity: 0.18;
  transition:
    opacity 0.16s ease,
    color 0.16s ease,
    background 0.16s ease;
}

.system-component:hover .system-reveal-control,
.system-component:focus-visible .system-reveal-control,
.system-reveal-control:focus-visible {
  opacity: 1;
}

.system-reveal-control:hover,
.system-reveal-control:focus-visible {
  outline: none;
  color: #001423;
  background: var(--accent);
}

.system-enter-dot {
  position: absolute;
  top: 0.45rem;
  right: 0.45rem;
  width: 0.56rem;
  height: 0.56rem;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 16px rgba(53, 200, 255, 0.72);
}

.system-component-hardware {
  background:
    linear-gradient(180deg, rgba(232, 247, 255, 0.13), transparent 44%),
    rgba(5, 24, 43, 0.86);
}

.system-component-memory {
  background:
    linear-gradient(180deg, rgba(53, 200, 255, 0.15), transparent 48%),
    rgba(2, 28, 55, 0.82);
}

.system-component-software,
.system-component-api {
  border-style: solid;
  background:
    linear-gradient(180deg, rgba(53, 200, 255, 0.12), transparent 44%),
    rgba(6, 18, 34, 0.64);
  backdrop-filter: blur(12px);
}

.system-component-output {
  background:
    linear-gradient(180deg, rgba(232, 247, 255, 0.16), transparent 46%),
    rgba(6, 29, 56, 0.86);
}

.chip-core,
.gpu-board,
.ram-stick,
.ssd-body,
.monitor-screen,
.layer-line,
.generic-node-ring {
  position: absolute;
  border: 1px solid rgba(232, 247, 255, 0.34);
  background: rgba(53, 200, 255, 0.1);
  box-shadow: inset 0 0 18px rgba(53, 200, 255, 0.16);
}

.chip-core {
  inset: 16% 24%;
  border-radius: 8px;
}

.chip-core::before {
  position: absolute;
  inset: 24%;
  border: 1px solid rgba(232, 247, 255, 0.22);
  border-radius: 4px;
  content: '';
}

.chip-trace {
  position: absolute;
  border-color: rgba(53, 200, 255, 0.38);
  border-style: solid;
}

.chip-trace-one {
  inset: 8% 10% 52% 10%;
  border-width: 0 1px 1px;
}

.chip-trace-two {
  inset: 52% 12% 8% 12%;
  border-width: 1px 1px 0;
}

.chip-pins {
  position: absolute;
  left: 14%;
  right: 14%;
  height: 4px;
  background: repeating-linear-gradient(90deg, rgba(232, 247, 255, 0.42) 0 6px, transparent 6px 12px);
}

.chip-pins-top {
  top: 2px;
}

.chip-pins-bottom {
  bottom: 2px;
}

.gpu-board {
  inset: 16% 4%;
  border-radius: 8px;
}

.gpu-pcie {
  position: absolute;
  left: 14%;
  right: 14%;
  bottom: 12%;
  height: 7%;
  border-radius: 2px;
  background: repeating-linear-gradient(90deg, rgba(232, 247, 255, 0.48) 0 8px, transparent 8px 14px);
}

.gpu-chip {
  position: absolute;
  top: 31%;
  left: 41%;
  width: 18%;
  height: 30%;
  border: 1px solid rgba(232, 247, 255, 0.34);
  border-radius: 5px;
  background: rgba(4, 16, 30, 0.72);
  box-shadow: inset 0 0 14px rgba(53, 200, 255, 0.18);
}

.gpu-fan {
  position: absolute;
  top: 29%;
  width: 22%;
  aspect-ratio: 1;
  border: 2px solid rgba(232, 247, 255, 0.36);
  border-radius: 999px;
  background: radial-gradient(circle, rgba(232, 247, 255, 0.42) 0 12%, transparent 13% 100%);
}

.gpu-fan-one {
  left: 13%;
}

.gpu-fan-two {
  right: 13%;
}

.gpu-memory,
.gpu-cap {
  position: absolute;
  border-radius: 3px;
  background: rgba(232, 247, 255, 0.28);
}

.gpu-memory {
  top: 23%;
  width: 10%;
  height: 13%;
}

.gpu-memory-one {
  left: 36%;
}

.gpu-memory-two {
  right: 36%;
}

.gpu-cap {
  bottom: 28%;
  width: 5%;
  aspect-ratio: 1;
  border-radius: 999px;
}

.gpu-cap-one {
  left: 36%;
}

.gpu-cap-two {
  right: 36%;
}

.ram-stick {
  inset: 30% 4%;
  border-radius: 999px;
}

.ram-fingers {
  position: absolute;
  left: 10%;
  right: 10%;
  bottom: 24%;
  height: 7%;
  border-radius: 999px;
  background: repeating-linear-gradient(90deg, rgba(232, 247, 255, 0.5) 0 7px, transparent 7px 12px);
}

.ram-block {
  position: absolute;
  top: 38%;
  width: 16%;
  height: 24%;
  border-radius: 3px;
  background: rgba(232, 247, 255, 0.28);
}

.ram-block-one {
  left: 18%;
}

.ram-block-two {
  left: 42%;
}

.ram-block-three {
  right: 18%;
}

.ssd-body {
  inset: 18% 12%;
  border-radius: 8px;
}

.ssd-dot {
  position: absolute;
  right: 22%;
  top: 38%;
  width: 11px;
  height: 11px;
  border-radius: 999px;
  background: var(--accent);
}

.monitor-screen {
  inset: 8% 12% 26%;
  border-radius: 7px;
}

.monitor-stand {
  position: absolute;
  left: 38%;
  right: 38%;
  bottom: 10%;
  height: 16%;
  border-radius: 999px;
  background: rgba(232, 247, 255, 0.32);
}

.layer-line {
  left: 12%;
  right: 12%;
  height: 18%;
  border-radius: 999px;
}

.layer-line-one {
  top: 18%;
}

.layer-line-two {
  top: 42%;
}

.layer-line-three {
  top: 66%;
}

.generic-node-dot {
  position: absolute;
  inset: 36%;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 22px rgba(53, 200, 255, 0.68);
}

.generic-node-ring {
  inset: 20%;
  border-radius: 999px;
}

.system-flow-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-top: 0.8rem;
  color: var(--text);
  font: 700 0.78rem/1 var(--mono);
}

.system-flow-title {
  color: var(--ice);
  margin-right: 0.2rem;
}

.system-flow-item {
  display: inline-flex;
  gap: 0.28rem;
  align-items: center;
  border: 1px solid rgba(145, 213, 255, 0.16);
  border-radius: 999px;
  padding: 0.38rem 0.55rem;
  background: rgba(7, 20, 35, 0.55);
}

.system-flow-item strong {
  color: var(--accent);
  font-weight: 850;
}

.timeline-view {
  display: block;
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  animation: zoom-view-enter 300ms ease-in-out;
}

.timeline-list {
  position: relative;
  list-style: none;
  margin: 0;
  padding: 0;
}

.timeline-list::before {
  content: '';
  position: absolute;
  left: 5px;
  top: 10px;
  bottom: 10px;
  width: 2px;
  background: var(--border);
}

.timeline-item {
  position: relative;
  padding-left: 28px;
  padding-bottom: 32px;
}

.timeline-item:last-child {
  padding-bottom: 0;
}

.timeline-dot {
  position: absolute;
  left: 0;
  top: 4px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--accent);
  pointer-events: none;
}

.timeline-row {
  cursor: pointer;
}

.timeline-row:hover .timeline-label {
  color: var(--accent);
}

.timeline-year {
  display: block;
  font: 600 13px/1 var(--mono);
  color: var(--accent);
  margin-bottom: 4px;
}

.timeline-label {
  margin: 0 0 4px;
  font: 500 17px/1.3 var(--sans);
  color: var(--text-h);
  transition: color 0.15s ease;
}

.timeline-description {
  margin: 0;
  color: var(--text);
}

.frame-timeline-view {
  display: block;
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  animation: zoom-view-enter 300ms ease-in-out;
}

.frame-timeline-columns {
  display: flex;
  gap: 32px;
  justify-content: center;
}

.frame-column {
  flex: 1;
  min-width: 0;
}

.frame-column-label {
  margin: 0;
  font-weight: 500;
  color: var(--text-h);
  text-align: center;
}

.frame-column-number {
  display: block;
  font: 700 28px/1 var(--mono);
  color: var(--accent);
  margin: 4px 0 16px;
  text-align: center;
}

.frame-stage-list {
  position: relative;
  list-style: none;
  margin: 0;
  padding: 0;
}

.frame-stage-item {
  padding-bottom: 8px;
}

.frame-stage-item:not(:last-child)::after {
  content: '↓';
  display: block;
  text-align: center;
  color: var(--border);
  margin: 2px 0;
}

.frame-stage-row {
  cursor: pointer;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  transition:
    border-color 0.15s ease,
    background 0.15s ease,
    color 0.15s ease;
}

.frame-stage-row:hover {
  border-color: var(--accent);
}

.frame-stage-row:hover .frame-stage-label {
  color: var(--accent);
}

/* Stage currently being worked on during playback. */
.frame-stage-row--active {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 14%, transparent);
}

.frame-stage-row--active .frame-stage-label {
  color: var(--accent);
  font-weight: 600;
}

.frame-stage-label {
  color: var(--text-h);
  font-weight: 500;
}

.frame-timeline-caption {
  margin-top: 24px;
  text-align: center;
  color: var(--text);
}

/* --- Animation controls --- */

.frame-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-bottom: 28px;
}

.frame-play-btn {
  font: 500 15px/1 var(--sans);
  color: var(--text-h);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 18px;
  cursor: pointer;
  transition:
    border-color 0.15s ease,
    color 0.15s ease;
}

.frame-play-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.frame-speed-group {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.frame-speed-btn {
  font: 500 14px/1 var(--sans);
  color: var(--text);
  background: transparent;
  border: none;
  padding: 9px 14px;
  cursor: pointer;
  transition:
    background 0.15s ease,
    color 0.15s ease;
}

.frame-speed-btn:not(:last-child) {
  border-right: 1px solid var(--border);
}

.frame-speed-btn:hover {
  color: var(--accent);
}

.frame-speed-btn--active {
  background: var(--accent);
  color: #001423;
}

/* --- Component illustrations --- */

.component-art {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
}

.component-art-svg {
  /* Fixed height keeps the CPU and GPU column headers vertically aligned,
     even though the two illustrations have different aspect ratios. */
  height: 76px;
  width: auto;
  display: block;
}

.component-art-model {
  font: 600 12px/1 var(--mono);
  color: var(--text);
  letter-spacing: 0.02em;
}

.component-art-pin {
  stroke: var(--text);
  stroke-width: 3;
  stroke-linecap: round;
  opacity: 0.5;
}

.component-art-substrate {
  fill: var(--border);
  stroke: var(--text);
  stroke-opacity: 0.35;
  stroke-width: 1.5;
}

.component-art-lid {
  fill: var(--bg);
  stroke: var(--text);
  stroke-opacity: 0.4;
  stroke-width: 1.5;
}

.component-art-notch {
  fill: var(--text);
  opacity: 0.4;
}

.component-art-pcb {
  fill: var(--border);
}

.component-art-shroud {
  fill: var(--bg);
  stroke: var(--text);
  stroke-opacity: 0.4;
  stroke-width: 1.5;
}

.component-art-fan-ring {
  fill: none;
  stroke: var(--text);
  stroke-opacity: 0.4;
  stroke-width: 1.5;
}

.component-art-spoke {
  stroke: var(--text);
  stroke-opacity: 0.3;
  stroke-width: 1.5;
}

.component-art-fan-hub {
  fill: var(--text);
  opacity: 0.5;
}

.breadcrumb {
  display: flex;
  gap: 4px;
  align-items: center;
  max-width: 900px;
  margin: 0 auto 16px;
  font: 500 15px/1 var(--sans);
}

.breadcrumb-item {
  background: none;
  border: none;
  padding: 4px 2px;
  cursor: pointer;
  color: var(--text);
  font: inherit;
}

.breadcrumb-item:hover:not(:disabled) {
  color: var(--accent);
}

.breadcrumb-item:disabled {
  color: var(--text-h);
  cursor: default;
}

.breadcrumb-sep {
  color: var(--border);
  margin: 0 2px;
}

.node-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: min(360px, 90vw);
  height: 100svh;
  box-sizing: border-box;
  padding: 32px 24px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), transparent 32%),
    rgba(3, 7, 13, 0.96);
  border-left: 1px solid var(--border);
  text-align: left;
  overflow-y: auto;
  box-shadow: -18px 0 70px rgba(0, 0, 0, 0.42);
}

.node-panel-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: none;
  color: var(--text-h);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.node-panel-details {
  color: var(--text);
}

.node-panel-label {
  animation: label-flip 300ms ease;
}

.reveal-button {
  display: block;
  margin-top: 16px;
  padding: 8px 14px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: none;
  color: var(--accent);
  font: 500 14px/1 var(--sans);
  cursor: pointer;
}

.reveal-button:hover {
  background: var(--accent);
  color: #001423;
}

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

@media (max-width: 820px) {
  #root {
    padding: 1rem;
  }

  .system-map-shell {
    width: 1120px;
    max-width: none;
    margin-inline: 0;
  }

  .system-map {
    min-height: 640px;
  }

  body {
    overflow-x: auto;
  }

  .breadcrumb,
  h1 {
    width: min(1120px, calc(100vw - 2rem));
  }
}

@media (max-width: 520px) {
  h1 {
    text-align: left;
  }

  .system-label {
    font-size: 0.86rem;
  }

  .system-revealed-label {
    font-size: 0.62rem;
  }
}


.back-link {
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 20;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  padding: 0.6rem 0.85rem;
  color: #e8f7ff;
  background: rgba(4, 12, 24, 0.72);
  text-decoration: none;
  font-weight: 800;
  backdrop-filter: blur(12px);
}
