/* ── Reset & base ──────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh;
  background: #3b5998;
  color: #fff;
}

/* ── Color palette ─────────────────────────────────────────────────────────── */
/* Host: deep navy cards on blue bg, bright white text
   Student: dark text (#222) on white bg, strong blue (#2c5282) accents
   Accent: warm orange #f6903d for CTAs */

/* ── Background image mixin (20% opacity, never blocks interaction) ────────── */
.bg-kids, .bg-staff { position: relative; isolation: isolate; }
.bg-kids::before, .bg-staff::before {
  content: '';
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  opacity: 0.2;
  z-index: -1;
  pointer-events: none;
}
.bg-kids::before { background-image: url('/static/bg-kids.jpg'); }
.bg-staff::before { background-image: url('/static/bg-staff.jpg'); }

/* ── Landing ───────────────────────────────────────────────────────────────── */
.landing {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  gap: 1.5rem;
  padding: 2rem;
  text-align: center;
}

.logo {
  font-size: clamp(2rem, 7vw, 3.5rem);
  font-weight: 900;
  letter-spacing: -1px;
  color: #fff;
  text-shadow: 0 2px 12px rgba(0,0,0,0.5), 0 0 40px rgba(0,0,0,0.3);
}

.logo-sm {
  font-size: clamp(1.5rem, 4vw, 2rem);
  font-weight: 900;
  text-align: center;
  text-shadow: 0 2px 8px rgba(0,0,0,0.4);
}

.tagline {
  font-size: 1.15rem;
  color: #fff;
  font-weight: 600;
  text-shadow: 0 1px 8px rgba(0,0,0,0.6);
}

.landing-btns {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 1rem;
}

.btn-join {
  padding: 1rem 2.5rem;
  border-radius: 16px;
  font-size: 1.2rem;
  font-weight: 700;
  text-decoration: none;
  border: none;
  cursor: pointer;
  background: #f6903d;
  color: #fff;
  transition: transform 0.1s, opacity 0.1s;
  box-shadow: 0 4px 14px rgba(0,0,0,0.25);
}
.btn-join:hover { transform: scale(1.04); opacity: 0.93; }

/* ── Common buttons ────────────────────────────────────────────────────────── */
.btn-primary {
  display: inline-block;
  padding: 0.85rem 2rem;
  background: #f6903d;
  color: #fff;
  border: none;
  border-radius: 14px;
  font-size: 1.1rem;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.1s, opacity 0.1s;
  margin-top: 1rem;
  box-shadow: 0 4px 14px rgba(0,0,0,0.25);
}
.btn-primary:hover { transform: scale(1.04); opacity: 0.9; }

/* ── Forms ─────────────────────────────────────────────────────────────────── */
.picker-form {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  max-width: 360px;
}

.input-code, .input-nick {
  padding: 1rem 1.25rem;
  border-radius: 14px;
  border: none;
  font-size: 1.3rem;
  font-weight: 700;
  text-align: center;
  outline: none;
  color: #222;
  background: #fff;
  width: 100%;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.input-code { letter-spacing: 6px; }

.error-msg {
  background: rgba(220, 60, 60, 0.9);
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 0.75rem 1.5rem;
  font-size: 1.05rem;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.btn-back {
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  text-shadow: 0 1px 4px rgba(0,0,0,0.4);
}

/* ── Host wrapper ──────────────────────────────────────────────────────────── */
.host-wrapper {
  min-height: 100vh;
  background: #3b5998;
}

#host-main { min-height: 100vh; }

/* ── Host: Lobby ───────────────────────────────────────────────────────────── */
.host-lobby {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1rem 1.5rem;
  gap: 1rem;
  text-align: center;
  min-height: 100vh;
}

/* Lobby top bar: code on left, push button on right */
.lobby-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: 800px;
  gap: 1rem;
}
.lobby-top-bar .btn-primary { margin-top: 0; white-space: nowrap; }

.top-bar-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-shrink: 0;
}

.code-box-sm {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: rgba(20,40,80,0.9);
  border: 2px solid rgba(255,255,255,0.35);
  border-radius: 14px;
  padding: 0.5rem 1.5rem;
  backdrop-filter: blur(8px);
}

.game-code-sm {
  font-size: clamp(2rem, 6vw, 3rem);
  font-weight: 900;
  letter-spacing: 4px;
  line-height: 1;
  color: #fff;
}

.students-section {
  width: 100%;
  max-width: 800px;
}

