@font-face {
  font-family: 'Share Tech Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/fonts/share-tech-mono.ttf') format('truetype');
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --phosphor: #33ff66;
  --phosphor-dim: #1a8033;
  --phosphor-glow: rgba(51, 255, 102, 0.45);
  --screen-bg: #0a0f0a;
  --bezel: #1a1a1a;
  --bezel-edge: #0d0d0d;
  --room-bg: #080808;
}

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: 'Share Tech Mono', 'Courier New', monospace;
  background: var(--room-bg);
  color: var(--phosphor);
}

.room {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background:
    radial-gradient(ellipse at 50% 30%, rgba(51, 255, 102, 0.03) 0%, transparent 60%),
    var(--room-bg);
}

.crt-unit {
  padding: 1rem;
  width: min(92vw, 720px);
}

.crt-bezel {
  background: linear-gradient(145deg, #2a2a2a 0%, var(--bezel) 40%, var(--bezel-edge) 100%);
  border-radius: 24px;
  padding: 28px 24px 20px;
  box-shadow:
    0 20px 60px rgba(0, 0, 0, 0.8),
    inset 0 2px 0 rgba(255, 255, 255, 0.06),
    inset 0 -4px 8px rgba(0, 0, 0, 0.5);
  position: relative;
}

.crt-brand {
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.65rem;
  letter-spacing: 0.35em;
  color: #444;
  text-transform: uppercase;
}

.crt-screen {
  position: relative;
  background: var(--screen-bg);
  border-radius: 18px;
  overflow: hidden;
  aspect-ratio: 4 / 3;
  box-shadow:
    inset 0 0 80px rgba(0, 0, 0, 0.9),
    inset 0 0 30px rgba(51, 255, 102, 0.05);
  animation: flicker 4s infinite;
}

.crt-screen::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, transparent 50%, rgba(0, 0, 0, 0.55) 100%);
  pointer-events: none;
  z-index: 4;
}

.crt-screen::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    rgba(255, 0, 0, 0.03) 0%,
    transparent 40%,
    transparent 60%,
    rgba(0, 0, 255, 0.03) 100%
  );
  pointer-events: none;
  z-index: 3;
}

.scanlines {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.25) 2px,
    rgba(0, 0, 0, 0.25) 4px
  );
  pointer-events: none;
  z-index: 5;
  animation: scanline-drift 8s linear infinite;
}

.screen-glow {
  position: absolute;
  inset: -20%;
  background: radial-gradient(ellipse at 50% 50%, var(--phosphor-glow) 0%, transparent 55%);
  pointer-events: none;
  z-index: 1;
  opacity: 0.35;
}

.screen-content {
  position: relative;
  z-index: 2;
  height: 100%;
  padding: 1.5rem 1.75rem;
  overflow: hidden;
  text-shadow:
    0 0 8px var(--phosphor-glow),
    0 0 20px rgba(51, 255, 102, 0.2);
}

.hidden {
  display: none !important;
}

/* Gate */
.gate {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.5rem;
}

.gate-header {
  font-size: 0.85rem;
  letter-spacing: 0.15em;
  margin-bottom: 0.25rem;
}

.gate-divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--phosphor-dim), transparent);
  margin-bottom: 0.75rem;
}

.gate-line {
  font-size: 0.95rem;
  letter-spacing: 0.08em;
}

.gate-line.dim {
  color: var(--phosphor-dim);
  font-size: 0.8rem;
}

.gate-stat {
  font-size: 0.9rem;
  margin-top: 0.35rem;
}

.gate-stat .label {
  color: var(--phosphor-dim);
  margin-right: 0.5rem;
}

.gate-stat .value {
  color: var(--phosphor);
  text-shadow: 0 0 12px var(--phosphor-glow);
}

.gate-message {
  font-size: 0.85rem;
  margin-top: 0.5rem;
  color: var(--phosphor);
}

