.game-score-panel {
    background: linear-gradient(145deg, #ffffff 0%, #f7faff 100%);
    border: 1px solid #dce5f2;
    border-radius: 16px;
    box-shadow: 0 16px 38px rgba(15, 23, 42, 0.1);
    color: #172033;
    margin: 24px 0 42px;
    overflow: hidden;
    padding: 24px;
}

.game-score-panel *,
.game-player-modal *,
.game-result-modal * {
    box-sizing: border-box;
}

.game-score-panel-header {
    display: grid;
    gap: 24px;
    grid-template-columns: minmax(0, 1fr);
    margin-bottom: 20px;
}

.game-score-eyebrow {
    color: #2563eb;
    display: block;
    font-size: 0.74rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    margin-bottom: 4px;
    text-transform: uppercase;
}

.game-score-panel h2 {
    color: #111827;
    font-size: clamp(1.45rem, 2.8vw, 2rem);
    font-weight: 800;
    margin: 0;
}

.game-player-form label {
    color: #475569;
    display: block;
    font-size: 0.78rem;
    font-weight: 800;
    margin-bottom: 6px;
}

.game-player-form-row {
    display: flex;
    gap: 8px;
}

.game-player-form input {
    background: #fff;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    color: #172033;
    flex: 1;
    min-width: 0;
    padding: 10px 12px;
}

.game-player-form input:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
    outline: none;
}

.game-player-form button,
.game-result-primary {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    border: 0;
    border-radius: 10px;
    color: #fff;
    cursor: pointer;
    font-weight: 800;
    padding: 10px 16px;
}

.game-player-form button:hover,
.game-result-primary:hover {
    filter: brightness(1.08);
}

.game-score-feedback {
    color: #0f766e;
    display: block;
    font-size: 0.76rem;
    min-height: 1.2em;
    padding-top: 5px;
}

.game-score-feedback.is-error {
    color: #b91c1c;
}

.game-panel-feedback {
    margin: -12px 0 8px;
}

.game-score-stats {
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-bottom: 20px;
}

.game-score-stats > div {
    background: #eff5ff;
    border: 1px solid #d9e7fb;
    border-radius: 12px;
    min-width: 0;
    padding: 12px;
}

