/*
 * eu-pvp.net rankings.
 *
 * The first version fitted a leaderboard into the middle third of a 27 inch screen and
 * set it in 13px type. A leaderboard is a list people scan, not read, and a list that
 * is scanned needs two things: rows tall enough to land on and a rhythm that repeats.
 * So everything here is built on one spacing step and one row height, and the page is
 * given the width it was always meant to have.
 */

:root {
    --step: 8px;                 /* every gap on the page is a multiple of this */
    --row: 68px;                 /* and every row is exactly this tall */
    --page: 1400px;

    --bg: #0b0d13;
    --bg-lift: #12151e;
    --panel: #151925;
    --panel-hi: #1c2130;
    --line: #232838;

    --text: #e8ecf5;
    --muted: #8b93a7;
    --faint: #5b6377;

    --accent: #a855f7;
    --accent-soft: rgba(168, 85, 247, 0.16);
    --discord: #5865f2;

    --gold: #f5c542;
    --silver: #b9c2d0;
    --bronze: #cd7f32;

    --radius: 12px;
    --radius-sm: 8px;
}

* {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    background:
        radial-gradient(1100px 620px at 50% -180px, #1a1030 0%, transparent 70%),
        var(--bg);
    color: var(--text);
    font: 400 16px/1.5 "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
    min-height: 100vh;
}

img {
    display: block;
}

/* ------------------------------------------------------------------ header */

.top {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: calc(var(--step) * 3);
    max-width: var(--page);
    margin: 0 auto;
    padding: calc(var(--step) * 2.5) calc(var(--step) * 3);
    background: rgba(11, 13, 19, 0.82);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--line);
}

.brand {
    font-size: 30px;
    font-weight: 800;
    letter-spacing: -0.5px;
    text-decoration: none;
    white-space: nowrap;
}

.brand .eu {
    color: var(--accent);
}

.brand .pvp {
    color: var(--text);
}

.ip {
    display: flex;
    align-items: center;
    gap: var(--step);
}

.ip-label {
    color: var(--faint);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.ip-value {
    font: 600 15px/1 inherit;
    color: var(--text);
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 11px 14px;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}

.ip-value:hover {
    background: var(--panel-hi);
    border-color: var(--accent);
}

.ip-value.copied::after {
    content: " copied";
    color: var(--accent);
}

.discord {
    display: inline-flex;
    align-items: center;
    padding: 11px 18px;
    border-radius: var(--radius-sm);
    background: var(--discord);
    color: #fff;
    font-weight: 600;
    font-size: 15px;
    text-decoration: none;
    transition: filter 0.15s;
}

.discord:hover {
    filter: brightness(1.12);
}

/* -------------------------------------------------------------------- tabs */

.tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    max-width: var(--page);
    margin: calc(var(--step) * 4) auto 0;
    padding: 0 calc(var(--step) * 3);
}

.tab {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 14px 22px;
    border: 1px solid transparent;
    border-bottom: none;
    border-radius: var(--radius) var(--radius) 0 0;
    color: var(--muted);
    font-weight: 600;
    font-size: 16px;
    text-decoration: none;
    transition: color 0.15s, background 0.15s;
}

.tab img {
    width: 22px;
    height: 22px;
    image-rendering: pixelated;
}

.tab:hover {
    color: var(--text);
    background: var(--bg-lift);
}

/* The active tab joins the panel below it - one shape, not two. */
.tab.active {
    color: var(--text);
    background: var(--panel);
    border-color: var(--line);
    box-shadow: inset 0 2px 0 var(--accent);
}

/* ------------------------------------------------------------------- panel */

main {
    max-width: var(--page);
    margin: 0 auto calc(var(--step) * 8);
    padding: calc(var(--step) * 4);
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 0 var(--radius) var(--radius) var(--radius);
}

.notice {
    margin: 0 0 calc(var(--step) * 3);
    padding: calc(var(--step) * 2) calc(var(--step) * 2.5);
    background: var(--accent-soft);
    border-left: 3px solid var(--accent);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    color: var(--muted);
    font-size: 15px;
}

.notice strong {
    color: var(--text);
}

.notice.error {
    background: rgba(255, 92, 99, 0.12);
    border-left-color: #ff5c63;
}

/* ------------------------------------------------------------ overall table */

table.overall {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 6px;
}

table.overall thead th {
    padding: 0 calc(var(--step) * 2) var(--step);
    color: var(--faint);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    text-align: left;
}

table.overall thead th.num {
    text-align: right;
}

table.overall thead th.pos {
    width: 92px;
    text-align: center;
}

.player-row {
    background: var(--bg-lift);
    cursor: pointer;
    transition: background 0.15s, transform 0.15s;
}

tr.player-row td {
    height: var(--row);
    padding: 0 calc(var(--step) * 2);
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
}

tr.player-row td:first-child {
    border-left: 1px solid var(--line);
    border-radius: var(--radius) 0 0 var(--radius);
    padding: 0;
}

tr.player-row td:last-child {
    border-right: 1px solid var(--line);
    border-radius: 0 var(--radius) var(--radius) 0;
}

tr.player-row:hover td {
    background: var(--panel-hi);
    border-color: #2e3549;
}

/*
 * The place number gets a block of colour rather than a coloured digit. A number in
 * gold text is a number; a gold block with a number on it is a podium, and that reads
 * from the other side of the room.
 */
