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

/* ── Show-start intro: video loop shown while a phone connects ── */
/* Sits above the aim overlay (200) and everything else on the page. Toggled
   with the `hidden` attribute; the explicit rules below beat the UA sheet
   even though the visible state is display:flex. */
#show-intro {
  position: fixed; inset: 0; z-index: 1000;
  background: #000; align-items: center; justify-content: center;
  cursor: pointer;
}
#show-intro[hidden] { display: none; }
#show-intro:not([hidden]) { display: flex; }
#show-intro-video, #show-intro-still {
  width: 100%; height: 100%; object-fit: contain;
}
#show-intro-skip {
  position: absolute; bottom: 6%; left: 0; right: 0; text-align: center;
  font-family: monospace; font-size: 13px; letter-spacing: 4px; color: #fff;
  cursor: pointer;
}
body { background: #000; color: #fff; font-family: monospace; }

#landing {
  display: flex; align-items: center; justify-content: center;
  position: fixed; inset: 0; background: #000;
}
#landing-bg {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: fill; pointer-events: none;
}
/* Button SVG overlay: full-landing, pointer-events off so clicks pass through */
#landing-btn-img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: fill; pointer-events: none;
}
/* Transparent clickable button over the bar in the SVG (~top 14%) */
#fs-center-btn {
  position: absolute;
  top: 14.09%; left: 10.88%; width: 78.06%; height: 5.86%;
  background: transparent; border: none; cursor: pointer; z-index: 3;
}
/* QR section: center over ring focal point; dark backdrop ensures visibility on all screens. */
#qr-section {
  position: absolute; z-index: 2;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  padding: 12px;
  background: rgba(0,0,0,0.75);
  border-radius: 4px;
}
#qr-container {
  width: min(55vmin, 300px); height: min(55vmin, 300px); display: none;
}
/* QR <img> rendered locally by vendor/qrcode.min.js, sized to fill container */
#qr-container > img { display: block; width: 100%; height: auto; }
#room-id {
  position: absolute; top: 100%; left: 50%;
  transform: translateX(-50%);
  margin-top: 8px;
  color: #555; font-size: 10px; letter-spacing: 2px; font-family: monospace;
  white-space: nowrap;
}

#watermark {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center;
  pointer-events: none; opacity: 0; transition: opacity 0.6s;
}
#watermark img { width: clamp(180px, 28vw, 380px); height: auto; }
#watermark.visible { opacity: 1; }

#status-bar {
  position: fixed; top: 12px; right: 12px;
  display: flex; align-items: center; gap: 6px; font-size: 11px; color: #555;
  opacity: 1; transition: opacity 0.8s;
}
#status-bar.hidden { opacity: 0; pointer-events: none; }
#fullscreen-btn {
  background: transparent; border: 1px solid #333; color: #555;
  font-size: 14px; padding: 2px 6px; cursor: pointer; line-height: 1;
}
#fullscreen-btn:hover { border-color: #888; color: #ccc; }
#audio-toggle-btn {
  background: transparent; border: 1px solid #333; color: #555;
  font-size: 14px; padding: 2px 8px; cursor: pointer; line-height: 1;
}
#audio-toggle-btn:hover { border-color: #888; color: #ccc; }
#audio-toggle-btn.active { border-color: #3a5; color: #3a5; }
#status-dot { width: 8px; height: 8px; border-radius: 50%; background: #f00; }
#status-dot.connecting { background: #ff0; }
#status-dot.connected  { background: #0f0; }

/* Connection-quality readout — persistent (unlike #status-bar, doesn't auto-hide) */
#conn-stats {
  position: fixed; bottom: 10px; left: 10px; z-index: 150;
  font-family: monospace; font-size: 10px; letter-spacing: 0.5px; color: #666;
  line-height: 1.6;
  background: rgba(0,0,0,0.45); padding: 5px 9px; border-radius: 4px;
  pointer-events: none; display: none; white-space: nowrap;
}
#conn-stats.show { display: block; }
#conn-stats .ct-local   { color: #0f0; }
#conn-stats .ct-p2p     { color: #ff0; }
#conn-stats .ct-turn    { color: #f80; }
#conn-stats .ct-unknown { color: #777; }
#conn-stats .q-good { color: #0f0; }
#conn-stats .q-mid  { color: #ff0; }
#conn-stats .q-bad  { color: #f44; }

