/* A Bigger Fish, Terminal Edition. CRT look forked from skills-sim viz-terminal. Deliberately single-theme (dark). */

:root {
  --green: #33ff33;
  --green-dim: #2a7a2a;
  --amber: #ffaa00;
  --red: #ff4444;
  --cyan: #00e5ff;
  --border: #1f6b1f;
  --bg: #050805;
  --glow-sm: 0 0 4px rgba(51, 255, 51, 0.4);
  --glow-lg: 0 0 12px rgba(51, 255, 51, 0.35), 0 0 4px rgba(51, 255, 51, 0.7);
  color-scheme: dark;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  width: 100%;
  height: 100%;
  background: #000;
  font-family: 'IBM Plex Mono', 'Courier New', monospace;
}

#crt {
  position: relative;
  min-width: 100vw;
  min-height: 100vh;
  display: flex;
  align-items: flex-start;
  justify-content: safe center; /* overflowing content stays scrollable from the left edge */
  background: radial-gradient(ellipse at center, #0d1a0d 0%, #050505 80%);
  overflow: auto;
}

#crt::before {
  content: '';
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse at center, transparent 60%, rgba(0, 0, 0, 0.5) 100%);
  pointer-events: none;
  z-index: 10;
}

#scanlines {
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(to bottom, transparent 0, transparent 2px, rgba(0, 0, 0, 0.12) 2px, rgba(0, 0, 0, 0.12) 4px);
  pointer-events: none;
  z-index: 5;
  animation: scanFlicker 8s ease-in-out infinite;
}

@keyframes scanFlicker {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 0.45; }
  93% { opacity: 0.8; }
}

/* 120 columns: IBM Plex Mono is 0.6em wide, so 120ch = 72em. About 50 lines at 1.2 = 60em. */
#terminal {
  position: relative;
  z-index: 2;
  color: var(--green);
  font-size: clamp(4.5px, min(calc((100vw - 16px) / 73), calc((100vh - 12px) / 61)), 18px);
  line-height: 1.2;
  white-space: pre;
  padding: 6px 8px;
  text-shadow: var(--glow-sm);
  user-select: none;
  animation: phosphorPulse 4s ease-in-out infinite;
}

/* Skill letters */
#terminal .kA { color: #c77dff; }
#terminal .kB { color: #5599ff; }
#terminal .kC { color: #33cccc; }
#terminal .kD { color: #ff6fae; }
#terminal .kF { color: #66ee88; }
#terminal .kG { color: #ffd23f; }
#terminal .kH { color: #ff5544; }
#terminal .kS { color: #ff9933; }

#terminal .green { color: var(--green); }
#terminal .dim { color: var(--green-dim); text-shadow: none; }
#terminal .amber { color: var(--amber); text-shadow: 0 0 6px rgba(255, 170, 0, 0.4); }
#terminal .red { color: var(--red); text-shadow: 0 0 6px rgba(255, 51, 51, 0.4); }
#terminal .cyan { color: var(--cyan); text-shadow: 0 0 6px rgba(0, 255, 255, 0.3); }
#terminal .bold { font-weight: 700; }
#terminal .border { color: var(--border); }
#terminal .done { opacity: 0.45; text-decoration: underline; }
#terminal .active { color: #fff; text-shadow: 0 0 8px rgba(255, 255, 255, 0.8); }
#terminal .blink { animation: blink-cursor 1s step-end infinite; }
#terminal .pts { color: var(--amber); }
#terminal .key { color: #6a6a6a; }
#terminal .key-char { color: var(--cyan); font-weight: 700; }
#terminal .bar-full { color: var(--green); }
#terminal .bar-empty { color: #1a3a1a; }
#terminal .btn { cursor: pointer; }
#terminal a.link { color: inherit; text-decoration: underline; text-underline-offset: 3px; }
#terminal a.link:hover, #terminal a.link:focus-visible { text-shadow: var(--glow-lg); outline: none; }
#terminal .btn:hover { text-shadow: var(--glow-lg); }

@keyframes blink-cursor {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

@keyframes phosphorPulse {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.04); }
}

@media (prefers-reduced-motion: reduce) {
  #scanlines, #terminal, #terminal .blink { animation: none; }
}
