:root {
  color-scheme: light dark;
  --bg: #f3f6fa;
  --surface: #ffffff;
  --surface-2: #eef2f7;
  --text: #17212e;
  --muted: #5d6b7c;
  --border: #d9e1ea;
  --primary: #1d5fa8;
  --primary-hover: #174d89;
  --primary-ink: #ffffff;
  --accent: #e07b24;
  --ok: #1d7a46;
  --ok-bg: #e2f4ea;
  --wait: #9a6200;
  --wait-bg: #fdf1d9;
  --ko: #b3261e;
  --ko-bg: #fce6e4;
  --shadow: 0 1px 2px rgb(16 32 56 / 6%), 0 4px 16px rgb(16 32 56 / 6%);
  --radius: 14px;
  --font: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e141c;
    --surface: #17202b;
    --surface-2: #1f2a37;
    --text: #e7edf4;
    --muted: #9aa8b8;
    --border: #2b3847;
    --primary: #5aa2ec;
    --primary-hover: #7bb5f0;
    --primary-ink: #0b1622;
    --accent: #f29a4a;
    --ok: #6fd39b;
    --ok-bg: #133423;
    --wait: #f0c060;
    --wait-bg: #3a2c0d;
    --ko: #ff8d84;
    --ko-bg: #3d1714;
    --shadow: 0 1px 2px rgb(0 0 0 / 30%), 0 4px 16px rgb(0 0 0 / 25%);
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 var(--font);
  min-height: 100vh;
}

body.no-scroll {
  overflow: hidden;
}

#app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  color: var(--primary);
}

h1,
h2,
h3 {
  line-height: 1.25;
  margin: 0 0 0.5em;
}

h1 {
  font-size: 1.6rem;
}

h2 {
  font-size: 1.25rem;
}

h3 {
  font-size: 1.05rem;
}

img {
  max-width: 100%;
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 0.875rem;
}

.boot,
.spinner {
  padding: 3rem 1rem;
  text-align: center;
  color: var(--muted);
}

.spinner {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  justify-content: center;
}

.spinner-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* --- barre du haut ------------------------------------------------------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 0.6rem 16px;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
}

.brand svg {
  color: var(--primary);
}

.nav {
  display: flex;
  gap: 0.25rem;
}

.nav a {
  padding: 0.35rem 0.7rem;
  border-radius: 8px;
  color: var(--muted);
  text-decoration: none;
  font-weight: 500;
}

.nav a.active,
.nav a:hover {
  color: var(--text);
  background: var(--surface-2);
}

.user-zone {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-width: 0;
}

.user-name {
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 600px) {
  .topbar-inner {
    flex-wrap: wrap;
    row-gap: 0.4rem;
  }
  .brand span {
    display: none;
  }
  .user-name {
    display: none;
  }
  /* Sur mobile, le logo mène à l'accueil : place gagnée pour Orga + Déconnexion. */
  .nav-home {
    display: none;
  }
  .topbar-inner {
    gap: 0.5rem;
  }
  .nav a {
    padding: 0.35rem 0.55rem;
  }
}

/* --- mise en page -------------------------------------------------------- */

.main {
  flex: 1;
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding: 1.25rem 16px 3rem;
}

.main-wide {
  max-width: 960px;
}

.footer {
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
  padding: 1.5rem 16px 2rem;
  border-top: 1px solid var(--border);
}

.section {
  margin-top: 2.25rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.1rem 1.2rem;
}

.notice {
  text-align: center;
  color: var(--muted);
  margin: 1.25rem 0;
}

.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.page-head h1 {
  margin: 0;
}

.back {
  display: inline-block;
  margin-bottom: 0.8rem;
  text-decoration: none;
  font-weight: 500;
}

/* --- boutons et formulaires ---------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 0.6rem 1.1rem;
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--primary);
  color: var(--primary-ink);
}

.btn-primary:not(:disabled):hover {
  background: var(--primary-hover);
}

.btn-ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}

.btn-ghost:hover {
  background: var(--surface-2);
}

.btn-small {
  padding: 0.35rem 0.75rem;
  font-size: 0.875rem;
}

.btn-lg {
  padding: 0.8rem 1.4rem;
  font-size: 1.05rem;
}

.btn-block {
  width: 100%;
}

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

label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-weight: 500;
  font-size: 0.95rem;
}

input,
textarea {
  font: inherit;
  font-weight: 400;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.65rem 0.8rem;
  width: 100%;
}

input:focus,
textarea:focus {
  outline: 2px solid color-mix(in srgb, var(--primary) 45%, transparent);
  border-color: var(--primary);
}

textarea {
  resize: vertical;
}

.hint {
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 400;
}

.alert {
  border-radius: 10px;
  padding: 0.7rem 0.9rem;
  font-size: 0.95rem;
}

.alert.error {
  background: var(--ko-bg);
  color: var(--ko);
}

.alert.success {
  background: var(--ok-bg);
  color: var(--ok);
}

.auth-card {
  max-width: 420px;
  margin: 1.5rem auto;
  padding: 1.6rem 1.4rem;
}

.auth-switch {
  text-align: center;
  margin-bottom: 0;
}

/* --- badges -------------------------------------------------------------- */

