:root {
  --bg: #050810;
  --bg-glow: #0a1220;
  --fg: #7cffb0;
  --dim: #2c6845;
  --accent: #ff2bd6;
  --accent2: #00d9ff;
  --warn: #ffb347;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: #000;
  font-family: 'Courier New', 'Consolas', monospace;
  color: var(--fg);
  font-size: 16px;
}

body {
  display: flex;
  justify-content: center;
  padding: 1.5rem;
}

#crt {
  width: 100%;
  max-width: 820px;
  border: 2px solid var(--dim);
  border-radius: 6px;
  padding: 1.2rem 1.4rem;
  background:
    radial-gradient(ellipse at center, var(--bg-glow) 0%, var(--bg) 80%);
  box-shadow:
    0 0 30px rgba(124, 255, 176, 0.15) inset,
    0 0 40px rgba(255, 43, 214, 0.08);
  position: relative;
  overflow: hidden;
  min-height: 88vh;
  display: flex;
  flex-direction: column;
}

/* CRT scanlines */
#crt::before {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0) 0px,
    rgba(0, 0, 0, 0) 2px,
    rgba(0, 0, 0, 0.18) 3px,
    rgba(0, 0, 0, 0) 4px
  );
  pointer-events: none;
  z-index: 2;
}

/* subtle screen flicker */
#crt::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(124, 255, 176, 0.02);
  pointer-events: none;
  animation: flicker 6s infinite;
  z-index: 1;
}

@keyframes flicker {
  0%, 96%, 100% { opacity: 1; }
  97% { opacity: 0.85; }
  98% { opacity: 1; }
  99% { opacity: 0.92; }
}

#hud {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  border-bottom: 1px dashed var(--dim);
  padding-bottom: 0.6rem;
  margin-bottom: 1rem;
  font-size: 0.85rem;
  letter-spacing: 0.1em;
  position: relative;
  z-index: 3;
}

.title {
  color: var(--accent);
  font-weight: bold;
  text-shadow: 0 0 8px var(--accent);
  font-size: 1rem;
}

.subtitle {
  color: var(--dim);
  font-weight: normal;
  text-shadow: none;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
}

.stats { display: flex; gap: 1rem; }

.stat { color: var(--accent2); }
.stat b {
  color: var(--fg);
  font-weight: normal;
  text-shadow: 0 0 6px rgba(124, 255, 176, 0.6);
}

#screen {
  flex: 1;
  position: relative;
  z-index: 3;
  display: flex;
  flex-direction: column;
}

#log {
  white-space: pre-wrap;
  margin-bottom: 1.2rem;
  line-height: 1.6;
  flex: 1;
}

.scene-text {
  margin: 0 0 0.8rem 0;
}

.scene-text.flavor {
  color: var(--dim);
  font-style: italic;
}

.scene-text.system {
  color: var(--warn);
  font-size: 0.9rem;
}

#choices {
  list-style: none;
  padding: 0;
  margin: 0;
}

#choices li {
  padding: 0.5rem 0.8rem;
  border-left: 2px solid var(--dim);
  margin-bottom: 0.4rem;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

#choices li:hover {
  border-left-color: var(--accent);
  color: var(--accent);
  background: rgba(255, 43, 214, 0.06);
  padding-left: 1.2rem;
  text-shadow: 0 0 6px rgba(255, 43, 214, 0.5);
}

#choices li.locked {
  color: var(--dim);
  cursor: not-allowed;
  font-style: italic;
}

#choices li.locked:hover {
  border-left-color: var(--dim);
  color: var(--dim);
  background: none;
  padding-left: 0.8rem;
  text-shadow: none;
}

footer {
  border-top: 1px dashed var(--dim);
  margin-top: 1rem;
  padding-top: 0.6rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.78rem;
  color: var(--dim);
  position: relative;
  z-index: 3;
}

#inventory-display {
  flex: 1;
  letter-spacing: 0.05em;
}

#restart {
  background: none;
  color: var(--dim);
  border: 1px solid var(--dim);
  padding: 0.3rem 0.7rem;
  font-family: inherit;
  font-size: 0.75rem;
  cursor: pointer;
  letter-spacing: 0.1em;
  transition: all 0.15s;
}

#restart:hover {
  color: var(--accent);
  border-color: var(--accent);
  text-shadow: 0 0 6px var(--accent);
}

.ascii-art {
  white-space: pre;
  font-family: 'Courier New', 'Consolas', monospace;
  color: var(--accent);
  text-shadow:
    0 0 8px var(--accent),
    0 0 16px rgba(255, 43, 214, 0.4);
  line-height: 1.0;
  letter-spacing: 0;
  font-size: 0.85rem;
  margin: 0 0 1.2rem 0;
  overflow-x: auto;
  user-select: none;
}

.cover-image {
  display: block;
  width: 100%;
  height: auto;
  margin: 0 auto 1.2rem auto;
  border: 1px solid var(--dim);
  box-shadow:
    0 0 12px rgba(255, 43, 214, 0.35),
    0 0 24px rgba(0, 217, 255, 0.18);
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.cursor::after {
  content: '\2588';
  margin-left: 2px;
  color: var(--accent);
  animation: blink 1s steps(2) infinite;
}

@keyframes blink {
  50% { opacity: 0; }
}

@media (max-width: 600px) {
  body { padding: 0.5rem; }
  #crt { padding: 0.8rem; }
  #hud { font-size: 0.75rem; }
  .stats { gap: 0.6rem; }
}
