:root {
  --bg: #050505;
  --panel: rgba(18, 18, 18, 0.72);
  --line: rgba(255, 255, 255, 0.1);
  --text: #e9e9e6;
  --muted: #8a8a86;
  --accent: #ffffff;
  --ok: #7ee2a8;
  --run: #f1c96b;
  --todo: #e88a7a;
  --mono: ui-monospace, "SF Mono", "Cascadia Code", "JetBrains Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--mono);
  font-size: 15px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

#field {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

.topbar,
main,
.footer {
  position: relative;
  z-index: 1;
}

a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid var(--line);
}

a:hover {
  border-bottom-color: var(--accent);
}

.dim {
  color: var(--muted);
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1040px;
  margin: 0 auto;
  padding: 24px;
}

.brand {
  border: 0;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.topbar nav {
  display: flex;
  gap: 20px;
  font-size: 13px;
}

.topbar nav a {
  border: 0;
  color: var(--muted);
}

.topbar nav a:hover {
  color: var(--accent);
}

main {
  max-width: 1040px;
  margin: 0 auto;
  padding: 0 24px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(180px, 320px) 1fr;
  gap: 56px;
  align-items: center;
  min-height: calc(100vh - 90px);
  padding: 24px 0 72px;
}

.logo {
  width: 100%;
  height: auto;
  filter: drop-shadow(0 0 40px rgba(255, 255, 255, 0.08));
}

.comment,
.label {
  color: var(--muted);
  font-size: 13px;
  margin: 0 0 16px;
}

h1,
h2 {
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.25;
  margin: 0 0 20px;
}

h1 {
  font-size: clamp(28px, 4.2vw, 44px);
}

h2 {
  font-size: clamp(22px, 3vw, 30px);
  max-width: 28ch;
}

.lede {
  color: #c4c4c0;
  max-width: 60ch;
}

.prompt {
  margin-top: 28px;
  color: var(--accent);
}

.cursor {
  display: inline-block;
  width: 0.6em;
  height: 1.1em;
  margin-left: 4px;
  vertical-align: text-bottom;
  background: var(--accent);
  animation: blink 1.1s steps(1) infinite;
}

@keyframes blink {
  50% {
    opacity: 0;
  }
}

.block {
  padding: 72px 0;
  border-top: 1px solid var(--line);
}

.block > p {
  max-width: 70ch;
  color: #c4c4c0;
}

.stages {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  margin: 36px 0;
  background: var(--line);
  border: 1px solid var(--line);
}

.stage {
  background: var(--panel);
  backdrop-filter: blur(4px);
  padding: 22px;
}

.stage p {
  margin: 0;
  font-size: 13px;
  color: #b4b4b0;
}

.stage .fn {
  font-size: 16px;
  color: var(--accent);
  margin-bottom: 10px;
}

.note {
  font-size: 13px;
  color: var(--muted) !important;
}

.code {
  margin: 32px 0;
  padding: 24px;
  overflow-x: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1.8;
}

.kw {
  color: #9fb4ff;
}

.fn-name {
  color: var(--accent);
  font-weight: 600;
}

.status {
  list-style: none;
  padding: 0;
  margin: 28px 0 0;
  max-width: 80ch;
}

.status li {
  padding: 10px 0;
  border-bottom: 1px dashed var(--line);
  color: #c4c4c0;
}

.status span {
  display: inline-block;
  width: 10ch;
}

.ok {
  color: var(--ok);
}

.run {
  color: var(--run);
}

.todo {
  color: var(--todo);
}

.signal {
  display: grid;
  grid-template-columns: minmax(260px, 440px) 1fr;
  gap: 48px;
  align-items: center;
  margin: 36px 0 24px;
}

#globe {
  width: 100%;
  aspect-ratio: 1;
  cursor: grab;
  touch-action: pan-y;
}

.signal-stat {
  margin: 0 0 28px;
  font-size: clamp(36px, 6vw, 56px);
  font-weight: 600;
  color: var(--run);
  line-height: 1;
}

.signal-top {
  list-style: none;
  padding: 0;
  margin: 0 0 20px;
  font-size: 13px;
}

.signal-top li {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px dashed var(--line);
}

.influences-label {
  margin: 40px 0 12px;
}

.matrix-wrap {
  overflow-x: auto;
  margin-bottom: 24px;
  background: var(--panel);
  border: 1px solid var(--line);
}

.matrix {
  display: grid;
  grid-template-columns: 210px repeat(7, minmax(64px, 1fr));
  grid-template-rows: auto repeat(6, 54px);
  min-width: 700px;
  padding: 20px 20px 16px;
}

/* each stage label spans every row so its left border draws a column guide */
.m-stage {
  grid-row: 1 / -1;
  border-left: 1px solid var(--line);
  padding-bottom: 14px;
  text-align: center;
  font-size: 12px;
  color: var(--accent);
}

.m-name {
  grid-column: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  font-size: 13px;
  line-height: 1.4;
  border-top: 1px dashed var(--line);
}

.m-name span:last-child {
  font-size: 11px;
  color: var(--muted);
}

.m-ant strong {
  letter-spacing: 0.2em;
}

.m-bar {
  position: relative;
  z-index: 1;
  align-self: center;
  height: 10px;
  margin: 0 8px;
  background: rgba(255, 255, 255, 0.55);
  clip-path: polygon(5px 0, calc(100% - 5px) 0, 100% 50%, calc(100% - 5px) 100%, 5px 100%, 0 50%);
}

.m-bar-ant {
  height: 16px;
  background: var(--accent);
  clip-path: polygon(8px 0, calc(100% - 8px) 0, 100% 50%, calc(100% - 8px) 100%, 8px 100%, 0 50%);
}

.r2 { grid-row: 2; }
.r3 { grid-row: 3; }
.r4 { grid-row: 4; }
.r5 { grid-row: 5; }
.r6 { grid-row: 6; }
.r7 { grid-row: 7; }

.s2 { grid-column-start: 2; }
.s3 { grid-column-start: 3; }
.s4 { grid-column-start: 4; }
.s5 { grid-column-start: 5; }
.s6 { grid-column-start: 6; }
.s7 { grid-column-start: 7; }
.s8 { grid-column-start: 8; }

.e3 { grid-column-end: 3; }
.e4 { grid-column-end: 4; }
.e5 { grid-column-end: 5; }
.e6 { grid-column-end: 6; }
.e7 { grid-column-end: 7; }
.e9 { grid-column-end: 9; }

.footer {
  max-width: 1040px;
  margin: 0 auto;
  padding: 40px 24px 56px;
  border-top: 1px solid var(--line);
  font-size: 13px;
}

.footer p {
  margin: 4px 0;
}

@media (max-width: 860px) {
  .stages {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  body {
    font-size: 14px;
  }

  .topbar {
    padding: 18px 16px;
  }

  .topbar nav {
    display: none;
  }

  main {
    padding: 0 16px;
  }

  .hero {
    grid-template-columns: 1fr;
    gap: 28px;
    min-height: auto;
    padding-top: 32px;
  }

  .logo {
    width: 160px;
  }

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

  .block {
    padding: 56px 0;
  }

  .signal {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .matrix {
    grid-template-columns: 150px repeat(7, minmax(56px, 1fr));
    min-width: 580px;
    padding: 16px;
  }

  .footer {
    padding: 32px 16px 44px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .cursor {
    animation: none;
  }
}
