/* === Roseo - Global Styles === */
:root,
html[data-theme="dark"] {
  /* Dark (défaut) — contraste renforcé */
  --bg: #070712;
  --bg-glow: #2a1a5e;
  --card: #1a1a36;
  --surface: #222244;
  --surface-2: #2a2a52;
  --panel: rgba(19, 19, 41, 0.9);
  --panel-solid: #131329;
  --accent: #a78bfa;
  --accent2: #c4b5fd;
  --accent-strong: #8b5cf6;
  --text: #f8fafc;
  --muted: #cbd5e1;
  --muted-2: #94a3b8;
  --border: #4c4c78;
  --border-strong: #6d6da0;
  --danger: #f87171;
  --success: #4ade80;
  --success-soft: #86efac;
  --gold: #fbbf24;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  --header-bg: rgba(7, 7, 18, 0.92);
  --footer-bg: transparent;
  --toast-bg: rgba(26, 26, 54, 0.96);
  --overlay-soft: rgba(167, 139, 250, 0.10);
  --overlay-strong: rgba(139, 92, 246, 0.18);
  --title-from: #ffffff;
  --title-to: #a78bfa;
  --on-accent: #ffffff;
  --particle: 139, 92, 246;
  --nav-hover-text: #fff;
  --mixed-from: #102418;
  --brand-mark-to: rgba(19, 19, 41, 0.9);
  color-scheme: dark;
}

html[data-theme="light"] {
  --bg: #f4f1fb;
  --bg-glow: #ddd6fe;
  --card: #ffffff;
  --surface: #f8f7ff;
  --surface-2: #efeaff;
  --panel: #ffffff;
  --panel-solid: #ffffff;
  --accent: #7c3aed;
  --accent2: #6d28d9;
  --accent-strong: #5b21b6;
  --text: #1e1b2e;
  --muted: #4b5568;
  --muted-2: #6b7280;
  --border: #d4d0e8;
  --border-strong: #b7b0d6;
  --danger: #dc2626;
  --success: #16a34a;
  --success-soft: #15803d;
  --gold: #d97706;
  --shadow: 0 16px 40px rgba(49, 30, 102, 0.12);
  --header-bg: rgba(255, 255, 255, 0.92);
  --footer-bg: transparent;
  --toast-bg: rgba(255, 255, 255, 0.97);
  --overlay-soft: rgba(124, 58, 237, 0.08);
  --overlay-strong: rgba(124, 58, 237, 0.14);
  --title-from: #5b21b6;
  --title-to: #7c3aed;
  --on-accent: #ffffff;
  --particle: 124, 58, 237;
  --nav-hover-text: var(--accent-strong);
  --mixed-from: #dcfce7;
  --brand-mark-to: rgba(237, 233, 254, 0.95);
  color-scheme: light;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { background: var(--bg); color: var(--text); font-family: 'SF Pro Display', 'Inter', system-ui, sans-serif; overflow-x: hidden; }

/* Flash toasts (sans daisyUI / default.css) */
.roseo-flash {
  position: fixed;
  top: max(12px, env(safe-area-inset-top));
  right: 12px;
  left: 12px;
  z-index: 90;
  max-width: 420px;
  margin-left: auto;
  padding: 14px 40px 14px 16px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--toast-bg);
  box-shadow: var(--shadow);
  animation: cardIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}
@media (min-width: 480px) {
  .roseo-flash { left: auto; width: min(420px, calc(100vw - 24px)); }
}
.roseo-flash.is-info { border-color: rgba(167, 139, 250, 0.45); }
.roseo-flash.is-error {
  border-color: rgba(239, 68, 68, 0.5);
  background: rgba(46, 5, 22, 0.95);
}
.roseo-flash-title { font-weight: 800; margin-bottom: 4px; }
.roseo-flash-msg { color: var(--text); font-size: 0.92rem; line-height: 1.4; }
.roseo-flash-close {
  position: absolute;
  top: 8px;
  right: 10px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  padding: 4px 8px;
}
.roseo-flash-close:hover { color: var(--text); }

/* Social proof toasts (e‑commerce style activity) */
.social-proof-toast {
  position: fixed;
  left: max(12px, env(safe-area-inset-left));
  bottom: max(16px, env(safe-area-inset-bottom));
  z-index: 55;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: min(360px, calc(100vw - 24px));
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--toast-bg);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  transform: translateY(12px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease, transform 0.35s ease;
}
.social-proof-toast.is-visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.social-proof-toast[hidden] { display: none !important; }
.social-proof-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.55);
  animation: socialPulse 2s ease infinite;
  flex-shrink: 0;
}
@keyframes socialPulse {
  0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.45); }
  70% { box-shadow: 0 0 0 8px rgba(34, 197, 94, 0); }
  100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}
.social-proof-icon {
  font-size: 1.25rem;
  line-height: 1;
  flex-shrink: 0;
}
.social-proof-msg {
  font-size: 0.86rem;
  line-height: 1.35;
  font-weight: 600;
  color: var(--text);
}
@media (max-width: 520px) {
  .social-proof-toast {
    left: 50%;
    right: auto;
    transform: translate(-50%, 12px);
    max-width: calc(100vw - 20px);
  }
  .social-proof-toast.is-visible {
    transform: translate(-50%, 0);
  }
}
@media (prefers-reduced-motion: reduce) {
  .social-proof-toast { transition: none; }
  .social-proof-dot { animation: none; }
}

