html, body { overscroll-behavior-y: contain; }

.fq-player-body {
  min-height: 100vh;
  min-height: 100dvh;
  background: radial-gradient(circle at 50% 0%, color-mix(in srgb, var(--primary) 10%, var(--bg)), var(--bg) 60%);
}

#player-root { min-height: 100vh; min-height: 100dvh; }

.fq-screen {
  display: none;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 20px 18px 32px;
  padding-bottom: max(32px, calc(env(safe-area-inset-bottom, 0px) + 20px));
  flex-direction: column;
}
.fq-screen.active { display: flex; }

/* ---------------- Join ---------------- */

.fq-join-card {
  max-width: 380px;
  margin: 8vh auto 0;
  width: 100%;
  text-align: center;
}
.fq-join-logo { margin-bottom: 20px; }
.fq-join-logo__img { height: 56px; width: auto; display: inline-block; object-fit: contain; }
.fq-join-card h1 { margin-bottom: 24px; font-size: 1.6rem; }
.fq-join-card .fq-field { text-align: left; }

.fq-pin-input {
  text-align: center;
  font-size: 1.8rem;
  font-weight: 800;
  letter-spacing: 0.15em;
}

/* ---------------- Lobby ---------------- */

.fq-player-lobby {
  margin: auto;
  text-align: center;
  max-width: 360px;
}
.fq-player-avatar-big {
  font-size: 4rem;
  width: 110px; height: 110px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: var(--shadow-md);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 20px;
}
.fq-player-lobby h1 { margin-bottom: 6px; }
.fq-player-lobby p { margin-bottom: 10px; }

.fq-lobby-waiting { margin-top: 40px; }
.fq-waiting-dots { display: flex; justify-content: center; gap: 8px; margin-bottom: 16px; }
.fq-waiting-dots span {
  width: 12px; height: 12px; border-radius: 50%; background: var(--primary);
  animation: fq-dot-bounce 1.2s ease-in-out infinite;
}
.fq-waiting-dots span:nth-child(2) { animation-delay: 0.15s; }
.fq-waiting-dots span:nth-child(3) { animation-delay: 0.3s; }
@keyframes fq-dot-bounce { 0%, 80%, 100% { transform: scale(0.6); opacity: 0.5; } 40% { transform: scale(1); opacity: 1; } }

/* ---------------- Question ---------------- */

.fq-player-topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.fq-timer {
  width: 52px; height: 52px; border-radius: 50%;
  background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 1.2rem;
  box-shadow: var(--shadow-sm);
}
.fq-timer--warn { background: var(--danger); animation: fq-timer-pulse 0.6s ease infinite; }
@keyframes fq-timer-pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.08); } }

.fq-player-question-text {
  font-size: 1.3rem;
  font-weight: 800;
  text-align: center;
  margin: 10px 0 20px;
  line-height: 1.3;
}

.fq-player-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  flex: 1;
}
.fq-player-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: 20px;
  color: #fff;
  font-weight: 800;
  font-size: 1.05rem;
  min-height: 120px;
  padding: 14px;
  cursor: pointer;
  transition: transform 0.12s ease, opacity 0.2s ease, box-shadow 0.12s ease;
  box-shadow: var(--shadow-sm);
  -webkit-tap-highlight-color: transparent;
}
.fq-player-option:active { transform: scale(0.96); }
.fq-player-option--a { background: var(--opt-a); }
.fq-player-option--b { background: var(--opt-b); }
.fq-player-option--c { background: var(--opt-c); }
.fq-player-option--d { background: var(--opt-d); }
.fq-player-option__letter { font-size: 1.5rem; }
.fq-player-option.is-selected { box-shadow: 0 0 0 4px #fff, 0 0 0 8px var(--text); }
.fq-player-option.is-disabled { opacity: 0.45; cursor: not-allowed; }

.fq-player-locked {
  position: fixed; bottom: 24px; left: 18px; right: 18px;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 24px);
  background: var(--success); color: #fff; text-align: center;
  padding: 14px; border-radius: 16px; font-weight: 800;
  box-shadow: var(--shadow-md);
  animation: fq-pop-in 0.25s ease;
}
@keyframes fq-pop-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ---------------- Result ---------------- */

