/* =============================================================================
   PORTATOUT — LA CHARTE DU ROYAUME
   Fichier : /assets/css/royaume.css
   11 nov. 2026 (etape 2-A) : creation.
   11 nov. 2026 (etape 2-C) : cartes alignees dans les grilles.

   Ce fichier contient les REGLES (comment un bouton, une carte, un message est
   construit). Les VALEURS (couleurs, polices, tailles, saisons) sont rangees en
   base dans pt_style_jetons et pt_saisons ; /assets/css/jetons.php en fait
   une petite feuille, chargee avant celle-ci et gardee en memoire par le navigateur.
   Les valeurs ecrites ci-dessous dans :root ne servent que de secours, si ce
   petit fichier manque : elles sont identiques aux valeurs de depart en base.

   Toutes les classes communes commencent par « rk- » (Royaume) pour ne jamais
   se melanger avec les anciennes classes des pages.
   Pense d'abord pour le telephone : une colonne, grandes zones a toucher (44 px).
   ============================================================================= */

/* ---------- 1. Valeurs de secours (remplacees par celles de la base, /assets/css/jetons.php) ----------
   :where(:root) a une priorite nulle : les valeurs de la base gagnent toujours, quel que soit l'ordre des feuilles. */
:where(:root) {
    --rk-fond: #140d08;
    --rk-fond-2: #1d130b;
    --rk-bois: #2a1b10;
    --rk-bois-clair: #3a2616;
    --rk-bordure: #5a3d22;
    --rk-parchemin: #f3e3c3;
    --rk-encre: #2a1606;
    --rk-texte: #f3e7d3;
    --rk-texte-doux: #c9b494;
    --rk-or: #f2b632;
    --rk-or-clair: #ffd977;
    --rk-succes: #7fd18b;
    --rk-erreur: #ff8a7a;
    --rk-info: #8ec5ff;
    --rk-rarete-1: #c9b494;
    --rk-rarete-2: #6fa8ff;
    --rk-rarete-3: #d38cff;
    --rk-police-titre: Georgia, "Times New Roman", serif;
    --rk-police-texte: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --rk-taille-texte: 16px;
    --rk-arrondi: 12px;
    --rk-espace: 16px;
    --rk-largeur-page: 760px;
    --rk-largeur-large: 1120px;
    --rk-toucher: 44px;
    /* Saison (automne par defaut). Les anciens noms --saison-* restent pour les anciennes pages. */
    --saison-bg: #160d08;
    --saison-accent: #f59e0b;
    --saison-border: #d97706;
    --saison-header: rgba(34, 15, 19, 0.96);
}

/* ---------- 2. Remise a zero (corrige la regle « * » perdue dans style.css) ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
img, svg, video, canvas { max-width: 100%; height: auto; }
button, input, select, textarea { font: inherit; color: inherit; }

/* Pour qui demande moins de mouvement (reglage de l'appareil) : animations coupees */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ---------- 3. Page ---------- */
.rk-page {
    width: min(100% - 24px, var(--rk-largeur-page));
    margin: 18px auto 40px;
    font-family: var(--rk-police-texte);
    font-size: var(--rk-taille-texte);
    line-height: 1.5;
    color: var(--rk-texte);
}
.rk-page--large { width: min(100% - 24px, var(--rk-largeur-large)); }

.rk-retour {
    display: inline-flex; align-items: center; gap: 6px;
    min-height: var(--rk-toucher);
    color: var(--rk-or); font-weight: 600; text-decoration: none;
}
.rk-retour:hover, .rk-retour:focus-visible { color: var(--rk-or-clair); text-decoration: underline; }

