:root {
    --bg: #0b0e12;
    --bg-2: #101721;
    --surface: #141b24;
    --surface-2: #171f2b;
    --surface-3: #1d2735;
    --accent: #d1b57a;
    --accent-2: #6f8aa8;
    --warning: #d0a25a;
    --danger: #c96d72;
    --text: #ebe6dd;
    --muted: #9aa3ad;
    --border: #263244;
    --border-strong: #334157;
    --accent-soft: rgba(209, 181, 122, 0.18);
    --accent-2-soft: rgba(111, 138, 168, 0.16);
    --warning-soft: rgba(208, 162, 90, 0.2);
    --danger-soft: rgba(201, 109, 114, 0.2);
    --shadow: 0 18px 40px rgba(5, 8, 12, 0.55);
    --shadow-soft: 0 10px 22px rgba(5, 8, 12, 0.35);
    --radius: 16px;
}

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

html {
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;
    font-family: 'Instrument Sans', 'Space Grotesk', sans-serif;
    color: var(--text);
    background-color: var(--bg);
    background-image:
        radial-gradient(900px 380px at 10% -10%, rgba(209, 181, 122, 0.08), transparent 60%),
        radial-gradient(820px 420px at 90% 0%, rgba(111, 138, 168, 0.08), transparent 58%),
        linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 50%, var(--bg) 100%);
    line-height: 1.6;
    font-size: 17px;
    overflow-x: hidden;
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image:
        repeating-linear-gradient(110deg, rgba(255, 255, 255, 0.012) 0 1px, transparent 1px 4px),
        repeating-linear-gradient(20deg, rgba(255, 255, 255, 0.008) 0 1px, transparent 1px 6px);
    opacity: 0.22;
    z-index: 0;
}

img {
    max-width: 100%;
    display: block;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
select,
textarea {
    font-family: inherit;
}

h1, h2, h3 {
    font-family: 'Space Grotesk', 'Instrument Sans', sans-serif;
    letter-spacing: 0.02em;
}

h1 {
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--text);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 28px;
    position: relative;
    z-index: 1;
}

.page {
    padding-bottom: 120px;
}

body.has-bottom-nav .container {
    padding-bottom: 120px;
}

header {
    text-align: center;
    padding: 48px 32px 32px;
    margin-bottom: 28px;
    background: linear-gradient(135deg, rgba(209, 181, 122, 0.18), rgba(111, 138, 168, 0.14));
    border: 1px solid rgba(38, 50, 68, 0.8);
    border-radius: 22px;
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
}

header::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(600px 220px at 50% 0%, rgba(255, 255, 255, 0.04), transparent 70%);
    opacity: 0.7;
    pointer-events: none;
}

header > * {
    position: relative;
    z-index: 1;
}

header h1 {
    font-size: 2.6rem;
    font-weight: 700;
    color: var(--text);
}

.subtitle {
    margin-top: 6px;
    font-size: 1.05rem;
    color: var(--muted);
}

.main-nav {
    display: inline-flex;
    gap: 8px;
    margin-top: 18px;
    padding: 6px;
    background: rgba(20, 27, 36, 0.86);
    border: 1px solid var(--border);
    border-radius: 999px;
    backdrop-filter: blur(8px);
}

.nav-link {
    color: var(--muted);
    padding: 8px 16px;
    border-radius: 999px;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-weight: 600;
    transition: all 0.2s ease;
}

.nav-link:hover {
    color: var(--text);
    background: var(--surface-2);
}

.update-info {
    margin-top: 16px;
    font-size: 0.85rem;
    color: var(--muted);
    font-family: 'IBM Plex Mono', monospace;
}

main {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

section {
    background: rgba(18, 24, 32, 0.92);
    border: 1px solid rgba(38, 50, 68, 0.9);
    border-radius: var(--radius);
    padding: 28px;
    box-shadow: var(--shadow-soft);
    position: relative;
    overflow: hidden;
    animation: fadeUp 0.6s ease both;
    backdrop-filter: blur(10px);
}

section::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    height: 2px;
    background: linear-gradient(90deg, rgba(209, 181, 122, 0.65), rgba(111, 138, 168, 0.55));
    opacity: 0.4;
}

section h2 {
    margin-bottom: 16px;
    font-size: 1.6rem;
    font-weight: 600;
    color: var(--text);
}

