/* v8.2 split-screen duel */
/* v7.1 */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

:root {
  --nav-height: 70px;
  --bg-dark: #0b1120;
  --card-bg: rgba(15, 23, 42, 0.9);
  --border-soft: rgba(255, 255, 255, 0.14);
}

html, body {
  width: 100%;
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  background-color: var(--bg-dark);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: #f8fafc;
  user-select: none;
}

#webcam {
  position: fixed;
  top: 0;
  left: 0;
  width: 1px;
  height: 1px;
  opacity: 0.01;
  pointer-events: none;
}

#gameCanvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100dvh;
  display: block;
  background: radial-gradient(circle at center, #1e293b 0%, #0b1120 100%);
  z-index: 1;
}

/* =========================================================================
   HUD ARÈNE
   ========================================================================= */
#hud {
  position: fixed;
  top: max(8px, env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  width: min(96vw, 1060px);
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px 12px;
  background: rgba(15, 23, 42, 0.86);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-soft);
  border-radius: 18px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
}

#hud.hidden-tab { display: none; }

.hud-top-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

#modeSelect {
  flex: 1 1 150px;
  min-height: 40px;
  padding: 6px 10px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: #1e293b;
  color: #f8fafc;
  font-size: clamp(0.84rem, 2.4vw, 0.96rem);
  font-weight: 800;
  cursor: pointer;
  outline: none;
}

.hud-btn {
  min-height: 40px;
  padding: 6px 12px;
  border: none;
  border-radius: 10px;
  font-size: clamp(0.8rem, 2.2vw, 0.92rem);
  font-weight: 800;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
}

.hud-btn:active { transform: scale(0.96); }

#exercisePillBtn {
  background: rgba(192, 132, 252, 0.2);
  border: 1px solid rgba(192, 132, 252, 0.5);
  color: #e9d5ff;
}

#difficultyBadgeBtn {
  background: rgba(56, 189, 248, 0.18);
  border: 1px solid rgba(56, 189, 248, 0.5);
  color: #7dd3fc;
}

#finishBtn { background: #0f766e; color: #f0fdfa; }
#resetBtn { background: #334155; color: #f8fafc; }
.add-btn { background: #2563eb; color: #ffffff; }

.hud-stats-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  align-items: stretch;
}

.hud-stats-row.with-timer {
  grid-template-columns: repeat(6, 1fr);
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4px 2px;
  border-radius: 10px;
  background: rgba(30, 41, 59, 0.58);
}

.stat-label {
  font-size: clamp(0.58rem, 1.6vw, 0.72rem);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #cbd5e1;
  font-weight: 700;
  text-align: center;
}

.stat-value {
  font-size: clamp(1.2rem, 3.7vw, 1.9rem);
  font-weight: 900;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.combo-inline {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

#multiplierPill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 6px;
  border-radius: 999px;
  font-size: clamp(0.72rem, 2vw, 0.88rem);
  font-weight: 900;
  background: #334155;
  color: #e2e8f0;
  transition: transform 0.2s ease, background 0.2s ease;
}

#multiplierPill.m2 { background: #0284c7; color: #ffffff; }
#multiplierPill.m3 { background: #d97706; color: #ffffff; }
#multiplierPill.m4 { background: #dc2626; color: #fef08a; box-shadow: 0 0 14px rgba(239, 68, 68, 0.75); }
#multiplierPill.pop { transform: scale(1.28); }

#timerBox {
  display: none;
  background: rgba(244, 63, 94, 0.22);
  border: 1px solid rgba(244, 63, 94, 0.55);
}

#timerBox.visible { display: flex; }
#timerValue { color: #fb7185; }
#timerValue.urgent {
  color: #ef4444;
  animation: pulseUrgent 0.55s infinite alternate;
}

@keyframes pulseUrgent {
  from { transform: scale(1); }
  to { transform: scale(1.14); }
}

#primaryRepCount { color: #38bdf8; }
#secondaryRepCount { color: #c084fc; }
#scoreValue { color: #4ade80; }
#comboValue { color: #facc15; }
#bestScoreValue { color: #fbbf24; }

/* Barre d'objectif (Étape/Boss ou Programme du jour) */
#stageGoalBar {
  display: none;
  flex-direction: column;
  gap: 5px;
  padding: 7px 12px;
  border-radius: 12px;
  background: linear-gradient(90deg, rgba(124, 45, 18, 0.82), rgba(153, 27, 27, 0.82));
  border: 1px solid rgba(251, 146, 60, 0.65);
}

#stageGoalBar.program-style {
  background: linear-gradient(90deg, rgba(14, 116, 144, 0.8), rgba(29, 78, 216, 0.8));
  border-color: rgba(56, 189, 248, 0.65);
}

#stageGoalBar.visible { display: flex; }

.stage-goal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: clamp(0.78rem, 2.2vw, 0.94rem);
  font-weight: 900;
  color: #fef3c7;
}

.stage-progress-track {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.65);
  overflow: hidden;
}

#stageProgressFill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #facc15, #4ade80);
  transition: width 0.25s ease;
}

/* Barre Mode Cardio / Séquences */
#cardioSeqBar {
  display: none;
  flex-direction: column;
  gap: 5px;
  padding: 7px 12px;
  border-radius: 12px;
  background: linear-gradient(90deg, rgba(190, 24, 93, 0.82), rgba(234, 88, 12, 0.82));
  border: 1px solid rgba(251, 146, 60, 0.7);
}

#cardioSeqBar.visible { display: flex; }

.cardio-seq-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: clamp(0.82rem, 2.4vw, 0.98rem);
  font-weight: 900;
  color: #fff7ed;
}

.cardio-bars-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 8px;
}

#cardioBlockFill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #38bdf8, #4ade80);
  transition: width 0.2s ease;
}

#cardioRhythmFill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #facc15, #f97316, #ef4444);
  transition: width 0.15s linear;
}

/* Barre du Mode Fantôme */
#ghostBar {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 5px 12px;
  border-radius: 10px;
  background: rgba(30, 41, 59, 0.82);
  border: 1px solid rgba(148, 163, 184, 0.25);
  font-size: clamp(0.78rem, 2.2vw, 0.92rem);
  font-weight: 800;
}

#ghostBar.visible { display: flex; }
#ghostTargetText { color: #e2e8f0; }

#ghostDelta {
  padding: 2px 10px;
  border-radius: 999px;
  font-variant-numeric: tabular-nums;
}
#ghostDelta.ahead { background: rgba(34, 197, 94, 0.22); color: #4ade80; border: 1px solid rgba(74, 222, 128, 0.5); }
#ghostDelta.behind { background: rgba(239, 68, 68, 0.22); color: #f87171; border: 1px solid rgba(248, 113, 113, 0.5); }
#ghostDelta.even { background: rgba(250, 204, 21, 0.2); color: #fde047; border: 1px solid rgba(250, 204, 21, 0.45); }

/* =========================================================================
   OVERLAY PRÊT / GESTE / HORS CHAMP / CONTRÔLES CAMÉRA
   ========================================================================= */
#readyStartOverlay {
  position: fixed;
  inset: 0 0 calc(var(--nav-height) + env(safe-area-inset-bottom)) 0;
  z-index: 22;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  pointer-events: none;
}

#readyStartOverlay.visible { display: flex; }

.ready-card {
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: min(92vw, 430px);
  padding: 20px 22px;
  border-radius: 22px;
  background: rgba(15, 23, 42, 0.84);
  backdrop-filter: blur(8px);
  border: 2px solid rgba(74, 222, 128, 0.6);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.55);
  text-align: center;
}

.ready-card h3 { font-size: clamp(1.2rem, 4vw, 1.55rem); color: #ffffff; }
.ready-card p { font-size: clamp(0.9rem, 2.7vw, 1.04rem); color: #cbd5e1; line-height: 1.35; }

.gesture-hint-box {
  width: 100%;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(56, 189, 248, 0.14);
  border: 1px solid rgba(56, 189, 248, 0.45);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.gesture-hint-box span { font-size: 0.86rem; font-weight: 800; color: #7dd3fc; }

.gesture-progress-track {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.8);
  overflow: hidden;
}

.gesture-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #38bdf8, #4ade80);
  transition: width 0.08s linear;
}

#startChallengeBtn {
  width: 100%;
  min-height: 56px;
  padding: 14px 24px;
  border: none;
  border-radius: 16px;
  background: linear-gradient(135deg, #22c55e, #16a34a);
  color: #052e16;
  font-size: clamp(1.18rem, 4vw, 1.48rem);
  font-weight: 900;
  letter-spacing: 0.04em;
  cursor: pointer;
  box-shadow: 0 12px 28px rgba(34, 197, 94, 0.45);
}

#outOfFrameAlert {
  position: fixed;
  top: 52%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 24;
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: min(88vw, 440px);
  padding: 18px 22px;
  border-radius: 20px;
  background: rgba(127, 29, 29, 0.9);
  border: 3px solid #f87171;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.55);
  text-align: center;
  pointer-events: none;
  animation: alertPulse 1.1s ease-in-out infinite alternate;
}

#outOfFrameAlert.visible { display: flex; }
#outOfFrameAlert strong { font-size: clamp(1.2rem, 4.3vw, 1.8rem); font-weight: 900; color: #ffffff; }
#outOfFrameAlert span { font-size: clamp(0.92rem, 2.8vw, 1.1rem); color: #fecaca; font-weight: 600; }

@keyframes alertPulse {
  from { transform: translate(-50%, -50%) scale(0.98); }
  to { transform: translate(-50%, -50%) scale(1.03); }
}

#controls {
  position: fixed;
  bottom: calc(var(--nav-height) + env(safe-area-inset-bottom) + 12px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 25;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: min(92vw, 380px);
  pointer-events: none;
}

#controls.hidden-tab { display: none; }

#statusBadge {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.16);
  font-size: clamp(0.8rem, 2.3vw, 0.92rem);
  color: #e2e8f0;
  text-align: center;
  transition: opacity 0.25s ease;
}

#statusBadge.error { border-color: rgba(248, 113, 113, 0.7); color: #fecaca; }
#statusBadge.hidden { opacity: 0; pointer-events: none; }

.spinner {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  border: 2px solid rgba(255, 255, 255, 0.25);
  border-top-color: #38bdf8;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: none;
}

#statusBadge.loading .spinner { display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

#toggleCamBtn {
  pointer-events: auto;
  min-height: 40px;
  padding: 8px 18px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.92);
  color: #ffffff;
  font-size: 0.9rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}

#toggleCamBtn.active { background: rgba(220, 38, 38, 0.88); }
#toggleCamBtn:disabled { opacity: 0.6; cursor: wait; }

/* =========================================================================
   PANNEAUX ONGLETS : PROGRAMME/PARCOURS, EXERCICES, PROFIL
   ========================================================================= */
.tab-panel {
  position: fixed;
  inset: 0 0 calc(var(--nav-height) + env(safe-area-inset-bottom)) 0;
  z-index: 30;
  display: none;
  overflow-y: auto;
  padding: max(18px, env(safe-area-inset-top)) 16px 32px;
  background: rgba(11, 17, 32, 0.95);
  backdrop-filter: blur(12px);
}

