/**
 * game-how-to-play.css — Bouton « ? » + panneau de règles partagé des mini-jeux.
 * Chargé une fois par app/Views/layout/game-head-seo.php. Cf. game-how-to-play.js.
 *
 * Autonome : le panneau porte ses propres couleurs (overlay isolé), lisible quel
 * que soit le thème de la page de jeu. Dark géré via prefers-color-scheme et via
 * html[data-theme] quand la page le définit.
 */

.oplc-howto-btn {
    position: fixed;
    top: max(12px, env(safe-area-inset-top));
    right: max(12px, env(safe-area-inset-right));
    z-index: 2147483000;
    /* Audit a11y 2026-07-25 : 42px, sous le minimum de 44px recommande pour une
       cible tactile — et ce bouton est present sur les 246 pages de jeu. */
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.85);
    background: rgba(37, 99, 235, 0.92);
    color: #fff;
    font-size: 1.35rem;
    font-weight: 800;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition:
        transform 0.12s ease,
        background 0.12s ease;
}
.oplc-howto-btn:hover {
    background: rgba(29, 78, 216, 0.98);
    transform: scale(1.06);
}
.oplc-howto-btn:focus-visible {
    outline: 3px solid #fbbf24;
    outline-offset: 2px;
}

.oplc-howto-overlay {
    position: fixed;
    inset: 0;
    z-index: 2147483200;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(15, 23, 42, 0.62);
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
}
.oplc-howto-overlay.is-open {
    display: flex;
}

.oplc-howto-panel {
    width: 100%;
    max-width: 460px;
    max-height: 88vh;
    overflow-y: auto;
    background: #ffffff;
    color: #1e293b;
    border-radius: 18px;
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
    border: 1px solid rgba(0, 0, 0, 0.08);
    animation: oplc-howto-pop 0.18s ease-out;
}
@keyframes oplc-howto-pop {
    from {
        transform: translateY(12px) scale(0.97);
        opacity: 0;
    }
    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

.oplc-howto-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 18px 20px 10px;
}
.oplc-howto-title {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 800;
    color: #1d4ed8;
}
.oplc-howto-emoji {
    margin-right: 4px;
}
.oplc-howto-close {
    flex: 0 0 auto;
    /* Audit a11y 2026-07-25 : 34px. C'est la croix qui FERME le panneau de regles,
       affiche au premier lancement : un CP devait viser 34px pour commencer a
       jouer. Portee au minimum tactile de 44px. */
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.06);
    color: #334155;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}
.oplc-howto-close:hover {
    background: rgba(0, 0, 0, 0.12);
}
.oplc-howto-close:focus-visible {
    outline: 3px solid #2563eb;
    outline-offset: 2px;
}

.oplc-howto-body {
    padding: 4px 20px 8px;
}
.oplc-howto-gamename {
    margin: 0 0 12px;
    font-size: 1.02rem;
    font-weight: 700;
    color: #0f172a;
}
.oplc-howto-subtitle {
    margin: 14px 0 6px;
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #64748b;
}
.oplc-howto-goal {
    margin: 0;
    font-size: 1.05rem;
    line-height: 1.45;
    color: #1e293b;
}
.oplc-howto-steps {
    margin: 0;
    padding-left: 0;
    list-style: none;
}
.oplc-howto-steps li {
    position: relative;
    padding: 7px 0 7px 30px;
    font-size: 1rem;
    line-height: 1.4;
    color: #1e293b;
}
.oplc-howto-steps li::before {
    content: '\2713';
    position: absolute;
    left: 0;
    top: 7px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #dbeafe;
    color: #1d4ed8;
    font-size: 0.75rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
}
.oplc-howto-warn {
    margin: 14px 0 0;
    padding: 10px 12px;
    border-radius: 10px;
    background: #fef3c7;
    color: #92400e;
    font-size: 0.96rem;
    line-height: 1.4;
}

.oplc-howto-footer {
    padding: 12px 20px 20px;
}
.oplc-howto-ok {
    width: 100%;
    padding: 12px 16px;
    border: none;
    border-radius: 12px;
    background: #2563eb;
    color: #fff;
    font-size: 1.05rem;
    font-weight: 700;
    cursor: pointer;
}
.oplc-howto-ok:hover {
    background: #1d4ed8;
}
.oplc-howto-ok:focus-visible {
    outline: 3px solid #fbbf24;
    outline-offset: 2px;
}

/* -- Thème sombre : préférence système. -- */
@media (prefers-color-scheme: dark) {
    .oplc-howto-panel {
        background: #1e293b;
        color: #e2e8f0;
        border-color: rgba(255, 255, 255, 0.1);
    }
    .oplc-howto-title {
        color: #93c5fd;
    }
    .oplc-howto-gamename {
        color: #f1f5f9;
    }
    .oplc-howto-subtitle {
        color: #94a3b8;
    }
    .oplc-howto-goal,
    .oplc-howto-steps li {
        color: #e2e8f0;
    }
    .oplc-howto-close {
        background: rgba(255, 255, 255, 0.1);
        color: #cbd5e1;
    }
    .oplc-howto-close:hover {
        background: rgba(255, 255, 255, 0.18);
    }
    .oplc-howto-steps li::before {
        background: rgba(59, 130, 246, 0.25);
        color: #bfdbfe;
    }
    .oplc-howto-warn {
        background: rgba(251, 191, 36, 0.15);
        color: #fcd34d;
    }
}