.competition-section {
    padding: 18px;
}

.competition-section h2,
.upcoming-section h2 {
    font-size: 1.25rem;
}

.competition-section .competition-info {
    font-size: 0.9rem;
    margin-bottom: 14px;
}

.competition-section .competition-info p {
    margin-bottom: 6px;
}

.competition-section .player-standing {
    grid-template-columns: 36px minmax(0, 1fr) auto auto;
    padding: 10px 12px;
    gap: 10px;
}

.competition-section .player-title {
    gap: 8px;
}

.competition-section .owner-avatar {
    width: 22px;
    height: 22px;
    font-size: 0.55rem;
}

.competition-section .player-info h3 {
    font-size: 0.95rem;
}

.competition-section .team-name {
    font-size: 0.78rem;
}

.competition-section .team-stats {
    gap: 6px;
}

.competition-section .stat {
    background: rgba(23, 31, 43, 0.9);
    border: 1px solid rgba(38, 50, 68, 0.8);
    padding: 3px 6px;
    border-radius: 7px;
    min-width: 42px;
}

.competition-section .stat-value {
    font-size: 0.9rem;
}

.competition-section .stat-label {
    font-size: 0.55rem;
}

.competition-section .team-position {
    min-width: 52px;
}

.competition-section .position-number {
    font-size: 1.1rem;
}

.upcoming-section {
    padding: 18px;
}

.upcoming-section .match-day {
    font-size: 0.65rem;
    letter-spacing: 0.14em;
}

.upcoming-section .match-card {
    padding: 10px 12px;
    border-radius: 12px;
    box-shadow: none;
}

.upcoming-section .match-time-chip {
    padding: 3px 6px;
    font-size: 0.7rem;
}

.upcoming-section .match-meta {
    font-size: 0.72rem;
}

.upcoming-section .match-team .team {
    font-size: 0.9rem;
}

.upcoming-section .owner-name-badge {
    height: 18px;
    font-size: 0.6rem;
    padding: 0 6px;
}

.competition-info {
    text-align: center;
    color: var(--muted);
    margin-bottom: 24px;
}

.matchday {
    font-size: 1rem;
    color: var(--accent);
    margin-top: 8px;
    font-family: 'IBM Plex Mono', monospace;
}

.standings-grid {
    display: grid;
    gap: 12px;
}

.player-standing {
    display: grid;
    grid-template-columns: 56px 1fr auto auto;
    align-items: center;
    gap: 16px;
    padding: 14px 16px;
    border-radius: 14px;
    border: 1px solid rgba(38, 50, 68, 0.85);
    background: linear-gradient(140deg, rgba(21, 28, 38, 0.92), rgba(14, 19, 26, 0.98));
    position: relative;
    overflow: hidden;
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
    animation: rise 0.5s ease both;
}

.standings-grid .player-standing:nth-child(1) { animation-delay: 0.04s; }
.standings-grid .player-standing:nth-child(2) { animation-delay: 0.08s; }
.standings-grid .player-standing:nth-child(3) { animation-delay: 0.12s; }
.standings-grid .player-standing:nth-child(4) { animation-delay: 0.16s; }
.standings-grid .player-standing:nth-child(5) { animation-delay: 0.2s; }
.standings-grid .player-standing:nth-child(6) { animation-delay: 0.24s; }
.standings-grid .player-standing:nth-child(7) { animation-delay: 0.28s; }
.standings-grid .player-standing:nth-child(8) { animation-delay: 0.32s; }

.player-standing::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(320px 160px at 12% 0%, rgba(111, 138, 168, 0.06), transparent 60%);
    opacity: 0.4;
    pointer-events: none;
}

.player-standing:hover {
    transform: translateY(-1px);
    border-color: var(--border-strong);
    box-shadow: 0 14px 28px rgba(5, 8, 12, 0.4);
}

.player-standing.leader {
    border-color: rgba(209, 181, 122, 0.45);
    box-shadow: 0 0 0 1px rgba(209, 181, 122, 0.15), 0 14px 28px rgba(14, 12, 6, 0.3);
}

.player-standing.rank-1 {
    border-color: rgba(209, 181, 122, 0.5);
}

.player-standing.rank-2 {
    border-color: rgba(111, 138, 168, 0.5);
}

