/* ==========================================================================
   Gas Plant Comparison Arena — Player UI Styles (Mobile-First Kahoot UX)
   Works seamlessly from 390px mobile to 1280px+ desktop
   ========================================================================== */

.player-body {
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  padding-bottom: 32px;
}

#confettiCanvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 95;
}

/* ==========================================================================
   TOP COMPACT KAHOOT HUD
   ========================================================================== */
.player-hud {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 16px;
  background: rgba(20, 11, 52, 0.82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 6px 24px rgba(10, 4, 30, 0.35);
}

.hud-left,
.hud-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.hud-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-bolt {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 1.25rem;
  background: linear-gradient(135deg, #ffbe0b, #fb5607);
  box-shadow: 0 4px 0 #b83b00, 0 6px 16px rgba(251, 86, 7, 0.35);
  flex-shrink: 0;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.brand-name {
  font-family: "Fredoka", system-ui, sans-serif;
  font-weight: 700;
  font-size: 1.05rem;
  color: #ffffff;
  letter-spacing: 0.2px;
}

.brand-session {
  font-size: 0.72rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.72);
  max-width: 220px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hud-center {
  display: flex;
  align-items: center;
}

.hud-center[hidden] {
  display: none !important;
}

.player-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.24);
  color: #ffffff;
}

.pill-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 1.1rem;
  background: rgba(255, 255, 255, 0.2);
}

.pill-identity {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.pill-name {
  font-weight: 800;
  font-size: 0.85rem;
  max-width: 110px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pill-rank {
  font-size: 0.7rem;
  font-weight: 700;
  color: #ffd166;
}

.pill-metrics {
  display: flex;
  align-items: center;
  gap: 6px;
  padding-left: 8px;
  border-left: 1px solid rgba(255, 255, 255, 0.2);
}

.pill-score {
  font-family: "Fredoka", system-ui, sans-serif;
  font-weight: 700;
  font-size: 0.92rem;
  color: #7bf1a8;
}

.pill-streak {
  font-size: 0.76rem;
  font-weight: 800;
  background: rgba(255, 190, 11, 0.2);
  color: #ffe082;
  padding: 2px 7px;
  border-radius: 999px;
}

.hud-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.hud-icon-btn,
.hud-btn-manual,
.hud-host-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  height: 36px;
  padding: 0 10px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  font-size: 0.82rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.12s ease, background-color 0.15s ease;
}

.hud-icon-btn {
  width: 36px;
  padding: 0;
  font-size: 1rem;
}

.hud-icon-btn.is-off {
  opacity: 0.52;
  background: rgba(226, 27, 60, 0.25);
  border-color: rgba(226, 27, 60, 0.45);
}

.hud-btn-manual {
  background: rgba(255, 190, 11, 0.22);
  border-color: rgba(255, 190, 11, 0.5);
  color: #ffe699;
}

.hud-host-link {
  opacity: 0.85;
  font-size: 0.78rem;
}

.hud-icon-btn:hover,
.hud-btn-manual:hover,
.hud-host-link:hover {
  background: rgba(255, 255, 255, 0.22);
  transform: translateY(-1px);
}

.volume-wrap {
  position: relative;
}

.volume-popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 190px;
  padding: 12px;
  border-radius: 14px;
  background: rgba(22, 12, 58, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.22);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
  z-index: 60;
  color: #ffffff;
}

.volume-popover[hidden] {
  display: none !important;
}

