:root {
  --bg-1: #1a1a2e;
  --bg-2: #16213e;
  --bg-3: #0f3460;
  --gold: #ffd166;
  --gold-dark: #e8a838;
  --text: #ffffff;
  --text-dim: #b8c5d6;
  --opt-1: #e63946;
  --opt-2: #2a9df4;
  --opt-3: #ffb703;
  --opt-4: #06a77d;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  --radius: 18px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background: linear-gradient(135deg, var(--bg-1) 0%, var(--bg-2) 50%, var(--bg-3) 100%);
  background-attachment: fixed;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  color: white;
  transition: transform 0.1s ease, box-shadow 0.15s ease, filter 0.15s ease;
}

button:active {
  transform: scale(0.97);
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

input {
  font-family: inherit;
}

h1, h2, h3 {
  font-weight: 800;
  letter-spacing: -0.01em;
}

/* ============ HEADER / TOP BAR ============ */
.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  padding-top: max(12px, env(safe-area-inset-top, 12px));
  padding-left: max(16px, env(safe-area-inset-left, 16px));
  padding-right: max(16px, env(safe-area-inset-right, 16px));
  background: rgba(0, 0, 0, 0.25);
  backdrop-filter: blur(8px);
  border-bottom: 2px solid rgba(255, 209, 102, 0.2);
  flex-shrink: 0;
}

.brand {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--gold);
  letter-spacing: 0.02em;
}

.brand span {
  color: white;
  font-weight: 400;
}

.score-pill {
  background: var(--gold);
  color: var(--bg-1);
  font-weight: 800;
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 1.1rem;
  box-shadow: var(--shadow);
}

.pseudo-pill {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 0.95rem;
  font-weight: 600;
}

/* ============ PLAYER VIEW ============ */
.player-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 16px;
  padding-bottom: max(16px, env(safe-area-inset-bottom, 16px));
  padding-left: max(16px, env(safe-area-inset-left, 16px));
  padding-right: max(16px, env(safe-area-inset-right, 16px));
  gap: 12px;
  min-height: 0;
  overflow: hidden;
}

.join-card {
  margin: auto;
  width: 100%;
  max-width: 420px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius);
  padding: 32px 24px;
  text-align: center;
  box-shadow: var(--shadow);
}

.join-card h1 {
  font-size: 2rem;
  color: var(--gold);
  margin-bottom: 8px;
}

.join-card p {
  color: var(--text-dim);
  margin-bottom: 24px;
  font-size: 1.05rem;
}

.join-card input {
  width: 100%;
  padding: 18px;
  font-size: 1.3rem;
  background: rgba(255, 255, 255, 0.08);
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 14px;
  color: white;
  text-align: center;
  margin-bottom: 16px;
  outline: none;
  transition: border-color 0.15s;
}

.join-card input:focus {
  border-color: var(--gold);
}

.join-card button {
  width: 100%;
  padding: 20px;
  font-size: 1.4rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  color: var(--bg-1);
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.error-msg {
  color: #ff6b6b;
  font-weight: 600;
  margin-top: 12px;
  min-height: 1.5em;
}

.status-card {
  margin: auto;
  text-align: center;
  padding: 40px 20px;
}

.status-card .big-emoji {
  font-size: 5rem;
  margin-bottom: 20px;
}

.status-card h2 {
  font-size: 2rem;
  color: var(--gold);
  margin-bottom: 12px;
}

.status-card p {
  color: var(--text-dim);
  font-size: 1.2rem;
}

.options-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 10px;
  flex: 1;
  min-height: 0;
}

.option-btn {
  font-size: clamp(2.5rem, 12vw, 4.5rem);
  font-weight: 900;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  min-height: 0;
  min-width: 0;
}

.option-btn.opt-1 { background: var(--opt-1); }
.option-btn.opt-2 { background: var(--opt-2); }
.option-btn.opt-3 { background: var(--opt-3); }
.option-btn.opt-4 { background: var(--opt-4); }