.player-standing.rank-3 {
    border-color: rgba(208, 162, 90, 0.5);
}

.player-standing.rank-bottom {
    border-color: rgba(201, 109, 114, 0.55);
}

.rank {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 1.4rem;
    color: var(--muted);
    text-align: center;
}

.player-info {
    min-width: 0;
}

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

.clickable-player,
.clickable-team {
    cursor: pointer;
    transition: color 0.2s ease, transform 0.2s ease;
}

.clickable-player:hover {
    color: var(--accent);
    transform: translateX(2px);
}

.clickable-team:hover {
    color: var(--accent-2);
    transform: translateX(2px);
}

.player-info h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.team-name {
    color: var(--muted);
    font-size: 0.9rem;
    margin-top: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.team-stats {
    display: flex;
    gap: 16px;
    align-items: center;
}

.stat {
    text-align: center;
}

.stat-value {
    display: block;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 1.2rem;
    color: var(--text);
}

.stat-label {
    display: block;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--muted);
}

.team-position {
    text-align: right;
    min-width: 70px;
}

.position-number {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 1.6rem;
    color: var(--text);
}

.position-change {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 6px;
    font-size: 0.85rem;
    font-family: 'IBM Plex Mono', monospace;
    padding: 4px 8px;
    border-radius: 999px;
    background: rgba(16, 22, 30, 0.8);
    border: 1px solid rgba(38, 50, 68, 0.7);
}

.position-change.up {
    color: var(--accent);
}

.position-change.down {
    color: var(--danger);
}

.owner-avatar {
    width: 28px;
    height: 28px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--bg);
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.owner-avatar-sm {
    width: 22px;
    height: 22px;
    font-size: 0.6rem;
    margin-left: 6px;
}

.owner-name-badge {
    width: auto;
    height: 24px;
    padding: 0 8px;
    font-size: 0.72rem;
    font-weight: 700;
    border-radius: 999px;
    color: var(--bg);
    white-space: nowrap;
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.owner-more {
    background: var(--surface-3);
    color: var(--text);
}

.upcoming-matches {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.match-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.match-day {
    color: var(--muted);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    font-family: 'IBM Plex Mono', monospace;
    padding-bottom: 4px;
    position: sticky;
    top: 0;
    background: linear-gradient(180deg, rgba(11, 14, 18, 0.9), rgba(11, 14, 18, 0));
}

.match-list {
    display: grid;
    gap: 10px;
}

.match-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid rgba(38, 50, 68, 0.85);
    background: rgba(21, 28, 38, 0.88);
    box-shadow: 0 8px 20px rgba(6, 10, 16, 0.25);
    animation: fadeUp 0.5s ease both;
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.match-card:hover {
    transform: translateY(-1px);
    border-color: var(--border-strong);
}

.match-list .match-card:nth-child(1) { animation-delay: 0.04s; }
.match-list .match-card:nth-child(2) { animation-delay: 0.08s; }
.match-list .match-card:nth-child(3) { animation-delay: 0.12s; }
.match-list .match-card:nth-child(4) { animation-delay: 0.16s; }

.match-card--neutral {
    border-left: 3px solid var(--border);
}

.match-card--owned {
    border-left: 3px solid var(--accent-2);
}

.match-card--duel {
    border-left: 3px solid var(--accent);
}

.match-meta-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.74rem;
}

.match-time-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 3px 7px;
    border-radius: 7px;
    background: rgba(15, 20, 28, 0.9);
    border: 1px solid rgba(38, 50, 68, 0.7);
    font-family: 'IBM Plex Mono', monospace;
    color: var(--text);
}

.match-meta {
    color: var(--muted);
}