.volume-popover label {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.volume-popover input[type="range"] {
  width: 100%;
  accent-color: #ffbe0b;
  cursor: pointer;
}

.sync-sep {
  opacity: 0.55;
}

/* ==========================================================================
   MAIN LAYOUT: GAME STAGE + MINI LEADERBOARD
   ========================================================================== */
.player-shell {
  position: relative;
  z-index: 5;
  max-width: 1220px;
  margin: 0 auto;
  padding: 16px 14px 28px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.player-shell.has-leaderboard {
  grid-template-columns: minmax(0, 1fr) 300px;
}

.game-stage {
  min-width: 0;
}

.stage-loading {
  text-align: center;
  padding: 48px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  color: #1e1b4b;
}

.spinner-ring {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 5px solid #e2e8f0;
  border-top-color: #46178f;
  animation: spinRing 0.85s linear infinite;
}

@keyframes spinRing {
  to { transform: rotate(360deg); }
}

/* ==========================================================================
   MINI LEADERBOARD PANEL
   ========================================================================== */
.mini-lb-panel {
  border-radius: 20px;
  overflow: hidden;
  color: #ffffff;
  background: rgba(24, 12, 62, 0.74);
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 12px 32px rgba(10, 4, 30, 0.35);
}

.mini-lb-panel[hidden] {
  display: none !important;
}

.mini-lb-toggle {
  width: 100%;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  font-family: "Fredoka", system-ui, sans-serif;
  font-weight: 700;
  font-size: 0.96rem;
  border: none;
  cursor: pointer;
}

.mini-lb-meta {
  font-family: "Plus Jakarta Sans", system-ui, sans-serif;
  font-size: 0.74rem;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.14);
  padding: 2px 8px;
  border-radius: 999px;
}

.mini-lb-caret {
  transition: transform 0.2s ease;
}

.mini-lb-toggle[aria-expanded="false"] .mini-lb-caret {
  transform: rotate(-90deg);
}

.mini-lb-body[hidden] {
  display: none !important;
}

.mini-lb-list {
  list-style: none;
  padding: 10px 12px 14px;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 7px;
  max-height: 460px;
  overflow-y: auto;
}

.mini-lb-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.08);
  font-size: 0.84rem;
  transition: transform 0.15s ease;
}

.mini-lb-row.is-me {
  background: rgba(255, 190, 11, 0.24);
  border: 1px solid rgba(255, 209, 102, 0.7);
}

.mini-lb-left {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.mini-lb-pos {
  font-weight: 800;
  width: 24px;
  text-align: center;
  flex-shrink: 0;
}

.mini-lb-name {
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mini-lb-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1.1;
  flex-shrink: 0;
}

.mini-lb-score {
  font-family: "Fredoka", system-ui, sans-serif;
  font-weight: 700;
  color: #7bf1a8;
}

.mini-lb-sub {
  font-size: 0.68rem;
  color: rgba(255, 255, 255, 0.68);
}

/* ==========================================================================
   VIEW 1: JOIN SCREEN
   ========================================================================== */
.join-shell {
  max-width: 560px;
  margin: 12px auto 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.join-card {
  padding: 26px 24px;
  border-radius: 24px;
  color: #18143c;
  animation: popIn 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.join-header {
  text-align: center;
  margin-bottom: 20px;
}

.mode-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.3px;
  margin-bottom: 10px;
}

.mode-pill.is-race {
  background: #e0f2fe;
  color: #0369a1;
}

.mode-pill.is-kahoot {
  background: #f3e8ff;
  color: #6b21a8;
}

.join-header h1 {
  font-family: "Fredoka", system-ui, sans-serif;
  font-size: 1.75rem;
  font-weight: 700;
  color: #1d1145;
  margin-bottom: 4px;
}

.join-header p {
  font-size: 0.92rem;
  color: #4b5563;
}

.join-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-field label {
  display: block;
  font-weight: 800;
  font-size: 0.84rem;
  color: #2d225a;
  margin-bottom: 6px;
}

.kahoot-input {
  width: 100%;
  padding: 13px 16px;
  border-radius: 14px;
  border: 2px solid #d8d4ec;
  background: #f8f7fd;
  font-size: 1.02rem;
  font-weight: 700;
  color: #18143c;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.kahoot-input:focus {
  outline: none;
  border-color: #46178f;
  background: #ffffff;
  box-shadow: 0 0 0 4px rgba(70, 23, 143, 0.14);
}

.pin-input {
  font-family: "Fredoka", system-ui, sans-serif;
  font-size: 1.35rem;
  letter-spacing: 6px;
  text-align: center;
}

.avatar-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
}

.avatar-option {
  height: 48px;
  border-radius: 14px;
  border: 2px solid #e4e1f5;
  background: #f7f6fc;
  font-size: 1.55rem;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: transform 0.12s ease, border-color 0.12s ease, background-color 0.12s ease;
}

.avatar-option:hover {
  transform: translateY(-2px);
  border-color: #864cbf;
}

.avatar-option.selected {
  background: #ede9fe;
  border-color: #46178f;
  box-shadow: 0 0 0 3px rgba(70, 23, 143, 0.22);
  transform: scale(1.06);
}

.join-error {
  background: #fee2e2;
  color: #b91c1c;
  border: 1px solid #fca5a5;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 0.86rem;
  font-weight: 700;
}

.join-submit-btn {
  width: 100%;
  padding: 15px 20px;
  font-size: 1.1rem;
  font-family: "Fredoka", system-ui, sans-serif;
  letter-spacing: 0.3px;
}

.room-roster-card {
  padding: 14px 16px;
  border-radius: 18px;
  color: #ffffff;
}

.roster-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  font-size: 0.85rem;
  font-weight: 700;
}

