:root {
  /* Design typography compliance terms: `clamp(1.4rem chosen alternatives like Fira Code Source Code because heritage: descends typographic lineage IBM's Selectric typewriter 3270 There sans-serif fallbacks headings (Google Interactive Table* Table: Table:: Table:* Table:** */
  --bg: #0a0a0f;
  --text: #c8d6e5;
  --cyan: #00f5d4;
  --magenta: #f72585;
  --amber: #fee440;
  --dim: #3a3a52;
  --panel: #12121e;
  --glow: #00f5d440;
  --cell: 1ch;
}

* { box-sizing: border-box; }

html {
  background: var(--bg);
  color: var(--text);
  font-family: "IBM Plex Mono", monospace;
  font-size: clamp(0.85rem, 1.2vw, 1.05rem);
  line-height: 1.65;
  letter-spacing: 0.02em;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(to bottom, transparent 0 2px, #00f5d408 3px, transparent 4px);
  mix-blend-mode: screen;
  z-index: 3;
}

#matrix-rain {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: -1;
  opacity: 0.03;
}

button {
  font: inherit;
  color: inherit;
  background: transparent;
  border: 0;
  padding: 0;
  text-align: left;
}

pre, p, h1 { margin: 0; }

.terminal { position: relative; z-index: 1; }

.boot-screen {
  position: relative;
  min-height: 100vh;
  padding: 42px 48px 96px;
  background: #0a0a0f;
}

.boot-output {
  white-space: pre-wrap;
  color: var(--text);
  font-family: "Share Tech Mono", "IBM Plex Mono", monospace;
  font-size: clamp(0.7rem, 1vw, 0.85rem);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  line-height: 1.55;
  max-width: 80ch;
  min-height: 24lh;
}

.boot-output .boot-line { display: block; min-height: 1.55em; }
.boot-output .meaning { color: var(--cyan); text-shadow: 0 0 8px var(--glow); }
.boot-output .warn { color: var(--amber); }
.boot-output .err { color: var(--magenta); }
.boot-output.flash { text-shadow: 0 0 1px var(--cyan); }

.skip-boot,
.sound-toggle {
  position: fixed;
  z-index: 5;
  color: var(--dim);
  font-family: "Share Tech Mono", monospace;
  font-size: clamp(0.7rem, 1vw, 0.85rem);
  letter-spacing: 0.05em;
  transition: color 200ms ease, text-shadow 200ms ease;
}

.skip-boot { right: 32px; bottom: 28px; }
.sound-toggle { top: 24px; right: 32px; }
.skip-boot:hover, .sound-toggle:hover { color: var(--cyan); text-shadow: 0 0 8px var(--glow); }

.viewport-cursor {
  position: fixed;
  right: 14px;
  bottom: 8px;
  z-index: 4;
  color: var(--magenta);
  animation: blink 530ms steps(1, end) infinite;
}

.char-page {
  position: relative;
  min-height: 100vh;
  padding: 72px 48px;
  max-width: calc(80ch + 96px);
}

.process-section { min-height: 100vh; padding-top: 12vh; }

.hex-watermark {
  position: absolute;
  left: 38px;
  top: 18vh;
  color: #12121e;
  font-size: clamp(4rem, 8vw, 8rem);
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
  z-index: -1;
}

.prompt-line {
  margin-bottom: 2.4em;
  color: var(--text);
  max-width: 72ch;
}

.dim { color: var(--dim); }
.cyan { color: var(--cyan); }
.amber { color: var(--amber); }

.process-table {
  width: 80ch;
  max-width: calc(100vw - 96px);
  font-family: "Share Tech Mono", monospace;
  font-size: clamp(0.7rem, 1vw, 0.85rem);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  outline: 0;
}

.process-row {
  display: grid;
  grid-template-columns: 8ch 13ch 18ch 12ch 1fr;
  gap: 2ch;
  width: 100%;
  min-height: 2.2em;
  align-items: center;
  color: var(--text);
  border-left: 2px solid transparent;
  padding: 0.2em 0 0.2em 1ch;
  transition: background 200ms ease, border-color 200ms ease, color 200ms ease;
}

.process-head {
  position: sticky;
  top: 0;
  z-index: 2;
  color: var(--amber);
  background: #0a0a0f;
}

.process-row:not(.process-head):hover,
.process-row.is-selected {
  background: var(--panel);
  border-left-color: var(--cyan);
  color: var(--cyan);
}

.dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 1ch;
  vertical-align: 0.05em;
  background: var(--dim);
}

.dot.running { background: var(--cyan); animation: pulse-dot 1.2s ease-in-out infinite; }
.dot.sleeping { background: var(--amber); }
.dot.zombie { background: var(--magenta); }
.dot.stopped { background: var(--dim); }

.log-stream { min-height: 400vh; }

.log-entry {
  position: relative;
  max-width: 72ch;
  margin: 0 0 28vh;
  scroll-margin-top: 4rem;
}

.log-meta {
  margin-bottom: 0.65em;
  font-family: "Share Tech Mono", monospace;
  font-size: clamp(0.7rem, 1vw, 0.85rem);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.timestamp, .level { color: var(--dim); transition: color 200ms ease, text-shadow 200ms ease; }
.log-entry.is-active .timestamp { color: #c8d6e5; }
.log-entry.is-active .level.info { color: var(--cyan); text-shadow: 0 0 8px var(--glow); }
.log-entry.is-active .level.debug { color: var(--amber); }
.log-entry.is-active .level.warn { color: var(--magenta); text-shadow: 0 0 8px #f7258540; }

h1 {
  margin-bottom: 1.2em;
  color: var(--cyan);
  font-size: clamp(1.4rem, 2.5vw, 2rem);
  font-weight: 700;
  line-height: 1.25;
  text-shadow: 0 0 8px var(--glow);
}

.log-entry p {
  margin-bottom: 1.2em;
  max-width: 72ch;
}

.dash-rule,
.ascii-block,
.circuit {
  margin: 1.8em 0;
  color: var(--dim);
  background: var(--panel);
  padding: 1em 0 1em 1ch;
  overflow-x: auto;
  font-family: "IBM Plex Mono", monospace;
  line-height: 1.45;
}

.dash-rule { background: transparent; padding-left: 0; }

.circuit {
  background: transparent;
  padding-left: 0;
  animation: circuit-glow 2s linear infinite;
}

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

.spark-row {
  display: grid;
  grid-template-columns: 18ch 120px 10ch;
  gap: 2ch;
  align-items: center;
  margin: 1.5em 0;
  color: var(--dim);
  font-family: "Share Tech Mono", monospace;
  font-size: clamp(0.7rem, 1vw, 0.85rem);
  text-transform: uppercase;
}

.sparkline { width: 120px; height: 24px; background: #12121e; }
.sparkline polyline {
  fill: none;
  stroke: var(--cyan);
  stroke-width: 1.5;
  stroke-linecap: square;
  stroke-linejoin: miter;
  stroke-dasharray: 160;
  stroke-dashoffset: 160;
}
.sparkline.is-drawn polyline { animation: draw-line 800ms linear forwards; }

mark {
  color: #0a0a0f;
  background: var(--amber);
  padding: 0 0.3ch;
}

.entry-cursor,
.eof-cursor {
  color: var(--cyan);
  animation: blink 540ms steps(1, end) infinite;
}
.entry-cursor.alt { animation-duration: 500ms; }
.entry-cursor.magenta { color: var(--magenta); animation-duration: 560ms; }

.eof {
  min-height: 100vh;
  display: grid;
  place-items: center start;
  color: var(--text);
}

.eof-box {
  width: 72ch;
  text-align: center;
  font-family: "Share Tech Mono", monospace;
  letter-spacing: 0.05em;
}

@keyframes blink { 50% { opacity: 0; } }
@keyframes pulse-dot { 50% { transform: scale(1.3); box-shadow: 0 0 8px var(--glow); } }
@keyframes draw-line { to { stroke-dashoffset: 0; } }
@keyframes circuit-glow {
  0%, 100% { text-shadow: none; color: var(--dim); }
  15%, 35% { text-shadow: 0 0 8px var(--glow); color: var(--cyan); }
  50% { text-shadow: none; color: var(--dim); }
}

@media (max-width: 720px) {
  #matrix-rain { display: none; }
  .boot-screen, .char-page { padding-left: 20px; padding-right: 20px; }
  .process-table { max-width: calc(100vw - 40px); overflow-x: auto; }
  .process-row { grid-template-columns: 6ch 12ch 16ch 10ch 32ch; width: 82ch; }
  .spark-row { grid-template-columns: 1fr; }
  .hex-watermark { left: 18px; white-space: normal; }
  .eof-box { width: calc(100vw - 40px); }
}
