/* ========== MONACO FLAG — ratio 4/5 (portrait) ========== */
/* Corrige tous les contextes où le drapeau est affiché avec des dimensions libres (sans !important) */
.fi-mc { aspect-ratio: 4/5 !important; background-size: contain !important; background-position: center !important; background-repeat: no-repeat !important; }

/* ========== BUTTONS ========== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.65rem 1.4rem;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: all var(--transition);
  border: none;
  white-space: nowrap;
  text-decoration: none;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
  background: var(--accent);
  color: white;
  box-shadow: 0 2px 12px rgba(79, 99, 255, 0.4);
}
.btn-primary:hover:not(:disabled) {
  background: var(--accent-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(79, 99, 255, 0.5);
}

.btn-secondary {
  background: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--border);
}
.btn-secondary:hover:not(:disabled) {
  background: var(--bg-card-hover);
  border-color: var(--border-hover);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-ghost:hover:not(:disabled) { color: var(--text-primary); border-color: var(--border-hover); background: rgba(255,255,255,0.04); }

.btn-success { background: var(--success); color: white; }
.btn-success:hover:not(:disabled) { background: #0ea672; transform: translateY(-1px); }

.btn-danger { background: var(--error); color: white; }
.btn-danger:hover:not(:disabled) { background: #dc2626; transform: translateY(-1px); }

.btn-lg { padding: 0.9rem 2rem; font-size: 1rem; border-radius: var(--radius-lg); }
.btn-sm { padding: 0.4rem 0.9rem; font-size: 0.8rem; border-radius: var(--radius-sm); }
.btn-icon { padding: 0.6rem; width: 2.4rem; height: 2.4rem; }

/* ========== CARDS ========== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
}
.card-hover {
  cursor: pointer;
  transition: all var(--transition);
}
.card-hover:hover {
  border-color: var(--border-active);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

/* ========== CONTINENT BADGES ========== */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
}
.badge-africa { background: rgba(249, 115, 22, 0.15); color: var(--africa); border: 1px solid rgba(249, 115, 22, 0.3); }
.badge-americas { background: rgba(34, 197, 94, 0.15); color: var(--americas); border: 1px solid rgba(34, 197, 94, 0.3); }
.badge-asia { background: rgba(236, 72, 153, 0.15); color: var(--asia); border: 1px solid rgba(236, 72, 153, 0.3); }
.badge-europe { background: rgba(99, 102, 241, 0.15); color: var(--europe); border: 1px solid rgba(99, 102, 241, 0.3); }
.badge-oceania { background: rgba(6, 182, 212, 0.15); color: var(--oceania); border: 1px solid rgba(6, 182, 212, 0.3); }

/* ========== FILTER TABS ========== */
.filter-tabs {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}
.filter-tab {
  padding: 0.4rem 1rem;
  border-radius: var(--radius-full);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  transition: all var(--transition);
}
.filter-tab:hover { color: var(--text-primary); border-color: var(--border-hover); }
.filter-tab.active { background: var(--accent); color: white; border-color: var(--accent); }
.filter-tab[data-c="Africa"].active { background: var(--africa); border-color: var(--africa); }
.filter-tab[data-c="Americas"].active { background: var(--americas); border-color: var(--americas); }
.filter-tab[data-c="Asia"].active { background: var(--asia); border-color: var(--asia); }
.filter-tab[data-c="Europe"].active { background: var(--europe); border-color: var(--europe); }
.filter-tab[data-c="Oceania"].active { background: var(--oceania); border-color: var(--oceania); }

/* ========== SEARCH ========== */
.search-wrapper {
  position: relative;
  margin-bottom: 1.5rem;
}
.search-icon {
  position: absolute;
  left: 0.9rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 1rem;
  pointer-events: none;
}
.search-input {
  width: 100%;
  padding: 0.7rem 1rem 0.7rem 2.5rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 0.9rem;
  transition: border-color var(--transition);
  outline: none;
}
.search-input:focus { border-color: var(--border-active); }
.search-input::placeholder { color: var(--text-muted); }

/* ========== FLAG LIST ========== */
.flags-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.flags-count { color: var(--text-muted); font-size: 0.875rem; }

.flags-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;
}
.flag-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 2.75rem 1rem 1.25rem;
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  text-align: center;
}
.flag-card:hover {
  border-color: var(--border-active);
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  background: var(--bg-card-hover);
}
.flag-display {
  width: 80px;
  height: 53px;
  border-radius: 4px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
  flex-shrink: 0;
}
.flag-display .fi {
  width: 80px !important;
  height: 53px !important;
  background-size: cover !important;
  background-position: center !important;
  display: block;
}
.flag-card { position: relative; }
.flag-card-top { position: absolute; top: 0.5rem; left: 0.5rem; }
.flag-card-top .badge { font-size: 0.62rem; padding: 0.1rem 0.4rem; }
.flag-card-name { font-size: 0.875rem; font-weight: 600; line-height: 1.3; margin-top: 0.25rem; }
.flag-card-capital { font-size: 0.75rem; color: var(--text-muted); }


/* ========== FLAG DETAIL MODAL ========== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  animation: fadeIn 0.2s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 2rem;
  max-width: 420px;
  width: 100%;
  text-align: center;
  animation: modalIn 0.3s ease;
  position: relative;
}
@keyframes modalIn { from { opacity: 0; transform: scale(0.9) translateY(20px); } to { opacity: 1; transform: scale(1) translateY(0); } }

.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition);
}
.modal-close:hover { background: var(--border-hover); color: var(--text-primary); }

.modal-country { max-width: 480px; text-align: left; }

.modal-flag-header { display: flex; align-items: center; gap: 1rem; margin-bottom: 1rem; padding-right: 2rem; }
.modal-flag-header-text { min-width: 0; }
.modal-country-name { font-size: 1.4rem; font-weight: 800; margin-bottom: 0.15rem; }
.modal-country-name-fr { color: var(--text-secondary); font-size: 0.875rem; margin-bottom: 0.4rem; }

.modal-minimap { border-radius: var(--radius-md); overflow: hidden; background: #060d1a; margin-bottom: 1rem; }
.modal-minimap-empty { padding: 1rem; font-size: 0.78rem; color: var(--text-muted); text-align: center; font-style: italic; }

.modal-facts { display: flex; flex-direction: column; gap: 0; margin-bottom: 1rem; border: 1px solid var(--border); border-radius: var(--radius-md); overflow: hidden; }
.modal-fact { display: flex; justify-content: space-between; align-items: center; padding: 0.55rem 0.85rem; font-size: 0.82rem; border-bottom: 1px solid var(--border); }
.modal-fact:last-child { border-bottom: none; }
.modal-fact-label { color: var(--text-muted); }
.modal-fact-value { font-weight: 600; text-align: right; }

.modal-history { margin-bottom: 1.25rem; }
.modal-history-title { font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); margin-bottom: 0.4rem; }
.modal-history-text { font-size: 0.82rem; color: var(--text-secondary); line-height: 1.6; margin: 0; }

.modal-actions { display: flex; gap: 0.75rem; flex-wrap: wrap; }
.modal-loading { opacity: 0.4; font-style: italic; }

/* ========== QUIZ SETUP ========== */
.quiz-setup {
  max-width: 700px;
  margin: 0 auto;
}
.quiz-setup-title { font-size: 2rem; font-weight: 800; margin-bottom: 0.5rem; }
.quiz-setup-subtitle { color: var(--text-secondary); margin-bottom: 2rem; }

.setup-section { margin-bottom: 1.75rem; }
.setup-section-label { font-size: 0.9rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 0.75rem; }

.level-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
}
.level-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1rem;
  cursor: pointer;
  transition: all var(--transition);
  text-align: center;
}
.level-card:hover { border-color: var(--border-active); transform: translateY(-2px); }
.level-card.selected { border-color: var(--accent); background: rgba(79, 99, 255, 0.1); }
.level-card-num { font-size: 2rem; font-weight: 800; color: var(--accent-light); line-height: 1; margin-bottom: 0.4rem; }
.level-card-name { font-size: 0.9rem; font-weight: 600; margin-bottom: 0.3rem; }
.level-card-desc { font-size: 0.775rem; color: var(--text-muted); line-height: 1.4; }

.count-selector {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.count-btn {
  padding: 0.5rem 1.25rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}
.count-btn:hover { border-color: var(--border-hover); color: var(--text-primary); }
.count-btn.selected { background: var(--accent); border-color: var(--accent); color: white; }

.difficulty-selector { display: flex; gap: 0.75rem; flex-wrap: wrap; }
.diff-btn {
  flex: 1;
  min-width: 120px;
  padding: 0.6rem 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  text-align: center;
}
.diff-btn:hover { border-color: var(--border-hover); color: var(--text-primary); }
.diff-btn.selected { border-color: var(--warning); background: var(--warning-bg); color: var(--warning); }

/* ========== QUIZ QUESTION ========== */
.quiz-container { max-width: 680px; margin: 0 auto; }

.quiz-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  gap: 1rem;
}
.quiz-progress-wrap { flex: 1; }
.quiz-progress-text { font-size: 0.82rem; color: var(--text-muted); margin-bottom: 0.4rem; display: flex; justify-content: space-between; }
.quiz-progress-bar {
  height: 6px;
  background: var(--bg-surface);
  border-radius: var(--radius-full);
  overflow: hidden;
}
.quiz-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #9b87f2, #e8e3fc);
  border-radius: var(--radius-full);
  transition: width 0.4s ease;
}

.quiz-score-wrap { display: flex; gap: 0.75rem; align-items: center; flex-shrink: 0; }
.quiz-score-badge {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.85rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 700;
}
.quiz-streak-badge {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.4rem 0.85rem;
  background: var(--warning-bg);
  border: 1px solid var(--warning-border);
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--warning);
}
.quiz-streak-badge.hidden { opacity: 0; }

.quiz-timer-badge {
  display: flex;
  align-items: center;
  padding: 0.4rem 0.85rem;
  background: var(--surface-2, #f1f5f9);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.quiz-question-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 2rem;
  text-align: center;
  margin-bottom: 1.25rem;
  min-height: 200px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
}
.quiz-question-label { font-size: 0.85rem; color: var(--text-muted); font-weight: 500; text-transform: uppercase; letter-spacing: 0.05em; }
.quiz-question-text { font-size: 1.5rem; font-weight: 700; }
.quiz-flag-container .fi { display: block; width: 160px !important; height: 107px !important; background-size: cover !important; border-radius: 8px; box-shadow: var(--shadow-md); }
/* Monaco a un ratio 4/5 (portrait) — on laisse le height et on libère le width */
.quiz-flag-container .fi-mc { width: auto !important; aspect-ratio: 4/5 !important; background-size: contain !important; background-position: center !important; background-repeat: no-repeat !important; }

.quiz-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}
.quiz-option {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem 1.25rem;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: var(--font);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  text-align: left;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-height: 64px;
}
.quiz-option:hover:not(:disabled) { border-color: var(--accent); background: rgba(79,99,255,0.08); transform: translateY(-1px); }
.quiz-option:disabled { cursor: default; }
.quiz-option.correct { border-color: var(--success) !important; background: var(--success-bg) !important; color: var(--success) !important; animation: correctPulse 0.4s ease; }
.quiz-option.wrong { border-color: var(--error) !important; background: var(--error-bg) !important; color: var(--error) !important; animation: wrongShake 0.4s ease; }
.quiz-option.revealed { border-color: var(--success) !important; background: var(--success-bg) !important; }

.option-key {
  width: 26px; height: 26px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  font-size: 0.75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--text-muted);
}
.quiz-option.correct .option-key, .quiz-option.wrong .option-key { border-color: currentColor; color: currentColor; background: transparent; }

/* Flag options (level 2) */
.quiz-option.flag-option {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.75rem;
}
.quiz-option.flag-option .fi { width: 72px !important; height: 48px !important; background-size: cover !important; border-radius: 4px; display: block; }
.quiz-option.flag-option .fi-mc { width: auto !important; background-size: contain !important; background-position: center !important; background-repeat: no-repeat !important; }

/* Text input (level 3) */
.quiz-text-form { width: 100%; display: flex; flex-direction: column; gap: 0.75rem; }
.quiz-text-input {
  width: 100%;
  padding: 1rem 1.25rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 1.1rem;
  font-weight: 600;
  text-align: center;
  outline: none;
  transition: border-color var(--transition);
}
.quiz-text-input:focus { border-color: var(--border-active); }
.quiz-text-input.correct { border-color: var(--success); background: var(--success-bg); color: var(--success); }
.quiz-text-input.wrong { border-color: var(--error); background: var(--error-bg); color: var(--error); }
.quiz-hint { font-size: 0.85rem; color: var(--text-muted); }
.quiz-hint-confirm-msg { font-size: 0.85rem; color: var(--warning, #f59e0b); font-weight: 500; }
.hint-btn--warn { border-color: var(--warning, #f59e0b) !important; color: var(--warning, #f59e0b) !important; }
.quiz-correct-answer { font-size: 0.9rem; color: var(--success); font-weight: 600; margin-top: 0.25rem; }

/* ========== PROFILE MODAL ========== */
.profile-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  transition: opacity 0.35s ease;
}
.profile-modal-overlay.profile-modal-in  { opacity: 1; }
.profile-modal-overlay.profile-modal-out { opacity: 0; }

.profile-modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 2.5rem 2rem 2rem;
  max-width: 400px;
  width: 100%;
  text-align: center;
  box-shadow: var(--shadow-lg);
  transform: translateY(24px) scale(0.96);
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.profile-modal-overlay.profile-modal-in .profile-modal {
  transform: translateY(0) scale(1);
}

.profile-modal-globe  { font-size: 2.8rem; margin-bottom: 0.5rem; }
.profile-modal-title  { font-size: 1.4rem; font-weight: 800; margin-bottom: 0.4rem; }
.profile-modal-subtitle {
  color: var(--text-secondary);
  font-size: 0.88rem;
  margin-bottom: 1.5rem;
}

.profile-modal-avatar-wrap {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  overflow: hidden;
  margin: 0 auto 1.4rem;
  border: 3px solid var(--accent);
  box-shadow: 0 0 24px var(--accent-glow);
  background: var(--bg-surface);
}
.profile-modal-avatar-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-modal-input {
  width: 100%;
  padding: 0.75rem 1rem;
  background: var(--bg-input);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 1rem;
  text-align: center;
  margin-bottom: 1rem;
  transition: border-color var(--transition);
}
.profile-modal-input:focus { outline: none; border-color: var(--accent); }

.profile-modal-btn  { width: 100%; margin-bottom: 0.75rem; }
.profile-modal-google { width: 100%; margin-bottom: 0.5rem; justify-content: center; }
.profile-modal-divider {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.25rem 0 0.75rem;
  color: var(--text-muted);
  font-size: 0.8rem;
}
.profile-modal-divider::before,
.profile-modal-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}
.profile-modal-guest {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-family: var(--font);
  cursor: pointer;
  transition: color var(--transition);
  padding: 0.25rem;
}
.profile-modal-guest:hover { color: var(--text-secondary); text-decoration: underline; }

/* ========== NAVBAR AVATAR ========== */
#navProfileBtn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3rem 0.75rem 0.3rem 0.35rem;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  color: var(--text-primary);
  font-size: 0.85rem;
  font-weight: 600;
  font-family: var(--font);
  white-space: nowrap;
}
#navProfileBtn:hover {
  border-color: var(--border-hover);
  background: var(--bg-card-hover);
}
.nav-avatar-img {
  border-radius: 50%;
  display: block;
  flex-shrink: 0;
  background: var(--bg-surface);
}
.nav-avatar-name {
  max-width: 90px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ========== PROFILE PAGE ========== */
.profile-page {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  max-width: 580px;
  margin: 0 auto;
}

.profile-avatar-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding: 2rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.profile-avatar-big {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  overflow: hidden;
  border: 3px solid var(--accent);
  box-shadow: 0 0 32px var(--accent-glow);
  background: var(--bg-surface);
  transition: box-shadow 0.3s;
}
.profile-avatar-big img { width: 100%; height: 100%; object-fit: cover; }

.profile-name-display {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 1.3rem;
  font-weight: 700;
}
.profile-guest-badge {
  font-size: 0.72rem;
  padding: 0.2rem 0.55rem;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  color: var(--text-muted);
}

.profile-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
}
.profile-section-title {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.profile-name-edit { display: flex; gap: 0.75rem; }
.profile-input {
  flex: 1;
  padding: 0.65rem 1rem;
  background: var(--bg-input);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 0.9rem;
  transition: border-color var(--transition);
}
.profile-input:focus { outline: none; border-color: var(--accent); }

.profile-style-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.6rem;
}
.profile-style-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  padding: 0.75rem 0.4rem 0.6rem;
  background: var(--bg-surface);
  border: 2px solid transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition);
  font-size: 0.7rem;
  color: var(--text-secondary);
  font-family: var(--font);
}
.profile-style-btn:hover { border-color: var(--border-hover); background: var(--bg-card-hover); }
.profile-style-btn.active {
  border-color: var(--accent);
  background: rgba(79, 99, 255, 0.12);
  color: var(--text-primary);
}
.profile-style-btn img { border-radius: 50%; background: var(--bg-input); }

