/* ══════════════════════════════════════════════════════
   challenges.css — Les Quêtes
   Palette : parchemin chaud + vert forêt + brun sépia
   ══════════════════════════════════════════════════════ */

:root {
  --chal-radius: 14px;
  --chal-official:     #c0392b;
  --chal-community:    #2980b9;
  --chal-open:         #27ae60;
  --chal-voting:       #e67e22;
  --chal-closed:       #7f8c8d;
  --chal-contest:      #8e44ad;
  --chal-participative:#16a085;
}

/* ── Hero "cap de départ" ─────────────────────────────── */
.chal-hero {
  position: relative;
  overflow: hidden;
  background: radial-gradient(ellipse at 60% 40%, rgba(139,100,60,.09) 0%, transparent 70%),
              var(--accent-light);
  border-bottom: 1px solid var(--border);
  padding: 56px 24px 48px;
  text-align: center;
}

/* Motif de méridiens façon carte ancienne */
.chal-hero::before {
  content: '';
  position: absolute; inset: 0;
  background-image:
    repeating-linear-gradient(0deg,   transparent, transparent 39px, rgba(92,74,58,.05) 39px, rgba(92,74,58,.05) 40px),
    repeating-linear-gradient(90deg,  transparent, transparent 39px, rgba(92,74,58,.05) 39px, rgba(92,74,58,.05) 40px);
  pointer-events: none;
}

/* Symbole décoratif en fond */
.chal-hero::after {
  content: '✦';
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  font-size: 16rem; line-height: 1;
  color: rgba(92,74,58,.04);
  pointer-events: none;
  font-family: serif;
}

.chal-hero-inner {
  position: relative;
  max-width: 720px;
  margin: 0 auto;
}

.chal-hero-eyebrow {
  font-family: var(--font-ui);
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--accent-mid);
  margin-bottom: 12px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.chal-hero-eyebrow::before,
.chal-hero-eyebrow::after {
  content: '';
  display: block;
  width: 20px; height: 1px;
  background: var(--accent-mid);
}

.chal-hero-title {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  font-weight: 700;
  color: var(--accent);
  margin: 0 0 10px;
  line-height: 1.15;
  letter-spacing: -.02em;
}
.chal-hero-title em {
  font-style: italic;
  color: var(--green);
}

.chal-hero-sub {
  font-family: var(--font-body);
  font-style: italic;
  color: var(--text-muted);
  font-size: .95rem;
  margin: 0 0 22px;
  line-height: 1.6;
}
.chal-hero-sub em { font-style: normal; font-weight: 600; color: var(--text-mid); }

.chal-hero-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* Badges hero centrer */
.chal-hero-badges {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

/* ── Container ────────────────────────────────────────── */
.chal-container {
  max-width: 980px;
  margin: 36px auto;
  padding: 0 20px;
}
.chal-container--wide {
  max-width: 1120px;
  margin: 36px auto;
  padding: 0 20px;
}

/* ── Filtres / tabs ───────────────────────────────────── */
.chal-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 24px;
  border-bottom: 2px solid var(--border);
  padding-bottom: 0;
}
.chal-tab {
  padding: 8px 18px;
  border-radius: 8px 8px 0 0;
  font-family: var(--font-ui);
  font-size: .85rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  color: var(--text-muted);
  border: 1.5px solid transparent;
  border-bottom: none;
  transition: color .15s, background .15s;
}
.chal-tab:hover { color: var(--accent); background: var(--accent-light); }
.chal-tab.active {
  color: var(--accent);
  background: var(--surface);
  border-color: var(--border);
  border-bottom: 2px solid var(--surface);
  margin-bottom: -2px;
}
.chal-tab-count {
  display: inline-block;
  background: var(--accent-light);
  color: var(--accent);
  font-size: .7rem;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 999px;
  margin-left: 4px;
}

/* ── Carte défi (liste) ───────────────────────────────── */
.chal-card {
  display: block;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-left: 4px solid var(--border);
  border-radius: var(--chal-radius);
  padding: 22px 26px;
  margin-bottom: 14px;
  text-decoration: none;
  color: inherit;
  transition: border-color .2s, box-shadow .2s, transform .15s;
  position: relative;
  overflow: hidden;
}
.chal-card::before {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(135deg, var(--accent-light) 0%, transparent 50%);
  opacity: 0;
  transition: opacity .2s;
  pointer-events: none;
}
.chal-card:hover {
  border-color: var(--accent);
  border-left-color: var(--accent);
  box-shadow: 0 4px 20px rgba(139,100,60,.1);
  transform: translateY(-2px);
}
.chal-card:hover::before { opacity: 1; }