.badge {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  white-space: nowrap;
}

.badge.ok {
  background: var(--ok-bg);
  color: var(--ok);
}

.badge.wait {
  background: var(--wait-bg);
  color: var(--wait);
}

.badge.ko {
  background: var(--ko-bg);
  color: var(--ko);
}

.badge.muted {
  background: var(--surface-2);
  color: var(--muted);
}

.badge.draft {
  background: transparent;
  color: var(--muted);
  border: 1px dashed var(--muted);
}

.enigma-card.is-draft {
  border-style: dashed;
  background: color-mix(in srgb, var(--surface) 60%, var(--bg));
}

.enigma-card.is-draft h2,
.enigma-card.is-draft p {
  color: var(--muted);
}

.draft-banner {
  margin: 0 0 0.8rem;
  font-size: 0.9rem;
  color: var(--muted);
}

.admin-chip {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.1rem 0.5rem;
  border-radius: 6px;
  background: color-mix(in srgb, var(--accent) 18%, transparent);
  color: var(--accent);
}

.phase {
  display: inline-block;
  font-weight: 600;
  font-size: 0.9rem;
  padding: 0.3rem 0.8rem;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
}

.phase-open {
  background: var(--ok-bg);
  color: var(--ok);
}

.phase-before {
  background: var(--wait-bg);
  color: var(--wait);
}

/* --- accueil ------------------------------------------------------------- */

.hero {
  position: relative;
  margin: -1.25rem -16px 0;
  min-height: 420px;
  display: flex;
  align-items: flex-end;
  color: #fff;
  background:
    linear-gradient(180deg, rgb(8 22 40 / 15%) 0%, rgb(8 22 40 / 78%) 100%),
    var(--hero-img, linear-gradient(160deg, #3d86d1, #1d5fa8)) center 20% / cover no-repeat;
}

@media (min-width: 992px) {
  .hero {
    margin: 0;
    border-radius: 0 0 var(--radius) var(--radius);
  }
}

.hero-inner {
  padding: 2.5rem 20px 2rem;
  max-width: 640px;
}

.hero h1 {
  font-size: clamp(2rem, 7vw, 3rem);
  margin-bottom: 0.4rem;
  text-shadow: 0 2px 12px rgb(0 0 0 / 35%);
}

.hero-kicker {
  margin: 0 0 0.4rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 0.85rem;
  opacity: 0.9;
}

.hero-dates {
  font-size: 1.1rem;
  margin: 0 0 0.9rem;
}

.hero .phase {
  background: rgb(255 255 255 / 92%);
  color: #17212e;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 1.2rem;
}

.hero .btn-ghost {
  color: #fff;
  border-color: rgb(255 255 255 / 60%);
  background: rgb(255 255 255 / 10%);
}

.hero .btn-primary {
  background: #fff;
  color: #174d89;
}

.lead {
  font-size: 1.08rem;
  max-width: 62ch;
}

.steps {
  list-style: none;
  padding: 0;
  margin: 1.25rem 0 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 0.9rem;
}

.steps li {
  display: flex;
  gap: 0.8rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
}

.steps h3 {
  margin-bottom: 0.25rem;
}

.steps p {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.step-num {
  flex: none;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 700;
  background: var(--primary);
  color: var(--primary-ink);
}

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0.6rem;
}

.gallery-item {
  padding: 0;
  border: 0;
  border-radius: 10px;
  overflow: hidden;
  aspect-ratio: 4 / 3;
  cursor: zoom-in;
  background: var(--surface-2);
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.25s;
}

.gallery-item:hover img {
  transform: scale(1.04);
}

/* --- énigmes ------------------------------------------------------------- */

.progress-card {
  margin-bottom: 1rem;
}

.progress-text {
  margin-bottom: 0.5rem;
}

.progress {
  height: 8px;
  border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
}

.progress span {
  display: block;
  height: 100%;
  background: var(--ok);
  border-radius: 999px;
  transition: width 0.3s;
}

.submit-form .progress span {
  background: var(--primary);
}

.enigma-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.enigma-card {
  display: flex;
  gap: 0.9rem;
  color: inherit;
  text-decoration: none;
  border-left: 4px solid var(--border);
  transition: transform 0.12s, border-color 0.12s;
}

.enigma-card:hover {
  transform: translateY(-1px);
  border-color: var(--primary);
}

.enigma-card.status-validated {
  border-left-color: var(--ok);
}

.enigma-card.status-pending {
  border-left-color: var(--wait);
}

.enigma-card.status-rejected {
  border-left-color: var(--ko);
}

.enigma-num {
  flex: none;
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-weight: 700;
  background: var(--surface-2);
  color: var(--primary);
}

.enigma-body {
  flex: 1;
  min-width: 0;
}

.enigma-body p {
  margin: 0.15rem 0 0.4rem;
  font-size: 0.93rem;
}

.enigma-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.6rem;
}

.enigma-top h2 {
  font-size: 1.05rem;
  margin: 0;
}

.enigma-top h1 {
  margin: 0;
}

.enigma-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.9rem;
  font-size: 0.83rem;
  color: var(--muted);
}