.pos {
    position: relative;
    width: 92px;
    height: var(--row);
    text-align: center;
    font-size: 26px;
    font-weight: 800;
    font-style: italic;
    color: var(--muted);
    overflow: hidden;
}

.pos::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 100%;
    /* Cut off on the slant so the block points into the row. */
    clip-path: polygon(0 0, 100% 0, 74% 100%, 0 100%);
    background: transparent;
}

.pos > * {
    position: relative;
}

.pos-1 {
    color: #201703;
}

.pos-1::before {
    background: linear-gradient(135deg, #ffd66b, var(--gold));
}

.pos-2 {
    color: #171b22;
}

.pos-2::before {
    background: linear-gradient(135deg, #dbe3ee, var(--silver));
}

.pos-3 {
    color: #1e1206;
}

.pos-3::before {
    background: linear-gradient(135deg, #e59a52, var(--bronze));
}

.who {
    display: flex;
    align-items: center;
    gap: calc(var(--step) * 1.5);
}

.head {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--line);
    background: #0e1017;
    image-rendering: pixelated;
    flex: none;
}

.name {
    font-size: 19px;
    font-weight: 700;
    letter-spacing: -0.2px;
}

.region {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 46px;
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    background: rgba(74, 222, 128, 0.12);
    color: #4ade80;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.06em;
}

.rank-chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 6px 12px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--rank) 16%, transparent);
    border: 1px solid color-mix(in srgb, var(--rank) 40%, transparent);
    color: var(--rank);
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
}

.rank-chip img {
    width: 18px;
    height: 18px;
}

.num {
    text-align: right;
    white-space: nowrap;
}

.total {
    font-size: 22px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}

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

/*
 * One tile per mode, all the same size whatever the number inside. Ragged tiles turn
 * a row of results into a row of shapes, and then the eye reads the shapes.
 */
.mode-pill {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    min-width: 52px;
    padding: 7px 6px;
    border-radius: var(--radius-sm);
    background: #0e1017;
    border: 1px solid var(--line);
}

.mode-pill img {
    width: 20px;
    height: 20px;
    image-rendering: pixelated;
}

.mode-pill b {
    font-size: 12px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}

/* ------------------------------------------------------------ tier columns */

.columns {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: calc(var(--step) * 2);
    margin-bottom: calc(var(--step) * 3);
}

.column {
    background: var(--bg-lift);
    border: 1px solid var(--line);
    border-top: 3px solid var(--rank);
    border-radius: var(--radius);
    overflow: hidden;
}

.column > header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: calc(var(--step) * 1.75) calc(var(--step) * 1.75);
    background: color-mix(in srgb, var(--rank) 12%, transparent);
}

.column > header img {
    width: 24px;
    height: 24px;
}

.tier {
    color: var(--rank);
    font-size: 16px;
    font-weight: 800;
}

.tier-name {
    margin-left: auto;
    color: var(--faint);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.column ol {
    margin: 0;
    padding: 6px;
    list-style: none;
}

.column li {
    display: flex;
    align-items: center;
    gap: 10px;
    height: 46px;
    padding: 0 10px;
    border-radius: var(--radius-sm);
}

.column li:hover {
    background: var(--panel-hi);
}

.column li .head {
    width: 26px;
    height: 26px;
    border-radius: 5px;
}

.column li .name {
    font-size: 15px;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.column .mmr {
    margin-left: auto;
    color: var(--muted);
    font-size: 14px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.column .empty {
    color: var(--faint);
    font-size: 14px;
    justify-content: center;
}

/* ------------------------------------------------------------ player card */

.card-backdrop {
    position: fixed;
    inset: 0;
    z-index: 60;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: calc(var(--step) * 3);
    background: rgba(4, 5, 9, 0.72);
    backdrop-filter: blur(6px);
}

.card-backdrop[hidden] {
    display: none;
}

.card {
    position: relative;
    width: min(560px, 100%);
    max-height: 86vh;
    overflow: auto;
    padding: calc(var(--step) * 4);
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: 0 32px 80px rgba(0, 0, 0, 0.55);
}

.card .close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--muted);
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
}

.card .close:hover {
    background: var(--panel-hi);
    color: var(--text);
}

.card-head {
    display: flex;
    align-items: center;
    gap: calc(var(--step) * 2);
    margin-bottom: calc(var(--step) * 3);
}

.card-head .head {
    width: 64px;
    height: 64px;
}

.card-head h2 {
    margin: 0 0 6px;
    font-size: 24px;
}

.card table {
    width: 100%;
    border-collapse: collapse;
}

.card td {
    height: 44px;
    border-top: 1px solid var(--line);
    font-size: 15px;
}

.card td:last-child {
    text-align: right;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

/* ------------------------------------------------------------------ footer */

footer {
    max-width: var(--page);
    margin: 0 auto;
    padding: calc(var(--step) * 4) calc(var(--step) * 3) calc(var(--step) * 8);
    color: var(--faint);
    font-size: 14px;
}

.dot {
    margin: 0 10px;
}

/* ------------------------------------------------------------------ narrow */

@media (max-width: 900px) {
    :root {
        --row: 60px;
    }

    .top {
        flex-wrap: wrap;
    }

    .tab {
        padding: 12px 16px;
        font-size: 15px;
    }

    /* The mode tiles are the first thing to go: the name and the total are the row. */
    .modes,
    table.overall thead th:nth-child(4) {
        display: none;
    }

    .name {
        font-size: 17px;
    }
}
