@font-face {
  font-family: 'VCR OSD Mono';
  src: url('../assets/fonts/VCROSDMono.woff2') format('woff2'),
       url('../assets/fonts/VCROSDMono.woff') format('woff');
  font-display: block;
}

html, body {
  margin: 0;
  width: 100%;
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  background: #000;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

body.idle { cursor: none; }

#tube {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

/* The video is only a texture source; keep it in the DOM (Safari) but invisible. */
#video {
  position: fixed;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

#hint {
  position: fixed;
  left: 50%;
  bottom: 12%;
  transform: translateX(-50%);
  font: 18px 'VCR OSD Mono', monospace;
  letter-spacing: 0.15em;
  color: #6a6a6a;
  opacity: 0;
  transition: opacity 1.2s;
  pointer-events: none;
  white-space: nowrap;
}
#hint.show {
  opacity: 1;
  animation: hint-pulse 2.4s ease-in-out 1.2s infinite;
}
@keyframes hint-pulse {
  50% { color: #3a3a3a; }
}

/* ---- Fallback when WebGL is unavailable: plain video + CSS scanlines ---- */
body.no-webgl #tube { display: none; }
body.no-webgl.on #video {
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 1;
  object-fit: cover;
}
body.no-webgl.on::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%),
    linear-gradient(90deg, rgba(255, 0, 0, 0.06), rgba(0, 255, 0, 0.02), rgba(0, 0, 255, 0.06));
  background-size: 100% 3px, 3px 100%;
}
@media (orientation: portrait) {
  body.no-webgl.on #video { object-fit: contain; }
}

/* ---- ?debug readout ---- */
#debug {
  position: fixed;
  left: 8px;
  bottom: 8px;
  margin: 0;
  padding: 6px 8px;
  background: rgba(0, 0, 0, 0.75);
  color: #9f9;
  font: 11px/1.35 ui-monospace, monospace;
  pointer-events: none;
  white-space: pre;
}

/* ---- ?tune panel ---- */
#tuner {
  position: fixed;
  top: 8px;
  right: 8px;
  width: 300px;
  max-height: calc(100% - 60px);
  overflow-y: auto;
  padding: 8px 10px;
  background: rgba(10, 10, 10, 0.85);
  color: #cfcfcf;
  font: 11px/1.3 ui-monospace, monospace;
  border: 1px solid #333;
  display: none;
  cursor: auto;
}
#tuner.open { display: block; }
#tuner h3 { margin: 8px 0 4px; font-size: 11px; color: #5cff6a; text-transform: uppercase; }
#tuner label { display: grid; grid-template-columns: 90px 1fr 52px; gap: 6px; align-items: center; }
#tuner input { width: 100%; }
#tuner output { text-align: right; }
#tuner button, #tuner-toggle {
  margin-top: 8px;
  font: 11px ui-monospace, monospace;
  background: #222;
  color: #ddd;
  border: 1px solid #444;
  padding: 4px 8px;
  cursor: pointer;
}
#tuner-toggle { position: fixed; bottom: 8px; right: 8px; margin: 0; cursor: pointer; }
