:root {
    --bg: #f4f5f7;
    --panel: #ffffff;
    --ink: #1c232b;
    --muted: #66717f;
    --line: #dde3ea;
    --accent: #c43b2f;
    --accent-2: #10756f;
    --gold: #d89b22;
    --shadow: 0 18px 45px rgba(28, 35, 43, 0.08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: Arial, Helvetica, sans-serif;
    line-height: 1.5;
}

.app-shell {
    width: min(1120px, calc(100% - 32px));
    margin: 0 auto;
    padding: 32px 0;
}

.page-header {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 24px;
}

.eyebrow {
    margin: 0 0 4px;
    color: var(--accent);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: uppercase;
}

h1,
h2,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: 0;
    font-size: clamp(2rem, 4vw, 3.8rem);
    line-height: 1;
}

h2 {
    font-size: 1.1rem;
}

.stats-strip {
    display: grid;
    grid-template-columns: repeat(3, minmax(88px, 1fr));
    gap: 8px;
    margin: 0;
}

.stats-strip div {
    min-width: 0;
    padding: 12px 14px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.stats-strip dt {
    color: var(--muted);
    font-size: 0.75rem;
}

.stats-strip dd {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 800;
}

.notice,
.empty-state {
    margin-bottom: 18px;
    padding: 18px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.notice--error {
    border-left: 5px solid var(--accent);
}

.notice ul {
    margin: 0;
    padding-left: 20px;
}

code {
    padding: 2px 5px;
    background: #eef1f4;
    border-radius: 4px;
    font-size: 0.92em;
}

.leaderboard {
    overflow: hidden;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.leaderboard-heading,
.leaderboard-summary {
    display: grid;
    grid-template-columns: 84px minmax(220px, 1fr) 110px 90px 90px;
    gap: 12px;
    align-items: center;
}

.leaderboard-heading {
    padding: 12px 18px;
    color: var(--muted);
    background: #f8fafb;
    border-bottom: 1px solid var(--line);
    font-size: 0.76rem;
    font-weight: 800;
    text-transform: uppercase;
}

.leaderboard-row {
    border-bottom: 1px solid var(--line);
}

.leaderboard-row:last-child {
    border-bottom: 0;
}

.leaderboard-summary {
    min-height: 78px;
    padding: 12px 18px;
    cursor: pointer;
    list-style: none;
}

.leaderboard-summary::-webkit-details-marker {
    display: none;
}

.leaderboard-summary:hover {
    background: #fbfcfd;
}

.rank {
    color: var(--gold);
    font-size: 1.1rem;
    font-weight: 900;
}

.player {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 12px;
}

.avatar {
    position: relative;
    display: inline-grid;
    flex: 0 0 54px;
    width: 54px;
    height: 54px;
    place-items: center;
    overflow: hidden;
    color: #ffffff;
    background: var(--accent-2);
    border-radius: 50%;
    font-size: 0.9rem;
    font-weight: 800;
}

.avatar img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.player-name {
    min-width: 0;
    overflow-wrap: anywhere;
    font-weight: 800;
}

.points {
    font-size: 1.65rem;
    line-height: 1;
}

.metric {
    font-weight: 800;
}

.matches {
    padding: 0 18px 18px 114px;
}

.matches-heading,
.match-row {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) 100px 90px 64px;
    gap: 12px;
    align-items: center;
}

.matches-heading {
    padding: 10px 0;
    color: var(--muted);
    border-top: 1px solid var(--line);
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
}

.match-row {
    min-height: 48px;
    padding: 9px 0;
    border-top: 1px solid #edf0f3;
}

.match-teams {
    min-width: 0;
    overflow-wrap: anywhere;
    font-weight: 700;
}

.match-teams span {
    color: var(--muted);
    font-weight: 400;
}

.match-teams small {
    display: block;
    color: var(--muted);
    font-size: 0.76rem;
    font-weight: 700;
}

.is-scored strong:last-child {
    color: var(--accent-2);
}

.is-pending {
    color: var(--muted);
}

@media (max-width: 760px) {
    .app-shell {
        width: min(100% - 20px, 1120px);
        padding: 20px 0;
    }

    .page-header {
        display: block;
    }

    .stats-strip {
        margin-top: 18px;
    }

    .leaderboard-heading {
        display: none;
    }

    .leaderboard-summary {
        grid-template-columns: 58px minmax(0, 1fr) 74px;
        gap: 10px;
        min-height: 76px;
        padding: 12px;
    }

    .leaderboard-summary .metric {
        display: none;
    }

    .points {
        text-align: right;
    }

    .matches {
        padding: 0 12px 14px;
    }

    .matches-heading {
        display: none;
    }

    .match-row {
        grid-template-columns: minmax(0, 1fr) 64px 64px 44px;
        gap: 8px;
        font-size: 0.9rem;
    }

    .avatar {
        flex-basis: 48px;
        width: 48px;
        height: 48px;
    }
}

@media (max-width: 460px) {
    .stats-strip {
        grid-template-columns: 1fr;
    }

    .leaderboard-summary {
        grid-template-columns: 48px minmax(0, 1fr) 58px;
    }

    .rank {
        font-size: 0.95rem;
    }

    .points {
        font-size: 1.3rem;
    }

    .match-row {
        grid-template-columns: minmax(0, 1fr) 48px 48px 36px;
        font-size: 0.84rem;
    }
}
