/*
 * Gexplorer - Places secretes, zones a reperer, pieces.
 *
 * Chargee sur toutes les pages (includes/header.php) : la revelation peut
 * survenir partout ou la carte tourne, et la collection de pieces s'affiche
 * dans le profil. Voir assets/js/revelation.js et assets/js/secrets.js.
 */

/* --------------------------------------------------------------------
 *  La revelation
 * ------------------------------------------------------------------ */
.revelation {
    position: fixed; inset: 0; z-index: 10000;
    display: flex; align-items: center; justify-content: center;
    padding: 16px; box-sizing: border-box;
    transition: opacity .2s;
}
.revelation-fond {
    position: absolute; inset: 0; background: rgba(12, 14, 20, .62);
    animation: revelation-fondu .35s ease-out;
}
.revelation-fx {
    position: absolute; inset: 0; width: 100%; height: 100%;
    pointer-events: none; z-index: 3;
}
.revelation-fiche {
    position: relative; z-index: 2;
    width: min(92vw, 420px); max-height: 86vh; overflow: auto;
    border-radius: 20px; background: #fffaf0; color: #3b2a14;
    box-shadow: 0 14px 36px rgba(0, 0, 0, .45);
    opacity: 0; transform: scale(.35);
}
.revelation-photo img { display: block; width: 100%; max-height: 38vh; object-fit: cover; }
.revelation-contenu { padding: 14px 16px 16px; }
.revelation-lieu {
    font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: #9a7a45;
    /* La place de la pastille des points, posee en haut a droite. */
    padding-right: 74px;
}
.revelation-photo + .revelation-contenu .revelation-lieu { padding-right: 0; }
.revelation-titre {
    margin: 4px 0 10px; font: 700 22px/1.25 Georgia, "Times New Roman", serif;
    background: linear-gradient(100deg, #3b2a14 40%, #f6d27a 50%, #3b2a14 60%) 200% 0 / 300% 100%;
    -webkit-background-clip: text; background-clip: text; color: transparent;
}
.revelation-fiche.vue .revelation-titre { animation: revelation-brille 1.6s .3s ease-out; }
.revelation-corps { font-size: 15px; line-height: 1.5; color: #5b4a33; }
.revelation-corps p { margin: 0 0 10px; }
.revelation-corps img { max-width: 100%; border-radius: 10px; }
.revelation-corps audio { width: 100%; margin: 6px 0; }
.revelation-points {
    position: absolute; right: 10px; top: 10px; z-index: 3;
    padding: 5px 13px; border-radius: 16px; color: #fff; font-weight: 800; font-size: 17px;
    background: linear-gradient(135deg, #f6c75a, #c8861f); box-shadow: 0 3px 10px rgba(0, 0, 0, .35);
}
.revelation-fermer { display: block; width: 100%; margin-top: 14px; }

/* Facile : la fiche est deja la, sous le voile qui s'ouvre. */
.revelation-facile .revelation-fiche { transform: none; transition: opacity .3s; }
.revelation-facile .revelation-fiche.vue { opacity: 1; }
/* Moyen : le parchemin se deroule. */
.revelation-moyen .revelation-fiche {
    transform-origin: 50% 0; transform: scaleY(.02);
    background:
        radial-gradient(circle at 20% 15%, rgba(160, 110, 40, .12), transparent 40%),
        radial-gradient(circle at 85% 80%, rgba(160, 110, 40, .16), transparent 45%),
        linear-gradient(#f8eccd, #f1dfb4);
    border-top: 12px solid #c9a05b; border-bottom: 12px solid #a77a38;
}
.revelation-moyen .revelation-fiche.vue {
    opacity: 1; transform: scaleY(1);
    transition: transform .95s cubic-bezier(.2, .9, .25, 1.05), opacity .15s;
}
/* Difficile : la fiche jaillit, dans un halo qui respire. */
.revelation-difficile .revelation-fiche.vue {
    opacity: 1; transform: scale(1);
    transition: transform .75s cubic-bezier(.17, 1.65, .4, 1), opacity .2s;
    animation: revelation-halo 1.8s .7s ease-in-out infinite alternate;
}
/* Mouvement reduit : un fondu, rien d'autre. */
.revelation-sobre .revelation-fiche { transform: none; transition: opacity .4s; }
.revelation-sobre .revelation-fiche.vue { opacity: 1; animation: none; }
.revelation-sobre .revelation-fiche.vue .revelation-titre { animation: none; color: #3b2a14; background: none; }

.revelation-secousse { animation: revelation-secousse .6s cubic-bezier(.36, .07, .19, .97); }
.revelation-sortie { opacity: 0; }

@keyframes revelation-fondu { from { opacity: 0; } }
@keyframes revelation-brille { to { background-position: -100% 0; } }
@keyframes revelation-halo {
    from { box-shadow: 0 14px 36px rgba(0, 0, 0, .45), 0 0 0 0 rgba(242, 184, 75, 0); }
    to   { box-shadow: 0 14px 36px rgba(0, 0, 0, .45), 0 0 30px 6px rgba(242, 184, 75, .75); }
}
@keyframes revelation-secousse {
    0% { transform: translate(0, 0); } 12% { transform: translate(-7px, 4px) rotate(-.6deg); }
    26% { transform: translate(8px, -5px) rotate(.6deg); } 40% { transform: translate(-6px, -3px); }
    55% { transform: translate(5px, 5px); } 70% { transform: translate(-3px, -2px); }
    85% { transform: translate(2px, 1px); } 100% { transform: translate(0, 0); }
}
@media (prefers-reduced-motion: reduce) {
    .revelation-fond, .revelation-secousse { animation: none; }
}

/* --------------------------------------------------------------------
 *  Les medaillons des places secretes sur la carte
 * ------------------------------------------------------------------ */
.marqueur-secret {
    width: 34px; height: 34px; border-radius: 50%; box-sizing: border-box;
    display: flex; align-items: center; justify-content: center; cursor: pointer;
    font: 800 19px/1 Georgia, "Times New Roman", serif; color: #fff;
    border: 3px solid #fff7df; box-shadow: 0 2px 8px rgba(0, 0, 0, .4), 0 0 0 3px rgba(242, 184, 75, .45);
    text-shadow: 0 1px 2px rgba(0, 0, 0, .45);
    animation: secret-pouls 2.2s ease-in-out infinite;
}
.marqueur-secret.secret-facile    { background: radial-gradient(circle at 35% 30%, #7fb8e0, #3b78a8); }
.marqueur-secret.secret-moyen     { background: radial-gradient(circle at 35% 30%, #e3685f, #9c2621); }
.marqueur-secret.secret-difficile { background: radial-gradient(circle at 35% 30%, #f6d36e, #b8860b); }
.marqueur-secret.trouve {
    animation: none; opacity: .85; font: 800 17px/1 system-ui, sans-serif;
    box-shadow: 0 2px 6px rgba(0, 0, 0, .3);
}
.marqueur-secret:focus-visible { outline: 3px solid #2f74e6; outline-offset: 2px; }
@keyframes secret-pouls {
    50% { box-shadow: 0 2px 8px rgba(0, 0, 0, .4), 0 0 0 9px rgba(242, 184, 75, 0); }
}
@media (prefers-reduced-motion: reduce) { .marqueur-secret { animation: none; } }

/* --------------------------------------------------------------------
 *  Zones a reperer (pied de la fiche d'un lieu)
 * ------------------------------------------------------------------ */
.secrets-zones {
    margin: 14px 0; padding: 12px 14px; border-radius: 14px;
    background: linear-gradient(160deg, rgba(242, 184, 75, .16), rgba(242, 184, 75, .05));
    border: 1px solid rgba(201, 162, 39, .45);
}
.secrets-zones h3 { margin: 0 0 6px; font-size: 1.05em; }
.zone-secrete { padding: 10px 0; border-top: 1px dashed rgba(201, 162, 39, .45); }
.zone-secrete:first-of-type { border-top: 0; }
.zone-secrete h4 { margin: 0 0 4px; }
.zone-secrete p { margin: 4px 0; }
.zone-secrete.trouvee h4::before { content: '✓ '; color: #2e7d32; }
.zone-secrete .ligne-entre { gap: 8px; }
.zone-secrete .zone-reponse { flex: 1; min-width: 0; }
.zone-options { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.zone-indice { margin-top: 8px; }
.zone-indice-texte { font-style: italic; }
.zone-message:empty { display: none; }
.zone-message { color: #b8322c; font-weight: 600; }

/* --------------------------------------------------------------------
 *  Etoiles de la fiche revelee
 * ------------------------------------------------------------------ */
.secret-etoiles { margin-top: 12px; display: flex; align-items: center; gap: 2px; flex-wrap: wrap; }
.secret-etoiles button {
    border: 0; background: none; padding: 2px 3px; font-size: 26px; line-height: 1; cursor: pointer;
    color: #d9cfbd;
}
.secret-etoiles button.choisie { color: #e0a32e; }
.secret-etoiles button:focus-visible { outline: 2px solid #2f74e6; border-radius: 4px; }
.secret-revele figure { margin: 10px 0; }
.secret-revele figcaption { font-size: 12px; margin-top: 4px; }

/* --------------------------------------------------------------------
 *  Panneau du radar chaud / froid d'une place secrete
 * ------------------------------------------------------------------ */
.radar-secret {
    position: fixed; left: 50%; bottom: calc(84px + env(safe-area-inset-bottom, 0px)); z-index: 900;
    transform: translateX(-50%);
    display: flex; align-items: center; gap: 10px;
    padding: 8px 8px 8px 16px; border-radius: 22px;
    background: rgba(20, 22, 28, .88); color: #fff; font-weight: 700;
    box-shadow: 0 0 0 3px var(--radar-couleur, #c9a227), 0 6px 18px rgba(0, 0, 0, .35);
}
.radar-secret[hidden] { display: none; }
.radar-secret-stop {
    border: 0; border-radius: 50%; width: 30px; height: 30px; cursor: pointer;
    background: rgba(255, 255, 255, .15); color: #fff; font-size: 18px; line-height: 1;
}
.piece-gagnee { display: inline-block; animation: piece-tourne 1.2s ease-out; }
@keyframes piece-tourne { from { transform: rotateY(0) scale(.4); } to { transform: rotateY(720deg) scale(1); } }
@media (prefers-reduced-motion: reduce) { .piece-gagnee { animation: none; } }

/* --------------------------------------------------------------------
 *  La collection de pieces (profil) et les scores (compagnons)
 * ------------------------------------------------------------------ */
.collection-pieces {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 12px; margin: 14px 0;
}
.collection-pieces .piece { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; }
.piece-face {
    width: 58px; height: 58px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
    font-size: 28px; background: radial-gradient(circle at 35% 30%, #e9e5dc, #b9b3a6);
    box-shadow: inset 0 0 0 4px rgba(255, 255, 255, .35), 0 2px 6px rgba(0, 0, 0, .2);
    filter: grayscale(1); opacity: .45;
}
.piece-face img { width: 70%; height: 70%; object-fit: contain; }
.piece.gagnee .piece-face {
    filter: none; opacity: 1;
    background: radial-gradient(circle at 35% 30%, #fbe7a6, #d29a2a 70%, #a8741a);
    box-shadow: inset 0 0 0 4px rgba(255, 244, 205, .55), 0 3px 10px rgba(168, 116, 26, .45);
}
.piece.rare .piece-face { background: radial-gradient(circle at 35% 30%, #e9f2ff, #8ea9d8 70%, #5b78ad); }
.piece-nom { font-size: 12px; font-weight: 600; line-height: 1.2; }
.piece-nb { font-size: 11px; opacity: .75; }
.scores-secrets h3 { margin: 18px 0 6px; }
.liste-scores { margin: 0; padding-left: 22px; }
.liste-scores li { margin: 4px 0; }
.liste-scores .nom { font-weight: 700; }
.liste-scores .detail { opacity: .8; font-size: .92em; }

/* .btn impose un display (app.css) qui l'emporte sur l'attribut hidden :
 * sans cette regle, « Chercher » et « Arreter le radar » s'affichaient
 * ensemble. */
.secret-commandes [hidden] { display: none !important; }