.fq-result-panel { margin: auto; text-align: center; max-width: 360px; }
.fq-result-panel.hidden { display: none; }
.fq-result-icon { font-size: 3.6rem; margin-bottom: 10px; }
.fq-result-points {
  font-size: 2.6rem; font-weight: 800; color: var(--success);
  margin: 10px 0;
}
.fq-result-points.is-zero { color: var(--danger); }

/* Leaderboard (duplicated here since player.css loads independently of host.css) */
.fq-leaderboard {
  max-width: 420px; margin: 0 auto; width: 100%;
  display: flex; flex-direction: column; gap: 10px;
}
.fq-lb-row {
  display: flex; align-items: center; gap: 14px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; padding: 12px 18px; box-shadow: var(--shadow-sm);
}
.fq-lb-row__rank { font-weight: 800; font-size: 1.1rem; color: var(--primary); width: 26px; }
.fq-lb-row__name { flex: 1; font-weight: 700; }
.fq-lb-row__score { font-weight: 800; }
.fq-your-rank {
  text-align: center; margin-top: 20px; font-weight: 700; color: var(--muted);
}

/* Podium (duplicated for the same reason) */
.fq-podium-title { text-align: center; font-size: 1.8rem; margin: 10px 0 30px; }
.fq-podium { display: flex; align-items: flex-end; justify-content: center; gap: 12px; flex: 1; }
.fq-podium__place { display: flex; flex-direction: column; align-items: center; width: 100px; animation: fq-podium-in 0.5s ease backwards; }
.fq-podium__place--1 { animation-delay: 0.3s; }
.fq-podium__place--2 { animation-delay: 0.1s; }
.fq-podium__place--3 { animation-delay: 0.5s; }
@keyframes fq-podium-in { from { opacity: 0; transform: translateY(30px); } to { opacity: 1; transform: none; } }
.fq-podium__avatar { font-size: 2rem; margin-bottom: 6px; }
.fq-podium__name { font-weight: 800; font-size: 0.85rem; text-align: center; margin-bottom: 2px; }
.fq-podium__score { color: var(--muted); font-weight: 700; font-size: 0.8rem; margin-bottom: 10px; }
.fq-podium__block { width: 100%; border-radius: 14px 14px 0 0; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 1.1rem; color: #fff; }
.fq-podium__place--1 .fq-podium__block { height: 120px; background: linear-gradient(180deg, #FFD166, #FFB020); }
.fq-podium__place--2 .fq-podium__block { height: 90px; background: linear-gradient(180deg, #C9CEDB, #9AA1B5); }
.fq-podium__place--3 .fq-podium__block { height: 70px; background: linear-gradient(180deg, #E2A275, #C97C4A); }
.fq-podium-actions { display: flex; justify-content: center; gap: 12px; padding: 20px 0; flex-wrap: wrap; }

.fq-podium-confetti { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 1; }
.fq-confetti-piece { position: absolute; top: -20px; width: 8px; height: 14px; opacity: 0.9; animation: fq-confetti-fall linear forwards; }
@keyframes fq-confetti-fall { to { transform: translateY(105vh) rotate(360deg); opacity: 0.3; } }

.hidden { display: none !important; }

@media (min-width: 480px) {
  .fq-player-option { min-height: 140px; font-size: 1.15rem; }
}

/* Short screens (small phones, landscape): keep all four answers on screen. */
@media (max-height: 700px) {
  .fq-player-option { min-height: 88px; }
  .fq-player-question-text { font-size: 1.15rem; margin: 6px 0 14px; }
}
