/* CITY QUEST — design system (voir docs/DESIGN_SYSTEM.md). Thème clair, orange vif, mobile d'abord. */

:root {
    --bg: #f6f6f8;
    --surface: #ffffff;
    --surface-2: #f1f1f4;
    --border: #e6e6ec; /* séparateurs décoratifs */
    --field-border: #7c7c88; /* bordure des champs : 4,1:1 sur blanc (WCAG 1.4.11) */
    --text: #15151a;
    --text-muted: #6b6b78;
    --primary: #ff7a00;
    --primary-hover: #ff8f26;
    --primary-soft: #fff1e4;
    --primary-ink: #15151a; /* texte sombre sur orange : 6,96:1 (blanc : 2,6:1, non conforme AA) */
    --primary-text: #a84d00; /* orange foncé pour le texte sur fond clair : ≥ 5:1 */
    --success: #157a42;
    --success-soft: #e5f6ec;
    --warning: #8a5a0f;
    --warning-soft: #fff6d6;
    --danger: #b03030;
    --danger-soft: #fdeaea;
    --info: #1a5fc8;
    --info-soft: #e7f0ff;
    --purple: #6d28d9;
    --purple-soft: #f1eafe;
    --yellow: #ffc83d;
    --radius: 18px;
    --radius-sm: 12px;
    --shadow: 0 6px 20px rgba(21, 21, 26, .07);
    --shadow-strong: 0 10px 28px rgba(255, 122, 0, .28);
    --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --bottom-nav-h: 68px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 16px/1.5 var(--font);
    padding-bottom: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom));
}
@media (min-width: 900px) { body { padding-bottom: 0; } }
img { max-width: 100%; height: auto; display: block; }
a { color: var(--primary-text); text-decoration: none; }
a:hover { color: var(--primary-text); text-decoration: underline; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .6em; font-weight: 800; letter-spacing: -.01em; }
h1 { font-size: clamp(1.6rem, 4vw, 2.2rem); }
h2 { font-size: clamp(1.15rem, 3vw, 1.4rem); }
h3 { font-size: 1.05rem; }
p { margin: 0 0 1em; }
/* Anneau sombre (contraste ≥ 3:1 sur fond clair et sur orange) + halo orange de marque. */
:focus-visible { outline: 3px solid var(--text); outline-offset: 2px; box-shadow: 0 0 0 6px rgba(255, 122, 0, .35); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: -999px; top: 8px; background: var(--primary); color: var(--primary-ink); padding: 8px 12px; border-radius: var(--radius-sm); z-index: 100; }
.skip-link:focus { left: 8px; }