.tab-panel.active { display: block; }

.panel-container {
  width: min(100%, 920px);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 12px;
  border-bottom: 1px solid var(--border-soft);
  padding-bottom: 12px;
}

.panel-header h2 { font-size: clamp(1.4rem, 4.5vw, 1.95rem); font-weight: 900; color: #ffffff; }
.panel-header p { font-size: 0.9rem; color: #94a3b8; }

.segmented-tabs {
  display: inline-flex;
  padding: 4px;
  border-radius: 14px;
  background: rgba(30, 41, 59, 0.9);
  border: 1px solid var(--border-soft);
  gap: 4px;
}

.segmented-tabs.small .seg-btn {
  padding: 6px 11px;
  font-size: 0.8rem;
}

.seg-btn {
  border: none;
  border-radius: 10px;
  padding: 8px 14px;
  background: transparent;
  color: #cbd5e1;
  font-size: 0.86rem;
  font-weight: 800;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.seg-btn.active {
  background: #2563eb;
  color: #ffffff;
}

.sub-view { display: none; flex-direction: column; gap: 16px; }
.sub-view.active { display: flex; }
.stack-gap { display: flex; flex-direction: column; gap: 14px; }

.card-block {
  padding: 16px;
  border-radius: 20px;
  background: rgba(30, 41, 59, 0.78);
  border: 1px solid var(--border-soft);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.highlight-card {
  background: linear-gradient(145deg, rgba(14, 116, 144, 0.28), rgba(30, 41, 59, 0.92));
  border-color: rgba(56, 189, 248, 0.45);
}

.card-block h3 { font-size: 1.12rem; font-weight: 900; color: #ffffff; }
.muted-text { font-size: 0.86rem; color: #94a3b8; line-height: 1.38; }

.builder-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.builder-pane { display: none; flex-direction: column; gap: 14px; }
.builder-pane.active { display: flex; }

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.slider-field {
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.68);
  border: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.slider-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.82rem;
  color: #cbd5e1;
}

.slider-top strong { color: #38bdf8; font-weight: 900; }

.slider-field input[type="range"] {
  width: 100%;
  accent-color: #38bdf8;
  cursor: pointer;
}

.form-row-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 10px;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.input-group label {
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  color: #94a3b8;
}

.input-group select,
.input-group input,
.manual-add-row select,
.manual-add-row input {
  min-height: 42px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: #0f172a;
  color: #f8fafc;
  font-size: 0.9rem;
  font-weight: 700;
}

.days-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.day-pill {
  min-width: 44px;
  min-height: 38px;
  padding: 6px 10px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(15, 23, 42, 0.75);
  color: #94a3b8;
  font-size: 0.82rem;
  font-weight: 800;
  cursor: pointer;
}

.day-pill.selected {
  background: #2563eb;
  border-color: #60a5fa;
  color: #ffffff;
}

.manual-add-row {
  display: grid;
  grid-template-columns: 1fr 72px 84px auto;
  gap: 8px;
  align-items: center;
}

@media (max-width: 560px) {
  .manual-add-row {
    grid-template-columns: 1fr 1fr;
  }
  .manual-add-row select { grid-column: 1 / -1; }
  .manual-add-row button { grid-column: 1 / -1; }
}

.manual-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.manual-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.manual-item strong { color: #ffffff; font-size: 0.92rem; }
.manual-item span { color: #94a3b8; font-size: 0.82rem; }

.remove-mini-btn {
  padding: 6px 10px;
  border-radius: 8px;
  border: none;
  background: rgba(239, 68, 68, 0.2);
  color: #fca5a5;
  font-weight: 800;
  cursor: pointer;
}

/* Programme du jour + Planning hebdomadaire */
.today-items-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.today-item {
  padding: 12px;
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.12);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.today-item.done {
  border-color: rgba(74, 222, 128, 0.6);
  background: rgba(20, 83, 45, 0.25);
}

.today-item-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.today-item-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mini-launch-btn {
  padding: 6px 12px;
  border: none;
  border-radius: 9px;
  background: #2563eb;
  color: #ffffff;
  font-size: 0.8rem;
  font-weight: 800;
  cursor: pointer;
}

.schedule-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}

.schedule-day-card {
  padding: 12px;
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.schedule-day-card.today {
  border-color: #38bdf8;
  box-shadow: 0 0 16px rgba(56, 189, 248, 0.22);
}

.schedule-day-card h4 { font-size: 0.92rem; color: #38bdf8; }
.schedule-day-card ul { list-style: none; display: flex; flex-direction: column; gap: 4px; font-size: 0.8rem; color: #cbd5e1; }

/* Parcours Aventure */
.zone-card {
  border-radius: 20px;
  padding: 16px;
  background: rgba(30, 41, 59, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.14);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.zone-card.locked { opacity: 0.58; filter: grayscale(0.45); }
.zone-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.zone-title { font-size: 1.15rem; font-weight: 900; color: #f8fafc; }

.zone-pill {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 800;
  text-transform: uppercase;
}
.zone-pill.unlocked { background: rgba(34, 197, 94, 0.2); color: #4ade80; border: 1px solid rgba(74, 222, 128, 0.45); }
.zone-pill.locked { background: rgba(148, 163, 184, 0.16); color: #cbd5e1; border: 1px solid rgba(148, 163, 184, 0.3); }

.stages-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.stage-card {
  padding: 14px;
  border-radius: 16px;
  background: rgba(15, 23, 42, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.12);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
}

.stage-card.boss {
  border-color: rgba(249, 115, 22, 0.65);
  background: linear-gradient(160deg, rgba(67, 20, 7, 0.72), rgba(15, 23, 42, 0.92));
}

.stage-card.cleared { border-color: rgba(74, 222, 128, 0.55); }
.stage-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.stage-name { font-size: 1rem; font-weight: 900; color: #ffffff; }
.stage-tag { font-size: 0.7rem; font-weight: 900; padding: 3px 8px; border-radius: 999px; white-space: nowrap; }
.stage-tag.boss { background: #dc2626; color: #fef08a; }
.stage-tag.done { background: #16a34a; color: #ffffff; }
.stage-tag.step { background: #334155; color: #cbd5e1; }
.stage-desc { font-size: 0.85rem; color: #cbd5e1; line-height: 1.35; }

.stage-launch-btn {
  width: 100%;
  min-height: 42px;
  border: none;
  border-radius: 12px;
  background: #2563eb;
  color: #ffffff;
  font-size: 0.9rem;
  font-weight: 800;
  cursor: pointer;
}

.stage-card.boss .stage-launch-btn { background: linear-gradient(135deg, #f97316, #dc2626); }
.stage-launch-btn:disabled { background: #334155; color: #94a3b8; cursor: not-allowed; }

/* Exercices */
.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip-btn {
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(30, 41, 59, 0.8);
  color: #cbd5e1;
  font-size: 0.82rem;
  font-weight: 800;
  cursor: pointer;
}

.chip-btn.active {
  background: #38bdf8;
  border-color: #7dd3fc;
  color: #082f49;
}

.exercise-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 12px;
}

.exercise-card {
  padding: 15px;
  border-radius: 18px;
  background: rgba(30, 41, 59, 0.78);
  border: 2px solid rgba(255, 255, 255, 0.12);
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: left;
  cursor: pointer;
  color: #f8fafc;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.exercise-card:hover { background: rgba(30, 41, 59, 0.96); }
.exercise-card.selected {
  border-color: #38bdf8;
  background: rgba(14, 116, 144, 0.28);
  box-shadow: 0 0 22px rgba(56, 189, 248, 0.25);
}

.exercise-card-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.exercise-card-head strong { font-size: 1.04rem; font-weight: 900; }

.exercise-type-pill {
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 800;
  background: rgba(15, 23, 42, 0.75);
  color: #7dd3fc;
  white-space: nowrap;
}

.exercise-meta { font-size: 0.82rem; color: #cbd5e1; line-height: 1.35; }
.exercise-muscles { font-size: 0.75rem; color: #86efac; font-weight: 700; }
.exercise-angles {
  font-size: 0.76rem;
  font-weight: 800;
  color: #fde047;
  background: rgba(15, 23, 42, 0.65);
  padding: 6px 10px;
  border-radius: 10px;
}

/* Profil : Sport vs Jeu */
.profile-hero {
  padding: 18px;
  border-radius: 20px;
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.92), rgba(15, 23, 42, 0.95));
  border: 1px solid rgba(56, 189, 248, 0.4);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.profile-top { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; }
.level-circle { display: inline-flex; align-items: center; gap: 12px; }

.level-badge {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: linear-gradient(135deg, #38bdf8, #2563eb);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  box-shadow: 0 0 20px rgba(56, 189, 248, 0.45);
}

.level-badge small { font-size: 0.62rem; text-transform: uppercase; opacity: 0.9; }
.level-badge strong { font-size: 1.35rem; line-height: 1; }
.rank-title { font-size: 1.35rem; font-weight: 900; color: #fde047; }

.xp-track {
  width: 100%;
  height: 14px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.14);
  overflow: hidden;
}

#xpBarFill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #38bdf8, #4ade80, #fde047);
  transition: width 0.3s ease;
}

.profile-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
  gap: 10px;
}

.profile-stat-box {
  padding: 14px 10px;
  border-radius: 16px;
  background: rgba(30, 41, 59, 0.78);
  border: 1px solid var(--border-soft);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  text-align: center;
}

.profile-stat-box strong { font-size: 1.55rem; font-weight: 900; color: #ffffff; }

/* Régularité 7 jours */
.week-strip {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}

.week-day-box {
  padding: 10px 4px;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: 0.75rem;
  color: #94a3b8;
}

.week-day-box.active {
  background: rgba(34, 197, 94, 0.2);
  border-color: rgba(74, 222, 128, 0.6);
  color: #ffffff;
}

.week-day-box strong { font-size: 0.92rem; color: #4ade80; }

/* Répartition musculaire */
.muscle-bars {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.muscle-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.muscle-row-head {
  display: flex;
  justify-content: space-between;
  font-size: 0.84rem;
  font-weight: 800;
  color: #e2e8f0;
}

.muscle-bar-track {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.85);
  overflow: hidden;
}

.muscle-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #38bdf8, #4ade80);
}

/* Tableau volume par exercice */
.exercise-stats-table {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 8px;
}

.ex-stat-row {
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.ex-stat-row strong { font-size: 0.9rem; color: #ffffff; display: block; }
.ex-stat-row small { font-size: 0.74rem; color: #94a3b8; }
.ex-stat-nums { text-align: right; font-size: 0.82rem; font-weight: 800; color: #38bdf8; }
.ex-stat-nums span { display: block; font-size: 0.72rem; color: #facc15; }

.badges-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 10px;
}

.badge-card {
  padding: 12px;
  border-radius: 16px;
  background: rgba(30, 41, 59, 0.62);
  border: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  gap: 10px;
  opacity: 0.5;
}

.badge-card.unlocked {
  opacity: 1;
  border-color: rgba(250, 204, 21, 0.65);
  background: rgba(250, 204, 21, 0.1);
}

.badge-icon { font-size: 1.6rem; flex-shrink: 0; }
.badge-info strong { display: block; font-size: 0.9rem; color: #ffffff; }
.badge-info span { font-size: 0.76rem; color: #cbd5e1; }

.danger-reset-btn {
  align-self: flex-start;
  padding: 10px 16px;
  border-radius: 12px;
  border: 1px solid rgba(248, 113, 113, 0.5);
  background: rgba(127, 29, 29, 0.45);
  color: #fecaca;
  font-size: 0.85rem;
  font-weight: 800;
  cursor: pointer;
}

/* =========================================================================
   MODALES (ACCUEIL & BILAN)
   ========================================================================= */
.modal-overlay {
  position: fixed;
  inset: 0 0 calc(var(--nav-height) + env(safe-area-inset-bottom)) 0;
  z-index: 35;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(11, 17, 32, 0.8);
  backdrop-filter: blur(8px);
  padding: 16px;
  overflow-y: auto;
}

.modal-overlay.visible { display: flex; }

.modal-card {
  width: min(94vw, 530px);
  padding: 22px 20px;
  border-radius: 24px;
  background: rgba(30, 41, 59, 0.96);
  border: 2px solid rgba(255, 255, 255, 0.16);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6);
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 13px;
}

.modal-title { font-size: clamp(1.48rem, 4.8vw, 2.05rem); font-weight: 900; color: #ffffff; }
.modal-subtitle { font-size: clamp(0.88rem, 2.6vw, 0.98rem); color: #cbd5e1; line-height: 1.35; }

.section-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #94a3b8;
  font-weight: 800;
  text-align: left;
  margin-bottom: 6px;
}

.difficulty-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }

.diff-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 76px;
  padding: 8px 6px;
  border-radius: 14px;
  border: 2px solid rgba(255, 255, 255, 0.14);
  background: rgba(15, 23, 42, 0.72);
  color: #e2e8f0;
  cursor: pointer;
}

.diff-btn strong { font-size: clamp(0.84rem, 2.5vw, 0.98rem); font-weight: 900; }
.diff-btn span { font-size: clamp(0.66rem, 1.9vw, 0.76rem); color: #94a3b8; line-height: 1.2; }
.diff-btn.selected { border-color: #38bdf8; background: rgba(56, 189, 248, 0.22); color: #ffffff; }
.diff-btn.selected[data-diff="decontracte"] { border-color: #4ade80; background: rgba(34, 197, 94, 0.22); }
.diff-btn.selected[data-diff="extreme"] { border-color: #f43f5e; background: rgba(244, 63, 94, 0.24); }

.welcome-mode-select {
  width: 100%;
  min-height: 46px;
  padding: 8px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: #0f172a;
  color: #f8fafc;
  font-size: 0.98rem;
  font-weight: 800;
}

.primary-cta {
  width: 100%;
  min-height: 52px;
  padding: 12px 20px;
  border: none;
  border-radius: 16px;
  background: linear-gradient(135deg, #22c55e, #16a34a);
  color: #052e16;
  font-size: clamp(1.08rem, 3.6vw, 1.32rem);
  font-weight: 900;
  letter-spacing: 0.03em;
  cursor: pointer;
  box-shadow: 0 10px 26px rgba(34, 197, 94, 0.4);
}

.secondary-cta {
  width: 100%;
  min-height: 44px;
  padding: 10px 16px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.72);
  color: #e2e8f0;
  font-size: 0.94rem;
  font-weight: 800;
  cursor: pointer;
}

.final-score-big { font-size: clamp(2.4rem, 9vw, 3.4rem); font-weight: 900; color: #4ade80; line-height: 1; }

.xp-gain-pill {
  align-self: center;
  padding: 5px 14px;
  border-radius: 999px;
  background: rgba(56, 189, 248, 0.2);
  border: 1px solid #38bdf8;
  color: #7dd3fc;
  font-size: 0.9rem;
  font-weight: 900;
}

#newRecordBadge {
  display: none;
  align-self: center;
  padding: 5px 14px;
  border-radius: 999px;
  background: rgba(251, 191, 36, 0.22);
  border: 1px solid #fbbf24;
  color: #fde047;
  font-size: 0.88rem;
  font-weight: 800;
}

#newRecordBadge.visible { display: inline-block; }

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 12px;
  border-radius: 16px;
  background: rgba(15, 23, 42, 0.72);
}

.summary-cell {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 6px 4px;
  border-radius: 10px;
  background: rgba(30, 41, 59, 0.62);
}

.summary-cell strong { font-size: clamp(1.2rem, 3.6vw, 1.5rem); font-weight: 900; }

.summary-program-note {
  font-size: 0.85rem;
  font-weight: 800;
  color: #7dd3fc;
  background: rgba(14, 116, 144, 0.22);
  border: 1px solid rgba(56, 189, 248, 0.4);
  border-radius: 12px;
  padding: 8px 12px;
}

/* =========================================================================
   BARRE DE NAVIGATION BASSE : 4 ONGLETS + BOUTON CENTRAL D'ACTION
   ========================================================================= */
#bottomNav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  height: calc(var(--nav-height) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: rgba(15, 23, 42, 0.96);
  backdrop-filter: blur(14px);
  border-top: 1px solid rgba(255, 255, 255, 0.16);
  display: grid;
  grid-template-columns: 1fr 1fr 78px 1fr 1fr;
  align-items: center;
}

.nav-tab {
  height: 100%;
  border: none;
  background: transparent;
  color: #94a3b8;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  cursor: pointer;
  font-size: 0.72rem;
  font-weight: 800;
  transition: color 0.15s ease;
}

.nav-tab .nav-icon { font-size: 1.3rem; line-height: 1; }
.nav-tab.active { color: #38bdf8; }

.center-action-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
}

#centerActionBtn {
  width: 62px;
  height: 62px;
  margin-top: -22px;
  border-radius: 50%;
  border: 3px solid #0b1120;
  background: linear-gradient(135deg, #22c55e, #0ea5e9);
  color: #04131c;
  font-size: 1.45rem;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 8px 26px rgba(34, 197, 94, 0.5);
  transition: transform 0.12s ease, background 0.15s ease;
}

#centerActionBtn:active { transform: scale(0.93); }
#centerActionBtn.playing {
  background: linear-gradient(135deg, #f97316, #dc2626);
  color: #ffffff;
  box-shadow: 0 8px 24px rgba(239, 68, 68, 0.5);
}

/* =========================================================================
   AJOUTS ÉTAPE 7 : MINI-JEUX DÉDIÉS & MODE LIBRE AUTO-DÉTECTION
   ========================================================================= */
#autoToggleBtn {
  display: none;
  background: rgba(34, 197, 94, 0.22);
  border: 1px solid rgba(74, 222, 128, 0.6);
  color: #86efac;
}

#autoToggleBtn.visible { display: inline-block; }
#autoToggleBtn.off {
  background: rgba(148, 163, 184, 0.16);
  border-color: rgba(148, 163, 184, 0.4);
  color: #cbd5e1;
}

#minigameBanner {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 12px;
  border-radius: 12px;
  background: linear-gradient(90deg, rgba(30, 58, 138, 0.78), rgba(88, 28, 135, 0.78));
  border: 1px solid rgba(129, 140, 248, 0.58);
  font-size: clamp(0.8rem, 2.3vw, 0.96rem);
}

#minigameBanner.visible { display: flex; }
.mg-banner-left { display: inline-flex; align-items: center; gap: 7px; color: #f8fafc; }
#mgIcon { font-size: 1.15rem; }
#mgMetric { font-weight: 900; color: #fde047; font-variant-numeric: tabular-nums; white-space: nowrap; }

.exercise-minigame-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 10px;
  background: linear-gradient(90deg, rgba(79, 70, 229, 0.28), rgba(14, 165, 233, 0.22));
  border: 1px solid rgba(129, 140, 248, 0.45);
  color: #e0e7ff;
  font-size: 0.78rem;
  font-weight: 800;
}

.summary-breakdown {
  display: none;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.65);
}

.summary-breakdown.visible { display: flex; }

.breakdown-chip {
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(56, 189, 248, 0.16);
  border: 1px solid rgba(56, 189, 248, 0.4);
  color: #bae6fd;
  font-size: 0.78rem;
  font-weight: 800;
}

/* =========================================================================
   AJOUTS ÉTAPE 8 : DÉMO SQUELETTE ANIMÉ & BOUTONS DÉMO
   ========================================================================= */
#hudDemoBtn {
  background: rgba(250, 204, 21, 0.2);
  border: 1px solid rgba(250, 204, 21, 0.55);
  color: #fef08a;
}

#hudDemoBtn:hover {
  background: rgba(250, 204, 21, 0.32);
}

.demo-mini-btn {
  padding: 6px 11px;
  border: 1px solid rgba(250, 204, 21, 0.55);
  border-radius: 9px;
  background: rgba(250, 204, 21, 0.16);
  color: #fef08a;
  font-size: 0.8rem;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
}

.demo-mini-btn:hover {
  background: rgba(250, 204, 21, 0.28);
}

.exercise-card-actions {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

.exercise-card-actions .demo-mini-btn {
  flex: 0 0 auto;
  min-height: 38px;
  padding: 6px 12px;
}

.exercise-card-actions .mini-launch-btn {
  flex: 1;
  min-height: 38px;
}

.stage-actions-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.stage-actions-row .demo-mini-btn {
  min-height: 42px;
  padding: 6px 12px;
}

.stage-actions-row .stage-launch-btn {
  flex: 1;
}

.demo-modal-overlay {
  z-index: 60;
  inset: 0;
}

.demo-card {
  width: min(94vw, 510px);
  gap: 11px;
}

.demo-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.demo-canvas-wrap {
  position: relative;
  width: 100%;
  border-radius: 16px;
  overflow: hidden;
  border: 2px solid rgba(56, 189, 248, 0.45);
  background: #0f172a;
}

#demoCanvas {
  width: 100%;
  height: auto;
  display: block;
}

.demo-phase-caption {
  padding: 8px 12px;
  background: rgba(15, 23, 42, 0.92);
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  color: #4ade80;
  font-size: 0.9rem;
  font-weight: 900;
}

.demo-actions-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

/* =========================================================================
   AJOUTS ÉTAPE 9 : POSITION PRÊT MINI-JEUX & NAVIGATION GESTUELLE
   ========================================================================= */
#gestureNavToggleBtn {
  background: rgba(16, 185, 129, 0.22);
  border: 1px solid rgba(52, 211, 153, 0.55);
  color: #6ee7b7;
}

#gestureNavToggleBtn.off {
  background: rgba(148, 163, 184, 0.16);
  border-color: rgba(148, 163, 184, 0.4);
  color: #cbd5e1;
}

.ready-ex-switcher {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px;
  border-radius: 14px;
  background: rgba(30, 41, 59, 0.85);
  border: 1px solid rgba(148, 163, 184, 0.28);
}

.ready-ex-switcher.hidden {
  display: none;
}

.switcher-arrow-btn {
  min-width: 42px;
  min-height: 38px;
  border: 1px solid rgba(56, 189, 248, 0.45);
  border-radius: 10px;
  background: rgba(14, 116, 144, 0.28);
  color: #e0f2fe;
  font-size: 1rem;
  font-weight: 900;
  cursor: pointer;
}

.switcher-arrow-btn:active {
  transform: scale(0.94);
}

.ready-ex-badge {
  flex: 1;
  text-align: center;
  font-size: clamp(0.9rem, 2.7vw, 1.05rem);
  font-weight: 900;
  color: #fde047;
  padding: 0 4px;
}

#gestureToast {
  position: fixed;
  top: max(18px, env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%) translateY(-16px);
  z-index: 70;
  width: min(90vw, 420px);
  padding: 12px 16px;
  border-radius: 18px;
  background: rgba(15, 23, 42, 0.94);
  backdrop-filter: blur(12px);
  border: 2px solid #38bdf8;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
  gap: 8px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.16s ease, transform 0.16s ease;
}

#gestureToast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.gesture-toast-top {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: clamp(0.95rem, 3vw, 1.15rem);
  color: #ffffff;
}

#gestureToastIcon {
  font-size: 1.3rem;
}

/* =========================================================================
   AJOUTS ÉTAPE 10 : REPLI MANUEL SANS CDN MEDIAPIPE
   ========================================================================= */
.controls-btn-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}

#manualRepBtn {
  pointer-events: auto;
  display: none;
  min-height: 44px;
  padding: 9px 18px;
  border: 2px solid rgba(74, 222, 128, 0.75);
  border-radius: 999px;
  background: linear-gradient(135deg, #22c55e, #0ea5e9);
  color: #04131c;
  font-size: 0.94rem;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 8px 22px rgba(34, 197, 94, 0.45);
  transition: transform 0.1s ease;
}

#manualRepBtn.visible {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

#manualRepBtn:active {
  transform: scale(0.95);
}

/* =========================================================================
   AJOUTS ÉTAPE 11 : ONBOARDING 1 CLIC, CADRAGE, HUD ALLÉGÉ/ESSENTIEL,
   AUDIO/ÉCO & RESPONSIVE PETITS ÉCRANS (360px–390px)
   ========================================================================= */
.hud-icon-btn {
  min-width: 40px;
  padding: 6px 9px;
  background: rgba(30, 41, 59, 0.82);
  border: 1px solid rgba(148, 163, 184, 0.35);
  color: #f8fafc;
}

#soundToggleBtn.muted {
  background: rgba(127, 29, 29, 0.45);
  border-color: rgba(248, 113, 113, 0.55);
  color: #fca5a5;
}

#ecoModeBtn.active {
  background: rgba(34, 197, 94, 0.25);
  border-color: rgba(74, 222, 128, 0.65);
  color: #86efac;
}

#essentialHudBtn.active {
  background: rgba(56, 189, 248, 0.28);
  border-color: rgba(56, 189, 248, 0.7);
  color: #e0f2fe;
}

#gestureNavToggleBtn.menus-only {
  background: rgba(250, 204, 21, 0.18);
  border-color: rgba(250, 204, 21, 0.5);
  color: #fef08a;
}

/* Onboarding 1 clic & Repères de cadrage */
.welcome-card {
  gap: 11px;
}

.quick-start-cta {
  min-height: 58px;
  font-size: clamp(1.06rem, 3.8vw, 1.3rem);
  background: linear-gradient(135deg, #22c55e, #0ea5e9);
  color: #031521;
  box-shadow: 0 12px 30px rgba(34, 197, 94, 0.45);
}

.framing-overview {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  text-align: left;
}

.framing-pill,
.framing-guide-box {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 10px;
  border-radius: 13px;
  background: rgba(15, 23, 42, 0.78);
  border: 1px solid rgba(56, 189, 248, 0.35);
  text-align: left;
}

.framing-guide-box {
  width: 100%;
  background: rgba(14, 116, 144, 0.22);
  border-color: rgba(56, 189, 248, 0.52);
}

.framing-icon {
  font-size: 1.45rem;
  line-height: 1;
  flex-shrink: 0;
}

.framing-pill strong,
.framing-text strong {
  display: block;
  font-size: 0.8rem;
  font-weight: 900;
  color: #e0f2fe;
}

.framing-pill span,
.framing-text span {
  display: block;
  font-size: 0.72rem;
  color: #94a3b8;
  line-height: 1.25;
}

.welcome-prefs-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
}

.pref-chip {
  min-height: 36px;
  padding: 6px 11px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(15, 23, 42, 0.75);
  color: #cbd5e1;
  font-size: 0.78rem;
  font-weight: 800;
  cursor: pointer;
}

.pref-chip.active {
  background: rgba(34, 197, 94, 0.22);
  border-color: rgba(74, 222, 128, 0.65);
  color: #86efac;
}

.welcome-advanced {
  width: 100%;
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.58);
  border: 1px solid rgba(255, 255, 255, 0.14);
  padding: 8px 11px;
  text-align: left;
}

.welcome-advanced summary {
  cursor: pointer;
  font-size: 0.86rem;
  font-weight: 800;
  color: #7dd3fc;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.welcome-advanced summary::-webkit-details-marker { display: none; }
.welcome-advanced summary::after { content: '▾'; font-size: 0.95rem; }
.welcome-advanced[open] summary::after { content: '▴'; }

.welcome-advanced-body {
  display: flex;
  flex-direction: column;
  gap: 11px;
  margin-top: 11px;
}

.launch-custom-cta {
  background: rgba(37, 99, 235, 0.28);
  border-color: rgba(96, 165, 250, 0.6);
  color: #e0f2fe;
}

/* =========================================================================
   ALLÈGEMENT DU HUD EN COURS D'EFFORT (.in-effort)
   ========================================================================= */
#hud.in-effort {
  padding: 6px 10px;
  gap: 5px;
  background: rgba(15, 23, 42, 0.74);
}

#hud.in-effort .hud-secondary {
  display: none !important;
}

#hud.in-effort .hud-top-row {
  justify-content: flex-end;
}

#hud.in-effort .stat-secondary,
#hud.in-effort .stat-combo.empty {
  display: none !important;
}

#hud.in-effort .hud-stats-row {
  display: flex;
  gap: 6px;
}

#hud.in-effort .hud-stats-row .stat {
  flex: 1 1 0;
  min-width: 0;
}

#controls.in-effort #toggleCamBtn {
  display: none;
}

/* =========================================================================
   MODE HUD ESSENTIEL (body.essential-hud)
   ========================================================================= */
body.essential-hud #hud {
  width: min(94vw, 560px);
  padding: 6px 10px;
  gap: 4px;
  border-radius: 16px;
  background: rgba(15, 23, 42, 0.72);
}

body.essential-hud #hud .hud-secondary,
body.essential-hud #hud .hud-utility,
body.essential-hud #hud #ecoModeBtn,
body.essential-hud #hud .stat-secondary,
body.essential-hud #hud .stat-combo,
body.essential-hud #hud #ghostBar {
  display: none !important;
}

body.essential-hud #hud .hud-top-row {
  justify-content: flex-end;
  gap: 5px;
}

body.essential-hud #hud .hud-stats-row {
  display: flex;
  gap: 6px;
}

body.essential-hud #hud .hud-stats-row .stat {
  flex: 1 1 0;
  min-width: 0;
  padding: 3px 4px;
}

