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

:root {
  --bg:        #ede8e0;
  --sidebar:   #e8e2d9;
  --card:      #ffffff;
  --text:      #2e2319;
  --muted:     #7a6e63;
  --blue:      #2a5fa5;
  --blue-light:#3b7fd4;
  --border:    #d8d0c5;
  --green:     #2e7d32;
  --red:       #c0392b;
  --yellow:    #e67e22;
  --radius:    12px;
  --sidebar-w: 200px;
  --font-sans: "Inter", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", monospace;
}

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
}

a { color: inherit; text-decoration: none; }

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: fixed;
  top: 0; left: 0;
  bottom: 0;
  padding: 1.5rem 0;
}

.sidebar__brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 1rem 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
}

.sidebar__logo-img {
  width: 80px;
  height: 80px;
  object-fit: contain;
  border-radius: 12px;
}

.sidebar__logo {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: 0.04em;
}

.sidebar__section {
  padding: 1.25rem 1rem 0.5rem;
}

.sidebar__section-label {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.5rem;
  padding: 0 0.25rem;
}

.sidebar__nav { display: flex; flex-direction: column; gap: 0.15rem; }

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  padding: 0.75rem 0.5rem;
  border-radius: var(--radius);
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 500;
  transition: background 0.15s;
  cursor: pointer;
}

.nav-item:hover { background: rgba(0,0,0,0.06); }
.nav-item--active { background: rgba(42,95,165,0.12); color: var(--blue); font-weight: 700; }

.nav-item__icon { font-size: 1.4rem; }

/* ── Main content ── */
.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  padding: 2.5rem 2.5rem 4rem;
  max-width: 1100px;
}

/* ── Topbar (compte haut droite) ── */
.topbar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0 1rem;
  margin-bottom: 0.5rem;
}

.topbar__user { margin-right: 0.25rem; }

.topbar__btn {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.9rem;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  text-decoration: none;
  border: none;
  font-family: inherit;
}

.topbar__btn--login {
  color: var(--blue);
  background: transparent;
  border: 1.5px solid var(--blue);
}

.topbar__btn--login:hover { background: rgba(42,95,165,0.07); }

.topbar__btn--register {
  background: var(--blue);
  color: #fff;
}

.topbar__btn--register:hover { background: var(--blue-light); }

.topbar__btn--logout {
  color: var(--muted);
  background: transparent;
  border: 1.5px solid var(--border);
}

.topbar__btn--logout:hover { background: rgba(0,0,0,0.05); }

.topbar__logout-form { display: inline; }

/* ── Page header ── */
.page-header {
  margin-bottom: 2rem;
}

.page-header h1 {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 0.3rem;
}

.page-header p {
  color: var(--muted);
  font-size: 0.9rem;
}

/* ── Stats bar ── */
.stats-bar {
  display: flex;
  gap: 1rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.stat {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.85rem 1.4rem;
  min-width: 130px;
}

.stat__value {
  display: block;
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--blue);
}

.stat__label {
  font-size: 0.72rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  font-weight: 600;
}

/* ── Filters ── */
.filters {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1.75rem;
}

.filter-btn {
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.4rem 1rem;
  border-radius: 99px;
  border: 1.5px solid var(--border);
  background: var(--card);
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s;
}

.filter-btn:hover { border-color: var(--blue); color: var(--blue); }
.filter-btn.active { background: var(--blue); border-color: var(--blue); color: #fff; }

/* ── Challenge grid ── */
.challenges-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1.25rem;
}

/* ── Card ── */
.card {
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.15s, box-shadow 0.15s;
  cursor: pointer;
}

.card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.10);
}

.card--solved { border-color: var(--green); }

.card__banner {
  height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3.5rem;
  position: relative;
  overflow: hidden;
}

.card__banner--introduction { background: linear-gradient(135deg, #d4e9c5, #a8d5a2); }
.card__banner--débutant     { background: linear-gradient(135deg, #c5d9f0, #90bce8); }
.card__banner--moyen        { background: linear-gradient(135deg, #fde9c0, #f5c87a); }
.card__banner--avancé       { background: linear-gradient(135deg, #f5c0c0, #e88a8a); }

.card__image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card__solved-badge {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: var(--green);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: 99px;
  letter-spacing: 0.05em;
}

.card__body {
  padding: 1.1rem 1.25rem 1.25rem;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.card__difficulty {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 0.4rem;
}

.card__title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--blue);
  margin-bottom: 0.5rem;
  line-height: 1.3;
}

.card__desc {
  font-size: 0.83rem;
  color: var(--muted);
  line-height: 1.55;
  flex: 1;
  margin-bottom: 1rem;
}

.card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.card__points {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--blue);
}

.card__tags { display: flex; gap: 0.3rem; flex-wrap: wrap; }

.tag {
  font-size: 0.65rem;
  color: var(--muted);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.1rem 0.4rem;
}

/* ── Challenge page ── */
.ch-back {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--muted);
  font-size: 0.85rem;
  margin-bottom: 1.5rem;
  font-weight: 500;
  transition: color 0.15s;
}
.ch-back:hover { color: var(--blue); }

.challenge-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 1.5rem;
  align-items: start;
}

@media (max-width: 800px) {
  .challenge-layout { grid-template-columns: 1fr; }
}

.ch-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.6rem;
}

.ch-difficulty-badge {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 0.25rem 0.7rem;
  border-radius: 99px;
  border: 1.5px solid currentColor;
}

.ch-category-label { font-size: 0.8rem; color: var(--muted); }

.ch-title {
  font-size: clamp(1.4rem, 3vw, 2rem);
  font-weight: 800;
  color: var(--blue);
  margin-bottom: 0.75rem;
  line-height: 1.2;
}

.ch-tags { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-bottom: 1.5rem; }

.section-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1rem;
}

.section-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin-bottom: 0.6rem;
}

.section-card p { font-size: 0.9rem; line-height: 1.65; color: var(--text); }

.ch-image {
  width: 100%;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  margin-bottom: 1rem;
  display: none;
}

/* ── Sidebar challenge ── */
.ch-sidebar { position: sticky; top: 1.5rem; }

.points-box {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  text-align: center;
  margin-bottom: 1rem;
}

.points-value {
  display: block;
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--blue);
}