/* --- Mise en page --- */
.container { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.container-narrow { max-width: 560px; }
.center-block { margin-left: auto; margin-right: auto; }
main { padding: 16px 0 32px; min-height: 60vh; }
.stack > * + * { margin-top: 16px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row-between { justify-content: space-between; }
.grid { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 640px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 960px) { .grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.muted { color: var(--text-muted); }
.small { font-size: .875rem; }
.xsmall { font-size: .78rem; }
.text-center { text-align: center; }
.mt-0 { margin-top: 0; } .mb-0 { margin-bottom: 0; }

/* --- En-tête --- */
.topbar { position: sticky; top: 0; z-index: 50; background: rgba(255, 255, 255, .94); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); }
.topbar .container { display: flex; align-items: center; justify-content: space-between; height: 58px; gap: 12px; }
.brand { font-weight: 900; letter-spacing: .02em; color: var(--text); font-size: 1.2rem; font-style: italic; white-space: nowrap; }
.brand span { color: var(--primary); }
.brand:hover { text-decoration: none; color: var(--text); }
.topnav { display: none; gap: 4px; }
.topnav a { color: var(--text-muted); padding: 8px 12px; border-radius: 999px; font-weight: 600; }
.topnav a:hover, .topnav a.active { color: var(--primary-text); background: var(--primary-soft); text-decoration: none; }
@media (min-width: 900px) { .topnav { display: flex; } }
.top-actions { display: flex; gap: 8px; align-items: center; }
.icon-btn { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 50%; background: var(--surface-2); color: var(--text); flex: 0 0 auto; }
.icon-btn:hover { text-decoration: none; color: var(--primary-text); }
.icon-btn .dot { position: absolute; top: 2px; right: 2px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9px; background: var(--primary); color: var(--primary-ink); font-size: .7rem; font-weight: 700; line-height: 18px; text-align: center; }
.icon-btn img { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; }
.city-select { display: inline-flex; align-items: center; gap: 6px; font-weight: 800; font-size: 1.1rem; color: var(--text); }
.city-select::before { content: ""; width: 12px; height: 12px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); background: var(--primary); }

/* --- Navigation mobile (5 entrées : Carte, Quêtes, Équipes, Récompenses, Profil) --- */
.bottom-nav { position: fixed; bottom: 0; left: 0; right: 0; z-index: 60; display: grid; grid-template-columns: repeat(5, 1fr); height: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); background: var(--surface); border-top: 1px solid var(--border); box-shadow: 0 -4px 16px rgba(21, 21, 26, .05); }
.bottom-nav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--text-muted); font-size: .72rem; font-weight: 600; }
.bottom-nav a .ico { font-size: 1.3rem; line-height: 1; filter: grayscale(1); opacity: .75; }
.bottom-nav a.active, .bottom-nav a:hover { color: var(--primary-text); text-decoration: none; }
.bottom-nav a.active .ico { filter: none; opacity: 1; }
@media (min-width: 900px) { .bottom-nav { display: none; } }

/* --- Pied de page --- */
.footer { border-top: 1px solid var(--border); padding: 24px 0; color: var(--text-muted); font-size: .9rem; background: var(--surface); }
.footer nav { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-bottom: 8px; }
.footer a { color: var(--text-muted); }