/* === Site header / navbar === */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  border-bottom: 1px solid var(--border);
  background: var(--header-bg);
  backdrop-filter: blur(14px);
}
.site-header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 10px 18px;
  padding-top: max(10px, env(safe-area-inset-top));
  padding-left: max(18px, env(safe-area-inset-left));
  padding-right: max(18px, env(safe-area-inset-right));
  display: flex;
  align-items: center;
  gap: 18px;
}
.nav-brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--accent2);
  font-weight: 800;
  font-size: 1.15rem;
  text-decoration: none;
  letter-spacing: -0.02em;
  flex-shrink: 0;
}
.nav-brand-mark {
  display: inline-flex;
  width: 18px;
  height: 28px;
  color: var(--accent2);
}
.nav-brand-mark svg { width: 100%; height: 100%; }
.nav-brand-text { line-height: 1; }
.nav-primary {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
  min-width: 0;
}
.nav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}
.nav-link {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 8px 12px;
  border-radius: 10px;
  transition: color 0.15s, background 0.15s;
  white-space: nowrap;
}
.nav-link:hover { color: var(--nav-hover-text); background: var(--overlay-soft); }
.nav-link.is-active {
  color: var(--text);
  background: var(--overlay-strong);
}
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.15s;
  flex-shrink: 0;
}
.theme-toggle:hover {
  border-color: var(--accent);
  background: var(--overlay-soft);
  transform: translateY(-1px);
}
.theme-toggle-icon { font-size: 1.1rem; line-height: 1; }
.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: inline; }
html[data-theme="light"] .theme-toggle .icon-sun { display: inline; }
html[data-theme="light"] .theme-toggle .icon-moon { display: none; }
.theme-toggle-menu {
  width: 100%;
  justify-content: flex-start;
  gap: 10px;
  padding: 10px 12px;
  height: auto;
  margin: 4px 0;
}
.theme-toggle-label { font-size: 0.9rem; font-weight: 700; }
.nav-link-muted { font-weight: 500; }
.nav-link-secondary { opacity: 0.9; }
.nav-btn {
  background: linear-gradient(135deg, var(--accent), #7c3aed);
  color: #fff;
  padding: 8px 14px;
  border-radius: 10px;
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 700;
  transition: transform 0.15s, box-shadow 0.15s, opacity 0.15s;
  white-space: nowrap;
  box-shadow: 0 4px 14px rgba(139, 92, 246, 0.25);
}
.nav-btn:hover {
  opacity: 0.95;
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(139, 92, 246, 0.35);
}

/* Mobile menu */
.nav-menu { display: none; position: relative; margin-left: auto; }
.nav-menu-toggle {
  list-style: none;
  cursor: pointer;
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.nav-menu-toggle::-webkit-details-marker { display: none; }
.nav-menu-bars,
.nav-menu-bars::before,
.nav-menu-bars::after {
  display: block;
  width: 16px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  position: relative;
  transition: transform 0.2s, opacity 0.2s;
}
.nav-menu-bars::before,
.nav-menu-bars::after {
  content: "";
  position: absolute;
  left: 0;
}
.nav-menu-bars::before { top: -5px; }
.nav-menu-bars::after { top: 5px; }
.nav-menu[open] .nav-menu-bars { background: transparent; }
.nav-menu[open] .nav-menu-bars::before { top: 0; transform: rotate(45deg); }
.nav-menu[open] .nav-menu-bars::after { top: 0; transform: rotate(-45deg); }
.nav-menu-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: min(280px, calc(100vw - 28px));
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
  z-index: 50;
}
.nav-menu-link {
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  padding: 12px 14px;
  border-radius: 12px;
}
.nav-menu-link:hover,
.nav-menu-link.is-active {
  background: rgba(139, 92, 246, 0.16);
  color: #fff;
}
.nav-menu-divider {
  height: 1px;
  background: var(--border);
  margin: 6px 8px;
}
.nav-menu-cta {
  margin-top: 4px;
  text-align: center;
  background: linear-gradient(135deg, var(--accent), #7c3aed);
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  padding: 12px 14px;
  border-radius: 12px;
}

@media (max-width: 820px) {
  .nav-primary,
  .nav-actions { display: none; }
  .nav-menu { display: block; }
}

/* === Auth pages === */
.auth-container { min-height: 80dvh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.auth-card { background: var(--card); border: 1px solid var(--border); border-radius: 20px; padding: 36px 32px; max-width: 400px; width: 100%; }
.auth-card h2 { font-size: 1.5rem; margin-bottom: 12px; text-align: center; }
.auth-back { color: var(--muted); text-decoration: none; font-size: 0.85rem; display: block; margin-bottom: 16px; }
.auth-back:hover { color: var(--accent2); }
.auth-brand { text-align: center; margin-bottom: 8px; }
.auth-brand-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 52px; height: 52px; border-radius: 16px;
  background: linear-gradient(135deg, var(--overlay-strong), var(--brand-mark-to));
  border: 1px solid var(--border);
  color: var(--accent2); font-size: 1.4rem;
}
.auth-field { margin-bottom: 16px; }
.auth-field label { display: block; font-size: 0.8rem; color: var(--muted); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 1px; }
.auth-field input { width: 100%; padding: 12px 16px; font-size: 1rem; border: 2px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text); outline: none; }
.auth-field input:focus { border-color: var(--accent); }
.auth-field-hint { color: var(--muted); font-size: 0.78rem; margin-top: 6px; line-height: 1.4; }
.field-error { color: var(--danger); font-size: 0.78rem; margin-top: 4px; }
.auth-btn { width: 100%; padding: 14px; background: linear-gradient(135deg, var(--accent), #7c3aed); color: #fff; border: none; border-radius: 12px; font-size: 1.05rem; font-weight: 700; cursor: pointer; margin-top: 8px; min-height: 48px; }
.auth-btn:hover { opacity: 0.95; }
.auth-btn:disabled { opacity: 0.55; cursor: wait; }
.auth-btn-soft {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  box-shadow: none;
}
.auth-btn-soft:hover {
  border-color: var(--accent);
  color: var(--accent2);
  opacity: 1;
}
.auth-lead {
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
  margin: 0 0 20px;
  word-break: break-word;
  line-height: 1.45;
}
.auth-email-highlight { color: var(--accent2); font-weight: 700; }
.auth-checklist {
  list-style: none;
  display: flex; flex-direction: column; gap: 10px;
  margin: 0 0 18px; padding: 0;
}
.auth-checklist li {
  position: relative;
  padding: 10px 12px 10px 36px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  font-size: 0.88rem;
  line-height: 1.4;
}
.auth-checklist li::before {
  content: "→";
  position: absolute; left: 12px; top: 10px;
  color: var(--accent2); font-weight: 800;
}
.auth-hint {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.45;
  margin: 0 0 14px;
}
.auth-hint-center { text-align: center; margin-top: 16px; }
.auth-resend-form { margin-top: 4px; }
.auth-legal-note {
  text-align: center;
  color: var(--muted);
  font-size: 0.75rem;
  margin-top: 14px;
  line-height: 1.4;
}
.auth-legal-note a { color: var(--accent2); }
.auth-info {
  color: var(--success);
  font-size: 0.85rem;
  margin: 8px 0 4px;
  text-align: center;
}
.auth-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 24px 0;
}
.auth-card-wide { max-width: 440px; }
.auth-switch { text-align: center; margin-top: 20px; color: var(--muted); font-size: 0.85rem; }
.auth-switch a { color: var(--accent2); }

/* === Home page === */
.home-root {
  min-height: 0;
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at 50% 30%, var(--bg-glow) 0%, var(--bg) 65%);
  position: relative;
  padding: 20px;
  width: 100%;
}
#bg-canvas { position: fixed; inset: 0; z-index: 0; pointer-events: none; }

.home-card {
  position: relative; z-index: 1;
  background: var(--card); border: 1px solid var(--border);
  border-radius: 32px; padding: 48px 40px 36px; max-width: 460px; width: 100%;
  backdrop-filter: blur(30px); box-shadow: var(--shadow);
  animation: cardIn 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}
.home-card-wide { max-width: 560px; }
@keyframes cardIn {
  from { opacity: 0; transform: translateY(30px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.logo-section { text-align: center; margin-bottom: 28px; }
.reed-icon { width: 52px; height: 84px; margin: 0 auto 12px; color: var(--accent2); animation: sway 3s ease-in-out infinite; }
@keyframes sway { 0%,100% { transform: rotate(-3deg); } 50% { transform: rotate(3deg); } }

.app-title {
  font-size: clamp(2.6rem, 8vw, 3.4rem); font-weight: 900;
  background: linear-gradient(135deg, var(--title-from), var(--title-to));
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.04em; line-height: 1;
}
.home-lead {
  color: var(--muted);
  font-size: 1.05rem;
  margin-top: 12px;
  line-height: 1.4;
  max-width: 28ch;
  margin-left: auto;
  margin-right: auto;
}
.tagline {
  color: var(--accent2); font-style: italic;
  font-size: 1rem; margin-top: 12px;
  letter-spacing: 0.02em;
}
.author { color: var(--muted); font-size: 0.8rem; margin-top: 4px; }
.actions-stack { display: flex; flex-direction: column; gap: 18px; }

/* Homepage dual paths */
.home-paths {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 22px;
}
.home-path {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  gap: 6px;
  padding: 18px 16px;
  min-height: 168px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s, background 0.2s;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.home-path:hover:not(:disabled) {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: 0 10px 28px rgba(139, 92, 246, 0.22);
}
.home-path:active:not(:disabled) { transform: scale(0.98); }
.home-path:disabled,
.home-path.is-disabled {
  opacity: 0.55;
  cursor: wait;
  pointer-events: none;
}
.home-path-friends {
  background: linear-gradient(160deg, rgba(139, 92, 246, 0.22), var(--surface) 55%);
  border-color: rgba(167, 139, 250, 0.35);
}
.home-path-solo {
  background: linear-gradient(160deg, rgba(34, 197, 94, 0.12), var(--surface) 55%);
}
.home-path-kicker {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent2);
}
.home-path-solo .home-path-kicker { color: var(--success); }
.home-path-title {
  font-size: 1.2rem;
  font-weight: 900;
  line-height: 1.2;
  letter-spacing: -0.02em;
}
.home-path-desc {
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.4;
  flex: 1;
}
.home-path-cta {
  margin-top: 8px;
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--accent2);
}
.home-path-solo .home-path-cta { color: var(--success-soft); }

.home-join {
  padding-top: 4px;
  margin-bottom: 8px;
}
.home-join-label {
  text-align: center;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 600;
  margin-bottom: 10px;
}
.home-join .btn-join {
  padding: 0 18px;
  font-weight: 800;
  font-size: 0.9rem;
  min-width: 108px;
  justify-content: center;
}
.home-more {
  text-align: center;
  margin-top: 8px;
}
.home-guest-note {
  text-align: center;
  color: var(--muted);
  font-size: 0.78rem;
  margin: 4px 0 0;
  opacity: 0.85;
}

.btn-create {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  width: 100%; padding: 18px 24px; border: none; border-radius: 18px;
  background: linear-gradient(135deg, var(--accent), #7c3aed);
  color: white; font-size: 1.15rem; font-weight: 800; cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 8px 30px rgba(139,92,246,0.45);
  letter-spacing: 0.02em;
}
.btn-create:hover {
  transform: translateY(-4px) scale(1.01);
  box-shadow: 0 14px 40px rgba(139,92,246,0.6);
  background: linear-gradient(135deg, #9f67f8, #8b5cf6);
}
.btn-create:active { transform: translateY(-1px) scale(0.995); }

.divider {
  display: flex; align-items: center; gap: 14px;
  color: var(--muted); font-size: 0.85rem;
}
.divider::before, .divider::after {
  content: ''; flex: 1; height: 1px;
  background: linear-gradient(90deg, transparent, var(--border), transparent);
}

.join-form { width: 100%; }
.code-input-group {
  display: flex; gap: 0;
  border: 2px solid var(--border);
  border-radius: 18px; overflow: hidden;
  transition: all 0.3s;
  background: var(--surface);
}
.code-input-group:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(139,92,246,0.15), 0 0 24px rgba(139,92,246,0.2);
}
.code-input-group input {
  flex: 1; padding: 18px 20px;
  font-size: 1.4rem; font-weight: 800;
  letter-spacing: 10px; text-align: center;
  background: transparent; border: none;
  color: var(--text); outline: none;
  text-transform: uppercase;
  font-family: 'SF Mono', 'JetBrains Mono', monospace;
  min-width: 0;
}
.code-input-group input::placeholder {
  color: var(--muted-2);
  letter-spacing: 6px;
  font-size: 1.1rem;
  font-weight: 500;
}
.btn-join {
  padding: 0 26px;
  background: linear-gradient(135deg, var(--accent), #7c3aed);
  border: none; color: white; cursor: pointer;
  display: flex; align-items: center;
  transition: all 0.25s;
  font-weight: 700;
}
.btn-join:hover {
  background: linear-gradient(135deg, #9f67f8, #8b5cf6);
}
.btn-join:disabled {
  background: var(--surface);
  color: var(--muted-2);
  cursor: not-allowed;
}

.error-msg { color: var(--danger); text-align: center; margin: 14px 0; font-size: 0.85rem; }
.my-quizzes-link { display: block; text-align: center; color: var(--muted); margin-top: 16px; font-size: 0.85rem; }
.my-quizzes-link:hover { color: var(--accent2); }

/* Create page */
.create-page {
  position: relative; z-index: 1;
  max-width: 600px; width: 100%;
  margin: 0 auto; padding: 28px 24px;
  animation: cardIn 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}
.create-header {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 32px;
}
.create-header h1 {
  font-size: clamp(1.45rem, 4vw, 1.75rem);
  font-weight: 900;
  letter-spacing: -0.02em;
  line-height: 1.2;
}
.back-link {
  color: var(--muted); text-decoration: none;
  font-size: 0.88rem; transition: all 0.2s;
  padding: 6px 12px; border-radius: 10px;
}
.back-link:hover {
  color: var(--accent2);
  background: rgba(167, 139, 250, 0.08);
}

/* Setup sections */
.setup-section { margin-bottom: 28px; }
.setup-label {
  display: block;
  font-size: 0.8rem;
  color: var(--accent2);
  text-transform: uppercase;
  letter-spacing: 1.2px;
  margin-bottom: 12px;
  font-weight: 800;
}

/* Mode cards */
.mode-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.mode-card {
  display: flex; flex-direction: column; align-items: center;
  gap: 6px; padding: 20px 12px;
  border: 2px solid var(--border-strong);
  border-radius: 18px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  text-align: center;
}
.mode-card:hover {
  border-color: var(--accent);
  color: var(--text);
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(139,92,246,0.2);
  background: var(--surface-2);
}
.mode-card.active {
  border-color: var(--accent);
  background: linear-gradient(135deg, var(--surface-2), var(--overlay-strong));
  color: var(--text);
  box-shadow: 0 8px 30px rgba(139,92,246,0.28);
  transform: translateY(-2px);
}
.mode-card-icon { font-size: 1.9rem; line-height: 1; }
.mode-card-label { font-size: 0.9rem; font-weight: 800; color: inherit; }
.mode-card-sub { font-size: 0.75rem; color: var(--muted); }

/* Question count selector */
.count-selector { display: flex; gap: 10px; }
.count-btn {
  flex: 1; padding: 14px 10px;
  border: 2px solid var(--border-strong);
  border-radius: 14px;
  background: var(--surface);
  color: var(--text);
  font-size: 1.2rem; font-weight: 800;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
.count-btn:hover {
  border-color: var(--accent);
  color: var(--text);
  background: var(--surface-2);
  transform: translateY(-2px);
}
.count-btn.active {
  border-color: var(--accent);
  background: linear-gradient(135deg, var(--surface-2), var(--overlay-strong));
  color: var(--text);
  box-shadow: 0 6px 20px rgba(139,92,246,0.25);
}

/* Random tile (surprise me) */
.random-tile {
  display: flex; flex-direction: column; align-items: center;
  gap: 6px; width: 100%;
  padding: 24px; margin-bottom: 14px;
  border: 2px solid var(--accent);
  border-radius: 20px;
  background: linear-gradient(135deg, var(--surface-2), var(--overlay-strong));
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  text-align: center;
}
.random-tile:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(139,92,246,0.4);
  border-color: var(--accent2);
}
.random-tile:active { transform: translateY(-1px) scale(0.99); }
.random-tile-icon { font-size: 2.4rem; }
.random-tile-label { font-size: 1.1rem; font-weight: 800; color: var(--text); }
.random-tile-sub { font-size: 0.8rem; color: var(--accent2); }
.mixed-tile {
  border-color: rgba(74, 222, 128, 0.45);
  background: linear-gradient(135deg, var(--mixed-from), var(--surface-2));
}
.mixed-tile .random-tile-sub { color: var(--success-soft); }

.theme-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.theme-section-head .setup-label { margin-bottom: 0; }
.theme-selection-hint {
  font-size: 0.78rem;
  color: var(--accent2);
  font-weight: 600;
}
.theme-quick-actions {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
}
.theme-quick-btn {
  flex: 1;
  padding: 12px 14px;
  border: 2px solid var(--border-strong);
  border-radius: 14px;
  background: var(--surface);
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}
.theme-quick-btn:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--text);
}
.theme-quick-btn.active {
  border-color: rgba(74, 222, 128, 0.55);
  background: linear-gradient(135deg, var(--mixed-from), var(--surface-2));
  color: var(--text);
}
.theme-quick-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.category-tile.is-selected {
  border-color: var(--accent);
  background: linear-gradient(180deg, var(--surface), var(--card));
  box-shadow: 0 0 0 1px var(--accent), 0 8px 24px rgba(139, 92, 246, 0.18);
}
.category-tile .cat-check {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(139, 92, 246, 0.35);
  z-index: 1;
}
.create-start-bar {
  position: sticky;
  bottom: 12px;
  margin-top: 8px;
  z-index: 2;
}
.create-start-btn {
  width: 100%;
  min-height: 54px;
  font-size: 1.05rem;
}
.create-start-btn.is-disabled,
.create-start-btn:disabled {
  opacity: 0.72;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
  filter: saturate(0.85);
}

/* Meta-category grid */
.meta-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.meta-tile {
  display: flex; flex-direction: column; align-items: center;
  gap: 6px; padding: 22px 12px;
  border: 2px solid var(--border);
  border-radius: 18px;
  background: var(--surface);
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  text-align: center;
}
.meta-tile:hover {
  border-color: var(--accent);
  background: linear-gradient(135deg, var(--surface-2), var(--surface-2));
  transform: translateY(-3px);
  box-shadow: 0 8px 28px rgba(139,92,246,0.2);
}
.meta-tile:active { transform: translateY(-1px) scale(0.99); }
.meta-icon { font-size: 2rem; line-height: 1; }
.meta-name { font-size: 0.88rem; font-weight: 800; }
.meta-count {
  font-size: 0.7rem;
  color: var(--muted);
  background: var(--border);
  padding: 3px 10px;
  border-radius: 10px;
  font-weight: 600;
}

/* Category grid (sub-categories inside a meta) */
.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
  gap: 12px;
}
.category-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 16px 12px 14px;
  min-height: 148px;
  border: 1.5px solid var(--border);
  border-radius: 18px;
  background: var(--card);
  color: var(--text);
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.2s, box-shadow 0.2s, background 0.2s;
  text-align: center;
  text-decoration: none;
  box-shadow: 0 2px 10px rgba(49, 30, 102, 0.06);
  position: relative;
}
.category-tile:hover {
  border-color: var(--accent);
  background: var(--surface);
  transform: translateY(-3px);
  box-shadow: 0 10px 28px rgba(139, 92, 246, 0.16);
}
.category-tile:active { transform: translateY(-1px) scale(0.98); }
.cat-icon-wrap {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, var(--overlay-strong), var(--surface-2));
  border: 1px solid var(--border);
  flex-shrink: 0;
}
.cat-icon {
  font-size: 1.55rem;
  line-height: 1;
  display: block;
}
.cat-name {
  font-size: 0.9rem;
  font-weight: 800;
  line-height: 1.25;
  color: var(--text);
  letter-spacing: -0.01em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  max-width: 100%;
}
.cat-count {
  margin-top: auto;
  font-size: 0.72rem;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 4px 10px;
  border-radius: 999px;
  font-weight: 700;
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.cat-count.is-soon {
  color: var(--muted-2);
  font-style: italic;
  font-weight: 600;
}
.category-tile.is-selected .cat-icon-wrap {
  border-color: var(--accent);
  background: linear-gradient(160deg, var(--overlay-strong), var(--surface));
  box-shadow: 0 4px 14px rgba(139, 92, 246, 0.2);
}
.category-tile.is-selected .cat-name {
  color: var(--accent-strong);
}
.category-tile.is-selected .cat-count {
  color: var(--accent2);
  border-color: color-mix(in srgb, var(--accent) 35%, var(--border));
  background: var(--overlay-soft);
}

/* Category header (inside meta) */
.category-header { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.cat-back { background: none; border: none; color: var(--muted); font-size: 0.85rem; cursor: pointer; transition: color 0.2s; }
.cat-back:hover { color: var(--accent2); }
.cat-title { font-size: 1.1rem; font-weight: 700; }

.no-quiz-msg { text-align: center; padding: 30px 20px; color: var(--muted); }

/* === Room page === */
.room-root {
  max-width: 680px; margin: 0 auto;
  padding: 24px; min-height: 100dvh;
}
.room-topbar {
  display: flex; justify-content: space-between;
  align-items: center; margin-bottom: 24px;
}
.room-code-box {
  display: flex; align-items: center; gap: 12px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px; padding: 12px 18px;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
}
.room-code-box:hover {
  border-color: var(--accent);
  box-shadow: 0 4px 20px rgba(139,92,246,0.2);
  transform: translateY(-1px);
}
.code-label {
  font-size: 0.68rem; color: var(--muted);
  letter-spacing: 2.5px; font-weight: 600;
}
.code-val {
  font-size: 1.4rem; font-weight: 900;
  letter-spacing: 6px; color: var(--text);
  font-family: 'SF Mono', 'JetBrains Mono', monospace;
}
.copy-icon { font-size: 0.9rem; }
.question-progress {
  background: linear-gradient(135deg, var(--accent), #7c3aed);
  color: #fff;
  padding: 8px 18px;
  border-radius: 24px;
  font-weight: 800;
  font-size: 0.9rem;
  box-shadow: 0 4px 16px rgba(139,92,246,0.35);
}

/* Join screen */
.join-screen { display: flex; align-items: center; justify-content: center; min-height: 70dvh; padding: 20px; }
.join-card {
  text-align: center; background: var(--card);
  border: 1px solid var(--border);
  border-radius: 28px;
  padding: 40px 32px;
  width: 100%;
  max-width: 420px;
  animation: cardIn 0.5s ease-out;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4), 0 0 80px rgba(139, 92, 246, 0.1);
}
.join-quiz-info { margin-bottom: 24px; padding: 14px 18px; background: linear-gradient(135deg, var(--surface-2), var(--surface)); border-radius: 14px; border: 1px solid var(--border); }
.join-quiz-title { display: block; font-size: 1rem; font-weight: 800; color: var(--accent2); }
.join-quiz-meta { font-size: 0.8rem; color: var(--muted); margin-top: 4px; }
.join-subtitle { color: var(--muted); font-size: 0.95rem; margin: -8px 0 24px; line-height: 1.5; }
.selected-avatar-preview { display: flex; flex-direction: column; align-items: center; gap: 6px; margin-bottom: 28px; }
.preview-emoji {
  font-size: 3rem;
  line-height: 1;
  padding: 12px;
  background: var(--surface);
  border-radius: 20px;
  border: 2px solid var(--border);
  animation: gentleFloat 3s ease-in-out infinite;
}
@keyframes gentleFloat {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-6px); }
}
.preview-label { font-size: 0.75rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.1em; }
.join-card h2 { margin-bottom: 10px; font-size: 1.6rem; font-weight: 800; }

/* Avatar picker */
.avatar-picker { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-bottom: 28px; }
.avatar-option {
  width: 56px; height: 56px;
  border-radius: 16px;
  border: 2px solid var(--border);
  background: var(--surface);
  font-size: 1.8rem;
  cursor: pointer;
  transition: all 0.2s ease-out;
  display: flex;
  align-items: center;
  justify-content: center;
}
.avatar-option:hover { transform: translateY(-3px) scale(1.1); border-color: var(--av-color); box-shadow: 0 6px 20px rgba(139, 92, 246, 0.2); }
.avatar-option.active {
  border-color: var(--av-color);
  background: var(--av-color);
  box-shadow: 0 0 20px var(--av-color), 0 4px 24px var(--av-color);
  transform: translateY(-2px) scale(1.15);
}

.name-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.name-form input {
  width: 100%;
  padding: 16px 20px;
  font-size: 16px; /* évite le zoom iOS */
  border: 2px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  color: var(--text);
  outline: none;
  transition: all 0.3s;
  text-align: center;
}
.name-form input::placeholder {
  color: var(--muted-2);
  font-style: italic;
}
.name-form input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.15), 0 0 20px rgba(139, 92, 246, 0.2);
}
.btn-join-submit {
  padding: 16px 28px;
  background: linear-gradient(135deg, var(--accent), #7c3aed);
  color: #fff;
  border: none;
  border-radius: 16px;
  font-weight: 800;
  font-size: 1.1rem;
  cursor: pointer;
  transition: all 0.25s ease-out;
  box-shadow: 0 4px 20px rgba(139, 92, 246, 0.4);
  letter-spacing: 0.02em;
}
.btn-join-submit:hover:not(:disabled) {
  transform: translateY(-3px);
  box-shadow: 0 8px 32px rgba(139, 92, 246, 0.6);
  background: linear-gradient(135deg, #9f67f8, #8b5cf6);
}
.btn-join-submit:active:not(:disabled) {
  transform: translateY(-1px);
}
.btn-join-submit:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  box-shadow: none;
}

/* Lobby */
.lobby { text-align: center; padding-top: 24px; }
.lobby-quiz-banner {
  display: flex; flex-direction: column;
  gap: 6px; align-items: center;
  margin-bottom: 28px; padding: 18px 24px;
  background: linear-gradient(135deg, var(--surface-2), var(--card));
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.3);
}
.lobby-quiz-name { font-size: 1.2rem; font-weight: 800; color: var(--accent2); }
.lobby-quiz-count { font-size: 0.85rem; color: var(--muted); }
.waiting-indicator {
  display: flex; justify-content: center; gap: 8px;
  margin-bottom: 18px;
}
.waiting-indicator .dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 1.4s ease-in-out infinite;
}
.waiting-indicator .dot:nth-child(2) { animation-delay: 0.2s; }
.waiting-indicator .dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes pulse {
  0%,80%,100% { opacity: 0.3; transform: scale(0.8); }
  40% { opacity: 1; transform: scale(1.3); }
}

