/* =========================================================
   SMP.HF4U.GG — style globalne
   ========================================================= */

:root {
    --bg: #0b0e17;
    --bg2: #11162a;
    --card: #151b31;
    --card2: #1a2140;
    --accent: #7c3aed;
    --accent2: #22d3ee;
    --gold: #fbbf24;
    --green: #34d399;
    --red: #f87171;
    --text: #e6e9f2;
    --muted: #8b93b0;
    --border: rgba(255, 255, 255, .08);
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Rubik', sans-serif;
    background: var(--bg);
    color: var(--text);
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    /* footer zawsze na dole */
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: -2;
    background:
        radial-gradient(1000px 500px at 20% -10%, rgba(124, 58, 237, .25), transparent 60%),
        radial-gradient(800px 500px at 90% 10%, rgba(34, 211, 238, .15), transparent 60%),
        radial-gradient(700px 600px at 50% 110%, rgba(124, 58, 237, .15), transparent 60%),
        var(--bg);
}

/* =========================================================
   Nawigacja
   ========================================================= */

nav {
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(14px);
    background: rgba(11, 14, 23, .75);
    border-bottom: 1px solid var(--border);
}

.nav-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 24px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: 'Chakra Petch', sans-serif;
    font-size: 1.3rem;
    font-weight: 700;
    text-decoration: none;
    color: var(--text);
}

.logo-cube {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    font-size: 1.1rem;
    box-shadow: 0 0 18px rgba(124, 58, 237, .5);
}

.logo span em {
    font-style: normal;
    background: linear-gradient(90deg, var(--accent), var(--accent2));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 6px;
    list-style: none;
}

.nav-links a {
    text-decoration: none;
    color: var(--muted);
    font-weight: 500;
    font-size: .95rem;
    padding: 8px 14px;
    border-radius: 10px;
    transition: .2s;
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--text);
    background: rgba(255, 255, 255, .06);
}

.btn-login {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 20px;
    border-radius: 12px;
    font-weight: 600;
    color: #fff;
    text-decoration: none;
    font-size: .95rem;
    background: linear-gradient(135deg, var(--accent), #a855f7);
    box-shadow: 0 4px 20px rgba(124, 58, 237, .4);
    transition: .2s;
}

.btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 28px rgba(124, 58, 237, .55);
}

/* =========================================================
   Menu konta
   ========================================================= */

.account-menu {
    position: relative;
    z-index: 110;
}

.account-trigger {
    display: flex;
    align-items: center;
    gap: 8px;
    background: transparent;
    border: 0;
    color: var(--text);
    padding: 7px 9px;
    border-radius: 12px;
    cursor: pointer;
    font: inherit;
    transition: .2s;
}

.account-trigger:hover,
.account-menu.open .account-trigger {
    background: rgba(255, 255, 255, .06);
}

.account-avatar {
    width: 30px;
    height: 30px;
    border-radius: 9px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    color: #fff;
    font-family: 'Chakra Petch', sans-serif;
    font-weight: 700;
    font-size: .8rem;
    box-shadow: 0 0 14px rgba(124, 58, 237, .25);
}

.account-name {
    font-weight: 600;
    font-size: .9rem;
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.account-chevron {
    color: var(--muted);
    font-size: 1rem;
    line-height: 1;
    transition: transform .2s;
}

.account-menu:hover .account-chevron,
.account-menu.open .account-chevron {
    transform: rotate(180deg);
}

.account-dropdown {
    position: absolute;
    right: 0;
    top: 100%;
    padding-top: 10px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-5px);
    pointer-events: none;
    transition: opacity .24s ease, transform .24s ease, visibility .24s;
    transition-delay: .06s;
}

.account-dropdown::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    height: 10px;
}

.account-menu:hover .account-dropdown,
.account-menu.open .account-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
}

.account-dropdown-inner {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 7px;
    background: rgba(13, 17, 30, .97);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: 0 16px 45px rgba(0, 0, 0, .45);
    backdrop-filter: blur(16px);
    white-space: nowrap;
}

.account-item {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 12px;
    border-radius: 9px;
    color: var(--muted);
    text-decoration: none;
    font-size: .84rem;
    font-weight: 600;
    border: 0;
    background: transparent;
    cursor: pointer;
    font-family: inherit;
    transition: .16s;
}

.account-item:hover {
    color: var(--text);
    background: rgba(255, 255, 255, .07);
}

.account-item small {
    color: var(--accent2);
    font-size: .72rem;
}

.account-item-icon {
    font-size: .95rem;
    line-height: 1;
}

.account-divider {
    width: 1px;
    height: 24px;
    background: var(--border);
    margin: 0 3px;
}

.account-logout-form {
    margin: 0;
}

.account-logout {
    color: #fca5a5;
}

.account-logout:hover {
    color: #fff;
    background: rgba(248, 113, 113, .12);
}

@media (max-width: 760px) {
    .account-name {
        max-width: 110px;
    }

    .account-dropdown {
        right: -8px;
    }

    .account-dropdown-inner {
        flex-wrap: wrap;
        justify-content: flex-end;
        max-width: calc(100vw - 32px);
        white-space: normal;
    }
}

.burger {
    display: none;
    background: none;
    border: none;
    color: var(--text);
    font-size: 1.5rem;
    cursor: pointer;
}

/* =========================================================
   Układ / panele
   ========================================================= */

.section {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 24px;
    width: 100%;
}

