:root {
    --bg: #0d1117;
    --surface: #161b22;
    --surface2: #21262d;
    --border: rgba(255, 255, 255, 0.08);
    --accent: #38bdf8;
    --accent2: #818cf8;
    --green: #10b981;
    --red: #f87171;
    --text: #e6edf3;
    --muted: #6e7681;
    --row-hover: rgba(56, 189, 248, 0.06);
    --sort-active: #38bdf8;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Outfit', sans-serif;
}

body {
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
}

/* ── Layout ─────────────────────────────── */
.app-layout {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

/* ── Topbar ─────────────────────────────── */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.9rem 1.6rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.topbar-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.brand-icon {
    font-size: 1.8rem;
}

.topbar h1 {
    font-size: 1.4rem;
    font-weight: 800;
    background: linear-gradient(to right, var(--accent), var(--accent2));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.subtitle {
    color: var(--muted);
    font-size: 0.8rem;
    font-weight: 300;
    margin-top: 1px;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--muted);
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--green);
    box-shadow: 0 0 8px var(--green);
    animation: blink 2s ease-in-out infinite;
}

@keyframes blink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.4;
    }
}

/* ── Main ────────────────────────────────── */
.main-content {
    display: grid;
    grid-template-columns: 240px 1fr 320px;
    gap: 0;
    flex: 1;
    overflow: hidden;
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    overflow: hidden;
}

/* ── Sidebar Pane ────────────────────────── */
.sidebar-pane {
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.side-nav {
    padding: 1.5rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.nav-item {
    padding: 0.75rem 1rem;
    color: var(--muted);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    border-radius: 8px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.nav-item:hover {
    background: var(--surface2);
    color: var(--text);
}

.nav-item.active {
    background: rgba(56, 189, 248, 0.1);
    color: var(--accent);
}

.leagues-section {
    padding: 1rem;
}

.leagues-section h3 {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
    margin-bottom: 0.75rem;
    padding-left: 0.5rem;
}

.league-row-item {
    padding: 0.65rem 0.75rem;
    border-radius: 8px;
    background: var(--surface2);
    margin-bottom: 0.5rem;
    font-size: 0.8rem;
    font-weight: 600;
    transition: border-color 0.2s;
    border: 1px solid transparent;
}

.league-row-item:hover {
    border-color: var(--accent);
}

.league-key {
    font-size: 0.7rem;
    color: var(--muted);
    font-weight: 400;
}

/* ── Schedule pane ──────────────────────── */
.schedule-pane {
    border-right: 1px solid var(--border);
    border-top: none;
    border-left: none;
    border-bottom: none;
    display: flex;
    flex-direction: column;
}

.schedule-pane h2 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 1rem 1.25rem 0.75rem;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

#schedule-container {
    overflow-y: auto;
    flex: 1;
}

.game-row {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 0.5rem;
    padding: 0.65rem 1.25rem;
    border-bottom: 1px solid var(--border);
    transition: background 0.15s;
}

.game-row:hover {
    background: var(--surface2);
}

.team-name {
    font-size: 0.85rem;
    font-weight: 600;
}

.team-record {
    font-size: 0.7rem;
    color: var(--muted);
}

.team.away {
    text-align: left;
}

.team.home {
    text-align: right;
}

.vs {
    font-size: 0.7rem;
    color: var(--muted);
    text-align: center;
}

.game-status {
    display: none;
    /* hidden — status shown via game-row badge instead */
}

.game-badge {
    font-size: 0.65rem;
    font-weight: 600;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    border: 1px solid;
}

.badge-final {
    color: var(--muted);
    border-color: var(--border);
}

.badge-live {
    color: var(--green);
    border-color: var(--green);
}

.badge-sched {
    color: var(--accent);
    border-color: var(--accent);
}

.game-row-bottom {
    grid-column: 1 / -1;
    display: flex;
    justify-content: center;
}

/* ── Stats pane ─────────────────────────── */
.stats-pane {
    display: flex;
    flex-direction: column;
    border: none;
    border-top: none;
}

.stats-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem 1.25rem;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.stats-header h2 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.table-controls input {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-family: inherit;
    font-size: 0.85rem;
    padding: 0.4rem 0.85rem;
    width: 220px;
    outline: none;
    transition: border-color 0.2s;
}

.table-controls input:focus {
    border-color: var(--accent);
}

.table-controls input::placeholder {
    color: var(--muted);
}

.table-wrapper {
    overflow: auto;
    flex: 1;
}

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

thead {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--surface2);
}

th {
    padding: 0.6rem 0.75rem;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
    text-align: right;
    user-select: none;
}

th.left {
    text-align: left;
}

th.num {
    text-align: right;
}

th.muted {
    color: rgba(110, 118, 129, 0.5);
}

th.sortable {
    cursor: pointer;
}

th.sortable:hover {
    color: var(--text);
}

th.sort-asc,
th.sort-desc {
    color: var(--sort-active);
}

.sort-arrow {
    display: inline-block;
    width: 1ch;
    margin-left: 3px;
}

th.sort-asc .sort-arrow::after {
    content: '↑';
}

th.sort-desc .sort-arrow::after {
    content: '↓';
}

td {
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
    border-bottom: 1px solid var(--border);
    text-align: right;
    white-space: nowrap;
    transition: color 0.15s;
}

td.left {
    text-align: left;
}

td.player-name {
    font-weight: 600;
    text-align: left;
}

td.team-code {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--accent);
    letter-spacing: 0.04em;
}

td.placeholder {
    color: var(--muted);
    font-size: 0.75rem;
}

td.stat-zero {
    color: var(--surface2);
}

/* fade zeros */

tr:hover td {
    background: var(--row-hover);
}

.table-footer {
    padding: 0.5rem 1.25rem;
    font-size: 0.75rem;
    color: var(--muted);
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}

.loading {
    padding: 2rem;
    text-align: center;
    color: var(--accent);
    animation: pulse 1.5s infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1
    }

    50% {
        opacity: 0.45
    }
}