/* Couleur de la bordure gauche selon statut */
.chal-card[data-status="open"]   { border-left-color: var(--chal-open); }
.chal-card[data-status="voting"] { border-left-color: var(--chal-voting); }
.chal-card[data-status="closed"] { border-left-color: var(--chal-closed); }

.chal-card-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
  flex-wrap: wrap;
  position: relative;
  padding-right: 90px;
}
.chal-card-title {
  font-family: var(--font-display);
  font-size: 1.2rem;
  color: var(--text);
  margin: 0 0 6px;
  letter-spacing: -.01em;
  line-height: 1.25;
}
.chal-card-excerpt {
  font-family: var(--font-body);
  font-style: italic;
  color: var(--text-mid);
  font-size: .88rem;
  line-height: 1.6;
  margin-bottom: 14px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.chal-card-meta {
  display: flex;
  gap: 16px;
  font-family: var(--font-ui);
  font-size: .78rem;
  color: var(--text-muted);
  flex-wrap: wrap;
  align-items: center;
}
.chal-card-meta strong { color: var(--text-mid); }
.chal-card-joined {
  position: absolute;
  top: 16px;
  right: 18px;
  font-size: .72rem;
  font-weight: 700;
  font-family: var(--font-ui);
  color: var(--chal-open);
  background: rgba(39,174,96,.1);
  padding: 2px 10px;
  border-radius: 999px;
  border: 1px solid rgba(39,174,96,.2);
}
.chal-card-new {
  background: var(--danger, #c0392b);
  color: #fff;
  border: 1px solid rgba(192, 57, 43, .4);
  font-weight: 700;
  animation: nb-dot-pulse 2.4s ease-in-out infinite;
}

/* ── Badges ───────────────────────────────────────────── */
.chal-badge {
  display: inline-block;
  font-family: var(--font-ui);
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  padding: 3px 10px;
  border-radius: 999px;
  white-space: nowrap;
}
.chal-badge--official     { background: rgba(192,57,43,.12);  color: var(--chal-official); }
.chal-badge--community    { background: rgba(41,128,185,.12); color: var(--chal-community); }
.chal-badge--open         { background: rgba(39,174,96,.12);  color: var(--chal-open); }
.chal-badge--voting       { background: rgba(230,126,34,.12); color: var(--chal-voting); }
.chal-badge--closed       { background: rgba(127,140,141,.12);color: var(--chal-closed); }
.chal-badge--contest        { background: rgba(142,68,173,.12); color: var(--chal-contest); }
.chal-badge--participative  { background: rgba(22,160,133,.12); color: var(--chal-participative); }
.chal-badge--deadline-passed{ background: rgba(231,76,60,.12);  color: #e74c3c; border: 1px solid rgba(231,76,60,.25); }

/* ── Pill "inscriptions fermées" dans le hero ─────────── */
.chal-hero-closed-pill {
  display: inline-flex; align-items: center;
  padding: 8px 18px; border-radius: 999px;
  font-family: var(--font-ui); font-size: .82rem; font-weight: 700;
  background: rgba(127,140,141,.12);
  border: 1.5px solid rgba(127,140,141,.3);
  color: var(--text-muted);
  letter-spacing: .02em;
}

/* ── Page détail ──────────────────────────────────────── */
.chal-detail-grid {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 28px;
  align-items: start;
}
@media (max-width: 860px) {
  .chal-detail-grid { grid-template-columns: 1fr; }
}

/* ── Sections ─────────────────────────────────────────── */
.chal-section {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--chal-radius);
  margin-bottom: 20px;
  overflow: hidden;
  box-shadow: var(--shadow-xs);
}

.chal-section-title {
  font-family: var(--font-display);
  font-size: .88rem;
  font-weight: 700;
  font-style: italic;
  color: var(--accent);
  padding: 14px 20px 12px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, var(--accent-light) 0%, var(--surface) 100%);
  margin: 0;
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}
.chal-section-title::before {
  content: '◆';
  font-size: .45rem;
  color: var(--accent-mid);
  flex-shrink: 0;
  position: relative;
  top: -1px;
  font-style: normal;
}

/* Sous-titre de section */
.chal-section-sub {
  font-family: var(--font-body);
  font-style: italic;
  font-size: .72rem;
  color: var(--text-faint);
  font-weight: 400;
}

.chal-section-body { padding: 18px 20px; }

/* ── Contraintes ─────────────────────────────────────── */
.chal-constraints { list-style: none; padding: 0; margin: 0; }
.chal-constraint-item {
  display: flex;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  align-items: flex-start;
  transition: background .12s;
}
.chal-constraint-item:last-child { border-bottom: none; }
.chal-constraint-item:hover { background: var(--bg); margin: 0 -4px; padding: 12px 4px; border-radius: 6px; }
.chal-constraint-icon {
  font-size: 1.1rem;
  flex-shrink: 0;
  margin-top: 1px;
}
.chal-constraint-label {
  font-family: var(--font-ui);
  font-size: .75rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: 3px;
}
.chal-constraint-value {
  font-family: var(--font-body);
  font-size: .9rem;
  color: var(--text);
  word-break: break-word;
  line-height: 1.5;
}

/* Indicateur d'avancement contrainte dans l'éditeur */
.chal-constraint-progress { display: flex; align-items: center; gap: 8px; margin-top: 5px; }
.chal-constraint-bar { flex: 1; height: 4px; background: var(--border); border-radius: 2px; overflow: hidden; }
.chal-constraint-bar-fill { height: 100%; background: var(--accent); border-radius: 2px; transition: width .3s; }
.chal-constraint-bar-fill.done { background: var(--chal-open); }
.chal-constraint-check { font-size: .85rem; color: var(--text-muted); }
.chal-constraint-check.done { color: var(--chal-open); }

/* ── Participants ─────────────────────────────────────── */
.chal-participant-list { list-style: none; padding: 0; margin: 0; }
.chal-participant-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: .9rem;
  transition: background .12s;
}
.chal-participant-item:last-child { border-bottom: none; }
.chal-participant-item:hover { background: var(--bg); margin: 0 -4px; padding: 10px 4px; border-radius: 6px; }
.chal-participant-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--accent-light);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .75rem;
  color: var(--accent); flex-shrink: 0; overflow: hidden;
  border: 2px solid var(--border);
}
.chal-participant-avatar img { width: 100%; height: 100%; object-fit: cover; }
.chal-participant-name { font-weight: 600; color: var(--text); font-family: var(--font-display); font-style: italic; }
.chal-participant-sub  { font-family: var(--font-ui); font-size: .75rem; color: var(--text-muted); }
.chal-participant-voted { color: var(--chal-open); font-size: .72rem; font-weight: 700; white-space: nowrap; }