.option-btn.selected {
  outline: 6px solid white;
  outline-offset: -6px;
}

.option-btn.dimmed {
  opacity: 0.35;
}

.player-question {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: var(--radius);
  flex-shrink: 0;
}

.player-question .q-text {
  font-size: clamp(0.95rem, 4vw, 1.2rem);
  font-weight: 600;
  line-height: 1.35;
}

.answer-feedback {
  margin: auto;
  text-align: center;
  padding: 30px;
}

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

.answer-feedback h2 {
  font-size: 2rem;
  margin-bottom: 8px;
}

.answer-feedback.correct h2 { color: var(--opt-4); }
.answer-feedback.wrong h2 { color: var(--opt-1); }

.answer-feedback .points {
  font-size: 1.3rem;
  color: var(--gold);
  font-weight: 700;
  margin-top: 8px;
}

/* ============ PODIUM JOUEUR (téléphone) ============ */
.podium-player {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 16px 12px;
  gap: 8px;
  overflow-y: auto;
}

.podium-player .feedback-emoji {
  font-size: 5rem;
  line-height: 1;
  margin-bottom: 4px;
}

.podium-player h2 {
  font-size: 1.8rem;
  color: var(--gold);
  margin: 0;
}

.podium-player-score {
  font-size: 3rem;
  font-weight: 900;
  color: white;
  line-height: 1;
  margin-top: 8px;
}

.podium-player-score span {
  font-size: 1.3rem;
  color: var(--gold);
  font-weight: 700;
}

.podium-player-context {
  color: var(--text-dim);
  font-size: 1rem;
  margin-bottom: 8px;
}

.mini-rank-list {
  width: 100%;
  max-width: 360px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 209, 102, 0.2);
  border-radius: 14px;
  padding: 12px;
  margin-top: 8px;
}

.mini-rank-title {
  color: var(--gold);
  font-weight: 800;
  font-size: 1rem;
  margin-bottom: 8px;
  text-align: center;
}

.mini-rank-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 0.95rem;
}

.mini-rank-row.me {
  background: rgba(255, 209, 102, 0.18);
  border: 1px solid rgba(255, 209, 102, 0.4);
}

.mini-rank-emoji {
  font-size: 1.3rem;
  min-width: 32px;
  text-align: center;
}

.mini-rank-name {
  flex: 1;
  font-weight: 700;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mini-rank-pts {
  color: var(--gold);
  font-weight: 800;
}

.mini-rank-divider {
  text-align: center;
  color: var(--text-dim);
  font-size: 1.4rem;
  letter-spacing: 0.3em;
  margin: 4px 0;
}

/* ============ SCREEN VIEW ============ */
.screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 32px 48px;
  gap: 24px;
}

.screen-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 16px;
  border-bottom: 3px solid rgba(255, 209, 102, 0.3);
}

.screen-title {
  font-size: 2.5rem;
  color: var(--gold);
  font-weight: 900;
}

.screen-title span {
  color: white;
  font-weight: 400;
}

.screen-progress {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--text-dim);
}

/* Lobby */
.lobby {
  flex: 1;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 40px;
  align-items: center;
}

.qr-block {
  text-align: center;
  background: white;
  padding: 24px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.qr-block img {
  display: block;
  width: 480px;
  height: 480px;
  max-width: 100%;
}

.qr-block .url {
  margin-top: 16px;
  color: var(--bg-1);
  font-size: 1.3rem;
  font-weight: 700;
}

.lobby-info {
  display: flex;
  flex-direction: column;
  gap: 20px;
  height: 100%;
}

.lobby-info h2 {
  font-size: 3rem;
  color: var(--gold);
  margin-bottom: 8px;
}

.lobby-info .instructions {
  font-size: 1.6rem;
  color: var(--text-dim);
  line-height: 1.5;
}

.players-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  max-height: 60vh;
  overflow-y: auto;
  padding-right: 8px;
}

