.game-modal {
    position: fixed;
    inset: 0;
    z-index: 500;

    display: grid;
    place-items: center;

    padding: 12px;

    background: rgb(3 20 12 / 88%);
    backdrop-filter: blur(6px);
}

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

.game-panel {
    width: min(1180px, 96vw);
    height: min(860px, 95dvh);
    min-height: 0;

    display: grid;
    grid-template-rows: auto minmax(0, 1fr);

    overflow: hidden;

    border: 4px solid #79491a;
    border-radius: 24px;

    background: radial-gradient(circle at top, #377e51, #092719);
    box-shadow: 0 28px 70px rgb(0 0 0 / 58%);
}

.game-header {
    display: flex;
    align-items: center;
    justify-content: space-between;

    padding: 10px 14px;

    background: #0b4a2f;
    border-bottom: 3px solid #8a5620;
}

.game-header h2,
.game-header p {
    margin: 0;
}

.game-eyebrow {
    color: #f5d57b;
    font-size: 11px;
    font-weight: 900;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.game-close {
    width: 46px;
    height: 46px;

    border: 2px solid #704218;
    border-radius: 50%;

    background: #efbb5e;
    color: #2a1909;

    font-size: 30px;
    font-weight: 1000;
    cursor: pointer;
}

.game-layout {
    min-height: 0;

    display: grid;
    grid-template-columns: minmax(0, 1fr) 250px;
    gap: 12px;

    padding: 10px;
}

.game-main {
    position: relative;

    min-width: 0;
    min-height: 0;

    display: grid;
    grid-template-rows:
        auto
        minmax(0, 1fr)
        auto;
    gap: 8px;
}

.game-start-panel {
    position: absolute;
    inset: 50% auto auto 50%;
    z-index: 5;

    width: min(360px, 88%);
    display: grid;
    gap: 10px;

    padding: 18px;

    border: 3px solid #754619;
    border-radius: 18px;

    background: linear-gradient(145deg, #fff1bd, #e7b757);
    color: #2a1b0c;

    translate: -50% -50%;
    box-shadow: 0 18px 40px rgb(0 0 0 / 45%);
}
.game-start-panel[hidden] {
    display: none;
}

.game-start-panel label {
    font-weight: 900;
}

.game-start-panel input,
.game-start {
    min-height: 48px;
    padding: 9px 12px;

    border: 2px solid #75491a;
    border-radius: 12px;

    font: inherit;
}

.game-start {
    background: #347346;
    color: #fff8dc;
    font-weight: 900;
    cursor: pointer;
}

.game-hud {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;

    padding: 8px 12px;

    border: 2px solid #76501e;
    border-radius: 11px;

    background: linear-gradient(145deg, #fff0bb, #e6b558);
    color: #2e1d0c;

    font-weight: 900;
}

.game-hud span:first-child {
    color: #125e35;
    font-size: 18px;
}

.game-hud span:first-child strong {
    color: #e45a32;
    font-size: 29px;
    text-shadow: 0 1px 0 #fff1c0;
}

.game-stop {
    min-height: 34px;
    padding: 5px 10px;
    border: 2px solid #75491a;
    border-radius: 9px;
    background: #fff3c8;
    color: #472a10;
    font: inherit;
    font-size: 12px;
    font-weight: 1000;
    cursor: pointer;
}

.game-canvas {
    width: 100%;
    height: auto;
    min-height: 0;
    aspect-ratio: 900 / 520;
    align-self: start;

    border: 4px solid #9a6225;
    border-radius: 18px;
    background: linear-gradient(180deg, #78cfe0 0%, #bde69b 58%, #376c3b 59%);
    box-shadow: inset 0 0 0 2px rgb(255 255 255 / 25%), 0 10px 20px rgb(0 0 0 / 20%);
    touch-action: none;
}

.game-controls {
    display: grid;

    grid-template-columns:
        repeat(3, minmax(0, 1fr));

    gap: 7px;

    margin-top: 12px;
    padding-top: 12px;

    border-top:
        2px dashed
        rgb(117 73 26 / 35%);
}

.game-controls button {
    width: 100%;
    min-width: 0;
    min-height: 48px;

    border: 2px solid #704218;
    border-radius: 12px;

    background: linear-gradient(#fff0ae, #eab14d);
    color: #2d1b0a;

    font-size: 22px;
    font-weight: 900;

    cursor: pointer;
    touch-action: none;
    box-shadow: 0 4px 0 #9a5b1d;
}

.game-status {
    min-height: 20px;
    margin: 0;
    color: #f6e4ad;
    font-size: 12px;
    font-weight: 800;
    text-align: center;
}

.game-ranking {
    min-height: 0;
    overflow-y: auto;

    padding: 12px;

    border: 3px solid #744719;
    border-radius: 15px;

    background: #f1d286;
    color: #2c1b0b;

    scrollbar-width: none;
    -ms-overflow-style: none;
}
.game-ranking::-webkit-scrollbar {
    width: 0;
    height: 0;
    display: none;
}

.game-ranking h3 {
    margin: 0 0 12px;
    color: #245f38;
}

.game-ranking ol {
    min-height: 0;

    margin: 0;

    padding-left: 25px;
    padding-right: 2px;

    overflow-y: auto;

    scrollbar-width: none;
    -ms-overflow-style: none;
}

.game-ranking ol::-webkit-scrollbar {
    width: 0;
    height: 0;
    display: none;
}

.game-ranking li {
    margin-bottom: 8px;
    font-weight: 800;
}

@media (max-width: 759px) {
    .game-modal {
        padding: 0;
    }

    .game-panel {
        width: 100%;
        height: 100dvh;
        border-width: 0;
        border-radius: 0;
    }

    .game-layout {
        grid-template-columns: 1fr;
        grid-template-rows: minmax(0, 1fr) 150px;
        padding: 8px;
    }

    .game-canvas { aspect-ratio: 900 / 520; }

    .game-ranking {
        border-width: 2px;
        padding: 8px;
    }

    .game-ranking h3 {
        margin-bottom: 5px;
        font-size: 15px;
    }

    .game-ranking ol {
        display: grid;

        grid-template-columns:
            repeat(2, minmax(0, 1fr));

        gap: 4px 15px;

        font-size: 11px;
    }

    .game-controls {
        gap: 5px;

        margin-top: 5px;
        padding-top: 5px;
    }

    .game-controls button {
        min-height: 38px;

        font-size: 18px;
    }
}