/* ── Carte soumission ─────────────────────────────────── */
.chal-submission-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-left: 4px solid var(--border);
  border-radius: 10px;
  padding: 18px 20px;
  margin-bottom: 12px;
  transition: border-color .15s, box-shadow .15s;
  position: relative;
  overflow: hidden;
}
.chal-submission-card::before {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(135deg, var(--accent-light) 0%, transparent 40%);
  opacity: 0; transition: opacity .2s; pointer-events: none;
}
.chal-submission-card:hover::before { opacity: .5; }
.chal-submission-card.voted-card {
  border-color: var(--accent);
  border-left-color: var(--accent);
}
.chal-submission-card--highlight {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(92,74,58,.18);
  animation: chal-card-pulse 2.5s ease-out forwards;
}
@keyframes chal-card-pulse {
  0%   { box-shadow: 0 0 0 3px rgba(92,74,58,.28); }
  100% { box-shadow: none; border-color: var(--border); }
}
.chal-submission-title {
  font-family: var(--font-display);
  font-size: 1.05rem;
  color: var(--text);
  margin: 0 0 4px;
  position: relative;
}
.chal-submission-meta {
  font-family: var(--font-ui);
  font-size: .78rem;
  color: var(--text-muted);
  margin-bottom: 12px;
}
.chal-submission-hidden {
  font-family: var(--font-body);
  color: var(--text-muted);
  font-style: italic;
  font-size: .88rem;
}
.chal-sub-owner-only {
  display: inline-block;
  font-family: var(--font-ui);
  font-size: .68rem;
  font-weight: 600;
  color: var(--chal-voting);
  background: rgba(230,126,34,.1);
  border: 1px solid rgba(230,126,34,.3);
  border-radius: 4px;
  padding: 1px 7px;
  margin-left: 8px;
  vertical-align: middle;
}
.chal-not-submitted-notice {
  font-family: var(--font-ui);
  font-size: .78rem;
  background: rgba(230,126,34,.1);
  border: 1px solid rgba(230,126,34,.35);
  border-radius: 6px;
  color: var(--chal-voting);
  padding: 7px 12px;
  margin-bottom: 10px;
}
.chal-not-submitted-notice a {
  color: var(--chal-voting);
  font-weight: 700;
  text-decoration: underline;
}
.chal-vote-btns { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; align-items: center; }
.chal-vote-btn {
  padding: 6px 16px;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: transparent;
  font-size: .82rem;
  font-family: var(--font-ui);
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
  color: var(--text-mid);
}
.chal-vote-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-light); }
.chal-vote-btn.active-vote    { background: rgba(142,68,173,.12); border-color: var(--chal-contest); color: var(--chal-contest); }
.chal-vote-btn.active-success { background: rgba(39,174,96,.12);  border-color: var(--chal-open);   color: var(--chal-open); }
.chal-vote-btn.active-failure { background: rgba(231,76,60,.1);   border-color: #e74c3c;            color: #e74c3c; }
.chal-vote-note {
  font-family: var(--font-body);
  font-size: .72rem; color: var(--text-muted);
  font-style: italic; margin-top: 4px;
}

/* ── Résultats ────────────────────────────────────────── */
.chal-podium {
  display: flex;
  gap: 16px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}
.chal-podium-item {
  flex: 1; min-width: 160px;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--chal-radius);
  padding: 20px 16px;
  text-align: center;
  position: relative;
  transition: box-shadow .2s;
}
.chal-podium-item.rank-1 {
  border-color: #f1c40f;
  box-shadow: 0 4px 20px rgba(241,196,15,.2);
  order: -1;
}
.chal-podium-item.rank-2 { border-color: #bdc3c7; }
.chal-podium-item.rank-3 { border-color: #e67e22; }

/* Texture parchemin subtile sur le podium rank-1 */
.chal-podium-item.rank-1::before {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(241,196,15,.06) 0%, transparent 60%);
  border-radius: inherit;
  pointer-events: none;
}
.chal-podium-rank { font-size: 1.8rem; margin-bottom: 6px; display: block; }
.chal-podium-author { font-family: var(--font-display); font-weight: 700; font-style: italic; font-size: .9rem; color: var(--text); }
.chal-podium-work { font-family: var(--font-body); font-size: .8rem; color: var(--text-muted); margin: 4px 0 8px; font-style: italic; }
.chal-podium-pct { font-family: var(--font-ui); font-size: .82rem; font-weight: 600; color: var(--accent); }

.chal-result-row {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  transition: background .1s;
}
.chal-result-row:last-child { border-bottom: none; }
.chal-result-row:hover { background: var(--bg); margin: 0 -4px; padding: 12px 4px; border-radius: 6px; }

/* ── Sidebar infos ────────────────────────────────────── */
.chal-info-list { list-style: none; padding: 0; margin: 0; }
.chal-info-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
  font-size: .88rem;
}
.chal-info-item:last-child { border-bottom: none; }
.chal-info-label { font-family: var(--font-ui); font-size: .75rem; color: var(--text-muted); white-space: nowrap; }
.chal-info-value { font-family: var(--font-display); font-style: italic; font-weight: 600; color: var(--text); text-align: right; }

