﻿:root {
    --bg: #060606;
    --panel: rgba(10, 10, 10, 0.97);
    --panel-strong: rgba(18, 18, 18, 0.98);
    --header-bg: rgba(6, 6, 6, 0.88);
    --line: rgba(255, 68, 68, 0.15);
    --line-strong: rgba(255, 68, 68, 0.32);
    --text: #f0e8e8;
    --muted: #8a7a7a;
    --accent: #ff4444;
    --accent-soft: #ff6a6a;
    --gold: #caa063;
    --green: #78df8a;
    --shadow: 0 20px 56px rgba(0, 0, 0, 0.5);
    --header-h: 62px;
    --radius-lg: 24px;
    --radius-md: 16px;
    --radius-sm: 10px;
}

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;
    font-family: 'Space Grotesk', sans-serif;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.012) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.012) 1px, transparent 1px);
    background-size: 40px 40px;
    z-index: 0;
}

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

/* HEADER */

.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    height: var(--header-h);
    border-bottom: 1px solid var(--line);
    background: var(--header-bg);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
}

.header-inner {
    width: min(1240px, calc(100% - 32px));
    margin: 0 auto;
    height: 100%;
    display: flex;
    align-items: center;
    gap: 20px;
}

.brand {
    display: flex;
    align-items: center;
    text-decoration: none;
    flex-shrink: 0;
}

.brand-logo {
    height: 38px;
    width: auto;
    display: block;
    /* Black bg matches site bg, no need for border-radius */
    /* Slight glow to match the site vibe */
    filter: drop-shadow(0 0 6px rgba(255, 60, 60, 0.35));
}

.mode-tabs {
    display: flex;
    gap: 4px;
    padding: 4px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.03);
}

.mode-tab {
    padding: 6px 20px;
    border: 1px solid transparent;
    border-radius: 999px;
    font: inherit;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
    background: transparent;
    cursor: pointer;
    transition: color 180ms, background 180ms, border-color 180ms, box-shadow 180ms;
    white-space: nowrap;
}

.mode-tab:hover:not(.active) {
    color: var(--text);
    background: rgba(255, 255, 255, 0.06);
}

.mode-tab.active {
    color: #fff;
    background: linear-gradient(135deg, #b52222 0%, #ff4444 100%);
    border-color: transparent;
    box-shadow: 0 2px 14px rgba(255, 50, 50, 0.38);
}

.header-spacer {
    flex: 1;
}

.header-link {
    padding: 8px 16px;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--muted);
    text-decoration: none;
    font-size: 0.78rem;
    font-weight: 500;
    white-space: nowrap;
    flex-shrink: 0;
    transition: color 160ms, border-color 160ms, background 160ms;
}

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

/* PAGE SHELL */

.page-shell {
    position: relative;
    z-index: 1;
    width: min(1240px, calc(100% - 32px));
    margin: 0 auto;
    padding: 28px 0 56px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

/* HERO */

.hero {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 28px;
    align-items: center;
    padding: 30px 32px;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--panel);
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
}

.hero::after {
    content: '';
    position: absolute;
    top: -80px;
    right: -80px;
    width: 360px;
    height: 360px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 44, 44, 0.065), transparent 68%);
    pointer-events: none;
}

.hero-left {
    flex-shrink: 0;
}

.kicker {
    display: inline-block;
    text-transform: uppercase;
    letter-spacing: 0.22em;
    font-size: 0.66rem;
    color: var(--accent-soft);
    margin-bottom: 12px;
}

.hero-left h1 {
    font-size: clamp(2.4rem, 4vw, 3.6rem);
    font-weight: 800;
    line-height: 1.0;
    margin-bottom: 16px;
}

.hero-left h1 em {
    font-style: normal;
    background: linear-gradient(135deg, #ff4444, #ff8a8a);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-desc {
    color: var(--muted);
    font-size: 0.86rem;
    line-height: 1.7;
    max-width: 36ch;
}

/* SUMMARY CARDS */

.summary-cards {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    position: relative;
    z-index: 1;
}

.summary-card {
    padding: 16px 18px;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.025);
    display: flex;
    flex-direction: column;
    gap: 5px;
    transition: border-color 200ms, background 200ms;
}

