:root {
    --bg: #030405;
    --card-bg: rgba(13, 18, 24, 0.72);
    --border: rgba(255, 255, 255, 0.06);
    --text: #f8fafc;
    --text-dim: #94a3b8;
    --accent: #3b82f6;
    --accent-glow: rgba(59, 130, 246, 0.28);
    --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    font-family: 'Inter', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    margin: 0;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

.glass {
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: 16px;
}

.container {
    max-width: 1540px;
    margin: 0 auto;
    padding: 40px 20px;
}

header {
    margin-bottom: 48px;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 16px;
}

h1 {
    font-family: 'Outfit', sans-serif;
    font-weight: 800;
    font-size: clamp(2rem, 5vw, 3rem);
    margin: 0;
    letter-spacing: -0.04em;
    background: linear-gradient(135deg, #fff 0%, #60a5fa 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.stat-box {
    padding: 24px;
    transition: transform 0.3s var(--ease-in-out);
}

.stat-box:hover {
    transform: translateY(-4px);
    border-color: var(--accent);
}

.stat-val {
    font-size: 2.5rem;
    font-weight: 800;
    display: block;
    margin-top: 8px;
    font-variant-numeric: tabular-nums;
}

.view-container {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 24px;
    min-height: 850px;
}

.table-side {
    overflow-x: auto;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: rgba(0, 0, 0, 0.2);
    max-height: 850px;
}

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

th {
    position: sticky;
    top: 0;
    z-index: 20;
    background: #030405;
    padding: 16px 20px;
    text-align: left;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-dim);
}

th.sortable { cursor: pointer; transition: color 0.1s; }
th.sortable:hover { color: var(--accent); }

td {
    padding: 18px 20px;
    border-bottom: 1px solid var(--border);
    transition: background 0.1s;
    vertical-align: top;
    overflow-wrap: break-word;
    word-break: normal;
}

tr:hover td {
    background: rgba(59, 130, 246, 0.05);
}

.rank-tag {
    padding: 4px 10px;
    border-radius: 99px;
    font-size: 0.65rem;
    font-weight: 800;
    text-transform: uppercase;
    white-space: nowrap;
}

.r-1 {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 0 15px var(--accent-glow);
}

.r-2 {
    background: #64748b;
    color: #fff;
}

.r-3 {
    background: rgba(148, 163, 184, 0.12);
    color: var(--text-dim);
}

.wq-tag {
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.65rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    display: inline-block;
}

.wq-ghost {
    background: rgba(59, 130, 246, 0.12);
    color: var(--accent);
    border: 1px dashed var(--accent-glow);
    font-weight: 800;
}

#map {
    border-radius: 16px;
    border: 1px solid var(--border);
    height: 850px;
    position: sticky;
    top: 40px;
}

.btn-action {
    background: #fff;
    color: #000;
    padding: 10px 18px;
    border-radius: 8px;
    font-weight: 800;
    font-size: 0.75rem;
    border: none;
    cursor: pointer;
    transition: 0.2s var(--ease-in-out);
}

.btn-action.primary {
    background: var(--accent);
    color: #fff;
}

.btn-action:hover {
    transform: scale(1.05);
    filter: contrast(110%);
}

.leaflet-tile {
    filter: invert(100%) hue-rotate(180deg) brightness(95%) contrast(90%);
}

@media (max-width: 1024px) {
    header {
        flex-direction: column;
        align-items: flex-start;
        gap: 20px;
    }
    .container {
        padding: 24px 14px;
    }
    .view-container {
        grid-template-columns: 1fr;
    }
    #map {
        height: min(42vh, 420px);
        min-height: 280px;
        position: relative;
        top: 0;
        order: -1;
    }
    .table-side {
        max-height: none;
    }
}

::-webkit-scrollbar {
    width: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

.ge-hud {
    font-family: ui-monospace, monospace;
    font-size: 11px;
    color: var(--text-dim);
    padding: 8px 12px;
    margin-bottom: 16px;
    border_radius: 8px;
    border: 1px solid var(--border);
    background: rgba(0, 0, 0, 0.35);
}

.hub-nav-links {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 14px;
    margin-top: 12px;
}

.hub-nav-links a {
    color: var(--accent);
    font-weight: 700;
    text-decoration: none;
    font-size: 0.8rem;
}

.hub-nav-links a:hover {
    text-decoration: underline;
}

@media (max-width: 1200px) {
    .table-side table {
        min-width: 960px;
        table-layout: auto;
    }
    .table-side th:nth-child(3),
    .table-side td:nth-child(3) {
        white-space: nowrap;
        width: 1%;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 16px 12px;
    }
    h1 {
        font-size: 1.65rem;
    }
    .stat-val {
        font-size: 1.75rem;
    }
}
