:root {
  --bg: #10150c;
  --panel: #1b2114;
  --panel-edge: #5f6a38;
  --screen: #121907;
  --screen-glow: rgba(131, 255, 114, 0.18);
  --phosphor: #91ff66;
  --phosphor-dim: #5bcf4a;
  --amber: #ffb347;
  --danger: #ff6d5e;
  --paper: #d2f2b4;
  --shadow: rgba(0, 0, 0, 0.45);
  --console-font: "VT323", monospace;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  color: var(--paper);
  background:
    radial-gradient(circle at top, rgba(89, 105, 54, 0.24), transparent 36%),
    linear-gradient(180deg, #2c2412 0%, #15170d 45%, #070905 100%);
  font-family: "VT323", monospace;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.18;
  background-image: linear-gradient(rgba(255, 255, 255, 0.04) 50%, transparent 50%);
  background-size: 100% 4px;
}

.page-shell {
  width: min(1200px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1.5rem 0 2rem;
}

.masthead {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: start;
  margin-bottom: 1.25rem;
}

.eyebrow {
  margin: 0 0 0.75rem;
  color: var(--amber);
  letter-spacing: 0.18em;
}

h1,
h2,
button {
  font-family: "Press Start 2P", cursive;
}

h1 {
  margin: 0;
  font-size: clamp(1.25rem, 3vw, 2rem);
  line-height: 1.35;
  color: #ffe79b;
  text-shadow: 0 0 10px rgba(255, 231, 155, 0.25);
}

h2 {
  margin: 0 0 0.75rem;
  font-size: 0.75rem;
  color: var(--amber);
}

.status-lights {
  display: flex;
  gap: 0.45rem;
  padding-top: 0.25rem;
}

.light {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  border: 2px solid rgba(0, 0, 0, 0.35);
  box-shadow: 0 0 12px currentColor;
}

.light-red {
  color: var(--danger);
  background: currentColor;
}

.light-amber {
  color: var(--amber);
  background: currentColor;
}

.light-green {
  color: var(--phosphor);
  background: currentColor;
}

.console-layout {
  display: block;
}

.panel {
  background: linear-gradient(180deg, #31341f 0%, #202715 100%);
  border: 3px solid var(--panel-edge);
  box-shadow: 0 18px 36px var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.control-panel {
  padding: 1rem;
  display: grid;
  gap: 1rem;
  align-content: start;
}

.telemetry {
  margin: 0;
  display: grid;
  gap: 0.65rem;
}

.telemetry div {
  display: grid;
  gap: 0.15rem;
}

.telemetry dt {
  color: #ffda7b;
}

.telemetry dd {
  margin: 0;
  color: var(--phosphor);
  word-break: break-word;
}

.tiny {
  font-size: 0.8em;
}

.button-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.6rem;
}

.button-grid.mini {
  margin-top: 0.25rem;
}

.button-grid.mini button {
  padding: 0.55rem 0.5rem;
  font-size: 0.55rem;
}

.list-pane {
  list-style: none;
  margin: 0.75rem 0 0;
  padding: 0.45rem;
  border: 2px solid #51632e;
  background: rgba(8, 12, 4, 0.78);
  max-height: 140px;
  overflow: auto;
  display: grid;
  gap: 0.35rem;
}

.list-pane button {
  width: 100%;
  text-align: left;
  font-family: "VT323", monospace;
  font-size: 1.25rem;
  padding: 0.4rem 0.55rem;
  border: 1px solid #6d7f40;
  background: rgba(0, 0, 0, 0.25);
  color: var(--phosphor);
}

.list-pane button.active {
  background: rgba(145, 255, 102, 0.2);
  border-color: #ffe79b;
  color: #fff6c9;
}

.list-pane .empty {
  color: rgba(210, 242, 180, 0.7);
  padding: 0.4rem 0.45rem;
}

button {
  border: 2px solid #8c7d41;
  background: linear-gradient(180deg, #5a4b1f 0%, #372e12 100%);
  color: #fff2bd;
  padding: 0.9rem 0.75rem;
  font-size: 0.65rem;
  cursor: pointer;
  transition: transform 120ms ease, filter 120ms ease;
}

button:hover,
button:focus-visible {
  transform: translateY(-1px);
  filter: brightness(1.08);
}

.crt {
  padding: 1rem;
}

.crt-bezel {
  padding: 1rem;
  background: linear-gradient(180deg, #665931 0%, #3f371f 100%);
  box-shadow: inset 0 0 0 2px rgba(255, 235, 171, 0.08);
}

.crt-screen {
  position: relative;
  min-height: 70vh;
  display: grid;
  grid-template-rows: 1fr auto auto;
  background:
    radial-gradient(circle at center, rgba(145, 255, 102, 0.08), transparent 55%),
    linear-gradient(180deg, rgba(145, 255, 102, 0.02), rgba(0, 0, 0, 0.1)),
    var(--screen);
  color: var(--phosphor);
  border: 3px solid #394422;
  padding: 1rem;
  box-shadow: inset 0 0 40px var(--screen-glow), inset 0 0 0 1px rgba(145, 255, 102, 0.08);
}

.crt-screen::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.03), transparent 18%),
    linear-gradient(0deg, rgba(0,0,0,0.15), transparent 18%),
    repeating-linear-gradient(180deg, transparent 0 2px, rgba(145, 255, 102, 0.045) 2px 4px);
}

.output {
  position: relative;
  z-index: 1;
  margin: 0;
  font-family: var(--console-font);
  letter-spacing: 0.02em;
  overflow-y: auto;
  overflow-x: hidden;
  max-height: 55vh;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: clamp(1.35rem, 2vw, 1.7rem);
  line-height: 1.05;
  text-shadow: 0 0 10px rgba(145, 255, 102, 0.5);
  padding-right: 0.5rem;
}

.crt-inverse {
  background: #91ff66;
  color: #121907;
}

.crt-flash {
  animation: crt-flash 1s steps(1, end) infinite;
}

@keyframes crt-flash {
  0%, 49% {
    opacity: 1;
  }

  50%, 100% {
    opacity: 0;
  }
}

.output::-webkit-scrollbar {
  width: 12px;
}

.output::-webkit-scrollbar-track {
  background: rgba(8, 12, 4, 0.5);
}

.output::-webkit-scrollbar-thumb {
  background: rgba(145, 255, 102, 0.4);
  border-radius: 6px;
}

.output::-webkit-scrollbar-thumb:hover {
  background: rgba(145, 255, 102, 0.6);
}

.runtime-hint {
  display: none;
  border: 2px solid #51632e;
  background: rgba(8, 12, 4, 0.9);
  color: #d7ff79;
  font-family: var(--console-font);
  font-size: 1rem;
  padding: 0.4rem 0.55rem;
  margin-bottom: 0.5rem;
  grid-column: 1 / -1;
}

.runtime-hint.active {
  display: block;
}

.runtime-hint.warning {
  border-color: #ffb347;
  color: #ffe7b1;
}

.runtime-hint.key {
  border-color: #7db3ff;
  color: #d4e5ff;
}

.command-bar {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.25rem;
  align-items: baseline;
  margin-top: 0;
  background: inherit;
  margin-left: -1rem;
  margin-right: -1rem;
  padding: 0 1rem;
  padding-bottom: 0.5rem;
}

.command-bar::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.03), transparent 18%),
    linear-gradient(0deg, rgba(0,0,0,0.15), transparent 18%),
    repeating-linear-gradient(180deg, transparent 0 2px, rgba(145, 255, 102, 0.045) 2px 4px);
}

