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

:root {
    --bg-0: #06080d;
    --bg-1: #0c1018;
    --bg-2: #131825;
    --bg-3: #1a2033;
    --bg-4: #222940;
    --bg-5: #2c3550;
    --border-1: #1e2538;
    --border-2: #2a3348;
    --border-3: #354060;
    --text-1: #f1f3f8;
    --text-2: #b0b8cc;
    --text-3: #7a849e;
    --text-4: #505a72;
    --blue: #4f8fff;
    --blue-dim: rgba(79,143,255,0.12);
    --blue-glow: rgba(79,143,255,0.25);
    --green: #22c55e;
    --green-dim: rgba(34,197,94,0.12);
    --green-glow: rgba(34,197,94,0.3);
    --red: #ef4444;
    --red-dim: rgba(239,68,68,0.12);
    --amber: #f59e0b;
    --amber-dim: rgba(245,158,11,0.12);
    --purple: #a855f7;
    --r: 10px;
    --r-lg: 14px;
    --r-sm: 7px;
    --r-xs: 5px;
    --ease: cubic-bezier(0.4, 0, 0.2, 1);
    /* Sidebar layout */
    --sidebar-w: 260px;
    --info-bar-h: 30px;
}

html { font-size: 14px; }
body {
    font-family: 'Inter', system-ui, sans-serif;
    background: var(--bg-0);
    color: var(--text-1);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}
#bgCanvas {
    position: fixed; inset: 0; z-index: 0;
    width: 100%; height: 100%;
    pointer-events: none;
}

/* ===== LOGIN GATE ===== */
.login-gate {
    min-height: 100vh;
    display: flex; align-items: center; justify-content: center;
    padding: 20px;
    background: transparent;
    position: relative; z-index: 1;
}
.login-card {
    width: 100%; max-width: 360px;
    background: rgba(19,24,37,0.85);
    backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-2);
    border-radius: 16px;
    padding: 40px 32px 36px;
    display: flex; flex-direction: column; align-items: center;
    box-shadow: 0 16px 48px rgba(0,0,0,0.5), 0 0 0 1px rgba(79,143,255,0.05);
}
.login-logo {
    width: 56px; height: 56px;
    border-radius: 14px;
    object-fit: contain;
    margin-bottom: 16px;
}
.login-title {
    font-size: 1.4rem; font-weight: 800;
    letter-spacing: -0.03em; color: var(--text-1);
    margin-bottom: 4px;
}
.login-sub {
    font-size: 0.8rem; color: var(--text-4);
    margin-bottom: 28px;
}
.login-form { width: 100%; display: flex; flex-direction: column; gap: 16px; }
.login-field { display: flex; flex-direction: column; gap: 5px; }
.login-label {
    font-size: 0.72rem; font-weight: 600; color: var(--text-3);
    text-transform: uppercase; letter-spacing: 0.05em;
}
.login-input {
    width: 100%; padding: 10px 14px;
    background: var(--bg-3); border: 1px solid var(--border-1);
    border-radius: var(--r-sm); color: var(--text-1);
    font-family: inherit; font-size: 0.9rem;
    transition: border-color 0.15s var(--ease);
}
.login-input::placeholder { color: var(--text-4); }
.login-input:focus { outline: none; border-color: var(--blue); }
.login-error {
    font-size: 0.78rem; color: var(--red);
    text-align: center; padding: 8px;
    background: var(--red-dim); border-radius: var(--r-xs);
}
.login-btn {
    width: 100%; padding: 11px;
    background: var(--blue); color: #fff;
    border: none; border-radius: var(--r-sm);
    font-family: inherit; font-size: 0.88rem; font-weight: 700;
    cursor: pointer;
    transition: all 0.15s var(--ease);
}
.login-btn:hover { filter: brightness(1.1); }
.login-btn:active { transform: scale(0.98); }
.login-shake {
    animation: shake 0.4s ease;
}
@keyframes shake {
    0%,100% { transform: translateX(0); }
    20%,60% { transform: translateX(-8px); }
    40%,80% { transform: translateX(8px); }
}

/* ===== USER BAR ===== */
.user-bar {
    background: var(--bg-2);
    border-bottom: 1px solid var(--border-1);
}
.user-bar-inner {
    max-width: 1480px; margin: 0 auto;
    padding: 6px 20px;
    display: flex; align-items: center; gap: 12px;
    font-size: 0.72rem;
}
.user-info {
    display: flex; align-items: center; gap: 6px;
    color: var(--text-2); font-weight: 600;
}
.user-info svg { color: var(--blue); flex-shrink: 0; }
.user-name { color: var(--text-1); }
.user-meta {
    display: flex; align-items: center; gap: 6px;
    margin-left: auto;
}
.user-tag {
    padding: 2px 8px; border-radius: 4px;
    background: var(--bg-4); color: var(--text-3);
    font-weight: 600; font-size: 0.68rem;
    white-space: nowrap;
}
.user-tag-expiry {
    background: var(--green-dim); color: var(--green);
}
.user-tag-warn {
    background: var(--red-dim) !important; color: var(--red) !important;
}
.user-logout {
    background: none; border: none; cursor: pointer;
    color: var(--text-4); padding: 4px;
    border-radius: 4px; display: flex; align-items: center;
    transition: all 0.12s var(--ease);
}
.user-logout:hover { color: var(--red); background: var(--red-dim); }

/* ===== HEADER ===== */
.header {
    background: var(--bg-1);
    border-bottom: 1px solid var(--border-1);
    position: sticky; top: 0; z-index: 100;
}
.header-inner {
    max-width: 1480px; margin: 0 auto;
    padding: 12px 20px;
    display: flex; align-items: center; justify-content: space-between;
}
.logo { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; cursor: pointer; }
.logo-mark {
    width: 34px; height: 34px;
    border-radius: 9px;
    object-fit: contain;
}
.logo-text { display: flex; flex-direction: column; }
.logo-title { font-weight: 800; font-size: 1.1rem; letter-spacing: -0.03em; line-height: 1.1; }
.logo-sub { font-size: 0.65rem; color: var(--text-3); font-weight: 500; letter-spacing: 0.04em; text-transform: uppercase; }

.header-stats { display: flex; gap: 16px; font-size: 0.78rem; color: var(--text-3); }
.stat { display: flex; align-items: center; gap: 5px; }
.stat-val { font-weight: 700; color: var(--text-1); font-size: 0.85rem; }
.stat-live {
    color: var(--green);
    display: flex; align-items: center; gap: 5px;
}
.stat-soon {
    color: var(--amber);
}
.stat-clickable {
    cursor: pointer; padding: 3px 8px; border-radius: 6px;
    transition: all 0.15s var(--ease);
    border: 1px solid transparent;
}
.stat-clickable:hover { background: var(--bg-3); }
.stat-clickable.stat-active.stat-live {
    background: var(--green-dim); border-color: rgba(34,197,94,0.3);
}
.stat-clickable.stat-active.stat-soon {
    background: var(--amber-dim); border-color: rgba(245,158,11,0.3);
}
.live-dot {
    width: 7px; height: 7px; border-radius: 50%;
    background: var(--green);
    box-shadow: 0 0 8px var(--green-glow);
    animation: blink 2s ease-in-out infinite;
}
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:0.4} }