/* ── Barre de progression votes ───────────────────────── */
.chal-vote-progress {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--chal-radius);
  padding: 16px 20px;
  margin-bottom: 20px;
  position: relative; overflow: hidden;
}
.chal-vote-progress::before {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(135deg, var(--accent-light) 0%, transparent 60%);
  opacity: .4; pointer-events: none;
}
.chal-vote-progress-label {
  font-family: var(--font-display);
  font-style: italic;
  font-size: .85rem;
  font-weight: 700;
  color: var(--text-mid);
  margin-bottom: 10px;
  position: relative;
}
.chal-vote-progress-bar {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 6px;
  position: relative;
}
.chal-vote-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--green));
  border-radius: 3px;
  transition: width .5s ease;
}
.chal-vote-progress-fill.complete { background: var(--chal-open); }
.chal-vote-progress-sub {
  font-family: var(--font-body);
  font-style: italic;
  font-size: .75rem;
  color: var(--text-muted);
  position: relative;
}

/* ── Bannière défi clôturé ────────────────────────────── */
.chal-complete-banner {
  position: relative; overflow: hidden;
  background: linear-gradient(135deg, rgba(39,174,96,.1) 0%, rgba(139,100,60,.06) 100%);
  border: 1.5px solid var(--chal-open);
  border-radius: var(--chal-radius);
  padding: 24px 28px;
  margin-bottom: 24px;
  text-align: center;
}
.chal-complete-banner::before {
  content: '🏁';
  position: absolute; right: 20px; top: 50%; transform: translateY(-50%);
  font-size: 4rem; opacity: .1; pointer-events: none;
}
.chal-complete-banner h2 {
  font-family: var(--font-display);
  font-style: italic;
  color: var(--chal-open);
  margin: 0 0 6px;
}
.chal-complete-banner p { font-family: var(--font-body); font-style: italic; color: var(--text-muted); font-size: .9rem; margin: 0; }