body.essential-hud #hud #minigameBanner {
  padding: 4px 10px;
  font-size: 0.78rem;
}

/* =========================================================================
   ADAPTATION PETITS ÉCRANS MOBILES (360px – 430px)
   ========================================================================= */
@media (max-width: 430px) {
  :root {
    --nav-height: 58px;
  }

  #hud {
    width: 97vw;
    top: max(6px, env(safe-area-inset-top));
    padding: 6px 8px;
    gap: 5px;
    border-radius: 14px;
  }

  .hud-top-row {
    gap: 4px;
  }

  #modeSelect {
    flex: 1 1 100%;
    min-height: 35px;
    font-size: 0.82rem;
    padding: 4px 8px;
  }

  .hud-btn {
    min-height: 34px;
    padding: 4px 8px;
    font-size: 0.76rem;
    border-radius: 8px;
  }

  .hud-icon-btn {
    min-width: 34px;
    padding: 4px 7px;
  }

  #minigameBanner {
    padding: 4px 9px;
    font-size: 0.76rem;
    border-radius: 10px;
  }

  .hud-stats-row {
    gap: 4px;
  }

  .stat {
    padding: 3px 2px;
    border-radius: 8px;
  }

  .stat-label {
    font-size: 0.55rem;
    letter-spacing: 0.03em;
  }

  .stat-value {
    font-size: clamp(1.05rem, 4.8vw, 1.38rem);
  }

  #multiplierPill {
    font-size: 0.68rem;
    padding: 1px 5px;
  }

  #stageGoalBar,
  #cardioSeqBar {
    padding: 5px 9px;
    gap: 4px;
  }

  .stage-goal-header,
  .cardio-seq-top {
    font-size: 0.74rem;
  }

  #readyStartOverlay {
    padding: 10px;
    align-items: flex-end;
  }

  .ready-card {
    width: 95vw;
    max-height: calc(100dvh - 175px);
    overflow-y: auto;
    padding: 14px 14px;
    gap: 9px;
    border-radius: 18px;
  }

  .ready-card h3 { font-size: 1.12rem; }
  .ready-card p { font-size: 0.82rem; }

  #startChallengeBtn {
    min-height: 48px;
    padding: 10px 18px;
    font-size: 1.12rem;
  }

  .modal-card {
    padding: 16px 14px;
    gap: 10px;
    border-radius: 20px;
  }

  .framing-overview {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .difficulty-grid {
    gap: 6px;
  }

  .diff-btn {
    min-height: 64px;
    padding: 6px 4px;
  }

  #controls {
    bottom: calc(var(--nav-height) + env(safe-area-inset-bottom) + 8px);
    width: 94vw;
  }

  #statusBadge {
    padding: 6px 11px;
    font-size: 0.75rem;
  }

  #bottomNav {
    grid-template-columns: 1fr 1fr 66px 1fr 1fr;
  }

  .nav-tab {
    font-size: 0.66rem;
    gap: 2px;
  }

  .nav-tab .nav-icon {
    font-size: 1.15rem;
  }

  #centerActionBtn {
    width: 52px;
    height: 52px;
    margin-top: -16px;
    font-size: 1.25rem;
  }
}