/* ===== CONTROLS ===== */
.controls {
    background: var(--bg-1);
    border-bottom: 1px solid var(--border-1);
    position: sticky; top: 59px; z-index: 99;
    overflow: visible;
}
.controls-inner {
    max-width: 1480px; margin: 0 auto;
    padding: 10px 20px 12px;
    display: flex; flex-direction: column; gap: 10px;
    overflow: visible;
}

/* Date pills */
.date-nav { display: flex; align-items: center; gap: 4px; }
.date-arrow {
    background: var(--bg-3); border: 1px solid var(--border-1);
    color: var(--text-3); cursor: pointer;
    width: 32px; height: 32px; border-radius: var(--r-sm);
    display: flex; align-items: center; justify-content: center;
    transition: all 0.15s var(--ease); flex-shrink: 0;
}
.date-arrow:hover { background: var(--bg-4); color: var(--text-1); border-color: var(--border-2); }
.date-pills {
    display: flex; gap: 3px; overflow-x: auto; flex: 1;
    scrollbar-width: none; padding: 2px 0;
}
.date-pills::-webkit-scrollbar { display: none; }
.date-pill {
    padding: 5px 12px; border-radius: 20px;
    font-size: 0.78rem; font-weight: 500;
    white-space: nowrap; cursor: pointer;
    background: transparent; border: 1px solid transparent;
    color: var(--text-3); transition: all 0.15s var(--ease);
    display: flex; flex-direction: column; align-items: center; gap: 1px;
    font-family: inherit;
}
.date-pill:hover { color: var(--text-2); background: var(--bg-3); }
.date-pill:focus { outline: 2px solid var(--blue); outline-offset: 2px; }
.date-pill.active {
    background: var(--blue-dim); color: var(--blue);
    border-color: rgba(79,143,255,0.25); font-weight: 700;
}
.date-pill .dp-day { font-size: 0.68rem; opacity: 0.7; text-transform: uppercase; }
.date-pill .dp-num { font-size: 0.9rem; font-weight: 700; line-height: 1; }

/* Filters */
.filters-row {
    display: flex; flex-direction: column; gap: 8px;
    overflow: visible;
}
.filter-chip-group {
    display: flex; gap: 4px; flex-wrap: wrap; width: 100%;
}
.filter-chip {
    padding: 4px 10px; border-radius: 16px;
    font-size: 0.72rem; font-weight: 600;
    white-space: nowrap; cursor: pointer;
    background: var(--bg-3); border: 1px solid var(--border-1);
    color: var(--text-3); transition: all 0.15s var(--ease);
    font-family: inherit;
}
.filter-chip:hover { background: var(--bg-4); color: var(--text-2); }
.filter-chip:focus { outline: 2px solid var(--blue); outline-offset: 2px; }
.filter-chip.active {
    background: var(--blue-dim); color: var(--blue);
    border-color: rgba(79,143,255,0.3);
}
.filter-controls { display: flex; gap: 6px; flex-shrink: 0; }
.search-wrap {
    position: relative; width: 200px;
}
.search-icon {
    position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
    color: var(--text-4); pointer-events: none;
}
.search-input {
    width: 100%; padding: 6px 28px 6px 32px;
    background: var(--bg-3); border: 1px solid var(--border-1);
    border-radius: var(--r-sm); color: var(--text-1);
    font-family: inherit; font-size: 0.8rem;
    transition: border-color 0.15s var(--ease);
}
.search-input::placeholder { color: var(--text-4); }
.search-input:focus { outline: none; border-color: var(--blue); }
.search-clear {
    position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
    background: none; border: none; color: var(--text-4); cursor: pointer;
    font-size: 1.1rem; line-height: 1; padding: 2px;
}
.filter-select {
    padding: 6px 28px 6px 10px;
    background: var(--bg-3); border: 1px solid var(--border-1);
    border-radius: var(--r-sm); color: var(--text-2);
    font-family: inherit; font-size: 0.8rem; cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23505a72' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 6px center;
    transition: border-color 0.15s var(--ease);
}
.filter-select:focus { outline: none; border-color: var(--blue); }

