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

html { user-select: none; -webkit-user-select: none; }

:root {
  --tbc-blue:   #0057a8;
  --tbc-yellow: #ffd600;
  --tbc-green:  #00b860;
  --bg:         #0a1628;
  --card-bg:    rgba(255,255,255,0.06);
  --card-border:rgba(255,255,255,0.12);
  --text:       #e8edf5;
  --muted:      #8ea3be;
  --radius:     1.25rem;
}

html {
  min-height: 100%;
}

body {
  min-height: 100%;
  font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  /* pas d'overflow:hidden — la page doit scroller sur petit écran */
}

/* ─── Background video ──────────────────────────────────────────────────────── */
.video-bg {
  position: fixed; inset: 0; z-index: 0;
}
.video-bg video {
  width: 100%; height: 100%; object-fit: cover;
  filter: brightness(0.25) saturate(0.6);
}
.video-bg.hidden { display: none; }

/* ─── Confetti canvas ───────────────────────────────────────────────────────── */
#confetti-canvas {
  position: fixed; inset: 0; z-index: 1;
  pointer-events: none;
  width: 100%; height: 100%;
}

/* ─── Card ──────────────────────────────────────────────────────────────────── */
.card {
  position: relative; z-index: 2;
  min-height: 100dvh;
  display: flex; flex-direction: column;
  align-items: center; justify-content: flex-start;
  padding: 2.5rem 1.25rem;
  gap: 1.25rem;
}

.logo img { height: 2.6rem; filter: drop-shadow(0 2px 12px rgba(0,0,0,0.4)); }

.title {
  font-size: clamp(1.2rem, 3vw, 1.6rem);
  font-weight: 700;
  text-align: center;
  letter-spacing: -0.02em;
}

.subtitle {
  color: var(--muted);
  text-align: center;
  font-size: 1rem;
  max-width: 32rem;
}

/* ─── State visibility ──────────────────────────────────────────────────────── */
.state { display: none; flex-direction: column; align-items: center; gap: 1.25rem; }
.state.active { display: flex; }

/* ─── Spinner ───────────────────────────────────────────────────────────────── */
.spinner {
  width: 2.5rem; height: 2.5rem;
  border: 3px solid rgba(255,255,255,0.15);
  border-top-color: var(--tbc-yellow);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Queue info panel ──────────────────────────────────────────────────────── */
.queue-info {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 2rem;
  width: 100%;
  max-width: 28rem;
  display: flex; flex-direction: column; gap: 1.5rem;
  backdrop-filter: blur(12px);
}

.queue-position {
  display: flex; flex-direction: column; align-items: center; gap: 0.25rem;
}

.label { font-size: 0.8rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }

.big-number {
  font-size: clamp(3rem, 10vw, 5rem);
  font-weight: 800;
  line-height: 1;
  background: linear-gradient(135deg, #fff 0%, var(--tbc-yellow) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}


/* ─── Wait time ─────────────────────────────────────────────────────────────── */
.wait-estimate { font-size: 0.9rem; color: var(--muted); text-align: center; }
.wait-estimate strong { color: var(--text); }

.group-hint {
  font-size: 0.85rem;
  color: var(--tbc-yellow);
  text-align: center;
  min-height: 1.2em;
}

/* ─── Flags row ─────────────────────────────────────────────────────────────── */
.flags-row {
  display: flex; gap: 0.5rem; flex-wrap: wrap; justify-content: center;
  max-width: 28rem;
}
.flags-row img {
  width: 2rem; height: 1.35rem; object-fit: cover; border-radius: 3px;
  opacity: 0.6; cursor: pointer;
  transition: transform 0.15s, opacity 0.15s, outline 0.1s;
}
.flags-row img:hover { opacity: 1; transform: scale(1.18); }
.flags-row img.flag-active {
  opacity: 1;
  outline: 2px solid var(--tbc-yellow);
  outline-offset: 2px;
  transform: scale(1.08);
}

/* ─── Ready state ───────────────────────────────────────────────────────────── */
.ready-icon { font-size: 4rem; animation: pop 0.4s cubic-bezier(0.34,1.56,0.64,1); }
@keyframes pop { from { transform: scale(0); } to { transform: scale(1); } }

.ready-title { font-size: 1.75rem; font-weight: 700; text-align: center; }
.ready-text  { font-size: 1rem; color: var(--muted); text-align: center; }
.ready-text strong { color: var(--tbc-yellow); font-size: 1.2em; }

/* ─── Error state ───────────────────────────────────────────────────────────── */
.error-text { color: #f87171; text-align: center; }
.btn-retry {
  padding: 0.6rem 1.75rem;
  background: var(--tbc-blue);
  color: #fff;
  border: none; border-radius: 99px;
  font-size: 1rem; cursor: pointer;
  transition: opacity 0.2s;
}
.btn-retry:hover { opacity: 0.85; }

/* ─── Status text ────────────────────────────────────────────────────────────── */
.status-text { color: var(--muted); font-size: 0.9rem; }

/* ─── Mini game ─────────────────────────────────────────────────────────────── */
.game-section {
  width: 100%;
  max-width: 36rem;
  display: flex; flex-direction: column; gap: 0.4rem;
}

.game-meta {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0 0.1rem;
}

.game-meta-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--tbc-yellow);
  opacity: 0.85;
}

.game-meta-scores {
  font-size: 0.72rem;
  color: var(--muted);
}

.game-meta-scores b {
  color: var(--text);
  font-family: 'Courier New', monospace;
  font-variant-numeric: tabular-nums;
  min-width: 2.5ch;
  display: inline-block;
  text-align: right;
}

#game-canvas {
  width: 100%;
  height: 165px;
  border-radius: 0.75rem;
  border: 1px solid var(--card-border);
  cursor: pointer;
  display: block;
  touch-action: manipulation;
  outline: none;
  background: #060e1c;
}

#game-canvas:focus-visible {
  outline: 2px solid var(--tbc-yellow);
  outline-offset: 2px;
}

/* ─── Responsive — mobile & petits écrans ───────────────────────────────────── */
@media (max-width: 400px) {
  .card { padding: 1.5rem 1rem; gap: 1rem; }
  .logo img { height: 2.2rem; }
  .queue-info { padding: 1.25rem; }
  #game-canvas { height: 140px; }
}

@media (max-height: 640px) {
  /* Paysage mobile ou téléphone court : on réduit sans rognage */
  .card { gap: 1rem; padding-top: 1.5rem; padding-bottom: 1.5rem; }
  .queue-info { gap: 1rem; }
  #game-canvas { height: 130px; }
}

/* Tablette portrait (≥ 600px) : on centre et on laisse scroller si besoin */
@media (min-width: 600px) {
  .card { padding: 3rem 2rem; }
}