.player-chip {
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid rgba(255, 209, 102, 0.4);
  border-radius: 14px;
  padding: 12px 16px;
  font-size: 1.3rem;
  font-weight: 700;
  text-align: center;
  animation: pop-in 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes pop-in {
  0% { transform: scale(0); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.player-count {
  font-size: 2.5rem;
  color: var(--gold);
  font-weight: 900;
}

/* Question phase */
.question-screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.question-text {
  text-align: center;
  font-size: 3rem;
  font-weight: 800;
  padding: 32px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: var(--radius);
  line-height: 1.3;
}

.timer-block {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 24px;
}

.timer-circle {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  background: var(--gold);
  color: var(--bg-1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 4rem;
  font-weight: 900;
  box-shadow: var(--shadow);
  transition: background 0.3s;
}

.timer-circle.warning { background: #ff8c42; }
.timer-circle.critical { background: var(--opt-1); animation: pulse 0.5s infinite alternate; }

@keyframes pulse {
  from { transform: scale(1); }
  to { transform: scale(1.08); }
}

.answers-meta {
  font-size: 1.6rem;
  color: var(--text-dim);
  font-weight: 600;
}

.options-screen {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  flex: 1;
}

.screen-option {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 24px 32px;
  border-radius: var(--radius);
  font-size: 2.2rem;
  font-weight: 700;
  box-shadow: var(--shadow);
  position: relative;
  transition: all 0.3s ease;
}

.screen-option .num {
  font-size: 3.5rem;
  font-weight: 900;
  width: 80px;
  height: 80px;
  background: rgba(0, 0, 0, 0.25);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.screen-option.opt-1 { background: var(--opt-1); }
.screen-option.opt-2 { background: var(--opt-2); }
.screen-option.opt-3 { background: var(--opt-3); color: var(--bg-1); }
.screen-option.opt-4 { background: var(--opt-4); }

.screen-option.opt-3 .num { background: rgba(0, 0, 0, 0.2); color: var(--bg-1); }

.screen-option.correct {
  outline: 6px solid var(--gold);
  outline-offset: -6px;
  transform: scale(1.03);
}

.screen-option.wrong {
  opacity: 0.4;
  filter: grayscale(60%);
}

.vote-count {
  position: absolute;
  right: 24px;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0, 0, 0, 0.4);
  padding: 6px 18px;
  border-radius: 999px;
  font-size: 1.6rem;
  font-weight: 800;
}

/* Podium */
.podium {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 20px;
  padding: 16px 0;
  min-height: 0;
}

.podium h2 {
  font-size: 3rem;
  color: var(--gold);
  text-align: center;
}

.podium-row {
  display: flex;
  align-items: flex-end;
  gap: 24px;
  justify-content: center;
}

.podium-spot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.podium-spot .crown {
  font-size: 3rem;
}

.podium-spot .name {
  font-size: 2rem;
  font-weight: 800;
}

.podium-spot .score {
  font-size: 1.3rem;
  color: var(--gold);
  font-weight: 700;
}

.podium-spot .block {
  width: 200px;
  border-radius: var(--radius) var(--radius) 0 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 4rem;
  font-weight: 900;
  box-shadow: var(--shadow);
}

.podium-spot.first .block { height: 300px; background: var(--gold); color: var(--bg-1); }
.podium-spot.second .block { height: 220px; background: #c0c0c0; color: var(--bg-1); }
.podium-spot.third .block { height: 160px; background: #cd7f32; color: white; }

.scoreboard-meta {
  margin-top: 24px;
  color: var(--text-dim);
  font-size: 1.1rem;
  font-weight: 600;
  text-align: center;
}

.full-scoreboard {
  margin-top: 12px;
  width: 100%;
  max-width: 1700px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 8px 12px;
  max-height: 55vh;
  overflow-y: auto;
  padding: 8px 4px;
}

.scoreboard-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 1.05rem;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.scoreboard-row .rank {
  color: var(--gold);
  font-weight: 800;
  min-width: 32px;
  text-align: center;
  background: rgba(255, 209, 102, 0.15);
  border-radius: 999px;
  padding: 2px 6px;
  font-size: 0.95rem;
}

.scoreboard-row .name {
  flex: 1;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.scoreboard-row .pts {
  font-weight: 800;
  color: var(--gold);
  font-size: 0.95rem;
  flex-shrink: 0;
}

.scoreboard-row .pts::after { content: ' pts'; opacity: 0.7; font-weight: 600; }

/* Scoreboard during reveal */
.reveal-scoreboard {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 16px;
  justify-content: center;
}

.reveal-scoreboard .player-rank {
  background: rgba(255, 255, 255, 0.1);
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 1.2rem;
  font-weight: 600;
}

.reveal-scoreboard .player-rank.top {
  background: var(--gold);
  color: var(--bg-1);
  font-weight: 800;
}

/* ============ HOST VIEW ============ */
.host-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 24px;
  gap: 20px;
  max-width: 600px;
  margin: 0 auto;
  width: 100%;
}

.host-card {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}

.host-card h2 {
  color: var(--gold);
  font-size: 1.5rem;
  margin-bottom: 16px;
}

.host-state {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.host-state .label {
  color: var(--text-dim);
  font-size: 0.9rem;
}

.host-state .value {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--gold);
}

.btn-primary {
  width: 100%;
  padding: 22px;
  font-size: 1.5rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  color: var(--bg-1);
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.btn-secondary {
  padding: 14px 20px;
  font-size: 1rem;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  color: white;
}

.btn-danger {
  background: var(--opt-1);
}

.host-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.player-list-host {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 300px;
  overflow-y: auto;
}

.player-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255, 255, 255, 0.05);
  padding: 10px 14px;
  border-radius: 10px;
}

.player-row .info {
  display: flex;
  gap: 12px;
  align-items: center;
}

.player-row .pseudo { font-weight: 700; }
.player-row .score { color: var(--gold); font-weight: 700; }

.player-row button {
  background: rgba(230, 57, 70, 0.7);
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 700;
}

.preview-question {
  background: rgba(0, 0, 0, 0.25);
  padding: 16px;
  border-radius: 12px;
  margin-top: 12px;
}

.preview-question .q {
  font-weight: 700;
  margin-bottom: 8px;
}

.preview-question .opt {
  padding: 4px 0;
  color: var(--text-dim);
}

.preview-question .opt.correct {
  color: var(--opt-4);
  font-weight: 700;
}

/* ============ IDLE SCREEN ============ */
.idle-screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 20px;
  gap: 16px;
  margin: auto;
  max-width: 700px;
}

.idle-screen .idle-emoji {
  font-size: 7rem;
  animation: float 2.5s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-12px); }
}

.idle-screen h1 {
  font-size: 3.5rem;
  color: var(--gold);
  margin-bottom: 8px;
}

.idle-screen .idle-title {
  font-size: 2rem;
  color: white;
  font-weight: 700;
}

.idle-screen .idle-message {
  font-size: 1.6rem;
  color: var(--text-dim);
  line-height: 1.5;
  max-width: 600px;
}

.idle-screen .idle-sub {
  font-size: 1.2rem;
  color: var(--gold);
  font-weight: 600;
  margin-top: 12px;
}

.idle-screen.player-idle h1 { font-size: 2rem; }
.idle-screen.player-idle .idle-title { font-size: 1.4rem; }
.idle-screen.player-idle .idle-message { font-size: 1.1rem; }
.idle-screen.player-idle .idle-sub { font-size: 1rem; }
.idle-screen.player-idle .idle-emoji { font-size: 5rem; }

/* ============ ACTIVE QUIZ BADGE (lobby) ============ */
.active-quiz-badge {
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  color: var(--bg-1);
  padding: 12px 28px;
  border-radius: 999px;
  font-size: 1.5rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
  align-self: flex-start;
  max-width: 100%;
}

.active-quiz-badge span {
  font-weight: 900;
  font-size: 1.7rem;
}

/* ============ QUESTION IMAGE (écran seulement) ============ */
.question-image {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 0 auto;
  width: 100%;
}

.question-image img {
  max-width: min(70%, 600px);
  max-height: 32vh;
  min-height: 180px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  object-fit: contain;
  border: 4px solid var(--gold);
  background: rgba(255, 255, 255, 0.05);
  padding: 4px;
}

.question-image.small img {
  max-height: 18vh;
  min-height: 120px;
  max-width: min(40%, 360px);
}

.question-screen.has-image .question-text {
  font-size: 2.2rem;
  padding: 20px 32px;
}

.question-screen.has-image .options-screen {
  gap: 14px;
}

.question-screen.has-image .screen-option {
  padding: 16px 24px;
  font-size: 1.8rem;
}

/* ============ BARRE QUIZ (multi-quiz) ============ */
.quiz-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
  align-items: center;
  background: rgba(255, 255, 255, 0.05);
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 209, 102, 0.25);
}

.quiz-bar-left {
  display: flex;
  gap: 8px;
  flex: 1;
  align-items: center;
  min-width: 200px;
  flex-wrap: wrap;
}

.quiz-bar select {
  flex: 1;
  min-width: 150px;
  background: rgba(255, 255, 255, 0.1);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 0.95rem;
  font-family: inherit;
  font-weight: 600;
  outline: none;
}

.quiz-bar select option { background: var(--bg-1); color: white; }

.quiz-bar-actions {
  display: flex;
  gap: 4px;
}

.quiz-bar-actions button {
  width: 36px;
  height: 36px;
  padding: 0;
  font-size: 1rem;
}

#activateQuizBtn {
  padding: 8px 14px;
  font-size: 0.9rem;
}