/* --- Boutons --- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 10px 20px; border: 1.5px solid transparent; border-radius: 999px; font: inherit; font-weight: 700; cursor: pointer; text-decoration: none; transition: background .15s, color .15s, border-color .15s, box-shadow .15s; }
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--primary); color: var(--primary-ink); box-shadow: var(--shadow-strong); }
.btn-primary:hover { background: var(--primary-hover); color: var(--primary-ink); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-secondary:hover { border-color: var(--primary); color: var(--primary-text); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--text); }
.btn-ghost:hover { color: var(--primary-text); border-color: var(--primary); }
.btn-soft { background: var(--primary-soft); color: var(--primary-text); }
.btn-soft:hover { background: var(--primary); color: var(--primary-ink); }
.btn-danger { background: transparent; color: var(--danger); border-color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-sm { min-height: 44px; padding: 6px 14px; font-size: .875rem; box-shadow: none; }
.btn-lg { min-height: 54px; font-size: 1.05rem; }
.btn-block { width: 100%; }
.btn[disabled], .btn.disabled { opacity: .5; cursor: not-allowed; pointer-events: none; }
.link-btn { background: none; border: 0; padding: 0; color: var(--primary-text); font: inherit; cursor: pointer; }
.inline-form { display: inline; }

/* --- Cartes --- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.card-header { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.card-header h2, .card-header h3 { margin: 0; }
.card-link { display: block; color: inherit; }
.card-link:hover { text-decoration: none; color: inherit; }
a.card:hover, .card.card-link:hover { border-color: var(--primary); }
.card-cover { margin: -18px -18px 14px; border-radius: var(--radius) var(--radius) 0 0; overflow: hidden; aspect-ratio: 16 / 9; background: var(--surface-2); }
.card-cover img { width: 100%; height: 100%; object-fit: cover; }
.mission-card .meta, .meta { display: flex; flex-wrap: wrap; gap: 6px 12px; margin: 8px 0; align-items: center; }
.points { font-weight: 800; color: var(--primary-text); }
.xp::before { content: "★ "; color: var(--primary); }

/* Ligne de liste avec vignette (Quêtes, Récompenses, Équipes) */
.media-item { display: flex; gap: 14px; align-items: stretch; padding: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); color: inherit; position: relative; }
.media-item:hover { text-decoration: none; color: inherit; border-color: var(--primary); }
.media-thumb { flex: 0 0 88px; width: 88px; height: 88px; border-radius: var(--radius-sm); overflow: hidden; background: var(--surface-2); }
.media-thumb img { width: 100%; height: 100%; object-fit: cover; }
.media-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.media-title { font-weight: 800; font-size: 1rem; margin: 0; overflow-wrap: anywhere; }
.media-aside { display: flex; flex-direction: column; justify-content: space-between; align-items: flex-end; gap: 8px; }
.media-list { display: grid; gap: 12px; }
@media (min-width: 900px) { .media-list { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.meta-item { display: inline-flex; align-items: center; gap: 4px; color: var(--text-muted); font-size: .85rem; }

/* --- Écran d'accueil (visiteur) --- */
.hero { padding: 24px 0; }
.hero h1 { font-size: clamp(2.4rem, 10vw, 4rem); font-weight: 900; font-style: italic; line-height: .95; transform: rotate(-4deg); margin-bottom: 8px; }
.hero h1 em { font-style: italic; color: var(--primary); display: block; }
.hero .tagline { font-weight: 800; font-style: italic; transform: rotate(-4deg); text-transform: uppercase; letter-spacing: .02em; }
.hero p { color: var(--text-muted); font-size: 1.1rem; max-width: 40rem; }
.hero-banner { background: linear-gradient(160deg, #15151a 0%, #2a1a0c 100%); color: #fff; border-radius: 28px; padding: 28px 22px; overflow: hidden; position: relative; }
.hero-banner p { color: #e6e6ec; }
.hero-banner .hero-words { font-weight: 900; font-style: italic; font-size: clamp(1.5rem, 6vw, 2.2rem); line-height: 1.05; text-transform: uppercase; transform: rotate(-4deg); margin: 18px 0; }
.hero-words span { display: block; color: #fff; }
.hero-words span:nth-child(odd) { color: var(--yellow); }
.steps-list { counter-reset: step; list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.steps-list li { counter-increment: step; display: flex; gap: 12px; align-items: flex-start; }
.steps-list li::before { content: counter(step); flex: 0 0 32px; height: 32px; border-radius: 50%; background: var(--primary); color: var(--primary-ink); font-weight: 800; display: flex; align-items: center; justify-content: center; }

/* --- Puces / filtres / onglets --- */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 6px; margin-bottom: 14px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { display: inline-flex; align-items: center; min-height: 44px; gap: 6px; padding: 8px 16px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); color: var(--text); font-weight: 600; font-size: .9rem; white-space: nowrap; }
.chip:hover { text-decoration: none; border-color: var(--primary); color: var(--primary-text); }
.chip.active { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.tabs { display: flex; gap: 8px; overflow-x: auto; margin-bottom: 16px; padding-bottom: 4px; scrollbar-width: none; }
.tabs a { display: inline-flex; align-items: center; min-height: 44px; padding: 8px 16px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); color: var(--text); white-space: nowrap; font-size: .9rem; font-weight: 600; }
.tabs a.active, .tabs a:hover { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); text-decoration: none; }
.segmented { display: flex; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.segmented a { flex: 1; text-align: center; padding: 10px 8px; color: var(--text-muted); font-weight: 700; border-bottom: 3px solid transparent; margin-bottom: -1px; }
.segmented a.active, .segmented a:hover { color: var(--primary-text); border-bottom-color: var(--primary); text-decoration: none; }
.search-field { position: relative; }
/* Sélecteur renforcé : doit l'emporter sur la règle générique input[type=search] déclarée plus bas. */
.search-field input, .search-field input[type=search] { padding-left: 42px; border-radius: 999px; background: var(--surface); }
.search-field::before { content: "⌕"; position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-size: 1.2rem; pointer-events: none; }

/* --- Badges / étiquettes --- */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 999px; font-size: .74rem; font-weight: 700; background: var(--surface-2); color: var(--text-muted); border: 1px solid transparent; white-space: nowrap; }
.badge-primary { background: var(--primary-soft); color: var(--primary-text); }
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-info { background: var(--info-soft); color: var(--info); }
.badge-purple { background: var(--purple-soft); color: var(--purple); }
/* Étiquette de catégorie pleine (ÉNIGME, DÉFI PHOTO, LIEU MYSTÈRE, QUIZ…) */
.tag { display: inline-block; padding: 3px 10px; border-radius: 6px; font-size: .7rem; font-weight: 900; letter-spacing: .04em; text-transform: uppercase; background: var(--yellow); color: #3a2a00; }
.tag-answer { background: var(--yellow); color: #3a2a00; }
.tag-manual { background: #e11d74; color: #fff; }
.tag-qr { background: var(--success); color: #fff; }
.tag-code { background: var(--purple); color: #fff; }
.tag-event { background: #15151a; color: #fff; }
.tag-discount { background: #c4363b; color: #fff; }
.tag-experience { background: var(--success); color: #fff; }
.tag-gift { background: var(--info); color: #fff; }
.tag-invitation, .tag-access { background: var(--purple); color: #fff; }
.tag-voucher { background: var(--primary); color: var(--primary-ink); }

/* --- Formulaires --- */
.form { display: grid; gap: 16px; }
.form-group { display: grid; gap: 6px; }
/* Champ mot de passe avec œil « afficher / masquer » (app.js) */
.password-wrap { position: relative; display: block; }
.password-wrap input { width: 100%; padding-right: 52px; }
.password-eye { position: absolute; top: 50%; right: 6px; transform: translateY(-50%); width: 44px; height: 44px;
                border: 0; border-radius: var(--radius-sm); background: transparent; cursor: pointer; font-size: 1.15rem;
                opacity: .55; line-height: 1; }
.password-eye:hover, .password-eye:focus-visible, .password-eye.is-on { opacity: 1; background: var(--surface-2); }
.streak-card { display: flex; align-items: center; gap: 14px; }
.streak-flame { font-size: 2rem; line-height: 1; }
.form-row { display: grid; gap: 16px; }
@media (min-width: 640px) { .form-row { grid-template-columns: 1fr 1fr; } }
label, legend { font-weight: 700; font-size: .95rem; }
fieldset { border: 0; padding: 0; margin: 0; }
.hint { color: var(--text-muted); font-size: .85rem; font-weight: 400; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=datetime-local], input[type=url], input[type=search], input[type=file], select, textarea {
    width: 100%; min-height: 48px; padding: 10px 14px; border: 1px solid var(--field-border); border-radius: var(--radius-sm);
    background: var(--surface); color: var(--text); font: inherit; font-size: 16px; /* 16px évite le zoom iOS */
}
textarea { min-height: 120px; resize: vertical; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid var(--text); outline-offset: 1px; border-color: var(--text); box-shadow: 0 0 0 6px rgba(255, 122, 0, .25); }
.checkbox { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; }
.checkbox input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--primary); flex: 0 0 auto; }
.field-error { color: var(--danger); font-size: .85rem; }
.has-error input, .has-error select, .has-error textarea { border-color: var(--danger); }
.hp-field { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; margin-bottom: 16px; }
.filters .form-group { flex: 1 1 160px; }

/* --- Alertes --- */
.alert { padding: 12px 16px; border-radius: var(--radius-sm); border: 1px solid transparent; margin-bottom: 12px; }
.alert-success { background: var(--success-soft); color: #145c33; }
.alert-error { background: var(--danger-soft); color: #8a2323; }
.alert-info { background: var(--info-soft); color: #1b4d99; }
.alert-warning { background: var(--warning-soft); color: #6b4a10; }

/* --- Progression, statistiques --- */
progress.progress { -webkit-appearance: none; appearance: none; width: 100%; height: 8px; border: 0; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
progress.progress::-webkit-progress-bar { background: var(--surface-2); border-radius: 999px; }
progress.progress::-webkit-progress-value { background: var(--primary); border-radius: 999px; }
progress.progress::-moz-progress-bar { background: var(--primary); border-radius: 999px; }
.stat { display: grid; gap: 2px; min-width: 0; }
.stat-value { font-size: 1.6rem; font-weight: 900; line-height: 1.1; }
.stat-value-text { font-size: 1.1rem; overflow-wrap: anywhere; }
.stat-label { color: var(--text-muted); font-size: .82rem; }
.stats { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 900px) { .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
/* Bandeau de compteurs (profil, équipe) */
.counters { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); text-align: center; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.counters > * { padding: 14px 4px; display: grid; gap: 2px; color: inherit; }
.counters > * + * { border-left: 1px solid var(--border); }
.counters strong { font-size: 1.3rem; font-weight: 900; }
.counters span { font-size: .75rem; color: var(--text-muted); }
a.counter:hover { text-decoration: none; color: var(--primary-text); }

/* --- Étapes numérotées (mission en cours) --- */
.stepper { display: flex; align-items: center; justify-content: center; gap: 0; margin: 8px 0 16px; list-style: none; padding: 0; }
.stepper li { display: flex; align-items: center; }
.stepper li + li::before { content: ""; width: 40px; height: 2px; background: var(--border); }
.stepper li.done + li::before, .stepper li.current::before { background: var(--primary); }
.stepper .dot { width: 38px; height: 38px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 800; background: var(--surface); border: 2px solid var(--border); color: var(--text-muted); }
.stepper li.current .dot, .stepper li.done .dot { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
/* Tuiles d'action (Prends une photo / Scanne le QR / Entre le mot secret) */
.action-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.action-tile { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 6px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); text-align: center; font-size: .82rem; color: var(--text); }
.action-tile .ico { font-size: 1.5rem; }
.action-tile.active { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-text); font-weight: 700; }
.action-tile.disabled { opacity: .45; }
/* Liste « Ce que tu vas faire » */
.icon-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.icon-list li { display: flex; gap: 12px; align-items: center; }
.icon-list .ico { flex: 0 0 32px; height: 32px; border-radius: 10px; background: var(--primary-soft); color: var(--primary-text); display: flex; align-items: center; justify-content: center; }
.hint-box { display: flex; gap: 12px; align-items: flex-start; padding: 14px; border-radius: var(--radius-sm); background: var(--primary-soft); }
.reward-box { display: flex; gap: 12px; align-items: center; padding: 14px; border-radius: var(--radius-sm); background: var(--surface-2); }
.reward-box .ico { font-size: 1.8rem; }

/* --- Classement : podium --- */
.podium { display: grid; grid-template-columns: 1fr 1.15fr 1fr; gap: 8px; align-items: end; text-align: center; margin: 8px 0 16px; }
.podium-place { display: grid; justify-items: center; gap: 4px; min-width: 0; }
.podium-place .avatar { width: 64px; height: 64px; border: 3px solid var(--border); }
.podium-place.first .avatar { width: 84px; height: 84px; border-color: var(--yellow); box-shadow: 0 0 0 4px rgba(255, 200, 61, .25); }
.podium-place.second .avatar { border-color: #b8c0cc; }
.podium-place.third .avatar { border-color: #d08a4a; }
.podium-place .crown { font-size: 1.2rem; line-height: 1; }
.podium-place .name { font-weight: 800; font-size: .9rem; overflow-wrap: anywhere; }
.podium-place.first .score { color: var(--primary-text); font-weight: 900; }
.rank-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.rank-list li { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--surface); }
.rank-list li.is-me { background: var(--primary-soft); font-weight: 700; }
.rank-list .rank-num { width: 26px; font-weight: 800; color: var(--text-muted); text-align: center; }
.rank-list .rank-name { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.rank-list .rank-score { font-weight: 700; font-variant-numeric: tabular-nums; }

/* --- Badges de profil (hexagones) --- */
.hex-badges { display: flex; gap: 12px; flex-wrap: wrap; }
.hex { width: 58px; height: 64px; clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%); display: flex; align-items: center; justify-content: center; font-size: 1.5rem; background: var(--primary); color: var(--primary-ink); }
.hex-2 { background: var(--purple); } .hex-3 { background: var(--info); } .hex-4 { background: var(--success); } .hex-5 { background: #15151a; }
.hex.locked { background: var(--surface-2); filter: grayscale(1); opacity: .6; }

/* --- Tableaux --- */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.table th, .table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table th { color: var(--text-muted); font-weight: 700; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; background: var(--surface-2); }
.table tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.rank { font-weight: 900; width: 48px; }
.rank-1 { color: #c99400; } .rank-2 { color: #7d8794; } .rank-3 { color: #b0662a; }
tr.is-me td { background: var(--primary-soft); }

/* --- Listes, divers --- */
.list { list-style: none; margin: 0; padding: 0; }
.list > li { display: flex; gap: 12px; align-items: center; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid var(--border); }
.list > li:last-child { border-bottom: 0; }
.page-header { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.page-header h1 { margin: 0; }
.back-link { display: inline-flex; align-items: center; gap: 6px; color: var(--text); font-weight: 700; margin-bottom: 8px; }
.empty-state { text-align: center; padding: 32px 16px; color: var(--text-muted); border: 1px dashed var(--border); border-radius: var(--radius); background: var(--surface); }
.avatar { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; background: var(--surface-2); flex: 0 0 auto; }
.avatar-lg { width: 104px; height: 104px; }
.avatar-sm { width: 32px; height: 32px; }
.avatar-stack { display: flex; }
.avatar-stack .avatar { width: 36px; height: 36px; border: 2px solid var(--surface); margin-left: -8px; }
.avatar-stack .avatar:first-child { margin-left: 0; }
.pagination { display: flex; gap: 8px; justify-content: center; margin-top: 16px; }
.code-box { font-family: ui-monospace, Consolas, monospace; font-size: 1.4rem; letter-spacing: .15em; padding: 12px 16px; background: var(--primary-soft); border: 1.5px dashed var(--primary); border-radius: var(--radius-sm); text-align: center; word-break: break-all; color: var(--text); }
.prose { white-space: pre-line; }
.divider { border: 0; border-top: 1px solid var(--border); margin: 20px 0; }
.notif-unread { border-left: 3px solid var(--primary); padding-left: 12px; }
details > summary { cursor: pointer; font-weight: 700; }
.promo-card { display: flex; gap: 14px; align-items: center; padding: 16px; border-radius: var(--radius); background: var(--primary-soft); color: var(--text); }
.promo-card:hover { text-decoration: none; color: var(--text); }
.promo-card .ico { font-size: 2rem; }

/* --- Carte (Leaflet) --- */
.map-page { position: relative; }
/* Hauteur bornée pour que la barre basse ne masque ni le bouton de localisation ni l'attribution OSM (obligatoire). */
.map { width: 100%; height: max(320px, calc(100svh - var(--bottom-nav-h) - env(safe-area-inset-bottom) - 330px)); border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); background: #e8eef3; z-index: 0; }
@media (min-width: 900px) { .map { height: 560px; } }
.map-pin { width: 34px; height: 34px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); background: var(--primary); border: 3px solid #fff; box-shadow: 0 4px 10px rgba(0, 0, 0, .25); display: flex; align-items: center; justify-content: center; }
.map-pin span { transform: rotate(45deg); font-size: 14px; line-height: 1; }
.map-pin-answer { background: var(--yellow); } .map-pin-manual { background: #e11d74; } .map-pin-qr { background: var(--success); } .map-pin-code { background: var(--purple); }
.map-me { width: 18px; height: 18px; border-radius: 50%; background: var(--info); border: 3px solid #fff; box-shadow: 0 0 0 8px rgba(45, 127, 249, .2); }
.map-sheet { margin-top: -28px; position: relative; z-index: 2; }

/* --- Administration --- */
.admin-layout { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 960px) { .admin-layout { grid-template-columns: 230px minmax(0, 1fr); align-items: start; } }
.admin-sidebar { min-width: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 8px; box-shadow: var(--shadow); }
.admin-sidebar nav { display: flex; gap: 4px; overflow-x: auto; }
@media (min-width: 960px) { .admin-sidebar { position: sticky; top: 76px; } .admin-sidebar nav { flex-direction: column; overflow: visible; } }
.admin-sidebar a { padding: 8px 12px; border-radius: var(--radius-sm); color: var(--text-muted); white-space: nowrap; font-size: .93rem; font-weight: 600; }
.admin-sidebar a:hover, .admin-sidebar a.active { background: var(--primary-soft); color: var(--primary-text); text-decoration: none; }
.admin-content { min-width: 0; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* Contrôles de zoom Leaflet : cibles tactiles de 44 px. */
.leaflet-touch .leaflet-bar a { width: 44px; height: 44px; line-height: 44px; }

/* --- Mini tuto --- */
.tutorial-card { text-align: center; }
.tutorial-points { justify-items: center; gap: 6px; font-weight: 600; }
.tutorial-icon { font-size: 3rem; line-height: 1; margin: 0 0 8px; text-align: center; }
.tutorial-points li { align-items: flex-start; }
.tutorial-actions { display: grid; gap: 12px; margin-top: 16px; }
.tutorial-actions form { margin: 0; }

/* Cauris (ADR-039) : solde dans la barre du haut, boutique, essais par étape. */
.cauri-icon { width: 20px; height: 20px; vertical-align: -4px; object-fit: contain; }
.cauri-chip { display: inline-flex; align-items: center; gap: 4px; height: 44px; padding: 0 10px; border-radius: 22px; background: var(--surface-2); color: var(--text); font-weight: 700; flex: 0 0 auto; }
.cauri-chip:hover, .cauri-chip.active { text-decoration: none; color: var(--primary-text); }
.attempts-left { text-align: center; }
.attempts-out { display: flex; flex-direction: column; gap: 8px; text-align: center; }
.cauri-hero { display: flex; align-items: center; gap: 12px; }
.cauri-hero img { width: 72px; height: 72px; object-fit: contain; flex: 0 0 auto; }
.cauri-packs { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; padding: 0; margin: 0; list-style: none; }
.cauri-pack { display: flex; flex-direction: column; gap: 6px; text-align: center; }
.cauri-pack .cauri-count { font-size: 1.4rem; font-weight: 800; }
.attempts-shop { text-align: left; }
.cauri-pick { border: 0; margin: 0; }
.cauri-pick { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; min-width: 0; border: 0; }
.cauri-pick .cauri-pack { cursor: pointer; align-items: center; padding: 12px 8px; }
.cauri-pick .cauri-pack img { width: 40px; height: 40px; object-fit: contain; }
.cauri-pick .cauri-pack:has(input:checked) { outline: 2px solid var(--primary); }
@media (max-width: 420px) { .top-actions { gap: 4px; } .cauri-chip { padding: 0 8px; } }