.return-msg {
  color: var(--phosphor);
  animation: pulse-text 2s ease-in-out infinite;
}

.access-btn {
  margin-top: 1.25rem;
  padding: 0.85rem 1.5rem;
  font-family: inherit;
  font-size: 1rem;
  letter-spacing: 0.12em;
  color: var(--phosphor);
  background: rgba(51, 255, 102, 0.08);
  border: 2px solid var(--phosphor-dim);
  cursor: pointer;
  transition: background 0.15s, box-shadow 0.15s, transform 0.1s;
  animation: btn-pulse 2.5s ease-in-out infinite;
  align-self: flex-start;
}

.access-btn:hover {
  background: rgba(51, 255, 102, 0.18);
  box-shadow: 0 0 20px var(--phosphor-glow);
}

.access-btn:active {
  transform: scale(0.97);
}

.gate-hint {
  font-size: 0.7rem;
  color: var(--phosphor-dim);
  margin-top: 0.75rem;
  letter-spacing: 0.05em;
}

.blocked-title {
  color: #ff4444;
  text-shadow: 0 0 12px rgba(255, 68, 68, 0.5);
  animation: pulse-text 2s ease-in-out infinite;
}

.blocked-value {
  color: #ff4444;
  text-shadow: 0 0 12px rgba(255, 68, 68, 0.5);
}

.blocked-footer {
  margin-top: 1.5rem;
}

.blocked-led {
  background: #ff4444;
  box-shadow: 0 0 8px #ff4444;
}

/* Unlocked */
.unlocked {
  display: flex;
  flex-direction: column;
}

.boot-log {
  font-size: 0.78rem;
  line-height: 1.5;
  color: var(--phosphor-dim);
  white-space: pre-wrap;
  overflow: hidden;
}

.boot-log .highlight {
  color: var(--phosphor);
}

.main-content {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-top: 0.5rem;
}

.ascii-art {
  font-size: 0.55rem;
  line-height: 1.1;
  color: var(--phosphor);
  margin-bottom: 0.75rem;
  overflow: hidden;
}

.troll-line {
  font-size: 0.85rem;
  letter-spacing: 0.06em;
}

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

.cursor-line {
  margin-top: 1rem;
  font-size: 0.8rem;
  color: var(--phosphor-dim);
}

.blink {
  animation: blink 1s step-end infinite;
}

/* CRT controls */
.crt-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 14px;
  padding-right: 8px;
}

.knob {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #555, #222);
  box-shadow: inset 0 -2px 4px rgba(0, 0, 0, 0.5);
}

.power-led {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--phosphor);
  box-shadow: 0 0 8px var(--phosphor);
  animation: led-pulse 2s ease-in-out infinite;
}

/* Flash on sound trigger */
.crt-screen.flash {
  animation: screen-flash 0.15s ease-out;
}

/* Animations */
@keyframes flicker {
  0%, 100% { opacity: 1; }
  92% { opacity: 1; }
  93% { opacity: 0.97; }
  94% { opacity: 1; }
  96% { opacity: 0.98; }
  97% { opacity: 1; }
}

@keyframes scanline-drift {
  0% { transform: translateY(0); }
  100% { transform: translateY(4px); }
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

@keyframes btn-pulse {
  0%, 100% { box-shadow: 0 0 0 rgba(51, 255, 102, 0); }
  50% { box-shadow: 0 0 16px var(--phosphor-glow); }
}

@keyframes pulse-text {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

@keyframes led-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

@keyframes screen-flash {
  0% { filter: brightness(3); }
  100% { filter: brightness(1); }
}

@media (max-width: 480px) {
  .screen-content {
    padding: 1rem 1.25rem;
  }

  .gate-line {
    font-size: 0.8rem;
  }

  .access-btn {
    width: 100%;
    text-align: center;
  }

  .ascii-art {
    font-size: 0.45rem;
  }
}