.enigma-detail .enigma-meta {
  margin: 0.4rem 0 0.9rem;
}

/* Politique de confidentialité */

.privacy h1 {
  font-size: 1.4rem;
}

.privacy h2 {
  font-size: 1.1rem;
  margin-top: 1.4rem;
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
  margin: 0.6rem 0;
  display: block;
  overflow-x: auto;
}

.prose th,
.prose td {
  text-align: left;
  vertical-align: top;
  padding: 0.4rem 0.6rem;
  border-bottom: 1px solid var(--border);
}

.consent {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.consent h1 {
  margin-bottom: 0.4rem;
}

.consent-summary {
  margin: 0.4rem 0 0;
  padding-left: 1.2rem;
}

.consent-text {
  max-height: 55vh;
  overflow-y: auto;
}

.consent-actions .actions {
  margin-top: 0.8rem;
}

.consent-actions p {
  margin: 0.8rem 0 0;
}

.privacy-details summary {
  cursor: pointer;
  color: var(--primary);
  font-weight: 500;
  font-size: 0.95rem;
}

.privacy-details .consent-text {
  margin-top: 0.6rem;
  max-height: 40vh;
  padding: 0.8rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 0.9rem;
}

label.radio span {
  font-weight: 400;
  font-size: 0.92rem;
}

label.radio:has(span) {
  align-items: flex-start;
}

label.radio input[type="checkbox"] {
  margin-top: 0.15rem;
  flex: none;
  width: 1.1rem;
  height: 1.1rem;
}

.answer {
  margin: 0 0 0.9rem;
  padding: 0.5rem 0.7rem;
  border-radius: 10px;
  border: 1px dashed color-mix(in srgb, var(--accent) 50%, transparent);
  font-size: 0.93rem;
}

.prose {
  overflow-wrap: anywhere;
}

.prose > :first-child {
  margin-top: 0;
}

.prose > :last-child {
  margin-bottom: 0;
}

.prose img {
  border-radius: 10px;
}

.prose blockquote {
  margin: 1rem 0;
  padding: 0.2rem 1rem;
  border-left: 3px solid var(--primary);
  color: var(--muted);
}

/* --- soumission ---------------------------------------------------------- */

.submit-form {
  margin-top: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.submit-form h2 {
  margin: 0;
}

.submit-form p {
  margin: 0;
}

.picker {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 0.6rem;
}

.picker-item,
.picker-add {
  position: relative;
  aspect-ratio: 1;
  border-radius: 10px;
  overflow: hidden;
  background: var(--surface-2);
}

.picker-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.picker-item img.broken {
  visibility: hidden;
}

.picker-name {
  position: absolute;
  inset: auto 0 0;
  padding: 0.25rem 0.4rem;
  font-size: 0.68rem;
  line-height: 1.3;
  color: #fff;
  background: linear-gradient(transparent, rgb(0 0 0 / 70%));
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.picker-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 0;
  background: rgb(0 0 0 / 60%);
  color: #fff;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
}

.picker-add {
  border: 2px dashed var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.1rem;
  font-size: 0.85rem;
  color: var(--primary);
  cursor: pointer;
  text-align: center;
  padding: 0.4rem;
}

.picker-add:hover {
  border-color: var(--primary);
}

.picker-add input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.picker-plus {
  font-size: 2rem;
  line-height: 1;
}

.history {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.submission {
  border-left: 4px solid var(--wait);
}

.submission.status-validated {
  border-left-color: var(--ok);
}

.submission.status-rejected {
  border-left-color: var(--ko);
}

.submission-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.7rem;
  font-size: 0.9rem;
}

.thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.thumb {
  padding: 0;
  border: 0;
  width: 92px;
  height: 92px;
  border-radius: 8px;
  overflow: hidden;
  cursor: zoom-in;
  background: var(--surface-2);
}

.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.photo-meta {
  margin: 0.5rem 0 0;
  padding-left: 1.1rem;
}

.comment {
  margin: 0.7rem 0 0;
  white-space: pre-wrap;
}

.review {
  margin-top: 0.7rem;
  padding: 0.6rem 0.8rem;
  border-radius: 10px;
  font-size: 0.93rem;
}

.review p {
  margin: 0.2rem 0 0;
  white-space: pre-wrap;
}

.review.rejected {
  background: var(--ko-bg);
  color: var(--ko);
}

.review.validated {
  background: var(--ok-bg);
  color: var(--ok);
}

/* --- visionneuse --------------------------------------------------------- */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgb(5 10 18 / 92%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 0.5rem 1rem;
}

.lightbox img {
  max-width: 100%;
  max-height: calc(100vh - 7rem);
  object-fit: contain;
  border-radius: 6px;
}

.lightbox-caption {
  color: #dfe7f0;
  font-size: 0.9rem;
  margin-top: 0.6rem;
  text-align: center;
}

.lightbox-close,
.lightbox-nav {
  position: absolute;
  border: 0;
  background: rgb(255 255 255 / 14%);
  color: #fff;
  border-radius: 50%;
  width: 44px;
  height: 44px;
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
}

.lightbox-close {
  top: 0.6rem;
  right: 0.6rem;
}

.lightbox-nav {
  top: 50%;
  transform: translateY(-50%);
}

.lightbox-nav.prev {
  left: 0.5rem;
}

.lightbox-nav.next {
  right: 0.5rem;
}

/* --- organisateurs ------------------------------------------------------- */

.strong {
  font-weight: 600;
}

.warn-text {
  color: var(--wait);
  font-weight: 600;
}

.admin-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
  margin: 0.2rem 0 0.9rem;
}

.tabs {
  display: flex;
  gap: 0.25rem;
  margin-bottom: 1.1rem;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}

.tabs a {
  padding: 0.55rem 0.8rem;
  color: var(--muted);
  text-decoration: none;
  font-weight: 600;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

.tabs a.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-bottom: 1rem;
}

.segmented {
  display: inline-flex;
  background: var(--surface-2);
  border-radius: 10px;
  padding: 3px;
  gap: 2px;
  flex-wrap: wrap;
}

.segmented button {
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 600;
  font-size: 0.88rem;
  padding: 0.35rem 0.75rem;
  border-radius: 8px;
  cursor: pointer;
}

.segmented.small button {
  font-size: 0.8rem;
  padding: 0.2rem 0.6rem;
}

.segmented button.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
}