/* ===== MAIN ===== */
.main {
    max-width: 1480px; margin: 0 auto;
    padding: 16px 20px 48px;
}
.state-msg {
    display: flex; flex-direction: column; align-items: center;
    justify-content: center; padding: 80px 20px; color: var(--text-4); gap: 8px;
}
.spinner {
    width: 36px; height: 36px;
    border: 3px solid var(--border-2); border-top-color: var(--blue);
    border-radius: 50%; animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.empty-icon { font-size: 2.5rem; opacity: 0.5; }
.empty-title { font-size: 1rem; font-weight: 600; color: var(--text-3); }
.empty-sub { font-size: 0.82rem; }

/* ===== LEAGUE SECTION ===== */
.league-section { margin-bottom: 24px; }
.league-header {
    display: flex; align-items: center; gap: 10px;
    padding: 6px 0; margin-bottom: 10px;
    z-index: 10;
    background: var(--bg-0);
}
.league-badge {
    width: 24px; height: 24px; object-fit: contain; border-radius: 4px;
    flex-shrink: 0;
}
.league-badge-placeholder {
    width: 24px; height: 24px; border-radius: 4px;
    background: var(--bg-4); display: flex; align-items: center; justify-content: center;
    font-size: 0.7rem; font-weight: 700; color: var(--text-4); flex-shrink: 0;
}
.league-title {
    font-size: 0.82rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.05em; color: var(--text-2);
}
.league-sport {
    font-size: 0.7rem; color: var(--text-4); font-weight: 500;
}
.league-line { flex: 1; height: 1px; background: var(--border-1); }
.league-count {
    font-size: 0.7rem; color: var(--text-4); font-weight: 600;
    background: var(--bg-3); padding: 2px 8px; border-radius: 10px;
}

.league-events {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
    gap: 10px;
}

/* ===== EVENT CARD ===== */
.ev-card {
    background: var(--bg-2);
    border: 1px solid var(--border-1);
    border-radius: var(--r-lg);
    overflow: hidden;
    transition: all 0.2s var(--ease);
    cursor: pointer;
    display: flex; flex-direction: column;
}
.ev-card:hover {
    border-color: var(--border-2);
    background: var(--bg-3);
    transform: translateY(-1px);
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
}
.ev-card:focus {
    outline: 2px solid var(--blue);
    outline-offset: 2px;
    border-color: var(--blue);
    background: var(--bg-3);
    box-shadow: 0 0 0 4px rgba(79,143,255,0.15);
}
.ev-card-live {
    border-color: rgba(34,197,94,0.3);
    box-shadow: 0 0 12px rgba(34,197,94,0.08);
}
.ev-card-live:hover {
    border-color: rgba(34,197,94,0.5);
}
.ev-live-bar {
    display: flex; align-items: center; gap: 6px;
    padding: 4px 16px;
    background: var(--green-dim);
    color: var(--green);
    font-size: 0.65rem; font-weight: 800;
    letter-spacing: 0.06em;
}

/* Card body */
.ev-body {
    padding: 14px 16px 10px;
    display: flex; align-items: center; gap: 12px;
    flex: 1;
}

/* Time column */
.ev-time-col {
    display: flex; flex-direction: column; align-items: center;
    min-width: 54px; gap: 2px;
}
.ev-time {
    font-size: 0.95rem; font-weight: 700; color: var(--text-1);
    line-height: 1;
}
.ev-time-ampm {
    font-size: 0.6rem; font-weight: 600; color: var(--text-3);
    text-transform: uppercase;
}
.ev-status-badge {
    font-size: 0.62rem; font-weight: 800; padding: 2px 6px;
    border-radius: 4px; text-transform: uppercase; letter-spacing: 0.04em;
    line-height: 1.3;
}
.badge-live { background: var(--green-dim); color: var(--green); text-transform: none; }
.badge-ft { background: rgba(100,116,139,0.15); color: var(--text-4); text-transform: none; }
.badge-soon { background: var(--amber-dim); color: var(--amber); text-transform: none; }
.badge-upcoming { background: var(--blue-dim); color: var(--blue); }
.badge-ppd { background: var(--amber-dim); color: var(--amber); }

/* Matchup area */
.ev-matchup { flex: 1; min-width: 0; }

/* Team event */
.ev-teams {
    display: flex; flex-direction: column; gap: 6px;
}
.ev-team-row {
    display: flex; align-items: center; gap: 8px;
}
.ev-team-logo {
    width: 28px; height: 28px; object-fit: contain;
    border-radius: 4px; flex-shrink: 0;
}
.ev-team-logo-ph {
    width: 28px; height: 28px; border-radius: 4px;
    background: var(--bg-4);
    display: flex; align-items: center; justify-content: center;
    font-size: 0.72rem; font-weight: 800; color: var(--text-4);
    flex-shrink: 0;
}
.ev-team-name {
    font-size: 0.88rem; font-weight: 600; color: var(--text-1);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ev-team-tag {
    font-size: 0.58rem; font-weight: 600; color: var(--text-4);
    text-transform: uppercase; letter-spacing: 0.04em;
    flex-shrink: 0;
}
.ev-at {
    font-size: 0.62rem; color: var(--text-4); font-weight: 600;
    padding-left: 36px; line-height: 1;
}

/* Non-team event */
.ev-single {
    display: flex; flex-direction: column; gap: 3px;
}
.ev-single-name {
    font-size: 0.92rem; font-weight: 700; color: var(--text-1);
    line-height: 1.3;
}
.ev-single-sub {
    font-size: 0.72rem; color: var(--text-3);
}

/* Venue */
.ev-venue {
    font-size: 0.68rem; color: var(--text-4); padding-left: 36px;
    margin-top: 2px; display: flex; align-items: center; gap: 4px;
}
.ev-venue svg { flex-shrink: 0; }

/* Channels bar — display only, never focusable */
.ev-channels {
    padding: 8px 16px 10px;
    border-top: 1px solid var(--border-1);
    display: flex; align-items: center; gap: 6px;
    flex-wrap: wrap;
    pointer-events: none;   /* block all mouse/touch/focus events on children */
}
.ch-pill {
    display: inline-flex; align-items: center; gap: 3px;
    padding: 2px 7px; border-radius: 4px;
    background: var(--bg-4); font-size: 0.68rem; font-weight: 500;
    color: var(--text-3); white-space: nowrap;
    border: 1px solid transparent;
    transition: all 0.12s var(--ease);
}
.ch-pill:hover { border-color: var(--border-3); color: var(--text-2); }
.ch-flag { font-size: 0.72rem; }
.ch-name { max-width: 120px; overflow: hidden; text-overflow: ellipsis; }
.ch-more {
    font-size: 0.68rem; color: var(--blue); font-weight: 600; cursor: pointer;
    padding: 2px 4px;
}
.ch-count {
    font-size: 0.62rem; color: var(--text-4); font-weight: 600;
    margin-left: auto; flex-shrink: 0;
    display: flex; align-items: center; gap: 3px;
}
.ch-count svg { opacity: 0.5; }

/* ===== MODAL ===== */
.modal {
    position: fixed; inset: 0; z-index: 200;
    display: flex; align-items: center; justify-content: center;
    padding: 20px;
    overflow: hidden;
}
.modal-backdrop {
    position: absolute; inset: 0;
    background: rgba(0,0,0,0.65); backdrop-filter: blur(6px);
}
.modal-sheet {
    position: relative; background: var(--bg-2);
    border: 1px solid var(--border-2);
    border-radius: 16px;
    max-width: 640px; width: calc(100% - 40px);
    max-height: calc(100vh - 40px); overflow-y: auto; overflow-x: hidden;
    box-shadow: 0 16px 48px rgba(0,0,0,0.5);
    animation: modalIn 0.2s var(--ease);
}
@keyframes modalIn {
    from { opacity: 0; transform: scale(0.96) translateY(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}
.modal-handle { display: none; }
.modal-head {
    padding: 16px 20px; display: flex; align-items: center; justify-content: space-between;
    border-bottom: 1px solid var(--border-1);
}
.modal-league-info { display: flex; align-items: center; gap: 10px; }
.modal-league-info img { width: 28px; height: 28px; object-fit: contain; border-radius: 4px; }
.modal-league-text { display: flex; flex-direction: column; }
.modal-league-name { font-size: 0.92rem; font-weight: 700; }
.modal-sport-name { font-size: 0.7rem; color: var(--text-4); }
.modal-close {
    width: 32px; height: 32px; border-radius: 8px;
    background: var(--bg-4); border: 1px solid var(--border-2);
    color: var(--text-3); cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.12s var(--ease);
}
.modal-close:hover { background: var(--bg-5); color: var(--text-1); }

.modal-matchup {
    padding: 24px 20px; display: flex; align-items: center;
    gap: 16px; justify-content: center;
}
.modal-team { display: flex; flex-direction: column; align-items: center; gap: 8px; flex: 1; }
.modal-team-badge {
    width: 64px; height: 64px; border-radius: 50%;
    background: var(--bg-4); border: 2px solid var(--border-2);
    display: flex; align-items: center; justify-content: center; padding: 8px;
}
.modal-team-badge img { width: 100%; height: 100%; object-fit: contain; }
.modal-team-name { font-size: 0.95rem; font-weight: 700; text-align: center; }
.modal-vs { font-size: 0.9rem; font-weight: 900; color: var(--text-4); }

.modal-event-name {
    padding: 24px 20px; text-align: center;
    font-size: 1.15rem; font-weight: 700; line-height: 1.4;
}

.modal-meta {
    padding: 0 20px 16px; display: flex; flex-wrap: wrap;
    gap: 8px; justify-content: center;
}
.meta-tag {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 5px 10px; border-radius: var(--r-sm);
    background: var(--bg-3); border: 1px solid var(--border-1);
    font-size: 0.78rem; color: var(--text-2);
}
.meta-tag svg { width: 13px; height: 13px; color: var(--blue); flex-shrink: 0; }

/* Video player in modal */
.modal-player-section {
    border-top: 1px solid var(--border-1);
    border-bottom: 1px solid var(--border-1);
    background: var(--bg-0);
}
.modal-player-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 20px;
    background: var(--green-dim);
}
.modal-player-label {
    font-size: 0.78rem; font-weight: 700; color: var(--green);
    display: flex; align-items: center; gap: 6px;
}
.modal-player-label::before {
    content: ''; width: 7px; height: 7px; border-radius: 50%;
    background: var(--green); box-shadow: 0 0 8px var(--green-glow);
    animation: blink 2s ease-in-out infinite;
}
.modal-player-close {
    background: none; border: none; color: var(--text-3);
    cursor: pointer; padding: 4px; border-radius: 4px;
    display: flex; align-items: center;
    transition: all 0.12s var(--ease);
}
.modal-player-close:hover { color: var(--red); background: var(--red-dim); }
.modal-player-wrap {
    padding: 0; background: #000;
}
.modal-player-wrap .video-js {
    width: 100%; min-height: 200px;
}
.modal-player-url {
    display: flex; gap: 6px; padding: 8px 16px 10px;
    background: var(--bg-1);
}
.modal-player-url-input {
    flex: 1; padding: 6px 10px;
    background: var(--bg-3); border: 1px solid var(--border-1);
    border-radius: var(--r-xs); color: var(--text-3);
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 0.68rem; cursor: text;
}
.modal-player-copy {
    padding: 6px 12px; border-radius: var(--r-xs);
    background: var(--blue); color: #fff; border: none;
    font-family: inherit; font-size: 0.72rem; font-weight: 700;
    cursor: pointer; white-space: nowrap;
    transition: all 0.15s var(--ease);
}
.modal-player-copy:hover { filter: brightness(1.15); }

/* Playable channel items */
.modal-ch-playable { cursor: pointer; position: relative; }
.modal-ch-playable:hover { border-color: var(--green); background: var(--bg-4); }
.modal-ch-playable:focus { outline: 2px solid var(--green); outline-offset: 2px; border-color: var(--green); background: var(--bg-4); }
.modal-ch-playable:focus .modal-ch-play-icon { color: var(--green); }
.modal-ch-play-icon {
    display: flex; align-items: center; justify-content: center;
    color: var(--text-4); transition: all 0.15s var(--ease);
    margin-left: auto; margin-right: 6px;
}
.modal-ch-playable:hover .modal-ch-play-icon { color: var(--green); }
.ch-playing {
    border-color: var(--green) !important;
    background: var(--green-dim) !important;
}
.ch-playing .modal-ch-play-icon { color: var(--green); }
.ch-playing .modal-ch-name { color: var(--green); }

.modal-ch-section {
    padding: 14px 20px 20px; border-top: 1px solid var(--border-1);
}
.modal-ch-title {
    font-size: 0.75rem; font-weight: 700; color: var(--text-4);
    text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 10px;
}
.modal-ch-grid {
    display: grid; grid-template-columns: 1fr 1fr; gap: 6px;
}
.modal-ch-item {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 10px; background: var(--bg-3);
    border: 1px solid var(--border-1); border-radius: var(--r-sm);
    transition: all 0.12s var(--ease);
    min-width: 0; overflow: hidden;
}
.modal-ch-item:hover { border-color: var(--border-2); background: var(--bg-4); }
.modal-ch-flag { font-size: 1.1rem; flex-shrink: 0; }
.modal-ch-details { flex: 1; min-width: 0; overflow: hidden; }
.modal-ch-name {
    font-size: 0.8rem; font-weight: 600; color: var(--text-1);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    max-width: 100%;
}
.modal-ch-section { overflow: hidden; }
.modal-ch-grid { overflow: hidden; }
.modal-ch-id {
    font-size: 0.65rem; color: var(--text-4);
    font-family: 'SF Mono', 'Fira Code', monospace;
}
.modal-ch-country {
    font-size: 0.62rem; font-weight: 700; color: var(--blue);
    background: var(--blue-dim); padding: 1px 6px; border-radius: 3px;
    flex-shrink: 0;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
    .league-events { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
    /* User bar */
    .user-bar-inner { padding: 5px 12px; gap: 8px; font-size: 0.68rem; }
    .user-meta { gap: 4px; }
    .user-tag { font-size: 0.62rem; padding: 1px 6px; }

    /* Header: stack logo + stats vertically */
    .header-inner {
        flex-wrap: wrap; gap: 8px;
        padding: 10px 14px;
    }
    .header-stats {
        display: flex; width: 100%;
        gap: 8px; font-size: 0.72rem;
        overflow-x: auto; scrollbar-width: none;
    }
    .header-stats::-webkit-scrollbar { display: none; }
    /* Hide non-essential stats on mobile, keep Live & Starting Soon */
    .header-stats .stat:not(.stat-live):not(.stat-soon) { display: none; }

    /* Controls */
    .controls-inner { padding: 8px 12px 10px; gap: 8px; }
    .filters-row { flex-direction: column; }
    .filter-controls { width: 100%; }
    .search-wrap { flex: 1; width: auto; }
    .filter-select { flex: 1; min-width: 0; }
    .date-nav { gap: 2px; }
    .date-pill { padding: 4px 8px; font-size: 0.72rem; }
    .date-pill .dp-num { font-size: 0.82rem; }
    .date-arrow { width: 28px; height: 28px; }

    /* Sport chips: smaller on mobile */
    .filter-chip { padding: 3px 8px; font-size: 0.68rem; }

    /* Cards */
    .ev-body { padding: 10px 12px 8px; gap: 10px; }
    .ev-channels { padding: 6px 12px 8px; }
    .ev-time-col { min-width: 48px; }
    .ev-time { font-size: 0.88rem; }
    .ev-team-name { font-size: 0.82rem; }
    .ev-team-logo, .ev-team-logo-ph { width: 24px; height: 24px; }
    .ev-at { padding-left: 32px; }
    .ev-venue { padding-left: 32px; }
    .ev-single-name { font-size: 0.85rem; }

    /* League headers */
    .league-header { gap: 8px; }
    .league-title { font-size: 0.75rem; }
    .league-badge, .league-badge-placeholder { width: 20px; height: 20px; }
    .league-section { margin-bottom: 16px; }

    /* Main content */
    .main { padding: 12px 12px 40px; }

    /* Modal: bottom sheet on mobile */
    .modal { align-items: flex-end; padding: 0; }
    .modal-sheet {
        width: 100%; max-width: 100%;
        border-radius: 16px 16px 0 0;
        max-height: 90vh;
        animation: modalSlideUp 0.25s var(--ease);
    }
    .modal-handle {
        display: block; width: 36px; height: 4px;
        background: var(--border-2); border-radius: 2px;
        margin: 8px auto 4px;
    }
    .modal-ch-grid { grid-template-columns: 1fr; }
    .modal-matchup { gap: 10px; padding: 16px 16px; }
    .modal-team-badge { width: 48px; height: 48px; }
    .modal-team-name { font-size: 0.85rem; }
    .modal-head { padding: 12px 16px; }
    .modal-meta { padding: 0 16px 12px; gap: 6px; }
    .modal-ch-section { padding: 12px 16px 16px; }
    .meta-tag { font-size: 0.72rem; padding: 4px 8px; }
}

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

@media (max-width: 400px) {
    html { font-size: 13px; }
    .header-inner { padding: 8px 10px; }
    .controls-inner { padding: 6px 10px 8px; }
    .main { padding: 10px 10px 32px; }
    .ev-body { padding: 8px 10px 6px; gap: 8px; }
    .ev-channels { padding: 5px 10px 6px; }
    .ev-time-col { min-width: 44px; }
    .ev-time { font-size: 0.82rem; }
    .ev-status-badge { font-size: 0.58rem; padding: 1px 5px; }
    .ch-pill { font-size: 0.62rem; padding: 1px 5px; }
    .date-pill { padding: 3px 6px; }
}

/* ===== ADMIN: User bar tags ===== */
.user-tag-level {
    background: var(--bg-4); color: var(--text-3);
}
.user-tag-admin-level {
    background: rgba(168,85,247,0.12) !important; color: var(--purple) !important;
}
.user-tag-admin {
    text-decoration: none;
    background: rgba(168,85,247,0.12); color: var(--purple);
    font-weight: 700; cursor: pointer;
    transition: all 0.15s var(--ease);
    font-size: 0.68rem; padding: 2px 8px; border-radius: 4px;
}
.user-tag-admin:hover {
    background: rgba(168,85,247,0.25); color: #c084fc;
}

/* ===== ADMIN TABS ===== */
.admin-tabs {
    display: flex; gap: 4px; margin-bottom: 20px;
    background: rgba(19,24,37,0.6);
    border: 1px solid var(--border-1);
    border-radius: var(--r-lg);
    padding: 4px; backdrop-filter: blur(8px);
}
.admin-tab {
    flex: 1; display: flex; align-items: center; justify-content: center; gap: 8px;
    padding: 10px 16px; border-radius: var(--r);
    background: transparent; border: 1px solid transparent;
    color: var(--text-3); font-family: inherit;
    font-size: 0.82rem; font-weight: 600; cursor: pointer;
    transition: all 0.15s var(--ease);
}
.admin-tab:hover { color: var(--text-2); background: var(--bg-3); }
.admin-tab.active {
    background: var(--bg-2); color: var(--text-1);
    border-color: var(--border-2);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
.admin-tab svg { flex-shrink: 0; opacity: 0.6; }
.admin-tab.active svg { opacity: 1; color: var(--purple); }
.admin-tab-content { display: none; }
.admin-tab-content.active { display: block; }

/* ===== ADMIN CP ===== */
.admin-header-actions { display: flex; align-items: center; gap: 8px; }
.admin-back-btn {
    display: flex; align-items: center; gap: 5px;
    padding: 6px 14px; border-radius: var(--r-sm);
    background: var(--bg-3); border: 1px solid var(--border-1);
    color: var(--text-2); text-decoration: none;
    font-size: 0.78rem; font-weight: 600;
    transition: all 0.15s var(--ease);
}
.admin-back-btn:hover { background: var(--bg-4); border-color: var(--border-2); color: var(--text-1); }

.admin-grid {
    display: grid; grid-template-columns: 1fr 1fr; gap: 20px;
}
@media (max-width: 900px) {
    .admin-grid { grid-template-columns: 1fr; }
}

.admin-card {
    background: rgba(19,24,37,0.85);
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-1);
    border-radius: var(--r-lg);
    overflow: visible;
}
.admin-card-header {
    display: flex; align-items: center; gap: 10px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-1);
    color: var(--text-1);
}
.admin-card-header svg { color: var(--purple); flex-shrink: 0; }
.admin-card-header h2 { font-size: 0.95rem; font-weight: 700; }
.admin-count {
    margin-left: auto;
    font-size: 0.72rem; font-weight: 700;
    background: var(--purple); color: #fff;
    padding: 1px 8px; border-radius: 10px;
    min-width: 22px; text-align: center;
}

/* Admin form */
.admin-form { padding: 20px; display: flex; flex-direction: column; gap: 14px; overflow: visible; }
.form-row { display: flex; gap: 10px; }
.form-row-2 > .form-group { flex: 1; }
.form-group { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.form-label {
    font-size: 0.7rem; font-weight: 600; color: var(--text-3);
    text-transform: uppercase; letter-spacing: 0.04em;
}
.form-input {
    width: 100%; padding: 9px 12px;
    background: var(--bg-3); border: 1px solid var(--border-1);
    border-radius: var(--r-sm); color: var(--text-1);
    font-family: inherit; font-size: 0.84rem;
    transition: border-color 0.15s var(--ease);
}
.form-input::placeholder { color: var(--text-4); }
.form-input:focus { outline: none; border-color: var(--purple); }
.form-msg {
    font-size: 0.78rem; padding: 8px 12px; border-radius: var(--r-xs);
    text-align: center;
}
.form-msg-ok { background: var(--green-dim); color: var(--green); }
.form-msg-error { background: var(--red-dim); color: var(--red); }
.form-submit {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    width: 100%; padding: 11px;
    background: var(--purple); color: #fff;
    border: none; border-radius: var(--r-sm);
    font-family: inherit; font-size: 0.88rem; font-weight: 700;
    cursor: pointer; transition: all 0.15s var(--ease);
}
.form-submit:hover { filter: brightness(1.15); }
.form-submit:active { transform: scale(0.98); }
.form-submit:disabled { opacity: 0.6; cursor: not-allowed; }

/* Admin events list */
.admin-events-list {
    max-height: 600px; overflow-y: auto;
    scrollbar-width: thin; scrollbar-color: var(--border-2) transparent;
}
.admin-empty {
    padding: 40px 20px; text-align: center;
    color: var(--text-4); font-size: 0.85rem;
}
.aev-item {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 20px;
    border-bottom: 1px solid var(--border-1);
    transition: background 0.12s var(--ease);
}
.aev-item:last-child { border-bottom: none; }
.aev-item:hover { background: rgba(255,255,255,0.02); }
.aev-main { flex: 1; min-width: 0; }
.aev-name {
    font-size: 0.88rem; font-weight: 700; color: var(--text-1);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.aev-meta {
    display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px;
}
.aev-tag {
    font-size: 0.65rem; font-weight: 600;
    padding: 1px 6px; border-radius: 3px;
    background: var(--bg-4); color: var(--text-3);
    white-space: nowrap;
}
.aev-tag-sport { background: var(--blue-dim); color: var(--blue); }
.aev-tag-time { background: var(--amber-dim); color: var(--amber); }
.aev-tag-ch { background: var(--green-dim); color: var(--green); }
.aev-teams {
    display: block; font-size: 0.72rem; color: var(--text-3); margin-top: 2px;
}
.aev-actions {
    display: flex; flex-direction: column; align-items: flex-end; gap: 4px;
    flex-shrink: 0;
}
.aev-by { font-size: 0.62rem; color: var(--text-4); }
.aev-edit, .aev-delete {
    background: none; border: none; cursor: pointer;
    color: var(--text-4); padding: 4px; border-radius: 4px;
    display: flex; align-items: center;
    transition: all 0.12s var(--ease);
}
.aev-edit:hover { color: var(--blue); background: var(--blue-dim); }
.aev-delete:hover { color: var(--red); background: var(--red-dim); }

/* Event type toggle */
.form-toggle {
    display: flex; gap: 4px;
}
.toggle-btn {
    flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px;
    padding: 8px 12px; border-radius: var(--r-sm);
    background: var(--bg-3); border: 1px solid var(--border-1);
    color: var(--text-3); font-family: inherit;
    font-size: 0.78rem; font-weight: 600; cursor: pointer;
    transition: all 0.15s var(--ease);
}
.toggle-btn:hover { background: var(--bg-4); color: var(--text-2); }
.toggle-btn.active {
    background: rgba(168,85,247,0.12); color: var(--purple);
    border-color: rgba(168,85,247,0.3);
}
.toggle-btn svg { flex-shrink: 0; }

/* Channel picker */
.ch-picker { position: relative; }
.ch-selected {
    display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 6px;
}
.ch-sel-tag {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 3px 8px; border-radius: 4px;
    background: var(--blue-dim); color: var(--blue);
    font-size: 0.72rem; font-weight: 600;
}
.ch-sel-remove {
    background: none; border: none; color: var(--blue);
    cursor: pointer; font-size: 0.9rem; line-height: 1; padding: 0 2px;
    opacity: 0.7; transition: opacity 0.1s;
}
.ch-sel-remove:hover { opacity: 1; }
.ch-search-wrap { position: relative; }
.ch-search-icon {
    position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
    color: var(--text-4); pointer-events: none;
}
.ch-search-input { padding-left: 32px !important; }
.ch-dropdown {
    position: absolute; left: 0; right: 0; top: 100%; margin-top: 4px;
    background: var(--bg-2); border: 1px solid var(--border-2);
    border-radius: var(--r-sm); z-index: 50;
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
    max-height: 240px; overflow-y: auto;
    scrollbar-width: thin; scrollbar-color: var(--border-2) transparent;
}
.ch-opt {
    padding: 7px 12px; font-size: 0.78rem; color: var(--text-2);
    cursor: pointer; transition: background 0.1s;
    border-bottom: 1px solid var(--border-1);
}
.ch-opt:last-child { border-bottom: none; }
.ch-opt:hover { background: var(--bg-3); }
.ch-opt-selected {
    background: rgba(79,143,255,0.08); color: var(--blue);
}
.ch-opt-selected::after {
    content: ' \2713'; font-weight: 700;
}
.ch-dropdown-loading {
    padding: 10px; text-align: center;
    font-size: 0.75rem; color: var(--text-4);
}

/* Combo picker (searchable select with manual fallback) */
.combo-picker { position: relative; }
.combo-input { width: 100%; }
.combo-dropdown {
    position: absolute; left: 0; right: 0; top: 100%; margin-top: 4px;
    background: var(--bg-2); border: 1px solid var(--border-2);
    border-radius: var(--r-sm); z-index: 50;
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
    max-height: 200px; overflow-y: auto;
    scrollbar-width: thin; scrollbar-color: var(--border-2) transparent;
}
.combo-opt {
    padding: 7px 12px; font-size: 0.78rem; color: var(--text-2);
    cursor: pointer; transition: background 0.1s;
    border-bottom: 1px solid var(--border-1);
}
.combo-opt:last-child { border-bottom: none; }
.combo-opt:hover { background: var(--bg-3); color: var(--text-1); }
.combo-opt-hint {
    padding: 6px 12px; font-size: 0.7rem; color: var(--text-4);
    font-style: italic;
}
.combo-loading {
    padding: 10px; text-align: center;
    font-size: 0.75rem; color: var(--text-4);
}

/* Event type tags in list */
.aev-tag-team { background: rgba(168,85,247,0.12); color: var(--purple); }
.aev-tag-single { background: rgba(79,143,255,0.12); color: var(--blue); }

/* ===== SPORTS & LEAGUES MANAGEMENT ===== */
.sl-add-row {
    display: flex; gap: 6px; padding: 12px 16px;
    border-bottom: 1px solid var(--border-1);
    align-items: center;
}
.sl-add-input { flex: 1; padding: 8px 12px; font-size: 0.82rem; }
.sl-add-select { width: 160px; padding: 8px 10px; font-size: 0.82rem; appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23505a72' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 8px center;
    padding-right: 24px;
}
.sl-add-btn {
    display: flex; align-items: center; gap: 4px;
    padding: 8px 14px; border-radius: var(--r-sm);
    background: var(--green); color: #fff; border: none;
    font-family: inherit; font-size: 0.78rem; font-weight: 700;
    cursor: pointer; white-space: nowrap;
    transition: all 0.15s var(--ease);
}
.sl-add-btn:hover { filter: brightness(1.15); }
.sl-add-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.sl-checkbox {
    display: flex; align-items: center; gap: 5px;
    font-size: 0.75rem; color: var(--text-3);
    white-space: nowrap; cursor: pointer;
}
.sl-checkbox input { accent-color: var(--purple); cursor: pointer; }

.sl-filter-row {
    padding: 10px 16px;
    border-bottom: 1px solid var(--border-1);
}
.sl-filter-select { width: 100%; padding: 8px 10px; font-size: 0.82rem; }

.sl-list {
    max-height: 500px; overflow-y: auto;
    scrollbar-width: thin; scrollbar-color: var(--border-2) transparent;
}
.sl-item {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border-1);
    transition: background 0.12s var(--ease);
}
.sl-item:last-child { border-bottom: none; }
.sl-item:hover { background: rgba(255,255,255,0.02); }
.sl-item-main { flex: 1; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; }
.sl-item-name {
    font-size: 0.85rem; font-weight: 600; color: var(--text-1);
}
.sl-item-badge {
    font-size: 0.62rem; font-weight: 700;
    padding: 2px 7px; border-radius: 4px;
    background: var(--bg-4); color: var(--text-3);
    text-transform: uppercase; letter-spacing: 0.03em;
}
.sl-item-badge-sport {
    background: var(--purple); background: rgba(168,85,247,0.15);
    color: var(--purple);
}
.sl-item-count {
    font-size: 0.68rem; color: var(--text-4); font-weight: 500;
}
.sl-item-actions { display: flex; gap: 2px; flex-shrink: 0; }
.sl-btn-edit, .sl-btn-delete {
    background: none; border: none; cursor: pointer;
    color: var(--text-4); padding: 5px; border-radius: 5px;
    display: flex; align-items: center;
    transition: all 0.12s var(--ease);
}
.sl-btn-edit:hover { color: var(--blue); background: var(--blue-dim); }
.sl-btn-delete:hover { color: var(--red); background: var(--red-dim); }

/* Edit modal */
.edit-modal {
    position: fixed; inset: 0; z-index: 200;
    display: flex; align-items: center; justify-content: center;
    padding: 20px;
}
.edit-modal-backdrop {
    position: absolute; inset: 0;
    background: rgba(0,0,0,0.65); backdrop-filter: blur(6px);
}
.edit-modal-sheet {
    position: relative;
    background: var(--bg-2);
    border: 1px solid var(--border-2);
    border-radius: 16px;
    max-width: 720px; width: 100%;
    max-height: calc(100vh - 40px); overflow-y: auto;
    box-shadow: 0 16px 48px rgba(0,0,0,0.5);
    animation: modalIn 0.2s var(--ease);
}
.edit-modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-1);
}
.edit-modal-header h2 {
    font-size: 1rem; font-weight: 700; color: var(--text-1);
}

.aev-actions {
    display: flex; flex-direction: column; align-items: flex-end; gap: 4px;
    flex-shrink: 0;
}
.aev-actions .aev-btns {
    display: flex; gap: 2px;
}

/* Admin responsive */
@media (max-width: 640px) {
    .admin-form { padding: 14px; gap: 10px; }
    .form-row-2 { flex-direction: column; }
    .aev-item { padding: 10px 14px; gap: 8px; }
    .aev-name { font-size: 0.82rem; }
    .admin-card-header { padding: 12px 14px; }
    .edit-modal { padding: 0; align-items: flex-end; }
    .edit-modal-sheet {
        max-width: 100%; border-radius: 16px 16px 0 0;
        max-height: 90vh;
    }
    .admin-tabs { flex-direction: row; }
    .admin-tab { padding: 8px 10px; font-size: 0.75rem; gap: 5px; }
    .sl-add-row { flex-wrap: wrap; padding: 10px 12px; }
    .sl-add-input { min-width: 120px; }
    .sl-add-select { width: 100%; }
    .sl-item { padding: 8px 12px; }
    .sl-item-name { font-size: 0.8rem; }
}

::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 3px; }

/* ===== EXTERNAL / NATIVE PLAYER PICKER ===== */
.ext-player-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 8px;
    padding: 12px 16px;
}
.ext-player-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 12px;
    background: var(--bg-3);
    border: 1px solid var(--border-1);
    border-radius: 8px;
    color: var(--text-1);
    font-size: 0.82rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}