.lobby-title { font-size: 1.4rem; margin-bottom: 6px; font-weight: 800; }
.player-count-big {
  font-size: 2.8rem; font-weight: 900;
  color: var(--accent2);
  margin: 10px 0 24px;
}
.player-count-sep {
  color: var(--muted);
  margin: 0 6px;
  font-weight: 400;
}

.player-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 14px; margin-bottom: 36px;
}
.player-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px 10px;
  text-align: center;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  animation: popIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes popIn {
  from { opacity: 0; transform: scale(0.85); }
  to { opacity: 1; transform: scale(1); }
}
.player-card:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,0,0,0.3); }
.player-avatar {
  width: 50px; height: 50px;
  border-radius: 50%;
  margin: 0 auto 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 1.3rem;
  color: #fff;
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
}
.player-card-name {
  font-size: 0.88rem;
  font-weight: 700;
  display: block;
}
.player-card-empty {
  opacity: 0.45;
  border-style: dashed;
}
.player-avatar-empty {
  background: var(--surface) !important;
  color: var(--muted);
  font-size: 1.4rem;
}
.player-card-name-empty {
  color: var(--muted);
  font-style: italic;
}
.player-disconnected { opacity: 0.5; }
.player-disconnected:hover { opacity: 0.7; }

/* Connection status dots */
.player-avatar-wrapper {
  position: relative;
  display: inline-block;
  margin: 0 auto 10px;
}
.conn-dot {
  position: absolute; bottom: -3px; right: -3px;
  width: 14px; height: 14px;
  border-radius: 50%;
  border: 3px solid var(--card);
  transition: background 0.3s;
}
.conn-dot-sm {
  display: inline-block; width: 7px; height: 7px;
  border-radius: 50%;
  margin-right: 5px;
  flex-shrink: 0;
  vertical-align: middle;
  transition: background 0.3s;
}
.conn-online { background: #22c55e; }
.conn-offline { background: #6b7280; }
.you-badge {
  background: var(--accent);
  color: #fff;
  font-size: 0.62rem;
  padding: 2px 7px;
  border-radius: 6px;
  margin-left: 5px;
  font-weight: 700;
}

.btn-start-game {
  padding: 18px 56px;
  background: linear-gradient(135deg, var(--accent), #7c3aed);
  color: #fff;
  border: none;
  border-radius: 18px;
  font-size: 1.2rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 8px 30px rgba(139,92,246,0.4);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
.btn-start-game:hover:not(:disabled) {
  transform: translateY(-3px);
  box-shadow: 0 12px 40px rgba(139,92,246,0.55);
  background: linear-gradient(135deg, #9f67f8, #8b5cf6);
}
.btn-start-game:active:not(:disabled) {
  transform: translateY(-1px);
}
.btn-start-game:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Countdown */
.countdown-overlay {
  position: fixed; inset: 0;
  background: radial-gradient(ellipse at 50% 30%, var(--surface-2) 0%, var(--bg) 60%);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  z-index: 100;
}
.countdown-number {
  font-size: 9rem;
  font-weight: 900;
  background: linear-gradient(135deg, var(--title-from), var(--title-to));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: countBounce 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes countBounce {
  0% { transform: scale(2.2); opacity: 0; }
  60% { transform: scale(0.92); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}
.countdown-overlay p {
  color: var(--muted);
  font-size: 1.3rem;
  margin-top: 20px;
}

/* Quiz playing — immersion famille */
.room-root.is-immersive,
.room-root.is-playing {
  max-width: 720px;
  width: 100%;
  min-height: 100dvh;
  padding: 8px 12px max(12px, env(safe-area-inset-bottom));
  background: radial-gradient(ellipse at 50% 0%, var(--surface-2) 0%, var(--bg) 55%);
  overflow-x: clip;
}
.room-topbar-play {
  margin-bottom: 10px;
  gap: 10px;
  flex-wrap: nowrap;
}
.play-hud-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}
.play-progress {
  background: linear-gradient(135deg, var(--accent), #7c3aed);
  color: #fff;
  font-weight: 800;
  font-size: 0.85rem;
  padding: 8px 12px;
  border-radius: 999px;
  box-shadow: 0 4px 14px rgba(139, 92, 246, 0.35);
  white-space: nowrap;
}
.play-my-score {
  color: var(--accent2);
  font-weight: 800;
  font-size: 0.95rem;
  white-space: nowrap;
}

.play-stage {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  min-height: calc(100dvh - 72px);
}

.score-rail {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x proximity;
  padding: 4px 2px 8px;
  margin: 0 -2px;
  scrollbar-width: none;
}
.score-rail::-webkit-scrollbar { display: none; }

.score-chip {
  flex: 0 0 auto;
  scroll-snap-align: start;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 132px;
  max-width: 180px;
  padding: 8px 10px;
  border-radius: 16px;
  background: var(--panel);
  border: 1px solid var(--border);
  transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s, background 0.25s;
}
.score-chip.is-you {
  border-color: var(--accent2);
  box-shadow: 0 0 0 1px rgba(167, 139, 250, 0.35), 0 6px 18px rgba(139, 92, 246, 0.2);
  background: linear-gradient(135deg, var(--overlay-strong), var(--panel));
}
.score-chip.is-leader:not(.is-you) {
  border-color: rgba(245, 158, 11, 0.45);
}
.score-chip.has-answered {
  border-color: rgba(34, 197, 94, 0.45);
}
.score-chip.flash-correct {
  animation: chipFlashOk 0.7s ease;
}
.score-chip.flash-wrong {
  animation: chipFlashKo 0.7s ease;
}
@keyframes chipFlashOk {
  0%, 100% { background: var(--panel); }
  35% { background: rgba(34, 197, 94, 0.28); }
}
@keyframes chipFlashKo {
  0%, 100% { background: var(--panel); }
  35% { background: rgba(239, 68, 68, 0.25); }
}
.score-chip-rank {
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--muted);
  width: 18px;
  flex-shrink: 0;
}
.score-chip.is-leader .score-chip-rank { color: var(--gold); }
.score-chip-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 1.05rem;
  color: #fff;
  font-weight: 800;
  flex-shrink: 0;
}
.score-chip-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
  gap: 1px;
}
.score-chip-name {
  font-size: 0.82rem;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.score-chip-pts {
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--accent2);
}
.score-chip-done {
  color: var(--success);
  font-weight: 900;
  font-size: 1rem;
  flex-shrink: 0;
}

.quiz-play {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  padding-top: 0;
  gap: 10px;
}
.play-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}
.play-timer-row { width: 100%; }
.play-timer {
  position: relative;
  height: 36px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.play-timer-bar {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  background: linear-gradient(90deg, var(--accent), #7c3aed);
  transition: width 1s linear, background 0.3s;
  border-radius: 999px;
}
.play-timer.urgency .play-timer-bar {
  background: linear-gradient(90deg, #ef4444, #f97316);
}
.play-timer-num {
  position: relative;
  z-index: 1;
  font-weight: 900;
  font-size: 1rem;
  color: #fff;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.55);
}
.play-timer.urgency .play-timer-num {
  color: #fff;
  animation: urgentPulse 0.5s ease-in-out infinite;
}
.play-reactions {
  margin-top: auto;
  padding-top: 4px;
  padding-bottom: env(safe-area-inset-bottom);
}

.circular-timer {
  position: relative;
  width: 110px;
  height: 110px;
  margin-bottom: 24px;
}
.circular-timer svg {
  width: 100%;
  height: 100%;
}
.timer-circle {
  transition: stroke-dashoffset 1s linear, stroke 0.3s;
}
.timer-number {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.3rem;
  font-weight: 900;
  color: #fff;
}
.timer-number.urgency {
  color: var(--danger);
  animation: urgentPulse 0.5s ease-in-out infinite;
}
.timer-number.timer-waiting {
  color: var(--gold);
  animation: waitingPulse 0.8s ease-in-out infinite;
}
@keyframes urgentPulse {
  0%,100% { transform: scale(1); }
  50% { transform: scale(1.18); }
}
@keyframes waitingPulse {
  0%,100% { opacity: 0.4; }
  50% { opacity: 1; }
}

/* === Waiting screen (between questions / rejoin) === */
.waiting-screen {
  text-align: center;
  padding-top: 8px;
  animation: cardIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
.waiting-center {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 12px;
}
.waiting-screen h2 {
  font-size: 1.45rem;
  margin: 18px 0 10px;
  font-weight: 800;
}
.waiting-sub {
  color: var(--muted);
  font-size: 0.95rem;
}
.waiting-screen .waiting-indicator {
  margin-bottom: 10px;
}

/* === Game in progress banner (join screen) === */
.game-in-progress-banner {
  display: flex; align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 20px;
  margin-bottom: 20px;
  background: linear-gradient(135deg, #2a1a00, #1a1000);
  border: 1px solid var(--gold);
  border-radius: 16px;
  color: var(--gold);
  font-size: 0.95rem;
  font-weight: 700;
  box-shadow: 0 6px 24px rgba(245,158,11,0.15);
}
.pulse-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--gold);
  animation: pulse 1.4s ease-in-out infinite;
}

.question-block {
  text-align: center;
  margin-bottom: 4px;
}
.question-num {
  font-size: 0.8rem;
  color: var(--accent2);
  text-transform: uppercase;
  letter-spacing: 4px;
  font-weight: 700;
}
.question-text {
  font-size: clamp(1.2rem, 4.5vw, 1.55rem);
  font-weight: 800;
  margin-top: 0;
  line-height: 1.35;
}

.choices {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}
.choice-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  border: 2px solid var(--border);
  border-radius: 16px;
  background: var(--card);
  color: var(--text);
  font-size: 1.05rem;
  cursor: pointer;
  text-align: left;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  width: 100%;
  min-height: 56px;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.choice-btn:hover:not(:disabled) {
  border-color: var(--accent);
  background: var(--surface-2);
  box-shadow: 0 6px 20px rgba(0,0,0,0.3);
}
.choice-btn:active:not(:disabled) {
  transform: scale(0.98);
}
.choice-btn:disabled { cursor: default; }
.choice-btn.selected-correct {
  border-color: var(--success);
  background: #052e16;
  animation: flashGreen 0.5s;
}
.choice-btn.selected-wrong {
  border-color: var(--danger);
  background: #2e0516;
  animation: shake 0.4s;
}
.choice-btn.reveal-correct {
  border-color: var(--success);
  background: #052e16;
}
@keyframes flashGreen {
  0% { background: var(--success); }
  100% { background: #052e16; }
}
@keyframes shake {
  0%,100% { transform: translateX(0); }
  25% { transform: translateX(-8px); }
  75% { transform: translateX(8px); }
}
.choice-letter {
  background: var(--surface);
  padding: 8px 14px;
  border-radius: 10px;
  font-weight: 900;
  font-size: 1rem;
  color: var(--accent2);
  min-width: 40px;
  text-align: center;
}
.choice-text { flex: 1; }
.check-mark {
  color: var(--success);
  font-weight: 700;
  font-size: 1.4rem;
}

.feedback-toast {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 4px;
  padding: 14px 20px;
  border-radius: 14px;
  font-weight: 800;
  font-size: 1.05rem;
  animation: slideUp 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}
.feedback-toast.correct {
  background: #052e16;
  color: var(--success);
  box-shadow: 0 6px 24px rgba(34,197,94,0.25);
}
.feedback-toast.wrong {
  background: #2e0516;
  color: var(--danger);
  box-shadow: 0 6px 24px rgba(239,68,68,0.25);
}
.fb-icon { font-size: 1.5rem; }
@keyframes slideUp {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

.round-reveal {
  text-align: center;
  margin-top: 24px;
  padding: 18px;
  background: var(--card);
  border-radius: 16px;
  border: 1px solid var(--border);
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}
.correct-answer {
  color: var(--success);
  font-size: 1.25rem;
  font-weight: 700;
}
.next-hint {
  color: var(--muted);
  font-size: 0.9rem;
  margin-top: 8px;
}

.live-ranks {
  width: 100%;
  margin-top: 28px;
  background: var(--card);
  border-radius: 16px;
  padding: 14px 18px;
  border: 1px solid var(--border);
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}
.mini-rank {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.mini-rank:last-child { border-bottom: none; }
.mini-pos {
  font-weight: 800;
  color: var(--accent2);
  width: 26px;
}
.mini-name {
  flex: 1;
  font-size: 0.95rem;
}
.mini-pts { font-weight: 700; color: var(--accent); }
.answered-check {
  font-weight: 800;
  color: #22c55e;
  font-size: 1rem;
}

/* Answer notifications */
.answer-notifications {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  max-width: 400px;
  margin-bottom: 20px;
}

.answer-notification {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-radius: 12px;
  animation: slideInFromTop 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  font-size: 0.95rem;
  font-weight: 600;
}

@keyframes slideInFromTop {
  0% { opacity: 0; transform: translateY(-20px) scale(0.95); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

.answer-notification.correct {
  background: rgba(34, 197, 94, 0.15);
  border: 1px solid #22c55e;
  color: #22c55e;
}

.answer-notification.wrong {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid #ef4444;
  color: #ef4444;
}

.answer-notification-icon {
  font-size: 1.2rem;
}

/* Finished */
.finished-root {
  text-align: center;
  padding-top: 16px;
  position: relative;
}
.finished-title {
  font-size: 2rem;
  margin-bottom: 36px;
  font-weight: 900;
}

.podium {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 18px;
  margin-bottom: 36px;
}
.podium-spot {
  text-align: center;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 24px 18px;
  min-width: 140px;
  animation: podiumRise 0.55s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}
.podium-spot.rank-1 {
  order: 2;
  transform: translateY(-12px);
  background: linear-gradient(180deg, #2a1a00, #1a1000);
  border-color: var(--gold);
  box-shadow: 0 0 36px rgba(245,158,11,0.25), 0 8px 24px rgba(0,0,0,0.3);
}
.podium-spot.rank-2 { order: 1; }
.podium-spot.rank-3 { order: 3; }
@keyframes podiumRise {
  from { opacity: 0; transform: translateY(36px); }
  to { opacity: 1; transform: translateY(-12px); }
}
.podium-spot.rank-2, .podium-spot.rank-3 {
  animation: podiumRise2 0.55s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes podiumRise2 {
  from { opacity: 0; transform: translateY(36px); }
  to { opacity: 1; transform: translateY(0); }
}

.podium-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  margin: 0 auto 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 1.6rem;
  color: #fff;
  box-shadow: 0 6px 16px rgba(0,0,0,0.35);
}
.podium-medal {
  font-size: 2.5rem;
  display: block;
  margin: 6px 0;
}
.podium-name {
  font-weight: 800;
  font-size: 1.05rem;
}
.podium-points {
  color: var(--accent2);
  font-weight: 800;
  font-size: 1rem;
  margin-top: 4px;
}

.full-ranks {
  text-align: left;
  background: var(--card);
  border-radius: 18px;
  padding: 18px;
  border: 1px solid var(--border);
  margin-bottom: 28px;
  box-shadow: 0 6px 24px rgba(0,0,0,0.3);
}
.full-ranks h4 {
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 0.88rem;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  font-weight: 700;
}
.rank-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.rank-row:last-child { border-bottom: none; }
.rank-player {
  display: flex;
  align-items: center;
  gap: 12px;
}
.rank-avatar-sm {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.85rem;
  color: #fff;
}
.rank-score {
  font-weight: 800;
  color: var(--accent);
}

.btn-home {
  display: inline-block;
  padding: 16px 48px;
  background: linear-gradient(135deg, var(--accent), #7c3aed);
  color: #fff;
  border-radius: 16px;
  font-weight: 800;
  text-decoration: none;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 6px 24px rgba(139,92,246,0.35);
}
.btn-home:hover {
  background: linear-gradient(135deg, #9f67f8, #8b5cf6);
  transform: translateY(-3px);
  box-shadow: 0 10px 32px rgba(139,92,246,0.5);
}

.finished-actions {
  display: flex;
  gap: 14px;
  justify-content: center;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.btn-replay {
  padding: 16px 36px;
  border: none;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--success), #16a34a);
  color: #fff;
  font-size: 1.1rem;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 6px 24px rgba(34,197,94,0.4);
}
.btn-replay:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 36px rgba(34,197,94,0.55);
}
.btn-new-theme {
  padding: 16px 36px;
  border: 2px solid var(--accent);
  border-radius: 16px;
  background: transparent;
  color: var(--accent2);
  font-size: 1.1rem;
  font-weight: 800;
  text-decoration: none;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
.btn-new-theme:hover {
  background: rgba(139,92,246,0.15);
  transform: translateY(-3px);
}

#confetti-canvas, #confetti-canvas-end { position: fixed; inset: 0; z-index: 200; pointer-events: none; display: none; }

/* === Mode badge === */
.room-topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}
.mode-badge {
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--accent2);
  padding: 8px 18px;
  border-radius: 24px;
  font-size: 0.85rem;
  font-weight: 800;
}

/* === Solo lobby === */
.solo-hint {
  color: var(--muted);
  font-size: 1rem;
  margin-top: 10px;
}

/* === Bot players === */
.bot-card {
  opacity: 0.75;
  border-color: #f97316 !important;
}
.bot-badge {
  background: #f97316;
  color: #fff;
  font-size: 0.6rem;
  padding: 2px 7px;
  border-radius: 6px;
  margin-left: 5px;
}
.bot-mini { font-size: 0.75rem; }

/* === Share section (viral) === */
.share-section {
  margin: 24px 0;
  padding: 20px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: 0 6px 24px rgba(0,0,0,0.3);
}
.share-results {
  margin-top: 24px;
}
.share-label {
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 14px;
}
.share-buttons {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}
.share-btn {
  padding: 12px 20px;
  border-radius: 12px;
  font-size: 0.9rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  border: none;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.share-btn:hover {
  transform: translateY(-2px);
  opacity: 0.95;
  box-shadow: 0 6px 20px rgba(0,0,0,0.3);
}
.share-btn.whatsapp {
  background: #25d366;
  color: #fff;
}
.share-btn.twitter {
  background: #000;
  color: #fff;
}
.share-btn.copy-link {
  background: linear-gradient(135deg, var(--accent), #7c3aed);
  color: #fff;
}
.share-icon {
  font-size: 1.1rem;
}

/* === Invite section (lobby — prominent social CTA) === */
.invite-section {
  margin: 28px 0;
  padding: 24px;
  background: linear-gradient(135deg, var(--surface-2), var(--card));
  border: 1px solid var(--accent);
  border-radius: 20px;
  text-align: center;
  box-shadow: 0 8px 30px rgba(139,92,246,0.2);
}
.invite-title {
  font-size: 1.1rem;
  font-weight: 800;
  margin-bottom: 8px;
}
.invite-sub {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 16px;
}
.invite-code {
  color: var(--accent2);
  font-size: 1.2rem;
  font-weight: 900;
  letter-spacing: 3px;
}

/* === Leave button === */
.btn-leave {
  display: block;
  text-align: center;
  color: var(--muted);
  margin-top: 18px;
  font-size: 0.88rem;
  text-decoration: none;
  background: none;
  border: none;
  cursor: pointer;
  width: 100%;
}
.btn-leave:hover { color: var(--danger); }
.btn-leave-top {
  color: var(--muted);
  text-decoration: none;
  font-size: 1.2rem;
  padding: 6px 12px;
  border-radius: 10px;
  transition: all 0.2s;
  background: none;
  border: none;
  cursor: pointer;
}
.btn-leave-top:hover {
  color: var(--danger);
  background: rgba(239,68,68,0.12);
}

/* === Quiz title hint === */
.quiz-title-hint {
  color: var(--accent2);
  font-size: 0.88rem;
  margin-bottom: 6px;
}

/* === Classement page === */
.classement-page {
  max-width: 640px;
  width: 100%;
  margin: 0 auto;
  padding: 28px 18px 48px;
}
.classement-list {
  list-style: none;
  margin: 0 0 28px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.classement-row {
  display: grid;
  grid-template-columns: 40px 48px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
}
.classement-row.is-podium {
  border-color: rgba(167, 139, 250, 0.35);
  background: linear-gradient(135deg, var(--surface-2), var(--surface-2));
}
.classement-row.is-me {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(139, 92, 246, 0.35);
}
.classement-rank {
  font-weight: 900;
  font-size: 1.1rem;
  color: var(--muted);
  text-align: center;
}
.classement-rank.rank-gold { color: var(--gold); }
.classement-rank.rank-silver { color: var(--muted); }
.classement-rank.rank-bronze { color: #c2410c; }
html[data-theme="dark"] .classement-rank.rank-bronze { color: #fb923c; }
.classement-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  box-shadow: 0 4px 14px rgba(0,0,0,0.35);
}
.classement-player {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.classement-name {
  font-weight: 800;
  font-size: 1rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.classement-meta {
  font-size: 0.75rem;
  color: var(--muted);
}
.classement-stats {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}
.classement-xp {
  font-weight: 900;
  color: var(--accent2);
  font-size: 0.95rem;
}
.classement-wins {
  font-size: 0.72rem;
  color: var(--muted);
}
.classement-empty {
  text-align: center;
  padding: 36px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  margin-bottom: 24px;
}
.classement-empty-hint {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 10px 0 22px;
}
.classement-empty-hint a { color: var(--accent2); }
@media (max-width: 520px) {
  .classement-row {
    grid-template-columns: 32px 40px 1fr;
    grid-template-rows: auto auto;
  }
  .classement-stats {
    grid-column: 3;
    flex-direction: row;
    gap: 10px;
    align-items: center;
    justify-content: flex-start;
  }
  .classement-avatar { width: 40px; height: 40px; font-size: 1.2rem; }
}

/* === Profile page === */
.profile-card {
  position: relative;
  z-index: 1;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 28px;
  padding: 48px 36px;
  max-width: 520px;
  width: 100%;
  box-shadow: 0 24px 70px rgba(0,0,0,0.55), 0 0 90px rgba(139,92,246,0.1);
  animation: cardIn 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}
.profile-header {
  text-align: center;
  margin-bottom: 36px;
}
.profile-avatar-big {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  margin: 0 auto 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 2rem;
  color: #fff;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}
.profile-header h2 {
  font-size: 1.3rem;
  font-weight: 800;
}
.profile-email {
  color: var(--muted);
  font-size: 0.85rem;
  margin-top: 4px;
}
.profile-level-row {
  display: flex;
  justify-content: center;
  align-items: baseline;
  gap: 12px;
  margin-top: 16px;
}
.profile-level {
  font-weight: 800;
  color: var(--accent2);
  font-size: 1rem;
}
.profile-xp {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
}
.profile-xp-bar {
  margin: 10px auto 0;
  width: min(280px, 90%);
  height: 8px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  overflow: hidden;
}
.profile-xp-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #a855f7);
  border-radius: 999px;
  transition: width 0.35s ease;
}
.profile-xp-hint {
  margin-top: 8px;
  font-size: 0.75rem;
  color: var(--muted);
}
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin-bottom: 28px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 22px;
  text-align: center;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
.stat-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(139,92,246,0.2);
}
.stat-value {
  display: block;
  font-size: 2.2rem;
  font-weight: 900;
  color: var(--accent2);
}
.stat-label {
  font-size: 0.8rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1.4px;
}
.profile-actions {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}
.profile-themes {
  margin-bottom: 28px;
}
.profile-themes h3 {
  font-size: 0.95rem;
  font-weight: 800;
  margin-bottom: 12px;
  text-align: center;
}
.profile-themes-empty {
  text-align: center;
  color: var(--muted);
  font-size: 0.88rem;
}
.profile-theme-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.profile-theme-item {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.profile-theme-icon { font-size: 1.1rem; }
.profile-theme-name { font-weight: 600; font-size: 0.92rem; }
.profile-theme-count {
  font-weight: 800;
  color: var(--accent2);
  font-size: 0.9rem;
}
.profile-edit-form { margin-top: 8px; }
.profile-avatar-label {
  margin: 18px 0 10px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}
.profile-avatar-picker { margin-bottom: 8px; }
.profile-edit-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-top: 24px;
}
.profile-edit-actions .btn-home {
  border: none;
  cursor: pointer;
  font: inherit;
}
.profile-actions .btn-home {
  border: none;
  cursor: pointer;
  font: inherit;
}

/* === Debug page === */
.debug-card { position: relative; z-index: 1; background: var(--card); border: 1px solid var(--border); border-radius: 24px; padding: 32px 28px; max-width: 720px; width: 100%; box-shadow: 0 20px 60px rgba(0,0,0,0.5); animation: cardIn 0.6s ease-out; }
.debug-header { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; }
.debug-header h1 { font-size: 1.4rem; }
.debug-badge { background: var(--accent); color: #fff; padding: 3px 10px; border-radius: 20px; font-size: 0.7rem; font-weight: 700; }
.debug-setup { }
.btn-quick-test { width: 100%; padding: 18px; background: linear-gradient(135deg, var(--success), #16a34a); color: #fff; border: none; border-radius: 14px; font-size: 1.1rem; font-weight: 700; cursor: pointer; margin-bottom: 20px; transition: all 0.2s; }
.btn-quick-test:hover { opacity: 0.9; transform: translateY(-1px); }
.debug-cat-list { max-height: 50dvh; overflow-y: auto; }
.debug-cat-section { margin-bottom: 4px; }
.debug-cat-summary { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; cursor: pointer; font-size: 0.9rem; transition: border-color 0.15s; list-style: none; }
.debug-cat-summary:hover { border-color: var(--accent); }
.debug-cat-summary::-webkit-details-marker { display: none; }
.debug-cat-icon { font-size: 1.2rem; }
.debug-cat-name { flex: 1; font-weight: 600; }
.debug-cat-count { font-size: 0.7rem; color: var(--muted); background: var(--border); padding: 2px 8px; border-radius: 8px; }
.debug-quiz-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 6px; padding: 8px 0 12px; }
.debug-quiz-btn { display: flex; justify-content: space-between; align-items: center; padding: 8px 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; color: var(--text); cursor: pointer; font-size: 0.82rem; transition: all 0.15s; text-align: left; }
.debug-quiz-btn:hover { border-color: var(--accent); background: var(--surface-2); }
.dqb-title { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-right: 8px; }
.dqb-count { color: var(--muted); font-size: 0.68rem; background: var(--border); padding: 2px 6px; border-radius: 4px; flex-shrink: 0; }
.debug-game { display: flex; flex-direction: column; gap: 20px; }
.debug-bar { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px 18px; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; }
.debug-info { display: flex; gap: 16px; font-size: 0.85rem; color: var(--muted); }
.debug-info strong { color: var(--text); }
.debug-controls { display: flex; gap: 8px; }
.ctrl-btn { padding: 8px 14px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); cursor: pointer; font-size: 0.8rem; transition: all 0.15s; }
.ctrl-btn:hover { border-color: var(--accent); }
.ctrl-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.ctrl-btn.danger { border-color: var(--danger); color: var(--danger); }
.debug-lobby { text-align: center; }
.debug-lobby h3 { margin-bottom: 16px; }
.player-grid-debug { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-bottom: 24px; }
.debug-player { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 14px 18px; text-align: center; min-width: 90px; }
.debug-player.you { border-color: var(--accent); }
.debug-player.bot { border-color: #f97316; opacity: 0.7; }
.dp-avatar { width: 40px; height: 40px; border-radius: 50%; margin: 0 auto 6px; display: flex; align-items: center; justify-content: center; font-weight: 700; color: #fff; }
.debug-playing { text-align: center; }
.ext-link { color: var(--accent2); }
.live-scores { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 16px; text-align: left; margin-top: 20px; }
.live-scores h4 { margin-bottom: 10px; color: var(--muted); font-size: 0.8rem; text-transform: uppercase; }
.score-row { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--border); }
.score-row:last-child { border-bottom: none; }
.you-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.bot-dot { width: 8px; height: 8px; border-radius: 50%; background: #f97316; }
.sr-name { flex: 1; font-size: 0.9rem; }
.sr-score { font-weight: 700; color: var(--accent); }
.debug-podium { text-align: center; }
.debug-podium h3 { margin-bottom: 14px; }
.debug-rank { display: flex; gap: 12px; padding: 8px 14px; background: var(--surface); border-radius: 8px; margin-bottom: 6px; text-align: left; align-items: center; }
.dr-pos { font-weight: 700; color: var(--accent2); width: 24px; }
.dr-name { flex: 1; }
.dr-score { font-weight: 700; color: var(--accent); }

.debug-cat-stats { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px; margin-bottom: 16px; }
.stats-header { display: flex; justify-content: space-between; padding: 8px 10px; border-bottom: 1px solid var(--border); font-size: 0.75rem; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; font-weight: 600; }
.stat-row { display: flex; justify-content: space-between; padding: 8px 10px; border-bottom: 1px solid var(--border); font-size: 0.85rem; }
.stat-row:last-child { border-bottom: none; }
.stat-cat { flex: 1; }
.stat-count { font-weight: 700; color: var(--accent2); }

/* Petits écrans / hauteur courte (iPhone SE, landscape) */
@media (max-width: 640px) and (max-height: 700px) {
  .room-root.is-playing .score-rail { display: none; }
  .room-root.is-playing .reaction-bar.play-reactions { display: none; }
  .room-root.is-playing .play-timer { height: 24px; }
  .room-root.is-playing .question-text { font-size: 1rem; }
  .room-root.is-playing .choice-btn {
    min-height: 44px;
    padding: 10px 12px;
    font-size: 0.88rem;
  }
  .room-root.is-playing .play-stage { gap: 6px; }
}

/* === Responsive tablet === */
@media (max-width: 820px) {
  .mode-cards { grid-template-columns: 1fr; gap: 10px; }
  .mode-card { flex-direction: row; justify-content: flex-start; gap: 12px; padding: 14px 16px; }
  .home-card { padding: 40px 28px 32px; }
  .create-page { padding: 20px 16px; }
}

/* === Responsive mobile (full) === */
@media (max-width: 640px) {
  .home-root {
    padding: 12px;
    padding-bottom: max(12px, env(safe-area-inset-bottom));
    align-items: flex-start;
    padding-top: 16px;
  }
  .home-card { padding: 28px 18px 24px; max-width: 100%; width: 100%; }
  .logo-section { margin-bottom: 20px; }
  .app-title { font-size: clamp(1.85rem, 9vw, 2.2rem); }
  .home-lead { font-size: 0.95rem; }
  .home-paths {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .home-path {
    min-height: 0;
    padding: 16px;
  }
  .home-path-title { font-size: 1.1rem; }
  .code-input-group { border-radius: 14px; }
  .home-join .btn-join {
    min-width: 96px;
    font-size: 0.85rem;
    padding: 0 14px;
  }
  .code-input-group input {
    padding: 16px 12px;
    font-size: clamp(1rem, 4.5vw, 1.25rem);
    letter-spacing: clamp(3px, 1.8vw, 8px);
  }
  .code-input-group input::placeholder {
    letter-spacing: clamp(2px, 1.2vw, 5px);
    font-size: 0.95rem;
  }
  .btn-join {
    min-width: 52px;
    min-height: 52px;
    padding: 0 18px;
  }
  .profile-card { padding: 24px 16px; max-width: 100%; }
  .debug-card { padding: 24px 16px; max-width: 100%; }
  .auth-container {
    min-height: auto;
    padding: 16px;
    padding-bottom: max(24px, env(safe-area-inset-bottom));
    align-items: flex-start;
  }
  .auth-card { padding: 24px 18px; border-radius: 16px; }
  .auth-card h2 { font-size: 1.3rem; margin-bottom: 18px; }
  .auth-field input { font-size: 16px; padding: 14px 14px; min-height: 48px; }
  .auth-btn { min-height: 48px; font-size: 1rem; }

  .room-root {
    padding: 10px 12px 24px;
    padding-bottom: max(24px, env(safe-area-inset-bottom));
    min-height: auto;
    width: 100%;
    max-width: 100%;
    overflow-x: clip;
  }
  .room-topbar {
    flex-wrap: nowrap;
    gap: 8px;
    margin-bottom: 14px;
    align-items: center;
  }
  .room-code-box {
    flex: 1 1 auto;
    min-width: 0;
    padding: 10px 12px;
    gap: 8px;
  }
  .code-val {
    font-size: clamp(1rem, 4.5vw, 1.2rem);
    letter-spacing: clamp(2px, 1.2vw, 4px);
  }
  .code-label { font-size: 0.6rem; }
  .room-topbar-right {
    flex: 0 0 auto;
    width: auto;
    justify-content: flex-end;
    flex-wrap: nowrap;
    gap: 6px;
  }
  .mode-badge { display: none; }
  .question-progress {
    padding: 8px 12px;
    font-size: 0.82rem;
  }
  .btn-mute,
  .btn-leave-top {
    min-width: 44px;
    min-height: 44px;
    padding: 10px 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .join-screen { min-height: auto; padding: 8px 0 24px; }
  .join-card { padding: 28px 18px; border-radius: 20px; }
  .join-card h2 { font-size: 1.35rem; }
  .preview-emoji { font-size: 2.4rem; }
  .avatar-picker { gap: 8px; }
  .avatar-option {
    width: 48px;
    height: 48px;
    min-width: 48px;
    min-height: 48px;
    font-size: 1.45rem;
  }

  .player-grid {
    grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
    gap: 10px;
    margin-bottom: 24px;
  }
  .player-card { padding: 12px 8px; }
  .player-avatar { width: 44px; height: 44px; font-size: 1.15rem; }
  .player-card-name {
    font-size: 0.8rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .player-count-big { font-size: 2rem; }
  .btn-start-game {
    width: 100%;
    padding: 16px 20px;
    font-size: 1.05rem;
    min-height: 52px;
  }

  .countdown-number { font-size: clamp(4.5rem, 28vw, 7rem); }

  /* === Quiz play — téléphone immersif === */
  .room-root.is-immersive,
  .room-root.is-playing {
    padding: max(6px, env(safe-area-inset-top)) 10px max(8px, env(safe-area-inset-bottom));
    max-width: 100%;
    min-height: 100dvh;
    min-height: 100svh;
    display: flex;
    flex-direction: column;
  }
  .room-root.is-immersive .room-topbar,
  .room-root.is-playing .room-topbar {
    flex-wrap: nowrap;
    margin-bottom: 6px;
    gap: 8px;
    flex-shrink: 0;
  }
  .room-root.is-immersive .room-topbar-right,
  .room-root.is-playing .room-topbar-right {
    width: auto;
    flex: 0 0 auto;
  }
  .play-hud-left {
    gap: 8px;
    min-width: 0;
  }
  .play-progress {
    font-size: 0.78rem;
    padding: 7px 10px;
  }
  .play-my-score {
    font-size: 0.85rem;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .play-stage {
    flex: 1 1 auto;
    min-height: 0;
    gap: 8px;
    display: flex;
    flex-direction: column;
  }
  .score-rail {
    flex-shrink: 0;
    padding: 2px 0 6px;
    margin: 0;
    gap: 6px;
  }
  .score-chip {
    min-width: 104px;
    max-width: 140px;
    padding: 6px 8px;
    gap: 6px;
    border-radius: 14px;
  }
  .score-chip-avatar { width: 30px; height: 30px; font-size: 0.9rem; }
  .score-chip-name { font-size: 0.72rem; }
  .score-chip-pts { font-size: 0.7rem; }
  .score-chip-rank { font-size: 0.65rem; width: 16px; }

  .play-main {
    flex: 1 1 auto;
    min-height: 0;
    gap: 8px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }
  .play-timer { height: 28px; flex-shrink: 0; }
  .play-timer-num { font-size: 0.88rem; }
  .question-block {
    margin-bottom: 0;
    flex-shrink: 0;
  }
  .question-text {
    font-size: clamp(1.05rem, 4.4vw, 1.28rem);
    line-height: 1.28;
    word-break: break-word;
    overflow-wrap: anywhere;
    hyphens: auto;
  }
  .choices {
    gap: 8px;
    flex: 0 0 auto;
  }
  .choice-btn {
    padding: 12px 12px;
    font-size: 0.92rem;
    min-height: 48px;
    gap: 10px;
    border-radius: 14px;
    align-items: flex-start;
  }
  .choice-btn:hover { transform: none; }
  .choice-letter {
    min-width: 32px;
    padding: 5px 8px;
    font-size: 0.9rem;
    margin-top: 1px;
    flex-shrink: 0;
  }
  .choice-text {
    min-width: 0;
    word-break: break-word;
    overflow-wrap: anywhere;
    line-height: 1.3;
  }
  .reaction-bar.play-reactions {
    gap: 4px;
    margin-top: 4px;
    padding-bottom: 0;
    flex-shrink: 0;
  }
  .reaction-bar.play-reactions .reaction-btn {
    width: 40px;
    height: 40px;
    font-size: 1.1rem;
    border-radius: 12px;
  }
  .feedback-toast {
    font-size: 0.9rem;
    padding: 10px 14px;
    margin-top: 0;
  }
  .round-reveal {
    padding: 10px 12px;
    font-size: 0.9rem;
  }
  .correct-answer {
    word-break: break-word;
    overflow-wrap: anywhere;
  }

  .finished-title { font-size: 1.5rem; margin-bottom: 22px; }
  .finished-hero { font-size: 1.1rem; }
  .podium {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .podium-spot {
    min-width: 0;
    width: 100%;
    padding: 14px 16px;
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-start;
    gap: 10px 12px;
    text-align: left;
  }
  .podium-spot.rank-1,
  .podium-spot.rank-2,
  .podium-spot.rank-3 {
    order: 0;
    transform: none;
  }
  .podium-spot.rank-1 { order: -1; }
  .podium-avatar {
    width: 48px;
    height: 48px;
    font-size: 1.25rem;
    margin: 0;
    flex-shrink: 0;
  }
  .podium-medal {
    font-size: 1.5rem;
    margin: 0;
    order: -1;
    flex-shrink: 0;
  }
  .podium-name {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 0.95rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .podium-points {
    margin-top: 0;
    font-size: 0.9rem;
    margin-left: auto;
    flex-shrink: 0;
  }
  .finished-actions {
    flex-direction: column;
    gap: 10px;
  }
  .share-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .share-btn {
    width: 100%;
    justify-content: center;
    min-height: 44px;
  }
  .invite-section {
    margin: 16px 0;
    padding: 16px 14px;
  }
  .invite-qr {
    width: 112px;
    height: 112px;
  }
  .btn-replay,
  .btn-new-theme {
    width: 100%;
    min-height: 48px;
    text-align: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .modal-card { padding: 20px 16px; max-width: 100%; }
  .mode-cards { grid-template-columns: 1fr; gap: 8px; }
  .mode-card { flex-direction: row; justify-content: flex-start; gap: 12px; padding: 12px 16px; }
  .mode-card-icon { font-size: 1.4rem; }
  .quiz-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
  .category-grid,
  .cultural-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .category-tile { min-height: 136px; padding: 14px 10px 12px; }
  .cat-icon-wrap { width: 46px; height: 46px; border-radius: 14px; }
  .cat-icon { font-size: 1.4rem; }
  .cat-name { font-size: 0.86rem; }
  .meta-grid { grid-template-columns: 1fr; }
  .count-selector { gap: 6px; }
  .count-btn { padding: 12px; font-size: 1rem; min-height: 44px; }
  .create-page {
    padding: 14px 12px 32px;
    padding-bottom: max(32px, env(safe-area-inset-bottom));
  }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .seo-theme-page,
  .seo-index-page,
  .legal-page {
    padding: 18px 14px 48px;
    padding-bottom: max(48px, env(safe-area-inset-bottom));
  }
  .seo-section,
  .legal-content section { padding: 16px; }
  .seo-cta-row { flex-direction: column; }
  .seo-cta-row .btn-create,
  .seo-cta-row .btn-secondary-outline { width: 100%; min-height: 48px; }
  .join-toast {
    top: calc(64px + env(safe-area-inset-top));
    max-width: calc(100vw - 24px);
    font-size: 0.82rem;
    padding: 10px 14px;
  }
  .site-footer {
    padding: 28px 16px max(24px, env(safe-area-inset-bottom));
  }
  .flash-group,
  [id="flash-group"] {
    left: 12px !important;
    right: 12px !important;
    top: calc(12px + env(safe-area-inset-top)) !important;
    width: auto !important;
  }
}

/* === Social / fun UX additions === */
.btn-mute {
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 6px 10px;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  transition: all 0.2s;
}
.btn-mute:hover { background: rgba(139,92,246,0.18); }
.btn-mute.is-muted { opacity: 0.55; }

.micro-confetti {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 80;
  display: none;
}

.join-toast {
  position: fixed;
  top: 76px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 70;
  background: linear-gradient(135deg, var(--surface-2), var(--card));
  border: 1px solid var(--accent);
  color: var(--text);
  padding: 10px 18px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.9rem;
  box-shadow: 0 10px 30px rgba(139,92,246,0.25);
  animation: toastIn 0.35s ease, toastOut 0.35s ease 2.1s forwards;
}
@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(-10px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}
@keyframes toastOut {
  to { opacity: 0; transform: translateX(-50%) translateY(-8px); }
}

.floating-reactions {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 60;
  overflow: hidden;
}
.floating-reaction {
  position: absolute;
  left: var(--rx);
  top: var(--ry);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  animation: floatReact 2.6s ease-out forwards;
}
.floating-reaction-emoji {
  font-size: 2rem;
  filter: drop-shadow(0 4px 10px rgba(0,0,0,0.35));
}
.floating-reaction-name {
  font-size: 0.7rem;
  color: var(--muted);
  background: var(--toast-bg);
  border: 1px solid var(--border);
  padding: 2px 8px;
  border-radius: 999px;
}
@keyframes floatReact {
  0% { opacity: 0; transform: translateY(18px) scale(0.7); }
  15% { opacity: 1; transform: translateY(0) scale(1.05); }
  100% { opacity: 0; transform: translateY(-70px) scale(1); }
}

.reaction-bar {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 16px;
  flex-wrap: wrap;
}
.reaction-btn {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.04);
  font-size: 1.25rem;
  cursor: pointer;
  transition: transform 0.15s, background 0.15s, border-color 0.15s;
}
.reaction-btn:hover {
  transform: translateY(-2px) scale(1.08);
  background: rgba(139,92,246,0.18);
  border-color: var(--accent);
}
.reaction-btn:active { transform: scale(0.94); }

.score-pop {
  position: fixed;
  left: 50%;
  top: 38%;
  transform: translate(-50%, -50%);
  z-index: 75;
  font-size: 2.4rem;
  font-weight: 900;
  color: var(--success);
  text-shadow: 0 0 24px rgba(34,197,94,0.45);
  pointer-events: none;
  animation: scorePop 1.1s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
@keyframes scorePop {
  0% { opacity: 0; transform: translate(-50%, -40%) scale(0.5); }
  20% { opacity: 1; transform: translate(-50%, -55%) scale(1.15); }
  100% { opacity: 0; transform: translate(-50%, -90%) scale(1); }
}

.player-card.is-you,
.mini-rank.is-you,
.rank-row.is-you,
.podium-spot.is-you {
  border-color: var(--accent2);
  box-shadow: 0 0 0 1px rgba(167,139,250,0.35), 0 8px 24px rgba(139,92,246,0.18);
}
.player-card.is-you {
  background: linear-gradient(180deg, var(--overlay-strong), var(--panel));
}
.mini-rank.is-you,
.rank-row.is-you {
  background: rgba(139,92,246,0.12);
  border-radius: 12px;
}
.you-badge-sm {
  display: inline-block;
  margin-left: 6px;
  font-size: 0.65rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--accent2);
  background: rgba(139,92,246,0.18);
  padding: 1px 6px;
  border-radius: 999px;
  vertical-align: middle;
}

.player-card.is-thinking .player-avatar {
  animation: thinkPulse 1.1s ease-in-out infinite;
}
.thinking-bubble {
  position: absolute;
  top: -8px;
  right: -8px;
  background: #f97316;
  color: #fff;
  font-size: 0.75rem;
  font-weight: 900;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  animation: thinkBounce 0.9s ease-in-out infinite;
}
.thinking-label {
  margin-left: 6px;
  font-size: 0.7rem;
  color: #fb923c;
  font-weight: 700;
}
@keyframes thinkPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}
@keyframes thinkBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}

.invite-qr-wrap {
  display: flex;
  justify-content: center;
  margin: 0 auto 16px;
}
.invite-qr {
  width: 148px;
  height: 148px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--card);
  padding: 8px;
}
.share-btn.native-share {
  background: linear-gradient(135deg, #334155, #1e293b);
  color: #fff;
}

.player-card-empty {
  animation: emptyPulse 2.2s ease-in-out infinite;
}
@keyframes emptyPulse {
  0%, 100% { opacity: 0.55; }
  50% { opacity: 0.9; }
}

@media (max-width: 640px) {
  .reaction-btn {
    width: 48px;
    height: 48px;
    min-width: 48px;
    min-height: 48px;
  }
  .invite-qr { width: 120px; height: 120px; }
  .score-pop { font-size: 1.85rem; }
}


/* === Vision francophone / frictionless === */
.home-promise {
  margin-top: 10px;
  font-size: 0.85rem;
  color: var(--accent2);
  letter-spacing: 0.02em;
}
.play-now-hint {
  text-align: center;
  margin: -8px 0 0;
  font-size: 0.8rem;
  color: var(--muted);
}
.btn-secondary-link {
  display: block;
  text-align: center;
  color: var(--muted);
  font-size: 0.88rem;
  text-decoration: none;
  padding: 4px 0 2px;
}
.btn-secondary-link:hover { color: var(--accent2); }
.btn-play-now {
  animation: playPulse 2.4s ease-in-out infinite;
}
@keyframes playPulse {
  0%, 100% { box-shadow: 0 10px 28px rgba(139,92,246,0.28); }
  50% { box-shadow: 0 12px 36px rgba(139,92,246,0.45); }
}
.create-sub {
  color: var(--muted);
  font-size: 0.95rem;
  margin-top: 6px;
  line-height: 1.45;
}
.cultural-grid {
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
}
.cultural-grid .cat-name {
  text-transform: none;
  letter-spacing: -0.01em;
  font-size: 0.92rem;
  color: var(--text);
}
html[data-theme="light"] .category-tile {
  background: #fff;
  border-color: #d8d2ec;
  box-shadow: 0 4px 16px rgba(49, 30, 102, 0.07);
}
html[data-theme="light"] .cat-icon-wrap {
  background: linear-gradient(160deg, #efeaff, #f8f7ff);
  border-color: #ddd6fe;
}
html[data-theme="light"] .cat-count {
  background: #f3f0ff;
  color: #4b5568;
  border-color: #e4dff5;
}
html[data-theme="light"] .category-tile.is-selected {
  background: linear-gradient(180deg, #f5f0ff, #ffffff);
  border-color: var(--accent);
}

/* === SEO theme / index pages === */
.seo-theme-page, .seo-index-page {
  position: relative;
  z-index: 1;
  max-width: 720px;
  margin: 0 auto;
  padding: 24px 18px 64px;
}
.seo-breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 22px;
}
.seo-breadcrumb a { color: var(--accent2); text-decoration: none; }
.seo-breadcrumb a:hover { text-decoration: underline; }
.seo-theme-header { text-align: center; margin-bottom: 28px; }
.seo-theme-icon { font-size: 3rem; display: block; margin-bottom: 10px; }
.seo-theme-header h1 {
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 12px;
}
.seo-theme-lead {
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.55;
  max-width: 540px;
  margin: 0 auto 10px;
}
.seo-theme-meta {
  color: var(--accent2);
  font-size: 0.88rem;
  font-weight: 600;
}
.seo-cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  margin-bottom: 36px;
}
.btn-secondary-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 14px;
  padding: 14px 20px;
  font-weight: 700;
  cursor: pointer;
}
.btn-secondary-outline:hover {
  border-color: var(--accent);
  color: var(--accent2);
}
.seo-section {
  margin-bottom: 32px;
  padding: 22px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
}
.seo-section h2 {
  font-size: 1.15rem;
  margin-bottom: 12px;
}
.seo-section p, .seo-section li {
  color: var(--muted);
  line-height: 1.55;
  font-size: 0.95rem;
}
.seo-sample-list {
  list-style: disc;
  padding-left: 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.seo-note { margin-top: 12px; font-size: 0.82rem !important; opacity: 0.8; }
.seo-steps { padding-left: 1.2rem; display: flex; flex-direction: column; gap: 8px; }
.seo-theme-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.seo-theme-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(139,92,246,0.12);
  border: 1px solid var(--border);
  color: var(--text);
  text-decoration: none;
  font-size: 0.85rem;
}
.seo-theme-chip:hover { border-color: var(--accent); }
.seo-index-cta { text-align: center; margin-top: 28px; }

/* === UX polish (P0–P2) === */
.create-header {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 28px;
}
.create-header h1 {
  font-size: clamp(1.45rem, 4vw, 1.75rem);
  line-height: 1.2;
}
.create-sub {
  margin-top: 0;
  max-width: 36ch;
}
.create-loading {
  text-align: center;
  color: var(--accent2);
  font-weight: 700;
  margin-bottom: 16px;
}
.category-tile:disabled,
.category-tile.is-disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
  border-color: var(--border);
}
.category-tile:disabled:hover,
.category-tile.is-disabled:hover {
  border-color: var(--border);
  background: var(--surface);
  transform: none;
}
.btn-create.is-loading,
.random-tile.is-loading,
.btn-play-now.is-loading {
  opacity: 0.85;
  cursor: wait;
  pointer-events: none;
}
.btn-secondary-link.is-disabled {
  pointer-events: none;
  opacity: 0.45;
}
.connecting-screen {
  text-align: center;
  padding: 64px 20px;
}
.lobby-need-hint {
  text-align: center;
  color: var(--muted);
  font-size: 0.92rem;
  margin: -8px 0 18px;
}
.finished-hero {
  text-align: center;
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--accent2);
  margin: -8px 0 22px;
}
.live-ranks-collapsible {
  padding: 0;
  overflow: hidden;
}
.live-ranks-toggle {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: transparent;
  border: none;
  color: var(--text);
  font-weight: 700;
  font-size: 0.92rem;
  padding: 14px 18px;
  cursor: pointer;
}
.live-ranks-body {
  padding: 0 18px 12px;
}
.room-code-box {
  border: none;
  font: inherit;
  color: inherit;
  text-align: left;
}
/* Scores live toujours visibles via .score-rail — plus de panneau repliable */
@media (prefers-reduced-motion: reduce) {
  .btn-play-now,
  .timer-number.urgency,
  .floating-reaction,
  .join-toast,
  .reed-stem,
  .reed-head,
  .reed-leaf {
    animation: none !important;
  }
  .category-tile,
  .btn-replay,
  .btn-new-theme,
  .share-btn,
  .room-code-box {
    transition: none !important;
  }
}

/* === Site footer + legal pages === */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--footer-bg);
  padding: 32px 20px max(28px, env(safe-area-inset-bottom));
  margin-top: auto;
  width: 100%;
  flex-shrink: 0;
  position: relative;
  z-index: 2;
}
.site-footer-inner {
  max-width: 720px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
  text-align: center;
}
.site-footer-brand {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: center;
}
.site-footer-logo {
  color: var(--accent2);
  font-weight: 800;
  font-size: 1.1rem;
  text-decoration: none;
}
.site-footer-tagline {
  color: var(--muted-2);
  font-size: 0.82rem;
  line-height: 1.35;
  max-width: 36ch;
}
.site-footer-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 4px;
  justify-content: center;
  padding: 4px 0 2px;
}
.site-footer-nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: 999px;
  transition: color 0.15s, background 0.15s;
}
.site-footer-nav a:hover {
  color: var(--accent2);
  background: var(--overlay-soft);
}
.site-footer-copy {
  color: var(--muted-2);
  font-size: 0.72rem;
  margin-top: 2px;
}
body {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}
/* Pendant le quiz : immersion totale — navbar/footer hors écran */
body:has(.room-root.is-playing) {
  overflow: hidden;
  height: 100dvh;
  height: 100svh;
}
body:has(.room-root.is-playing) > .site-header,
body:has(.room-root.is-playing) > #site-header,
body:has(.room-root.is-playing) > .site-footer,
body:has(.room-root.is-playing) > #site-footer,
body:has(.room-root.is-immersive) > .site-header,
body:has(.room-root.is-immersive) > #site-header,
body:has(.room-root.is-immersive) > .site-footer,
body:has(.room-root.is-immersive) > #site-footer {
  display: none !important;
}
body:has(.room-root.is-playing) > .room-root,
body:has(.room-root.is-immersive) > .room-root {
  flex: 1 1 auto;
  min-height: 0;
  max-height: 100%;
}
body:has(.room-root.is-playing) [aria-live="polite"] {
  /* flash group — ne pas couvrir le quiz */
  position: fixed;
  top: max(8px, env(safe-area-inset-top));
  left: 12px;
  right: 12px;
  z-index: 80;
  pointer-events: none;
}
body > .home-root,
body > .room-root,
body > .legal-page,
body > .seo-theme-root,
body > .auth-container,
body > .create-page,
body > .classement-page,
body > main {
  flex: 1 1 auto;
  width: 100%;
}

.legal-page {
  max-width: 720px;
  margin: 0 auto;
  padding: 28px 18px 64px;
  width: 100%;
}
.legal-header {
  margin-bottom: 28px;
}
.legal-header h1 {
  font-size: clamp(1.5rem, 4vw, 2rem);
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 8px;
}
.legal-updated {
  color: var(--muted);
  font-size: 0.85rem;
}
.legal-content section {
  margin-bottom: 26px;
  padding: 20px 22px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
}
.legal-content h2 {
  color: var(--text);
  font-size: 1.1rem;
  margin-bottom: 10px;
}
.legal-content p,
.legal-content li {
  color: var(--muted);
  line-height: 1.6;
  font-size: 0.95rem;
}
.legal-content ul {
  padding-left: 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
}
.legal-content a {
  color: var(--accent2);
}
.legal-note {
  margin-top: 12px;
  font-size: 0.85rem !important;
  opacity: 0.85;
}
.legal-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}
.legal-nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.85rem;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
}
.legal-nav a:hover,
.legal-nav a.active {
  color: var(--accent2);
  border-color: var(--accent);
}