.points-label {
  font-size: 0.72rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
}

/* ── Answer form ── */
.answer-form { display: flex; flex-direction: column; gap: 0.75rem; }

.answer-input {
  width: 100%;
  padding: 0.75rem 1rem;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.15s;
  font-family: var(--font-sans);
}

.answer-input:focus { border-color: var(--blue); }

.answer-input.shake { animation: shake 0.35s ease; }
@keyframes shake {
  0%,100% { transform: translateX(0); }
  20%,60%  { transform: translateX(-6px); }
  40%,80%  { transform: translateX(6px); }
}

.submit-btn {
  width: 100%;
  padding: 0.8rem;
  background: var(--blue);
  color: #fff;
  font-weight: 700;
  font-size: 0.9rem;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  letter-spacing: 0.03em;
}

.submit-btn:hover { background: var(--blue-light); transform: translateY(-1px); }

.submit-btn--success {
  background: var(--green);
  cursor: default;
  opacity: 1;
}
.submit-btn--success:hover { background: var(--green); transform: none; }

.feedback {
  font-size: 0.82rem;
  text-align: center;
  min-height: 1.2em;
  font-weight: 600;
}

.feedback--error { color: var(--red); }

/* ── Solved banner ── */
.solved-banner {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 1.5rem;
  background: #e8f5e9;
  border: 1.5px solid var(--green);
  border-radius: var(--radius);
  text-align: center;
}

.solved-banner__icon { font-size: 2rem; }
.solved-banner__title { font-weight: 800; color: var(--green); font-size: 1rem; }
.solved-banner__sub { font-size: 0.82rem; color: var(--muted); }

/* ── Hints ── */
.hints-list { list-style: none; display: flex; flex-direction: column; gap: 0.5rem; }

.hint-btn {
  background: var(--bg);
  border: 1.5px dashed var(--border);
  border-radius: 8px;
  color: var(--muted);
  padding: 0.55rem 0.9rem;
  cursor: pointer;
  font-size: 0.82rem;
  width: 100%;
  text-align: left;
  transition: border-color 0.15s, color 0.15s;
  font-family: var(--font-sans);
  font-weight: 500;
}

.hint-btn:hover { border-color: var(--blue); color: var(--blue); }

.hint-text {
  display: block;
  padding: 0.55rem 0.9rem;
  background: #eef4fc;
  border-left: 3px solid var(--blue);
  border-radius: 0 8px 8px 0;
  color: var(--text);
  font-size: 0.85rem;
  line-height: 1.5;
}

.hint-text a,
.hint-url,
.step__explanation a { color: var(--blue); font-weight: 600; }
.hint-text a:hover,
.hint-url:hover,
.step__explanation a:hover { text-decoration: underline; }

.hint-image {
  display: block;
  margin-top: 0.6rem;
  max-width: 100%;
  border-radius: 6px;
  border: 1px solid var(--border);
}

.hidden { display: none !important; }

/* ── Objective ── */
.ch-objective {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: #eef4fc;
  border-left: 4px solid var(--blue);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 0.7rem 1rem;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--blue);
  margin-bottom: 1rem;
}

/* ── Step explanation ── */
.step__explanation {
  margin-top: 0.75rem;
  padding: 0.75rem 1rem;
  background: #fff8e1;
  border-left: 3px solid var(--yellow, #e67e22);
  border-radius: 0 8px 8px 0;
  font-size: 0.85rem;
  line-height: 1.6;
  color: var(--text);
}

/* ── External links block ── */
.ch-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-bottom: 1.25rem;
}

.ch-link-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--blue);
  background: #eef4fc;
  border: 1.5px solid #c5d9f0;
  border-radius: 8px;
  padding: 0.5rem 1rem;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s;
}

.ch-link-btn:hover {
  background: #d9eaf9;
  border-color: var(--blue);
}