.ext-player-btn:hover, .ext-player-btn:focus {
    border-color: var(--green);
    background: var(--bg-4);
    outline: none;
}
/* Quality picker */
.quality-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px 14px 16px;
}
.quality-btn {
    background: var(--bg-3);
    border: 1.5px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.9rem;
    font-weight: 500;
    padding: 12px 16px;
    text-align: left;
    cursor: pointer;
    transition: border-color .15s, background .15s;
}
.quality-btn:hover {
    border-color: var(--blue);
    background: var(--bg-4);
    outline: none;
}
.quality-btn:focus {
    border-color: var(--blue);
    background: var(--bg-4);
    outline: 2px solid var(--blue);
    outline-offset: 2px;
}
.ext-player-native-msg {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 16px;
    color: var(--green);
    font-size: 0.87rem;
    font-weight: 500;
}

/* ===================================================
   SIDEBAR LAYOUT
   =================================================== */

/* ===== TOP INFO BAR ===== */
.top-info-bar {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--info-bar-h);
    background: rgba(12,16,24,0.92);
    border-bottom: 1px solid var(--border-1);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 120;
    user-select: none;
    -webkit-user-select: none;
}
.top-info-inner {
    height: 100%;
    padding: 0 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    font-size: 0.7rem;
    overflow: hidden;
}
/* Brand (left) */
.top-brand {
    display: flex; align-items: center; gap: 6px;
    flex-shrink: 0; overflow: hidden;
    user-select: none;
}
.top-brand-logo {
    width: 16px; height: 16px;
    border-radius: 3px; object-fit: contain; flex-shrink: 0;
}
.top-brand-name {
    font-size: 0.75rem; font-weight: 800;
    color: var(--text-1); letter-spacing: -0.02em;
    white-space: nowrap;
}
.top-brand-sep {
    color: var(--text-4); font-size: 0.7rem;
}
.top-brand-sub {
    font-size: 0.65rem; color: var(--text-4);
    font-weight: 500; letter-spacing: 0.03em;
    text-transform: uppercase; white-space: nowrap;
}
/* User info (right) */
.top-user {
    display: flex; align-items: center; gap: 8px;
    flex-shrink: 0; overflow: hidden;
    user-select: none;
}
.top-info-bar .user-info {
    display: flex; align-items: center; gap: 5px;
    color: var(--text-3); font-weight: 600;
    flex-shrink: 0;
}
.top-info-bar .user-info svg { color: var(--blue); flex-shrink: 0; }
.top-info-bar .user-name { color: var(--text-2); font-size: 0.72rem; }
.top-info-bar .user-meta {
    display: flex; align-items: center; gap: 5px;
    overflow: hidden;
}
.top-info-bar .user-tag {
    padding: 1px 7px; border-radius: 3px;
    background: var(--bg-4); color: var(--text-4);
    font-weight: 600; font-size: 0.65rem;
    white-space: nowrap;
}
.top-info-bar .user-tag-expiry { background: var(--green-dim); color: var(--green); }
.top-info-bar .user-tag-warn { background: var(--red-dim) !important; color: var(--red) !important; }
.top-info-bar .user-tag-level { background: var(--bg-4); color: var(--text-3); }
.top-info-bar .user-tag-admin-level { background: rgba(168,85,247,0.12) !important; color: var(--purple) !important; }

