/* ============================================
   FOOTMANIACS - Styles principaux
   ============================================ */

:root {
    --color-primary: #2ecc40;
    --color-primary-dark: #27ae36;
    --color-secondary: #0074d9;
    --color-bg: #1a1a2e;
    --color-surface: #16213e;
    --color-text: #f5f5f5;
    --color-muted: #8892b0;
    --color-accent: #ff6b35;
    --font-main: 'Segoe UI', system-ui, -apple-system, sans-serif;
    --font-title: 'Impact', 'Arial Black', sans-serif;
    --radius: 12px;
    --radius-lg: 20px;
}

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-main);
    background: var(--color-bg);
    color: var(--color-text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ---- Splash screen [T3] ---- */
.splash {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: var(--color-bg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.2rem;
    transition: opacity 0.4s ease-out;
}

.splash--hidden {
    opacity: 0;
    pointer-events: none;
}

.splash__logo {
    animation: splashBounce 1s ease-in-out infinite alternate;
}

@keyframes splashBounce {
    from { transform: translateY(0); }
    to   { transform: translateY(-8px); }
}

.splash__text {
    color: var(--color-muted);
    font-size: 0.9rem;
    letter-spacing: 1px;
}

.splash__bar {
    width: 140px;
    height: 4px;
    background: var(--color-surface);
    border-radius: 2px;
    overflow: hidden;
}

.splash__fill {
    width: 30%;
    height: 100%;
    background: var(--color-primary);
    border-radius: 2px;
    animation: splashFill 1.5s ease-in-out infinite;
}

@keyframes splashFill {
    0%   { width: 10%; margin-left: 0; }
    50%  { width: 50%; margin-left: 25%; }
    100% { width: 10%; margin-left: 90%; }
}

/* ---- Header ---- */
.site-header nav {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem 2rem;
    background: var(--color-surface);
    border-bottom: 3px solid var(--color-primary);
}

.site-header .logo {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
}

.site-header .logo img {
    display: block;
    height: 80px;
    width: auto;
    max-width: 100%;
}

.site-header ul {
    list-style: none;
    display: flex;
    gap: 1.5rem;
}

.site-header a {
    color: var(--color-text);
    text-decoration: none;
    transition: color 0.2s;
}

.site-header a:hover {
    color: var(--color-primary);
}

/* ---- Main ---- */
main {
    flex: 1;
    max-width: 500px;
    margin: 0 auto;
    padding: 1rem 2rem;
    width: 100%;
}

/* ---- Hero ---- */
.hero {
    text-align: center;
    padding: 4rem 1rem;
}

.hero h1 {
    font-family: var(--font-title);
    font-weight: 400;
    font-size: 3.5rem;
    color: var(--color-primary);
    text-transform: uppercase;
    letter-spacing: 4px;
    margin-bottom: 0.5rem;
}

.hero .subtitle {
    font-size: 1.3rem;
    color: var(--color-muted);
}

/* ---- Modale concours (Je participe) ---- */
.modal[hidden] { display: none; }
.modal {
    position: fixed; inset: 0; z-index: 1000;
    display: flex; align-items: center; justify-content: center;
    padding: 1rem;
}
.modal__backdrop {
    position: absolute; inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(2px);
}
.modal__panel {
    position: relative;
    background: var(--color-surface, #1a1a2e);
    color: var(--color-text, #fff);
    width: 100%;
    max-width: 540px;
    max-height: 90vh;
    overflow-y: auto;
    border-radius: 12px;
    padding: 1.4rem 1.4rem 1rem;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.modal__panel h2 {
    margin: 0 0 0.4rem;
    font-size: 1.4rem;
}
.modal__close {
    position: absolute; top: 0.6rem; right: 0.8rem;
    background: transparent; color: inherit;
    border: 0; font-size: 1.6rem; line-height: 1;
    cursor: pointer; padding: 0.3rem 0.5rem;
}
.modal__intro {
    color: var(--color-muted, #aaa);
    margin: 0 0 0.8rem;
}
.modal__intro strong { color: var(--color-primary, #2ecc40); }

.modal__reglement {
    max-height: 30vh;
    overflow-y: auto;
    padding: 0.8rem;
    background: rgba(0,0,0,0.25);
    border-radius: 8px;
    margin-bottom: 1rem;
    font-size: 0.85rem;
    line-height: 1.4;
}
.reglement-content h3 {
    margin: 0.6rem 0 0.2rem;
    font-size: 0.95rem;
    color: #ffdd00;
}
.reglement-content p { margin: 0 0 0.4rem; }

.modal__form { display: flex; flex-direction: column; gap: 0.7rem; }

.form-field { display: flex; flex-direction: column; gap: 0.25rem; }
.form-field__label { font-size: 0.85rem; font-weight: bold; }
.form-field input {
    padding: 0.55rem 0.7rem;
    border-radius: 6px;
    border: 1px solid rgba(255,255,255,0.15);
    background: rgba(0,0,0,0.3);
    color: inherit;
    font: inherit;
}
.form-field input:focus { outline: 2px solid #ffdd00; outline-offset: 1px; }

.form-consent {
    display: flex; gap: 0.6rem;
    align-items: flex-start;
    padding: 0.7rem;
    background: rgba(255,255,255,0.05);
    border-radius: 6px;
    font-size: 0.82rem;
    line-height: 1.35;
    cursor: pointer;
}
.form-consent input[type="checkbox"] {
    margin-top: 0.15rem;
    width: 18px; height: 18px;
    accent-color: var(--color-primary, #2ecc40);
    flex-shrink: 0;
}

.form-error {
    margin: 0;
    color: #ff5454;
    font-size: 0.85rem;
    padding: 0.4rem 0.6rem;
    background: rgba(255,84,84,0.12);
    border-radius: 4px;
}

.modal__actions {
    display: flex; justify-content: flex-end; gap: 0.6rem;
    margin-top: 0.4rem;
}
.btn-primary, .btn-secondary {
    padding: 0.6rem 1.2rem;
    border: 0; border-radius: 6px;
    font-weight: bold; text-transform: uppercase;
    font-size: 0.85rem; cursor: pointer;
    transition: opacity 0.2s, background 0.2s;
}
.btn-primary {
    background: var(--color-primary, #2ecc40);
    color: #fff;
}
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-secondary {
    background: rgba(255,255,255,0.1);
    color: inherit;
}

body.modal-open { overflow: hidden; }

/* Bannière de confirmation après save en mode concours */
.concours-confirmation[hidden] { display: none; }
.concours-confirmation {
    margin: 0.8rem auto;
    max-width: 400px;
    padding: 0.9rem 1.1rem;
    background: linear-gradient(135deg, rgba(255,221,0,0.18), rgba(255,149,0,0.22));
    border: 1px solid rgba(255,221,0,0.5);
    border-radius: 10px;
    text-align: center;
    animation: concoursPop 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.concours-confirmation__title {
    margin: 0 0 0.3rem;
    font-weight: bold;
    font-size: 1rem;
    color: #ffdd00;
    text-shadow: 0 1px 2px rgba(0,0,0,0.4);
}
.concours-confirmation__detail {
    margin: 0;
    font-size: 0.85rem;
    color: rgba(255,255,255,0.85);
    line-height: 1.35;
}
@keyframes concoursPop {
    0%   { opacity: 0; transform: scale(0.85); }
    100% { opacity: 1; transform: scale(1); }
}

/* Badge de mode dans le HUD (concours / fun) */
.hud-badge {
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: bold;
    letter-spacing: 0.5px;
}
.hud-badge--concours {
    background: linear-gradient(135deg, #ffdd00, #ff9500);
    color: #1a1a2e;
    box-shadow: 0 2px 8px rgba(255,221,0,0.4);
}
.hud-badge--fun {
    background: linear-gradient(135deg, #2ecc40, #27a233);
    color: #fff;
    box-shadow: 0 2px 8px rgba(46,204,64,0.4);
}

/* ---- Character Picker ---- */
.character-picker {
    padding: 1.5rem 0 0.5rem;
    text-align: center;
}

.character-picker h2 {
    font-size: 1.4rem;
    margin: 0 0 1rem;
    color: var(--color-text, #fff);
}

.character-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
    max-width: 420px;
    margin: 0 auto;
}

.character-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    padding: 0.6rem 0.3rem;
    background: var(--color-surface, #1a1a2e);
    border: 2px solid transparent;
    border-radius: 12px;
    cursor: pointer;
    color: inherit;
    font: inherit;
    transition: transform 0.12s ease, border-color 0.12s ease, background 0.12s ease;
}

.character-tile:hover {
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 0.06);
}

.character-tile:focus-visible {
    outline: 2px solid #ffdd00;
    outline-offset: 2px;
}

.character-tile--selected {
    border-color: #ffdd00;
    background: rgba(255, 221, 0, 0.12);
}

.character-tile__preview {
    position: relative;
    display: inline-block;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: 2px solid #000;
    overflow: hidden;
}

/* Variante "image PNG" (style BD) — pas de pastille colorée, pas de bordure noire */
.character-tile__preview--image {
    width: 64px;
    height: 64px;
    border: none;
    border-radius: 0;
    background: transparent;
    overflow: visible;
}

.character-tile__img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.character-tile__hair {
    position: absolute;
    top: -6px;
    left: 50%;
    transform: translateX(-50%);
    width: 70%;
    height: 22px;
    border-radius: 50% 50% 30% 30%;
    background: #111;
}

.character-tile__hair--bald {
    display: none;
}

.character-tile__number {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -30%);
    font-family: Impact, sans-serif;
    font-weight: 400;
    font-size: 1.2rem;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
    pointer-events: none;
}

.character-tile__name {
    font-size: 0.78rem;
    line-height: 1.1;
    color: var(--color-muted, #aaa);
}

.character-tile--selected .character-tile__name {
    color: #ffdd00;
    font-weight: bold;
}

@media (max-width: 480px) {
    .character-grid {
        gap: 0.5rem;
    }
    .character-tile {
        padding: 0.4rem 0.2rem;
    }
    .character-tile__preview {
        width: 48px;
        height: 48px;
    }
}

/* ---- Games Grid ---- */
.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    padding: 2rem 0;
}

.game-card {
    background: var(--color-surface);
    border: 2px solid transparent;
    border-radius: var(--radius);
    padding: 1rem;
    text-align: center;
    text-decoration: none;
    color: var(--color-text);
    transition: border-color 0.3s, transform 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.8rem;
}

.game-card:hover {
    border-color: var(--color-primary);
    transform: translateY(-4px);
}

.game-card--locked {
    opacity: 0.5;
    pointer-events: none;
}

.game-card__header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
}

.game-card__icon {
    font-size: 2.4rem;
    line-height: 1;
}

.game-card h2 {
    font-family: var(--font-title);
    font-weight: 400;
    font-size: 1.5rem;
    color: var(--color-primary);
}

.game-card__stats {
    font-size: 0.75rem;
    color: var(--color-muted);
    letter-spacing: 0.3px;
}

.game-card__stats-label {
    font-size: 0.7rem;
    color: var(--color-accent);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: bold;
    margin-bottom: -0.5rem;
}

.game-card__stats:empty {
    display: none;
}

.game-card__stats-label:empty {
    display: none;
}

.game-card__podium {
    width: 100%;
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.08), rgba(255, 107, 53, 0.05));
    border: 1px solid rgba(255, 215, 0, 0.2);
    border-radius: 8px;
    padding: 0.6rem 0.9rem;
    text-align: left;
}

.game-card__podium-title {
    font-size: 0.7rem;
    color: var(--color-accent);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: bold;
    margin-bottom: 0.25rem;
    text-align: center;
}

.game-card__podium-stats {
    font-size: 0.75rem;
    color: var(--color-muted);
    text-align: center;
    margin-bottom: 0.5rem;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid rgba(255, 215, 0, 0.15);
}

.game-card__podium-stats strong {
    color: var(--color-primary);
    font-variant-numeric: tabular-nums;
    font-weight: bold;
}

.game-card__podium-sep {
    margin: 0 0.3rem;
    opacity: 0.5;
}

.podium-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.podium-list__item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.9rem;
    font-weight: 600;
}

.podium-list__medal {
    font-size: 1.15rem;
    line-height: 1;
    flex-shrink: 0;
}

.podium-list__name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--color-text);
}

.podium-list__score {
    font-variant-numeric: tabular-nums;
    color: var(--color-primary);
    font-weight: bold;
}

.game-card__actions {
    margin-top: auto;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.game-card__cta {
    padding: 0.5rem 1.5rem;
    background: var(--color-primary);
    color: #fff;
    border-radius: 6px;
    font-weight: bold;
    text-transform: uppercase;
    font-size: 0.85rem;
    text-decoration: none;
    transition: opacity 0.2s;
    width: 100%;
}

.game-card__cta:hover {
    opacity: 0.85;
}

.game-card__cta--secondary {
    background: rgba(255, 255, 255, 0.1);
    color: var(--color-text);
    border: none;
    cursor: pointer;
}

/* ---- Classement page ---- */
.classement {
    max-width: 420px;
    margin: 0 auto;
    padding: 1.5rem 1rem;
}

.classement__back {
    color: var(--color-muted);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.2s;
}

.classement__back:hover {
    color: var(--color-primary);
}

.classement__title {
    font-family: var(--font-title);
    font-weight: 400;
    font-size: 1.8rem;
    color: var(--color-primary);
    text-align: center;
    margin: 1rem 0 0.2rem;
}

.classement__intro {
    text-align: center;
    color: var(--color-muted);
    font-size: 0.85rem;
    line-height: 1.45;
    margin: 0 0 1.6rem;
}

.classement__empty {
    text-align: center;
    color: var(--color-muted);
    padding: 1.2rem 0;
    font-size: 0.9rem;
}

.classement__block {
    margin-bottom: 1.8rem;
    padding: 1rem 0.9rem 0.6rem;
    border-radius: 12px;
}

.classement__block--concours {
    background: linear-gradient(180deg, rgba(255, 215, 0, 0.12), rgba(255, 215, 0, 0.02));
    border: 1px solid rgba(255, 215, 0, 0.45);
    box-shadow: 0 4px 14px rgba(255, 215, 0, 0.08);
}

.classement__block--fun {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.classement__block-header {
    padding-bottom: 0.7rem;
    margin-bottom: 0.6rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.classement__block--concours .classement__block-header {
    border-bottom-color: rgba(255, 215, 0, 0.3);
}

.classement__block-icon {
    font-size: 1.4rem;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.35));
    flex-shrink: 0;
}

.classement__block-title {
    font-family: var(--font-title);
    font-weight: 400;
    font-size: 1.15rem;
    margin: 0;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 0.55rem;
    line-height: 1.2;
}

.classement__block--concours .classement__block-title {
    color: #ffd86b;
}

.classement__block-sub {
    display: block;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--color-muted);
    margin-top: 4px;
}

.classement__list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.classement__item {
    display: flex;
    align-items: center;
    padding: 0.7rem 0.7rem;
    gap: 0.8rem;
    background: var(--color-surface);
    border-radius: var(--radius);
    margin-bottom: 0.4rem;
}

.classement__item--concours {
    background: linear-gradient(90deg, rgba(255, 215, 0, 0.1), rgba(255, 215, 0, 0.02));
    border-left: 3px solid #ffd700;
}

.classement__rank {
    width: 2rem;
    text-align: center;
    font-weight: bold;
    font-size: 1.1rem;
    color: var(--color-muted);
    flex-shrink: 0;
}

.classement__item:nth-child(1) .classement__rank { color: #ffd700; font-size: 1.3rem; }
.classement__item:nth-child(2) .classement__rank { color: #c0c0c0; font-size: 1.2rem; }
.classement__item:nth-child(3) .classement__rank { color: #cd7f32; font-size: 1.15rem; }

.classement__name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.classement__score {
    font-weight: bold;
    color: var(--color-primary);
    font-size: 1.1rem;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.classement__block--concours .classement__score {
    color: #ffd86b;
}

/* Séparateur « … » entre les segments de la vue fenêtrée */
.classement__gap {
    list-style: none;
    text-align: center;
    color: var(--color-muted);
    font-weight: bold;
    letter-spacing: 0.3em;
    padding: 0.15rem 0 0.35rem;
    line-height: 1;
}

/* Ligne du joueur courant — surlignage vert prioritaire sur le doré concours */
.classement__item--me {
    background: linear-gradient(90deg, rgba(46,204,64,0.24), rgba(46,204,64,0.06));
    border-left-color: #2ecc40;
    outline: 2px solid rgba(46,204,64,0.55);
    outline-offset: -2px;
}
.classement__you {
    display: inline-block;
    font-size: 0.62rem;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: #2ecc40;
    color: #06210b;
    padding: 0.05rem 0.4rem;
    border-radius: 999px;
    vertical-align: middle;
    margin-left: 0.2rem;
}
.lb-badge {
    font-size: 0.9em;
    margin-left: 0.15rem;
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.4));
}

/* ---- Admin (tableau de bord concours) ---- */
.admin {
    max-width: 1100px;
    margin: 0 auto;
    padding: 1.5rem 1rem;
}
.admin__header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.2rem;
}
.admin__header h1 { margin: 0; flex: 1 1 auto; font-size: 1.6rem; }
.admin__metrics {
    display: flex; gap: 1rem;
    color: var(--color-muted, #aaa);
    font-size: 0.9rem;
}
.admin__metric strong {
    color: var(--color-text, #fff);
    font-size: 1.2rem;
    margin-right: 0.2rem;
}
.admin__actions { margin-left: auto; }
.admin__btn {
    display: inline-block;
    padding: 0.6rem 1.1rem;
    background: rgba(255,255,255,0.08);
    color: inherit;
    text-decoration: none;
    border-radius: 6px;
    font-weight: bold;
    transition: background 0.2s;
}
.admin__btn:hover { background: rgba(255,255,255,0.18); }
.admin__btn--primary {
    background: var(--color-primary, #2ecc40);
    color: #fff;
}
.admin__btn--primary:hover { opacity: 0.9; background: var(--color-primary, #2ecc40); }

.admin__empty {
    text-align: center;
    color: var(--color-muted, #aaa);
    padding: 3rem 1rem;
}

.admin__table-wrapper {
    overflow-x: auto;
    background: var(--color-surface, #1a1a2e);
    border-radius: 10px;
}
.admin__table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}
.admin__table th,
.admin__table td {
    padding: 0.65rem 0.85rem;
    text-align: left;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    white-space: nowrap;
}
.admin__table th {
    background: rgba(0,0,0,0.25);
    font-weight: bold;
    color: var(--color-muted, #ccc);
    text-transform: uppercase;
    font-size: 0.72rem;
    letter-spacing: 0.4px;
}
.admin__table tr:hover td { background: rgba(255,255,255,0.04); }
.admin__rank { color: var(--color-muted, #888); font-weight: bold; }
.admin__col-num { text-align: right; }
.admin__col-status { text-align: center; }
.admin__col-date { color: var(--color-muted, #888); font-size: 0.82rem; }

.admin__row--winner td {
    background: linear-gradient(90deg, rgba(255,221,0,0.18), transparent);
}
.admin__row--winner .admin__rank::before { content: "🏆 "; }

.admin__hint {
    margin-top: 1rem;
    color: var(--color-muted, #aaa);
    font-size: 0.82rem;
    font-style: italic;
}

/* ---- Admin settings ---- */
.admin__flash {
    padding: 0.7rem 1rem;
    background: rgba(46, 204, 64, 0.15);
    border-left: 3px solid var(--color-primary, #2ecc40);
    border-radius: 4px;
    margin-bottom: 1.2rem;
    color: #b6e8c0;
}
.admin__form {
    background: var(--color-surface, #1a1a2e);
    padding: 1.4rem 1.6rem;
    border-radius: 10px;
}
.admin__section-title {
    margin: 0 0 0.4rem;
    font-size: 1.1rem;
    color: var(--color-muted, #ddd);
}
.admin__section-hint {
    margin: 0 0 1.2rem;
    color: var(--color-muted, #aaa);
    font-size: 0.88rem;
}
.admin__settings-list {
    list-style: none;
    padding: 0;
    margin: 0 0 1.5rem;
}
.admin__setting {
    padding: 0.9rem 0;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}
.admin__setting:last-child { border-bottom: none; }
.admin__toggle {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    cursor: pointer;
    font-weight: bold;
    user-select: none;
}
.admin__toggle input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--color-primary, #2ecc40);
    cursor: pointer;
}
.admin__setting-label { font-size: 1rem; }
.admin__setting-desc {
    margin: 0.3rem 0 0 1.6rem;
    color: var(--color-muted, #aaa);
    font-size: 0.84rem;
}
.admin__form-actions {
    display: flex;
    justify-content: flex-end;
}
.admin__form-actions button.admin__btn {
    border: none;
    cursor: pointer;
    font-family: inherit;
    font-size: 1rem;
}

/* ---- Footer ---- */
.site-footer {
    text-align: center;
    padding: 1.5rem;
    color: var(--color-muted);
    font-size: 0.85rem;
    border-top: 1px solid var(--color-surface);
}

/* ============================================
   GAME PAGE — Immersive Mode
   ============================================ */

body.game-page .site-header,
body.game-page .site-footer {
    display: none;
}

body.game-page main {
    padding: 0;
    max-width: none;
    margin: 0;
}

body.game-page {
    overflow: hidden;
}

/* ---- Game Container (immersif) ---- */
.game-page .game-container {
    position: relative;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    max-width: none;
    margin: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    background: linear-gradient(to bottom, #0a1628 0%, #0d3a5c 25%, #1a6ebf 45%, #2aa040 60%, #1a8c2e 70%);
    overflow: hidden;
}

/* ---- Back Button ---- */
.game-back {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 20;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-radius: 50%;
    color: #fff;
    text-decoration: none;
    font-size: 1.3rem;
    transition: background 0.2s;
}

.game-back:hover {
    background: rgba(0, 0, 0, 0.6);
}

/* ---- HUD (floating overlay) ---- */
.game-page .game-hud {
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 15;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 16px;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 25px;
    font-size: 1rem;
    font-weight: bold;
    white-space: nowrap;
}

.game-page .hud-score {
    color: #fff;
    font-size: 1.3rem;
}

.game-page .hud-best {
    color: var(--color-muted);
    font-size: 0.85rem;
}

.hud-actions {
    display: flex;
    gap: 4px;
}

.hud-btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    padding: 4px;
    font-size: 1rem;
    line-height: 1;
    transition: color 0.2s;
    border-radius: 4px;
}

.hud-btn:hover {
    color: #fff;
}

.hud-btn.hud-mute--off {
    opacity: 0.4;
    color: var(--color-accent);
}

.hud-multiplier {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-top: 0.4rem;
    padding: 0.3rem 0.9rem;
    background: linear-gradient(135deg, #ffd24a, #ffae00);
    color: #1a1a2e;
    font-weight: 900;
    font-size: 0.95rem;
    letter-spacing: 0.5px;
    border-radius: 999px;
    box-shadow: 0 0 12px rgba(255, 210, 74, 0.6), 0 2px 4px rgba(0, 0, 0, 0.3);
    pointer-events: none;
    animation: hudMultiplierPulse 0.8s ease-in-out infinite;
    z-index: 10;
    font-variant-numeric: tabular-nums;
}

@keyframes hudMultiplierPulse {
    0%, 100% { transform: translateX(-50%) scale(1); }
    50%      { transform: translateX(-50%) scale(1.08); }
}

/* HUD slow-mo : même structure que hud-multiplier, palette bleue, décalé en X
   pour cohabiter avec le multiplicateur ×2 doré. */
.hud-slowmo {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translate(-50%, 0) translateX(70px);
    margin-top: 0.4rem;
    padding: 0.3rem 0.9rem;
    background: linear-gradient(135deg, #4ad9ff, #1f6a8e);
    color: #fff;
    font-weight: 900;
    font-size: 0.95rem;
    letter-spacing: 0.5px;
    border-radius: 999px;
    box-shadow: 0 0 12px rgba(74, 217, 255, 0.55), 0 2px 4px rgba(0, 0, 0, 0.3);
    pointer-events: none;
    animation: hudSlowMoPulse 0.8s ease-in-out infinite;
    z-index: 10;
    font-variant-numeric: tabular-nums;
}

@keyframes hudSlowMoPulse {
    0%, 100% { transform: translate(-50%, 0) translateX(70px) scale(1); }
    50%      { transform: translate(-50%, 0) translateX(70px) scale(1.08); }
}

/* ---- Canvas wrapper (immersif, portrait) ---- */
.game-page #game-canvas {
    width: 100%;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    min-height: 0;
}

/* ---- Canvas (immersif, portrait mobile-first) ---- */
.game-page #game-canvas canvas {
    display: block;
    width: auto;
    height: 100%;
    max-width: 100%;
    border-radius: 0;
    border: none;
    touch-action: none;
    -webkit-touch-callout: none;
    user-select: none;
}


/* ---- Score pop animation [V2] ---- */
.game-page .hud-score .score-pop {
    animation: scorePop 0.25s ease-out;
}

@keyframes scorePop {
    0%   { transform: scale(1); }
    40%  { transform: scale(1.5); color: #fff; }
    100% { transform: scale(1); }
}

.game-page .hud-score #score {
    display: inline-block;
}

/* ---- Countdown [G1] ---- */
.game-page .countdown {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 25;
    font-family: var(--font-title);
    font-weight: 400;
    font-size: 5rem;
    color: #fff;
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.6), 0 0 40px rgba(46, 204, 64, 0.4);
    pointer-events: none;
    opacity: 0;
}

.game-page .countdown--animate {
    animation: countdownPop 0.55s ease-out forwards;
}

@keyframes countdownPop {
    0%   { opacity: 0; transform: translate(-50%, -50%) scale(2.5); }
    30%  { opacity: 1; transform: translate(-50%, -50%) scale(0.9); }
    50%  { transform: translate(-50%, -50%) scale(1.05); }
    70%  { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    100% { opacity: 0; transform: translate(-50%, -50%) scale(0.8); }
}

/* ---- Stats line [U5] ---- */
.game-page .stats-line {
    font-size: 0.8rem;
    color: var(--color-muted);
    margin-bottom: 0.8rem;
    letter-spacing: 0.5px;
}

.game-page .stats-line:empty {
    display: none;
}

/* ---- Social share buttons [U10] ---- */
.game-page .share-social {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 0.5rem;
    flex-wrap: wrap;
}

.game-page .share-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    border: none;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: bold;
    cursor: pointer;
    color: #fff;
    transition: opacity 0.2s, transform 0.15s;
    min-height: 32px;
}

.game-page .share-btn:hover {
    opacity: 0.85;
    transform: scale(1.05);
}

.game-page .share-btn--whatsapp  { background: #25D366; }
.game-page .share-btn--facebook  { background: #1877F2; }
.game-page .share-btn--messenger { background: #0099FF; }
.game-page .share-btn--instagram { background: linear-gradient(45deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888); }
.game-page .share-btn--copy      { background: rgba(255, 255, 255, 0.15); }

.game-page .share-btn__icon {
    font-size: 1rem;
    line-height: 1;
}

/* ---- Game Over fade-in [U6] ---- */
.game-page .game-overlay--fadein {
    animation: overlayFadeIn 0.4s ease-out;
}

@keyframes overlayFadeIn {
    from { opacity: 0; transform: translate(-50%, -50%) scale(0.9); }
    to   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

/* ---- Overlays (glassmorphism) ---- */
.game-page .game-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10;
    background: rgba(10, 15, 30, 0.75);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--radius-lg);
    padding: 1.5rem 1.2rem;
    text-align: center;
    min-width: 0;
    width: 90%;
    max-width: 370px;
    box-sizing: border-box;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.game-page .game-overlay h2 {
    font-family: var(--font-title);
    font-weight: 400;
    font-size: 1.6rem;
    color: #fff;
    margin-bottom: 0.4rem;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

.game-page .game-overlay p {
    color: rgba(255, 255, 255, 0.75);
    margin-bottom: 0.8rem;
    font-size: 0.9rem;
    line-height: 1.4;
}

.game-page .overlay-score {
    font-size: 1.3rem;
    color: #fff;
    font-weight: bold;
}

.game-page .overlay-score span {
    color: var(--color-primary);
    font-size: 1.6rem;
}

.game-page .game-overlay input {
    display: block;
    width: 100%;
    padding: 0.6rem 0.8rem;
    margin-bottom: 0.8rem;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    font-size: 1rem;
    text-align: center;
    outline: none;
    transition: border-color 0.2s;
}

.game-page .game-overlay input:focus {
    border-color: var(--color-primary);
}

.game-page .game-overlay input::placeholder {
    color: rgba(255, 255, 255, 0.35);
}

/* ---- New Record (game page) ---- */
.game-page .new-record {
    color: var(--color-accent);
    font-size: 1.2rem;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 2px;
    animation: newRecordPulse 0.6s ease-in-out infinite alternate;
    margin: 0 0 0.3rem;
}

@keyframes newRecordPulse {
    from { transform: scale(1); opacity: 0.8; }
    to   { transform: scale(1.08); opacity: 1; }
}

/* ---- Buttons (game page) ---- */
.game-page .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.7rem 1.2rem;
    min-height: 44px;
    border: none;
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    font-size: 0.85rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0;
    text-decoration: none;
}

.game-page .btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.game-page .btn--primary {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
    color: #fff;
    box-shadow: 0 4px 15px rgba(46, 204, 64, 0.35);
}

.game-page .btn--primary:hover {
    box-shadow: 0 6px 20px rgba(46, 204, 64, 0.5);
    transform: translateY(-1px);
}

.game-page .btn--large {
    padding: 1rem 3rem;
    font-size: 1.2rem;
    border-radius: var(--radius);
    min-height: 56px;
}

/* ---- Leaderboard (game page) ---- */
.game-page .gameover-actions {
    display: flex;
    justify-content: center;
    gap: 0.4rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.game-page #leaderboard {
    margin-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 0.8rem;
    max-height: 200px;
    overflow-y: auto;
}

.game-page .leaderboard__title {
    font-family: var(--font-title);
    font-weight: 400;
    font-size: 0.9rem;
    color: var(--color-accent);
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 0.5rem;
}

.game-page .leaderboard__list {
    list-style: none;
    width: 100%;
}

.game-page .leaderboard__item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    font-size: 0.85rem;
}

.game-page .leaderboard__item--me {
    background: rgba(46, 204, 64, 0.15);
    border: 1px solid rgba(46, 204, 64, 0.3);
}

.game-page .lb-rank {
    width: 1.2rem;
    color: var(--color-muted);
    font-size: 0.75rem;
    text-align: right;
    flex-shrink: 0;
}

.game-page .leaderboard__item:nth-child(1) .lb-rank { color: #ffd700; font-weight: bold; }
.game-page .leaderboard__item:nth-child(2) .lb-rank { color: #c0c0c0; font-weight: bold; }
.game-page .leaderboard__item:nth-child(3) .lb-rank { color: #cd7f32; font-weight: bold; }

.game-page .lb-name {
    flex: 1;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: rgba(255, 255, 255, 0.8);
}

.game-page .lb-score {
    color: var(--color-primary);
    font-weight: bold;
    flex-shrink: 0;
}

/* ---- Game Over redesign [2026-05-22 : badge mode, score géant, layout pyramide] ---- */
.game-page .mode-badge {
    display: inline-block;
    padding: 5px 14px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 0.7rem;
}
.game-page .mode-badge--concours {
    background: linear-gradient(135deg, #ffd700, #ffaa00);
    color: #2a1a00;
    box-shadow: 0 2px 10px rgba(255, 215, 0, 0.4);
}
.game-page .mode-badge--fun {
    background: rgba(46, 204, 64, 0.18);
    color: #5fea76;
    border: 1px solid rgba(46, 204, 64, 0.45);
}

.game-page .gameover-title {
    font-family: var(--font-title);
    font-weight: 400;
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.65);
    margin: 0 0 0.1rem;
    text-transform: uppercase;
    letter-spacing: 2.5px;
}

.game-page .gameover-score {
    margin: 0 0 1.1rem;
}
.game-page .gameover-score__value {
    display: block;
    font-family: var(--font-title);
    font-weight: 400;
    font-size: 5rem;
    line-height: 1;
    color: var(--color-primary);
    text-shadow: 0 4px 24px rgba(46, 204, 64, 0.55);
    margin-bottom: 0.3rem;
}
.game-page .gameover-score__context {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.55);
    margin: 0;
}
.game-page .gameover-score__context:empty {
    display: none;
}

/* Override : actions verticales empilées (pyramide) */
.game-page .gameover-actions {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    margin-bottom: 0.5rem;
    flex-wrap: nowrap;
}
/* Input group façon Bootstrap : input + bouton fusionnés dans un même conteneur */
.game-page .gameover-input-row {
    display: flex;
    align-items: stretch;
    gap: 0;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: var(--radius);
    overflow: hidden;
    background: rgba(255, 255, 255, 0.06);
    transition: border-color 0.2s;
}
.game-page .gameover-input-row:focus-within {
    border-color: var(--color-primary);
}
.game-page .gameover-input-row input {
    flex: 1;
    margin: 0;
    border: none;
    border-radius: 0;
    background: transparent;
    text-align: left;
    padding: 0.7rem 0.9rem;
}
.game-page .gameover-input-row input:focus {
    border-color: transparent;
}
.game-page .gameover-input-row .btn {
    flex-shrink: 0;
    border-radius: 0;
    border-left: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.06);
    padding: 0 1.1rem;
    font-size: 0.78rem;
    min-height: 0;
}
.game-page .gameover-input-row .btn:hover {
    background: rgba(255, 255, 255, 0.18);
}
.game-page .gameover-input-row .btn:disabled {
    opacity: 0.5;
    cursor: default;
    background: rgba(255, 255, 255, 0.06);
}

.game-page .btn--ghost {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.18);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 0.78rem;
}
.game-page .btn--ghost:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.32);
}

.game-page .gameover-link {
    display: inline-block;
    color: rgba(255, 255, 255, 0.55);
    font-size: 0.85rem;
    text-decoration: none;
    margin: 0.2rem auto 0;
    transition: color 0.2s;
}
.game-page .gameover-link:hover {
    color: #fff;
}

/* Sociaux en mode pictos circulaires (sans label texte) */
.game-page .share-social--icons {
    margin-top: 1rem;
    gap: 0.7rem;
}
.game-page .share-social--icons .share-btn {
    width: 42px;
    height: 42px;
    padding: 0;
    min-height: 0;
    border-radius: 50%;
    justify-content: center;
    gap: 0;
}
.game-page .share-social--icons .share-btn__icon {
    width: 20px;
    height: 20px;
    fill: #fff;
    display: block;
}

/* ============================================
   NON-GAME PAGE — Normal styles
   ============================================ */

/* Game Container (non-immersive, for any edge case) */
.game-container {
    position: relative;
    max-width: 800px;
    margin: 0 auto;
}

.game-hud {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    font-size: 1.3rem;
    font-weight: bold;
}

.hud-score {
    color: var(--color-primary);
}

.hud-best {
    color: var(--color-accent);
}

#game-canvas canvas {
    display: block;
    margin: 0 auto;
    width: 100%;
    height: auto;
    border-radius: var(--radius);
    border: 2px solid var(--color-surface);
    touch-action: none;
    -webkit-touch-callout: none;
    user-select: none;
}

/* ---- Game Overlays (non-game-page fallback) ---- */
.game-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(22, 33, 62, 0.95);
    border: 2px solid var(--color-primary);
    border-radius: var(--radius);
    padding: 2.5rem;
    text-align: center;
    z-index: 10;
    min-width: 300px;
}

.new-record {
    color: var(--color-accent);
    font-size: 1.4rem;
    font-weight: bold;
    text-transform: uppercase;
    animation: newRecordPulse 0.6s ease-in-out infinite alternate;
    margin: 0 0 0.5rem;
}

.game-overlay h2 {
    font-family: var(--font-title);
    font-weight: 400;
    font-size: 2rem;
    color: var(--color-primary);
    margin-bottom: 1rem;
}

.game-overlay p {
    color: var(--color-muted);
    margin-bottom: 1.5rem;
}

.game-overlay input {
    display: block;
    width: 100%;
    padding: 0.7rem;
    margin-bottom: 1rem;
    border: 1px solid var(--color-muted);
    border-radius: 6px;
    background: var(--color-bg);
    color: var(--color-text);
    font-size: 1rem;
    text-align: center;
}

/* ---- Buttons ---- */
.btn {
    display: inline-block;
    padding: 0.7rem 2rem;
    border: 2px solid var(--color-primary);
    border-radius: 6px;
    background: transparent;
    color: var(--color-primary);
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
    text-transform: uppercase;
    margin: 0.3rem;
}

.btn:hover {
    background: var(--color-primary);
    color: #fff;
}

.btn--primary {
    background: var(--color-primary);
    color: #fff;
    border-color: var(--color-primary);
}

.btn--primary:hover {
    background: var(--color-primary-dark);
}

/* ---- Leaderboard ---- */
.gameover-actions {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

#leaderboard {
    margin-top: 1.2rem;
    border-top: 1px solid var(--color-muted);
    padding-top: 1rem;
    max-height: 220px;
    overflow-y: auto;
}

.leaderboard__title {
    font-family: var(--font-title);
    font-weight: 400;
    font-size: 1rem;
    color: var(--color-accent);
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 0.6rem;
}

.leaderboard__list {
    list-style: none;
    width: 100%;
}

.leaderboard__item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.3rem 0.5rem;
    border-radius: 4px;
    font-size: 0.9rem;
}

.leaderboard__item--me {
    background: rgba(46, 204, 64, 0.15);
    border: 1px solid var(--color-primary);
}

.lb-rank {
    width: 1.4rem;
    color: var(--color-muted);
    font-size: 0.8rem;
    text-align: right;
    flex-shrink: 0;
}

.leaderboard__item:nth-child(1) .lb-rank { color: #ffd700; font-weight: bold; }
.leaderboard__item:nth-child(2) .lb-rank { color: #c0c0c0; font-weight: bold; }
.leaderboard__item:nth-child(3) .lb-rank { color: #cd7f32; font-weight: bold; }

.lb-name {
    flex: 1;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.lb-score {
    color: var(--color-primary);
    font-weight: bold;
    flex-shrink: 0;
}

/* ---- Responsive ---- */
@media (max-width: 600px) {
    .hero h1 {
        font-size: 2.2rem;
    }
    .site-header nav {
        flex-direction: column;
        gap: 0.5rem;
    }
}

/* ---- Blocage paysage (pages de jeu uniquement) ----
   Masqué par défaut ; affiché plein écran en paysage sur petit écran.
   max-height: 600px isole les téléphones (paysage ≤ ~450px de haut) des
   tablettes/desktops (≥ 768px), pour ne pas bloquer ces derniers. */
.rotate-overlay { display: none; }

@media screen and (orientation: landscape) and (max-height: 600px) {
    body.game-page { overflow: hidden; }
    body.game-page .rotate-overlay {
        display: flex;
        position: fixed;
        inset: 0;
        z-index: 10000;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 0.6rem;
        padding: 1.5rem;
        text-align: center;
        background: var(--color-bg);
        color: var(--color-text);
    }
}

.rotate-overlay__icon {
    font-size: 3.5rem;
    line-height: 1;
    animation: rotateHint 1.8s ease-in-out infinite;
}
.rotate-overlay__title {
    font-family: var(--font-title);
    font-size: 1.5rem;
    margin: 0;
    color: var(--color-primary);
}
.rotate-overlay__text {
    margin: 0;
    font-size: 0.95rem;
    color: var(--color-muted);
}
@keyframes rotateHint {
    0%, 45%  { transform: rotate(0deg); }
    65%, 100% { transform: rotate(-90deg); }
}
