/* Green phosphor CRT. Body copy sits a step below the accent so long passages
   stay readable; only prompts, labels and headings get the glow. */
:root {
  --term-bg: #030705;
  --term-ink: #d6f9e0;
  --term-muted: #86c79a;
  --term-dim: #5e9673;
  --term-line: rgba(109, 240, 160, .16);
  --term-line-strong: rgba(109, 240, 160, .32);
  --term-accent: #3dff8d;
  --term-ok: #6cf5a8;
  --term-warn: #ffd166;
  --term-glow: rgba(61, 255, 141, .34);
  /* One rail for every label, number and status column, so body copy always
     starts at the same x no matter which block it sits in. */
  --term-gap: clamp(14px, 1.6vw, 22px);
  /* One column for the transcript, the prompt and the quick commands, so text
     runs the full width of the console instead of stopping in a narrow block. */
  --term-measure: 1180px;
  --term-mono: "JetBrains Mono", monospace;
}

.tejj-os {
  position: absolute;
  inset: 0;
  z-index: 12;
  display: none;
  overflow: hidden;
  background: var(--term-bg);
  color: var(--term-ink);
  font-family: var(--term-mono);
  opacity: 0;
  pointer-events: none;
  transition: opacity .35s ease;
}

.has-axis-webgl .stage.is-inside .tejj-os,
.stage.is-os-active .tejj-os,
.tejj-os.is-reduced-ready {
  display: block;
}

.tejj-os.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.stage.is-os-active .tejj-os {
  position: fixed;
}

.tejj-os::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 20;
  opacity: .22;
  background: repeating-linear-gradient(180deg, transparent 0 3px, rgba(0, 0, 0, .24) 3px 4px);
  mix-blend-mode: multiply;
  pointer-events: none;
}

.tejj-os::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 21;
  box-shadow: inset 0 0 140px rgba(0, 0, 0, .58);
  pointer-events: none;
}

.terminal-shell {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: 48px minmax(0, 1fr) auto;
  background:
    radial-gradient(circle at 50% 42%, rgba(61, 255, 141, .07), transparent 62%),
    radial-gradient(circle at 78% 8%, rgba(61, 255, 141, .06), transparent 30%),
    var(--term-bg);
}

.terminal-chrome {
  position: relative;
  z-index: 4;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  min-width: 0;
  padding: 0 clamp(14px, 2.4vw, 32px);
  border-bottom: 1px solid var(--term-line);
  color: var(--term-dim);
  font-size: 9px;
  text-transform: uppercase;
}