/* ── Formulaire création / édition ───────────────────── */
.chal-section-body .mb-3 { margin-bottom: 1.1rem !important; }
.chal-section-body .form-label {
  font-family: var(--font-ui);
  font-size: .78rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .05em;
  color: var(--text-muted); margin-bottom: 6px !important;
}
.chal-section-body .form-text {
  font-family: var(--font-body);
  font-style: italic;
  font-size: .77rem; color: var(--text-muted);
  margin-top: 5px; line-height: 1.5;
}
.chal-section-body textarea.form-control { resize: vertical; min-height: 130px; }
.chal-section-body .form-check {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 4px; border-radius: 6px; transition: background .12s;
}
.chal-section-body .form-check:hover { background: var(--accent-light); }
.chal-section-body .form-check-input { margin: 0; flex-shrink: 0; cursor: pointer; }
.chal-section-body .form-check-label {
  font-size: .85rem; color: var(--text-mid); cursor: pointer;
  line-height: 1.3; font-weight: 400;
  text-transform: none; letter-spacing: 0;
}
.chal-scroll-checks {
  max-height: 200px; overflow-y: auto;
  border: 1.5px solid var(--border); border-radius: 10px;
  padding: 10px 12px; background: var(--surface);
  scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent;
}
.chal-scroll-checks::-webkit-scrollbar { width: 5px; }
.chal-scroll-checks::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 3px; }
.chal-form-hint {
  font-family: var(--font-body); font-style: italic;
  font-size: .75rem; color: var(--text-muted);
  text-align: center; margin-top: 10px; line-height: 1.4;
}
.chal-mode-hint {
  margin-top: 8px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--accent-light);
  border-left: 3px solid var(--accent-mid);
  font-family: var(--font-body);
  font-size: .82rem;
  line-height: 1.6;
  color: var(--text-mid);
}