.game-score-stats span {
    color: #64748b;
    display: block;
    font-size: 0.72rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.game-score-stats strong {
    color: #172033;
    display: block;
    font-size: 1.05rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.game-leaderboard-table-wrap {
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    overflow-x: auto;
}

.game-leaderboard-table {
    border-collapse: collapse;
    margin: 0;
    min-width: 460px;
    width: 100%;
}

.game-leaderboard-table th,
.game-leaderboard-table td {
    border-bottom: 1px solid #e8edf4;
    padding: 11px 12px;
    text-align: left;
}

.game-leaderboard-table th {
    background: #f1f5f9;
    color: #475569;
    font-size: 0.72rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.game-leaderboard-table tbody tr:last-child td {
    border-bottom: 0;
}

.game-leaderboard-table tbody tr.is-current-player {
    background: #eaf2ff;
    color: #1749a6;
    font-weight: 800;
}

.game-leader-score {
    font-variant-numeric: tabular-nums;
    font-weight: 800;
}

.game-score-empty {
    color: #64748b;
    padding: 24px !important;
    text-align: center !important;
}

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

.game-player-modal,
.game-result-modal {
    align-items: center;
    display: flex;
    inset: 0;
    justify-content: center;
    padding: 18px;
    position: fixed;
    z-index: 10050;
}

.game-player-backdrop,
.game-result-backdrop {
    background: rgba(8, 15, 30, 0.76);
    inset: 0;
    position: absolute;
}

.game-player-dialog,
.game-result-dialog {
    background: #fff;
    border-radius: 18px;
    box-shadow: 0 28px 80px rgba(0, 0, 0, 0.32);
    max-height: calc(100vh - 36px);
    max-height: calc(100dvh - 36px);
    max-width: 620px;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 28px;
    position: relative;
    text-align: center;
    -webkit-overflow-scrolling: touch;
    width: 100%;
    z-index: 1;
}

.game-player-dialog {
    max-width: 460px;
    text-align: left;
}

.game-player-icon {
    align-items: center;
    background: linear-gradient(135deg, #dbeafe, #bfdbfe);
    border-radius: 50%;
    color: #1d4ed8;
    display: flex;
    font-size: 1.35rem;
    height: 54px;
    justify-content: center;
    margin: 0 auto 12px;
    width: 54px;
}

.game-player-dialog h2,
.game-player-dialog > p {
    text-align: center;
}

.game-player-dialog > p {
    color: #64748b;
    margin: 6px 0 20px;
}

.game-result-close {
    align-items: center;
    background: #eef2f7;
    border: 0;
    border-radius: 50%;
    color: #334155;
    cursor: pointer;
    display: flex;
    font-size: 1.5rem;
    height: 36px;
    justify-content: center;
    line-height: 1;
    position: absolute;
    right: 16px;
    top: 16px;
    width: 36px;
}

.game-result-trophy {
    align-items: center;
    background: linear-gradient(135deg, #fff2b8, #f4b942);
    border-radius: 50%;
    color: #8a5a00;
    display: inline-flex;
    font-size: 1.45rem;
    height: 58px;
    justify-content: center;
    margin-bottom: 10px;
    width: 58px;
}

.game-result-dialog h2 {
    margin-bottom: 4px;
}

.game-result-dialog > p {
    color: #64748b;
    margin-bottom: 18px;
}

.game-result-dialog h3 {
    color: #334155;
    font-size: 1rem;
    margin: 20px 0 10px;
}

.game-result-highlight {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.game-result-highlight > div {
    background: linear-gradient(135deg, #eff6ff, #e0ecff);
    border: 1px solid #cfe0fb;
    border-radius: 14px;
    padding: 14px;
}

.game-result-highlight span {
    color: #64748b;
    display: block;
    font-size: 0.76rem;
    font-weight: 700;
}

.game-result-highlight strong {
    color: #1749a6;
    display: block;
    font-size: 1.55rem;
    margin-top: 3px;
}

.game-result-totals {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}

.game-result-totals span {
    background: #f1f5f9;
    border-radius: 999px;
    color: #475569;
    font-size: 0.8rem;
    padding: 7px 11px;
}

.game-result-games {
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    margin: 12px 0 18px;
    max-height: 220px;
    overflow-y: auto;
    text-align: left;
}

.game-result-games > div {
    align-items: center;
    border-bottom: 1px solid #edf1f6;
    display: flex;
    gap: 14px;
    justify-content: space-between;
    padding: 9px 11px;
}

.game-result-games > div:last-child {
    border-bottom: 0;
}

.game-result-games strong {
    color: #334155;
    font-size: 0.82rem;
}

.game-result-games span {
    color: #64748b;
    font-size: 0.75rem;
    text-align: right;
}

.game-result-primary {
    min-width: 150px;
}

body.game-player-open,
body.game-result-open {
    overflow: hidden;
}

@media (max-width: 767.98px) {
    .game-score-panel {
        border-radius: 12px;
        margin: 16px 0 24px;
        padding: 16px;
    }

    .game-score-panel-header {
        align-items: stretch;
        grid-template-columns: 1fr;
    }

    .game-score-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .game-player-modal,
    .game-result-modal {
        padding:
            max(12px, env(safe-area-inset-top))
            12px
            max(12px, env(safe-area-inset-bottom));
    }

    .game-player-dialog,
    .game-result-dialog {
        border-radius: 14px;
        max-height: 82vh;
        max-height: 82dvh;
        padding: 18px 14px 16px;
    }

    .game-player-icon {
        font-size: 1.1rem;
        height: 44px;
        margin-bottom: 8px;
        width: 44px;
    }

    .game-player-dialog > p {
        margin: 4px 0 14px;
    }

    .game-result-close {
        height: 32px;
        right: 10px;
        top: 10px;
        width: 32px;
    }

    .game-result-trophy {
        font-size: 1.15rem;
        height: 44px;
        margin-bottom: 6px;
        width: 44px;
    }

    .game-result-dialog > p {
        margin-bottom: 12px;
    }

    .game-result-dialog h3 {
        margin: 14px 0 8px;
    }

    .game-result-highlight {
        gap: 8px;
    }

    .game-result-highlight > div {
        border-radius: 10px;
        padding: 9px;
    }

    .game-result-highlight strong {
        font-size: 1.25rem;
    }

    .game-result-totals span {
        padding: 5px 9px;
    }

    .game-result-games {
        max-height: 140px;
        max-height: min(140px, 20dvh);
        margin: 8px 0 12px;
    }

    .game-result-games > div {
        align-items: flex-start;
        flex-direction: column;
        gap: 3px;
        padding: 7px 9px;
    }

    .game-result-games span {
        text-align: left;
    }
}

@media (max-width: 380px) {
    .game-player-form-row {
        align-items: stretch;
        flex-direction: column;
    }

    .game-result-highlight {
        grid-template-columns: 1fr;
    }
}
