:root {
  color-scheme: dark;
  --bg: #040704;
  --screen: #061006;
  --fg: #3dff72;
  --dim: #22b850;
  --amber: #ffb833;
  --glow: 0 0 6px rgba(61, 255, 114, 0.45);
}

* { box-sizing: border-box; }

html { background: var(--bg); }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: clamp(0.5rem, 3vw, 2rem);
  padding-top: clamp(0.5rem, 7vh, 4rem);
  background: radial-gradient(ellipse at center, #0a150a 0%, var(--bg) 70%);
  color: var(--fg);
  font: 16px/1.5 ui-monospace, "Cascadia Mono", "Cascadia Code", Consolas, Menlo, "DejaVu Sans Mono", monospace;
}

/* The monitor: rounded glass, inner shadow, scanlines, a faint flicker. */
.crt {
  position: relative;
  width: min(100%, 48rem);
  padding: 1.25rem 1.25rem 1.1rem;
  background: var(--screen);
  border: 2px solid #12331a;
  border-radius: 14px;
  box-shadow: 0 0 0 4px #0b1a0d, 0 0 40px rgba(61, 255, 114, 0.12), inset 0 0 60px rgba(0, 0, 0, 0.65);
  text-shadow: var(--glow);
  overflow: hidden;
  animation: flicker 7s infinite;
}

.crt::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  background: repeating-linear-gradient(to bottom, rgba(0, 0, 0, 0) 0, rgba(0, 0, 0, 0) 2px, rgba(0, 0, 0, 0.2) 3px);
}

@keyframes flicker {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.99; }
  52% { opacity: 0.955; }
  54% { opacity: 1; }
}

a {
  color: var(--amber);
  text-shadow: 0 0 6px rgba(255, 184, 51, 0.4);
  text-underline-offset: 3px;
}

a:focus-visible, button:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 2px;
}

::selection { background: var(--fg); color: var(--bg); text-shadow: none; }

/* Static, no-JS view. */
#static h1 { margin: 0 0 0.75rem; font-size: 1.4rem; }
#static h2 { margin: 1.25rem 0 0.25rem; font-size: 1rem; color: var(--dim); }
#static p { margin: 0 0 0.75rem; }
#static ul { margin: 0; padding-left: 1.25rem; }

/* Terminal view: hidden until JS is on. Once it is, the static copy stays in the
   DOM for screen readers but is visually hidden. */
#screen { display: none; flex-direction: column; }

.js #screen { display: flex; }
.js #static { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

@media (scripting: enabled) {
  #screen { display: flex; }
  #static { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
}

.line { white-space: pre-wrap; overflow-wrap: anywhere; min-height: 1.5em; }
.line.cmdline { color: var(--amber); }
.line.dim { color: var(--dim); }

form { display: flex; align-items: center; gap: 1ch; margin: 0; }

.prompt { color: var(--dim); white-space: nowrap; }
form:focus-within .prompt { color: var(--amber); }

input {
  flex: 1;
  min-width: 0;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: max(16px, 1em); /* under 16px makes iOS zoom the page on focus */
  text-shadow: inherit;
  caret-color: var(--fg);
}

.chips { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1rem; }

.chips button {
  min-height: 44px;
  padding: 0.4rem 0.9rem;
  background: transparent;
  color: var(--fg);
  border: 1px solid var(--dim);
  border-radius: 6px;
  font: inherit;
  text-shadow: inherit;
  cursor: pointer;
}

.chips button:hover { background: rgba(61, 255, 114, 0.12); }
.chips button:active { transform: translateY(1px); }

footer {
  margin-top: 1rem;
  color: var(--dim);
  font-size: 0.8rem;
  opacity: 0.8;
}

@media (prefers-reduced-motion: reduce) {
  .crt { animation: none; }
  .chips button:active { transform: none; }
}
