/* CLOUDFLIX – Netflix-style live quiz */
:root {
  --nf-red: #e50914;
  --nf-red-dark: #b00610;
  --nf-bg: #0b0b0b;
  --nf-bg-2: #1a1a1a;
  --nf-bg-3: #262626;
  --nf-text: #ffffff;
  --nf-text-dim: #b3b3b3;
  --nf-border: #2f2f2f;
  --nf-ok: #46d369;
  --nf-warn: #f5c518;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Helvetica Neue', 'Segoe UI', Arial, sans-serif;
  background: var(--nf-bg);
  color: var(--nf-text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.logo {
  font-family: 'Bebas Neue', 'Helvetica Neue', Arial, sans-serif;
  font-weight: 900;
  font-size: 28px;
  letter-spacing: 3px;
  color: var(--nf-red);
  text-shadow: 0 2px 12px rgba(229,9,20,0.5);
}
.logo span { color: var(--nf-text); margin-left: 4px; font-weight: 700; letter-spacing: 4px; }
.logo.big { font-size: 56px; margin-bottom: 30px; }

.kicker {
  display: inline-block;
  color: var(--nf-red);
  font-weight: 700;
  letter-spacing: 6px;
  font-size: 14px;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.kicker.red { color: var(--nf-red); }

.hidden { display: none !important; }

/* ===================== PRESENTER ===================== */
body.presenter {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  background: radial-gradient(ellipse at top, #1f1f1f 0%, #050505 70%);
}

.top-bar {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 14px 28px;
  border-bottom: 1px solid var(--nf-border);
  background: linear-gradient(180deg, rgba(0,0,0,0.95), rgba(0,0,0,0.5));
}
.now-streaming {
  color: var(--nf-text-dim);
  font-family: monospace;
  letter-spacing: 2px;
  font-size: 13px;
}
.progress {
  margin-left: auto;
  font-family: monospace;
  font-weight: 700;
  color: var(--nf-text-dim);
  letter-spacing: 1px;
}

.countdown {
  font-size: 42px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  background: var(--nf-bg-3);
  border-radius: 10px;
  padding: 2px 18px;
  min-width: 92px;
  text-align: center;
  border: 2px solid transparent;
  transition: all 0.2s;
}
.countdown.warn { color: var(--nf-warn); border-color: var(--nf-warn); }
.countdown.danger {
  color: white; background: var(--nf-red); border-color: var(--nf-red);
}

.stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 60px;
  overflow: auto;
}
.loading { color: var(--nf-text-dim); font-size: 24px; }

/* --- Lobby slide with FEATURED poster + profiles --- */
.lobby {
  display: grid;
  grid-template-columns: 1.2fr 0.9fr;
  gap: 60px;
  width: 100%;
  max-width: 1500px;
  align-items: center;
}
.lobby-left { min-width: 0; }
.lobby-title {
  font-size: clamp(56px, 7vw, 110px);
  font-weight: 900;
  line-height: 1;
  margin: 6px 0 18px;
  letter-spacing: -2px;
  text-shadow: 0 4px 24px rgba(0,0,0,0.8);
}
.lobby-sub {
  font-size: clamp(18px, 1.6vw, 24px);
  color: var(--nf-text-dim);
  margin: 0 0 36px;
}
.profiles-wrap {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--nf-border);
  border-radius: 14px;
  padding: 20px 22px;
}
.profiles-label {
  font-size: 14px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--nf-text-dim);
  margin-bottom: 14px;
}
.profiles-label span {
  color: var(--nf-red);
  font-weight: 800;
  margin-left: 6px;
}
.profiles-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  max-height: 280px;
  overflow: auto;
}
.profiles-empty {
  color: var(--nf-text-dim);
  font-style: italic;
}
.profile-mini {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 84px;
}
.profile-avatar {
  width: 64px; height: 64px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 900; font-size: 24px;
  color: white;
  border: 2px solid rgba(255,255,255,0.15);
  box-shadow: 0 4px 14px rgba(0,0,0,0.4);
}
.profile-name {
  margin-top: 6px;
  font-size: 13px;
  color: var(--nf-text-dim);
  text-align: center;
  max-width: 84px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  width: 100%;
}