.rk-titre {
    font-family: var(--rk-police-titre);
    font-size: clamp(1.45rem, 4.5vw, 2rem);
    line-height: 1.2;
    color: var(--rk-or);
    margin: 4px 0 6px;
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.rk-titre .rk-icone { font-size: 1.15em; }
.rk-chapeau { color: var(--rk-texte-doux); margin: 0 0 var(--rk-espace); }
.rk-chapeau strong { color: var(--rk-texte); }

.rk-sous-titre {
    font-family: var(--rk-police-titre);
    font-size: 1.15rem; color: var(--rk-or);
    margin: 0 0 10px;
}

/* ---------- 4. Cartes ---------- */
.rk-carte {
    background: linear-gradient(180deg, var(--rk-bois) 0%, var(--rk-fond-2) 100%);
    border: 1px solid var(--rk-bordure);
    border-radius: var(--rk-arrondi);
    padding: var(--rk-espace);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
}
.rk-carte + .rk-carte { margin-top: var(--rk-espace); }
/* [Etape 2-C] dans une grille, c'est l'espace de la grille qui separe les cartes */
.rk-grille > .rk-carte + .rk-carte { margin-top: 0; }
.rk-carte--parchemin {
    background: var(--rk-parchemin);
    color: var(--rk-encre);
    border-color: #c9a46a;
}
.rk-carte--parchemin .rk-sous-titre { color: #7a4b16; }
.rk-carte--accent { border-color: var(--saison-border); box-shadow: 0 0 0 1px var(--saison-border), 0 6px 24px rgba(0, 0, 0, 0.35); }

/* Zone de jeu : le plateau, les rouleaux, la roue... centres dans la carte */
.rk-zone-jeu {
    display: flex; flex-direction: column; align-items: center; gap: var(--rk-espace);
    padding: 8px 0;
    text-align: center;
}

/* ---------- 5. Boutons ---------- */
.rk-bouton {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    min-height: var(--rk-toucher);
    padding: 10px 20px;
    border: 0; border-radius: 10px;
    background: linear-gradient(180deg, var(--rk-or-clair) 0%, var(--rk-or) 100%);
    color: var(--rk-encre);
    font-weight: 700; font-size: 1rem; letter-spacing: 0.2px;
    text-decoration: none; cursor: pointer;
    box-shadow: 0 3px 0 rgba(0, 0, 0, 0.35);
    transition: transform 0.08s ease, filter 0.15s ease;
}
.rk-bouton:hover { filter: brightness(1.05); }
.rk-bouton:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(0, 0, 0, 0.35); }
.rk-bouton:focus-visible { outline: 3px solid var(--rk-info); outline-offset: 2px; }
.rk-bouton--secondaire {
    background: var(--rk-bois-clair); color: var(--rk-texte);
    border: 1px solid var(--rk-bordure);
}
.rk-bouton--discret { background: transparent; color: var(--rk-or); box-shadow: none; border: 1px solid var(--rk-bordure); }
.rk-bouton--large { width: 100%; }
.rk-bouton:disabled, .rk-bouton[aria-disabled="true"] {
    background: #3a332d; color: #9a8f82; box-shadow: none; cursor: not-allowed; filter: none; transform: none;
}
@media (max-width: 560px) { .rk-bouton--principal { width: 100%; } }

/* ---------- 6. Messages ---------- */
.rk-message {
    border-radius: 10px; padding: 10px 14px;
    border-left: 4px solid var(--rk-or);
    background: rgba(242, 182, 50, 0.10);
    color: var(--rk-texte);
    min-height: 1.5em;
}
.rk-message:empty { display: none; }
.rk-message--succes { border-left-color: var(--rk-succes); background: rgba(127, 209, 139, 0.12); }
.rk-message--erreur { border-left-color: var(--rk-erreur); background: rgba(255, 138, 122, 0.12); }
.rk-message--info { border-left-color: var(--rk-info); background: rgba(142, 197, 255, 0.10); }

/* ---------- 7. Petites pastilles, raretes, compteurs ---------- */
.rk-pastille {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 3px 10px; border-radius: 999px;
    background: var(--rk-bois-clair); border: 1px solid var(--rk-bordure);
    font-size: 0.85rem; color: var(--rk-texte);
}
.rk-pastille strong { color: var(--rk-or-clair); }
.rk-rarete { font-size: 0.78rem; padding: 1px 8px; border-radius: 999px; border: 1px solid currentColor; }
.rk-rarete--1 { color: var(--rk-rarete-1); }
.rk-rarete--2 { color: var(--rk-rarete-2); }
.rk-rarete--3 { color: var(--rk-rarete-3); }
/* Sur parchemin clair, couleurs plus sombres pour rester lisibles */
.rk-carte--parchemin .rk-rarete--1 { color: #6b5233; }
.rk-carte--parchemin .rk-rarete--2 { color: #1f5fbf; }
.rk-carte--parchemin .rk-rarete--3 { color: #8a2fc0; }

/* ---------- 8. Grilles et onglets ---------- */
.rk-grille { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); }
.rk-rangee { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.rk-onglets { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; scrollbar-width: thin; }
.rk-onglet {
    flex: 0 0 auto; min-height: 38px; padding: 6px 14px;
    border-radius: 999px; border: 1px solid var(--rk-bordure);
    background: var(--rk-bois-clair); color: var(--rk-texte);
    cursor: pointer; white-space: nowrap; text-decoration: none;
}
.rk-onglet[aria-selected="true"], .rk-onglet.rk-actif { background: var(--rk-or); color: var(--rk-encre); border-color: var(--rk-or); font-weight: 700; }

/* ---------- 9. Formulaires ---------- */
.rk-champ { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.rk-champ label { font-weight: 600; color: var(--rk-texte); }
.rk-champ input, .rk-champ select, .rk-champ textarea {
    min-height: var(--rk-toucher);
    padding: 10px 12px; border-radius: 10px;
    border: 1px solid var(--rk-bordure); background: var(--rk-fond);
    color: var(--rk-texte); font-size: 16px; /* 16 px : evite le zoom automatique sur iPhone */
}
.rk-champ input:focus, .rk-champ select:focus, .rk-champ textarea:focus { outline: 2px solid var(--rk-or); outline-offset: 1px; }
.rk-champ small { color: var(--rk-texte-doux); }

/* ---------- 10. Tableaux (classement, registre...) ---------- */
.rk-tableau-boite { overflow-x: auto; }
.rk-tableau { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.rk-tableau th, .rk-tableau td { padding: 10px 8px; text-align: left; border-bottom: 1px solid var(--rk-bordure); }
.rk-tableau th { color: var(--rk-or); font-weight: 700; }
.rk-tableau tr.rk-moi td { background: rgba(242, 182, 50, 0.10); }

/* ---------- 11. Aides ---------- */
.rk-centre { text-align: center; }
.rk-doux { color: var(--rk-texte-doux); }
.rk-masque-visuel {
    position: absolute !important; width: 1px; height: 1px; overflow: hidden;
    clip: rect(0 0 0 0); white-space: nowrap;
}

/* =============================================================================
   12. EN-TETE, MENU ET BARRE DE SAISON DU SITE
   11 nov. 2026 (etape 2-A) : style deplace tel quel depuis /includes/header.php,
   ou il etait ecrit dans chaque page. Les couleurs de saison (--saison-*)
   viennent maintenant de la base (pt_saisons) par /assets/css/jetons.php.
   ============================================================================= */
body {
    background-color: var(--saison-bg) !important;
    color: #f0f6fc;
    margin: 0;
    padding: 0;
    font-family: system-ui, -apple-system, sans-serif;
    overflow-x: hidden;
}
.royal-event-top-bar {
    background: linear-gradient(90deg, #1e1b4b, #31102f, #1e1b4b);
    color: #fef08a;
    text-align: center;
    padding: 7px 14px;
    font-size: 0.85rem;
    font-weight: 700;
    border-bottom: 1px solid rgba(250, 204, 21, 0.35);
    position: relative;
    z-index: 100001;
}
.site-header-royaume {
    position: sticky;
    top: 0;
    z-index: 100000 !important;
    background: var(--saison-header);
    border-bottom: 2px solid var(--saison-border);
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.75);
    padding: 0 24px;
    backdrop-filter: blur(8px);
    overflow: visible !important;
}
.header-inner-flex {
    max-width: 1420px;
    margin: 0 auto;
    min-height: 68px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 14px;
    overflow: visible !important;
}
.brand-logo-royaume {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    font-size: 1.45rem;
    font-weight: 900;
    color: var(--saison-accent);
    letter-spacing: 1px;
}
.nav-royaume-list {
    display: flex;
    align-items: center;
    gap: 6px;
    list-style: none;
    margin: 0;
    padding: 0;
    flex-wrap: wrap;
    overflow: visible !important;
}
.nav-royaume-item {
    position: relative;
    z-index: 100002;
}
.nav-royaume-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 14px;
    color: #f8fafc;
    text-decoration: none;
    font-weight: 700;
    font-size: 0.94rem;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    user-select: none;
}
.nav-royaume-link:hover,
.nav-royaume-item:hover > .nav-royaume-link,
.nav-royaume-item.open > .nav-royaume-link {
    background: rgba(255, 255, 255, 0.1);
    color: var(--saison-accent);
}
.nav-royaume-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    padding-top: 8px;
    min-width: 255px;
    display: none;
    z-index: 100005 !important;
}
.nav-royaume-item:hover > .nav-royaume-dropdown,
.nav-royaume-item.open > .nav-royaume-dropdown {
    display: block !important;
}
.nav-royaume-dropdown-inner {
    background: #111827;
    border: 2px solid var(--saison-border);
    border-radius: 10px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.95);
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.nav-royaume-dropdown-inner a {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 9px 12px;
    color: #e2e8f0;
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 600;
    border-radius: 6px;
    transition: 0.15s;
}
.nav-royaume-dropdown-inner a:hover {
    background: var(--saison-accent);
    color: #0f172a;
    font-weight: 800;
}
.header-user-zone {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}
.user-xp-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(15, 23, 42, 0.85);
    border: 1px solid #475569;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.84rem;
    color: #f8fafc;
    text-decoration: none;
}
.badge-xp-gold {
    background: var(--saison-accent);
    color: #0f172a;
    font-weight: 800;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.78rem;
}
.badge-ecus-lune {
    background: #e2e8f0;
    color: #0f172a;
    font-weight: 800;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.78rem;
}
.btn-auth-royaume {
    background: #facc15;
    color: #0f172a !important;
    font-weight: 800;
    padding: 8px 16px;
    border-radius: 8px;
    text-decoration: none;
    font-size: 0.88rem;
    border: 1px solid #fde047;
    transition: 0.2s;
}
.btn-auth-royaume:hover {
    background: #fde047;
    transform: translateY(-1px);
}
.saison-control-bar {
    max-width: 1120px;
    margin: 12px auto 6px auto;
    padding: 8px 18px;
    background: rgba(17, 24, 39, 0.9);
    border: 1px solid var(--saison-border);
    border-radius: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    position: relative;
    z-index: 50;
    box-shadow: 0 4px 16px rgba(0,0,0,0.45);
}
.saison-pill-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 700;
    background: rgba(245, 158, 11, 0.15);
    border: 1px solid var(--saison-border);
    color: #fde68a;
}

/* [Correctif L2] Bouton « Installer Portatout » (cache tant que l'installation n'est pas possible) */
.btn-installer-royaume {
    display: none;
    align-items: center;
    gap: 6px;
    background: linear-gradient(135deg, #064e3b, #022c22);
    color: #a7f3d0;
    border: 1px solid #10b981;
    border-radius: 8px;
    padding: 7px 12px;
    font-weight: 800;
    font-size: 0.84rem;
    cursor: pointer;
    font-family: inherit;
}
.btn-installer-royaume.visible { display: inline-flex; }
.btn-installer-royaume:hover { background: #10b981; color: #022c22; }
.aide-install-fond {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    z-index: 100010;
    align-items: center;
    justify-content: center;
    padding: 16px;
}
.aide-install-fond.visible { display: flex; }
.aide-install-boite {
    background: #111827;
    border: 2px solid var(--saison-border);
    border-radius: 14px;
    max-width: 380px;
    width: 100%;
    padding: 18px 20px;
    color: #e2e8f0;
    text-align: center;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.95);
}
.aide-install-boite img { width: 72px; height: 72px; border-radius: 16px; }
.aide-install-boite h3 { color: var(--saison-accent); margin: 10px 0 8px 0; font-size: 1.1rem; }
.aide-install-boite ol { text-align: left; padding-left: 22px; margin: 8px 0 14px 0; line-height: 1.55; font-size: 0.92rem; }
.aide-install-boite button {
    background: var(--saison-accent);
    color: #0f172a;
    border: none;
    border-radius: 8px;
    padding: 9px 18px;
    font-weight: 800;
    cursor: pointer;
    font-family: inherit;
}

/* [Correctif L2] Bouton du menu repliable : invisible sur grand ecran */
.btn-burger-royaume { display: none; }

/* [Correctif L2] SMARTPHONE ET PETITE TABLETTE : en-tete compact, menus en accordeon */
@media (max-width: 900px) {
    .site-header-royaume {
        position: relative;
        padding: 0 10px;
    }
    .header-inner-flex {
        min-height: 54px;
        gap: 8px;
        padding: 6px 0;
    }
    .brand-logo-royaume { font-size: 1.15rem; gap: 6px; }
    .btn-burger-royaume {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 44px;
        height: 40px;
        margin-left: auto;
        background: rgba(255, 255, 255, 0.08);
        border: 1px solid var(--saison-border);
        border-radius: 8px;
        color: #f8fafc;
        font-size: 1.35rem;
        line-height: 1;
        cursor: pointer;
        font-family: inherit;
    }
    .site-header-royaume nav { display: none; width: 100%; order: 3; }
    .site-header-royaume.menu-ouvert nav { display: block; }
    .nav-royaume-list {
        flex-direction: column;
        align-items: stretch;
        gap: 2px;
        padding: 4px 0 8px 0;
    }
    .nav-royaume-link {
        display: flex;
        justify-content: space-between;
        padding: 12px 10px;
    }
    /* au doigt, pas de survol : un menu ne s'ouvre que lorsqu'on le touche */
    .nav-royaume-item:hover > .nav-royaume-dropdown { display: none !important; }
    .nav-royaume-item.open > .nav-royaume-dropdown { display: block !important; }
    .nav-royaume-dropdown {
        position: static;
        min-width: 0;
        padding: 0 0 6px 12px;
    }
    .nav-royaume-dropdown-inner a { padding: 11px 12px; font-size: 0.92rem; }
    .header-user-zone { order: 2; gap: 6px; width: 100%; }
    .user-xp-pill { padding: 4px 9px; font-size: 0.78rem; }
    .user-xp-pill small { display: none; }
    .btn-auth-royaume { padding: 6px 10px; font-size: 0.78rem; }
    .btn-installer-royaume { padding: 6px 10px; font-size: 0.78rem; }
    .saison-control-bar { margin: 8px 8px 4px 8px; padding: 6px 10px; gap: 6px; }
}

/* [Etape 2-A] Le menu « Ambiance » reste dans la largeur de l'ecran, meme avec les noms longs des fetes */
.saison-control-bar form { max-width: 100%; min-width: 0; flex-wrap: wrap; }
#selectAmbianceHdr { max-width: 100%; min-width: 0; text-overflow: ellipsis; }

/* [Paquet 1-F] Annonce du Royaume : parchemin de recompense en bas de l'ecran (portatoutAnnonce) */
.rk-annonces {
    position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%);
    z-index: 9999; width: min(92vw, 440px);
    display: flex; flex-direction: column; gap: 8px;
    pointer-events: none;
}
.rk-annonce {
    background: var(--rk-bois, #2a1d14);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45);
    font-size: 0.95rem; line-height: 1.35;
    animation: rk-annonce-arrivee 0.35s ease-out;
    transition: opacity 0.5s ease, transform 0.5s ease;
}
.rk-annonce--depart { opacity: 0; transform: translateY(10px); }
@keyframes rk-annonce-arrivee {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
    .rk-annonce { animation: none; transition: none; }
}
