/* fail=true — terminal / CRT aesthetic. No external fonts, no deps. */

:root {
  --bg: #0a0e0a;
  --panel: #0f140f;
  --ink: #7dff8a;
  --ink-dim: #3f7d46;
  --amber: #ffcf5c;
  --danger: #ff5c5c;
  --border: #1d2a1d;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 16px;
  line-height: 1.5;
}

body {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

#screen {
  width: 100%;
  max-width: 760px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 0 0 1px rgba(125, 255, 138, 0.05), 0 24px 80px rgba(0, 0, 0, 0.6);
  padding: 22px 24px 26px;
  position: relative;
  overflow: hidden;
  transition: box-shadow 0.4s ease;
}

/* CRT scanline overlay */
#screen::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  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
  );
  mix-blend-mode: multiply;
}

#screen.danger { box-shadow: 0 0 0 1px rgba(255, 207, 92, 0.25), 0 0 60px rgba(255, 207, 92, 0.08); }
#screen.critical {
  box-shadow: 0 0 0 1px rgba(255, 92, 92, 0.4), 0 0 80px rgba(255, 92, 92, 0.15);
  animation: jitter 0.18s infinite;
}
@keyframes jitter {
  0% { transform: translate(0, 0); }
  25% { transform: translate(-0.5px, 0.5px); }
  50% { transform: translate(0.5px, -0.5px); }
  75% { transform: translate(-0.5px, -0.5px); }
  100% { transform: translate(0, 0); }
}

/* --- header / HUD ----------------------------------------------------- */
.hud { margin-bottom: 18px; }

.brand {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 14px;
}
.brand h1 {
  font-size: 20px;
  margin: 0;
  letter-spacing: 1px;
}
.brand h1 .eq { color: var(--amber); }
.brand .tagline { color: var(--ink-dim); font-size: 12px; }
.cursor { animation: blink 1s step-end infinite; color: var(--amber); }
@keyframes blink { 50% { opacity: 0; } }

.meter-row {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  color: var(--ink-dim);
}
.meter-label { white-space: nowrap; }
.meter {
  flex: 1;
  height: 14px;
  background: #08120a;
  border: 1px solid var(--border);
  border-radius: 3px;
  overflow: hidden;
}
#meter-fill {
  height: 100%;
  width: 12%;
  background: linear-gradient(90deg, var(--ink), var(--amber) 70%, var(--danger));
  transition: width 0.5s ease;
}
.meter-stats { white-space: nowrap; color: var(--ink); }
.meter-stats b { color: var(--amber); }

/* --- scenario --------------------------------------------------------- */
#scenario-title {
  font-size: 13px;
  letter-spacing: 1.5px;
  color: var(--amber);
  margin: 18px 0 8px;
  text-transform: uppercase;
}
#scenario-title.doom {
  color: var(--danger);
  font-size: 18px;
  animation: blink 0.7s step-end infinite;
}
#scenario-prompt {
  margin: 0 0 16px;
  color: var(--ink);
}
#scenario-prompt code, #result code {
  color: var(--amber);
  background: rgba(255, 207, 92, 0.08);
  padding: 0 4px;
  border-radius: 3px;
}

#result {
  min-height: 0;
  margin: 0 0 16px;
  color: var(--amber);
  border-left: 2px solid var(--amber);
  padding-left: 12px;
  opacity: 0;
  max-height: 0;
  overflow: hidden;
  transition: opacity 0.4s ease, max-height 0.4s ease;
}
#result.show { opacity: 1; max-height: 320px; }

.final-eval {
  display: block;
  margin-top: 10px;
  color: var(--ink-dim);
  font-size: 13px;
}

/* --- choices ---------------------------------------------------------- */
#choices { display: flex; flex-direction: column; gap: 10px; }
.choice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  text-align: left;
  background: #0c130c;
  color: var(--ink);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 12px 14px;
  font-family: var(--mono);
  font-size: 14px;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.05s ease;
}
.choice:hover:not(:disabled) {
  border-color: var(--ink);
  background: #101a10;
}
.choice:active:not(:disabled) { transform: translateY(1px); }
.choice:disabled { opacity: 0.4; cursor: default; }
.choice-text::before { content: "› "; color: var(--ink-dim); }
.choice-cost {
  font-size: 11px;
  color: var(--danger);
  white-space: nowrap;
  opacity: 0.8;
}
.choice.restart { justify-content: center; border-color: var(--ink-dim); margin-top: 4px; }
.choice.restart .choice-text::before { content: ""; }

.endgame-stats {
  margin: 4px 0 6px;
  padding: 14px;
  border: 1px dashed var(--border);
  border-radius: 5px;
  background: rgba(255, 92, 92, 0.04);
}
.endgame-stats p { margin: 0 0 8px; }
.endgame-stats p:last-child { margin-bottom: 0; }
.endgame-stats .verdict { color: var(--amber); font-style: italic; }

/* --- incident log ----------------------------------------------------- */
.log-wrap { margin-top: 20px; }
.log-wrap summary {
  cursor: pointer;
  color: var(--ink-dim);
  font-size: 12px;
  letter-spacing: 1px;
  text-transform: uppercase;
  user-select: none;
}
#log {
  list-style: none;
  margin: 10px 0 0;
  padding: 10px;
  max-height: 150px;
  overflow-y: auto;
  background: #080d08;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 12px;
  color: var(--ink-dim);
}
#log li { padding: 2px 0; border-bottom: 1px solid rgba(29, 42, 29, 0.5); }
#log li:last-child { border-bottom: none; color: var(--ink); }

footer {
  margin-top: 18px;
  text-align: center;
  color: var(--ink-dim);
  font-size: 11px;
}
footer a { color: var(--ink-dim); }

@media (max-width: 520px) {
  body { padding: 10px; }
  #screen { padding: 16px; }
  .choice-cost { display: none; }
}
