/*
 * CTR Central. Palette of the CTR Central launcher (ctr-decomp src/launcher/launcher.c): navy to
 * purple, gold letters, the game's red selection bar and the checkered flag, in a modern take:
 * rounded translucent panels, soft shadows and glows, Exo 2 for headings, Inter for text.
 */

:root {
    --bg-top: #0a1248;
    --bg-bottom: #2e0a40;
    --panel: rgba(9, 11, 38, 0.72);
    --panel-border: rgba(196, 200, 232, 0.12);
    --panel-border-strong: rgba(196, 200, 232, 0.22);
    --inset: rgba(255, 255, 255, 0.04);
    --row-alt: rgba(255, 255, 255, 0.025);
    --row-hover: rgba(130, 186, 255, 0.08);
    --gold-top: #fff246;
    --gold-bottom: #ff9210;
    --gold: #ffcf3f;
    --red-top: #ef4a22;
    --red-bottom: #a3140c;
    --blue-soft: rgba(61, 107, 255, 0.16);
    --text: #eef0fb;
    --text-soft: #b6bad8;
    --dim: #7d81a6;
    --ok: #7be854;
    --bad: #ff6a4d;
    --busy: #ffd84a;
    --radius: 14px;
    --radius-sm: 10px;
    --heading-font: "Exo 2", "Segoe UI", system-ui, sans-serif;
    --body-font: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
}

/* ── Base ──────────────────────────────────────────────────────────────────── */

html {
    background: var(--bg-bottom);
}

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background:
        radial-gradient(900px 500px at 15% -10%, rgba(61, 107, 255, 0.28), transparent 70%),
        radial-gradient(800px 500px at 100% 10%, rgba(255, 146, 16, 0.10), transparent 70%),
        radial-gradient(900px 600px at 50% 110%, rgba(190, 40, 160, 0.22), transparent 70%),
        linear-gradient(180deg, var(--bg-top) 0%, var(--bg-bottom) 100%);
    background-attachment: fixed;
    color: var(--text);
    font-family: var(--body-font);
    font-size: 15px;
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--gold);
    text-decoration: none;
    transition: color 0.15s ease;
}

a:hover {
    color: #fff3a8;
}

p {
    color: var(--text-soft);
}

.muted,
.text-muted {
    color: var(--dim) !important;
}

code {
    color: var(--gold);
    background: var(--inset);
    padding: 2px 6px;
    border-radius: 6px;
    font-size: 0.85em;
}

.wrap {
    width: 100%;
    max-width: 1120px;
    margin: 0 auto;
    padding: 0 16px;
    box-sizing: border-box;
}