/* ===== SIDEBAR ===== */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: var(--sidebar-w);
    background: var(--bg-1);
    border-right: 1px solid var(--border-1);
    z-index: 160;
    display: flex;
    flex-direction: column;
    transform: translateX(calc(-1 * var(--sidebar-w)));
    transition: transform 0.28s var(--ease), box-shadow 0.28s var(--ease);
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: var(--border-2) transparent;
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 2px; }

.sidebar.open {
    transform: translateX(0);
    box-shadow: 6px 0 32px rgba(0,0,0,0.5);
}
.sidebar-inner {
    display: flex;
    flex-direction: column;
    padding-top: var(--info-bar-h); /* clear the fixed top bar */
    padding-bottom: 12px;
    min-height: 100%;
}

/* Brand / logo at top of sidebar */
.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px 12px;
    border-bottom: 1px solid var(--border-1);
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    transition: background 0.15s var(--ease);
    flex-shrink: 0;
}
.sidebar-logo:hover { background: var(--bg-2); }
.sidebar-logo:focus { outline: 2px solid var(--blue); outline-offset: -2px; }
.sidebar-logo .logo-mark {
    width: 30px; height: 30px;
    border-radius: 8px; object-fit: contain; flex-shrink: 0;
}
.sidebar-logo .logo-text { display: flex; flex-direction: column; }
.sidebar-logo .logo-title { font-weight: 800; font-size: 0.95rem; letter-spacing: -0.03em; line-height: 1.15; }
.sidebar-logo .logo-sub { font-size: 0.6rem; color: var(--text-4); font-weight: 500; letter-spacing: 0.04em; text-transform: uppercase; }