/* ============ POINTS BADGES ============ */
.q-points-badge {
  background: rgba(255, 209, 102, 0.2);
  border: 1px solid rgba(255, 209, 102, 0.5);
  color: var(--gold);
  font-weight: 800;
  font-size: 0.85rem;
  padding: 4px 10px;
  border-radius: 999px;
  flex-shrink: 0;
}

.points-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}

.points-chip {
  background: rgba(255, 255, 255, 0.08);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 999px;
  padding: 6px 14px;
  font-weight: 700;
  font-size: 0.85rem;
}

.points-chip.selected {
  background: var(--gold);
  color: var(--bg-1);
  border-color: var(--gold);
}

#customPoints {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  padding: 6px 12px;
  color: white;
  font-weight: 700;
  font-size: 0.85rem;
  outline: none;
}

/* Badge points sur l'écran et joueur (pendant question) */
.points-display {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  color: var(--bg-1);
  padding: 8px 20px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 1.4rem;
  box-shadow: var(--shadow);
}

.points-display.big {
  font-size: 2rem;
  padding: 12px 28px;
}

.points-display.small {
  font-size: 0.95rem;
  padding: 6px 14px;
}

/* ============ EDITEUR DE QUESTIONS ============ */
.editor-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 10px;
}

.editor-toolbar .info {
  color: var(--text-dim);
  font-size: 0.9rem;
}

