:root {
  --room-green: #78ff9b;
  --room-green-bright: #a7ffbc;
  --room-green-dim: #39b95d;
}

html,
body {
  width: 100%;
  height: 100%;
  min-height: 100%;
  overflow: hidden;
  background: #050301;
}

body {
  display: grid;
  place-items: center;
  cursor: default;
}

/* Scanlines belong on the CRT now, not across the entire 1987 room. */
body::before,
body::after {
  display: none;
}

/* Match the verified clean room asset exactly: 1280 x 853. */
.room-scene {
  position: relative;
  width: min(100vw, 150.0586vh);
  height: min(100vh, 66.6406vw);
  aspect-ratio: 1280 / 853;
  overflow: hidden;
  background-color: #090603;
  background-position: center;
  background-repeat: no-repeat;
  background-size: 100% 100%;
  box-shadow: 0 0 80px rgba(0, 0, 0, 0.9);
}

.room-scene::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  box-shadow: inset 0 0 8vw rgba(0, 0, 0, 0.52);
}

/* Live terminal fitted to the actual dark CRT glass in the clean 1280x853 photo. */
.screen {
  position: absolute;
  z-index: 5;
  left: 34.77%;
  top: 24.62%;
  width: 26.64%;
  height: 28.49%;
  min-height: 0;
  margin: 0;
  padding: 0.7% 0.82% 0.75%;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-width: none;
  border-radius: 8.5% / 11%;
  background:
    radial-gradient(ellipse at 50% 43%, rgba(0, 31, 10, 0.99) 0%, rgba(0, 17, 6, 0.99) 62%, rgba(0, 5, 2, 1) 100%);
  box-shadow:
    inset 0 0 30px rgba(0, 0, 0, 0.98),
    inset 0 0 12px rgba(120, 255, 155, 0.12),
    0 0 7px rgba(77, 255, 119, 0.13);
  color: var(--room-green);
  font-size: clamp(6px, 0.38vw, 7.5px);
  line-height: 1.18;
  text-shadow: 0 0 4px rgba(120, 255, 155, 0.7), 0 0 10px rgba(120, 255, 155, 0.2);
  cursor: text;
}

.screen::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.screen::before {
  content: "";
  position: fixed;
  pointer-events: none;
  z-index: 20;
  background: none;
  mix-blend-mode: normal;
}

.screen::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 20;
  pointer-events: none;
  border-radius: inherit;
  opacity: 0.27;
  background:
    repeating-linear-gradient(
      to bottom,
      rgba(255, 255, 255, 0.045) 0,
      rgba(255, 255, 255, 0.045) 1px,
      rgba(0, 0, 0, 0.1) 2px,
      rgba(0, 0, 0, 0.1) 4px
    ),
    radial-gradient(ellipse at center, transparent 45%, rgba(0, 0, 0, 0.56) 100%);
  animation: crt-flicker 7s infinite steps(1);
}

.terminal,
.input-row,
.statusbar {
  position: relative;
  z-index: 3;
}

.terminal {
  min-height: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.line {
  min-height: 1.18em;
}

.input-row {
  margin-top: 0.12rem;
  min-height: 1.2em;
  gap: 0.35rem;
}

.statusbar {
  margin-top: 0.45rem;
  padding-top: 0.3rem;
  font-size: 0.64em;
  letter-spacing: 0.05em;
  opacity: 0.52;
}

.terminal-link:hover,
.terminal-link:focus-visible {
  background: rgba(120, 255, 155, 0.14);
}

@keyframes crt-flicker {
  0%, 100% { opacity: 0.25; }
  38% { opacity: 0.29; }
  39% { opacity: 0.18; }
  40% { opacity: 0.26; }
  72% { opacity: 0.31; }
  73% { opacity: 0.25; }
}

/* Mobile intentionally stays terminal-only: room-loader.js does not load the photo here. */
@media (max-width: 700px), (max-aspect-ratio: 4 / 5) {
  .room-scene {
    width: 100vw;
    height: 100vh;
    aspect-ratio: auto;
    background-size: cover;
    background-position: center;
  }

  .room-scene::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 3;
    pointer-events: none;
    background: rgba(0, 0, 0, 0.58);
  }

  .screen {
    left: 4vw;
    top: 5vh;
    width: 92vw;
    height: 90vh;
    padding: 18px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.42;
    box-shadow:
      inset 0 0 42px rgba(0, 0, 0, 0.98),
      0 0 30px rgba(0, 0, 0, 0.82);
  }

  .line {
    min-height: 1.42em;
  }

  .statusbar {
    font-size: 10px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .screen::after {
    animation: none;
  }
}
