/* ============================================================
   DigitalKiddo™ Maths — 🏆 Live Challenge styles
   ============================================================
   Builds on the global design system (style.css tokens: --primary,
   --surface, --radius, .card, .btn …). Only Live-specific pieces
   live here. Dark mode works automatically through the themeable
   surface tokens remapped by dark-mode.css.
   ============================================================ */

/* ---- shared page bits -------------------------------------- */
.live-hero {
  background: linear-gradient(135deg, var(--primary) 0%, #8b85ff 60%, var(--teal) 100%);
  border-radius: var(--radius-lg);
  color: #fff;
  padding: 2.25rem 2rem;
  text-align: center;
  margin-bottom: 2rem;
  box-shadow: var(--shadow);
}
.live-hero h1 { color: #fff; font-size: clamp(1.8rem, 4vw, 2.6rem); margin-bottom: 0.4rem; }
.live-hero p  { color: rgba(255,255,255,0.92); font-size: 1.05rem; max-width: 52ch; margin: 0 auto; }

.live-fade { animation: liveFade 0.4s ease; }
@keyframes liveFade { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ---- home: two big mode cards ------------------------------ */
.live-mode-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}
.live-mode-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 2rem 1.75rem;
  text-align: center;
  border: 3px solid transparent;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
}
.live-mode-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.live-mode-card.create { border-color: rgba(108,99,255,0.25); }
.live-mode-card.join   { border-color: rgba(38,222,129,0.3); }
.live-mode-emoji { font-size: 3.4rem; line-height: 1; }
.live-mode-card h3 { margin-bottom: 0.15rem; }
.live-mode-card ul { color: var(--gray-600); font-size: 0.95rem; line-height: 1.9; }
.live-mode-card .btn { margin-top: 0.75rem; }

/* ---- join form --------------------------------------------- */
.live-join-form { display: flex; flex-direction: column; gap: 0.75rem; width: 100%; max-width: 300px; }
.live-input {
  width: 100%;
  border: 2.5px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  font-size: 1.15rem;
  font-weight: 800;
  text-align: center;
  background: var(--surface-2);
  color: var(--dark);
  transition: var(--transition);
}
.live-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px rgba(108,99,255,0.15); }
.live-input.pin { letter-spacing: 0.35em; font-family: 'Fredoka One', cursive; font-size: 1.5rem; }
.live-child-chips { display: flex; flex-wrap: wrap; gap: 0.4rem; justify-content: center; }
.live-child-chip {
  border: 2px solid var(--gray-200);
  background: var(--surface);
  color: var(--dark);
  border-radius: 50px;
  padding: 0.3rem 0.9rem;
  font-weight: 800;
  font-size: 0.85rem;
  transition: var(--transition);
}
.live-child-chip:hover, .live-child-chip.active { border-color: var(--primary); background: rgba(108,99,255,0.12); }