.btn-add {
  background: var(--opt-4);
  padding: 12px 20px;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 700;
}

.q-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 400px;
  overflow-y: auto;
}

.q-row {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.q-row .q-num {
  background: var(--gold);
  color: var(--bg-1);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  flex-shrink: 0;
}

.q-row .q-text {
  flex: 1;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.q-row .q-icon {
  font-size: 1.2rem;
  opacity: 0.7;
}

.q-row .q-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.q-row .q-actions button {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 0.85rem;
  font-weight: 600;
}

.q-row .q-actions .del {
  background: rgba(230, 57, 70, 0.5);
}

.q-form {
  background: rgba(0, 0, 0, 0.3);
  border-radius: 12px;
  padding: 16px;
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.q-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--text-dim);
  font-weight: 600;
}

.q-form input[type="text"],
.q-form textarea {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 1rem;
  color: white;
  outline: none;
  font-family: inherit;
}

.q-form input[type="text"]:focus,
.q-form textarea:focus {
  border-color: var(--gold);
}

.q-form textarea { resize: vertical; min-height: 60px; }

.q-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.q-options .q-opt-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.q-options .q-opt-row .q-opt-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  color: white;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 0.85rem;
}

.q-options .q-opt-row .q-opt-num.n1 { background: var(--opt-1); }
.q-options .q-opt-row .q-opt-num.n2 { background: var(--opt-2); }
.q-options .q-opt-row .q-opt-num.n3 { background: var(--opt-3); color: var(--bg-1); }
.q-options .q-opt-row .q-opt-num.n4 { background: var(--opt-4); }