.summary-card:hover {
    border-color: var(--line-strong);
    background: rgba(255, 68, 68, 0.05);
}

.summary-label {
    text-transform: uppercase;
    letter-spacing: 0.18em;
    font-size: 0.64rem;
    color: var(--accent-soft);
    font-weight: 500;
}

.summary-value {
    display: block;
    font-family: 'Sora', sans-serif;
    font-size: 1.5rem;
    font-weight: 800;
    line-height: 1.15;
    color: var(--text);
}

.summary-meta {
    font-size: 0.73rem;
    color: var(--muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* PANEL */

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

.panel-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    padding: 20px 20px 18px;
    border-bottom: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.012);
    position: relative;
    z-index: 1;
}

.panel-head-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.panel-head h2 {
    font-size: 1.1rem;
    font-weight: 700;
    line-height: 1;
}

.panel-room-badge {
    padding: 3px 10px;
    border-radius: 999px;
    background: rgba(255, 68, 68, 0.1);
    border: 1px solid var(--line-strong);
    color: var(--accent-soft);
    font-size: 0.68rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    font-weight: 700;
}

.input-wrap {
    display: grid;
    gap: 5px;
    color: var(--muted);
    font-size: 0.76rem;
    font-weight: 500;
}

.input-wrap input[type="search"] {
    padding: 8px 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    color: var(--text);
    background: rgba(0, 0, 0, 0.52);
    outline: none;
    font: inherit;
    font-size: 0.84rem;
    min-width: 210px;
    transition: border-color 160ms, box-shadow 160ms;
}

.input-wrap input[type="search"]:focus {
    border-color: rgba(255, 68, 68, 0.5);
    box-shadow: 0 0 0 3px rgba(255, 68, 68, 0.1);
}

/* TABLE */

.table-wrap {
    overflow-x: auto;
    position: relative;
    z-index: 1;
}

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

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

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

th {
    font-size: 0.68rem;
    letter-spacing: 0.07em;
    color: var(--muted);
    text-transform: uppercase;
    font-weight: 600;
    position: sticky;
    top: 0;
    z-index: 2;
    background: rgba(10, 10, 10, 0.95);
}

tbody tr {
    transition: background 140ms;
}

tbody tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.012);
}

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

th:nth-child(1), td:nth-child(1) { width: 54px; text-align: center; }
th:nth-child(2), td:nth-child(2) { width: 30%; }
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 */

.rank-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 28px;
    border-radius: 8px;
    font-family: 'Sora', sans-serif;
    font-size: 0.76rem;
    font-weight: 800;
    background: rgba(255, 255, 255, 0.05);
    color: var(--muted);
}

.rank-badge.top-1,
.rank-badge.top-2,
.rank-badge.top-3 {
    color: #0a0a0a;
}

.rank-badge.top-1 {
    background: linear-gradient(135deg, #a07428, #d4a44a);
    box-shadow: 0 2px 10px rgba(212, 164, 74, 0.3);
}

.rank-badge.top-2 {
    background: linear-gradient(135deg, #6e7f8e, #b8c8d4);
}

.rank-badge.top-3 {
    background: linear-gradient(135deg, #8b3a1a, #c07448);
}

/* PLAYER CELL */

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

.player-avatar {
    width: 30px;
    height: 30px;
    border-radius: 9px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 68, 68, 0.18);
    background: rgba(38, 10, 10, 0.82);
    font-family: 'Sora', sans-serif;
    font-size: 0.68rem;
    font-weight: 800;
    color: var(--accent-soft);
    flex-shrink: 0;
}

.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 {
    font-size: 0.7rem;
    color: var(--muted);
    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: 48px 18px;
    text-align: center;
    color: var(--muted);
    font-size: 0.86rem;
}

/* PAGINATION */

.pagination {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 18px;
    border-top: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.01);
    flex-wrap: wrap;
    position: relative;
    z-index: 1;
}

.pagination button,
.page-number {
    padding: 7px 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    color: var(--text);
    background: rgba(255, 255, 255, 0.03);
    font: inherit;
    font-size: 0.78rem;
    cursor: pointer;
    transition: border-color 140ms, background 140ms, color 140ms;
}

.pagination button:hover:not(:disabled),
.page-number:hover:not(.active) {
    border-color: var(--line-strong);
    background: rgba(255, 68, 68, 0.08);
}

.pagination button:disabled {
    opacity: 0.35;
    cursor: default;
    pointer-events: none;
}

.page-number.active {
    border-color: var(--line-strong);
    background: rgba(255, 68, 68, 0.15);
    color: var(--accent-soft);
    font-weight: 700;
}

.page-numbers {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
}

#page-indicator {
    margin-left: auto;
    color: var(--muted);
    font-size: 0.78rem;
}

