:root {
    --navy: #111a44;
    --bg: #f5f7fb;
    --surface: #ffffff;
    --surface-strong: #ffffff;
    --text: #162039;
    --muted: #65708a;
    --line: #dfe5f0;
    --accent: #2ca6a4;
    --accent-dark: #218c8a;
    --accent-soft: #eef9f8;
    --success: #087f5b;
    --success-soft: #edf9f4;
    --danger: #b42318;
    --danger-soft: #fdeceb;
    --shadow: 0 18px 55px rgba(42, 55, 98, 0.11);
    --radius: 22px;
    --carte-dos: #2f5fa8;
}

* { box-sizing: border-box; }

html { color-scheme: light; }

body {
    margin: 0;
    min-height: 100vh;
    background:
        radial-gradient(circle at 8% 5%, rgba(19, 184, 178, 0.14), transparent 26rem),
        radial-gradient(circle at 95% 0%, rgba(101, 49, 201, 0.12), transparent 28rem),
        var(--bg);
    color: var(--text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.55;
}

button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .62; }

/* En-tete/pied de page/texte de lien : desormais herites du style.css partage
   (jeux/assets/css/style.css, charge avant celui-ci) pour rester coherent avec
   le hub et les pages de jeux a enigme - voir inc/page-jeu-enigme.php. */

.page-shell { padding-bottom: 64px; }

.screen.is-hidden { display: none; }

.eyebrow {
    text-transform: uppercase;
    letter-spacing: .08em;
    font-size: 13px;
    font-weight: 700;
    color: var(--accent-dark);
    margin: 0 0 6px;
}

h1 { margin: 0 0 14px; font-size: clamp(26px, 4vw, 34px); }

.intro-text { color: var(--muted); margin: 0 0 28px; }

.text-button {
    background: none;
    border: none;
    color: var(--accent-dark);
    font-weight: 700;
    padding: 10px 0;
    text-decoration: underline;
}

.primary-button {
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 12px;
    padding: 12px 20px;
    font-weight: 700;
}

.primary-button:hover { background: var(--accent-dark); }

/* .site-footer : idem, style herite du CSS partage. */

/* --- Choix de mode / taille --- */

.mode-choix,
.difficulte-choix {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
    margin-bottom: 28px;
}

.mode-card,
.difficulte-card {
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: flex-start;
    text-align: left;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
}

.mode-card:hover,
.difficulte-card:hover { border-color: var(--accent); }

.difficulte-card.is-active {
    border-color: var(--accent);
    background: var(--accent-soft);
}

.mode-card-titre { font-weight: 800; font-size: 18px; color: var(--accent-dark); }
.mode-card-desc { color: var(--muted); font-size: 14px; }

/* --- Score / statut --- */

.scoreboard {
    display: flex;
    gap: 14px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.score-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 10px 18px;
    min-width: 74px;
}

.score-item.score-item-active {
    border-color: var(--accent);
    background: var(--accent-soft);
}

.score-label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--muted);
    font-weight: 700;
}

.score-valeur { font-size: 20px; font-weight: 800; color: var(--accent-dark); }

.statut-jeu {
    font-weight: 700;
    margin: 0 0 18px;
    font-size: 16px;
}

.statut-jeu.statut-victoire { color: var(--success); }
.statut-jeu.statut-nul { color: var(--muted); }

.jeu-actions {
    display: flex;
    align-items: center;
    gap: 18px;
    flex-wrap: wrap;
    margin-top: 20px;
}

/* --- Plateau Memory --- */

.plateau-memory {
    display: grid;
    gap: 10px;
    margin: 0 auto;
    perspective: 800px;
}

.carte-memory {
    aspect-ratio: 3 / 4;
    background: none;
    border: none;
    padding: 0;
}

.carte-interieur {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform .35s;
    transform-style: preserve-3d;
}

.carte-memory.est-retournee .carte-interieur,
.carte-memory.est-trouvee .carte-interieur {
    transform: rotateY(180deg);
}

.carte-face {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    border-radius: 14px;
    backface-visibility: hidden;
    box-shadow: var(--shadow);
    font-size: clamp(22px, 5vw, 32px);
}

.carte-face-dos {
    background: var(--carte-dos);
    color: #fff;
    font-size: clamp(18px, 4vw, 24px);
    font-weight: 800;
}

.carte-face-recto {
    background: var(--surface-strong);
    border: 1px solid var(--line);
    transform: rotateY(180deg);
}

.carte-memory.est-trouvee .carte-face-recto {
    background: var(--success-soft);
    border-color: var(--success);
}

.carte-memory:disabled { cursor: default; }