/* Sidebar sections */
.sidebar-section {
    padding: 10px 14px 8px;
    border-bottom: 1px solid var(--border-1);
}
.sidebar-section:last-of-type { border-bottom: none; }
.sidebar-section-label {
    font-size: 0.6rem;
    font-weight: 700;
    color: var(--text-4);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 7px;
}

/* Stats in sidebar */
.sidebar-stats-section { padding: 10px 14px 10px; border-bottom: 1px solid var(--border-1); }
.sidebar .header-stats.sidebar-stats {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 0.75rem;
    color: var(--text-3);
    width: 100%;
}
.sidebar .sidebar-stats .stat {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 3px 6px;
    border-radius: 5px;
}
.sidebar .sidebar-stats .stat-val {
    font-weight: 700;
    color: var(--text-1);
    font-size: 0.82rem;
    min-width: 22px;
    text-align: right;
}
.sidebar .sidebar-stats .stat-clickable {
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.15s var(--ease);
    border-radius: 5px;
}
.sidebar .sidebar-stats .stat-clickable:hover { background: var(--bg-3); }
.sidebar .sidebar-stats .stat-clickable.stat-active.stat-live {
    background: var(--green-dim); border-color: rgba(34,197,94,0.3);
}
.sidebar .sidebar-stats .stat-clickable.stat-active.stat-soon {
    background: var(--amber-dim); border-color: rgba(245,158,11,0.3);
}
.sidebar .sidebar-stats .stat-clickable.stat-active.stat-all {
    background: var(--bg-3); border-color: var(--border);
}
.sidebar .sidebar-stats .stat-live { color: var(--green); }
.sidebar .sidebar-stats .stat-soon { color: var(--amber); }