/* ── Carte YouTube (remplacement de l'iframe) ─────────── */
.chal-yt-card {
  display: inline-flex;
  align-items: center;
  flex-direction: row;
  gap: 10px;
  margin-top: 8px;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  background: #0f0f0f;
  color: #fff;
  text-decoration: none;
  transition: opacity .15s;
  max-width: 320px;
  width: 100%;
  box-sizing: border-box;
}
.chal-yt-card:hover { opacity: .85; color: #fff; }
.chal-yt-thumb {
  width: 72px !important;
  height: 50px !important;
  min-width: 72px;
  object-fit: cover;
  border-radius: 4px;
  flex-shrink: 0;
  display: block;
}
.chal-yt-play {
  font-size: 1.1rem;
  color: #ff0000;
  flex-shrink: 0;
}
.chal-yt-label {
  font-family: var(--font-ui);
  font-size: .8rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Contrainte form row ──────────────────────────────── */
.chal-constraint-row {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px 12px;
  margin-bottom: 10px;
  position: relative;
  transition: border-color .15s, box-shadow .15s;
}
.chal-constraint-row:hover { border-color: var(--accent-mid); box-shadow: 0 2px 8px rgba(92,74,58,.07); }
.chal-constraint-row .form-label { font-size: .72rem !important; margin-bottom: 4px !important; }
.chal-constraint-row .btn-remove-constraint {
  position: absolute; top: 10px; right: 12px;
  background: none; border: none; font-size: .95rem;
  cursor: pointer; color: var(--text-muted); padding: 2px 4px;
  border-radius: 4px; line-height: 1; transition: color .12s, background .12s;
}
.chal-constraint-row .btn-remove-constraint:hover { color: var(--danger); background: var(--danger-light); }

/* ── Musique player ───────────────────────────────────── */
.chal-music-player { margin-top: 10px; border-radius: 10px; overflow: hidden; background: var(--bg); border: 1px solid var(--border); }
.chal-music-player iframe { display: block; width: 100%; border: none; }

/* ── Panel éditeur ────────────────────────────────────── */
.chal-editor-panel {
  background: var(--accent-light); border: 1.5px solid var(--border);
  border-radius: 10px; padding: 14px 16px; margin-bottom: 16px;
}
.chal-editor-panel-title {
  font-family: var(--font-display); font-style: italic;
  font-size: .82rem; font-weight: 700; color: var(--accent); margin-bottom: 10px;
}
.chal-all-done-banner {
  background: rgba(39,174,96,.1); border: 1.5px solid var(--chal-open);
  border-radius: 8px; padding: 10px 14px;
  font-family: var(--font-body); font-style: italic;
  font-size: .84rem; color: var(--chal-open); font-weight: 600; margin-top: 10px;
}

/* ── Statut soumission ────────────────────────────────── */
.chal-sub-status {
  display: inline-block; font-family: var(--font-ui);
  font-size: .72rem; font-weight: 700;
  padding: 3px 10px; border-radius: 999px; margin-bottom: 4px;
}
.chal-sub-status--ok   { background: rgba(39,174,96,.12); color: var(--chal-open); }
.chal-sub-status--draft{ background: rgba(230,126,34,.12); color: var(--chal-voting); }

/* ── Rattachement actuel (page submit) ────────────────── */
.chal-sub-current {
  display: flex; gap: 12px; align-items: flex-start;
  background: var(--accent-light); border: 1.5px solid var(--border);
  border-radius: 10px; padding: 14px 16px; margin-bottom: 18px;
}
.chal-sub-current__icon { font-size: 1.4rem; flex-shrink: 0; }
.chal-sub-current__label {
  font-family: var(--font-ui); font-size: .72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-muted); margin-bottom: 3px;
}
.chal-sub-current__title { font-family: var(--font-display); font-style: italic; font-weight: 600; font-size: .92rem; color: var(--text); }
.chal-sub-current__work  { font-weight: 400; color: var(--text-muted); font-size: .82rem; }
.chal-sub-current__note  { font-family: var(--font-body); font-style: italic; font-size: .78rem; color: var(--text-muted); margin-top: 3px; }

/* ── Sélecteur œuvre (submit) ─────────────────────────── */
.chal-attach-step { margin-bottom: 6px; }
.chal-work-list {
  display: flex; flex-direction: column; gap: 6px;
  max-height: 320px; overflow-y: auto;
  scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent;
}
.chal-work-item {
  padding: 10px 14px;
  border: 1.5px solid var(--border); border-left: 3px solid var(--border);
  border-radius: 8px; cursor: pointer;
  transition: all .15s; background: var(--surface);
}
.chal-work-item:hover { border-color: var(--accent); border-left-color: var(--green); background: var(--accent-light); }
.chal-work-item__title { font-family: var(--font-display); font-weight: 600; font-style: italic; font-size: .9rem; color: var(--text); }
.chal-work-item__meta  { font-family: var(--font-ui); font-size: .78rem; color: var(--text-muted); margin-top: 2px; }
.chal-work-status { font-weight: 600; }
.chal-work-status--draft       { color: var(--text-muted); }
.chal-work-status--in_progress { color: var(--chal-voting); }
.chal-work-status--published   { color: var(--chal-open); }
.chal-work-status--completed   { color: var(--chal-open); }

.chal-selected-work { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.chal-back-btn {
  background: none; border: 1px solid var(--border); border-radius: 6px;
  font-size: .78rem; padding: 4px 10px; cursor: pointer;
  color: var(--text-muted); transition: all .12s;
}
.chal-back-btn:hover { border-color: var(--accent); color: var(--accent); }
.chal-selected-work__name { font-family: var(--font-display); font-style: italic; font-weight: 700; font-size: .95rem; color: var(--text); }

/* ── Cartes d'action ──────────────────────────────────── */
.chal-action-card {
  border: 1.5px solid var(--border);
  border-radius: 10px; padding: 14px 16px; margin-bottom: 10px;
  background: var(--surface); transition: border-color .15s;
}
.chal-action-card:hover { border-color: var(--accent-mid); }
.chal-action-card__title { font-family: var(--font-display); font-style: italic; font-weight: 700; font-size: .9rem; color: var(--text); margin-bottom: 4px; }
.chal-action-card__note { font-family: var(--font-body); font-style: italic; font-size: .8rem; color: var(--text-muted); margin-bottom: 2px; }

/* ── Liste chapitres ──────────────────────────────────── */
.chal-chapter-list { display: flex; flex-direction: column; gap: 4px; margin-bottom: 8px; }
.chal-chapter-row {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px; border-radius: 6px;
  cursor: pointer; transition: background .12s;
}
.chal-chapter-row:hover { background: var(--accent-light); }
.chal-chapter-row input[type="radio"] { flex-shrink: 0; cursor: pointer; }
.chal-chapter-row__title { flex: 1; font-family: var(--font-display); font-style: italic; font-size: .88rem; color: var(--text); font-weight: 500; }
.chal-chapter-row__meta  { font-family: var(--font-ui); font-size: .74rem; color: var(--text-muted); white-space: nowrap; }
.chal-chap-pub    { color: var(--chal-open); font-weight: 600; }
.chal-chap-draft  { color: var(--chal-voting); }
.chal-chap-locked { margin-left: 4px; }

/* ── Page confirmation (départ de quête) ─────────────── */
.chal-confirm-card {
  max-width: 560px; margin: 60px auto;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--chal-radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.chal-confirm-header {
  padding: 20px 24px 16px;
  background: linear-gradient(180deg, var(--accent-light) 0%, var(--surface) 100%);
  border-bottom: 1px solid var(--border);
}
.chal-confirm-title {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent);
  margin: 0;
  display: flex; align-items: center; gap: 8px;
}
.chal-confirm-title::before { content: '◆'; font-size: .45rem; color: var(--accent-mid); font-style: normal; }
.chal-confirm-body { padding: 20px 24px; }
.chal-confirm-body p { font-family: var(--font-body); line-height: 1.6; }
.chal-confirm-actions { display: flex; gap: 10px; margin-top: 20px; }

/* ── Dark mode ────────────────────────────────────────── */
[data-theme="dark"] .chal-work-item   { background: var(--bg-alt); }
[data-theme="dark"] .chal-action-card { background: var(--bg-alt); }
[data-theme="dark"] .chal-sub-current { background: rgba(255,255,255,.04); }
[data-theme="dark"] .chal-constraint-row { background: var(--bg-alt); border-color: var(--border); }
[data-theme="dark"] .chal-constraint-row:hover { border-color: var(--accent-mid); }
[data-theme="dark"] .chal-scroll-checks { background: var(--bg-alt); border-color: var(--border); }
[data-theme="dark"] .chal-section-body .form-check:hover { background: rgba(255,255,255,.04); }
[data-theme="dark"] .chal-hero::after { color: rgba(255,255,255,.025); }
[data-theme="dark"] .chal-hero::before {
  background-image:
    repeating-linear-gradient(0deg,   transparent, transparent 39px, rgba(255,255,255,.025) 39px, rgba(255,255,255,.025) 40px),
    repeating-linear-gradient(90deg,  transparent, transparent 39px, rgba(255,255,255,.025) 39px, rgba(255,255,255,.025) 40px);
}
[data-theme="dark"] .chal-submission-card { background: var(--bg-alt); }

/* ── Responsive ───────────────────────────────────────── */
@media (max-width: 640px) {
  .chal-hero { padding: 40px 16px 32px; }
  .chal-hero::after { font-size: 8rem; }
  .chal-container { padding: 0 14px; }
  .chal-card { padding: 16px 18px; }
  .chal-podium { flex-direction: column; }
  .chal-section-body { padding: 14px 16px; }
  .chal-confirm-card { margin: 30px 16px; }
  .quest-works-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ── Encart "Carnets de voyage" ─────────────────────────── */
.quest-works-section {
  padding: 40px 0 20px;
  border-top: 1px solid var(--border);
  margin-top: 32px;
}

.quest-works-header {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 24px;
}

.quest-works-title {
  font-family: var(--font-display);
  font-size: 1.4rem;
  color: var(--text);
  margin: 0;
  flex-shrink: 0;
}

.quest-works-sub {
  font-family: var(--font-body);
  font-style: italic;
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin: 0;
  flex: 1;
}

.quest-works-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

@media (max-width: 900px) {
  .quest-works-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 600px) {
  .quest-works-grid { grid-template-columns: repeat(2, 1fr); }
}

.quest-work-card {
  display: flex;
  flex-direction: column;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface);
  text-decoration: none;
  color: inherit;
  transition: box-shadow 0.18s, transform 0.18s;
}

.quest-work-card:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,.10);
  transform: translateY(-2px);
}