/* --- Creative QR poster --- */
.poster {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
}
.poster-tape {
  width: 100%;
  background: var(--nf-red);
  color: white;
  font-weight: 800;
  letter-spacing: 4px;
  font-size: 12px;
  padding: 6px 0;
  text-align: center;
  overflow: hidden;
  white-space: nowrap;
}
.poster-tape.bottom { background: var(--nf-bg-3); color: var(--nf-text-dim); }
.poster-card {
  background: #111;
  border: 1px solid var(--nf-border);
  border-radius: 14px;
  padding: 22px;
  width: clamp(280px, 28vw, 360px);
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
  position: relative;
}
.poster-badge {
  display: inline-block;
  background: var(--nf-red);
  color: white;
  font-weight: 900;
  font-size: 12px;
  letter-spacing: 3px;
  padding: 6px 12px;
  border-radius: 4px;
  margin-bottom: 14px;
}
.poster-qr {
  background: #000;
  padding: 16px;
  border-radius: 14px;
  width: 100%;
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.poster-qr svg { width: 100%; height: 100%; }
.qr-loading { color: var(--nf-text-dim); }
.poster-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
}
.poster-rating {
  background: var(--nf-bg-3);
  color: var(--nf-text-dim);
  border: 1px solid var(--nf-border);
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 700;
  border-radius: 4px;
}
.poster-url {
  font-family: monospace;
  font-size: 14px;
  color: var(--nf-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.poster-foot {
  margin-top: 12px;
  font-size: 11px;
  letter-spacing: 3px;
  color: var(--nf-text-dim);
  text-align: center;
  text-transform: uppercase;
}

/* --- Question stage (no QR here) --- */
.question-block { width: 100%; max-width: 1400px; }
.question {
  font-size: clamp(32px, 4.2vw, 64px);
  font-weight: 800;
  line-height: 1.15;
  margin: 8px 0 36px;
  letter-spacing: -1px;
}

.options {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}
.opt {
  position: relative;
  background: var(--nf-bg-2);
  border: 2px solid var(--nf-border);
  border-radius: 14px;
  overflow: hidden;
  min-height: 88px;
}
.opt-bar {
  position: absolute;
  inset: 0 auto 0 0;
  background: linear-gradient(90deg, rgba(229,9,20,0.35), rgba(229,9,20,0.15));
  transition: width 0.6s ease;
  width: 0%;
}
.opt-content {
  position: relative;
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 18px 24px;
  font-size: clamp(20px, 2vw, 28px);
  font-weight: 600;
}
.opt .letter {
  display: inline-flex; align-items: center; justify-content: center;
  width: 48px; height: 48px; border-radius: 10px;
  background: var(--nf-red); color: white;
  font-weight: 900; font-size: 22px; flex-shrink: 0;
}
.opt .text { flex: 1; }
.opt .count {
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  background: rgba(0,0,0,0.4);
  padding: 4px 14px;
  border-radius: 8px;
}
.opt.revealed.correct { border-color: var(--nf-ok); }
.opt.revealed.correct .opt-bar { background: linear-gradient(90deg, rgba(70,211,105,0.45), rgba(70,211,105,0.2)); }
.opt.revealed.correct .letter { background: var(--nf-ok); }
.opt.revealed.wrong { opacity: 0.6; }

.text-hint {
  font-size: 22px;
  color: var(--nf-text-dim);
  background: var(--nf-bg-2);
  border: 2px dashed var(--nf-border);
  padding: 32px;
  border-radius: 14px;
  text-align: center;
}
.text-result { margin-top: 20px; display: flex; flex-direction: column; gap: 12px; }
.bar-row { display: flex; align-items: center; gap: 16px; font-size: 20px; }
.bar-row span { width: 80px; }
.bar { flex: 1; height: 28px; background: var(--nf-bg-2); border-radius: 8px; overflow: hidden; }
.fill { height: 100%; transition: width 0.6s; }
.fill.ok { background: var(--nf-ok); }
.fill.ko { background: var(--nf-red); }

/* --- Outro / podium / leaderboard --- */
.outro { width: 100%; max-width: 1200px; text-align: center; }
.outro-title {
  font-size: clamp(48px, 6vw, 96px);
  font-weight: 900;
  margin: 8px 0 12px;
}
.podium {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin: 40px auto;
  max-width: 800px;
  align-items: end;
}
.podium-card {
  background: var(--nf-bg-2);
  border: 1px solid var(--nf-border);
  border-radius: 14px;
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.podium-card.place-1 {
  border-color: var(--nf-warn);
  box-shadow: 0 0 40px rgba(245,197,24,0.3);
  transform: translateY(-20px);
}
.podium-card.place-2 { border-color: #c0c0c0; }
.podium-card.place-3 { border-color: #cd7f32; }
.podium-empty { visibility: hidden; }
.podium-medal { font-size: 40px; }
.podium-avatar {
  width: 70px; height: 70px;
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 900; font-size: 28px; color: white;
}
.podium-name { font-weight: 800; font-size: 18px; }
.podium-score { font-size: 28px; font-weight: 900; color: var(--nf-red); }

.leaderboard {
  max-width: 600px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.lb-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--nf-bg-2);
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--nf-border);
}
.lb-rank { font-family: monospace; font-weight: 800; color: var(--nf-text-dim); width: 40px; }
.lb-dot { width: 14px; height: 14px; border-radius: 4px; }
.lb-name { flex: 1; text-align: left; font-weight: 600; }
.lb-score { font-variant-numeric: tabular-nums; font-weight: 800; color: var(--nf-red); }
.lb-row.me { border-color: var(--nf-red); background: rgba(229,9,20,0.1); }

/* --- Bottom bar (controls only, NO QR here anymore) --- */
.bottom-bar {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 14px 28px;
  border-top: 1px solid var(--nf-border);
  background: linear-gradient(0deg, rgba(0,0,0,0.95), rgba(0,0,0,0.6));
}
.bottom-left { flex: 1; }
.stats { display: flex; gap: 22px; font-size: 14px; color: var(--nf-text-dim); }
.stats b { color: var(--nf-text); font-size: 20px; margin-right: 6px; }
.controls { display: flex; gap: 10px; }
.controls button {
  padding: 10px 22px;
  background: var(--nf-bg-3);
  color: var(--nf-text);
  border: 1px solid var(--nf-border);
  border-radius: 10px;
  font-weight: 700;
  font-size: 16px;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}
.controls button:hover { background: var(--nf-bg-2); }
.controls button:active { transform: scale(0.97); }
.controls #next { background: var(--nf-red); border-color: var(--nf-red); }
.controls #next:hover { background: var(--nf-red-dark); }

/* ===================== PARTICIPANT ===================== */
body.participant {
  background: radial-gradient(ellipse at top, #1a1a1a 0%, #000 80%);
  min-height: 100vh;
  display: block;
}

/* Name picker (Netflix "Who's watching?" full screen) */
.full-screen {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 20px;
}
.who {
  font-size: clamp(28px, 6vw, 48px);
  font-weight: 400;
  margin: 0 0 32px;
}
.profile-picker {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  width: 100%;
  max-width: 360px;
}
.big-avatar {
  width: 140px; height: 140px;
  border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 900; font-size: 56px;
  color: white;
  background: var(--nf-red);
  border: 3px solid rgba(255,255,255,0.1);
  box-shadow: 0 10px 30px rgba(0,0,0,0.6);
  transition: transform 0.3s, background 0.3s;
  margin-bottom: 8px;
}
.color-row {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  margin: 4px 0 12px;
}
.color-dot {
  width: 32px; height: 32px;
  border-radius: 8px;
  border: 2px solid transparent;
  cursor: pointer;
  padding: 0;
  transition: transform 0.15s, border-color 0.15s;
}
.color-dot:hover { transform: scale(1.1); }
.color-dot.active { border-color: white; transform: scale(1.15); }

/* Top bar after login */
.p-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--nf-border);
  background: rgba(0,0,0,0.7);
  position: sticky; top: 0; z-index: 5;
  backdrop-filter: blur(8px);
}
.me { display: flex; align-items: center; gap: 10px; }
.me-avatar {
  width: 40px; height: 40px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: white; font-weight: 900; font-size: 16px;
}
.me-name { font-weight: 800; font-size: 15px; }
.me-score { font-size: 12px; color: var(--nf-text-dim); }
.me-score b { color: var(--nf-warn); font-size: 14px; margin-right: 2px; }

.p-countdown {
  font-size: 28px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  min-width: 58px;
  text-align: center;
  background: var(--nf-bg-3);
  padding: 4px 12px;
  border-radius: 10px;
  border: 2px solid transparent;
}
.p-countdown.warn { color: var(--nf-warn); border-color: var(--nf-warn); }
.p-countdown.danger { color: white; background: var(--nf-red); border-color: var(--nf-red); }

.p-main {
  padding: 20px 16px 60px;
  max-width: 720px;
  width: 100%;
  margin: 0 auto;
}

.card {
  background: var(--nf-bg-2);
  border: 1px solid var(--nf-border);
  border-radius: 14px;
  padding: 24px 22px;
  text-align: center;
}
.card h2 { font-size: 24px; margin: 6px 0 8px; font-weight: 800; }
.muted { color: var(--nf-text-dim); margin: 4px 0 14px; }
.muted.small { font-size: 12px; }

input { font-family: inherit; }
input[type=text], input:not([type]) {
  width: 100%;
  background: var(--nf-bg-3);
  border: 2px solid var(--nf-border);
  color: var(--nf-text);
  border-radius: 10px;
  padding: 14px 16px;
  font-size: 18px;
  font-weight: 600;
  outline: none;
  transition: border-color 0.15s;
}
input:focus { border-color: var(--nf-red); }

.primary {
  display: block;
  width: 100%;
  margin-top: 6px;
  background: var(--nf-red);
  color: white;
  border: none;
  border-radius: 10px;
  padding: 14px;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}
.primary:hover { background: var(--nf-red-dark); }
.primary:active { transform: scale(0.98); }

.lobby-card .lobby-pulse {
  width: 4px; height: 24px;
  margin: 16px auto 8px;
  display: flex;
  gap: 4px;
  justify-content: center;
}
.lobby-card .lobby-pulse::before,
.lobby-card .lobby-pulse::after,
.lobby-card .lobby-pulse {
  /* simple three-dot loader, no continuous bg pulse */
}
.lobby-card .lobby-pulse {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--nf-text-dim);
  box-shadow: 16px 0 0 var(--nf-text-dim), 32px 0 0 var(--nf-text-dim);
  margin: 14px auto 18px 14px;
}
.lobby-others-label {
  font-size: 12px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--nf-text-dim);
  margin: 10px 0 12px;
}
.lobby-others {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
}
.profile-mini.small { width: 60px; }
.profile-mini.small .profile-avatar { width: 48px; height: 48px; font-size: 18px; }
.profile-mini.small .profile-name { font-size: 11px; }

