/* crt.css - phosphor-terminal styling for the DOM layer.
 *
 * The report splits CRT emulation into two vectors: a GLSL shader for the 3D
 * canvas (see crtShader.js) and pure CSS for the HTML text layers (here). This
 * file delivers the text side: phosphor glow via text-shadow, a black field
 * with radial bloom, and a scanline overlay (::after) at near-zero GPU cost.
 *
 * The phosphor colour is driven by [data-tint] so each edition picks amber /
 * green / cyan to match its mood (and its 3D shader tint).
 */

:root {
  --phosphor: #ffbb33;          /* amber default */
  --phosphor-dim: #b87f1e;
  --link: #44dddd;
  --bg: #06040a;
  --mono: "Courier New", "DejaVu Sans Mono", ui-monospace, monospace;
}

[data-tint="green"] { --phosphor: #6cff8a; --phosphor-dim: #3f9e54; --link: #aaffcc; }
[data-tint="cyan"]  { --phosphor: #66e9ff; --phosphor-dim: #3aa6bd; --link: #ffe066; }
[data-tint="amber"] { --phosphor: #ffbb33; --phosphor-dim: #b87f1e; --link: #44dddd; }

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--phosphor);
  font-family: var(--mono);
  overflow: hidden;
}

/* Uneven centre bloom of an illuminated tube. */
body {
  background:
    radial-gradient(ellipse at 50% 45%, rgba(255,255,255,0.05), transparent 60%),
    var(--bg);
}

/* Global scanline + flicker overlay across the whole screen. */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 50;
  background:
    repeating-linear-gradient(
      to bottom,
      rgba(0,0,0,0) 0px,
      rgba(0,0,0,0) 1px,
      rgba(0,0,0,0.22) 1px,
      rgba(0,0,0,0.22) 2px
    ),
    radial-gradient(ellipse at center, transparent 55%, rgba(0,0,0,0.55) 100%);
  animation: flicker 5s infinite steps(60);
}

@keyframes flicker {
  0%, 100% { opacity: 1; }
  48% { opacity: 0.97; }
  50% { opacity: 0.92; }
  52% { opacity: 0.98; }
}

.glow { text-shadow: 0 0 5px var(--phosphor), 0 0 12px rgba(255,255,255,0.12); }

/* ---------------- Launcher (index.html) ---------------- */
.launcher {
  position: relative;
  z-index: 1;
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4vh 6vw;
  gap: 2.2rem;
  text-align: center;
}
.launcher h1 {
  font-size: clamp(1.6rem, 5vw, 3rem);
  letter-spacing: 0.3em;
  margin: 0;
  text-shadow: 0 0 8px var(--phosphor), 0 0 22px rgba(255,255,255,0.15);
}
.launcher .tagline { color: var(--phosphor-dim); max-width: 40ch; line-height: 1.5; }
.edition-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.2rem;
  width: min(960px, 100%);
}
.edition-card {
  border: 1px solid var(--phosphor-dim);
  background: rgba(255,255,255,0.02);
  padding: 1.1rem 1.2rem;
  text-align: left;
  text-decoration: none;
  color: var(--phosphor);
  transition: background 0.15s, box-shadow 0.15s, transform 0.1s;
  display: block;
}
.edition-card:hover, .edition-card:focus {
  background: rgba(255,255,255,0.06);
  box-shadow: 0 0 14px var(--phosphor-dim);
  transform: translateY(-2px);
  outline: none;
}
.edition-card .genre { color: var(--link); font-size: 0.75rem; letter-spacing: 0.2em; }
.edition-card h2 { margin: 0.3rem 0 0.5rem; font-size: 1.15rem; letter-spacing: 0.08em; }
.edition-card p { margin: 0; color: var(--phosphor-dim); font-size: 0.85rem; line-height: 1.45; }
.boot-log { color: var(--phosphor-dim); font-size: 0.8rem; min-height: 1.2em; white-space: pre-wrap; }
.footer-note { color: var(--phosphor-dim); font-size: 0.72rem; max-width: 60ch; line-height: 1.5; }

/* ---------------- Game shell (play.html) ---------------- */
/* The 2.5D canvas is a fixed backdrop. CSS sizes it (the renderer reads its
 * clientWidth/Height): full-screen on mobile, the area left of the docked
 * terminal on desktop. */
#scene-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 0;
  display: block;
}
@media (min-width: 721px) {
  #scene-canvas { width: calc(100vw - 600px); }
}

#hud {
  position: relative;
  z-index: 2;
  height: 100vh;
  display: flex;
  flex-direction: column;
  margin-left: auto;                 /* dock the terminal to the right on desktop */
  width: min(640px, 100%);
  background: linear-gradient(to right, transparent, rgba(3,2,6,0.78) 12%);
}

#hud header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.6rem 1rem;
  border-bottom: 1px solid var(--phosphor-dim);
}
#hud header #game-title { font-size: 0.95rem; letter-spacing: 0.18em; }
#hud header nav { display: flex; gap: 0.8rem; align-items: center; }
#hud header a, #hud header button {
  color: var(--phosphor);
  background: none;
  border: 1px solid var(--phosphor-dim);
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  padding: 0.3rem 0.6rem;
  cursor: pointer;
  text-decoration: none;
}
#hud header a:hover, #hud header button:hover { background: rgba(255,255,255,0.08); }

#terminal {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 0.8rem 1rem;
}
#output {
  flex: 1;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.5;
  font-size: clamp(0.85rem, 1.5vw, 1rem);
  text-shadow: 0 0 4px var(--phosphor-dim);
  scrollbar-width: thin;
  scrollbar-color: var(--phosphor-dim) transparent;
}
#output > div { margin-bottom: 0.6rem; }
#output .echo { color: var(--link); }
#output .response b { color: #fff; text-shadow: 0 0 8px var(--phosphor); }

/* Context-aware suggestion chips - guide players on what they can type. */
#suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0.5rem 0 0.2rem;
  max-height: 5.6em;
  overflow-y: auto;
}
#suggestions .chip {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  color: var(--phosphor);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--phosphor-dim);
  border-radius: 2px;
  padding: 0.22rem 0.55rem;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.12s, box-shadow 0.12s;
}
#suggestions .chip:hover,
#suggestions .chip:focus {
  background: rgba(255, 255, 255, 0.12);
  box-shadow: 0 0 8px var(--phosphor-dim);
  outline: none;
}

#cmd-form {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border-top: 1px solid var(--phosphor-dim);
  padding-top: 0.7rem;
  margin-top: 0.4rem;
}
#cmd-form .prompt { color: var(--phosphor); }
#cmd {
  flex: 1;
  background: none;
  border: none;
  color: var(--phosphor);
  font-family: var(--mono);
  font-size: clamp(0.9rem, 1.6vw, 1.05rem);
  outline: none;
  caret-color: var(--phosphor);
  text-shadow: 0 0 6px var(--phosphor);
}
#cmd::placeholder { color: var(--phosphor-dim); }

/* On narrow screens the text parser takes prominence (report §6.1): the
 * terminal fills the screen and the 3D recedes to a backdrop. */
@media (max-width: 720px) {
  #hud { width: 100%; background: rgba(3,2,6,0.82); }
}