/* ---- host setup -------------------------------------------- */
.live-opt-group { margin-bottom: 1.6rem; }
.live-opt-label { font-weight: 900; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--gray-600); margin-bottom: 0.6rem; display: block; }
.live-opt-row { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.live-opt {
  border: 2.5px solid var(--gray-200);
  background: var(--surface);
  color: var(--dark);
  border-radius: var(--radius);
  padding: 0.6rem 1.1rem;
  font-weight: 800;
  font-size: 0.95rem;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  transition: var(--transition);
}
.live-opt:hover { border-color: var(--primary); transform: translateY(-2px); }
.live-opt.active {
  border-color: var(--primary);
  background: linear-gradient(135deg, var(--primary), #8b85ff);
  color: #fff;
  box-shadow: 0 6px 18px rgba(108,99,255,0.35);
}
.live-topic-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 0.6rem; }
.live-topic-grid .live-opt { justify-content: center; padding: 0.8rem 0.5rem; }

/* ---- PIN display (lobby) ------------------------------------ */
.live-pin-box {
  background: linear-gradient(135deg, var(--primary), #8b85ff);
  border-radius: var(--radius-lg);
  color: #fff;
  text-align: center;
  padding: 1.6rem 1rem 1.9rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow);
}
.live-pin-box .lbl { font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; font-size: 0.8rem; opacity: 0.85; }
.live-pin-digits {
  font-family: 'Fredoka One', cursive;
  font-size: clamp(2.6rem, 9vw, 4.2rem);
  letter-spacing: 0.18em;
  line-height: 1.15;
}
.live-pin-hint { font-size: 0.9rem; opacity: 0.9; }

/* ---- lobby player chips ------------------------------------ */
.live-players { display: flex; flex-wrap: wrap; gap: 0.6rem; justify-content: center; min-height: 56px; }
.live-player-chip {
  background: var(--surface);
  border: 2px solid var(--gray-100);
  border-radius: 50px;
  padding: 0.45rem 1.1rem 0.45rem 0.6rem;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  box-shadow: var(--shadow-sm);
  animation: livePop 0.35s ease;
  color: var(--dark);
}
.live-player-chip .em { font-size: 1.25rem; }
@keyframes livePop { 0% { transform: scale(0.6); opacity: 0; } 70% { transform: scale(1.08); } 100% { transform: scale(1); opacity: 1; } }
.live-waiting-dots::after { content: '…'; animation: liveDots 1.4s steps(4) infinite; }
@keyframes liveDots { 0% { content: ''; } 25% { content: '.'; } 50% { content: '..'; } 75% { content: '...'; } }

/* ---- gameplay ----------------------------------------------- */
.live-game-wrap { max-width: 760px; margin: 0 auto; }
.live-hud { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; margin-bottom: 0.8rem; flex-wrap: wrap; }
.live-hud-pill {
  background: var(--surface);
  border-radius: 50px;
  box-shadow: var(--shadow-sm);
  padding: 0.45rem 1rem;
  font-family: 'Fredoka One', cursive;
  font-size: 0.95rem;
  color: var(--dark);
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  white-space: nowrap;
}
.live-hud-pill .lbl { font-family: 'Nunito', sans-serif; font-weight: 800; font-size: 0.68rem; letter-spacing: 0.05em; text-transform: uppercase; color: var(--gray-600); }

.live-timer-bar { background: var(--gray-100); border-radius: 50px; height: 14px; overflow: hidden; margin-bottom: 1.1rem; }
.live-timer-fill { height: 100%; width: 100%; border-radius: 50px; background: linear-gradient(90deg, var(--green), var(--accent)); transition: width 0.2s linear; }
.live-timer-fill.low { background: linear-gradient(90deg, var(--orange), var(--secondary)); }

.live-question-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 2.2rem 1.5rem;
  text-align: center;
  margin-bottom: 1.25rem;
  min-height: 130px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.live-question-text {
  font-family: 'Fredoka One', cursive;
  color: var(--dark);
  font-size: clamp(1.4rem, 4.5vw, 2.3rem);
  line-height: 1.3;
}

/* Four colourful, thumb-sized answer buttons */
.live-answers { display: grid; grid-template-columns: 1fr 1fr; gap: 0.9rem; }
.live-ans {
  border: none;
  border-radius: var(--radius);
  padding: 1.35rem 0.9rem;
  font-family: 'Fredoka One', cursive;
  font-size: clamp(1.05rem, 3vw, 1.5rem);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 78px;
  cursor: pointer;
  box-shadow: 0 8px 22px rgba(45,52,54,0.18);
  transition: transform 0.12s, box-shadow 0.15s, filter 0.15s, opacity 0.2s;
  touch-action: manipulation;
  text-align: center;
  line-height: 1.25;
  word-break: break-word;
}
.live-ans:hover:not(:disabled) { transform: translateY(-3px); }
.live-ans:active { transform: translateY(0); }
.live-ans:disabled { cursor: default; }
.live-ans .shape { font-size: 1.1rem; flex-shrink: 0; }
.live-ans-0 { background: linear-gradient(135deg, var(--secondary), #ff8e8e); }
.live-ans-1 { background: linear-gradient(135deg, var(--primary), #8b85ff); }
.live-ans-2 { background: linear-gradient(135deg, #1fc76b, var(--green)); }
.live-ans-3 { background: linear-gradient(135deg, var(--orange), #ffb443); }
.live-ans.picked { outline: 4px solid var(--accent); animation: livePop 0.3s ease; }
.live-ans.dim { opacity: 0.35; filter: grayscale(45%); }
.live-ans.correct { outline: 4px solid #fff; box-shadow: 0 0 0 6px rgba(38,222,129,0.55), 0 8px 22px rgba(45,52,54,0.18); animation: livePop 0.4s ease; }
.live-ans.wrong-pick { animation: liveShake 0.4s ease; }
@keyframes liveShake { 0%,100% { transform: translateX(0); } 20% { transform: translateX(-6px); } 40% { transform: translateX(6px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(4px); } }

/* Waiting overlay after a player answers */
.live-waiting-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  text-align: center;
  padding: 2rem 1.5rem;
  color: var(--gray-600);
  font-weight: 800;
}
.live-waiting-card .em { font-size: 2.6rem; display: block; margin-bottom: 0.4rem; animation: liveBounce 1.2s ease infinite; }
@keyframes liveBounce { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }

/* Score popup */
.live-score-pop {
  position: fixed;
  left: 50%; top: 38%;
  transform: translate(-50%, -50%);
  font-family: 'Fredoka One', cursive;
  font-size: clamp(2rem, 7vw, 3.2rem);
  color: var(--green);
  text-shadow: 0 4px 14px rgba(38,222,129,0.4);
  pointer-events: none;
  z-index: 3000;
  animation: liveScorePop 1.2s ease forwards;
}
@keyframes liveScorePop {
  0%   { opacity: 0; transform: translate(-50%, -30%) scale(0.6); }
  25%  { opacity: 1; transform: translate(-50%, -50%) scale(1.15); }
  60%  { opacity: 1; transform: translate(-50%, -60%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -95%) scale(0.95); }
}

/* ---- reveal / leaderboard ----------------------------------- */
.live-celebrate { text-align: center; font-family: 'Fredoka One', cursive; font-size: 1.5rem; color: var(--primary); margin-bottom: 0.9rem; }
.live-board { display: flex; flex-direction: column; gap: 0.55rem; }
.live-board-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 0.6rem 1rem;
  font-weight: 800;
  color: var(--dark);
  animation: liveFade 0.35s ease;
}
.live-board-row.me { border: 2.5px solid var(--primary); background: rgba(108,99,255,0.08); }
.live-board-rank { font-family: 'Fredoka One', cursive; width: 2.1rem; text-align: center; color: var(--primary); flex-shrink: 0; }
.live-board-name { flex: 1; display: flex; align-items: center; gap: 0.45rem; min-width: 0; }
.live-board-name span.nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.live-board-score { font-family: 'Fredoka One', cursive; color: var(--dark); }

/* ---- results podium ----------------------------------------- */
.live-podium { display: flex; align-items: flex-end; justify-content: center; gap: 0.9rem; margin: 1.5rem 0 2rem; }
.live-podium-col { text-align: center; flex: 1; max-width: 170px; }
.live-podium-avatar { font-size: 2.6rem; line-height: 1; }
.live-podium-name { font-weight: 900; margin: 0.25rem 0 0.1rem; color: var(--dark); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.live-podium-score { font-family: 'Fredoka One', cursive; color: var(--primary); font-size: 1.05rem; margin-bottom: 0.5rem; }
.live-podium-block {
  border-radius: var(--radius) var(--radius) 0 0;
  color: #fff;
  font-size: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: livePodiumGrow 0.7s ease both;
  transform-origin: bottom;
}
.live-podium-col.p1 .live-podium-block { height: 130px; background: linear-gradient(135deg, var(--accent), var(--orange)); animation-delay: 0.5s; }
.live-podium-col.p2 .live-podium-block { height: 95px;  background: linear-gradient(135deg, #b2bec3, #dfe6e9); animation-delay: 0.3s; }
.live-podium-col.p3 .live-podium-block { height: 70px;  background: linear-gradient(135deg, #e17055, #fab1a0); animation-delay: 0.1s; }
@keyframes livePodiumGrow { from { transform: scaleY(0); } to { transform: scaleY(1); } }

.live-stat-row { display: flex; justify-content: center; gap: 1.4rem; flex-wrap: wrap; margin: 0.5rem 0 1.2rem; }
.live-stat { min-width: 108px; text-align: center; }
.live-stat .num { font-family: 'Fredoka One', cursive; font-size: 1.7rem; color: var(--primary); line-height: 1.15; }
.live-stat .cap { font-size: 0.74rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.05em; color: var(--gray-600); margin-top: 0.2rem; }

/* ---- host monitor ------------------------------------------- */
.live-host-meta { display: flex; align-items: center; justify-content: center; gap: 1rem; flex-wrap: wrap; color: var(--gray-600); font-weight: 800; margin-bottom: 1rem; }
.live-answered-count { font-family: 'Fredoka One', cursive; color: var(--primary); }

/* mute toggle */
.live-mute-btn {
  position: fixed;
  right: 1.1rem; bottom: 1.1rem;
  z-index: 2000;
  background: var(--surface);
  border-radius: 50%;
  width: 52px; height: 52px;
  font-size: 1.4rem;
  box-shadow: var(--shadow);
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--gray-100);
  transition: var(--transition);
}
.live-mute-btn:hover { transform: scale(1.08); }

/* floating language toggle — for the full-width pages that hide
   the sidebar (game / results / leaderboard); mirrors the shared
   .lang-toggle so I18n wires it up automatically */
.live-lang-float {
  position: fixed;
  left: 1.1rem; bottom: 1.1rem;
  z-index: 2000;
  box-shadow: var(--shadow);
}

/* recent games */
.live-recent-row { display: flex; align-items: center; justify-content: space-between; gap: 0.8rem; padding: 0.7rem 0.4rem; border-bottom: 1.5px solid var(--gray-100); font-weight: 700; color: var(--dark); flex-wrap: wrap; }
.live-recent-row:last-child { border-bottom: none; }
.live-recent-meta { color: var(--gray-600); font-size: 0.85rem; font-weight: 700; }

/* ---- responsive --------------------------------------------- */
@media (max-width: 640px) {
  .live-hero { padding: 1.6rem 1.2rem; }
  .live-answers { gap: 0.6rem; }
  .live-ans { min-height: 68px; padding: 1rem 0.7rem; }
  .live-question-card { padding: 1.5rem 1rem; }
  .live-podium { gap: 0.5rem; }
  .live-hud-pill { padding: 0.35rem 0.75rem; font-size: 0.85rem; }
}
