/* SECOND REQUEST — phosphor terminal look. */
:root {
  --fg: #ffb000;
  --dim: #b37a00;
  --hi: #ffd76a;
  --bg: #0b0700;
  --glow: rgba(255, 176, 0, 0.55);
  --warn: #ff5a36;
}
body.green {
  --fg: #33ff66;
  --dim: #1f9e40;
  --hi: #b6ffc9;
  --bg: #010a03;
  --glow: rgba(51, 255, 102, 0.5);
  --warn: #ffe14d;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--fg);
}

body {
  font-family: "VT323", ui-monospace, "Cascadia Mono", Consolas, "Courier New", monospace;
  /* 80 columns fit the viewport down to phone width */
  font-size: clamp(9px, 2.35vw, 22px);
  line-height: 1.12;
  padding: 12px 16px 64px;
  /* VT323 ships an "fi" ligature that eats a cell and breaks the frames */
  font-variant-ligatures: none;
  font-feature-settings: "liga" 0, "clig" 0;
}

#crt {
  max-width: 82ch;
  margin: 0 auto;
  overflow-x: auto;
}

#screen {
  font: inherit;
  margin: 0;
  white-space: pre;
  text-shadow: 0 0 2px var(--glow), 0 0 8px var(--glow);
  min-height: 60vh;
}

a { color: var(--hi); }
a:hover, a:focus { background: var(--fg); color: var(--bg); text-shadow: none; outline: none; }

/* one run of non-ASCII glyphs, pinned to N monospace cells (width set inline) */
.u {
  display: inline-block;
  overflow: hidden;
  vertical-align: top;
  white-space: pre;
  text-align: left;
}

.dim { color: var(--dim); }
.hi { color: var(--hi); }
.warn { color: var(--warn); text-shadow: 0 0 6px var(--warn); }
.inv { background: var(--fg); color: var(--bg); text-shadow: none; }
.key { color: var(--hi); cursor: pointer; }
.key:hover { background: var(--fg); color: var(--bg); text-shadow: none; }
[data-key] { cursor: pointer; }

.cursor { animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

.flash { animation: flash 0.35s steps(1) infinite; }
@keyframes flash { 50% { background: var(--fg); color: var(--bg); text-shadow: none; } }

#footer {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  padding: 6px 16px;
  font-size: clamp(9px, 1.9vw, 17px);
  line-height: 1.2;
  color: var(--dim);
  background: var(--bg);
  border-top: 1px solid var(--dim);
  text-align: center;
  z-index: 2;
}
#footer .links { white-space: nowrap; }
#footer a { color: var(--fg); }

#scanlines {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 3;
  display: none;
  background:
    repeating-linear-gradient(to bottom, rgba(0,0,0,0) 0, rgba(0,0,0,0) 2px, rgba(0,0,0,0.28) 3px),
    radial-gradient(ellipse at center, rgba(0,0,0,0) 60%, rgba(0,0,0,0.45) 100%);
}
body.scan #scanlines { display: block; }

@media print {
  html, body { background: #fff !important; color: #000 !important; }
  body { font-size: 11pt; padding: 0; }
  #screen { text-shadow: none; color: #000; min-height: 0; }
  #crt { max-width: none; overflow: visible; }
  .dim, .hi, .warn, .key, a { color: #000 !important; text-shadow: none !important; }
  .inv { background: #000 !important; color: #fff !important; }
  .noprint, #scanlines, .cursor { display: none !important; }
  #footer { position: static; color: #000; border-top: 1px solid #000; margin-top: 12pt; text-align: left; }
  #footer a { color: #000; }
}
