:root {
  --fg: #A8FF00;           /* main phosphor green */
  --fg-dim: #6B9900;       /* addresses, garbage */
  --fg-bright: #CCFF66;    /* highlights */
  --bg: #000800;           /* screen bg */
  --bg-line: #001000;
  --border: #334400;
  --danger: #FF3300;       /* lockout red */
  --warning: #FFFF00;      /* brackets */
  --success: #00FF66;      /* win green */
  --scanline: rgba(0,0,0,0.35);
}

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

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

html {
  background: #000;
}

body { background: #000; }

body {
  font-family: 'VT323', monospace;
  background: #000;
  color: var(--fg);
  line-height: 1.35;
  min-height: 100vh;
  padding: 3rem 1rem 5rem;
  font-size: 20px;
}

/* CRT */
.crt-overlay {
  position: fixed; inset: 0; pointer-events: none; z-index: 1000;
  background: radial-gradient(ellipse at center, transparent 40%, rgba(0,0,0,0.6) 100%);
  animation: vignette 5s ease-in-out infinite alternate;
}
@keyframes vignette { 0% { opacity: 0.25; } 100% { opacity: 0.45; } }

.scanlines {
  position: fixed; inset: 0; pointer-events: none; z-index: 999;
  background: repeating-linear-gradient(0deg, transparent, transparent 2px, var(--scanline) 2px, var(--scanline) 4px);
  animation: scanline-move 0.12s linear infinite;
}
@keyframes scanline-move { 0% { background-position: 0 0; } 100% { background-position: 0 4px; } }

/* Terminal frame */
.terminal {
  width: 100%;
  max-width: 1100px;
  height: 70vh;               
  max-height: 720px;
  min-height: 520px;
  margin: 0 auto;      
  background: var(--bg);
  border: 4px solid var(--border);
  box-shadow:
    0 0 40px rgba(168, 255, 0, 0.08),
    inset 0 0 100px rgba(0, 0, 0, 0.9),
    0 0 0 2px rgba(168, 255, 0, 0.05);
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 10;
  font-family: 'VT323', monospace;
  border-radius: 0;
}

.terminal-header { padding: 1rem 1.5rem; background: var(--bg); border-bottom: 2px solid var(--border); flex-shrink: 0; }
.header-content { display: flex; flex-direction: column; gap: 0.5rem; }
.robco-logo { color: var(--fg); letter-spacing: 0.03em; font-size: 1.2rem; text-shadow: 0 0 6px var(--fg), 0 0 12px var(--fg); }
.prompt { color: var(--fg); font-size: 1.1rem; letter-spacing: 0.06em; animation: blink-prompt 1.4s ease-in-out infinite; }
@keyframes blink-prompt { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

.attempts-display { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; font-family: 'Share Tech Mono', monospace; font-size: 1rem; }
.attempts-label { color: var(--fg-dim); }
.attempt-box { font-family: 'VT323', monospace; font-size: 1.1rem; color: var(--fg); user-select: none; }
.attempt-box.used { color: var(--danger); text-shadow: 0 0 4px var(--danger); }

/* Body — 2 columns */
.terminal-body {
  flex: 1; overflow-y: auto; padding: 0.75rem 1.5rem 1rem;
  background: var(--bg); font-family: 'VT323', monospace; font-size: 1rem; line-height: 1.45;
  column-count: 1; column-gap: 3rem; column-fill: auto;
}
@media (min-width: 900px) { .terminal-body { column-count: 2; } }

.hex-line { break-inside: avoid; display: flex; gap: 1.5rem; padding: 0.1rem 0; white-space: pre; transition: background 0.1s; }
.hex-line:hover { background: rgba(168, 255, 0, 0.04); }
.hex-line.selected { background: rgba(168, 255, 0, 0.08); outline: 1px solid rgba(168,255,0,0.15); }
.hex-line.guessed { pointer-events: none; opacity: 0.7; }

.hex-address { color: var(--fg-dim); min-width: 6.5ch; font-family: 'Share Tech Mono', monospace; font-size: 0.95rem; user-select: none; flex-shrink: 0; }
.hex-content { flex: 1; font-family: 'VT323', monospace; letter-spacing: 0.01em; }

.word-candidate { color: var(--fg); background: transparent; transition: all 0.08s; cursor: pointer; padding: 0 2px; }
.word-candidate:hover { background: rgba(168, 255, 0, 0.12); text-shadow: 0 0 4px var(--fg); color: #fff; }
.word-candidate.selected { background: rgba(168, 255, 0, 0.2); text-shadow: 0 0 6px var(--fg); }
.word-candidate.guessed { color: var(--warning); text-shadow: 0 0 2px var(--warning); }
.word-candidate.correct { color: var(--fg-bright); background: rgba(168, 255, 0, 0.25); animation: correct-pulse 1s ease-out; }
@keyframes correct-pulse { 0% { background: rgba(168,255,0,0.4); } 100% { background: rgba(168, 255, 0, 0.25); } }

.bracket-pair { color: var(--warning); cursor: pointer; transition: all 0.08s; padding: 0 2px; }
.bracket-pair:hover { background: rgba(255, 255, 0, 0.1); text-shadow: 0 0 4px var(--warning); color: #fff; }
.bracket-pair.used { color: var(--fg-dim); text-decoration: line-through; cursor: default; }

.garbage { color: var(--fg-dim); opacity: 0.65; }

.result-badge { display: inline-block; margin-left: 1rem; padding: 0 0.5rem; font-family: 'Share Tech Mono', monospace; font-size: 0.8rem; color: var(--warning); opacity: 0; transform: translateX(-8px); transition: all 0.15s ease; white-space: nowrap; }
.hex-line.guessed .result-badge { opacity: 1; transform: translateX(0); }
.hex-line.correct .result-badge { color: var(--fg-bright); }

.terminal-footer { padding: 0.5rem 1.5rem; background: var(--bg); border-top: 2px solid var(--border); flex-shrink: 0; display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.status-line { font-family: 'Share Tech Mono', monospace; font-size: 0.95rem; min-height: 1.3em; color: var(--fg); }
.status-line.success { color: var(--success); animation: blink-status 1s ease-in-out infinite; }
@keyframes blink-status { 0%,100% { opacity: 1; } 50% { opacity: 0.5; } }
.status-line.fail { color: var(--danger); }
.footer-hint { font-family: 'Share Tech Mono', monospace; font-size: 0.65rem; color: var(--fg-dim); white-space: nowrap; }

/* ===== OVERLAYS (common) ===== */
.overlay {
  position: absolute; inset: 0;
  background: rgba(0, 0, 0, 0.95);
  display: none; flex-direction: column; justify-content: center; align-items: center;
  gap: 1.5rem; z-index: 50; padding: 2rem; text-align: center;
}
.overlay.visible { display: flex; }

.seo-description {
  max-width: 850px;
  margin: 4rem auto 0;        
  padding: 0 1.5rem 3rem;
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.85rem;
  line-height: 1.6;
  color: var(--fg-dim);
  opacity: 0.7;
  text-align: left;
}

.seo-description h1 {
  font-family: 'VT323', monospace;
  font-size: 1.8rem;
  color: var(--fg);
  margin-bottom: 1rem;
  letter-spacing: 0.02em;
  text-shadow: 0 0 4px var(--fg);
}
.seo-description h2 {
  font-family: 'VT323', monospace;
  font-size: 1.3rem;
  color: var(--fg-bright);
  margin: 2rem 0 0.75rem;
  letter-spacing: 0.02em;
}
.seo-description p { margin: 0 0 0.75rem; }

.overlay-gif {
  max-width: 100%; max-height: 300px;
  image-rendering: pixelated;
  animation: gif-flicker 0.15s steps(1) infinite;
}
@keyframes gif-flicker { 0%, 100% { opacity: 1; } 50% { opacity: 0.7; } }

.overlay-title { font-family: 'VT323', monospace; font-size: 2.5rem; letter-spacing: 0.1em; animation: overlay-blink 0.6s ease-in-out infinite; }
@keyframes overlay-blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }

.overlay-hint { font-family: 'Share Tech Mono', monospace; font-size: 1rem; letter-spacing: 0.05em; }

/* Lockout (red) */
.lockout-overlay .overlay-gif { filter: drop-shadow(0 0 12px var(--danger)); }
.lockout-overlay .overlay-title { color: var(--danger); text-shadow: 0 0 10px var(--danger), 0 0 20px var(--danger); }
.lockout-overlay .overlay-hint { color: var(--fg-dim); }

/* Success (green) */
.success-overlay .overlay-gif { filter: drop-shadow(0 0 12px var(--success)); }
.success-overlay .overlay-title { color: var(--success); text-shadow: 0 0 10px var(--success), 0 0 20px var(--success); }
.success-overlay .overlay-hint { color: var(--fg-dim); }

/* Scrollbar */
.terminal-body::-webkit-scrollbar { width: 8px; }
.terminal-body::-webkit-scrollbar-track { background: var(--bg); }
.terminal-body::-webkit-scrollbar-thumb { background: var(--border); border: 2px solid var(--bg); }
.terminal-body::-webkit-scrollbar-thumb:hover { background: var(--fg-dim); }

/* Mobile */
@media (max-width: 600px) {
  body { font-size: 16px; padding: 2rem 0.75rem 4rem; }
  .terminal { height: 80vh; max-height: none; min-height: 480px; border-width: 2px; }
  .robco-logo { font-size: 1rem; }
  .prompt { font-size: 0.95rem; }
  .attempt-box { font-size: 1rem; }
  .hex-line { gap: 1rem; }
  .hex-address { min-width: 5.5ch; font-size: 0.85rem; }
  .footer-hint { font-size: 0.55rem; }
  .overlay-title { font-size: 1.8rem; }
  .seo-description { font-size: 0.75rem; margin-top: 2.5rem; }
  .seo-description h1 { font-size: 1.5rem; }
  .seo-description h2 { font-size: 1.1rem; }
}