:root {
    --bg: #e9eef6;
    --card: #fbfdff;
    --muted: #333a44;
    --accent: #0b63d6;
    --border: #d3d9e6;
}

html,
:root {
    --bg: #e9eef6;
    --card: #fbfdff;
    --muted: #333a44;
    --accent: #0b63d6;
    --border: #d3d9e6;
}

html,
body {
    height: 100%
}

body {
    margin: 0;
    background: var(--bg);
    font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial;
    color: #0f172a;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.page {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 32px
}

.card {
    width: 100%;
    max-width: 1700px;
    background: var(--card);
    border-radius: 12px;
    padding: 20px 20px 28px;
    box-shadow: 0 6px 24px rgba(18, 38, 63, 0.08);
    border: 1px solid var(--border);
}

.title {
    margin: 0 0 36px;
    font-size: 38px;
    font-weight: 700;
    text-align: center;
}

.subtitle {
    margin: 0 0 16px;
    color: var(--muted);
    font-size: 13px
}

.controls {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 12px
}

input#filter {
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid #d1d5db;
    min-width: 260px;
    box-shadow: none;
    font-size: 14px
}

input#filter:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(3, 102, 214, 0.08)
}

#ageGroupButtons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px
}

.btn {
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid #d1d5db;
    background: #fff;
    color: #0f172a;
    cursor: pointer;
    font-size: 13px
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.06)
}

.btn.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent)
}

table {
    width: 80vw;
    border-collapse: collapse;
    margin-top: 8px;
    font-size: 14px
}

thead th {
    position: relative;
    padding: 12px 10px;
    background: linear-gradient(180deg, #fbfdff, #f6f9ff);
    border-bottom: 1px solid var(--border);
    text-align: left
}

tbody td {
    padding: 10px;
    border-bottom: 1px solid #f1f5f9
}

tbody tr:hover td {
    background: linear-gradient(90deg, rgba(3, 102, 214, 0.02), rgba(0, 0, 0, 0))
}

tr:nth-child(even) td {
    background: #fbfcfe
}

th.sort-asc::after,
th.sort-desc::after {
    font-size: 12px;
    margin-left: 6px;
    color: var(--muted)
}

#pager {
    margin-top: 14px;
    display: flex;
    gap: 10px;
    align-items: center
}

#pager button {
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid #d1d5db;
    background: #fff
}

#pager button:disabled {
    opacity: 0.5;
    cursor: not-allowed
}

#pager select {
    padding: 8px;
    border-radius: 8px;
    border: 1px solid #d1d5db
}

@media (max-width:700px) {
    .card {
        padding: 14px
    }

    input#filter {
        min-width: 160px
    }

    thead th,
    tbody td {
        padding: 8px
    }
}

/* Sticky header and podium colors */
thead th {
    position: sticky;
    top: 0;
    z-index: 3
}

table {
    width: 80vw;
    max-width: 1800px;
    margin: 0 auto
}

.podium1 td {
    background: linear-gradient(90deg, #fff4d9, #ffe7a8);
    color: #5b3b00
}

.podium2 td {
    background: linear-gradient(90deg, #e9eef6, #d7dfe9);
    color: #24303a
}

.podium3 td {
    background: linear-gradient(90deg, #fde8d9, #ffd1a8);
    color: #5a3620
}

.gold {
    background: linear-gradient(90deg, #ffd94d, #ffbf00);
    color: #3b2a00
}

.silver {
    background: linear-gradient(90deg, #dfe6ee, #c6cfd9);
    color: #1f2933
}

.bronze {
    background: linear-gradient(90deg, #f6c49a, #e5935b);
    color: #4b2e1a
}

/* Expandable per-row details */
.btn.toggle {
    padding: 4px 8px;
    font-size: 12px;
    line-height: 1;
}

.details-row td {
    background: linear-gradient(180deg, rgba(250, 250, 252, 0.9), rgba(245, 247, 250, 0.95));
    padding: 10px 12px;
    border-bottom: 1px solid #eef2f7;
}

.detail-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 14px;
    align-items: center;
}

.detail-item {
    background: rgba(0, 0, 0, 0.02);
    padding: 6px 8px;
    border-radius: 8px;
    font-size: 13px;
}

.detail-item strong {
    font-weight: 600;
    margin-right: 6px
}

.up {
    color: #0f9d58;
    font-weight: 600
}

.down {
    color: #d93025;
    font-weight: 600
}

.muted {
    color: #667085;
    font-style: italic
}

/* Ensure cell-level top-3 colors are visible even when the row has a podium background.
   These selectors are more specific so they take precedence over `.podium1 td` etc. */
.podium1 td.gold,
.podium2 td.gold,
.podium3 td.gold {
    background: linear-gradient(90deg, #ffd94d, #ffbf00);
    color: #3b2a00;
}

.podium1 td.silver,
.podium2 td.silver,
.podium3 td.silver {
    background: linear-gradient(90deg, #dfe6ee, #c6cfd9);
    color: #1f2933;
}

.podium1 td.bronze,
.podium2 td.bronze,
.podium3 td.bronze {
    background: linear-gradient(90deg, #f6c49a, #e5935b);
    color: #4b2e1a;
}


.silver {
    background: linear-gradient(90deg, #dfe6ee, #c6cfd9);
    color: #1f2933
}

.bronze {
    background: linear-gradient(90deg, #f6c49a, #e5935b);
    color: #4b2e1a
}