/* PhotoFlixDM runs on a television seen from across a room: nothing under 24px,
   high contrast, and a safe area inset because many TVs still overscan. */
:root {
  --bg: #07090f;
  --surface: #11151f;
  --surface-2: #1a2030;
  --ink: #f4f6fb;
  --ink-dim: #9aa4bd;
  --accent: #4f8dff;
  --accent-warm: #ffb547;
  --good: #35d07f;
  --safe: 4vh 4vw;
  --radius: 18px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font: 400 24px/1.45 "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  overflow: hidden;
  cursor: none;
}

#app { height: 100%; }

.screen {
  height: 100%;
  padding: var(--safe);
  display: none;
  flex-direction: column;
}
.screen.active { display: flex; }

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  font-weight: 650;
  letter-spacing: -0.01em;
}
.brand .dot {
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 20px var(--accent);
}

/* --- pairing ---------------------------------------------------------- */

.pair {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6vw;
  align-items: center;
}
.pair h1 {
  font-size: clamp(40px, 4.4vw, 76px);
  line-height: 1.1;
  margin: 0 0 24px;
  letter-spacing: -0.02em;
}
.pair p { color: var(--ink-dim); font-size: clamp(22px, 1.7vw, 30px); margin: 0 0 18px; max-width: 22ch; }

.steps { list-style: none; padding: 0; margin: 32px 0 0; counter-reset: s; }
.steps li {
  counter-increment: s;
  display: flex; gap: 18px; align-items: baseline;
  margin-bottom: 16px; color: var(--ink-dim); font-size: clamp(20px, 1.5vw, 27px);
}
.steps li::before {
  content: counter(s);
  flex: 0 0 auto;
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--surface-2); color: var(--ink);
  display: grid; place-items: center;
  font-size: 20px; font-weight: 600;
}

.qr-card {
  background: #fff;
  border-radius: var(--radius);
  padding: 28px;
  display: grid;
  place-items: center;
  gap: 20px;
}
.qr-card canvas, .qr-card img { display: block; width: 30vh; height: 30vh; }
.qr-fallback {
  display: grid; place-items: center;
  width: 30vh; height: 30vh;
  color: #07090f; text-align: center; padding: 16px;
  font-size: 20px; line-height: 1.3;
}
.code {
  font: 700 clamp(34px, 3vw, 54px)/1 ui-monospace, "SF Mono", Menlo, monospace;
  letter-spacing: 0.22em;
  color: #07090f;
  text-indent: 0.22em;
}
.pair-url { color: var(--ink-dim); font-size: 20px; margin-top: 10px; }

/* --- queue board ------------------------------------------------------ */

.board { flex: 1; display: flex; flex-direction: column; gap: 3vh; min-height: 0; }
.board-head { display: flex; justify-content: space-between; align-items: flex-end; }
.board-head h1 { font-size: clamp(34px, 3.2vw, 56px); margin: 0; letter-spacing: -0.02em; }
.board-head .muted { color: var(--ink-dim); font-size: clamp(20px, 1.5vw, 28px); }

.counters {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 2vh 2vw;
  min-height: 0;
}
.counter {
  background: var(--surface);
  border: 1px solid #222a3c;
  border-radius: var(--radius);
  padding: 3vh 2vw;
  display: flex; flex-direction: column; justify-content: center; gap: 12px;
}
.counter.just-called {
  border-color: var(--accent);
  background: linear-gradient(140deg, #16233f, var(--surface));
  animation: pulse 1.1s ease-in-out 3;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(79, 141, 255, 0); }
  50% { box-shadow: 0 0 0 14px rgba(79, 141, 255, 0.16); }
}
.counter .name { color: var(--ink-dim); font-size: clamp(20px, 1.4vw, 26px); }
.counter .number {
  font: 700 clamp(64px, 8vw, 150px)/1 "Inter", system-ui, sans-serif;
  letter-spacing: -0.03em;
  /* An open counter with nobody at it keeps the same height as a busy one, so
     the numbers across the board sit on one line. */
  min-height: clamp(64px, 8vw, 150px);
  display: flex;
  align-items: center;
}
.counter .number.empty { color: #2b3346; }

.board-foot {
  display: flex; justify-content: space-between; align-items: center;
  color: var(--ink-dim); font-size: clamp(20px, 1.4vw, 26px);
}
.next-up { display: flex; gap: 14px; align-items: center; }
.chip {
  background: var(--surface-2); border-radius: 999px;
  padding: 8px 20px; color: var(--ink); font-weight: 600;
}

/* --- family viewing --------------------------------------------------- */

.stage { position: absolute; inset: 0; background: #000; }
.stage img, .stage video {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: contain;
  opacity: 0;
  transition: opacity 700ms ease;
}
.stage .shown { opacity: 1; }
.caption {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 10vh var(--safe) 5vh;
  background: linear-gradient(to top, rgba(0,0,0,.75), transparent);
  font-size: clamp(22px, 1.7vw, 32px);
}
.progress {
  position: absolute; top: 0; left: 0; height: 4px;
  background: var(--accent);
  transition: width 200ms linear;
}

/* --- ads and OOH ------------------------------------------------------ */

.ad-badge {
  position: absolute; top: 4vh; right: 4vw;
  background: rgba(0,0,0,.55);
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 999px;
  padding: 8px 20px;
  font-size: 20px; letter-spacing: .06em; text-transform: uppercase;
  color: var(--ink-dim);
}

/* --- overlays --------------------------------------------------------- */

.toast {
  position: absolute; left: 50%; bottom: 6vh; transform: translateX(-50%);
  background: rgba(10,13,20,.92);
  border: 1px solid #2a3348;
  border-radius: 999px;
  padding: 14px 32px;
  font-size: 22px;
  opacity: 0; transition: opacity 300ms ease;
}
.toast.shown { opacity: 1; }

.empty-state {
  flex: 1; display: grid; place-content: center; text-align: center; gap: 14px;
}
.empty-state h2 { font-size: clamp(32px, 3vw, 52px); margin: 0; }
.empty-state p { color: var(--ink-dim); margin: 0; }

.offline {
  position: absolute; top: 4vh; left: 4vw;
  background: #4a1f22; border: 1px solid #7d3238; color: #ffd9dc;
  border-radius: 999px; padding: 10px 24px; font-size: 20px;
  display: none;
}
.offline.shown { display: block; }