.ep-tag {
  font-family: monospace;
  letter-spacing: 2px;
  color: var(--nf-red);
  font-size: 12px;
  margin-bottom: 6px;
}
.q-question {
  font-size: 22px;
  font-weight: 800;
  line-height: 1.25;
  margin-bottom: 16px;
}
.q-options { display: flex; flex-direction: column; gap: 12px; }
.opt-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  background: var(--nf-bg-2);
  border: 2px solid var(--nf-border);
  border-radius: 12px;
  color: var(--nf-text);
  font-size: 18px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: transform 0.1s, border-color 0.15s, background 0.15s;
  font-family: inherit;
}
.opt-btn:hover:not(:disabled) { border-color: var(--nf-red); }
.opt-btn:active:not(:disabled) { transform: scale(0.98); }
.opt-btn:disabled { opacity: 0.5; cursor: default; }
.opt-btn.selected {
  border-color: var(--nf-red);
  background: rgba(229,9,20,0.15);
  opacity: 1;
}
.opt-btn .letter {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 8px;
  background: var(--nf-red); color: white;
  font-weight: 900; flex-shrink: 0;
}
.opt-btn .text { flex: 1; }

.q-text { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }

.submitted {
  margin-top: 20px;
  background: var(--nf-bg-2);
  border: 1px solid var(--nf-border);
  border-radius: 12px;
  padding: 24px;
  text-align: center;
}
.submitted .check {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: var(--nf-ok);
  color: white;
  font-size: 32px;
  font-weight: 900;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 12px;
}
.locked .q-options .opt-btn:not(.selected) { opacity: 0.35; }

