:root {
  --bg: #070707;
  --ink: #0d0d0d;
  --panel: #111111;
  --panel-2: #171717;
  --paper: #f1eee7;
  --paper-dim: #c9c1b6;
  --muted: #8b8580;
  --line: #d8d0c5;
  --line-dark: #34302d;
  --red: #ff2a2f;
  --red-soft: rgba(255, 42, 47, 0.16);
  --white-soft: rgba(241, 238, 231, 0.08);
  --shadow: 10px 10px 0 #000;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 70% 18%, rgba(255, 42, 47, 0.1), transparent 28rem),
    linear-gradient(rgba(241, 238, 231, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(241, 238, 231, 0.035) 1px, transparent 1px),
    var(--bg);
  background-size: auto, 38px 38px, 38px 38px, auto;
  color: var(--paper);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.5));
}

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

button,
textarea,
input {
  font: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: 268px minmax(0, 1fr);
  min-height: 100vh;
}

.side-rail {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  border-right: 2px solid var(--line);
  background: #0b0b0b;
  padding: 24px;
}

.rail-logo {
  display: grid;
  gap: 8px;
  min-height: 132px;
  border-bottom: 1px dashed var(--muted);
}

.dot-logo {
  color: var(--paper);
  font-family: "Courier New", ui-monospace, monospace;
  font-size: 30px;
  font-weight: 900;
  line-height: 0.92;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.dot-logo span {
  color: var(--red);
}

.rail-version,
.micro,
.section-kicker,
.label,
.time-code,
.card-label {
  font-family: "Courier New", ui-monospace, monospace;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.rail-version {
  color: var(--muted);
  font-size: 12px;
}

.rail-nav {
  display: grid;
  gap: 10px;
  margin-top: 34px;
}

.rail-nav a {
  position: relative;
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 12px;
  align-items: center;
  min-height: 58px;
  border: 1px solid transparent;
  padding: 10px 12px;
  color: var(--paper);
}

.rail-nav a:hover,
.rail-nav a.active {
  border-color: var(--line);
  background: #050505;
}

.rail-nav a.active::after {
  content: "";
  position: absolute;
  right: 14px;
  width: 7px;
  height: 7px;
  background: var(--red);
}

.nav-icon {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--paper);
  font-family: "Courier New", ui-monospace, monospace;
  font-size: 13px;
  font-weight: 800;
}

.rail-nav strong {
  display: block;
  font-family: "Courier New", ui-monospace, monospace;
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.rail-nav span:last-child {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-family: "Courier New", ui-monospace, monospace;
  font-size: 11px;
}

.rail-footer {
  display: grid;
  gap: 18px;
  margin-top: auto;
}

.system-card,
.profile-card {
  border: 1px solid var(--line-dark);
  background: #101010;
  padding: 16px;
}

.signal-bars {
  display: flex;
  gap: 4px;
  margin: 14px 0 10px;
}

.signal-bars span {
  width: 5px;
  height: 22px;
  background: var(--line-dark);
}

.signal-bars span:nth-child(-n + 8) {
  background: var(--red);
  animation: pulseBar 1.4s ease-in-out infinite;
}

.profile-row {
  display: grid;
  grid-template-columns: 52px 1fr;
  gap: 12px;
  align-items: center;
}

.avatar-box {
  display: grid;
  width: 52px;
  height: 52px;
  place-items: center;
  border: 1px solid var(--line);
  color: var(--paper);
  font-family: "Courier New", ui-monospace, monospace;
  font-weight: 800;
}

.main-board {
  min-width: 0;
  padding: 18px 18px 56px;
}

.top-strip {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 64px;
  border: 1px solid var(--line-dark);
  background: rgba(11, 11, 11, 0.92);
  backdrop-filter: blur(16px);
  padding: 0 16px;
}

.top-left,
.top-links {
  display: flex;
  align-items: center;
  gap: 12px;
}

.wf-mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid var(--red);
  color: var(--red);
  font-family: "Courier New", ui-monospace, monospace;
  font-weight: 900;
}

.top-title {
  color: var(--paper);
  font-family: "Courier New", ui-monospace, monospace;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.top-subtitle {
  color: var(--muted);
  font-family: "Courier New", ui-monospace, monospace;
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.top-links a {
  border: 1px solid transparent;
  padding: 10px 12px;
  color: var(--paper-dim);
  font-family: "Courier New", ui-monospace, monospace;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.top-links a:hover,
.top-links a.active {
  border-color: var(--line);
  color: var(--red);
}

.page-title {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(300px, 0.5fr);
  gap: 22px;
  align-items: end;
  padding: 28px 0 20px;
}

.progression-title {
  grid-template-columns: 1fr;
}

.section-kicker {
  display: block;
  margin-bottom: 10px;
  color: var(--red);
  font-size: 13px;
  font-weight: 900;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  max-width: 900px;
  font-size: clamp(44px, 7.6vw, 104px);
  font-weight: 900;
  line-height: 0.88;
  letter-spacing: -0.04em;
  text-transform: uppercase;
}

.page-title p {
  margin: 0;
  color: var(--paper-dim);
  font-size: 18px;
  line-height: 1.55;
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border: 1px solid var(--line-dark);
  background: rgba(17, 17, 17, 0.9);
}

.status-grid div {
  min-height: 100px;
  border: 1px solid var(--line-dark);
  padding: 16px;
}

.status-grid strong {
  display: block;
  color: var(--paper);
  font-family: "Courier New", ui-monospace, monospace;
  font-size: 34px;
}

.status-grid span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.demo-layout {
  display: grid;
  grid-template-columns: minmax(320px, 0.82fr) minmax(420px, 1fr) minmax(300px, 0.58fr);
  gap: 16px;
  align-items: stretch;
}

.panel,
.story-section,
.phase,
.visual-card {
  min-width: 0;
  border: 1px solid var(--line-dark);
  background: rgba(17, 17, 17, 0.95);
}

.panel {
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.6);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 54px;
  border-bottom: 1px solid var(--line-dark);
  padding: 0 14px;
}

.panel-header h2,
.panel-header h3 {
  margin: 0;
  color: var(--red);
  font-family: "Courier New", ui-monospace, monospace;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.index {
  margin-right: 8px;
}

.panel-body {
  padding: 14px;
}

.sample-row,
.input-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.sample-row {
  margin-bottom: 12px;
}

.primary,
.ghost,
.file-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border: 1px solid var(--line-dark);
  background: #0d0d0d;
  color: var(--paper);
  padding: 0 14px;
  font-family: "Courier New", ui-monospace, monospace;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
}

.primary {
  border-color: var(--red);
  background: var(--red);
  color: #fff;
  box-shadow: 6px 6px 0 #000;
}

.ghost:hover,
.file-label:hover {
  border-color: var(--paper);
}

.primary:hover {
  transform: translate(-2px, -2px);
  box-shadow: 8px 8px 0 #000;
}

.context-input {
  width: 100%;
  min-height: 282px;
  resize: vertical;
  border: 1px dashed var(--muted);
  outline: none;
  background: #0a0a0a;
  color: var(--paper);
  padding: 18px;
  font-family: "Courier New", ui-monospace, monospace;
  font-size: 14px;
  line-height: 1.65;
}

.context-input:focus {
  border-color: var(--red);
}

.file-input {
  display: none;
}

.input-actions {
  justify-content: space-between;
  margin-top: 12px;
}

.orbit-stage {
  position: relative;
  min-height: 398px;
  overflow: hidden;
  border: 1px solid var(--line-dark);
  background:
    radial-gradient(circle at center, rgba(255, 42, 47, 0.14), transparent 7rem),
    #0a0a0a;
}

.orbit-stage::before,
.orbit-stage::after {
  content: "";
  position: absolute;
  inset: 54px 42px;
  border: 1px dashed rgba(241, 238, 231, 0.32);
  border-radius: 50%;
  animation: orbitSpin 18s linear infinite;
}

.orbit-stage::after {
  inset: 90px 110px;
  animation-direction: reverse;
}

.orbit-line {
  position: absolute;
  top: 50%;
  left: 10%;
  right: 10%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--red), transparent);
}

.orbit-node {
  position: absolute;
  z-index: 2;
  display: grid;
  width: 92px;
  height: 92px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #0d0d0d;
  color: var(--paper);
  box-shadow: 0 0 22px rgba(255, 42, 47, 0.18);
}

.orbit-node.red {
  border-color: var(--red);
  color: var(--red);
  animation: redPulse 1.9s ease-in-out infinite;
}

.orbit-node strong {
  font-family: "Courier New", ui-monospace, monospace;
  font-size: 18px;
}

.node-1 { left: 7%; top: 45%; }
.node-2 { left: 27%; top: 45%; }
.node-3 { left: 48%; top: 38%; width: 120px; height: 120px; }
.node-4 { right: 25%; top: 45%; }
.node-5 { right: 7%; top: 45%; }

.node-caption {
  position: absolute;
  z-index: 2;
  top: calc(45% + 104px);
  width: 132px;
  transform: translateX(-20px);
  text-align: center;
  color: var(--paper);
  font-family: "Courier New", ui-monospace, monospace;
  font-size: 12px;
  text-transform: uppercase;
}

.caption-1 { left: 7%; }
.caption-2 { left: 27%; }
.caption-3 { left: 48%; }
.caption-4 { right: calc(25% - 32px); }
.caption-5 { right: calc(7% - 32px); }

.node-caption small {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 10px;
  text-transform: none;
}

.real-time {
  position: absolute;
  right: 16px;
  bottom: 14px;
  color: var(--muted);
  font-family: "Courier New", ui-monospace, monospace;
  font-size: 11px;
}

.real-time::after {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-left: 8px;
  background: var(--red);
  border-radius: 50%;
  animation: redPulse 1s infinite;
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  border: 1px solid var(--line-dark);
  margin-bottom: 12px;
}

.result-card {
  min-height: 96px;
  border-right: 1px solid var(--line-dark);
  padding: 14px;
}

.result-card:last-child {
  border-right: 0;
}

.result-card small {
  display: block;
  margin-bottom: 12px;
  color: var(--red);
  font-family: "Courier New", ui-monospace, monospace;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.result-card strong {
  color: var(--paper);
  font-family: "Courier New", ui-monospace, monospace;
  font-size: 38px;
}

.muted {
  color: var(--paper-dim);
  line-height: 1.6;
}

.list {
  display: grid;
  gap: 9px;
}

.item {
  position: relative;
  border: 1px solid var(--line-dark);
  background: #0d0d0d;
  padding: 12px;
}

.item::before {
  content: "";
  position: absolute;
  left: -1px;
  top: -1px;
  width: 4px;
  height: calc(100% + 2px);
  background: var(--red);
}

.item strong {
  display: block;
  margin-bottom: 7px;
  color: var(--paper);
  font-size: 14px;
  line-height: 1.25;
}

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

.opportunity-stack {
  max-height: 520px;
  overflow: auto;
  padding-right: 4px;
}

.score-line {
  display: grid;
  grid-template-columns: 82px 1fr 38px;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  color: var(--muted);
  font-family: "Courier New", ui-monospace, monospace;
  font-size: 10px;
}

.bar {
  height: 6px;
  background: #302b28;
}

.bar span {
  display: block;
  height: 100%;
  background: var(--red);
}

.explain-strip,
.proto-grid,
.content-grid,
.progress-slab-grid {
  display: grid;
  gap: 14px;
}

.explain-strip {
  grid-template-columns: repeat(6, minmax(0, 1fr));
  margin-top: 16px;
}

.visual-card {
  min-height: 186px;
  padding: 16px;
  transition: transform 220ms ease, border-color 220ms ease;
}

.visual-card:hover {
  transform: translateY(-4px);
  border-color: var(--red);
}

.visual-card h3 {
  margin: 10px 0 8px;
  color: var(--paper);
  font-size: 15px;
  text-transform: uppercase;
}

.visual-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.mini-chaos,
.mini-map,
.mini-bars,
.mini-flow,
.mini-docs,
.mini-memory {
  height: 66px;
  border: 1px dashed var(--line-dark);
  background: #0a0a0a;
}

.mini-chaos {
  background:
    radial-gradient(circle at 24% 28%, var(--red) 0 3px, transparent 4px),
    radial-gradient(circle at 55% 55%, var(--red) 0 3px, transparent 4px),
    radial-gradient(circle at 75% 22%, var(--paper) 0 2px, transparent 3px),
    #0a0a0a;
}

.mini-map,
.mini-flow {
  position: relative;
}

.mini-map::before,
.mini-flow::before {
  content: "";
  position: absolute;
  inset: 20px 18px;
  border-top: 1px solid var(--red);
}

.mini-map::after,
.mini-flow::after {
  content: "";
  position: absolute;
  left: 18px;
  right: 18px;
  top: 16px;
  height: 14px;
  background: linear-gradient(90deg, var(--paper) 0 16%, transparent 16% 34%, var(--red) 34% 48%, transparent 48% 68%, var(--paper) 68% 86%, transparent 86%);
}

.mini-bars {
  background:
    linear-gradient(90deg, var(--red) 0 18%, transparent 18% 24%, var(--red) 24% 35%, transparent 35% 48%, var(--paper) 48% 70%, transparent 70%),
    #0a0a0a;
  background-size: 100% 8px, auto;
  background-position: center;
  background-repeat: no-repeat;
}

.mini-docs {
  background:
    linear-gradient(90deg, transparent 20%, var(--paper) 20% 33%, transparent 33% 43%, var(--paper) 43% 56%, transparent 56% 66%, var(--paper) 66% 79%, transparent 79%),
    #0a0a0a;
}

.mini-memory {
  border-color: var(--red);
  background:
    radial-gradient(circle at 50% 50%, transparent 0 18px, var(--red) 19px 20px, transparent 21px),
    radial-gradient(circle at 50% 50%, transparent 0 32px, rgba(241,238,231,.5) 33px 34px, transparent 35px),
    #0a0a0a;
}

.diagram-panel,
.prototype-panel,
.purpose-panel {
  margin-top: 16px;
}

.mermaid-wrap {
  overflow: auto;
  border: 1px dashed var(--line-dark);
  background: #0a0a0a;
  padding: 16px;
}

.mermaid {
  min-width: 620px;
}

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

.story-section {
  padding: 18px;
}

.story-section h2 {
  margin-bottom: 10px;
  color: var(--paper);
  font-size: 24px;
  line-height: 1.08;
  text-transform: uppercase;
}

.story-section p,
.story-section li {
  color: var(--paper-dim);
  line-height: 1.6;
}

.story-section ul {
  margin: 12px 0 0;
  padding-left: 18px;
}

.code-block {
  overflow: auto;
  border: 1px dashed var(--line-dark);
  background: #070707;
  color: var(--paper);
  padding: 14px;
  font-family: "Courier New", ui-monospace, monospace;
  font-size: 12px;
  line-height: 1.6;
}

.content-grid {
  grid-template-columns: minmax(0, 1fr) minmax(300px, 0.42fr);
  padding-top: 4px;
}

.timeline {
  display: grid;
  gap: 14px;
}

.phase {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr) 142px;
  gap: 18px;
  align-items: stretch;
  min-height: 142px;
}

.phase-number {
  display: grid;
  place-items: center;
  border-right: 1px solid var(--line-dark);
  color: var(--red);
  font-family: "Courier New", ui-monospace, monospace;
  font-size: 28px;
  font-weight: 900;
}

.phase-main {
  padding: 18px 0;
}

.phase-main h2 {
  margin-bottom: 10px;
  font-size: 26px;
  line-height: 1.05;
}

.phase-main p {
  margin-bottom: 0;
  color: var(--paper-dim);
  line-height: 1.55;
}

.phase-notes {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.phase-notes span {
  border: 1px solid var(--line-dark);
  background: rgba(255, 255, 255, 0.03);
  color: var(--paper-dim);
  padding: 7px 9px;
  font-size: 12px;
}

.phase-status {
  display: grid;
  place-items: center;
  border-left: 1px solid var(--line-dark);
  color: var(--red);
  font-family: "Courier New", ui-monospace, monospace;
  font-size: 14px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.phase.next .phase-status {
  background: var(--red);
  color: #fff;
}

.progress-slab-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.slab {
  border: 1px solid var(--line-dark);
  padding: 16px;
  min-height: 142px;
}

.slab strong {
  display: block;
  margin-bottom: 10px;
  font-size: 34px;
}

.progress-track {
  position: relative;
  height: 16px;
  border: 1px solid var(--line-dark);
  margin-top: 18px;
}

.progress-track span {
  display: block;
  height: 100%;
  background: var(--red);
}

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

.purpose-step {
  position: relative;
  border: 1px solid var(--line-dark);
  padding: 16px;
  min-height: 178px;
}

.purpose-step:not(:last-child)::after {
  content: ">>";
  position: absolute;
  right: -18px;
  top: 50%;
  color: var(--red);
  font-family: "Courier New", ui-monospace, monospace;
  font-weight: 900;
}

.purpose-step h2 {
  font-size: 20px;
}

.footer {
  margin-top: 18px;
  border: 1px solid var(--line-dark);
  padding: 18px;
  color: var(--muted);
  font-family: "Courier New", ui-monospace, monospace;
  font-size: 12px;
}

@keyframes pulseBar {
  0%, 100% { opacity: 0.55; }
  50% { opacity: 1; }
}

@keyframes redPulse {
  0%, 100% { box-shadow: 0 0 0 rgba(255, 42, 47, 0); }
  50% { box-shadow: 0 0 34px rgba(255, 42, 47, 0.5); }
}

@keyframes orbitSpin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}

@media (max-width: 1500px) {
  .app-shell {
    grid-template-columns: 236px minmax(0, 1fr);
  }

  .side-rail {
    padding: 18px;
  }

  .demo-layout {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }

  .demo-layout > .panel:nth-child(3) {
    grid-column: 1 / -1;
  }

  .node-caption {
    display: none;
  }
}

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

  .side-rail {
    position: relative;
    height: auto;
    border-right: 0;
    border-bottom: 2px solid var(--line);
  }

  .rail-nav {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .rail-footer {
    display: none;
  }

  .demo-layout,
  .page-title,
  .content-grid {
    grid-template-columns: 1fr;
  }

  .explain-strip,
  .proto-grid,
  .purpose-map {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .main-board {
    padding: 10px;
  }

  .top-strip,
  .top-left,
  .top-links {
    align-items: flex-start;
    flex-direction: column;
  }

  .top-strip {
    position: relative;
    padding: 14px;
  }

  .top-links {
    width: 100%;
  }

  .top-links a,
  .rail-nav a {
    width: 100%;
  }

  .rail-nav,
  .status-grid,
  .result-grid,
  .explain-strip,
  .proto-grid,
  .progress-slab-grid,
  .purpose-map {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: 42px;
    line-height: 0.95;
  }

  .demo-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .orbit-stage {
    min-height: 520px;
  }

  .orbit-node {
    width: 74px;
    height: 74px;
  }

  .node-1 { left: 8%; top: 18%; }
  .node-2 { left: 58%; top: 18%; }
  .node-3 { left: 32%; top: 38%; width: 96px; height: 96px; }
  .node-4 { left: 8%; right: auto; top: 68%; }
  .node-5 { right: 8%; top: 68%; }

  .node-caption {
    display: none;
  }

  .phase {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .phase-number,
  .phase-status {
    min-height: 54px;
    border: 0;
    border-bottom: 1px solid var(--line-dark);
  }

  .phase-main {
    padding: 18px;
  }

  .purpose-step:not(:last-child)::after {
    display: none;
  }

  .matrix-dot {
    position: static;
    display: inline-block;
    margin: 8px;
  }
}

/* Calm editorial redesign pass */
:root {
  --bg: #090b0d;
  --panel: #101316;
  --panel-2: #15191d;
  --paper: #f3f0ea;
  --paper-dim: #c3bbb1;
  --muted: #8d8781;
  --line: #403b36;
  --line-dark: #2a2725;
  --red: #ff3438;
  --red-soft: rgba(255, 52, 56, 0.12);
}

body {
  background:
    radial-gradient(circle at 78% 8%, rgba(255, 52, 56, 0.08), transparent 28rem),
    linear-gradient(rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    var(--bg);
  background-size: auto, 44px 44px, 44px 44px, auto;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.app-shell {
  grid-template-columns: 250px minmax(0, 1fr);
}

.side-rail {
  background: rgba(9, 11, 13, 0.96);
  border-right: 1px solid var(--line-dark);
  padding: 22px;
}

.rail-logo {
  min-height: 92px;
  border-bottom-color: var(--line-dark);
}

.dot-logo {
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  font-size: 22px;
  line-height: 1.04;
  letter-spacing: 0;
}

.rail-version,
.micro,
.section-kicker,
.label,
.time-code,
.card-label,
.top-title,
.top-subtitle,
.top-links a,
.rail-nav strong,
.rail-nav span:last-child {
  font-family: "SF Mono", "Courier New", ui-monospace, monospace;
}

.rail-version {
  font-size: 11px;
  letter-spacing: 0.12em;
}

.rail-nav {
  gap: 8px;
  margin-top: 28px;
}

.rail-nav a {
  min-height: 54px;
  border-color: transparent;
  border-radius: 0;
  color: var(--paper-dim);
}

.rail-nav a:hover,
.rail-nav a.active {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.025);
  color: var(--paper);
}

.rail-nav strong {
  font-size: 12px;
  letter-spacing: 0.04em;
}

.nav-icon {
  border-color: var(--line);
  font-size: 12px;
}

.system-card,
.profile-card,
.panel,
.story-section,
.phase,
.visual-card,
.slab,
.purpose-step {
  background: rgba(16, 19, 22, 0.86);
  border-color: var(--line-dark);
  box-shadow: none;
}

.main-board {
  padding: 24px 26px 48px;
}

.top-strip {
  min-height: 66px;
  border-color: var(--line-dark);
  background: rgba(12, 14, 16, 0.84);
}

.wf-mark {
  border-color: var(--red);
  color: var(--red);
}

.top-title {
  font-size: 15px;
  letter-spacing: 0.06em;
}

.top-subtitle {
  font-size: 11px;
  letter-spacing: 0.08em;
}

.top-links {
  gap: 8px;
}

.top-links a {
  color: var(--paper-dim);
  font-size: 12px;
  letter-spacing: 0.04em;
  padding: 9px 10px;
}

.top-links a:hover,
.top-links a.active {
  color: var(--red);
  border-color: transparent;
  border-bottom-color: var(--red);
}

.page-title {
  grid-template-columns: minmax(0, 0.9fr) minmax(280px, 0.52fr);
  gap: 28px;
  align-items: center;
  padding: 36px 0 28px;
}

.section-kicker {
  margin-bottom: 10px;
  color: var(--red);
  font-size: 12px;
  letter-spacing: 0.11em;
}

h1 {
  max-width: 760px;
  font-size: clamp(34px, 4.4vw, 56px);
  font-weight: 650;
  line-height: 1.06;
  letter-spacing: -0.03em;
  text-transform: none;
}

.page-title p {
  max-width: 680px;
  color: var(--paper-dim);
  font-size: 17px;
  line-height: 1.65;
}

.status-grid {
  border-color: var(--line-dark);
  background: rgba(16, 19, 22, 0.76);
}

.status-grid div {
  min-height: 92px;
  border-color: var(--line-dark);
}

.status-grid strong,
.result-card strong,
.slab strong {
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  font-size: 34px;
  font-weight: 650;
}

.demo-layout {
  grid-template-columns: minmax(300px, 0.8fr) minmax(360px, 1fr) minmax(300px, 0.72fr);
  gap: 18px;
}

.panel-header {
  min-height: 56px;
}

.panel-header h2,
.panel-header h3,
.card-label {
  font-size: 12px;
  letter-spacing: 0.08em;
}

.primary,
.ghost,
.file-label {
  min-height: 40px;
  border-color: var(--line-dark);
  font-size: 12px;
  letter-spacing: 0.02em;
  text-transform: none;
}

.primary {
  background: var(--red);
  box-shadow: none;
}

.primary:hover {
  transform: translateY(-1px);
  box-shadow: none;
}

.context-input {
  min-height: 250px;
  border-color: var(--line);
  border-style: solid;
  background: rgba(7, 8, 10, 0.9);
  font-family: "SF Mono", "Courier New", ui-monospace, monospace;
  font-size: 13px;
}

.orbit-stage {
  min-height: 370px;
  border-color: var(--line-dark);
  background: radial-gradient(circle at center, rgba(255, 52, 56, 0.1), transparent 9rem), #090b0d;
}

.orbit-stage::before,
.orbit-stage::after {
  border-color: rgba(243, 240, 234, 0.2);
  animation-duration: 28s;
}

.orbit-node {
  width: 78px;
  height: 78px;
  border-color: var(--line);
  background: #0f1215;
}

.orbit-node.red {
  border-color: var(--red);
  color: var(--red);
}

.orbit-node strong {
  font-size: 15px;
}

.node-3 {
  width: 102px;
  height: 102px;
}

.node-caption {
  font-size: 11px;
}

.result-grid {
  border-color: var(--line-dark);
}

.result-card {
  min-height: 84px;
  border-color: var(--line-dark);
}

.result-card small {
  color: var(--red);
  font-size: 10px;
  letter-spacing: 0.08em;
}

.item {
  border-color: var(--line-dark);
  background: rgba(12, 14, 16, 0.9);
}

.item strong {
  font-size: 14px;
}

.item p {
  color: var(--paper-dim);
}

.score-line {
  font-family: "SF Mono", "Courier New", ui-monospace, monospace;
}

.explain-strip {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-top: 18px;
}

.visual-card {
  min-height: 172px;
}

.visual-card h3,
.story-section h2,
.phase-main h2,
.purpose-step h2 {
  text-transform: none;
  letter-spacing: -0.01em;
}

.visual-card h3 {
  font-size: 16px;
}

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

.progression-title {
  grid-template-columns: minmax(0, 0.85fr) minmax(280px, 0.5fr);
}

.progress-slab-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.phase {
  grid-template-columns: 70px minmax(0, 1fr) 126px;
  min-height: 168px;
}

.phase-number {
  color: var(--red);
  font-size: 24px;
}

.phase-main {
  padding: 20px 4px;
}

.phase-main h2 {
  font-size: 24px;
  font-weight: 650;
}

.phase-main p {
  max-width: 880px;
  color: var(--paper-dim);
  font-size: 15px;
}

.phase-status {
  font-size: 12px;
}

.purpose-map {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  margin-bottom: 18px;
}

.purpose-step {
  min-height: 190px;
}

.purpose-step h2 {
  font-size: 19px;
}

.visual-explainer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 120px minmax(0, 1fr);
  gap: 18px;
  align-items: stretch;
  margin: 18px 0;
}

.comparison-card {
  border: 1px solid var(--line-dark);
  background: rgba(16, 19, 22, 0.86);
  padding: 20px;
}

.comparison-card h2 {
  margin-bottom: 10px;
  font-size: 24px;
}

.comparison-card p {
  margin: 0;
  color: var(--paper-dim);
  line-height: 1.65;
}

.comparison-card.quiet {
  opacity: 0.72;
}

.comparison-card.active {
  border-color: rgba(255, 52, 56, 0.44);
  background: linear-gradient(135deg, rgba(255, 52, 56, 0.1), rgba(16, 19, 22, 0.86));
}

.signal-path {
  position: relative;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 9px;
}

.signal-path::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 14px;
  bottom: 14px;
  width: 1px;
  background: var(--line-dark);
}

.signal-path span {
  position: relative;
  z-index: 1;
  display: block;
  width: 13px;
  height: 13px;
  border: 1px solid var(--red);
  border-radius: 50%;
  background: var(--bg);
  animation: redPulse 2.4s ease-in-out infinite;
}

.signal-path span:nth-child(2) { animation-delay: 0.2s; }
.signal-path span:nth-child(3) { animation-delay: 0.4s; }
.signal-path span:nth-child(4) { animation-delay: 0.6s; }

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

.result-meaning-grid article {
  border: 1px solid var(--line-dark);
  background: rgba(255, 255, 255, 0.025);
  padding: 16px;
}

.meaning-icon {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border: 1px solid var(--red);
  color: var(--red);
  font-family: "SF Mono", "Courier New", ui-monospace, monospace;
  font-size: 12px;
  font-weight: 700;
}

.result-meaning-grid h3 {
  margin: 14px 0 8px;
  font-size: 18px;
}

.result-meaning-grid p {
  margin: 0;
  color: var(--paper-dim);
  line-height: 1.55;
}

.decision-matrix {
  position: relative;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  min-height: 360px;
  border: 1px solid var(--line-dark);
  overflow: hidden;
}

.decision-matrix::before,
.decision-matrix::after {
  content: "";
  position: absolute;
  background: var(--line-dark);
}

.decision-matrix::before {
  left: 50%;
  top: 0;
  bottom: 0;
  width: 1px;
}

.decision-matrix::after {
  left: 0;
  right: 0;
  top: 50%;
  height: 1px;
}

.matrix-cell {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 14px;
}

.matrix-cell.high {
  color: var(--paper);
  background: rgba(255, 52, 56, 0.08);
}

.matrix-axis {
  position: absolute;
  z-index: 2;
  color: var(--red);
  font-family: "SF Mono", "Courier New", ui-monospace, monospace;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.matrix-axis.y {
  left: 14px;
  top: 14px;
}

.matrix-axis.x {
  right: 14px;
  bottom: 14px;
}

.matrix-dot {
  position: absolute;
  z-index: 3;
  border: 1px solid var(--red);
  background: #121417;
  color: var(--paper);
  padding: 8px 10px;
  font-size: 12px;
  animation: floatDot 4s ease-in-out infinite;
}

.dot-a { right: 14%; top: 18%; }
.dot-b { right: 28%; top: 42%; animation-delay: 0.4s; }
.dot-c { left: 16%; bottom: 18%; animation-delay: 0.8s; }

@keyframes floatDot {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

.footer {
  border-color: var(--line-dark);
}

@media (max-width: 1500px) {
  .demo-layout {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }

  .demo-layout > .panel:nth-child(3) {
    grid-column: 1 / -1;
  }
}

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

  .side-rail {
    position: relative;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line-dark);
  }

  .page-title,
  .progression-title,
  .demo-layout,
  .content-grid {
    grid-template-columns: 1fr;
  }

  .rail-nav {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .purpose-map,
  .explain-strip,
  .result-meaning-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .visual-explainer {
    grid-template-columns: 1fr;
  }

  .signal-path {
    min-height: 70px;
    grid-template-columns: repeat(4, auto);
  }

  .signal-path::before {
    left: 14px;
    right: 14px;
    top: 50%;
    bottom: auto;
    width: auto;
    height: 1px;
  }
}

@media (max-width: 760px) {
  .main-board {
    padding: 12px;
  }

  .side-rail {
    padding: 16px;
  }

  .rail-nav,
  .status-grid,
  .result-grid,
  .progress-slab-grid,
  .purpose-map,
  .explain-strip,
  .proto-grid,
  .result-meaning-grid {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: 36px;
  }

  .orbit-stage {
    min-height: 430px;
  }
}