select {
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.45rem 0.7rem;
  max-width: 100%;
}

.btn-success {
  background: var(--ok);
  color: #fff;
}

.btn-danger {
  background: var(--ko);
  color: #fff;
}

@media (prefers-color-scheme: dark) {
  .btn-success,
  .btn-danger {
    color: #0b1622;
  }
}

.btn-ghost-danger {
  background: transparent;
  color: var(--ko);
  border-color: color-mix(in srgb, var(--ko) 45%, transparent);
}

.btn-ghost-danger:hover {
  background: var(--ko-bg);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.9rem;
}

.review-list {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.review-card .answer {
  margin-bottom: 0.8rem;
}

.thumbs.large .thumb {
  width: 150px;
  height: 150px;
}

@media (max-width: 600px) {
  .thumbs.large .thumb {
    width: calc(50% - 0.25rem);
    height: auto;
    aspect-ratio: 1;
  }
}

.reject-form {
  margin-top: 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  padding: 0.9rem;
  border-radius: 10px;
  background: var(--surface-2);
}

.reject-form .actions {
  margin-top: 0;
}

fieldset {
  border: 0;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

legend {
  font-weight: 600;
  margin-bottom: 0.3rem;
}

label.radio {
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
  font-weight: 400;
}

label.radio input {
  width: auto;
  margin: 0;
}

.search {
  margin-bottom: 0.9rem;
}

.user-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.user-card {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  color: inherit;
  text-decoration: none;
  padding: 0.8rem 1rem;
}

.user-card:hover {
  border-color: var(--primary);
}

.user-main {
  min-width: 0;
}

.user-main .small {
  overflow-wrap: anywhere;
}

.user-counts {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 1rem;
  color: var(--muted);
}

.user-counts strong {
  color: var(--text);
}

.user-detail h1 {
  margin-bottom: 0.15rem;
}

.user-detail .user-counts {
  margin: 0.9rem 0;
}

.admin-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.2rem;
  margin-top: 0.9rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--border);
}