.prompt {
  font-family: var(--console-font);
  font-size: 1.9rem;
  color: #d7ff79;
  text-shadow: 0 0 8px rgba(145, 255, 102, 0.35);
  line-height: 1.2;
  padding-top: 0.3rem;
  position: relative;
  z-index: 2;
}

textarea {
  width: 100%;
  min-height: auto;
  resize: none;
  border: none;
  background: transparent;
  color: var(--phosphor);
  font-family: var(--console-font);
  font-size: 1.6rem;
  letter-spacing: 0.02em;
  padding: 0.3rem 0 0.55rem 0;
  text-shadow: 0 0 10px rgba(145, 255, 102, 0.5);
  position: relative;
  z-index: 2;
  caret-color: var(--phosphor);
  caret-shape: block;
}

textarea::placeholder {
  color: rgba(145, 255, 102, 0.35);
}

textarea:focus {
  outline: none;
}

@media (max-width: 920px) {
  .crt-screen {
    min-height: 56vh;
  }

  .output {
    min-height: calc(56vh - 11rem);
  }
}

@media (max-width: 640px) {
  .page-shell {
    width: min(100% - 1rem, 100%);
    padding-top: 1rem;
  }

  .masthead {
    flex-direction: column;
  }

  .button-grid {
    grid-template-columns: 1fr 1fr;
  }

  .command-bar {
    grid-template-columns: 1fr;
  }

  .prompt {
    display: none;
  }
}