.code-box {
  background: rgba(20,40,80,0.9);
  border: 3px solid rgba(255,255,255,0.4);
  border-radius: 20px;
  padding: 1.5rem 3rem;
  text-align: center;
  backdrop-filter: blur(8px);
}

.code-label {
  font-size: 0.9rem;
  color: rgba(255,255,255,0.85);
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: 0.3rem;
}

.game-code {
  font-size: clamp(3rem, 10vw, 6rem);
  font-weight: 900;
  letter-spacing: 8px;
  line-height: 1;
  color: #fff;
}

.set-name {
  font-size: 0.85rem;
  color: rgba(255,255,255,0.75);
  margin-top: 0.4rem;
}

.player-count {
  font-size: 1.1rem;
  color: #fff;
  font-weight: 600;
  text-shadow: 0 1px 4px rgba(0,0,0,0.3);
}

.session-stats {
  font-size: 1rem;
  color: rgba(255,255,255,0.9);
  font-weight: 600;
  text-shadow: 0 1px 4px rgba(0,0,0,0.3);
}

#player-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  justify-content: center;
  list-style: none;
  max-width: 800px;
}

.player-chip {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(255,255,255,0.25);
  padding: 0.4rem 0.6rem 0.4rem 1rem;
  border-radius: 999px;
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.player-chip-name { flex: 1; }

.btn-kick {
  background: rgba(220, 60, 60, 0.6);
  border: 1px solid rgba(220, 60, 60, 0.8);
  border-radius: 50%;
  color: #fff;
  font-size: 0.65rem;
  font-weight: 900;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  flex-shrink: 0;
}
.btn-kick:hover { background: rgba(220, 60, 60, 0.9); }

.btn-rename {
  background: rgba(255,255,255,0.2);
  border: 1px solid rgba(255,255,255,0.4);
  border-radius: 6px;
  color: #fff;
  font-size: 0.55rem;
  font-weight: 700;
  padding: 0.1rem 0.35rem;
  cursor: pointer;
  text-transform: uppercase;
  width: auto !important;
  margin: 0 !important;
}
.btn-rename:hover { background: rgba(255,255,255,0.35); }

.rename-form {
  display: flex;
  gap: 0.3rem;
  align-items: center;
}

.input-rename {
  padding: 0.3rem 0.5rem;
  border-radius: 8px;
  border: 2px solid rgba(255,255,255,0.4);
  background: rgba(255,255,255,0.2);
  color: #fff;
  font-size: 0.9rem;
  font-weight: 600;
  outline: none;
  width: 120px;
}

.rename-form .btn-save-q {
  width: auto !important;
  margin: 0 !important;
}

/* ── Question section ──────────────────────────────────────────────────────── */
.question-section {
  width: 100%;
  max-width: 700px;
  text-align: left;
}

.section-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
  color: #fff;
  text-align: center;
  text-shadow: 0 1px 4px rgba(0,0,0,0.3);
}

.q-list-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(255,255,255,0.15);
  padding: 0.5rem 0.75rem;
  border-radius: 10px;
  margin-bottom: 0.4rem;
  font-size: 0.9rem;
  color: #fff;
  font-weight: 600;
}

.q-list-item.q-done { opacity: 0.5; }

.q-num {
  font-weight: 800;
  font-size: 0.75rem;
  background: rgba(255,255,255,0.25);
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  flex-shrink: 0;
}