@media (max-width: 375px) {
  #hud {
    padding: 5px 6px;
  }

  .hud-btn {
    min-height: 32px;
    padding: 3px 7px;
    font-size: 0.72rem;
  }

  .stat-value {
    font-size: 1.02rem;
  }

  .ready-ex-badge {
    font-size: 0.84rem;
  }

  .framing-pill,
  .framing-guide-box {
    padding: 7px 8px;
    gap: 7px;
  }
}

/* =========================================================================
   AJOUTS ÉTAPE 12 : PARAMÈTRES, MICRO-OBJECTIFS, DÉFIS HEBDO, BILAN ACTIONNABLE,
   DIAGNOSTIC CAMÉRA/PERF & EXPORT/IMPORT
   ========================================================================= */
#minigameBanner {
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
}

.mg-banner-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.mg-challenge-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: 3px;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  font-size: clamp(0.72rem, 2vw, 0.84rem);
  color: #e0f2fe;
  font-weight: 800;
}

.mg-quality-badge {
  display: none;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 900;
  white-space: nowrap;
}

.mg-quality-badge.visible { display: inline-block; }
.mg-quality-badge.perfect { background: rgba(74, 222, 128, 0.25); color: #86efac; border: 1px solid rgba(74, 222, 128, 0.65); }
.mg-quality-badge.good { background: rgba(56, 189, 248, 0.25); color: #bae6fd; border: 1px solid rgba(56, 189, 248, 0.6); }

body.essential-hud #mgChallengeRow {
  display: none;
}

/* Alerte ralentissement / chauffe */
#slowPerfToast {
  position: fixed;
  bottom: calc(var(--nav-height) + env(safe-area-inset-bottom) + 64px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 65;
  width: min(92vw, 440px);
  padding: 10px 14px;
  border-radius: 16px;
  background: rgba(15, 23, 42, 0.94);
  border: 2px solid #f59e0b;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.55);
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 0.84rem;
  font-weight: 800;
  color: #fef3c7;
}

#slowPerfToast.visible { display: flex; }

.slow-perf-actions {
  display: inline-flex;
  gap: 6px;
}

/* Panneau Paramètres */
.settings-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.setting-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.setting-row strong {
  display: block;
  font-size: 0.92rem;
  color: #ffffff;
}

.setting-row span {
  display: block;
  font-size: 0.78rem;
  color: #94a3b8;
  line-height: 1.28;
}

.setting-toggle {
  min-width: 64px;
  min-height: 36px;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.45);
  background: rgba(51, 65, 85, 0.8);
  color: #cbd5e1;
  font-size: 0.82rem;
  font-weight: 900;
  cursor: pointer;
  flex-shrink: 0;
}

