/* ── Player shell ───────────────────────────────────────── */
#app.view-player { height: 100vh; overflow: hidden; }

#player-container {
  width: 100%; height: 100vh;
  display: grid; grid-template-rows: auto 1fr auto;
}

#player-stage {
  display: flex; overflow: hidden;
  min-height: 0; position: relative;
}

#hud {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.65rem 2rem;
  background: rgba(0,0,0,0.35); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--bs-border-color);
  min-height: 60px; z-index: 10;
  position: relative;
}

/* ── Progress bar ───────────────────────────────────────── */
.hud-progress {
  position: absolute; bottom: 0; left: 0; right: 0; height: 3px;
  background: rgba(255,255,255,0.07);
}
.hud-progress-fill {
  height: 100%; width: 0%;
  background: var(--bs-primary);
  border-radius: 0 2px 2px 0;
  transition: width 350ms ease;
}

#controls {
  display: flex; align-items: center; justify-content: center; gap: 1.5rem;
  padding: 0.65rem 2rem;
  background: rgba(0,0,0,0.45); backdrop-filter: blur(12px);
  border-top: 1px solid var(--bs-border-color);
  min-height: 60px; z-index: 10;
}

#main-area {
  flex: 1;
  display: flex; align-items: center; justify-content: center;
  padding: 2.5rem; overflow: hidden; position: relative;
  min-width: 0;
}

.review-mode--list #main-area {
  align-items: flex-start; overflow-y: auto; padding: 0;
}

#review-panel { display: none; }
#review-panel.active {
  display: flex; width: 280px; min-width: 240px;
  overflow-y: auto; border-left: 1px solid var(--bs-border-color);
  background: rgba(0,0,0,0.28);
}

/* ── HUD internals ──────────────────────────────────────── */
.hud-left   { flex: 1; display: flex; align-items: center; gap: 0.75rem; overflow: hidden; }
.hud-center { flex: 1; display: flex; justify-content: center; }
.hud-right  { flex: 1; display: flex; justify-content: flex-end; align-items: center; }

.hud-title {
  font-size: var(--ep-base); font-weight: 600;
  color: rgba(255,255,255,0.55);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.hud-timer {
  display: flex; align-items: center; gap: 0.5rem;
  font-size: var(--ep-xl); font-weight: 700; font-variant-numeric: tabular-nums;
}
.hud-timer.timer-warning { color: var(--ep-wrong); animation: timerPulse 1s infinite; }
@keyframes timerPulse { 0%,100% { opacity:1 } 50% { opacity:0.45 } }

.hud-score { display: flex; flex-direction: column; align-items: flex-end; }
.score-value { font-size: var(--ep-xl); font-weight: 700; font-variant-numeric: tabular-nums; }
.score-pct   { font-size: var(--ep-sm); color: rgba(255,255,255,0.45); font-variant-numeric: tabular-nums; }
.score-value.score-bump { animation: scoreBump 300ms ease; }
/* Team score layout */
.hud-score--team { justify-content: flex-end; }
.score-rounds    { font-size: var(--ep-xl); font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: .03em; }
.score-rounds.score-bump { animation: scoreBump 300ms ease; }
/* Round badge inside activity */
.round-badge {
  text-align: center; font-size: .8rem; font-weight: 700; letter-spacing: .05em;
  color: rgba(255,255,255,0.5); padding-bottom: .25rem;
  text-transform: uppercase;
}
@keyframes scoreBump {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.35); color: var(--ep-correct); }
  100% { transform: scale(1); }
}

/* ── Teacher control buttons ────────────────────────────── */
.ctrl-btn {
  display: flex; align-items: center; justify-content: center;
  width: 54px; height: 54px; border-radius: 50%;
  font-size: 1.4rem; background: rgba(255,255,255,0.07);
  color: #fff; border: 1px solid rgba(255,255,255,0.1); cursor: pointer;
  transition: background 150ms ease, transform 150ms ease;
}
.ctrl-btn:hover  { background: rgba(255,255,255,0.14); transform: scale(1.06); }
.ctrl-btn:active { transform: scale(0.94); }