.admin-actions h2 {
  font-size: 1rem;
}

.inline-form {
  display: flex;
  gap: 0.5rem;
}

.inline-form input {
  flex: 1;
  min-width: 0;
}

/* Éditeur d'énigme */

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.8rem;
}

.label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: -0.6rem;
}

.label-row .label {
  font-weight: 500;
  font-size: 0.95rem;
}

.mono {
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 0.9rem;
}

.preview {
  border: 1px dashed var(--border);
  border-radius: 10px;
  padding: 0.8rem;
  min-height: 10rem;
}

.enigma-editor h1 {
  margin: 0;
}

.enigma-editor .actions {
  margin-top: 0;
}

/* Statistiques */

.kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 0.6rem;
}

.stat-tile {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  padding: 0.9rem 1rem;
  color: inherit;
  text-decoration: none;
}

a.stat-tile:hover {
  border-color: var(--primary);
}

.stat-value {
  font-size: 1.9rem;
  font-weight: 700;
  line-height: 1.1;
}

.stat-label {
  color: var(--muted);
  font-size: 0.88rem;
}

.chart {
  margin: 0;
}

.chart figcaption {
  font-weight: 600;
  margin-bottom: 0.8rem;
}

/* Colonnes : 24 px max., extrémité arrondie, base carrée, 2 px d'écart. */
.columns,
.columns-axis {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  gap: 2px;
}

.columns {
  height: 160px;
  align-items: end;
  border-bottom: 1px solid var(--border);
}

.col {
  position: relative;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  outline: none;
}

.col-bar {
  width: 100%;
  max-width: 24px;
  background: var(--primary);
  border-radius: 4px 4px 0 0;
}

.col:hover .col-bar,
.col:focus .col-bar {
  background: var(--primary-hover);
}

.col-value {
  font-size: 0.75rem;
  color: var(--muted);
  line-height: 1.4;
}

.columns-axis span {
  text-align: center;
  font-size: 0.72rem;
  color: var(--muted);
  padding-top: 0.25rem;
}

.axis-title {
  text-align: center;
  margin-top: 0.1rem;
}

.tip {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  white-space: nowrap;
  background: var(--text);
  color: var(--surface);
  font-size: 0.78rem;
  padding: 0.3rem 0.55rem;
  border-radius: 6px;
  pointer-events: none;
  /* display: none tant qu'elle est cachée : sinon elle élargit la page sur mobile. */
  display: none;
}

.col .tip {
  bottom: auto;
  top: 0;
}

.col.tip-end .tip {
  left: auto;
  right: 0;
  transform: none;
}

.col.tip-start .tip {
  left: 0;
  transform: none;
}

.col:hover .tip,
.col:focus .tip,
.hbar:hover .tip,
.hbar:focus .tip {
  display: block;
}

.data-table {
  margin-top: 0.8rem;
  font-size: 0.88rem;
}

.data-table summary {
  cursor: pointer;
  color: var(--primary);
}

.data-table table {
  margin-top: 0.5rem;
  border-collapse: collapse;
}

.data-table td,
.data-table th {
  padding: 0.2rem 0.8rem 0.2rem 0;
  text-align: left;
}

.table-wrap {
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.stats-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.stats-table th,
.stats-table td {
  padding: 0.55rem 0.7rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.stats-table tr:last-child td {
  border-bottom: 0;
}

.stats-table th {
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 600;
}

.stats-table td:first-child a {
  white-space: normal;
}

.stats-table tr.muted td {
  color: var(--muted);
}

.bar-col {
  min-width: 150px;
  width: 35%;
}

/* Barre horizontale : base carrée à gauche, extrémité arrondie, valeur hors de la barre. */
.hbar {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  outline: none;
}

.hbar-track {
  flex: 1;
  min-width: 0;
}

.hbar-fill {
  display: block;
  height: 12px;
  background: var(--primary);
  border-radius: 0 4px 4px 0;
}

.hbar-value {
  min-width: 1.6rem;
}

.hbar:hover .hbar-fill,
.hbar:focus .hbar-fill {
  background: var(--primary-hover);
}

.hbar-value {
  font-variant-numeric: tabular-nums;
}

.hbar .tip {
  left: 0;
  transform: none;
}