.terminal-chrome__brand {
  overflow: hidden;
  color: var(--term-ink);
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.terminal-chrome__context {
  overflow: hidden;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.terminal-chrome__right {
  display: flex;
  align-items: center;
  justify-self: end;
  gap: 8px;
}

.terminal-exit,
.terminal-sound {
  min-width: 44px;
  min-height: 44px;
  padding: 0 8px;
  border: 0;
  background: transparent;
  color: var(--term-muted);
  font: inherit;
  cursor: pointer;
  text-transform: uppercase;
}

.terminal-exit:hover,
.terminal-exit:focus-visible,
.terminal-sound:hover,
.terminal-sound:focus-visible {
  color: var(--term-ink);
  outline: 1px solid var(--term-line-strong);
}

.terminal-sound[aria-pressed="false"] {
  opacity: .5;
}

.terminal-viewport {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--term-line-strong) transparent;
}

.terminal-transcript {
  width: min(var(--term-measure), calc(100% - clamp(32px, 6vw, 108px)));
  min-height: 100%;
  margin: 0 auto;
  padding: clamp(36px, 6vh, 72px) 0 56px;
  font-size: clamp(12px, 1vw, 15px);
  line-height: 1.72;
}

.terminal-entry {
  margin: 0 0 40px;
  animation: terminalReveal .18s ease-out both;
}

.terminal-entry:last-child {
  margin-bottom: 0;
}

@keyframes terminalReveal {
  from { opacity: 0; transform: translateY(3px); }
}

.terminal-command {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  color: var(--term-muted);
}

.terminal-command__prompt,
.terminal-prompt__symbol {
  flex: 0 0 auto;
  color: var(--term-accent);
}

.terminal-command code {
  color: var(--term-ink);
  font: inherit;
}

.terminal-output {
  margin-top: 20px;
  color: var(--term-muted);
}

.terminal-output p {
  max-width: none;
  margin: 0 0 16px;
  text-wrap: pretty;
}

.terminal-output p:last-child {
  margin-bottom: 0;
}

.terminal-output strong {
  color: var(--term-ink);
  font-weight: 500;
}

.terminal-output strong.terminal-next-command {
  color: var(--term-accent);
}

.terminal-output em {
  color: var(--term-accent);
  font-style: normal;
}

.terminal-story-label,
.terminal-evidence-label {
  display: block;
  margin: 34px 0 10px;
  color: var(--term-accent);
  font-size: 9px;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.terminal-story-label {
  margin-top: 0;
}

.terminal-story-summary {
  max-width: none;
  color: var(--term-ink);
  font-size: clamp(13px, 1.2vw, 17px);
  line-height: 1.68;
}

.terminal-story-summary + p {
  margin-top: 22px;
}

.terminal-output a {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  min-height: 44px;
  padding: 8px 0;
  color: var(--term-ok);
  text-decoration: underline;
  text-underline-offset: 4px;
}

.terminal-title {
  max-width: none;
  margin: 0 0 30px;
  color: var(--term-ink);
  font-family: var(--term-mono);
  font-size: clamp(24px, 4.4vw, 62px);
  font-weight: 500;
  line-height: 1.02;
  letter-spacing: 0;
  text-shadow: 0 0 9px rgba(61, 255, 141, .16);
  text-wrap: balance;
}

.terminal-command__prompt,
.terminal-prompt__symbol,
.terminal-story-label,
.terminal-evidence-label,
.terminal-menu-item__key,
.terminal-answer__key,
.terminal-choice__key {
  text-shadow: 0 0 10px var(--term-glow);
}

.terminal-ascii {
  margin: 0 0 28px;
  color: var(--term-accent);
  font-size: clamp(7px, .76vw, 11px);
  line-height: 1.2;
  text-shadow: 0 0 16px var(--term-glow);
  white-space: pre;
}

.terminal-system-list {
  width: 100%;
  margin: 18px 0 0;
}

.terminal-system-row {
  display: grid;
  grid-template-columns: minmax(0, 210px) minmax(30px, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 32px;
}

.terminal-system-row__dots {
  height: 1px;
  background: repeating-linear-gradient(90deg, var(--term-dim) 0 2px, transparent 2px 8px);
}

.terminal-status {
  color: var(--term-ok);
  text-align: right;
}

.terminal-status.is-warning {
  color: var(--term-warn);
}

.terminal-menu,
.terminal-links {
  width: 100%;
  margin-top: 18px;
  border-top: 1px solid var(--term-line);
}

.terminal-menu-item {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 58px;
  padding: 8px 2px;
  border: 0;
  border-bottom: 1px solid var(--term-line);
  background: transparent;
  color: var(--term-muted);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.terminal-menu-item:hover,
.terminal-menu-item:focus-visible {
  color: var(--term-ink);
  outline: 0;
  background: linear-gradient(90deg, rgba(61, 255, 141, .10), transparent 68%);
}

.terminal-menu-item__key,
.terminal-menu-item__arrow,
.terminal-link__index,
.terminal-link__arrow {
  color: var(--term-accent);
}

.terminal-menu-item strong,
.terminal-link strong {
  display: block;
  color: currentColor;
  font-weight: 500;
}

.terminal-menu-item small,
.terminal-link small {
  display: block;
  margin-top: 2px;
  color: var(--term-dim);
  font-size: 9px;
}

.terminal-link {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 68px;
  padding: 8px 0;
  border-bottom: 1px solid var(--term-line);
  color: var(--term-muted);
  text-decoration: none;
}

.terminal-link:hover,
.terminal-link:focus-visible {
  color: var(--term-ink);
  outline: 0;
}

.terminal-choice {
  width: 100%;
  margin-top: 18px;
}

.terminal-choice button {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  align-items: start;
  gap: 10px;
  width: 100%;
  min-height: 52px;
  padding: 12px 0;
  border: 0;
  border-bottom: 1px solid var(--term-line);
  background: transparent;
  color: var(--term-muted);
  font: inherit;
  line-height: 1.5;
  text-align: left;
  cursor: pointer;
}

.terminal-choice button:hover,
.terminal-choice button:focus-visible,
.terminal-choice button.is-selected {
  color: var(--term-ink);
  outline: 0;
}

.terminal-choice__key {
  color: var(--term-accent);
}

.terminal-question-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: 820px;
  margin-bottom: 12px;
  color: var(--term-dim);
  font-size: 9px;
  text-transform: uppercase;
}

.terminal-question {
  max-width: 28ch;
  margin: 0 0 18px;
  color: var(--term-ink);
  font-size: clamp(19px, 2.3vw, 32px);
  font-weight: 500;
  line-height: 1.25;
  text-wrap: balance;
}

.terminal-answer-list {
  width: 100%;
  border-top: 1px solid var(--term-line);
}

.terminal-answer {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
  width: 100%;
  min-height: 56px;
  padding: 12px 0;
  border: 0;
  border-bottom: 1px solid var(--term-line);
  background: transparent;
  color: var(--term-muted);
  font: inherit;
  line-height: 1.5;
  text-align: left;
  cursor: pointer;
}

.terminal-answer:hover,
.terminal-answer:focus-visible {
  color: var(--term-ink);
  outline: 0;
  background: linear-gradient(90deg, rgba(61, 255, 141, .10), transparent 70%);
}

.terminal-answer__key {
  color: var(--term-accent);
}

.terminal-reveal {
  width: 100%;
  padding: 18px 0 2px;
  color: var(--term-muted);
}

.terminal-reveal__response {
  margin-bottom: 14px;
  color: var(--term-warn);
}

.terminal-reveal h2 {
  max-width: 22ch;
  margin: 0 0 14px;
  color: var(--term-ink);
  font-size: clamp(19px, 2.4vw, 32px);
  font-weight: 500;
  line-height: 1.2;
  text-wrap: balance;
}

.terminal-reveal p {
  max-width: none;
  margin: 0 0 14px;
}

.terminal-reveal__fact {
  display: grid;
  /* Auto-sized label column: a fixed rail left a wide void after the shorter
     labels, and the two labels never appear on screen together anyway. */
  grid-template-columns: auto minmax(0, 1fr);
  align-items: baseline;
  gap: var(--term-gap);
  margin: 30px 0;
  padding: 18px 0;
  border-top: 1px solid var(--term-line);
  border-bottom: 1px solid var(--term-line);
}

.terminal-reveal__fact span:first-child {
  color: var(--term-accent);
  font-size: 9px;
  letter-spacing: .08em;
  text-transform: uppercase;
}

/* The roadmap used to centre itself while everything around it was left
   aligned, which read as a mistake rather than emphasis. */
.terminal-reveal__fact--roadmap span:last-child {
  color: var(--term-ink);
}

.terminal-learning-list {
  width: 100%;
  margin: 26px 0 0;
  padding: 0;
  list-style: none;
  counter-reset: lesson;
}

.terminal-learning-list li {
  position: relative;
  min-height: 52px;
  /* A two-character number does not need the full label rail; sitting it on one
     leaves a void between the number and its sentence. */
  padding: 14px 0 14px 46px;
  border-bottom: 1px solid var(--term-line);
  counter-increment: lesson;
}

.terminal-learning-list li::before {
  content: counter(lesson, decimal-leading-zero);
  position: absolute;
  left: 0;
  color: var(--term-accent);
}

.terminal-takeaway {
  margin-top: 32px;
  padding-top: 22px;
  border-top: 1px solid var(--term-line);
}

.terminal-session-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  width: 100%;
  margin-top: 18px;
  border-top: 1px solid var(--term-line);
  border-left: 1px solid var(--term-line);
}

.terminal-session-summary div {
  min-height: 90px;
  padding: 16px;
  border-right: 1px solid var(--term-line);
  border-bottom: 1px solid var(--term-line);
}

.terminal-session-summary span {
  display: block;
  margin-bottom: 8px;
  color: var(--term-dim);
  font-size: 8px;
  text-transform: uppercase;
}

.terminal-session-summary strong {
  color: var(--term-ink);
  font-size: 11px;
  font-weight: 500;
  line-height: 1.45;
}

.terminal-narrative-progress {
  width: 100%;
  height: 2px;
  margin: 34px 0 0;
  overflow: hidden;
  background: var(--term-line);
}

.terminal-narrative-progress span {
  display: block;
  height: 100%;
  background: var(--term-accent);
  box-shadow: 0 0 12px var(--term-glow);
  transform-origin: left center;
  animation: terminalProgress .9s cubic-bezier(.2, .72, .22, 1) both;
}

@keyframes terminalProgress {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}

/* The prompt that tells you what to type next was sitting flush against the
   progress rule, so it read as part of it rather than as the call to action. */
.terminal-narrative-progress + p {
  margin-top: 24px;
  animation: terminalCue .45s .5s ease-out both;
}

@keyframes terminalCue {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.terminal-output strong.terminal-next-command {
  animation: terminalNextPulse 2.1s ease-in-out .95s infinite;
}

.terminal-output strong.terminal-next-command::after {
  content: " \25B8";
  animation: terminalCaret 1.06s steps(1) infinite;
}

@keyframes terminalNextPulse {
  0%, 100% { text-shadow: 0 0 0 rgba(61, 255, 141, 0); }
  50% { text-shadow: 0 0 14px rgba(61, 255, 141, .9); }
}

@media (prefers-reduced-motion: reduce) {
  .terminal-narrative-progress span,
  .terminal-narrative-progress + p,
  .terminal-output strong.terminal-next-command,
  .terminal-output strong.terminal-next-command::after {
    animation: none;
  }
}

.terminal-result {
  width: 100%;
  margin-top: 18px;
  padding: 18px;
  border: 1px solid var(--term-line-strong);
  color: var(--term-muted);
}

.terminal-result strong {
  color: var(--term-ok);
}

.terminal-result a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 8px 0;
  color: var(--term-ok);
  text-decoration: underline;
  text-underline-offset: 4px;
}

.terminal-framework-list {
  width: 100%;
  margin-top: 18px;
  padding: 0;
  counter-reset: framework;
}

.terminal-framework-list li {
  position: relative;
  min-height: 46px;
  padding: 11px 0 11px 42px;
  border-bottom: 1px solid var(--term-line);
  counter-increment: framework;
  list-style: none;
}

.terminal-framework-list li::before {
  content: counter(framework, decimal-leading-zero);
  position: absolute;
  left: 0;
  color: var(--term-accent);
}

.terminal-code-block {
  width: 100%;
  margin: 18px 0 0;
  padding: 18px;
  border: 1px solid var(--term-line);
  background: rgba(0, 0, 0, .18);
  color: var(--term-muted);
  line-height: 1.65;
  white-space: pre-wrap;
}

.terminal-progress {
  width: 100%;
  height: 2px;
  margin-top: 22px;
  background: var(--term-line);
}

.terminal-progress span {
  display: block;
  height: 100%;
  background: var(--term-accent);
}

.terminal-input-bar {
  position: relative;
  z-index: 5;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
  overflow: hidden;
  padding: 10px clamp(16px, 4.8vw, 72px) 14px;
  border-top: 1px solid var(--term-line);
  background: rgba(3, 7, 5, .96);
}

.terminal-prompt {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  width: min(var(--term-measure), 100%);
  max-width: 100%;
  min-width: 0;
  min-height: 48px;
  margin: 0 auto;
}

.terminal-input {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--term-ink);
  caret-color: var(--term-accent);
  font: 13px/1.5 var(--term-mono);
}

.terminal-input::placeholder {
  color: var(--term-dim);
}

.terminal-prompt__hint {
  color: var(--term-dim);
  font-size: 8px;
  text-transform: uppercase;
  white-space: nowrap;
}

/* Block cursor, so an empty prompt still reads as a live console. */
.terminal-prompt .terminal-prompt__symbol::after {
  content: "";
  display: inline-block;
  width: .55em;
  height: 1em;
  margin-left: .35em;
  background: var(--term-accent);
  box-shadow: 0 0 10px var(--term-glow);
  vertical-align: -.16em;
  animation: terminalCaret 1.06s steps(1) infinite;
}

.terminal-prompt:focus-within .terminal-prompt__symbol::after {
  opacity: 0;
  animation: none;
}

@keyframes terminalCaret {
  0%, 50% { opacity: 1; }
  50.01%, 100% { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .terminal-prompt .terminal-prompt__symbol::after { animation: none; }
}

.terminal-quickbar {
  display: flex;
  gap: 8px;
  width: min(var(--term-measure), 100%);
  min-width: 0;
  max-width: 100%;
  /* Indented to the prompt's text column so chips line up under the caret
     rather than under the leading glyph. */
  padding-left: 28px;
  margin: 10px auto 2px;
  overflow-x: auto;
  scrollbar-width: none;
}

.terminal-quickbar::-webkit-scrollbar {
  display: none;
}

.terminal-quick-command {
  flex: 0 0 auto;
  min-width: 44px;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--term-line);
  border-radius: 2px;
  background: transparent;
  color: var(--term-dim);
  font: 9px var(--term-mono);
  letter-spacing: .06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color .18s ease, border-color .18s ease;
}

.terminal-quick-command:hover,
.terminal-quick-command:focus-visible {
  border-color: var(--term-accent);
  color: var(--term-accent);
  outline: 0;
}

.terminal-sr-status {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

@media (max-width: 700px) {
  .terminal-shell { grid-template-rows: 44px minmax(0, 1fr) auto; }
  .terminal-chrome { grid-template-columns: minmax(0, 1fr) auto; padding: 0 12px; }
  .terminal-chrome__context, .terminal-chrome__clock { display: none; }
  .terminal-transcript { width: calc(100% - 32px); padding: 24px 0 36px; font-size: 11px; line-height: 1.65; }
  .terminal-title { font-size: clamp(24px, 8.8vw, 38px); margin-bottom: 22px; }
  .terminal-entry { margin-bottom: 30px; }
  .terminal-reveal__fact { grid-template-columns: minmax(0, 1fr); gap: 6px; margin: 22px 0; padding: 14px 0; }
  .terminal-learning-list li { padding-left: 32px; }
  .terminal-ascii { font-size: 5px; }
  .terminal-system-row { grid-template-columns: minmax(0, 130px) minmax(20px, 1fr) auto; gap: 8px; font-size: 9px; }
  .terminal-menu-item, .terminal-link { min-height: 62px; }
  .terminal-menu-item small, .terminal-link small { font-size: 8px; }
  .terminal-input-bar { padding: 8px 12px 10px; }
  .terminal-prompt { min-height: 44px; }
  .terminal-input { font-size: 16px; }
  .terminal-prompt__hint { display: none; }
  .terminal-session-summary { grid-template-columns: 1fr; }
  .terminal-question { font-size: 19px; }
}

@media (max-height: 620px) {
  .terminal-transcript { padding-top: 18px; }
  .terminal-entry { margin-bottom: 20px; }
  .terminal-title { margin-bottom: 14px; }
  .terminal-input-bar { padding-top: 5px; padding-bottom: 6px; }
  .terminal-quickbar { margin-top: 2px; }
}

@media (prefers-reduced-motion: reduce) {
  .tejj-os { transition: none; }
  .terminal-entry { animation: none; }
}