.quest-work-card__cover {
  aspect-ratio: 3/4;
  background: var(--accent-light);
  overflow: hidden;
  flex-shrink: 0;
}

.quest-work-card__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.quest-work-card__placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  opacity: .5;
}

.quest-work-card__body {
  padding: 10px 12px;
}

.quest-work-card__quest {
  font-size: 0.68rem;
  font-family: var(--font-ui);
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.quest-work-card__title {
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.quest-work-card__author {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-family: var(--font-ui);
}

/* ── Barre de filtres ─────────────────────────────────── */
.chal-filters {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 20px;
  align-items: center;
}
.chal-filters .form-control { max-width: 280px; }
.chal-filters .form-select  { max-width: 200px; }
@media (max-width: 640px) {
  .chal-filters .form-control,
  .chal-filters .form-select { max-width: 100%; flex: 1 1 140px; }
}

/* ── Stepper participation ────────────────────────────── */
.chal-stepper {
  display: flex;
  align-items: flex-start;
  margin-bottom: 16px;
}
.chal-step {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  position: relative;
}
.chal-step + .chal-step::before {
  content: '';
  position: absolute;
  top: 9px; left: -50%; right: 50%;
  height: 2px;
  background: var(--border);
}
.chal-step--done + .chal-step::before { background: var(--chal-open); }
.chal-step-dot {
  width: 20px; height: 20px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--surface);
  position: relative; z-index: 1;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  transition: all .2s;
}
.chal-step--done    .chal-step-dot { background: var(--chal-open); border-color: var(--chal-open); }
.chal-step--current .chal-step-dot { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-light); }
.chal-step--done .chal-step-dot::after {
  content: '✓'; font-size: .6rem; font-weight: 900; color: #fff;
}
.chal-step-label {
  font-family: var(--font-ui); font-size: .62rem; font-weight: 600;
  color: var(--text-muted); text-align: center;
  text-transform: uppercase; letter-spacing: .04em; line-height: 1.2;
}
.chal-step--done    .chal-step-label { color: var(--chal-open); }
.chal-step--current .chal-step-label { color: var(--accent); }