.q-preview-text {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.q-type-badge {
  font-size: 0.65rem;
  font-weight: 800;
  background: rgba(255,255,255,0.2);
  padding: 0.15rem 0.5rem;
  border-radius: 6px;
  text-transform: uppercase;
  flex-shrink: 0;
}

.q-status-badge {
  font-size: 0.6rem;
  font-weight: 800;
  padding: 0.15rem 0.45rem;
  border-radius: 6px;
  text-transform: uppercase;
  flex-shrink: 0;
}
.q-status-pending { background: #d4a017; color: #fff; }
.q-status-active { background: #38a169; color: #fff; }
.q-status-closed { background: rgba(255,255,255,0.15); color: rgba(255,255,255,0.5); }

.q-resp-count {
  font-size: 0.7rem;
  color: rgba(255,255,255,0.7);
  flex-shrink: 0;
}

.q-duration {
  font-size: 0.65rem;
  color: rgba(255,255,255,0.6);
  flex-shrink: 0;
}

/* Edit/delete buttons on question items */
.btn-edit-q, .btn-del-q {
  font-size: 0.6rem;
  font-weight: 700;
  padding: 0.15rem 0.4rem;
  border-radius: 5px;
  border: 1px solid rgba(255,255,255,0.3);
  background: rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.8);
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.btn-edit-q:hover { background: rgba(255,255,255,0.25); color: #fff; }
.btn-del-q { border-color: rgba(220,60,60,0.5); color: #f8a0a0; }
.btn-del-q:hover { background: rgba(220,60,60,0.3); color: #ffcccc; }

/* ── Add question form ─────────────────────────────────────────────────────── */
.add-question-form {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.input-question {
  width: 100%;
  padding: 0.75rem 1rem;
  border-radius: 10px;
  border: 2px solid rgba(255,255,255,0.3);
  background: rgba(255,255,255,0.15);
  color: #fff;
  font-size: 1rem;
  font-family: inherit;
  outline: none;
  resize: vertical;
  min-height: 3.5rem;
}
.input-question:focus { border-color: rgba(255,255,255,0.6); }
.input-question::placeholder { color: rgba(255,255,255,0.5); }

.add-q-row-right {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.select-type {
  flex: 1;
  padding: 0.5rem;
  border-radius: 8px;
  border: 2px solid rgba(255,255,255,0.3);
  background: rgba(255,255,255,0.15);
  color: #fff;
  font-size: 0.85rem;
  cursor: pointer;
}

.btn-add-q {
  padding: 0 !important;
  border-radius: 8px !important;
  border: none;
  background: #f6903d !important;
  color: #fff !important;
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
  flex-shrink: 0;
  width: 2.5rem !important;
  min-width: 2.5rem;
  height: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 !important;
}
.btn-add-q:hover { opacity: 0.9; }

/* ── Edit question form (inline) ───────────────────────────────────────────── */
.edit-question-form {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  background: rgba(255,255,255,0.15);
  padding: 0.75rem;
  border-radius: 10px;
  margin-bottom: 0.4rem;
  border: 2px solid rgba(255,255,255,0.3);
}

.edit-q-row-right {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.btn-save-q {
  padding: 0.4rem 0.8rem;
  border-radius: 8px;
  border: none;
  background: #38a169;
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
}
.btn-save-q:hover { opacity: 0.9; }

.btn-cancel-q {
  padding: 0.4rem 0.8rem;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.35);
  background: transparent;
  color: rgba(255,255,255,0.8);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}
.btn-cancel-q:hover { background: rgba(255,255,255,0.12); }

/* ── Host: Active question ─────────────────────────────────────────────────── */
.host-question {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding: 1.5rem 2rem;
  gap: 1.5rem;
}

.q-header {
  display: flex;
  gap: 1rem;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
}

.q-counter {
  background: rgba(20,40,80,0.85);
  padding: 0.35rem 0.9rem;
  border-radius: 8px;
  font-weight: 700;
  font-size: 1rem;
  color: #fff;
}

.timer {
  font-size: 1.6rem;
  font-weight: 900;
  background: rgba(20,40,80,0.85);
  padding: 0.25rem 0.9rem;
  border-radius: 8px;
  min-width: 84px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  color: #fff;
}

.timer-passive {
  color: rgba(255,255,255,0.8);
}

.pts-badge {
  background: #fff;
  color: #2c5282;
  padding: 0.3rem 0.85rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 800;
  text-transform: uppercase;
}

.question-display {
  background: rgba(20,40,80,0.85);
  border-radius: 16px;
  padding: 2rem;
  text-align: center;
  backdrop-filter: blur(4px);
}

.question-text-full {
  font-size: clamp(1.8rem, 4vw, 3rem);
  font-weight: 800;
  line-height: 1.3;
  color: #fff;
}

/* Answer progress */
.answer-progress-wrap {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.answer-progress-bar {
  flex: 1;
  height: 6px;
  background: rgba(255,255,255,0.15);
  border-radius: 3px;
  overflow: hidden;
}

.answer-progress-fill {
  height: 100%;
  background: #f6903d;
  border-radius: 3px;
  transition: width 0.4s ease;
}

.answer-progress-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: rgba(255,255,255,0.8);
  white-space: nowrap;
  flex-shrink: 0;
}

/* Response preview */
.resp-preview {
  background: rgba(20,40,80,0.7);
  border-radius: 12px;
  padding: 0.5rem 1rem;
}

.resp-summary {
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  padding: 0.5rem 0;
  color: rgba(255,255,255,0.9);
}

.resp-list {
  max-height: 40vh;
  overflow-y: auto;
  padding: 0.5rem 0;
}

.resp-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  padding: 0.35rem 0;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  font-size: 0.85rem;
  color: #fff;
}

.resp-action { flex-shrink: 0; }

.resp-name {
  font-weight: 700;
  flex-shrink: 0;
  min-width: 80px;
  color: rgba(255,255,255,0.85);
}

.resp-answer {
  flex: 1;
  word-break: break-word;
  color: #fff;
}

.no-resp {
  color: rgba(255,255,255,0.5);
  font-size: 0.85rem;
  padding: 0.5rem 0;
}

/* Host controls */
.host-controls-active {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  margin-top: auto;
  padding-bottom: 1rem;
}

/* ── Host: Between questions ───────────────────────────────────────────────── */
.host-between {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2rem;
  gap: 1rem;
  min-height: 100vh;
}

/* ── Host: Final / Closed ──────────────────────────────────────────────────── */
.host-final {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 3rem 2rem;
  gap: 1.5rem;
  min-height: 100vh;
  text-align: center;
}

.final-title {
  font-size: clamp(1.8rem, 5vw, 3rem);
  font-weight: 900;
  color: #fff;
  text-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.btn-export {
  display: inline-block;
  padding: 0.65rem 1.5rem;
  background: rgba(255,255,255,0.2);
  color: #fff;
  border: 2px solid rgba(255,255,255,0.4);
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 700;
  text-decoration: none;
  transition: background 0.15s;
}
.btn-export:hover { background: rgba(255,255,255,0.35); }

.btn-control {
  padding: 0.5rem 1.2rem;
  border-radius: 10px;
  border: 2px solid rgba(255,255,255,0.3);
  background: rgba(255,255,255,0.12);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.12s;
}
.btn-control:hover { background: rgba(255,255,255,0.25); }

.btn-skip {
  border-color: rgba(220, 60, 60, 0.6);
  background: rgba(220, 60, 60, 0.2);
  color: #ffcccc;
}
.btn-skip:hover { background: rgba(220, 60, 60, 0.4); }

/* ── Join page ─────────────────────────────────────────────────────────────── */
.join-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  gap: 1.2rem;
  padding: 2rem;
  text-align: center;
}

.join-page form {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  width: 100%;
  max-width: 360px;
}

.btn-join-submit {
  padding: 1rem;
  background: #f6903d;
  color: #fff;
  border: none;
  border-radius: 14px;
  font-size: 1.3rem;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.1s;
  box-shadow: 0 4px 14px rgba(0,0,0,0.25);
}
.btn-join-submit:hover { transform: scale(1.03); }

/* ── Player wrapper ────────────────────────────────────────────────────────── */
.player-wrapper {
  min-height: 100vh;
  background: #fff;
  color: #222;
}

#student-main {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Player: Waiting ───────────────────────────────────────────────────────── */
.player-waiting, .player-answered, .player-final {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 2rem;
  text-align: center;
  gap: 1rem;
  background: #fff;
  color: #222;
}

.player-in-title {
  font-size: 2.5rem;
  font-weight: 900;
  color: #2c5282;
  text-shadow: 0 1px 4px rgba(0,0,0,0.1);
}

.player-nick-display {
  font-size: 1.6rem;
  font-weight: 800;
  color: #222;
  background: #dbeafe;
  padding: 0.5rem 1.5rem;
  border-radius: 999px;
}

.waiting-msg {
  font-size: 1.1rem;
  color: #555;
  font-weight: 500;
}

/* ── Player: Question ──────────────────────────────────────────────────────── */
.player-question {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding: 1.5rem;
  gap: 1.5rem;
  background: #f7f7f7;
  box-sizing: border-box;
}

.player-q-meta {
  display: flex;
  justify-content: flex-end;
  padding: 0 0.25rem;
}

.player-q-points {
  font-size: 0.8rem;
  font-weight: 700;
  color: #666;
  text-transform: uppercase;
  background: #e2e8f0;
  padding: 0.2rem 0.6rem;
  border-radius: 6px;
}

.student-question-text {
  font-size: clamp(1.4rem, 4vw, 2rem);
  font-weight: 800;
  color: #1a202c;
  text-align: center;
  line-height: 1.3;
  padding: 1rem 0;
}

/* ── Answer form ───────────────────────────────────────────────────────────── */
.answer-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  flex: 1;
}

.input-answer {
  padding: 1rem;
  border-radius: 14px;
  border: 2px solid #cbd5e0;
  font-size: 1.2rem;
  font-weight: 600;
  color: #1a202c;
  background: #fff;
  outline: none;
  width: 100%;
}
.input-answer::placeholder { color: #a0aec0; }
.input-answer:focus { border-color: #2c5282; box-shadow: 0 0 0 3px rgba(44,82,130,0.15); }

.textarea-answer {
  resize: vertical;
  min-height: 100px;
}

/* Range input */
.range-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 1rem 0;
}

.range-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  width: 100%;
}

.range-label {
  font-size: 1rem;
  font-weight: 700;
  color: #666;
  flex-shrink: 0;
}

.input-range {
  flex: 1;
  height: 40px;
  -webkit-appearance: none;
  appearance: none;
  background: #e2e8f0;
  border-radius: 20px;
  outline: none;
}
.input-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 32px;
  height: 32px;
  background: #f6903d;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

.range-value {
  font-size: 2.5rem;
  font-weight: 900;
  color: #2c5282;
}

.btn-submit-answer {
  padding: 1rem;
  background: #f6903d;
  color: #fff;
  border: none;
  border-radius: 14px;
  font-size: 1.3rem;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.1s;
  margin-top: auto;
  box-shadow: 0 4px 14px rgba(0,0,0,0.2);
}
.btn-submit-answer:hover { transform: scale(1.03); }

/* ── Player: Answered ──────────────────────────────────────────────────────── */
.locked-title {
  font-size: 2rem;
  font-weight: 900;
  color: #38a169;
}

/* ── Player: Final ─────────────────────────────────────────────────────────── */
.final-title-student {
  font-size: 2rem;
  font-weight: 900;
  color: #2c5282;
}

/* ── Player: Kicked ────────────────────────────────────────────────────────── */
.player-kicked {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 2rem;
  text-align: center;
  gap: 1rem;
  background: #c53030;
  color: #fff;
}

.kicked-title {
  font-size: 3rem;
  font-weight: 900;
}

.kicked-msg {
  font-size: 1.2rem;
}

/* ── Floating code badge ───────────────────────────────────────────────────── */
.code-badge {
  position: fixed;
  top: 0.5rem;
  right: 0.5rem;
  background: rgba(20,40,80,0.85);
  padding: 0.25rem 0.65rem;
  border-radius: 8px;
  font-size: 0.75rem;
  font-weight: 700;
  color: #fff;
  z-index: 100;
  backdrop-filter: blur(4px);
}
.code-badge-label { color: rgba(255,255,255,0.7); }
.code-badge-val { letter-spacing: 2px; font-size: 0.85rem; color: #fff; }

/* ── Markdown rendered content ─────────────────────────────────────────────── */
.marked p { margin: 0.4em 0; }
.marked code {
  background: rgba(0,0,0,0.12);
  padding: 0.15em 0.4em;
  border-radius: 4px;
  font-size: 0.9em;
}
.marked pre {
  background: rgba(0,0,0,0.15);
  padding: 0.75rem 1rem;
  border-radius: 8px;
  overflow-x: auto;
  margin: 0.5em 0;
}
.marked pre code { background: none; padding: 0; }
.marked ul, .marked ol { padding-left: 1.5em; margin: 0.4em 0; }
.marked blockquote {
  border-left: 3px solid rgba(255,255,255,0.4);
  padding-left: 0.75em;
  margin: 0.4em 0;
}
.marked strong { font-weight: 800; }
.marked img { max-width: 100%; border-radius: 8px; margin: 0.5em 0; }
.marked table { border-collapse: collapse; margin: 0.5em 0; width: 100%; }
.marked th, .marked td {
  border: 1px solid rgba(255,255,255,0.25);
  padding: 0.3em 0.6em;
  text-align: left;
}

/* Student-side markdown (dark text on light bg) */
.player-question .marked code { background: rgba(0,0,0,0.07); color: #c53030; }
.player-question .marked pre { background: #edf2f7; color: #1a202c; }
.player-question .marked pre code { color: #1a202c; }
.player-question .marked blockquote { border-left-color: #cbd5e0; color: #4a5568; }
.player-question .marked th, .player-question .marked td { border-color: #e2e8f0; color: #1a202c; }

/* ── Responsive ────────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .q-header { gap: 0.5rem; }
  .game-code { letter-spacing: 4px; }
}