.profile-color-grid { display: flex; flex-wrap: wrap; gap: 0.65rem; }
.profile-color-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 3px solid transparent;
  cursor: pointer;
  font-size: 0.9rem;
  color: white;
  font-weight: 800;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}
.profile-color-btn:hover { transform: scale(1.18); }
.profile-color-btn.active {
  border-color: white;
  box-shadow: 0 0 0 2px var(--accent);
  transform: scale(1.1);
}

@media (max-width: 520px) {
  .profile-style-grid { grid-template-columns: repeat(3, 1fr); }
  .nav-avatar-name    { display: none; }
  .nav-avatar-info    { display: none; }
  #navProfileBtn      { padding: 0.3rem; }
  .profile-modal      { padding: 2rem 1.25rem 1.5rem; }
}

/* ========== CHARACTER BUILDER ========== */
.cb-layout {
  display: grid;
  grid-template-columns: 270px 1fr;
  gap: 1.5rem;
  max-width: 900px;
  margin: 0 auto;
  align-items: start;
}

/* Sélecteur de type de personnage */
.cb-style-picker {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem;
}
.cb-style-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  padding: 0.6rem 0.4rem;
  background: var(--bg-surface);
  border: 2px solid transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-secondary);
  font-family: var(--font);
}
.cb-style-card:hover {
  border-color: var(--border-hover);
  background: var(--bg-card-hover);
  color: var(--text-primary);
  transform: translateY(-2px);
}
.cb-style-card.active {
  border-color: var(--accent);
  background: rgba(79, 99, 255, 0.15);
  color: var(--accent-light);
  box-shadow: 0 0 12px var(--accent-glow);
}
.cb-style-card-avatar {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg-input);
}
.cb-style-card-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Info seed (styles à seed) */
.cb-seed-info {
  padding: 0.75rem 1rem;
  background: rgba(79, 99, 255, 0.08);
  border: 1px solid rgba(79, 99, 255, 0.2);
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.5;
}
.cb-seed-info strong { color: var(--text-primary); }

@media (max-width: 500px) {
  .cb-style-picker { grid-template-columns: repeat(4, 1fr); }
}

/* Panneau gauche : preview */
.cb-preview-panel {
  position: sticky;
  top: calc(var(--nav-height) + 1rem);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.75rem 1.25rem;
}
.cb-avatar-big {
  width: 160px;
  height: 160px;
  border-radius: 50%;
  overflow: hidden;
  border: 3px solid var(--accent);
  box-shadow: 0 0 36px var(--accent-glow);
  background: var(--bg-surface);
  transition: box-shadow 0.3s;
}
.cb-avatar-big img { width: 100%; height: 100%; object-fit: cover; }

/* ─── Rank Frames ────────────────────────────────────────────────────────── */
.rank-frame-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}
/* Remove inner border/shadow when inside a rank frame */
.rank-frame-wrap .cb-avatar-big {
  border: 2px solid rgba(255,255,255,0.15);
  box-shadow: none;
}
.rank-frame-wrap .profile-modal-avatar-wrap {
  border: 2px solid rgba(255,255,255,0.15);
  box-shadow: none;
  margin: 0;
}