/* ── Nudge "pas de texte" ─────────────────────────────── */
.chal-nudge {
  background: rgba(230,126,34,.07);
  border: 1.5px dashed rgba(230,126,34,.4);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 12px;
  font-family: var(--font-body); font-size: .84rem;
  line-height: 1.6; color: var(--text-mid);
}
.chal-nudge strong {
  color: var(--chal-voting); display: block; margin-bottom: 3px;
  font-size: .75rem; text-transform: uppercase; letter-spacing: .05em;
}

/* ── Countdown deadline ───────────────────────────────── */
.chal-countdown {
  display: inline-block; font-family: var(--font-ui); font-size: .68rem;
  font-weight: 700; padding: 1px 7px; border-radius: 999px;
  margin-left: 6px; vertical-align: middle; white-space: nowrap;
}
.chal-countdown--soon  { background: rgba(231,76,60,.12);  color: #e74c3c; }
.chal-countdown--close { background: rgba(230,126,34,.12); color: var(--chal-voting); }
.chal-countdown--ok    { background: rgba(39,174,96,.1);   color: var(--chal-open); }

/* ── Lien musique générique ───────────────────────────── */
.chal-link-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 14px; border-radius: 999px; margin-top: 8px;
  background: var(--accent-light); color: var(--accent);
  font-family: var(--font-ui); font-size: .82rem; font-weight: 600;
  text-decoration: none; border: 1.5px solid var(--border);
  transition: border-color .15s;
}
.chal-link-btn:hover { border-color: var(--accent); color: var(--accent); }

/* ── Bouton ⋯ (dropdown) ──────────────────────────────── */
.chal-more-btn {
  display: inline-flex; align-items: center;
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: 999px; padding: 6px 16px;
  font-size: .85rem; font-family: var(--font-ui); font-weight: 700;
  cursor: pointer; color: var(--text-mid); letter-spacing: .05em;
  transition: border-color .15s, color .15s;
}
.chal-more-btn:hover,
.chal-more-btn[aria-expanded="true"] { border-color: var(--accent); color: var(--accent); }

/* ── Participants — collapse mobile ───────────────────── */
.chal-participants-toggle {
  display: none; width: 100%; background: none; border: none;
  font-family: var(--font-ui); font-size: .75rem; color: var(--accent);
  cursor: pointer; padding: 8px 0 2px; text-align: center; font-weight: 600;
}
@media (max-width: 860px) {
  .chal-participant-extra { display: none; }
  .chal-participant-extra.visible { display: flex; }
  .chal-participants-toggle { display: block; }
}