/* Checkered flag: a thin strip that fades out at both ends */
.checker {
    height: 8px;
    background: repeating-conic-gradient(#0a0a14 0 25%, #f4f4fa 0 50%) 0 0 / 8px 8px;
    opacity: 0.85;
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 20%, #000 80%, transparent);
    mask-image: linear-gradient(90deg, transparent, #000 20%, #000 80%, transparent);
    flex-shrink: 0;
}

/* ── Headings: gold gradient letters ───────────────────────────────────────── */

.glyph {
    font-family: var(--heading-font);
    font-weight: 800;
    letter-spacing: 0.01em;
    color: var(--gold);
    background: linear-gradient(180deg, var(--gold-top) 10%, var(--gold-bottom) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 2px 0 rgba(0, 0, 0, 0.35));
}

.glyph-white {
    background-image: linear-gradient(180deg, #ffffff 20%, #9cc4ff 100%);
}

/* ── Panels ────────────────────────────────────────────────────────────────── */

.box {
    position: relative;
    background: var(--panel);
    border: 1px solid var(--panel-border);
    border-radius: var(--radius);
    box-shadow: 0 10px 30px rgba(3, 4, 20, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.05);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    padding: 20px 22px 22px;
}

.box + .box {
    margin-top: 20px;
}

.box-title {
    display: block;
    font-size: 1.3rem;
    line-height: 1.25;
    margin: 0 0 12px;
}

.inset {
    background: var(--inset);
    border: 1px solid var(--panel-border);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
}

/* ── Buttons ───────────────────────────────────────────────────────────────── */

.btn-menu {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 40px;
    padding: 8px 18px;
    border: 1px solid var(--panel-border-strong);
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text);
    font-family: var(--heading-font);
    font-weight: 700;
    font-size: 0.95rem;
    letter-spacing: 0.02em;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease,
        transform 0.15s ease;
}

.btn-menu i {
    color: var(--gold);
    font-size: 0.9em;
    transition: color 0.15s ease;
}

.btn-menu:hover,
.btn-menu:focus-visible {
    background: rgba(255, 255, 255, 0.10);
    border-color: rgba(255, 207, 63, 0.55);
    color: #fff;
    text-decoration: none;
    outline: none;
}

/* The game's red selection bar */
.btn-menu.active {
    background: linear-gradient(180deg, var(--red-top), var(--red-bottom));
    border-color: rgba(255, 190, 120, 0.55);
    color: #fff6c8;
    box-shadow: 0 6px 18px rgba(239, 74, 34, 0.35);
}

.btn-menu.active i {
    color: #fff6c8;
}

.btn-menu:active {
    transform: translateY(1px);
}

.btn-menu.big {
    min-height: 52px;
    padding: 12px 26px;
    font-size: 1.1rem;
    border: 0;
    background: linear-gradient(180deg, var(--gold-top), var(--gold-bottom));
    color: #2a1200;
    box-shadow: 0 8px 24px rgba(255, 146, 16, 0.30), inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.btn-menu.big i {
    color: #2a1200;
}

.btn-menu.big:hover,
.btn-menu.big:focus-visible {
    color: #1a0b00;
    transform: translateY(-1px);
    box-shadow: 0 12px 28px rgba(255, 146, 16, 0.42), inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.btn-menu.big.secondary {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--panel-border-strong);
    color: var(--text);
    box-shadow: none;
}

.btn-menu.big.secondary i {
    color: var(--gold);
}

.btn-menu.big.secondary:hover {
    background: rgba(255, 255, 255, 0.11);
    border-color: rgba(255, 207, 63, 0.55);
    color: #fff;
}

.btn-menu.small {
    min-height: 32px;
    padding: 4px 12px;
    font-size: 0.82rem;
    border-radius: 8px;
}

.btn-menu.disabled,
.btn-menu[aria-disabled="true"] {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--panel-border);
    color: var(--dim);
    box-shadow: none;
    pointer-events: none;
}

.btn-menu.disabled i,
.btn-menu[aria-disabled="true"] i {
    color: var(--dim);
}

/* ── Header ────────────────────────────────────────────────────────────────── */

.site-header {
    position: sticky;
    top: 0;
    z-index: 10;
    background: rgba(8, 12, 46, 0.72);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--panel-border);
}

.header-top {
    display: flex;
    align-items: center;
    gap: 20px;
    min-height: 68px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    line-height: 1;
    text-decoration: none !important;
    flex-shrink: 0;
}

.brand-title {
    font-size: 1.7rem;
    font-style: italic;
    font-weight: 900;
    letter-spacing: 0.02em;
    padding-right: 0.1em;
}

.brand-sub {
    font-size: 0.72rem;
    font-weight: 800;
    padding: 2px 6px;
    border-radius: 6px;
    border: 1px solid rgba(156, 196, 255, 0.4);
    -webkit-text-fill-color: #9cc4ff;
    filter: none;
}

.main-nav {
    display: flex;
    gap: 4px;
    flex: 1;
}

.main-nav .btn-menu {
    border-color: transparent;
    background: transparent;
    min-height: 38px;
    padding: 6px 14px;
    font-size: 0.92rem;
}

.main-nav .btn-menu:hover {
    background: rgba(255, 255, 255, 0.07);
    border-color: transparent;
}

.main-nav .btn-menu.active {
    background: linear-gradient(180deg, var(--red-top), var(--red-bottom));
    border-color: transparent;
}

.account {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.account form {
    margin: 0;
}

.account-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text);
    font-weight: 600;
    padding: 3px 10px 3px 3px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.06);
}

.account-chip:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.11);
}

.soon-tag {
    font-family: var(--body-font);
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #2a1200;
    background: var(--busy);
    border-radius: 999px;
    padding: 1px 7px;
}

main.wrap {
    flex: 1;
    min-width: 0;
    padding-top: 28px;
    padding-bottom: 48px;
}

/* ── Footer ────────────────────────────────────────────────────────────────── */

.site-footer {
    margin-top: auto;
    background: rgba(5, 6, 24, 0.7);
    border-top: 1px solid var(--panel-border);
}

.footer-inner {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr));
    gap: 24px;
    padding: 30px 16px;
}

.footer-inner h6 {
    font-size: 0.85rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin: 0 0 12px;
}

.footer-inner ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.footer-inner li {
    margin-bottom: 6px;
}