/* ── Image block ── */
.image-block {
  margin-bottom: 1rem;
}

.ch-image {
  width: 100%;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  display: block;
}

.download-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.6rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--blue);
  background: #eef4fc;
  border: 1.5px solid #c5d9f0;
  border-radius: 8px;
  padding: 0.4rem 0.9rem;
  cursor: pointer;
  font-family: var(--font-sans);
  transition: background 0.15s;
}
.download-link:hover { background: #d9eaf9; }

/* ── Context images ── */
.context-image-block {
  margin-bottom: 1rem;
}

.context-image-caption {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 0.4rem;
}

.context-image {
  width: 100%;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  display: block;
}

/* ── Steps ── */
.step {
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 0.85rem;
  transition: border-color 0.2s;
}

.step--done {
  border-color: var(--green);
  background: #f1f8f1;
}

.step--locked {
  opacity: 0.55;
}

.step__header {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin-bottom: 0.85rem;
}

.step__wrong-penalty-badge {
  margin-left: auto;
  background: var(--red);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  border-radius: 4px;
  white-space: nowrap;
  flex-shrink: 0;
}

.step__number {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--blue);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.step--done .step__number {
  background: var(--green);
}

.step--locked .step__number {
  background: var(--muted);
}

.step__title {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text);
}

.step__question {
  font-size: 0.9rem;
  color: var(--text);
  line-height: 1.6;
  margin-bottom: 1rem;
}

.step__links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}
.step__link {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  background: var(--accent-bg, #e8f0fe);
  color: var(--accent, #1a73e8);
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid var(--accent-border, #c5d8f8);
}
.step__link:hover { text-decoration: underline; }
.step__resource-img {
  display: block;
  max-width: 100%;
  border-radius: 8px;
  margin-bottom: 0.75rem;
  border: 1px solid var(--border);
}

.step__map {
  height: 400px;
  border-radius: 8px;
  margin: 1rem 0;
  border: 1px solid var(--border);
  cursor: crosshair;
}

.step__locked-msg {
  font-size: 0.82rem;
  color: var(--muted);
  font-style: italic;
}

.step__success {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--green);
}

.step__hint-wrap {
  margin-bottom: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

/* ── Card step progress ── */
.step-progress {
  height: 4px;
  background: var(--border);
  border-radius: 99px;
  overflow: hidden;
  margin-bottom: 0.3rem;
}

.step-progress__bar {
  height: 100%;
  background: var(--blue);
  border-radius: 99px;
  transition: width 0.3s ease;
}

.step-progress__label {
  font-size: 0.7rem;
  color: var(--muted);
  margin-bottom: 0.75rem;
}

/* ── Error ── */
.error {
  color: var(--red);
  font-size: 0.9rem;
  padding: 1rem;
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

/* ── Login challenge ── */
.login-card {
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
  max-width: 420px;
}

.login-card__header {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border);
}

.login-card__icon { font-size: 1.8rem; }

.login-card__title {
  font-weight: 800;
  font-size: 1rem;
  color: var(--text);
}

.login-card__subtitle {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 0.1rem;
}

.login-form { display: flex; flex-direction: column; gap: 1rem; }

.login-field { display: flex; flex-direction: column; gap: 0.35rem; }

.login-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.login-input {
  padding: 0.7rem 1rem;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.92rem;
  font-family: var(--font-sans);
  outline: none;
  transition: border-color 0.15s;
}
.login-input:focus { border-color: var(--blue); }
.login-input.shake { animation: shake 0.35s ease; }

.login-submit {
  margin-top: 0.25rem;
  padding: 0.8rem;
  background: var(--blue);
  color: #fff;
  font-weight: 700;
  font-size: 0.92rem;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-family: var(--font-sans);
  transition: background 0.15s, transform 0.1s;
}
.login-submit:hover { background: var(--blue-light); transform: translateY(-1px); }

.login-submit--success {
  background: var(--green);
  cursor: default;
  opacity: 1;
}
.login-submit--success:hover { background: var(--green); transform: none; }

/* ── Points penalty display ── */
.points-penalty {
  display: block;
  font-size: 0.72rem;
  color: var(--red);
  font-weight: 600;
  margin-top: 0.25rem;
}

/* ── Hints block ── */
.hints-block {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 0.85rem;
}

.hint-item { display: flex; flex-direction: column; gap: 0.3rem; }

.hint-cost {
  font-size: 0.7rem;
  color: var(--red);
  font-weight: 700;
  margin-left: 0.5rem;
  background: #fdecea;
  border-radius: 4px;
  padding: 0.1rem 0.35rem;
}

.hint-subtitle {
  display: block;
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: 400;
  margin-top: 0.15rem;
}

.hint-btn--locked {
  opacity: 0.5;
  cursor: not-allowed;
}

.hint-error {
  font-size: 0.78rem;
  color: var(--red);
  padding: 0.15rem 0.4rem;
}

/* ── Hint modal ── */
.hint-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  /* Au-dessus des panneaux Leaflet (max 800 sur .leaflet-control). */
  z-index: 1100;
}

.hint-modal__box {
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem 1.75rem;
  max-width: 360px;
  width: 90%;
  text-align: center;
  box-shadow: 0 12px 40px rgba(0,0,0,0.15);
}

.hint-modal__icon { font-size: 2rem; margin-bottom: 0.75rem; }

.hint-modal__text {
  font-size: 0.92rem;
  color: var(--text);
  line-height: 1.6;
  margin-bottom: 1.25rem;
}

.hint-modal__actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
}

.hint-modal__cancel {
  padding: 0.6rem 1.2rem;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.hint-modal__cancel:hover { border-color: var(--text); color: var(--text); }

.hint-modal__confirm {
  padding: 0.6rem 1.2rem;
  background: var(--red);
  border: none;
  border-radius: 8px;
  color: #fff;
  font-size: 0.85rem;
  font-weight: 700;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: opacity 0.15s;
}
.hint-modal__confirm:hover { opacity: 0.85; }
.hint-modal__confirm:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* ── Reset button ── */
.reset-btn {
  width: 100%;
  margin-top: 0.75rem;
  padding: 0.6rem 1rem;
  background: transparent;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  color: var(--muted);
  font-size: 0.82rem;
  font-family: var(--font-sans);
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.reset-btn:hover { border-color: var(--red); color: var(--red); }

/* ── Disclaimer overlay ── */
.disclaimer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  backdrop-filter: blur(4px);
}

.disclaimer-box {
  background: var(--card);
  border-radius: 16px;
  max-width: 580px;
  width: 100%;
  padding: 2.5rem;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  max-height: 90vh;
  overflow-y: auto;
}

.disclaimer-icon {
  font-size: 2.5rem;
  text-align: center;
}

.disclaimer-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text);
  text-align: center;
}

