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

/* the hidden attribute must always win, even over display:flex rules */
[hidden] { display: none !important; }

html, body {
  height: 100%;
  background: #000;
  color: #fff;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  overflow: hidden;
}

/* ---------- pairing ---------- */
.pair-view {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(1200px 800px at 50% 30%, #1c2333, #0a0d14);
}

.pair-card {
  text-align: center;
  padding: 48px 56px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  max-width: 520px;
}

.brand { font-size: 22px; font-weight: 700; color: #f59e0b; margin-bottom: 24px; letter-spacing: 0.5px; }
.pair-card h1 { font-size: 32px; margin-bottom: 12px; }
.pair-card p { color: #9ca3af; margin-bottom: 28px; font-size: 16px; }

.device-code {
  font-family: "SF Mono", Menlo, monospace;
  font-size: 58px;
  font-weight: 800;
  letter-spacing: 16px;
  text-align: center;
  color: #f59e0b;
  background: rgba(0, 0, 0, 0.4);
  border: 2px solid rgba(245, 158, 11, 0.4);
  border-radius: 14px;
  padding: 18px 8px 18px 24px;
  margin: 18px 0 10px;
}

.claim-status { color: #8b94a7; font-size: 15px; min-height: 20px; }
.claim-status.ok { color: #22c55e; }

.linklike {
  background: none;
  border: none;
  color: #8b94a7;
  text-decoration: underline;
  cursor: pointer;
  font-size: 14px;
  margin-top: 22px;
}
.linklike:hover { color: #fff; }

#manualBlock { margin-top: 16px; }

body.hide-cursor, body.hide-cursor * { cursor: none !important; }

/* on-screen watermark over ads */
.watermark {
  position: absolute;
  z-index: 20;
  pointer-events: none;
  max-width: 40%;
  height: auto;
  object-fit: contain;
}
.watermark.pos-top-left { top: 3%; left: 3%; }
.watermark.pos-top-right { top: 3%; right: 3%; }
.watermark.pos-bottom-left { bottom: 3%; left: 3%; }
.watermark.pos-bottom-right { bottom: 3%; right: 3%; }
.watermark.pos-center { top: 50%; left: 50%; transform: translate(-50%, -50%); }

/* per-ad QR code over live ads — white pad keeps it scannable on any video */
.qr-overlay {
  position: absolute;
  z-index: 21;
  pointer-events: none;
  background: #fff;
  padding: 0.5%;
  border-radius: 10px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.35);
}
.qr-overlay.pos-top-left { top: 3%; left: 3%; }
.qr-overlay.pos-top-right { top: 3%; right: 3%; }
.qr-overlay.pos-bottom-left { bottom: 3%; left: 3%; }
.qr-overlay.pos-bottom-right { bottom: 3%; right: 3%; }

#codeInput {
  width: 100%;
  font-size: 40px;
  letter-spacing: 14px;
  text-align: center;
  text-transform: uppercase;
  padding: 14px 8px;
  border-radius: 12px;
  border: 2px solid rgba(255, 255, 255, 0.15);
  background: rgba(0, 0, 0, 0.4);
  color: #fff;
  outline: none;
  font-family: "SF Mono", Menlo, monospace;
}
#codeInput:focus { border-color: #f59e0b; }

#pairBtn {
  margin-top: 20px;
  width: 100%;
  padding: 16px;
  font-size: 18px;
  font-weight: 700;
  border: none;
  border-radius: 12px;
  background: #f59e0b;
  color: #1a1206;
  cursor: pointer;
}
#pairBtn:hover { background: #fbbf24; }

.pair-error { margin-top: 16px; color: #f87171; font-size: 15px; min-height: 20px; }

/* ---------- playback ---------- */
.play-view { position: fixed; inset: 0; background: #000; }

#adImage, #adVideo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}
/* hide any native media overlay (cast / picture-in-picture / controls) */
#adVideo::-webkit-media-controls,
#adVideo::-webkit-media-controls-overlay-cast-button,
#adVideo::-internal-media-controls-overlay-cast-button {
  display: none !important;
  -webkit-appearance: none;
}

/* ---------- idle: photo slideshow + movable clock ---------- */
.idle {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: radial-gradient(1000px 700px at 50% 40%, #131a28, #05070c);
}
.idle-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 1.6s ease;
}
.idle-bg.show { opacity: 1; }
/* soft dark veil so the clock stays readable on any photo */
.idle-shade { position: absolute; inset: 0; background: rgba(4, 6, 12, 0.35); }
/* every idle element is freely positioned: left/top (% of screen, element
   center) and size (vw) come from config; each has its own opacity. Text
   wraps inside a safe width so it never runs off the edge of any TV. */
.idle-el {
  position: absolute;
  transform: translate(-50%, -50%);
  text-align: center;
  text-shadow: 0 2px 24px rgba(0, 0, 0, 0.7);
  color: #fff;
  max-width: 90vw;
  overflow-wrap: break-word;
}
.idle-clock { font-weight: 800; letter-spacing: 2px; line-height: 1; }
.idle-venue { font-weight: 600; }
.idle-text { font-weight: 500; }
.idle-logo {
  position: absolute;
  transform: translate(-50%, -50%);
  height: auto;
  object-fit: contain;
  pointer-events: none;
}
/* photo credit is now a freely-placed idle element (see .idle-el) */
.idle-credit-el { color: rgba(255, 255, 255, 0.85); font-weight: 500; }

/* ---------- game-day invite (white, branded) ---------- */
.invite {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  color: #16182b;
}
.invite-card { text-align: center; max-width: 74%; }
.invite-logo { height: 9vh; display: block; margin: 0 auto; }
.invite-kicker { color: #9aa0b4; letter-spacing: 7px; font-size: 1.3vw; font-weight: 700; margin-top: 3.4vh; }
.invite-card h1 { font-size: 3.8vw; margin: 1.6vh 0 0.6vh; color: #16182b; }
.invite-when { color: #4c5164; font-size: 1.8vw; font-weight: 600; }
.invite-msg { color: #6d7285; font-size: 1.6vw; margin-top: 2.2vh; line-height: 1.5; }
.invite-actions { display: flex; gap: 2.5vw; justify-content: center; margin-top: 4.5vh; }
.invite-btn {
  font-size: 1.9vw;
  font-weight: 800;
  padding: 1.6vh 4vw;
  border-radius: 14px;
  border: 3px solid #e3e5ee;
  cursor: pointer;
  background: #f4f5f9;
  color: #4c5164;
  outline: none;
}
.invite-btn.focused { transform: scale(1.06); transition: transform 0.12s; }
.invite-btn.yes.focused { background: #16a34a; color: #fff; border-color: #16a34a; box-shadow: 0 10px 34px rgba(22, 163, 74, 0.35); }
.invite-btn.no.focused { background: #dc2626; color: #fff; border-color: #dc2626; box-shadow: 0 10px 34px rgba(220, 38, 38, 0.35); }
.invite-hint { color: #9aa0b4; font-size: 1.2vw; margin-top: 3.6vh; }
.invite-done { font-size: 2.4vw; color: #16a34a; margin-top: 2.5vh; font-weight: 700; }

/* ---------- overlays ---------- */
.status-dot {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #22c55e;
  opacity: 0.7;
  z-index: 10;
}
.status-dot.offline { background: #ef4444; animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: 0.2; } }

.takeover-badge {
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 10;
  background: rgba(239, 68, 68, 0.9);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 999px;
  letter-spacing: 1.5px;
  display: flex;
  align-items: center;
  gap: 7px;
}
.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #fff;
  animation: blink 1.2s infinite;
}

.fs-btn {
  position: absolute;
  bottom: 14px;
  right: 14px;
  z-index: 10;
  background: rgba(255, 255, 255, 0.12);
  border: none;
  color: #fff;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  cursor: pointer;
  opacity: 0.35;
  display: flex;
  align-items: center;
  justify-content: center;
}
.fs-btn svg { width: 20px; height: 20px; }
.fs-btn:hover { opacity: 1; }
