/* ── Live games (#live) ──
   Uses the theme's own colours (--blue, --card-bg, --text …), so it follows whatever theme is on.
   Layout: header at the top, the current screen centred in the space below. */

#screen-live {
  min-height: 100vh; background: var(--body-bg); color: var(--text);
  padding: max(12px, env(safe-area-inset-top)) 16px calc(24px + env(safe-area-inset-bottom));
  box-sizing: border-box;
}
#live-root {
  max-width: 920px; margin: 0 auto; min-height: calc(100vh - 48px);
  display: flex; flex-direction: column;
}
/* Centre whatever follows the header vertically */
#live-root > .live-header + * { margin-top: auto; }
#live-root > :last-child { margin-bottom: auto; }

/* ── Header ── */
.live-header {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 6px 0 14px; border-bottom: 1px solid var(--card-border); margin-bottom: 18px;
  font-family: var(--font-mono); font-size: 12px; color: var(--text-secondary);
}
.live-brand { display: inline-flex; align-items: center; gap: 8px; font-family: var(--font-serif); font-size: 20px; font-weight: 800; color: var(--text); }
.live-brand .live-pill {
  display: inline-flex; align-items: center; gap: 6px; font-family: var(--font-mono); font-size: 10px; font-weight: 700;
  letter-spacing: 0.12em; text-transform: uppercase; color: #fff; background: var(--blue); padding: 3px 9px 3px 8px; border-radius: 999px;
}
.live-pill::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: #fff; animation: livePulse 1.6s ease-in-out infinite; }
@keyframes livePulse { 50% { opacity: 0.3; transform: scale(0.7); } }
.live-unit, .live-me { color: var(--text-secondary); }
.live-me { font-weight: 700; color: var(--text); }
.live-code-chip, .live-qnum {
  margin-left: auto; background: var(--card-bg); border: 1px solid var(--card-border); color: var(--text);
  padding: 5px 12px; border-radius: 999px;
}
.live-qnum { margin-left: 0; }
.live-header .live-qnum { margin-left: 8px; }