.match-content {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.match-side {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

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

.match-team .team {
    font-weight: 600;
    color: var(--text);
    max-width: 210px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.match-divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(154, 163, 173, 0.2), transparent);
}

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

.team-logo {
    width: 22px;
    height: 22px;
    object-fit: contain;
    filter: brightness(0.98) saturate(1.05);
}

.pl-table {
    overflow-x: auto;
    border-radius: 14px;
    border: 1px solid rgba(38, 50, 68, 0.9);
    background: rgba(21, 28, 38, 0.92);
}

.pl-table table {
    width: 100%;
    border-collapse: collapse;
    min-width: 640px;
}

.pl-table th,
.pl-table td {
    padding: 12px 10px;
    text-align: left;
}

.pl-table th {
    background: rgba(15, 20, 28, 0.95);
    color: var(--muted);
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.75rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.pl-table tr {
    border-bottom: 1px solid rgba(38, 50, 68, 0.6);
}

.pl-table tr:hover {
    background: rgba(24, 31, 42, 0.55);
}

.pl-table tr.player-team {
    background: rgba(38, 32, 20, 0.7);
    border-left: 4px solid var(--accent);
}

.pl-table tr.player-team:hover {
    background: rgba(46, 38, 22, 0.85);
}

.pl-table .position {
    font-weight: 700;
    color: var(--text);
}

.pl-table .team-name {
    font-weight: 500;
    color: var(--text);
}

.pl-table .points {
    font-family: 'IBM Plex Mono', monospace;
    color: var(--accent);
}

.owned-badge {
    display: inline-block;
    margin-left: 8px;
    padding: 2px 8px;
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--bg);
    background: var(--accent);
    border-radius: 999px;
    vertical-align: middle;
}

.bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 16px;
    display: flex;
    justify-content: center;
    padding: 0 18px;
    z-index: 10;
}

.bottom-nav-inner {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    padding: 6px;
    background: rgba(15, 20, 28, 0.9);
    border: 1px solid var(--border);
    border-radius: 18px;
    box-shadow: 0 18px 36px rgba(6, 12, 20, 0.6);
    backdrop-filter: blur(12px);
    min-width: 260px;
    max-width: 360px;
    width: 100%;
}

.bottom-nav-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 10px 6px;
    color: var(--muted);
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    transition: color 0.2s ease, background 0.2s ease;
    border-radius: 12px;
}

.bottom-nav-link .nav-icon {
    font-size: 1.3rem;
}

.bottom-nav-link.is-active {
    color: var(--accent);
    background: rgba(209, 181, 122, 0.14);
}

.bottom-nav-link:hover {
    color: var(--text);
}

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes rise {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (min-width: 900px) {
    .bottom-nav {
        display: none;
    }
}

@media (max-width: 900px) {
    header {
        padding: 36px 24px 24px;
    }

    header h1 {
        font-size: 2.1rem;
    }

    .player-standing {
        grid-template-columns: 44px 1fr auto;
        grid-template-areas:
            'rank info pos'
            'rank stats pos';
    }

    .rank {
        grid-area: rank;
    }

    .player-info {
        grid-area: info;
    }

    .team-stats {
        grid-area: stats;
    }

    .team-position {
        grid-area: pos;
    }

    .competition-section .player-standing {
        padding: 10px 12px;
    }

    .competition-section .team-stats .stat:last-child {
        display: none;
    }
}

@media (max-width: 768px) {
    body {
        font-size: 16px;
    }

    .container {
        padding: 18px;
    }

    header {
        padding: 28px 18px 20px;
    }

    header h1 {
        font-size: 1.9rem;
    }

    .subtitle {
        font-size: 0.95rem;
    }

    body.has-bottom-nav .main-nav {
        display: none;
    }

    section {
        padding: 20px;
    }

    .match-team .team {
        max-width: 160px;
    }

    .pl-table {
        font-size: 0.9rem;
    }

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

@media (max-width: 640px) {
    .player-standing {
        grid-template-columns: 36px 1fr auto;
        gap: 10px;
        padding: 12px;
    }

    .team-stats {
        gap: 10px;
    }

    .stat-value {
        font-size: 1rem;
    }

    .position-number {
        font-size: 1.3rem;
    }

    .match-card {
        padding: 12px;
    }

    .owner-badges {
        justify-content: flex-end;
    }

    .pl-table table {
        min-width: 0;
    }

    .pl-table th:nth-child(3),
    .pl-table th:nth-child(4),
    .pl-table th:nth-child(5),
    .pl-table th:nth-child(6),
    .pl-table th:nth-child(7),
    .pl-table th:nth-child(8),
    .pl-table td:nth-child(3),
    .pl-table td:nth-child(4),
    .pl-table td:nth-child(5),
    .pl-table td:nth-child(6),
    .pl-table td:nth-child(7),
    .pl-table td:nth-child(8) {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