.q-options .q-opt-row input[type="text"] {
  flex: 1;
}

.q-options .q-opt-row input[type="radio"] {
  width: 20px;
  height: 20px;
  cursor: pointer;
}

.q-image-row {
  display: flex;
  gap: 12px;
  align-items: center;
}

.q-image-preview {
  width: 80px;
  height: 80px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px dashed rgba(255, 255, 255, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}

.q-image-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.q-image-preview .placeholder {
  font-size: 1.8rem;
  opacity: 0.4;
}

.q-image-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.q-image-actions button {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 0.85rem;
  font-weight: 600;
}

.q-image-actions .upload {
  background: var(--opt-2);
}

.q-image-actions .remove {
  background: rgba(230, 57, 70, 0.5);
}

.q-form-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.q-form-actions .save {
  background: var(--opt-4);
  padding: 10px 24px;
  border-radius: 10px;
  font-weight: 700;
}

.q-form-actions .cancel {
  background: rgba(255, 255, 255, 0.08);
  padding: 10px 24px;
  border-radius: 10px;
  font-weight: 700;
}

.editor-warning {
  background: rgba(255, 140, 66, 0.15);
  border: 1px solid rgba(255, 140, 66, 0.4);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 0.9rem;
  color: #ffb380;
  margin-bottom: 12px;
}

details.host-card {
  cursor: default;
}

details.host-card summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 10px;
}

details.host-card summary::before {
  content: '▶';
  font-size: 0.8rem;
  color: var(--gold);
  transition: transform 0.15s;
}

details.host-card[open] summary::before {
  transform: rotate(90deg);
}

details.host-card summary h2 {
  display: inline;
  margin: 0;
}

/* ============ RESPONSIVE ============ */
@media (max-width: 900px) {
  .screen { padding: 20px; gap: 16px; }
  .screen-title { font-size: 1.6rem; }
  .screen-progress { font-size: 1.2rem; }
  .question-text { font-size: 1.8rem; padding: 20px; }
  .screen-option { font-size: 1.4rem; padding: 16px 20px; }
  .screen-option .num { width: 60px; height: 60px; font-size: 2.5rem; }
  .timer-circle { width: 100px; height: 100px; font-size: 2.8rem; }
  .lobby { grid-template-columns: 1fr; gap: 20px; }
  .qr-block img { width: 300px; height: 300px; }
  .podium-spot .block { width: 110px; }
  .podium-spot.first .block { height: 200px; }
  .podium-spot.second .block { height: 150px; }
  .podium-spot.third .block { height: 110px; }
  .podium h2 { font-size: 2.5rem; }
}

@media (max-width: 500px) {
  .top-bar { padding: 10px 14px; }
  .brand { font-size: 1rem; }
  .score-pill { font-size: 1rem; padding: 6px 12px; }
  .pseudo-pill { font-size: 0.85rem; padding: 5px 12px; }
  .player-wrap { padding: 12px; gap: 10px; }
  .options-grid { gap: 8px; }
  .player-question {
    padding: 10px 12px;
    line-height: 1.3;
  }
  .points-display { font-size: 0.85rem !important; padding: 5px 10px !important; }
}

@media (max-height: 700px) {
  .player-question { padding: 8px 14px; font-size: 0.95rem; }
  .points-display { font-size: 0.8rem !important; padding: 4px 10px !important; margin-bottom: 6px !important; }
  .option-btn { font-size: clamp(2rem, 10vw, 3.5rem); }
}