.setting-toggle.active {
  background: rgba(34, 197, 94, 0.25);
  border-color: rgba(74, 222, 128, 0.7);
  color: #86efac;
}

.setting-select {
  min-height: 38px;
  max-width: 210px;
  padding: 6px 10px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: #0f172a;
  color: #f8fafc;
  font-size: 0.84rem;
  font-weight: 800;
}

/* Diagnostic Caméra / Perf / Réseau */
.diag-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(175px, 1fr));
  gap: 8px;
}

.diag-cell {
  padding: 10px 11px;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.76);
  border: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.diag-cell small {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #94a3b8;
  font-weight: 800;
}

.diag-cell strong {
  font-size: 0.88rem;
  font-weight: 900;
  color: #e2e8f0;
}

.diag-cell.ok strong { color: #4ade80; }
.diag-cell.warn strong { color: #facc15; }
.diag-cell.err strong { color: #f87171; }

.backup-actions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
}

.backup-actions-grid button {
  min-height: 42px;
  font-size: 0.86rem;
}

/* Défis hebdomadaires & Jalons Programme */
.weekly-challenges-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.weekly-challenge-item {
  padding: 11px 12px;
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.76);
  border: 1px solid rgba(255, 255, 255, 0.12);
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.weekly-challenge-item.done {
  border-color: rgba(74, 222, 128, 0.6);
  background: rgba(20, 83, 45, 0.28);
}

.wc-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 0.86rem;
}

.wc-top strong { color: #ffffff; }
.wc-xp {
  font-size: 0.72rem;
  font-weight: 900;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(56, 189, 248, 0.2);
  color: #7dd3fc;
}

.milestones-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.milestone-pill {
  padding: 8px 6px;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.1);
  text-align: center;
  font-size: 0.74rem;
  color: #94a3b8;
  font-weight: 800;
}

.milestone-pill.reached {
  background: rgba(250, 204, 21, 0.16);
  border-color: rgba(250, 204, 21, 0.65);
  color: #fde047;
}

/* Bilan post-séance actionnable */
.summary-actionable-card {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 11px 12px;
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.82);
  border: 1px solid rgba(56, 189, 248, 0.35);
  text-align: left;
  font-size: 0.82rem;
  color: #e2e8f0;
}

.actionable-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  line-height: 1.32;
}

.act-badge {
  flex-shrink: 0;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 900;
  text-transform: uppercase;
}

.act-badge.good { background: rgba(34, 197, 94, 0.22); color: #4ade80; border: 1px solid rgba(74, 222, 128, 0.5); }
.act-badge.tip { background: rgba(245, 158, 11, 0.22); color: #fde047; border: 1px solid rgba(250, 204, 21, 0.5); }
.act-badge.next { background: rgba(56, 189, 248, 0.22); color: #7dd3fc; border: 1px solid rgba(56, 189, 248, 0.5); }

@media (max-width: 480px) {
  .setting-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  .setting-select {
    width: 100%;
    max-width: none;
  }
  .milestones-strip {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* =========================================================================
   AJOUTS ÉTAPE 13 : CLOUD AUTH & MODE RAID QUOTIDIEN
   ========================================================================= */
.input-group input {
  width: 100%;
  outline: none;
}

.input-group input:focus {
  border-color: #38bdf8;
}

#stageGoalBar.raid-style {
  background: linear-gradient(90deg, rgba(154, 52, 18, 0.88), rgba(185, 28, 28, 0.88));
  border-color: rgba(251, 146, 60, 0.78);
}

.raid-card {
  background: linear-gradient(145deg, rgba(124, 45, 18, 0.34), rgba(15, 23, 42, 0.94));
  border-color: rgba(251, 146, 60, 0.55);
}

.raid-exercises-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.raid-ex-row {
  padding: 11px 12px;
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.12);
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.raid-ex-row.done {
  border-color: rgba(74, 222, 128, 0.65);
  background: rgba(20, 83, 45, 0.28);
}

.raid-ex-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.raid-ex-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.raid-cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.raid-feedback {
  font-size: 0.84rem;
  font-weight: 800;
  color: #38bdf8;
}

.raid-feedback.error {
  color: #f87171;
}

.raid-feedback.success {
  color: #4ade80;
}

/* =========================================================================
   AJOUTS ÉTAPE 14 : CORRECTIFS FIREFOX MOBILE (VISIBILITÉ ERREURS & MODALES)
   ========================================================================= */
#controls {
  z-index: 42;
}

.welcome-cam-feedback {
  display: none;
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(127, 29, 29, 0.72);
  border: 1px solid rgba(248, 113, 113, 0.75);
  color: #fecaca;
  font-size: 0.82rem;
  font-weight: 800;
  line-height: 1.35;
  text-align: left;
}

.welcome-cam-feedback.visible {
  display: block;
}

.welcome-cam-feedback.info {
  background: rgba(14, 116, 144, 0.35);
  border-color: rgba(56, 189, 248, 0.65);
  color: #bae6fd;
}

@media (max-height: 760px) {
  .modal-overlay {
    align-items: flex-start;
  }
}

/* =========================================================================
   AJOUTS ÉTAPE 15 : MODE DUEL 1v1 TEMPS RÉEL
   ========================================================================= */
.segmented-tabs {
  flex-wrap: wrap;
}

#stageGoalBar.duel-style {
  background: linear-gradient(90deg, rgba(109, 40, 217, 0.9), rgba(190, 24, 93, 0.9));
  border-color: rgba(232, 121, 249, 0.8);
}

.duel-card {
  background: linear-gradient(145deg, rgba(88, 28, 135, 0.38), rgba(15, 23, 42, 0.95));
  border-color: rgba(192, 132, 252, 0.55);
}

.duel-code-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.85);
  border: 1px dashed rgba(232, 121, 249, 0.7);
  color: #f0abfc;
  font-size: 1.08rem;
  font-weight: 900;
  letter-spacing: 0.14em;
  font-variant-numeric: tabular-nums;
}

.duel-versus-grid {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 10px;
  align-items: center;
}

@media (max-width: 520px) {
  .duel-versus-grid {
    grid-template-columns: 1fr;
  }
  .duel-vs-badge {
    justify-self: center;
  }
}

.duel-player-box {
  padding: 12px;
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.82);
  border: 2px solid rgba(255, 255, 255, 0.14);
  display: flex;
  flex-direction: column;
  gap: 5px;
  text-align: center;
}

.duel-player-box.ready {
  border-color: rgba(74, 222, 128, 0.72);
  background: rgba(20, 83, 45, 0.28);
}

.duel-player-box.winner {
  border-color: #facc15;
  box-shadow: 0 0 20px rgba(250, 204, 21, 0.3);
}

.duel-player-box strong {
  font-size: 1rem;
  color: #ffffff;
}

.duel-player-score {
  font-size: 1.3rem;
  font-weight: 900;
  color: #38bdf8;
}

.duel-vs-badge {
  padding: 6px 12px;
  border-radius: 999px;
  background: linear-gradient(135deg, #c026d3, #f43f5e);
  color: #ffffff;
  font-size: 0.86rem;
  font-weight: 900;
  letter-spacing: 0.06em;
}

.duel-join-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
}

.duel-join-row input {
  min-height: 42px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: #0f172a;
  color: #f8fafc;
  font-size: 0.96rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.duel-open-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.duel-open-row {
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.76);
  border: 1px solid rgba(255, 255, 255, 0.12);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.duel-result-banner {
  padding: 12px 14px;
  border-radius: 14px;
  text-align: center;
  font-size: 1.05rem;
  font-weight: 900;
  background: rgba(15, 23, 42, 0.85);
  border: 2px solid #c084fc;
  color: #f5d0fe;
}

.duel-result-banner.win {
  border-color: #4ade80;
  color: #86efac;
  background: rgba(20, 83, 45, 0.4);
}

.duel-result-banner.lose {
  border-color: #f87171;
  color: #fecaca;
  background: rgba(127, 29, 29, 0.38);
}

/* =========================================================================
   AJOUTS ÉTAPE 16 : MATCHMAKING, LIGUES, BOTS, AMIS & NOTIFICATIONS IN-APP
   ========================================================================= */
.panel-header-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.notif-bell-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.notif-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: #ef4444;
  color: #ffffff;
  font-size: 0.68rem;
  font-weight: 900;
  display: none;
  align-items: center;
  justify-content: center;
  border: 2px solid #0f172a;
}

.notif-badge.visible {
  display: inline-flex;
}

.ranked-card {
  background: linear-gradient(145deg, rgba(180, 83, 9, 0.34), rgba(15, 23, 42, 0.95));
  border-color: rgba(250, 204, 21, 0.6);
}

.league-card {
  background: linear-gradient(145deg, rgba(14, 116, 144, 0.34), rgba(30, 27, 75, 0.94));
  border-color: rgba(56, 189, 248, 0.55);
}

.friends-card {
  background: linear-gradient(145deg, rgba(22, 101, 52, 0.32), rgba(15, 23, 42, 0.95));
  border-color: rgba(74, 222, 128, 0.52);
}