/* Date nav inside sidebar — horizontal scroll pills */
.sidebar-date-nav {
    display: flex;
    align-items: center;
    gap: 3px;
}
.sidebar-date-nav .date-pills {
    display: flex;
    gap: 2px;
    flex-wrap: wrap;
    flex: 1;
    padding: 1px 0;
}
.sidebar-date-nav .date-pill {
    padding: 4px 8px;
    font-size: 0.7rem;
    min-width: 42px;
}
.sidebar-date-nav .date-pill .dp-num { font-size: 0.82rem; }
.sidebar-date-nav .date-arrow { width: 28px; height: 28px; flex-shrink: 0; }

/* Sport chips in sidebar — wrap */
.sidebar .filter-chip-group {
    flex-wrap: wrap;
    gap: 4px;
}
.sidebar .filter-chip { font-size: 0.68rem; padding: 3px 8px; }

/* Search in sidebar */
.sidebar-search {
    width: 100% !important;
}
.sidebar-search .search-input { width: 100%; font-size: 0.78rem; }

/* Select dropdowns in sidebar */
.sidebar-select {
    width: 100%;
    margin-bottom: 6px;
    font-size: 0.78rem;
}
.sidebar-select:last-child { margin-bottom: 0; }

/* Bottom: admin + logout */
.sidebar-bottom {
    margin-top: auto;
    padding: 12px 14px;
    border-top: 1px solid var(--border-1);
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.sidebar-admin-link {
    display: flex; align-items: center; gap: 7px;
    padding: 8px 12px; border-radius: var(--r-sm);
    background: rgba(168,85,247,0.08);
    border: 1px solid rgba(168,85,247,0.2);
    color: var(--purple);
    text-decoration: none;
    font-size: 0.78rem; font-weight: 700;
    transition: all 0.15s var(--ease);
}
.sidebar-admin-link:hover { background: rgba(168,85,247,0.18); border-color: rgba(168,85,247,0.4); }
.sidebar-admin-link:focus { outline: 2px solid var(--purple); outline-offset: 2px; }
.sidebar-logout {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 12px; border-radius: var(--r-sm);
    background: none;
    border: 1px solid var(--border-1);
    color: var(--text-3);
    font-family: inherit; font-size: 0.78rem; font-weight: 600;
    cursor: pointer; width: 100%;
    transition: all 0.15s var(--ease);
}
.sidebar-logout:hover { color: var(--red); background: var(--red-dim); border-color: rgba(239,68,68,0.3); }
.sidebar-logout:focus { outline: 2px solid var(--red); outline-offset: 2px; }

/* ===== SIDEBAR TOGGLE BUTTON ===== */
/* Tab that sticks out from the left edge — center of screen vertically */
.sidebar-toggle {
    position: fixed;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    z-index: 165;
    background: var(--bg-3);
    border: 1px solid var(--border-2);
    border-left: none;
    border-radius: 0 8px 8px 0;
    color: var(--text-3);
    width: 18px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    transition: background 0.15s var(--ease), color 0.15s var(--ease),
                left 0.28s var(--ease), width 0.15s var(--ease),
                box-shadow 0.15s var(--ease);
    /* On hover: widen slightly */
}
.sidebar-toggle:hover {
    background: var(--bg-4);
    color: var(--text-1);
    width: 22px;
    box-shadow: 2px 0 12px rgba(0,0,0,0.4);
}
.sidebar-toggle:focus { outline: 2px solid var(--blue); outline-offset: 2px; }
/* When sidebar is open: button sits at the right edge of sidebar */
.sidebar-open .sidebar-toggle {
    left: var(--sidebar-w);
}
/* Arrow icon rotates when sidebar is open */
.sidebar-toggle svg {
    transition: transform 0.28s var(--ease);
    flex-shrink: 0;
}
.sidebar-open .sidebar-toggle svg {
    transform: rotate(180deg);
}

/* ===== SIDEBAR BACKDROP (mobile/TV overlay) ===== */
.sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    z-index: 155;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.28s var(--ease);
}
.sidebar-backdrop.visible {
    opacity: 1;
    pointer-events: all;
}

