html,
body,
#root {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  background: #0a0a0c;
  color: #fff;
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

* {
  box-sizing: border-box;
}

#root {
  position: relative;
}

iframe#scene {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
  background: #0a0a0c;
  /* Hidden until the first scene is set so the TV doesn't flash about:blank. */
  opacity: 0;
  transition: opacity 280ms ease;
}

iframe#scene.visible {
  opacity: 1;
}

.hidden {
  display: none !important;
}

/* ── Claim screen (shown when ?id= is missing) ─────────────────────── */
.claim {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
  padding: 40px;
  text-align: center;
  z-index: 10;
}

.claim h1 {
  margin: 0;
  font-size: clamp(32px, 5vw, 64px);
  font-weight: 800;
  letter-spacing: -0.02em;
}

.claim p {
  margin: 0;
  color: rgba(255, 255, 255, 0.6);
  font-size: clamp(14px, 1.4vw, 18px);
  max-width: 560px;
}

#claim-form {
  display: flex;
  gap: 12px;
  width: 100%;
  max-width: 560px;
}

#claim-input {
  flex: 1;
  padding: 18px 22px;
  font-size: 22px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #fff;
  border-radius: 14px;
  outline: none;
  font-family: inherit;
  letter-spacing: 0.02em;
}

#claim-input:focus {
  border-color: rgba(56, 189, 248, 0.6);
  background: rgba(56, 189, 248, 0.08);
}

#claim-form button {
  padding: 0 28px;
  font-size: 18px;
  font-weight: 700;
  background: linear-gradient(135deg, #34d399, #22d3ee);
  color: #0a0a0c;
  border: 0;
  border-radius: 14px;
  cursor: pointer;
  font-family: inherit;
  letter-spacing: 0.02em;
}

/* ── Idle splash (shown when scene = "idle") ───────────────────────── */
.idle {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background:
    radial-gradient(ellipse 60% 60% at 50% 40%, rgba(56, 189, 248, 0.08), transparent 70%),
    #0a0a0c;
  z-index: 5;
}

.idle-mark {
  font-size: clamp(48px, 8vw, 96px);
  font-weight: 900;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, #34d399, #22d3ee, #818cf8);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.idle-sub {
  font-size: clamp(12px, 1.4vw, 16px);
  font-weight: 600;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.35);
}

/* ── Tiny HUD in the corner so we can see TV id + status at a glance ── */
.hud {
  position: fixed;
  bottom: 12px;
  right: 12px;
  z-index: 50;
  display: flex;
  gap: 8px;
  padding: 6px 10px;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, monospace;
  font-size: 10px;
  letter-spacing: 0.18em;
  color: rgba(255, 255, 255, 0.55);
  text-transform: uppercase;
  pointer-events: none;
  opacity: 0.7;
  transition: opacity 200ms;
}

.hud:hover {
  opacity: 1;
}

#hud-status.ok::before {
  content: '● ';
  color: #34d399;
}

#hud-status.warn::before {
  content: '● ';
  color: #f59e0b;
}

#hud-status.err::before {
  content: '● ';
  color: #ef4444;
}

/* ── Fullscreen toggle button ────────────────────────────────────────── */
.fs-btn {
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 60;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  color: rgba(255, 255, 255, 0.75);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  transition: opacity 200ms ease, background 150ms ease, border-color 150ms ease;
  font-family: inherit;
  padding: 0;
}

/* Show the button while the operator is moving the cursor; the JS adds
   .visible on mousemove and strips it after a few seconds of stillness.
   Always visible while focused so keyboard users can find it. */
.fs-btn.visible,
.fs-btn:hover,
.fs-btn:focus-visible {
  opacity: 0.85;
}

.fs-btn:hover {
  background: rgba(0, 0, 0, 0.75);
  border-color: rgba(255, 255, 255, 0.25);
  color: #fff;
}

/* When fullscreen is active, also reset the cursor; we hide it via JS
   on idle but keep the button reachable on mousemove. */
:fullscreen .fs-btn {
  /* Same coordinates work — fullscreen target is the documentElement. */
}

/* Hide the HUD entirely while fullscreen is active so the demo is
   uninterrupted. The fullscreen button stays so the operator can exit. */
:fullscreen .hud {
  display: none;
}

/* Auto-hide the cursor after a short idle period (toggled via JS). */
.cursor-idle,
.cursor-idle * {
  cursor: none !important;
}

/* ── Remote "tap to go fullscreen" overlay ───────────────────────────── */
.fs-prompt {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  background: radial-gradient(
      ellipse 60% 60% at 50% 50%,
      rgba(56, 189, 248, 0.12),
      transparent 70%
    ),
    rgba(10, 10, 12, 0.78);
  backdrop-filter: blur(16px);
  cursor: pointer;
  animation: fs-prompt-in 240ms ease-out;
}

@keyframes fs-prompt-in {
  from {
    opacity: 0;
    backdrop-filter: blur(0);
  }
  to {
    opacity: 1;
    backdrop-filter: blur(16px);
  }
}

.fs-prompt-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  padding: 48px 64px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 24px;
  text-align: center;
  pointer-events: none; /* clicks bubble to the overlay → fullscreen request */
  max-width: 80vw;
}

.fs-prompt-icon {
  font-size: clamp(56px, 7vw, 96px);
  line-height: 1;
  background: linear-gradient(135deg, #34d399, #22d3ee, #818cf8);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.fs-prompt-title {
  font-size: clamp(22px, 2.6vw, 36px);
  font-weight: 700;
  letter-spacing: -0.01em;
  color: #fff;
}

.fs-prompt-sub {
  font-size: clamp(13px, 1.4vw, 16px);
  color: rgba(255, 255, 255, 0.55);
  letter-spacing: 0.02em;
}

.fs-prompt-sub kbd {
  display: inline-block;
  padding: 2px 8px;
  margin: 0 2px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.95em;
  color: rgba(255, 255, 255, 0.85);
}

.fs-prompt-dismiss {
  margin-top: 8px;
  padding: 8px 18px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: rgba(255, 255, 255, 0.6);
  border-radius: 10px;
  font-family: inherit;
  font-size: 13px;
  letter-spacing: 0.04em;
  cursor: pointer;
  pointer-events: auto; /* re-enable clicks on the dismiss button itself */
  transition: background 150ms, color 150ms;
}

.fs-prompt-dismiss:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

/* ── Monitor mode (control-panel grid preview) ─────────────────────
 * Strip every overlay so the iframe renders only the active scene.
 * No HUD, no fullscreen button, no idle splash — those would just
 * clutter a 200px-wide preview tile.
 * ─────────────────────────────────────────────────────────────────── */
body.monitor-mode .hud,
body.monitor-mode .fs-btn,
body.monitor-mode .fs-prompt,
body.monitor-mode .claim,
body.monitor-mode .idle {
  display: none !important;
}

body.monitor-mode iframe#scene {
  /* Skip the cross-fade — we want the freshest possible frame. */
  transition: none;
  opacity: 1;
}

/* Block stray clicks/taps inside the preview tile from interacting
 * with the embedded scene. The control card handles all clicks
 * (opens the per-TV sheet). */
body.monitor-mode iframe#scene {
  pointer-events: none;
}