.disclaimer-intro {
  color: var(--muted);
  font-size: 0.875rem;
  line-height: 1.6;
}

.disclaimer-rules {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  list-style: none;
}

.disclaimer-rules li {
  background: #f5f1eb;
  border-radius: 10px;
  padding: 0.8rem 1rem;
  font-size: 0.84rem;
  line-height: 1.55;
  color: var(--text);
  border-left: 3px solid var(--blue);
}

.disclaimer-rules li strong {
  display: block;
  margin-bottom: 0.15rem;
  color: var(--blue);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.disclaimer-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  padding-top: 0.25rem;
  border-top: 1px solid var(--border);
}

.disclaimer-refuse {
  padding: 0.65rem 1.25rem;
  border-radius: 8px;
  border: 1.5px solid var(--border);
  background: transparent;
  color: var(--muted);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font-sans);
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.disclaimer-refuse:hover {
  border-color: var(--red);
  color: var(--red);
  background: rgba(192, 57, 43, 0.05);
}

.disclaimer-accept {
  padding: 0.65rem 1.5rem;
  border-radius: 8px;
  border: none;
  background: var(--blue);
  color: #fff;
  font-size: 0.875rem;
  font-weight: 700;
  cursor: pointer;
  font-family: var(--font-sans);
  transition: background 0.15s;
}
.disclaimer-accept:hover { background: var(--blue-light); }

/* ── Tools page ── */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 1.25rem;
}

.tool-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1rem;
}

