/*
============================================================
Motmaître — PLAYER STATS UI
============================================================
*/


/* ==========================================================
   HEADER ACTIONS
   ========================================================== */

.game-header {
    position:
        relative;
}


.header-actions {
    position:
        absolute;

    top:
        0;

    right:
        0;

    display:
        flex;

    gap:
        8px;
}


.header-icon-button {
    display:
        inline-flex;

    width:
        42px;

    height:
        42px;

    padding:
        0;

    border:
        1px solid
        rgba(
            0,
            0,
            0,
            0.08
        );

    border-radius:
        12px;

    background:
        rgba(
            255,
            255,
            255,
            0.72
        );

    color:
        #333;

    align-items:
        center;

    justify-content:
        center;

    cursor:
        pointer;

    box-shadow:
        0
        5px
        18px
        rgba(
            0,
            0,
            0,
            0.04
        );

    backdrop-filter:
        blur(
            10px
        );

    transition:
        background
        0.15s ease,
        border-color
        0.15s ease,
        transform
        0.15s ease;
}


.header-icon-button svg {
    width:
        21px;

    height:
        21px;

    fill:
        none;

    stroke:
        currentColor;

    stroke-width:
        2;

    stroke-linecap:
        round;

    stroke-linejoin:
        round;
}


.header-icon-button:hover {
    border-color:
        rgba(
            0,
            0,
            0,
            0.16
        );

    background:
        #ffffff;

    transform:
        translateY(
            -1px
        );
}


.header-icon-button:active {
    transform:
        translateY(
            0
        )
        scale(
            0.97
        );
}


/* ==========================================================
   MODAL
   ========================================================== */

.stats-modal[hidden] {
    display:
        none;
}


.stats-modal {
    position:
        fixed;

    z-index:
        8000;

    inset:
        0;

    display:
        flex;

    padding:
        24px;

    align-items:
        center;

    justify-content:
        center;
}


.stats-modal-backdrop {
    position:
        absolute;

    inset:
        0;

    background:
        rgba(
            20,
            20,
            20,
            0.38
        );

    backdrop-filter:
        blur(
            4px
        );

    animation:
        stats-backdrop-in
        0.2s
        ease-out
        both;
}


.stats-dialog {
    position:
        relative;

    z-index:
        1;

    width:
        min(
            560px,
            100%
        );

    padding:
        25px;

    border:
        1px solid
        rgba(
            0,
            0,
            0,
            0.06
        );

    border-radius:
        20px;

    background:
        #ffffff;

    box-shadow:
        0
        30px
        90px
        rgba(
            0,
            0,
            0,
            0.22
        );

    animation:
        stats-dialog-in
        0.32s
        cubic-bezier(
            0.22,
            1,
            0.36,
            1
        )
        both;
}


.stats-dialog-handle {
    display:
        none;
}


.stats-dialog-header {
    display:
        flex;

    margin-bottom:
        20px;

    align-items:
        flex-start;

    justify-content:
        space-between;

    gap:
        16px;
}


.player-stats-kicker {
    margin-bottom:
        3px;

    color:
        #999;

    font-size:
        10px;

    font-weight:
        800;

    letter-spacing:
        0.08em;

    text-transform:
        uppercase;
}


.player-stats-title {
    margin:
        0;

    font-size:
        22px;

    letter-spacing:
        -0.035em;
}


.stats-close-button {
    display:
        inline-flex;

    width:
        38px;

    height:
        38px;

    flex:
        0 0 auto;

    padding:
        0;

    border:
        0;

    border-radius:
        50%;

    background:
        #f2f2ef;

    color:
        #555;

    font:
        inherit;

    font-size:
        25px;

    line-height:
        1;

    align-items:
        center;

    justify-content:
        center;

    cursor:
        pointer;

    transition:
        background
        0.15s ease,
        transform
        0.15s ease;
}


.stats-close-button:hover {
    background:
        #e8e8e4;

    color:
        #111;
}


.stats-close-button:active {
    transform:
        scale(
            0.94
        );
}


/* ==========================================================
   GRID
   ========================================================== */

.player-stats-grid {
    display:
        grid;

    grid-template-columns:
        repeat(
            5,
            1fr
        );

    gap:
        8px;
}


.player-stat {
    display:
        flex;

    min-width:
        0;

    min-height:
        100px;

    padding:
        14px
        7px;

    border-radius:
        13px;

    background:
        #f5f5f2;

    flex-direction:
        column;

    align-items:
        center;

    justify-content:
        center;

    text-align:
        center;
}


.player-stat-value {
    display:
        block;

    font-size:
        28px;

    font-weight:
        850;

    font-variant-numeric:
        tabular-nums;

    letter-spacing:
        -0.045em;

    line-height:
        1;
}


.player-stat-label {
    margin-top:
        8px;

    color:
        #777;

    font-size:
        10px;

    font-weight:
        700;

    line-height:
        1.25;
}


.player-stat-streak
.player-stat-value::after {
    margin-left:
        4px;

    font-size:
        14px;

    content:
        "🔥";
}


.player-stats-note {
    margin:
        15px
        0
        0;

    color:
        #aaa;

    font-size:
        10px;

    text-align:
        center;
}


/* ==========================================================
   BODY STATE
   ========================================================== */

body.stats-modal-open {
    overflow:
        hidden;
}


/* ==========================================================
   ANIMATIONS
   ========================================================== */

@keyframes stats-backdrop-in {

    from {
        opacity:
            0;
    }

    to {
        opacity:
            1;
    }
}


@keyframes stats-dialog-in {

    from {
        opacity:
            0;

        transform:
            translateY(
                10px
            )
            scale(
                0.97
            );
    }

    to {
        opacity:
            1;

        transform:
            translateY(
                0
            )
            scale(
                1
            );
    }
}


/* ==========================================================
   MOBILE — BOTTOM SHEET
   ========================================================== */

@media (
    max-width: 600px
) {

    .header-icon-button {
        width:
            40px;

        height:
            40px;
    }


    .stats-modal {
        padding:
            0;

        align-items:
            flex-end;
    }


    .stats-modal-backdrop {
        backdrop-filter:
            blur(
                3px
            );
    }


    .stats-dialog {
        width:
            100%;

        padding:
            12px
            16px
            calc(
                20px
                +
                env(
                    safe-area-inset-bottom
                )
            );

        border:
            0;

        border-radius:
            22px
            22px
            0
            0;

        animation:
            stats-sheet-in
            0.34s
            cubic-bezier(
                0.22,
                1,
                0.36,
                1
            )
            both;
    }


    .stats-dialog-handle {
        display:
            block;

        width:
            38px;

        height:
            4px;

        margin:
            0
            auto
            14px;

        border-radius:
            999px;

        background:
            #d8d8d4;
    }


    .stats-dialog-header {
        margin-bottom:
            17px;
    }


    .player-stats-title {
        font-size:
            21px;
    }


    .player-stats-grid {
        grid-template-columns:
            repeat(
                2,
                1fr
            );
    }


    .player-stat {
        min-height:
            82px;
    }


    .player-stat:last-child {
        grid-column:
            1
            / -1;

        min-height:
            75px;
    }


    .player-stat-value {
        font-size:
            25px;
    }
}


@keyframes stats-sheet-in {

    from {
        transform:
            translateY(
                100%
            );
    }

    to {
        transform:
            translateY(
                0
            );
    }
}


/* ==========================================================
   REDUCED MOTION
   ========================================================== */

@media (
    prefers-reduced-motion:
        reduce
) {

    .stats-modal-backdrop,
    .stats-dialog {
        animation:
            none;
    }
}
