:root {
    --bg-color: #F2F4F7;
    --primary-blue: #001a4b;
    --text-dark: #141d23;
    --text-light: #ffffff;
    --danger-red: #ba1a1a;
    /* Le rouge posé en TEXTE : identique en clair, éclairci en sombre (voir le
               thème sombre plus bas). --danger-red reste celui des aplats et des filets. */
    --danger-red-text: #ba1a1a;
    /* Idem pour le vert « juste » : #1D7A41 faisait 4,2:1 sur sa teinte (posée sur
               le fond d'écran) en clair, et 2,8:1 en sombre où rien ne le redéfinissait.
               #1A6E3A : au moins 4,8:1 en clair ; un vert clair en sombre. */
    --success-text: #1A6E3A;
    --favorite-yellow: #d4a017;
    --progress-green: #1e8e3e;
    --card-shadow: 0px 10px 30px rgba(0, 26, 75, 0.05);
    /* Variante « survolée » de --card-shadow (même teinte navy diffuse, plus
               marquée) : formule signature du design "Tailored Executive"
               (ui/tailored_executive/DESIGN.md), à utiliser à la place d'une ombre
               noire générique partout où une carte se soulève au survol. */
    --card-shadow-hover: 0 6px 12px rgba(0, 26, 75, 0.15);
    --font-main: 'Inter', sans-serif;
    --zoom-level: 1;
    /* Jetons additionnels pour le thème sombre */
    --surface: #FFFFFF;
    --surface-2: #ecf5fe;
    --card-bg: #FFFFFF;
    /* Texte discret (sous-titres, légendes, compteurs). #888888 plafonnait à
               3,5:1 sur blanc et à 3,2:1 sur le fond d'écran, pour 4,5:1 exigés (WCAG
               AA) : un jeton unique, utilisé 70 fois, qui faisait échouer la moitié de
               l'app. #646464 donne 5,9:1 sur blanc, 5,4:1 sur #F2F4F7, 5,2:1 sur le
               fond des cartes d'axe et 4,7:1 sur la teinte verte ou rouge d'une réponse
               juste ou fausse — le pire fond où ce texte se pose, et ce qui exclut
               #6B6B6B (4,2:1 là). Voir e2e/contrastes.spec.js. */
    --muted-text: #646464;
    --border-soft: #E5E7EB;
    --btn-secondary-bg: #CCCCCC;
    --btn-secondary-text: #333333;
    --selected-tint: #EAF1F6;
    --modal-overlay-bg: rgba(0, 0, 0, 0.5);
    --locked-bg: #9AA4AD;
    /* Glassmorphisme (design "Tailored Executive") : verre dépoli utilisé sur les
               modales, la barre de notification du bas et les boutons flottants. Dérivé de
               --surface via color-mix plutôt qu'une couleur figée, pour suivre automatiquement
               le thème clair/sombre sans jeton dupliqué. */
    --glass-bg: color-mix(in srgb, var(--surface) 78%, transparent);
    --glass-border: rgba(255, 255, 255, 0.4);
    --glass-shadow: 0 10px 30px rgba(0, 26, 75, 0.08);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: var(--font-main);
}

body {
    background-color: var(--bg-color);
    color: var(--text-dark);
    height: 100vh;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.hidden {
    display: none !important;
}

.btn {
    background-color: var(--primary-blue);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 9999px;
    font-size: 16px;
    cursor: pointer;
    font-weight: bold;
    transition: opacity 0.2s;
}

.btn:hover {
    opacity: 0.8;
}

/* ÉCRAN D'ACCUEIL AVEC IMAGE & FOND BEIGE FLOUTÉ */
#screen-home {
    position: relative;
    width: 100%;
    height: 100%;
    flex: 1;
    display: flex;
    background-color: #E6D5B8;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

/* Les <img> home-backdrop/home-image sont désormais chacune enveloppées
   dans un <picture> (choix du visuel selon le format d'écran, voir
   index.html) : display:contents fait disparaître cette boîte du rendu,
   pour que la mise en page ci-dessous (position absolute, tailles en %…)
   se comporte exactement comme avec un <img> en enfant direct. */
#screen-home picture {
    display: contents;
}

.home-backdrop {
    position: absolute;
    inset: -20px;
    width: calc(100% + 40px);
    height: calc(100% + 40px);
    object-fit: cover;
    filter: blur(28px) brightness(0.95);
    opacity: 0.6;
    transform: scale(1.08);
    pointer-events: none;
}

.home-backdrop-overlay {
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at center, transparent 35%, rgba(230, 213, 184, 0.75) 100%), linear-gradient(to right, rgba(230, 213, 184, 0.7) 0%, transparent 15%, transparent 85%, rgba(230, 213, 184, 0.7) 100%);
    pointer-events: none;
    z-index: 1;
}

.home-image {
    position: relative;
    z-index: 2;
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    object-position: center;
    display: block;
    filter: drop-shadow(0 0 30px rgba(0, 0, 0, 0.18));
}

/* Sous-titre d'accueil (voir index.html : data-i18n="app.tagline") : teintes
           sombres/dorées assorties à l'illustration (livres, boussole, sablier) plutôt
           que les jetons --glass-* navy/blancs du reste de l'appli, qui jureraient sur
           ce fond sépia. Ancré en bas de l'écran (pas de l'image) pour ne jamais
           recouvrir l'illustration, quel que soit le ratio d'écran. */
.home-tagline-badge {
    position: absolute;
    z-index: 3;
    left: 50%;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 28px);
    transform: translateX(-50%);
    max-width: min(92%, 420px);
    margin: 0;
    padding: 9px 20px;
    border-radius: 9999px;
    background: rgba(24, 16, 8, 0.55);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid rgba(212, 160, 23, 0.45);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    color: #f5e4bc;
    font-size: 12.5px;
    font-weight: 700;
    letter-spacing: 0.01em;
    line-height: 1.4;
    text-align: center;
}

/* LISTES : CATÉGORIES & THÈMES */
.list-screen {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* padding horizontal pour ne jamais passer sous le bouton retour (fixed, 42px de large
           à 16px du bord) sur les écrans étroits, même avec un titre long comme « Réviser mes
           points faibles » */
.header-title {
    font-size: 24px;
    margin-bottom: 20px;
    text-align: center;
    margin-top: 20px;
    padding: 0 60px;
    box-sizing: border-box;
}

/* Écran des modes : nom du thème (titre) + décompte d'axes/événements
   sélectionnés (sous-titre) sont deux éléments distincts plutôt qu'une
   seule phrase jointe par un tiret cadratin (voir showScreen() dans
   app.js) — le sous-titre hérite de l'espacement bas que le titre seul
   portait jusqu'ici. */
.modes-header-title {
    margin-bottom: 4px;
}

.modes-header-subtitle {
    text-align: center;
    color: var(--muted-text);
    font-size: 15px;
    margin: 0 60px 20px;
    padding: 0;
    box-sizing: border-box;
}

/* Longueur de la manche (voir js/app.js: renderRoundLengthPicker). Placé
   au-dessus des modes parce qu'il les concerne tous : c'est un cadrage de la
   partie à venir, pas un mode de plus. */
.round-length {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin: 0 16px 22px;
}

.round-length-btn {
    min-width: 54px;
    padding: 8px 14px;
    border-radius: 999px;
    border: 1px solid var(--border-soft);
    background: var(--surface);
    color: var(--text-dark);
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

@media (hover: hover) {
    .round-length-btn:hover {
        border-color: var(--primary-blue);
    }
}

.round-length-btn.active {
    background: var(--primary-blue);
    border-color: var(--primary-blue);
    color: var(--text-light);
}

/* Le rappel en clair de ce qui va être joué : sur une ligne à part au-delà
   des petits écrans, pour ne pas comprimer les boutons. */
.round-length-hint {
    flex-basis: 100%;
    text-align: center;
    color: var(--muted-text);
    font-size: 13px;
}

/* Longueur de la manche rappelée sous le nom du mode, dans l'historique des
   scores : deux parties de longueurs différentes ne se comparent pas. */
.leaderboard-rounds {
    display: block;
    color: var(--muted-text);
    font-size: 11px;
    font-weight: 400;
}

/* Sur petit écran, un nom de thème long peut s'étaler sur plusieurs
   lignes : un corps un peu plus petit laisse le titre respirer sans
   pousser tout le reste de l'écran hors du premier écran visible. */
@media (max-width: 600px) {
    .modes-header-title {
        font-size: 20px;
    }

    .modes-header-subtitle {
        font-size: 13px;
    }
}

.grid-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    width: 100%;
    max-width: 1000px;
}

/* Carte thème : même langage visuel que les bannières de catégorie
           (plein fond coloré, chevron circulaire, effet de survol), mais dans
           la teinte bleue propre aux thèmes, pour rester distinguable du
           dossier parent tout en s'accordant esthétiquement avec lui. */
.data-card {
    background: linear-gradient(135deg, var(--primary-blue), #9CB8CE);
    color: white;
    border-radius: 12px;
    padding: 20px 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    box-shadow: var(--card-shadow);
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.data-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--card-shadow-hover);
}

.data-card-title {
    flex: 1;
    font-size: 19px;
    font-weight: bold;
    line-height: 1.3;
}

.data-card-icon {
    flex-shrink: 0;
    font-size: 22px;
    background: rgba(255, 255, 255, 0.2);
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

/* Étoile de favori sur une carte-thème : cliquable indépendamment de la carte
           (stopPropagation en JS), dorée et pleine une fois activée. */
.data-card-fav {
    flex-shrink: 0;
    font-size: 21px;
    line-height: 1;
    cursor: pointer;
    opacity: 0.75;
    padding: 2px;
    transition: transform 0.15s ease, opacity 0.15s ease;
}

.data-card-fav:hover {
    opacity: 1;
    transform: scale(1.18);
}

.data-card-fav.is-fav {
    color: #FFD54A;
    opacity: 1;
}

.data-card-delete {
    flex-shrink: 0;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    opacity: 0.75;
    padding: 4px 6px;
    border-radius: 6px;
    transition: transform 0.15s ease, opacity 0.15s ease, background 0.15s;
}

.data-card-delete:hover {
    opacity: 1;
    transform: scale(1.15);
    background: rgba(231, 76, 60, 0.25);
}

.empty-msg {
    font-size: 18px;
    color: var(--muted-text);
    font-style: italic;
    margin-top: 30px;
    text-align: center;
    width: 100%;
}

/* Barre de recherche de thèmes, en tête de l'écran des catégories : filtre
           instantané (dès la première lettre) sur tous les thèmes de la base, quelle
           que soit leur profondeur dans l'arbre de catégories/sous-catégories. */
.search-bar-wrap {
    width: 100%;
    max-width: 640px;
    margin: 64px auto 20px;
    position: relative;
    z-index: 20;
}

.search-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: 9999px;
    padding: 12px 18px;
    box-shadow: var(--card-shadow);
}

.search-bar-icon {
    font-size: 17px;
    flex-shrink: 0;
    opacity: 0.7;
}

.search-bar-input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    -webkit-appearance: none;
    appearance: none;
    font: inherit;
    font-size: 16px;
    color: var(--text-dark);
    min-width: 0;
}

.search-bar-input::placeholder {
    color: var(--muted-text);
}

.search-bar-clear {
    flex-shrink: 0;
    cursor: pointer;
    color: var(--muted-text);
    font-size: 15px;
    line-height: 1;
    padding: 4px;
    border-radius: 50%;
    transition: background 0.15s, color 0.15s;
}

.search-bar-clear:hover {
    background: var(--border-soft);
    color: var(--text-dark);
}

.search-results {
    margin-top: 8px;
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: 16px;
    box-shadow: var(--card-shadow);
    max-height: 360px;
    overflow-y: auto;
}

.search-result-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 12px 18px;
    cursor: pointer;
    border-bottom: 1px solid var(--border-soft);
    transition: background 0.15s;
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item:hover {
    background: var(--surface-2);
}

.search-result-title {
    font-size: 15.5px;
    font-weight: 700;
    color: var(--text-dark);
}

.search-result-path {
    font-size: 12.5px;
    color: var(--muted-text);
}

.search-empty {
    padding: 16px 18px;
    font-size: 14px;
    color: var(--muted-text);
    font-style: italic;
    text-align: center;
}

/* Cartes spéciales (« Ajouter un thème », mode Carte, etc.) intercalées
           parmi les catégories. Format compact façon carte-thème. */
.special-card {
    border-radius: 12px;
    padding: 18px 20px;
    color: white;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    cursor: pointer;
    box-shadow: var(--card-shadow);
    transition: transform 0.2s, box-shadow 0.2s;
    min-height: 88px;
}

.special-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--card-shadow-hover);
}

.special-card-title {
    font-size: 16px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.special-card-subtitle {
    font-size: 13px;
    opacity: 0.85;
}

/* Icônes rondes des 4 actions rapides (Favoris / Découvrir / Réviser / Progression),
           en tête de l'écran des catégories. Couleurs pilotées par les tokens de thème :
           auparavant fond blanc et icônes bleu marine/rouge codés en dur, ce qui restait
           blanc même en mode sombre et tranchait violemment avec le reste de l'écran.
           En mode sombre, elles utilisent var(--surface) (bleu nuit élégant). */
.quick-action-circle {
    background: var(--surface);
    border: 1px solid var(--border-soft);
    box-shadow: var(--card-shadow);
    transition: background 0.2s, box-shadow 0.2s, transform 0.2s;
}

.quick-action-circle:hover {
    background: var(--surface-2);
    transform: translateY(-2px);
}

.quick-action-label {
    font-size: 12px;
    font-weight: 500;
    display: block;
    margin-top: 8px;
    color: var(--muted-text);
}

:root[data-theme="dark"] .quick-action-circle {
    background: var(--surface);
    border-color: var(--border-soft);
}

/* Choix Défi du jour / Défi hebdomadaire (voir js/app.js: initCategories) :
   déplié/replié sous la grille d'actions rapides par le bouton « Défis »,
   plutôt qu'un nouvel écran — le choix reste à un tap de distance. */
.challenge-picker {
    display: flex;
    /* Trois défis depuis l'ajout du Défi de simultanéité : sur les écrans les
       plus étroits, mieux vaut qu'un bouton passe à la ligne que d'écraser
       les trois libellés. */
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 14px;
}

.challenge-picker-btn {
    flex: 1 1 28%;
    min-width: 96px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 14px 10px;
    border-radius: 16px;
    background: var(--surface);
    border: 1px solid var(--border-soft);
    box-shadow: var(--card-shadow);
    color: var(--text-dark);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, box-shadow 0.2s, transform 0.2s;
}

.challenge-picker-btn:hover {
    background: var(--surface-2);
    transform: translateY(-2px);
}

.challenge-picker-icon {
    font-size: 24px;
}

/* Un défi encore verrouillé reste visible et cliquable — le clic explique ce
   qui l'ouvrira. Le griser sans le désactiver est délibéré : un bouton inerte
   ne dirait pas pourquoi (même parti pris que les verrous Chrono/Expert). */
.challenge-picker-btn.locked {
    opacity: 0.55;
}

.challenge-picker-btn.locked .challenge-picker-icon {
    filter: grayscale(1);
}

/* ÉCRAN « PROGRESSION PAR THÈME » : radar de synthèse par catégorie et liste
           de barres de maîtrise détaillées (thème par thème), triées du moins
           maîtrisé au mieux maîtrisé pour indiquer d'un coup d'œil où concentrer sa
           révision. Réutilise les boîtes de mémorisation du SRS comme mesure de
           maîtrise (boîte / 5, en %), moyennée par thème puis par catégorie. */
.progress-subtitle {
    font-size: 14px;
    color: var(--muted-text);
    margin: 0 auto 18px;
    text-align: center;
    max-width: 640px;
    line-height: 1.5;
}

.progress-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    justify-content: center;
    margin-bottom: 24px;
    font-size: 12.5px;
    color: var(--muted-text);
}

.progress-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.progress-legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.progress-radar-wrap {
    width: 100%;
    max-width: 420px;
    margin: 0 auto 30px;
    display: flex;
    justify-content: center;
}

.radar-svg {
    width: 100%;
    height: auto;
    overflow: visible;
}

.radar-grid-ring {
    fill: none;
    stroke: var(--border-soft);
    stroke-width: 1;
}

.radar-axis-line {
    stroke: var(--border-soft);
    stroke-width: 1;
}

.radar-data-poly {
    fill: rgba(107, 142, 173, 0.35);
    stroke: var(--primary-blue);
    stroke-width: 2;
    stroke-linejoin: round;
}

.radar-point {
    fill: var(--primary-blue);
}

.radar-point.is-untested {
    fill: var(--muted-text);
}

.radar-label {
    font-size: 10.5px;
    font-weight: 600;
    fill: var(--text-dark);
    text-anchor: middle;
}

.radar-label-pct {
    font-size: 9.5px;
    fill: var(--muted-text);
    text-anchor: middle;
}

.progress-groups-container {
    width: 100%;
    max-width: 760px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.mastery-group {
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: 12px;
    overflow: hidden;
}

.mastery-group-summary {
    list-style: none;
    cursor: pointer;
    padding: 16px 18px;
    display: block;
}

.mastery-group-summary::-webkit-details-marker {
    display: none;
}

.mastery-group-summary::marker {
    content: '';
}

.mastery-group-summary .mastery-row-name::before {
    content: '▸ ';
    color: var(--muted-text);
}

.mastery-group[open]>.mastery-group-summary .mastery-row-name::before {
    content: '▾ ';
}

.mastery-group-children {
    padding: 14px 14px 14px 26px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    border-top: 1px solid var(--border-soft);
}

.mastery-row {
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: 10px;
    padding: 12px 16px;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
}

.mastery-row:hover {
    transform: translateY(-2px);
    box-shadow: var(--card-shadow);
}

.mastery-row-top {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 10px;
    margin-bottom: 8px;
}

.mastery-row-name {
    font-size: 15px;
    font-weight: 600;
}

.mastery-row-pct {
    font-size: 14px;
    font-weight: 700;
    flex-shrink: 0;
}

.mastery-bar-track {
    height: 9px;
    border-radius: 5px;
    background: var(--surface-2);
    overflow: hidden;
}

.mastery-bar-fill {
    height: 100%;
    border-radius: 5px;
    transition: width 0.4s ease;
}

.mastery-bar-fill.band-none {
    background: repeating-linear-gradient(45deg, var(--border-soft), var(--border-soft) 5px, transparent 5px, transparent 10px);
}

.mastery-bar-fill.band-low {
    background: var(--danger-red);
}

.mastery-bar-fill.band-mid {
    background: #E0A639;
}

.mastery-bar-fill.band-high {
    background: #2ECC71;
}

.mastery-row-pct.band-low {
    color: var(--danger-red-text);
}

.mastery-row-pct.band-mid {
    color: #B5811E;
}

.mastery-row-pct.band-high {
    color: #1E8449;
}

.mastery-row-pct.band-none {
    color: var(--muted-text);
}

.mastery-row-meta {
    font-size: 12px;
    color: var(--muted-text);
    margin-top: 6px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.mastery-row-weak-badge {
    color: var(--danger-red-text);
    font-weight: 600;
}

/* Écran « Réviser mes points faibles » : sous-titre, blocs d'options,
           rangée de boutons de quantité, et badge de compte sur les cartes-thème. */
.revision-hub-subtitle {
    font-size: 14px;
    color: var(--muted-text);
    margin-bottom: 24px;
    text-align: center;
}

.revision-hub-content {
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
}

/* Les onglets de Réviser prennent toute la largeur de l'écran. Sans cela, comme ils sont
   centrés dans une colonne flex, ils se dimensionnent sur leur contenu et débordent des deux côtés. */
#revision-hub-due-container,
#revision-hub-weak-container,
#revision-hub-progress-container {
    width: 100%;
    max-width: 800px;
}

/* Thèmes à reprendre : une seule colonne, les cartes les unes sous les autres. */
#revision-themes-container {
    grid-template-columns: 1fr;
}

.revision-option-block {
    margin-bottom: 38px;
}

.revision-option-title {
    font-size: 19px;
    margin-bottom: 6px;
}

.revision-option-desc {
    font-size: 14px;
    color: var(--muted-text);
    margin-bottom: 16px;
    line-height: 1.5;
}

.revision-quantity-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.quantity-btn {
    min-width: 64px;
}

/* Session aléatoire : les cinq quantités tiennent sur une seule ligne, de même largeur. */
#revision-hub-content .revision-quantity-row {
    flex-wrap: nowrap;
    gap: 8px;
}

#revision-hub-content .revision-quantity-row .quantity-btn {
    flex: 1 1 0;
    min-width: 0;
    padding-left: 0;
    padding-right: 0;
}

.data-card-badge {
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.25);
    color: white;
    font-size: 13px;
    font-weight: 700;
    padding: 3px 11px;
    border-radius: 999px;
}

/* ÉCRAN DES MODES DE JEU */
.grid-modes {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    width: 100%;
    max-width: 800px;
    margin-bottom: 30px;
    /* Toutes les cases ont la hauteur de la plus haute : grille régulière. */
    grid-auto-rows: 1fr;
}

.grid-modes .mode-card {
    min-height: 170px;
}

.mode-card {
    background-color: var(--primary-blue);
    color: white;
    padding: 25px 20px;
    border-radius: 12px;
    text-align: center;
    cursor: pointer;
    transition: transform 0.2s;
    box-shadow: var(--card-shadow);
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.mode-card:hover {
    transform: translateY(-5px);
}

.mode-card h3 {
    font-size: 22px;
    margin-bottom: 10px;
}

.mode-card p {
    font-size: 14px;
    opacity: 0.9;
}

/* Mode verrouillé : progression requise sur ce thème avant d'y accéder */
.mode-card.locked {
    background-color: var(--locked-bg);
    cursor: not-allowed;
}

.mode-card.locked:hover {
    transform: none;
}

.mode-card.locked h3 {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
}

.mode-card.quiz-card {
    background: linear-gradient(135deg, #9A3412, #B9461B);
}

.mode-card.avap-card {
    background: linear-gradient(135deg, #7E2E0E, #A34A1E);
}

.mode-card.fil-card {
    background: linear-gradient(135deg, #6B3D1C, #8F5A30);
}

.mode-card.periodes-card {
    background: linear-gradient(135deg, #7A2E4D, #9E3D5E);
}

.mode-card.ecart-card {
    background: linear-gradient(135deg, #7A5C00, #937000);
}

.mode-card.simul-card {
    background: linear-gradient(135deg, #1B4F72, #117A65);
}

.mode-card.ordre-mode-card {
    background: linear-gradient(135deg, #5C3A21, #7D4E2D);
}

.mode-card.blitz-card {
    background: linear-gradient(135deg, #922B21, #B03A2E);
}

.mode-card.curseur-card {
    background: linear-gradient(135deg, #7A5200, #946200);
}

.mode-card.intrus-card {
    background: linear-gradient(135deg, #784212, #A0520F);
}

/* --- Grille carrée 2x2 pour Entraînement / Classique / Chrono / Expert --- */
.grid-modes-square {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
    width: 100%;
    max-width: 460px;
    margin: 0 auto 30px;
}

.grid-modes-square .mode-card {
    aspect-ratio: 1 / 1;
    padding: 14px 10px;
}

.grid-modes-square .mode-card h3 {
    font-size: clamp(15px, 5vw, 21px);
    margin-bottom: 6px;
}

.grid-modes-square .mode-card p {
    font-size: clamp(10.5px, 3.4vw, 13px);
    line-height: 1.3;
}

.grid-modes-square .mode-card.locked h3 {
    font-size: clamp(13px, 4.4vw, 18px);
}

@media (max-width: 380px) {
    .grid-modes-square {
        gap: 10px;
    }

    .grid-modes-square .mode-card {
        padding: 10px 8px;
    }
}

.selection-list {
    text-align: left;
    background: var(--surface);
    border: 1px solid var(--rule);
    border-radius: 12px;
    max-height: 50vh;
    overflow-y: auto;
    padding: 10px;
    margin-bottom: 20px;
}

.selection-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    border-bottom: 1px solid var(--rule);
    cursor: pointer;
}

.selection-item:last-child {
    border-bottom: none;
}

.selection-item:hover {
    background: var(--surface-2);
    border-radius: 6px;
}

.selection-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.selection-item-title {
    flex: 1;
    font-weight: 600;
    color: var(--text-dark);
    font-size: 15px;
}

.selection-item-date {
    font-family: var(--font-year);
    font-size: 14px;
    font-weight: 700;
    color: var(--primary-blue);
}

.selection-item-delete {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
    padding: 4px 6px;
    border-radius: 4px;
    opacity: 0.6;
    transition: all 0.15s;
    margin-left: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.selection-item-delete:hover {
    opacity: 1;
    transform: scale(1.15);
    background: rgba(231, 76, 60, 0.2);
}

.form-group {
    text-align: left;
    margin-bottom: 15px;
}

.form-label {
    display: block;
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 6px;
    color: var(--text-dark);
}

.form-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-soft);
    border-radius: 9999px;
    font: inherit;
    /* 16 px et pas moins : sous ce seuil, iOS zoome dans la page à chaque
       focus d'un champ. Cela ne se voyait pas tant que la balise viewport
       interdisait le zoom (maximum-scale=1.0 le masquait) ; une fois le zoom
       rendu aux utilisateurs, c'est ce qui l'aurait réactivé en pleine
       saisie. Voir e2e/clavier.spec.js qui garde cette valeur. */
    font-size: 16px;
    background: #ffffff !important;
    color: #141d23 !important;
}

.form-input::placeholder {
    color: #8B93A0 !important;
    opacity: 1;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 2px rgba(0, 26, 75, 0.15);
}

textarea.form-input {
    border-radius: 12px;
}

.form-row {
    display: flex;
    gap: 10px;
}

.leaderboard-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 14px;
    margin-bottom: 15px;
}

.leaderboard-table th {
    padding: 10px 8px;
    border-bottom: 2px solid var(--rule);
    font-weight: 600;
    color: var(--muted-text);
}

.leaderboard-table td {
    padding: 12px 8px;
    border-bottom: 1px solid var(--rule);
    color: var(--text-dark);
}

.leaderboard-table tr:last-child td {
    border-bottom: none;
}

.leaderboard-score {
    font-weight: 700;
    color: var(--primary-blue);
}

.leaderboard-empty {
    text-align: center;
    padding: 30px 10px;
    color: var(--muted-text);
    font-style: italic;
}

.combo-chip {
    font-size: 11px;
    font-weight: 700;
    color: var(--primary-blue);
    background: rgba(107, 142, 173, 0.14);
    border-radius: 999px;
    padding: 2px 8px;
    margin-left: 6px;
}

/* Le bleu marine de la marque, posé en texte sur une surface sombre : 1,2:1 —
   la pastille « ×1.1 » des jeux y était invisible. Un bleu clair du même ton. */
:root[data-theme="dark"] .combo-chip {
    color: #A9C7E6;
}

.mode-lock-icon {
    font-size: 18px;
}

.mode-unlock-hint {
    font-size: 13px;
    font-style: italic;
    opacity: 0.95;
}

/* MODALE DE RÉSULTATS — DÉFI DU JOUR */
.daily-results-summary {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin: 4px 0 20px;
}

.daily-results-stat {
    text-align: center;
}

.daily-results-stat-val {
    font-size: 24px;
    font-weight: 800;
    color: var(--primary-blue);
    display: block;
}

.daily-results-stat-label {
    font-size: 12px;
    color: var(--muted-text);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.daily-countdown-box {
    text-align: center;
    font-size: 13px;
    color: var(--muted-text);
    background: rgba(46, 204, 113, 0.1);
    border-radius: 12px;
    padding: 10px 14px;
    margin-bottom: 18px;
}

.daily-countdown-val {
    font-weight: 700;
    color: #1E8449;
    font-family: var(--font-year);
}

:root[data-theme="dark"] .daily-countdown-val {
    color: #2ECC71;
}

#daily-pseudo-input {
    text-align: center;
    background: #ffffff !important;
    color: #141d23 !important;
}

.daily-submit-feedback {
    margin-top: 10px;
    font-size: 13px;
    text-align: center;
    min-height: 18px;
}

.daily-submit-feedback.success {
    color: var(--success-text);
}

.daily-submit-feedback.error {
    color: var(--danger-red-text);
}

.daily-duel-comparison {
    background: linear-gradient(135deg, rgba(212, 160, 23, 0.12), rgba(247, 147, 30, 0.18));
    border: 1px solid rgba(212, 160, 23, 0.35);
    color: #a86b00;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 13.5px;
    font-weight: 700;
    text-align: center;
    margin-bottom: 16px;
}

:root[data-theme="dark"] .daily-duel-comparison {
    color: #f0b90b;
    background: rgba(212, 160, 23, 0.15);
    border-color: rgba(212, 160, 23, 0.4);
}

.daily-leaderboard-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-dark);
    margin: 18px 0 8px;
}

.daily-leaderboard-empty {
    text-align: center;
    padding: 16px 10px;
    color: var(--muted-text);
    font-size: 13px;
}

#daily-leaderboard-preview .leaderboard-row {
    display: grid;
    grid-template-columns: 28px 1fr auto auto;
    align-items: center;
    gap: 8px;
    padding: 8px 4px;
    border-bottom: 1px solid var(--rule);
    font-size: 13px;
    text-align: left;
}

#daily-leaderboard-preview .leaderboard-row:last-child {
    border-bottom: none;
}

#daily-leaderboard-preview .leaderboard-row-me {
    background: rgba(107, 142, 173, 0.10);
    border-radius: 8px;
}

#daily-leaderboard-preview .leaderboard-rank {
    font-weight: 700;
    text-align: center;
}

#daily-leaderboard-preview .leaderboard-pseudo {
    color: var(--text-dark);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#daily-leaderboard-preview .leaderboard-pseudo em {
    color: var(--muted-text);
    font-style: italic;
    font-weight: 400;
}

#daily-leaderboard-preview .leaderboard-time {
    color: var(--muted-text);
    font-size: 12px;
}

/* MODALE LIGUE HEBDOMADAIRE (voir js/league.js) : même grille que
           l'aperçu de classement du Défi du jour ci-dessus, sans colonne temps. */
.league-week-hint {
    text-align: center;
    font-size: 13px;
    color: var(--muted-text);
    background: rgba(107, 142, 173, 0.10);
    border-radius: 12px;
    padding: 10px 14px;
    margin-bottom: 16px;
}

.league-week-hint strong {
    color: var(--primary-blue);
}

.league-country-row {
    text-align: center;
    font-size: 13.5px;
    margin-bottom: 12px;
}

.league-country-row select {
    margin-left: 6px;
    max-width: 100%;
    font-size: 13.5px;
    padding: 4px 8px;
    border-radius: 8px;
}

#league-list-container .leaderboard-row {
    display: grid;
    grid-template-columns: 28px 30px 1fr auto;
    align-items: center;
    gap: 8px;
    padding: 9px 4px;
    border-bottom: 1px solid var(--rule);
    font-size: 13.5px;
    text-align: left;
}

#league-list-container .leaderboard-row:last-child {
    border-bottom: none;
}

#league-list-container .leaderboard-row-me {
    background: rgba(107, 142, 173, 0.10);
    border-radius: 8px;
}

#league-list-container .leaderboard-rank {
    font-weight: 700;
    text-align: center;
}

/* Onglet « Défis » : rang, pseudo, points, détail (temps ou bonnes réponses). Pas de colonne niveau : le pseudo prend la place
   restante au lieu de se loger dans une colonne de 30 px (celle du niveau, dans les autres onglets). */
#league-list-container .league-challenge-row {
    grid-template-columns: 28px minmax(0, 1fr) auto auto;
}

#league-list-container .league-challenge-row .leaderboard-pseudo {
    color: var(--text-dark);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#league-list-container .league-challenge-row .leaderboard-pseudo em {
    color: var(--muted-text);
    font-style: italic;
    font-weight: 400;
}

#league-list-container .league-challenge-row .leaderboard-time {
    color: var(--muted-text);
    font-size: 12px;
}

/* Qualificatifs (mots-clés d'équipe, qualificatifs personnels) : puces cochables, plafonnées. */
.qualifier-picker,
.qualifier-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin: 6px 0 12px;
}

.qualifier-chip {
    border: 1px solid var(--border-soft);
    background: var(--surface);
    color: var(--text-dark);
    border-radius: 9999px;
    padding: 6px 12px;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.2;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, opacity 0.15s;
}

.qualifier-chip[aria-pressed="true"] {
    background: var(--primary-blue);
    border-color: var(--primary-blue);
    color: #fff;
}

.qualifier-chip:disabled {
    opacity: 0.4;
    cursor: default;
}

.qualifier-chip.is-static {
    cursor: default;
    background: rgba(107, 142, 173, 0.12);
    border-color: transparent;
    color: var(--text-dark);
}

.qualifier-count {
    color: var(--muted-text);
    font-size: 12px;
    margin-left: 4px;
}

/* La fiche personnelle s'ouvre aussi depuis les classements (clic sur son propre nom) : elle passe au-dessus de la ligue,
   et les amis, ouverts depuis elle, au-dessus d'elle. */
#modal-player-profile { z-index: 101; }
#modal-friends { z-index: 102; }

/* Fiche du joueur connecté */
.player-profile-card {
    max-width: 420px;
}

.player-profile-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-right: 36px;
}

.player-profile-icon {
    width: 56px;
    height: 56px;
    flex-shrink: 0;
    border-radius: 50%;
    background: rgba(107, 142, 173, 0.14);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
}

.player-profile-id {
    flex: 1;
    min-width: 0;
}

.player-profile-id h2 {
    margin: 0;
    font-size: 20px;
    color: var(--text-dark);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.player-profile-rank {
    font-size: 13.5px;
    color: var(--muted-text);
    margin-top: 2px;
}

/* Série de jours d'affilée : une flamme avec le nombre au centre, à gauche du rond du niveau. */
.player-profile-badges {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.player-profile-streak {
    position: relative;
    width: 34px;
    height: 40px; /* la hauteur du rond du niveau : la flamme est alignée en haut et en bas */
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

.player-profile-streak-flame {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 33px;
    line-height: 1;
    filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.25));
}

.player-profile-streak-n {
    position: relative;
    margin-bottom: 5px;
    font-size: 12.5px;
    font-weight: 800;
    line-height: 1;
    color: #fff;
    text-shadow: 0 0 3px #b83200, 0 0 3px #b83200, 0 1px 2px rgba(120, 30, 0, 0.9);
}

/* Fiche publique d'une équipe */
#modal-team-view { z-index: 103; }
.team-view-head { display: flex; align-items: center; gap: 12px; padding-right: 36px; margin-bottom: 8px; }
.team-view-badge { width: 56px; height: 56px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.team-view-badge svg { width: 100%; height: 100%; }
.team-view-id { min-width: 0; }
.team-view-id h2 { margin: 0; font-size: 20px; color: var(--text-dark); overflow-wrap: anywhere; }
.team-view-id small { color: var(--muted-text); }
.team-view-join { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }

.player-profile-level {
    flex-shrink: 0;
    min-width: 40px;
    height: 40px;
    box-sizing: border-box;
    padding: 0 8px;
    border-radius: 9999px;
    background: var(--primary-blue);
    color: #fff;
    font-size: 16px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
}

:root[data-theme="dark"] .player-profile-level {
    background: #2475ab;
}

.player-profile-xp {
    margin: 14px 0 4px;
}

.player-profile-xp small {
    display: block;
    margin-top: 6px;
    color: var(--muted-text);
    font-size: 12.5px;
}

.player-profile-section {
    margin: 18px 0 2px;
    font-size: 16px;
    color: var(--text-dark);
}

.player-profile-ids {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.player-profile-id-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 14px;
    border-radius: 12px;
    background: rgba(107, 142, 173, 0.10);
    font-size: 14px;
    color: var(--text-dark);
}

/* Pseudo cliquable dans les classements : il garde l'apparence du texte. */
#league-list-container .leaderboard-pseudo {
    background: none;
    border: 0;
    padding: 0;
    font: inherit;
    text-align: left;
    cursor: pointer;
    text-decoration: underline;
    text-decoration-color: rgba(107, 142, 173, 0.45);
    text-underline-offset: 3px;
}

.leaderboard-friend-mark {
    font-size: 12px;
    margin-left: 3px;
    text-decoration: none;
    display: inline-block;
}

.public-profile-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 14px;
    margin: 12px 0 0;
    font-size: 13.5px;
    color: var(--muted-text);
}

.player-profile-id-end {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.player-profile-id-label {
    color: var(--muted-text);
}

.player-profile-id-value {
    white-space: nowrap;
    flex-shrink: 0;
    font-weight: 700;
    letter-spacing: 0.06em;
    color: var(--primary-blue);
}

.player-profile-record-text {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.player-profile-fold {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    margin: 18px 0 2px;
    padding: 0;
    border: 0;
    background: none;
    font: inherit;
    font-size: 16px;
    color: var(--text-dark);
    cursor: pointer;
    text-align: left;
}

.player-profile-fold-chevron {
    font-size: 14px;
    color: var(--muted-text);
    transition: transform 0.2s;
}

.player-profile-fold.is-open .player-profile-fold-chevron {
    transform: rotate(180deg);
}

.player-profile-kind {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px 14px;
    border-radius: 12px;
    background: rgba(107, 142, 173, 0.10);
    font-size: 14px;
    color: var(--text-dark);
}

.player-profile-kind .player-profile-id-row {
    background: none;
    padding: 4px 0;
}

.player-profile-kind-title {
    margin: 4px 0 0;
    font-size: 15px;
    color: var(--text-dark);
}

.player-profile-tops {
    flex-direction: column;
    align-items: flex-start;
}

.player-profile-tops .qualifier-list {
    margin: 0;
}

/* Palier (Top 3, Top 10, Top 50) et nombre de semaines : deux couleurs distinctes, séparées. */
.player-profile-top-chip {
    display: inline-flex;
    align-items: center;
    gap: 0;
    border-radius: 9999px;
    background: var(--surface);
    border: 1px solid var(--border-soft);
    overflow: hidden;
    font-size: 13px;
    line-height: 1;
}

.player-profile-top-label {
    padding: 7px 10px;
    color: var(--muted-text);
    font-weight: 600;
}

.player-profile-top-count {
    min-width: 28px;
    padding: 7px 10px;
    text-align: center;
    background: var(--primary-blue);
    color: #fff;
    font-weight: 800;
}

:root[data-theme="dark"] .player-profile-top-count {
    background: #2475ab;
}

/* Médailles : or pour le top 3, argent pour le top 10, bronze pour le top 50 (fond du libellé). */
.player-profile-top-chip.tier-3 .player-profile-top-label {
    background: #f5c542;
    color: #3d2e00;
}

.player-profile-top-chip.tier-10 .player-profile-top-label {
    background: #d4d9de;
    color: #2b3138;
}

.player-profile-top-chip.tier-50 .player-profile-top-label {
    background: #d9a06b;
    color: #3d2210;
}

.player-profile-record-sub {
    display: block;
    font-size: 12.5px;
    color: var(--muted-text);
}

.player-profile-team-row {
    justify-content: flex-start;
}

.player-profile-team-row .player-profile-id-end {
    margin-left: auto;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.player-profile-team-badge {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
}

.player-profile-team-badge svg {
    width: 40px;
    height: 40px;
    display: block;
}

.player-profile-team-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.player-profile-team-info b {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.player-profile-actions {
    display: flex;
    gap: 10px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.player-profile-actions .btn {
    flex: 1 1 140px;
}

/* Niveau : rond bleu marine, chiffre seul (même couleur que .player-rank-level-badge). */
#league-list-container .leaderboard-level {
    justify-self: center;
    box-sizing: border-box;
    min-width: 24px;
    height: 24px;
    padding: 0 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 9999px;
    background: var(--primary-blue);
    color: #fff;
    font-size: 11px;
    font-weight: 800;
    line-height: 1;
}

:root[data-theme="dark"] #league-list-container .leaderboard-level {
    background: #2475ab;
}

#league-list-container .leaderboard-pseudo {
    color: var(--text-dark);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#league-list-container .leaderboard-pseudo em {
    color: var(--muted-text);
    font-style: italic;
    font-weight: 400;
}


/* =====================================================================
           PLATEAU DE JEU — « La colonne du temps »
           Interface propre à HistoriAxe : la frise se lit verticalement, du plus
           ancien (en haut) au plus récent (en bas). Les millésimes sont alignés
           dans une gouttière à gauche, le long de l'axe. L'insertion se fait
           dans des intervalles nommés (« Entre 1789 et 1848 »), et l'événement
           en jeu reste en main, épinglé en bas de l'écran.
           ===================================================================== */
:root {
    --paper: #FBFAF7;
    --rule: #E6E3DC;
    --ink: #1F2933;
    /* Encre secondaire de la frise et des jeux (compteurs, A−/A+, boutons de
               réglage). #7A848F faisait 3,8:1 sur blanc ; #66717D en fait 5,0. */
    --ink-soft: #66717D;
    --axis: #CBD2D9;
    --hand-bg: #263445;
    --amber: #B07520;
    --gutter: calc(74px * var(--zoom-level));
    --font-year: Georgia, "Iowan Old Style", "Times New Roman", serif;
}

#screen-game {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    background: var(--paper);
}

/* --- Barre de partie --- */
.game-bar {
    background: var(--surface);
    border-bottom: 1px solid var(--rule);
    padding: 9px 16px 11px;
    display: flex;
    flex-direction: column;
    gap: 9px;
    flex-shrink: 0;
}

.bar-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.quit-btn {
    background: none;
    border: none;
    font: inherit;
    font-size: 15px;
    font-weight: 600;
    color: var(--primary-blue);
    cursor: pointer;
    padding: 2px 4px 2px 0;
}

.bar-fill {
    flex: 1;
}

.timer-chip {
    font-family: var(--font-year);
    font-variant-numeric: tabular-nums;
    font-size: 15px;
    font-weight: 700;
    color: var(--ink);
    background: var(--surface-2);
    padding: 3px 9px;
    border-radius: 4px;
}

.lives-row {
    display: inline-flex;
    gap: 6px;
    align-items: center;
}

.pip {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--danger-red);
}

.pip.spent {
    background: none;
    border: 1.5px solid var(--border-soft);
}

/* Réglages ouverts depuis la frise : seulement orientation, disposition en paysage et apparence. */
#modal-settings.is-quick > .modal-content > .settings-group:not(.settings-quick) {
    display: none !important;
}

.layout-btn {
    flex: none;
    min-width: 34px;
    height: 28px;
    padding: 0 8px;
    border: 1px solid var(--rule);
    border-radius: 6px;
    background: var(--surface);
    font-size: 15px;
    line-height: 1;
    cursor: pointer;
}

.layout-btn:active {
    background: var(--surface-2);
}

.type-size {
    display: inline-flex;
    border: 1px solid var(--rule);
    border-radius: 6px;
    overflow: hidden;
}

.type-size button {
    background: var(--surface);
    border: none;
    color: var(--ink-soft);
    font-family: var(--font-main);
    font-weight: 700;
    cursor: pointer;
    padding: 3px 9px;
}

.type-size button:first-child {
    font-size: 12px;
}

.type-size button:last-child {
    font-size: 16px;
    border-left: 1px solid var(--rule);
}

.type-size button:active {
    background: var(--surface-2);
}

.progress-rail {
    flex: 1;
    height: 3px;
    background: var(--surface-2);
    border-radius: 2px;
    overflow: hidden;
}

.progress-fill {
    display: block;
    height: 100%;
    width: 0%;
    background: var(--primary-blue);
    transition: width 0.35s ease;
}

.bar-meta {
    font-size: 12px;
    font-weight: 600;
    color: var(--ink-soft);
    letter-spacing: 0.02em;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

/* --- Colonne chronologique --- */
/* En orientation verticale (portrait), .board devient une colonne flex :
           quand la frise tient entièrement dans la hauteur visible (peu de
           repères), la marge automatique verticale de .chrono la centre au
           lieu de la coller contre la barre de jeu ; dès que le contenu
           déborde, ces marges auto s'annulent d'elles-mêmes et on retrouve
           le défilement classique ancré en haut. */
.board {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    /* Une seule direction de défilement : vertical en portrait, horizontal en paysage (voir plus bas). */
    touch-action: pan-y;
    overscroll-behavior-x: none;
    -webkit-overflow-scrolling: touch;
    padding: 10px 16px 32px;
    scroll-padding: 90px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.chrono {
    position: relative;
    width: 100%;
    max-width: 720px;
    margin: auto 0;
}

.chrono::before {
    content: "";
    position: absolute;
    top: 4px;
    bottom: 4px;
    left: calc(var(--gutter) + 11px);
    width: 1px;
    background: var(--axis);
}

/* En orientation paysage du téléphone, la hauteur visible du board est très
           réduite : même une frise qui déborde (donc sans le bénéfice de la marge
           automatique ci-dessus, qui ne joue que si tout le contenu tient) affichait
           son premier repère collé contre la barre de jeu, faute de tout espace de
           respiration garanti. On réserve ici un minimum incompressible en haut et
           en bas du board — proportionnel à la hauteur de l'écran plutôt que fixe,
           pour rester cohérent sur les petits comme les grands appareils. */
@media (orientation: landscape) {
    [data-layout="vertical"] .board {
        padding-top: 18vh;
        padding-bottom: 18vh;
    }
}

.entry {
    display: grid;
    grid-template-columns: var(--gutter) 23px minmax(0, 1fr);
    align-items: center;
    padding: calc(10px * var(--zoom-level)) 0;
    cursor: pointer;
    scroll-margin: 100px 0;
}

.entry-year {
    font-family: var(--font-year);
    font-size: calc(19px * var(--zoom-level));
    font-weight: 700;
    color: var(--ink);
    text-align: right;
    padding-right: 13px;
    line-height: 1.15;
    font-variant-numeric: tabular-nums;
}

/* Dates très longues (Préhistoire, ex. « 3 300 000 av. J.-C. », voir
   formatYear()) : un corps un peu plus petit suffit à garder le nombre
   groupé par milliers sur une seule ligne dans la gouttière existante,
   sans en changer la largeur (ce qui désaxerait la puce des autres
   repères par rapport au trait de la frise). Les dates courantes
   (jusqu'à 4 chiffres) ne sont pas concernées. */
.entry-year.entry-year-long {
    font-size: calc(15px * var(--zoom-level));
}

.entry-tick {
    justify-self: center;
    width: 7px;
    height: 7px;
    background: var(--ink);
    transform: rotate(45deg);
}

.entry-body {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: calc(6px * var(--zoom-level)) 0 calc(6px * var(--zoom-level)) 14px;
}

/* Regroupe titre + badge d'axe (+ éventuel flag « manqué ») en colonne,
   pour que le badge se place sous le titre plutôt qu'à sa droite, où il
   pouvait dépasser hors de l'écran en portrait. Le chevron reste hors de
   ce groupe, aligné à droite sur toute la hauteur de l'entrée. */
.entry-main {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    flex: 1;
    min-width: 0;
}

.entry-title {
    flex: 1;
    min-width: 0;
    overflow-wrap: anywhere;
    font-size: calc(15px * var(--zoom-level));
    line-height: 1.35;
    color: var(--ink);
}

.entry-chevron {
    color: var(--ink-soft);
    font-size: 17px;
    line-height: 1;
    opacity: 0.6;
}

.entry-flag {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--danger-red-text);
    border: 1px solid currentColor;
    border-radius: 3px;
    padding: 1px 5px;
}

.entry:hover .entry-title {
    color: var(--primary-blue);
}

.entry-missed .entry-tick {
    background: var(--danger-red);
}

.entry-missed .entry-year {
    color: var(--danger-red-text);
}

/* En mode Découverte, aucun intervalle ne sépare les repères : on rétablit un filet */
.chrono:not(.playing) .entry+.entry .entry-body {
    border-top: 1px solid var(--rule);
}

/* --- Intervalles d'insertion (élément signature) --- */
.slot {
    display: block;
    width: 100%;
    background: none;
    border: none;
    -webkit-appearance: none;
    appearance: none;
    font: inherit;
    text-align: left;
    cursor: pointer;
    padding: calc(7px * var(--zoom-level)) 0;
    -webkit-tap-highlight-color: transparent;
}

.slot-grid {
    display: grid;
    grid-template-columns: var(--gutter) 23px 1fr;
    align-items: center;
}

.slot-caret {
    justify-self: center;
    position: relative;
    left: 3px;
    width: 0;
    height: 0;
    border-top: 5px solid transparent;
    border-bottom: 5px solid transparent;
    border-left: 8px solid var(--axis);
    transition: border-left-color 0.15s ease, transform 0.15s ease;
}

.slot-body {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-left: 14px;
}

.slot-label {
    font-size: calc(12.5px * var(--zoom-level));
    letter-spacing: 0.02em;
    color: var(--ink-soft);
    transition: color 0.15s ease;
}

.slot:focus-visible .slot-label {
    color: var(--amber);
}

.slot:focus-visible .slot-caret {
    border-left-color: var(--amber);
    transform: translateX(3px);
}

.slot:focus-visible {
    outline: 2px solid var(--amber);
    outline-offset: 3px;
    border-radius: 4px;
}

.slot:active .slot-label {
    color: var(--amber);
}

/* (hover: hover) évite qu'un tap sur mobile/tactile ne laisse l'intervalle
           « collé » dans son état survolé une fois le doigt relevé (aucun mouseleave
           n'est jamais émis sur ces appareils). */
@media (hover: hover) {
    /* Pas de changement de graisse ici : le texte plus large ferait revenir à la ligne toute la frise (les repères sautent). */
    .slot:hover .slot-label {
        color: var(--amber);
    }

    .slot:hover .slot-caret {
        border-left-color: var(--amber);
        transform: translateX(3px);
    }
}

.slot-wrong {
    animation: nudge 0.35s ease-in-out;
}

.slot-wrong .slot-label {
    color: var(--danger-red-text);
    font-weight: 700;
}

.slot-wrong .slot-caret {
    border-left-color: var(--danger-red);
}

/* --- Événement en main --- */
.hand {
    flex-shrink: 0;
    background: var(--surface);
    border-top: 1px solid var(--rule);
    box-shadow: 0 -2px 14px rgba(0, 26, 75, 0.05);
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
}

.hand-card {
    max-width: 720px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 14px;
    background: var(--hand-bg);
    border-radius: 10px;
    padding: 13px 16px;
}

.hand-year {
    flex-shrink: 0;
    min-width: calc(58px * var(--zoom-level));
    text-align: center;
    font-family: var(--font-year);
    font-size: calc(20px * var(--zoom-level));
    font-weight: 700;
    color: var(--amber);
    border: 1px dashed rgba(255, 255, 255, 0.3);
    border-radius: 6px;
    padding: 7px 6px;
    font-variant-numeric: tabular-nums;
}

.hand-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.hand-kicker {
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 4px;
}

.hand-title {
    font-size: calc(16px * var(--zoom-level));
    font-weight: 600;
    line-height: 1.3;
    color: #fff;
}

.hand-revealed .hand-year {
    border-style: solid;
    border-color: var(--amber);
    background: rgba(176, 117, 32, 0.16);
}

/* Défi du jour uniquement : rappelle entre parenthèses le thème d'origine de
           l'événement encore « en main » (pas assez de contexte sinon, les 10
           événements du jour venant de thèmes très divers). Disparaît une fois
           l'événement placé sur la frise (buildEntry n'affiche que evt.titre). */
.hand-title-theme {
    font-style: italic;
    font-weight: 400;
    opacity: 0.7;
    font-size: 0.85em;
}

@keyframes nudge {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-4px);
    }

    75% {
        transform: translateX(4px);
    }
}

@keyframes settle {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes flag {

    0%,
    100% {
        background: transparent;
    }

    30% {
        background: rgba(217, 83, 79, 0.10);
    }
}

.entry-new {
    animation: settle 0.4s ease-out;
}

.entry-reveal {
    animation: entryArrive 0.5s var(--ease-out) backwards, flag 1.4s ease-out;
}

/* Navigation catégories → sous-catégories → thèmes → axes thématiques → modes de jeu :
           glissement directionnel (avant/arrière) */
@keyframes screenSlideInRight {
    from {
        opacity: 0;
        transform: translateX(48px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes screenSlideInLeft {
    from {
        opacity: 0;
        transform: translateX(-48px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.screen-slide-forward {
    animation: screenSlideInRight 0.32s cubic-bezier(0.22, 0.61, 0.36, 1);
}

.screen-slide-back {
    animation: screenSlideInLeft 0.32s cubic-bezier(0.22, 0.61, 0.36, 1);
}

@media (prefers-reduced-motion: reduce) {

    .screen-slide-forward,
    .screen-slide-back {
        animation: none;
    }
}

/* Dernier degré de catégorie (sous-catégorie feuille, ou catégorie sans
           sous-catégories) → thèmes : au lieu du glissement, un effacement rapide
           de l'écran quitté suivi d'une réapparition en fondu sur les thèmes. */
@keyframes screenFadeOutQuick {
    from {
        opacity: 1;
    }

    to {
        opacity: 0;
    }
}

@keyframes screenFadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.screen-fade-out {
    animation: screenFadeOutQuick 0.15s ease-in forwards;
}

.screen-fade-in {
    animation: screenFadeIn 0.26s ease-out;
}

@media (prefers-reduced-motion: reduce) {

    .screen-fade-out,
    .screen-fade-in {
        animation: none;
    }
}

@media (prefers-reduced-motion: reduce) {

    .entry-new,
    .entry-reveal,
    .slot-wrong {
        animation: none;
    }

    .slot-caret,
    .progress-fill {
        transition: none;
    }
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--modal-overlay-bg);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

#modal-confirm {
    z-index: 105;
}

#modal-scoring-info {
    z-index: 110;
}

/* Verre dépoli : le fond de la modale laisse deviner l'écran flouté derrière elle
           au lieu d'un aplat opaque — c'est le rendu "premium" des maquettes Tailored
           Executive (cf. ui/historiaxe_*_tailored_style/code.html). */
.modal-content {
    /* 94 % d'opacité et non les 78 % du verre ordinaire : à 78 %, le panneau
               laissait transparaître le voile sombre de la modale et n'était plus blanc
               mais gris (#E1E1E2 mesuré), si bien que le texte discret y faisait 4,1:1.
               À 94 %, le fond redevient quasi blanc, et le texte n'est plus tributaire de
               ce qui passe derrière. */
    background: color-mix(in srgb, var(--surface) 94%, transparent);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--glass-border);
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    border-radius: 24px;
    padding: 30px;
    position: relative;
    box-shadow: var(--glass-shadow);
}

/* Bouton de fermeture des modales : `position: sticky` (plutôt qu'absolute) le
   maintient collé en haut du panneau — donc toujours cliquable — même une fois
   le contenu défilé (cas des modales longues : profil, réglages, récap...).
   Étant en flux normal, il réserve sa propre ligne au lieu de chevaucher le
   premier élément du contenu, et le style "chip" rond (glass + ombre) reprend
   la même famille visuelle que .settings-btn / .profile-btn / .league-btn. */
.close-btn {
    position: sticky;
    top: 0;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    margin: 0 0 12px auto;
    border-radius: 50%;
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    box-shadow: var(--card-shadow);
    font-size: 19px;
    line-height: 1;
    cursor: pointer;
    color: var(--text-dark);
    transition: transform 0.2s ease, background 0.2s ease;
}

.close-btn:hover {
    transform: scale(1.08);
    background: color-mix(in srgb, var(--surface) 92%, transparent);
}

.close-btn:active {
    transform: scale(0.94);
}

.modal-title {
    font-size: 22px;
    color: var(--text-dark);
    margin-bottom: 10px;
}

.modal-date {
    font-size: 18px;
    color: var(--primary-blue);
    font-weight: bold;
    margin-bottom: 20px;
}

.modal-desc {
    line-height: 1.6;
    color: var(--ink-soft);
    margin-bottom: 20px;
    text-align: justify;
}

.modal-link {
    color: var(--primary-blue);
    text-decoration: none;
    font-weight: bold;
}

.modal-link:hover {
    text-decoration: underline;
}

/* « Signaler une erreur » : discret, sous le lien Wikipédia. */
.modal-report-row {
    margin-top: 4px;
    font-size: 12px;
    color: var(--muted-text);
}

.modal-report-link {
    display: inline-block;
    padding: 10px 0;
    color: var(--muted-text);
    text-decoration: none;
}

.modal-report-link:hover {
    text-decoration: underline;
}

.modal-report-hint {
    display: block;
    margin-bottom: 8px;
}

.modal-report-hint a,
.modal-report-hint button {
    padding: 0;
    background: none;
    border: none;
    font: inherit;
    color: inherit;
    text-decoration: underline;
    cursor: pointer;
}

/* Retour à la fiche précédente (après un saut par « Vu aussi dans… »). */
.modal-back-btn {
    display: block;
    max-width: calc(100% - 48px);
    margin: 0 0 12px;
    padding: 0;
    background: transparent;
    border: none;
    font: inherit;
    font-size: 13px;
    font-weight: 700;
    color: var(--primary-blue);
    cursor: pointer;
    text-align: left;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.modal-back-btn:hover {
    text-decoration: underline;
}

.modal-back-btn.hidden {
    display: none;
}

/* « Vu aussi dans… » : le même fait, raconté par d'autres thèmes. */
.modal-linked-row {
    margin-top: 16px;
}

.modal-linked-label {
    font-size: 13px;
    font-weight: 700;
    color: var(--muted-text);
    margin-bottom: 8px;
}

.modal-linked-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.modal-linked-btn {
    display: flex;
    flex-direction: column;
    gap: 2px;
    width: 100%;
    padding: 10px 14px;
    text-align: left;
    background: transparent;
    border: 1px solid var(--border-soft);
    border-radius: 12px;
    cursor: pointer;
    font: inherit;
    color: var(--ink-soft);
}

.modal-linked-btn:hover {
    border-color: var(--primary-blue);
}

.modal-linked-theme {
    font-size: 14px;
    font-weight: 700;
    color: var(--primary-blue);
}

/* En mode sombre, --primary-blue (#001a4b) se confond avec le fond de la fiche :
   le nom du thème et la bordure au survol passent en blanc. */
:root[data-theme="dark"] .modal-linked-theme {
    color: #fff;
}

:root[data-theme="dark"] .modal-linked-btn:hover {
    border-color: #fff;
}

.modal-linked-title {
    font-size: 13px;
}

.modal-linked-more {
    align-self: flex-start;
    padding: 6px 12px;
    background: transparent;
    border: none;
    font: inherit;
    font-size: 13px;
    font-weight: 700;
    color: var(--primary-blue);
    cursor: pointer;
    text-decoration: underline;
}

/* Ligne d'actions additionnelle affichée uniquement quand la fiche est ouverte
           depuis « Découvrir un événement » : reroll et accès direct au thème d'origine. */
.modal-theme-row {
    display: flex;
    gap: 10px;
    margin-top: 22px;
    padding-top: 18px;
    border-top: 1px solid var(--border-soft);
}

.modal-theme-row .btn {
    flex: 1;
    padding: 10px 14px;
    font-size: 14px;
}

/* Explications du calcul des points (modale Réglages) */
.scoring-info-body h3 {
    font-size: 15px;
    color: var(--primary-blue);
    margin: 18px 0 6px;
}

.scoring-info-body h3:first-child {
    margin-top: 0;
}

.scoring-info-body p {
    font-size: 14px;
    line-height: 1.55;
    color: var(--ink-soft);
    margin-bottom: 8px;
}

.scoring-info-body ul {
    margin: 6px 0 10px 20px;
    padding: 0;
    font-size: 13.5px;
    color: var(--ink-soft);
    line-height: 1.55;
}

.scoring-info-body li {
    margin-bottom: 6px;
}

.scoring-info-body em {
    color: var(--muted-text);
}

/* Mode Quiz */
/* Les écrans à carcasse de quiz remplissent la hauteur du body (qui ne défile pas : overflow hidden)
   et c'est leur corps qui défile, sous la barre de partie. Sans cela, une fiche révélée plus haute
   que l'écran — celle du « Qui est-ce ? » et du portrait du jour — restait coupée, sans moyen
   d'atteindre « Continuer » ni de revenir au menu. */
#screen-lesson,
#screen-quiz,
#screen-ordre,
#screen-blitz,
#screen-curseur,
#screen-intrus,
#screen-whois,
#screen-simultaneity {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.quiz-body {
    width: 100%;
    max-width: 700px;
    margin: 0 auto;
    padding: 20px 16px 40px;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.quiz-question-card {
    background: var(--surface);
    border-radius: 14px;
    padding: 28px 24px;
    text-align: center;
    box-shadow: var(--card-shadow);
    margin-bottom: 24px;
}

.quiz-kicker {
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--muted-text);
    margin-bottom: 10px;
}

.quiz-prompt {
    font-size: 21px;
    font-weight: 700;
    color: var(--text-dark);
    line-height: 1.35;
}

.quiz-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 22px;
}

.quiz-option {
    background: var(--surface);
    border: 2px solid var(--border-soft);
    border-radius: 12px;
    padding: 16px 20px;
    font: inherit;
    font-size: 17px;
    font-weight: 600;
    color: var(--text-dark);
    text-align: left;
    cursor: pointer;
    transition: transform 0.15s, border-color 0.15s, background 0.15s;
}

/* (hover: hover) évite qu'un tap tactile (tablette) ne laisse l'option
           encadrée dans son état survolé une fois le doigt relevé — aucun mouseleave
           n'est jamais émis sur ces appareils, et le cadre reste alors visible sur les
           nouvelles options rendues à la question suivante, sans rapport avec elles. */
@media (hover: hover) {
    .quiz-option:hover {
        transform: translateY(-2px);
        border-color: var(--primary-blue);
    }
}

.quiz-option.correct {
    background: rgba(44, 168, 90, 0.14);
    border-color: #2CA85A;
    color: var(--success-text);
}

.quiz-option.wrong {
    background: rgba(217, 83, 79, 0.12);
    border-color: var(--danger-red);
    color: var(--danger-red-text);
}

.quiz-option.disabled-5050 {
    opacity: 0.3;
}

.quiz-fifty-row {
    text-align: center;
}

.quiz-fifty-btn {
    padding: 10px 22px;
    border-radius: 999px;
    border: none;
    background: var(--surface-2);
    color: var(--text-dark);
    font: inherit;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
}

.quiz-fifty-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* === MODE « REMISE EN ORDRE » (voir js/app.js: renderOrdreCards) ===
   Les cartes se touchent du plus ancien au plus récent, et le rang s'inscrit
   dans la pastille de gauche. Ce sont de vrais <button> : le mode se joue
   donc aussi bien au clavier qu'au doigt, ce qu'un glisser-déposer aurait
   rendu impossible. */
.ordre-progress-hint {
    margin-top: 8px;
    font-size: 14px;
    color: var(--muted-text);
}

.ordre-cards {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 16px;
}

.ordre-card {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    padding: 14px 16px;
    border-radius: 12px;
    border: 2px solid var(--border-soft);
    background: var(--surface);
    color: var(--text-dark);
    font: inherit;
    text-align: left;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s, transform 0.15s;
}

@media (hover: hover) {
    .ordre-card:hover {
        border-color: var(--primary-blue);
    }
}

.ordre-card.placed {
    border-color: var(--primary-blue);
    background: var(--selected-tint);
}

.ordre-card.correct {
    background: rgba(44, 168, 90, 0.14);
    border-color: #2CA85A;
}

.ordre-card.wrong {
    background: rgba(186, 26, 26, 0.1);
    border-color: var(--danger-red);
}

/* La pastille garde sa place même vide : sans largeur fixe, les titres
   sauteraient latéralement à chaque carte touchée. */
.ordre-rank {
    flex: 0 0 auto;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-year);
    font-weight: 700;
    font-size: 15px;
    border: 1px dashed var(--border-soft);
    color: var(--muted-text);
}

.ordre-card.placed .ordre-rank {
    border-style: solid;
    border-color: var(--primary-blue);
    background: var(--primary-blue);
    color: var(--text-light);
}

.ordre-card-title {
    font-size: 15px;
    font-weight: 600;
    line-height: 1.3;
}

.ordre-actions {
    display: flex;
    justify-content: center;
    margin-bottom: 18px;
}

.ordre-reset-btn {
    background: none;
    border: none;
    font: inherit;
    font-size: 14px;
    color: var(--muted-text);
    text-decoration: underline;
    cursor: pointer;
}

/* === MODE « BLITZ 60 SECONDES » (voir js/app.js: startBlitzGame) ===
   Pas de vies : l'horloge est la seule contrainte, et c'est elle qui occupe
   la place que les cœurs tiennent ailleurs. */
.blitz-clock {
    font-family: var(--font-year);
    font-size: 18px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--ink);
}

.blitz-clock.urgent {
    color: var(--danger-red-text);
}

.blitz-rail .progress-fill {
    background: var(--danger-red);
}

.blitz-statement {
    background: var(--surface);
    border-radius: 14px;
    padding: 26px 22px;
    box-shadow: var(--card-shadow);
    text-align: center;
    margin-bottom: 22px;
}

.blitz-event {
    font-size: 19px;
    font-weight: 700;
    color: var(--text-dark);
    line-height: 1.3;
}

.blitz-link {
    margin: 12px 0;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--muted-text);
}

.blitz-buttons {
    display: flex;
    gap: 14px;
    margin-bottom: 18px;
}

/* Deux cibles larges et hautes : à ce rythme, le doigt vise mal. */
.blitz-btn {
    flex: 1;
    padding: 24px 10px;
    border-radius: 16px;
    border: 2px solid var(--border-soft);
    background: var(--surface);
    color: var(--text-dark);
    font: inherit;
    font-size: 20px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.1s, background 0.15s, border-color 0.15s;
}

.blitz-btn.correct {
    background: rgba(44, 168, 90, 0.18);
    border-color: #2CA85A;
    color: var(--success-text);
}

.blitz-btn.wrong {
    background: rgba(186, 26, 26, 0.12);
    border-color: var(--danger-red);
    color: var(--danger-red-text);
}

.blitz-tally {
    text-align: center;
    font-size: 14px;
    color: var(--muted-text);
}

/* === MODE « LE CURSEUR » (voir js/app.js: startCurseurGame) === */
.curseur-dial {
    background: var(--surface);
    border-radius: 14px;
    padding: 22px 20px 16px;
    box-shadow: var(--card-shadow);
    margin-bottom: 18px;
}

.curseur-value {
    text-align: center;
    font-family: var(--font-year);
    font-size: 34px;
    font-weight: 700;
    color: var(--ink);
    margin-bottom: 14px;
}

/* Piste épaisse et poignée large : on vise une année en glissant au pouce,
   pas à la souris. */
.curseur-range {
    width: 100%;
    height: 34px;
    background: transparent;
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
}

.curseur-range::-webkit-slider-runnable-track {
    height: 8px;
    border-radius: 4px;
    background: var(--border-soft);
}

.curseur-range::-moz-range-track {
    height: 8px;
    border-radius: 4px;
    background: var(--border-soft);
}

.curseur-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 30px;
    height: 30px;
    margin-top: -11px;
    border-radius: 50%;
    background: var(--primary-blue);
    border: 3px solid var(--surface);
    box-shadow: var(--card-shadow);
}

.curseur-range::-moz-range-thumb {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--primary-blue);
    border: 3px solid var(--surface);
}

.curseur-range:disabled {
    opacity: 0.6;
}

.curseur-bounds {
    display: flex;
    justify-content: space-between;
    font-family: var(--font-year);
    font-size: 13px;
    color: var(--muted-text);
}

.curseur-actions {
    display: flex;
    justify-content: center;
    margin-bottom: 18px;
}

.curseur-validate {
    min-width: 180px;
}

.curseur-verdict {
    border-radius: 12px;
    padding: 14px 16px;
    text-align: center;
    font-size: 16px;
    font-weight: 600;
}

.curseur-verdict.is-good {
    background: rgba(44, 168, 90, 0.14);
    color: var(--success-text);
}

.curseur-verdict.is-bad {
    background: rgba(186, 26, 26, 0.1);
    color: var(--danger-red-text);
}

/* === MODE « L'INTRUS » ===
   Réutilise .quiz-option pour les quatre choix et .simul-reveal pour le
   révélé ; seule la ligne de l'intrus s'en distingue. */
.simul-reveal-row.is-intrus .simul-reveal-year,
.simul-reveal-row.is-intrus .simul-reveal-text strong {
    color: var(--danger-red-text);
}

.simul-reveal-row.is-intrus .simul-reveal-text small {
    color: var(--danger-red-text);
    font-weight: 600;
}

/* Mode « Pendant ce temps, ailleurs… » (simultanéité — voir js/simultaneity.js).
   L'écran réutilise la carcasse du Quiz (.quiz-body, .quiz-option…) : seules
   l'ancre et le révélé lui sont propres. */
.simul-anchor-card {
    border-left: 4px solid var(--primary-blue);
}

/* L'année porte la question : elle doit se lire avant le titre, d'où la
   taille et la police à chasse ancienne, comme les dates de la frise. */
.simul-anchor-year {
    font-family: var(--font-year);
    font-size: 30px;
    font-weight: 700;
    color: var(--ink);
    line-height: 1.1;
    margin-bottom: 6px;
}

.simul-anchor-theme {
    margin-top: 10px;
    font-size: 13px;
    color: var(--muted-text);
}

/* Le révélé : la vraie récompense du mode. Il apparaît sous les options une
   fois la réponse donnée, bonne ou mauvaise. */
.simul-reveal {
    background: var(--surface);
    border-radius: 14px;
    border: 1px solid var(--border-soft);
    padding: 18px 20px;
    box-shadow: var(--card-shadow);
    animation: simul-reveal-in 0.32s ease-out both;
}

@keyframes simul-reveal-in {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .simul-reveal {
        animation: none;
    }
}

.simul-reveal-title {
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--muted-text);
    margin-bottom: 12px;
}

.simul-reveal-row {
    display: flex;
    gap: 14px;
    align-items: baseline;
    padding: 7px 0;
}

.simul-reveal-row+.simul-reveal-row {
    border-top: 1px solid var(--border-soft);
}

.simul-reveal-year {
    flex: 0 0 auto;
    min-width: 58px;
    font-family: var(--font-year);
    font-weight: 700;
    color: var(--ink);
}

.simul-reveal-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    color: var(--text-dark);
    font-size: 15px;
    line-height: 1.35;
}

.simul-reveal-text small {
    color: var(--muted-text);
    font-size: 12px;
}

.simul-next-btn {
    display: block;
    margin: 16px auto 0;
    min-width: 160px;
}

/* Mode Carte (localisation géographique puis temporelle — voir js/geoMap.js) */
.geo-body {
    max-width: 720px;
    margin: 0 auto;
    padding: 16px 16px 40px;
}

.geo-scope-chip {
    display: inline-block;
    margin: 0 auto 14px;
    padding: 4px 14px;
    border-radius: 999px;
    background: var(--surface-2);
    color: var(--primary-blue);
    font-size: 12px;
    font-weight: 700;
    text-align: center;
}

.geo-body>.geo-scope-chip {
    display: block;
    width: fit-content;
}

.geo-phase-kicker {
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--muted-text);
    margin-bottom: 10px;
}

.geo-event-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-dark);
    line-height: 1.35;
    margin-bottom: 8px;
}

.geo-event-desc {
    font-size: 14.5px;
    color: var(--muted-text);
    line-height: 1.5;
    max-height: 4.5em;
    overflow: hidden;
}

.geo-reveal-label {
    text-align: center;
    font-weight: 700;
    font-size: 15px;
    padding: 10px 16px;
    border-radius: 12px;
    margin-bottom: 16px;
}

.geo-reveal-label.is-correct {
    background: rgba(44, 168, 90, 0.14);
    color: var(--success-text);
}

.geo-reveal-label.is-wrong {
    background: rgba(217, 83, 79, 0.12);
    color: var(--danger-red-text);
}

.geo-map-frame {
    position: relative;
    width: 100%;
    /* Une carte à viser doit être grande : haute comme l'écran le permet, ni écrasée ni démesurée. */
    height: clamp(260px, 42vh, 520px);
    background: #eaf3fb;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: var(--card-shadow);
}

:root[data-theme="dark"] .geo-map-frame {
    background: #142033;
}

/* L'identifiant : maplibre-gl.css pose `.maplibregl-map { position: relative }` et, chargé plus tard,
   l'emporterait sur une classe (voir #atlas-map). */
#geo-map.geo-map {
    position: absolute;
    inset: 0;
}

/* Mire : la carte se vise au clavier en posant le repère en son centre (Entrée) ; elle n'apparaît
   donc que lorsque la carte a le focus clavier. */
.geo-crosshair,
.cities-crosshair {
    display: none;
    position: absolute;
    left: 50%;
    top: 50%;
    width: 26px;
    height: 26px;
    margin: -13px 0 0 -13px;
    pointer-events: none;
    border: 2px solid var(--primary-blue);
    border-radius: 50%;
    box-shadow: 0 0 0 2px #fff;
}

#geo-map:focus-visible+.geo-crosshair {
    display: block;
}

.geo-hint {
    margin: 0 0 8px;
    font-size: 14px;
    color: var(--muted-text);
    text-align: center;
    min-height: 1.4em;
}

.geo-status {
    min-height: 1.4em;
    margin-top: 8px;
    font-size: 13px;
    color: var(--muted-text);
    text-align: center;
}

.geo-actions {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 6px;
    /* « Valider » et « Continuer » restent à portée du pouce même quand la carte dépasse l'écran. */
    position: sticky;
    bottom: 0;
    z-index: 5;
    padding: 10px 0 calc(env(safe-area-inset-bottom, 0px) + 10px);
    background: linear-gradient(to bottom, rgba(242, 244, 247, 0), var(--bg-color) 45%);
}

.geo-actions .btn[disabled] {
    opacity: 0.45;
    cursor: default;
}

/* Les repères : une goutte posée par le joueur, une autre (verte) sur la bonne réponse. */
.geo-pin {
    width: 28px;
    height: 28px;
    border-radius: 50% 50% 50% 0;
    transform: rotate(-45deg);
    border: 3px solid #ffffff;
    box-shadow: 0 3px 8px rgba(0, 26, 75, 0.35);
    cursor: grab;
}

.geo-pin-player {
    background: #d1438a;
}

.geo-pin-answer {
    background: #2CA85A;
    cursor: default;
}

.geo-reveal-label.is-ok {
    background: var(--selected-tint);
    color: var(--text-dark);
}

.geo-time-phase {
    margin-top: 4px;
}

/* Carte d'accès au Mode Carte, injectée dans screen-subcategories /
           screen-themes (voir js/geoMap.js: buildGeoModeCard) — même gabarit que
           .special-card, teinte propre pour la distinguer visuellement. */
.geo-mode-card {
    margin-bottom: 6px;
}

/* Mode Carte, Chrono-Géo et (au niveau des Panthéons) Galerie des portraits : une même rangée sur toute la
   largeur de la grille parente. Trois colonnes dès la tablette ; sur téléphone, deux colonnes pour les deux
   modes et la galerie en pleine largeur dessous. Le .gallery-launcher se dissout (display: contents) pour que
   son bouton prenne place dans la rangée et que son choix d'ordre s'ouvre sur toute la largeur. */
.geo-mode-row {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.geo-mode-row .geo-mode-card {
    margin-bottom: 0;
    padding: 14px 16px;
    min-height: 0;
    justify-content: flex-start;
}

.geo-mode-row .gallery-launcher {
    display: contents;
}

.geo-mode-row .gallery-launcher-btn {
    grid-column: 1 / -1;
    height: 100%;
    margin: 0;
    padding: 14px 16px;
    border-radius: 12px;
    gap: 10px;
}

.geo-mode-row .gallery-launcher-icon {
    font-size: 26px;
}

.geo-mode-row .gallery-launcher-title {
    font-size: 16px;
}

.geo-mode-row .gallery-order-picker {
    grid-column: 1 / -1;
    margin-top: 0;
}

/* « Année entière » et « Méthodologie » occupent toute la largeur sur téléphone, comme la galerie. */
.geo-mode-row .year-mode-card,
.geo-mode-row .methodo-mode-card {
    grid-column: 1 / -1;
}

@media (min-width: 768px) {
    .geo-mode-row {
        gap: 16px;
    }

    /* Trois colonnes seulement quand il y a un troisième élément ; sinon les deux modes se partagent la ligne. */
    .geo-mode-row.has-extra {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .geo-mode-row .gallery-launcher-btn {
        grid-column: auto;
    }

    .geo-mode-row .year-mode-card,
    .geo-mode-row .methodo-mode-card {
        grid-column: auto;
    }

    .geo-mode-row .geo-mode-card {
        padding: 18px 20px;
    }
}

/* Mode « Le fil du temps » */
.fil-body {
    max-width: 480px;
    margin: 0 auto;
    padding: 20px 16px 40px;
}

.fil-question-card {
    background: var(--surface);
    border-radius: 14px;
    padding: 28px 24px;
    text-align: center;
    box-shadow: var(--card-shadow);
    margin-bottom: 22px;
}

.fil-kicker {
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--muted-text);
    margin-bottom: 10px;
}

.fil-prompt {
    font-size: 21px;
    font-weight: 700;
    color: var(--text-dark);
    line-height: 1.35;
}

.fil-display {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 12px;
    margin-bottom: 15px;
}

.fil-display-value {
    min-width: 140px;
    background: var(--surface);
    border: 2px solid var(--border-soft);
    border-radius: 12px;
    padding: 14px 10px;
    font-size: 28px;
    font-weight: 700;
    letter-spacing: 1px;
    color: var(--text-dark);
    text-align: center;
}

.fil-display-value.fil-feedback-correct {
    border-color: #2CA85A;
    background: rgba(44, 168, 90, 0.14);
    color: var(--success-text);
}

.fil-display-value.fil-feedback-wrong {
    border-color: var(--danger-red);
    background: rgba(217, 83, 79, 0.12);
    color: var(--danger-red-text);
}

.fil-hint-btn {
    padding: 12px 16px;
    border-radius: 12px;
    border: 2px solid var(--border-soft);
    background: var(--surface-2);
    color: var(--text-dark);
    font: inherit;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    white-space: nowrap;
    transition: opacity 0.2s;
    justify-self: end;
}

.fil-hint-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.ecart-chances-badge {
    /* Simple compteur : il réutilise l'apparence de .fil-hint-btn mais n'a
       aucun clic, et son curseur « main » promettait une action inexistante. */
    cursor: default;
}

.fil-era-btn {
    padding: 12px 16px;
    border-radius: 12px;
    border: 2px solid var(--border-soft);
    background: var(--surface-2);
    color: var(--text-dark);
    font: inherit;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    white-space: nowrap;
    justify-self: start;
}

.fil-era-btn.era-bc {
    border-color: var(--primary-blue);
    color: var(--primary-blue);
}

.fil-answer-badge {
    text-align: center;
    font-weight: 700;
    padding: 10px 16px;
    border-radius: 9999px;
    margin: 0 auto 22px;
    max-width: 300px;
    font-size: 16px;
}

.fil-answer-badge.badge-wrong {
    background: rgba(217, 83, 79, 0.12);
    color: var(--danger-red-text);
    border: 1px solid var(--danger-red);
}

.fil-answer-badge.badge-correct {
    background: rgba(44, 168, 90, 0.14);
    color: var(--success-text);
    border: 1px solid #2CA85A;
}

.fil-keypad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 16px;
}

.fil-key {
    background: var(--surface);
    border: 2px solid var(--border-soft);
    border-radius: 12px;
    padding: 16px 0;
    font: inherit;
    font-size: 20px;
    font-weight: 700;
    color: var(--text-dark);
    cursor: pointer;
    transition: transform 0.1s, background 0.1s;
}

.fil-key:hover {
    background: var(--surface-2);
}

.fil-key:active {
    transform: scale(0.94);
}

.fil-key-erase {
    font-size: 17px;
}

.fil-validate-btn {
    display: block;
    width: 100%;
    padding: 16px 0;
    border-radius: 12px;
    border: none;
    background: var(--primary-blue);
    color: white;
    font: inherit;
    font-weight: 700;
    font-size: 17px;
    cursor: pointer;
}

.fil-validate-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Mode « Périodes & Ères » */
.periodes-body {
    max-width: 700px;
    margin: 0 auto;
    padding: 20px 16px 40px;
}

.periodes-question-card {
    background: var(--surface);
    border-radius: 14px;
    padding: 28px 24px;
    text-align: center;
    box-shadow: var(--card-shadow);
    margin-bottom: 24px;
}

.periodes-kicker {
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--muted-text);
    margin-bottom: 10px;
    font-weight: 700;
}

.periodes-prompt {
    font-size: 21px;
    font-weight: 700;
    color: var(--text-dark);
    line-height: 1.35;
}

.periodes-tag {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 12.5px;
    font-weight: 600;
    margin-top: 12px;
    background: var(--surface-2);
    color: var(--muted-text);
}

.periodes-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 22px;
}

@media (max-width: 640px) {
    .periodes-options {
        grid-template-columns: 1fr;
    }
}

.periodes-option {
    background: var(--surface);
    border: 2px solid var(--border-soft);
    border-radius: 12px;
    padding: 18px 20px;
    font: inherit;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-dark);
    text-align: center;
    cursor: pointer;
    transition: transform 0.15s, border-color 0.15s, background 0.15s;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    min-height: 72px;
}

/* (hover: hover) évite qu'un tap tactile (tablette) ne laisse l'option
           encadrée dans son état survolé une fois le doigt relevé — aucun mouseleave
           n'est jamais émis sur ces appareils, et le cadre reste alors visible sur les
           nouvelles options rendues à la question suivante, sans rapport avec elles. */
@media (hover: hover) {
    .periodes-option:hover {
        transform: translateY(-2px);
        border-color: #8E44AD;
    }
}

.periodes-option-main {
    font-size: 17px;
    font-weight: 700;
    color: var(--text-dark);
}

.periodes-option-sub {
    font-size: 13px;
    color: var(--muted-text);
}

.periodes-option.correct {
    background: rgba(44, 168, 90, 0.14);
    border-color: #2CA85A;
    color: var(--success-text);
}

.periodes-option.correct .periodes-option-main {
    color: var(--success-text);
}

.periodes-option.wrong {
    background: rgba(217, 83, 79, 0.12);
    border-color: var(--danger-red);
    color: var(--danger-red-text);
}

.periodes-option.wrong .periodes-option-main {
    color: var(--danger-red-text);
}

/* MODE AVANT / APRÈS (deux événements sans date, deviner l'antériorité) */
.avap-body {
    max-width: 700px;
    margin: 0 auto;
    padding: 20px 16px 40px;
}

.avap-kicker-card {
    background: var(--surface);
    border-radius: 14px;
    padding: 20px 24px;
    text-align: center;
    box-shadow: var(--card-shadow);
    margin-bottom: 22px;
    font-size: 15px;
    font-weight: 700;
    color: var(--text-dark);
}

.avap-options {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.avap-option {
    background: var(--surface);
    border: 2px solid var(--border-soft);
    border-radius: 14px;
    padding: 22px 20px;
    font: inherit;
    text-align: center;
    cursor: pointer;
    transition: transform 0.15s, border-color 0.15s, background 0.15s;
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: center;
    width: 100%;
}

/* (hover: hover) évite qu'un tap tactile (tablette) ne laisse l'option
           encadrée dans son état survolé une fois le doigt relevé — aucun mouseleave
           n'est jamais émis sur ces appareils, et le cadre reste alors visible sur les
           nouvelles options rendues à la question suivante, sans rapport avec elles. */
@media (hover: hover) {
    .avap-option:hover {
        transform: translateY(-2px);
        border-color: var(--primary-blue);
    }
}

/* Le focus persiste sur le même bouton d'une question à l'autre (les boutons ne
           sont pas recréés) : on masque l'anneau natif pour éviter qu'il ne soit confondu
           avec le résultat de la question précédente, en gardant un repère clavier. */
.avap-option:focus {
    outline: none;
}

.avap-option:focus-visible {
    outline: 2px solid var(--primary-blue);
    outline-offset: 2px;
}

.avap-option-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-dark);
    line-height: 1.35;
}

.avap-option-year {
    font-size: 14px;
    font-weight: 600;
    color: var(--muted-text);
}

.avap-option.correct {
    background: rgba(44, 168, 90, 0.14);
    border-color: #2CA85A;
}

.avap-option.correct .avap-option-title {
    color: var(--success-text);
}

.avap-option.wrong {
    background: rgba(217, 83, 79, 0.12);
    border-color: var(--danger-red);
}

.avap-option.wrong .avap-option-title {
    color: var(--danger-red-text);
}

.avap-vs {
    text-align: center;
    font-size: 12.5px;
    font-weight: 800;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--muted-text);
    margin: 4px 0;
}

/* MODE TROUVE L'ÉCART (deux événements sans date, estimer le nombre d'années qui les séparent) */
.ecart-pair {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    margin-top: 14px;
}

.ecart-pair-event {
    font-size: 17px;
    font-weight: 700;
    color: var(--text-dark);
    line-height: 1.3;
}

.ecart-pair-sep {
    font-size: 13px;
    color: var(--muted-text);
}

.ecart-pair-years {
    display: flex;
    justify-content: center;
    gap: 14px;
    margin-top: 8px;
    min-height: 18px;
}

.ecart-pair-year {
    font-size: 13px;
    font-weight: 600;
    color: var(--primary-blue);
}

.ecart-unit-label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: default;
}

/* « Trouve l'écart » et « Le fil du temps » : tout tient dans l'écran, pavé numérique et « Valider » compris. La zone des deux événements prend la
   hauteur laissée libre par le reste ; quand le message (plus / moins / écart réel) apparaît, elle rétrécit d'autant, si bien
   que l'affichage, les touches et « Valider » ne bougent jamais. */
#screen-ecart,
#screen-fil {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

#screen-ecart .fil-body,
#screen-fil .fil-body {
    width: 100%;
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px 16px 14px;
    overflow-y: auto;
}

.fil-top {
    flex: 1 1 auto;
    min-height: 150px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

#screen-ecart .fil-question-card,
#screen-fil .fil-question-card {
    flex: 1 1 0;
    min-height: 0;
    margin: 0;
    padding: 16px 18px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    overflow: hidden;
}

#screen-ecart .fil-kicker,
#screen-fil .fil-kicker { margin-bottom: 6px; }

#screen-ecart .ecart-pair,
#screen-fil .ecart-pair { margin-top: 6px; }

#screen-ecart .fil-answer-badge,
#screen-fil .fil-answer-badge {
    flex: none;
    margin: 0 auto;
    padding: 8px 16px;
    max-width: none;
    width: 100%;
    box-sizing: border-box;
}

#screen-ecart .fil-display,
#screen-fil .fil-display { margin-bottom: 0; }

#screen-ecart .fil-display-value,
#screen-fil .fil-display-value { padding: 10px; }

#screen-ecart .fil-keypad,
#screen-fil .fil-keypad {
    gap: 8px;
    margin-bottom: 0;
}

#screen-ecart .fil-key,
#screen-fil .fil-key { padding: 11px 0; }

#screen-ecart .fil-validate-btn,
#screen-fil .fil-validate-btn { flex: none; padding: 14px 0; }

/* Message affiché : la consigne cède la place, les deux événements restent lisibles. */
@supports selector(:has(*)) {
    .fil-top:has(.fil-answer-badge:not(.hidden)) .fil-kicker { display: none; }
    .fil-top:has(.fil-answer-badge:not(.hidden)) .ecart-pair-event { font-size: 15px; }
    .fil-top:has(.fil-answer-badge:not(.hidden)) .fil-prompt { font-size: 17px; }
}

#screen-end {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow-y: auto;
    padding: 20px 10px;
}

.end-title {
    font-size: 28px;
    margin-bottom: 12px;
    color: var(--primary-blue);
    font-weight: 800;
}

.end-score {
    font-size: 22px;
    margin-bottom: 12px;
}

.end-time {
    font-size: 16px;
    margin-bottom: 16px;
    color: var(--muted-text);
    font-weight: bold;
}

.end-xp {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: linear-gradient(135deg, #F59E0B, #10B981);
    color: white;
    padding: 6px 14px;
    border-radius: 9999px;
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 12px;
}

/* Entrée de l'XP gagné en fin de partie (voir endGame() dans js/app.js, qui
           ajoute cette classe et anime le chiffre en comptage montant) : la puce
           "rebondit" vers sa position finale plutôt que d'apparaître figée. */
@keyframes xpChipRise {
    0% {
        opacity: 0;
        transform: translateY(16px) scale(0.85);
    }

    60% {
        opacity: 1;
        transform: translateY(-4px) scale(1.06);
    }

    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.end-xp.xp-rise {
    animation: xpChipRise 0.55s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* --- SYSTÈME DE RÉTENTION : STREAKS, PARTAGE WORDLE & ANECDOTES --- */
.end-streak-banner {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: linear-gradient(135deg, rgba(255, 107, 53, 0.12), rgba(247, 147, 30, 0.18));
    border: 1px solid rgba(247, 147, 30, 0.35);
    color: #d35400;
    padding: 6px 14px;
    border-radius: 9999px;
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 15px;
}

:root[data-theme="dark"] .end-streak-banner {
    color: #f39c12;
    background: rgba(247, 147, 30, 0.15);
    border-color: rgba(247, 147, 30, 0.4);
}

/* Célébration de série en fin de partie : un vrai rebond d'entrée plutôt que
           le texte qui se contente de changer (voir endGame() dans js/app.js). */
@keyframes streakBannerPop {
    0% {
        opacity: 0;
        transform: scale(0.7) translateY(10px);
    }

    55% {
        opacity: 1;
        transform: scale(1.08) translateY(-2px);
    }

    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.end-streak-banner.streak-pop {
    animation: streakBannerPop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@media (prefers-reduced-motion: reduce) {

    .end-xp.xp-rise,
    .end-streak-banner.streak-pop {
        animation: none;
    }
}

/* Conteneur et carte de fin */
.end-content-wrapper {
    width: 100%;
    max-width: 480px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

/* Carte de partage Wordle */
.share-card {
    width: 100%;
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: 16px;
    padding: 16px;
    margin: 14px 0;
    box-shadow: var(--card-shadow);
    text-align: center;
    box-sizing: border-box;
}

.share-card-header {
    font-size: 12px;
    font-weight: 700;
    color: var(--muted-text);
    text-transform: uppercase;
    letter-spacing: 0.6px;
    margin-bottom: 8px;
}

.share-emojis-grid {
    font-size: 22px;
    line-height: 1.4;
    letter-spacing: 3px;
    margin-bottom: 12px;
    word-break: break-all;
    user-select: all;
}

.btn-share {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: linear-gradient(135deg, #10B981, #059669);
    color: white;
    border: none;
    padding: 11px 20px;
    border-radius: 9999px;
    font-size: 14.5px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
    transition: transform 0.15s ease, opacity 0.15s ease;
    width: 100%;
}

.btn-share:hover {
    transform: translateY(-2px);
    opacity: 0.92;
}

.btn-share:active {
    transform: translateY(0);
}

/* Anecdote Historique « Le Saviez-vous ? » */
.anecdote-card-wrapper {
    width: 100%;
    margin-top: 16px;
    text-align: left;
}

.anecdote-card {
    background: var(--surface);
    border-left: 4px solid var(--favorite-yellow);
    border-top: 1px solid var(--border-soft);
    border-right: 1px solid var(--border-soft);
    border-bottom: 1px solid var(--border-soft);
    border-radius: 14px;
    padding: 16px 18px;
    box-shadow: var(--card-shadow);
}

.anecdote-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
    gap: 8px;
}

.anecdote-badge {
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: #b7791f;
    background: rgba(212, 160, 23, 0.15);
    padding: 3px 8px;
    border-radius: 9999px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

:root[data-theme="dark"] .anecdote-badge {
    color: #f6e05e;
    background: rgba(246, 224, 94, 0.2);
}

.anecdote-date {
    font-size: 12.5px;
    font-weight: 700;
    color: var(--muted-text);
}

.anecdote-event-title {
    font-size: 15.5px;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 6px;
    line-height: 1.35;
}

.anecdote-desc {
    font-size: 13.5px;
    line-height: 1.5;
    color: var(--on-surface-variant);
    margin-bottom: 10px;
}

.anecdote-wiki-link {
    font-size: 12.5px;
    font-weight: 600;
    color: #2980b9;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: color 0.15s;
}

.anecdote-wiki-link:hover {
    color: #1a5276;
    text-decoration: underline;
}

:root[data-theme="dark"] .anecdote-wiki-link {
    color: #5dade2;
}

/* Toast notification */
.toast-notification {
    position: fixed;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%) translateY(0);
    background: rgba(20, 29, 35, 0.82);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    padding: 12px 24px;
    border-radius: 9999px;
    font-size: 14.5px;
    font-weight: 600;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
    z-index: 100000;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: none;
}

.toast-notification.toast-hide {
    opacity: 0;
    transform: translateX(-50%) translateY(20px);
}


/* --- ANIMATIONS ET GAME FEEL (ÉLASTICITÉ, SECOUSSE, HALO, TOUCH) --- */
@keyframes errorShake {

    0%,
    100% {
        transform: translateX(0);
    }

    20% {
        transform: translateX(-9px) rotate(-1.2deg);
    }

    40% {
        transform: translateX(9px) rotate(1.2deg);
    }

    60% {
        transform: translateX(-5px);
    }

    80% {
        transform: translateX(5px);
    }
}

.shake-anim {
    animation: errorShake 0.45s ease-in-out !important;
}

@keyframes comboGlow {
    0% {
        transform: scale(1);
        filter: drop-shadow(0 0 0 rgba(247, 147, 30, 0));
    }

    50% {
        transform: scale(1.18);
        filter: drop-shadow(0 0 10px rgba(247, 147, 30, 0.85));
    }

    100% {
        transform: scale(1);
        filter: drop-shadow(0 0 0 rgba(247, 147, 30, 0));
    }
}

.combo-pulse {
    animation: comboGlow 0.42s ease-out;
}

/* Micro-interactions tactiles réactives */
.btn,
.data-card,
.mode-card,
.quiz-option,
.avap-option,
.periodes-option,
.quick-action-circle,
.selection-item {
    transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
    -webkit-tap-highlight-color: transparent;
}

.btn:active,
.data-card:active,
.mode-card:active,
.quiz-option:active,
.avap-option:active,
.periodes-option:active,
.quick-action-circle:active {
    transform: scale(0.96) !important;
}

/* Pulse vert sur le repère qui vient d'être placé correctement sur la frise
           (au-delà du simple fondu de .entry-new) : un léger rebond + halo vert qui
           confirme visuellement la bonne réponse, symétrique du tremblement rouge de
           .shake-anim côté erreur. */
@keyframes correctPulse {
    0% {
        transform: scale(0.94);
        box-shadow: 0 0 0 0 rgba(30, 142, 62, 0.45);
    }

    45% {
        transform: scale(1.03);
        box-shadow: 0 0 0 9px rgba(30, 142, 62, 0);
    }

    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(30, 142, 62, 0);
    }
}

.entry-correct-pulse {
    animation: entryLand 0.62s var(--ease-out) backwards;
}

/* Pulse bonne/mauvaise réponse sur les boutons de choix des modes Quiz,
           Avant/Après, Périodes & Ères et Mode Carte (temporel) : ils reçoivent déjà
           les classes .correct/.wrong (couleur figée définie plus haut), on y ajoute
           ici juste le mouvement. */
@keyframes optionCorrectPulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(44, 168, 90, 0.45);
    }

    45% {
        transform: scale(1.035);
        box-shadow: 0 0 0 9px rgba(44, 168, 90, 0);
    }

    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(44, 168, 90, 0);
    }
}

@keyframes optionWrongPulse {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-6px);
    }

    50% {
        transform: translateX(6px);
    }

    75% {
        transform: translateX(-3px);
    }
}

.quiz-option.correct,
.avap-option.correct,
.periodes-option.correct,
.fil-display-value.fil-feedback-correct {
    animation: optionCorrectPulse 0.5s ease-out;
}

.quiz-option.wrong,
.avap-option.wrong,
.periodes-option.wrong,
.fil-display-value.fil-feedback-wrong {
    animation: optionWrongPulse 0.4s ease-in-out;
}

/* Pins du Mode Carte : transform de base translate(-50%,-50%) pour le
           centrage, à préserver dans l'animation sous peine de faire sauter le pin
           de sa position lors du pulse. */
@keyframes geoPinCorrectPulse {
    0% {
        transform: translate(-50%, -50%) scale(1);
    }

    45% {
        transform: translate(-50%, -50%) scale(1.22);
        box-shadow: 0 3px 8px rgba(0, 26, 75, 0.25), 0 0 0 8px rgba(44, 168, 90, 0);
    }

    100% {
        transform: translate(-50%, -50%) scale(1);
    }
}

@keyframes geoPinWrongPulse {

    0%,
    100% {
        transform: translate(-50%, -50%) rotate(0);
    }

    25% {
        transform: translate(-50%, -50%) rotate(-10deg);
    }

    50% {
        transform: translate(-50%, -50%) rotate(10deg);
    }

    75% {
        transform: translate(-50%, -50%) rotate(-5deg);
    }
}

@media (prefers-reduced-motion: reduce) {

    .entry-correct-pulse,
    .quiz-option.correct,
    .avap-option.correct,
    .periodes-option.correct,
    .fil-display-value.fil-feedback-correct,
    .quiz-option.wrong,
    .avap-option.wrong,
    .periodes-option.wrong,
    .fil-display-value.fil-feedback-wrong {
        animation: none;
    }
}

/* --- APPARITION EN CASCADE (STAGGER) DES LISTES DE CARTES --- */
/* Catégories, sous-catégories, thèmes, favoris, points faibles à réviser :
           décale légèrement l'entrée de chaque carte selon --stagger-i (posé en JS,
           voir applyStagger() dans js/app.js) pour une ouverture de liste plus vivante
           qu'un affichage simultané figé. Délai plafonné côté JS pour qu'une longue
           liste ne fasse pas attendre ses dernières cartes une éternité. */
@keyframes staggerIn {
    from {
        opacity: 0;
        transform: translateY(14px) scale(0.97);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.stagger-in {
    animation: staggerIn 0.36s cubic-bezier(0.16, 1, 0.3, 1) backwards;
    animation-delay: calc(var(--stagger-i, 0) * 45ms);
}

@media (prefers-reduced-motion: reduce) {
    .stagger-in {
        animation: none;
    }
}

#confetti-canvas {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 99999;
}


/* --- GAMIFICATION : RANGS, XP & TROPHÉES --- */
.profile-btn {
    position: fixed;
    top: 20px;
    right: 70px;
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    color: var(--text-dark);
    border: 1px solid var(--glass-border);
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    cursor: pointer;
    box-shadow: var(--card-shadow);
    z-index: 100;
    transition: transform 0.2s, background 0.2s;
}

.league-btn {
    position: fixed;
    top: 20px;
    right: 124px;
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    color: var(--text-dark);
    border: 1px solid var(--glass-border);
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 19px;
    cursor: pointer;
    box-shadow: var(--card-shadow);
    z-index: 100;
    transition: transform 0.2s, background 0.2s;
}

/* Barre fixe en haut de l'accueil (sticky, dans l'écran qui défile) : compte à gauche,
   raccourcis à droite. Remplace les anciens boutons en position fixed, qui pouvaient
   suivre le défilement de l'écran selon le moteur de rendu. */
#screen-categories {
    padding-top: 0;
}

.categories-topbar {
    position: sticky;
    top: 0;
    z-index: 60;
    align-self: stretch;
    margin: 0 -20px;
    padding: calc(var(--sat, 0px) + 8px) 20px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    box-sizing: border-box;
    background: color-mix(in srgb, var(--bg-color) 92%, transparent);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

.categories-topbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: auto;
}

.categories-topbar .league-btn,
.categories-topbar .profile-btn,
.categories-topbar .settings-btn {
    position: static;
    top: auto;
    right: auto;
    margin: 0;
    flex-shrink: 0;
}

/* Espace du bouton « Connexion » : même pastille bleu marine que « Niv. N » du profil. */
.account-header-btn {
    height: 42px;
    max-width: 55%;
    min-width: 0;
    padding: 0 18px;
    border: none;
    border-radius: 9999px;
    background: var(--primary-blue);
    color: #fff;
    font-size: 14px;
    font-weight: 800;
    letter-spacing: 0.2px;
    line-height: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    box-shadow: var(--card-shadow);
    cursor: pointer;
    flex-shrink: 1;
    transition: transform 0.2s, background 0.2s;
}

.account-header-btn:hover {
    transform: scale(1.04);
}

:root[data-theme="dark"] .account-header-btn {
    background: #2475ab;
}

/* Le bloc de recherche garde son espace d'avant (64px sous le haut de l'écran), la barre le remplace en partie. */
#screen-categories .search-bar-wrap {
    margin-top: 22px;
    margin-bottom: 16px;
}

.league-btn:hover {
    transform: scale(1.08);
    background: color-mix(in srgb, var(--surface) 92%, transparent);
}

.profile-btn:hover {
    transform: scale(1.08);
    background: color-mix(in srgb, var(--surface) 92%, transparent);
}

.player-rank-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: 16px;
    padding: 10px 16px;
    margin: 12px auto 0;
    max-width: 640px;
    width: 100%;
    box-shadow: var(--card-shadow);
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    box-sizing: border-box;
}

.player-rank-bar:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 26, 75, 0.08);
}

.player-rank-avatar {
    font-size: 24px;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(212, 160, 23, 0.15), rgba(247, 147, 30, 0.25));
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border: 1px solid rgba(212, 160, 23, 0.3);
}

.player-rank-details {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* Le badge de série (🔥 ×1.1) ajoute de la largeur : sans retour à la ligne,
   la rangée déborde sur le texte XP à droite et le masque. Les badges passent
   alors sous le titre au lieu de recouvrir les points. */
.player-rank-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 4px 8px;
}

.player-rank-title {
    font-size: 14.5px;
    font-weight: 700;
    color: var(--text-dark);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Sur petit écran, la barre de grade est trop étroite pour un rang sur une
   seule ligne une fois le badge de niveau et le texte XP soustraits (même
   le tout premier rang, le plus court, s'y retrouvait tronqué) : on laisse
   le titre passer sur deux lignes plutôt que de le couper. Tablette et
   ordinateur, où la largeur suffit, gardent l'ellipse d'origine. */
@media (max-width: 600px) {
    .player-rank-title {
        white-space: normal;
        overflow: visible;
        text-overflow: clip;
        line-height: 1.2;
    }

    .player-rank-row {
        align-items: flex-start;
    }

    .player-rank-level-badge {
        margin-top: 1px;
    }
}

.player-rank-level-badge {
    font-size: 11px;
    font-weight: 800;
    background: var(--primary-blue);
    color: white;
    padding: 2px 7px;
    border-radius: 9999px;
    letter-spacing: 0.3px;
    flex-shrink: 0;
    white-space: nowrap;
}

:root[data-theme="dark"] .player-rank-level-badge {
    /* #2980B9 donnait 4,3:1 au texte blanc de 11 px ; #2475AB, 5,0:1. */
    background: #2475ab;
}

.player-rank-streak-badge {
    font-size: 11px;
    font-weight: 800;
    background: linear-gradient(135deg, #FF6B35, #F7931E);
    color: white;
    padding: 2px 7px;
    border-radius: 9999px;
    letter-spacing: 0.2px;
    flex-shrink: 0;
    white-space: nowrap;
}

/* Légère flamme "vivante" tant que la série est en cours (badge visible,
           donc pas .hidden) : un rappel ambiant discret de l'enjeu de la série,
           plutôt qu'un badge complètement statique. */
@keyframes flameFlicker {

    0%,
    100% {
        filter: drop-shadow(0 0 0 rgba(247, 147, 30, 0));
    }

    50% {
        filter: drop-shadow(0 0 4px rgba(247, 147, 30, 0.7));
    }
}

.player-rank-streak-badge:not(.hidden) {
    animation: flameFlicker 1.8s ease-in-out infinite;
}

@media (prefers-reduced-motion: reduce) {
    .player-rank-streak-badge {
        animation: none;
    }
}

.player-rank-track {
    height: 6px;
    background: var(--border-soft);
    border-radius: 9999px;
    overflow: hidden;
    width: 100%;
}

.player-rank-fill {
    height: 100%;
    background: linear-gradient(90deg, #F59E0B, #10B981);
    border-radius: 9999px;
    transition: width 0.4s ease;
}

.player-rank-xp-text {
    font-size: 12px;
    font-weight: 600;
    color: var(--muted-text);
    white-space: nowrap;
    flex-shrink: 0;
}

/* Modale profil & trophées */
.profile-hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    background: linear-gradient(135deg, var(--surface-2), var(--surface));
    border: 1px solid var(--border-soft);
    border-radius: 20px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: var(--card-shadow);
}

.profile-hero-icon {
    font-size: 48px;
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: rgba(212, 160, 23, 0.2);
    border: 2px solid var(--favorite-yellow);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
    box-shadow: 0 4px 12px rgba(212, 160, 23, 0.3);
}

.profile-hero-title {
    font-size: 22px;
    font-weight: 800;
    color: var(--text-dark);
    margin-bottom: 4px;
}

.profile-hero-subtitle {
    font-size: 14px;
    font-weight: 600;
    color: var(--muted-text);
    margin-bottom: 12px;
}

.profile-hero-track {
    width: 100%;
    max-width: 320px;
    height: 8px;
    background: var(--border-soft);
    border-radius: 9999px;
    overflow: hidden;
    margin-bottom: 6px;
}

.profile-hero-fill {
    height: 100%;
    background: linear-gradient(90deg, #F59E0B, #10B981);
    border-radius: 9999px;
    transition: width 0.4s ease;
}

.profile-hero-xp-needed {
    font-size: 12px;
    color: var(--muted-text);
    font-weight: 500;
}

.profile-stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 24px;
}

@media (max-width: 520px) {
    .profile-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.profile-stat-box {
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: 14px;
    padding: 12px 8px;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.profile-stat-val {
    font-size: 18px;
    font-weight: 800;
    color: var(--text-dark);
}

.profile-stat-label {
    font-size: 11.5px;
    font-weight: 600;
    color: var(--muted-text);
}

.profile-section-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.profile-streak-multiplier {
    background: linear-gradient(135deg, rgba(255, 107, 53, 0.12), rgba(247, 147, 30, 0.18));
    border: 1px solid rgba(247, 147, 30, 0.35);
    /* #D35400 sur ce fond orangé pâle : 3,5:1. #A63F00 : 5,3:1, même famille. */
    color: #a63f00;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.4;
    margin-bottom: 20px;
}

:root[data-theme="dark"] .profile-streak-multiplier {
    color: #f39c12;
    background: rgba(247, 147, 30, 0.15);
    border-color: rgba(247, 147, 30, 0.4);
}

.trophies-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.trophy-card {
    display: flex;
    align-items: center;
    gap: 14px;
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: 14px;
    padding: 14px 16px;
    transition: all 0.2s ease;
}

.trophy-card.unlocked {
    border-color: rgba(212, 160, 23, 0.5);
    background: linear-gradient(135deg, rgba(212, 160, 23, 0.06), var(--surface));
}

/* Un trophée verrouillé s'estompe par son ICÔNE et son titre, pas par une
           opacité sur toute la carte : à 0,65, le texte qui dit comment le débloquer
           (« Réussir 5 thèmes de l'Antiquité ») tombait à 2:1 — l'information la plus
           utile de la carte était la moins lisible. */
.trophy-card.locked .trophy-icon {
    opacity: 0.55;
    filter: grayscale(1);
}

.trophy-card.locked .trophy-name {
    color: var(--muted-text);
}

.trophy-icon {
    font-size: 28px;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: var(--surface-2);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border: 1px solid var(--border-soft);
}

.trophy-card.unlocked .trophy-icon {
    background: rgba(212, 160, 23, 0.2);
    border-color: var(--favorite-yellow);
    box-shadow: 0 2px 8px rgba(212, 160, 23, 0.25);
}

.trophy-info {
    flex: 1;
    min-width: 0;
}

.trophy-name-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 3px;
}

.trophy-name {
    font-size: 14.5px;
    font-weight: 700;
    color: var(--text-dark);
}

.trophy-status-badge {
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 9999px;
}

.trophy-card.unlocked .trophy-status-badge {
    background: #d4edda;
    color: #155724;
}

:root[data-theme="dark"] .trophy-card.unlocked .trophy-status-badge {
    background: rgba(46, 204, 113, 0.2);
    color: #2ecc71;
}

.trophy-card.locked .trophy-status-badge {
    background: var(--surface-2);
    color: var(--muted-text);
}

.trophy-desc {
    font-size: 12.5px;
    color: var(--muted-text);
    line-height: 1.4;
}

.trophy-progress-bar {
    height: 4px;
    background: var(--border-soft);
    border-radius: 9999px;
    margin-top: 6px;
    overflow: hidden;
}

.trophy-progress-fill {
    height: 100%;
    background: var(--favorite-yellow);
    border-radius: 9999px;
}

/* STYLE POUR LES CATÉGORIES (BANNIÈRES) */
.list-categories {
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
}

.subcategory-note {
    background: var(--surface-2);
    color: var(--text-dark);
    border: 1px solid var(--border-soft);
    border-radius: 16px;
    padding: 16px;
    margin: 0 auto 24px;
    max-width: 800px;
    box-shadow: var(--card-shadow);
}

/* Note repliée par défaut : seul le titre est visible, avec un « + » ; un clic déplie le texte. */
.subcategory-note-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    padding: 0;
    margin-bottom: 4px;
    background: none;
    border: 0;
    font: inherit;
    font-weight: 700;
    font-size: 14px;
    color: var(--text-dark);
    text-align: left;
    cursor: pointer;
}

.subcategory-note-toggle {
    flex-shrink: 0;
    font-size: 20px;
    font-weight: 400;
    line-height: 1;
    color: var(--ink-soft);
    transition: transform 0.2s;
}

.subcategory-note.is-open .subcategory-note-toggle {
    transform: rotate(45deg);
}

/* Le texte se déploie et se replie en hauteur (grille 0fr → 1fr) : la transition porte sur la hauteur réelle. */
.subcategory-note-body {
    display: grid;
    grid-template-rows: 0fr;
    opacity: 0;
    visibility: hidden;
    transition: grid-template-rows 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.22s ease, visibility 0.3s;
}

.subcategory-note.is-open .subcategory-note-body {
    grid-template-rows: 1fr;
    opacity: 1;
    visibility: visible;
    transition: grid-template-rows 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.26s ease 0.04s, visibility 0.3s;
}

.subcategory-note-body > p {
    min-height: 0;
    overflow: hidden;
    font-size: 13px;
    line-height: 1.5;
    color: var(--ink-soft);
    margin: 0;
}

@media (prefers-reduced-motion: reduce) {
    .subcategory-note-body,
    .subcategory-note-toggle {
        transition: none;
    }
}

/* Salle de jeux, profil Religieux : « Voir les autres jeux » est une note repliable, sur le modèle de « Note importante ».
   Il passe après « Jeux religieux » (order). Hors de ce mode, le conteneur est transparent : les sections gardent leur place. */
.games-fold:not(.is-focus),
.games-fold:not(.is-focus) > .games-fold-body,
.games-fold:not(.is-focus) > .games-fold-body > .games-fold-inner {
    display: contents;
}

.games-fold:not(.is-focus) > .games-fold-title {
    display: none;
}

.games-fold.is-focus {
    order: 1;
    width: 100%;
    max-width: 800px;
    box-sizing: border-box;
    margin: 12px auto 24px;
    padding: 16px;
    background: var(--surface-2);
    color: var(--text-dark);
    border: 1px solid var(--border-soft);
    border-radius: 16px;
    box-shadow: var(--card-shadow);
}

.games-fold.is-focus.is-open .subcategory-note-toggle {
    transform: rotate(45deg);
}

/* La visibilité ne passe pas par une transition : sinon, à l'arrivée dans le mode, les jeux repliés restent visibles 0,3 s. */
.games-fold.is-focus > .games-fold-body {
    display: grid;
    grid-template-rows: 0fr;
    opacity: 0;
    visibility: hidden;
    transition: grid-template-rows 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.22s ease;
}

.games-fold.is-focus.is-open > .games-fold-body {
    grid-template-rows: 1fr;
    opacity: 1;
    visibility: visible;
    transition: grid-template-rows 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.26s ease 0.04s;
}

.games-fold.is-focus .games-fold-inner {
    min-height: 0;
    overflow: hidden;
}

.reset-srs-btn {
    font-size: 20px;
    opacity: 0.85;
    padding: 4px 9px;
    border-radius: 50%;
    transition: background 0.15s, opacity 0.15s;
}

.reset-srs-btn:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.2);
}

.reset-srs-btn.reset-srs-link {
    font-size: 14px;
    font-weight: 600;
    color: var(--muted-text);
    background: var(--surface-2);
    border-radius: 9999px;
    padding: 10px 16px;
    cursor: pointer;
    opacity: 1;
}

.reset-srs-btn.reset-srs-link:hover {
    background: var(--border-soft);
}

/* Boutons « Tout sélectionner / Tout désélectionner » au-dessus des axes */
.axes-bulk {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-bottom: 20px;
}

/* STYLE POUR LA SÉLECTION D'AXE THÉMATIQUE */
.axis-card {
    background: var(--surface);
    border: 2px solid var(--border-soft);
    border-radius: 12px;
    padding: 18px 20px;
    cursor: pointer;
    transition: all 0.15s;
    box-shadow: var(--card-shadow);
    text-align: left;
}

.axis-card h3 {
    font-size: 17px;
    margin-bottom: 4px;
    color: var(--text-dark);
}

.axis-card p {
    font-size: 13px;
    color: var(--muted-text);
}

.axis-card.selected {
    border-color: var(--primary-blue);
    background: var(--selected-tint);
}

.axis-card.selected h3::before {
    content: "✓ ";
    color: var(--primary-blue);
}

.axis-card.selected[data-axis="blue"] {
    border-color: #2980b9;
}

.axis-card.selected[data-axis="green"] {
    border-color: #27ae60;
}

.axis-card.selected[data-axis="orange"] {
    border-color: #e67e22;
}

.axis-card.selected[data-axis="purple"] {
    border-color: #8e44ad;
}

.axis-card.selected[data-axis="red"] {
    border-color: #c0392b;
}

.axis-card.selected[data-axis="teal"] {
    border-color: #16a085;
}

.axis-card.selected[data-axis="gold"] {
    border-color: #b8892e;
}

.axis-card.selected[data-axis="pink"] {
    border-color: #d81b60;
}

.essentiel-card {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 18px;
    padding: 18px 20px;
    border: 2px solid #b8892e;
    border-radius: 12px;
    background: #fff8e7;
    color: #6d4c16;
    cursor: pointer;
    box-shadow: var(--card-shadow);
    transition: all 0.15s;
}

.essentiel-card:hover,
.essentiel-card.active {
    background: #b8892e;
    color: #fff;
}

.essentiel-icon {
    font-size: 28px;
    line-height: 1;
}

.essentiel-card strong,
.essentiel-card small {
    display: block;
}

.essentiel-card strong {
    font-size: 17px;
}

.essentiel-card small {
    margin-top: 3px;
    font-size: 13px;
    opacity: 0.85;
}

/* Ambre foncé : l'ambre d'origine (#B8892E, puis #8C681E sur une carte
           sélectionnée) faisait 3,2:1 sur blanc et 4,47:1 sur le fond d'une carte
           d'axe — sous les 4,5:1 exigés pour un texte de 11 px. #7A5A14 : 6,4:1 sur
           blanc, 5,6:1 sur la carte sélectionnée. En sombre, un ambre clair. */
.axis-essentiel-badge {
    margin-left: 8px;
    color: #7a5a14;
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
}

:root[data-theme="dark"] .axis-essentiel-badge {
    color: #d9a441;
}

:root[data-theme="dark"] .essentiel-card {
    background: #3d321d;
    color: #f5d98a;
}

:root[data-theme="dark"] .essentiel-card:hover,
:root[data-theme="dark"] .essentiel-card.active {
    background: #8c681e;
    color: #fff;
}

/* ENCADRÉ COLORÉ POUR LES AXES THÉMATIQUES */
.entry-axe-badge {
    display: inline-flex;
    align-items: center;
    box-sizing: border-box;
    font-size: calc(11px * var(--zoom-level));
    font-weight: 600;
    line-height: 1.25;
    padding: 3px 8px;
    border-radius: 6px;
    border: 1.5px solid transparent;
    flex-shrink: 0;
    max-width: 260px;
    white-space: normal;
    text-align: left;
    margin-left: 6px;
}

/* Dans la liste (.entry-main empile titre puis badge), le badge n'a plus
   besoin de ce décalage horizontal pensé pour un alignement sur la même
   ligne que le titre — et se centre sous lui (tout en restant sous le
   titre, qui lui reste aligné à gauche) plutôt que de démarrer contre le
   bord gauche de la carte. */
.entry-main .entry-axe-badge,
.entry-main .entry-flag {
    margin-left: 0;
    align-self: center;
}

.axes-entry-badges-hidden .entry-axe-badge {
    display: none;
}

.entry-axe-badge[data-axis="blue"] {
    background: rgba(41, 128, 185, 0.12);
    border-color: #2980b9;
    color: #1a5276;
}

.entry-axe-badge[data-axis="green"] {
    background: rgba(39, 174, 96, 0.12);
    border-color: #27ae60;
    color: #196f3d;
}

.entry-axe-badge[data-axis="orange"] {
    background: rgba(230, 126, 34, 0.12);
    border-color: #e67e22;
    color: #a04000;
}

.entry-axe-badge[data-axis="purple"] {
    background: rgba(142, 68, 173, 0.12);
    border-color: #8e44ad;
    color: #5b2c6f;
}

.entry-axe-badge[data-axis="red"] {
    background: rgba(192, 57, 43, 0.12);
    border-color: #c0392b;
    color: #78281f;
}

.entry-axe-badge[data-axis="teal"] {
    background: rgba(22, 160, 133, 0.12);
    border-color: #16a085;
    color: #0e6655;
}

.entry-axe-badge[data-axis="gold"] {
    background: rgba(184, 137, 46, 0.14);
    border-color: #b8892e;
    color: #7d5d18;
}

.entry-axe-badge[data-axis="pink"] {
    background: rgba(216, 27, 96, 0.12);
    border-color: #d81b60;
    color: #880e4f;
}

[data-theme="dark"] .entry-axe-badge[data-axis="blue"] {
    background: rgba(41, 128, 185, 0.28);
    border-color: #5dade2;
    color: #aed6f1;
}

[data-theme="dark"] .entry-axe-badge[data-axis="green"] {
    background: rgba(39, 174, 96, 0.28);
    border-color: #58d68d;
    color: #a9dfbf;
}

[data-theme="dark"] .entry-axe-badge[data-axis="orange"] {
    background: rgba(230, 126, 34, 0.28);
    border-color: #f5b041;
    color: #fad7a0;
}

[data-theme="dark"] .entry-axe-badge[data-axis="purple"] {
    background: rgba(142, 68, 173, 0.28);
    border-color: #af7ac5;
    color: #d7bde2;
}

[data-theme="dark"] .entry-axe-badge[data-axis="red"] {
    background: rgba(192, 57, 43, 0.28);
    border-color: #ec7063;
    color: #f5b7b1;
}

[data-theme="dark"] .entry-axe-badge[data-axis="teal"] {
    background: rgba(22, 160, 133, 0.28);
    border-color: #48c9b0;
    color: #a3e4d7;
}

[data-theme="dark"] .entry-axe-badge[data-axis="gold"] {
    background: rgba(184, 137, 46, 0.28);
    border-color: #f4d03f;
    color: #f9e79f;
}

[data-theme="dark"] .entry-axe-badge[data-axis="pink"] {
    background: rgba(216, 27, 96, 0.28);
    border-color: #f06292;
    color: #f8bbd0;
}

.timeline-axes-legend {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    background: var(--surface-2);
    border-radius: 10px;
    margin: 0 auto 16px;
    max-width: 800px;
    width: 95%;
    position: relative;
}

/* Épinglée (œil ouvert, réglage par défaut) : reste ancrée en haut du
           board pendant le défilement de la frise, pour garder les axes
           visibles en permanence. Non épinglée (œil fermé) : défile
           normalement avec la frise, donc visible seulement au tout début. */
.timeline-axes-legend.pinned {
    position: sticky;
    top: 0;
    z-index: 5;
    box-shadow: var(--card-shadow);
}

.axes-legend-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    margin-left: auto;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: none;
    color: var(--muted-text);
    cursor: pointer;
    flex-shrink: 0;
}

.axes-legend-toggle:hover {
    color: var(--ink);
    background: rgba(0, 0, 0, 0.06);
}

[data-theme="dark"] .axes-legend-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
}

.axes-legend-title {
    font-size: 12px;
    font-weight: 700;
    color: var(--muted-text);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-right: 4px;
}

@media (max-width: 600px) {
    .entry-axe-badge {
        font-size: 10px;
        padding: 2px 6px;
        max-width: 170px;
    }
}

[data-layout="horizontal"] .entry-axe-badge {
    margin: 4px 0 0 0;
    max-width: 100%;
    font-size: 10px;
    padding: 2px 5px;
    text-align: center;
}

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

.btn-secondary {
    background: var(--btn-secondary-bg);
    color: var(--btn-secondary-text);
}

/* --- Bouton de réglages (roue dentée) --- */
.settings-btn {
    position: fixed;
    top: calc(env(safe-area-inset-top, 0px) + 14px);
    right: 16px;
    z-index: 60;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: 1px solid var(--glass-border);
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: var(--card-shadow);
    font-size: 19px;
    line-height: 1;
    color: var(--text-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.25s ease, background 0.2s;
}

.settings-btn:hover {
    transform: rotate(35deg);
}

/* En sombre, le verre du bouton ⚙︎ est posé sur un fond plein : un lecteur de contraste (axe) lit le verre
   translucide comme un aplat clair et signale à tort son icône. Le rendu reste le même, en plus franc. */
:root[data-theme="dark"] .settings-btn {
    background: #1B212B;
}

.settings-btn:active {
    transform: rotate(70deg);
}

/* --- Bouton retour (chevron), fixé en haut à gauche de l'écran --- */
.back-btn {
    position: fixed;
    top: calc(env(safe-area-inset-top, 0px) + 14px);
    left: 16px;
    z-index: 60;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: 1px solid var(--glass-border);
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: var(--card-shadow);
    font-size: 24px;
    font-weight: bold;
    line-height: 1;
    color: var(--text-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s ease, background 0.2s;
}

.back-btn:hover {
    opacity: 0.85;
}

.back-btn:active {
    transform: scale(0.9);
}

/* --- Réglages : contrôles segmentés Auto / option A / option B --- */
.settings-group {
    margin-bottom: 26px;
}

.settings-group:last-child {
    margin-bottom: 4px;
}

.settings-label {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 9px;
}

/* flex-shrink:0 — sans ça, overflow:hidden désactive la taille minimale automatique
           d'un enfant flex : utilisé à même une colonne flex qui manque de hauteur (comme
           #screen-revision-hub sur mobile, avec beaucoup de points faibles), le contrôle se
           retrouverait écrasé à quelques pixels de haut au lieu de garder sa taille propre. */
.segmented {
    display: flex;
    flex-shrink: 0;
    border: 1px solid var(--rule);
    border-radius: 9999px;
    overflow: hidden;
}

.segmented button {
    flex: 1;
    background: var(--surface);
    border: none;
    border-right: 1px solid var(--rule);
    padding: 10px 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--ink-soft);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.segmented button:last-child {
    border-right: none;
}

.segmented button.active {
    background: var(--primary-blue);
    color: #fff;
}

/* Le choix du profil d'accueil (et des périmètres de la ligue) : quatre cases en rectangle. Même habillage que .segmented :
   la case active est en bleu. */
.profile-choices {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.profile-choices button {
    background: var(--surface);
    border: 1px solid var(--rule);
    border-radius: 14px;
    padding: 14px 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--ink-soft);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

/* Dans les réglages : un profil par ligne (trois lignes). */
#settings-view-profile {
    grid-template-columns: 1fr;
}

#settings-view-profile button {
    padding: 14px 16px;
    text-align: left;
}

.profile-choices button.active {
    background: var(--primary-blue);
    border-color: var(--primary-blue);
    color: #fff;
}

/* Premier lancement : le choix du profil d'accueil (js/app/first-profile.js), avant le tutoriel. */
.first-profile-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(0, 26, 75, 0.55);
    overflow-y: auto;
}

.first-profile-card {
    width: 100%;
    max-width: 520px;
    background: var(--surface, #fff);
    border-radius: 20px;
    padding: 24px 20px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
}

.first-profile-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--ink, #0f172a);
    margin: 0 0 8px;
}

.first-profile-intro {
    font-size: 14px;
    color: var(--ink-soft, #475569);
    margin: 0 0 16px;
    line-height: 1.45;
}

.first-profile-choices {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

.first-profile-choice {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    text-align: left;
    background: var(--surface, #fff);
    border: 1px solid var(--rule, #e2e8f0);
    border-radius: 14px;
    padding: 14px;
    cursor: pointer;
    color: var(--ink, #0f172a);
}

/* Survol seulement : bleu de marque et texte blanc, comme le profil choisi dans les réglages (valable en mode sombre).
   Le focus clavier ne change que le contour, pour que tous les choix gardent le même fond. */
.first-profile-choice:hover {
    border-color: var(--primary-blue, #001a4b);
    background: var(--primary-blue, #001a4b);
    color: #fff;
}

.first-profile-choice:hover .first-profile-desc {
    color: rgba(255, 255, 255, 0.88);
}

.first-profile-choice:focus-visible {
    outline: 3px solid #f5b400;
    outline-offset: 2px;
}

.first-profile-name {
    font-size: 16px;
    font-weight: 700;
}

.first-profile-desc {
    font-size: 13px;
    color: var(--ink-soft, #475569);
    line-height: 1.4;
}

.notif-type-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 2px;
    border-bottom: 1px solid var(--rule);
    font-size: 14px;
    color: var(--ink);
}

.notif-type-row input {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    cursor: pointer;
    accent-color: var(--primary-blue);
}

.settings-hint {
    font-size: 12px;
    color: var(--muted-text);
    margin-top: 8px;
    line-height: 1.45;
}

/* =====================================================================
           THÈME SOMBRE — activé via [data-theme="dark"] sur <html>
           Choix délibéré : on garde le même bleu de marque, le même rouge et le
           même ambre dans les deux thèmes ; seuls le fond, les surfaces et les
           textes changent. Exception, mesurée : le rouge posé en TEXTE ne gardait
           pas « un excellent contraste » sur fond sombre — #BA1A1A sur #1B212B
           fait 2,5:1, pour 4,5:1 exigés. Il s'éclaircit donc (--danger-red-text) ;
           les aplats et les filets rouges, eux, restent ceux du thème clair.
           ===================================================================== */
:root[data-theme="dark"] {
    --danger-red-text: #FF8A80;
    --success-text: #5ED68A;
    --bg-color: #12161D;
    --text-dark: #F2F4F7;
    --card-shadow: 0 4px 16px rgba(0, 0, 0, 0.55);
    --card-shadow-hover: 0 6px 20px rgba(0, 0, 0, 0.65);
    --paper: #171C24;
    --rule: #2A313D;
    --ink: #F2F4F7;
    --ink-soft: #9AA3AE;
    --axis: #3A4453;
    --hand-bg: #2C374A;
    --surface: #1B212B;
    --surface-2: #232A35;
    --card-bg: #1B212B;
    /* #8B93A0 faisait 4,3:1 sur les cartes d'axe sélectionnées (#26303C). */
    --muted-text: #9BA3B0;
    --border-soft: #2E3644;
    --btn-secondary-bg: #2B323D;
    --btn-secondary-text: #E7E9EC;
    --selected-tint: rgba(127, 166, 201, 0.18);
    --modal-overlay-bg: rgba(0, 0, 0, 0.7);
    --locked-bg: #3B4350;
    /* Verre plus discret en thème sombre : un liseré clair trop marqué
               romprait l'ambiance, l'ombre doit rester noire (pas teintée navy). */
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
}

/* Cartes d'événements (.entry-title) : la version « Tailored Executive »
           plus bas force un fond blanc pur, harmonieux en thème clair mais
           criard sur fond sombre. On lui substitue les tons de surface du
           thème sombre pour rester cohérent avec le reste de l'interface. */
:root[data-theme="dark"] .entry-title {
    background: var(--surface) !important;
    color: var(--ink) !important;
    border-color: rgba(255, 255, 255, 0.08) !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45) !important;
}

:root[data-theme="dark"] .entry-tick {
    border-color: var(--paper) !important;
}

/* Textes utilisant le bleu de marque comme couleur de premier plan
           (et non comme fond) : #001a4b est un bleu marine quasiment noir,
           illisible posé directement sur le fond sombre. On les passe en
           blanc/texte clair, comme demandé pour « Quitter », l'année et le
           lien Wikipédia de la modale d'événement. */
:root[data-theme="dark"] .quit-btn,
:root[data-theme="dark"] .modal-date,
:root[data-theme="dark"] .modal-link,
:root[data-theme="dark"] .selection-item-date,
:root[data-theme="dark"] .leaderboard-score,
:root[data-theme="dark"] .scoring-info-body h3,
:root[data-theme="dark"] .end-title {
    color: var(--text-dark);
}

/* Éléments où le bleu de marque sert d'indicateur d'état (bascule
           « avant J.-C. », axe sélectionné) : on garde une teinte bleue
           pour conserver le sens visuel, mais avec une variante claire,
           bien plus lisible sur fond sombre que le bleu marine. */
:root[data-theme="dark"] .fil-era-btn.era-bc {
    border-color: #5dade2;
    color: #5dade2;
}

:root[data-theme="dark"] .axis-card.selected {
    border-color: #5dade2;
}

:root[data-theme="dark"] .axis-card.selected h3::before {
    color: #5dade2;
}

/* Repère de placement en pointillés (.slot-label), qui indique où
           poser la date sur la frise : en thème clair, son fond et sa
           bordure pointillée sont dérivés du bleu de marque très foncé
           (rgba(0,26,75,…)), ce qui le rend quasi invisible sur fond
           sombre. On le remplace par des variantes claires cohérentes
           avec le reste du thème sombre. */
:root[data-theme="dark"] .slot-label {
    background: rgba(255, 255, 255, 0.06) !important;
    border-color: rgba(255, 255, 255, 0.3) !important;
    color: var(--ink-soft) !important;
}

@media (hover: hover) {
    :root[data-theme="dark"] .slot:hover .slot-caret {
        background: #5dade2 !important;
    }

    :root[data-theme="dark"] .slot:hover .slot-label {
        background: rgba(93, 173, 226, 0.15) !important;
        border-color: #5dade2 !important;
        color: #5dade2 !important;
    }
}

/* =====================================================================
           ORIENTATION HORIZONTALE — activée via [data-layout="horizontal"]
           La même colonne du temps pivote en frise déroulante de gauche à
           droite : l'axe passe au centre, chaque repère devient une carte
           verticale (année / puce / titre empilés), le défilement passe en
           horizontal. Aucune structure JS n'est dupliquée : ce sont les mêmes
           éléments .entry / .slot, seulement réagencés en CSS.

           Alignement de l'axe : plutôt que de centrer chaque repère sur sa
           propre hauteur (ce qui déplace le repère dès que son contenu diffère
           — ex. le badge « manqué »), on réserve une zone d'en-tête de hauteur
           fixe (--h-head) avant la puce/le curseur, identique pour tous les
           repères ET les intervalles. La puce tombe donc toujours à la même
           hauteur, et l'axe vient se caler dessus — jamais sur le texte.
           ===================================================================== */
[data-layout="horizontal"] .board {
    touch-action: pan-x;
    overflow-x: auto;
    overflow-y: hidden;
    display: flex;
    flex-direction: row;
    align-items: center;
    padding: 18px 16px 22px;
    scroll-padding: 0 90px;
}

[data-layout="horizontal"] .chrono {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    max-width: none;
    width: max-content;
    min-width: 100%;
    flex-shrink: 0;
    margin: 0 auto;
    padding: 0 6px;
    --h-head: calc(38px * var(--zoom-level));
}

[data-layout="horizontal"] .chrono::before {
    top: calc(var(--h-head) + 4px);
    bottom: auto;
    left: 0;
    right: 0;
    width: auto;
    height: 1px;
}

[data-layout="horizontal"] .entry {
    display: flex;
    flex-direction: column;
    align-items: center;
    grid-template-columns: none;
    width: 168px;
    flex-shrink: 0;
    padding: 0 12px;
    text-align: center;
}

[data-layout="horizontal"] .entry-year {
    height: var(--h-head);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    text-align: center;
    padding: 0 0 20px 0;
}

[data-layout="horizontal"] .entry-body {
    flex-direction: column;
    align-items: center;
    padding: 8px 0 0;
    gap: 4px;
}

/* En paysage, titre/badge/chevron sont déjà chacun repositionnés
   directement en enfants de .entry-body (voir règles ci-dessus/ci-dessous) :
   .entry-main ne doit pas y introduire de boîte propre, sous peine de casser
   cet agencement en carte verticale centrée. */
[data-layout="horizontal"] .entry-main {
    display: contents;
}

[data-layout="horizontal"] .entry-title {
    text-align: center;
}

[data-layout="horizontal"] .entry-chevron {
    display: none;
}

[data-layout="horizontal"] .chrono:not(.playing) .entry+.entry .entry-body {
    border-top: none;
}

[data-layout="horizontal"] .chrono:not(.playing) .entry+.entry {
    border-left: 1px solid var(--rule);
}

[data-layout="horizontal"] .slot {
    width: auto;
    flex-shrink: 0;
    padding: 0 10px;
}

[data-layout="horizontal"] .slot-grid {
    display: flex;
    flex-direction: column;
    align-items: center;
    grid-template-columns: none;
}

[data-layout="horizontal"] .slot-grid>span:first-child {
    height: var(--h-head);
    display: block;
}

[data-layout="horizontal"] .slot-caret {
    left: 0;
    top: 0;
    transform: rotate(90deg);
}

[data-layout="horizontal"] .slot:focus-visible .slot-caret {
    transform: rotate(90deg) translateX(3px);
}

@media (hover: hover) {
    [data-layout="horizontal"] .slot:hover .slot-caret {
        transform: rotate(90deg) translateX(3px);
    }
}

[data-layout="horizontal"] .slot-body {
    flex-direction: column;
    align-items: center;
    padding-left: 0;
    padding-top: 8px;
    gap: 5px;
    min-width: 90px;
}

[data-layout="horizontal"] .slot-label {
    text-align: center;
}

/* Mode Multijoueurs */

.multiplayer-setup-container {
    max-width: 500px;
    margin: 40px auto;
    background: #fff;
    padding: 30px;
    border-radius: 12px;
    box-shadow: var(--card-shadow);
    color: #333;
    text-align: center;
}

.multiplayer-setup-container h2 {
    color: #2c3e50;
    margin-bottom: 20px;
}

.multiplayer-setup-container select,
.multiplayer-setup-container input {
    width: 100%;
    padding: 10px;
    margin: 10px 0;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 16px;
    background: #ffffff !important;
    color: #141d23 !important;
}

/* « Nombre de joueurs : » et son choix sur une seule ligne, pour ne pas confondre ce choix avec les champs de noms. */
.multi-count-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 0 0 18px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-soft);
}

.multi-count-row label {
    text-align: left;
    font-weight: 600;
}

.multiplayer-setup-container .multi-count-row select {
    width: auto;
    min-width: 130px;
    margin: 0;
}

.multiplayer-setup-container input::placeholder {
    color: #8B93A0 !important;
    opacity: 1;
}

.multi-turn-banner {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #2c3e50;
    color: white;
    padding: 40px;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 26, 75, 0.5);
    z-index: 1000;
    width: 90%;
    max-width: 400px;
}

:root[data-theme="dark"] .multi-turn-banner {
    background: var(--surface);
    border: 1px solid var(--border-soft);
}

.multi-turn-banner h2 {
    margin-bottom: 20px;
    font-size: 24px;
}

.multi-end-podium {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin: 30px 0;
}

.podium-row {
    display: flex;
    justify-content: space-between;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 9999px;
    align-items: center;
    font-weight: bold;
    border-left: 5px solid #ccc;
}

.podium-row.gold {
    border-left-color: #FFD700;
    background: #fff9e6;
}

.podium-row.silver {
    border-left-color: #C0C0C0;
    background: #f2f2f2;
}

.podium-row.bronze {
    border-left-color: #CD7F32;
    background: #faf0e6;
}

.multi-player-hud {
    font-weight: bold;
    color: white;
    background: #8e44ad;
    padding: 2px 8px;
    border-radius: 12px;
    margin-right: 10px;
    font-size: 0.9em;
}


/* --- Overrides for Tailored Executive UI --- */
.game-bar {
    background: rgba(255, 255, 255, 0.8) !important;
    backdrop-filter: blur(20px) !important;
    border-bottom: none !important;
}

/* En thème sombre, ce fond blanc translucide retombe en gris terne sur
           l'arrière-plan sombre : on lui substitue une variante sombre de la
           même surface pour rester harmonieux avec le reste de l'interface. */
:root[data-theme="dark"] .game-bar {
    background: rgba(27, 33, 43, 0.85) !important;
}

.timer-chip {
    background: #ecf5fe !important;
    color: #001a4b !important;
}

:root[data-theme="dark"] .timer-chip {
    background: #17233A !important;
    color: var(--text-dark) !important;
}

.board {
    background: var(--bg-color) !important;
}

.chrono::before {
    background: #c5c6d0 !important;
    left: calc(var(--gutter) + 11px) !important;
}

/* En orientation horizontale, l'axe traverse toute la largeur : le
           décalage à gauche ci-dessus (pensé pour la colonne verticale) donne
           l'impression d'un début d'alinéa. On le remet à 0 dans ce mode. */
[data-layout="horizontal"] .chrono::before {
    left: 0 !important;
}

/* Entries */
.entry {
    padding: 16px 0 !important;
}

.entry-body {
    padding: 0 0 0 16px !important;
}

/* En horizontal, chaque carte est censée être centrée sous sa puce ;
           le padding-gauche ci-dessus (pensé pour la liste verticale) la
           poussait contre le séparateur de droite. */
[data-layout="horizontal"] .entry-body {
    padding: 10px 0 0 !important;
}

.entry-title {
    background: #ffffff !important;
    padding: 16px !important;
    border-radius: 16px !important;
    box-shadow: 0px 10px 30px rgba(0, 26, 75, 0.05) !important;
    border: 1px solid rgba(0, 0, 0, 0.05) !important;
    font-weight: 600 !important;
    color: #001a4b !important;
    display: inline-block;
    width: 100%;
}

.entry-tick {
    width: 16px !important;
    height: 16px !important;
    background: #001a4b !important;
    border: 4px solid #ffffff !important;
    border-radius: 50% !important;
    transform: none !important;
    box-shadow: 0 2px 4px rgba(0, 26, 75, 0.15) !important;
}

/* Slots */
.slot {
    margin: 8px 0 !important;
}

.slot-caret {
    width: 12px !important;
    height: 12px !important;
    border-radius: 50% !important;
    background: #dbe4ed !important;
    border: 2px solid #ffffff !important;
    transform: none !important;
    left: 1px !important;
    transition: all 0.2s ease !important;
}

.slot-label {
    background: rgba(0, 26, 75, 0.05) !important;
    padding: 6px 16px !important;
    border-radius: 9999px !important;
    color: #44464f !important;
    border: 1px dashed rgba(0, 26, 75, 0.2);
    transition: all 0.2s ease !important;
}

/* (hover: hover) évite qu'un tap tactile ne laisse l'intervalle choisi
           plus foncé que les autres une fois le doigt relevé. */
@media (hover: hover) {
    .slot:hover .slot-caret {
        background: #001a4b !important;
    }

    .slot:hover .slot-label {
        background: rgba(0, 26, 75, 0.1) !important;
        border-color: #001a4b !important;
        color: #001a4b !important;
    }
}

/* Hand / Mystery Card */
.hand {
    background: linear-gradient(to top, var(--bg-color) 70%, transparent) !important;
    border-top: none !important;
    box-shadow: none !important;
    padding-bottom: 24px !important;
}

.hand-card {
    background: #001a4b !important;
    border-radius: 24px !important;
    box-shadow: 0px 20px 40px rgba(0, 26, 75, 0.2) !important;
    padding: 20px 24px !important;
    position: relative;
    transform: translateY(0);
    transition: transform 0.2s ease;
}

.hand-card:hover {
    transform: translateY(-4px);
}

.hand-year {
    background: rgba(255, 255, 255, 0.1) !important;
    color: #ffffff !important;
}

.hand-kicker {
    color: #b2c5ff !important;
    font-size: 11px !important;
    letter-spacing: 0.05em !important;
    text-transform: uppercase !important;
    margin-bottom: 4px;
    display: block;
}

.hand-title {
    color: #ffffff !important;
    font-weight: 700 !important;
    font-size: 18px !important;
}

/* Quick tweaks for headers */
.header-title {
    font-weight: 700;
    color: #001a4b;
}

:root[data-theme="dark"] .header-title {
    color: var(--text-dark) !important;
}

/* Barre de recherche du menu principal : en mode sombre, un fond gris neutre
           tranchait trop peu, et sans cette règle certains navigateurs appliquaient
           encore le blanc par défaut des champs de formulaire. On lui donne un bleu
           marine sombre dérivé de --primary-blue pour rester en harmonie avec le
           reste du thème. !important pour rester prioritaire sur tout style de
           formulaire natif que certains navigateurs mobiles pourraient réappliquer. */
:root[data-theme="dark"] .search-bar,
:root[data-theme="dark"] .search-results {
    background: #17233A !important;
    border-color: #2A3B5C !important;
}

:root[data-theme="dark"] .search-bar-input {
    background: transparent !important;
    color: var(--text-dark) !important;
}

:root[data-theme="dark"] .multiplayer-setup-container {
    background: var(--surface);
    color: var(--text-dark);
}

:root[data-theme="dark"] .podium-row {
    background: var(--surface-2);
}

:root[data-theme="dark"] .podium-row.gold { background: rgba(255, 215, 0, 0.14); }
:root[data-theme="dark"] .podium-row.silver { background: rgba(192, 192, 192, 0.14); }
:root[data-theme="dark"] .podium-row.bronze { background: rgba(205, 127, 50, 0.16); }

:root[data-theme="dark"] .multiplayer-setup-container h2 {
    color: var(--text-dark);
}

/* Champs de formulaire dans les modales et écrans de configuration (pseudo défi du jour, mode du bouton « Jouer »,
           etc.) : en mode sombre, même fond marine que la barre de recherche, avec le texte clair du thème. */
:root[data-theme="dark"] .form-input,
:root[data-theme="dark"] #daily-pseudo-input,
:root[data-theme="dark"] .multiplayer-setup-container input,
:root[data-theme="dark"] .multiplayer-setup-container select {
    background: #17233A !important;
    border-color: #2A3B5C !important;
    color: var(--text-dark) !important;
}

:root[data-theme="dark"] .form-input::placeholder,
:root[data-theme="dark"] .multiplayer-setup-container input::placeholder {
    color: #8B93A0 !important;
}

/* Alignement des puces sur l'axe en orientation horizontale : le padding/
           marge vertical ajouté ci-dessus par le skin (pensé pour la liste de
           cartes verticale) décale .entry et .slot sous la zone d'en-tête fixe
           (--h-head) sur laquelle l'axe est calé, désynchronisant la puce du
           trait. On neutralise ce décalage en haut, puis on recentre chaque
           puce (tailles fixées plus haut) exactement sur le trait de 1px.
           Cf. lignes ~704-709 : la puce doit tomber sur l'axe, jamais sur le texte. */
[data-layout="horizontal"] .entry {
    padding-top: 0 !important;
    padding-bottom: 16px !important;
}

[data-layout="horizontal"] .slot {
    margin-top: 0 !important;
    padding-top: 0 !important;
    margin-bottom: 8px !important;
}

[data-layout="horizontal"] .entry-tick {
    margin-top: -3.5px !important;
}

[data-layout="horizontal"] .slot-caret {
    margin-top: -1.5px !important;
}


/* =======================================
           CORRECTIF DÉFINITIF : Z-INDEX & PAYSAGE
           ======================================= */
/* Placement en arrière-plan de la ligne et premier plan des puces (tous modes) */
.chrono {
    z-index: 0;
}

.chrono::before {
    z-index: 1 !important;
}

.entry,
.slot {
    z-index: 2 !important;
    position: relative !important;
}

.entry-tick,
.slot-caret {
    z-index: 3 !important;
    position: relative !important;
}

.entry-tick {
    left: 0 !important;
    margin: 0 auto !important;
    transform: none !important;
}

/* Ajustement du décalage des puces pour le layout vertical natif */
[data-layout="vertical"] .entry-tick,
:root:not([data-layout="horizontal"]) .entry-tick {
    left: -1px !important;
}

[data-layout="vertical"] .slot-caret,
:root:not([data-layout="horizontal"]) .slot-caret {
    left: 1px !important;
}

/* Alignement parfait du mode horizontal / paysage */
[data-layout="horizontal"] .game-bar {
    padding: 6px 16px 8px !important;
    gap: 4px !important;
}

[data-layout="horizontal"] .board {
    overflow-x: auto !important;
    overflow-y: hidden !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    align-items: flex-start !important;
    padding: 8px 20px !important;
    scroll-padding: 0 90px !important;
    flex: 1 !important;
    min-height: 0 !important;
}

/* Ici le défilement de la frise est horizontal (overflow-x) : on ancre
           la légende des axes au milieu de la largeur visible plutôt qu'en
           haut (left: 50% + translation, pour rester centrée pendant le
           scroll au lieu de se coller au bord gauche). */
[data-layout="horizontal"] .timeline-axes-legend.pinned {
    left: 50% !important;
    transform: translateX(-50%) !important;
}

[data-layout="horizontal"] .chrono {
    display: flex !important;
    flex-direction: row !important;
    align-items: flex-start !important;
    max-width: none !important;
    width: max-content !important;
    min-width: 100% !important;
    flex-shrink: 0 !important;
    margin: auto 0 !important;
    padding: 0 12px !important;
    --h-head: calc(34px * var(--zoom-level)) !important;
    position: relative !important;
}

[data-layout="horizontal"] .chrono::before {
    top: calc(var(--h-head) + 7px) !important;
    bottom: auto !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    height: 2px !important;
    z-index: 1 !important;
}

[data-layout="horizontal"] .entry {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    grid-template-columns: none !important;
    width: 170px !important;
    flex-shrink: 0 !important;
    padding: 0 8px !important;
    text-align: center !important;
    margin: 0 !important;
    position: relative !important;
    z-index: 2 !important;
}

[data-layout="horizontal"] .entry-year {
    height: var(--h-head) !important;
    display: flex !important;
    align-items: flex-end !important;
    justify-content: center !important;
    text-align: center !important;
    padding: 0 0 6px 0 !important;
    line-height: 1 !important;
    font-size: calc(18px * var(--zoom-level)) !important;
}

[data-layout="horizontal"] .entry-body {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    padding: 6px 0 0 0 !important;
    gap: 4px !important;
    width: 100% !important;
}

[data-layout="horizontal"] .entry-title {
    text-align: center !important;
    width: 100% !important;
    box-sizing: border-box !important;
    padding: 10px 12px !important;
    border-radius: 12px !important;
    font-size: calc(14px * var(--zoom-level)) !important;
    line-height: 1.3 !important;
}

[data-layout="horizontal"] .slot {
    width: auto !important;
    flex-shrink: 0 !important;
    padding: 0 8px !important;
    margin: 0 !important;
    position: relative !important;
    z-index: 2 !important;
}

[data-layout="horizontal"] .slot-grid {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    grid-template-columns: none !important;
}

[data-layout="horizontal"] .slot-grid>span:first-child {
    height: var(--h-head) !important;
    display: block !important;
}

[data-layout="horizontal"] .slot-caret {
    left: 0 !important;
    top: 0 !important;
    transform: rotate(90deg) !important;
    margin-top: 0 !important;
    position: relative !important;
    z-index: 3 !important;
}

[data-layout="horizontal"] .entry-tick {
    margin-top: 0 !important;
}


/* --- PACKS DE LANGUE (I18N SETTINGS) --- */
.lang-packs-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 10px;
}

.lang-pack-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: 12px;
    padding: 10px 14px;
    gap: 10px;
}

.lang-pack-left {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.lang-pack-flag {
    font-size: 24px;
    line-height: 1;
}

.lang-pack-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.lang-pack-name {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-dark);
    display: flex;
    align-items: center;
    gap: 6px;
}

.lang-pack-status-badge {
    font-size: 10px;
    font-weight: 800;
    padding: 2px 6px;
    border-radius: 9999px;
}

.lang-pack-status-badge.active {
    background: #d4edda;
    color: #155724;
}

:root[data-theme="dark"] .lang-pack-status-badge.active {
    background: rgba(46, 204, 113, 0.2);
    color: #2ecc71;
}

.lang-pack-status-badge.installed {
    background: #e2e3e5;
    color: #383d41;
}

:root[data-theme="dark"] .lang-pack-status-badge.installed {
    background: rgba(255, 255, 255, 0.1);
    color: #ced4da;
}

.lang-pack-details {
    font-size: 11.5px;
    color: var(--muted-text);
}

.lang-pack-content-hint {
    font-size: 11px;
    font-style: italic;
    color: var(--muted-text);
    opacity: 0.85;
}

.lang-pack-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.btn-pack-action {
    font-size: 12px;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 8px;
    border: 1px solid var(--border-soft);
    background: var(--surface-2);
    color: var(--text-dark);
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-pack-action:hover {
    background: var(--surface);
    border-color: var(--primary-blue);
}

.btn-pack-action.btn-primary {
    background: var(--primary-blue);
    color: white;
    border-color: transparent;
}

.btn-pack-action.btn-danger {
    background: rgba(231, 76, 60, 0.1);
    color: var(--danger-red-text);
    border-color: rgba(231, 76, 60, 0.3);
}



/* --- ADAPTATIONS NATIVES IOS (SAFE AREA, DYNAMIC ISLAND, STATUS BAR) --- */
:root {
    --sat: env(safe-area-inset-top, 0px);
    --sab: env(safe-area-inset-bottom, 0px);
    --sal: env(safe-area-inset-left, 0px);
    --sar: env(safe-area-inset-right, 0px);
}

/* Le contenu va jusqu'aux bords de l'écran : l'heure et l'indicateur d'accueil passent par-dessus
   (StatusBar overlaysWebView). Les marges haute et basse ne sont donc plus sur body mais sur chaque
   écran : son défilement remonte ainsi sous la barre d'état au lieu d'être coupé net. */
body {
    padding-left: var(--sal);
    padding-right: var(--sar);
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
}

body > [id^="screen-"] {
    padding-top: var(--sat);
    padding-bottom: var(--sab);
}

/* Les listes gardent leur marge de 20px, ajoutée à la zone de sécurité. */
body > .list-screen {
    padding-top: calc(var(--sat) + 20px);
    padding-bottom: calc(var(--sab) + 20px);
}

/* Écrans qui occupent tout l'écran (accueil, carte, cadre des rapports) : aucune marge. */
#screen-home,
#screen-atlas,
#screen-multi-turn,
#screen-rapport {
    padding-top: 0;
    padding-bottom: 0;
}

#screen-end {
    padding-top: calc(var(--sat) + 20px);
    padding-bottom: calc(var(--sab) + 20px);
}

/* Bande d'état floue : le contenu qui remonte sous l'heure se floute, comme dans les apps iOS natives. */
body::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--sat);
    z-index: 50;
    pointer-events: none;
    background: color-mix(in srgb, var(--bg-color) 75%, transparent);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

/* FOND D'ÉCRAN (Réglages › Fond d'écran) : un dégradé doux derrière toute l'appli.
   Chaque teinte a sa variante sombre. Sans attribut, ou avec « none », rien ne change. */
html[data-wallpaper="sand"] { --wp-from: #F6EFE0; --wp-to: #EEE2CD; }
html[data-wallpaper="sky"] { --wp-from: #EAF3FB; --wp-to: #D6E5F3; }
html[data-wallpaper="sage"] { --wp-from: #F0F5EA; --wp-to: #DCE7D4; }
html[data-wallpaper="slate"] { --wp-from: #F0F2F5; --wp-to: #DFE4EA; }
:root[data-theme="dark"][data-wallpaper="sand"] { --wp-from: #2B251C; --wp-to: #1C1812; }
:root[data-theme="dark"][data-wallpaper="sky"] { --wp-from: #1A2636; --wp-to: #111A26; }
:root[data-theme="dark"][data-wallpaper="sage"] { --wp-from: #1C2719; --wp-to: #131B11; }
:root[data-theme="dark"][data-wallpaper="slate"] { --wp-from: #1F242C; --wp-to: #15181E; }

html[data-wallpaper]:not([data-wallpaper="none"]) body {
    background: linear-gradient(165deg, var(--wp-from), var(--wp-to));
}

/* Les surfaces qui posent leur propre fond uni laissent voir le dégradé. */
html[data-wallpaper]:not([data-wallpaper="none"]) #screen-game,
html[data-wallpaper]:not([data-wallpaper="none"]) .board,
html[data-wallpaper]:not([data-wallpaper="none"]) .hand {
    background: transparent !important;
}

/* Carte (Atlas) : la carte reste opaque, pour que sa géographie reste lisible ; seul le cadre suit le fond. */
html[data-wallpaper]:not([data-wallpaper="none"]) #screen-atlas {
    background: linear-gradient(165deg, var(--wp-from), var(--wp-to));
}

/* Barres fixes et collantes (bande d'état, barres du haut et du bas) : elles prennent une teinte pleine,
   à mi-chemin du dégradé, au lieu du gris d'origine. Une teinte pleine, et non transparente, pour que la
   bande du haut reste identique sur tous les navigateurs. */
html[data-wallpaper]:not([data-wallpaper="none"]) {
    --wp-bar: color-mix(in srgb, var(--wp-from) 50%, var(--wp-to));
}

html[data-wallpaper]:not([data-wallpaper="none"]) body::before,
html[data-wallpaper]:not([data-wallpaper="none"]) .categories-topbar,
html[data-wallpaper]:not([data-wallpaper="none"]) .axes-action-bar,
html[data-wallpaper]:not([data-wallpaper="none"]) .dict-bar,
html[data-wallpaper]:not([data-wallpaper="none"]) .cal-month-title {
    background: var(--wp-bar) !important;
}

html[data-wallpaper]:not([data-wallpaper="none"]) .geo-actions {
    background: linear-gradient(to bottom, transparent, var(--wp-bar) 45%);
}

/* MOTIF (Réglages › Motif) : un tracé répété sur un pseudo-élément fixe, sous le contenu.
   Son opacité suit l'intensité ; la variante sombre est claire, pour rester visible. */
html[data-motif="dots"] { --wp-motif: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32'%3E%3Ccircle cx='16' cy='16' r='1.2' fill='%23001a4b'/%3E%3C/svg%3E"); }
:root[data-theme="dark"][data-motif="dots"] { --wp-motif: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32'%3E%3Ccircle cx='16' cy='16' r='1.2' fill='%23F2F4F7'/%3E%3C/svg%3E"); }
html[data-motif="grid"] { --wp-motif: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32'%3E%3Cpath d='M32 0H0V32' fill='none' stroke='%23001a4b' stroke-width='1'/%3E%3C/svg%3E"); }
:root[data-theme="dark"][data-motif="grid"] { --wp-motif: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32'%3E%3Cpath d='M32 0H0V32' fill='none' stroke='%23F2F4F7' stroke-width='1'/%3E%3C/svg%3E"); }
html[data-motif="meander"] { --wp-motif: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='40'%3E%3Cpath d='M4 36V4h32v24H14V16h12' fill='none' stroke='%23001a4b' stroke-width='2'/%3E%3C/svg%3E"); }
:root[data-theme="dark"][data-motif="meander"] { --wp-motif: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='40'%3E%3Cpath d='M4 36V4h32v24H14V16h12' fill='none' stroke='%23F2F4F7' stroke-width='2'/%3E%3C/svg%3E"); }
html { --wp-motif: none; --wp-motif-alpha: 0.6; }
html[data-motif-intensity="low"] { --wp-motif-alpha: 0.25; }
html[data-motif-intensity="medium"] { --wp-motif-alpha: 0.45; }
html[data-motif-intensity="high"] { --wp-motif-alpha: 0.75; }

body::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background-image: var(--wp-motif);
    opacity: var(--wp-motif-alpha);
}

/* Les mêmes surfaces unies laissent passer le motif, comme le fond. */
html[data-motif]:not([data-motif="none"]) #screen-game,
html[data-motif]:not([data-motif="none"]) .board,
html[data-motif]:not([data-motif="none"]) .hand {
    background: transparent !important;
}

input,
textarea {
    -webkit-user-select: auto;
    user-select: auto;
}

.back-btn,
.settings-btn,
.profile-btn,
.league-btn {
    top: calc(20px + var(--sat)) !important;
}

.modal-content {
    max-height: calc(88vh - var(--sat) - var(--sab)) !important;
}

/* =====================================================================
           ONBOARDING GUIDÉ — coach-marks des 3 premières minutes (js/onboarding.js)
           ===================================================================== */
.onboarding-overlay {
    position: fixed;
    inset: 0;
    z-index: 9998;
    pointer-events: none;
}

.onboarding-spotlight {
    position: fixed;
    border-radius: 16px;
    box-shadow: 0 0 0 9999px rgba(0, 10, 30, 0.65);
    pointer-events: none;
    transition: top 0.2s ease, left 0.2s ease, width 0.2s ease, height 0.2s ease;
}

.onboarding-bubble {
    position: fixed;
    top: 40vh;
    left: 50%;
    transform: translateX(-50%);
    width: min(90vw, 340px);
    background: var(--surface);
    color: var(--text-dark);
    border-radius: 16px;
    padding: 18px 20px;
    box-shadow: 0 12px 32px rgba(0, 26, 75, 0.35);
    pointer-events: auto;
    box-sizing: border-box;
}

.onboarding-bubble-title {
    font-size: 15px;
    font-weight: 800;
    margin-bottom: 6px;
}

.onboarding-bubble-text {
    font-size: 13.5px;
    line-height: 1.5;
    color: var(--muted-text);
    margin-bottom: 14px;
}

.onboarding-bubble-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.onboarding-skip {
    background: none;
    border: none;
    color: var(--muted-text);
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    padding: 6px 4px;
}

.onboarding-next {
    background: var(--primary-blue);
    color: white;
    border: none;
    border-radius: 9999px;
    padding: 9px 18px;
    font-size: 13.5px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
}
/* =======================================================================
   === CARTES MENTALES (écran #screen-mindmap, voir js/mindMap.js) =======
   ======================================================================= */

/* Chaque branche porte une couleur de la palette d'axes (AXIS_PALETTE dans
   js/app.js) via data-axis ; toute la mise en forme en découle par
   --mm-accent, plutôt qu'un jeu de règles dupliqué par couleur. Les mêmes
   valeurs servent aux pastilles « Réviser cet axe », qui reprennent la
   couleur de l'axe telle qu'elle apparaît sur la frise. */
.mindmap-branch[data-axis="blue"],
.mindmap-axis-chip[data-axis="blue"] {
    --mm-accent: #2980b9;
}

.mindmap-branch[data-axis="green"],
.mindmap-axis-chip[data-axis="green"] {
    --mm-accent: #27ae60;
}

.mindmap-branch[data-axis="orange"],
.mindmap-axis-chip[data-axis="orange"] {
    --mm-accent: #e67e22;
}

.mindmap-branch[data-axis="purple"],
.mindmap-axis-chip[data-axis="purple"] {
    --mm-accent: #8e44ad;
}

.mindmap-branch[data-axis="red"],
.mindmap-axis-chip[data-axis="red"] {
    --mm-accent: #c0392b;
}

.mindmap-branch[data-axis="teal"],
.mindmap-axis-chip[data-axis="teal"] {
    --mm-accent: #16a085;
}

.mindmap-branch[data-axis="gold"],
.mindmap-axis-chip[data-axis="gold"] {
    --mm-accent: #b8892e;
}

.mindmap-branch[data-axis="pink"],
.mindmap-axis-chip[data-axis="pink"] {
    --mm-accent: #d81b60;
}

/* En thème sombre, les mêmes teintes éclaircies (mêmes valeurs que les
   badges d'axe de la frise) : les versions saturées du thème clair
   deviennent illisibles sur fond nuit. */
[data-theme="dark"] .mindmap-branch[data-axis="blue"],
[data-theme="dark"] .mindmap-axis-chip[data-axis="blue"] {
    --mm-accent: #5dade2;
}

[data-theme="dark"] .mindmap-branch[data-axis="green"],
[data-theme="dark"] .mindmap-axis-chip[data-axis="green"] {
    --mm-accent: #58d68d;
}

[data-theme="dark"] .mindmap-branch[data-axis="orange"],
[data-theme="dark"] .mindmap-axis-chip[data-axis="orange"] {
    --mm-accent: #f5b041;
}

[data-theme="dark"] .mindmap-branch[data-axis="purple"],
[data-theme="dark"] .mindmap-axis-chip[data-axis="purple"] {
    --mm-accent: #af7ac5;
}

[data-theme="dark"] .mindmap-branch[data-axis="red"],
[data-theme="dark"] .mindmap-axis-chip[data-axis="red"] {
    --mm-accent: #ec7063;
}

[data-theme="dark"] .mindmap-branch[data-axis="teal"],
[data-theme="dark"] .mindmap-axis-chip[data-axis="teal"] {
    --mm-accent: #48c9b0;
}

[data-theme="dark"] .mindmap-branch[data-axis="gold"],
[data-theme="dark"] .mindmap-axis-chip[data-axis="gold"] {
    --mm-accent: #f4d03f;
}

[data-theme="dark"] .mindmap-branch[data-axis="pink"],
[data-theme="dark"] .mindmap-axis-chip[data-axis="pink"] {
    --mm-accent: #f06292;
}

/* Accès au sommaire : plus une carte de mode à part, mais un choix déplié
   par « Découverte » quand le thème en propose un (voir js/mindMap.js:
   refreshDiscoveryPicker). Le bloc garde la carte et son choix solidaires
   dans une seule case de la grille — sans lui, la grille multi-colonnes
   des grands écrans placerait le choix à côté de la carte plutôt qu'en
   dessous. */
.discovery-block {
    display: flex;
    flex-direction: column;
}

.discovery-block .mode-card {
    flex: 1;
}

/* Deux boutons côte à côte sous la carte dépliée — même langage visuel que
   le choix Défi du jour / Défi hebdomadaire de l'écran des catégories
   (.challenge-picker plus haut). */
.mode-picker {
    display: flex;
    gap: 12px;
    margin-top: 12px;
}

.mode-picker-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 12px 10px;
    border-radius: 14px;
    background: var(--surface);
    border: 1px solid var(--border-soft);
    box-shadow: var(--card-shadow);
    color: var(--text-dark);
    font-family: var(--font-main);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, box-shadow 0.2s, transform 0.2s;
}

.mode-picker-btn:hover {
    background: var(--surface-2);
    transform: translateY(-2px);
}

.mode-picker-icon {
    font-size: 22px;
}

#screen-mindmap {
    padding-bottom: calc(var(--sab) + 60px);
}

.mindmap-subtitle {
    font-size: 14px;
    color: var(--muted-text);
    text-align: center;
    margin: -12px 0 18px;
    padding: 0 20px;
}

/* Le « chapeau » de la fiche : ce que le thème demande de savoir, avant
   toute branche. Filet vertical plutôt qu'un encadré, pour ne pas le faire
   concurrencer visuellement les branches elles-mêmes. */
.mindmap-esprit {
    width: 100%;
    max-width: 720px;
    font-size: 14.5px;
    line-height: 1.6;
    color: var(--text-dark);
    border-left: 3px solid var(--border-soft);
    padding-left: 16px;
    margin-bottom: 22px;
}

.mindmap-toolbar {
    width: 100%;
    max-width: 720px;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-bottom: 12px;
}

.mindmap-toolbar-btn {
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: 9999px;
    color: var(--muted-text);
    font-size: 12.5px;
    font-weight: 600;
    padding: 7px 14px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.mindmap-toolbar-btn:hover {
    background: var(--surface-2);
    color: var(--text-dark);
}

#mindmap-branches {
    width: 100%;
    max-width: 720px;
}

.mindmap-branch {
    background: var(--card-bg);
    border: 1px solid var(--border-soft);
    border-left: 4px solid var(--mm-accent, var(--primary-blue));
    border-radius: 12px;
    box-shadow: var(--card-shadow);
    margin-bottom: 14px;
    overflow: hidden;
}

.mindmap-branch>summary {
    list-style: none;
    cursor: pointer;
    display: flex;
    align-items: baseline;
    gap: 10px;
    padding: 16px 18px;
    font-size: 17px;
    font-weight: 700;
    color: var(--text-dark);
}

.mindmap-branch>summary::-webkit-details-marker {
    display: none;
}

/* Le « + / − » de fin de ligne signale l'état d'une branche ; les
   sous-branches, elles, utilisent un chevron en début de ligne
   (.mindmap-sub > summary::before) — les deux niveaux restent ainsi
   distinguables d'un coup d'œil, même une fois tous dépliés. */
.mindmap-branch>summary::after {
    content: '+';
    margin-left: auto;
    font-size: 20px;
    font-weight: 400;
    color: var(--muted-text);
    line-height: 1;
}

.mindmap-branch[open]>summary::after {
    content: '−';
}

.mindmap-branch-num {
    color: var(--mm-accent, var(--primary-blue));
    font-size: 15px;
    font-weight: 800;
    flex-shrink: 0;
}

.mindmap-branch-title {
    flex: 1;
}

.mindmap-branch-body {
    padding: 0 18px 16px;
}

.mindmap-branch-intro {
    font-size: 13.5px;
    color: var(--muted-text);
    margin-bottom: 14px;
}

.mindmap-sub {
    margin-bottom: 8px;
}

.mindmap-sub:last-child {
    margin-bottom: 0;
}

.mindmap-sub>summary {
    list-style: none;
    cursor: pointer;
    display: flex;
    align-items: baseline;
    gap: 8px;
    font-size: 14.5px;
    font-weight: 600;
    padding: 9px 12px;
    border-radius: 8px;
    color: var(--mm-accent, var(--primary-blue));
    background: color-mix(in srgb, var(--mm-accent, var(--primary-blue)) 10%, transparent);
}

.mindmap-sub>summary::-webkit-details-marker {
    display: none;
}

.mindmap-sub>summary::before {
    content: '›';
    font-weight: 800;
    flex-shrink: 0;
}

.mindmap-sub[open]>summary::before {
    content: '⌄';
}

.mindmap-sub-body {
    margin: 6px 0 10px 12px;
    padding-left: 14px;
    border-left: 1px solid color-mix(in srgb, var(--mm-accent, var(--primary-blue)) 35%, transparent);
}

.mindmap-sub-intro {
    font-size: 13px;
    color: var(--muted-text);
    margin-bottom: 8px;
}

/* Série de mots non hiérarchisés (voir js/mindMap.js: buildMindMapSubBranch) :
   des pastilles plutôt qu'une liste à puces, qui suggérerait un ordre. */
.mindmap-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.mindmap-tags li {
    font-size: 13px;
    line-height: 1.3;
    padding: 4px 11px;
    border-radius: 9999px;
    color: var(--mm-accent, var(--primary-blue));
    background: color-mix(in srgb, var(--mm-accent, var(--primary-blue)) 12%, transparent);
}

/* Puces réaffirmées : le preflight Tailwind (css/tailwind.generated.css)
   remet `list-style: none` sur tous les ul/ol de la page. */
.mindmap-items {
    margin: 0;
    padding-left: 18px;
    list-style: disc outside;
}

.mindmap-items li::marker {
    color: var(--mm-accent, var(--primary-blue));
}

.mindmap-items li {
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 8px;
    color: var(--text-dark);
}

.mindmap-items li:last-child {
    margin-bottom: 0;
}

/* Repères chronologiques : une branche peut lister des jalons datés au lieu
   de sous-branches (voir js/mindMap.js: buildMindMapTimeline). */
.mindmap-timeline {
    margin: 0;
    padding-left: 16px;
    border-left: 2px solid color-mix(in srgb, var(--mm-accent, var(--primary-blue)) 35%, transparent);
}

.mindmap-timeline dt {
    font-size: 13px;
    font-weight: 800;
    color: var(--mm-accent, var(--primary-blue));
    margin-top: 12px;
}

.mindmap-timeline dt:first-child {
    margin-top: 0;
}

.mindmap-timeline dd {
    margin: 2px 0 0;
    font-size: 14px;
    line-height: 1.55;
    color: var(--text-dark);
}

/* Jalon qui correspond à un événement du thème : ouvre sa fiche. Rendu en
   bouton (et non en lien) pour rester accessible au clavier sans inventer
   une URL qui n'existe pas. */
.mindmap-repere-link {
    background: none;
    border: none;
    padding: 0;
    text-align: left;
    font-size: 14px;
    line-height: 1.55;
    font-family: var(--font-main);
    color: var(--text-dark);
    cursor: pointer;
    text-decoration: underline;
    text-decoration-color: color-mix(in srgb, var(--mm-accent, var(--primary-blue)) 55%, transparent);
    text-underline-offset: 3px;
}

.mindmap-repere-link:hover {
    text-decoration-color: var(--mm-accent, var(--primary-blue));
}

/* Passerelle vers le jeu : rejoue l'axe correspondant à ce qu'on vient de
   lire (voir js/mindMap.js: buildMindMapAxisChip). */
.mindmap-axis-chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin-top: 12px;
    padding: 7px 13px;
    border-radius: 9999px;
    border: 1.5px solid var(--mm-accent);
    background: color-mix(in srgb, var(--mm-accent) 12%, transparent);
    color: color-mix(in srgb, var(--mm-accent) 75%, #000);
    font-family: var(--font-main);
    font-size: 12.5px;
    font-weight: 600;
    line-height: 1.3;
    text-align: left;
    cursor: pointer;
    transition: background 0.15s;
}

.mindmap-axis-chip:hover {
    background: color-mix(in srgb, var(--mm-accent) 22%, transparent);
}

[data-theme="dark"] .mindmap-axis-chip {
    color: color-mix(in srgb, var(--mm-accent) 80%, #fff);
}

.mindmap-axis-chip-icon {
    font-size: 14px;
    flex-shrink: 0;
}

@media (max-width: 480px) {

    .mindmap-branch>summary {
        font-size: 15.5px;
        padding: 14px 14px;
    }

    .mindmap-branch-body {
        padding: 0 14px 14px;
    }
}


/* Voile des cartes de catégorie : volontairement désactivé pour laisser voir les
   photos en entier (choix de design). Un aplat à 60 % rétablirait la conformité
   de e2e/contrastes.spec.js (« texte sur photo »), qui échoue sans voile. */
.category-card-veil {
    position: absolute;
    inset: 0;
    background: none;
}

/* =========================================================================
   ACCESSIBILITÉ : FOCUS, TACTILE (voir js/a11y.js et e2e/clavier.spec.js)
   ========================================================================= */

/* Couleur de l'anneau de focus, une par thème : le bleu marine de l'app est
   invisible sur fond sombre, et le jaune illisible sur fond clair. */
:root {
    --focus-ring: #0B57D0;
}

:root[data-theme="dark"] {
    --focus-ring: #FFD54A;
}

/* Anneau pour le seul clavier (:focus-visible : un clic à la souris ou un tap
   ne le déclenche pas). Décalé de 3 px pour se dessiner sur le fond de la
   page et non sur la couleur de l'élément — c'est ce qui le garde lisible
   autour d'une carte bleu marine comme d'une carte jaune. */
:focus-visible {
    outline: 3px solid var(--focus-ring);
    outline-offset: 3px;
}

/* Tout ce qui est en tabindex="-1" — conteneurs d'écran, de modale, cartes-
   questions — ne reçoit le focus que par programme (voir A11y.focusScreen et
   A11y.focusQuestion) pour que Tab reparte du bon endroit : un anneau autour
   d'une page entière n'aurait aucun sens. */
[tabindex="-1"]:focus {
    outline: none;
}

/* Le champ de recherche supprimait son propre contour (outline: none) sans
   rien mettre à la place : le focus y était invisible. On le rend à sa barre. */
.search-bar:focus-within {
    outline: 3px solid var(--focus-ring);
    outline-offset: 2px;
}

.form-input:focus-visible {
    outline: 3px solid var(--focus-ring);
    outline-offset: 2px;
}

/* Carte-thème : le titre est le contrôle principal, l'étoile et la corbeille
   des contrôles frères (voir js/app.js: createThemeCard). Sur un navigateur
   qui sait :has(), l'anneau entoure la CARTE entière quand son titre a le
   focus — un anneau autour du seul texte, posé sur le dégradé bleu, serait
   illisible. Les autres reviennent à un contour blanc sur le dégradé. */
.data-card-title:focus-visible {
    outline: 3px solid #fff;
    outline-offset: 3px;
    border-radius: 4px;
}

.data-card-fav:focus-visible,
.data-card-delete:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
    border-radius: 6px;
}

@supports selector(:has(*)) {
    .data-card-title:focus-visible {
        outline: none;
    }

    .data-card:has(.data-card-title:focus-visible) {
        outline: 3px solid var(--focus-ring);
        outline-offset: 3px;
    }
}

/* Zoom au double-tap : le zoom par pincement est rendu aux utilisateurs (la
   balise viewport ne l'interdit plus), mais le double-tap, lui, se déclencherait
   au milieu d'une partie — le Blitz enchaîne les taps en moins d'une demi-
   seconde. `manipulation` supprime ce seul geste et garde le pincement. Même
   liste que Bootstrap (reboot) ; le curseur de date en est exclu, qu'on fait
   glisser plutôt que taper. */
a, area, button, [role="button"], [role="checkbox"],
input:not([type="range"]), label, select, summary, textarea {
    touch-action: manipulation;
}

/* =====================================================================
   PORTRAITS — champ facultatif `image` d'un événement (voir README « Portraits »)
   Les fichiers font 320 × 400 : affichés à moitié sur la fiche, ils restent
   nets sur un écran 2x. Les variables (--muted-text, --rule, --border-soft)
   sont celles du thème, si bien que le sombre et le zoom du texte suivent.
   ===================================================================== */
.modal-portrait {
    margin: 0 auto 20px;
    max-width: 240px;
    text-align: center;
}

.modal-portrait-img {
    display: block;
    width: 160px;
    height: 200px;
    margin: 0 auto 10px;
    object-fit: cover;
    object-position: top;
    border-radius: 14px;
    background: var(--border-soft);
    box-shadow: 0 6px 18px rgba(0, 26, 75, 0.16);
}

.modal-portrait figcaption {
    font-size: 12px;
    line-height: 1.45;
    color: var(--muted-text);
}

.modal-portrait-caption {
    display: block;
}

.modal-portrait-credit {
    display: block;
    margin-top: 3px;
}

.modal-portrait-credit a {
    color: inherit;
    text-decoration: underline;
}

/* Pays de la figure (panthéons de région) : une ligne discrète sous la date,
   dont la marge négative défait en partie celle de .modal-date. Masquée par
   `.hidden` quand l'événement n'a pas de pays — la marge disparaît avec elle. */
.modal-pays {
    margin: -14px 0 20px;
    font-size: 14px;
    color: var(--muted-text);
}

.modal-bio-row {
    margin-top: 16px;
}

.modal-bio-row .btn {
    width: 100%;
    padding: 10px 14px;
    font-size: 14px;
}

/* Carte « À placer » : portrait de l'événement en main, avant la case de date. */
.hand-portrait {
    flex-shrink: 0;
    width: calc(52px * var(--zoom-level));
    height: calc(65px * var(--zoom-level));
    object-fit: cover;
    object-position: top;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.28);
    background: rgba(255, 255, 255, 0.1);
}

/* Repère de la frise : pastille ronde avant le titre. */
.entry-portrait {
    flex-shrink: 0;
    width: calc(40px * var(--zoom-level));
    height: calc(40px * var(--zoom-level));
    object-fit: cover;
    object-position: top;
    border-radius: 50%;
    border: 1px solid var(--rule);
    background: var(--border-soft);
}

/* =====================================================================
   GALERIE DES PORTRAITS (Personnages illustres, voir js/gallery.js)
   ===================================================================== */

/* Le bouton d'entrée, sous les tuiles « Biographies » et « Panthéons » :
   pleine largeur et teinte de cadre doré, pour qu'on ne le prenne ni pour une
   sous-catégorie ni pour un mode de jeu. Le texte blanc garde au moins
   5,3:1 sur la teinte la plus claire du dégradé. */
.gallery-launcher {
    width: 100%;
    margin-top: 20px;
}

.gallery-launcher-btn {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 20px;
    border: 2px solid #C9A24A;
    border-radius: 24px;
    background: linear-gradient(135deg, #5C4210 0%, #85631F 100%);
    color: #FFFFFF;
    text-align: left;
    cursor: pointer;
    box-shadow: 0 10px 30px rgba(92, 66, 16, 0.25);
    transition: transform 0.2s, box-shadow 0.2s;
}

.gallery-launcher-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 34px rgba(92, 66, 16, 0.32);
}

.gallery-launcher-icon {
    font-size: 30px;
    line-height: 1;
}

.gallery-launcher-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.gallery-launcher-title {
    font-size: 19px;
    font-weight: 700;
}

.gallery-launcher-sub {
    font-size: 12.5px;
}

.gallery-launcher-chevron {
    font-size: 26px;
    transition: transform 0.2s;
}

.gallery-launcher-btn.is-open .gallery-launcher-chevron {
    transform: rotate(90deg);
}

/* Les deux ordres, côte à côte sous le bouton (mêmes boutons que le choix des
   défis, .challenge-picker-btn). */
.gallery-order-picker {
    display: flex;
    gap: 12px;
    margin-top: 12px;
}

.gallery-order-picker .challenge-picker-btn {
    flex: 1 1 0;
}

/* L'écran : titre, décompte, bascule d'ordre, puis une section par initiale
   ou par siècle. */
.gallery-subtitle {
    margin: -8px 0 14px;
    font-size: 14px;
    color: var(--muted-text);
    text-align: center;
}

.gallery-order-toggle {
    display: inline-flex;
    padding: 4px;
    margin-bottom: 18px;
    border-radius: 999px;
    background: var(--surface);
    border: 1px solid var(--border-soft);
    box-shadow: var(--card-shadow);
}

.gallery-order-toggle-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 999px;
    background: transparent;
    color: var(--text-dark);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.gallery-order-toggle-btn.active {
    background: var(--primary-blue);
    color: #FFFFFF;
}

:root[data-theme="dark"] .gallery-order-toggle-btn.active {
    background: #85631F;
}

.gallery-container {
    width: 100%;
    max-width: 1100px;
    padding-bottom: 80px;
}

.gallery-section-title {
    margin: 18px 0 10px;
    padding: 6px 4px;
    color: var(--text-dark);
    font-size: 18px;
    font-weight: 700;
    border-bottom: 1px solid var(--border-soft);
}

/* Trois colonnes sur un téléphone, quatre à six sur une tablette, comme une
   planche de trombinoscope. */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 12px;
}

@media (min-width: 768px) {
    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 16px;
    }
}

.gallery-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 10px 8px 12px;
    border: 1px solid var(--border-soft);
    border-radius: 16px;
    background: var(--surface);
    color: var(--text-dark);
    box-shadow: var(--card-shadow);
    text-align: center;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.gallery-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--card-shadow-hover);
}

.gallery-card-frame {
    width: 100%;
    aspect-ratio: 4 / 5;
    border-radius: 8px;
    overflow: hidden;
    background: var(--border-soft);
}

.gallery-card-img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top;
}

.gallery-card-name {
    font-size: 13px;
    font-weight: 700;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.gallery-card-meta {
    font-size: 12px;
    color: var(--muted-text);
}

/* Fiche ouverte depuis la galerie : « Jouer sur sa biographie » et « Jouer sur
   le panthéon » forment un seul bloc sous un même filet. */
.modal-content.from-gallery .modal-bio-row:not(.hidden) {
    margin-top: 22px;
    padding-top: 18px;
    border-top: 1px solid var(--border-soft);
}

.modal-content.from-gallery .modal-bio-row:not(.hidden) + .modal-theme-row {
    margin-top: 10px;
    padding-top: 0;
    border-top: none;
}

/* Galerie : recherche, filtres, passage d'un portrait à l'autre ---------- */
.gallery-search {
    width: 100%;
    max-width: 520px;
    margin-bottom: 14px;
}

.gallery-filters {
    width: 100%;
    max-width: 640px;
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: center;
    gap: 8px 10px;
    margin-bottom: 4px;
}

.gallery-filter {
    flex: 1 1 140px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.gallery-filter-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--muted-text);
}

/* 16 px : en dessous, Safari sur iPhone zoome la page à la prise de focus. */
.gallery-select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-soft);
    border-radius: 12px;
    background: var(--surface);
    color: var(--text-dark);
    font: inherit;
    font-size: 16px;
}

.gallery-reset {
    padding: 10px 14px;
    border: none;
    background: transparent;
    color: var(--primary-blue);
    font-size: 14px;
    font-weight: 600;
    text-decoration: underline;
    cursor: pointer;
}

:root[data-theme="dark"] .gallery-reset {
    color: #9DC1FF;
}

.gallery-order-picker {
    flex-wrap: wrap;
}

.gallery-order-toggle-btn {
    padding: 8px 12px;
}

.modal-gallery-nav {
    display: none;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin: 0 36px 10px 0;
}

.modal-content.from-gallery .modal-gallery-nav {
    display: flex;
}

.modal-gallery-nav-btn {
    width: 40px;
    height: 40px;
    border: 1px solid var(--border-soft);
    border-radius: 50%;
    background: var(--surface);
    color: var(--text-dark);
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
}

.modal-gallery-nav-btn:disabled {
    opacity: 0.35;
    cursor: default;
}

.modal-gallery-nav-pos {
    flex: 1;
    text-align: center;
    font-size: 13px;
    color: var(--muted-text);
}

/* Collection de portraits : noir et blanc jusqu'à la rencontre en jeu ------ */
.gallery-card.is-locked .gallery-card-img {
    filter: grayscale(1);
    opacity: 0.88;
}

.gallery-collection {
    width: 100%;
    max-width: 520px;
    margin-bottom: 14px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.gallery-collection-meter {
    width: 100%;
}

.gallery-collection-count {
    display: block;
    margin-bottom: 6px;
    text-align: center;
    font-size: 14px;
    font-weight: 700;
    color: var(--text-dark);
}

.gallery-collection-bar {
    height: 8px;
    border-radius: 999px;
    background: var(--border-soft);
    overflow: hidden;
}

.gallery-collection-fill {
    display: block;
    height: 100%;
    width: 0;
    border-radius: 999px;
    background: linear-gradient(90deg, #C9A24A, #85631F);
    transition: width 0.4s ease;
}

.gallery-collection-toggle {
    padding: 6px 10px;
    border: none;
    background: transparent;
    color: var(--primary-blue);
    font-size: 13px;
    font-weight: 600;
    text-decoration: underline;
    cursor: pointer;
}

:root[data-theme="dark"] .gallery-collection-toggle {
    color: #9DC1FF;
}

.collection-intro {
    margin: 4px 0 6px;
    font-size: 15px;
    line-height: 1.5;
    color: var(--text-dark);
}

.collection-choice {
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 100%;
    margin-top: 10px;
    padding: 14px 16px;
    border: 2px solid var(--border-soft);
    border-radius: 16px;
    background: var(--surface);
    color: var(--text-dark);
    text-align: left;
    cursor: pointer;
    transition: border-color 0.2s, transform 0.2s;
}

.collection-choice:hover {
    border-color: #C9A24A;
    transform: translateY(-1px);
}

.collection-choice-title {
    font-size: 16px;
    font-weight: 700;
}

.collection-choice-sub {
    font-size: 13px;
    line-height: 1.4;
    color: var(--muted-text);
}

/* Fiche d'un personnage pas encore rencontré : portrait en noir et blanc, et la façon de le débloquer. */
.modal-gallery-lock {
    display: none;
    margin: 4px 0 10px;
    padding: 8px 12px;
    border-radius: 12px;
    background: var(--selected-tint);
    color: var(--text-dark);
    font-size: 13px;
    line-height: 1.4;
}

.modal-content.from-gallery-locked .modal-gallery-lock {
    display: block;
}

.modal-content.from-gallery-locked .modal-portrait-img {
    filter: grayscale(1);
}

/* L'en-tête de la galerie reste bas : les visages sont ce qu'on vient voir, et sur un téléphone
   chaque ligne de commandes repousse la première carte sous le pli. */
/* =====================================================================
   RENOMMÉE DES PERSONNAGES (js/renown.js) : le contour du portrait.
   1 filet bronze = renommée locale · 2 filets argent = régionale · 3 filets or = mondiale.
   La couleur ne porte jamais seule le sens : le nombre de filets et le libellé le disent aussi.
   ===================================================================== */
.renown-1 { --rn: #b0703c; }
.renown-2 { --rn: #8d99a6; }
.renown-3 { --rn: #d4a017; }

/* Image libre (fiche, révélation d'une réponse) : les filets entourent le portrait, dessinés par des ombres sans flou ; les marges
   laissent la place du dernier filet. */
.renown-img.renown-1 {
    box-shadow: 0 0 0 3px var(--rn);
    margin-top: 6px;
    margin-bottom: 16px;
}

.renown-img.renown-2 {
    box-shadow: 0 0 0 3px var(--rn), 0 0 0 5px var(--surface), 0 0 0 8px var(--rn);
    margin-top: 10px;
    margin-bottom: 20px;
}

.renown-img.renown-3 {
    box-shadow: 0 0 0 3px var(--rn), 0 0 0 5px var(--surface), 0 0 0 8px var(--rn), 0 0 0 10px var(--surface), 0 0 0 13px var(--rn);
    margin-top: 14px;
    margin-bottom: 24px;
}

/* Vignette de la galerie : le cadre rogne ce qui dépasse, les filets sont donc posés à l'intérieur, par-dessus la photo. */
.renown-frame {
    position: relative;
}

.renown-frame::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
}

.renown-frame.renown-1::after {
    box-shadow: inset 0 0 0 3px var(--rn);
}

.renown-frame.renown-2::after {
    box-shadow: inset 0 0 0 3px var(--rn), inset 0 0 0 5px rgba(255, 255, 255, 0.9), inset 0 0 0 8px var(--rn);
}

.renown-frame.renown-3::after {
    box-shadow: inset 0 0 0 3px var(--rn), inset 0 0 0 5px rgba(255, 255, 255, 0.9), inset 0 0 0 8px var(--rn),
        inset 0 0 0 10px rgba(255, 255, 255, 0.9), inset 0 0 0 13px var(--rn);
}

/* L'étiquette : trois pastilles dont autant sont pleines que de filets, puis le libellé. */
.renown-chip {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin: 2px auto 6px;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-dark);
}

.renown-chip.hidden {
    display: none;
}

.renown-pips {
    display: inline-flex;
    gap: 3px;
}

.renown-pips i {
    display: block;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--rn);
}

.renown-1 .renown-pips i:nth-child(n + 2),
.renown-2 .renown-pips i:nth-child(3) {
    background: transparent;
    box-shadow: inset 0 0 0 1.5px var(--rn);
}

/* La galerie : la case, les trois boutons du filtre, une ligne d'explication. */
.gallery-renown {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin: 4px 0 12px;
    width: 100%;
    max-width: 520px;
}

.gallery-renown-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    font-size: 14px;
    font-weight: 700;
    color: var(--text-dark);
    cursor: pointer;
}

.gallery-renown-toggle input {
    width: 20px;
    height: 20px;
}

.gallery-renown-filter {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
}

.gallery-renown-filter.hidden,
.gallery-renown-help.hidden {
    display: none;
}

.gallery-renown-btn {
    min-height: 44px;
    margin: 0;
    padding: 0 12px;
    border: 2px solid var(--rn);
    border-radius: 999px;
    background: var(--surface);
    font: inherit;
    font-size: 13px;
    font-weight: 700;
    color: var(--text-dark);
    cursor: pointer;
}

.gallery-renown-btn[aria-pressed="true"] {
    background: color-mix(in srgb, var(--rn) 22%, var(--surface));
    box-shadow: 0 0 0 2px var(--rn);
}

.gallery-renown-help {
    margin: 0;
    max-width: 440px;
    text-align: center;
    font-size: 12px;
    line-height: 1.4;
    color: var(--muted-text);
}

.gallery-header-title {
    font-size: 22px;
    margin-top: 12px;
    margin-bottom: 6px;
}

#screen-gallery .gallery-subtitle {
    margin: 0 0 10px;
}

#screen-gallery .gallery-search {
    margin-bottom: 10px;
}

#screen-gallery .gallery-order-toggle {
    margin-bottom: 12px;
}

#screen-gallery .gallery-collection {
    margin-bottom: 8px;
}

/* Mode « Qui est-ce ? » : un portrait, quatre noms ------------------------- */
.mode-card.whois-card {
    background: linear-gradient(135deg, #4A235A, #8E44AD);
}

.whois-question-card {
    padding: 22px 20px 18px;
}

.whois-portrait {
    margin: 4px auto 0;
    max-width: 240px;
}

.whois-portrait-img {
    display: block;
    width: 200px;
    max-width: 100%;
    height: auto;
    aspect-ratio: 4 / 5;
    margin: 0 auto;
    object-fit: cover;
    object-position: top;
    border-radius: 14px;
    background: var(--border-soft);
    box-shadow: var(--card-shadow);
}

.whois-portrait-credit {
    margin-top: 8px;
    font-size: 12px;
    line-height: 1.4;
    color: var(--muted-text);
}

/* Le révélé : la fiche de la personne, qu'on lit à son rythme — d'où un vrai bouton « Continuer »
   plutôt qu'une disparition au bout de deux secondes. Même carcasse que le révélé des autres modes. */
.whois-reveal {
    background: var(--surface);
    border-radius: 14px;
    border: 1px solid var(--border-soft);
    padding: 18px 20px;
    box-shadow: var(--card-shadow);
    animation: simul-reveal-in 0.32s ease-out both;
}

.whois-reveal-verdict {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.whois-reveal-verdict.is-good {
    color: var(--success-text);
}

.whois-reveal-verdict.is-bad {
    color: var(--danger-red-text);
}

.whois-reveal-name {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-dark);
}

.whois-reveal-name small {
    font-size: 15px;
    font-weight: 600;
    color: var(--muted-text);
}

.whois-reveal-caption {
    margin-top: 4px;
    font-size: 13px;
    font-style: italic;
    color: var(--muted-text);
}

.whois-reveal-desc {
    margin: 10px 0 16px;
    font-size: 15px;
    line-height: 1.5;
    color: var(--text-dark);
}

.whois-continue {
    width: 100%;
}

.whois-continue + .whois-continue {
    margin-top: 10px;
}

/* Portrait du jour : un « Qui est-ce ? » d'une question, non classé ----------------- */
.challenge-picker-btn.portrait-day-btn {
    border-color: #C9A24A;
}

.portrait-day-text {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 2px;
}

/* Les quatre défis (jour, semaine, simultanéité, portrait du jour) tiennent sur une ligne dès la tablette ;
   sur téléphone, deux par ligne. */
#challenge-picker {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

#challenge-picker .challenge-picker-btn {
    min-width: 0;
    justify-content: center;
    text-align: center;
}

.portrait-day-title {
    font-size: 14px;
}

.portrait-day-status {
    font-size: 12px;
    font-weight: 500;
    color: var(--muted-text);
}

/* Ni vies, ni progression, ni points : la barre du haut ne garde que « Quitter » et la taille du texte. */
#screen-whois.is-portrait-day .lives-row,
#screen-whois.is-portrait-day .game-bar .bar-row + .bar-row {
    display: none;
}

/* Repère « biographie disponible » : une pastille dans l'angle de la photo. Posée par-dessus, elle
   n'ajoute rien à la carte — avec ou sans, le gabarit est le même. */
.gallery-card-frame {
    position: relative;
}

.gallery-card-bio {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
    font-size: 11px;
    line-height: 1;
}

/* =====================================================================
           FRISE HORIZONTALE SUR PLUSIEURS LIGNES — « Lignes multiples » et
           « Serpentin » (réglage landscapeFlow, voir effectiveLandscapeFlow
           dans js/app.js). Réservées aux grands écrans : sur un téléphone la
           frise reste sur une ligne, et ces règles ne s'appliquent pas
           (data-landscape-multi n'est alors pas posé).
           En paysage, la frise sur une seule ligne laissait vide toute la
           hauteur de l'écran. Ici la frise défile de haut en bas.
           L'axe unique de .chrono::before ne peut pas suivre les retours à la
           ligne : chaque repère et chaque intervalle trace donc son propre
           tronçon d'axe (::after), à la hauteur de la puce.
           ===================================================================== */
[data-layout="horizontal"][data-landscape-multi] .chrono {
    --flow-axis: #c5c6d0;
}

[data-theme="dark"][data-layout="horizontal"][data-landscape-multi] .chrono {
    --flow-axis: var(--axis);
}

[data-layout="horizontal"][data-landscape-multi] .board {
    touch-action: pan-y;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    justify-content: flex-start !important;
    align-items: stretch !important;
    padding: 16px 28px 32px !important;
    scroll-padding: 90px 0 !important;
}

[data-layout="horizontal"][data-landscape-multi] .chrono::before {
    display: none !important;
}

[data-layout="horizontal"][data-landscape-multi] .entry::after,
[data-layout="horizontal"][data-landscape-multi] .slot::after {
    content: "";
    position: absolute;
    top: calc(var(--h-head) + 7px);
    left: 0;
    right: 0;
    height: 2px;
    background: var(--flow-axis);
    z-index: 1;
    pointer-events: none;
}

/* La frise défile ici verticalement : la légende des axes reprend sa place
   normale (centrée par ses marges auto) au lieu du recentrage prévu pour le
   défilement horizontal. */
[data-layout="horizontal"][data-landscape-multi] .timeline-axes-legend.pinned {
    left: auto !important;
    transform: none !important;
}

/* --- Lignes multiples : les repères reviennent à la ligne comme un texte. --- */
[data-layout="horizontal"][data-landscape-flow="wrap"] .chrono {
    flex-wrap: wrap !important;
    /* --wrap-width : largeur de la ligne la plus large (markTimelineRows), pour
       centrer le bloc sans centrer les lignes une à une. */
    width: var(--wrap-width, 100%) !important;
    min-width: 0 !important;
    max-width: 1600px !important;
    margin: auto !important;
    padding: 0 !important;
    row-gap: 28px;
}

/* Fin de ligne : l'axe s'arrête sur une pointe de flèche... */
[data-layout="horizontal"][data-landscape-flow="wrap"] .row-end::after {
    right: 10px;
}

[data-layout="horizontal"][data-landscape-flow="wrap"] .row-end::before {
    content: "";
    position: absolute;
    top: calc(var(--h-head) + 2px);
    right: 0;
    border-left: 12px solid var(--flow-axis);
    border-top: 6px solid transparent;
    border-bottom: 6px solid transparent;
    z-index: 1;
    pointer-events: none;
}

/* ... et reprend à la ligne suivante, en fondu, comme une suite. */
[data-layout="horizontal"][data-landscape-flow="wrap"] .row-start::after {
    background: linear-gradient(90deg, transparent 0, var(--flow-axis) 40%);
}

[data-layout="horizontal"][data-landscape-flow="wrap"] .chrono:not(.playing) .entry.row-start {
    border-left: none !important;
}

/* --- Une ligne par axe : une voie par axe thématique (Découverte). --- */
[data-layout="horizontal"][data-landscape-flow="wrap"] .chrono.axis-lanes {
    flex-direction: column !important;
    flex-wrap: nowrap !important;
    align-items: stretch !important;
    row-gap: 22px;
}

.axis-lane {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.axis-lane-head {
    display: flex;
    align-items: center;
}

.axis-lane-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    row-gap: 20px;
}

[data-layout="horizontal"][data-landscape-multi] .axis-lane-badge {
    margin: 0;
    max-width: 100%;
    font-size: calc(13px * var(--zoom-level));
    padding: 4px 12px;
    text-align: left;
}

/* Les étiquettes d'axe se masquent quand la légende est repliée ; pas celles
   des voies, qui sont ici la légende même. */
.axes-entry-badges-hidden .axis-lane-badge {
    display: inline-flex;
}

.axis-lane-badge[data-axis="none"] {
    background: var(--surface-2);
    border-color: var(--rule);
    color: var(--ink-soft);
}

/* --- Serpentin : grille dont une ligne sur deux se lit de droite à gauche. --- */
[data-layout="horizontal"][data-landscape-flow="snake"] .chrono {
    display: grid !important;
    grid-template-columns: repeat(var(--snake-cols, 4), 170px) !important;
    justify-content: center !important;
    align-items: stretch !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    margin: auto !important;
    padding: 0 !important;
    row-gap: 28px;
}

/* Une pointe de flèche entre deux repères indique le sens de lecture. */
[data-layout="horizontal"][data-landscape-flow="snake"] .entry::before {
    content: "";
    position: absolute;
    top: calc(var(--h-head) + 3px);
    right: 0;
    border-left: 10px solid var(--flow-axis);
    border-top: 5px solid transparent;
    border-bottom: 5px solid transparent;
    z-index: 1;
    pointer-events: none;
}

[data-layout="horizontal"][data-landscape-flow="snake"] .entry.row-rtl::before {
    right: auto;
    left: 0;
    border-left: none;
    border-right: 10px solid var(--flow-axis);
}

[data-layout="horizontal"][data-landscape-flow="snake"] .entry.snake-end::before {
    display: none;
}

/* Demi-tour en bout de ligne : l'axe sort du dernier repère, descend d'une
   ligne et rentre dans le premier de la suivante (même colonne). La hauteur
   est celle du repère, qui occupe toute la ligne de la grille, plus l'écart
   entre lignes (28 px) et l'épaisseur de l'axe (2 px). */
.snake-turn {
    position: absolute;
    top: calc(var(--h-head) + 7px);
    height: calc(100% + 30px);
    width: 26px;
    box-sizing: border-box;
    border: 2px solid var(--flow-axis);
    z-index: 1;
    pointer-events: none;
}

.snake-end:not(.row-rtl) .snake-turn {
    left: 100%;
    border-left: none;
    border-radius: 0 26px 26px 0;
}

.snake-end.row-rtl .snake-turn {
    right: 100%;
    border-right: none;
    border-radius: 26px 0 0 26px;
}

/* La pointe d'arrivée, dans le sens du demi-tour. */
.snake-turn::after {
    content: "";
    position: absolute;
    bottom: -6px;
    border-top: 5px solid transparent;
    border-bottom: 5px solid transparent;
}

.snake-end:not(.row-rtl) .snake-turn::after {
    left: -1px;
    border-right: 10px solid var(--flow-axis);
}

.snake-end.row-rtl .snake-turn::after {
    right: -1px;
    border-left: 10px solid var(--flow-axis);
}

/* --- Axe thématique : liseré de couleur plutôt qu'étiquette, sur tous les écrans et dans toutes les orientations. ---
   L'étiquette (2 à 3 lignes de texte sous chaque carte) coûtait presque une
   ligne de frise par écran. La carte porte à la place un liseré de la couleur
   de l'axe — celle de la légende, quand il y en a une (Découverte) ; en
   partie, l'étiquette reste mais tient sur une seule ligne (nom complet dans
   l'infobulle). */
.entry[data-axis] .entry-title {
    box-shadow: inset 0 5px 0 var(--axis-c), 0px 10px 30px rgba(0, 26, 75, 0.05) !important;
    padding-top: 14px !important;
}

[data-layout="horizontal"][data-landscape-multi] .entry .entry-axe-badge {
    display: block;
    box-sizing: border-box;
    max-width: 100%;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

/* Case à cocher des réglages. */
.settings-check {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-dark);
    cursor: pointer;
}

.settings-check input {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    accent-color: var(--primary-blue);
}

/* =========================================================================
   ATLAS (voir js/atlas.js) : carte plein écran, commandes et feuille du bas
   posées par-dessus. Le conteneur du bas laisse passer les gestes (pointer-events)
   pour que la carte reste manipulable derrière ; seuls ses enfants les captent.
   ========================================================================= */
#screen-atlas {
    position: fixed;
    inset: 0;
    background: var(--bg-color);
    overflow: hidden;
}

/* L'identifiant, pas la classe : maplibre-gl.css pose `.maplibregl-map { position: relative }`
   et, chargé plus tard, l'emporterait à spécificité égale — la carte retomberait à 0 px de haut. */
#atlas-map.atlas-map {
    position: absolute;
    inset: 0;
}

/* Point de la position du joueur sur l'Atlas (js/location.js, js/atlas.js). */
.atlas-me-dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #2f6fdb;
    border: 3px solid #fff;
    box-shadow: 0 0 0 4px rgba(47, 111, 219, 0.3);
}

.location-ctrl-btn {
    width: 29px;
    height: 29px;
    font-size: 18px;
    line-height: 1;
    background: none;
    border: 0;
    cursor: pointer;
    color: var(--text-dark);
}

.atlas-status {
    position: absolute;
    top: calc(env(safe-area-inset-top, 0px) + 68px);
    left: 50%;
    transform: translateX(-50%);
    z-index: 40;
    max-width: calc(100% - 140px);
    padding: 8px 16px;
    border-radius: 9999px;
    background: var(--surface);
    color: var(--text-dark);
    border: 1px solid var(--border-soft);
    box-shadow: var(--card-shadow);
    font-size: 14px;
    text-align: center;
}

.atlas-bottom {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 30;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 0 12px calc(env(safe-area-inset-bottom, 0px) + 12px);
    pointer-events: none;
}

.atlas-controls,
.atlas-sheet {
    pointer-events: auto;
    width: 100%;
    max-width: 640px;
    background: var(--surface);
    color: var(--text-dark);
    border: 1px solid var(--border-soft);
    border-radius: 18px;
    box-shadow: var(--card-shadow);
}

.atlas-controls {
    padding: 12px 14px 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.atlas-controls-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    font-size: 14px;
}

.atlas-count {
    font-weight: 700;
}

.atlas-years {
    color: var(--muted-text);
    text-align: right;
}

.atlas-chips {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: none;
}

.atlas-chips::-webkit-scrollbar {
    display: none;
}

.atlas-chip {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 36px;
    padding: 6px 14px;
    border-radius: 9999px;
    border: 2px solid var(--border-soft);
    background: var(--surface-2);
    color: var(--text-dark);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}

.atlas-chip[aria-pressed="true"] {
    background: var(--primary-blue);
    border-color: var(--primary-blue);
    color: #ffffff;
}

:root[data-theme="dark"] .atlas-chip[aria-pressed="true"] {
    border-color: #7fa6c9;
}

.atlas-chip-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 1.5px solid #ffffff;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.25);
}

.atlas-time {
    display: grid;
    gap: 2px;
}

.atlas-range {
    width: 100%;
    margin: 0;
    accent-color: var(--primary-blue);
    height: 28px;
}

:root[data-theme="dark"] .atlas-range {
    accent-color: #7fa6c9;
}

.atlas-sheet {
    position: relative;
    max-height: 42vh;
    display: flex;
    flex-direction: column;
}

.atlas-sheet-close {
    position: absolute;
    top: 6px;
    right: 8px;
    z-index: 1;
    width: 34px;
    height: 34px;
    border: none;
    border-radius: 50%;
    background: var(--surface-2);
    color: var(--text-dark);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}

.atlas-sheet-body {
    overflow-y: auto;
    padding: 14px 16px 12px;
    -webkit-overflow-scrolling: touch;
}

.atlas-sheet-title,
.atlas-card-title {
    margin: 0 40px 8px 0;
    font-size: 16px;
    font-weight: 700;
    line-height: 1.3;
}

.atlas-card-meta {
    color: var(--muted-text);
    font-size: 13px;
    margin-bottom: 6px;
}

.atlas-card-approx {
    display: inline-block;
    margin-bottom: 6px;
    padding: 2px 10px;
    border-radius: 9999px;
    background: var(--selected-tint);
    color: var(--text-dark);
    font-size: 12px;
    font-weight: 600;
}

.atlas-card-desc {
    margin: 4px 0 12px;
    font-size: 14px;
    line-height: 1.45;
}

.atlas-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.atlas-row {
    display: flex;
    align-items: baseline;
    gap: 10px;
    width: 100%;
    padding: 10px 6px;
    border: none;
    border-bottom: 1px solid var(--border-soft);
    background: transparent;
    color: var(--text-dark);
    font-size: 14px;
    text-align: left;
    cursor: pointer;
}

.atlas-row:hover {
    background: var(--surface-2);
}

.atlas-row-focus {
    background: var(--selected-tint);
    box-shadow: inset 4px 0 0 var(--primary-blue);
}

:root[data-theme="dark"] .atlas-row-focus {
    box-shadow: inset 4px 0 0 #7fa6c9;
}

.atlas-row-year {
    flex: 0 0 auto;
    min-width: 64px;
    color: var(--muted-text);
    font-variant-numeric: tabular-nums;
    font-weight: 600;
}

.atlas-row-title {
    flex: 1 1 auto;
}

.atlas-row-approx {
    flex: 0 0 auto;
    color: var(--muted-text);
    font-weight: 700;
}

.atlas-list-note {
    margin: 10px 0 0;
    color: var(--muted-text);
    font-size: 13px;
}

.modal-map-row {
    margin-top: 14px;
    display: flex;
    justify-content: center;
}

/* Les contrôles de MapLibre (zoom, attribution) passent au-dessus du fond de carte mais
   sous la barre de commandes du bas, et suivent le thème sombre. */
#screen-atlas .maplibregl-ctrl-top-right {
    top: calc(env(safe-area-inset-top, 0px) + 8px);
}

#screen-atlas .maplibregl-ctrl-bottom-right,
#screen-atlas .maplibregl-ctrl-bottom-left {
    z-index: 5;
}

:root[data-theme="dark"] .maplibregl-ctrl-group {
    background: var(--surface);
}

:root[data-theme="dark"] .maplibregl-ctrl-group button .maplibregl-ctrl-icon {
    filter: invert(1);
}

/* Deux rangées de quatre boutons ronds en tête de l'écran des catégories. Sur les écrans les plus étroits
   (≤ 400 px), les pastilles rétrécissent un peu. */
/* L'accueil : les boutons ronds (ou le bandeau « Aujourd'hui ») suivent la carte de niveau de près — 16 px sur téléphone, 32 px sur
   grand écran —, sans le grand vide d'avant (marge du conteneur + marge de la grille, 56 à 72 px). */
#categories-container {
    margin-top: 0;
}

.home-quick-grid {
    margin-top: 0;
}

.home-quick-grid > :first-child {
    margin-top: 0;
}

@media (min-width: 768px) {
    .home-quick-grid {
        margin-top: 16px;
    }
}

.quick-actions-row {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
    text-align: center;
    margin-top: 14px;
}

/* Dès la tablette, les rangées s'étendent sur toute la largeur utile : le premier bouton touche la marge
   gauche, le dernier la marge droite, et les écarts entre les quatre sont égaux — comme les autres
   éléments de l'écran. */
@media (min-width: 768px) {
    .quick-actions-row {
        grid-template-columns: repeat(4, 64px);
        justify-content: space-between;
        margin-top: 24px;
    }

    /* La colonne n'a que la largeur du cercle : la légende, centrée dessous, peut la déborder un peu. */
    .quick-actions-row .quick-action-label {
        white-space: nowrap;
    }

    #quick-actions-1 {
        margin-top: 0;
    }
}

.quick-action {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
}

.quick-action .quick-action-circle {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.quick-action-emoji {
    font-size: 28px;
}

/* Un bouton rond « déplié » (Défis, Hasard, Dictionnaires, Généalogie, Sainteté, Textes : il affiche ses sous-boutons) garde le fond bleu clair du survol,
   pour qu'on voie sur lequel on a appuyé. Posé après la règle du thème sombre, qu'il doit battre à spécificité égale. */
.quick-action[aria-expanded="true"] .quick-action-circle {
    background: var(--surface-2);
}

.quick-action .quick-action-label {
    font-size: 13px;
    font-weight: 600;
    line-height: 1.25;
    margin-top: 8px;
    color: var(--text-dark);
}

/* « Défis » (profils Tout public et Scolaire) : tant qu'un défi du moment reste à jouer, le rond devient un petit soleil — fond doré,
   lueur qui respire, couronne de rayons qui tourne lentement — et une pastille dit combien il en reste. Tout joué : rond normal,
   pastille verte ✓. Voir refreshHomeChallenges (js/app/categories.js). */
.quick-action .quick-action-circle {
    position: relative;
}

.quick-action-badge {
    display: none;
}

#btn-daily .quick-action-badge {
    position: absolute;
    top: -3px;
    right: -3px;
    z-index: 2;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    border-radius: 11px;
    border: 2px solid var(--surface);
    font-size: 12px;
    font-weight: 800;
    line-height: 1;
    align-items: center;
    justify-content: center;
    color: #fff;
}

#btn-daily.is-pending .quick-action-badge {
    display: flex;
    background: #e8590c;
}

#btn-daily.is-done .quick-action-badge {
    display: flex;
    background: #2f9e44;
}

#btn-daily.is-pending .quick-action-circle {
    isolation: isolate;
    background: radial-gradient(circle at 50% 38%, #fffbe8 0%, #ffe9a8 55%, #ffd56a 100%);
    border-color: #f5b400;
    animation: challengeGlow 2.6s ease-in-out infinite;
}

#btn-daily.is-pending .quick-action-circle::before {
    content: '';
    position: absolute;
    inset: -10px;
    z-index: -1;
    border-radius: 50%;
    background: repeating-conic-gradient(from 0deg, rgba(255, 176, 0, 0.75) 0deg 7deg, transparent 7deg 30deg);
    -webkit-mask: radial-gradient(closest-side, transparent 74%, #000 79%, #000 94%, transparent 100%);
    mask: radial-gradient(closest-side, transparent 74%, #000 79%, #000 94%, transparent 100%);
    animation: challengeRays 16s linear infinite;
}

#btn-daily.is-pending .quick-action-label {
    color: #b45309;
}

:root[data-theme="dark"] #btn-daily.is-pending .quick-action-circle {
    background: radial-gradient(circle at 50% 38%, #6b5317 0%, #4d3b0f 60%, #3a2c0a 100%);
}

:root[data-theme="dark"] #btn-daily.is-pending .quick-action-label {
    color: #fbbf24;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) #btn-daily.is-pending .quick-action-circle {
        background: radial-gradient(circle at 50% 38%, #6b5317 0%, #4d3b0f 60%, #3a2c0a 100%);
    }

    :root:not([data-theme="light"]) #btn-daily.is-pending .quick-action-label {
        color: #fbbf24;
    }
}

@keyframes challengeGlow {
    0%, 100% { box-shadow: 0 0 0 2px rgba(255, 190, 0, 0.25), 0 0 10px 2px rgba(255, 170, 0, 0.35); }
    50% { box-shadow: 0 0 0 4px rgba(255, 190, 0, 0.35), 0 0 22px 6px rgba(255, 170, 0, 0.55); }
}

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

@media (prefers-reduced-motion: reduce) {
    #btn-daily.is-pending .quick-action-circle,
    #btn-daily.is-pending .quick-action-circle::before {
        animation: none;
    }

    #btn-daily.is-pending .quick-action-circle {
        box-shadow: 0 0 0 3px rgba(255, 190, 0, 0.3), 0 0 16px 4px rgba(255, 170, 0, 0.45);
    }
}

/* Dans le volet des Défis : « À jouer · classement » (orange) ou « ✓ Joué » (discret), sous chaque défi qui compte. */
.challenge-status {
    font-size: 11px;
    font-weight: 700;
    line-height: 1.2;
    color: #c2410c;
}

.challenge-status.is-done {
    font-weight: 500;
    color: var(--muted-text);
}

:root[data-theme="dark"] .challenge-status:not(.is-done) {
    color: #fb923c;
}

/* « Reprendre » sans partie commencée : affiché, mais éteint (le clic explique pourquoi). */
.quick-action.is-disabled .quick-action-circle {
    opacity: 0.55;
}

.quick-action.is-disabled .quick-action-label {
    color: var(--muted-text);
}

@media (max-width: 400px) {
    .quick-action .quick-action-circle {
        width: 54px;
        height: 54px;
    }

    .quick-action .quick-action-label {
        font-size: 12px;
    }
}

/* Recherche : un champ à droite du bouton retour, sa liste en dessous (au-dessus de la carte). */
.atlas-search {
    position: absolute;
    top: calc(env(safe-area-inset-top, 0px) + 14px);
    left: 66px;
    right: 56px;
    max-width: 520px;
    z-index: 50;
}

.atlas-search-input {
    width: 100%;
    height: 42px;
    box-sizing: border-box;
    padding: 0 38px 0 16px;
    border-radius: 9999px;
    border: 1px solid var(--border-soft);
    background: var(--surface);
    color: var(--text-dark);
    box-shadow: var(--card-shadow);
    font-size: 16px;
}

.atlas-search-clear {
    position: absolute;
    top: 0;
    right: 4px;
    width: 38px;
    height: 42px;
    border: none;
    background: transparent;
    color: var(--text-dark);
    font-size: 22px;
    cursor: pointer;
}

.atlas-search-results {
    margin-top: 6px;
    max-height: min(60vh, 420px);
    overflow-y: auto;
    background: var(--surface);
    color: var(--text-dark);
    border: 1px solid var(--border-soft);
    border-radius: 16px;
    box-shadow: var(--card-shadow);
}

.atlas-search-section {
    padding: 8px 14px 4px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    opacity: 0.65;
}

.atlas-search-item {
    display: flex;
    align-items: baseline;
    gap: 10px;
    width: 100%;
    padding: 10px 14px;
    border: none;
    border-bottom: 1px solid var(--border-soft);
    background: transparent;
    color: var(--text-dark);
    font-size: 14px;
    text-align: left;
    cursor: pointer;
}

.atlas-search-item:hover,
.atlas-search-item:focus-visible {
    background: var(--surface-2);
}

.atlas-search-main {
    flex: 1;
    min-width: 0;
}

.atlas-search-aside {
    flex: none;
    max-width: 38%;
    font-size: 12px;
    opacity: 0.65;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.atlas-search-none {
    padding: 14px;
    font-size: 14px;
    opacity: 0.7;
}

.atlas-search-input::-webkit-search-cancel-button {
    -webkit-appearance: none;
    appearance: none;
    display: none;
}

.atlas-search-item .atlas-row-year {
    flex: none;
    min-width: 0;
    width: 3.6em;
}

/* Le bouton de disposition n'a de sens que sur écran large. */
.atlas-layout-btn {
    display: none;
    flex: none;
    width: 30px;
    height: 30px;
    border: 1px solid var(--border-soft);
    border-radius: 8px;
    background: var(--surface-2);
    color: var(--text-dark);
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
}

.atlas-layout-btn[aria-pressed="true"] {
    background: var(--selected-tint);
    border-color: var(--primary-blue);
}

@media (min-width: 900px) {
    .atlas-layout-btn {
        display: block;
    }
}

/* Disposition « panneau latéral » : une colonne à gauche (filtres puis fiche) posée sur la carte plein écran. */
#screen-atlas.atlas-side {
    --atlas-side-w: 380px;
}

#screen-atlas.atlas-side .atlas-bottom {
    top: 0;
    right: auto;
    width: var(--atlas-side-w);
    box-sizing: border-box;
    padding: calc(env(safe-area-inset-top, 0px) + 68px) 0 0;
    gap: 0;
    background: var(--surface);
    border-right: 1px solid var(--border-soft);
    box-shadow: var(--card-shadow);
    pointer-events: auto;
    overflow: hidden;
}

#screen-atlas.atlas-side .atlas-controls,
#screen-atlas.atlas-side .atlas-sheet {
    max-width: none;
    border: none;
    border-radius: 0;
    box-shadow: none;
}

#screen-atlas.atlas-side .atlas-controls {
    order: 1;
    flex: none;
    border-bottom: 1px solid var(--border-soft);
}

#screen-atlas.atlas-side .atlas-sheet {
    order: 2;
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;
}

#screen-atlas.atlas-side .atlas-sheet-body {
    flex: 1 1 auto;
    min-height: 0;
}

#screen-atlas.atlas-side .atlas-search {
    right: auto;
    width: calc(var(--atlas-side-w) - 78px);
}

#screen-atlas.atlas-side .atlas-status {
    left: calc(50% + var(--atlas-side-w) / 2);
    top: calc(env(safe-area-inset-top, 0px) + 18px);
}

/* Flèche de repli de la colonne : une languette sur son bord droit (au bord de l'écran une fois repliée). */
.atlas-panel-toggle {
    display: none;
    position: absolute;
    top: calc(env(safe-area-inset-top, 0px) + 84px);
    left: 380px;
    z-index: 55;
    width: 22px;
    height: 56px;
    padding: 0;
    border: 1px solid var(--border-soft);
    border-left: none;
    border-radius: 0 12px 12px 0;
    background: var(--surface);
    color: var(--text-dark);
    box-shadow: var(--card-shadow);
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
}

#screen-atlas.atlas-side .atlas-panel-toggle {
    display: block;
}

#screen-atlas.atlas-side.atlas-collapsed .atlas-panel-toggle {
    left: 0;
}

#screen-atlas.atlas-side.atlas-collapsed .atlas-bottom {
    transform: translateX(-100%);
    visibility: hidden;
}

#screen-atlas.atlas-side.atlas-collapsed .atlas-status {
    left: 50%;
}

#screen-atlas.atlas-side.atlas-collapsed .atlas-search {
    width: min(360px, calc(100% - 140px));
}

/* Le repli de la colonne glisse (0,25 s) : colonne, languette et pastille bougent d'un seul tenant ; la carte, elle,
   ne bouge pas (elle occupe tout l'écran sous la colonne) : la redimensionner à chaque image la faisait trembler.
   `visibility` ne bascule qu'à la fin du repli, pour que la colonne reste visible pendant qu'elle sort. */
#screen-atlas.atlas-side .atlas-bottom {
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), visibility 0s linear 0s;
}

#screen-atlas.atlas-side.atlas-collapsed .atlas-bottom {
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), visibility 0s linear 0.25s;
}

#screen-atlas.atlas-side .atlas-panel-toggle,
#screen-atlas.atlas-side .atlas-status {
    transition: left 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

@media (prefers-reduced-motion: reduce) {
    #screen-atlas.atlas-side .atlas-bottom,
    #screen-atlas.atlas-side.atlas-collapsed .atlas-bottom,
    #screen-atlas.atlas-side .atlas-panel-toggle,
    #screen-atlas.atlas-side .atlas-status {
        transition: none;
    }
}

/* --- ÉCRAN DES MODES : « Jouer » d'abord, puis des groupes --- */
.modes-play {
    width: 100%;
    max-width: 800px;
    padding: 0 16px;
    margin: 0 auto 22px;
}

.modes-play-btn {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 18px 22px;
    border: 0;
    border-radius: 16px;
    background: var(--primary-blue);
    color: #fff;
    text-align: left;
    cursor: pointer;
    box-shadow: var(--card-shadow);
    transition: transform 0.2s;
}

.modes-play-btn:hover {
    transform: translateY(-3px);
}

.modes-play-icon {
    flex: none;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #fff;
    color: var(--primary-blue);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    padding-left: 3px;
}

.modes-play-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.modes-play-text strong {
    font-size: 24px;
    line-height: 1.1;
}

.modes-play-text small {
    font-size: 14px;
}

.modes-group {
    width: 100%;
    max-width: 800px;
    padding: 0 16px;
    margin: 0 auto 8px;
}

.modes-group-title {
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-dark);
}

.modes-group-static {
    margin: 0 0 12px;
}

.modes-group-head {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 4px;
    margin-bottom: 8px;
    border: 0;
    border-bottom: 1px solid var(--border-soft);
    background: none;
    cursor: pointer;
}

.modes-group-chevron {
    font-size: 18px;
    color: var(--text-dark);
    transition: transform 0.2s;
}

.modes-group.collapsed .modes-group-chevron {
    transform: rotate(-90deg);
}

.modes-group.collapsed .modes-group-body {
    display: none;
}

/* Dans un groupe, les cartes sont plus basses : 7 défis ne doivent pas faire quatre écrans. */
.modes-group-body.grid-modes {
    gap: 12px;
    margin-bottom: 18px;
}

.modes-group-body.grid-modes .mode-card {
    min-height: 0;
    padding: 14px 16px;
}

.modes-group-body.grid-modes .mode-card h3 {
    font-size: 18px;
    margin-bottom: 4px;
}

.modes-group-body.grid-modes .mode-card p {
    font-size: 13px;
}

.modes-group-body.grid-modes {
    grid-auto-rows: auto;
}

.modes-group-frise .grid-modes-square {
    margin-bottom: 18px;
}

/* --- « Reprendre » sur l'écran des catégories --- */
.resume-card {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 14px;
    margin-top: 20px;
    padding: 14px 18px;
    border: 1px solid var(--border-soft);
    border-radius: 16px;
    background: var(--surface);
    color: var(--text-dark);
    text-align: left;
    cursor: pointer;
    box-shadow: var(--card-shadow);
}

.resume-card-icon {
    flex: none;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: var(--primary-blue);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    padding-left: 2px;
}

.resume-card-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.resume-card-kicker {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--muted-text);
}

.resume-card-title {
    font-size: 17px;
}

/* « La frise » : mêmes cases que les autres groupes (deux colonnes sur toute la largeur du groupe, même
   écart, même hauteur de carte) — et non plus quatre petits carrés centrés. */
.modes-group-frise .grid-modes-square {
    max-width: none;
    margin: 0 0 18px;
    gap: 12px;
}

.modes-group-frise .grid-modes-square .mode-card {
    aspect-ratio: auto;
    min-height: 0;
    padding: 14px 16px;
}

.modes-group-frise .grid-modes-square .mode-card h3 {
    font-size: 18px;
    margin-bottom: 4px;
}

.modes-group-frise .grid-modes-square .mode-card p {
    font-size: 13px;
}

/* Texte réservé aux lecteurs d'écran (zone d'annonces, voir A11y.announce) : hors écran mais lu. */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* --- EXPÉDITION --- */
.mode-card.expedition-card {
    background: linear-gradient(135deg, #6b4400, #9a6200);
}

#screen-expedition {
    align-items: center;
}

.expedition-track {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    width: 100%;
    max-width: 620px;
    margin: 6px auto 18px;
    padding: 0 16px;
}

.expedition-stage {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border: 1px solid var(--border-soft);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text-dark);
    font-size: 13px;
    font-weight: 600;
}

.expedition-stage.is-current {
    background: var(--primary-blue);
    border-color: var(--primary-blue);
    color: #fff;
}

.expedition-stage.is-done {
    color: var(--muted-text);
}

.expedition-stage-icon {
    min-width: 1.1em;
    text-align: center;
}

.expedition-status {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin-bottom: 18px;
}

.expedition-score {
    font-size: 16px;
    color: var(--text-dark);
}

.expedition-next,
.expedition-final {
    width: 100%;
    max-width: 520px;
    margin: 0 auto 40px;
    padding: 22px 20px;
    border-radius: 16px;
    background: var(--surface);
    border: 1px solid var(--border-soft);
    box-shadow: var(--card-shadow);
    text-align: center;
    color: var(--text-dark);
}

.expedition-next-kicker {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--muted-text);
}

.expedition-next-title {
    font-size: 24px;
    font-weight: 700;
    margin: 6px 0 8px;
}

.expedition-next-desc {
    font-size: 14px;
    color: var(--muted-text);
    margin-bottom: 18px;
}

.expedition-go {
    width: 100%;
}

.expedition-jokers {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 14px;
}

.expedition-earned {
    font-size: 14px;
    font-weight: 600;
    color: var(--success-text);
}

.expedition-final-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    margin-top: 16px;
}

/* Le geste principal : grand, central, juste sous la série de victoires. */
.expedition-final-actions .expedition-primary {
    min-width: 240px;
    padding: 16px 36px;
    font-size: 20px;
    box-shadow: 0 6px 16px rgba(0, 26, 75, 0.25);
}

/* La ligne des gestes principaux : « Niveau suivant » et, à sa droite, la « Leçon » (verte, à peine plus discrète). */
.expedition-primary-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 12px;
}

.expedition-primary-row .expedition-primary {
    min-width: 0;
    padding: 14px 24px;
    font-size: 18px;
}

.expedition-final-actions .expedition-lesson {
    padding: 14px 22px;
    background: var(--progress-green);
    border-color: var(--progress-green);
    color: #fff;
    box-shadow: 0 6px 16px rgba(30, 142, 62, 0.3);
}

/* Sur téléphone, les trois liens restent sur une seule ligne (jamais coupés en deux). */
@media (max-width: 480px) {
    .expedition-final-links { flex-wrap: nowrap; max-width: 100%; }
    .expedition-final-links .final-link { padding: 10px 7px; font-size: 13px; white-space: nowrap; }
}
@media (max-width: 380px) {
    .expedition-final-links .final-link { padding: 10px 4px; font-size: 12px; }
    .expedition-primary-row { gap: 8px; }
    .expedition-primary-row .expedition-primary { padding: 14px 16px; font-size: 16px; }
}
@media (max-width: 350px) {
    .expedition-final-links .final-link { padding: 10px 2px; font-size: 11.5px; }
}

/* Les autres : de simples liens, séparés par une barre verticale. */
.expedition-final-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
}

.final-link {
    position: relative;
    padding: 10px 14px;
    border: 0;
    background: none;
    color: var(--muted-text);
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.final-link:hover { color: var(--text-dark); text-decoration: underline; }

.final-link:not(.hidden) ~ .final-link:not(.hidden)::before {
    content: '';
    position: absolute;
    left: 0;
    top: 30%;
    height: 40%;
    border-left: 1px solid var(--border-soft);
}

/* --- MODE CLASSE --- */
.mode-card.class-card {
    background: linear-gradient(135deg, #0b4f6c, #1b7a99);
}

#screen-class {
    align-items: center;
}

.class-panel {
    width: 100%;
    max-width: 560px;
    margin: 0 auto 40px;
    padding: 0 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    color: var(--text-dark);
}

.class-help,
.class-label {
    font-size: 14px;
    color: var(--muted-text);
}

.class-label {
    font-weight: 600;
    color: var(--text-dark);
}

.class-primary {
    width: 100%;
}

.class-error {
    font-size: 14px;
    font-weight: 600;
    color: var(--danger-red-text);
}

.class-code-input {
    font-size: 24px;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    text-align: center;
}

.class-code-block {
    text-align: center;
    padding: 18px 12px;
    border-radius: 16px;
    background: var(--surface);
    border: 1px solid var(--border-soft);
    box-shadow: var(--card-shadow);
}

/* Profils « Concours » et « Religieux » : pas de Ligue sur l'accueil (elle reste dans « Profil et Trophées »). */
body[data-view-profile="concours"] .league-btn,
body[data-view-profile="religieux"] .league-btn {
    display: none;
}

.profile-shortcuts-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 20px;
}

.class-share {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

/* Fond blanc même en mode sombre : un QR code se scanne mieux en noir sur blanc. */
.class-qr {
    width: min(220px, 70vw);
    padding: 10px;
    border-radius: 12px;
    background: #fff;
    line-height: 0;
}

.class-qr svg {
    width: 100%;
    height: auto;
}

.class-link-row {
    display: flex;
    gap: 8px;
    width: 100%;
    max-width: 420px;
}

.class-link-row input {
    flex: 1;
    min-width: 0;
    font-size: 16px; /* sous 16 px, iOS zoome à la saisie */
}

/* Le bandeau de l'enseignant pendant la séance : collé en haut, le code se lit de loin et reste à portée de scan. */
.class-live-join {
    position: sticky;
    top: 0;
    z-index: 5;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 14px;
    border-radius: 16px;
    background: var(--surface);
    border: 1px solid var(--border-soft);
    box-shadow: var(--card-shadow);
}

.class-live-join .class-live-qr {
    flex: 0 0 auto;
    width: 84px;
    padding: 5px;
}

.class-live-join-text {
    flex: 1;
    min-width: 0;
    text-align: center;
}

.class-live-join .class-live-code {
    font-size: clamp(26px, 9vw, 44px);
}

.class-live-join.is-locked .class-live-qr {
    opacity: 0.25;
}

.class-live-join.is-locked .class-live-code {
    opacity: 0.35;
    text-decoration: line-through;
}

.class-live-lock {
    flex: 0 0 auto;
    max-width: 130px;
    font-size: 13px;
    line-height: 1.2;
}

@media (max-width: 420px) {
    .class-live-join { flex-wrap: wrap; justify-content: center; }
    .class-live-join .class-live-lock { max-width: none; width: 100%; }
}

.class-code-kicker {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--muted-text);
}

.class-code {
    font-size: clamp(34px, 12vw, 60px);
    font-weight: 800;
    letter-spacing: 0.16em;
    white-space: nowrap;
    padding-left: 0.16em; /* compense l'espace ajouté après la dernière lettre */
    color: var(--primary-blue);
    font-variant-numeric: tabular-nums;
}

:root[data-theme="dark"] .class-code {
    color: var(--text-dark);
}

.class-count,
.class-status {
    font-size: 15px;
    font-weight: 600;
}

.class-players {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.class-players li {
    padding: 6px 12px;
    border-radius: 999px;
    background: var(--surface);
    border: 1px solid var(--border-soft);
    font-size: 14px;
}

.class-board {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.class-row {
    display: grid;
    grid-template-columns: 2.6em 1fr 90px 3.6em;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 12px;
    background: var(--surface);
    border: 1px solid var(--border-soft);
}

.class-row.is-me {
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 1px var(--primary-blue);
}

.class-rank {
    font-weight: 700;
    color: var(--muted-text);
}

.class-name {
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

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

.class-progress {
    display: flex;
}

.class-progress-fill,
.class-progress-bad {
    display: block;
    height: 100%;
    flex: none;
    transition: width 0.4s;
}

.class-progress-fill { background: var(--progress-green); }

.class-progress-bad { background: var(--danger-red); }

/* La grande barre de toute la classe : vert depuis la gauche, rouge depuis la droite, le taux de réussite au centre. */
.class-meter {
    position: relative;
    display: flex;
    align-items: center;
    padding: 26px 0;
}

.class-meter-bar {
    position: relative;
    flex: 1;
    height: 26px;
    border-radius: 999px;
    background: var(--border-soft);
    overflow: hidden;
}

.class-meter-good,
.class-meter-bad {
    position: absolute;
    top: 0;
    bottom: 0;
    transition: width 0.6s;
}

.class-meter-good { left: 0; background: var(--progress-green); }

.class-meter-bad { right: 0; background: var(--danger-red); }

.class-meter-pct {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 74px;
    height: 74px;
    border-radius: 50%;
    background: var(--surface);
    border: 3px solid var(--border-soft);
    box-shadow: var(--card-shadow);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    line-height: 1.1;
}

.class-meter-pct b { font-size: 18px; }

.class-meter-pct small {
    font-size: 10px;
    color: var(--muted-text);
}

/* Le podium de fin de séance : les marches montent l'une après l'autre (3e, 2e, puis 1er). */
.class-podium {
    padding: 8px 0 0;
    text-align: center;
}

.class-podium-title {
    font-size: 20px;
    font-weight: 800;
    margin-bottom: 14px;
}

.class-podium-stage {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 6px;
    min-height: 230px;
}

.class-podium-place {
    flex: 1;
    max-width: 130px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    opacity: 0;
    animation: class-podium-in 0.4s ease-out forwards;
    animation-delay: var(--delay, 0s);
}

.class-podium-name {
    align-self: center;
    max-width: 100%;
    padding: 4px 10px;
    border-radius: 8px;
    background: var(--surface);
    border: 1px solid var(--border-soft);
    font-weight: 700;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.class-podium-step {
    height: 0;
    border-radius: 12px 12px 0 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding-top: 10px;
    color: #fff;
    font-weight: 800;
    overflow: hidden;
    animation: class-podium-rise 0.9s cubic-bezier(.2, .8, .2, 1) forwards;
    animation-delay: var(--delay, 0s);
}

.class-podium-medal { font-size: 30px; }

.class-podium-score { font-size: 14px; font-variant-numeric: tabular-nums; }

.class-podium-place.place-1 .class-podium-step { background: linear-gradient(#e6b422, #b8860b); --h: 150px; }
.class-podium-place.place-2 .class-podium-step { background: linear-gradient(#aab2bd, #7d8794); --h: 110px; }
.class-podium-place.place-3 .class-podium-step { background: linear-gradient(#cd7f32, #8c5a24); --h: 80px; }

@keyframes class-podium-in {
    to { opacity: 1; }
}

@keyframes class-podium-rise {
    to { height: var(--h); }
}

@media (prefers-reduced-motion: reduce) {
    .class-podium-place,
    .class-podium-step {
        animation-duration: 0.01s;
        animation-delay: 0s;
    }
}

.class-score {
    text-align: right;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.class-recap {
    padding: 16px;
    border-radius: 16px;
    background: var(--surface);
    border: 1px solid var(--border-soft);
}

.class-recap h3 {
    font-size: 16px;
    margin-bottom: 10px;
}

.class-recap ol {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.class-recap li {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.class-recap-title {
    font-weight: 600;
}

.class-recap-miss {
    font-size: 13px;
    color: var(--muted-text);
}

/* --- LE CHEMIN DU TEMPS (carte des niveaux : js/app/path.js) --- */
.resume-card.path-card .resume-card-icon {
    background: linear-gradient(135deg, #6b4400, #9a6200);
    padding-left: 0;
    font-size: 20px;
}

#screen-path {
    align-items: center;
}

.path-map {
    width: 100%;
    max-width: 420px;
    /* De la place sous le dernier niveau pour que la fiche, posée en bas, ne le cache jamais. */
    padding: 0 8px 240px;
    box-sizing: border-box;
}

.path-world-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border: 1px solid var(--border-soft);
    border-radius: 14px;
    background: var(--surface);
    color: var(--text-dark);
    box-shadow: var(--card-shadow);
}

.path-world-icon {
    font-size: 22px;
}

.path-world-title {
    flex: 1;
    margin: 0;
    font-size: 17px;
}

.path-world-stars {
    font-size: 14px;
    font-weight: 700;
    color: var(--muted-text);
}

.path-track {
    position: relative;
    width: 100%;
    /* Le paysage du monde (js/app/path.js : pathBuildScenery) : un pré, une route, des décors, un monument. */
    margin-top: 10px;
    border-radius: 22px;
    overflow: hidden;
    background:
        radial-gradient(ellipse 38% 9% at 18% 22%, rgba(255, 255, 255, 0.22), transparent),
        radial-gradient(ellipse 34% 8% at 82% 48%, rgba(255, 255, 255, 0.18), transparent),
        radial-gradient(ellipse 40% 9% at 22% 78%, rgba(0, 0, 0, 0.07), transparent),
        radial-gradient(ellipse 30% 8% at 80% 90%, rgba(255, 255, 255, 0.2), transparent),
        linear-gradient(180deg, var(--sc-ground-a, #c9e8a6), var(--sc-ground-b, #9fd47c));
    box-shadow: inset 0 0 0 3px rgba(0, 0, 0, 0.07), var(--card-shadow);
}

.path-scenery {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.path-scenery .sc {
    position: absolute;
    transform: translate(-50%, -100%);
    overflow: visible;
    filter: drop-shadow(0 3px 2px rgba(0, 0, 0, 0.18));
}

.path-scenery .sc.flip { transform: translate(-50%, -100%) scaleX(-1); }
.path-scenery .sc-landmark { filter: drop-shadow(0 6px 4px rgba(0, 0, 0, 0.25)); }
.path-world.is-complete .sc-landmark { filter: drop-shadow(0 0 10px rgba(255, 213, 79, 0.95)) drop-shadow(0 6px 4px rgba(0, 0, 0, 0.25)); }
/* Un monde pas encore atteint : son paysage attend, en grisaille. */
.path-world.is-locked .path-track { filter: grayscale(0.85) brightness(0.92); }

.path-road-edge { stroke: rgba(120, 84, 40, 0.45); stroke-width: 34px; }
.path-road { stroke: var(--sc-road, #f0d9a0); stroke-width: 28px; }

.path-lines {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    overflow: visible;
    pointer-events: none;
}

.path-lines path {
    fill: none;
    stroke-linecap: round;
}

.path-line-todo {
    stroke: var(--border-soft);
    stroke-width: 5;
    stroke-dasharray: 2 11;
}

.path-line-done {
    stroke: var(--progress-green);
    stroke-width: 7;
}

.path-node {
    /* Le bouton a la taille de sa pastille (centrée sur le point du chemin par ses marges) : une vraie zone
       à toucher, un vrai anneau de focus. */
    position: absolute;
    width: 56px;
    height: 56px;
    margin: -28px 0 0 -28px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: none;
    cursor: pointer;
    font: inherit;
    color: var(--text-dark);
}

.path-node.is-boss {
    width: 76px;
    height: 76px;
    margin: -38px 0 0 -38px;
}

.path-node-disc {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 21px;
    font-weight: 800;
    color: #fff;
    background: var(--primary-blue);
    border: 4px solid var(--surface);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.25);
    box-sizing: border-box;
    transition: transform 0.15s;
}

.path-node:active .path-node-disc,
.path-node.is-selected .path-node-disc {
    transform: scale(1.1);
}

.path-node.is-done .path-node-disc {
    background: var(--progress-green);
}

.path-node.is-locked .path-node-disc {
    background: var(--locked-bg, #b8bfc9);
    font-size: 18px;
    box-shadow: none;
}

.path-node.is-boss .path-node-disc {
    font-size: 32px;
    background: linear-gradient(135deg, #6b4400, #b8892e);
}

.path-node.is-boss.is-locked .path-node-disc {
    background: var(--locked-bg, #b8bfc9);
}

/* Le prochain niveau à jouer respire : c'est là qu'on regarde. */
.path-node.is-next .path-node-disc {
    box-shadow: 0 0 0 0 rgba(30, 142, 62, 0.55);
    animation: path-pulse 1.8s ease-out infinite;
}

@keyframes path-pulse {
    to { box-shadow: 0 0 0 16px rgba(30, 142, 62, 0); }
}

@media (prefers-reduced-motion: reduce) {
    .path-node.is-next .path-node-disc { animation: none; box-shadow: 0 0 0 5px rgba(30, 142, 62, 0.4); }
    .path-node-disc { transition: none; }
}

.path-node-stars {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-top: 2px;
    font-size: 13px;
    letter-spacing: 1px;
    line-height: 1.2;
    color: var(--favorite-yellow);
    white-space: nowrap;
    /* Les étoiles passent parfois sur le trait du chemin : un liseré de la couleur du fond les détache. */
    text-shadow: 0 0 3px var(--bg-color), 0 0 3px var(--bg-color), 0 0 3px var(--bg-color);
}

.path-node-label {
    padding: 2px 7px;
    border-radius: 9px;
    background: color-mix(in srgb, var(--surface) 82%, transparent);
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 128px;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.25;
    color: var(--text-dark);
}

.path-node-label.to-right { left: 100%; margin-left: 12px; text-align: left; }
.path-node-label.to-left { right: 100%; margin-right: 12px; text-align: right; }
.path-node.is-locked .path-node-label { color: var(--muted-text); font-weight: 600; }

.path-soon {
    margin: 22px 0 0;
    text-align: center;
    font-size: 14px;
    color: var(--muted-text);
}

.path-sheet {
    position: fixed;
    left: 50%;
    bottom: 0;
    transform: translateX(-50%);
    z-index: 70;
    width: 100%;
    max-width: 520px;
    box-sizing: border-box;
    padding: 20px 20px calc(env(safe-area-inset-bottom, 0px) + 20px);
    border-radius: 20px 20px 0 0;
    background: var(--surface);
    color: var(--text-dark);
    border: 1px solid var(--border-soft);
    box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.25);
    text-align: center;
}

.path-sheet-close {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 50%;
    background: none;
    color: var(--muted-text);
    font-size: 18px;
    cursor: pointer;
}

.path-sheet-title {
    margin: 0 36px 4px;
    font-size: 19px;
}

.path-sheet-range,
.path-sheet-stages,
.path-sheet-best,
.path-sheet-lock {
    margin: 4px 0;
    font-size: 14px;
    color: var(--muted-text);
}

.path-sheet-best {
    color: var(--text-dark);
    font-weight: 700;
}

.path-sheet-lock {
    color: var(--danger-red-text);
    font-weight: 600;
}

.path-sheet-play {
    margin-top: 14px;
    min-width: 200px;
}

.expedition-final-extra {
    margin: 6px 0 0;
}

.path-final-stars {
    font-size: 40px;
    letter-spacing: 6px;
    color: var(--favorite-yellow);
}

/* Chemin du Temps : plusieurs mondes empilés, verrou et passage d'un monde. */
.path-world + .path-world {
    margin-top: 8px;
}

.path-world.is-locked .path-world-head {
    opacity: 0.75;
}

.path-world-note {
    margin: 8px 4px 0;
    text-align: center;
    font-size: 13px;
    color: var(--muted-text);
}

.path-world-skip {
    display: block;
    margin: 10px auto 0;
    padding: 8px 14px;
    border: 1px dashed var(--border-soft);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text-dark);
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

/* --- ÉPREUVE « LEÇON » (js/app/lesson.js) : l'écran du Quiz, plus l'explication après chaque réponse --- */
.lesson-option:disabled {
    cursor: default;
    opacity: 1;
}

.lesson-feedback {
    margin: 14px auto 0;
    max-width: 560px;
    padding: 16px 18px;
    border-radius: 16px;
    border: 1px solid var(--border-soft);
    border-left: 5px solid var(--progress-green);
    background: var(--surface);
    color: var(--text-dark);
    box-shadow: var(--card-shadow);
}

.lesson-feedback.is-wrong {
    border-left-color: var(--danger-red);
}

.lesson-feedback strong {
    display: block;
    font-size: 16px;
    margin-bottom: 6px;
}

.lesson-feedback.is-wrong strong {
    color: var(--danger-red-text);
}

.lesson-feedback:not(.is-wrong) strong {
    color: var(--success-text);
}

.lesson-feedback p {
    margin: 0 0 12px;
    font-size: 15px;
    line-height: 1.45;
}

/* Chemin du Temps : mondes repliés (fermés), îles bonus, île ouverte à la fin d'un niveau. */
.path-world.is-collapsed .path-world-head {
    opacity: 0.6;
}

.path-world.is-collapsed .path-world-note {
    margin-bottom: 6px;
}

.path-island-card {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    margin-top: 10px;
    padding: 10px 14px;
    border: 1px dashed var(--border-soft);
    border-radius: 14px;
    background: var(--surface);
    color: var(--text-dark);
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.path-island-card:not(.is-locked) {
    border-style: solid;
    border-color: var(--progress-green);
}

.path-island-card.is-locked {
    opacity: 0.8;
}

.path-island-icon {
    font-size: 24px;
}

.path-island-text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.path-island-text small {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--muted-text);
}

.path-island-text strong {
    font-size: 15px;
}

.path-island-stars {
    font-size: 13px;
    font-weight: 700;
    color: var(--muted-text);
    white-space: nowrap;
}

.path-final-island {
    margin: 6px 0 0;
    font-weight: 700;
    color: var(--success-text);
}

/* --- RÉCOMPENSES : pièces, série, boutique de Clio, album, révélation d'une carte (js/app/rewards.js) --- */
.rewards-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    width: 100%;
    margin-top: 20px;
}

.rewards-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    border: 1px solid var(--border-soft);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text-dark);
    font-size: 15px;
    font-weight: 700;
}

.rewards-chip {
    position: relative;
    cursor: help;
}

/* Bulle d'explication (js/app/rewards.js : rewardsAttachTip). */
.rewards-tip {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    z-index: 60;
    width: 260px;
    max-width: min(260px, calc(100vw - 40px));
    padding: 10px 12px;
    border-radius: 12px;
    background: var(--text-dark);
    color: var(--surface);
    font-size: 13px;
    font-weight: 500;
    line-height: 1.4;
    text-align: left;
    box-shadow: var(--card-shadow-hover);
    pointer-events: none;
}

.rewards-chip.is-tip-open .rewards-tip,
.rewards-chip:focus-visible .rewards-tip {
    display: block;
}

@media (hover: hover) {
    .rewards-chip:hover .rewards-tip {
        display: block;
    }
}

.rewards-streak.is-hot {
    border-color: var(--favorite-yellow);
}

.rewards-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    border: 1px solid var(--border-soft);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text-dark);
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.rewards-btn small {
    color: var(--muted-text);
    font-weight: 700;
}

.rewards-bar .rewards-shop-btn { margin-left: auto; }

/* Accueil (Tout public, Scolaire) : une seule ligne de quatre tuiles égales sous les boutons ronds — Boutique (avec les pièces
   dessous), Album, Amis, Équipe —, sur téléphone comme sur grand écran. Pas de pastilles pièces ni série ici : la série est sur
   la carte du Chemin (.path-card-streak). */
.rewards-bar.is-compact {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    align-items: stretch;
    gap: 8px;
    margin-top: 22px;
}

.rewards-bar.is-compact .rewards-shop-btn { margin-left: 0; }

.rewards-bar.is-compact .rewards-btn {
    min-width: 0;
    flex-direction: column;
    justify-content: center;
    gap: 2px;
    padding: 8px 2px;
    border-radius: 16px;
    font-size: 13px;
    text-align: center;
}

.rewards-bar.is-compact .rewards-btn > span[aria-hidden],
.rewards-bar.is-compact .rewards-team-badge {
    font-size: 20px;
    line-height: 1.1;
}

.rewards-bar.is-compact .rewards-btn small {
    display: block;
    font-size: 11px;
    line-height: 1;
}

.rewards-bar.is-compact .rewards-btn small:empty { display: none; }

.rewards-bar.is-compact .rewards-coins {
    color: var(--text-dark);
}

/* La série de victoires sur la carte du Chemin (accueil) : « ⚡︎ 3 », dorée dès deux niveaux d'affilée. */
.path-card-streak {
    font-weight: 800;
    white-space: nowrap;
}

.path-card-streak.is-hot {
    color: #d97706;
}

/* Téléphone : pièces et série se partagent la première ligne, puis quatre tuiles égales (icône au-dessus du libellé). */
@media (max-width: 600px) {
    .rewards-bar {
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        align-items: stretch;
        gap: 8px;
    }

    .rewards-bar .rewards-chip {
        grid-column: span 2;
        justify-content: center;
    }

    .rewards-bar .rewards-streak .rewards-tip {
        left: auto;
        right: 0;
    }

    .rewards-bar .rewards-btn {
        flex-direction: column;
        justify-content: center;
        gap: 2px;
        padding: 8px 2px;
        border-radius: 16px;
        font-size: 13px;
        text-align: center;
    }

    .rewards-bar .rewards-btn > span[aria-hidden],
    .rewards-bar .rewards-team-badge {
        font-size: 20px;
        line-height: 1.1;
    }

    .rewards-bar .rewards-btn small {
        display: block;
        font-size: 11px;
        line-height: 1;
    }

    .rewards-bar .rewards-btn small:empty { display: none; }

    .rewards-bar .rewards-team-badge {
        width: 22px;
        height: 24px;
    }

    /* Le compteur de demandes d'ami reste une petite pastille, pas une barre pleine largeur. */
    .rewards-bar .rewards-friends-btn small:not(:empty) {
        display: inline-block;
        align-self: center;
        padding: 1px 6px;
    }

    .rewards-bar .rewards-shop-btn { margin-left: 0; }
}

.path-rewards {
    width: 100%;
    max-width: 420px;
    margin-bottom: 4px;
}

.path-rewards .rewards-bar { margin-top: 0; }

/* Les pièces qui s'envolent et les étoiles qui jaillissent. */
.rewards-particle {
    position: fixed;
    z-index: 200;
    pointer-events: none;
    font-size: 22px;
    transform: translate(0, 0) scale(1);
    opacity: 1;
    transition: transform 0.8s cubic-bezier(0.3, 0.8, 0.4, 1), opacity 0.8s ease-in;
}

.path-final-stars .path-star {
    display: inline-block;
}

.path-final-stars .path-star.is-earned {
    animation: path-star-fly 0.7s cubic-bezier(0.2, 1.4, 0.4, 1) both;
    animation-delay: calc(var(--i) * 0.25s + 0.15s);
}

@keyframes path-star-fly {
    0% { transform: translateY(70px) scale(0.2) rotate(-200deg); opacity: 0; }
    70% { transform: translateY(-8px) scale(1.5) rotate(10deg); opacity: 1; }
    100% { transform: translateY(0) scale(1) rotate(0); opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
    .path-final-stars .path-star.is-earned { animation: none; }
    .rewards-particle { display: none; }
}

.rewards-summary {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dashed var(--border-soft);
}

.rewards-final-head {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
}

.rewards-final-gain {
    font-size: 26px;
    font-weight: 800;
    color: var(--text-dark);
}

.rewards-parts {
    list-style: none;
    margin: 8px 0 0;
    padding: 0;
    font-size: 14px;
    color: var(--muted-text);
}

.rewards-cap {
    margin: 6px 0 0;
    font-size: 13px;
    color: var(--muted-text);
}

.rewards-streak-line {
    margin: 8px 0 0;
    font-size: 15px;
    font-weight: 700;
    color: var(--text-dark);
}

.rewards-streak-line.is-hot {
    color: var(--success-text);
}

.rewards-card-chips {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 10px;
}

.rewards-card-chip {
    width: 44px;
    height: 58px;
    border-radius: 8px;
    border: 3px solid #b0b7c3;
    background: var(--surface);
    font-size: 22px;
    cursor: pointer;
}

.rewards-card-chip.rarity-rare { border-color: #2980b9; }
.rewards-card-chip.rarity-legendaire { border-color: var(--favorite-yellow); }

.end-coins {
    margin-top: 8px;
    font-size: 18px;
    font-weight: 700;
    color: var(--text-dark);
}

.end-coins.is-capped {
    font-size: 13px;
    font-weight: 500;
    color: var(--muted-text);
    max-width: 320px;
    text-align: center;
}

/* La révélation d'une carte : elle se retourne. */
.card-reveal-content {
    text-align: center;
    max-width: 340px;
}

.card-reveal-kicker {
    font-size: 20px;
    font-weight: 800;
    margin-bottom: 12px;
    color: var(--text-dark);
}

.card-flip {
    perspective: 900px;
    width: 190px;
    height: 270px;
    margin: 0 auto;
}

.card-flip-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.7s;
    transform-style: preserve-3d;
}

.card-flip.is-flipped .card-flip-inner { transform: rotateY(180deg); }

@media (prefers-reduced-motion: reduce) {
    .card-flip-inner { transition: none; }
}

.card-face {
    position: absolute;
    inset: 0;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    border-radius: 14px;
    border: 5px solid #b0b7c3;
    background: var(--surface);
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px;
    color: var(--text-dark);
}

.card-back {
    font-size: 64px;
    background: linear-gradient(135deg, #6b4400, #b8892e);
    border-color: #6b4400;
}

.card-front {
    transform: rotateY(180deg);
}

.card-face.rarity-rare, .album-card.rarity-rare { border-color: #2980b9; }
.card-face.rarity-legendaire, .album-card.rarity-legendaire { border-color: var(--favorite-yellow); }

.card-portrait {
    width: 120px;
    height: 150px;
    border-radius: 8px;
    overflow: hidden;
    background: var(--bg-color);
    display: flex;
    align-items: center;
    justify-content: center;
}

.card-portrait img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.card-name {
    font-size: 14px;
    font-weight: 800;
    line-height: 1.2;
    text-align: center;
}

.card-date, .card-rarity {
    font-size: 12px;
    color: var(--muted-text);
}

.card-reveal-note {
    margin: 12px 0 0;
    font-size: 14px;
    color: var(--muted-text);
}

.card-reveal-clio:empty { display: none; }
.card-reveal-clio .clio-react { margin: 8px 0 0; }

.card-reveal-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-top: 14px;
}

/* L'album : un monde par section, une grille de cartes. */
.album-list {
    width: 100%;
    max-width: 640px;
    padding-bottom: 60px;
}

.album-world-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 18px 0 8px;
    font-size: 17px;
    color: var(--text-dark);
}

.album-world-title { flex: 1; }
.album-world-count { font-size: 14px; color: var(--muted-text); }
.album-world.is-locked { opacity: 0.6; }

.album-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
    gap: 10px;
}

.album-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px 6px;
    border: 3px solid #b0b7c3;
    border-radius: 12px;
    background: var(--surface);
    color: var(--text-dark);
    font: inherit;
    cursor: pointer;
}

.album-card.is-missing {
    cursor: default;
    opacity: 0.55;
}

.album-card .card-portrait {
    width: 84px;
    height: 104px;
}

.card-unknown {
    font-size: 34px;
    font-weight: 800;
    color: var(--muted-text);
}

/* La boutique de Clio. */
.shop-top {
    display: flex;
    justify-content: center;
    margin-bottom: 10px;
}

.shop-clio {
    text-align: center;
    margin-bottom: 12px;
}

.shop-clio-avatar {
    display: inline-block;
}

.shop-clio p {
    margin: 6px 0 0;
    font-size: 14px;
    color: var(--text-dark);
}


.shop-list {
    list-style: none;
    margin: 0;
    padding: 0 0 12px;
    width: 100%;
    max-width: 520px;
}

.shop-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    margin-bottom: 8px;
    border: 1px solid var(--border-soft);
    border-radius: 14px;
    background: var(--surface);
    color: var(--text-dark);
}

.shop-item.is-locked { opacity: 0.6; }
.shop-section { margin: 14px 4px 8px; font-size: 13px; font-weight: 800; color: var(--muted-text); text-transform: uppercase; letter-spacing: 0.04em; }
.shop-item-emoji { font-size: 30px; width: 40px; text-align: center; }
.shop-item-emoji.is-drawn { height: 64px; width: 56px; }
.shop-item-view { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0; border: 0; background: none; cursor: zoom-in; }
.shop-item.is-locked .shop-item-emoji.is-drawn svg { filter: grayscale(1); opacity: 0.45; }
.shop-zoom { position: fixed; inset: 0; z-index: 1100; display: grid; place-items: center; padding: max(16px, env(safe-area-inset-top, 0px)) 16px max(16px, env(safe-area-inset-bottom, 0px)); background: rgba(10, 16, 28, 0.6); }
.shop-zoom-card { width: min(360px, 100%); display: grid; justify-items: center; gap: 12px; padding: 18px; border-radius: 20px; background: var(--surface); color: var(--text-dark); box-shadow: var(--card-shadow); }
.shop-zoom-art { width: min(260px, 70vw); }
.shop-zoom-art svg { display: block; width: 100%; height: auto; overflow: visible; }
.shop-zoom-card.is-locked .shop-zoom-art svg { filter: grayscale(1); opacity: 0.5; }
.shop-zoom-name { margin: 0; font-size: 18px; font-weight: 800; text-align: center; text-wrap: balance; }
.shop-zoom-close { width: 100%; }
.shop-item-emoji.is-drawn svg { display: block; width: 100%; height: 100%; overflow: visible; }
.shop-item-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.shop-item-text strong { font-size: 15px; }
.shop-item-text small { font-size: 12px; color: var(--muted-text); }
.shop-item-btn { padding: 8px 14px; font-size: 14px; min-width: 84px; }
.shop-item-btn:disabled { opacity: 0.5; cursor: default; }
.shop-item-btn.is-short { background: var(--locked-bg, #b8bfc9); }

.shop-decors {
    margin: 4px 0 60px;
    font-size: 13px;
    color: var(--muted-text);
    text-align: center;
}

/* Compte (js/auth.js) : les liens de la fenêtre de connexion et des réglages restent visibles comme liens. */
#modal-account a,
#settings-account a {
    color: inherit;
    text-decoration: underline;
}

/* --- Équipe de classe (js/app/team.js) --- */
.team-chest { text-align: center; padding: 14px 12px; border-radius: 16px; background: var(--surface, rgba(255,255,255,.06)); border: 1px solid var(--border, rgba(255,255,255,.12)); margin-bottom: 12px; }
.team-chest-icon { font-size: 44px; line-height: 1; }
.team-chest-track { height: 14px; border-radius: 7px; background: rgba(127,127,127,.25); overflow: hidden; margin: 10px 0 6px; }
.team-chest-bar { height: 100%; width: 0; border-radius: 7px; background: linear-gradient(90deg, #f6b73c, #ffd96b); transition: width .6s ease; }
.team-chest-text { font-weight: 700; margin: 4px 0; }
.team-chest-next, .team-chest-count, .team-me { font-size: 14px; opacity: .85; margin: 4px 0; }
.team-me { padding: 0 6px; }
.team-claimed { text-align: center; font-weight: 700; color: #3f9d5b; margin: 6px 0; }
.team-members { list-style: none; margin: 8px 0 14px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.team-member { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 12px; background: var(--surface, rgba(255,255,255,.06)); }
.team-member.is-me { outline: 2px solid #f6b73c; }
.team-member-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.team-kick { min-width: 36px; min-height: 36px; border: 0; border-radius: 50%; background: rgba(200,60,60,.18); color: inherit; font-size: 20px; cursor: pointer; }
.team-teacher { text-align: center; margin: 10px 0; }
.team-create { margin-top: 22px; padding-top: 14px; border-top: 1px solid rgba(127,127,127,.3); }
/* Les formulaires de l'écran Équipe empilent leurs champs et leur bouton avec le même écart que les autres
   panneaux de classe (.class-panel) : sans cela, le bouton restait collé au champ du dessus. */
#team-join-form,
#team-create-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

#team-create-form {
    margin-top: 26px;
    padding-top: 22px;
}

/* Trois blocs, dans l'ordre : séance en direct, rejoindre une équipe, créer une équipe. Un filet sépare chacun du
   précédent, à la largeur des champs. */
#team-join-form {
    margin-top: 26px;
    padding-top: 22px;
    border-top: 1px solid rgba(127,127,127,.3);
}

#team-panel-view {
    margin-top: 26px;
}
.team-secondary { display: block; margin: 8px auto; background: transparent; border: 1px solid rgba(127,127,127,.5); color: inherit; }
.class-subhead { font-size: 16px; margin: 8px 0 0; }

.class-modes { list-style: none; display: flex; flex-direction: column; gap: 8px; }

.class-mode-row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 12px;
    background: var(--surface);
    border: 1px solid var(--border-soft);
}

.class-mode-row input { width: 20px; height: 20px; margin-top: 2px; flex: none; cursor: pointer; accent-color: var(--primary-blue); }

.class-mode-text { display: flex; flex-direction: column; gap: 2px; }

.class-mode-text b { font-size: 15px; }

.class-mode-text small { font-size: 13px; line-height: 1.35; color: var(--muted-text); }

.class-check { display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 600; }

.class-check input { width: 18px; height: 18px; cursor: pointer; accent-color: var(--primary-blue); }

/* En séance de classe, le fil du temps se joue sans indice : le bouton garde sa place (le pavé ne bouge pas). */
#screen-fil.is-class .fil-hint-btn,
#screen-quiz.is-class #quiz-fifty-btn { visibility: hidden; }

.class-team-link { display: flex; align-items: center; gap: 8px; margin: 10px 0; font-size: 14px; }
.rewards-team-btn small:empty,
.rewards-friends-btn small:empty { display: none; }
@media (prefers-reduced-motion: reduce) { .team-chest-bar { transition: none; } }

/* --- Clio, la mascotte (js/app/clio.js, dessin : js/clioArt.js) --- */
.clio { position: relative; display: inline-block; flex: none; line-height: 1; transform-origin: 50% 90%; }
.clio-small { width: 40px; height: 46px; }
.clio-medium { width: 64px; height: 74px; }
.clio-large { width: 132px; height: 152px; }
.clio > svg { display: block; width: 100%; height: 100%; overflow: visible; filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.18)); }
/* Costume pas encore dessiné : un aperçu en emoji, posé contre Clio. */
.clio-costume { position: absolute; right: -10%; bottom: 0; font-size: 0.42em; }
.clio-small .clio-costume { font-size: 18px; }
.clio-medium .clio-costume { font-size: 26px; }
.clio-large .clio-costume { font-size: 44px; }

/* Le personnage entier (une fois, à l'apparition) */
.clio.is-content { animation: clio-hop 1.4s ease-in-out 2; }
.clio.is-ravi { animation: clio-jump 0.8s ease-in-out 3; }
.clio.is-walking { animation: clio-walk 0.35s ease-in-out infinite; }
@keyframes clio-hop { 0%, 100% { transform: translateY(0); } 40% { transform: translateY(-6px); } }
@keyframes clio-jump { 0%, 100% { transform: translateY(0) scale(1); } 45% { transform: translateY(-14px) scale(1.08); } }
@keyframes clio-walk { 0%, 100% { transform: translateY(0) rotate(-4deg); } 50% { transform: translateY(-5px) rotate(4deg); } }

/* Les parties du dessin (en continu) : queue, respiration, clignement, patte qui salue, oreilles tristes */
.clio-art .ca-tail { transform-box: view-box; transform-origin: 136px 204px; animation: ca-tail 2.6s ease-in-out infinite; }
.clio-art .ca-breath { transform-box: view-box; transform-origin: 100px 218px; animation: ca-breath 3.4s ease-in-out infinite; }
.clio-art .ca-blink { transform-box: fill-box; transform-origin: center; animation: ca-blink 5.2s infinite; }
.clio-art .ca-wave { transform-box: view-box; transform-origin: 136px 162px; animation: ca-wave 0.9s ease-in-out infinite alternate; }
.clio-art .ca-zz { animation: ca-float 2.4s ease-in-out infinite; }
.clio-art .ca-earL, .clio-art .ca-earR, .clio-art .ca-head { transform-box: view-box; }
.clio-art .ca-earL { transform-origin: 74px 66px; }
.clio-art .ca-earR { transform-origin: 126px 66px; }
.clio-art .ca-head { transform-origin: 100px 140px; }
.clio-art.ca-m-triste .ca-earL { transform: rotate(-24deg); }
.clio-art.ca-m-triste .ca-earR { transform: rotate(24deg); }
.clio-art.ca-m-dort .ca-head { transform: rotate(7deg); }
.clio-art.ca-m-fier .ca-head { transform: rotate(-5deg); }
@keyframes ca-tail { 0%, 100% { transform: rotate(-7deg); } 50% { transform: rotate(11deg); } }
@keyframes ca-breath { 0%, 100% { transform: scaleY(1); } 50% { transform: scaleY(1.018); } }
@keyframes ca-blink { 0%, 93%, 100% { transform: scaleY(1); } 95.5% { transform: scaleY(0.08); } }
@keyframes ca-wave { from { transform: rotate(-10deg); } to { transform: rotate(12deg); } }
@keyframes ca-float { 0%, 100% { transform: translateY(0); opacity: 0.9; } 50% { transform: translateY(-5px); opacity: 0.5; } }

/* Les poses : danse (album complété), essayage (boutique), marche de profil (le Chemin) */
.clio-art.ca-m-danse .ca-whole { transform-box: view-box; transform-origin: 100px 218px; animation: ca-sway 0.8s ease-in-out infinite alternate; }
.clio-art .ca-danceL { transform-box: view-box; transform-origin: 64px 162px; animation: ca-beat-l 0.4s ease-in-out infinite alternate; }
.clio-art .ca-danceR { transform-box: view-box; transform-origin: 136px 162px; animation: ca-beat-r 0.4s ease-in-out infinite alternate-reverse; }
.clio.is-essaie { animation: clio-spin 1.2s ease-in-out 1; }
.clio-walk { width: 58px; height: 46px; }
.clio.clio-walk.is-walking { animation: none; }
.clio-walk.is-left > svg { transform: scaleX(-1); }
.clio-walk-art .ca-walk-body { animation: ca-walk-bob 0.35s ease-in-out infinite alternate; }
.clio-walk-art .ca-tail-walk { transform-box: view-box; transform-origin: 58px 112px; animation: ca-tail 1.4s ease-in-out infinite; }
.clio-walk-art .ca-leg-nf, .clio-walk-art .ca-leg-fb, .clio-walk-art .ca-leg-nb, .clio-walk-art .ca-leg-ff { transform-box: view-box; animation: ca-step 0.35s ease-in-out infinite alternate; }
.clio-walk-art .ca-leg-nb, .clio-walk-art .ca-leg-ff { animation-direction: alternate-reverse; }
.clio-walk-art .ca-leg-nf { transform-origin: 150px 134px; }
.clio-walk-art .ca-leg-nb { transform-origin: 82px 134px; }
.clio-walk-art .ca-leg-ff { transform-origin: 140px 134px; }
.clio-walk-art .ca-leg-fb { transform-origin: 72px 134px; }
@keyframes ca-sway { from { transform: rotate(-6deg); } to { transform: rotate(6deg) translateY(-4px); } }
@keyframes ca-beat-l { from { transform: rotate(10deg); } to { transform: rotate(-12deg); } }
@keyframes ca-beat-r { from { transform: rotate(-12deg); } to { transform: rotate(10deg); } }
@keyframes clio-spin { 0%, 100% { transform: scaleX(1) translateY(0); } 25% { transform: scaleX(0.1) translateY(-8px); } 50% { transform: scaleX(-1) translateY(-12px); } 75% { transform: scaleX(-0.1) translateY(-8px); } }
@keyframes ca-walk-bob { from { transform: translateY(0); } to { transform: translateY(-3px); } }
@keyframes ca-step { from { transform: rotate(-22deg); } to { transform: rotate(22deg); } }

@media (prefers-reduced-motion: reduce) {
    .clio, .clio-art .ca-tail, .clio-art .ca-breath, .clio-art .ca-blink, .clio-art .ca-wave, .clio-art .ca-zz,
    .clio-art.ca-m-danse .ca-whole, .clio-art .ca-danceL, .clio-art .ca-danceR, .clio.is-essaie,
    .clio-walk-art .ca-walk-body, .clio-walk-art .ca-tail-walk, .clio-walk-art .ca-leg-nf, .clio-walk-art .ca-leg-fb,
    .clio-walk-art .ca-leg-nb, .clio-walk-art .ca-leg-ff { animation: none !important; }
}

.clio-react {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 12px 0;
    padding: 10px 14px;
    border: 1px solid var(--border-soft);
    border-radius: 16px;
    background: var(--surface);
    color: var(--text-dark);
    box-shadow: var(--card-shadow);
}
.clio-bubble { flex: 1; margin: 0; font-size: 14px; font-weight: 700; line-height: 1.35; text-align: left; }
.clio-close { position: absolute; top: 2px; right: 6px; min-width: 32px; min-height: 32px; border: 0; background: none; color: var(--muted-text); font-size: 20px; cursor: pointer; }
.clio-home { margin: 8px 0 4px; }
/* La présentation de Clio, à la première visite du Chemin : une carte en bas de l'écran, bulle par bulle. */
.clio-intro {
    position: fixed;
    left: max(16px, env(safe-area-inset-left, 0px));
    right: max(16px, env(safe-area-inset-right, 0px));
    bottom: max(16px, env(safe-area-inset-bottom, 0px));
    z-index: 1000;
    max-width: 460px;
    margin: 0 auto;
    display: grid;
    gap: 10px;
    padding: 10px 18px 16px;
    border-radius: 20px;
    background: var(--surface);
    color: var(--text-dark);
    box-shadow: var(--card-shadow);
    border: 1px solid var(--border-soft);
}
.clio-intro-head { display: flex; justify-content: flex-end; }
.clio-intro-skip { min-height: 32px; border: 0; background: none; color: var(--muted-text); font-size: 14px; cursor: pointer; }
.clio-intro-body { display: flex; justify-content: center; }
.clio-intro-bubble { margin: 0; font-size: 17px; font-weight: 700; line-height: 1.4; text-align: left; min-height: 4.2em; }
.clio-intro-count { justify-self: start; font-size: 12px; color: var(--muted-text); font-variant-numeric: tabular-nums; }
.clio-intro-next { width: 100%; }
@media (max-height: 560px) { .clio-intro .clio-large { width: 96px; height: 110px; } }
.clio-costume-hint { flex-wrap: wrap; }
.clio-shop-btn { flex-basis: 100%; margin-top: 4px; }

.clio-marker {
    position: absolute;
    z-index: 3;
    width: 44px;
    height: 48px;
    padding: 0;
    border: 0;
    background: none;
    cursor: pointer;
}
.clio-marker.on-left { margin: -34px 0 0 -88px; }
.clio-marker.on-right { margin: -34px 0 0 44px; }
.clio-marker-bubble {
    position: absolute;
    bottom: 100%;
    width: 150px;
    padding: 6px 10px;
    border-radius: 12px;
    background: var(--surface);
    color: var(--text-dark);
    box-shadow: var(--card-shadow);
    font-size: 12px;
    font-weight: 700;
    line-height: 1.3;
    text-align: left;
    z-index: 4;
}
.clio-marker.on-left .clio-marker-bubble { left: 0; }
.clio-marker.on-right .clio-marker-bubble { right: 0; }

/* --- LA ROUE DES FÊTES (js/app/wheel.js) : mini-jeu du niveau 4 du Monde 0 --- */
.path-sheet-side {
    display: block;
    margin: 10px auto 0;
    padding: 8px 14px;
    border: 1px dashed var(--border-soft);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text-dark);
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.wheel-tab-stars {
    color: var(--favorite-yellow);
}

.wheel-intro,
.wheel-hint {
    flex: 0 0 auto;
    max-width: 520px;
    margin: 10px 0 0;
    text-align: center;
    font-size: 13px;
    line-height: 1.4;
    color: var(--muted-text);
}

.wheel-hint {
    margin: 4px 0 0;
}

.wheel-current {
    flex: 0 0 auto;
    max-width: 520px;
    min-height: 22px;
    margin: 0 0 6px;
    text-align: center;
    font-size: 15px;
    color: var(--text-dark);
}

.wheel-current.hidden {
    display: none;
}

.wheel-stage {
    flex: 0 0 auto;
    width: min(100%, 440px);
    /* Le glissement horizontal tourne la roue ; le vertical reste à la page. */
    touch-action: pan-y;
    user-select: none;
    -webkit-user-select: none;
}

.wheel-svg {
    display: block;
    width: 100%;
    height: auto;
    overflow: visible;
}

.wheel-slice {
    fill: var(--surface);
    stroke: var(--border-soft);
    stroke-width: 1;
    cursor: pointer;
}

.wheel-slice.is-odd {
    fill: var(--surface-2);
}

.wheel-slice:hover {
    fill: var(--selected-tint);
}

.wheel-rim {
    fill: #1f3a73;
    stroke: var(--surface);
    stroke-width: 1;
    pointer-events: none;
}

.wheel-rim.is-odd {
    fill: #001a4b;
}

.wheel-month {
    fill: #ffffff;
    font-weight: 700;
    pointer-events: none;
}

.wheel-token circle {
    fill: var(--surface);
    stroke: var(--progress-green);
    stroke-width: 2;
}

.wheel-token {
    cursor: pointer;
}

.wheel-hub {
    fill: var(--primary-blue);
    stroke: var(--surface);
    stroke-width: 2;
    pointer-events: none;
}

.wheel-pointer {
    fill: var(--favorite-yellow);
    stroke: var(--text-dark);
    stroke-width: 1;
    pointer-events: none;
}

.wheel-svg :focus-visible {
    outline: none;
    stroke: var(--focus-ring);
    stroke-width: 4;
}

.wheel-controls {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 6px;
}

.wheel-spin {
    min-width: 44px;
    min-height: 44px;
    padding: 0 14px;
    border: 1px solid var(--border-soft);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text-dark);
    font: inherit;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
}

.wheel-spin-reset {
    font-size: 14px;
}

.wheel-feedback {
    flex: 0 0 auto;
    width: 100%;
    max-width: 520px;
    box-sizing: border-box;
    margin: 8px 0 0;
    padding: 12px 16px;
    border-radius: 14px;
    border: 1px solid var(--border-soft);
    border-left: 5px solid var(--progress-green);
    background: var(--surface);
    color: var(--text-dark);
    font-size: 14px;
    line-height: 1.45;
    box-shadow: var(--card-shadow);
}

.wheel-feedback.is-wrong {
    border-left-color: var(--danger-red);
}

.wheel-tray-label {
    flex: 0 0 auto;
    margin: 14px 0 6px;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted-text);
}

.wheel-tray {
    flex: 0 0 auto;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    width: 100%;
    max-width: 520px;
}

.wheel-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 44px;
    padding: 6px 12px;
    border: 1px solid var(--border-soft);
    border-radius: 14px;
    background: var(--surface);
    color: var(--text-dark);
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
}

.wheel-chip.is-selected {
    border-color: var(--primary-blue);
    background: var(--selected-tint);
    box-shadow: 0 0 0 2px var(--primary-blue);
}

.wheel-chip-icon {
    font-size: 20px;
}

.wheel-chip-local {
    display: block;
    font-size: 12px;
    font-weight: 400;
    color: var(--muted-text);
}

.wheel-done {
    flex: 0 0 auto;
    width: 100%;
    max-width: 520px;
    margin-top: 14px;
    text-align: center;
    color: var(--text-dark);
}

.wheel-done-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.wheel-done-stars {
    font-size: 40px;
    letter-spacing: 6px;
    color: var(--favorite-yellow);
}

/* --- SALLE D'ARCADE, SNAKE, TETRIS, CONVERTISSEUR D'ÈRES (js/app/arcade.js, js/app/eras.js) --- */
.arcade-menu {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    max-width: 520px;
}

/* L'Atelier : des groupes d'outils, chacun sous son titre. */
.tools-group {
    width: 100%;
    max-width: 520px;
    margin-bottom: 22px;
}

.tools-group .modes-group-static { margin: 0 0 10px 4px; }

.arcade-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    border: 1px solid var(--border-soft);
    border-radius: 16px;
    background: var(--surface);
    color: var(--text-dark);
    font: inherit;
    text-align: left;
    cursor: pointer;
    box-shadow: var(--card-shadow);
}

.arcade-card-icon {
    flex: none;
    font-size: 32px;
}

.arcade-card-text small {
    display: block;
    margin-top: 2px;
    font-size: 13px;
    color: var(--muted-text);
}

.arcade-best {
    font-weight: 700;
}

.arcade-rule {
    flex: 0 0 auto;
    max-width: 520px;
    margin: 0 0 10px;
    text-align: center;
    font-size: 13px;
    line-height: 1.4;
    color: var(--muted-text);
}

.arcade-board {
    position: relative;
    flex: 0 0 auto;
    width: min(100%, 360px);
}

.arcade-canvas {
    display: block;
    margin: 0 auto;
    border-radius: 12px;
    box-shadow: var(--card-shadow);
}

.arcade-start {
    /* Centré sans `transform` : `.btn:active` pose `transform: scale(0.96) !important`, qui écraserait un translate(-50%, -50%) et ferait
       sauter le bouton vers le bas-droite sous le doigt, avant que le clic n'ait lieu. */
    position: absolute;
    inset: 0;
    margin: auto;
    width: fit-content;
    height: fit-content;
    min-width: 140px;
}

.arcade-start.hidden,
.arcade-over.hidden {
    display: none;
}

/* Flappy Clio : les deux événements de la prochaine porte, l'un pour l'ouverture du haut, l'autre pour celle du bas. */
.flappy-choices {
    flex: 0 0 auto;
    width: min(100%, 360px);
    margin: 8px 0 0;
}

.flappy-choices.hidden {
    display: none;
}

.flappy-choices p {
    margin: 3px 0;
    padding: 6px 10px;
    border: 1px solid var(--border-soft);
    border-radius: 10px;
    background: var(--surface);
    color: var(--text-dark);
    font-size: 13px;
    font-weight: 700;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

/* La difficulté (facile / moyen / difficile) au-dessus du plateau d'un jeu. */
.arcade-difficulty {
    flex: 0 0 auto;
    width: min(100%, 360px);
    /* `auto` à gauche et à droite : centré aussi dans un conteneur plus large (écran de départ, écran de fin). */
    margin: 0 auto 10px;
    text-align: center;
}

.arcade-over .arcade-difficulty {
    margin-top: 14px;
}

.arcade-difficulty.hidden {
    display: none;
}

.arcade-difficulty-group {
    display: flex;
    gap: 6px;
    width: 100%;
}

.arcade-difficulty-btn {
    flex: 1;
    min-width: 0;
    overflow-wrap: anywhere;
    min-height: 44px;
    padding: 0 8px;
    border: 1px solid var(--border-soft);
    border-radius: 12px;
    background: var(--surface);
    color: var(--text-dark);
    font: inherit;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
}

.arcade-difficulty-btn.is-active {
    background: var(--text-dark);
    color: var(--surface);
    border-color: var(--text-dark);
}

.arcade-difficulty-hint {
    display: block;
    margin-top: 6px;
    font-size: 12px;
    color: var(--muted-text);
}

/* « 3, 2, 1, Go ! » par-dessus le plateau : le chiffre arrive en grand et se pose (façon départ de course). */
.arcade-countdown {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    font-size: 96px;
    font-weight: 900;
    line-height: 1;
    color: #fde047;
    text-shadow: 0 4px 0 #b45309, 0 0 24px rgba(0, 0, 0, 0.6);
}

.arcade-countdown.is-go {
    font-size: 72px;
    color: #4ade80;
    text-shadow: 0 4px 0 #166534, 0 0 24px rgba(0, 0, 0, 0.6);
}

.arcade-countdown.hidden {
    display: none;
}

.arcade-countdown.is-pop {
    animation: arcade-count-pop 0.5s ease-out;
}

@keyframes arcade-count-pop {
    from { transform: scale(2.4); opacity: 0; }
    60% { opacity: 1; }
    to { transform: scale(1); opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
    .arcade-countdown.is-pop {
        animation: none;
    }
}

.snake-legend {
    flex: 0 0 auto;
    list-style: none;
    margin: 12px 0 0;
    padding: 0;
    width: 100%;
    max-width: 520px;
}

.snake-legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 4px 0;
    font-size: 14px;
    color: var(--text-dark);
}

.snake-legend-item.is-eaten {
    color: var(--muted-text);
}

.snake-dot {
    flex: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

.arcade-dpad {
    flex: 0 0 auto;
    display: grid;
    grid-template-columns: repeat(3, 56px);
    grid-template-areas: ". up ." "left down right";
    gap: 8px;
    margin-top: 12px;
}

.arcade-key-up { grid-area: up; }
.arcade-key-left { grid-area: left; }
.arcade-key-down { grid-area: down; }
.arcade-key-right { grid-area: right; }

.arcade-key {
    min-width: 48px;
    min-height: 48px;
    padding: 0 12px;
    border: 1px solid var(--border-soft);
    border-radius: 14px;
    background: var(--surface);
    color: var(--text-dark);
    font: inherit;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
}

.arcade-key:disabled {
    opacity: 0.5;
    cursor: default;
}

.arcade-key.hidden {
    display: none;
}

.arcade-key-wide {
    flex: 1;
}

.arcade-controls {
    flex: 0 0 auto;
    display: flex;
    gap: 10px;
    width: min(100%, 360px);
    margin-top: 10px;
}

.arcade-over {
    flex: 0 0 auto;
    width: 100%;
    max-width: 520px;
    box-sizing: border-box;
    margin-top: 14px;
    padding: 14px 16px;
    border-radius: 14px;
    border: 1px solid var(--border-soft);
    background: var(--surface);
    color: var(--text-dark);
    text-align: center;
}

.arcade-over h3 {
    margin: 0 0 6px;
}

.arcade-mistakes {
    margin: 8px 0 12px;
    padding-left: 18px;
    text-align: left;
    font-size: 13px;
    line-height: 1.4;
    color: var(--muted-text);
}

.tetris-banner {
    flex: 0 0 auto;
    min-height: 40px;
    max-width: 520px;
    margin: 0 0 8px;
    text-align: center;
    font-size: 15px;
    font-weight: 700;
    color: var(--text-dark);
}

.tetris-heads {
    flex: 0 0 auto;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    width: min(100%, 360px);
    gap: 0;
}

.tetris-head {
    padding: 4px 2px;
    border: 0;
    background: none;
    color: var(--text-dark);
    font: inherit;
    text-align: center;
    cursor: pointer;
}

.tetris-head strong {
    display: block;
    font-size: 11px;
    line-height: 1.15;
}

.tetris-head small {
    display: block;
    font-size: 10px;
    color: var(--muted-text);
}

.eras-question {
    flex: 0 0 auto;
    max-width: 520px;
    margin: 0 0 12px;
    text-align: center;
    font-size: 16px;
    font-weight: 700;
    line-height: 1.4;
    color: var(--text-dark);
}

#eras-play {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 520px;
}

.eras-ruler {
    width: 100%;
    padding: 10px 6px;
    border: 1px solid var(--border-soft);
    border-radius: 14px;
    background: var(--surface);
    box-sizing: border-box;
}

.eras-row {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    text-align: center;
}

.eras-cell {
    padding: 8px 0;
    font-size: 14px;
    color: var(--muted-text);
    border-left: 1px solid var(--border-soft);
}

.eras-cell:first-child {
    border-left: 0;
}

.eras-cell.is-center {
    font-size: 17px;
    font-weight: 800;
    color: var(--text-dark);
    background: var(--selected-tint);
    border-radius: 8px;
}

.eras-link {
    text-align: center;
    font-size: 18px;
    color: var(--muted-text);
}

.eras-era-name {
    margin: 6px 0 0;
    text-align: center;
    font-size: 13px;
    font-weight: 700;
    color: var(--muted-text);
}

.eras-steppers {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 12px;
}

.eras-value {
    flex: 0 0 100%;
    order: -1;
    min-width: 72px;
    text-align: center;
    font-size: 24px;
    font-weight: 800;
    color: var(--text-dark);
}

.eras-slider {
    width: 100%;
    margin: 12px 0;
}

.eras-check {
    min-width: 160px;
}

#eras-play .wheel-feedback {
    margin-top: 12px;
}

#eras-feedback strong {
    display: block;
    margin-bottom: 4px;
}

#eras-feedback p {
    margin: 0 0 10px;
}

.arcade-message {
    flex: 0 0 auto;
    margin-top: 10px;
    width: min(100%, 360px);
    min-height: 0;
    font-size: 13px;
}

.arcade-message.hidden {
    display: none;
}

.wheel-kinds {
    flex: 0 0 auto;
    display: flex;
    gap: 10px;
    width: 100%;
    max-width: 520px;
    margin-bottom: 8px;
}

.wheel-kind {
    flex: 1;
    min-height: 44px;
    padding: 8px 14px;
    border: 1px solid var(--border-soft);
    border-radius: 14px;
    background: var(--surface);
    color: var(--text-dark);
    font: inherit;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
}

.wheel-kind::after {
    content: ' ▾';
}

.wheel-kind.is-open::after {
    content: ' ▴';
}

.wheel-kind.is-active {
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 1px var(--primary-blue);
}

.wheel-kind.is-open {
    background: var(--primary-blue);
    border-color: var(--primary-blue);
    color: var(--text-light);
}

.wheel-choices {
    flex: 0 0 auto;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
    width: 100%;
    max-width: 520px;
    box-sizing: border-box;
    margin-bottom: 8px;
    padding: 8px;
    border: 1px solid var(--border-soft);
    border-radius: 14px;
    background: var(--surface);
}

.wheel-choices.hidden {
    display: none;
}

.wheel-choice {
    min-height: 44px;
    padding: 6px 10px;
    border: 1px solid transparent;
    border-radius: 10px;
    background: none;
    color: var(--text-dark);
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
}

.wheel-choice:hover {
    background: var(--selected-tint);
}

.wheel-choice.is-active {
    border-color: var(--primary-blue);
    background: var(--selected-tint);
}

.wheel-cal {
    flex: 0 0 auto;
    margin: 0 0 6px;
    text-align: center;
    font-size: 14px;
    font-weight: 700;
    color: var(--text-dark);
}

/* --- SALLE DE JEUX : sections, MEMORY, QUI SUIS-JE ? (js/app/arcade.js, js/app/reflexion.js) --- */
.games-section {
    flex: 0 0 auto;
    width: 100%;
    max-width: 520px;
    margin-top: 12px;
}

.games-section h3 {
    margin: 0;
    font-size: 17px;
    color: var(--text-dark);
}

.games-section-desc {
    margin: 2px 0 8px;
    font-size: 13px;
    color: var(--muted-text);
}

.memory-grid {
    flex: 0 0 auto;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    width: min(100%, 360px);
}

/* Difficile : dix-huit cartes, six rangées. */
.memory-grid.is-dense .memory-card {
    min-height: 64px;
}

.memory-card {
    min-height: 84px;
    padding: 6px;
    border: 2px solid var(--primary-blue);
    border-radius: 12px;
    background: var(--primary-blue);
    color: var(--text-light);
    font: inherit;
    font-size: 24px;
    font-weight: 800;
    cursor: pointer;
}

.memory-card.is-up {
    border-color: var(--border-soft);
    background: var(--surface);
    color: var(--text-dark);
    font-size: 12px;
    font-weight: 700;
    line-height: 1.25;
}

/* Facile : le dos de la carte dit si c'est un événement (bleu, 📜) ou une date (ambre, 📅). */
.memory-card.is-back-date {
    border-color: #92400e;
    background: #92400e;
}

.memory-card.is-back-event {
    border-color: var(--primary-blue);
    background: var(--primary-blue);
}

.memory-card.is-up.is-date {
    font-size: 22px;
    background: var(--selected-tint);
}

.memory-card.is-matched {
    border-color: var(--progress-green);
    opacity: 0.85;
}

.who-clues {
    flex: 0 0 auto;
    list-style: none;
    margin: 0 0 10px;
    padding: 0;
    width: 100%;
    max-width: 520px;
}

.who-clue {
    margin: 6px 0;
    padding: 10px 14px;
    border: 1px solid var(--border-soft);
    border-left: 4px solid var(--primary-blue);
    border-radius: 10px;
    background: var(--surface);
    color: var(--text-dark);
    font-size: 15px;
    line-height: 1.4;
}

#who-play {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 520px;
}

.who-more {
    margin: 4px 0 10px;
}

.who-options {
    width: 100%;
}

#who-play .wheel-feedback {
    margin-top: 12px;
}

#who-feedback strong {
    display: block;
    margin-bottom: 4px;
}

#who-feedback p {
    margin: 0 0 10px;
}

/* --- CAUSE OU CONSÉQUENCE ?, CHASSE AUX ANACHRONISMES (js/app/reflexion.js) --- */
#cause-play,
#scene-play {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 520px;
}

.cause-question {
    margin: 0 0 12px;
    text-align: center;
    font-size: 16px;
    font-weight: 700;
    line-height: 1.4;
    color: var(--text-dark);
}

.cause-cards {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
}

.cause-card {
    min-height: 72px;
    font-size: 16px;
    text-align: center;
}

.cause-card:disabled {
    opacity: 1;
    cursor: default;
}

#cause-play .wheel-feedback,
#scene-play .wheel-feedback {
    margin-top: 12px;
}

#cause-feedback strong,
#scene-feedback strong {
    display: block;
    margin-bottom: 4px;
}

#cause-feedback p {
    margin: 0 0 8px;
}

.scene-title {
    margin: 0 0 4px;
    text-align: center;
    font-size: 17px;
    color: var(--text-dark);
}

.scene-intro {
    margin: 0 0 10px;
    text-align: center;
    font-size: 14px;
    line-height: 1.4;
    color: var(--muted-text);
}

.scene-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    width: 100%;
}

.scene-tile {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 64px;
    padding: 8px 10px;
    border: 2px solid var(--border-soft);
    border-radius: 12px;
    background: var(--surface);
    color: var(--text-dark);
    font: inherit;
    font-size: 13px;
    line-height: 1.3;
    text-align: left;
    cursor: pointer;
}

.scene-tile-icon {
    flex: none;
    font-size: 24px;
}

.scene-tile.is-selected {
    border-color: var(--primary-blue);
    background: var(--selected-tint);
    box-shadow: 0 0 0 1px var(--primary-blue);
}

.scene-tile:disabled {
    opacity: 1;
    cursor: default;
}

.scene-tile.is-found {
    border-color: var(--progress-green);
    background: var(--selected-tint);
}

.scene-tile.is-missed {
    border-color: var(--favorite-yellow);
    border-style: dashed;
}

.scene-tile.is-wrong {
    border-color: var(--danger-red);
}

.scene-check {
    margin-top: 12px;
}

.scene-check.hidden {
    display: none;
}

.scene-reasons {
    margin: 4px 0 10px;
    padding-left: 18px;
    font-size: 13px;
    line-height: 1.45;
}

/* --- CASSE-BRIQUES, FLAPPY CLIO, COURSE DE CHARS, PENDU DES DATES, SIÈCLES ROMAINS, AVENT (js/app/arcade-extra.js, js/app/minigames.js, js/app/reflexion.js) --- */
.arcade-canvas-wide {
    touch-action: pan-y;
    background: #0f1a33;
}

.roman-numeral {
    flex: 0 0 auto;
    margin: 0 0 12px;
    text-align: center;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 56px;
    font-weight: 700;
    letter-spacing: 4px;
    color: var(--text-dark);
}

.roman-numeral.hidden {
    display: none;
}

#roman-play {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 520px;
}

#roman-play .wheel-feedback {
    margin-top: 12px;
}

#roman-feedback strong {
    display: block;
    margin-bottom: 4px;
}

#roman-feedback p {
    margin: 0 0 10px;
}

.roman-tile:disabled {
    opacity: 1;
}

.advent-grid {
    flex: 0 0 auto;
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
    width: min(100%, 420px);
}

.advent-day {
    position: relative;
    aspect-ratio: 1;
    min-height: 44px;
    padding: 0;
    border: 2px solid var(--border-soft);
    border-radius: 10px;
    background: var(--surface);
    color: var(--text-dark);
    font: inherit;
    font-size: 16px;
    font-weight: 800;
    cursor: pointer;
}

.advent-day small {
    position: absolute;
    left: 3px;
    bottom: 1px;
    font-size: 9px;
    font-weight: 600;
    color: var(--muted-text);
}

.advent-day.is-locked {
    opacity: 0.55;
    font-size: 14px;
}

.advent-day.is-missed {
    opacity: 0.4;
    cursor: default;
}

.advent-day.is-open {
    border-color: var(--primary-blue);
}

.advent-day.is-right {
    border-color: var(--progress-green);
    background: var(--selected-tint);
    color: var(--success-text);
}

.advent-day.is-wrong {
    border-color: var(--danger-red);
    color: var(--danger-red-text);
}

.advent-day.is-selected {
    box-shadow: 0 0 0 3px var(--primary-blue);
}

.advent-case {
    flex: 0 0 auto;
    width: min(100%, 520px);
    box-sizing: border-box;
    margin-top: 14px;
    padding: 14px 16px;
    border: 1px solid var(--border-soft);
    border-radius: 14px;
    background: var(--surface);
    color: var(--text-dark);
}

.advent-case.hidden {
    display: none;
}

.advent-case-title {
    margin: 0 0 6px;
    font-size: 15px;
    font-weight: 800;
    text-align: center;
}

.advent-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    width: 100%;
}

.advent-option {
    min-height: 54px;
    font-size: 18px;
    font-weight: 700;
    text-align: center;
}

.advent-option:disabled {
    opacity: 1;
    cursor: default;
}

#advent-feedback strong {
    display: block;
    margin-bottom: 4px;
}

#advent-feedback p {
    margin: 0;
}

.advent-gifts {
    flex: 0 0 auto;
    width: min(100%, 420px);
    margin: 0 0 10px;
}

.advent-gift {
    margin: 2px 0;
    font-size: 13px;
    font-weight: 700;
    color: var(--muted-text);
    text-align: center;
}

.advent-gift.is-earned {
    color: var(--success-text);
}

.advent-gift.is-lost {
    opacity: 0.7;
    text-decoration: line-through;
}

.arcade-card.is-closed {
    opacity: 0.6;
}

/* La carte du jour de l'Avent sur l'écran des catégories : chaque jour de décembre a sa teinte (--advent-hue). */
.advent-card {
    --advent-hue: 140;
    border-color: hsl(var(--advent-hue) 55% 35%);
    background: linear-gradient(135deg, hsl(var(--advent-hue) 55% 22%), hsl(calc(var(--advent-hue) + 40) 55% 16%));
    color: #fff;
}

.advent-card .resume-card-kicker {
    color: #f3f4f6;
}

.advent-card-icon {
    background: hsl(var(--advent-hue) 60% 38%);
    font-size: 22px;
}

.race-setup {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
    max-width: 520px;
    align-items: stretch;
}

.race-duo {
    background: var(--surface);
    color: var(--text-dark);
    border: 2px solid var(--primary-blue);
}

#race-play {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 520px;
}

.race-track {
    width: 100%;
    margin-bottom: 10px;
}

.race-lane {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 6px 0;
}

.race-label {
    flex: none;
    width: 78px;
    font-size: 12px;
    font-weight: 700;
    color: var(--muted-text);
}

.race-road {
    position: relative;
    flex: 1;
    height: 38px;
    border-radius: 10px;
    background: repeating-linear-gradient(90deg, var(--surface-2) 0 8.33%, var(--surface) 8.33% 16.66%);
    border: 1px solid var(--border-soft);
}

.race-car {
    position: absolute;
    top: 3px;
    font-size: 26px;
    transform: translateX(-50%);
    transition: left 0.5s ease;
}

.race-flag {
    position: absolute;
    left: 4px;
    top: 5px;
    font-size: 22px;
}

.race-turn {
    margin: 0 0 6px;
    font-size: 14px;
    font-weight: 700;
    color: var(--muted-text);
}

#race-play .wheel-feedback {
    margin-top: 12px;
}

#race-feedback strong {
    display: block;
    margin-bottom: 4px;
}

#race-feedback p {
    margin: 0 0 10px;
}

#race-handover,
#race-over {
    width: 100%;
    max-width: 520px;
    text-align: center;
}

.race-lane.is-rival .race-car {
    transition: none;
}

.race-recap-title {
    margin: 14px 0 6px;
    font-size: 14px;
    color: var(--muted-text);
}

.race-recap {
    max-height: 260px;
    overflow-y: auto;
    text-align: left;
}

.race-recap-right {
    color: var(--progress-green);
}

.race-recap-wrong {
    color: var(--text-dark);
}

@media (prefers-reduced-motion: reduce) {
    .race-car { transition: none; }
}

#hangman-play {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 520px;
}

.hangman-bc {
    margin: 0 0 4px;
    font-size: 13px;
    font-weight: 700;
    color: var(--muted-text);
}

.hangman-bc.hidden {
    display: none;
}

.hangman-slots {
    display: flex;
    gap: 8px;
    margin: 4px 0 8px;
}

.hangman-slot {
    width: 44px;
    height: 56px;
    border-bottom: 4px solid var(--text-dark);
    text-align: center;
    font-size: 36px;
    font-weight: 800;
    line-height: 56px;
    color: var(--text-dark);
}

.hangman-slot.is-found {
    color: var(--success-text);
    border-bottom-color: var(--progress-green);
}

.hangman-lives {
    margin: 0 0 6px;
    font-size: 20px;
    letter-spacing: 3px;
    color: var(--danger-red-text);
}

.hangman-hint {
    margin: 0 0 8px;
    padding: 6px 12px;
    border-radius: 10px;
    background: var(--selected-tint);
    font-size: 14px;
    font-weight: 700;
    color: var(--text-dark);
}

.hangman-hint.hidden {
    display: none;
}

.hangman-pad {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
    width: 100%;
    max-width: 360px;
}

.hangman-digit {
    font-size: 20px;
}

.hangman-digit.correct {
    background: var(--selected-tint);
    border-color: var(--progress-green);
    color: var(--success-text);
    opacity: 1;
}

.hangman-digit.wrong {
    border-color: var(--danger-red);
    color: var(--danger-red-text);
    opacity: 1;
}

.hangman-try {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    margin-top: 14px;
}

.hangman-try-label {
    flex: 0 0 100%;
    text-align: center;
    font-size: 13px;
    color: var(--muted-text);
}

.hangman-year {
    width: 110px;
    min-height: 44px;
    padding: 0 10px;
    border: 1px solid var(--border-soft);
    border-radius: 10px;
    background: var(--surface);
    color: var(--text-dark);
    font: inherit;
    font-size: 18px;
}

.hangman-try-bc {
    font-size: 14px;
    color: var(--text-dark);
}

#hangman-play .wheel-feedback {
    margin-top: 12px;
}

#hangman-feedback strong {
    display: block;
    margin-bottom: 4px;
}

#hangman-feedback p {
    margin: 0 0 10px;
}

/* --- LA BOÎTE À OUTILS (js/app/tools.js) --- */
.tool-panel {
    flex: 0 0 auto;
    width: 100%;
    max-width: 520px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.tool-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.tool-field label {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-dark);
}

.tool-inline {
    display: flex;
    gap: 8px;
}

.tool-inline .tool-input:first-child {
    flex: 1;
    min-width: 0;
}

.tool-input {
    box-sizing: border-box;
    min-height: 44px;
    padding: 8px 12px;
    border: 1px solid var(--border-soft);
    border-radius: 12px;
    background: var(--surface);
    color: var(--text-dark);
    font: inherit;
    font-size: 16px;
}

.tool-today {
    flex: none;
    min-height: 44px;
    padding: 8px 14px;
}

.tool-h {
    margin: 10px 0 0;
    font-size: 16px;
    color: var(--text-dark);
}

.tool-msg,
.tool-small {
    margin: 0;
    font-size: 14px;
    line-height: 1.45;
    color: var(--muted-text);
}

.tool-big {
    margin: 0;
    font-size: 26px;
    font-weight: 800;
    line-height: 1.2;
    color: var(--text-dark);
    overflow-wrap: anywhere;
}

.tool-result {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 12px 14px;
    border: 1px solid var(--border-soft);
    border-radius: 14px;
    background: var(--surface);
}

.tool-result:empty {
    display: none;
}

.tool-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tool-chip {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    min-width: 52px;
    padding: 6px 10px;
    border: 1px solid var(--border-soft);
    border-radius: 12px;
    background: var(--surface-2);
    color: var(--text-dark);
}

.tool-chip strong {
    font-size: 18px;
}

.tool-chip small {
    font-size: 12px;
    color: var(--muted-text);
}

.tool-rows {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.tool-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 10px 14px;
    border: 1px solid var(--border-soft);
    border-radius: 14px;
    background: var(--surface);
    color: var(--text-dark);
}

.tool-row.is-off {
    opacity: 0.75;
}

.tool-row.is-current {
    border-color: var(--text-dark);
    box-shadow: var(--card-shadow);
}

.tool-row-head {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 4px 12px;
}

.tool-row-value {
    font-weight: 800;
}

.tool-row-note {
    font-size: 13px;
    color: var(--muted-text);
}

.tool-row-rule summary {
    cursor: pointer;
    font-size: 13px;
    color: var(--muted-text);
}

.tool-row-rule p {
    margin: 4px 0 0;
    font-size: 13px;
    line-height: 1.45;
    color: var(--muted-text);
}

.tool-lesson-btn {
    align-self: flex-start;
}

.tool-lesson {
    gap: 8px;
}

.tool-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    color: var(--text-dark);
}

.tool-table th,
.tool-table td {
    padding: 6px 8px;
    border-bottom: 1px solid var(--border-soft);
    text-align: left;
}

.tool-table td:nth-child(2),
.tool-table tr > th:first-child {
    font-weight: 800;
}

/* --- L'ATLAS DES PAYS (js/app/countries.js) --- */
.tool-countries-search {
    position: relative;
}

.tool-countries-results {
    list-style: none;
    margin: 4px 0 0;
    padding: 4px;
    border: 1px solid var(--border-soft);
    border-radius: 12px;
    background: var(--surface);
    box-shadow: var(--card-shadow);
}

.tool-countries-hit {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    min-height: 44px;
    padding: 8px 10px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--text-dark);
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.tool-countries-hit small {
    color: var(--muted-text);
}

.tool-countries-none {
    padding: 10px;
    font-size: 14px;
    color: var(--muted-text);
}

.tool-countries-map {
    width: 100%;
    height: min(52vh, 420px);
    min-height: 260px;
    border: 1px solid var(--border-soft);
    border-radius: 14px;
    overflow: hidden;
    background: var(--surface-2);
}

.tool-countries-credit {
    font-size: 12px;
}

.tool-countries-name {
    margin: 0;
    font-size: 22px;
    color: var(--text-dark);
}

.tool-countries-badge {
    margin: 0;
    font-size: 13px;
    font-weight: 700;
    color: var(--muted-text);
}

.tool-countries-facts {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 6px 14px;
    margin: 0;
    font-size: 14px;
}

.tool-countries-facts dt {
    font-weight: 700;
    color: var(--muted-text);
}

.tool-countries-facts dd {
    margin: 0;
    color: var(--text-dark);
}

.tool-countries-facts dd small {
    color: var(--muted-text);
}

.tool-countries-event-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.tool-countries-event {
    min-height: 44px;
    padding: 8px 12px;
    border: 1px solid var(--border-soft);
    border-radius: 12px;
    background: var(--surface-2);
    color: var(--text-dark);
    font: inherit;
    font-size: 14px;
    text-align: left;
    cursor: pointer;
}

.tool-countries-event strong {
    margin-right: 4px;
}

/* --- LES CARTES HISTORIQUES (js/app/history-maps.js) --- */
.tool-history-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tool-history-chip {
    min-height: 44px;
    padding: 8px 14px;
    border: 1px solid var(--border-soft);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text-dark);
    font: inherit;
    font-size: 14px;
    cursor: pointer;
}

.tool-history-chip.is-date {
    border-radius: 12px;
    font-size: 13px;
}

.tool-history-chip[aria-pressed="true"] {
    border-color: var(--text-dark);
    background: var(--surface-2);
    font-weight: 700;
    box-shadow: var(--card-shadow);
}

.tool-history-when {
    margin: 0;
    font-size: 15px;
    color: var(--text-dark);
}

.tool-history-legend {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 14px;
    color: var(--text-dark);
}

.tool-history-dot {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    vertical-align: middle;
}

.tool-compare {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 14px;
    color: var(--text-dark);
}

.tool-compare-row {
    padding: 4px 0;
    border-bottom: 1px solid var(--border-soft);
}

.tool-history-modes {
    display: flex;
    gap: 8px;
}

.tool-history-modes .tool-history-chip {
    flex: 1;
    justify-content: center;
}

.tool-history-block {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.tool-history-slider {
    width: 100%;
    min-height: 32px;
}

.tool-history-active {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
}

/* Une seule rangée qui défile, au lieu d'un mur de puces */
.tool-history-chips.is-scroll {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 4px;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
}

.tool-history-chips.is-scroll .tool-history-chip {
    flex: none;
    scroll-snap-align: start;
    white-space: nowrap;
}

.tool-history-modes {
    padding: 3px;
    border: 1px solid var(--border-soft);
    border-radius: 999px;
    background: var(--surface-2);
}

.tool-history-modes .tool-history-chip {
    min-height: 38px;
    border: 0;
    background: transparent;
    box-shadow: none;
    font-size: 14px;
}

.tool-history-modes .tool-history-chip[aria-pressed="true"] {
    background: var(--surface);
    box-shadow: var(--card-shadow);
}

/* --- Écusson d'équipe (js/teamBadge.js, éditeur dans js/app/team.js) --- */
.team-badge-svg {
    display: block;
    width: 100%;
    height: auto;
}


.rewards-team-badge {
    display: inline-block;
    width: 18px;
    height: 20px;
    vertical-align: middle;
}

.tb-editor {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.tb-preview {
    width: 112px;
    margin: 0 auto;
}

.tb-row-title {
    margin: 0 0 8px;
    font-size: 14px;
    font-weight: 700;
    color: var(--text-dark);
}

.tb-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tb-opt {
    position: relative;
    width: 48px;
    height: 52px;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--border-soft);
    border-radius: 12px;
    background: var(--surface);
    cursor: pointer;
}

.tb-opt[aria-pressed="true"] {
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 2px var(--selected-tint, rgba(0, 26, 75, 0.15));
}

.tb-swatch {
    display: block;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid rgba(0, 0, 0, 0.18);
}

.tb-opt.is-locked svg {
    opacity: 0.35;
    filter: grayscale(0.8);
}

.tb-opt.is-locked::after {
    content: '🔒';
    position: absolute;
    right: 1px;
    bottom: 0;
    font-size: 13px;
}

/* --- Fiche de l'équipe (style « clan ») : en-tête, membres par niveau, recherche, défis --- */
.team-card {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    padding: 16px;
    border-radius: 16px;
    background: var(--surface);
    border: 1px solid var(--border-soft);
    box-shadow: var(--card-shadow);
}

.team-card-badge {
    flex: 0 0 96px;
    width: 96px;
}

.team-card-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.team-card-id {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 13px;
    color: var(--muted-text);
}

.team-card-id b {
    font-size: 16px;
    letter-spacing: 0.06em;
    color: var(--text-dark);
}

.team-copy {
    padding: 3px 10px;
    border-radius: 999px;
    border: 1px solid var(--border-soft);
    background: transparent;
    color: inherit;
    font: inherit;
    font-size: 12px;
    cursor: pointer;
}

.team-card-desc {
    margin: 0;
    font-size: 14px;
    line-height: 1.45;
    overflow-wrap: anywhere;
}

.team-card-desc.is-placeholder {
    font-style: italic;
    color: var(--muted-text);
}

.team-facts {
    margin: 0;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px 14px;
    font-size: 13px;
}

.team-facts dt {
    color: var(--muted-text);
    font-size: 12px;
}

.team-facts dd {
    margin: 0;
    font-weight: 700;
    overflow-wrap: anywhere;
}

.team-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.team-card-actions .team-secondary {
    margin: 0;
    flex: 1 1 180px;
}

.team-edit,
.team-challenge-find {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 16px;
    border-radius: 16px;
    background: var(--surface);
    border: 1px solid var(--border-soft);
}

.team-profile-editor {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.team-textarea {
    height: auto;
    border-radius: 18px;
    resize: vertical;
    font: inherit;
}

.team-select {
    width: 100%;
}

.team-find-box {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.team-find-row {
    display: flex;
    gap: 8px;
}

.team-find-row .form-input {
    flex: 1;
    min-width: 0;
}

.team-find-btn,
.team-find-action {
    padding: 8px 16px;
    font-size: 14px;
}

.team-find-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.team-find-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 14px;
    border: 1px solid var(--border-soft);
    background: var(--surface);
}

.team-find-badge {
    flex: 0 0 38px;
    width: 38px;
}

.team-find-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.team-find-info b {
    overflow-wrap: anywhere;
}

.team-find-info small {
    color: var(--muted-text);
    font-size: 12px;
}

.team-challenge {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 16px;
    border-radius: 16px;
    background: var(--surface);
    border: 1px solid var(--border-soft);
    text-align: center;
}

.team-challenge h3 {
    margin: 0;
}

.team-challenge-lead {
    margin: 0;
    font-weight: 700;
}

.team-challenge-actions {
    display: flex;
    gap: 10px;
}

.team-challenge-actions .btn {
    flex: 1;
    margin: 0;
}

.team-versus {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
}

.team-versus-side {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.team-versus-badge {
    width: 64px;
}

.team-versus-score {
    font-size: 20px;
    font-weight: 800;
}

.team-versus-side.is-mine .team-versus-score {
    color: var(--primary-blue);
}

.team-versus-vs {
    font-weight: 800;
    color: var(--muted-text);
}

.team-members-title {
    margin: 6px 0 0;
    font-size: 14px;
    color: var(--muted-text);
    font-weight: 700;
}

.team-members .team-member {
    display: flex;
    align-items: center;
    gap: 10px;
}

.team-member-icon {
    font-size: 22px;
}

.team-members .team-member-name {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    white-space: normal;
}

.team-member-name b {
    overflow-wrap: anywhere;
}

.team-member-name small {
    color: var(--muted-text);
    font-size: 12px;
}

.team-member-level {
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--selected-tint, rgba(0, 26, 75, 0.08));
    font-size: 12px;
    font-weight: 700;
}

.team-member.is-leader {
    outline: 2px solid #C9A24A;
}

.team-listed {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-top: 6px;
}

.team-listed input {
    cursor: pointer;
    margin-top: 3px;
    width: 18px;
    height: 18px;
    flex: 0 0 auto;
}

.team-listed span {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.team-listed small {
    color: var(--muted-text);
    font-size: 12px;
    line-height: 1.35;
}

/* --- Amis (js/app/friends.js) --- */
.friends-me,
.friends-add,
.friends-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px;
    border-radius: 16px;
    background: var(--surface);
    border: 1px solid var(--border-soft);
    margin-bottom: 14px;
}

.friends-me h3,
.friends-add h3,
.friends-section h3 {
    margin: 0;
}

.friends-code-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.friends-code {
    font-size: 26px;
    letter-spacing: 0.14em;
    color: var(--text-dark);
}

.friends-msg {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
}

.friends-msg.is-ok {
    color: var(--success-text);
}

.friends-msg.is-error {
    color: var(--danger-red-text);
}

.friends-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.friends-person {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px 10px;
    padding: 8px 10px;
    border-radius: 14px;
    border: 1px solid var(--border-soft);
}

.friends-person-link {
    background: none;
    border: none;
    padding: 0;
    font: inherit;
    font-weight: 700;
    color: inherit;
    text-align: left;
    cursor: pointer;
}

.friends-hub-tabs {
    margin-bottom: 16px;
}

.friends-person-icon {
    font-size: 22px;
}

.friends-person-name {
    flex: 1 1 120px;
    min-width: 0;
    overflow-wrap: anywhere;
}

.friends-person-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.friends-btn {
    padding: 6px 12px;
    border-radius: 999px;
    border: 1px solid var(--border-soft);
    background: var(--surface);
    color: var(--text-dark);
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.friends-btn.is-primary {
    background: var(--primary-blue);
    border-color: var(--primary-blue);
    color: #fff;
}

.rewards-friends-btn small:not(:empty) {
    min-width: 18px;
    padding: 0 6px;
    border-radius: 999px;
    background: var(--danger-red-text, #b42318);
    color: #fff;
    text-align: center;
}

/* --- La colonne des grades (js/app/ranks.js) --- */
.profile-ranks-btn {
    width: 100%;
    margin: 6px 0 14px;
}

.ranks-column {
    width: 100%;
    max-width: 520px;
    margin: 6px auto 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.ranks-summit {
    align-self: flex-start;
    margin: 0 0 6px 82px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted-text);
}

.ranks-capital,
.ranks-base {
    width: 190px;
    line-height: 0;
    position: relative;
    z-index: 2;
    /* Centrés sur le fût (82 + 48 px du bord) plutôt que sur l'écran. */
    align-self: flex-start;
    margin-left: 35px;
}

.ranks-capital {
    margin-bottom: -4px;
}

.ranks-base {
    margin-top: -4px;
}

.ranks-capital-svg,
.ranks-base-svg {
    width: 100%;
    height: auto;
}

/* Le fût : un tube cannelé en pierre claire, que la ligne d'or remplit depuis le pied. Les rangées (une par grade)
   sont posées dessus en absolu, depuis le bas. */
.ranks-shaft {
    position: relative;
    width: 100%;
}

.ranks-tube {
    position: absolute;
    left: 82px;
    top: 0;
    bottom: 0;
    width: 96px;
    border-radius: 6px;
    overflow: hidden;
    background:
        repeating-linear-gradient(90deg, rgba(120, 104, 78, 0.28) 0 2px, transparent 2px 13px),
        linear-gradient(90deg, #D6CCB8, #F6F1E6 35%, #F6F1E6 65%, #D6CCB8);
    box-shadow: inset 0 0 0 1px rgba(120, 104, 78, 0.35);
}

.ranks-fill {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.16) 0 2px, transparent 2px 13px),
        linear-gradient(180deg, #2DB784 0%, #A9B341 55%, #E8A230 100%);
    border-top: 3px solid rgba(255, 255, 255, 0.75);
    box-shadow: 0 -6px 14px rgba(45, 183, 132, 0.45);
    transition: height 0.9s ease-out;
}

.ranks-row {
    position: absolute;
    left: 0;
    right: 0;
    display: grid;
    grid-template-columns: 82px 96px minmax(0, 1fr);
    align-items: center;
    column-gap: 0;
}

.ranks-scale {
    justify-self: end;
    padding-right: 12px;
    font-size: 12px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--muted-text);
}

.ranks-scale::after {
    content: '';
    display: inline-block;
    width: 10px;
    height: 2px;
    margin-left: 6px;
    vertical-align: middle;
    background: currentColor;
    opacity: 0.6;
}

.ranks-ring {
    justify-self: center;
    z-index: 1;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 21px;
    background: #FBF7EE;
    border: 3px solid #BFB39B;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
}

.ranks-row.is-reached .ranks-ring {
    border-color: #C9A24A;
    background: #FFF5D6;
}

.ranks-row.is-locked .ranks-ring {
    filter: grayscale(1);
    opacity: 0.7;
}

.ranks-row.is-current .ranks-ring {
    width: 48px;
    height: 48px;
    font-size: 26px;
    border-color: #C9A24A;
    box-shadow: 0 0 0 5px rgba(201, 162, 74, 0.3), 0 3px 10px rgba(0, 0, 0, 0.25);
}

.ranks-label {
    padding-left: 12px;
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}

.ranks-label b {
    font-size: 15px;
    line-height: 1.2;
    color: var(--text-dark);
    overflow-wrap: anywhere;
}

.ranks-row.is-locked .ranks-label b {
    color: var(--muted-text);
}

.ranks-label small {
    font-size: 12px;
    color: var(--muted-text);
}

.ranks-here {
    font-style: normal;
    font-size: 12px;
    font-weight: 800;
    color: #8A6A1F;
}

@media (prefers-reduced-motion: reduce) {
    .ranks-fill {
        transition: none;
    }
}

.tool-countries-play {
    display: block;
    width: 100%;
    margin: 12px 0;
}

/* --- CARTE DE LA SÉRIE (js/app/streak-card.js) : les 7 jours, 4 à 5 secondes, une fois par jour --- */
.streak-card {
    position: fixed;
    top: calc(env(safe-area-inset-top, 0px) + 14px);
    left: 50%;
    width: min(92vw, 420px);
    box-sizing: border-box;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    background: var(--surface);
    color: var(--text-dark);
    border: 1px solid var(--border-soft);
    border-radius: 20px;
    box-shadow: var(--card-shadow-hover);
    z-index: 100001;
    pointer-events: none;
    opacity: 0;
    transform: translate(-50%, -140%);
}

.streak-card.is-in {
    opacity: 1;
    transform: translate(-50%, 0);
    transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.3s ease;
}

.streak-card.is-out {
    opacity: 0;
    transform: translate(-50%, -30%);
    transition: transform 0.4s ease, opacity 0.4s ease;
}

.streak-card-reduced {
    opacity: 1;
    transform: translate(-50%, 0);
}

.streak-card-flame {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 46px;
}

.streak-card-flame-icon {
    font-size: 34px;
    line-height: 1;
    filter: grayscale(1) opacity(0.45);
}

.streak-card-flame.is-lit .streak-card-flame-icon {
    filter: none;
    animation: streakFlameLight 0.7s ease-out;
}

.streak-card-count {
    font-size: 15px;
    font-weight: 800;
    line-height: 1.2;
    font-variant-numeric: tabular-nums;
}

.streak-card-count.is-bump {
    animation: streakCountBump 0.5s ease-out;
}

.streak-card-days {
    flex: 1;
    display: flex;
    justify-content: space-between;
    gap: 4px;
}

.streak-card-day {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.streak-card-weekday {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted, #646464);
}

.streak-card-dot {
    width: 24px;
    height: 24px;
    box-sizing: border-box;
    border-radius: 50%;
    border: 2px solid var(--border-soft);
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 800;
    color: #ffffff;
}

.streak-card-dot.is-done,
.streak-card-dot.is-todayDone {
    background: #1A6E3A;
    border-color: #1A6E3A;
}

.streak-card-dot.is-done::after,
.streak-card-dot.is-todayDone::after {
    content: '\2713';
}

.streak-card-dot.is-rest,
.streak-card-dot.is-futureRest {
    border-style: dashed;
    border-color: #1A6E3A;
    opacity: 0.55;
}

.streak-card-dot.is-today {
    border-color: #1A6E3A;
}

.streak-card-dot.is-pop {
    animation: streakDotPop 0.55s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes streakFlameLight {
    0% { transform: scale(0.7); }
    60% { transform: scale(1.25); filter: drop-shadow(0 0 8px rgba(247, 147, 30, 0.9)); }
    100% { transform: scale(1); }
}

@keyframes streakCountBump {
    0% { transform: translateY(6px); opacity: 0; }
    100% { transform: translateY(0); opacity: 1; }
}

@keyframes streakDotPop {
    0% { transform: scale(0.6); }
    60% { transform: scale(1.3); }
    100% { transform: scale(1); }
}

@media (prefers-reduced-motion: reduce) {
    .streak-card.is-in,
    .streak-card.is-out {
        transition: none;
    }

    .streak-card-flame.is-lit .streak-card-flame-icon,
    .streak-card-count.is-bump,
    .streak-card-dot.is-pop {
        animation: none;
    }
}

/* Enchaîner les questions (js/app/auto-next.js) : la case au-dessus du bouton « Question suivante » et la barre qui se vide sur le bouton. */
.auto-next-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 10px 0 4px;
    font-size: 14px;
    color: var(--muted-text);
    cursor: pointer;
}

.auto-next-toggle input { width: 18px; height: 18px; accent-color: var(--primary-blue); }

.auto-next-pending {
    position: relative;
    overflow: hidden;
}

.auto-next-pending::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 4px;
    background: currentColor;
    opacity: 0.55;
    transform-origin: left center;
    animation: auto-next-drain var(--auto-next-ms, 3000ms) linear forwards;
}

@keyframes auto-next-drain {
    from { transform: scaleX(1); }
    to { transform: scaleX(0); }
}

@media (prefers-reduced-motion: reduce) {
    .auto-next-pending::after { animation: none; transform: scaleX(1); opacity: 0.3; }
}

/* =====================================================================
   MOUVEMENT — apparitions et transitions partagées (js/app/motion.js)
   Un seul tempérament pour toute l'app : les choses ne « surgissent » pas,
   elles arrivent — un fondu court et un léger mouvement vers leur place,
   avec la même courbe partout. Les animations d'entrée tiennent à ce qu'un
   élément passe de `display: none` à affiché (écrans, modales, panneaux) ou
   vient d'être inséré (listes reconstruites) : aucune ligne de JS n'est
   nécessaire pour elles. Les sélecteurs `:where()` ont une spécificité nulle,
   pour que les animations plus précises (glissements de navigation, rebond
   de l'XP…) gardent toujours la main. « Réduire les animations » coupe tout,
   en fin de section.
   ===================================================================== */
:root {
    --ease-out: cubic-bezier(0.22, 0.61, 0.36, 1);
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --dur-base: 280ms;
    --dur-calm: 420ms;
}

/* Écrans : toute ouverture d'écran se fait en fondu + légère montée.
   Les écrans qui ont déjà leur propre mouvement (.screen-slide-*, .screen-fade-*)
   le gardent. */
@keyframes motionScreenIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

:where(body > div[id^="screen-"]:not(.hidden)) {
    animation: motionScreenIn var(--dur-base) var(--ease-out) backwards;
}

/* Modales : le voile se fond, le panneau monte en se posant. */
@keyframes motionOverlayIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes motionModalIn {
    from {
        opacity: 0;
        transform: translateY(18px) scale(0.97);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

:where(.modal-overlay:not(.hidden)) {
    animation: motionOverlayIn var(--dur-base) ease-out backwards;
}

:where(.modal-overlay:not(.hidden) .modal-content) {
    animation: motionModalIn var(--dur-base) var(--ease-out) backwards;
}

/* La fiche d'événement reste ouverte quand on passe d'un événement lié à un
   autre : son contenu se renouvelle d'un fondu plutôt que de changer d'un coup. */
@keyframes motionSwap {
    from {
        opacity: 0.25;
        transform: translateY(6px);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

.modal-content.modal-swap {
    animation: motionSwap var(--dur-base) var(--ease-out);
}

/* Panneaux qui se dévoilent après une réponse (verdict, année, badge de
   résultat, bouton « Continuer »…). */
@keyframes motionReveal {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

:where(.curseur-verdict, .avap-option-year, .ecart-pair-year, .fil-answer-badge, .geo-reveal-label, #geo-continue-btn):not(.hidden),
:where(details[open] > :not(summary)) {
    animation: motionReveal var(--dur-base) var(--ease-out) backwards;
}

/* Frise : la carte posée arrive à sa place (fondu, léger rebond, halo vert)
   au lieu d'être déjà là. Variante « manquée » : elle arrive sans halo, puis
   rougit un instant (voir .entry-reveal). */
@keyframes entryLand {
    0% {
        opacity: 0;
        transform: translateY(-14px) scale(0.95);
        box-shadow: 0 0 0 0 rgba(30, 142, 62, 0.3);
    }

    55% {
        opacity: 1;
        transform: translateY(0) scale(1.025);
        box-shadow: 0 0 0 7px rgba(30, 142, 62, 0);
    }

    100% {
        opacity: 1;
        transform: none;
        box-shadow: 0 0 0 0 rgba(30, 142, 62, 0);
    }
}

@keyframes entryArrive {
    from {
        opacity: 0;
        transform: translateY(-10px) scale(0.97);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

/* Les intervalles que la pose vient de créer se déploient en fondu pendant
   que les repères voisins glissent vers leur nouvelle place (voir
   timelineFlipPlay). */
@keyframes slotIn {
    from {
        opacity: 0;
        transform: scaleY(0.4);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

.slot-new {
    animation: slotIn var(--dur-calm) var(--ease-out) backwards;
    transform-origin: top center;
}

/* Carte « en main » : chaque nouvel événement arrive par le bas. */
@keyframes handCardIn {
    from {
        opacity: 0;
        transform: translateY(18px);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

.hand-card.hand-card-in {
    animation: handCardIn var(--dur-calm) var(--ease-out) backwards;
}

/* La date de la carte se dévoile (réponse fausse) : elle se retourne
   brièvement, et la bordure en pointillés devient pleine en douceur. */
.hand-year {
    transition: border-color var(--dur-base) ease, background-color var(--dur-base) ease;
}

@keyframes handYearReveal {
    0% {
        opacity: 0.2;
        transform: scale(0.7);
    }

    60% {
        opacity: 1;
        transform: scale(1.12);
    }

    100% {
        transform: scale(1);
    }
}

.hand-revealed .hand-year {
    animation: handYearReveal 0.5s var(--ease-out);
}

/* Score : le nombre « rebondit » quand il change ; une vie perdue se gonfle
   avant de se vider (voir initMotion). */
[id$="hud-score"] {
    display: inline-block;
}

@keyframes scoreBump {
    0% {
        transform: scale(1);
    }

    40% {
        transform: scale(1.35);
        color: var(--amber);
    }

    100% {
        transform: scale(1);
    }
}

.score-bump {
    animation: scoreBump 0.45s var(--ease-out);
}

@keyframes pipLost {
    from {
        transform: scale(2);
        background: var(--danger-red);
        border-color: var(--danger-red);
    }

    to {
        transform: scale(1);
    }
}

.pip.pip-lost {
    animation: pipLost 0.5s var(--ease-out);
}

/* Écran de fin : le titre, le score, les gains puis le reste arrivent l'un
   après l'autre. (L'XP et la série ont leur propre rebond, qui reste prioritaire.) */
:where(#screen-end:not(.hidden) .end-content-wrapper) > * {
    animation: staggerIn var(--dur-calm) var(--ease-out) backwards;
    animation-delay: calc(var(--fx-i, 0) * 70ms + 120ms);
}

/* Listes qui se remplissent d'un coup : leurs cartes arrivent en cascade
   (les dix premières seulement — le reste est déjà hors de vue). La classe
   .fx-cascade se pose dans index.html, ou par applyCascade() en JS. */
.fx-cascade > :nth-child(-n+10) {
    animation: staggerIn var(--dur-calm) var(--ease-out) backwards;
    animation-delay: calc(var(--fx-i, 0) * 45ms);
}

.fx-cascade > :nth-child(1) { --fx-i: 0; }
.fx-cascade > :nth-child(2) { --fx-i: 1; }
.fx-cascade > :nth-child(3) { --fx-i: 2; }
.fx-cascade > :nth-child(4) { --fx-i: 3; }
.fx-cascade > :nth-child(5) { --fx-i: 4; }
.fx-cascade > :nth-child(6) { --fx-i: 5; }
.fx-cascade > :nth-child(7) { --fx-i: 6; }
.fx-cascade > :nth-child(8) { --fx-i: 7; }
.fx-cascade > :nth-child(9) { --fx-i: 8; }
.fx-cascade > :nth-child(10) { --fx-i: 9; }

/* Groupes de modes repliables : le contenu qui se déplie arrive en cascade. */
:where(.modes-group:not(.collapsed) .modes-group-body) > :nth-child(-n+10) {
    animation: staggerIn var(--dur-calm) var(--ease-out) backwards;
    animation-delay: calc(var(--fx-i, 0) * 45ms);
}

:where(.modes-group:not(.collapsed) .modes-group-body) > :nth-child(1) { --fx-i: 0; }
:where(.modes-group:not(.collapsed) .modes-group-body) > :nth-child(2) { --fx-i: 1; }
:where(.modes-group:not(.collapsed) .modes-group-body) > :nth-child(3) { --fx-i: 2; }
:where(.modes-group:not(.collapsed) .modes-group-body) > :nth-child(4) { --fx-i: 3; }
:where(.modes-group:not(.collapsed) .modes-group-body) > :nth-child(5) { --fx-i: 4; }
:where(.modes-group:not(.collapsed) .modes-group-body) > :nth-child(6) { --fx-i: 5; }
:where(.modes-group:not(.collapsed) .modes-group-body) > :nth-child(7) { --fx-i: 6; }
:where(.modes-group:not(.collapsed) .modes-group-body) > :nth-child(8) { --fx-i: 7; }
:where(.modes-group:not(.collapsed) .modes-group-body) > :nth-child(9) { --fx-i: 8; }
:where(.modes-group:not(.collapsed) .modes-group-body) > :nth-child(10) { --fx-i: 9; }

:where(#screen-end .end-content-wrapper) > :nth-child(1) { --fx-i: 0; }
:where(#screen-end .end-content-wrapper) > :nth-child(2) { --fx-i: 1; }
:where(#screen-end .end-content-wrapper) > :nth-child(3) { --fx-i: 2; }
:where(#screen-end .end-content-wrapper) > :nth-child(4) { --fx-i: 3; }
:where(#screen-end .end-content-wrapper) > :nth-child(5) { --fx-i: 4; }
:where(#screen-end .end-content-wrapper) > :nth-child(6) { --fx-i: 5; }
:where(#screen-end .end-content-wrapper) > :nth-child(7) { --fx-i: 6; }
:where(#screen-end .end-content-wrapper) > :nth-child(8) { --fx-i: 7; }
:where(#screen-end .end-content-wrapper) > :nth-child(9) { --fx-i: 8; }
:where(#screen-end .end-content-wrapper) > :nth-child(10) { --fx-i: 9; }

@media (prefers-reduced-motion: reduce) {

    :where(body > div[id^="screen-"]:not(.hidden)),
    :where(.modal-overlay:not(.hidden)),
    :where(.modal-overlay:not(.hidden) .modal-content),
    .modal-content.modal-swap,
    :where(.curseur-verdict, .avap-option-year, .ecart-pair-year, .fil-answer-badge, .geo-reveal-label, #geo-continue-btn):not(.hidden),
    :where(details[open] > :not(summary)),
    .slot-new,
    .hand-card.hand-card-in,
    .hand-revealed .hand-year,
    .score-bump,
    .pip.pip-lost,
    :where(#screen-end:not(.hidden) .end-content-wrapper) > *,
    .fx-cascade > :nth-child(-n+10),
    :where(.modes-group:not(.collapsed) .modes-group-body) > :nth-child(-n+10) {
        animation: none;
    }

    .hand-year {
        transition: none;
    }
}

/* Découvrir › Pays : la bannière de la fête nationale du jour, au-dessus de la fiche ; le bouton « Un autre pays » en bas d'écran. */
.tool-countries-festive {
    margin: 0 0 10px;
    padding: 10px 14px;
    border-radius: 12px;
    background: #fff4d6;
    color: #7c2d12;
    font-weight: 700;
    text-align: center;
}

[data-theme="dark"] .tool-countries-festive {
    background: #3d3316;
    color: #fde68a;
}

.tool-countries-another {
    display: block;
    width: 100%;
    margin: 16px 0 8px;
}

/* Le quiz des pays (js/modes/geoquiz.js) : une question à la fois, quatre réponses, puis le score. */
.geoquiz-play,
.geoquiz-end {
    width: 100%;
    max-width: 560px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.geoquiz-end {
    align-items: center;
    text-align: center;
    margin-top: 24px;
}

.geoquiz-card {
    background: var(--surface);
    border: 2px solid var(--border-soft);
    border-radius: 14px;
    padding: 16px 18px;
}

.geoquiz-ask {
    margin: 0 0 8px;
    font-size: 19px;
    font-weight: 700;
    color: var(--text-dark);
}

.geoquiz-clues {
    margin: 0;
    padding-left: 18px;
    color: var(--text-dark);
}

.geoquiz-options {
    display: grid;
    gap: 10px;
}

/* La question et les réponses sont espacées comme les réponses entre elles. */
.geoquiz-qcm {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.geoquiz-feedback {
    min-height: 1.5em;
    margin: 0;
    font-weight: 600;
}

.geoquiz-menu {
    width: 100%;
    max-width: 560px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Le drapeau seul, en grand : c'est l'indice entier du mode « drapeau → pays ». */
.geoquiz-flag {
    font-size: 72px;
    line-height: 1.1;
    list-style: none;
    margin: 4px 0;
    padding-left: 0;
    text-align: center;
}

/* La carte des villes : la mire (même style que celle du Mode Carte) n'apparaît que lorsque la carte a le focus clavier ; Entrée pose alors le repère
   en son centre. */
.cities-map-frame {
    position: relative;
}

#cities-map:focus-visible+.cities-crosshair {
    display: block;
}

/* « Ville de l'histoire » : le fait à situer (titre, année et thème), puis sa description une fois la réponse donnée. */
.cities-fact {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border-soft);
}

.cities-fact-title {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: var(--text-dark);
}

.cities-fact-desc {
    margin: 8px 0 0;
    font-size: 14px;
    line-height: 1.45;
    color: var(--text-dark);
}

/* La progression et le score courant, sur une même ligne au-dessus de la question. */
/* « Quelle est cette ville ? » : la photo, pleine largeur dans le téléphone, et ses crédits dessous. */
.cities-photo {
    margin: 0 0 16px;
}

.cities-photo img {
    display: block;
    width: 100%;
    max-width: 480px;
    height: auto;
    border-radius: 12px;
}

.cities-photo figcaption {
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* Le crédit des données, sous le menu et les parties : un peu d'air après le dernier bouton. */
#cities-credit {
    margin-top: 24px;
}

.cities-bar {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin: 0;
}

.geoquiz-locate {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Une carte pleine largeur, assez haute pour toucher un petit pays ; le quiz n'a pas de noms à lire dessus. */
.geoquiz-map {
    width: 100%;
    height: 52vh;
    min-height: 260px;
    border-radius: 14px;
    overflow: hidden;
}

.geoquiz-score {
    margin: 0;
    font-size: 24px;
    font-weight: 800;
    color: var(--text-dark);
}

/* Le choix d'année du calendrier : un champ, et une note sur le calcul des fêtes mobiles. */
.cal-year-pick {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
    max-width: 720px;
    margin: 0 auto 10px;
}

.cal-year-pick label {
    font-weight: 600;
    color: var(--text-dark);
}

.cal-year-pick input {
    width: 110px;
}

.cal-year-pick .cal-today-btn {
    width: auto;
    padding: 8px 16px;
}

.cal-year-pick .tool-small {
    flex: 1 1 100%;
    margin: 0;
}

/* Le calendrier annuel : une liste de 366 jours, des mois en titres, une barre pour aller à un mois ; en colonnes sur grand écran. */
.cal-months {
    display: flex;
    flex: 0 0 auto;   /* l'écran est en flex : sans cela la barre s'écrase et ses boutons disparaissent */
    gap: 8px;
    overflow-x: auto;   /* la barre défile seule, à la largeur de l'écran : jamais de défilement horizontal de la page */
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    padding: 4px 2px 12px;
    margin: 0 auto;
    max-width: 720px;
    scrollbar-width: none;
}

.cal-months::-webkit-scrollbar {
    display: none;
}

.cal-month-btn {
    flex: 0 0 auto;
    padding: 8px 14px;
    border-radius: 9999px;
    border: 1px solid var(--border-soft);
    background: var(--surface);
    color: var(--text-dark);
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
}

.cal-year {
    max-width: 720px;
    margin: 0 auto;
    padding-bottom: 32px;
}

.cal-month {
    margin-bottom: 18px;
}

/* Le titre du mois reste en haut de l'écran pendant qu'on fait défiler le mois. Sa bande est pleine largeur, opaque (rien ne
   transparaît dessus), et son retrait à gauche laisse la place à la flèche « Retour », fixe en haut à gauche. */
.cal-month-title {
    position: sticky;
    top: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    box-sizing: border-box;
    width: 100%;
    min-height: 56px;
    margin: 0 0 6px;
    padding: 8px 4px 8px 66px;
    font-size: 18px;
    background: var(--bg-color);
    color: var(--text-dark);
}

.cal-row {
    display: flex;
    gap: 14px;
    padding: 8px 10px;
    border-bottom: 1px solid var(--border-soft);
    align-items: baseline;
}

.cal-row.is-empty .cal-date {
    color: var(--muted-text);
    font-weight: 400;
}

.cal-row.is-today {
    background: #fff4d6;
    border-radius: 10px;
}

[data-theme="dark"] .cal-row.is-today {
    background: #3d3316;
}

.cal-date {
    flex: 0 0 104px;
    font-weight: 700;
    color: var(--text-dark);
    font-size: 14px;
}

.cal-feasts {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    font-size: 14px;
}

.cal-country {
    color: var(--text-dark);
}

.cal-religious {
    color: var(--muted-text);
    font-style: italic;
}

/* Grand écran : les mois en trois colonnes, pour voir l'année d'un coup d'œil. */
@media (min-width: 900px) {
    /* Une grille (et non des colonnes CSS) : dans des colonnes, le titre collé en haut ne tient pas. */
    .cal-year {
        max-width: 1100px;
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        column-gap: 28px;
        align-items: start;
    }

    .cal-month {
        margin-bottom: 0;
    }

    /* Grand écran : la flèche Retour est loin du contenu centré, le titre n'a pas besoin de retrait. */
    .cal-month-title {
        padding-left: 4px;
    }

    .cal-months {
        max-width: 1100px;
    }
}
.is-man { background: #dbeafe; }
.is-woman { background: #fce7f3; }
:root { --tr-sheet: 24vh; }

/* --- Les chefs d'État --- */
.leaders-screen { padding-left: 0; padding-right: 0; }
.leaders-screen .header-title { padding: 58px 16px 0; font-size: 22px; }
.leaders-bar { width: 100%; max-width: 620px; padding: 0 16px; box-sizing: border-box; display: flex; flex-direction: column; align-items: center; margin: 0 auto; }
.leaders-bar #leaders-search { width: 100%; max-width: 420px; box-sizing: border-box; }
.leaders-bar .tool-small { text-align: center; margin: 6px 0 0; }
.leaders-note { font-size: 12px; opacity: 0.8; }
.leaders-list { width: 100%; max-width: 620px; padding: 8px 16px 40px; box-sizing: border-box; margin: 0 auto; }
.leader-row.leader-framed { border: 2px solid #64748b; border-radius: 10px; padding: 6px 8px; margin: 4px 0; background: rgba(100, 116, 139, 0.08); }
.leader-row {
    display: flex;
    align-items: stretch;
    gap: 12px;
    padding: 8px 12px;
    border-radius: 10px;
    color: #0f172a;
    margin-bottom: 4px;
}
.leader-dates {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-width: 62px;
    text-align: right;
    font-variant-numeric: tabular-nums;
    font-size: 14px;
    border-right: 2px solid rgba(15, 23, 42, 0.25);
    padding-right: 10px;
}
.leader-to { font-size: 12px; color: #334155; }
.leader-name { display: flex; flex-direction: column; justify-content: center; min-width: 0; }
.leader-name strong { font-size: 15px; }
.leader-name small { font-size: 12px; color: #334155; }
.leader-name .leader-civil { font-size: 11px; color: #64748b; font-style: italic; }
.leaders-divider {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 14px 0 8px;
    color: var(--text-dark, #0f172a);
    font-size: 13px;
    font-weight: bold;
}
.leaders-divider::before,
.leaders-divider::after { content: ''; flex: 1; border-top: 2px solid currentColor; opacity: 0.5; }
.leaders-select {
    margin: 4px 0 0;
    padding: 10px 18px;
    border: 1px solid var(--glass-border);
    border-radius: 999px;
    background: var(--glass-bg);
    color: var(--text-dark);
    /* 16 px au moins : en dessous, iOS zoome sur la page à l'ouverture de la liste. */
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    max-width: 100%;
}
.leaders-select optgroup { font-weight: 600; }
.leaders-select option { font-weight: normal; }
.leaders-modes { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 8px; }
.leaders-modes.hidden { display: none; }
.leaders-mode-btn {
    padding: 6px 14px;
    border: 1px solid #94a3b8;
    border-radius: 14px;
    background: #fff;
    color: #0f172a;
    font-size: 14px;
    cursor: pointer;
}
.leaders-mode-btn[aria-pressed="true"] { background: #2563eb; border-color: #2563eb; color: #fff; }
.leaders-mode-btn.hidden { display: none; }

/* --- Quiz des pays : réglages, chrono, points, fin de partie --- */
.geoquiz-settings { display: flex; flex-direction: column; gap: 14px; }
.geoquiz-setting { display: flex; flex-direction: column; gap: 6px; }
.geoquiz-setting-title { margin: 6px 0 2px; font-size: 15px; font-weight: 800; color: var(--text-dark); }
.geoquiz-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.geoquiz-chip {
    padding: 7px 13px;
    border: 1px solid var(--border-soft);
    border-radius: 16px;
    background: var(--surface);
    color: var(--text-dark);
    font-size: 14px;
    cursor: pointer;
}
.geoquiz-chip[aria-pressed="true"] { background: #2563eb; border-color: #2563eb; color: #fff; }
.geoquiz-secondary { background: var(--surface); color: var(--text-dark); border: 1px solid var(--border-soft); box-shadow: none; }
.geoquiz-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.geoquiz-head .tool-small { margin: 0; }
.geoquiz-points { font-weight: 800; color: var(--text-dark); }
.geoquiz-timer {
    position: relative;
    height: 22px;
    border-radius: 11px;
    background: var(--border-soft);
    overflow: hidden;
}
.geoquiz-timer.hidden { display: none; }
.geoquiz-timer-fill { position: absolute; left: 0; top: 0; bottom: 0; width: 100%; background: #16a34a; transition: width 0.1s linear; }
.geoquiz-timer.is-low .geoquiz-timer-fill { background: #dc2626; }
.geoquiz-timer-text { position: relative; display: block; text-align: center; font-size: 13px; font-weight: 800; line-height: 22px; color: #0f172a; mix-blend-mode: normal; }
.geoquiz-scores { width: 100%; max-width: 560px; display: flex; flex-direction: column; gap: 10px; }
.geoquiz-scores.hidden { display: none; }
.geoquiz-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; text-align: left; }
.geoquiz-list li { padding: 8px 12px; border-radius: 10px; background: var(--surface); border: 1px solid var(--border-soft); color: var(--text-dark); font-size: 14px; }
.geoquiz-detail { margin: 0; color: var(--text-dark); }
.geoquiz-record { margin: 0; font-weight: 700; color: #15803d; }
.geoquiz-errors { width: 100%; }
.geoquiz-end .geoquiz-setting-title { margin-top: 12px; }
#screen-geoquiz > .tool-small:last-child { margin-top: 22px; }
.geoquiz-list li strong { font-weight: 700; }

/* --- Quiz des pays : saisie libre, pays mystère, vies, carte raccourcie --- */
.geoquiz-typed { display: flex; flex-direction: column; gap: 10px; }
.geoquiz-typed .tool-input { width: 100%; box-sizing: border-box; font-size: 18px; }
.geoquiz-map.is-short { height: 34vh; min-height: 200px; }
.geoquiz-lives { margin: 0; font-size: 18px; letter-spacing: 2px; }
.geoquiz-mystery { display: flex; flex-direction: column; gap: 10px; }
.geoquiz-guesses { list-style: decimal inside; }
.geoquiz-guesses li { font-variant-numeric: tabular-nums; }
.geoquiz-head { flex-wrap: wrap; }

/* --- Quiz des pays : défi du jour, pays faibles, maîtrise --- */
.geoquiz-mastery { width: 100%; max-width: 560px; display: flex; flex-direction: column; gap: 10px; }
.geoquiz-mastery.hidden { display: none; }
.geoquiz-legend { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 14px; color: var(--text-dark); }
.geoquiz-dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; vertical-align: -1px; border: 2px solid transparent; }
.geoquiz-zone-block { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.geoquiz-zone-title { margin: 0; font-size: 15px; font-weight: 800; color: var(--text-dark); }
.geoquiz-bar { height: 8px; border-radius: 4px; background: var(--border-soft); overflow: hidden; }
.geoquiz-bar span { display: block; height: 100%; background: #16a34a; }
.geoquiz-grid { display: flex; flex-wrap: wrap; gap: 4px; }
.geoquiz-cell { width: 34px; height: 30px; display: inline-flex; align-items: center; justify-content: center; font-size: 20px; border-radius: 6px; border: 2px solid transparent; box-sizing: border-box; }
.geoquiz-m-mastered { border-color: #16a34a; background: rgba(22, 163, 74, 0.16); }
.geoquiz-m-learning { border-color: #f59e0b; background: rgba(245, 158, 11, 0.16); }
.geoquiz-m-weak { border-color: #dc2626; background: rgba(220, 38, 38, 0.16); }
.geoquiz-m-new { border-color: var(--border-soft); background: transparent; opacity: 0.55; }
.geoquiz-dot.geoquiz-m-new { opacity: 1; background: var(--border-soft); }
.geoquiz-dot.geoquiz-m-mastered { background: #16a34a; }
.geoquiz-dot.geoquiz-m-learning { background: #f59e0b; }
.geoquiz-dot.geoquiz-m-weak { background: #dc2626; }
#geoquiz-menu > .tool-small:empty { display: none; }

/* --- Quiz des pays : duel à deux --- */
.geoquiz-duel-names { display: flex; gap: 8px; }
.geoquiz-duel-names .tool-input { flex: 1; min-width: 0; box-sizing: border-box; }

/* --- Quiz des pays : mes statistiques --- */
#geoquiz-stats-forms li { font-size: 14px; }

/* --- Quiz des pays : progression --- */
.geoquiz-chart { width: 100%; max-width: 420px; }
.geoquiz-chart-svg { width: 100%; height: auto; display: block; }
.geoquiz-chart-line { fill: none; stroke: #2563eb; stroke-width: 2; stroke-linejoin: round; }
.geoquiz-chart-dot { fill: #2563eb; }

/* --- LE DICTIONNAIRE (js/app/dictionnaire.js) --- */
.dict-bar {
    position: sticky;
    /* Le haut de l'écran compte son rembourrage (20px) : à top: 0, la liste se verrait dans cette bande, au-dessus de la barre. */
    top: -20px;
    z-index: 2;
    width: 100%;
    max-width: 520px;
    padding: 8px 0;
    /* Le fond de la page : sans lui, la liste qui défile se voit à travers et autour du champ. */
    background: var(--bg-color);
}

/* Sur téléphone, collée en haut, la barre déborde jusqu'aux bords de l'écran (pour que la liste ne se voie pas derrière le bouton de retour,
   fixe, en haut à gauche) et son champ se décale à droite de ce bouton. */
@media (max-width: 600px) {
    .dict-bar {
        transition: padding 0.2s ease;
    }
    .dict-bar.is-stuck {
        margin-left: -20px;
        margin-right: -20px;
        width: calc(100% + 40px);
        max-width: none;
        padding: 16px 20px 8px 82px;
    }
}

.dict-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
    width: 100%;
    max-width: 520px;
    margin-bottom: 8px;
}

.dict-filters .tool-input {
    flex: 1 1 180px;
    min-width: 0;
}

.dict-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 44px;
    font-size: 14px;
    font-weight: 700;
    color: var(--text-dark);
}

.dict-letters {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px;
    width: 100%;
    max-width: 520px;
    margin: 4px 0;
}

.dict-letter-btn {
    min-width: 32px;
    min-height: 32px;
    padding: 0 6px;
    border: 1px solid var(--border-soft);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text-dark);
    font: inherit;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}

.dict-list {
    width: 100%;
    max-width: 520px;
    display: flex;
    flex-direction: column;
}

.dict-letter {
    scroll-margin-top: 120px;
    margin: 14px 0 4px;
    font-size: 15px;
    font-weight: 800;
    color: var(--muted-text);
}

.dict-item {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 2px 10px;
    width: 100%;
    min-height: 44px;
    padding: 8px 10px;
    border: 0;
    border-bottom: 1px solid var(--border-soft);
    background: transparent;
    color: var(--text-dark);
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.dict-item small {
    color: var(--muted-text);
    font-size: 12px;
}

.dict-jury {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-dark);
    border: 1px solid var(--border-soft);
    border-radius: 999px;
    padding: 1px 8px;
}

.dict-term {
    align-items: stretch;
    text-align: left;
}

.dict-section h3 {
    margin: 0 0 4px;
    font-size: 15px;
    font-weight: 800;
    color: var(--text-dark);
    border-left: 3px solid var(--text-dark);
    padding-left: 10px;
}

.dict-section p {
    margin: 0 0 0 13px;
    color: var(--muted-text);
    line-height: 1.5;
}

.dict-examples {
    margin: 0 0 0 13px;
    padding-left: 18px;
    color: var(--muted-text);
    line-height: 1.5;
}

.dict-examples li + li {
    margin-top: 4px;
}

.dict-jury-note {
    margin: 0;
    font-size: 13px;
    color: var(--muted-text);
}

.dict-near {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-left: 13px;
}

.dict-near-btn {
    min-height: 44px;
    padding: 8px 14px;
    border: 1px solid var(--border-soft);
    border-radius: 12px;
    background: var(--surface);
    color: var(--text-dark);
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

/* --- LES CITATIONS (js/app/citations.js) : la barre, les filtres et la fiche réutilisent ceux du dictionnaire --- */
.cit-order {
    margin: 0 0 4px;
}

.cit-list {
    width: 100%;
    max-width: 520px;
    display: flex;
    flex-direction: column;
    margin-bottom: 12px;
}

.cit-item {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    width: 100%;
    min-height: 44px;
    padding: 10px;
    border: 0;
    border-bottom: 1px solid var(--border-soft);
    background: transparent;
    color: var(--text-dark);
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.cit-item-text {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-style: italic;
    line-height: 1.4;
}

.cit-item-meta {
    color: var(--muted-text);
    font-size: 12px;
}

.cit-badge {
    font-size: 11px;
    font-weight: 700;
    border: 1px solid var(--border-soft);
    border-radius: 999px;
    padding: 1px 8px;
    color: var(--text-dark);
}

.cit-quote {
    margin: 0 0 4px;
    padding: 4px 0 4px 14px;
    border-left: 3px solid var(--text-dark);
    font-size: 19px;
    font-style: italic;
    line-height: 1.45;
    color: var(--text-dark);
}

/* La version originale est sur sa propre ligne, un vers par ligne (\n dans les données) : dir="auto" la range à droite pour l'hébreu, l'arabe ou le persan. */
.cit-original span {
    display: block;
    white-space: pre-line;
    text-align: start;
    margin-top: 2px;
}

.cit-status,
.cit-original {
    margin: 0 0 0 13px;
    font-size: 14px;
    line-height: 1.5;
    color: var(--muted-text);
}

.cit-status {
    font-weight: 700;
    color: var(--text-dark);
}

.cit-links {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 8px;
}

/* Rapports du jury : le document occupe tout l'écran (le document a son propre titre). Le bouton « retour » reste par-dessus,
   avec son z-index de .back-btn. */
#screen-rapport {
    padding: 0;
    overflow: hidden;
}

.rapport-frame {
    position: fixed;
    inset: 0;
    z-index: 0;
    display: block;
    width: 100%;
    height: 100%;
    height: 100dvh;
    margin: 0;
    border: 0;
    border-radius: 0;
    background: #fff;
}

.rapports-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 0 16px;
}

/* Méthodologie (voir js/app/methodologie.js) : même traitement plein écran que #screen-rapport,
   un seul document donc pas de liste intermédiaire. */
#screen-methodologie {
    padding: 0;
    overflow: hidden;
}

.methodologie-frame {
    position: fixed;
    inset: 0;
    z-index: 0;
    display: block;
    width: 100%;
    height: 100%;
    height: 100dvh;
    margin: 0;
    border: 0;
    border-radius: 0;
    background: #fff;
}

/* --- Michkan et Mikdash (js/app/mishkan.js) : schémas SVG dessinés en coudées ; les couleurs sont celles de la matière --- */
:root {
    --mkn-gold: #d4a72c; --mkn-copper: #c27a4a; --mkn-copper-dark: #8f5230; --mkn-silver: #aab3bb; --mkn-wood: #8a5a36;
    --mkn-blue: #2b4c94; --mkn-purple: #7a4a9a; --mkn-scarlet: #b3262f; --mkn-linen: #efe8d6; --mkn-goat: #3b3430; --mkn-tachash: #6f7f8a; --mkn-skin: #e2b896;
}

/* --- Mini-jeux sur des axes choisis : cartes trop petites pour le vivier --- */
.arcade-card.is-unavailable { opacity: 0.55; cursor: not-allowed; }
.arcade-why { color: var(--muted-text); font-style: italic; }

/* « Mini-jeux » à droite de « Continuer » : le libellé ne se coupe pas au tiret sur téléphone. */
#axes-minigames-btn { white-space: nowrap; }

/* Barre d'action de l'écran des axes : « Continuer » et « Mini-jeux » restent en bas de l'écran.
   Collante dans le défilement (et poussée en bas quand la liste est courte), elle ne dépend pas
   d'un position: fixed qui se comporte mal sous les transitions d'écran. Le bas de l'écran n'a plus
   de marge : la barre affleure le bord, et sa marge basse est celle de la zone de sécurité iOS. */
#screen-axes { padding-bottom: 0; }
#axes-container { margin-bottom: 16px; }
.axes-action-bar {
    position: sticky;
    bottom: 0;
    z-index: 5;
    align-self: stretch;
    margin: auto -20px 0;
    padding: 12px 20px calc(12px + var(--sab));
    box-sizing: border-box;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    background: var(--bg-color);
    box-shadow: 0 -6px 16px rgba(0, 0, 0, 0.06);
}
/* Une seule ligne par bouton : la taille du libellé suit la largeur de l'écran (320 px à 16 px et plus). */
.axes-action-bar .btn {
    flex: 0 0 auto;
    min-width: 0;
    padding: 12px 16px;
    font-size: clamp(13px, 3.9vw, 16px);
    white-space: nowrap;
}
#axes-continue-btn { flex: 0 1 auto; }
.lex-level { display: inline-flex; align-items: center; gap: 8px; flex-basis: 100%; font-size: 12px; color: var(--muted-text); }
.lexgame-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.lex-train-btn { align-self: flex-start; }

/* « Mots essentiels » : le bilan de départ, la barre de progression, le compteur du dictionnaire */
.lexgame-setup { display: flex; flex-direction: column; align-items: center; gap: 12px; width: 100%; max-width: 520px; text-align: center; }
.lexgame-progress-text { margin: 0; font-size: 18px; font-weight: 700; color: var(--text-dark); }
.lexgame-bar { width: 100%; height: 12px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border-soft); overflow: hidden; }
.lexgame-bar i { display: block; height: 100%; width: 0; background: var(--progress-green); }
.lex-train-btn { display: inline-flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; }
.lex-train-btn small { font-size: 12px; font-weight: 400; opacity: .85; }

/* « Mots essentiels », étape 3 : le choix du niveau, les questions en français ou en nombres */
.lexgame-levels { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }

/* « Mots proches » (js/app/dictionnaire-game.js) : le début de la définition à reconnaître, et l'explication après la réponse */
.dictgame-prompt { margin: 0 0 16px; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border-soft); font-size: 17px; line-height: 1.45; color: var(--text-dark); }
.dictgame-weak { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.dictgame-weak.hidden { display: none; }
#dictgame-domain { width: 100%; max-width: 100%; box-sizing: border-box; }
#dictgame-play .wheel-feedback { margin-top: 12px; }
#dictgame-feedback strong { display: block; margin-bottom: 4px; }
#dictgame-feedback-body p { margin: 0 0 8px; }
#dictgame-feedback-body strong { display: inline; }
.sta-group-title { margin: 6px 0 0; }
.sta-role-title { font-size: 13px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted-text); }

/* Ce jour-là dans l'histoire (js/app/onthisday.js) */
.onthisday-pick {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
    max-width: 720px;
    margin: 0 auto 10px;
}
.onthisday-pick label { font-weight: 600; color: var(--text-dark); }
.onthisday-pick select { min-width: 120px; }
.onthisday-title { max-width: 720px; margin: 12px auto 6px; font-size: 1.15rem; font-weight: 700; }
.onthisday-list { list-style: none; margin: 0 auto; padding: 0; max-width: 720px; display: grid; gap: 12px; }
.onthisday-entry { padding: 12px 14px; border-radius: 10px; background: var(--surface, rgba(0, 0, 0, 0.04)); }
.onthisday-entry.is-phare { border: 2px solid var(--accent, #b8860b); }
.onthisday-badge { display: inline-block; margin-bottom: 4px; font-size: 0.8rem; font-weight: 700; color: var(--accent, #b8860b); }
.onthisday-year { margin: 0; font-size: 0.85rem; opacity: 0.75; }
.onthisday-entry-title { margin: 2px 0 6px; font-size: 1.05rem; font-weight: 700; }
.onthisday-text { margin: 0 0 6px; line-height: 1.5; }
.onthisday-julian { margin: 0 0 6px; }
.onthisday-link { font-size: 0.9rem; }
@media (max-width: 380px) { .onthisday-pick select { min-width: 0; flex: 1 1 100%; } }

/* --- Atlas des écritures (Atelier) --- */
.tool-writing-sample {
    /* « HX Ecritures » : les polices Noto réduites aux signes des exemples (css/fonts.css) ; le reste vient de la police de l'interface. */
    font-family: 'HX Ecritures', var(--font-main), sans-serif;
    margin: 4px 0;
    padding: 12px 14px;
    border-radius: 12px;
    background: var(--surface-2);
    font-size: 22px;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

.tool-writing-sample[dir="rtl"] {
    text-align: right;
}

.tool-writing-translit {
    margin: 0 0 4px;
    font-style: italic;
    color: var(--muted-text);
    font-size: 14px;
}

.tool-writing-fonthint {
    opacity: 0.8;
}

.tool-writing-legend-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
}

.tool-writing-help {
    flex: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid var(--border-soft);
    background: var(--surface-2);
    color: var(--text-dark);
    font-weight: 700;
    font-size: 16px;
    cursor: pointer;
}

.tool-writing-help[aria-expanded="true"] {
    border-color: var(--text-dark);
    box-shadow: var(--card-shadow);
}

.tool-writing-type {
    margin-bottom: 10px;
}

.tool-writing-type .tool-h {
    margin: 0 0 2px;
}

.tool-writing-example {
    padding: 0;
    border: 0;
    background: none;
    color: inherit;
    font: inherit;
    text-decoration: underline;
    cursor: pointer;
}

.tool-writing-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 14px;
    margin: 0;
    padding: 0;
    list-style: none;
    font-size: 14px;
    color: var(--text-dark);
}

.tool-writing-reveal {
    margin: 4px 0 8px;
    padding: 10px 12px;
    border-radius: 12px;
    background: var(--surface-2);
}

.tool-writing-reveal p {
    margin: 2px 0;
}

.tool-writing-play {
    margin: 10px 0;
}

/* Le crédit sous une partie (Villes du monde, Quiz des écritures) ne colle pas au bouton « Question suivante ». */
#cities-credit,
#screen-writingquiz > .tool-small:last-child {
    margin-top: 24px;
}

.tool-area-reveal-list {
    margin: 4px 0 0;
    padding-left: 22px;
    font-size: 14px;
}

/* ← Langue → : la langue de l'exemple d'une écriture, et les flèches pour passer à l'autre. */
.tool-writing-lang {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin: 2px 0 6px;
}

.tool-writing-lang-name {
    flex: 1;
    text-align: center;
    font-weight: 700;
    color: var(--text-dark);
}

.tool-writing-lang-name small {
    font-weight: 400;
    color: var(--muted-text);
}

.tool-writing-arrow {
    flex: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 0;
    background: var(--primary-blue);
    color: #fff;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
}

/* La flèche qui n'a plus de langue de son côté disparaît mais garde sa place : le nom de la langue reste centré. */
.tool-writing-arrow.is-off {
    visibility: hidden;
}

.tool-writing-lang.is-single .tool-writing-arrow {
    display: none;
}

.tool-writing-choice {
    text-align: left;
}
@keyframes tanakhNavFlash { 0% { box-shadow: 0 0 0 0 rgba(47, 111, 237, 0.55); } 60% { box-shadow: 0 0 0 10px rgba(47, 111, 237, 0); } 100% { box-shadow: 0 0 0 0 rgba(47, 111, 237, 0); } }
/* body > [id^="screen-"] ajoute déjà la zone de sécurité haute à chaque écran ; la barre du rouleau la prend en charge
   elle-même : sans cette règle, elle était appliquée deux fois, d'où l'espace vide au-dessus de « Retour - Béréchit - ? ». */
#screen-torah-reader { padding-top: 0; }
.dict-toggle[hidden] { display: none; }


/* --- LA CARTE PHYSIQUE DU MONDE (js/app/physical-maps.js) --- */
.phys-check {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 44px;
    font-size: 15px;
    color: var(--text-dark);
    cursor: pointer;
}

.phys-check input {
    width: 20px;
    height: 20px;
}

.phys-play {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.phys-progress {
    margin: 0;
    font-size: 13px;
    color: var(--text-soft, var(--text-dark));
}

.phys-prompt {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: var(--text-dark);
}

.phys-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.phys-actions .btn:disabled {
    opacity: 0.5;
}

.phys-actions .btn.hidden {
    display: none;
}

.phys-guess {
    width: 18px;
    height: 18px;
    border: 3px solid #ffffff;
    border-radius: 50%;
    background: #e11d48;
    box-shadow: 0 0 0 1.5px #111827, 0 2px 6px rgba(0, 0, 0, 0.4);
}

.phys-result {
    margin: 0 0 4px;
    font-weight: 700;
    color: var(--text-dark);
}

.phys-result.is-exact { color: #15803d; }
.phys-result.is-far { color: #b91c1c; }

:root[data-theme="dark"] .phys-result.is-exact { color: #4ade80; }
:root[data-theme="dark"] .phys-result.is-far { color: #f87171; }

.phys-facts {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 4px 12px;
    margin: 6px 0;
    font-size: 14px;
    color: var(--text-dark);
}

.phys-facts dt {
    font-weight: 700;
}

.phys-facts dd {
    margin: 0;
}

.phys-note {
    margin: 6px 0;
    font-size: 14px;
    color: var(--text-dark);
}

.phys-mastery {
    margin: 6px 0;
    font-size: 14px;
    font-weight: 700;
}

.phys-mastery.is-mastered { color: #15803d; }
.phys-mastery.is-weak { color: #b45309; }
.phys-mastery.is-learning { color: var(--text-dark); }

:root[data-theme="dark"] .phys-mastery.is-mastered { color: #4ade80; }
:root[data-theme="dark"] .phys-mastery.is-weak { color: #fbbf24; }
@media (prefers-reduced-motion: no-preference) {
    @keyframes zm-pulse { 0%, 100% { opacity: 0.6; } 50% { opacity: 1; } }
}

/* Zmanim en hébreu (bouton « A / א ») : la mise en page s'inverse (dir="rtl") : le nom du moment à droite, l'heure à gauche. */
/* Le bouton « A / א » : en haut à droite, à la hauteur du bouton « Retour » (fixe), mais posé dans la page : il défile avec elle et disparaît. */
#screen-tool-zmanim { position: relative; }
#screen-tool-zmanim .header-title { padding: 0 92px; box-sizing: border-box; width: 100%; }

/* =========================================================================
   RÉCITS (js/app/recits.js) : la liste, la carte de l'accueil, le lecteur
   et la fiche d'un mot souligné. Le lecteur imite une page de livre : police
   à empattements, colonne étroite, texte justifié et césuré.
   ========================================================================= */
:root {
    --recit-paper: #FBF8F2;
    --recit-ink: #2A2420;
    --recit-ink-soft: #6B5F55;
    --recit-accent: #7A2E5C;
    --recit-rule: #E4DCCD;
    --recit-box: #F3ECDF;
    --font-recit: Georgia, "Iowan Old Style", "Palatino Linotype", "Times New Roman", serif;
}
:root[data-theme="dark"] {
    --recit-paper: #181B21;
    --recit-ink: #E9E4DC;
    --recit-ink-soft: #A79E93;
    --recit-accent: #E39BC4;
    --recit-rule: #2F3540;
    --recit-box: #21262F;
}

/* --- La liste --- */
.recits-list {
    width: 100%;
    max-width: 760px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 16px;
    padding-bottom: 40px;
}
.recit-card {
    display: flex;
    gap: 16px;
    width: 100%;
    padding: 14px;
    text-align: left;
    border: 1px solid var(--border-soft);
    border-radius: 18px;
    background: var(--card-bg);
    color: var(--text-dark);
    box-shadow: var(--card-shadow);
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}
.recit-card:hover { transform: translateY(-2px); box-shadow: var(--card-shadow-hover); }
.recit-card-img {
    width: 112px;
    height: 140px;
    flex-shrink: 0;
    object-fit: cover;
    border-radius: 10px;
}
.recit-card-body { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.recit-card-title { font-family: var(--font-recit); font-size: 20px; font-weight: 700; color: var(--primary-blue); }
:root[data-theme="dark"] .recit-card-title { color: var(--text-dark); }
.recit-card-sub { font-family: var(--font-recit); font-style: italic; font-size: 15px; color: var(--muted-text); }
.recit-card-resume { font-size: 14px; line-height: 1.45; margin-top: 4px; }
.recit-card-meta { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 6px; font-size: 13px; color: var(--muted-text); }
.recit-card-status { font-weight: 700; color: var(--recit-accent); }
.recit-card-status.is-done { color: var(--success-text); }
@media (max-width: 480px) {
    .recit-card-img { width: 84px; height: 112px; }
    .recit-card-resume { display: none; }
}

/* --- La carte de l'accueil --- */
.recits-home { width: 100%; margin-top: 20px; }
.recits-home-card {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 18px 12px 12px;
    border: 1px solid var(--recit-rule);
    border-radius: 24px;
    background: var(--recit-paper);
    color: var(--recit-ink);
    text-align: left;
    cursor: pointer;
    box-shadow: var(--card-shadow);
    transition: transform 0.2s, box-shadow 0.2s;
}
.recits-home-card:hover { transform: translateY(-2px); box-shadow: var(--card-shadow-hover); }
.recits-home-img { width: 64px; height: 80px; object-fit: cover; border-radius: 12px; flex-shrink: 0; }
.recits-home-text { flex: 1; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.recits-home-kicker { font-size: 12px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--recit-accent); }
.recits-home-title { font-family: var(--font-recit); font-size: 19px; font-weight: 700; }
.recits-home-meta { font-size: 13px; color: var(--recit-ink-soft); }
.recits-home-bar { display: block; height: 4px; margin-top: 6px; border-radius: 2px; background: var(--recit-rule); overflow: hidden; }
.recits-home-bar-fill { display: block; height: 100%; background: var(--recit-accent); }
.recits-home-card .gallery-launcher-chevron { color: var(--recit-ink-soft); }

/* --- Le lecteur --- */
.list-screen.recit-screen {
    padding: 0;
    align-items: stretch;
    background: var(--recit-paper);
    color: var(--recit-ink);
}
.recit-bar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: calc(env(safe-area-inset-top, 0px) + 10px) 12px 10px;
    background: color-mix(in srgb, var(--recit-paper) 88%, transparent);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--recit-rule);
}
.recit-bar-btn {
    width: 42px;
    height: 42px;
    flex-shrink: 0;
    border-radius: 50%;
    border: 1px solid var(--recit-rule);
    background: transparent;
    color: var(--recit-ink);
    font-size: 22px;
    font-weight: 700;
    cursor: pointer;
}
.recit-size-btn { font-family: var(--font-recit); font-size: 17px; }
.recit-bar-center { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.recit-dots { display: flex; gap: 2px; }
.recit-dot {
    width: 26px;
    height: 26px;
    border: none;
    background: transparent;
    padding: 0;
    cursor: pointer;
    position: relative;
}
.recit-dot::after {
    content: "";
    position: absolute;
    inset: 8px;
    border-radius: 50%;
    border: 1.5px solid var(--recit-ink-soft);
}
.recit-dot.is-current::after { background: var(--recit-accent); border-color: var(--recit-accent); }
.recit-bar-title {
    max-width: 100%;
    font-family: var(--font-recit);
    font-size: 14px;
    color: var(--recit-ink-soft);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.recit-article {
    width: 100%;
    max-width: 680px;
    margin: 0 auto;
    padding: 24px 20px 80px;
    font-family: var(--font-recit);
    font-size: 18px;
    line-height: 1.65;
    color: var(--recit-ink);
}
/* La règle universelle `*` impose Inter à chaque élément : dans le récit, tout hérite de la police du livre, sauf les
   boutons de navigation et de fin, qui restent ceux de l'app. */
.recit-article *,
.recit-fiche-sheet * { font-family: inherit; }
.recit-article .recit-nav *,
.recit-article .recit-end * { font-family: var(--font-main); }
.recit-article .recit-end .recit-end-title,
.recit-article .recit-end .recit-sources-title { font-family: var(--font-recit); }
.recit-article.recit-size-s { font-size: 16px; }
.recit-article.recit-size-l { font-size: 20px; }
.recit-article.recit-size-xl { font-size: 23px; }
.recit-head { text-align: center; padding: 16px 0 8px; margin-bottom: 8px; border-bottom: 1px solid var(--recit-rule); }
.recit-title { font-size: 1.9em; line-height: 1.15; font-weight: 400; letter-spacing: 0.02em; text-transform: uppercase; color: var(--recit-ink); margin: 0; }
.recit-subtitle { font-style: italic; font-size: 1.05em; color: var(--recit-ink-soft); margin: 10px 0 4px; }
.recit-meta { font-size: 0.78em; color: var(--recit-ink-soft); margin: 0 0 12px; }
.recit-chapter-title { text-align: center; font-size: 1.35em; font-weight: 400; margin: 28px 0 18px; outline: none; }
.recit-chapter-title::after {
    content: "";
    display: block;
    width: 80px;
    height: 1px;
    margin: 14px auto 0;
    background: var(--recit-accent);
}
.recit-h { font-size: 1.02em; font-weight: 700; margin: 30px 0 8px; color: var(--recit-accent); }
.recit-p {
    margin: 0 0 1em;
    text-align: justify;
    hyphens: auto;
    -webkit-hyphens: auto;
}
.recit-link {
    color: var(--recit-accent);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
    cursor: pointer;
}
.recit-figure { margin: 24px 0; }
.recit-figure img { display: block; max-width: 100%; margin: 0 auto; border-radius: 6px; }
.recit-figure:not(.is-map) img { max-height: 420px; }
.recit-figure.is-map img { width: 100%; border: 1px solid var(--recit-rule); }
.recit-figure figcaption { margin-top: 8px; font-size: 0.8em; line-height: 1.45; color: var(--recit-ink-soft); text-align: center; }
.recit-credit { display: block; font-size: 0.9em; font-style: italic; opacity: 0.85; }
.recit-encadre {
    margin: 26px 0;
    padding: 16px 18px 4px;
    border-left: 3px solid var(--recit-accent);
    border-radius: 0 10px 10px 0;
    background: var(--recit-box);
    font-size: 0.9em;
}
.recit-encadre-title { margin: 0 0 8px; font-size: 1.05em; }
.recit-encadre-p { margin: 0 0 0.8em; text-align: justify; hyphens: auto; -webkit-hyphens: auto; }
.recit-citation { margin: 26px 8px; text-align: center; }
.recit-citation p { margin: 0; font-size: 1.12em; font-style: italic; }
.recit-citation cite { display: block; margin-top: 8px; font-size: 0.75em; font-style: normal; color: var(--recit-ink-soft); }
.recit-frise { list-style: none; margin: 24px 0; padding: 0 0 0 18px; border-left: 2px solid var(--recit-rule); font-size: 0.88em; }
.recit-frise li { position: relative; display: flex; gap: 12px; padding: 5px 0; }
.recit-frise li::before {
    content: "";
    position: absolute;
    left: -24px;
    top: 0.85em;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--recit-accent);
}
.recit-frise-date { flex-shrink: 0; width: 3.2em; font-weight: 700; color: var(--recit-accent); }
.recit-nav { display: flex; flex-wrap: wrap; gap: 10px; justify-content: space-between; margin-top: 36px; font-family: var(--font-main); }
.recit-nav-btn { flex: 1 1 200px; font-size: 15px; }
.recit-end { margin-top: 40px; padding-top: 24px; border-top: 1px solid var(--recit-rule); text-align: center; font-family: var(--font-main); }
.recit-end-title { font-family: var(--font-recit); font-size: 1.3em; font-weight: 400; margin: 0 0 8px; }
.recit-end-text { font-size: 15px; color: var(--recit-ink-soft); margin: 0 0 16px; }
.recit-end-btn { display: block; width: 100%; max-width: 420px; margin: 0 auto 10px; font-size: 15px; }
.recit-sources-title { margin: 28px 0 8px; font-family: var(--font-recit); font-weight: 400; }
.recit-sources { text-align: left; font-size: 14px; color: var(--recit-ink-soft); padding-left: 18px; }

/* --- La fiche d'un mot souligné --- */
.recit-fiche { position: fixed; inset: 0; z-index: 1200; display: flex; align-items: center; justify-content: center; padding: 16px; }
.recit-fiche.hidden { display: none; }
.recit-fiche-backdrop { position: absolute; inset: 0; background: var(--modal-overlay-bg); }
.recit-fiche-sheet {
    position: relative;
    width: 100%;
    max-width: 520px;
    max-height: 80vh;
    overflow-y: auto;
    padding: 22px 22px 12px;
    border-radius: 18px;
    background: var(--recit-paper);
    color: var(--recit-ink);
    font-family: var(--font-recit);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
}
.recit-fiche-close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--recit-rule);
    background: transparent;
    color: var(--recit-ink);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}
.recit-fiche-img { display: block; max-width: 100%; max-height: 240px; margin: 0 auto 12px; border-radius: 8px; }
.recit-fiche-title { margin: 0 40px 10px 0; font-size: 21px; font-weight: 400; color: var(--recit-accent); }
.recit-fiche-text { margin: 0 0 10px; font-size: 16px; line-height: 1.55; }
.recit-zoom-btn { display: block; width: 100%; padding: 0; border: none; background: none; cursor: zoom-in; }
.recit-zoom-hint { display: block; margin-bottom: 2px; font-size: 0.9em; font-style: italic; }
/* La carte agrandie : deux fois la largeur de l'écran au plus, à faire défiler dans les deux sens. */
.recit-fiche.is-zoom { padding: 8px; }
.recit-fiche.is-zoom .recit-fiche-sheet { max-width: none; max-height: 92vh; height: 92vh; padding: 0; overflow: auto; }
.recit-zoom-img { display: block; width: max(100%, min(1400px, 200vw)); max-width: none; }
.recit-fiche.is-zoom .recit-fiche-close { position: sticky; float: right; top: 8px; margin: 8px 8px -44px 0; z-index: 2; background: var(--recit-paper); }

/* Chemin du Temps : la leçon de fin de niveau (js/app/levelRecap.js). */
.level-recap {
    width: 100%;
    max-width: 640px;
    padding-bottom: 32px;
    outline: none;
}
.level-recap-kicker {
    margin: 0 0 12px;
    text-align: center;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-muted, var(--text-dark));
}
.level-recap-section {
    margin: 0 0 14px;
    padding: 16px 18px;
    border-radius: 16px;
    border: 1px solid var(--border-soft);
    background: var(--surface);
    color: var(--text-dark);
    box-shadow: var(--card-shadow);
}
.level-recap-thread { border-left: 5px solid var(--progress-green); }
.level-recap-review { border-left: 5px solid var(--danger-red); }
.level-recap-heading { margin: 0 0 8px; font-size: 16px; font-weight: 700; }
.level-recap-text, .level-recap-hint, .level-recap-empty { margin: 0; font-size: 15px; line-height: 1.55; }
.level-recap-hint { margin-bottom: 10px; font-size: 14px; }
.level-recap-list { margin: 0; padding-left: 20px; list-style: disc; font-size: 15px; line-height: 1.5; }
.level-recap-list li + li { margin-top: 4px; }
.level-recap-timeline { list-style: none; margin: 0; padding: 0; }
.level-recap-item { padding: 10px 0; border-top: 1px solid var(--border-soft); }
.level-recap-item:first-child { border-top: 0; padding-top: 0; }
.level-recap-item-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.level-recap-year { font-variant-numeric: tabular-nums; font-weight: 700; min-width: 5.5em; }
.level-recap-name { font-size: 15px; }
.level-recap-line { margin: 4px 0 0; font-size: 14px; line-height: 1.45; }

/* Profil, mode sombre : identifiant joueur et code d'équipe en blanc (le bleu marine y était illisible). */
:root[data-theme="dark"] .player-profile-id-value,
:root[data-theme="dark"] #player-profile-team-code {
    color: #fff;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .player-profile-id-value,
    :root:not([data-theme="light"]) #player-profile-team-code {
        color: #fff;
    }
}
/* === ATELIER D'UN THÈME PERSONNALISÉ (js/app/custom-workshop.js) === */
.data-card-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.data-card-meta { font-size: 12px; font-weight: 500; opacity: 0.88; }
.data-card-play {
    flex-shrink: 0; background: rgba(255, 255, 255, 0.22); color: #fff; font-weight: 700; font-size: 13px;
    border-radius: 999px; padding: 9px 14px; white-space: nowrap; cursor: pointer;
}
.data-card-play:hover { background: rgba(255, 255, 255, 0.34); }
.data-card-play.is-disabled { opacity: 0.45; cursor: not-allowed; }

.workshop-title { display: flex; align-items: center; justify-content: center; gap: 8px; }
.workshop-rename {
    background: var(--card-bg); color: var(--text-dark); border: 1px solid var(--border-soft);
    border-radius: 50%; width: 32px; height: 32px; font-size: 15px; cursor: pointer; flex-shrink: 0;
}
.workshop-tabs {
    display: flex; gap: 4px; background: var(--card-bg); border: 1px solid var(--border-soft);
    border-radius: 999px; padding: 3px; margin: 0 auto 14px; max-width: 520px; width: 100%;
}
.workshop-tab {
    flex: 1; white-space: nowrap; border: none; background: none; color: var(--muted-text); font: inherit; font-weight: 600;
    font-size: 14px; padding: 9px 0; border-radius: 999px; cursor: pointer;
}
.workshop-tab.active { background: var(--primary-blue); color: #fff; }
/* Comme #screen-axes : la barre d'action, sticky en bas, porte déjà sa propre marge de sécurité
   (voir .axes-action-bar) — une marge fixe ici laisserait un vide sous le bouton quand la liste est courte. */
#screen-custom-theme { padding-bottom: 0; }
#screen-custom-theme > div[role="tabpanel"] { max-width: 640px; margin: 0 auto; width: 100%; }
.workshop-add { width: 100%; margin-bottom: 10px; background: var(--progress-green); }
.workshop-hint, .workshop-empty { font-size: 13px; color: var(--muted-text); line-height: 1.45; margin: 0 0 12px; }
.workshop-empty { text-align: center; padding: 24px 10px; font-style: italic; }
.workshop-list { display: flex; flex-direction: column; }
.workshop-event {
    display: flex; align-items: center; gap: 12px; text-align: left; width: 100%; background: none; border: none;
    border-bottom: 1px solid var(--border-soft); padding: 11px 4px; color: var(--text-dark); font: inherit; cursor: pointer;
}
.workshop-event:hover { background: var(--surface-2); }
.workshop-event-year { width: 74px; flex-shrink: 0; font-family: var(--font-year); font-weight: 700; font-size: 14px; }
.workshop-event-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.workshop-event-title { font-size: 14.5px; font-weight: 600; line-height: 1.25; }
.workshop-event-body small { color: var(--muted-text); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.axis-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
/* La couleur de l'axe est portée par le contour (et le fond teinté de la pastille choisie), jamais par le texte :
   la plupart des teintes de la palette n'atteignent pas 4,5:1 sur le fond, ni en clair ni en sombre. */
.axis-chip {
    --chip-color: var(--muted-text);
    font: inherit; font-size: 12.5px; font-weight: 700; color: var(--text-dark); background: none;
    border: 1.5px solid var(--chip-color); border-radius: 999px; padding: 5px 11px; cursor: pointer; white-space: nowrap;
}
.axis-chip.active { background: var(--surface-2); box-shadow: inset 0 0 0 1.5px var(--chip-color); }
@supports (background: color-mix(in srgb, red 10%, white)) {
    .axis-chip.active { background: color-mix(in srgb, var(--chip-color) 24%, var(--card-bg)); }
}
.axis-chip.static { cursor: inherit; font-size: 11px; padding: 3px 8px; flex-shrink: 0; max-width: 40%; overflow: hidden; text-overflow: ellipsis; }
.workshop-axis {
    display: flex; align-items: center; gap: 12px; background: var(--card-bg); border: 1px solid var(--border-soft);
    border-radius: 14px; padding: 12px 14px; margin-bottom: 8px;
}
.workshop-axis.none { background: none; border-style: dashed; }
.workshop-axis-dot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; background: var(--muted-text); }
.workshop-axis-name { flex: 1; font-weight: 600; font-size: 14.5px; color: var(--text-dark); display: flex; flex-direction: column; }
.workshop-axis-name small { font-weight: 500; font-size: 12px; color: var(--muted-text); }
.workshop-icon-btn { background: none; border: none; font-size: 17px; padding: 6px 8px; cursor: pointer; color: var(--text-dark); border-radius: 8px; }
.workshop-icon-btn:hover { background: var(--surface-2); }
.workshop-axis-add { display: flex; gap: 8px; margin-top: 10px; }
.workshop-axis-add .form-input { flex: 1; }
.workshop-delete-theme {
    display: block; margin: 28px auto 0; background: none; border: none; color: var(--danger-red-text);
    font: inherit; font-size: 13px; cursor: pointer; text-decoration: underline;
}
.custom-event-actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.custom-event-actions .btn { flex: 1 1 auto; }
.custom-event-actions #custom-event-delete-btn { flex: 0 0 auto; }

/* Profil : changer de pseudo. */
.player-profile-pseudo { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 8px 0 4px; }
.player-profile-pseudo-form { display: flex; flex: 1 1 100%; flex-wrap: wrap; gap: 8px; align-items: center; }
.player-profile-pseudo-form[hidden] { display: none; }
.player-profile-pseudo-form input { flex: 1 1 140px; min-width: 0; padding: 8px 12px; border-radius: 10px; border: 1px solid var(--border-soft); background: var(--surface); color: var(--text-dark); font: inherit; }

/* Défilement automatique (js/app/autoscroll.js) : un bandeau opaque collé au bord bas de l'écran, au-dessus de la zone de l'indicateur d'accueil. */
.autoscroll-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 900; box-sizing: border-box; padding: 10px 16px calc(env(safe-area-inset-bottom, 0px) + 10px); border-top: 1px solid var(--border-soft, #c9ced8); background: var(--surface, #fff); color: var(--text-dark, #1c2333); box-shadow: 0 -4px 18px rgba(0, 0, 0, 0.16); font-family: system-ui, sans-serif; }
.autoscroll-bar[hidden] { display: none; }
.autoscroll-recit { border-top-color: var(--recit-rule); background: var(--recit-paper); color: var(--recit-ink); }
/* Le dernier texte peut remonter au-dessus du bandeau (environ 120 px de haut, plus la zone de l'indicateur d'accueil). */
.list-screen.has-autoscroll { padding-bottom: calc(130px + env(safe-area-inset-bottom, 0px)); }
/* La flèche de retour (fixe, en haut à gauche) recouvrirait le texte qui défile : elle disparaît tant que le bandeau est ouvert, et revient à sa fermeture. */
.list-screen.has-autoscroll > .back-btn { visibility: hidden; pointer-events: none; }
.autoscroll-status { margin: 0 0 6px; min-height: 18px; font-size: 13px; font-weight: 700; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.autoscroll-count { font-variant-numeric: tabular-nums; }
.autoscroll-row { display: flex; align-items: center; justify-content: center; gap: 8px; }
.autoscroll-btn { flex: none; width: 44px; height: 44px; border: 1px solid currentColor; border-radius: 50%; background: transparent; color: inherit; font-size: 20px; font-weight: 700; line-height: 1; cursor: pointer; }
.autoscroll-btn:disabled { opacity: 0.35; cursor: default; }
.autoscroll-play { width: 52px; height: 52px; }
.autoscroll-mode { min-width: 112px; height: 44px; padding: 0 10px; font: 700 14px system-ui, sans-serif; border: 1px solid currentColor; border-radius: 22px; background: transparent; color: inherit; cursor: pointer; white-space: nowrap; }
.autoscroll-level { min-width: 44px; text-align: center; font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; }


/* Réglages : jours de repos de la série */
.settings-sublabel { margin: 12px 0 6px; font-size: 13.5px; font-weight: 700; color: var(--text-dark); }
.rest-weekdays { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.rest-weekday {
    padding: 9px 0; border-radius: 12px; border: 1px solid var(--border-soft); background: var(--card-bg, #fff);
    font: inherit; font-size: 13px; font-weight: 700; color: var(--text-dark); cursor: pointer;
}
.rest-weekday.active { background: var(--primary-blue); border-color: var(--primary-blue); color: #fff; }
.rest-leave-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px; }
.rest-leave-form label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted-text); flex: 1 1 130px; }
.rest-leaves { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.rest-leaves li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 12px; border-radius: 12px; background: rgba(107, 142, 173, 0.10); font-size: 14px; color: var(--text-dark); }

.torahaxe-promo-card {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-top: 12px;
    padding: 14px;
    border-radius: 16px;
    background: linear-gradient(135deg, var(--primary-blue), #0a2d6e);
    color: #fff;
    text-decoration: none;
    box-shadow: var(--card-shadow);
}
.torahaxe-promo-card img {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    flex-shrink: 0;
}
.torahaxe-promo-card span {
    font-size: 14px;
    line-height: 1.4;
    font-weight: 600;
}

.recits-filters {
    display: flex;
    gap: 10px;
    width: 100%;
    margin: 10px 0 8px;
}

.recits-filter-btn {
    flex: 1;
    min-height: 44px;
    padding: 8px 14px;
    border: 1px solid var(--border-soft);
    border-radius: 14px;
    background: var(--surface);
    color: var(--text-dark);
    font: inherit;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
}

.recits-filter-btn::after {
    content: ' ▾';
}

.recits-filter-btn.is-open::after {
    content: ' ▴';
}

.recits-filter-btn.is-active {
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 1px var(--primary-blue);
}

.recits-filter-btn.is-open {
    background: var(--primary-blue);
    border-color: var(--primary-blue);
    color: var(--text-light);
}

.recits-filter-choices {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
    width: 100%;
    box-sizing: border-box;
    margin-bottom: 8px;
    padding: 8px;
    border: 1px solid var(--border-soft);
    border-radius: 14px;
    background: var(--surface);
}

.recits-filter-choices.hidden {
    display: none;
}

.recits-filter-choice {
    min-height: 44px;
    padding: 6px 10px;
    border: 1px solid transparent;
    border-radius: 10px;
    background: none;
    color: var(--text-dark);
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
}

.recits-filter-choice:hover {
    background: var(--selected-tint);
}

.recits-filter-choice.is-active {
    border-color: var(--primary-blue);
    background: var(--selected-tint);
}

/* =========================================================================
   BARRE D'ONGLETS ET ACCUEIL EN DEUX VUES (js/app/tabs.js, js/app/categories.js)
   Cinq lieux : Aujourd'hui, Explorer, Chemin (ou Réviser), Atelier, Moi.
   Téléphone et tablette debout : barre en bas. Grand écran : colonne à gauche.
   Téléphone couché : rail d'icônes à gauche (la hauteur est trop précieuse).
   ========================================================================= */
:root {
    /* Largeur prise à gauche par la barre quand elle est en colonne : décale ce qui est fixé au bord (bouton retour). */
    --tabbar-left: 0px;
    --tab-active: var(--primary-blue);
    --tab-active-bg: #e4ebf7;
    --hero-bg: #001a4b;
}

:root[data-theme="dark"] {
    --tab-active: #F2F4F7;
    --tab-active-bg: rgba(127, 166, 201, 0.22);
    --hero-bg: #1d3566;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --tab-active: #F2F4F7;
        --tab-active-bg: rgba(127, 166, 201, 0.22);
        --hero-bg: #1d3566;
    }
}

.app-tabbar {
    flex: none;
    display: flex;
    justify-content: space-around;
    align-items: stretch;
    gap: 2px;
    padding: 6px max(8px, var(--sar)) calc(6px + var(--sab)) max(8px, var(--sal));
    background: var(--surface);
    border-top: 1px solid var(--border-soft);
    z-index: 70;
}

.app-tab {
    flex: 1 1 0;
    min-width: 0;
    max-width: 120px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 4px 2px;
    border: none;
    border-radius: 12px;
    background: none;
    color: var(--muted-text);
    font-size: 11px;
    font-weight: 600;
    line-height: 1.2;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.app-tab-icon {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 28px;
    border-radius: 14px;
    transition: background 0.2s;
}

.app-tab-icon svg {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.9;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.app-tab-label {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.app-tab.is-active {
    color: var(--tab-active);
    font-weight: 700;
}

.app-tab.is-active .app-tab-icon {
    background: var(--tab-active-bg);
}

.app-tab.is-active .app-tab-icon svg {
    stroke-width: 2.3;
}

@media (hover: hover) {
    .app-tab:hover .app-tab-icon {
        background: var(--tab-active-bg);
    }
}

/* Il reste un défi classé à jouer aujourd'hui. */
.app-tab-dot {
    position: absolute;
    top: 1px;
    right: 9px;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #d9480f;
    border: 2px solid var(--surface);
}

/* La barre porte la zone de sécurité du bas : l'écran au-dessus n'a plus à la réserver. */
body.has-tabbar > .list-screen {
    padding-bottom: 24px;
}

/* --- Grand écran : la barre devient une colonne à gauche --- */
@media (min-width: 1024px) {
    body.has-tabbar {
        flex-direction: row;
        --tabbar-left: 220px;
    }

    body.has-tabbar > [id^="screen-"] {
        min-width: 0;
    }

    body.has-tabbar > .list-screen {
        padding-bottom: calc(var(--sab) + 20px);
    }

    .app-tabbar {
        order: -1;
        width: 220px;
        flex-direction: column;
        justify-content: flex-start;
        gap: 4px;
        padding: calc(var(--sat) + 20px) 12px 20px;
        border-top: none;
        border-right: 1px solid var(--border-soft);
    }

    .app-tabbar::before {
        content: "HistoriAxe";
        font-family: var(--font-year);
        font-size: 24px;
        font-weight: 700;
        color: var(--text-dark);
        padding: 4px 12px 18px;
    }

    .app-tab {
        flex: none;
        max-width: none;
        flex-direction: row;
        gap: 12px;
        padding: 6px 8px;
        font-size: 15px;
    }

    .app-tab-icon {
        width: 36px;
        height: 36px;
        border-radius: 12px;
    }

    .app-tab.is-active {
        background: var(--tab-active-bg);
    }

    .app-tab.is-active .app-tab-icon {
        background: none;
    }

    .app-tab-dot {
        top: 4px;
        right: 4px;
    }
}

/* --- Téléphone couché : un rail d'icônes à gauche --- */
@media (orientation: landscape) and (max-height: 500px) {
    body.has-tabbar {
        flex-direction: row;
        --tabbar-left: calc(64px + var(--sal));
    }

    body.has-tabbar > [id^="screen-"] {
        min-width: 0;
    }

    body.has-tabbar > .list-screen {
        padding-bottom: calc(var(--sab) + 20px);
    }

    .app-tabbar {
        order: -1;
        width: 64px;
        flex-direction: column;
        justify-content: center;
        gap: 6px;
        padding: 8px 6px;
        border-top: none;
        border-right: 1px solid var(--border-soft);
    }

    .app-tabbar::before {
        content: none;
    }

    .app-tab {
        flex: none;
        flex-direction: column;
        padding: 2px;
        background: none;
    }

    .app-tab.is-active {
        background: none;
    }

    .app-tab.is-active .app-tab-icon {
        background: var(--tab-active-bg);
    }

    .app-tab-icon {
        width: 48px;
        height: 34px;
    }

    .app-tab-label {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip-path: inset(50%);
    }
}

/* Ce qui est fixé au bord gauche de la fenêtre se décale de la largeur de la colonne. */
body.has-tabbar .back-btn {
    left: calc(16px + var(--tabbar-left));
}

/* La racine d'un onglet n'a pas de « retour » : on en sort par la barre. */
body.has-tabbar #screen-tools > .back-btn,
body.has-tabbar #screen-path:not(.is-island) > .back-btn {
    display: none;
}

/* --- L'en-tête de l'accueil : la date, le nom de la vue, la série --- */
.home-head {
    align-items: flex-end;
    max-width: 1100px;
    align-self: center;
    width: calc(100% + 40px);
}

.home-head-text {
    min-width: 0;
}

.home-date {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted-text);
}

.home-title {
    font-size: 30px;
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.15;
    color: var(--text-dark);
}

.home-head .player-rank-streak-badge {
    flex: none;
    margin-bottom: 4px;
}

.home-head-off {
    display: none !important;
}

#home-search {
    margin: 4px auto 0;
    max-width: 1100px;
}

/* --- Les deux vues --- */
.home-view {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin: 12px auto 0;
    padding-bottom: 24px;
}

.home-view-today {
    max-width: 680px;
}

.home-view-explore {
    max-width: 1100px;
}

/* Les cartes déjà stylées ailleurs (Chemin, récit, Clio) : l'écart vient de la colonne, pas de chaque carte. */
.home-view > .resume-card,
.home-view > .recits-home,
.home-view > .advent-card,
.home-view > .clio-home {
    margin-top: 0;
}

/* L'action du jour : une seule carte bleu nuit, tout en haut. */
.home-hero {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    padding: 20px;
    border: none;
    border-radius: 20px;
    background: var(--hero-bg);
    color: #fff;
    text-align: left;
    cursor: pointer;
    box-shadow: 0 10px 24px rgba(0, 26, 75, 0.22);
    transition: transform 0.15s ease;
}

.home-hero:active {
    transform: scale(0.985);
}

.home-hero-kicker {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #b2c5ff;
}

.home-hero-title {
    font-size: 21px;
    font-weight: 700;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.home-hero-cta {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
    padding: 10px 20px;
    border-radius: 9999px;
    background: #fed65b;
    color: #241a00;
    font-size: 15px;
    font-weight: 800;
}

/* Le Chemin en action du jour (aucun thème à reprendre) : même habit que .home-hero. */
.resume-card.path-card.is-hero {
    padding: 20px;
    border: none;
    border-radius: 20px;
    background: var(--hero-bg);
    color: #fff;
    box-shadow: 0 10px 24px rgba(0, 26, 75, 0.22);
}

.resume-card.path-card.is-hero .resume-card-kicker {
    color: #b2c5ff;
}

.resume-card.path-card.is-hero .resume-card-title {
    font-size: 19px;
}

.resume-card.path-card.is-hero .resume-card-icon {
    width: 52px;
    height: 52px;
    font-size: 24px;
    background: #fed65b;
}

.home-section-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin: 6px 2px 10px;
}

.home-section-title {
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-dark);
}

.home-section-count {
    font-size: 13px;
    font-weight: 700;
    color: var(--danger-red-text);
}

.home-section-count.is-done {
    color: var(--success-text);
}

/* Les défis du jour : toujours dépliés, deux par ligne sur téléphone, tous sur une ligne dès qu'il y a la place. */
.home-challenges .challenge-picker {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-top: 0;
}

.home-challenges .challenge-picker-btn {
    min-width: 0;
    width: 100%;
}

@media (min-width: 620px) {
    .home-challenges .challenge-picker {
        grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    }
}

/* Une ligne d'accueil (Réviser) : même gabarit que la carte du Chemin. */
.home-line {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    border: 1px solid var(--border-soft);
    border-radius: 16px;
    background: var(--surface);
    color: var(--text-dark);
    text-align: left;
    cursor: pointer;
    box-shadow: var(--card-shadow);
}

.home-line-icon {
    flex: none;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: var(--surface-2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.home-line.is-due .home-line-icon {
    background: #fff0c2;
}

.home-line-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    flex: 1;
}

.home-line-text strong {
    font-size: 17px;
}

.home-line-text small {
    font-size: 13px;
    color: var(--muted-text);
}

.home-line-chevron {
    flex: none;
    font-size: 22px;
    color: var(--muted-text);
}

/* Les raccourcis d'Explorer : une seule ligne qui défile horizontalement, comme la frise des époques
   juste en dessous (même barre de défilement masquée). */
.home-chips {
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 2px;
}

.home-chips::-webkit-scrollbar {
    display: none;
}

.home-chip {
    flex: 0 0 auto;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border: 1px solid var(--border-soft);
    border-radius: 9999px;
    background: var(--surface);
    color: var(--text-dark);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: var(--card-shadow);
}

.home-chip[aria-expanded="true"] {
    background: var(--selected-tint);
}

.home-shortcuts .challenge-picker {
    margin-top: 12px;
}

/* Les catégories : l'image en haut, le texte dessous sur le fond de la carte (lisible sur toutes les photos). */
.cat-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

@media (min-width: 700px) {
    .cat-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 16px;
    }
}

@media (min-width: 1280px) {
    .cat-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

.cat-tile {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border-soft);
    border-radius: 18px;
    overflow: hidden;
    background: var(--surface);
    box-shadow: var(--card-shadow);
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

@media (hover: hover) {
    .cat-tile:hover {
        transform: translateY(-2px);
        box-shadow: var(--card-shadow-hover);
    }
}

.cat-tile-img {
    aspect-ratio: 16 / 9;
    background-color: var(--primary-blue);
    background-size: cover;
    background-position: center;
}

.cat-tile-text {
    padding: 10px 12px 12px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.cat-tile-title {
    font-size: 15px;
    font-weight: 700;
    line-height: 1.25;
    color: var(--text-dark);
    overflow-wrap: anywhere;
}

.cat-tile-sub {
    font-size: 12px;
    color: var(--muted-text);
}

@media (min-width: 700px) {
    .cat-tile-title {
        font-size: 17px;
    }

    .cat-tile-sub {
        font-size: 13px;
    }
}

/* --- L'onglet « Moi » --- */
.tab-root-title {
    align-self: stretch;
    max-width: 520px;
    width: 100%;
    margin: 0 auto 16px;
    padding: 0;
    text-align: left;
    font-size: 30px;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.me-account {
    width: 100%;
    max-width: 520px;
    display: flex;
}

/* « Moi » et le bouton du compte partagent une seule ligne : le bouton est poussé à droite. */
.me-head {
    width: 100%;
    max-width: 520px;
    margin: 0 auto 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.me-head .tab-root-title {
    flex: 0 1 auto;
    min-width: 0;
    width: auto;
    max-width: none;
    margin: 0;
    align-self: auto;
}

.me-head .me-account {
    flex: 0 1 auto;
    width: auto;
    max-width: 60%;
    min-width: 0;
    margin-left: auto;
    justify-content: flex-end;
}

.me-account .account-header-btn {
    max-width: 100%;
}

#screen-me .player-rank-bar {
    max-width: 520px;
    margin: 14px auto 20px;
}

body[data-view-profile="concours"] #me-league {
    display: none;
}

.tab-root-subtitle {
    align-self: stretch;
    max-width: 520px;
    width: 100%;
    margin: -8px auto 20px;
    text-align: left;
}

/* L'en-tête s'aligne sur la colonne de sa vue. */
#screen-categories[data-home-tab="today"] .home-head {
    max-width: 720px;
}

/* Le nombre de demandes d'ami en attente, au bout de la ligne « Amis ». */
.me-count {
    flex: none;
    margin-left: auto;
    min-width: 24px;
    height: 24px;
    padding: 0 7px;
    border-radius: 12px;
    background: #d9480f;
    color: #fff;
    font-size: 13px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* --- Ce qui est fixé en bas de la fenêtre passe AU-DESSUS de la barre d'onglets ---
   --tabbar-h : la hauteur de la barre quand elle est en bas ; 0 quand elle est en colonne ou en rail. */
:root {
    --tabbar-h: 0px;
}

body.has-tabbar {
    --tabbar-h: calc(64px + var(--sab));
}

.app-tabbar {
    height: calc(64px + var(--sab));
    box-sizing: border-box;
}

@media (min-width: 1024px) {
    body.has-tabbar {
        --tabbar-h: 0px;
    }

    .app-tabbar {
        height: auto;
    }
}

@media (orientation: landscape) and (max-height: 500px) {
    body.has-tabbar {
        --tabbar-h: 0px;
    }

    .app-tabbar {
        height: auto;
    }
}

/* La fiche d'un niveau du Chemin : posée sur la barre, centrée dans l'écran (et non dans la fenêtre) quand la barre est à gauche. */
body.has-tabbar .path-sheet {
    bottom: var(--tabbar-h);
    left: calc(50% + var(--tabbar-left) / 2);
    padding-bottom: 20px;
}

body.has-tabbar .toast-notification {
    bottom: calc(28px + var(--tabbar-h));
}

body.has-tabbar .clio-intro {
    bottom: calc(max(16px, env(safe-area-inset-bottom, 0px)) + var(--tabbar-h));
}

/* =========================================================================
   COULEUR DES MODES : une couleur par famille, pas une par carte.
   La frise reste bleu nuit (la couleur de l'app) ; Explorer est sarcelle, Défis terre cuite, Outils ardoise.
   Le même repère coloré précède le titre du groupe : la couleur dit à quelle famille appartient la carte.
   ========================================================================= */
:root {
    --fam-frise: #001a4b;
    --fam-explore: #0f5f6b;
    --fam-defis: #9a3412;
    --fam-tools: #3b4a5e;
}

.modes-group-frise { --fam: var(--fam-frise); }
.modes-group[data-group="explore"] { --fam: var(--fam-explore); }
.modes-group[data-group="express"] { --fam: var(--fam-defis); }
.modes-group[data-group="tools"] { --fam: var(--fam-tools); }

.modes-group[data-group] .mode-card:not(.locked),
.modes-group-frise .mode-card:not(.locked) {
    background: var(--fam);
}

.modes-group .modes-group-title::before {
    content: "";
    display: inline-block;
    width: 10px;
    height: 10px;
    margin-right: 8px;
    border-radius: 50%;
    background: var(--fam, var(--primary-blue));
    vertical-align: baseline;
}

:root[data-theme="dark"] .modes-group .modes-group-title::before {
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.18);
}

/* =========================================================================
   HARMONISATION : une pastille pour toutes les icônes, le serif pour ce qui est historique.
   ========================================================================= */
/* Les emojis changent de dessin d'un appareil à l'autre ; rangés dans la même pastille carrée, ils se lisent
   comme une seule famille (Atelier, Salle de jeux, Moi). */
.arcade-card-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: var(--surface-2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    line-height: 1;
}

.arcade-card-icon > img,
.arcade-card-icon > svg {
    max-width: 28px;
    max-height: 28px;
}

/* Le serif des Récits et de la frise, pour les noms de thèmes, de catégories, de mondes et l'action du jour. */
.cat-tile-title,
.home-hero-title,
.modes-header-title,
#modes-header-title,
.resume-card.path-card.is-hero .resume-card-title,
.data-card-title {
    font-family: var(--font-year);
    letter-spacing: -0.005em;
}

/* =========================================================================
   MISES EN PAGE LARGES (iPad, site) : les listes passent sur deux colonnes (trois sur très grand écran),
   la frise et la main de la partie grandissent avec la fenêtre (--zoom-level, voir js/app/modal.js).
   Sous 720 px de large : rien ne change.
   ========================================================================= */
@media (min-width: 720px) {
    .tools-group,
    .games-section,
    .album-list,
    .shop-list,
    .recits-list,
    .tab-root-title,
    .tab-root-subtitle,
    .me-head,
    #screen-me .player-rank-bar {
        max-width: 1040px;
    }

    .arcade-menu {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
        max-width: 1040px;
        align-items: stretch;
    }

    .arcade-menu > .arcade-card {
        min-width: 0;
    }

    /* La boutique : les costumes sur deux colonnes, les titres de section sur toute la largeur. */
    .shop-list {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        column-gap: 12px;
        align-items: start;
    }

    .shop-list > .shop-section {
        grid-column: 1 / -1;
    }

    .recits-list {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 16px;
        align-items: stretch;
    }
}

@media (min-width: 1500px) {
    .tools-group,
    .games-section,
    .album-list,
    .shop-list,
    .recits-list,
    .tab-root-title,
    .tab-root-subtitle,
    .me-head,
    #screen-me .player-rank-bar {
        max-width: 1260px;
    }

    .arcade-menu {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        max-width: 1260px;
    }

    .shop-list {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .recits-list {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

/* La partie : la frise et la main suivent le zoom (donc la fenêtre). */
.chrono {
    max-width: calc(720px * var(--zoom-level));
}

.hand-card {
    max-width: calc(720px * var(--zoom-level));
}

.hand-title {
    font-size: calc(18px * var(--zoom-level)) !important;
}

.hand-kicker {
    font-size: calc(11px * var(--zoom-level)) !important;
}

/* Frise horizontale : la largeur d'un repère et son badge suivent le zoom. */
[data-layout="horizontal"] .entry {
    width: calc(170px * var(--zoom-level)) !important;
}

[data-layout="horizontal"] .entry-axe-badge {
    font-size: calc(10px * var(--zoom-level));
    padding: calc(2px * var(--zoom-level)) calc(5px * var(--zoom-level));
}

.hand-card {
    max-width: min(100%, calc(560px * var(--zoom-level)));
}

/* =========================================================================
   FRISE DES ÉPOQUES (onglet Explorer, js/app/categories.js, js/eraFilterCore.js)
   Un axe, une pastille par époque : un filtre. « Tout » montre les catégories, une époque les thèmes qui la traversent.
   ========================================================================= */
.era-frise {
    width: 100%;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    margin: 4px 0 2px;
}

.era-frise::-webkit-scrollbar {
    display: none;
}

.era-track {
    position: relative;
    display: flex;
    min-width: max-content;
    padding: 2px 0 4px;
}

.era-track::before {
    content: "";
    position: absolute;
    left: 24px;
    right: 24px;
    top: 17px;
    height: 3px;
    border-radius: 2px;
    background: var(--tab-active);
    opacity: 0.35;
}

.era-stop {
    position: relative;
    flex: 1 0 auto;
    min-width: 72px;
    min-height: 56px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 2px 10px;
    border: none;
    background: none;
    color: var(--muted-text);
    font-size: 12px;
    font-weight: 600;
    line-height: 1.2;
    text-align: center;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.era-dot {
    width: 14px;
    height: 14px;
    margin-top: 4px;
    border-radius: 50%;
    background: var(--surface);
    border: 3px solid var(--tab-active);
    box-sizing: border-box;
    transition: transform 0.15s ease, background 0.15s ease;
}

.era-stop[aria-pressed="true"] {
    color: var(--text-dark);
    font-weight: 800;
}

.era-stop[aria-pressed="true"] .era-dot {
    background: #fed65b;
    transform: scale(1.5);
}

@media (hover: hover) {
    .era-stop:hover .era-dot {
        transform: scale(1.3);
    }

    .era-stop[aria-pressed="true"]:hover .era-dot {
        transform: scale(1.5);
    }
}

.era-head {
    margin: 14px 2px 4px;
}

.era-head-title {
    font-family: var(--font-year);
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -0.005em;
    color: var(--text-dark);
}

.era-head-sub {
    margin-top: 2px;
    font-size: 14px;
    color: var(--muted-text);
}

.era-empty {
    padding: 24px 2px;
    color: var(--muted-text);
}

.era-group {
    margin-top: 18px;
}

.era-group .home-section-head {
    margin-top: 0;
}

.era-group-count {
    color: var(--muted-text);
}

.era-rows {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
}

@media (min-width: 720px) {
    .era-rows {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 1500px) {
    .era-rows {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

.era-row {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    min-width: 0;
    padding: 12px 14px;
    border: 1px solid var(--border-soft);
    border-radius: 14px;
    background: var(--surface);
    color: var(--text-dark);
    text-align: left;
    cursor: pointer;
    box-shadow: var(--card-shadow);
}

.era-row-title {
    font-family: var(--font-year);
    font-size: 16px;
    font-weight: 700;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.era-row-meta {
    font-size: 12.5px;
    color: var(--muted-text);
    overflow-wrap: anywhere;
}

.era-more {
    margin: 10px auto 0;
    display: block;
    padding: 9px 18px;
    border: 1px solid var(--border-soft);
    border-radius: 9999px;
    background: var(--surface);
    color: var(--text-dark);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

/* Une frise plus large que l'écran se devine : son bord droit s'estompe tant qu'elle peut défiler. */
@media (max-width: 719px) {
    .era-frise {
        -webkit-mask-image: linear-gradient(to right, #000 0, #000 calc(100% - 36px), transparent 100%);
        mask-image: linear-gradient(to right, #000 0, #000 calc(100% - 36px), transparent 100%);
    }

    .era-stop {
        min-width: 64px;
        padding: 2px 6px;
    }
}

/* === Propositions de la communauté : le bouton sous la liste des récits, puis l'écran (js/app/suggestions.js) === */
.recits-propose {
    width: 100%;
    max-width: 760px;
    display: flex;
    justify-content: center;
    padding: 4px 0 40px;
}
.recits-propose-btn {
    min-height: 48px;
    padding: 12px 28px;
    border: none;
    border-radius: 14px;
    background: var(--primary-blue);
    color: #fff;
    font: inherit;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
}
.recits-propose-btn:hover { filter: brightness(1.15); }

.suggestions-tabs {
    width: 100%;
    max-width: 760px;
    margin-top: 16px;
}
.suggestions-tabs button { min-height: 44px; padding: 8px 4px; }
.suggestions-form {
    width: 100%;
    max-width: 760px;
    margin-top: 16px;
}
.suggestions-add {
    display: flex;
    gap: 10px;
    align-items: stretch;
}
.suggestions-field {
    position: relative;
    flex: 1;
    min-width: 0;
}
.suggestions-field input {
    width: 100%;
    min-height: 46px;
    padding: 8px 56px 8px 14px;
    border: 1px solid var(--border-soft);
    border-radius: 14px;
    background: var(--surface);
    color: var(--text-dark);
    font: inherit;
    font-size: 16px;
    box-sizing: border-box;
}
.suggestions-count {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 12px;
    font-variant-numeric: tabular-nums;
    color: var(--ink-soft);
    pointer-events: none;
}
.suggestions-add .btn { white-space: nowrap; }
#suggestions-msg {
    width: 100%;
    max-width: 760px;
    margin-top: 12px;
}
.suggestions-list {
    width: 100%;
    max-width: 760px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 16px;
    padding-bottom: 40px;
}
.suggestion-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border: 1px solid var(--border-soft);
    border-radius: 16px;
    background: var(--card-bg);
    color: var(--text-dark);
    box-shadow: var(--card-shadow);
}
.suggestion-row.is-published { border-color: var(--primary-blue); }
.suggestion-row.is-hidden { opacity: 0.7; }
.suggestion-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.suggestion-title {
    font-size: 17px;
    font-weight: 700;
    overflow-wrap: anywhere;
}
.suggestion-status,
.suggestion-votes {
    font-size: 13px;
    color: var(--ink-soft);
}
.suggestion-side {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}
.suggestion-vote,
.suggestion-report,
.suggestion-delete {
    min-height: 44px;
    border: 1px solid var(--border-soft);
    border-radius: 12px;
    background: var(--surface);
    color: var(--text-dark);
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}
.suggestion-vote {
    min-width: 56px;
    padding: 4px 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    line-height: 1.1;
}
.suggestion-vote-icon { font-size: 12px; }
.suggestion-vote-count { font-size: 16px; font-variant-numeric: tabular-nums; }
.suggestion-vote.is-voted { background: var(--primary-blue); border-color: var(--primary-blue); color: #fff; }
.suggestion-report { min-width: 44px; font-size: 15px; font-weight: 400; color: var(--ink-soft); }
.suggestion-delete { padding: 6px 12px; font-size: 14px; }
.suggestion-delete.is-confirm { background: #b3261e; border-color: #b3261e; color: #fff; }
@media (max-width: 420px) {
    .suggestion-row { padding: 10px; gap: 8px; }
    .suggestions-add { flex-direction: column; }
}

/* === Avis de parution et badge « Proposé par la communauté » === */
.suggestion-news-list { display: flex; flex-direction: column; gap: 14px; margin: 14px 0 20px; }
.suggestion-news-item { display: flex; flex-direction: column; gap: 10px; align-items: center; }
.suggestion-news-text { margin: 0; font-size: 17px; color: var(--text-dark); overflow-wrap: anywhere; }
.recit-community-badge {
    display: inline-block;
    padding: 2px 10px;
    border: 1px solid var(--border-soft);
    border-radius: 999px;
    background: var(--surface);
    color: var(--ink-soft);
    font-size: 13px;
    font-weight: 600;
}
p.recit-community-badge { margin: 8px 0 0; }

/* === La Grande Frise (écran de l'Atelier et de « Explorer » ; js/app/frise-monde.js) === */
/* Une voie par aire ; une barre = une période ; un point = un événement du jeu. Les teintes des aires sont des jetons, clairs puis éclaircis en thème sombre. */
:root {
    --gf-empires: #9a7608; --gf-europe: #3b6fb6; --gf-mo: #c0563c; --gf-afrique: #2f8f5b;
    --gf-asie-sud: #a86a0c; --gf-asie-est: #8350b0; --gf-ameriques: #1f8a8a; --gf-oceanie: #c2527f;
    --gf-reperes: #9a7608; --gf-chemin: #b3541e;
}
:root[data-theme="dark"] {
    --gf-empires: #e9c349; --gf-europe: #7fa8e6; --gf-mo: #e58a6d; --gf-afrique: #5fc08a;
    --gf-asie-sud: #e0b24a; --gf-asie-est: #b996dc; --gf-ameriques: #4fc1c1; --gf-oceanie: #e58ab0;
    --gf-reperes: #e9c349; --gf-chemin: #f0a35c;
}
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --gf-empires: #e9c349; --gf-europe: #7fa8e6; --gf-mo: #e58a6d; --gf-afrique: #5fc08a;
        --gf-asie-sud: #e0b24a; --gf-asie-est: #b996dc; --gf-ameriques: #4fc1c1; --gf-oceanie: #e58ab0;
        --gf-reperes: #e9c349; --gf-chemin: #f0a35c;
    }
}
.list-screen.gf-screen { padding: 0; overflow: hidden; }
.gf-screen .gf-top { position: relative; z-index: 20; width: 100%; max-width: 900px; margin-top: calc(env(safe-area-inset-top, 0px) + 14px); padding: 0 8px; display: flex; flex-direction: column; gap: 6px; }
.gf-toolbar, .gf-searchrow { display: flex; align-items: center; gap: 6px; min-height: 42px; }
/* Le bouton retour (fixe, 42 px à 14 px du bord) reste libre. */
.gf-toolbar, .gf-searchrow { margin-left: 50px; }
@media (max-width: 560px) { .gf-tb-mastery { display: none; } }
.gf-menu-mastery { display: none; }
@media (max-width: 560px) { .gf-drop .gf-menu-mastery { display: inline-flex; align-items: center; min-height: 36px; } }
.gf-toolbar.hidden, .gf-searchrow.hidden { display: none; }
.gf-seg { display: flex; flex: none; border: 1px solid var(--border-soft); border-radius: 18px; background: var(--surface); overflow: hidden; }
.gf-seg .tool-history-chip { min-height: 34px; padding: 2px 10px; border: 0; border-radius: 0; font-size: 13px; box-shadow: none; }
.gf-seg .tool-history-chip + .tool-history-chip { border-left: 1px solid var(--border-soft); }
.gf-seg .tool-history-chip[aria-pressed="true"] { background: var(--selected-tint); font-weight: 800; }
.gf-top .gf-tb-search { flex: none; min-width: 40px; min-height: 36px; padding: 0 8px; font-size: 16px; }
.gf-top .gf-tb-mastery { flex: none; min-height: 36px; padding: 0 12px; font-size: 13px; white-space: nowrap; }
.gf-top .gf-tb-menu { flex: none; margin-left: auto; min-height: 36px; padding: 0 12px; font-size: 13px; font-weight: 700; white-space: nowrap; }
.gf-searchrow #gf-search { flex: 1 1 auto; min-width: 0; width: auto; height: 40px; margin: 0; }
.gf-searchrow .tool-history-chip { flex: none; min-width: 40px; min-height: 40px; padding: 0; }
.gf-drop { position: absolute; left: 8px; right: 8px; top: calc(100% + 4px); z-index: 30; display: flex; flex-wrap: wrap; gap: 6px; padding: 10px; border: 1px solid var(--border-soft); border-radius: 16px; background: var(--surface); box-shadow: var(--card-shadow); max-height: 60vh; overflow: auto; }
.gf-drop.hidden { display: none; }
.gf-drop .gf-menu-title { flex: 1 1 100%; margin: 0; font-weight: 700; }
.gf-drop .tool-history-chips { flex: 1 1 100%; }
.gf-drop .gf-about { flex: 1 1 100%; font-size: 12px; color: var(--muted-text); }
.gf-drop .gf-about summary { cursor: pointer; padding: 2px 0; }
.gf-drop .gf-about p { margin: 4px 0; }
.gf-aire-chip { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; }
.gf-aire-chip .gf-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--gf-c); display: inline-block; }
.gf-aire-chip[aria-pressed="false"] { opacity: 0.5; }
.gf-aire-chip[aria-pressed="true"] { border-color: var(--gf-c); }

.gf-view {
    position: relative; flex: 1 1 auto; min-height: 0; width: 100%; margin-top: 6px; overflow: auto;
    border-top: 1px solid var(--border-soft); background: var(--surface); direction: ltr; overscroll-behavior: contain;
}
.gf-screen.has-sheet .gf-view { flex: 1 1 40%; }
.gf-stage { position: relative; padding-bottom: 24px; }
.gf-stubfull { position: absolute; left: 84px; width: 78px; top: 0; bottom: 0; background: repeating-linear-gradient(135deg, var(--surface-2) 0 6px, transparent 6px 12px); border-right: 2px solid var(--border-soft); }
.gf-hdr { position: sticky; top: 0; z-index: 6; background: var(--surface); border-bottom: 1px solid var(--border-soft); }
.gf-ruler { position: relative; height: 38px; cursor: crosshair; }
.gf-tick { position: absolute; top: 0; height: 100%; border-left: 1px solid var(--border-soft); }
.gf-tick span { position: absolute; top: 4px; left: 5px; font-size: 11px; color: var(--muted-text); white-space: nowrap; font-variant-numeric: tabular-nums; }
.gf-tick.is-major span { color: var(--text-dark); font-weight: 700; }
.gf-stub { position: absolute; left: 84px; top: 0; bottom: 0; width: 78px; background: repeating-linear-gradient(135deg, var(--surface-2) 0 6px, transparent 6px 12px); border-right: 2px solid var(--border-soft); }
.gf-stub b { position: absolute; left: 6px; top: 6px; width: 66px; font-size: 10px; line-height: 1.15; color: var(--muted-text); font-weight: 700; }
.gf-scales { position: relative; height: 16px; }
.gf-scales span { position: absolute; top: 0; height: 16px; padding-left: 6px; font-size: 10px; line-height: 16px; color: var(--muted-text); overflow: hidden; white-space: nowrap; border-left: 1px solid var(--border-soft); }
.gf-scales span:nth-of-type(odd) { background: var(--surface-2); }
.gf-glab { position: sticky; left: 0; z-index: 4; float: left; width: 84px; height: 100%; padding: 0 6px; background: var(--surface); font-size: 10px; line-height: 1.1; font-weight: 700; color: var(--muted-text); display: flex; align-items: center; }
.gf-rib { position: relative; height: 28px; }
.gf-rib .gf-bar { --gf-c: var(--gf-reperes); height: 22px; margin-top: 3px; line-height: 20px; font-weight: 700; cursor: crosshair; }
.gf-lane { position: relative; padding-bottom: 6px; border-bottom: 1px solid var(--border-soft); }
.gf-lane-head { height: 30px; position: relative; }
.gf-pill {
    position: sticky; left: 8px; z-index: 5; display: inline-flex; align-items: center; gap: 6px; margin-top: 5px; padding: 3px 12px 3px 10px;
    border-radius: 999px; font: inherit; font-size: 13px; font-weight: 700; color: var(--text-dark); cursor: pointer;
    background: color-mix(in srgb, var(--gf-c) 22%, var(--surface)); border: 1px solid color-mix(in srgb, var(--gf-c) 55%, var(--surface));
}
.gf-heat { position: relative; height: 6px; margin-bottom: 5px; }
.gf-heat i { position: absolute; top: 0; height: 6px; background: var(--gf-c); }
.gf-row { position: relative; height: 24px; margin-bottom: 3px; }
.gf-bar {
    position: absolute; top: 0; height: 24px; box-sizing: border-box; padding: 0 7px; overflow: clip; white-space: nowrap; text-align: left; cursor: pointer;
    border-radius: 7px; font: inherit; font-size: 12px; font-weight: 600; line-height: 22px; color: var(--text-dark);
    background: color-mix(in srgb, var(--gf-c) 24%, var(--surface)); border: 1px solid color-mix(in srgb, var(--gf-c) 75%, var(--surface));
}
.gf-bar .gf-lb { position: sticky; left: 92px; display: inline-block; }
.gf-bar.is-approx { border-right-style: dotted; }
.gf-bar.is-cut-left { border-top-left-radius: 0; border-bottom-left-radius: 0; border-left-style: dotted; }
.gf-bar.is-cut-right { border-top-right-radius: 0; border-bottom-right-radius: 0; border-right-style: dotted; }
.gf-bar.is-selected { outline: 3px solid var(--text-dark); outline-offset: 1px; z-index: 3; }
.gf-bar:focus-visible, .gf-dot-ev:focus-visible, .gf-pill:focus-visible, .gf-mc:focus-visible { outline: 3px solid #2563eb; outline-offset: 2px; z-index: 3; }
.gf-bar .gf-fill { position: absolute; left: 0; bottom: 0; height: 4px; background: var(--gf-c); }
.gf-events { position: relative; margin-top: 2px; }
.gf-dot-ev { position: absolute; display: flex; align-items: center; gap: 5px; height: 18px; padding: 0; border: 0; background: none; font: inherit; font-size: 11px; color: var(--text-dark); white-space: nowrap; cursor: pointer; }
.gf-dot-ev::before { content: ""; flex: 0 0 11px; width: 11px; height: 11px; border-radius: 50%; background: var(--gf-c); border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--gf-c); }
.gf-dot-ev.is-ok::before { background: var(--progress-green); box-shadow: 0 0 0 1px var(--progress-green); }
.gf-dot-ev.is-todo::before { background: #d9822b; box-shadow: 0 0 0 1px #d9822b; }
.gf-dot-ev.is-new::before { background: var(--surface); box-shadow: 0 0 0 1px var(--muted-text); }
.gf-dot-ev.is-selected { font-weight: 700; }
.gf-dot-ev.is-selected::before { box-shadow: 0 0 0 3px var(--text-dark); }
.gf-ghost { position: absolute; top: 0; bottom: 0; z-index: 2; pointer-events: none; background: color-mix(in srgb, var(--gf-empires) 7%, transparent); border-left: 2px dashed var(--gf-empires); border-right: 2px dashed var(--gf-empires); }
.gf-cut { position: absolute; top: 0; bottom: 0; width: 0; z-index: 5; border-left: 2px solid var(--text-dark); pointer-events: none; }
.gf-cut b { position: sticky; top: 96px; display: inline-block; margin-top: 96px; transform: translateX(-50%); padding: 2px 9px; border-radius: 999px; background: var(--text-dark); color: var(--surface); font-size: 12px; white-space: nowrap; }

.gf-sheet { width: 100%; max-width: 900px; flex: 0 1 auto; max-height: 44vh; overflow: auto; padding: 8px 8px calc(env(safe-area-inset-bottom, 0px) + 8px); }
.gf-sheet.hidden { display: none; }
.gf-card { position: relative; display: flex; flex-direction: column; gap: 8px; padding-right: 36px; }
.gf-close { position: absolute; top: -2px; right: 0; width: 34px; height: 34px; border: 0; border-radius: 50%; background: transparent; color: var(--muted-text); font-size: 24px; line-height: 1; cursor: pointer; }
.gf-close:focus-visible { outline: 3px solid #2563eb; }
.gf-title { margin: 0; font-size: 18px; color: var(--text-dark); }
.gf-badges, .gf-chips, .gf-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.gf-badge { padding: 2px 10px; border-radius: 999px; border: 1px solid var(--gf-c, var(--border-soft)); background: var(--surface-2); font-size: 12px; font-weight: 600; color: var(--text-dark); }
.gf-mc { padding: 4px 11px; border-radius: 999px; font: inherit; font-size: 13px; color: var(--text-dark); cursor: pointer; border: 1px solid color-mix(in srgb, var(--gf-c) 60%, var(--surface)); background: color-mix(in srgb, var(--gf-c) 14%, var(--surface)); }
.gf-mc.is-static { cursor: default; }
.gf-mbar { height: 8px; border-radius: 5px; background: var(--border-soft); overflow: hidden; }
.gf-mbar i { display: block; height: 100%; background: var(--progress-green); }
.gf-else { display: flex; flex-direction: column; gap: 6px; }
.gf-else p { margin: 0; }

/* La Grande Frise : mondes du Chemin du Temps et disposition verticale (téléphone) */
.gf-bar.is-island { border-style: dashed; }
.gf-screen.is-vertical .gf-view { overflow-x: hidden; }
.gf-vstage { position: relative; --gf-vgut: 46px; }
.gf-vhdr { position: sticky; top: 0; z-index: 7; display: grid; grid-template-columns: var(--gf-vgut) repeat(3, 1fr); height: 66px; padding: 4px 0 0; background: var(--surface); border-bottom: 1px solid var(--border-soft); }
.gf-vcolhead { display: flex; flex-direction: column; gap: 2px; min-width: 0; margin-right: 4px; padding: 3px 4px; border-radius: 10px; background: color-mix(in srgb, var(--gf-c) 22%, var(--surface)); border: 1px solid color-mix(in srgb, var(--gf-c) 55%, var(--surface)); }
.gf-vsel { width: 100%; min-width: 0; height: 26px; padding: 0 2px; border: 0; border-radius: 6px; background: transparent; color: var(--text-dark); font: inherit; font-size: 12px; font-weight: 700; text-overflow: ellipsis; }
.gf-vsel-row { font-weight: 500; font-size: 11px; }
.gf-vsel:focus-visible { outline: 3px solid #2563eb; }
.gf-vstub { position: absolute; left: 0; right: 0; z-index: 0; background: repeating-linear-gradient(135deg, var(--surface-2) 0 6px, transparent 6px 12px); border-bottom: 2px solid var(--border-soft); }
.gf-vstub b { position: absolute; left: 4px; top: 4px; width: var(--gf-vgut); font-size: 9px; line-height: 1.1; color: var(--muted-text); }
.gf-vruler { position: absolute; left: 0; width: var(--gf-vgut); z-index: 3; cursor: crosshair; background: var(--surface); border-right: 1px solid var(--border-soft); }
.gf-vtick { position: absolute; left: 0; right: 0; border-top: 1px solid var(--border-soft); }
.gf-vtick span { position: absolute; right: 3px; top: 1px; font-size: 10px; color: var(--muted-text); white-space: nowrap; font-variant-numeric: tabular-nums; }
.gf-vtick.is-major span { color: var(--text-dark); font-weight: 700; }
.gf-vcol { position: absolute; left: calc(var(--gf-vgut) + (100% - var(--gf-vgut)) / 3 * var(--gf-i)); width: calc((100% - var(--gf-vgut)) / 3 - 4px); }
.gf-vheat { position: absolute; right: 0; top: 0; bottom: 0; width: 4px; }
.gf-vheat i { position: absolute; left: 0; right: 0; background: var(--gf-c); }
.gf-vbar {
    position: absolute; left: 0; width: 28px; box-sizing: border-box; padding: 5px 2px; overflow: clip; writing-mode: vertical-rl; white-space: nowrap; text-align: left; cursor: pointer;
    border-radius: 7px; font: inherit; font-size: 11px; font-weight: 600; line-height: 1.1; color: var(--text-dark);
    background: color-mix(in srgb, var(--gf-c) 24%, var(--surface)); border: 1px solid color-mix(in srgb, var(--gf-c) 75%, var(--surface));
}
.gf-vbar .gf-lb { position: static; }
.gf-vbar.is-approx { border-bottom-style: dotted; }
.gf-vbar.is-cut-top { border-top-left-radius: 0; border-top-right-radius: 0; border-top-style: dotted; }
.gf-vbar.is-cut-bottom { border-bottom-left-radius: 0; border-bottom-right-radius: 0; border-bottom-style: dotted; }
.gf-vbar.is-selected { outline: 3px solid var(--text-dark); outline-offset: 1px; z-index: 3; }
.gf-vbar .gf-fill { position: absolute; left: 0; top: 0; bottom: auto; width: 4px; background: var(--gf-c); }
.gf-vbar:focus-visible, .gf-vdot:focus-visible { outline: 3px solid #2563eb; outline-offset: 1px; z-index: 3; }
.gf-vdot { position: absolute; left: 32px; right: 6px; display: flex; align-items: flex-start; gap: 4px; padding: 0; border: 0; background: none; font: inherit; font-size: 10.5px; line-height: 1.15; text-align: left; color: var(--text-dark); cursor: pointer; }
.gf-vdot::before { content: ""; flex: 0 0 10px; width: 10px; height: 10px; margin-top: 1px; border-radius: 50%; background: var(--gf-c); border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--gf-c); }
.gf-vdot span { min-width: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.gf-vdot.is-ok::before { background: var(--progress-green); box-shadow: 0 0 0 1px var(--progress-green); }
.gf-vdot.is-todo::before { background: #d9822b; box-shadow: 0 0 0 1px #d9822b; }
.gf-vdot.is-new::before { background: var(--surface); box-shadow: 0 0 0 1px var(--muted-text); }
.gf-vdot.is-selected { font-weight: 700; }
.gf-vdot.is-selected::before { box-shadow: 0 0 0 3px var(--text-dark); }
.gf-vcut { position: absolute; left: 0; right: 0; z-index: 5; border-top: 2px solid var(--text-dark); pointer-events: none; }
.gf-vcut b { position: absolute; left: 0; top: -10px; width: calc(var(--gf-vgut) - 2px); padding: 1px 0; border-radius: 999px; background: var(--text-dark); color: var(--surface); font-size: 10px; text-align: center; white-space: nowrap; overflow: hidden; }
.simul-frise-btn { margin-top: 10px; width: 100%; }
/* Sur téléphone, la fiche laisse plus de place à la frise verticale. */
.gf-screen.is-vertical .gf-sheet { max-height: 34vh; }
.gf-screen.is-vertical.has-sheet .gf-view { flex: 1 1 56%; }

/* =========================================================================
   Défis cartes et repères (js/modes/geogames.js) : silhouettes, cartes muettes d'empires, curseur de distance.
   Les couleurs suivent le thème (--gg-*) ; les dessins sont des SVG sans texte.
   ========================================================================= */
:root {
    --gg-shape: #1f2933;
    --gg-land: #dfe5ea;
    --gg-sea: #cfe3f3;
}

:root[data-theme="dark"] {
    --gg-shape: #e8eef5;
    --gg-land: #27323f;
    --gg-sea: #0f1a26;
}

.gg-visual:empty { display: none; }

.gg-visual {
    display: flex;
    justify-content: center;
    margin: 12px 0;
}

.gg-shape {
    display: block;
    width: min(100%, 320px);
    height: auto;
    aspect-ratio: 1 / 1;
}

.gg-shape-path { fill: var(--gg-shape); }

.gg-map {
    display: block;
    width: 100%;
    max-width: 520px;
    height: auto;
    border-radius: 12px;
    border: 2px solid var(--border-soft);
    background: var(--gg-land);
}

.gg-land { fill: var(--gg-land); }
.gg-sea { fill: var(--gg-sea); stroke: none; }
.gg-zone { fill-opacity: 0.72; stroke-width: 3; stroke-linejoin: round; }

/* Deux silhouettes, ou trois ou quatre cartes, côte à côte : des cartes à toucher. */
.geoquiz-options.gg-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
}

.gg-card {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 10px;
    border-radius: 12px;
    border: 2px solid var(--border-soft);
    background: var(--surface);
    color: var(--text-dark);
    font: inherit;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}

@media (hover: hover) {
    .gg-card:hover:not(:disabled) { border-color: var(--primary-blue); }
}

.gg-card:disabled { cursor: default; }
.gg-card.placed { border-color: var(--primary-blue); background: var(--selected-tint); }
.gg-card.correct { background: rgba(44, 168, 90, 0.14); border-color: #2CA85A; }
.gg-card.wrong { background: rgba(186, 26, 26, 0.1); border-color: var(--danger-red); }
.gg-card .gg-shape { width: 100%; }
.gg-card-map .gg-map { border: 0; border-radius: 8px; }

.gg-caption {
    font-size: 13px;
    font-weight: 600;
    line-height: 1.3;
    text-align: center;
}

.gg-rank {
    position: absolute;
    top: 6px;
    left: 6px;
    z-index: 1;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-year);
    font-weight: 700;
    font-size: 14px;
    border: 1px dashed var(--muted-text);
    background: var(--surface);
    color: var(--muted-text);
}

.gg-card.placed .gg-rank {
    border-style: solid;
    border-color: var(--primary-blue);
    background: var(--primary-blue);
    color: var(--text-light);
}

/* Le curseur de distance. */
.gg-slider {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 12px 0;
}

.gg-slider-value {
    margin: 0;
    font-size: 24px;
    font-weight: 700;
    text-align: center;
    color: var(--text-dark);
}

.gg-range {
    width: 100%;
    min-height: 44px;
    accent-color: var(--primary-blue);
}

#gg-credit { margin-top: 16px; }

/* =========================================================================
   Régions et départements de France (js/modes/france.js) : le contour demandé, en couleur, sur la carte de France.
   ========================================================================= */
:root {
    --fr-hit: #e8590c;
}

:root[data-theme="dark"] {
    --fr-hit: #f2c14e;
}

.fr-svg {
    display: block;
    width: 100%;
    max-width: 420px;
    height: auto;
}

.fr-svg-alone { max-width: 300px; }
.fr-zone { fill: var(--gg-land); stroke: var(--surface); stroke-width: 1.2; stroke-linejoin: round; }
.fr-hit { fill: var(--fr-hit); stroke: var(--text-dark); stroke-width: 1.4; stroke-linejoin: round; }

/* Le nom du lieu demandé, sous la question (« Département : Ain » : pas d'article à accorder). */
.gg-sub {
    margin: 0;
    font-size: 17px;
    font-weight: 600;
    color: var(--text-dark);
}

.gg-sub.hidden { display: none; }

/* « Remplir la carte » (js/modes/admin.js) : les boutons sous la carte, côte à côte. */
.gg-fill-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 12px;
}

.gg-fill-actions .btn { flex: 1 1 140px; }
.gg-fill-actions.hidden { display: none; }

/* Fuseaux horaires : la ligne « Paris : 20:00 → Astana : ? » se lit avant tout. */
.gg-sub-strong {
    font-size: 17px;
    font-weight: 600;
    color: var(--text-dark);
}