/* Build version tag — always visible, stays out of the way */
#app-version {
  position: fixed; bottom: 10px; right: 12px; z-index: 150;
  font-family: monospace; font-size: 9px; letter-spacing: 1px; color: #444;
  pointer-events: none;
}

#output {
  display: none;
  position: fixed; inset: 0;
}
#output video {
  width: 100%; height: 100%; object-fit: contain;
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%) rotate(180deg);
}

/* OBJ shape overlay (screen-side, used in 'screen' processing mode) */
#obj-overlay {
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 3; /* above fill-canvas (1) and gl-canvas (2 when circle+mirror) */
}
#obj-overlay svg { width: 100%; height: 100%; }

/* WebGL canvas for screen-side effects — same positioning as video so rotation works */
#gl-canvas {
  display: none;
  position: fixed; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 100%; height: 100%;
}

/* Live-stream fullscreen prompt — shown when output is live but not fullscreen */
#live-fs-prompt {
  display: none;
  position: fixed; bottom: 8%; left: 0; right: 0; z-index: 50;
  justify-content: center; align-items: flex-end;
  pointer-events: none; opacity: 0; transition: opacity 0.5s;
}
#live-fs-prompt.show { display: flex; opacity: 1; pointer-events: auto; }
#live-fs-btn {
  background: rgba(0,0,0,0.7); border: 1px solid #fff; color: #fff;
  font-family: monospace; font-size: 18px; letter-spacing: 4px;
  padding: 16px 40px; cursor: pointer;
}
#live-fs-btn:hover { background: rgba(255,255,255,0.1); }

/* Alignment helper overlay */
/* Verdict line — the one-sentence answer to "why does it look like this".
   Sits above the raw numbers and is deliberately louder than them: the numbers
   are evidence, this is the conclusion. */
#conn-stats .verdict {
  display: block; font-size: 12px; letter-spacing: 1px; font-weight: bold;
  margin-bottom: 3px; padding-bottom: 3px; border-bottom: 1px solid #333;
}
#conn-stats .verdict.v-good { color: #0f0; }
#conn-stats .verdict.v-warn { color: #fb0; }
#conn-stats .verdict.v-bad  { color: #f55; }
#conn-stats .verdict small { display:block; font-size:9px; font-weight:normal; letter-spacing:0.3px; color:#999; white-space:normal; max-width:340px; }


/* ── Portrait notice ─────────────────────────────────────────────────────
   A banner, not a blackout. This is a live performance in front of an
   audience: covering the projection because the performer tilted their phone
   for a moment would be a worse failure than the tilted picture itself. It
   sits low and out of the frame's centre, and clears the moment the phone
   goes back to landscape or disconnects. */
#rotate-notice {
  display: none; position: fixed; left: 50%; bottom: 6vh;
  transform: translateX(-50%); z-index: 300;
  max-width: min(90vw, 640px);
  align-items: center; gap: 18px;
  padding: 14px 24px;
  background: rgba(0, 0, 0, 0.82);
  border: 1px solid #4a4a4a; border-radius: 6px;
  font-family: monospace; color: #fff;
}
#rotate-notice.show { display: flex; }
#rotate-notice-icon {
  font-size: 36px; line-height: 1; flex-shrink: 0;
  animation: rotate-notice-hint 2.4s ease-in-out infinite;
}
@keyframes rotate-notice-hint {
  0%, 55%, 100% { transform: rotate(0deg); }
  75%, 95%      { transform: rotate(90deg); }
}
@media (prefers-reduced-motion: reduce) { #rotate-notice-icon { animation: none; } }
#rotate-notice-title { font-size: 15px; letter-spacing: 4px; }
#rotate-notice-sub   { font-size: 11px; letter-spacing: 1px; color: #888; margin-top: 4px; }