.footer-inner a {
    color: var(--text-soft);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.footer-inner a:hover,
.footer-inner a.current {
    color: var(--gold);
}

.footer-note {
    color: var(--dim);
    font-size: 0.85rem;
    margin: 0;
}

/* ── Alerts ────────────────────────────────────────────────────────────────── */

.alert-menu {
    margin-bottom: 16px;
    padding: 12px 16px;
    background: rgba(255, 216, 74, 0.08);
    border: 1px solid rgba(255, 216, 74, 0.3);
    border-radius: var(--radius-sm);
    color: var(--text);
}

.alert-menu.danger {
    background: rgba(255, 106, 77, 0.10);
    border-color: rgba(255, 106, 77, 0.4);
    color: #ffc2b5;
}

.alert-menu.info {
    background: rgba(61, 107, 255, 0.10);
    border-color: rgba(120, 160, 255, 0.35);
    color: var(--text-soft);
}

.alert-menu.info i {
    color: #9cc4ff;
}

/* ── Home ──────────────────────────────────────────────────────────────────── */

.hero {
    text-align: center;
    padding: 56px 24px 52px;
    overflow: hidden;
}

.hero::before {
    content: "";
    position: absolute;
    inset: 0 0 auto 0;
    height: 6px;
    background: repeating-conic-gradient(#0a0a14 0 25%, #f4f4fa 0 50%) 0 0 / 6px 6px;
    opacity: 0.7;
}

.hero-kicker {
    display: inline-block;
    font-family: var(--heading-font);
    font-weight: 700;
    font-size: 0.78rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #9cc4ff;
    background: var(--blue-soft);
    border: 1px solid rgba(120, 160, 255, 0.3);
    border-radius: 999px;
    padding: 4px 12px;
    margin-bottom: 18px;
}

.hero-title {
    font-size: clamp(2.4rem, 7vw, 4.2rem);
    font-style: italic;
    font-weight: 900;
    line-height: 1.05;
    margin: 0 0 14px;
    padding: 0 0.1em;
}

.hero-lead {
    font-size: 1.2rem;
    color: var(--text);
    margin: 0 auto 6px;
    max-width: 640px;
}

.hero-text {
    max-width: 620px;
    margin: 0 auto 28px;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
}

.hero-version {
    margin: 14px 0 0;
    color: var(--dim);
    font-size: 0.85rem;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr));
    gap: 20px;
}

.grid-3 > .box {
    margin-top: 0;
}

.section-gap {
    margin-top: 32px;
}

.box-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px;
}

.box-head .box-title {
    margin: 0;
    font-size: 1.15rem;
}

.feature {
    display: flex;
    gap: 16px;
    align-items: flex-start;
}

.feature i {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    font-size: 1.2rem;
    color: var(--gold);
    background: rgba(255, 207, 63, 0.1);
    border: 1px solid rgba(255, 207, 63, 0.25);
    border-radius: 12px;
}

.feature h3 {
    font-size: 1.05rem;
    margin: 2px 0 4px;
}

.feature p {
    margin: 0;
}

/* ── Tables ────────────────────────────────────────────────────────────────── */

.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--panel-border);
    border-radius: var(--radius-sm);
}

.menu-table {
    width: 100%;
    border-collapse: collapse;
    font-variant-numeric: tabular-nums;
}

.menu-table th {
    font-family: var(--body-font);
    font-weight: 600;
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--dim);
    text-align: left;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.03);
    border-bottom: 1px solid var(--panel-border);
    white-space: nowrap;
}

.menu-table td {
    padding: 10px 14px;
    border-bottom: 1px solid rgba(196, 200, 232, 0.06);
    vertical-align: middle;
}

.menu-table tbody tr:last-child td {
    border-bottom: 0;
}

.menu-table tbody tr:nth-child(even) td {
    background: var(--row-alt);
}

.menu-table tbody tr:hover td {
    background: var(--row-hover);
}

/* The signed-in player's row: a soft version of the game's red selection bar */
.menu-table tbody tr.me td {
    background: linear-gradient(90deg, rgba(239, 74, 34, 0.32), rgba(163, 20, 12, 0.12));
}

.menu-table tbody tr.me td:first-child {
    box-shadow: inset 3px 0 0 var(--red-top);
}

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

.menu-table .place {
    width: 3.2rem;
    text-align: center;
    font-family: var(--heading-font);
    font-weight: 800;
    color: var(--text-soft);
}

.menu-table .rating {
    font-family: var(--heading-font);
    font-weight: 800;
    font-size: 1.05em;
    color: var(--gold);
}