.tool-card__title {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  padding-bottom: 0.65rem;
  margin-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.tool-link {
  display: flex;
  flex-direction: column;
  padding: 0.55rem 0.6rem;
  border-radius: 8px;
  text-decoration: none;
  color: var(--text);
  transition: background 0.15s;
  gap: 0.1rem;
}
.tool-link:hover { background: rgba(42, 95, 165, 0.08); color: var(--blue); }

.tool-link__name {
  font-size: 0.84rem;
  font-weight: 600;
}

.tool-link__desc {
  font-size: 0.72rem;
  color: var(--muted);
  font-weight: 400;
}
.tool-link:hover .tool-link__desc { color: var(--blue-light); }

/* ── Sidebar : section bas (compte) ── */
.sidebar { justify-content: flex-start; }
.sidebar__section--bottom { margin-top: auto; padding-bottom: 1rem; }

.nav-item--user {
  cursor: default;
  background: transparent;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.78rem;
}

.logout-form { margin: 0; padding: 0; }
.logout-form .nav-item--logout {
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: inherit;
  color: var(--text);
  padding: 0.5rem 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border-radius: 8px;
}
.logout-form .nav-item--logout:hover { background: rgba(0,0,0,0.05); }

/* ── Flash messages ── */
.flash-stack { display: flex; flex-direction: column; gap: 0.5rem; margin-bottom: 1.5rem; }
.flash {
  padding: 0.85rem 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--card);
  font-size: 0.9rem;
}
.flash--error   { border-color: #e6b8b3; background: #fdecea; color: #8a1f12; }
.flash--success { border-color: #b8e0bb; background: #e9f8eb; color: #1f5b25; }
.flash--message { border-color: var(--border); background: var(--card); color: var(--text); }

/* ── Auth card (login / register / rate_limit) ── */
.auth-card {
  max-width: 460px;
  margin: 3rem auto;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem 2.25rem;
  box-shadow: 0 2px 14px rgba(0,0,0,0.04);
}
.auth-card__title { font-size: 1.6rem; margin-bottom: 0.4rem; }
.auth-card__sub   { color: var(--muted); font-size: 0.92rem; margin-bottom: 1.5rem; line-height: 1.5; }
.auth-card__alt   { margin-top: 1.25rem; font-size: 0.88rem; color: var(--muted); text-align: center; }
.auth-card__alt a { color: var(--blue); font-weight: 600; }

.auth-form { display: flex; flex-direction: column; gap: 1rem; }
.auth-form__field { display: flex; flex-direction: column; gap: 0.35rem; }
.auth-form__field label { font-weight: 600; font-size: 0.85rem; }
.auth-form__input {
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.95rem;
  background: var(--bg);
}
.auth-form__input:focus { outline: 2px solid var(--blue-light); outline-offset: -1px; }
.auth-form__hint  { font-size: 0.75rem; color: var(--muted); }
.auth-form__error { font-size: 0.78rem; color: var(--red); font-weight: 500; }
.auth-form__check { display: flex; align-items: center; gap: 0.5rem; font-size: 0.88rem; color: var(--muted); }
.auth-form__submit {
  margin-top: 0.5rem;
  padding: 0.75rem 1rem;
  background: var(--blue);
  color: white;
  border: none;
  border-radius: 8px;
  font-family: inherit;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background 0.15s;
}
.auth-form__submit:hover { background: var(--blue-light); }

/* ── Leaderboard ── */
.leaderboard {
  width: 100%;
  border-collapse: collapse;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  font-size: 0.95rem;
}
.leaderboard th, .leaderboard td {
  padding: 0.85rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.leaderboard th { background: var(--sidebar); font-weight: 700; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.leaderboard tr:last-child td { border-bottom: none; }
.leaderboard__rank  { width: 60px; text-align: center; font-weight: 700; }
.leaderboard__num   { text-align: right; font-variant-numeric: tabular-nums; }
.leaderboard__group { color: var(--muted); font-size: 0.82rem; }
.leaderboard__group-badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background: #6c47c422;
  color: #6c47c4;
  border: 1px solid #6c47c444;
  font-size: 0.75rem;
  font-weight: 600;
}
.leaderboard__row--top { background: rgba(255, 215, 0, 0.06); }

/* ── Empty state ── */
.empty-state {
  background: var(--card);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 2.5rem;
  text-align: center;
  color: var(--muted);
}

/* ── Admin (formateur) ── */
.admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 1.25rem;
}
.admin-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}
.admin-card--inactive { opacity: 0.55; }
.admin-card__head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; }
.admin-card__name { font-weight: 700; font-size: 1.05rem; }
.admin-card__email { font-size: 0.78rem; color: var(--muted); }
.admin-card__points {
  background: var(--blue);
  color: white;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.85rem;
  white-space: nowrap;
}
.admin-card__section { border-top: 1px solid var(--border); padding-top: 0.85rem; }
.admin-card__label { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 700; margin-bottom: 0.5rem; }
.admin-card__list  { list-style: none; display: flex; flex-direction: column; gap: 0.35rem; font-size: 0.86rem; }
.admin-card__list em { color: var(--muted); font-style: normal; font-size: 0.78rem; }
.admin-card__empty { font-size: 0.85rem; color: var(--muted); font-style: italic; }
.admin-card__chip {
  display: inline-block;
  width: 1.2rem; height: 1.2rem;
  text-align: center;
  line-height: 1.2rem;
  border-radius: 50%;
  font-size: 0.7rem;
  font-weight: 700;
  margin-right: 0.35rem;
}
.admin-card__chip--done { background: var(--green); color: white; }
.admin-card__chip--wip  { background: var(--yellow); color: white; }

/* ── Admin : méta + badges ── */
.admin-card__meta { font-size: 0.75rem; color: var(--muted); margin-top: 0.2rem; }

.admin-badge {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.15em 0.5em;
  border-radius: 4px;
  margin-left: 0.4rem;
  vertical-align: middle;
}
.admin-badge--banned { background: var(--red);    color: white; }
.admin-badge--hidden { background: var(--muted);  color: white; }

/* ── Admin : barre d'actions ── */
.admin-card__actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  border-top: 1px solid var(--border);
  padding-top: 0.85rem;
  margin-top: 0.25rem;
}

.admin-btn {
  flex: 1 1 auto;
  padding: 0.45rem 0.75rem;
  border: none;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
  white-space: nowrap;
}
.admin-btn:hover  { opacity: 0.85; }
.admin-btn:active { transform: scale(0.97); }

.admin-btn--danger    { background: var(--red);    color: white; }
.admin-btn--warning   { background: var(--yellow); color: white; }
.admin-btn--success   { background: var(--green);  color: white; }
.admin-btn--secondary { background: var(--border); color: var(--text); }
.admin-btn--primary   { background: var(--blue);   color: white; }
.admin-btn--sm        { flex: none; padding: 0.3rem 0.6rem; font-size: 0.75rem; }