.mm-searching-box {
  padding: 14px;
  border-radius: 16px;
  background: rgba(15, 23, 42, 0.86);
  border: 2px solid rgba(250, 204, 21, 0.65);
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: center;
}

.mm-timer-big {
  font-size: 1.9rem;
  font-weight: 900;
  color: #fde047;
  font-variant-numeric: tabular-nums;
}

.league-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 11px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 900;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.league-tiers-strip {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
}

@media (max-width: 560px) {
  .league-tiers-strip {
    grid-template-columns: repeat(3, 1fr);
  }
}

.league-tier-chip {
  padding: 7px 4px;
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.1);
  text-align: center;
  font-size: 0.72rem;
  font-weight: 800;
  color: #94a3b8;
}

.league-tier-chip.current {
  border-color: #facc15;
  background: rgba(250, 204, 21, 0.16);
  color: #fef08a;
}

.leaderboard-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.lb-row {
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.lb-row.me {
  border-color: rgba(56, 189, 248, 0.7);
  background: rgba(14, 116, 144, 0.26);
}

.lb-row.promo {
  border-left: 4px solid #4ade80;
}

.lb-row.bot {
  border-style: dashed;
  border-color: rgba(148, 163, 184, 0.35);
}

.lb-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.lb-rank {
  min-width: 28px;
  font-weight: 900;
  color: #fde047;
  font-size: 0.94rem;
}

.lb-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.bot-tag {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 0.66rem;
  font-weight: 900;
  background: rgba(148, 163, 184, 0.25);
  color: #cbd5e1;
  margin-left: 5px;
  vertical-align: middle;
}

.raid-bot-banner {
  padding: 9px 12px;
  border-radius: 12px;
  background: rgba(56, 189, 248, 0.15);
  border: 1px solid rgba(56, 189, 248, 0.45);
  font-size: 0.8rem;
  font-weight: 800;
  color: #bae6fd;
}

.friend-profile-box {
  padding: 12px;
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.78);
  border: 1px solid rgba(74, 222, 128, 0.35);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.friend-search-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
}

.friend-search-row input {
  min-height: 42px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: #0f172a;
  color: #f8fafc;
  font-size: 0.92rem;
  font-weight: 700;
}

.notif-modal-card {
  width: min(94vw, 480px);
  max-height: 82dvh;
  text-align: left;
}

.notif-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  max-height: 60dvh;
  padding-right: 2px;
}

.notif-item {
  padding: 11px 12px;
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.12);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.notif-item.unread {
  border-color: rgba(56, 189, 248, 0.75);
  background: rgba(14, 116, 144, 0.22);
}

.notif-item-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.notif-item-top strong {
  font-size: 0.9rem;
  color: #ffffff;
}

.notif-item-top small {
  font-size: 0.72rem;
  color: #94a3b8;
  white-space: nowrap;
}

.notif-item p {
  font-size: 0.82rem;
  color: #cbd5e1;
  line-height: 1.32;
}

.notif-item-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* =========================================================================
   AJOUTS ÉTAPE 17 : BANDEAUX PUBLICITAIRES (HORS EFFORT) & MODE PREMIUM
   ========================================================================= */
body.is-premium .ad-banner-slot,
body.is-premium #adConsentBanner {
  display: none !important;
}

.ad-banner-slot {
  width: 100%;
  margin-top: 4px;
  border-radius: 16px;
  background: rgba(15, 23, 42, 0.88);
  border: 1px dashed rgba(148, 163, 184, 0.35);
  padding: 10px 12px;
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ad-banner-slot.ad-banner-compact {
  min-height: 54px;
  padding: 8px 10px;
}

.ad-banner-inner {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.ad-banner-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-align: left;
  flex: 1 1 180px;
}

.ad-tag {
  display: inline-block;
  align-self: flex-start;
  padding: 1px 6px;
  border-radius: 6px;
  background: rgba(148, 163, 184, 0.22);
  color: #94a3b8;
  font-size: 0.64rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.ad-banner-copy strong {
  font-size: 0.84rem;
  color: #e2e8f0;
}

.ad-banner-copy span {
  font-size: 0.74rem;
  color: #94a3b8;
}

.ad-upgrade-btn {
  padding: 7px 12px;
  border: 1px solid rgba(250, 204, 21, 0.65);
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(234, 179, 8, 0.24), rgba(249, 115, 22, 0.24));
  color: #fef08a;
  font-size: 0.78rem;
  font-weight: 900;
  cursor: pointer;
  white-space: nowrap;
}

.premium-card {
  background: linear-gradient(145deg, rgba(161, 98, 7, 0.3), rgba(15, 23, 42, 0.96));
  border-color: rgba(250, 204, 21, 0.55);
}

.premium-card.premium-active {
  background: linear-gradient(145deg, rgba(20, 83, 45, 0.36), rgba(113, 63, 18, 0.36));
  border-color: rgba(250, 204, 21, 0.85);
  box-shadow: 0 0 24px rgba(250, 204, 21, 0.18);
}

.premium-perks-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 0.84rem;
  color: #e2e8f0;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.62);
}

.promo-redeem-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
}

.promo-redeem-row input {
  min-height: 42px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid rgba(250, 204, 21, 0.45);
  background: #0f172a;
  color: #fef08a;
  font-size: 0.94rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  outline: none;
}

.promo-redeem-row button {
  min-height: 42px;
  padding: 8px 16px;
}

.history-30-grid {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 5px;
}

@media (max-width: 480px) {
  .history-30-grid {
    grid-template-columns: repeat(6, 1fr);
  }
}

.history-30-cell {
  padding: 6px 2px;
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.08);
  text-align: center;
  font-size: 0.68rem;
  color: #64748b;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.history-30-cell.lvl1 {
  background: rgba(56, 189, 248, 0.18);
  border-color: rgba(56, 189, 248, 0.45);
  color: #bae6fd;
}

.history-30-cell.lvl2 {
  background: rgba(34, 197, 94, 0.24);
  border-color: rgba(74, 222, 128, 0.6);
  color: #bbf7d0;
}

.history-30-cell.lvl3 {
  background: rgba(250, 204, 21, 0.24);
  border-color: rgba(250, 204, 21, 0.72);
  color: #fef08a;
}

#adConsentBanner {
  position: fixed;
  left: 50%;
  bottom: calc(var(--nav-height) + env(safe-area-inset-bottom) + 10px);
  transform: translateX(-50%);
  z-index: 68;
  width: min(94vw, 560px);
  padding: 11px 14px;
  border-radius: 16px;
  background: rgba(15, 23, 42, 0.96);
  border: 1px solid rgba(56, 189, 248, 0.55);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.65);
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

#adConsentBanner.visible {
  display: flex;
}

.ad-consent-text {
  flex: 1 1 220px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 0.78rem;
  color: #cbd5e1;
}

.ad-consent-text strong {
  color: #ffffff;
  font-size: 0.86rem;
}

.ad-consent-actions {
  display: inline-flex;
  gap: 6px;
  flex-wrap: wrap;
}

/* Liens légaux (Confidentialité & Mentions légales) */
.legal-links-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 0.78rem;
  color: #94a3b8;
  padding-top: 2px;
}

.legal-links-bar a {
  color: #7dd3fc;
  text-decoration: none;
  font-weight: 700;
}

.legal-links-bar a:hover {
  text-decoration: underline;
}

/* Sélecteur de langue (FR / EN / ES) */
.lang-switcher-bar {
  display: inline-flex;
  align-self: center;
  gap: 5px;
  padding: 4px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.16);
}

.lang-pill {
  padding: 4px 10px;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: #94a3b8;
  font-size: 0.76rem;
  font-weight: 800;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.lang-pill.active {
  background: #2563eb;
  color: #ffffff;
}

/* =========================================================================
   NAVIGATION v8 : BARRE HAUTE FIXE, ARÈNE PLEIN ÉCRAN, ACCUEIL, PAUSE & PARAMÈTRES
   ========================================================================= */
#appTopBar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 58px;
  z-index: 36;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  background: rgba(11, 17, 32, 0.92);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(14px);
}

body.in-arena #appTopBar,
body.in-arena #bottomNav {
  display: none !important;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar-logo {
  font-size: 1.18rem;
  font-weight: 900;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #4ade80, #38bdf8);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.topbar-pill {
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(30, 41, 59, 0.9);
  border: 1px solid rgba(56, 189, 248, 0.35);
  color: #e2e8f0;
  font-size: 0.76rem;
  font-weight: 800;
  white-space: nowrap;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.topbar-icon-btn {
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(30, 41, 59, 0.88);
  color: #f8fafc;
  font-size: 1.05rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.12s ease, background 0.15s ease;
}

.topbar-icon-btn:hover {
  background: rgba(51, 65, 85, 0.95);
  transform: translateY(-1px);
}

/* Décalage des panneaux sous la barre haute fixe */
.tab-panel {
  padding-top: 72px !important;
  padding-bottom: 104px !important;
}

/* Arène plein écran : contrôles caméra abaissés sans barre basse */
body.in-arena #controls {
  bottom: 14px !important;
}

body.in-arena #slowPerfToast {
  bottom: 72px !important;
}

/* HUD d'Arène épuré (3 éléments max en haut) */
.arena-hud-bar {
  display: flex !important;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  flex-wrap: nowrap;
}

.arena-center-pills {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 0;
  flex: 1;
}

.hud-exit-btn {
  background: rgba(15, 23, 42, 0.85) !important;
  border: 1px solid rgba(255, 255, 255, 0.22) !important;
  color: #f8fafc !important;
  font-weight: 800;
  white-space: nowrap;
}

.hud-ex-pill {
  background: rgba(14, 165, 233, 0.24) !important;
  border: 1px solid rgba(56, 189, 248, 0.5) !important;
  color: #e0f2fe !important;
  font-weight: 900;
  max-width: 190px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hud-pause-btn {
  background: rgba(250, 204, 21, 0.2) !important;
  border: 1px solid rgba(250, 204, 21, 0.6) !important;
  color: #fef08a !important;
  font-weight: 900;
  white-space: nowrap;
}

/* Écran Prêt : ligne secondaire Démo + Retour */
.ready-secondary-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  width: 100%;
}

/* Onglet Accueil */
.home-hero-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.home-hero-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.home-hero-title {
  font-size: clamp(1.45rem, 4.6vw, 1.95rem);
  font-weight: 900;
  color: #ffffff;
  line-height: 1.15;
}

.lang-switcher-bar.compact {
  margin: 0;
  flex-shrink: 0;
}

.lang-switcher-bar.compact .lang-pill {
  padding: 5px 9px;
  font-size: 0.74rem;
}

.home-today-summary {
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid rgba(56, 189, 248, 0.28);
  border-radius: 14px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.home-today-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.home-today-top strong {
  color: #f8fafc;
  font-size: 0.96rem;
}

.home-shortcuts-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.home-shortcut-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 12px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(30, 41, 59, 0.78);
  color: #f8fafc;
  text-align: left;
  cursor: pointer;
  transition: transform 0.12s ease, border-color 0.15s ease, background 0.15s ease;
}

