:root {
  color-scheme: dark;
  font: 16px/1.28 "Courier New", "Liberation Mono", Courier, monospace;
  font-variant-ligatures: none;
  --paper: #070b08;
  --phosphor: #a3c59a;
  --dim: #70876a;
  background: var(--paper);
  color: var(--phosphor);
  text-shadow: 0 0 3px #91b88428;
}
* { box-sizing: border-box; }
body { margin: 0; overflow: hidden; background: radial-gradient(ellipse at 25% 35%, #14201655, transparent 75%); }
body::after {
  content: ""; position: fixed; inset: 0; z-index: 5; pointer-events: none;
  background: repeating-linear-gradient(0deg, #00000019 0, #00000019 1px, transparent 1px, transparent 3px);
  opacity: .38;
}
#screen {
  height: 100svh; overflow: auto; padding: 26px 32px 70px;
  scrollbar-width: thin; scrollbar-color: #384a35 var(--paper);
  animation: tube-on 180ms ease-out both;
}
#transcript, .entry { margin: 0; }
#transcript, #command-form { max-width: 88ch; }
.command-echo, pre { font: inherit; white-space: pre-wrap; overflow-wrap: anywhere; margin: 0; }
pre { tab-size: 8; }
.entry a { color: inherit; text-decoration: underline; text-underline-offset: 3px; }
#command-form { display: flex; align-items: baseline; gap: 1ch; margin: 0; }
#prompt { white-space: nowrap; color: inherit; }
#input-cell { position: relative; display: block; flex: 1; min-width: 0; overflow: hidden; }
#command {
  display: block; width: 100%; min-width: 0; padding: 0; margin: 0;
  border: 0; border-radius: 0; outline: 0; background: transparent;
  font: inherit; color: inherit; caret-color: transparent;
}
#command[type=password] { color: transparent; }
#block-cursor {
  display: none; position: absolute; top: 0; left: calc(var(--cursor-column, 0) * 1ch - var(--input-scroll, 0px));
  width: 1ch; height: 1.15em; background: var(--phosphor); pointer-events: none;
  mix-blend-mode: difference; animation: cursor 1.1s step-end infinite;
}
#input-cell:focus-within:has(#command:not(:disabled):not([type=password])) #block-cursor { display: block; }
#send { font: inherit; color: var(--dim); background: none; border: 0; padding: 0 6px; cursor: pointer; }
#send:focus-visible, #ambient-toggle:focus-visible { outline: 1px dotted var(--phosphor); outline-offset: 4px; }
#send:disabled { visibility: hidden; }
#ambient-toggle {
  position: fixed; right: 18px; bottom: max(10px, env(safe-area-inset-bottom)); z-index: 6;
  min-height: 32px; padding: 6px 8px; border: 0; border-radius: 0;
  background: var(--paper); font: 11px/1.2 "Courier New", Courier, monospace;
  letter-spacing: .07em; color: var(--dim); cursor: pointer;
}
#ambient-toggle::before { content: ""; display: inline-block; width: 4px; height: 4px; margin-right: 8px; background: #344330; vertical-align: 2px; }
#ambient-toggle[aria-pressed=true]::before { background: var(--phosphor); box-shadow: 0 0 5px #a3c59a55; }
#ambient-toggle:hover { color: var(--phosphor); }
.relay-output { display: flex; gap: 2ch; white-space: nowrap; }
.relay-output span { color: var(--dim); }
.relay-output .lit { background: var(--phosphor); color: var(--paper); text-shadow: none; }
::selection { background: var(--phosphor); color: var(--paper); text-shadow: none; }
[hidden] { display: none !important; }
#screen.intrusion pre, #screen.intrusion .command-echo, .history-voice { color: #f16a61; text-shadow: 0 0 5px #e3343433; }
.intrusion-word { font-size: calc(1em * var(--word-scale, 1)); font-weight: bold; line-height: .85; color: #ff3b32; }
.intrusion-flood {
  position: fixed; inset: 0; z-index: 4; overflow: hidden; pointer-events: none;
  background: #090303f5; color: #e73630; contain: strict;
  font-family: "Courier New", "Liberation Mono", Courier, monospace;
}
.intrusion-wall { position: absolute; inset: 0 -60vw auto 0; opacity: .65; }
.intrusion-row { white-space: nowrap; font-weight: bold; line-height: .82; letter-spacing: -.08em; }
.intrusion-shout {
  position: absolute; inset: 0; display: grid; place-content: center;
  padding: 0 4vw; text-align: center; font-size: clamp(78px, 18vw, 300px);
  font-weight: 900; line-height: .76; letter-spacing: -.09em;
  overflow-wrap: normal; color: #ff5145; text-shadow: 5px 2px 0 #5d0808, 0 0 24px #a7000066;
  transform: scale(var(--shout-scale, 1));
}
.vim { margin: 2px 0 6px; }
.vim-title, .vim-status, .skip-hint { color: var(--dim); }
.vim-status { margin-top: 2px; }
.vim-buffer { min-height: 0; }
.vim-filler { color: #61755b; }
.entry.finale { margin-top: 1.28em; }
.entry.finale pre { color: #bbd5b1; }
.skip-hint { margin-top: 6px; }
@keyframes cursor { 0%, 49% { opacity: 1; } 50%, 100% { opacity: 0; } }
@keyframes tube-on { from { opacity: .75; } to { opacity: 1; } }
@media (max-width: 600px) {
  #screen { padding: 16px 14px 66px; }
  .relay-output { gap: 1ch; }
  #ambient-toggle { right: 8px; min-height: 44px; }
}
@media (pointer: fine) { #send { visibility: hidden; } }
@media (prefers-reduced-motion: reduce) {
  #screen, #block-cursor { animation: none; }
  body::after { opacity: .2; }
  .intrusion-wall, .intrusion-shout { transform: none !important; }
}