.admin-badge--active  { background: var(--green);  color: white; }
.admin-badge--inactive{ background: var(--muted);  color: white; }
.admin-badge--group   { background: #6c47c4;        color: white; }

/* ── Admin : sections ── */
.admin-section {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 2rem;
}

.admin-section__head  { margin-bottom: 1.25rem; }
.admin-section__title { font-size: 1.1rem; font-weight: 700; margin-bottom: 0.2rem; }
.admin-section__sub   { font-size: 0.82rem; color: var(--muted); }

/* ── Formulaire création de code ── */
.group-create-form        { margin-bottom: 1.25rem; }
.group-create-form__row   { display: flex; gap: 0.75rem; align-items: center; flex-wrap: wrap; }
.group-create-form__input {
  flex: 1 1 220px;
  padding: 0.45rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.9rem;
  background: var(--bg);
}
.group-create-form__input:focus { outline: 2px solid var(--blue); border-color: transparent; }

/* ── Table des codes de groupe ── */
.code-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
.code-table th {
  text-align: left;
  padding: 0.5rem 0.75rem;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
}
.code-table td {
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.code-table tbody tr:last-child td { border-bottom: none; }
.code-table tbody tr:hover         { background: rgba(0,0,0,0.02); }
.code-table__row--inactive         { opacity: 0.55; }

.table-scroll-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.admin-table__badges {
  white-space: nowrap;
  min-width: 70px;
}
.admin-table__username { white-space: nowrap; font-weight: 700; }

.code-table td:nth-child(6),
.code-table td:nth-child(7),
.code-table td:nth-child(8) { white-space: nowrap; }

.code-table__actions               { display: flex; gap: 0.4rem; }

.code-string {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--blue);
  background: rgba(42,95,165,0.08);
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
}

.empty-state--sm {
  font-size: 0.85rem;
  color: var(--muted);
  padding: 0.75rem 0;
  border: none;
  background: none;
}

/* ── Profil public ── */
.profile-hero {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem 2rem;
  margin-bottom: 1.75rem;
  flex-wrap: wrap;
}

.profile-hero__avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--blue);
  color: #fff;
  font-size: 1.8rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.profile-hero__info  { flex: 1; }
.profile-hero__name  { font-size: 1.4rem; font-weight: 800; margin-bottom: 0.5rem; }

.profile-hero__stats { display: flex; gap: 2rem; flex-wrap: wrap; }

.profile-stat        { display: flex; flex-direction: column; gap: 0.1rem; }
.profile-stat__value { font-size: 1.4rem; font-weight: 800; color: var(--blue); }
.profile-stat__label { font-size: 0.75rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }

.profile-hero__edit {
  padding: 0.4rem 1rem;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
  transition: background 0.15s;
  white-space: nowrap;
}
.profile-hero__edit:hover { background: rgba(0,0,0,0.05); }

.profile-section {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.75rem;
}
.profile-section__title { font-size: 1rem; font-weight: 700; margin-bottom: 1rem; }

/* ── Historique challenges ── */
.history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
.history-table th {
  text-align: left;
  padding: 0.4rem 0.75rem;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
}
.history-table td {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.history-table tbody tr:last-child td { border-bottom: none; }
.history-table tbody tr:hover         { background: rgba(0,0,0,0.02); }
.history-table__title                 { font-weight: 500; }
.history-table__num                   { text-align: right; }
.history-table__max                   { color: var(--muted); font-size: 0.8rem; }
.history-table__date                  { color: var(--muted); font-size: 0.8rem; white-space: nowrap; }

.difficulty-badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  background: var(--border);
  color: var(--text);
}
.difficulty-badge--introduction { background: rgba(46,125,50,0.12);  color: var(--green);  }
.difficulty-badge--débutant     { background: rgba(42,95,165,0.12);  color: var(--blue);   }
.difficulty-badge--moyen        { background: rgba(230,126,34,0.15); color: var(--yellow); }
.difficulty-badge--avancé       { background: rgba(192,57,43,0.12);  color: var(--red);    }

/* ── Pagination ── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}
.pagination__btn {
  padding: 0.35rem 0.9rem;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--blue);
  text-decoration: none;
  transition: background 0.15s;
}
.pagination__btn:hover              { background: rgba(42,95,165,0.07); }
.pagination__btn--disabled          { color: var(--muted); pointer-events: none; border-color: transparent; }
.pagination__info                   { font-size: 0.82rem; color: var(--muted); }

/* ── Paramètres de compte ── */
.settings-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.25rem;
}
.settings-card__title { font-size: 1rem; font-weight: 700; margin-bottom: 0.4rem; }
.settings-card__sub   { font-size: 0.82rem; color: var(--muted); margin-bottom: 1rem; }

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.settings-row:last-child           { border-bottom: none; }
.settings-row__label               { font-size: 0.85rem; font-weight: 500; }
.settings-row__value               { font-size: 0.85rem; color: var(--muted); }
.settings-row__value--private      { font-family: var(--font-mono); font-size: 0.8rem; }