/* Per-rank ring gradients */
.rank-frame--bronze {
  background: linear-gradient(135deg, #f2b46a 0%, #cd7f32 40%, #7a3e0a 70%, #cd7f32 100%);
  box-shadow: 0 0 14px rgba(205,127,50,0.45);
}
.rank-frame--silver {
  background: linear-gradient(135deg, #f4f4f6 0%, #a8a9ad 40%, #58595e 70%, #a8a9ad 100%);
  box-shadow: 0 0 14px rgba(168,169,173,0.45);
}
.rank-frame--gold {
  background: linear-gradient(135deg, #fffce0 0%, #ffd700 40%, #b8860b 70%, #ffd700 100%);
  box-shadow: 0 0 20px rgba(255,215,0,0.55);
}
.rank-frame--platine {
  background: linear-gradient(135deg, #d8eaff 0%, #90b8e8 30%, #5878c8 60%, #90b8e8 100%);
  animation: platineIridescent 6s ease-in-out infinite;
}
.rank-frame--diamond {
  background: linear-gradient(135deg, #e0faff 0%, #88eeff 25%, #cc88ff 50%, #6655ee 75%, #88eeff 100%);
  animation: diamondIridescent 4s ease-in-out infinite;
}
.rank-frame--legend {
  background: linear-gradient(135deg, #ffe8a0 0%, #ff9f43 40%, #c0540a 70%, #ff9f43 100%);
  box-shadow: 0 0 24px rgba(255,159,67,0.65);
  animation: rankLegendPulse 1.8s ease-in-out infinite alternate;
}
@keyframes platineIridescent {
  0%   { filter: hue-rotate(0deg)   brightness(1); }
  50%  { filter: hue-rotate(35deg)  brightness(1.1); }
  100% { filter: hue-rotate(0deg)   brightness(1); }
}
@keyframes diamondIridescent {
  0%   { filter: hue-rotate(0deg)   brightness(1); }
  33%  { filter: hue-rotate(45deg)  brightness(1.12); }
  66%  { filter: hue-rotate(-25deg) brightness(1.08); }
  100% { filter: hue-rotate(0deg)   brightness(1); }
}
@keyframes rankLegendPulse {
  from { box-shadow: 0 0 18px rgba(255,159,67,0.5); }
  to   { box-shadow: 0 0 36px rgba(255,159,67,0.9); }
}

/* Navbar rank frame (small) */
.nav-rank-frame {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px;
  border-radius: 50%;
  flex-shrink: 0;
}
.nav-rank-frame .nav-avatar-img { display: block; }
.nav-rank-frame--bronze  { background: linear-gradient(135deg,#f2b46a,#cd7f32,#7a3e0a); box-shadow: 0 0 6px rgba(205,127,50,0.5); }
.nav-rank-frame--silver  { background: linear-gradient(135deg,#f4f4f6,#a8a9ad,#58595e); box-shadow: 0 0 6px rgba(168,169,173,0.5); }
.nav-rank-frame--gold    { background: linear-gradient(135deg,#fffce0,#ffd700,#b8860b); box-shadow: 0 0 8px rgba(255,215,0,0.6); }
.nav-rank-frame--platine { background: linear-gradient(135deg,#d8eaff,#90b8e8,#5878c8); animation: platineIridescent 6s ease-in-out infinite; }
.nav-rank-frame--diamond { background: linear-gradient(135deg,#88eeff,#cc88ff,#6655ee); animation: diamondIridescent 4s ease-in-out infinite; }
.nav-rank-frame--legend  { background: linear-gradient(135deg,#ffe8a0,#ff9f43,#c0540a); box-shadow: 0 0 10px rgba(255,159,67,0.7); animation: rankLegendPulse 1.8s ease-in-out infinite alternate; }

/* ─── Rank Badge Avatar Frame (profile page) ────────────────────────────── */
.rank-badge-av-frame {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--rbaf-size, 200px);
  height: var(--rbaf-size, 200px);
  flex-shrink: 0;
}
.rank-badge-av-svg {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.rank-badge-av-svg svg {
  display: block;
  width: 100%;
  height: 100%;
}
.rank-badge-av-img {
  position: absolute;
  width: var(--rbaf-av-size, 104px);
  height: var(--rbaf-av-size, 104px);
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 2px 14px rgba(0,0,0,0.45), 0 0 0 2px rgba(255,255,255,0.13);
  z-index: 1;
}
.rank-badge-av-frame--platine {
  animation: platineIridescent 6s ease-in-out infinite;
}
.rank-badge-av-frame--diamond {
  animation: diamondIridescent 4s ease-in-out infinite;
}
.rank-badge-av-frame--legend {
  animation: rbafLegendPulse 1.8s ease-in-out infinite alternate;
}
/* rbafPlatineGlow and rbafDiamondGlow replaced by shared sparkle keyframes */
@keyframes rbafLegendPulse {
  from { filter: drop-shadow(0 0 6px rgba(255,159,67,0.55)); }
  to   { filter: drop-shadow(0 0 20px rgba(255,159,67,1.0)); }
}

/* Rank Legend Panel */
.rank-legend {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin-top: 1rem;
  padding: 0.7rem 0.9rem;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  width: 100%;
}
.rank-legend-title {
  font-size: 0.67rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 0.2rem;
}
.rank-legend-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.77rem;
  color: var(--text-secondary);
  padding: 0.15rem 0;
}
.rank-legend-item.active { color: var(--text-primary); font-weight: 700; }
.rank-legend-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  flex-shrink: 0;
}
.rank-legend-label { flex: 1; }
.rank-legend-xp { font-size: 0.66rem; color: var(--text-muted); flex-shrink: 0; }
.rank-legend-you {
  font-size: 0.62rem;
  background: var(--accent);
  color: white;
  border-radius: 99px;
  padding: 0.08em 0.42em;
  flex-shrink: 0;
}

.cb-name-display {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.15rem;
  font-weight: 700;
  text-align: center;
}
.cb-name-edit {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  width: 100%;
}
.cb-name-edit .profile-input { font-size: 0.85rem; padding: 0.5rem 0.75rem; min-width: 0; }
.cb-name-color-row { display: flex; flex-direction: column; gap: 0.35rem; width: 100%; }
.cb-name-color-label { font-size: 0.8rem; font-weight: 600; opacity: 0.75; }
.cb-name-color-controls { display: flex; align-items: center; gap: 0.5rem; }
.cb-name-color-picker {
  width: 2.4rem; height: 2.4rem; border: none; border-radius: 8px; padding: 0.1rem;
  background: transparent; cursor: pointer;
}
.cb-name-color-picker[data-default] { opacity: 0.45; }
.cb-save-btn { width: 100%; padding: 0.65rem; font-size: 0.95rem; font-weight: 700; letter-spacing: 0.03em; transition: box-shadow .2s, transform .1s; }
@keyframes cb-pulse-save {
  0%, 100% { box-shadow: 0 0 0 0 rgba(var(--accent-rgb, 99,102,241), 0.55); }
  50%       { box-shadow: 0 0 0 7px rgba(var(--accent-rgb, 99,102,241), 0); }
}
.cb-save-pending {
  animation: cb-pulse-save 1.4s ease-in-out infinite;
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Panneau droit : options */
.cb-options-panel {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* Section accordéon */
.cb-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: border-color var(--transition);
}
.cb-section[open] { border-color: var(--border-hover); }

.cb-section-title {
  font-size: 0.9rem;
  font-weight: 700;
  padding: 1rem 1.25rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  list-style: none;
  user-select: none;
  transition: background var(--transition);
}
.cb-section-title::-webkit-details-marker { display: none; }
.cb-section-title::after {
  content: '▾';
  margin-left: auto;
  color: var(--text-muted);
  transition: transform var(--transition);
}
.cb-section[open] .cb-section-title::after { transform: rotate(180deg); }
.cb-section-title:hover { background: rgba(255,255,255,0.03); }

.cb-section-body {
  padding: 0 1.25rem 1.25rem;
}

.cb-group-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin: 0.75rem 0 0.5rem;
  padding-bottom: 0.3rem;
  border-bottom: 1px solid var(--border);
}
.cb-group-label:first-child { margin-top: 0; }

.cb-subsection-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 0.6rem;
}

/* Grille d'options avec mini-preview */
.cb-option-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.cb-option-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  padding: 0.5rem 0.4rem 0.4rem;
  background: var(--bg-surface);
  border: 2px solid transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition);
  font-size: 0.68rem;
  color: var(--text-secondary);
  font-family: var(--font);
  min-width: 88px;
}
/* Wrapper image avec checkmark overlay */
.cb-option-img-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}
.cb-option-img-wrap img {
  /* Carré arrondi — montre le buste entier de l'avatar, pas de recadrage circulaire */
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  display: block;
  object-fit: contain;
}
.cb-check {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 18px;
  height: 18px;
  background: var(--accent);
  color: white;
  border-radius: 50%;
  font-size: 0.65rem;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--bg-card);
  pointer-events: none;
}
.cb-option-btn:hover {
  border-color: var(--border-hover);
  background: var(--bg-card-hover);
  color: var(--text-primary);
  transform: translateY(-1px);
}
.cb-option-btn.active {
  border-color: var(--accent);
  background: rgba(79, 99, 255, 0.12);
  color: var(--accent-light);
}

/* Grille de couleurs (swatches) */
.cb-color-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}
.cb-color-swatch {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 3px solid transparent;
  cursor: pointer;
  font-size: 0.85rem;
  color: white;
  font-weight: 800;
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
  transition: all var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}
.cb-color-swatch:hover { transform: scale(1.2); }
.cb-color-swatch.active {
  border-color: white;
  box-shadow: 0 0 0 2px var(--accent);
  transform: scale(1.12);
}

/* Responsive */
@media (max-width: 700px) {
  .cb-layout {
    grid-template-columns: 1fr;
  }
  .cb-preview-panel {
    position: static;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    padding: 1.25rem;
  }
  .cb-avatar-big { width: 100px; height: 100px; }
  .cb-name-edit  { width: auto; min-width: 160px; }
}

/* Zone reset profil */
.cb-reset-zone {
  padding: 1rem 0 0.25rem;
  text-align: center;
  opacity: 0.6;
  transition: opacity var(--transition);
}
.cb-reset-zone:hover { opacity: 1; }

.quiz-actions {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-top: 1rem;
}

/* ========== QUIZ RESULTS ========== */
.results-container {
  max-width: 580px;
  margin: 0 auto;
  text-align: center;
}
.results-stars { font-size: 3rem; margin-bottom: 0.5rem; letter-spacing: 0.2rem; }
.results-title { font-size: 2rem; font-weight: 800; margin-bottom: 0.25rem; }
.results-subtitle { color: var(--text-secondary); margin-bottom: 1.5rem; }
.results-score-big {
  font-size: 3.5rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1;
  margin-bottom: 0.25rem;
}
.results-stats-row {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}
.results-stat {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.75rem 1.5rem;
  text-align: center;
}
.results-stat-num { font-size: 1.5rem; font-weight: 700; color: var(--text); }
.results-stat-label { font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }

.wrong-answers { margin: 1.5rem 0; text-align: left; }
.wrong-answers-title { font-size: 0.875rem; font-weight: 700; margin-bottom: 0.75rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.wrong-answer-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 0.875rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 0.375rem;
  font-size: 0.875rem;
}
.wrong-answer-item .fi { width: 36px !important; height: 24px !important; background-size: cover !important; border-radius: 2px; flex-shrink: 0; }
.wrong-answer-wrong { color: var(--error); text-decoration: line-through; }
.wrong-answer-correct { color: var(--success); font-weight: 600; }
.wrong-answer-arrow { color: var(--text-muted); }

.results-buttons { display: flex; gap: 0.75rem; justify-content: center; flex-wrap: wrap; margin-top: 1.5rem; }

/* ========== TOAST NOTIFICATIONS ========== */
.toast {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.75rem 1.1rem;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.3s ease;
  pointer-events: auto;
  max-width: 320px;
  border: 1px solid transparent;
}
@keyframes toastIn { from { opacity: 0; transform: translateX(40px); } to { opacity: 1; transform: translateX(0); } }
@keyframes toastOut { to { opacity: 0; transform: translateX(40px); } }

.toast.success { background: #0f2a1e; color: var(--success); border-color: var(--success-border); }
.toast.error { background: #2a0f0f; color: var(--error); border-color: var(--error-border); }
.toast.info { background: #0f1a2a; color: var(--accent-light); border-color: var(--border-active); }
.toast.warning { background: #2a1f0a; color: var(--warning); border-color: var(--warning-border); }

/* ========== QUIZ TYPE SELECTOR (map quiz) ========== */
.qtype-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
}
.qtype-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem 0.75rem;
  cursor: pointer;
  transition: all var(--transition);
  text-align: center;
}
.qtype-card:hover { border-color: var(--border-active); }
.qtype-card.selected { border-color: var(--accent); background: rgba(79,99,255,0.1); }
.qtype-card-icon { font-size: 1.75rem; margin-bottom: 0.4rem; }
.qtype-card-name { font-size: 0.875rem; font-weight: 600; }

/* ========== ANIMATIONS ========== */
@keyframes correctPulse {
  0% { transform: scale(1); }
  40% { transform: scale(1.03); }
  100% { transform: scale(1); }
}
@keyframes wrongShake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}
@keyframes streakBounce {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}
.streak-animate { animation: streakBounce 0.3s ease; }

/* ========== KEYBOARD HINTS ========== */
.keyboard-hints {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 0.75rem;
}
.kbd {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.25rem 0.6rem;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* ========== SECTION HEADERS ========== */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}
.section-title { font-size: 1.3rem; font-weight: 700; }

/* ========== RESPONSIVE QUIZ ========== */
@media (max-width: 640px) {
  .quiz-options { grid-template-columns: 1fr; }
  .level-cards { grid-template-columns: 1fr; }
  .qtype-cards { grid-template-columns: 1fr; }
  .quiz-question-card { padding: 1.5rem 1rem; min-height: 160px; }
  .quiz-flag-container .fi { width: 120px !important; height: 80px !important; }
  .quiz-setup-title { font-size: 1.6rem; }
  .diff-btn { min-width: 80px; padding: 0.5rem 0.75rem; font-size: 0.82rem; }
  .quiz-score-badge, .quiz-streak-badge, .quiz-timer-badge { padding: 0.3rem 0.65rem; font-size: 0.8rem; }
  .quiz-score-wrap { gap: 0.4rem; }
}

/* ========== QUIZ CAUCHEMAR ========== */
.nightmare-steps {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.nightmare-step {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  padding: 0.6rem 0.5rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-card);
  transition: all 0.2s ease;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
}

.nightmare-step-icon { font-size: 1.2rem; }
.nightmare-step-label { font-size: 0.7rem; text-align: center; line-height: 1.2; }

.nightmare-step.active {
  border-color: var(--accent);
  background: rgba(79, 99, 255, 0.1);
  color: var(--accent-light);
  box-shadow: 0 0 12px rgba(79, 99, 255, 0.2);
}

.nightmare-step.done-correct {
  border-color: var(--success);
  background: var(--success-bg);
  color: var(--success);
}

.nightmare-step.done-wrong {
  border-color: var(--error, #e53e3e);
  background: rgba(229, 62, 62, 0.08);
  color: var(--error, #e53e3e);
}

.nightmare-step.pending {
  opacity: 0.4;
}

/* Map step layout: side-by-side on desktop */
.page-fullwidth {
  max-width: 100%;
  padding: 1rem 1.5rem;
  display: flex;
  flex-direction: column;
  height: calc(100vh - var(--nav-height));
  box-sizing: border-box;
}

.page-fullwidth .map-wrapper {
  flex: 1;
  min-height: 300px;
  margin-top: 0.5rem;
}

.nightmare-map-layout {
  max-width: calc(var(--max-width) + 400px);
  margin: 0 auto;
  display: flex;
  gap: 1.25rem;
  align-items: flex-start;
}

.quiz-container-map {
  max-width: 400px;
  min-width: 320px;
  flex-shrink: 0;
  margin: 0;
}

/* Country summary card */
.nightmare-country-summary {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 2rem 1.5rem;
  text-align: center;
  margin-bottom: 1.25rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.nightmare-summary-name {
  font-size: 1.6rem;
  font-weight: 800;
}

.nightmare-summary-capital {
  font-size: 1rem;
  color: var(--text-secondary);
}

.nightmare-summary-steps {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 0.5rem;
}

.nightmare-summary-step {
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 700;
}

.nightmare-summary-step.correct {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid var(--success-border);
}

.nightmare-summary-step.wrong {
  background: rgba(229, 62, 62, 0.1);
  color: var(--error, #e53e3e);
  border: 1px solid rgba(229, 62, 62, 0.25);
}

.nightmare-summary-score {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent-light);
  margin-top: 0.25rem;
}

@media (max-width: 860px) {
  .nightmare-map-layout { flex-direction: column; }
  .quiz-container-map { max-width: none; min-width: 0; width: 100%; }
}

/* ========== RANK CARD ========== */
.rank-card {
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 0.75rem 1rem 0.75rem;
  margin-bottom: 1rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.rank-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--rank-color, #cd7f32);
  opacity: 0.06;
  pointer-events: none;
}
.rank-icon { width: 48px; height: 48px; margin: 0 auto 0.2rem; display: flex; align-items: center; justify-content: center; }
.rank-icon svg { width: 100%; height: 100%; }
.rank-name {
  font-size: 1rem;
  font-weight: 800;
  color: var(--rank-color, #cd7f32);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.3rem;
}
.rank-bar-track {
  height: 6px;
  background: var(--bg-surface);
  border-radius: 99px;
  overflow: hidden;
  margin-bottom: 0.3rem;
}
.rank-bar-fill {
  height: 100%;
  border-radius: 99px;
  background: var(--rank-color, #cd7f32);
  transition: width 0.6s ease;
}
.rank-tier-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.3rem;
}
.rank-xp-big {
  font-size: 2rem;
  font-weight: 800;
  line-height: 1;
  margin: 0.2rem 0 0.1rem;
  letter-spacing: -1px;
}
.rank-xp-unit {
  font-size: 0.9rem;
  font-weight: 600;
  opacity: 0.75;
}
.rank-mastered-line {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 0.6rem;
}
.rank-mastered-line strong { color: var(--text-primary); }

/* ========== RANK PROGRESSION BAR (achievements page) ========== */
.rank-pb-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem 1.2rem;
  margin-bottom: 1.5rem;
  position: relative;
  overflow: hidden;
}
.rank-pb-section::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg,
    transparent 35%,
    rgba(255,255,255,0.025) 50%,
    transparent 65%
  );
  background-size: 250% 250%;
  animation: rank-card-shine 8s linear infinite;
  pointer-events: none;
}
@keyframes rank-card-shine {
  0%   { background-position: 200% 200%; }
  100% { background-position: -200% -200%; }
}
.rank-pb-title {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-align: center;
  margin-bottom: 2.8rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.rank-pb-track-wrap {
  position: relative;
  padding-bottom: 3.6rem;
  margin: 0 0.5rem;
}
.rank-pb-track {
  position: relative;
  height: 12px;
  background: var(--bg-surface);
  border-radius: 99px;
  overflow: hidden;
  box-shadow: inset 0 2px 5px rgba(0,0,0,0.35);
}
.rank-pb-fill {
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg,
    #cd7f32,
    #c0a060,
    #a8a9ad,
    #d4c060,
    #ffd700,
    #b8d8f0,
    #90b8e8,
    #66ddff,
    #88eeff,
    #ffb347,
    #ff9f43,
    #ffd700,
    #a8a9ad,
    #cd7f32
  );
  background-size: 350% 100%;
  animation: rank-pb-flow 5s linear infinite;
  transition: width 0.9s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  box-shadow:
    0 0 8px rgba(255, 215, 0, 0.45),
    0 0 16px rgba(136, 238, 255, 0.2),
    inset 0 1px 0 rgba(255,255,255,0.25);
}
@keyframes rank-pb-flow {
  0%   { background-position: 0% center; }
  100% { background-position: 100% center; }
}
.rank-pb-marker {
  position: absolute;
  top: -4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  transform: translateX(-50%);
  gap: 0;
}
.rank-pb-dot {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid transparent;
  transition: background 0.3s, box-shadow 0.3s;
  flex-shrink: 0;
}
.rank-pb-marker.active .rank-pb-dot {
  width: 26px;
  height: 26px;
  margin-top: -3px;
  animation: rank-pb-pulse 2s ease-in-out infinite;
}
@keyframes rank-pb-pulse {
  0%, 100% { box-shadow: 0 0 6px var(--dot-glow, #cd7f32); }
  50%       { box-shadow: 0 0 18px var(--dot-glow, #cd7f32), 0 0 32px color-mix(in srgb, var(--dot-glow, #cd7f32) 35%, transparent); }
}
.rank-pb-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 3px;
  line-height: 1;
}
.rank-pb-icon svg {
  width: 32px;
  height: 32px;
  transition: transform 0.3s, filter 0.3s;
}
.rank-pb-icon--locked svg {
  filter: grayscale(1) opacity(0.28);
}
.rank-pb-icon--unlocked svg {
  filter: drop-shadow(0 0 3px var(--icon-glow, #cd7f32));
}
.rank-pb-marker.active .rank-pb-icon svg {
  transform: scale(1.25);
  filter: drop-shadow(0 0 7px var(--icon-glow, #cd7f32));
}
.rank-pb-label {
  font-size: 0.58rem;
  font-weight: 700;
  white-space: nowrap;
  margin-top: 2px;
  text-align: center;
}
.rank-pb-marker.active .rank-pb-label {
  font-size: 0.68rem;
}
.rank-pb-xp-big {
  font-size: 3rem;
  font-weight: 800;
  text-align: center;
  line-height: 1;
  margin: 0.5rem 0 0.1rem;
  letter-spacing: -1px;
}
.rank-pb-xp-unit {
  font-size: 1.1rem;
  font-weight: 600;
  opacity: 0.75;
}
.rank-pb-info {
  font-size: 0.78rem;
  color: var(--text-muted);
  text-align: center;
  margin-bottom: 0.6rem;
}

.rank-badge-mini {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--rank-color, #cd7f32);
  background: color-mix(in srgb, var(--rank-color, #cd7f32) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--rank-color, #cd7f32) 35%, transparent);
  border-radius: 99px;
  padding: 0.2rem 0.65rem;
}

@media (max-width: 640px) {
  .nightmare-steps { gap: 0.3rem; }
  .nightmare-step { padding: 0.5rem 0.25rem; }
  .nightmare-step-icon { font-size: 1rem; }
}

/* ========== QUIZ ULTIME ========== */
@keyframes ult-gradient {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}
@keyframes ult-shimmer {
  0%   { opacity: 0.85; }
  50%  { opacity: 1; }
  100% { opacity: 0.85; }
}
@keyframes ult-glow-pulse {
  0%   { box-shadow: 0 4px 24px rgba(236,72,153,0.35), 0 0 0 0 rgba(245,158,11,0.2); }
  50%  { box-shadow: 0 6px 40px rgba(139,92,246,0.5), 0 0 20px 4px rgba(245,158,11,0.15); }
  100% { box-shadow: 0 4px 24px rgba(236,72,153,0.35), 0 0 0 0 rgba(245,158,11,0.2); }
}
@keyframes ult-crown-bounce {
  0%, 100% { transform: translateY(0) rotate(-3deg); }
  50%       { transform: translateY(-6px) rotate(3deg); }
}
@keyframes ult-nope {
  0%   { transform: translateX(0); }
  15%  { transform: translateX(-8px) rotate(-4deg); }
  30%  { transform: translateX(8px) rotate(4deg); }
  45%  { transform: translateX(-6px) rotate(-3deg); }
  60%  { transform: translateX(6px) rotate(3deg); }
  75%  { transform: translateX(-3px); }
  100% { transform: translateX(0); }
}
.btn-hint-nope {
  animation: ult-nope 0.5s ease;
}

.btn-ultimate {
  background: linear-gradient(135deg, #f59e0b, #ec4899, #8b5cf6, #06b6d4, #f59e0b);
  background-size: 300% 300%;
  animation: ult-gradient 4s ease infinite, ult-glow-pulse 3s ease-in-out infinite;
  color: white;
  font-weight: 700;
  letter-spacing: 0.03em;
  border: none;
}
.btn-ultimate:hover:not(:disabled) {
  transform: translateY(-2px) scale(1.02);
  filter: brightness(1.1);
}
.btn-ultimate:disabled {
  animation: none;
  background: #888;
  box-shadow: none;
}

.ultimate-badge {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  background: linear-gradient(135deg, #f59e0b, #ec4899);
  color: white;
  font-size: 0.65rem;
  font-weight: 700;
  border-radius: 99px;
  letter-spacing: 0.05em;
  vertical-align: middle;
  margin-left: 0.35rem;
}

/* Setup page title */
.ultimate-setup-title {
  font-size: 2rem;
  font-weight: 900;
  background: linear-gradient(135deg, #f59e0b 0%, #ec4899 40%, #8b5cf6 80%, #06b6d4 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-align: center;
  line-height: 1.2;
}
.ultimate-crown {
  font-size: 3rem;
  display: block;
  text-align: center;
  animation: ult-crown-bounce 2.5s ease-in-out infinite;
  margin-bottom: 0.25rem;
}
.ultimate-country-count-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  background: linear-gradient(135deg, rgba(245,158,11,0.15), rgba(139,92,246,0.15));
  border: 1px solid rgba(236,72,153,0.3);
  border-radius: 99px;
  padding: 0.4rem 1rem;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0.5rem auto;
  width: fit-content;
  align-self: center;
}

/* Step indicators overrides for ultimate mode */
.ultimate-mode .nightmare-step.active {
  border-color: #ec4899;
  background: rgba(236, 72, 153, 0.1);
  animation: ult-shimmer 1.8s ease-in-out infinite;
}
.ultimate-mode .nightmare-step.done-correct {
  border-color: #f59e0b;
  background: rgba(245, 158, 11, 0.12);
}
.ultimate-mode .quiz-progress-fill {
  background: linear-gradient(90deg, #f59e0b, #ec4899, #8b5cf6);
  background-size: 200% 100%;
  animation: ult-gradient 3s ease infinite;
}
.ultimate-mode .quiz-score-badge {
  background: linear-gradient(135deg, #f59e0b, #ec4899);
  color: white;
}
.ultimate-mode .ranked-indicator {
  background: linear-gradient(135deg, #f59e0b, #8b5cf6);
  color: white;
}

/* Country summary card (ultimate) */
.ultimate-country-summary {
  background: linear-gradient(135deg, rgba(245,158,11,0.06), rgba(139,92,246,0.06));
  border: 1px solid rgba(236,72,153,0.25);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  position: relative;
  overflow: hidden;
}
.ultimate-country-summary::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(245,158,11,0.04), transparent 60%, rgba(139,92,246,0.04));
  pointer-events: none;
}

/* Results page ultimate flavour */
.ultimate-results-header {
  text-align: center;
  padding: 1.5rem 0 0.5rem;
}
.ultimate-results-score {
  font-size: 4rem;
  font-weight: 900;
  background: linear-gradient(135deg, #f59e0b, #ec4899, #8b5cf6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.ultimate-fireworks {
  font-size: 2rem;
  letter-spacing: 0.5rem;
  animation: ult-shimmer 1.5s ease-in-out infinite;
}

/* Victory screen */
@keyframes ult-victory-crown {
  0%   { transform: scale(1) rotate(-5deg); }
  25%  { transform: scale(1.15) rotate(5deg); }
  50%  { transform: scale(1.05) rotate(-3deg); }
  75%  { transform: scale(1.12) rotate(3deg); }
  100% { transform: scale(1) rotate(-5deg); }
}
@keyframes ult-victory-bg {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}
@keyframes ult-float-in {
  from { opacity: 0; transform: translateY(30px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes ult-sparkle {
  0%, 100% { opacity: 0.4; transform: scale(0.8); }
  50%       { opacity: 1;   transform: scale(1.2); }
}

.ultimate-victory-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 2rem 1rem 4rem;
  background: linear-gradient(135deg, #0f0c29, #1a0533, #24243e, #0f0c29);
  background-size: 400% 400%;
  animation: ult-victory-bg 8s ease infinite;
  position: relative;
  overflow: hidden;
}
.ultimate-victory-page::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 0%, rgba(245,158,11,0.12) 0%, transparent 65%),
              radial-gradient(ellipse at 20% 80%, rgba(139,92,246,0.1) 0%, transparent 50%),
              radial-gradient(ellipse at 80% 80%, rgba(236,72,153,0.1) 0%, transparent 50%);
  pointer-events: none;
}

@keyframes halo-pulse {
  0%, 100% { opacity: 0.6; transform: scale(1); }
  50%       { opacity: 1;   transform: scale(1.08); }
}
@keyframes earth-face {
  0%, 30%  { opacity: 1; }
  33%, 97% { opacity: 0; }
  100%     { opacity: 1; }
}

.ult-globe-wrap {
  position: relative;
  width: 130px;
  height: 160px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  margin: 0.5rem auto 0.75rem;
  z-index: 1;
}
.ult-globe-crown {
  font-size: 2.8rem;
  position: relative;
  z-index: 4;
  margin-bottom: -14px;
  filter: drop-shadow(0 0 14px rgba(245,158,11,0.9)) drop-shadow(0 2px 4px rgba(0,0,0,0.5));
  animation: ult-crown-bounce 2.5s ease-in-out infinite;
}
.ult-victory-crown {
  font-size: 6rem;
  display: block;
  text-align: center;
  position: relative;
  z-index: 1;
  margin-bottom: 0.25rem;
  filter: drop-shadow(0 0 24px rgba(245,158,11,0.8));
  animation: ult-victory-crown 3s ease-in-out infinite;
}
.ult-globe-halo {
  position: absolute;
  width: 112px;
  height: 112px;
  border-radius: 50%;
  top: 46px;
  z-index: 1;
  background: radial-gradient(circle, rgba(245,158,11,0.2) 0%, rgba(245,158,11,0.06) 55%, transparent 72%);
  box-shadow:
    0 0 30px 10px rgba(245,158,11,0.2),
    0 0 70px 25px rgba(245,158,11,0.08),
    0 0 100px 40px rgba(236,72,153,0.05);
  animation: halo-pulse 3s ease-in-out infinite;
}
.ult-globe-earth {
  width: 96px;
  height: 96px;
  position: relative;
  z-index: 2;
  filter: drop-shadow(0 4px 16px rgba(29,136,228,0.5));
}
.ult-globe-earth span {
  position: absolute;
  inset: 0;
  font-size: 96px;
  line-height: 1;
  opacity: 0;
}
.ult-globe-earth span:nth-child(1) { animation: earth-face 2.4s 0s   infinite; }
.ult-globe-earth span:nth-child(2) { animation: earth-face 2.4s 0.8s infinite; }
.ult-globe-earth span:nth-child(3) { animation: earth-face 2.4s 1.6s infinite; }

.ult-victory-title {
  font-size: 2.2rem;
  font-weight: 900;
  background: linear-gradient(135deg, #f59e0b, #fde68a, #ec4899, #c084fc, #f59e0b);
  background-size: 300% 300%;
  animation: ult-gradient 4s ease infinite;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-align: center;
  line-height: 1.2;
  margin: 0.75rem 0 0.25rem;
  position: relative;
  z-index: 1;
}
.ult-victory-subtitle {
  font-size: 0.9rem;
  color: rgba(255,255,255,0.5);
  text-align: center;
  margin-bottom: 1.5rem;
  position: relative;
  z-index: 1;
}

.ult-victory-score {
  font-size: 5rem;
  font-weight: 900;
  background: linear-gradient(135deg, #f59e0b, #fde68a);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
  filter: drop-shadow(0 0 16px rgba(245,158,11,0.4));
  position: relative;
  z-index: 1;
  animation: ult-float-in 0.6s ease both;
  animation-delay: 0.2s;
}
.ult-victory-score-label {
  font-size: 0.8rem;
  color: rgba(255,255,255,0.4);
  text-align: center;
  margin-bottom: 1.5rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.ult-victory-stats {
  display: flex;
  gap: 1.5rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
  position: relative;
  z-index: 1;
  animation: ult-float-in 0.6s ease both;
  animation-delay: 0.35s;
}
.ult-victory-stat {
  text-align: center;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(245,158,11,0.2);
  border-radius: var(--radius-md);
  padding: 0.75rem 1.25rem;
  min-width: 80px;
}
.ult-victory-stat-num {
  font-size: 1.5rem;
  font-weight: 800;
  color: #fde68a;
}
.ult-victory-stat-label {
  font-size: 0.7rem;
  color: rgba(255,255,255,0.4);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 0.15rem;
}

.ult-victory-rank-wrap {
  width: 100%;
  max-width: 480px;
  position: relative;
  z-index: 1;
  animation: ult-float-in 0.6s ease both;
  animation-delay: 0.5s;
}
.ult-victory-rank-wrap .rank-card {
  background: rgba(255,255,255,0.05);
  border-color: rgba(245,158,11,0.25);
}

.ult-victory-btn-wrap {
  margin-top: 2rem;
  position: relative;
  z-index: 1;
  animation: ult-float-in 0.6s ease both;
  animation-delay: 0.65s;
}

/* Nav / home card */
.quiz-pick-ultimate { border-top-color: #f59e0b; }
.quiz-pick-ultimate:hover {
  border-color: #ec4899;
  box-shadow: 0 4px 20px rgba(236,72,153,0.25);
}
.home-track-ultimate { border-left-color: #f59e0b; }
.home-track-ultimate:hover {
  border-color: #ec4899;
  box-shadow: 0 4px 20px rgba(236,72,153,0.2);
}

@media (max-width: 640px) {
  .ultimate-setup-title { font-size: 1.5rem; }
  .ultimate-crown { font-size: 2.2rem; }
}

/* ========== MODE SELECTOR (Ranked) ========== */
.mode-selector {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
}
.mode-card {
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem;
  cursor: pointer;
  transition: all var(--transition);
  text-align: center;
}
.mode-card:hover { border-color: var(--border-active); transform: translateY(-2px); }
.mode-card.selected { border-color: var(--accent); background: rgba(79, 99, 255, 0.1); }
.mode-card.selected[data-mode="ranked"] { border-color: #ffd700; background: rgba(255, 215, 0, 0.07); }
.mode-card-icon { font-size: 1.75rem; margin-bottom: 0.4rem; }
.mode-card-name { font-size: 0.95rem; font-weight: 700; margin-bottom: 0.25rem; }
.mode-card-desc { font-size: 0.72rem; color: var(--text-muted); line-height: 1.4; }

/* Ranked badge shown in quiz header during ranked session */
.ranked-indicator {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem 0.55rem;
  background: rgba(255, 215, 0, 0.12);
  border: 1px solid rgba(255, 215, 0, 0.4);
  border-radius: var(--radius-full);
  font-size: 0.7rem;
  font-weight: 700;
  color: #ffd700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  transition: opacity 0.25s, color 0.25s, border-color 0.25s, text-decoration 0.25s;
}

.ranked-indicator--voided {
  opacity: 0.4;
  color: var(--text-muted);
  border-color: var(--border);
  background: transparent;
  text-decoration: line-through;
}

/* Level cards dimmed when ranked mode is active */
.level-cards.locked {
  opacity: 0.35;
  pointer-events: none;
}

/* Rank-up announcement badge */
.rank-up-badge {
  background: linear-gradient(135deg, #ffd700, #ff9f43);
  color: #1a1020;
  font-weight: 800;
  text-align: center;
  padding: 0.6rem 1.25rem;
  border-radius: var(--radius-md);
  margin-bottom: 0.85rem;
  font-size: 1.05rem;
  animation: rankUpPop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
@keyframes rankUpPop {
  from { transform: scale(0.7); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}

/* ========== RANK BADGES ANIMATED (SVG) ========== */

.rb-wrap {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  text-align: center;
}

.rb-medal-wrap {
  position: relative;
}

/* Sparkle container — lives outside the medal so it's not clipped */
.rb-sparks-wrap {
  position: absolute;
  inset: -20px;
  pointer-events: none;
  z-index: 5;
}

.rb-spark {
  position: absolute;
  clip-path: polygon(50% 0%, 56% 44%, 100% 50%, 56% 56%, 50% 100%, 44% 56%, 0% 50%, 44% 44%);
  animation: rb-twinkle var(--dur, 2s) ease-in-out infinite var(--delay, 0s);
  opacity: 0;
}

/* Transparent container — shape comes from the SVG inside */
.rb-medal {
  position: relative;
  width: var(--rb-size, 110px);
  height: var(--rb-size, 110px);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: visible;
  animation: rb-float 3s ease-in-out infinite;
}

.rb-medal svg {
  width: 100%;
  height: 100%;
  flex-shrink: 0;
  overflow: visible;
}

.rb-name {
  font-size: 0.9rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.rb-xp-req {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 500;
}

.rb-desc {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-style: italic;
}

/* ---- Shared keyframes ---- */
@keyframes rb-float {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-8px); }
}
@keyframes rb-twinkle {
  0%        { opacity: 0;   transform: scale(0)   rotate(0deg); }
  15%       { opacity: 1;   transform: scale(1.2) rotate(0deg); }
  40%       { opacity: 0.9; transform: scale(1)   rotate(45deg); }
  70%       { opacity: 0.4; transform: scale(0.6) rotate(45deg); }
  100%      { opacity: 0;   transform: scale(0)   rotate(45deg); }
}

/* ---- Glow animations via filter: drop-shadow (follows SVG shape) ---- */
.rb-bronze .rb-medal { animation: rb-float 3s ease-in-out infinite, rb-glow-bronze 3s ease-in-out infinite; }
.rb-silver .rb-medal { animation: rb-float 3.2s ease-in-out infinite, rb-glow-silver 3.2s ease-in-out infinite; }
.rb-gold   .rb-medal { animation: rb-float 2.6s ease-in-out infinite, rb-glow-gold 2.6s ease-in-out infinite; }
.rb-platine .rb-medal{ animation: rb-float 3s ease-in-out infinite, platineIridescent 6s ease-in-out infinite; }
.rb-diamond .rb-medal{ animation: rb-float 2.8s ease-in-out infinite, diamondIridescent 4s ease-in-out infinite; }
.rb-legend .rb-medal { animation: rb-float 2.2s ease-in-out infinite, rb-glow-legend 2.2s ease-in-out infinite; }

@keyframes rb-glow-bronze {
  0%, 100% { filter: drop-shadow(0 4px 14px rgba(205,127,50,0.65)); }
  50%       { filter: drop-shadow(0 7px 28px rgba(205,127,50,0.98)) drop-shadow(0 0 14px rgba(205,127,50,0.45)); }
}
@keyframes rb-glow-silver {
  0%, 100% { filter: drop-shadow(0 4px 14px rgba(168,169,173,0.55)); }
  50%       { filter: drop-shadow(0 7px 28px rgba(168,169,173,0.9)) drop-shadow(0 0 12px rgba(168,169,173,0.38)); }
}
@keyframes rb-glow-gold {
  0%, 100% { filter: drop-shadow(0 4px 16px rgba(255,215,0,0.7)); }
  50%       { filter: drop-shadow(0 8px 36px rgba(255,215,0,1)) drop-shadow(0 0 22px rgba(255,215,0,0.55)); }
}
/* rb-glow-platine and rb-glow-diamond replaced by platineSparkle / diamondSparkle above */
@keyframes rb-glow-legend {
  0%, 100% { filter: drop-shadow(0 5px 24px rgba(200,80,220,0.8)) drop-shadow(0 0 10px rgba(255,160,50,0.5)); }
  50%       { filter: drop-shadow(0 10px 50px rgba(220,100,255,1)) drop-shadow(0 0 30px rgba(255,160,50,0.75)) drop-shadow(0 0 8px rgba(255,80,160,0.6)); }
}

/* ---- Name colours ---- */
.rb-bronze  .rb-name { color: #cd7f32; }
.rb-silver  .rb-name { color: #a8a9ad; }
.rb-gold    .rb-name { color: #c9a800; }
.rb-platine .rb-name { color: #7aaadd; }
.rb-diamond .rb-name { color: #44ccee; }
.rb-legend  .rb-name { color: #dd66ff; }

/* ---- Test Page grid ---- */
.rb-test-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem 1.25rem;
  margin: 2rem 0;
  justify-items: center;
}
@media (max-width: 600px) {
  .rb-test-grid { grid-template-columns: repeat(2, 1fr); gap: 1.5rem 0.75rem; }
}

.rb-test-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.75rem 1rem 1.25rem;
  text-align: center;
  width: 100%;
  transition: border-color 0.3s;
}

.rb-current-label {
  font-size: 0.65rem;
  font-weight: 800;
  padding: 0.18rem 0.55rem;
  border-radius: 99px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #111;
  margin-top: 0.35rem;
}

/* ---- Simulator ---- */
.rb-simulator {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-top: 0.5rem;
  text-align: center;
}
.rb-simulator h3 { font-size: 1rem; font-weight: 700; margin-bottom: 0.4rem; }
.rb-sim-slider {
  width: 100%;
  max-width: 420px;
  accent-color: #ff9f43;
  margin: 1rem 0;
  cursor: pointer;
}
.rb-sim-display {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  flex-wrap: wrap;
  margin-top: 0.5rem;
  min-height: 130px;
}
.rb-sim-xp {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
}

/* ========== LEVEL-UP OVERLAY — LoL style ========== */

/* Overlay backdrop */
.lu-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0);
  pointer-events: all;
  cursor: pointer;
  animation: luFadeIn 0.45s ease forwards;
}
.lu-overlay.leaving { animation: luFadeOut 0.55s ease forwards; pointer-events: none; }
@keyframes luFadeIn  { from { background: rgba(0,0,0,0);    } to { background: rgba(0,0,0,0.92); } }
@keyframes luFadeOut { from { background: rgba(0,0,0,0.92); } to { background: rgba(0,0,0,0);    } }

/* Atmospheric colored glow behind panel */
.lu-bg-glow {
  position: absolute;
  inset: 0;
  pointer-events: none;
  animation: luBgGlowIn 1s ease 0.08s both;
}
@keyframes luBgGlowIn {
  from { opacity: 0; transform: scale(0.7); }
  to   { opacity: 1; transform: scale(1);   }
}

/* White flash on entry */
.lu-flash {
  position: absolute;
  inset: 0;
  background: white;
  opacity: 0;
  pointer-events: none;
  animation: luFlash 0.9s ease forwards;
}
@keyframes luFlash {
  0%  { opacity: 0;    }
  9%  { opacity: 0.68; }
  100%{ opacity: 0;    }
}

/* ─── Panel ─────────────────────────────────────────────── */
.lu-panel {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.8rem;
  padding: 0 2.75rem 1.75rem;
  background: linear-gradient(175deg, rgba(10,14,32,0.97) 0%, rgba(4,7,18,0.99) 100%);
  border: 1px solid;
  border-radius: 3px;
  min-width: 320px;
  max-width: 84vw;
  overflow: hidden;
  backdrop-filter: blur(20px);
  box-shadow:
    0 0 0 1px var(--lc33, rgba(255,255,255,.2)),
    0 0 55px var(--lc33, rgba(255,255,255,.2)),
    0 0 130px var(--lc18, rgba(255,255,255,.1)),
    0 50px 120px rgba(0,0,0,0.95);
  animation:
    luPanelSlide  0.7s cubic-bezier(0.16,1,0.3,1) 0.06s both,
    luPanelGlow   3s  ease-in-out               2.2s infinite;
}
/* Sweep of light across panel */
.lu-panel::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 20;
  background: linear-gradient(110deg, transparent 30%, rgba(255,255,255,.05) 50%, transparent 70%);
  transform: translateX(-100%);
  animation: luSweep 1.5s ease 0.85s forwards;
  pointer-events: none;
}
@keyframes luPanelSlide {
  0%   { transform: translateY(100px) scale(0.8);  opacity: 0; filter: blur(5px); }
  55%  { transform: translateY(-12px) scale(1.025); opacity: 1; filter: blur(0);   }
  75%  { transform: translateY(5px)  scale(0.993); }
  100% { transform: translateY(0)    scale(1);     opacity: 1; filter: blur(0);   }
}
@keyframes luPanelGlow {
  0%,100% { box-shadow: 0 0 0 1px var(--lc33,rgba(255,255,255,.2)), 0 0 55px var(--lc33,rgba(255,255,255,.2)), 0 0 130px var(--lc18,rgba(255,255,255,.1)), 0 50px 120px rgba(0,0,0,.95); }
  50%     { box-shadow: 0 0 0 1px var(--lc55,rgba(255,255,255,.35)), 0 0 85px var(--lc55,rgba(255,255,255,.35)), 0 0 200px var(--lc33,rgba(255,255,255,.2)), 0 50px 120px rgba(0,0,0,.95); }
}
@keyframes luSweep {
  from { transform: translateX(-100%); }
  to   { transform: translateX(250%);  }
}

/* 1-px top-edge highlight */
.lu-panel-topglow {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--lc, white), transparent);
  opacity: 0.55;
  pointer-events: none;
}

/* ─── Corner L-accents ───────────────────────────────────── */
.lu-corner {
  position: absolute;
  width: 22px;
  height: 22px;
  border: 2px solid var(--lc, white);
  opacity: 0.75;
  pointer-events: none;
}
.lu-corner-tl { top:-1px;    left:-1px;   border-right:none;  border-bottom:none; border-radius:3px 0 0 0; }
.lu-corner-tr { top:-1px;    right:-1px;  border-left:none;   border-bottom:none; border-radius:0 3px 0 0; }
.lu-corner-bl { bottom:-1px; left:-1px;   border-right:none;  border-top:none;    border-radius:0 0 0 3px; }
.lu-corner-br { bottom:-1px; right:-1px;  border-left:none;   border-top:none;    border-radius:0 0 3px 0; }

/* ─── Header: —— NIVEAU SUPÉRIEUR —— ─────────────────────── */
.lu-panel-header {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  width: 100%;
  padding-top: 1.75rem;
  animation: luFadeSlideDown 0.5s ease 0.16s both;
}
@keyframes luFadeSlideDown {
  from { transform: translateY(-16px); opacity: 0; }
  to   { transform: translateY(0);     opacity: 1; }
}
.lu-header-line {
  flex: 1;
  height: 1px;
  transform-origin: right center;
  animation: luHeaderLine 0.55s ease 0.35s both;
}
.lu-header-line-l { background: linear-gradient(90deg, transparent, var(--lc44, rgba(255,255,255,.27))); transform-origin: right center; }
.lu-header-line-r { background: linear-gradient(90deg, var(--lc44, rgba(255,255,255,.27)), transparent); transform-origin: left  center; }
@keyframes luHeaderLine {
  from { transform: scaleX(0); opacity: 0; }
  to   { transform: scaleX(1); opacity: 1; }
}
.lu-title {
  font-size: clamp(0.6rem, 2vw, 0.78rem);
  font-weight: 800;
  letter-spacing: 0.34em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.55);
  white-space: nowrap;
  flex-shrink: 0;
}

/* ─── Ornate divider ──◆─────────────────────────────────── */
.lu-divider {
  display: flex;
  align-items: center;
  width: 100%;
  gap: 0.55rem;
  animation: luDividerIn 0.55s ease both;
}
@keyframes luDividerIn {
  from { opacity: 0; transform: scaleX(0.45); }
  to   { opacity: 1; transform: scaleX(1);    }
}
.lu-divider-line   { flex: 1; height: 1px; }
.lu-divider-line-l { background: linear-gradient(90deg, transparent, var(--lc66, rgba(255,255,255,.4))); }
.lu-divider-line-r { background: linear-gradient(90deg, var(--lc66, rgba(255,255,255,.4)), transparent); }
.lu-divider-gem {
  color: var(--lc, white);
  font-size: 0.6rem;
  text-shadow: 0 0 12px var(--lc, white), 0 0 24px var(--lc, white);
  flex-shrink: 0;
}

/* ─── Badge section ─────────────────────────────────────── */
.lu-badge-section {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 230px;
  height: 230px;
}
/* Colored orb / halo */
.lu-badge-orb {
  position: absolute;
  inset: -18px;
  border-radius: 50%;
  animation: luOrbIn 0.7s ease 0.36s both, luOrbPulse 3.2s ease-in-out 1.6s infinite;
}
@keyframes luOrbIn {
  from { transform: scale(0); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}
@keyframes luOrbPulse {
  0%,100% { transform: scale(1);    opacity: 1;   }
  50%     { transform: scale(1.12); opacity: 0.6; }
}
/* ✦ Stars orbiting badge */
.lu-badge-star {
  position: absolute;
  font-size: 0.72rem;
  transform: translate(-50%,-50%) scale(0);
  color: var(--lc, white);
  text-shadow: 0 0 10px var(--lc, white), 0 0 20px var(--lc, white);
  pointer-events: none;
  /* two animations: pop-in then twinkle (delays set per-element inline) */
  animation:
    luStarPop     0.45s cubic-bezier(0.34,1.56,0.64,1) both,
    luStarTwinkle 2.2s  ease-in-out                    infinite;
}
@keyframes luStarPop {
  from { transform: translate(-50%,-50%) scale(0); opacity: 0; }
  to   { transform: translate(-50%,-50%) scale(1); opacity: 1; }
}
@keyframes luStarTwinkle {
  0%,100% { opacity: 1;    transform: translate(-50%,-50%) scale(1);   }
  50%     { opacity: 0.2;  transform: translate(-50%,-50%) scale(0.55); }
}
/* Badge SVG wrapper */
.lu-badge-wrap {
  position: relative;
  z-index: 1;
  animation: luBadgePop 0.8s cubic-bezier(0.34,1.56,0.64,1) 0.46s both;
}
@keyframes luBadgePop {
  0%   { transform: scale(0.05) rotate(-35deg); opacity: 0; filter: blur(8px);  }
  60%  { transform: scale(1.12) rotate(4deg);   opacity: 1; filter: blur(0);    }
  80%  { transform: scale(0.95) rotate(-1deg);              }
  100% { transform: scale(1)    rotate(0deg);   opacity: 1; }
}

/* ─── Rank name (large, pulsing) ───────────────────────── */
.lu-rank-name {
  font-size: clamp(1.55rem, 6vw, 2.1rem);
  font-weight: 900;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--lc, white);
  text-shadow:
    0 0 28px var(--lc55, rgba(255,255,255,.35)),
    0 0 60px var(--lc33, rgba(255,255,255,.2));
  animation:
    luRankNameIn    0.7s cubic-bezier(0.34,1.56,0.64,1) 0.72s both,
    luRankNamePulse 3.2s ease-in-out                    2.1s  infinite;
}
@keyframes luRankNameIn {
  from { transform: scale(0.25); opacity: 0; filter: blur(10px); }
  to   { transform: scale(1);    opacity: 1; filter: blur(0);    }
}
@keyframes luRankNamePulse {
  0%,100% { text-shadow: 0 0 28px var(--lc55,rgba(255,255,255,.35)), 0 0 60px var(--lc33,rgba(255,255,255,.2)); }
  50%     { text-shadow: 0 0 45px var(--lc88,rgba(255,255,255,.6)),  0 0 90px var(--lc55,rgba(255,255,255,.35)); }
}

/* ─── Rank description ─────────────────────────────────── */
.lu-rank-desc {
  font-size: 0.73rem;
  color: rgba(255,255,255,0.38);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-top: -0.3rem;
  animation: luFadeUp 0.4s ease 0.98s both;
}

/* ─── Dismiss hint ─────────────────────────────────────── */
.lu-dismiss {
  font-size: 0.63rem;
  color: rgba(255,255,255,0.25);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  margin-top: 0.1rem;
  animation: luFadeUp 0.4s ease 1.4s both;
}
@keyframes luFadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0);   }
}

/* ─── Particles & lines ────────────────────────────────── */
.lu-particle {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  top: 50%; left: 50%;
  animation: luParticle var(--dur,1s) ease var(--delay,0s) both;
}
@keyframes luParticle {
  0%   { transform: translate(-50%,-50%) scale(1); opacity: 1; }
  100% { transform: translate(calc(-50% + var(--tx,0px)), calc(-50% + var(--ty,0px))) scale(0); opacity: 0; }
}
.lu-lines-wrap {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}
.lu-line {
  position: absolute;
  top: 50%; left: 50%;
  height: 2px;
  transform-origin: left center;
  border-radius: 99px;
  animation: luLine var(--dur,.6s) ease var(--delay,0s) both;
}
@keyframes luLine {
  from { width: 0;                   opacity: 1; }
  to   { width: var(--len, 200px);   opacity: 0; }
}

/* ========== ACHIEVEMENTS PAGE ========== */

/* Summary bar at top */
.ach-summary {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
}
.ach-summary-inner { display: flex; flex-direction: column; gap: 0.4rem; flex: 1; min-width: 160px; }
.ach-summary-count { display: flex; align-items: baseline; gap: 0.1rem; }
.ach-summary-num { font-size: 2rem; font-weight: 800; color: var(--accent-light); }
.ach-summary-denom { font-size: 1rem; color: var(--text-muted); }
.ach-summary-label { font-size: 0.8rem; color: var(--text-muted); margin-top: -0.2rem; }
.ach-summary-bar-track {
  height: 6px; background: var(--bg-surface); border-radius: 99px; overflow: hidden; margin-top: 0.4rem;
}
.ach-summary-bar-fill {
  height: 100%; background: var(--accent); border-radius: 99px;
  transition: width 0.6s ease;
}
.ach-summary-title-preview {
  display: flex; flex-direction: column; align-items: flex-end; gap: 0.4rem;
}
.ach-hint {
  font-size: 0.8rem; color: var(--text-muted); margin-bottom: 1.25rem;
}
.ach-section-title {
  font-size: 1rem; font-weight: 700; margin: 1.5rem 0 0.75rem;
}

/* Achievement grid */
.ach-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
  margin-bottom: 0.5rem;
}

/* Group card */
.ach-group-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem 1.1rem 0.75rem;
  display: flex; flex-direction: column; gap: 0.75rem;
}
.ach-group-header {
  display: flex; align-items: center; gap: 0.6rem;
}
.ach-group-emoji { font-size: 1.4rem; line-height: 1; }
.ach-group-label { font-weight: 700; font-size: 0.95rem; flex: 1; }
.ach-group-val { font-size: 0.85rem; font-weight: 700; }

/* Progress bar inside card */
.ach-group-bar-track {
  position: relative;
  height: 8px;
  background: var(--bg-surface);
  border-radius: 99px;
  overflow: visible;
}
.ach-group-bar-fill {
  height: 100%;
  border-radius: 99px;
  transition: width 0.5s ease;
  position: relative;
  z-index: 1;
}
.ach-group-bar-mark {
  position: absolute;
  top: -3px;
  width: 2px;
  height: 14px;
  background: var(--border);
  border-radius: 1px;
  transform: translateX(-50%);
  z-index: 2;
}
.ach-group-bar-mark.passed { background: rgba(255,255,255,0.6); }

/* Achievement rows */
.ach-rows { display: flex; flex-direction: column; gap: 0.4rem; }
.ach-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.45rem 0.5rem;
  border-radius: var(--radius-sm);
  transition: background 0.15s;
}
.ach-row-unlocked { cursor: default; }
.ach-row-unlocked:hover { background: rgba(255,255,255,0.03); }
.ach-row-locked { opacity: 0.5; }

/* ── Per-title notification dot ── */
.ach-row { position: relative; }
.ach-notif-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #e74c3c;
  border: 1.5px solid var(--bg-card, #1e293b);
  pointer-events: none;
  flex-shrink: 0;
}

.ach-row-left { display: flex; align-items: center; gap: 0.55rem; flex: 1; min-width: 0; }
.ach-row-text { display: flex; flex-direction: column; gap: 0.1rem; min-width: 0; }
.ach-row-title { font-size: 0.85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ach-row-tier { font-size: 0.7rem; color: var(--text-muted); }
.ach-row-progress-text { font-size: 0.75rem; color: var(--text-muted); white-space: nowrap; flex-shrink: 0; }

/* Tier pips */
.ach-tier-pip {
  width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; display: inline-block;
}
.ach-tier-plastic       { background: #4caf50; }
.ach-tier-bronze        { background: #cd7f32; }
.ach-tier-silver        { background: #a8a9ad; }
.ach-tier-gold          { background: #ffd700; }
.ach-tier-diamond       { background: #ffd700; }
.ach-tier-ultimate      { background: conic-gradient(#f00,#ff0,#0f0,#0ff,#00f,#f0f,#f00); }

/* Equip button */
.ach-equip-btn {
  font-size: 0.72rem; font-weight: 600; font-family: var(--font);
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text-secondary);
  cursor: pointer; white-space: nowrap; flex-shrink: 0;
  transition: all 0.15s;
}
.ach-equip-btn:hover { border-color: var(--accent-light); color: var(--accent-light); }
.ach-equip-btn.active {
  background: var(--accent); color: white; border-color: var(--accent);
}

/* Ultimate group card */
.ach-group-ultimate {
  background: linear-gradient(135deg, rgba(124,58,237,0.08), rgba(255,215,0,0.06));
  border-color: rgba(255,215,0,0.25);
}
.ach-group-ultimate-unlocked {
  border-color: rgba(255,215,0,0.6);
  box-shadow: 0 0 20px rgba(255,215,0,0.12);
}

/* ── Title badges (profile + achievements page) ── */
.ach-title-badge {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.ach-title-plastic { color: #4caf50; }
.ach-title-bronze  { color: #cd7f32; }
.ach-title-silver  { color: #a8a9ad; }
.ach-title-gold    { color: #ffd700; }
.ach-title-diamond { color: #ffd700; }

/* Rainbow ultimate title — Mario Kart star effect */
@keyframes achRainbow {
  0%   { color: #ff2222; }
  14%  { color: #ff8800; }
  28%  { color: #ffee00; }
  42%  { color: #22dd22; }
  57%  { color: #00aaff; }
  71%  { color: #8833ff; }
  85%  { color: #ff44cc; }
  100% { color: #ff2222; }
}
@keyframes achRainbowBorder {
  0%   { border-color: #ff2222; box-shadow: 0 0 12px rgba(255,34,34,0.4);   }
  14%  { border-color: #ff8800; box-shadow: 0 0 12px rgba(255,136,0,0.4);   }
  28%  { border-color: #ffee00; box-shadow: 0 0 12px rgba(255,238,0,0.4);   }
  42%  { border-color: #22dd22; box-shadow: 0 0 12px rgba(34,221,34,0.4);   }
  57%  { border-color: #00aaff; box-shadow: 0 0 12px rgba(0,170,255,0.4);   }
  71%  { border-color: #8833ff; box-shadow: 0 0 12px rgba(136,51,255,0.4);  }
  85%  { border-color: #ff44cc; box-shadow: 0 0 12px rgba(255,68,204,0.4);  }
  100% { border-color: #ff2222; box-shadow: 0 0 12px rgba(255,34,34,0.4);   }
}
.ach-title-ultimate {
  animation: achRainbow 1.8s linear infinite;
  font-weight: 800;
  letter-spacing: 0.05em;
}

/* ── Navbar avatar title ── */
.nav-avatar-info { display: flex; flex-direction: column; gap: 0; line-height: 1.3; }
.nav-avatar-title-text { font-size: 0.62rem; font-weight: 700; }

/* ── Profile header card ── */
.profile-header-card {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem 1.5rem;
  margin-bottom: 1.5rem;
}
.profile-header-avatar-wrap { flex-shrink: 0; }
.profile-header-info { display: flex; flex-direction: column; gap: 0.35rem; }
.profile-header-name { font-size: 1.4rem; font-weight: 800; color: var(--text-primary); }
.profile-header-title { min-height: 1.6rem; display: flex; align-items: center; }

/* ═══════════════════════════════════════════════════════════════════════════
   LEADERBOARD / CLASSEMENT  (redesign inspiré Nexrise)
   ═══════════════════════════════════════════════════════════════════════════ */

.lb-page {
  max-width: 720px;
}

/* Désactiver scintillements et animations dans le leaderboard */
.lb-page .rb-sparks-wrap               { display: none !important; }
.lb-page .rb-medal                     { animation: none !important; filter: none !important; }
.lb-page .rank-badge-av-frame--diamond,
.lb-page .rank-badge-av-frame--legend  { animation: none !important; filter: none !important; }
.lb-page .ach-title-ultimate           { animation: none !important; color: #ff44cc; }

/* Titre avec couleur de rareté */
.lb-title-text  { font-size: inherit; }
.lb-title-none  { color: rgba(255,255,255,0.25); }

/* ─── Hero dark section ─────────────────────────────────────────────────── */
.lb-hero {
  position: relative;
  background: #08101e;
  border-radius: 22px;
  padding: 2.2rem 1.5rem 0;
  margin-bottom: 1.25rem;
  overflow: hidden;
}

/* Radial spotlight behind #1 */
.lb-glow {
  position: absolute;
  top: -60px;
  left: 50%;
  transform: translateX(-50%);
  width: 460px;
  height: 340px;
  background: var(--lb-glow, radial-gradient(ellipse at 50% 30%, rgba(79,99,255,0.32) 0%, rgba(79,99,255,0.08) 45%, transparent 70%));
  pointer-events: none;
  z-index: 0;
}
/* Subtle star-field texture */
.lb-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle, rgba(255,255,255,0.55) 1px, transparent 1px),
    radial-gradient(circle, rgba(255,255,255,0.3) 1px, transparent 1px);
  background-size: 48px 48px, 96px 96px;
  background-position: 0 0, 24px 24px;
  opacity: 0.04;
  pointer-events: none;
  z-index: 0;
}


/* ─── Podium ────────────────────────────────────────────────────────────── */
.lb-podium {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 0.75rem;
  position: relative;
  z-index: 1;
}

/* ─── Podium slots ──────────────────────────────────────────────────────── */
.lb-podium-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  min-width: 0;
  max-width: 230px;
}

/* ─── Podium animations ─────────────────────────────────────────────────── */
@keyframes lb-float-1 {
  0%, 100% { transform: translateY(0px) scale(1); }
  50%       { transform: translateY(-9px) scale(1.025); }
}
@keyframes lb-float-2 {
  0%, 100% { transform: translateY(0px) rotate(-1.2deg); }
  50%       { transform: translateY(-6px) rotate(0.6deg); }
}
@keyframes lb-float-3 {
  0%, 100% { transform: translateY(0px) rotate(1.2deg); }
  50%       { transform: translateY(-6px) rotate(-0.6deg); }
}
@keyframes lb-crown-bounce {
  0%, 100% { transform: translateY(0) rotate(-6deg); }
  30%       { transform: translateY(-5px) rotate(6deg); }
  60%       { transform: translateY(-2px) rotate(-3deg); }
}

.lb-podium-pos-1 .lb-av-area { animation: lb-float-1 3s   ease-in-out infinite; }
.lb-podium-pos-2 .lb-av-area { animation: lb-float-2 3.6s ease-in-out infinite 0.5s; }
.lb-podium-pos-3 .lb-av-area { animation: lb-float-3 3.3s ease-in-out infinite 1s; }

.lb-podium-pos-1 .lb-podium-crown {
  animation: lb-crown-bounce 2s ease-in-out infinite;
  display: inline-block;
}

@keyframes lb-halo {
  0%, 100% { box-shadow: 0 0 18px 6px rgba(120,140,255,0.55), 0 0 40px 12px rgba(120,140,255,0.2), 0 2px 14px rgba(0,0,0,0.45), 0 0 0 2px rgba(255,255,255,0.18); }
  50%       { box-shadow: 0 0 38px 16px rgba(120,140,255,0.9), 0 0 70px 28px rgba(120,140,255,0.35), 0 2px 14px rgba(0,0,0,0.45), 0 0 0 2px rgba(255,255,255,0.28); }
}
@keyframes lb-halo-gold {
  0%, 100% { box-shadow: 0 0 18px 6px rgba(255,200,60,0.55), 0 0 40px 14px rgba(255,200,60,0.22), 0 2px 14px rgba(0,0,0,0.45), 0 0 0 2px rgba(255,255,255,0.18); }
  50%       { box-shadow: 0 0 40px 18px rgba(255,200,60,0.9), 0 0 80px 32px rgba(255,200,60,0.38), 0 2px 14px rgba(0,0,0,0.45), 0 0 0 2px rgba(255,255,255,0.3); }
}

.lb-podium-slot .rank-badge-av-img {
  animation: lb-halo 2.8s ease-in-out infinite;
}
.lb-podium-pos-1 .rank-badge-av-img {
  animation: lb-halo-gold 2.4s ease-in-out infinite;
}

/* Avatar area floats above the score card */
.lb-av-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  position: relative;
  z-index: 2;
  margin-bottom: 0.9rem;
}

.lb-podium-crown {
  font-size: 1.5rem;
  line-height: 1;
  filter: drop-shadow(0 0 8px rgba(255,220,0,0.6));
  margin-bottom: 0.25rem;
}
.lb-podium-pos-1 .lb-podium-crown { font-size: 2rem; }

/* Name & title above card */
.lb-podium-name {
  font-weight: 700;
  font-size: 0.9rem;
  color: #fff;
  text-align: center;
  max-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-top: 0.4rem;
  margin-bottom: 0.1rem;  /* serré avec le titre */
}
.lb-podium-pos-1 .lb-podium-name { font-size: 1.05rem; }
.lb-you-name { color: #7b93ff !important; }

@keyframes lb-title-scroll {
  0%, 20%   { transform: translateX(0); }
  80%, 100% { transform: translateX(var(--lb-scroll-dist, 0px)); }
}

.lb-podium-title-text {
  font-size: 0.66rem;
  text-align: center;
  max-width: 130px;
  overflow: hidden;
  white-space: nowrap;
  /* pas de margin-bottom ici — l'espacement avec la card est géré par lb-av-area margin-bottom */
}

.lb-podium-title-text.lb-marquee,
.lb-podium-name.lb-marquee,
.lb-row-name.lb-marquee {
  text-align: left;
  text-overflow: clip;
}

.lb-podium-title-text.lb-marquee > span,
.lb-podium-name.lb-marquee > span,
.lb-row-name.lb-marquee > span {
  display: inline-block;
  animation: lb-title-scroll 3.5s ease-in-out infinite alternate;
  animation-delay: 1.2s;
}

/* Score card below avatar */
.lb-score-card {
  width: 100%;
  background: rgba(255,255,255,0.045);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 16px;
  padding: 0.9rem 0.5rem 1.1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}
.lb-score-card-1 {
  background: rgba(79,99,255,0.1);
  border-color: rgba(100,120,255,0.28);
  padding: 1.1rem 0.5rem 1.4rem;
}

/* Hide rb text inside score card */
.lb-score-card .rb-name,
.lb-score-card .rb-xp-req,
.lb-score-card .rb-desc { display: none; }
.lb-score-card .rb-wrap { gap: 0; }

.lb-score-xp {
  font-size: 1.1rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.02em;
  line-height: 1;
  margin-top: 0.3rem;
}
.lb-score-card-1 .lb-score-xp { font-size: 1.3rem; }

.lb-score-label {
  font-size: 0.6rem;
  color: rgba(255,255,255,0.32);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-top: 0.2rem;
}


/* ─── List section ──────────────────────────────────────────────────────── */
.lb-list-wrap {
  background: var(--card);
  border-radius: 16px;
  border: 1px solid var(--border);
  overflow: hidden;
}

.lb-list-hdr {
  display: grid;
  grid-template-columns: 44px 72px 1fr 72px;
  align-items: center;
  padding: 0.6rem 1rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.lb-row {
  display: grid;
  grid-template-columns: 44px 88px 1fr 84px;
  align-items: center;
  padding: 0.7rem 1rem;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
  gap: 0;
}
.lb-row:last-child { border-bottom: none; }
.lb-row:hover { background: rgba(79,99,255,0.04); }

.lb-row-you {
  background: rgba(79,99,255,0.06) !important;
  border-left: 3px solid var(--primary);
  padding-left: calc(1rem - 3px);
}

.lb-row-pos {
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--text-muted);
  text-align: center;
}

/* Avatar in rows — uses rank-badge-av-frame */
.lb-row-av-cell {
  display: flex;
  align-items: center;
  justify-content: center;
}

.lb-row-info {
  padding: 0 0.75rem;
  min-width: 0;
}

.lb-row-name {
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 160px;
}

.lb-row-title {
  font-size: 0.69rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}

.lb-row-xp-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

/* Hide rb text inside row rank icon */
.lb-row-xp-cell .rb-name,
.lb-row-xp-cell .rb-xp-req,
.lb-row-xp-cell .rb-desc { display: none; }
.lb-row-xp-cell .rb-wrap { gap: 0; }

.lb-row-xp {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
}

/* ─── Responsive ────────────────────────────────────────────────────────── */
@media (max-width: 520px) {
  .lb-hero { padding: 1.6rem 1rem 0; }
  .lb-glow { width: 280px; }
  .lb-podium { gap: 0.4rem; }
  .lb-podium-name { font-size: 0.76rem; max-width: 95px; }
  .lb-podium-title-text { display: none; }
  .lb-score-xp { font-size: 1.2rem; }
  .lb-score-card-1 .lb-score-xp { font-size: 1.45rem; }
  .lb-list-hdr { grid-template-columns: 32px 72px 1fr 68px; padding: 0.5rem 0.75rem; }
  .lb-row      { grid-template-columns: 32px 72px 1fr 68px; padding: 0.6rem 0.75rem; }
}

/* ─── Auth — bouton navbar ───────────────────────────────────────────────── */
.nav-auth-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  border-radius: var(--radius-md);
  padding: 0.3rem 0.75rem;
  font-size: 0.8rem;
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
  white-space: nowrap;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.nav-auth-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.nav-auth-btn.auth-logged-in {
  border-color: var(--accent);
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
}

/* ─── Auth — modale ─────────────────────────────────────────────────────── */
.auth-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
}
.auth-modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.auth-modal-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  width: 100%;
  max-width: 380px;
  position: relative;
}
.auth-modal-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1rem;
  cursor: pointer;
  line-height: 1;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
  transition: color 0.15s, background 0.15s;
}
.auth-modal-close:hover { color: var(--text); background: var(--bg-surface); }
.auth-modal-title {
  margin: 0 0 0.75rem;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text);
}
.auth-modal-info {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin: 0 0 1.25rem;
  line-height: 1.5;
}
.auth-email-input {
  width: 100%;
  box-sizing: border-box;
  padding: 0.6rem 0.9rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text);
  font-size: 0.95rem;
  font-family: inherit;
  margin-bottom: 0.75rem;
  outline: none;
  transition: border-color 0.15s;
}
.auth-email-input:focus { border-color: var(--accent); }
.auth-modal-action { width: 100%; justify-content: center; }
.auth-msg {
  margin-top: 0.75rem;
  font-size: 0.85rem;
  min-height: 1.2em;
  text-align: center;
}
.auth-msg-error   { color: #e74c3c; }
.auth-msg-success { color: #2ecc71; }

/* ─── Profile — hint "entre ton prénom" ─────────────────────────────────── */
.profile-save-hint {
  font-size: 0.82rem;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  border-radius: var(--radius-md);
  padding: 0.45rem 0.75rem;
  margin: 0 0 0.5rem;
  text-align: center;
  line-height: 1.4;
}
.cb-validate-btn {
  margin-top: 0.5rem;
  width: 100%;
}

/* ── Bouton Google ───────────────────────────────────────────────────────── */
.cb-google-sep {
  border: none;
  border-top: 1px solid var(--border);
  width: 100%;
  margin: 0;
}
.btn-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  width: 100%;
  box-sizing: border-box;
  background: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--border);
  font-weight: 500;
}
.btn-google:hover:not(:disabled) {
  background: var(--bg-card-hover);
  border-color: var(--border-hover);
}

.btn-google-connected {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  box-sizing: border-box;
  padding: 0.4rem 0.9rem;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  color: var(--text-secondary);
}
.btn-google-connected span {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.btn-google-signout {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 0.75rem;
  padding: 0;
  line-height: 1;
  flex-shrink: 0;
}
.btn-google-signout:hover { color: var(--error, #f87171); }

/* ========== RESPONSIVE MOBILE GLOBAL (≤ 480px) ========== */
@media (max-width: 480px) {
  /* Modals */
  .modal { padding: 1.5rem 1rem; }
  .modal-country { padding: 1.5rem 1rem; }
  .modal-country-name { font-size: 1.2rem; }

  /* Toast — avoid overflow */
  #toast-container { right: 0.75rem; bottom: 0.75rem; }
  .toast { max-width: calc(100vw - 1.5rem); font-size: 0.82rem; }

  /* Results page */
  .results-score-big { font-size: 2.5rem; }
  .results-title { font-size: 1.5rem; }
  .results-stat { padding: 0.65rem 1rem; }

  /* Filter tabs — more compact */
  .filter-tab { padding: 0.3rem 0.7rem; font-size: 0.75rem; }

  /* Profile header */
  .profile-header-card { gap: 0.75rem; padding: 0.75rem 1rem; }
  .profile-header-name { font-size: 1.2rem; }

  /* Auth modal */
  .auth-modal-box { padding: 1.5rem 1.25rem; }

  /* Keyboard hints — not useful on touch */
  .keyboard-hints { display: none; }

  /* Wrong answers — compact on small phones */
  .wrong-answer-item { font-size: 0.8rem; gap: 0.5rem; padding: 0.5rem 0.7rem; }

  /* Quiz setup */
  .quiz-setup-title { font-size: 1.4rem; }

  /* Diff buttons — avoid overflow with 3 buttons on small phones */
  .diff-btn { min-width: 0; flex: 1 1 0; }

  /* Section header */
  .section-title { font-size: 1.1rem; }
}

/* ═══════════════════════════════════════════════════════════════════════════════
   MODE DÉFI — CHALLENGE
   ═══════════════════════════════════════════════════════════════════════════════ */

/* ── Grille de modes ─────────────────────────────────────────────────────────── */
.challenge-mode-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.75rem;
}
.challenge-mode-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  padding: 1rem 0.5rem;
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.15s;
  user-select: none;
}
.challenge-mode-card:hover { border-color: var(--primary); transform: translateY(-2px); }
.challenge-mode-card.selected {
  border-color: var(--primary);
  background: color-mix(in srgb, var(--primary) 12%, var(--bg-card));
}
.challenge-mode-icon { font-size: 1.6rem; }
.challenge-mode-name { font-size: 0.7rem; font-weight: 600; text-align: center; color: var(--text-secondary); }
.challenge-mode-card.selected .challenge-mode-name { color: var(--primary); }
.challenge-mode-card.disabled { opacity: 0.35; cursor: not-allowed; pointer-events: none; transform: none; }

/* ── Recherche / liste de joueurs ───────────────────────────────────────────── */
.challenge-search-input {
  width: 100%;
  padding: 0.65rem 1rem;
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.9rem;
  margin-bottom: 0.75rem;
  outline: none;
  transition: border-color 0.15s;
  box-sizing: border-box;
}
.challenge-search-input:focus { border-color: var(--primary); }

.challenge-player-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: 280px;
  overflow-y: auto;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 0.5rem;
  background: var(--bg-card);
}
.challenge-player-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.75rem;
  border-radius: 10px;
  cursor: pointer;
  border: 1.5px solid transparent;
  transition: background 0.15s, border-color 0.15s, transform 0.12s;
  position: relative;
}
.challenge-player-row:hover {
  background: color-mix(in srgb, var(--accent) 12%, var(--bg-surface));
  border-color: color-mix(in srgb, var(--accent) 30%, transparent);
  transform: translateX(3px);
}
.challenge-player-row.selected {
  background: color-mix(in srgb, var(--accent) 20%, var(--bg-surface));
  border-color: var(--accent);
  transform: translateX(3px);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 30%, transparent),
              inset 3px 0 0 var(--accent);
}
.challenge-player-avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 2px solid transparent;
  transition: border-color 0.15s;
}
.challenge-player-row.selected .challenge-player-avatar {
  border-color: var(--accent);
}
.challenge-player-info { flex: 1; min-width: 0; }
.challenge-player-name { font-weight: 600; font-size: 0.9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.challenge-player-row.selected .challenge-player-name { color: var(--accent-light); }
.challenge-player-xp   { font-size: 0.78rem; color: var(--text-muted); }
.challenge-player-row.selected .challenge-player-xp { color: var(--text-secondary); }
.challenge-player-title { font-style: italic; }
.challenge-player-title.tier-1 { color: #4caf50; }
.challenge-player-title.tier-2 { color: #cd7f32; }
.challenge-player-title.tier-3 { color: #a8a9ad; }
.challenge-player-title.tier-4 { color: #ffd700; }
.challenge-player-title.tier-5 { background: linear-gradient(90deg,#ff6b6b,#ffd700,#6bff6b,#6bb5ff,#d96bff); -webkit-background-clip:text; background-clip:text; -webkit-text-fill-color:transparent; }
.challenge-player-check {
  width: 26px; height: 26px;
  background: var(--accent);
  border-radius: 50%;
  font-size: 0.85rem;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 0.75rem; font-weight: 700;
  flex-shrink: 0;
}
.challenge-loading, .challenge-empty {
  text-align: center;
  padding: 1.5rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* ── Config tags ─────────────────────────────────────────────────────────────── */
.challenge-config-tag {
  display: inline-block;
  padding: 0.3rem 0.65rem;
  background: var(--bg-surface);
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin: 0.2rem;
}

/* ── Modal défi entrant ──────────────────────────────────────────────────────── */
.ch-modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.65);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.2s ease;
}
.ch-modal {
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: 20px;
  padding: 2rem 1.75rem;
  max-width: 340px;
  width: 90%;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,0.4);
}
.ch-modal-icon  { font-size: 3rem; margin-bottom: 0.5rem; }
.ch-modal-title { font-size: 1.4rem; margin: 0 0 0.25rem; }
.ch-modal-from  { color: var(--text-secondary); margin: 0 0 1rem; }
.ch-modal-tags  { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.25rem; margin-bottom: 1rem; }
.ch-modal-countdown {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}
.ch-modal-countdown span { font-weight: 700; color: var(--warning, #f59e0b); }
.ch-modal-btns { display: flex; gap: 0.75rem; justify-content: center; }

/* ── Écran d'attente générique ───────────────────────────────────────────────── */
.challenge-waiting {
  display: flex; flex-direction: column; align-items: center;
  gap: 0.6rem; padding: 4rem 1.5rem; text-align: center;
}
.challenge-waiting-icon { font-size: 3.5rem; animation: pulse 1.5s infinite; }
.challenge-waiting h3   { font-size: 1.5rem; margin: 0; }
.challenge-waiting p    { color: var(--text-secondary); margin: 0; }
.challenge-waiting-sub  { color: var(--text-muted); font-size: 0.9rem; }
.ch-dots { display: flex; gap: 6px; margin-top: 0.5rem; }
.ch-dots span {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--primary); animation: dotBounce 1.2s infinite;
}
.ch-dots span:nth-child(2) { animation-delay: 0.2s; }
.ch-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes dotBounce {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40%           { transform: scale(1);   opacity: 1; }
}

/* ── Écran Prêt ? (face-à-face) ──────────────────────────────────────────────── */
.ch-ready-screen {
  display: flex; flex-direction: column; align-items: center;
  gap: 1.5rem; padding: 2.5rem 1.5rem; text-align: center;
}
.ch-ready-title { font-size: 1.8rem; font-weight: 700; }
.ch-ready-vs {
  display: flex; align-items: center; gap: 1.5rem;
  width: 100%; justify-content: center;
}
.ch-ready-player {
  display: flex; flex-direction: column; align-items: center;
  gap: 0.5rem; flex: 1; max-width: 160px;
  padding: 1.25rem 1rem;
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: 16px;
  transition: border-color 0.3s, background 0.3s;
}
.ch-ready-player.is-ready {
  border-color: #22c55e;
  background: color-mix(in srgb, #22c55e 10%, var(--bg-card));
}
.ch-ready-avatar {
  width: 80px; height: 80px; border-radius: 50%; object-fit: cover;
  border: 2px solid var(--border);
}
.ch-ready-rank  { display: flex; justify-content: center; }
.ch-ready-name  { font-weight: 700; font-size: 0.9rem; }
.ch-ready-title-text {
  font-size: 0.72rem; font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 100%;
}
.ch-ready-status { font-size: 0.82rem; color: var(--text-muted); }
.ch-ready-player.is-ready .ch-ready-status { color: #22c55e; }
.ch-ready-vs-badge {
  font-size: 1.4rem; font-weight: 900;
  color: var(--text-muted); flex-shrink: 0;
}
.beta-badge {
  display: inline-block;
  padding: 0.1rem 0.45rem;
  background: #f59e0b;
  color: #fff;
  border-radius: 4px;
  font-size: 0.6rem;
  font-weight: 700;
  vertical-align: middle;
  margin-left: 0.3rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.you-badge {
  display: inline-block;
  padding: 0.1rem 0.4rem;
  background: var(--primary);
  color: #fff;
  border-radius: 4px;
  font-size: 0.65rem;
  font-weight: 700;
  vertical-align: middle;
  margin-left: 0.25rem;
}
.ch-ready-config { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.25rem; }
.ch-ready-rule   { font-size: 0.8rem; color: var(--text-muted); }
.ch-ready-btn    { min-width: 200px; }
.ch-ready-waiting-msg { color: var(--text-muted); font-size: 0.9rem; animation: pulse 1.5s infinite; }

/* ── Décompte 3..2..1..GO! ──────────────────────────────────────────────────── */
.ch-countdown {
  display: flex; align-items: center; justify-content: center; min-height: 60vh;
}
.ch-countdown-number {
  font-size: 8rem; font-weight: 900; line-height: 1;
  color: var(--primary);
  animation: countdownPop 0.9s ease;
}
.ch-countdown-go { color: #22c55e; font-size: 5rem; }
@keyframes countdownPop {
  0%   { transform: scale(1.8); opacity: 0; }
  40%  { transform: scale(1);   opacity: 1; }
  100% { transform: scale(1);   opacity: 1; }
}

/* ── Barre de timer pendant le quiz ─────────────────────────────────────────── */
.ch-timer-bar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0.5rem 1rem;
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  margin-bottom: 0.75rem;
}
.ch-timer-elapsed {
  font-size: 1.4rem; font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--primary);
}
.ch-timer-penalties { font-size: 0.82rem; color: var(--warning, #f59e0b); font-weight: 600; min-height: 1.2em; }
.ch-skip-penalty { color: var(--warning, #f59e0b); font-size: 0.78rem; font-weight: 700; }

/* ── Récapitulatif ─────────────────────────────────────────────────────────── */
.ch-recap {
  max-width: 640px; margin: 0 auto; padding: 2rem 1.25rem;
  display: flex; flex-direction: column; gap: 1.5rem;
}
.ch-recap-winner {
  text-align: center; font-size: 2rem; font-weight: 900;
  padding: 1.25rem; border-radius: 16px;
}
.ch-recap-winner.win  { background: color-mix(in srgb, #f59e0b 15%, var(--bg-card)); color: #f59e0b; }
.ch-recap-winner.lose { background: color-mix(in srgb, #ef4444 12%, var(--bg-card)); color: #ef4444; }
.ch-recap-winner.draw { background: color-mix(in srgb, #6366f1 12%, var(--bg-card)); color: #6366f1; }

.ch-recap-scores {
  display: flex; align-items: center; gap: 1rem;
}
.ch-recap-score-card {
  flex: 1; text-align: center; padding: 1.25rem 0.75rem;
  background: var(--bg-card); border: 2px solid var(--border);
  border-radius: 16px; transition: border-color 0.2s;
}
.ch-recap-score-card.winner { border-color: #f59e0b; background: color-mix(in srgb, #f59e0b 8%, var(--bg-card)); }
.ch-recap-score-name   { font-weight: 700; font-size: 0.9rem; margin-bottom: 0.4rem; }
.ch-recap-score-time   { font-size: 2rem; font-weight: 900; font-variant-numeric: tabular-nums; color: var(--primary); }
.ch-recap-score-detail { font-size: 0.78rem; color: var(--text-muted); margin-top: 0.3rem; }
.ch-recap-vs { font-weight: 900; color: var(--text-muted); font-size: 1rem; flex-shrink: 0; }

.ch-recap-detail h4 { font-size: 1rem; margin: 0 0 0.75rem; }
.ch-recap-table { border: 1.5px solid var(--border); border-radius: 12px; overflow: hidden; }
.ch-recap-thead, .ch-recap-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
}
.ch-recap-thead {
  background: var(--bg-surface);
  padding: 0.5rem 0.75rem;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.ch-recap-thead > div { text-align: center; }
.ch-recap-row {
  border-top: 1px solid var(--border);
  padding: 0.5rem 0.75rem;
  font-size: 0.85rem;
  align-items: center;
}
.ch-recap-row:nth-child(even) { background: color-mix(in srgb, var(--bg-card) 50%, transparent); }
.ch-recap-country { display: flex; align-items: center; gap: 0.35rem; font-weight: 500; }
.ch-recap-cell    { text-align: center; font-size: 0.82rem; }
.cell-correct { color: #22c55e; }
.cell-wrong   { color: var(--text-muted); }

/* ── Responsive ────────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .challenge-mode-grid { grid-template-columns: repeat(3, 1fr); }
  .ch-ready-vs { gap: 0.75rem; }
  .ch-ready-player { padding: 0.9rem 0.5rem; }
  .ch-ready-avatar { width: 60px; height: 60px; }
  .ch-recap-scores { flex-direction: column; }
  .ch-recap-vs { display: none; }
}

/* ========== RESPONSIVE MOBILE GLOBAL (≤ 380px) ========== */
@media (max-width: 380px) {
  .quiz-setup-title { font-size: 1.2rem; }
  .quiz-score-wrap { flex-wrap: wrap; justify-content: center; }
  .results-score-big { font-size: 2rem; }
  .level-card { padding: 0.9rem 0.6rem; }
  .level-card-num { font-size: 1.6rem; }
  .profile-modal { padding: 1.5rem 1rem 1.25rem; }
  .btn { padding: 0.6rem 1.1rem; font-size: 0.85rem; }
  .btn-lg { padding: 0.75rem 1.4rem; font-size: 0.9rem; }
}

/* ══════════════════════════════════════════════════════════════════════════
   GROUP CHALLENGE
   ══════════════════════════════════════════════════════════════════════════ */

/* Badge "max N" dans le label de section */
.gc-max-badge {
  display: inline-block;
  background: var(--primary);
  color: #fff;
  font-size: 0.62rem;
  font-weight: 700;
  padding: 0.12rem 0.5rem;
  border-radius: 1rem;
  vertical-align: middle;
  margin-left: 0.5rem;
  letter-spacing: 0.02em;
}

/* Checkbox dans la liste multi-select */
.gc-player-checkbox {
  width: 28px; height: 28px;
  border-radius: 50%;
  border: 2px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.8rem; font-weight: 700;
  color: transparent;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  flex-shrink: 0;
}
.gc-player-checkbox.checked {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

/* ── Invite list (créateur en attente) ──────────────────────────────────── */
.gc-invite-list {
  display: flex; flex-direction: column; gap: 0.6rem;
  margin-top: 1.5rem; width: 100%; max-width: 360px;
}
.gc-invite-row {
  display: flex; align-items: center; gap: 0.75rem;
  background: var(--card-bg); border-radius: 0.75rem;
  padding: 0.75rem 1rem; border: 1px solid var(--border);
}
.gc-invite-status-dot {
  width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0;
}
.gc-dot-pending  { background: var(--text-muted); }
.gc-dot-accepted { background: #22c55e; }
.gc-dot-declined { background: #ef4444; }
.gc-invite-name        { flex: 1; font-weight: 600; font-size: 0.9rem; }
.gc-invite-status-text { font-size: 0.78rem; color: var(--text-secondary); white-space: nowrap; }

/* ── Ready screen (lobby) ───────────────────────────────────────────────── */
.gc-ready-list {
  display: flex; flex-direction: column; gap: 0.6rem;
  margin: 1.75rem 0; width: 100%; max-width: 360px;
}
.gc-ready-player {
  display: flex; align-items: center; gap: 0.75rem;
  background: var(--card-bg); border: 1px solid var(--border);
  border-radius: 0.75rem; padding: 0.75rem 1rem;
  transition: background 0.25s, border-color 0.25s;
}
.gc-ready-player.is-ready {
  background: rgba(34, 197, 94, 0.08);
  border-color: rgba(34, 197, 94, 0.35);
}
.gc-ready-dot {
  width: 11px; height: 11px; border-radius: 50%;
  background: var(--text-muted); flex-shrink: 0; transition: background 0.3s;
}
.gc-ready-dot.ready { background: #22c55e; }
.gc-ready-name  { flex: 1; font-weight: 600; font-size: 0.9rem; }
.gc-ready-label { font-size: 0.78rem; color: var(--text-secondary); }
.gc-ready-config {
  display: flex; flex-wrap: wrap; gap: 0.4rem;
  justify-content: center; margin-bottom: 0.5rem;
}

/* ── Waiting screen – others list ─────────────────────────────────────── */
.gc-wait-others { display: flex; flex-direction: column; gap: 0.5rem; width: 100%; }
.gc-wait-row {
  display: flex; align-items: center; gap: 0.65rem;
  font-size: 0.88rem; padding: 0.4rem 0;
}

/* ── Résultats groupe ───────────────────────────────────────────────────── */
.gc-results {
  max-width: 680px; margin: 0 auto;
  padding: 2rem 1rem 4rem;
  display: flex; flex-direction: column; align-items: center; gap: 0;
}
.gc-results-btns {
  display: flex; gap: 1rem; justify-content: center;
  margin-top: 2.5rem; flex-wrap: wrap;
}

/* ── Podium ─────────────────────────────────────────────────────────────── */
.gc-podium {
  display: flex; align-items: flex-end; justify-content: center;
  gap: 0; margin: 1.5rem 0 2rem; width: 100%; max-width: 420px;
}
.gc-podium-player {
  display: flex; flex-direction: column; align-items: center;
  flex: 1;
}
.gc-podium-avatar-wrap {
  position: relative; margin-bottom: 0.5rem;
}
.gc-podium-avatar {
  border-radius: 50%; object-fit: cover;
  border: 3px solid var(--border);
  display: block;
}
.gc-podium-medal {
  position: absolute; bottom: -4px; right: -4px;
  font-size: 1.1rem; line-height: 1;
}
.gc-podium-name {
  font-weight: 700; font-size: 0.78rem;
  text-align: center; max-width: 90px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  margin-bottom: 0.15rem;
}
.gc-podium-time {
  font-size: 0.85rem; font-weight: 800;
  color: var(--primary); font-variant-numeric: tabular-nums;
  margin-bottom: 0.4rem;
}
.gc-podium-step {
  width: 100%; border-radius: 8px 8px 0 0;
  display: flex; align-items: center; justify-content: center;
  padding-top: 0.5rem;
}
.gc-podium-step-num {
  font-size: 1.4rem; font-weight: 900; opacity: 0.6;
}

/* Positions */
.gc-podium-pos-1 .gc-podium-avatar { width: 72px; height: 72px; border-color: #f59e0b; box-shadow: 0 0 0 3px rgba(245,158,11,0.3), 0 4px 20px rgba(245,158,11,0.25); }
.gc-podium-pos-2 .gc-podium-avatar { width: 58px; height: 58px; border-color: #94a3b8; }
.gc-podium-pos-3 .gc-podium-avatar { width: 52px; height: 52px; border-color: #b45309; }

.gc-podium-pos-1 .gc-podium-step { height: 90px; background: linear-gradient(180deg, rgba(245,158,11,0.22) 0%, rgba(245,158,11,0.08) 100%); border: 1px solid rgba(245,158,11,0.4); border-bottom: none; }
.gc-podium-pos-2 .gc-podium-step { height: 65px; background: linear-gradient(180deg, rgba(148,163,184,0.18) 0%, rgba(148,163,184,0.06) 100%); border: 1px solid rgba(148,163,184,0.3); border-bottom: none; }
.gc-podium-pos-3 .gc-podium-step { height: 45px; background: linear-gradient(180deg, rgba(180,87,9,0.16) 0%, rgba(180,87,9,0.05) 100%); border: 1px solid rgba(180,87,9,0.3); border-bottom: none; }

.gc-podium-pos-1 .gc-podium-step-num { color: #f59e0b; }
.gc-podium-pos-2 .gc-podium-step-num { color: #94a3b8; }
.gc-podium-pos-3 .gc-podium-step-num { color: #b45309; }

.gc-podium-me .gc-podium-name { color: var(--primary); }

/* ── Liste 4e+ ──────────────────────────────────────────────────────────── */
.gc-ranking-list {
  display: flex; flex-direction: column; gap: 0.7rem;
  width: 100%; max-width: 500px; margin: 1.5rem 0;
}
.gc-rank-row {
  display: flex; align-items: center; gap: 0.9rem;
  background: var(--card-bg); border: 1px solid var(--border);
  border-radius: 1rem; padding: 0.875rem 1.25rem;
  transition: box-shadow 0.2s;
}
.gc-rank-row.gc-rank-me {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(99,102,241,0.18);
}
.gc-rank-pos    { font-size: 1rem; font-weight: 700; min-width: 2.2rem; text-align: center; flex-shrink: 0; color: var(--text-muted); }
.gc-rank-avatar { width: 38px; height: 38px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.gc-rank-info   { flex: 1; min-width: 0; }
.gc-rank-name   { font-weight: 700; font-size: 0.9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gc-rank-detail { font-size: 0.74rem; color: var(--text-secondary); margin-top: 0.1rem; }
.gc-rank-time   { font-size: 1rem; font-weight: 700; color: var(--primary); white-space: nowrap; flex-shrink: 0; }

/* ── Tableau de détail ──────────────────────────────────────────────────── */
.gc-detail-section {
  width: 100%; margin-top: 1rem;
}
.gc-detail-title {
  font-size: 1rem; font-weight: 700; margin: 0 0 0.75rem;
}
.gc-detail-scroll {
  overflow-x: auto; border-radius: 12px;
  border: 1.5px solid var(--border);
}
.gc-detail-table {
  min-width: 100%;
  display: grid;
  grid-template-columns: 1.6fr repeat(var(--gc-cols), 1fr);
}
.gc-detail-head,
.gc-detail-row {
  display: contents;
}
.gc-detail-head > div {
  background: var(--bg-surface);
  padding: 0.5rem 0.6rem;
  font-size: 0.72rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.04em; color: var(--text-muted);
  border-bottom: 1.5px solid var(--border);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  display: flex; align-items: center;
}
.gc-detail-player-head {
  justify-content: center;
}
.gc-detail-player-head.gc-detail-me {
  color: var(--primary);
}
.gc-detail-country-cell {
  display: flex; align-items: center; gap: 0.35rem;
  font-weight: 500; font-size: 0.82rem;
  padding: 0.5rem 0.6rem;
  border-top: 1px solid var(--border);
}
.gc-detail-cell {
  text-align: center; font-size: 0.82rem; line-height: 1.3;
  padding: 0.45rem 0.4rem;
  border-top: 1px solid var(--border);
  border-left: 1px solid var(--border);
}
.gc-detail-row:nth-child(even) .gc-detail-country-cell,
.gc-detail-row:nth-child(even) .gc-detail-cell {
  background: color-mix(in srgb, var(--bg-card) 50%, transparent);
}
.gc-detail-time { font-size: 0.7rem; color: var(--text-muted); }
.gc-cell-ok { color: #22c55e; }
.gc-cell-no { color: var(--text-muted); }

@media (max-width: 480px) {
  .gc-podium    { max-width: 320px; }
  .gc-rank-row  { padding: 0.7rem 0.9rem; gap: 0.6rem; }
  .gc-rank-avatar { width: 32px; height: 32px; }
  .gc-rank-time { font-size: 0.88rem; }
  .gc-podium-pos-1 .gc-podium-avatar { width: 60px; height: 60px; }
  .gc-podium-pos-2 .gc-podium-avatar { width: 48px; height: 48px; }
  .gc-podium-pos-3 .gc-podium-avatar { width: 42px; height: 42px; }
}

/* ========== QUIZ CULTURE ========== */

/* Amber/gold palette — totally distinct from all other quizzes */
:root {
  --cult-accent:       #d97706;
  --cult-accent-light: #fbbf24;
  --cult-glow:         rgba(217, 119, 6, 0.30);
  --cult-glow-sm:      rgba(217, 119, 6, 0.18);
  --cult-card:         #1c1508;
  --cult-card-border:  rgba(251, 191, 36, 0.22);
  --cult-text-warm:    #fef3c7;
}

/* Page wrapper */
.culture-page {
  background: radial-gradient(ellipse at 50% -10%, rgba(217,119,6,0.12) 0%, transparent 60%);
}

/* ── Hero / Setup header ── */
.culture-hero {
  text-align: center;
  padding: 2.5rem 1rem 1.5rem;
}
.culture-hero-orb {
  font-size: 4rem;
  display: inline-block;
  animation: cultureFloat 4s ease-in-out infinite;
  filter: drop-shadow(0 0 18px var(--cult-glow));
  margin-bottom: 0.5rem;
}
@keyframes cultureFloat {
  0%, 100% { transform: translateY(0) rotate(-2deg); }
  50%       { transform: translateY(-10px) rotate(2deg); }
}

.culture-title {
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--cult-accent-light) 0%, var(--cult-accent) 60%, #b45309 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 0.5rem;
}

.culture-subtitle {
  color: var(--text-secondary);
  font-size: 0.95rem;
  max-width: 500px;
  margin: 0 auto;
}

/* ── Setup form ── */
.culture-setup {
  max-width: 640px;
  margin: 0 auto;
  padding: 0 0 3rem;
}

.culture-section-label {
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--cult-accent);
  margin-bottom: 0.75rem;
}

/* Count buttons — reuse count-btn but with amber selected state */
.culture-count-btn {
  padding: 0.5rem 1.25rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  font-family: var(--font);
}
.culture-count-btn:hover { border-color: var(--cult-card-border); color: var(--cult-accent-light); }
.culture-count-btn.selected { background: var(--cult-accent); border-color: var(--cult-accent); color: #1c1508; }

/* Mode selector */
.culture-mode-selector {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.875rem;
}
.culture-mode-card {
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1rem;
  cursor: pointer;
  transition: all var(--transition);
  text-align: center;
}
.culture-mode-card:hover { border-color: var(--cult-card-border); transform: translateY(-2px); }
.culture-mode-card.selected {
  border-color: var(--cult-accent);
  background: rgba(217, 119, 6, 0.10);
  box-shadow: 0 0 20px var(--cult-glow-sm);
}
.culture-mode-icon { font-size: 1.75rem; margin-bottom: 0.4rem; }
.culture-mode-name { font-size: 0.9rem; font-weight: 700; margin-bottom: 0.25rem; }
.culture-mode-desc { font-size: 0.75rem; color: var(--text-muted); }

/* Start / action button */
.culture-start-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  width: 100%;
  padding: 1rem 2rem;
  background: linear-gradient(135deg, var(--cult-accent) 0%, #b45309 100%);
  border: none;
  border-radius: var(--radius-lg);
  color: #fff8e7;
  font-family: var(--font);
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: 0.02em;
  transition: all var(--transition);
  box-shadow: 0 4px 20px var(--cult-glow);
}
.culture-start-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 28px var(--cult-glow);
  filter: brightness(1.08);
}
.culture-start-btn:active { transform: translateY(0); }

/* ── Quiz in-game ── */
.culture-quiz-wrap {
  max-width: 680px;
  margin: 0 auto;
}

.culture-quiz-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  gap: 1rem;
}

/* Amber progress bar */
.culture-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--cult-accent), var(--cult-accent-light));
  border-radius: var(--radius-full);
  transition: width 0.45s ease;
}

.culture-score-badge {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.85rem;
  background: rgba(217, 119, 6, 0.12);
  border: 1px solid var(--cult-card-border);
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--cult-accent-light);
}

/* ── Fact card ── */
.culture-fact-card {
  position: relative;
  background: linear-gradient(160deg, #1f1507 0%, #130f04 100%);
  border: 1.5px solid var(--cult-card-border);
  border-radius: var(--radius-xl);
  padding: 2.5rem 2rem 2rem;
  text-align: center;
  margin-bottom: 1.25rem;
  overflow: hidden;
  box-shadow: 0 4px 30px rgba(0,0,0,0.4), inset 0 1px 0 rgba(251,191,36,0.12);
}
/* Decorative amber glow in top corner */
.culture-fact-card::before {
  content: '';
  position: absolute;
  top: -40px;
  right: -40px;
  width: 160px;
  height: 160px;
  background: radial-gradient(circle, rgba(217,119,6,0.18) 0%, transparent 70%);
  pointer-events: none;
}
/* Bottom line accent */
.culture-fact-card::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 10%;
  right: 10%;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--cult-accent), transparent);
  border-radius: var(--radius-full);
}

.culture-fact-deco {
  font-size: 2rem;
  margin-bottom: 1rem;
  display: block;
  filter: drop-shadow(0 0 8px var(--cult-glow));
}

.culture-fact-text {
  font-size: clamp(1.05rem, 2.5vw, 1.25rem);
  font-weight: 600;
  color: var(--cult-text-warm);
  line-height: 1.65;
  font-style: italic;
  margin: 0 0 1.5rem;
  position: relative;
}
/* Opening quote */
.culture-fact-text::before {
  content: '"';
  font-size: 3rem;
  color: var(--cult-accent);
  opacity: 0.4;
  line-height: 0;
  vertical-align: -0.4em;
  margin-right: 0.1em;
  font-style: normal;
}
/* Closing quote */
.culture-fact-text::after {
  content: '"';
  font-size: 3rem;
  color: var(--cult-accent);
  opacity: 0.4;
  line-height: 0;
  vertical-align: -0.4em;
  margin-left: 0.1em;
  font-style: normal;
}

.culture-fact-question {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--cult-accent);
  opacity: 0.85;
}

/* Flag reveal after answer */
.culture-flag-reveal {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid rgba(251,191,36,0.15);
  animation: cultureReveal 0.4s ease;
}
@keyframes cultureReveal {
  from { opacity: 0; transform: scale(0.85); }
  to   { opacity: 1; transform: scale(1); }
}
.culture-reveal-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--cult-text-warm);
}

/* ── Multiple choice options ── */
.culture-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}
.culture-option {
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 0.875rem 1rem;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: var(--font);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-height: 58px;
}
.culture-option:hover:not(:disabled) {
  border-color: var(--cult-accent);
  background: rgba(217, 119, 6, 0.08);
  transform: translateY(-1px);
}
.culture-option:disabled { cursor: default; }
.culture-option.correct {
  border-color: var(--success) !important;
  background: var(--success-bg) !important;
  color: var(--success) !important;
  animation: correctPulse 0.4s ease;
}
.culture-option.wrong {
  border-color: var(--error) !important;
  background: var(--error-bg) !important;
  color: var(--error) !important;
  animation: wrongShake 0.4s ease;
}
.culture-option-key {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  font-size: 0.72rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--cult-accent);
}
.culture-option-label { flex: 1; text-align: left; }
.culture-option-flag {
  display: inline-block !important;
  height: 20px !important;
  aspect-ratio: 3/2 !important;
  background-size: contain !important;
  background-position: center !important;
  background-repeat: no-repeat !important;
  border-radius: 2px;
  flex-shrink: 0;
  opacity: 0.6;
  transition: opacity 0.15s;
}
.culture-option:hover .culture-option-flag,
.culture-option.correct .culture-option-flag,
.culture-option.wrong .culture-option-flag { opacity: 1; }

/* ── Results ── */
.culture-results {
  max-width: 640px;
  margin: 0 auto;
  text-align: center;
  padding-bottom: 3rem;
}
.culture-results-stars { font-size: 2rem; margin-bottom: 0.75rem; }
.culture-results-title {
  font-size: 2rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--cult-accent-light), var(--cult-accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 0.25rem;
}
.culture-results-sub { color: var(--text-muted); font-size: 0.85rem; margin-bottom: 1rem; }
.culture-score-big {
  font-size: clamp(3rem, 8vw, 4.5rem);
  font-weight: 900;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, var(--cult-accent-light) 0%, var(--cult-accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 1.5rem;
  line-height: 1;
}

.culture-wrong-answers {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  margin: 1.5rem 0;
  text-align: left;
}
.culture-wrong-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--error);
  margin-bottom: 0.75rem;
}
.culture-wrong-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.culture-wrong-item:last-child { border-bottom: none; }
.culture-wrong-country {
  font-size: 0.875rem;
  font-weight: 700;
  min-width: 100px;
  color: var(--cult-accent-light);
  flex-shrink: 0;
}
.culture-wrong-fact {
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-style: italic;
  flex: 1;
}
.culture-wrong-input {
  font-size: 0.78rem;
  color: var(--error);
  text-decoration: line-through;
  flex-shrink: 0;
}

.culture-perfect {
  padding: 1.5rem;
  background: rgba(217, 119, 6, 0.1);
  border: 1px solid rgba(217, 119, 6, 0.3);
  border-radius: var(--radius-lg);
  color: var(--cult-accent-light);
  font-weight: 600;
  margin: 1.5rem 0;
}

/* Home page quiz-pick card for Culture */
.quiz-pick-culture {
  background: linear-gradient(135deg, rgba(217,119,6,0.08) 0%, rgba(180,83,9,0.06) 100%);
  border-color: rgba(217,119,6,0.3);
}
.quiz-pick-culture:hover {
  border-color: var(--cult-accent) !important;
  box-shadow: 0 8px 32px rgba(217,119,6,0.2) !important;
}

/* ── Responsive ── */
@media (max-width: 480px) {
  .culture-mode-selector { grid-template-columns: 1fr; }
  .culture-options { grid-template-columns: 1fr; }
  .culture-fact-card { padding: 2rem 1.25rem 1.5rem; }
  .culture-fact-text { font-size: 1rem; }
}
