:root {
  --bg: #090b14;
  --panel: rgba(17, 24, 39, 0.72);
  --panel-border: rgba(255, 255, 255, 0.08);
  --text: #f5f7ff;
  --muted: #9aa4bf;
  --primary: #7c4dff;
  --secondary: #00d4ff;
  --success: #24e08a;
  --danger: #ff4d7a;
  --warning: #ffbe3b;
  --shadow: 0 18px 60px rgba(0, 0, 0, 0.35);
  --radius-xl: 28px;
  --radius-lg: 20px;
}

* { box-sizing: border-box; }
html, body {
  width: 100%; height: 100%; margin: 0;
  font-family: Inter, Arial, Helvetica, sans-serif;
  background:
    radial-gradient(circle at top left, rgba(124,77,255,0.18), transparent 25%),
    radial-gradient(circle at bottom right, rgba(0,212,255,0.18), transparent 25%),
    linear-gradient(180deg, #090b14 0%, #0d1220 100%);
  color: var(--text);
}
body { overflow: hidden; }

.background-glow {
  position: fixed;
  width: 38vw;
  height: 38vw;
  filter: blur(90px);
  opacity: 0.18;
  pointer-events: none;
}
.glow-1 { top: -8vw; left: -4vw; background: var(--primary); }
.glow-2 { bottom: -8vw; right: -4vw; background: var(--secondary); }

.app-shell {
  min-height: 100vh;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  position: relative;
  z-index: 1;
}

.glass-panel {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.topbar {
  border-radius: var(--radius-xl);
  padding: 20px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
}

.brand-wrap { display: flex; align-items: center; gap: 18px; }
.brand-badge {
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(124,77,255,0.22);
  color: #d6c8ff;
  font-weight: 700;
  letter-spacing: 0.08em;
  font-size: 0.85rem;
}
.brand { font-size: 2.15rem; font-weight: 900; letter-spacing: 0.02em; }
.subtitle { color: var(--muted); font-size: 1rem; margin-top: 6px; }

.status-wrap { display: flex; align-items: center; gap: 18px; }
.phase-box {
  min-width: 210px;
  padding: 16px 18px;
  border-radius: var(--radius-lg);
  background: rgba(255,255,255,0.04);
}
.phase-label { color: var(--muted); font-size: 0.9rem; margin-bottom: 6px; }
.phase-text { font-size: 1.35rem; font-weight: 800; }

.timer-ring-wrap {
  position: relative;
  width: 120px;
  height: 120px;
}
.timer-ring { width: 120px; height: 120px; transform: rotate(-90deg); }
.timer-ring-track {
  fill: none;
  stroke: rgba(255,255,255,0.08);
  stroke-width: 10;
}
.timer-ring-progress {
  fill: none;
  stroke: url(#timerGradient);
  stroke: var(--warning);
  stroke-linecap: round;
  stroke-width: 10;
  stroke-dasharray: 326.73;
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 1s linear, stroke 0.4s ease;
  filter: drop-shadow(0 0 10px rgba(255,190,59,0.35));
}
.timer-core {
  position: absolute;
  inset: 15px;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background: rgba(9,11,20,0.92);
}
.timer-value { font-size: 2rem; font-weight: 900; line-height: 1; }
.timer-unit { color: var(--muted); font-size: 0.8rem; margin-top: 6px; }

.main-layout {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 20px;
}

.quiz-panel {
  border-radius: var(--radius-xl);
  padding: 26px;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.meta-row { display: flex; justify-content: space-between; gap: 16px; align-items: center; }
.session-info { color: var(--muted); font-size: 1.02rem; }
.category-badge {
  padding: 10px 16px;
  border-radius: 999px;
  background: rgba(0,212,255,0.16);
  color: #bdf4ff;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 0.8rem;
}
.question-text {
  font-size: clamp(2.1rem, 3vw, 3.45rem);
  line-height: 1.18;
  margin: 18px 0 22px;
  font-weight: 900;
}

.choices-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-top: 6px;
}
.choice-card {
  position: relative;
  overflow: hidden;
  min-height: 120px;
  padding: 22px 24px;
  border-radius: 22px;
  border: 1px solid rgba(255,255,255,0.08);
  background: linear-gradient(180deg, rgba(255,255,255,0.06), rgba(255,255,255,0.03));
  display: flex;
  gap: 16px;
  align-items: center;
  transition: transform 0.25s ease, border-color 0.25s ease, opacity 0.25s ease, box-shadow 0.25s ease;
}
.choice-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent, rgba(255,255,255,0.05), transparent);
  transform: translateX(-100%);
}
.choice-card.reveal::after { animation: shimmer 1s ease; }
.choice-card.small-layout { min-height: 152px; }
.choice-index {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  background: rgba(124,77,255,0.18);
  border: 1px solid rgba(124,77,255,0.38);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  font-weight: 900;
  flex-shrink: 0;
}
.choice-text {
  font-size: clamp(1.25rem, 1.8vw, 1.85rem);
  line-height: 1.3;
  font-weight: 700;
}
.choice-card.correct {
  border-color: rgba(36,224,138,0.88);
  box-shadow: 0 0 0 1px rgba(36,224,138,0.25), 0 0 30px rgba(36,224,138,0.22);
  background: linear-gradient(180deg, rgba(36,224,138,0.18), rgba(36,224,138,0.08));
  transform: scale(1.015);
}
.choice-card.wrong {
  opacity: 0.34;
}

.answer-reveal {
  margin-top: 18px;
  padding: 18px 20px;
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(36,224,138,0.18), rgba(36,224,138,0.08));
  border: 1px solid rgba(36,224,138,0.35);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.answer-reveal-label {
  color: #bbf8da;
  font-size: 0.9rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 800;
}
.answer-reveal-text { font-size: 1.75rem; font-weight: 900; }
.hidden { display: none; }

.side-panel {
  border-radius: var(--radius-xl);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.side-title { font-size: 1.35rem; font-weight: 900; margin-bottom: 6px; }
.side-card {
  padding: 18px;
  border-radius: 18px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.06);
}
.accent-card { background: rgba(124,77,255,0.14); }
.side-label { color: var(--muted); font-size: 0.92rem; margin-bottom: 8px; }
.side-value { font-size: 1.2rem; font-weight: 800; }
.side-value.small { font-size: 1rem; line-height: 1.45; }
.primary-btn {
  margin-top: auto;
  padding: 18px 22px;
  border: 0;
  border-radius: 18px;
  font-size: 1.08rem;
  font-weight: 900;
  color: #0c1020;
  background: linear-gradient(135deg, var(--warning), #ffd86f);
  cursor: pointer;
  box-shadow: 0 14px 28px rgba(255,190,59,0.28);
  transition: transform 0.2s ease, opacity 0.2s ease;
}
.primary-btn:hover { transform: translateY(-1px); }
.primary-btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }

.flash-correct { animation: flashCorrect 0.9s ease; }
.flash-reveal { animation: revealPulse 0.6s ease; }
.question-enter { animation: fadeUp 0.45s ease; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes shimmer {
  from { transform: translateX(-100%); }
  to { transform: translateX(100%); }
}
@keyframes flashCorrect {
  0%, 100% { box-shadow: 0 0 0 rgba(36,224,138,0); }
  50% { box-shadow: 0 0 42px rgba(36,224,138,0.35); }
}
@keyframes revealPulse {
  0% { transform: scale(0.98); opacity: 0.2; }
  100% { transform: scale(1); opacity: 1; }
}

@media (max-width: 1280px) {
  .main-layout { grid-template-columns: 1fr; }
  .side-panel { display: grid; grid-template-columns: repeat(4, 1fr); align-items: start; }
  .primary-btn { margin-top: 0; }
}

/* === V2.1 quiz auto / centré / sans aside === */

.centered-mode {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.compact-topbar {
  width: min(1400px, calc(100vw - 48px));
  margin: 24px auto 0;
  padding: 18px 24px;
}

.centered-layout {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 24px;
}

.centered-panel {
  width: min(1280px, 92vw);
  max-width: 1280px;
  min-height: 68vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  margin: 0 auto;
}

.timer-floating {
  margin-left: 20px;
}

.timer-ring-wrap {
  width: 118px;
  height: 118px;
  position: relative;
  flex-shrink: 0;
}

.timer-core {
  position: absolute;
  inset: 15px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.timer-value {
  font-size: 2.15rem;
  font-weight: 900;
}

.question-text {
  text-align: center;
  max-width: 1000px;
  margin: 24px auto 32px;
}

.choices-grid {
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
}

.meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 12px;
}

.session-info {
  font-size: 1rem;
  opacity: 0.9;
}

.footer-counter {
  display: flex;
  justify-content: center;
  margin-top: 28px;
  opacity: 0.85;
}

.answer-reveal {
  margin-top: 22px;
}

@media (max-width: 1280px) {
  .main-layout.centered-layout {
    display: flex;
  }
}

@media (max-width: 900px) {
  .compact-topbar {
    width: calc(100vw - 24px);
    margin-top: 12px;
    padding: 14px 16px;
  }

  .centered-panel {
    width: 100%;
    min-height: auto;
    padding: 20px;
  }

  .meta-row {
    flex-direction: column;
    align-items: center;
  }

  .timer-ring-wrap {
    width: 96px;
    height: 96px;
  }

  .timer-value {
    font-size: 1.7rem;
  }

  .brand {
    font-size: 1.5rem;
  }

  .phase-box {
    min-width: auto;
    padding: 12px 14px;
  }

  .phase-text {
    font-size: 1rem;
  }
}
/* === V3 elegant full-frame layout === */

html, body {
  height: 100%;
}

body {
  overflow: hidden;
}

.app-shell.centered-mode {
  min-height: 100vh;
  height: 100vh;
  padding: 0;
  gap: 0;
  display: grid;
  grid-template-rows: auto 1fr;
}

/* Header collé en haut, sans marge extérieure */
.topbar.compact-topbar {
  width: 100%;
  margin: 0;
  border-radius: 0 0 28px 28px;
  padding: 18px 34px;
  min-height: 118px;
  position: relative;
  z-index: 5;
  border-left: 0;
  border-right: 0;
  border-top: 0;
}

/* Même largeur utile pour header et contenu */
.topbar.compact-topbar,
.main-layout.centered-layout {
  width: 100%;
}

/* Main prend tout l’espace restant */
.main-layout.centered-layout {
  min-height: 0;
  height: 100%;
  padding: 18px 28px 24px;
  display: flex;
  justify-content: center;
  align-items: stretch;
}

/* Le panel principal devient une vraie scène */
.quiz-panel.centered-panel {
  width: 100%;
  max-width: none;
  min-height: 0;
  height: 100%;
  margin: 0;
  padding: 28px 34px 24px;
  border-radius: 30px;
  display: grid;
  grid-template-rows: auto auto 1fr auto auto;
  row-gap: 18px;
}

/* Ligne meta plus respirante */
.meta-row {
  margin-bottom: 0;
  min-height: 44px;
}

.session-info {
  font-size: 1rem;
  line-height: 1.25;
  color: rgba(245, 247, 255, 0.72);
}

.category-badge {
  padding: 10px 16px;
  font-size: 0.78rem;
  white-space: nowrap;
}

/* Titre mieux posé et centré */
.question-text {
  margin: 0 auto;
  max-width: 1100px;
  text-align: center;
  text-wrap: balance;
  font-size: clamp(2.2rem, 3.2vw, 3.8rem);
  line-height: 1.12;
  letter-spacing: -0.02em;
}

/* La grille occupe toute la zone disponible */
.choices-grid {
  width: 100%;
  max-width: none;
  margin: 0;
  min-height: 0;
  height: 100%;
  align-content: stretch;
  align-items: stretch;
  grid-auto-rows: 1fr;
  gap: 20px;
}

/* Cartes de réponses plus premium et plus grandes */
.choice-card {
  min-height: 0;
  height: 100%;
  padding: 24px 26px;
  border-radius: 24px;
  gap: 18px;
  align-items: center;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.03);
}

.choice-card.small-layout {
  min-height: 0;
}

.choice-index {
  width: 56px;
  height: 56px;
  border-radius: 18px;
  font-size: 1.4rem;
}

.choice-text {
  font-size: clamp(1.3rem, 1.65vw, 1.95rem);
  line-height: 1.28;
  font-weight: 750;
}

/* Révélation mieux intégrée */
.answer-reveal {
  margin-top: 0;
  padding: 18px 22px;
  border-radius: 22px;
}

.answer-reveal-text {
  font-size: clamp(1.45rem, 2vw, 2rem);
  line-height: 1.2;
}

/* Compteur discret mais élégant */
.footer-counter {
  margin-top: 0;
  min-height: 28px;
  align-items: center;
}

.footer-counter .side-value {
  font-size: 1rem;
  letter-spacing: 0.04em;
  color: rgba(245, 247, 255, 0.68);
}

/* Header mieux équilibré */
.brand-wrap {
  gap: 16px;
}

.brand {
  font-size: clamp(1.6rem, 2vw, 2.25rem);
  line-height: 1;
}

.brand-badge {
  padding: 10px 14px;
}

/* Zone statut mieux proportionnée */
.status-wrap {
  gap: 16px;
}

.phase-box {
  min-width: 240px;
  padding: 14px 18px;
  border-radius: 18px;
  background: rgba(255,255,255,0.045);
}

.phase-text {
  font-size: 1.2rem;
  line-height: 1.15;
}

/* Timer mieux intégré visuellement */
.timer-floating {
  margin-left: 0;
}

.timer-ring-wrap {
  width: 108px;
  height: 108px;
}

.timer-ring {
  width: 108px;
  height: 108px;
}

.timer-core {
  inset: 13px;
  background: radial-gradient(circle at 30% 30%, rgba(20,24,37,0.98), rgba(9,11,20,0.94));
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
}

.timer-value {
  font-size: 2rem;
  letter-spacing: -0.03em;
}

/* Effet hover inutile sur écran public -> neutralisé */
.primary-btn,
.side-panel {
  display: none !important;
}

/* Réduction du poids visuel des éléments secondaires */
.question-enter {
  animation-duration: 0.35s;
}

.background-glow {
  opacity: 0.14;
}

/* Responsive grand écran court */
@media (max-height: 820px) {
  .topbar.compact-topbar {
    min-height: 100px;
    padding: 14px 28px;
  }

  .main-layout.centered-layout {
    padding: 14px 22px 18px;
  }

  .quiz-panel.centered-panel {
    padding: 22px 26px 18px;
    row-gap: 14px;
  }

  .question-text {
    font-size: clamp(1.9rem, 2.7vw, 3.1rem);
  }

  .choice-text {
    font-size: clamp(1.15rem, 1.45vw, 1.65rem);
  }

  .timer-ring-wrap,
  .timer-ring {
    width: 94px;
    height: 94px;
  }

  .timer-core {
    inset: 11px;
  }

  .timer-value {
    font-size: 1.7rem;
  }
}

/* Responsive tablette / TV verticale éventuelle */
@media (max-width: 1100px) {
  .topbar.compact-topbar {
    padding: 14px 20px;
    min-height: 96px;
    border-radius: 0 0 22px 22px;
  }

  .main-layout.centered-layout {
    padding: 14px 16px 18px;
  }

  .quiz-panel.centered-panel {
    padding: 20px 18px 18px;
    row-gap: 14px;
  }

  .meta-row {
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    gap: 10px;
  }

  .question-text {
    font-size: clamp(1.7rem, 4.5vw, 2.6rem);
    max-width: 100%;
  }

  .choices-grid {
    grid-template-columns: 1fr;
  }

  .choice-card,
  .choice-card.small-layout {
    min-height: 96px;
  }

  .phase-box {
    min-width: auto;
  }

  .status-wrap {
    gap: 12px;
  }

  .timer-ring-wrap,
  .timer-ring {
    width: 88px;
    height: 88px;
  }

  .timer-core {
    inset: 10px;
  }

  .timer-value {
    font-size: 1.55rem;
  }
}