.settings-form__row {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
}
.settings-form__input {
  flex: 1 1 200px;
  padding: 0.45rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.9rem;
  background: var(--bg);
}
.settings-form__input:focus        { outline: 2px solid var(--blue); border-color: transparent; }
.settings-form--stacked            { display: flex; flex-direction: column; gap: 0.75rem; }

/* ── Topbar user link ── */
.topbar__user--link {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  text-decoration: none;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.82rem;
  transition: color 0.15s;
  line-height: 1;
}
.topbar__user--link:hover { color: var(--blue); }
.topbar__avatar {
  width: 1.4rem;
  height: 1.4rem;
  flex-shrink: 0;
}

/* ── Leaderboard profile link ── */
.leaderboard__profile-link {
  color: inherit;
  text-decoration: none;
  font-weight: 500;
  transition: color 0.15s;
}
.leaderboard__profile-link:hover { color: var(--blue); text-decoration: underline; }

/* ── Admin : barre de recherche ── */
.admin-search-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}
.admin-search-form { display: flex; gap: 0.5rem; align-items: center; flex: 1 1 auto; }
.admin-search-form__input {
  flex: 1 1 200px;
  padding: 0.4rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.88rem;
  background: var(--bg);
}
.admin-search-form__input:focus { outline: 2px solid var(--blue); border-color: transparent; }
.admin-search-form__per-page {
  display: flex; align-items: center; gap: 0.4rem;
  font-size: 0.82rem; color: var(--muted); flex: 0 0 auto;
}
.admin-search-form__per-page select { flex: 0 0 auto; }

/* ── Admin : champs étroits dans le formulaire groupe ── */
.group-create-form__input--narrow { flex: 0 1 160px; }

/* ── Admin : table journal d'activité ── */
.audit-table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
.audit-table th {
  text-align: left;
  padding: 0.4rem 0.6rem;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
}
.audit-table td { padding: 0.5rem 0.6rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.audit-table tbody tr:last-child td { border-bottom: none; }
.audit-table tbody tr:hover { background: rgba(0,0,0,0.02); }
.audit-table__date { font-variant-numeric: tabular-nums; color: var(--muted); white-space: nowrap; }
.audit-badge {
  display: inline-block;
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.15em 0.55em;
  border-radius: 4px;
  background: var(--border);
  color: var(--text);
}
.audit-type { font-size: 0.72rem; color: var(--muted); }

/* ── Admin : grille stats groupe ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 1rem;
  margin-top: 0.75rem;
}
.stat-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  text-align: center;
}
.stat-card__value { font-size: 1.6rem; font-weight: 700; color: var(--blue); line-height: 1; margin-bottom: 0.3rem; }
.stat-card__label { font-size: 0.75rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; font-weight: 600; }

/* ── Admin : grille infos groupe ── */
.group-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.75rem 1.5rem;
}
.group-info-grid dt { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 700; margin-bottom: 0.15rem; }
.group-info-grid dd { font-weight: 600; font-size: 0.9rem; margin: 0 0 0.5rem; }

/* ── Page header nav ── */
.page-header__nav { margin-bottom: 0.75rem; }

/* ── Mot de passe : formulaire compact ── */
.settings-form--compact { max-width: 380px; }
/* flex-basis:200px inside a column-flex parent becomes a height — force single-line */
.settings-form--stacked .settings-form__input { flex: none; width: 100%; }