.home-shortcut-card:hover {
  transform: translateY(-2px);
  border-color: rgba(56, 189, 248, 0.55);
  background: rgba(30, 41, 59, 0.96);
}

.home-shortcut-card .shortcut-ico {
  font-size: 1.25rem;
}

.home-shortcut-card strong {
  font-size: 0.88rem;
  font-weight: 800;
  color: #ffffff;
}

.home-shortcut-card span:last-child {
  font-size: 0.74rem;
  color: #94a3b8;
  line-height: 1.25;
}

/* S'entraîner : bandeau Mode Libre + grille Modes */
.libre-banner-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.16), rgba(34, 197, 94, 0.14)) !important;
  border-color: rgba(56, 189, 248, 0.4) !important;
}

.modes-launch-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.mode-launch-card {
  background: rgba(15, 23, 42, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
}

.mode-launch-card strong {
  color: #ffffff;
  font-size: 0.96rem;
  display: block;
  margin-bottom: 4px;
}

/* Modale Pause Arène */
.pause-modal-card {
  max-width: 420px !important;
  gap: 12px !important;
}

.pause-actions-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  width: 100%;
}

.pause-actions-row button {
  padding: 10px 8px !important;
  font-size: 0.82rem !important;
}

.pause-finish-btn {
  border-color: rgba(248, 113, 113, 0.55) !important;
  color: #fecaca !important;
}

.pause-toggles-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  width: 100%;
}

.pause-toggles-grid .pref-chip {
  width: 100%;
  justify-content: center;
  padding: 10px 8px;
  font-size: 0.8rem;
}

/* Modale Éditeur de programme */
.plan-builder-modal-card {
  max-width: 680px !important;
  max-height: 88vh;
  overflow-y: auto;
  text-align: left !important;
}

/* Modale Paramètres dédiée + Accordéon 4 blocs */
.settings-modal-overlay {
  z-index: 65 !important;
  align-items: flex-start !important;
  padding-top: 16px !important;
}

.settings-modal-card {
  max-width: 720px !important;
  width: 100%;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  text-align: left !important;
  gap: 14px !important;
}

.settings-accordion {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

.settings-group {
  background: rgba(15, 23, 42, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 16px;
  overflow: hidden;
}

.settings-group > summary {
  list-style: none;
  cursor: pointer;
  padding: 14px 16px;
  font-weight: 900;
  font-size: 0.98rem;
  color: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
}

.settings-group > summary::-webkit-details-marker {
  display: none;
}

.settings-group > summary::after {
  content: '▾';
  color: #7dd3fc;
  font-size: 1rem;
  transition: transform 0.18s ease;
}

.settings-group[open] > summary {
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(30, 41, 59, 0.6);
}

.settings-group[open] > summary::after {
  transform: rotate(180deg);
}

.settings-group-body {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

@media (max-width: 520px) {
  .home-shortcuts-grid {
    grid-template-columns: 1fr;
  }
  .home-shortcut-card {
    flex-direction: row;
    align-items: center;
    gap: 10px;
  }
  .home-shortcut-card strong {
    min-width: 118px;
  }
  .arena-hud-bar .hud-btn {
    padding: 7px 10px;
    font-size: 0.78rem;
  }
}

/* =========================================================================
   v9 : MINI-SQUELETTE PLACEMENT, ALERTES CADRAGE, AVATAR ARCADE, FEEDBACK & STRAVA
   ========================================================================= */
.framing-guide-rich {
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  padding: 10px 12px;
}

.placement-svg-wrap {
  width: 96px;
  height: 70px;
  flex-shrink: 0;
  border-radius: 12px;
  background: radial-gradient(circle at 50% 50%, rgba(14, 165, 233, 0.18), rgba(15, 23, 42, 0.92));
  border: 1px solid rgba(56, 189, 248, 0.42);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.placement-svg-wrap.compact {
  width: 78px;
  height: 54px;
  border-radius: 10px;
}

.placement-svg-wrap svg {
  width: 100%;
  height: 100%;
  display: block;
}

.framing-title-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.framing-icon-sm {
  font-size: 1rem;
}

.framing-badges-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 5px;
}

.framing-mini-badge {
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 800;
  background: rgba(56, 189, 248, 0.16);
  border: 1px solid rgba(56, 189, 248, 0.42);
  color: #bae6fd;
  white-space: nowrap;
}

.ex-placement-strip {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 8px;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.62);
  border: 1px solid rgba(56, 189, 248, 0.22);
}

.ex-placement-meta {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 0.72rem;
  color: #cbd5e1;
}

.ex-placement-meta strong {
  color: #7dd3fc;
  font-size: 0.75rem;
}

/* Bandeau d'avertissement distance / détection difficile */
#framingWarnBanner {
  position: fixed;
  top: max(128px, 16vh);
  left: 50%;
  transform: translateX(-50%);
  z-index: 26;
  display: none;
  align-items: center;
  gap: 8px;
  max-width: min(92vw, 480px);
  padding: 9px 14px;
  border-radius: 999px;
  background: rgba(120, 53, 15, 0.92);
  border: 2px solid #f59e0b;
  color: #fef3c7;
  font-size: 0.84rem;
  font-weight: 800;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.5);
  pointer-events: none;
  text-align: center;
}

#framingWarnBanner.visible {
  display: inline-flex;
}

#framingWarnBanner.severe {
  background: rgba(127, 29, 29, 0.94);
  border-color: #f87171;
  color: #fecaca;
}

/* Bouton lien discret dans le pied de page */
.link-inline-btn {
  background: none;
  border: none;
  padding: 0;
  color: #7dd3fc;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.link-inline-btn:hover {
  text-decoration: underline;
}

/* Modale Feedback */
.feedback-modal-card {
  max-width: 520px !important;
  gap: 11px !important;
}

.feedback-modal-card textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: #0f172a;
  color: #f8fafc;
  font: 600 0.9rem/1.4 system-ui, sans-serif;
  resize: vertical;
  outline: none;
}

.feedback-modal-card textarea:focus {
  border-color: #38bdf8;
}

.feedback-check-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  width: 100%;
  text-align: left;
  font-size: 0.8rem;
  color: #cbd5e1;
  cursor: pointer;
}

.feedback-check-row input[type="checkbox"] {
  margin-top: 2px;
  width: 16px;
  height: 16px;
  accent-color: #38bdf8;
}

/* Carte & Boutons Export Fitness (.tcx) */
.tcx-card {
  border-color: rgba(252, 76, 2, 0.48) !important;
  background: linear-gradient(145deg, rgba(252, 76, 2, 0.13), rgba(15, 23, 42, 0.92)) !important;
}

.tcx-btn {
  background: linear-gradient(135deg, #fc4c02, #ea580c) !important;
  color: #ffffff !important;
}

.tcx-upload-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  min-height: 42px;
  font-size: 0.86rem;
}

.tcx-btn-outline {
  border-color: rgba(252, 76, 2, 0.7) !important;
  background: rgba(252, 76, 2, 0.16) !important;
  color: #fed7aa !important;
}

.tcx-summary-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
}

@keyframes pulseCamRay {
  0%, 100% { opacity: 0.25; }
  50% { opacity: 0.75; }
}

.placement-cam-ray {
  animation: pulseCamRay 2s ease-in-out infinite;
}

/* Mode Libre : options dédiées (Prêt + Bandeau) */
.ready-libre-options {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.ready-libre-options .pref-chip {
  width: 100%;
  justify-content: center;
  padding: 9px 8px;
  font-size: 0.78rem;
}

.libre-banner-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}


/* =========================================================================
   PACK FONDATEUR, BOUTIQUE COSMÉTIQUE, PARRAINAGE, CARTE PNG & AFFILIATION
   ========================================================================= */
.founder-home-card {
  background: linear-gradient(145deg, rgba(180, 83, 9, 0.28), rgba(15, 23, 42, 0.94)) !important;
  border-color: rgba(250, 204, 21, 0.55) !important;
}

.founder-cta-btn {
  background: linear-gradient(135deg, #facc15, #f97316) !important;
  color: #1c1917 !important;
  box-shadow: 0 10px 26px rgba(250, 204, 21, 0.35) !important;
}

.founder-summary-btn {
  border-color: rgba(250, 204, 21, 0.65) !important;
  background: linear-gradient(135deg, rgba(250, 204, 21, 0.16), rgba(249, 115, 22, 0.16)) !important;
  color: #fef08a !important;
}

body.is-premium .founder-summary-btn {
  display: none !important;
}

.share-card-btn {
  border-color: rgba(56, 189, 248, 0.65) !important;
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.22), rgba(168, 85, 247, 0.22)) !important;
  color: #e0f2fe !important;
}

.summary-share-row {
  display: flex;
  flex-direction: column;
  gap: 5px;
  width: 100%;
}

.cosmetic-section-title {
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #fde047;
  margin-top: 4px;
}

.cosmetic-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
}

.cosmetic-item {
  padding: 10px;
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.78);
  border: 2px solid rgba(255, 255, 255, 0.12);
  display: flex;
  flex-direction: column;
  gap: 5px;
  text-align: left;
  cursor: pointer;
  color: #f8fafc;
  transition: border-color 0.15s ease, transform 0.1s ease;
}

.cosmetic-item:hover {
  border-color: rgba(56, 189, 248, 0.55);
}

.cosmetic-item.equipped {
  border-color: #4ade80;
  background: rgba(20, 83, 45, 0.3);
}

.cosmetic-item.locked {
  opacity: 0.72;
}

.cosmetic-swatch {
  width: 100%;
  height: 8px;
  border-radius: 999px;
}

.cosmetic-item strong {
  font-size: 0.86rem;
  color: #ffffff;
}

.cosmetic-item small {
  font-size: 0.72rem;
  color: #94a3b8;
}

/* Cadres cosmétiques de profil */
.profile-hero.frame-founder_gold {
  border: 2px solid #facc15 !important;
  box-shadow: 0 0 26px rgba(250, 204, 21, 0.32) !important;
  background: linear-gradient(135deg, rgba(161, 98, 7, 0.36), rgba(15, 23, 42, 0.96)) !important;
}

.profile-hero.frame-champion_neon {
  border: 2px solid #c084fc !important;
  box-shadow: 0 0 26px rgba(192, 132, 252, 0.32) !important;
  background: linear-gradient(135deg, rgba(88, 28, 135, 0.36), rgba(14, 116, 144, 0.32)) !important;
}

.referral-settings-box,
.referral-banner-box {
  padding: 11px 12px;
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.78);
  border: 1px solid rgba(56, 189, 248, 0.38);
  display: flex;
  flex-direction: column;
  gap: 8px;
}




/* =========================================================================
   MODE DUEL ISOLÉ (LIENS DE COMMUNICATION — AUCUN ACCÈS AUX AUTRES MODES)
   ========================================================================= */