/* ===== APP CONTENT AREA ===== */
.app-content {
    padding-top: var(--info-bar-h);
    transition: margin-left 0.28s var(--ease);
    min-height: 100vh;
    position: relative;
    z-index: 1;
}
/* Push content right on desktop when sidebar opens */
.app-content.pushed {
    margin-left: var(--sidebar-w);
}

/* ===== MAIN CONTENT (sidebar layout override) ===== */
.app-content .main {
    max-width: 1480px;
    margin: 0 auto;
    padding: 16px 20px 48px;
}

/* ===== RESPONSIVE ===== */

/* On desktop: push mode, toggle always visible but subtle */
@media (min-width: 901px) {
    .sidebar-toggle {
        /* Slightly taller on desktop for easier hover target */
        height: 56px;
    }
}

/* On mobile/tablet: overlay mode, no push */
@media (max-width: 900px) {
    .app-content.pushed {
        margin-left: 0;
    }
    .sidebar-toggle {
        /* On mobile: slightly wider for touch */
        width: 20px;
        height: 56px;
    }
    .sidebar-toggle:hover {
        width: 24px;
    }
    .top-info-bar .user-meta .user-tag:not(.user-tag-expiry):not(.user-tag-level) {
        display: none;
    }
}

@media (max-width: 640px) {
    .top-info-inner { padding: 0 10px; gap: 6px; }
    .top-info-bar .user-name { font-size: 0.68rem; }
    .top-info-bar .user-tag { font-size: 0.62rem; padding: 1px 5px; }
    /* Modal stays as bottom sheet — already handled */
    .modal { align-items: flex-end; padding: 0; }
    .modal-sheet {
        width: 100%; max-width: 100%;
        border-radius: 16px 16px 0 0;
        max-height: 90vh;
        animation: modalSlideUp 0.25s var(--ease);
    }
}

/* ===== FINISHED EVENTS TOGGLE ===== */
.sidebar-toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    padding: 2px 0;
    gap: 10px;
}
.sidebar-toggle-label {
    font-size: 0.78rem;
    color: var(--text-2);
    font-weight: 500;
    user-select: none;
}
.sidebar-switch {
    position: relative;
    width: 36px;
    height: 20px;
    background: var(--bg-4);
    border: 1px solid var(--border-2);
    border-radius: 10px;
    flex-shrink: 0;
    cursor: pointer;
    transition: background 0.2s var(--ease), border-color 0.2s var(--ease);
    outline: none;
}
.sidebar-switch:focus { outline: 2px solid var(--blue); outline-offset: 2px; }
.sidebar-switch.on {
    background: var(--blue);
    border-color: var(--blue);
}
.sidebar-switch-thumb {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 14px;
    height: 14px;
    background: var(--text-3);
    border-radius: 50%;
    transition: transform 0.2s var(--ease), background 0.2s var(--ease);
}
.sidebar-switch.on .sidebar-switch-thumb {
    transform: translateX(16px);
    background: #fff;
}

/* ===== TV / D-PAD FOCUS STYLES ===== */
/* Make focus rings more visible for TV navigation */
@media (hover: none) and (pointer: coarse) {
    .sidebar-toggle { width: 24px; height: 64px; }
    .ev-card:focus {
        outline: 3px solid var(--blue);
        outline-offset: 3px;
    }
    .date-pill:focus, .filter-chip:focus {
        outline: 3px solid var(--blue);
        outline-offset: 3px;
    }
    .modal-ch-playable:focus {
        outline: 3px solid var(--green);
        outline-offset: 3px;
        background: var(--bg-4);
        border-color: var(--green);
    }
    .quality-btn:focus {
        outline: 3px solid var(--blue);
        outline-offset: 3px;
        background: var(--bg-4);
        border-color: var(--blue);
    }
}