/* ── Sélecteur de pseudonyme ── */
.username-picker {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}
.username-option {
  padding: 0.45rem 1.1rem;
  border: 2px solid var(--border);
  border-radius: 8px;
  background: var(--card);
  color: var(--text);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.username-option:hover {
  border-color: var(--blue-light);
  background: rgba(42,95,165,0.06);
}
.username-option--selected {
  border-color: var(--blue);
  background: rgba(42,95,165,0.1);
  color: var(--blue);
}
.username-picker__footer {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 0.35rem;
  flex-wrap: wrap;
}
.username-picker__refresh {
  background: none;
  border: none;
  color: var(--blue);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.username-picker__refresh:hover { color: var(--blue-light); }
.username-picker__label { font-size: 0.75rem; font-weight: 600; margin-bottom: 0.4rem; }

/* ── Responsive ── */
@media (max-width: 700px) {
  .sidebar { display: none; }
  .main { margin-left: 0; padding: 1.5rem 1rem 3rem; }
  .auth-card { margin: 1.5rem auto; padding: 1.5rem; }
}

/* ── KPI bar ── */
.kpi-bar { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 1rem; margin-bottom: 2rem; }
.kpi-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem 1.5rem; }
.kpi-card__value { font-size: 2rem; font-weight: 800; color: var(--blue); line-height: 1; }
.kpi-card__label { font-size: 0.72rem; text-transform: uppercase; font-weight: 700; color: var(--muted); margin-top: 0.3rem; letter-spacing: 0.06em; }

/* ── Group filter tabs ── */
.filter-tabs { display: flex; gap: 0.5rem; margin-bottom: 1rem; flex-wrap: wrap; }
.filter-tab { padding: 0.3rem 0.8rem; border-radius: 20px; font-size: 0.82rem; font-weight: 600; border: 1px solid var(--border); background: var(--bg); color: var(--muted); text-decoration: none; transition: background 0.15s; }
.filter-tab--active { background: var(--blue); color: #fff; border-color: var(--blue); }
.filter-tab:hover:not(.filter-tab--active) { background: var(--border); }

/* ── Player compact table columns ── */
.admin-table__email { color: var(--muted); font-size: 0.82rem; max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.admin-table__date  { font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--muted); font-size: 0.82rem; }

/* ── Bulk action bar ── */
.bulk-bar { display: flex; align-items: center; gap: 0.75rem; padding: 0.6rem 1rem; background: var(--blue); border-radius: 8px; color: #fff; margin-top: 0.75rem; }
.bulk-bar__count  { font-weight: 600; font-size: 0.88rem; flex: 1; }
.bulk-bar__select { padding: 0.3rem 0.6rem; border-radius: 6px; border: none; font-family: inherit; font-size: 0.82rem; cursor: pointer; }

/* ── Password feedback (registration form) ── */
.pw-requirements { list-style: none; padding: 0; margin: 0.4rem 0 0.75rem; display: flex; flex-direction: column; gap: 0.2rem; }
.pw-requirements li { font-size: 0.78rem; color: var(--muted); padding-left: 1.2em; position: relative; }
.pw-requirements li::before { content: "✗"; position: absolute; left: 0; color: #e74c3c; }
.pw-requirements li.pw-req--ok::before { content: "✓"; color: #27ae60; }
.pw-requirements li.pw-req--ok { color: var(--text); }
.pw-match { font-size: 0.78rem; margin: 0.3rem 0 0; min-height: 1.1em; }
.pw-match--ok  { color: #27ae60; }
.pw-match--err { color: #e74c3c; }

/* ── Step checkboxes (progress edit page) ── */
.step-checks { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.step-check { display: inline-flex; align-items: center; gap: 0.25rem; font-size: 0.8rem;
  cursor: pointer; padding: 0.2rem 0.5rem; border-radius: 6px;
  border: 1px solid var(--border); background: var(--bg); user-select: none; }
.step-check:has(input:checked) { background: #27ae6018; border-color: #27ae6055; color: #27ae60; font-weight: 600; }

/* ── Sticky save bar (progress edit page) ── */
.admin-sticky-save { position: sticky; bottom: 0; background: var(--surface);
  border-top: 1px solid var(--border); padding: 0.75rem 1rem; margin-top: 1.5rem;
  display: flex; align-items: center; gap: 0.75rem; z-index: 10; }

/* ── Role badges (admin panel) ── */
.admin-badge--superadmin { background: #7c3aed22; color: #7c3aed; border-color: #7c3aed44; }
.admin-badge--instructor { background: #0ea5e922; color: #0ea5e9; border-color: #0ea5e944; }

/* ── Action menu dropdown (admin panel) ── */
.action-menu { position: relative; display: inline-block; }
.action-menu__toggle { list-style: none; cursor: pointer; padding: 0.3rem 0.6rem;
  border: 1px solid var(--border); border-radius: 8px; background: var(--card);
  color: var(--text); font-size: 0.9rem; line-height: 1; display: inline-flex; align-items: center; }
.action-menu__toggle:hover { background: var(--border); }
.action-menu__toggle::marker,
.action-menu__toggle::-webkit-details-marker { display: none; }
.action-menu__list { position: absolute; right: 0; z-index: 200; min-width: 210px;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 4px 16px rgba(0,0,0,.12); padding: 0.3rem 0; margin: 0.2rem 0 0; list-style: none; }
.action-menu__item { display: block; width: 100%; padding: 0.45rem 0.85rem; background: none;
  border: none; text-align: left; cursor: pointer; font-size: 0.82rem; color: var(--text);
  font-family: inherit; text-decoration: none; white-space: nowrap; }
.action-menu__item:hover { background: rgba(0,0,0,.05); }
.action-menu__item--danger { color: var(--red); }
.action-menu__item--warning { color: var(--yellow); }
.action-menu__sep { height: 1px; background: var(--border); margin: 0.3rem 0; }
.action-menu__pw-form { display: flex; align-items: center; gap: 0.4rem;
  padding: 0.35rem 0.85rem; }
.admin-inline-input { padding: 0.3rem 0.5rem; border: 1px solid var(--border); border-radius: 6px;
  font-family: inherit; font-size: 0.82rem; background: var(--bg); color: var(--text); width: 140px; }

/* ── Sort links (admin table headers) ── */
.sort-link { color: var(--muted); text-decoration: none; white-space: nowrap; }
.sort-link:hover { color: var(--text); }
.sort-link--active { color: var(--blue); font-weight: 600; }