body.duel-only-mode #bottomNav,
body.duel-only-mode #panelAccueil,
body.duel-only-mode #panelEntrainer,
body.duel-only-mode #panelProfil,
body.duel-only-mode #topNotifBtn,
body.duel-only-mode #topCosmeticsBtn,
body.duel-only-mode #premiumCard,
body.duel-only-mode #settingsGroupCosmetics,
body.duel-only-mode #setSkeletonThemeRow,
body.duel-only-mode #socialSubTabs,
body.duel-only-mode #subViewRaid,
body.duel-only-mode #subViewAmis,
body.duel-only-mode #fitnessExportCard,
body.duel-only-mode #settingsGroupPrivacy,
body.duel-only-mode #settingsGroupLegal,
body.duel-only-mode #demoLaunchBtn,
body.duel-only-mode #summaryNextGoalBtn,
body.duel-only-mode #summaryFounderBtn,
body.duel-only-mode #tcxSummaryRow,
body.duel-only-mode .ad-banner-slot,
body.duel-only-mode #adConsentBanner {
  display: none !important;
}

body.duel-only-mode .tab-panel {
  inset: 0 !important;
  padding-bottom: 32px !important;
}

body.duel-only-mode .modal-overlay {
  inset: 0 !important;
}

body.duel-only-mode #controls {
  bottom: 14px !important;
}

body.duel-only-mode #readyStartOverlay {
  inset: 0 !important;
}

.duel-only-comm-banner {
  padding: 10px 13px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(192, 38, 211, 0.22), rgba(14, 165, 233, 0.22));
  border: 1px solid rgba(232, 121, 249, 0.5);
  color: #f5d0fe;
  font-size: 0.82rem;
  font-weight: 800;
  line-height: 1.35;
}


/* =========================================================================
   MODE ARÈNE DUEL ÉPURÉ (LISIBLE À 2 MÈTRES, SANS MINI-JEU NI COMBOS)
   ========================================================================= */
body.in-duel-arena #statsRow,
body.in-duel-arena #stageGoalBar,
body.in-duel-arena #minigameBanner,
body.in-duel-arena #ghostBar,
body.in-duel-arena #cardioSeqBar {
  display: none !important;
}

#duelLiveBoard {
  display: none;
  flex-direction: column;
  gap: 8px;
  width: min(780px, 96vw);
  margin: 6px auto 0;
  padding: 12px 16px;
  border-radius: 18px;
  background: rgba(10, 15, 28, 0.90);
  border: 2px solid rgba(56, 189, 248, 0.55);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(8px);
}
body.in-duel-arena #duelLiveBoard {
  display: flex;
}

.duel-board-top {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 10px;
}

.duel-side {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.duel-side.me { align-items: flex-start; }
.duel-side.opp { align-items: flex-end; text-align: right; }

.duel-side-name {
  font-size: clamp(0.82rem, 2.2vw, 1.05rem);
  font-weight: 900;
  color: #cbd5e1;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.duel-side-val {
  font-size: clamp(2.2rem, 6.5vw, 3.4rem);
  font-weight: 950;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  transition: transform 0.14s ease, color 0.14s ease;
}
.duel-side.me .duel-side-val { color: #4ade80; }
.duel-side.opp .duel-side-val { color: #fb923c; }
.duel-side-val.pulse {
  transform: scale(1.16);
  color: #fde047 !important;
}

.duel-center-clock {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 6px 14px;
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.92);
  border: 1.5px solid rgba(148, 163, 184, 0.35);
}

.duel-clock-val {
  font-size: clamp(1.65rem, 5vw, 2.6rem);
  font-weight: 950;
  color: #f8fafc;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
}
.duel-clock-val.urgent {
  color: #f87171;
}

.duel-delta-pill {
  margin-top: 3px;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: clamp(0.72rem, 1.9vw, 0.85rem);
  font-weight: 900;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.duel-delta-pill.ahead { background: rgba(34, 197, 94, 0.24); color: #4ade80; }
.duel-delta-pill.behind { background: rgba(239, 68, 68, 0.26); color: #f87171; }
.duel-delta-pill.even { background: rgba(148, 163, 184, 0.22); color: #e2e8f0; }

.duel-progress-bars {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.duel-bar-track {
  height: 11px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.22);
  overflow: hidden;
}

.duel-bar-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  transition: width 0.25s ease;
}
.duel-bar-fill.me { background: linear-gradient(90deg, #22c55e, #4ade80); }
.duel-bar-fill.opp { background: linear-gradient(90deg, #f97316, #fb923c); margin-left: auto; }

/* Bilan Duel centré sur l'essentiel (sans scores arcade / combos) */
body.duel-summary-mode #summaryOverlay .summary-grid,
body.duel-summary-mode #summaryOverlay #newRecordBadge {
  display: none !important;
}


/* =========================================================================
   v8.3 : LISIBILITÉ MOBILE (DARK COLOR-SCHEME, GRILLE 8 EXERCICES DUEL)
   ========================================================================= */
:root {
  color-scheme: dark;
}

select,
select option {
  color-scheme: dark;
  background-color: #0f172a;
  color: #f8fafc;
}

.duel-ex-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.duel-ex-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 46px;
  padding: 10px 10px;
  border-radius: 12px;
  border: 1.5px solid rgba(148, 163, 184, 0.32);
  background: rgba(15, 23, 42, 0.88);
  color: #f8fafc;
  font-size: 0.88rem;
  font-weight: 800;
  line-height: 1.2;
  cursor: pointer;
  transition: border-color 0.14s ease, background 0.14s ease, transform 0.1s ease;
}

.duel-ex-btn:active {
  transform: scale(0.97);
}

.duel-ex-btn.selected {
  border-color: #38bdf8;
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.34), rgba(34, 197, 94, 0.24));
  color: #ffffff;
  box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.45), 0 4px 14px rgba(14, 165, 233, 0.22);
}

.duel-ex-btn.friend-variant.selected {
  border-color: #c084fc;
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.34), rgba(236, 72, 153, 0.22));
  box-shadow: 0 0 0 1px rgba(192, 132, 252, 0.45), 0 4px 14px rgba(168, 85, 247, 0.22);
}


/* En mode Duel : jamais de modale pause, bouton Paramètres sobre */
body.in-duel-arena #arenaPauseOverlay {
  display: none !important;
}
#arenaPauseBtn.duel-settings-mode {
  background: rgba(30, 41, 59, 0.88) !important;
  border: 1px solid rgba(148, 163, 184, 0.45) !important;
  color: #e2e8f0 !important;
}


/* =========================================================================
   v8.5 : BIBLIOTHÈQUE DE COSMÉTIQUES (APERÇU LIVE, ONGLETS, PIÈCES & DÉBLOCAGE)
   ========================================================================= */
.cos-lib-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.cos-coins-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(250, 204, 21, 0.22), rgba(249, 115, 22, 0.22));
  border: 1px solid rgba(250, 204, 21, 0.65);
  color: #fef08a;
  font-size: 0.84rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.cos-lib-preview-wrap {
  position: relative;
  width: 100%;
  border-radius: 16px;
  overflow: hidden;
  border: 1.5px solid rgba(56, 189, 248, 0.42);
  background: radial-gradient(circle at 50% 45%, #16233b 0%, #090e1a 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.cos-lib-canvas {
  width: 100%;
  max-width: 340px;
  height: 210px;
  display: block;
}

.cos-lib-equipped-summary {
  width: 100%;
  padding: 6px 10px;
  background: rgba(15, 23, 42, 0.88);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  font-size: 0.72rem;
  color: #cbd5e1;
  font-weight: 700;
}

.cos-lib-cats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.cos-lib-cat-btn {
  padding: 6px 11px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.32);
  background: rgba(15, 23, 42, 0.85);
  color: #cbd5e1;
  font-size: 0.78rem;
  font-weight: 800;
  cursor: pointer;
  transition: background 0.14s ease, border-color 0.14s ease, color 0.14s ease;
}

.cos-lib-cat-btn.active {
  background: linear-gradient(135deg, #2563eb, #0ea5e9);
  border-color: #7dd3fc;
  color: #ffffff;
}

.cos-item-top {
  display: flex;
  align-items: center;
  gap: 6px;
}

.cos-item-ico {
  font-size: 1.15rem;
  line-height: 1;
}

.cos-item-badge {
  display: inline-block;
  margin-top: 2px;
  font-size: 0.72rem;
  font-weight: 800;
}

.cos-item-badge.equipped { color: #4ade80; }
.cos-item-badge.shop { color: #fde047; }
.cos-item-badge.ach { color: #7dd3fc; }
.cos-item-badge.prem { color: #f0abfc; }


/* Indicateur de chargement sur espace publicitaire réservé + mention CGV */
.ad-banner-slot {
  position: relative;
}

.ad-loading-row,
.ad-loading-placeholder {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.ad-loading-placeholder {
  font-size: 0.82rem;
  font-weight: 700;
  color: #94a3b8;
}

.ad-banner-slot:has(ins[data-ad-status="filled"]) .ad-loading-placeholder {
  display: none;
}

.ad-loading-spinner {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid rgba(148, 163, 184, 0.3);
  border-top-color: #38bdf8;
  display: inline-block;
  flex-shrink: 0;
  animation: spin 0.9s linear infinite;
}

.cgv-inline-notice {
  font-size: 0.74rem;
  line-height: 1.35;
}

.cgv-inline-notice a {
  color: #7dd3fc;
  text-decoration: underline;
  font-weight: 700;
}


/* v8.7 : Bandeau cosmétiques verrouillés + mode invité duel */
.cos-locked-notice {
  padding: 9px 12px;
  border-radius: 12px;
  background: rgba(148, 163, 184, 0.14);
  border: 1px solid rgba(148, 163, 184, 0.35);
  color: #cbd5e1;
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.35;
}

.guest-duel-banner {
  padding: 9px 12px;
  border-radius: 12px;
  background: rgba(56, 189, 248, 0.14);
  border: 1px solid rgba(56, 189, 248, 0.42);
  color: #bae6fd;
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1.35;
}


/* =========================================================================
   v8.8 : PWA, SUPPRESSION COMPTE & DUELS ASYNCHRONES (24H/48H)
   ========================================================================= */
.cloud-account-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.delete-account-btn {
  border-color: rgba(239, 68, 68, 0.72) !important;
  background: rgba(153, 27, 27, 0.55) !important;
  color: #fecaca !important;
}

.delete-account-btn:hover {
  background: rgba(185, 28, 28, 0.75) !important;
}

.pwa-install-card {
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.2), rgba(34, 197, 94, 0.16)) !important;
  border-color: rgba(56, 189, 248, 0.52) !important;
}

.async-duel-box {
  padding: 12px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(14, 116, 144, 0.25), rgba(88, 28, 135, 0.25));
  border: 1.5px solid rgba(56, 189, 248, 0.52);
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.async-duel-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.async-dur-pills {
  display: inline-flex;
  gap: 5px;
}

.async-dur-btn {
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.4);
  background: rgba(15, 23, 42, 0.85);
  color: #cbd5e1;
  font-size: 0.78rem;
  font-weight: 800;
  cursor: pointer;
}

.async-dur-btn.active {
  background: #0284c7;
  border-color: #7dd3fc;
  color: #ffffff;
}