/* PROFILE SEARCH PANEL */

.profile-search-panel {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: 32px;
    align-items: center;
    padding: 30px 32px;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--panel);
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
}

.profile-search-panel::after {
    content: '';
    position: absolute;
    bottom: -60px;
    left: -60px;
    width: 260px;
    height: 260px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 44, 44, 0.055), transparent 70%);
    pointer-events: none;
}

.ps-copy h2 {
    font-size: 1.6rem;
    font-weight: 800;
    margin: 10px 0 10px;
    line-height: 1.1;
}

.ps-copy p {
    color: var(--muted);
    font-size: 0.85rem;
    line-height: 1.7;
    max-width: 40ch;
}

.ps-controls {
    display: flex;
    flex-direction: column;
    gap: 10px;
    position: relative;
    z-index: 1;
}

.ps-input-row {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.ps-input-wrap {
    flex: 1;
}

.ps-input-wrap input[type="search"] {
    width: 100%;
    padding: 11px 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    color: var(--text);
    background: rgba(0, 0, 0, 0.52);
    outline: none;
    font: inherit;
    font-size: 0.88rem;
    transition: border-color 160ms, box-shadow 160ms;
}

.ps-input-wrap input[type="search"]:focus {
    border-color: rgba(255, 68, 68, 0.5);
    box-shadow: 0 0 0 3px rgba(255, 68, 68, 0.1);
}

.ps-btn {
    padding: 11px 22px;
    border-radius: var(--radius-sm);
    border: none;
    font: inherit;
    font-size: 0.84rem;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, #b52222 0%, #ff4444 100%);
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    transition: opacity 160ms, transform 160ms, box-shadow 160ms;
    box-shadow: 0 4px 16px rgba(255, 50, 50, 0.3);
}

.ps-btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
    box-shadow: 0 6px 22px rgba(255, 50, 50, 0.42);
}

.ps-btn:active {
    transform: translateY(0);
}

.ps-results {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 230px;
    overflow-y: auto;
}

.ps-result-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--panel-strong);
    text-decoration: none;
    color: var(--text);
    font-size: 0.84rem;
    transition: border-color 140ms, background 140ms;
    cursor: pointer;
}

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

.ps-result-name {
    font-family: 'Sora', sans-serif;
    font-weight: 700;
    font-size: 0.88rem;
}

.ps-result-sub {
    font-size: 0.72rem;
    color: var(--muted);
    margin-top: 2px;
}

.ps-result-elo {
    font-weight: 700;
    color: var(--gold);
    font-size: 0.84rem;
    white-space: nowrap;
    flex-shrink: 0;
}

.ps-empty {
    color: var(--muted);
    font-size: 0.82rem;
    padding: 10px 4px;
}

/* RESPONSIVE */

@media (max-width: 980px) {
    .hero {
        grid-template-columns: 1fr;
    }

    .summary-cards {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .panel-head {
        flex-direction: column;
        align-items: flex-start;
    }

    .input-wrap input[type="search"] {
        min-width: 0;
        width: 100%;
    }

    .profile-search-panel {
        grid-template-columns: 1fr;
        gap: 22px;
    }

    .ps-input-row {
        flex-direction: column;
        align-items: stretch;
    }

    .ps-btn {
        text-align: center;
    }
}

@media (max-width: 560px) {
    .mode-tab {
        padding: 6px 13px;
        font-size: 0.72rem;
    }

    .summary-cards {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .hero-left h1 {
        font-size: 2.2rem;
    }
}