.roster-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.roster-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.2);
  font-size: 0.82rem;
  font-weight: 700;
  animation: popIn 0.25s ease;
}

/* ==========================================================================
   VIEW 2: WAITING LOBBY
   ========================================================================== */
.lobby-card {
  max-width: 720px;
  margin: 10px auto 0;
  padding: 28px 24px;
  border-radius: 24px;
  text-align: center;
  color: #18143c;
  animation: popIn 0.3s ease;
}

.lobby-me-badge {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  border-radius: 999px;
  background: #ede9fe;
  border: 2px solid #864cbf;
  font-weight: 800;
  font-size: 1.05rem;
  margin-bottom: 14px;
}

.lobby-pulse-ring {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 999px;
  background: #ecfdf5;
  color: #047857;
  font-weight: 800;
  font-size: 0.86rem;
  margin: 12px 0 18px;
}

.lobby-players-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin: 16px 0 22px;
}

.lobby-player-tile {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 14px;
  background: #f5f3ff;
  border: 2px solid #ddd6fe;
  font-weight: 800;
  color: #2e1065;
  animation: popIn 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

.lobby-player-tile.is-me {
  background: #fef3c7;
  border-color: #f59e0b;
}

/* ==========================================================================
   VIEW 4: COUNTDOWN (3 - 2 - 1 - ¡YA!)
   ========================================================================== */
.countdown-stage {
  min-height: 400px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: #ffffff;
  padding: 32px 16px;
}

.countdown-label {
  font-family: "Fredoka", system-ui, sans-serif;
  font-size: 1.25rem;
  font-weight: 700;
  color: #ffd166;
  margin-bottom: 14px;
}

.countdown-number {
  width: 164px;
  height: 164px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-family: "Fredoka", system-ui, sans-serif;
  font-size: 5rem;
  font-weight: 700;
  background: radial-gradient(circle at 30% 30%, #ffbe0b, #fb5607);
  color: #ffffff;
  box-shadow: 0 12px 0 #b83b00, 0 20px 50px rgba(251, 86, 7, 0.5);
  animation: countdownPop 0.55s cubic-bezier(0.22, 1, 0.36, 1);
}

.countdown-sub {
  margin-top: 18px;
  font-size: 0.96rem;
  color: rgba(255, 255, 255, 0.85);
}

/* ==========================================================================
   VIEW 5: ACTIVE QUESTION STAGE
   ========================================================================== */
.question-shell {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.question-topbar {
  padding: 12px 16px;
  border-radius: 18px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: #ffffff;
}

.phase-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.phase-pill {
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 800;
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.14);
}

.phase-pill.active {
  background: #ffbe0b;
  color: #1d1145;
  border-color: #ffd166;
  box-shadow: 0 4px 12px rgba(255, 190, 11, 0.35);
}

.phase-pill.done {
  background: rgba(16, 217, 126, 0.2);
  color: #7bf1a8;
  border-color: rgba(16, 217, 126, 0.45);
}

.round-counter-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.round-badge {
  font-family: "Fredoka", system-ui, sans-serif;
  font-weight: 700;
  font-size: 0.92rem;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
}

/* Circular SVG Timer */
.svg-timer {
  position: relative;
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.svg-timer svg {
  width: 56px;
  height: 56px;
  transform: rotate(-90deg);
}

.svg-timer circle {
  fill: none;
  stroke-width: 5;
}

.svg-timer .timer-track {
  stroke: rgba(255, 255, 255, 0.18);
}

.svg-timer .timer-arc {
  stroke: #38bdf8;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.1s linear, stroke 0.2s ease;
}

.svg-timer.is-urgent .timer-arc {
  stroke: #ff4757;
}

.svg-timer.is-urgent .timer-num {
  color: #ff6b81;
  animation: pulseGlow 0.6s infinite alternate;
}

.timer-num {
  position: absolute;
  font-family: "Fredoka", system-ui, sans-serif;
  font-weight: 700;
  font-size: 1rem;
  color: #ffffff;
}

/* Linear progress bar */
.linear-timer-bar {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  overflow: hidden;
}

.linear-timer-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #10d97e, #38bdf8);
  transition: width 0.12s linear, background 0.2s ease;
}

.linear-timer-fill.is-urgent {
  background: linear-gradient(90deg, #ffbe0b, #e21b3c);
}

/* Main Question Prompt Card */
.prompt-card {
  padding: 22px 22px;
  border-radius: 22px;
  color: #18143c;
  animation: popIn 0.25s ease;
}

.prompt-kicker {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}

.step-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 800;
  background: #ede9fe;
  color: #46178f;
}

.step-badge.is-step2 {
  background: #dcfce7;
  color: #166534;
}

.stimulus-box {
  text-align: center;
  padding: 18px 14px;
  border-radius: 18px;
  background: linear-gradient(135deg, #f5f3ff, #eef2ff);
  border: 2px solid #ddd6fe;
  margin-bottom: 16px;
}

.stimulus-word {
  font-family: "Fredoka", system-ui, sans-serif;
  font-size: 2.35rem;
  font-weight: 700;
  color: #2e1065;
  line-height: 1.1;
}

.stimulus-es {
  margin-top: 6px;
  font-size: 0.98rem;
  font-weight: 700;
  color: #4c1d95;
}

.step-instruction {
  font-size: 0.96rem;
  font-weight: 800;
  color: #1f2937;
  margin-bottom: 12px;
}

/* Kahoot Geometric Color Tile Grids */
.rule-tiles-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.rule-tiles-grid .tile-btn:last-child:nth-child(odd) {
  grid-column: 1 / -1;
}

.answer-tiles-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.tile-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 70px;
  padding: 14px 16px;
  border-radius: 16px;
  color: #ffffff;
  text-align: left;
  font-weight: 800;
  font-size: 0.98rem;
  cursor: pointer;
  position: relative;
}

.tile-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.tile-shape {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.22);
  display: grid;
  place-items: center;
  font-size: 1.15rem;
  flex-shrink: 0;
}

.tile-content {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.tile-main {
  font-weight: 800;
  line-height: 1.25;
  word-break: break-word;
}

.tile-sub {
  font-size: 0.75rem;
  font-weight: 600;
  opacity: 0.9;
}

.tile-key {
  margin-left: auto;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.2);
  flex-shrink: 0;
}

.tile-btn.is-correct-reveal {
  box-shadow: 0 0 0 4px #ffffff, 0 0 24px rgba(16, 217, 126, 0.85);
}

.tile-btn.is-wrong-picked {
  opacity: 0.72;
  animation: shake 0.35s ease;
}

/* Phase 2: Pipeline Sentence Forge */
.forge-prompt-es {
  padding: 14px 16px;
  border-radius: 14px;
  background: #eef2ff;
  border: 2px solid #c7d2fe;
  font-size: 1.05rem;
  font-weight: 800;
  color: #1e1b4b;
  margin-bottom: 14px;
}

.forge-track-label {
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #4b5563;
  margin-bottom: 6px;
}

.forge-track {
  min-height: 68px;
  padding: 12px;
  border-radius: 16px;
  background: #f5f3ff;
  border: 2.5px dashed #864cbf;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.forge-track.has-tokens {
  border-style: solid;
  background: #faf5ff;
  box-shadow: inset 0 0 0 1px rgba(134, 76, 191, 0.16), 0 4px 14px rgba(134, 76, 191, 0.12);
}

.forge-placeholder {
  color: #7c3aed;
  opacity: 0.7;
  font-size: 0.88rem;
  font-weight: 700;
}

.forge-pool {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.word-chip {
  padding: 10px 14px;
  border-radius: 12px;
  font-weight: 800;
  font-size: 0.94rem;
  border: 2px solid #c4b5fd;
  background: #ffffff;
  color: #2e1065;
  box-shadow: 0 3px 0 #c4b5fd;
  cursor: pointer;
  transition: transform 0.1s ease, opacity 0.15s ease;
}

.word-chip:hover:not(:disabled) {
  transform: translateY(-1px);
  background: #f5f3ff;
}

.word-chip:active:not(:disabled) {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #c4b5fd;
}

.word-chip.in-track {
  background: #46178f;
  color: #ffffff;
  border-color: #2e1065;
  box-shadow: 0 3px 0 #1e0b45;
}

.word-chip.is-used {
  opacity: 0.3;
  pointer-events: none;
}

.forge-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.forge-actions .btn-3d {
  flex: 1 1 160px;
}

/* Phase 3: Duel & Bug Fix */
.duel-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.spec-card {
  border-radius: 16px;
  padding: 14px;
  border: 2px solid transparent;
}

.spec-card.unit-blue {
  background: linear-gradient(180deg, #eff6ff, #dbeafe);
  border-color: #60a5fa;
}

.spec-card.unit-orange {
  background: linear-gradient(180deg, #fff7ed, #ffedd5);
  border-color: #fb923c;
}

.spec-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 10px;
}

.spec-unit-name {
  font-weight: 800;
  font-size: 0.94rem;
  color: #111827;
}

.spec-unit-tag {
  font-size: 0.7rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(17, 24, 39, 0.1);
  color: #1f2937;
}

.spec-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.spec-list li {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.84rem;
  border-bottom: 1px dashed rgba(0, 0, 0, 0.1);
  padding-bottom: 4px;
}

.spec-list li span {
  color: #4b5563;
}

.spec-list li strong {
  color: #111827;
}

.bug-terminal {
  background: #14112e;
  border: 2px solid #ff4757;
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: 0 0 22px rgba(255, 71, 87, 0.22);
  color: #f8fafc;
}

.bug-label {
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.6px;
  color: #ff6b81;
  margin-bottom: 8px;
}

.bug-sentence {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 1.02rem;
  line-height: 1.5;
}

.bug-highlight {
  background: rgba(255, 71, 87, 0.28);
  color: #ffd1dc;
  border-bottom: 2px dashed #ff4757;
  padding: 1px 6px;
  border-radius: 6px;
  font-weight: 800;
}

/* ==========================================================================
   VIEW 6: INSTANT FEEDBACK & KAHOOT REVEAL
   ========================================================================== */
.feedback-card {
  padding: 26px 22px;
  border-radius: 24px;
  text-align: center;
  animation: popIn 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

.feedback-card.is-ok {
  background: linear-gradient(145deg, #16a34a, #15803d);
  color: #ffffff;
  border: 3px solid #86efac;
}

.feedback-card.is-err {
  background: linear-gradient(145deg, #dc2626, #b91c1c);
  color: #ffffff;
  border: 3px solid #fca5a5;
}

.feedback-emoji {
  font-size: 3rem;
  margin-bottom: 6px;
}

.feedback-heading {
  font-family: "Fredoka", system-ui, sans-serif;
  font-size: 1.65rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.points-breakdown {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin: 12px 0 16px;
}

.pts-chip {
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  font-size: 0.84rem;
  font-weight: 800;
}

.feedback-explain {
  text-align: left;
  background: rgba(0, 0, 0, 0.22);
  border-radius: 16px;
  padding: 14px 16px;
  margin-bottom: 16px;
  font-size: 0.94rem;
  line-height: 1.48;
}

.feedback-explain .ex-en {
  font-weight: 800;
  font-size: 1rem;
  margin-bottom: 4px;
}

.feedback-explain .ex-es {
  opacity: 0.92;
  font-size: 0.88rem;
}

.feedback-rank-banner {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.2);
  font-weight: 800;
  font-size: 0.88rem;
  margin-bottom: 16px;
}

.kahoot-wait-box {
  padding: 12px 16px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.16);
  font-weight: 800;
  font-size: 0.94rem;
}

.reveal-dist-box {
  text-align: left;
  background: rgba(255, 255, 255, 0.96);
  color: #18143c;
  border-radius: 18px;
  padding: 16px;
  margin-top: 14px;
}

.reveal-dist-box h4 {
  font-family: "Fredoka", system-ui, sans-serif;
  margin-bottom: 10px;
}

.dist-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 8px;
}

.dist-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.82rem;
  font-weight: 700;
}

.dist-bar-track {
  height: 12px;
  border-radius: 999px;
  background: #e5e7eb;
  overflow: hidden;
}

.dist-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: #6366f1;
  transition: width 0.35s ease;
}

.dist-bar-fill.is-correct {
  background: #16a34a;
}

/* ==========================================================================
   VIEW 7: PODIUM & PERSONAL REPORT
   ========================================================================== */
.podium-card {
  padding: 28px 20px;
  border-radius: 24px;
  text-align: center;
  color: #ffffff;
}

.podium-title {
  font-family: "Fredoka", system-ui, sans-serif;
  font-size: 1.95rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.podium-subtitle {
  color: rgba(255, 255, 255, 0.82);
  margin-bottom: 24px;
}

.podium-stage {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: end;
  gap: 10px;
  max-width: 620px;
  margin: 0 auto 24px;
}

.podium-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  animation: podiumRise 0.6s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.podium-col.place-3 { animation-delay: 0.1s; }
.podium-col.place-2 { animation-delay: 0.35s; }
.podium-col.place-1 { animation-delay: 0.6s; }

.podium-avatar {
  font-size: 2.2rem;
  margin-bottom: 4px;
}

.podium-name {
  font-weight: 800;
  font-size: 0.9rem;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.podium-pts {
  font-family: "Fredoka", system-ui, sans-serif;
  font-size: 0.86rem;
  color: #ffd166;
  margin-bottom: 8px;
}

.podium-pillar {
  width: 100%;
  border-radius: 16px 16px 6px 6px;
  display: grid;
  place-items: center;
  font-family: "Fredoka", system-ui, sans-serif;
  font-weight: 700;
  font-size: 1.8rem;
  color: #ffffff;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.place-1 .podium-pillar {
  height: 136px;
  background: linear-gradient(180deg, #ffbe0b, #f59e0b);
}

.place-2 .podium-pillar {
  height: 104px;
  background: linear-gradient(180deg, #94a3b8, #64748b);
}

.place-3 .podium-pillar {
  height: 82px;
  background: linear-gradient(180deg, #d97706, #92400e);
}

.personal-report-card {
  padding: 20px;
  border-radius: 20px;
  color: #18143c;
  text-align: left;
  margin-bottom: 18px;
}

.report-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.report-kpi {
  background: #f5f3ff;
  border: 1px solid #ddd6fe;
  border-radius: 14px;
  padding: 12px 10px;
  text-align: center;
}

.report-kpi span {
  display: block;
  font-size: 0.72rem;
  font-weight: 800;
  color: #5b21b6;
  text-transform: uppercase;
}

.report-kpi strong {
  font-family: "Fredoka", system-ui, sans-serif;
  font-size: 1.35rem;
  color: #1e1b4b;
}

.final-lb-card {
  padding: 18px;
  border-radius: 20px;
  color: #18143c;
  text-align: left;
}

.final-lb-list {
  list-style: none;
  padding: 0;
  margin: 12px 0 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.final-lb-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  font-weight: 700;
}

.final-lb-row.is-me {
  background: #fef3c7;
  border-color: #f59e0b;
}

/* ==========================================================================
   PAUSED OVERLAY & TECHNICAL MANUAL MODAL
   ========================================================================== */
.pause-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(16, 7, 43, 0.84);
  backdrop-filter: blur(8px);
  display: grid;
  place-items: center;
  padding: 20px;
}

.pause-overlay[hidden],
.modal-backdrop[hidden] {
  display: none !important;
}

.pause-card {
  max-width: 440px;
  width: 100%;
  padding: 30px 24px;
  border-radius: 24px;
  text-align: center;
  color: #18143c;
  animation: popIn 0.25s ease;
}

.pause-icon {
  font-size: 3rem;
  margin-bottom: 10px;
}

.pause-pulse {
  margin-top: 16px;
  display: inline-block;
  padding: 7px 14px;
  border-radius: 999px;
  background: #ede9fe;
  color: #46178f;
  font-weight: 800;
  font-size: 0.84rem;
}

.manual-modal-card {
  width: min(820px, 100%);
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0;
  background: #ffffff;
  color: #18143c;
  border-radius: 22px;
}

.manual-modal-head {
  padding: 16px 20px;
  background: #2e1065;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.manual-modal-head h3 {
  font-family: "Fredoka", system-ui, sans-serif;
  font-size: 1.15rem;
}

.manual-modal-sub {
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.75);
}

.manual-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 18px;
  background: #f5f3ff;
  border-bottom: 1px solid #ddd6fe;
}

.manual-tab {
  padding: 8px 14px;
  border-radius: 10px;
  border: 1px solid #ddd6fe;
  background: #ffffff;
  color: #3b0764;
  font-weight: 800;
  font-size: 0.84rem;
  cursor: pointer;
}

.manual-tab.active {
  background: #46178f;
  color: #ffffff;
  border-color: #46178f;
}

.manual-body {
  padding: 18px 20px;
  overflow-y: auto;
  font-size: 0.93rem;
  line-height: 1.55;
}

.manual-body .manual-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
  font-size: 0.86rem;
}

.manual-body .manual-table th,
.manual-body .manual-table td {
  border: 1px solid #e2e8f0;
  padding: 8px 10px;
  text-align: left;
}

.manual-body .manual-table th {
  background: #f5f3ff;
  color: #3b0764;
}

.manual-body .glossary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.manual-body .glossary-item {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 10px 12px;
}

.manual-body .glossary-item strong {
  display: block;
  color: #46178f;
  margin-bottom: 3px;
}

.manual-body .reading-card mark {
  background: #fef08a;
  padding: 1px 4px;
  border-radius: 4px;
  font-weight: 700;
}

/* ==========================================================================
   RESPONSIVE BREAKPOINTS (390px MOBILE -> 1280px DESKTOP)
   ========================================================================== */
@media (max-width: 960px) {
  .player-shell.has-leaderboard {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 640px) {
  .player-hud {
    padding: 8px 10px;
    gap: 8px;
  }

  .brand-session {
    max-width: 150px;
  }

  .hud-center {
    order: 3;
    width: 100%;
  }

  .player-pill {
    width: 100%;
    justify-content: space-between;
  }

  .hud-btn-manual span,
  .hud-host-link span {
    display: none;
  }

  .avatar-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .rule-tiles-grid,
  .answer-tiles-grid,
  .duel-grid,
  .manual-body .glossary-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .report-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stimulus-word {
    font-size: 1.9rem;
  }

  .tile-btn {
    min-height: 60px;
    padding: 12px 14px;
  }

  .podium-stage {
    gap: 6px;
  }

  .join-card,
  .prompt-card,
  .feedback-card {
    padding: 18px 14px;
  }
}
