* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { width: 100%; height: 100%; background: #000; overflow: hidden; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }

.view { width: 100vw; height: 100vh; }

#pairing-view { display: flex; align-items: center; justify-content: center; background: #0c1020; }
.pairing-box { text-align: center; color: #fff; }
.logo { display: block; width: 260px; max-width: 60vw; margin: 0 auto 24px; }

@keyframes brand-blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
.blinking { animation: brand-blink 1.6s linear infinite; }

/* Portrait screens: the box's own OS/browser viewport usually stays landscape (most
   TV boxes and kiosk PCs aren't told to rotate their display), so a portrait-mounted
   panel needs the page content itself rotated to match, rather than the OS. Applied
   only once we know the screen's orientation (see applyOrientation in player.js) —
   never during pairing, since orientation isn't known until after approval+sync. A
   real OS-level orientation lock (screen.orientation.lock, where supported — mainly
   Android Chrome in fullscreen) is tried first in player.js; this class is the
   guaranteed-to-work fallback for everywhere else. */
body.orientation-portrait #player-view {
  position: fixed;
  top: 50%;
  left: 50%;
  width: 100vh;
  height: 100vw;
  transform: translate(-50%, -50%) rotate(90deg);
  transform-origin: center center;
}
.pairing-label { color: #9aa3c0; font-size: 16px; margin-bottom: 20px; }
.pairing-code { font-size: 72px; font-weight: 800; letter-spacing: 18px; padding-left: 18px; color: #fff; }
.pairing-status { margin-top: 24px; color: #6b7280; font-size: 14px; }
.pairing-error { margin-top: 10px; color: #f87171; font-size: 14px; min-height: 18px; }

/* --- Keypad: typed by whoever is setting up the device, entering the code
   shown on that screen's admin edit page (see WSP_Player::render_code_entry_html
   in the old WordPress plugin — this mirrors that flow). --- */
.keypad-digits { display: flex; gap: 8px; justify-content: center; margin: 24px 0; }
.keypad-digit {
  width: 42px; height: 54px; background: #151a30; border: 1px solid #2a3050;
  border-radius: 6px; display: flex; align-items: center; justify-content: center;
  font-size: 26px; font-weight: 700; color: #fff;
}
.keypad-digit.filled { border-color: #3b5bfd; }
.keypad { display: grid; grid-template-columns: repeat(3, 64px); gap: 10px; justify-content: center; }
.keypad button {
  width: 64px; height: 56px; border-radius: 8px; border: 1px solid #2a3050;
  background: #151a30; color: #fff; font-size: 20px; cursor: pointer;
}
.keypad button:active { background: #3b5bfd; border-color: #3b5bfd; }
.keypad button.wide { font-size: 13px; }
.change-device-link {
  color: #6b7280; font-size: 12px; margin-top: 24px; display: inline-block;
  text-decoration: underline; cursor: pointer; background: none; border: none;
}

/* --- Update splash: shown briefly whenever content actually changes, instead
   of an abrupt jump cut. --- */
#splash-view {
  position: absolute; inset: 0; z-index: 50; display: flex; flex-direction: column;
  align-items: center; justify-content: center; color: #fff; text-align: center;
  transition: opacity 300ms ease;
}
#splash-view img { max-width: 40%; max-height: 30%; margin-bottom: 20px; object-fit: contain; }
#splash-view .spinner {
  width: 40px; height: 40px; border-radius: 50%; margin-bottom: 20px;
  border: 4px solid rgba(255,255,255,0.25); border-top-color: #fff;
  animation: splash-spin 900ms linear infinite;
}
#splash-view .splash-message { font-size: 20px; font-weight: 600; }
@keyframes splash-spin { to { transform: rotate(360deg); } }

/* --- Canvas slides: widgets positioned by percentage over a background. --- */
.slide-canvas { position: absolute; inset: 0; width: 100%; height: 100%; overflow: hidden; }
.widget { position: absolute; overflow: hidden; transform-origin: center center; }
.widget-text { display: flex; white-space: pre-wrap; word-break: break-word; }
.widget img, .widget video, .widget iframe { width: 100%; height: 100%; border: 0; }
.widget video, .widget img { object-fit: cover; }

#player-view { position: relative; overflow: hidden; }
/* Default (no video wall): fills the viewport exactly. player.js resizes/offsets
   this in wall mode — see the comment on #wall-canvas in index.html. */
#wall-canvas { position: absolute; left: 0; top: 0; width: 100%; height: 100%; }
.slide {
  position: absolute; inset: 0; width: 100%; height: 100%;
  background: #000 center center no-repeat; background-size: contain;
  opacity: 0; z-index: 1;
  will-change: opacity, transform;
  /* opacity/transform/transition are driven inline by player.js per-transition —
     this is just the resting state before the first slide ever shows. */
}
.slide video, .slide img { width: 100%; height: 100%; object-fit: contain; }
/* In wall mode the slide fills the full shared canvas, so content should crop
   to fill (like a video wall) rather than letterbox. */
#wall-canvas.wall-mode .slide video, #wall-canvas.wall-mode .slide img { object-fit: cover; }

.offline-indicator {
  position: absolute; bottom: 16px; right: 16px; z-index: 10;
  background: rgba(20,20,20,0.75); color: #ffc847; font-size: 13px;
  padding: 6px 12px; border-radius: 6px;
}

/* Fix: a view's own unconditional "display" rule (e.g. #pairing-view /
   #splash-view set display:flex for when they ARE shown) has higher CSS
   specificity than the browser's built-in [hidden] rule, so player.js
   correctly setting .hidden = true had NO visual effect on those two views.
   Result: once a device was ever shown the pairing/splash screen, it stayed
   visually stuck on top forever, even after being approved and successfully
   syncing real content underneath. This rule makes [hidden] always win. */
.view[hidden], #splash-view[hidden] { display: none !important; }