.result-emoji { font-size: 64px; margin-bottom: 6px; }
.delta-box {
  margin-top: 18px;
  display: inline-block;
  padding: 14px 28px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--nf-red), var(--nf-red-dark));
  box-shadow: 0 8px 30px rgba(229,9,20,0.5);
}
.delta-label { font-size: 11px; letter-spacing: 3px; opacity: 0.8; text-transform: uppercase; }
.delta-value { font-size: 36px; font-weight: 900; font-variant-numeric: tabular-nums; }
.delta-box.pop { animation: fade-in 0.25s ease-out; }
@keyframes fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.me-final {
  margin: 22px auto;
  display: inline-block;
  padding: 16px 36px;
  border: 2px solid var(--nf-red);
  border-radius: 14px;
  background: rgba(229,9,20,0.1);
}
.me-final-score {
  font-size: 56px;
  font-weight: 900;
  color: var(--nf-red);
  line-height: 1;
}
.me-final-label {
  font-size: 12px;
  letter-spacing: 3px;
  color: var(--nf-text-dim);
  text-transform: uppercase;
}
.mini-lb { margin-top: 20px; display: flex; flex-direction: column; gap: 6px; }

.join-error {
  margin-top: 10px;
  padding: 10px 14px;
  background: rgba(229,9,20,0.15);
  border: 1px solid var(--nf-red);
  border-radius: 8px;
  color: var(--nf-red);
  font-size: 14px;
  font-weight: 600;
  text-align: center;
}

.locked-card {
  background: var(--nf-bg-2);
  border: 1px solid var(--nf-border);
  border-radius: 14px;
  padding: 36px 28px;
  text-align: center;
  max-width: 380px;
  width: 100%;
}
.locked-icon {
  font-size: 56px;
  margin-bottom: 8px;
  color: var(--nf-text-dim);
}
.locked-card h2 { margin: 0 0 8px; font-size: 24px; }

@media (max-width: 900px) {
  .lobby { grid-template-columns: 1fr; gap: 30px; }
  .stage { padding: 20px; }
}
@media (max-width: 700px) {
  .options { grid-template-columns: 1fr; }
  .podium { grid-template-columns: 1fr; }
  .podium-card.place-1 { transform: none; }
}