.ctrl-btn.ctrl-primary {
  background: var(--bs-primary); border-color: transparent;
  width: 66px; height: 66px; font-size: 1.8rem;
}
.ctrl-btn.ctrl-primary:hover { filter: brightness(0.9); }

.ctrl-btn--wide {
  width: auto; height: 48px; border-radius: 24px;
  padding: 0 1.5rem; font-size: 1rem;
}
.ctrl-btn--wide.ctrl-primary { width: auto; height: 48px; font-size: 1rem; }

#player-container.fs-mode #controls { display: none; }
.hud-fs-btn { width: 38px; height: 38px; font-size: 1.1rem; flex-shrink: 0; }

/* ── Start screen ───────────────────────────────────────── */
.start-screen {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
}
.start-title    { font-size: var(--ep-xxl); font-weight: 800; }
.start-subtitle { font-size: var(--ep-lg);  color: rgba(255,255,255,0.6); }
.start-meta     { font-size: var(--ep-base); color: rgba(255,255,255,0.5); }

/* ── End screen ─────────────────────────────────────────── */
.end-screen {
  width: 100%; height: 100%; position: relative;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.end-card {
  position: relative; z-index: 1;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 24px; padding: 2.25rem 2.75rem;
  max-width: 480px; width: 90%; text-align: center;
  box-shadow: 0 28px 64px rgba(0,0,0,0.45);
  display: flex; flex-direction: column; align-items: center; gap: 1rem;
}
.end-title { font-size: var(--ep-xl); font-weight: 800; margin: 0; }
.end-score-ring {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  width: 128px; height: 128px; border-radius: 50%;
  border: 4px solid var(--ep-correct);
  background: rgba(255,255,255,0.04);
}
.end-score-pct   { font-size: var(--ep-xxl); font-weight: 800; line-height: 1; }
.end-score-label { font-size: var(--ep-sm); color: rgba(255,255,255,0.45); }
.end-stats { display: flex; gap: 2.5rem; }
.end-stat  { display: flex; flex-direction: column; align-items: center; gap: 0.15rem; }
.stat-value { font-size: var(--ep-lg); font-weight: 700; }
.stat-label { font-size: var(--ep-sm); color: rgba(255,255,255,0.4); }
.end-override-note { font-size: var(--ep-sm); color: rgba(255,255,255,0.5); margin: 0; }
.end-override-diff { font-weight: 700; margin-left: 0.3em; }

.end-replay-btn {
  background: var(--bs-primary); color: #fff; border: none; cursor: pointer;
  padding: 0.8rem 2.5rem; border-radius: 50px;
  font-size: var(--ep-base); font-weight: 700;
  transition: transform 150ms ease, filter 150ms ease;
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}
.end-replay-btn:hover  { filter: brightness(1.1); transform: scale(1.04); }
.end-replay-btn:active { transform: scale(0.97); }

/* ── Confetti ───────────────────────────────────────────── */
.confetti-wrap {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%;
  overflow: hidden; pointer-events: none; z-index: 0;
}
.confetti-piece {
  position: absolute; top: -24px; border-radius: 2px;
  animation: confettiFall linear forwards;
}
@keyframes confettiFall {
  0%   { transform: translateY(0) rotate(0deg);    opacity: 1; }
  100% { transform: translateY(110vh) rotate(720deg); opacity: 0.2; }
}

/* ── Portrait / mobile layout ───────────────────────────── */
@media (orientation: portrait), (max-width: 680px) {
  #player-stage { flex-direction: column; }

  #review-panel.active {
    width: 100%; min-width: unset;
    height: 38vh; min-height: 180px;
    border-left: none;
    border-top: 1px solid var(--bs-border-color);
  }

  #hud, #controls { padding: 0.5rem 1rem; min-height: 48px; }

  /* Remove side padding — spacers are hidden so the text wrapper
     can use the full screen width */
  #main-area { padding: 0.5rem 0; }
  .corr-screen { padding-left: 0.5rem; padding-right: 0.5rem; }

  /* Horizontal spacers used to balance the lateral review panel
     are irrelevant in column layout — hide them via CSS */
  .tc-spacer { display: none !important; }
}