.trophy-1 { color: #ffd83a; }
.trophy-2 { color: #d4d9ef; }
.trophy-3 { color: #e3914a; }

.empty {
    color: var(--dim);
    margin: 0;
    padding: 18px 4px;
}

/* ── Players ───────────────────────────────────────────────────────────────── */

.player-cell {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--text);
    font-weight: 500;
}

.player-cell:hover {
    color: #fff;
}

.player-cell:hover span {
    text-decoration: underline;
    text-decoration-color: rgba(255, 207, 63, 0.6);
    text-underline-offset: 3px;
}

.player-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    background: rgba(255, 255, 255, 0.08);
    flex-shrink: 0;
}

.player-avatar-empty {
    display: inline-block;
}

.player-header {
    display: flex;
    align-items: center;
    gap: 22px;
}

.player-avatar-lg {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    object-fit: cover;
    background: rgba(255, 255, 255, 0.06);
    box-shadow: 0 0 0 3px rgba(255, 207, 63, 0.5), 0 10px 30px rgba(0, 0, 0, 0.4);
}

.player-name {
    font-size: clamp(1.5rem, 5vw, 2.4rem);
    line-height: 1.15;
    margin: 0;
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    overflow-wrap: anywhere;
}

.stat {
    text-align: center;
}

.stat-mode {
    font-size: 0.8rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin-bottom: 6px;
}

.stat-value {
    font-size: 2.8rem;
    line-height: 1.1;
    font-weight: 900;
}

.stat-sub {
    color: var(--text-soft);
    font-size: 0.9rem;
}

.delta-up { color: var(--ok); }
.delta-down { color: var(--bad); }

.rivals a {
    color: var(--text-soft);
    margin-right: 12px;
    white-space: nowrap;
}

.rivals a:hover {
    color: var(--gold);
}

/* ── Mode tabs and pagination ──────────────────────────────────────────────── */

.mode-tabs {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 4px;
    margin-bottom: 16px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--panel-border);
    border-radius: 12px;
}

.mode-tabs .btn-menu {
    border-color: transparent;
    background: transparent;
    min-height: 36px;
}

.mode-tabs .btn-menu:hover {
    background: rgba(255, 255, 255, 0.07);
}

.mode-tabs .btn-menu.active {
    background: linear-gradient(180deg, var(--red-top), var(--red-bottom));
}

.pager {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 16px;
    align-items: center;
}

.pager .gap {
    color: var(--dim);
    padding: 0 4px;
}

/* ── Downloads ─────────────────────────────────────────────────────────────── */

.download {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.download-icon {
    font-size: 2.2rem;
    color: #7ab4ff;
    width: 64px;
    height: 64px;
    display: grid;
    place-items: center;
    background: rgba(61, 107, 255, 0.14);
    border-radius: 16px;
}

.download-info {
    flex: 1 1 260px;
    min-width: 0;
}

.download-info h2 {
    font-size: 1.15rem;
    margin: 0 0 4px;
}

.status-ok { color: var(--ok); }
.status-busy { color: var(--busy); }
.status-bad { color: var(--bad); }

.steps {
    margin: 0;
    padding-left: 1.4em;
}

.steps li {
    margin-bottom: 8px;
    color: var(--text-soft);
}

.steps li::marker {
    color: var(--gold);
    font-family: var(--heading-font);
    font-weight: 800;
}

.coming {
    text-align: center;
    padding: 56px 24px;
}

.coming i {
    font-size: 2.2rem;
    color: var(--gold);
    width: 84px;
    height: 84px;
    display: inline-grid;
    place-items: center;
    background: rgba(255, 207, 63, 0.1);
    border: 1px solid rgba(255, 207, 63, 0.25);
    border-radius: 24px;
}

.coming .box-title {
    font-size: 1.8rem;
    margin: 20px 0 10px;
}

.coming p {
    max-width: 560px;
    margin: 0 auto;
}

.error-code {
    font-size: 4.5rem;
    font-weight: 900;
}

/* ── Smaller screens ───────────────────────────────────────────────────────── */

@media (max-width: 900px) {
    .header-top {
        flex-wrap: wrap;
        gap: 10px;
        padding-top: 10px;
        padding-bottom: 10px;
    }

    .brand {
        order: 1;
    }

    .account {
        order: 2;
        margin-left: auto;
    }

    .main-nav {
        order: 3;
        flex-basis: 100%;
        overflow-x: auto;
        scrollbar-width: none;
    }

    .main-nav::-webkit-scrollbar {
        display: none;
    }
}

@media (max-width: 600px) {
    .site-header {
        position: static;
    }

    .brand-title {
        font-size: 1.4rem;
    }

    .account .btn-menu.small {
        padding: 4px 9px;
    }

    .main-nav .btn-menu {
        flex: 0 0 auto;
        font-size: 0.85rem;
        padding: 6px 10px;
    }

    .main-nav .soon-tag {
        display: none;
    }

    .box {
        padding: 16px 14px 18px;
    }

    .hero {
        padding: 40px 16px 36px;
    }

    .menu-table th,
    .menu-table td {
        padding: 8px 10px;
    }

    .mode-tabs {
        display: flex;
    }

    .mode-tabs .btn-menu {
        flex: 1 1 auto;
        white-space: normal;
        font-size: 0.85rem;
    }

    .player-header {
        flex-direction: column;
        text-align: center;
    }

    .player-name {
        justify-content: center;
    }

    .player-avatar-lg {
        width: 76px;
        height: 76px;
    }

    .btn-menu.big {
        width: 100%;
    }
}
