@font-face {
  font-family: "Inter";
  src: url("../sso/fonts/Inter-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Space Grotesk";
  src: url("../sso/fonts/SpaceGrotesk-Variable.woff2") format("woff2");
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Sans Arabic";
  src: url("../sso/fonts/IBMPlexSansArabic-Medium.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("../sso/fonts/IBMPlexMono-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

html, body {
  margin: 0;
  height: 100%;
  background: #000;
  color: #fafafa;
  font-family: "Inter", system-ui, sans-serif;
  overflow: hidden;
}
.screen {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
}
#pairing,
#player {
  display: none;
}
html.ads-pairing #pairing,
html.ads-claimed #player {
  display: flex;
}
#pairing {
  background: #0a0e1a;
  /* Bottom room for the footer, which sits over both screens. */
  padding: 48px 32px 112px;
}
.brand {
  height: 36px;
  width: auto;
  margin-bottom: 8px;
}
.hidden { display: none !important; }
.lede {
  margin: 0;
  font-family: "Space Grotesk", "Inter", system-ui, sans-serif;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: #c9d4e3;
}
.pin {
  font-family: "Space Grotesk", "Inter", system-ui, sans-serif;
  font-size: 96px;
  font-weight: 700;
  letter-spacing: 0.16em;
}
.hint {
  margin: 0;
  font-size: 14px;
  line-height: 20px;
  color: #5a6b85;
}
.qr {
  width: 220px;
  height: 220px;
  background: #fff;
  padding: 8px;
  border-radius: 12px;
  box-sizing: content-box;
}
/*
 * The player is a framed stage: inset from the screen edge, rounded, with a
 * hairline border, leaving a strip at the bottom for the footer. Media covers
 * the whole frame; anything off its aspect ratio is cropped, never boxed.
 */
:root {
  --tv-gutter: 12px;
  --tv-footer: 36px;
}
#player {
  position: fixed;
  top: var(--tv-gutter);
  right: var(--tv-gutter);
  bottom: calc(var(--tv-gutter) + var(--tv-footer));
  left: var(--tv-gutter);
  min-height: 0;
  border: 1px solid #3f3f46;
  border-radius: 12px;
  overflow: hidden;
  background: #000;
  cursor: none;
}
html.ads-claimed body { background: #09090b; }
.media {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #000;
}
/* A failed decode paints the broken-image icon. Keep it hidden until pixels exist. */
img.media:not([data-ready="1"]) { visibility: hidden !important; }
html:fullscreen,
html:-webkit-full-screen {
  background: #000;
  width: 100%;
  height: 100%;
}
/*
 * Waiting screen inside the frame: the TV is paired and polling, but has
 * nothing to play yet. Flat navy field, no glow; status is dot + text.
 * Sizes follow the viewport so it reads from across a shop floor.
 */
.tv-idle {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(16px, 2.2vh, 28px);
  padding: 32px;
  background: #0a0e1a;
  text-align: center;
}
.tv-idle[hidden] { display: none; }
.tv-idle-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px;
  border: 1px solid rgba(74, 222, 128, 0.32);
  border-radius: 999px;
  background: rgba(74, 222, 128, 0.08);
  color: #4ade80;
  font-size: clamp(12px, 1.2vh, 16px);
  font-weight: 500;
}
.tv-idle-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #4ade80;
  animation: tv-idle-pulse 2.4s ease-in-out infinite;
}
.tv-idle-status.offline {
  border-color: #3f3f46;
  background: rgba(161, 161, 170, 0.08);
  color: #a1a1aa;
}
.tv-idle-status.offline .tv-idle-dot { background: #a1a1aa; }
@keyframes tv-idle-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}
@media (prefers-reduced-motion: reduce) {
  .tv-idle-dot { animation: none; }
}
.tv-idle-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: clamp(64px, 9vh, 112px);
  height: clamp(64px, 9vh, 112px);
  border: 1px solid #1e3a5f;
  border-radius: 20px;
  background: #101b33;
  color: #c9d4e3;
}
.tv-idle-icon svg {
  width: 48%;
  height: 48%;
}
.tv-idle-copy p { margin: 0; }
.tv-idle-title {
  font-family: "Space Grotesk", "Inter", system-ui, sans-serif;
  font-size: clamp(24px, 3.6vh, 48px);
  font-weight: 600;
  letter-spacing: -0.02em;
  color: #fafafa;
}
.tv-idle-body {
  margin-top: 6px !important;
  font-size: clamp(14px, 1.9vh, 22px);
  line-height: 1.5;
  color: #8b9ab0;
}
.tv-idle-ar .tv-idle-title,
.tv-idle-ar .tv-idle-body {
  font-family: "IBM Plex Sans Arabic", "Inter", system-ui, sans-serif;
  letter-spacing: 0;
}
.tv-idle-ar .tv-idle-title { font-weight: 500; }

/* Footer: "Powered by RIME" at the start, the display ID at the end. */
.tv-footer {
  position: fixed;
  right: var(--tv-gutter);
  bottom: 0;
  left: var(--tv-gutter);
  z-index: 20;
  height: calc(var(--tv-gutter) + var(--tv-footer));
  box-sizing: border-box;
  padding: 0 4px 4px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  color: #71717a;
  font-size: 12px;
  line-height: 16px;
  pointer-events: none;
  user-select: none;
}
.tv-footer[hidden] { display: none; }
.tv-powered {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.tv-logo {
  display: inline-block;
  width: 44px;
  height: 12px;
  background: url("../admin/rime-logo-white.svg") left center / contain no-repeat;
  opacity: 0.7;
}
.tv-id {
  font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  letter-spacing: 0.02em;
  color: #71717a;
}
.tv-id[hidden] { display: none; }