/* ── Shared ── */
.live-center { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 14px; padding: 12px 0; }
.live-kicker { font-family: var(--font-mono); font-size: 11px; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; color: var(--blue); }
.live-get-ready { font-family: var(--font-serif); font-size: clamp(28px, 6vw, 46px); font-weight: 900; line-height: 1.1; color: var(--text); }
.live-sub { font-family: var(--font-mono); font-size: 13px; color: var(--text-secondary); margin: 0; }
.live-countdown {
  font-family: var(--font-serif); font-weight: 900; font-size: clamp(110px, 24vw, 200px); line-height: 1;
  color: var(--blue); animation: chipPop 1s var(--ease-spring) infinite;
}
.live-error { color: #dc2626; font-family: var(--font-mono); font-size: 12px; min-height: 16px; margin-top: 8px; }

/* Round icon badges (instead of emoji) */
.live-icon {
  width: 84px; height: 84px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  color: #fff; background: var(--blue); box-shadow: 0 6px 0 var(--blue-dark); animation: emojiDrop 0.6s var(--ease-spring) both;
}
.live-icon svg { width: 42px; height: 42px; }
.live-icon.good { background: #16a34a; box-shadow: 0 6px 0 #0f6b30; }
.live-icon.bad { background: #dc2626; box-shadow: 0 6px 0 #991b1b; }
.live-icon.muted { background: var(--card-bg); color: var(--text-secondary); border: 1.5px solid var(--card-border); box-shadow: 0 6px 0 var(--card-border); }

/* ── Lobby ── */
.live-join-hint { font-family: var(--font-mono); font-size: 14px; color: var(--text-secondary); }
.live-join-hint strong { color: var(--text); }
.live-code-big { display: flex; gap: clamp(6px, 1.4vw, 12px); }
.live-code-big span {
  font-family: var(--font-mono); font-weight: 800; font-size: clamp(40px, 10vw, 84px); line-height: 1.15;
  background: var(--card-bg); color: var(--text); border: 1.5px solid var(--card-border); border-radius: 16px;
  padding: 2px clamp(8px, 2vw, 18px); box-shadow: 0 6px 0 var(--blue); animation: chipPop 0.5s var(--ease-spring) both;
}
.live-code-big span:nth-child(2) { animation-delay: 0.05s; } .live-code-big span:nth-child(3) { animation-delay: 0.1s; }
.live-code-big span:nth-child(4) { animation-delay: 0.15s; } .live-code-big span:nth-child(5) { animation-delay: 0.2s; }
.live-code-big span:nth-child(6) { animation-delay: 0.25s; }
.live-player-count { font-family: var(--font-mono); font-size: 14px; color: var(--text-secondary); }
.live-player-count strong { font-family: var(--font-serif); font-size: 28px; color: var(--text); margin-right: 4px; }
.live-players { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; max-width: 760px; min-height: 40px; }
.live-player-chip {
  background: var(--card-bg); border: 1.5px solid var(--card-border); border-radius: 999px; color: var(--text);
  padding: 7px 14px; font-family: var(--font-mono); font-size: 13px; font-weight: 600;
  animation: chipPop 0.4s var(--ease-spring) both;
}
.live-waiting { color: var(--text-secondary); font-family: var(--font-mono); font-size: 13px; }
.live-dots { display: flex; gap: 8px; }
.live-dots span { width: 10px; height: 10px; border-radius: 50%; background: var(--blue); animation: liveDot 1.2s ease-in-out infinite; }
.live-dots span:nth-child(2) { animation-delay: 0.2s; } .live-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes liveDot { 0%, 100% { opacity: 0.25; transform: scale(0.8); } 50% { opacity: 1; transform: scale(1.1); } }

/* ── Question ── */
.live-question { display: flex; flex-direction: column; align-items: center; gap: 18px; width: 100%; }
.live-q-label { font-family: var(--font-mono); font-size: 11px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--blue); text-align: center; }
.live-q-text {
  max-width: 760px; text-align: center; color: var(--text);
  font-family: var(--font-serif); font-size: clamp(26px, 5vw, 46px); font-weight: 800; line-height: 1.2;
  animation: modalSlideUp 0.35s var(--ease-spring);
}
.live-q-text.small { font-size: clamp(20px, 3.4vw, 28px); }
.live-question.player .live-q-text { font-size: clamp(22px, 6vw, 30px); }
.live-q-def { font-family: var(--font-body); font-style: italic; font-size: clamp(15px, 2.2vw, 19px); font-weight: 500; color: var(--text-secondary); margin-top: 10px; line-height: 1.45; }
.live-q-top { display: flex; justify-content: space-between; align-items: center; width: 100%; font-family: var(--font-mono); }
.live-timer-small {
  font-family: var(--font-mono); font-weight: 800; font-size: 16px; min-width: 44px; text-align: center;
  background: var(--blue); color: #fff; border-radius: 999px; padding: 3px 12px;
}
.live-q-meta { display: flex; justify-content: center; align-items: center; gap: 28px; }
.live-timer-ring {
  --p: 100%;
  width: 76px; height: 76px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-weight: 800; font-size: 26px; color: var(--text);
  background: radial-gradient(closest-side, var(--body-bg) 80%, transparent 82%), conic-gradient(var(--blue) var(--p), var(--card-border) 0);
}
.live-answered { display: flex; flex-direction: column; align-items: center; font-family: var(--font-mono); color: var(--text-secondary); }
.live-answered strong { font-family: var(--font-serif); font-size: 32px; color: var(--text); line-height: 1; }
.live-answered span { font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; margin-top: 4px; }

/* Answer tiles: theme cards with a lettered badge */
.live-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; width: 100%; }
.live-tile {
  position: relative; overflow: hidden; display: flex; align-items: center; gap: 14px; text-align: left;
  min-height: 80px; padding: 14px 16px; border-radius: 16px; color: var(--text);
  background: var(--card-bg); border: 1.5px solid var(--card-border); box-shadow: 0 4px 0 var(--card-border);
  font-family: var(--font-body); font-size: clamp(15px, 2.4vw, 20px); font-weight: 600; line-height: 1.3;
  transition: transform 0.12s var(--ease-out), box-shadow 0.12s, border-color 0.2s, opacity 0.3s, background 0.3s;
  animation: choiceIn 0.35s var(--ease-out) both;
}
button.live-tile { cursor: pointer; }
button.live-tile:hover { transform: translateY(-2px); border-color: var(--blue); box-shadow: 0 6px 0 var(--blue); }
button.live-tile:active { transform: translateY(4px); box-shadow: 0 0 0 var(--blue); }
.live-tile:nth-child(2) { animation-delay: 0.05s; } .live-tile:nth-child(3) { animation-delay: 0.1s; } .live-tile:nth-child(4) { animation-delay: 0.15s; }
.live-letter {
  flex-shrink: 0; width: 38px; height: 38px; border-radius: 11px; display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-size: 16px; font-weight: 800; color: #fff; background: var(--blue);
  position: relative; z-index: 1;
}
.live-tile.dim { opacity: 0.4; }
.live-tile.picked { border-color: var(--blue); box-shadow: 0 4px 0 var(--blue); }
.live-tile.right { border-color: #16a34a; background: color-mix(in srgb, #16a34a 12%, var(--card-bg)); box-shadow: 0 4px 0 #16a34a; animation: fxCorrect 0.5s var(--ease-spring); }
.live-tile.right .live-letter { background: #16a34a; }
.live-tile-text { position: relative; z-index: 1; flex: 1; }
.live-check { position: relative; z-index: 1; display: flex; color: #16a34a; }
.live-check svg { width: 24px; height: 24px; }
.live-count { position: relative; z-index: 1; font-family: var(--font-mono); font-size: 16px; font-weight: 700; color: var(--text-secondary); }
.live-bar { position: absolute; left: 0; bottom: 0; height: 5px; background: var(--blue); opacity: 0.55; transition: width 0.6s var(--ease-out); }
.live-question.player .live-tiles { grid-template-columns: 1fr; }
@media (min-width: 640px) { .live-question.player .live-tiles { grid-template-columns: 1fr 1fr; } }
@media (max-width: 520px) { .live-tile { min-height: 62px; } }

/* ── Results ── */
.live-result.right .live-get-ready { color: #16a34a; }
.live-result.wrong .live-get-ready { color: #dc2626; }
.live-points { font-family: var(--font-serif); font-weight: 900; font-size: 46px; color: var(--blue); animation: chipPop 0.5s var(--ease-spring); }
.live-streak { font-family: var(--font-mono); font-size: 12px; font-weight: 700; color: var(--blue); background: color-mix(in srgb, var(--blue) 12%, transparent); padding: 4px 12px; border-radius: 999px; }
.live-rank-big { font-family: var(--font-mono); font-size: 18px; font-weight: 700; background: var(--card-bg); border: 1.5px solid var(--card-border); padding: 8px 18px; border-radius: 999px; }
.live-top5 { width: 100%; max-width: 560px; }
.live-top5-title { font-family: var(--font-mono); font-size: 11px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-secondary); margin-bottom: 8px; text-align: center; }
.live-ranking { list-style: none; padding: 0; margin: 0 auto; width: 100%; max-width: 560px; }
.live-ranking li {
  display: flex; align-items: center; gap: 10px; padding: 9px 14px; margin-bottom: 6px; border-radius: 12px;
  background: var(--card-bg); border: 1.5px solid var(--card-border); font-family: var(--font-mono); animation: fadeUp 0.35s var(--ease-out) both;
}
.live-ranking li.me { border-color: var(--blue); }
.live-rank { width: 26px; font-weight: 800; color: var(--text-secondary); }
.live-rank-name { flex: 1; font-weight: 600; text-align: left; }
.live-rank-score { font-weight: 800; color: var(--blue); }

/* ── Podium ── */
.live-podium { display: flex; align-items: flex-end; justify-content: center; gap: 10px; margin: 10px 0 6px; width: 100%; max-width: 560px; }
.live-podium-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; animation: podiumUp 0.7s var(--ease-spring) both; }
.live-podium-name { font-family: var(--font-serif); font-weight: 800; font-size: 17px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.live-podium-score { font-family: var(--font-mono); font-size: 13px; color: var(--text-secondary); }
.live-podium-block {
  width: 100%; display: flex; align-items: flex-start; justify-content: center; padding-top: 10px;
  font-family: var(--font-serif); font-size: 40px; font-weight: 900; color: #fff;
  border-radius: 14px 14px 0 0; background: color-mix(in srgb, var(--blue) 55%, var(--card-bg));
}
.place-1 .live-podium-block { height: 150px; background: var(--blue); }
.place-2 .live-podium-block { height: 110px; }
.place-3 .live-podium-block { height: 80px; background: color-mix(in srgb, var(--blue) 35%, var(--card-bg)); }
@keyframes podiumUp { from { transform: translateY(60px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ── Setup + join ── */
.live-settings { display: flex; gap: 14px; justify-content: center; margin: 4px 0 16px; font-family: var(--font-mono); font-size: 12px; color: var(--text-secondary); }
.live-settings label { display: flex; flex-direction: column; gap: 6px; align-items: center; }
.live-join { display: flex; flex-direction: column; gap: 10px; padding: 8px 0; }
.live-join .name-input { width: 100%; }
.live-code-input { font-family: var(--font-mono); font-size: 26px !important; letter-spacing: 8px; text-align: center; font-weight: 700; }
.live-center .next-btn, .live-center .leaderboard-btn { width: auto; }

/* ── Host controls: skip / end ── */
.live-controls { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; margin-top: 22px; }
.live-ctrl {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px;
  padding: 0 18px; border-radius: 999px; font-family: var(--font-mono); font-size: 12px; font-weight: 700;
  color: var(--text); background: var(--card-bg); border: 1.5px solid var(--card-border); cursor: pointer;
  box-shadow: 0 3px 0 var(--card-border); transition: transform 0.12s var(--ease-spring), border-color 0.15s, box-shadow 0.12s;
}
.live-ctrl svg { width: 14px; height: 14px; }
.live-ctrl:hover { border-color: var(--blue); transform: translateY(-1px); }
.live-ctrl:active { transform: translateY(3px); box-shadow: 0 0 0 var(--card-border); }
.live-ctrl.danger { color: #dc2626; }
.live-ctrl.danger:hover { border-color: #dc2626; }

/* A false statement's correct answer (Custom List question sets), shown with the answer */
.live-note {
  display: flex; align-items: flex-start; gap: 10px; max-width: 640px; width: 100%; box-sizing: border-box;
  margin: 12px auto 0; padding: 12px 14px; border-radius: 14px; text-align: left; font-size: 16px; line-height: 1.45;
  background: rgba(22, 163, 74, 0.12); border: 1px solid rgba(22, 163, 74, 0.35); color: var(--text);
}
.live-note .ico { width: 20px; height: 20px; flex: none; color: #16a34a; margin-top: 2px; }
.live-note strong { color: #16a34a; }