.panel {
    background: linear-gradient(180deg, var(--card), var(--bg2));
    border: 1px solid var(--border);
    border-radius: 18px;
    overflow: hidden;
}

.panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}

.panel-head h3 {
    font-family: 'Chakra Petch', sans-serif;
    font-size: 1.05rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.panel-head small {
    color: var(--muted);
    font-size: .75rem;
}

/* =========================================================
   Tabele
   ========================================================= */

table {
    width: 100%;
    border-collapse: collapse;
    font-size: .9rem;
}

th {
    padding: 10px 14px;
    text-align: left;
    color: var(--muted);
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    border-bottom: 1px solid var(--border);
    background: rgba(0, 0, 0, .15);
}

td {
    padding: 11px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, .04);
}

tbody tr {
    transition: .15s;
}

tbody tr:hover {
    background: rgba(124, 58, 237, .08);
}

tbody tr:last-child td {
    border-bottom: none;
}

.player-cell {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
}

.head {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    image-rendering: pixelated;
    border: 1px solid var(--border);
    background: #2a3352;
}

.head-lg {
    width: 84px;
    height: 84px;
    border-radius: 18px;
    image-rendering: pixelated;
    border: 1px solid var(--border);
    background: #2a3352;
}

.pos {
    width: 26px;
    height: 26px;
    border-radius: 8px;
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: .8rem;
    background: rgba(255, 255, 255, .06);
    color: var(--muted);
    flex-shrink: 0;
}

.pos.p1 {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    color: #1a1300;
}

.pos.p2 {
    background: linear-gradient(135deg, #e2e8f0, #94a3b8);
    color: #111;
}

.pos.p3 {
    background: linear-gradient(135deg, #d97706, #92400e);
    color: #fff;
}

.num {
    font-weight: 700;
    font-family: 'Chakra Petch', sans-serif;
}

.num.gold  { color: var(--gold); }
.num.green { color: var(--green); }
.num.red   { color: var(--red); }

.clan-tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 6px;
    background: rgba(34, 211, 238, .12);
    color: var(--accent2);
    font-weight: 700;
    font-size: .78rem;
    margin-right: 8px;
}

/* =========================================================
   Statystyki
   ========================================================= */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 16px;
    margin-top: 24px;
}

.stat-card {
    background: linear-gradient(180deg, var(--card), var(--bg2));
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 20px;
    text-align: center;
}

.stat-card .val {
    font-family: 'Chakra Petch', sans-serif;
    font-size: 1.6rem;
    font-weight: 700;
}

.stat-card .lbl {
    color: var(--muted);
    font-size: .8rem;
    margin-top: 6px;
    text-transform: uppercase;
    letter-spacing: .08em;
}

.back-link {
    display: inline-block;
    margin-bottom: 18px;
    color: var(--muted);
    text-decoration: none;
}

.back-link:hover {
    color: var(--accent2);
}

/* =========================================================
   Główki z tooltipami
   ========================================================= */

.heads-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    padding: 18px 20px;
}

.head-link {
    position: relative;
    display: inline-block;
    border-radius: 10px;
    transition: .15s;
}

.head-link:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 18px rgba(124, 58, 237, .4);
}

.head-link .head {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: block;
}

.empty-note {
    color: var(--muted);
    font-size: .85rem;
    padding: 18px 20px;
}

/* =========================================================
   Tooltip
   ========================================================= */

.mc-tooltip {
    position: fixed;
    z-index: 9999;
    pointer-events: none;
    opacity: 0;
    transition: opacity .12s;
    background: rgba(10, 13, 24, .96);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px 14px;
    font-size: .8rem;
    line-height: 1.5;
    max-width: 260px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .5);
}

.mc-tooltip.show {
    opacity: 1;
}

.mc-tooltip .tt-title {
    font-weight: 700;
    color: var(--accent2);
    font-size: .9rem;
    margin-bottom: 2px;
}

.mc-tooltip .tt-row {
    color: var(--muted);
}

.mc-tooltip .tt-row b {
    color: var(--text);
    font-weight: 600;
}

/* =========================================================
   Stopka
   ========================================================= */

footer {
    margin-top: auto;
    border-top: 1px solid var(--border);
    background: rgba(0, 0, 0, .25);
}

.footer-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 44px 24px 24px;
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 32px;
}

.footer-inner h4 {
    font-family: 'Chakra Petch', sans-serif;
    margin-bottom: 14px;
    font-size: .95rem;
    color: var(--text);
}

.footer-inner p,
.footer-inner a {
    color: var(--muted);
    font-size: .88rem;
    text-decoration: none;
    line-height: 1.8;
}

.footer-inner a {
    display: block;
    transition: .2s;
}

.footer-inner a:hover {
    color: var(--accent2);
}

.footer-bottom {
    max-width: 1200px;
    margin: 0 auto;
    padding: 18px 24px 28px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    color: var(--muted);
    font-size: .8rem;
}

/* =========================================================
   Siatka rankingów
   ========================================================= */

.rank-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 22px;
}

/* =========================================================
   Responsywność
   ========================================================= */

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

@media (max-width: 800px) {
    .footer-inner {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 760px) {
    .nav-links {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        flex-direction: column;
        align-items: stretch;
        background: rgba(11, 14, 23, .97);
        padding: 12px;
        display: none;
        border-bottom: 1px solid var(--border);
    }

    .nav-links.open {
        display: flex;
    }

    .burger {
        display: block;
    }
}

@media (max-width: 520px) {
    .footer-inner {
        grid-template-columns: 1fr;
    }
}
