:root {
  --text: #7dffb0;
  --glow: #2bff8a;
  --void: #05060c;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--void);
  color: var(--text);
  cursor: default;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

#scene {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background: radial-gradient(ellipse at 50% 80%, #1a1420 0%, var(--void) 70%);
}

#bg {
  position: absolute;
  max-width: none;
  opacity: 0;
  transition: opacity 2.5s ease;
  pointer-events: none;
}
#bg.shown { opacity: 1; }

/* The probe's display: a fixed-size box mapped onto the screen in the image
   with a perspective matrix (app.js). */
#screen {
  position: absolute;
  left: 0;
  top: 0;
  width: 400px;
  height: 225px;
  transform-origin: 0 0;
  mix-blend-mode: screen;
  pointer-events: none;
  opacity: 0;
  transition: opacity 1.5s ease;
}
#screen.shown { opacity: 1; }

.crt {
  position: relative;
  width: 100%;
  height: 100%;
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  font-family: "IBM Plex Mono", "DejaVu Sans Mono", ui-monospace, Menlo, Consolas, monospace;
  color: var(--text);
  text-shadow: 0 0 4px var(--glow), 0 0 14px var(--glow);
  background: radial-gradient(ellipse at center, color-mix(in srgb, var(--glow) 14%, transparent) 0%, transparent 75%);
  animation: flicker 7s infinite steps(1);
  overflow: hidden;
}
.crt::after {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(0deg, transparent 0 2px, rgba(0, 0, 0, 0.35) 2px 3px);
  pointer-events: none;
}

.cap {
  font-size: 15px;
  letter-spacing: 0.12em;
  opacity: 0.7;
  white-space: nowrap;
}
#cap-bottom { text-align: right; }

.main {
  font-size: 54px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-align: center;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.main.text {
  font-size: 22px;
  font-weight: 500;
  line-height: 1.35;
  white-space: pre-wrap;
  text-align: left;
}

.glitch .main {
  animation: glitch 0.12s infinite steps(2);
}

@keyframes glitch {
  0% { transform: translate(2px, -1px) skewX(4deg); opacity: 0.5; clip-path: inset(0 0 40% 0); }
  50% { transform: translate(-3px, 1px); opacity: 1; clip-path: inset(30% 0 0 0); }
  100% { transform: none; opacity: 0.8; }
}

@keyframes flicker {
  0%, 100% { opacity: 1; }
  41% { opacity: 0.86; }
  42% { opacity: 1; }
  77% { opacity: 0.93; }
  78% { opacity: 1; }
}

/* The hidden helmet mark. */
#mark {
  position: fixed;
  right: max(14px, env(safe-area-inset-right));
  bottom: max(12px, env(safe-area-inset-bottom));
  width: 22px;
  height: 22px;
  opacity: 0.1;
  transition: opacity 3s ease;
  pointer-events: auto;
}
#mark:hover { opacity: 0.45; }

/* Calibrate mode (#calibrate). */
.handle {
  position: absolute;
  width: 18px;
  height: 18px;
  margin: -9px 0 0 -9px;
  border: 2px solid #ff0800;
  border-radius: 50%;
  background: rgba(255, 8, 0, 0.25);
  cursor: grab;
  touch-action: none;
  z-index: 5;
}
#calibrate {
  position: fixed;
  left: 12px;
  top: 12px;
  z-index: 6;
  display: flex;
  gap: 8px;
  align-items: center;
  font: 13px ui-monospace, monospace;
  color: #eee;
  background: rgba(0, 0, 0, 0.7);
  padding: 8px 10px;
  border-radius: 6px;
}
#calibrate button {
  font: inherit;
  background: #222;
  color: #eee;
  border: 1px solid #555;
  border-radius: 4px;
  padding: 4px 10px;
  cursor: pointer;
}
