:root {
  --bg: #040507;
  --bezel: #4f4f53;
  --bezel-shadow: #161619;
  --phosphor: #79ff9c;
  --phosphor-dim: #5bd27c;
  --amber: #ffbf4a;
  --cyan: #67d7ff;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
}

body {
  background:
    radial-gradient(circle at 18% 8%, rgba(79, 102, 163, 0.2), transparent 42%),
    radial-gradient(circle at 84% 5%, rgba(255, 191, 74, 0.12), transparent 38%),
    linear-gradient(180deg, #0b0c0f 0%, #050608 100%);
  color: #d6d6d6;
  font-family: "IBM Plex Mono", "Lucida Console", "Consolas", "Courier New", monospace;
  overflow: hidden;
}

.scene {
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 1rem;
  gap: 0.9rem;
}

.monitor {
  width: min(980px, 96vw);
  aspect-ratio: 16 / 10;
  border-radius: 18px;
  background: linear-gradient(145deg, #6a6a6f 0%, var(--bezel) 48%, #3f4043 100%);
  border: 1px solid #7a7b80;
  box-shadow:
    0 24px 60px rgba(0, 0, 0, 0.62),
    0 0 0 5px #2b2b2f,
    0 0 0 8px #55565a;
  position: relative;
  padding: 2.2rem 2.2rem 2.6rem;
}

.bezel {
  position: absolute;
  inset: 0;
  border-radius: 18px;
  box-shadow:
    inset 0 0 0 2px #8b8d93,
    inset 0 0 45px rgba(0, 0, 0, 0.32);
  pointer-events: none;
}

.screen-wrap {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 8px;
  overflow: hidden;
  background: #050805;
  border: 2px solid #101412;
  box-shadow:
    inset 0 0 42px rgba(0, 0, 0, 0.82),
    inset 0 0 10px rgba(121, 255, 156, 0.12);
}

.screen-glow {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 20%, rgba(121, 255, 156, 0.1), transparent 55%),
    radial-gradient(circle at 50% 100%, rgba(103, 215, 255, 0.08), transparent 45%);
  pointer-events: none;
}

.scanlines {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.38;
  background-image: linear-gradient(rgba(0, 0, 0, 0.38) 50%, rgba(0, 0, 0, 0.04) 50%);
  background-size: 100% 4px;
}

.noise {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.09;
  background-image: radial-gradient(circle, #fff 1px, transparent 1px);
  background-size: 3px 3px;
  animation: noise 0.18s steps(2) infinite;
}

@keyframes noise {
  0% { transform: translate(0, 0); }
  100% { transform: translate(1px, -1px); }
}

.terminal {
  position: relative;
  margin: 0;
  height: 100%;
  padding: 1.05rem 1.2rem;
  overflow: hidden;
  font-size: clamp(0.72rem, 1.6vw, 1rem);
  line-height: 1.25;
  white-space: pre;
  color: var(--phosphor);
  font-family: "Lucida Console", "Consolas", "Courier New", monospace;
  letter-spacing: 0;
  font-kerning: none;
  font-feature-settings: "liga" 0;
  text-shadow: 0 0 8px rgba(121, 255, 156, 0.35);
}

.bios-logo {
  position: absolute;
  top: 0.85rem;
  right: 1rem;
  margin: 0;
  color: #79ff9c;
  text-shadow: 0 0 8px rgba(121, 255, 156, 0.3);
  font-family: "Lucida Console", "Consolas", "Courier New", monospace;
  font-size: 0.86rem;
  line-height: 1.12;
  white-space: pre;
  pointer-events: none;
  z-index: 2;
  display: none;
}

body.bios-mode .bios-logo {
  display: block;
}

.telix-footer {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1.55rem;
  display: none;
  grid-template-columns: 1.2fr 1fr 1.35fr 1fr 0.85fr;
  background: #6f0000;
  border-top: 1px solid #f8da63;
  box-shadow: 0 -2px 0 rgba(0, 0, 0, 0.45) inset;
  z-index: 3;
}

.telix-footer span {
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "Lucida Console", "Consolas", "Courier New", monospace;
  font-size: 0.78rem;
  color: #ffdf6e;
  text-shadow: none;
  border-right: 1px solid #f8da63;
  white-space: nowrap;
}

.telix-footer span:last-child {
  border-right: 0;
}

body.telix-mode .telix-footer {
  display: grid;
}

.line-bios {
  color: #c4cfdf;
  text-shadow: none;
}

.line-amber {
  color: var(--amber);
}

.line-cyan {
  color: var(--cyan);
}

.line-green {
  color: var(--phosphor);
}

.line-dim {
  color: var(--phosphor-dim);
}

.line-prompt {
  color: #a8f0ff;
}

.cursor {
  display: inline-block;
  width: 0.65ch;
  background: var(--phosphor);
  margin-left: 0.1ch;
  animation: blink 0.95s steps(2) infinite;
}

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

.power-led {
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 999px;
  right: 20px;
  bottom: 16px;
  background: #9cff3f;
  box-shadow: 0 0 10px rgba(156, 255, 63, 0.9);
}

.hint {
  margin: 0;
  color: #8d97a8;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 0.78rem;
}

body.fade-out .scene {
  animation: fadeout 2.6s ease forwards;
}

@keyframes fadeout {
  0% {
    opacity: 1;
    filter: blur(0);
  }
  100% {
    opacity: 0;
    filter: blur(4px);
  }
}

@media (max-width: 640px) {
  .monitor {
    padding: 1.2rem 1.2rem 1.8rem;
    border-radius: 12px;
  }

  .terminal {
    padding: 0.72rem;
  }
}
