:root {
    --bg: #030303;
    --bg-soft: rgba(8, 8, 8, 0.96);
    --panel: rgba(10, 10, 10, 0.96);
    --panel-strong: rgba(16, 16, 16, 0.98);
    --line: rgba(255, 68, 68, 0.16);
    --line-strong: rgba(255, 68, 68, 0.3);
    --text: #f2ecec;
    --muted: #958686;
    --gold: #caa063;
    --cyan: #ff6a6a;
    --green: #7ec881;
    --red: #ff4444;
    --blue: #ad4040;
    --shadow: 0 18px 48px rgba(0, 0, 0, 0.45);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: 'Space Grotesk', sans-serif;
    color: var(--text);
    background: linear-gradient(180deg, #060606 0%, #020202 100%);
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image: linear-gradient(rgba(255, 255, 255, 0.015) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, 0.015) 1px, transparent 1px);
    background-size: 36px 36px;
    opacity: 0.28;
}

.page-shell {
    width: min(1220px, calc(100% - 28px));
    margin: 0 auto;
    padding: 28px 0 40px;
}

.hero,
.panel {
    position: relative;
    overflow: hidden;
    border: 1px solid var(--line);
    background: var(--panel);
    box-shadow: var(--shadow);
}

.hero {
    display: grid;
    grid-template-columns: 1.6fr 1fr;
    gap: 18px;
    padding: 20px 22px;
    border-radius: 22px;
}

.hero::after,
.panel::after {
    content: '';
    position: absolute;
    inset: auto 0 0 auto;
    width: 120px;
    height: 120px;
    background: radial-gradient(circle, rgba(255, 68, 68, 0.08), transparent 72%);
}

.section-kicker,
.meta-label,
.summary-label {
    text-transform: uppercase;
    letter-spacing: 0.18em;
    color: var(--cyan);
    font-size: 0.72rem;
}

.back-link {
    display: inline-flex;
    margin-bottom: 18px;
    color: var(--text);
    text-decoration: none;
    padding: 10px 14px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.02);
}

.back-link:hover {
    border-color: var(--line-strong);
    background: rgba(255, 68, 68, 0.08);
}

h1,
h2,
h3,
strong {
    font-family: 'Sora', sans-serif;
}

h1 {
    margin: 6px 0 8px;
    font-size: clamp(1.9rem, 3vw, 3rem);
    line-height: 0.95;
}

.hero-copy {
    margin: 0;
    max-width: 60ch;
    color: var(--muted);
    line-height: 1.65;
}

.hero-meta {
    display: grid;
    gap: 10px;
}

.hero-meta.compact {
    align-content: start;
}

.meta-card {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 11px 13px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.02);
}

.meta-card.accent {
    border-color: var(--line-strong);
    background: rgba(38, 10, 10, 0.72);
}

.dashboard {
    display: grid;
    gap: 16px;
    margin-top: 16px;
}

.panel {
    border-radius: 22px;
    padding: 16px;
}

.panel-heading {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.panel-heading h2,
h3 {
    margin: 4px 0 0;
}

button {
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 999px;
    color: var(--text);
    background: rgba(255, 255, 255, 0.03);
    text-decoration: none;
    font: inherit;
    transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.back-link:hover {
    transform: translateY(-1px);
    border-color: var(--line-strong);
    background: rgba(255, 68, 68, 0.08);
}
.summary-cards {
    position: relative;
    z-index: 1;
    display: grid;
    gap: 10px;
}
.summary-card {
    padding: 10px 12px;
    border-radius: 14px;
    border: 1px solid var(--line);
    background: var(--panel-strong);
}

.summary-card small {
    color: var(--muted);
}

.summary-value {
    display: block;
    margin-top: 6px;
    font-size: 1.08rem;
}

.summary-meta {
    font-size: 0.76rem;
}

.input-wrap {
    display: grid;
    gap: 6px;
    color: var(--muted);
    font-size: 0.82rem;
    min-width: 220px;
}

input {
    min-width: 220px;
    padding: 8px 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    color: var(--text);
    background: rgba(0, 0, 0, 0.68);
    outline: none;
}

input:focus {
    border-color: rgba(255, 92, 92, 0.5);
    box-shadow: 0 0 0 4px rgba(255, 92, 92, 0.1);
}

.summary-cards {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-bottom: 14px;
}

.table-wrap {
    position: relative;
    z-index: 1;
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: rgba(0, 0, 0, 0.46);
}

table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

thead {
    background: rgba(255, 255, 255, 0.035);
}

th,
td {
    padding: 8px 10px;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    font-size: 0.84rem;
    vertical-align: middle;
}

th {
    font-size: 0.72rem;
    letter-spacing: 0.05em;
    color: var(--muted);
    text-transform: uppercase;
    position: sticky;
    top: 0;
    z-index: 1;
}

tbody tr {
    transition: background 160ms ease;
}

tbody tr:nth-child(odd) {
    background: rgba(255, 255, 255, 0.015);
}

tbody tr:hover {
    background: rgba(255, 68, 68, 0.08);
}

th:nth-child(1),
td:nth-child(1) {
    width: 52px;
    text-align: center;
}

th:nth-child(2),
td:nth-child(2) {
    width: 34%;
}

th:nth-child(3),
td:nth-child(3) {
    width: 88px;
    text-align: right;
}

th:nth-child(4),
td:nth-child(4),
th:nth-child(5),
td:nth-child(5),
th:nth-child(6),
td:nth-child(6),
th:nth-child(7),
td:nth-child(7),
th:nth-child(8),
td:nth-child(8) {
    text-align: center;
}

.rank-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.04);
    font-weight: 700;
    font-size: 0.74rem;
}

.rank-badge.top-1,
.rank-badge.top-2,
.rank-badge.top-3 {
    color: #09111b;
}

.rank-badge.top-1 {
    background: var(--gold);
}

.rank-badge.top-2 {
    background: #d4dee8;
}

.rank-badge.top-3 {
    background: #dc9a65;
}

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

.player-avatar {
    width: 28px;
    height: 28px;
    border-radius: 9px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 68, 68, 0.14);
    background: rgba(40, 12, 12, 0.8);
    font-weight: 800;
    font-size: 0.68rem;
}

.player-meta {
    display: grid;
    gap: 2px;
    min-width: 0;
}

.player-meta strong {
    font-size: 0.84rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.player-subline,
.placeholder-cell {
    color: var(--muted);
    font-size: 0.72rem;
}

.player-subline {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.elo {
    color: var(--gold);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.positive {
    color: var(--green);
    font-variant-numeric: tabular-nums;
}

.placeholder-cell {
    padding: 40px 18px;
    text-align: center;
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.pagination button {
    padding: 7px 11px;
    cursor: pointer;
}

.pagination button:disabled {
    opacity: 0.4;
    cursor: default;
}

#page-indicator {
    color: var(--muted);
    font-size: 0.78rem;
    min-width: 96px;
    text-align: center;
}

.page-numbers {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: center;
}

.page-number {
    min-width: 32px;
}

.page-number.active {
    border-color: var(--line-strong);
    background: rgba(255, 68, 68, 0.16);
}

@media (max-width: 960px) {
    .hero,
    .summary-cards {
        grid-template-columns: 1fr;
    }

    .panel-heading {
        flex-direction: column;
        align-items: stretch;
    }

    input {
        min-width: 0;
    }

    table {
        table-layout: auto;
    }
}