:root {
  --bg: #0a0a0a;
  --fg: #00ff41;
  --bright: #b6ffcb;
  --dim: #1f7a34;
  --label: #55655a;
  --amber: #ffb000;
  --red: #ff3131;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
}

body {
  color: var(--fg);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 13px;
  line-height: 1.5;
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
}

/* --- screen ------------------------------------------------------------ */

#screen {
  max-width: 760px;
  margin: 0 auto;
  min-height: 100dvh;
  padding:
    calc(14px + env(safe-area-inset-top))
    calc(14px + env(safe-area-inset-right))
    calc(40px + env(safe-area-inset-bottom))
    calc(14px + env(safe-area-inset-left));
  text-shadow: 0 0 6px rgba(0, 255, 65, 0.45);
}

.line {
  white-space: pre-wrap;
  word-break: break-word;
  min-height: 1.5em;
}

.cmd    { color: var(--bright); }
.ok     { color: var(--fg); }
.warn   { color: var(--red); text-shadow: 0 0 6px rgba(255, 49, 49, 0.5); }
.amber  { color: var(--amber); text-shadow: 0 0 6px rgba(255, 176, 0, 0.45); }
.muted  { color: var(--dim); }

.spacer { height: 1.5em; }

/* aligned key/value dump — a long value wraps under itself, not under the key */
.field {
  padding-left: 9ch;
  text-indent: -9ch;
}
.field .k {
  display: inline-block;
  width: 9ch;
  color: var(--label);
  text-shadow: none;
  /* text-indent is inherited and would apply again inside this inline-block */
  text-indent: 0;
}
.field .v { color: var(--bright); }

.big {
  font-size: clamp(1.7rem, 9.5vw, 3.4rem);
  line-height: 1.15;
  letter-spacing: 0.06em;
  font-weight: 700;
  margin: 0.5em 0;
  color: var(--fg);
  text-shadow: 0 0 18px rgba(0, 255, 65, 0.7);
}

.cursor {
  display: inline-block;
  width: 0.6em;
  height: 1em;
  background: var(--fg);
  vertical-align: -0.13em;
  box-shadow: 0 0 8px rgba(0, 255, 65, 0.7);
  animation: blink 1s steps(1) infinite;
}

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

/* --- reveal ------------------------------------------------------------ */

#reveal {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 78dvh;
  animation: fade-up 0.7s ease-out both;
}

#reveal h1 {
  font-size: clamp(1.5rem, 7.5vw, 2.6rem);
  line-height: 1.2;
  letter-spacing: 0.04em;
  margin: 0 0 1.2em;
  color: var(--fg);
  text-shadow: 0 0 18px rgba(0, 255, 65, 0.7);
}

#reveal p {
  margin: 0 0 0.9em;
  max-width: 46ch;
  font-size: 14px;
  line-height: 1.75;
  color: var(--bright);
}

#reveal p.note {
  color: var(--dim);
  text-shadow: none;
}

#reveal a {
  display: inline-block;
  margin-top: 1.6em;
  padding: 0.7em 1.1em;
  border: 1px solid var(--dim);
  color: var(--fg);
  text-decoration: none;
  align-self: flex-start;
}

#reveal a:hover,
#reveal a:focus-visible {
  background: rgba(0, 255, 65, 0.1);
  border-color: var(--fg);
}

@keyframes fade-up {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}

/* --- CRT overlay ------------------------------------------------------- */

#crt {
  position: fixed;
  inset: 0;
  z-index: 9;
  pointer-events: none;
  background: repeating-linear-gradient(
    180deg,
    rgba(0, 0, 0, 0) 0 2px,
    rgba(0, 0, 0, 0.3) 2px 4px
  );
  animation: crt-flicker 5s ease-in-out infinite;
}

#crt::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0) 52%, rgba(0, 0, 0, 0.6) 100%);
}

@keyframes crt-flicker {
  0%, 100% { opacity: 1; }
  47%      { opacity: 0.88; }
  49%      { opacity: 1; }
  52%      { opacity: 0.92; }
}

/* --- glitch pass ------------------------------------------------------- */

.glitch { animation: glitch 0.6s steps(2) 1; }

@keyframes glitch {
  0%   { transform: none; filter: none; }
  20%  { transform: translate(-3px, 1px); filter: hue-rotate(70deg); }
  40%  { transform: translate(4px, -2px); filter: invert(1); }
  60%  { transform: translate(-2px, 2px); filter: hue-rotate(-60deg); }
  80%  { transform: translate(2px, 0); filter: brightness(2.4); }
  100% { transform: none; filter: none; }
}

/* --- hint -------------------------------------------------------------- */

#hint {
  position: fixed;
  z-index: 10;
  left: 0;
  right: 0;
  bottom: calc(10px + env(safe-area-inset-bottom));
  text-align: center;
  font-size: 11px;
  letter-spacing: 0.14em;
  color: var(--dim);
  pointer-events: none;
  animation: fade-in 0.6s ease-out both;
}

#hint[hidden] { display: none; }

@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

/* --- reduced motion ---------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  #crt, .cursor, #reveal, .glitch { animation: none; }
}