/* -- Thème sombre : quand la page force html[data-theme="dark"]. -- */
:root[data-theme='dark'] .oplc-howto-panel {
    background: #1e293b;
    color: #e2e8f0;
    border-color: rgba(255, 255, 255, 0.1);
}
:root[data-theme='dark'] .oplc-howto-title {
    color: #93c5fd;
}
:root[data-theme='dark'] .oplc-howto-gamename {
    color: #f1f5f9;
}
:root[data-theme='dark'] .oplc-howto-subtitle {
    color: #94a3b8;
}
:root[data-theme='dark'] .oplc-howto-goal,
:root[data-theme='dark'] .oplc-howto-steps li {
    color: #e2e8f0;
}
:root[data-theme='dark'] .oplc-howto-close {
    background: rgba(255, 255, 255, 0.1);
    color: #cbd5e1;
}
:root[data-theme='dark'] .oplc-howto-steps li::before {
    background: rgba(59, 130, 246, 0.25);
    color: #bfdbfe;
}
:root[data-theme='dark'] .oplc-howto-warn {
    background: rgba(251, 191, 36, 0.15);
    color: #fcd34d;
}

/* -- Thème clair forcé : bat la préférence système sombre. -- */
:root[data-theme='light'] .oplc-howto-panel {
    background: #ffffff;
    color: #1e293b;
}
:root[data-theme='light'] .oplc-howto-title {
    color: #1d4ed8;
}
:root[data-theme='light'] .oplc-howto-goal,
:root[data-theme='light'] .oplc-howto-steps li {
    color: #1e293b;
}

@media (prefers-reduced-motion: reduce) {
    .oplc-howto-panel {
        animation: none;
    }
    .oplc-howto-btn {
        transition: none;
    }
}

/* ==========================================================================
   Bloc « Ce que travaille ce jeu » (game-seo-block.php) — contenu pédagogique
   visible en bas de chaque page jeu, rendu serveur. Autonome : les pages jeux
   ne chargent pas le socle CSS du site, donc couleurs posées ici, avec un fond
   plein qui reste lisible sur les décors très colorés des jeux.
   ========================================================================== */
.oplc-game-about {
    max-width: 860px;
    margin: 28px auto 20px;
    padding: 20px 24px;
    background: #ffffff;
    color: #1e293b;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    box-shadow: 0 2px 10px rgba(15, 23, 42, 0.08);
    font-family:
        system-ui,
        -apple-system,
        'Segoe UI',
        Roboto,
        sans-serif;
    font-size: 0.95rem;
    line-height: 1.55;
    text-align: left;
}
.oplc-game-about-title {
    margin: 0 0 10px;
    font-size: 1.1rem;
    font-weight: 700;
    color: #1d4ed8;
}
.oplc-game-about-objectif,
.oplc-game-about-modalites {
    margin: 0 0 10px;
}
.oplc-game-about-facts {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 28px;
    margin: 0 0 10px;
}
.oplc-game-about-facts div {
    min-width: 180px;
}
.oplc-game-about-facts dt {
    font-weight: 700;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #64748b;
}
.oplc-game-about-facts dd {
    margin: 2px 0 0;
}
.oplc-game-about-links {
    margin: 0;
    font-size: 0.9rem;
    color: #475569;
    /* Interligne genereux : ces liens se touchent au doigt sur les tablettes de
       classe, et ils ne faisaient que 19 px de haut (axe : target-size, seuil 24 px).
       WCAG tolere l'exception « lien en ligne dans une phrase », mais une cible de
       19 px reste penible pour un enfant — on la porte au seuil plutot que de se
       reposer sur l'exception. */
    line-height: 1.9;
}
.oplc-game-about-links a {
    color: #1d4ed8;
    text-decoration: underline;
    /* padding vertical + inline-block : la zone cliquable atteint 24 px sans
       decaler le texte autour (le line-height ci-dessus lui laisse la place). */
    display: inline-block;
    padding: 3px 1px;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme='light']) .oplc-game-about {
        background: #1e293b;
        color: #e2e8f0;
        border-color: #334155;
    }
    :root:not([data-theme='light']) .oplc-game-about-title,
    :root:not([data-theme='light']) .oplc-game-about-links a {
        color: #93c5fd;
    }
    :root:not([data-theme='light']) .oplc-game-about-facts dt,
    :root:not([data-theme='light']) .oplc-game-about-links {
        color: #94a3b8;
    }
}
:root[data-theme='dark'] .oplc-game-about {
    background: #1e293b;
    color: #e2e8f0;
    border-color: #334155;
}
:root[data-theme='dark'] .oplc-game-about-title,
:root[data-theme='dark'] .oplc-game-about-links a {
    color: #93c5fd;
}
:root[data-theme='dark'] .oplc-game-about-facts dt,
:root[data-theme='dark'] .oplc-game-about-links {
    color: #94a3b8;
}

@media print {
    .oplc-game-about {
        display: none;
    }
}

/* Ecrans tactiles : on agrandit encore, un doigt d'enfant vise moins bien
   qu'un curseur. Meme patron que les 16 autres feuilles du projet. */
@media (pointer: coarse) {
    .oplc-howto-btn {
        width: 48px;
        height: 48px;
    }

    .oplc-howto-close {
        width: 48px;
        height: 48px;
    }
}
