/* ==================== RESET ==================== */
*, *::before, *::after {
    margin: 0; padding: 0; box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

:root {
    --bg: #000000;
    --surface: rgba(255,255,255,0.04);
    --surface-hover: rgba(255,255,255,0.08);
    --surface-active: rgba(255,255,255,0.12);
    --glass: rgba(28,28,30,0.8);
    --glass-border: rgba(255,255,255,0.08);
    --glass-border-hover: rgba(255,255,255,0.15);
    --accent: #0A84FF;
    --accent-soft: rgba(10,132,255,0.12);
    --accent-text: #64D2FF;
    --green: #30D158;
    --green-soft: rgba(48,209,88,0.12);
    --orange: #FF9F0A;
    --red: #FF453A;
    --text: #F5F5F7;
    --text-secondary: rgba(245,245,247,0.6);
    --text-tertiary: rgba(245,245,247,0.3);
    --text-quaternary: rgba(245,245,247,0.18);
    --divider: rgba(255,255,255,0.06);
    --radius-xl: 20px;
    --radius-lg: 16px;
    --radius-md: 12px;
    --radius-sm: 8px;
    --ease: cubic-bezier(0.25, 0.46, 0.45, 0.94);
    --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --smooth: cubic-bezier(0.16, 1, 0.3, 1);
    --safe-top: env(safe-area-inset-top, 0px);
}

html { font-size: 16px; }

body {
    font-family: -apple-system, 'SF Pro Display', 'Inter', 'Helvetica Neue', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100dvh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ==================== AMBIENT BACKGROUND ==================== */
.ambient-bg {
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
}

.glow {
    position: absolute;
    border-radius: 50%;
    filter: blur(150px);
    opacity: 0.15;
    will-change: transform;
}

.glow-1 {
    width: 600px; height: 600px;
    background: #0A84FF;
    top: -20%; left: -20%;
    animation: drift1 25s ease-in-out infinite;
}

.glow-2 {
    width: 500px; height: 500px;
    background: #BF5AF2;
    bottom: -15%; right: -15%;
    animation: drift2 30s ease-in-out infinite;
}

.glow-3 {
    width: 400px; height: 400px;
    background: #64D2FF;
    top: 40%; left: 50%;
    animation: drift3 22s ease-in-out infinite;
}

@keyframes drift1 {
    0%, 100% { transform: translate(0, 0); }
    33% { transform: translate(100px, 80px); }
    66% { transform: translate(-40px, 120px); }
}
@keyframes drift2 {
    0%, 100% { transform: translate(0, 0); }
    33% { transform: translate(-80px, -60px); }
    66% { transform: translate(50px, -100px); }
}
@keyframes drift3 {
    0%, 100% { transform: translate(0, 0); }
    50% { transform: translate(-100px, 60px); }
}

/* ==================== NAVBAR ==================== */
.navbar {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    padding: 0 16px;
    height: 52px;
    padding-top: var(--safe-top);
    background: rgba(0,0,0,0.72);
    backdrop-filter: blur(40px) saturate(180%);
    -webkit-backdrop-filter: blur(40px) saturate(180%);
    border-bottom: 0.5px solid var(--divider);
    transition: transform 0.35s var(--smooth), opacity 0.35s var(--smooth);
}

.navbar.hide {
    transform: translateY(-100%);
    opacity: 0;
    pointer-events: none;
}

.nav-back {
    display: flex;
    align-items: center;
    gap: 4px;
    background: none;
    border: none;
    color: var(--accent);
    font-size: 17px;
    font-family: inherit;
    cursor: pointer;
    padding: 8px 4px 8px 0;
    flex-shrink: 0;
    transition: opacity 0.2s;
}

.nav-back:active { opacity: 0.5; }
.nav-back.hide { display: none; }

.nav-center {
    flex: 1;
    text-align: center;
    min-width: 0;
    overflow: hidden;
}

.nav-title {
    font-size: 17px;
    font-weight: 600;
    letter-spacing: -0.2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nav-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
    min-width: 70px;
    justify-content: flex-end;
}

.nav-sort {
    display: flex;
    align-items: center;
    gap: 4px;
    background: none;
    border: none;
    color: var(--accent);
    font-size: 13px;
    font-family: inherit;
    font-weight: 500;
    cursor: pointer;
    padding: 6px 8px;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
}

.nav-sort:active { opacity: 0.5; }
.nav-sort.hide { display: none; }

/* ==================== MAIN ==================== */
main {
    position: relative;
    z-index: 1;
    max-width: 680px;
    margin: 0 auto;
    padding: 16px;
    padding-bottom: 60px;
    min-height: 100dvh;
}

.has-navbar {
    padding-top: calc(52px + var(--safe-top) + 12px);
}

/* ==================== LOADER ==================== */
.loader {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 160px 0;
}

.loader-ring {
    width: 28px; height: 28px;
    border: 2.5px solid var(--text-quaternary);
    border-top-color: var(--text-secondary);
    border-radius: 50%;
    animation: spin 0.65s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ==================== PAGE TRANSITIONS ==================== */
.page-in {
    animation: fadeUp 0.5s var(--smooth) both;
}

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

/* Stagger children */
.stagger { opacity: 0; animation: fadeUp 0.45s var(--smooth) forwards; }

/* ==================== HOME PAGE ==================== */
.home {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 92dvh;
    padding: 40px 0;
}

.hero {
    text-align: center;
    margin-bottom: 56px;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: var(--accent-soft);
    border: 1px solid rgba(10,132,255,0.2);
    border-radius: 100px;
    font-size: 12px;
    font-weight: 600;
    color: var(--accent-text);
    letter-spacing: 0.3px;
    margin-bottom: 24px;
}

.hero-dot {
    width: 6px; height: 6px;
    background: var(--green);
    border-radius: 50%;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.85); }
}

.hero h1 {
    font-size: 52px;
    font-weight: 800;
    letter-spacing: -2.5px;
    line-height: 1;
    margin-bottom: 12px;
    background: linear-gradient(180deg, #FFFFFF 0%, rgba(255,255,255,0.5) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero p {
    font-size: 17px;
    color: var(--text-secondary);
    line-height: 1.5;
    max-width: 320px;
    margin: 0 auto;
}

/* Home action buttons */
.home-actions {
    width: 100%;
    max-width: 400px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.action-btn {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 18px 20px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--glass-border);
    background: var(--glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    cursor: pointer;
    transition: all 0.3s var(--ease);
    text-decoration: none;
    color: inherit;
    user-select: none;
    position: relative;
    overflow: hidden;
}

.action-btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.05) 0%, transparent 50%);
    opacity: 0;
    transition: opacity 0.3s;
}

.action-btn:active {
    transform: scale(0.97);
    background: var(--surface-active);
}

.action-btn:active::after { opacity: 1; }

.action-btn.primary {
    background: linear-gradient(135deg, rgba(10,132,255,0.15), rgba(10,132,255,0.05));
    border-color: rgba(10,132,255,0.25);
}

.action-btn.disabled {
    opacity: 0.35;
    cursor: default;
    pointer-events: none;
}

.action-icon {
    width: 44px; height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
    background: var(--surface);
}

.action-btn.primary .action-icon {
    background: var(--accent-soft);
}

.action-body { flex: 1; min-width: 0; }

.action-title {
    font-size: 16px;
    font-weight: 600;
    letter-spacing: -0.2px;
}

.action-desc {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.action-chevron {
    color: var(--text-tertiary);
    flex-shrink: 0;
    transition: transform 0.2s;
}

.action-btn:active .action-chevron {
    transform: translateX(2px);
}

/* ==================== STATS BAR ==================== */
.stats-bar {
    display: flex;
    gap: 1px;
    background: var(--divider);
    border-radius: var(--radius-md);
    overflow: hidden;
    margin-bottom: 20px;
}

.stat {
    flex: 1;
    background: rgba(28,28,30,0.6);
    padding: 16px 12px;
    text-align: center;
}

.stat:first-child { border-radius: var(--radius-md) 0 0 var(--radius-md); }
.stat:last-child { border-radius: 0 var(--radius-md) var(--radius-md) 0; }

.stat-val {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.5px;
    color: #fff;
}

.stat-lbl {
    font-size: 11px;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-top: 2px;
    font-weight: 500;
}

/* ==================== SEARCH BAR ==================== */
.search-bar {
    position: relative;
    margin-bottom: 16px;
}

.search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-tertiary);
    pointer-events: none;
}

.search-input {
    width: 100%;
    background: rgba(28,28,30,0.8);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: 12px 14px 12px 42px;
    font-size: 16px;
    font-family: inherit;
    color: var(--text);
    outline: none;
    transition: all 0.25s var(--ease);
}

.search-input:focus {
    border-color: rgba(10,132,255,0.4);
    background: rgba(28,28,30,1);
    box-shadow: 0 0 0 3px rgba(10,132,255,0.1);
}

.search-input::placeholder {
    color: var(--text-quaternary);
}

/* ==================== SPORT LIST ==================== */
.sport-list {
    display: flex;
    flex-direction: column;
}

.sport-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    margin: 0 -16px;
    cursor: pointer;
    transition: background 0.15s;
    user-select: none;
    position: relative;
}

.sport-item:active {
    background: var(--surface-hover);
}

.sport-item + .sport-item {
    border-top: 0.5px solid var(--divider);
}

.sport-emoji {
    font-size: 28px;
    width: 40px;
    text-align: center;
    flex-shrink: 0;
}

.sport-info {
    flex: 1;
    min-width: 0;
}

.sport-name {
    font-size: 17px;
    font-weight: 600;
    color: #fff;
    letter-spacing: -0.2px;
}

.sport-count {
    font-size: 13px;
    color: var(--text-tertiary);
    margin-top: 1px;
}

.sport-chevron {
    color: var(--text-quaternary);
    flex-shrink: 0;
}

/* Live indicator on sport */
.sport-live {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: var(--green);
    font-weight: 600;
}

.sport-live-dot {
    width: 5px; height: 5px;
    background: var(--green);
    border-radius: 50%;
    animation: pulse 2s ease-in-out infinite;
}

/* ==================== SECTION HEADERS ==================== */
.section-hdr {
    padding: 24px 0 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: -0.1px;
}

.section-hdr:first-child { padding-top: 8px; }

/* ==================== CATEGORY / LEAGUE LIST ==================== */
.cat-list {
    background: rgba(28,28,30,0.6);
    border-radius: var(--radius-md);
    border: 0.5px solid var(--divider);
    overflow: hidden;
    margin-bottom: 12px;
}

.cat-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 13px 16px;
    cursor: pointer;
    transition: background 0.15s;
    user-select: none;
}

.cat-item:active { background: var(--surface-hover); }

.cat-item + .cat-item {
    border-top: 0.5px solid var(--divider);
}

.cat-item-left {
    flex: 1;
    min-width: 0;
}

.cat-name {
    font-size: 16px;
    font-weight: 500;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

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

.cat-badge {
    font-size: 13px;
    color: var(--text-tertiary);
    font-weight: 500;
    font-variant-numeric: tabular-nums;
}

/* ==================== VIEW TOGGLE (Leagues / Teams) ==================== */
.seg-control {
    display: flex;
    background: rgba(28,28,30,0.8);
    border-radius: 9px;
    padding: 2px;
    margin-bottom: 16px;
    border: 0.5px solid var(--divider);
}

.seg-btn {
    flex: 1;
    padding: 8px 16px;
    text-align: center;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    color: var(--text-secondary);
    background: none;
    border: none;
    border-radius: 7px;
    cursor: pointer;
    transition: all 0.2s var(--ease);
    user-select: none;
}

.seg-btn.active {
    background: rgba(255,255,255,0.12);
    color: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.seg-btn:active { transform: scale(0.96); }

/* ==================== FIXTURES ==================== */
.fixture-count {
    text-align: center;
    padding: 4px 0 16px;
    font-size: 13px;
    color: var(--text-tertiary);
}

.fixture-count strong {
    color: var(--text-secondary);
    font-weight: 600;
}

.fixture-list {
    background: rgba(28,28,30,0.6);
    border-radius: var(--radius-md);
    border: 0.5px solid var(--divider);
    overflow: hidden;
}

.fixture-row {
    padding: 13px 16px;
    font-size: 15px;
    color: var(--text);
    line-height: 1.45;
    word-break: break-word;
    transition: background 0.15s;
}

.fixture-row + .fixture-row {
    border-top: 0.5px solid var(--divider);
}

.fixture-row:active { background: var(--surface-hover); }

/* Fixture number styling */
.fx-num {
    color: var(--text-quaternary);
    font-variant-numeric: tabular-nums;
    font-weight: 500;
    margin-right: 6px;
}

/* ==================== TEAM SEARCH RESULTS ==================== */
.team-result {
    padding: 14px 16px;
    border-top: 0.5px solid var(--divider);
}

.team-result:first-child { border-top: none; }

.team-league {
    font-size: 11px;
    font-weight: 600;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.team-fixture {
    font-size: 15px;
    color: var(--text);
    line-height: 1.4;
}

/* ==================== EMPTY STATE ==================== */
.empty-state {
    text-align: center;
    padding: 60px 24px;
    color: var(--text-tertiary);
}

.empty-state .icon { font-size: 36px; margin-bottom: 12px; opacity: 0.5; }
.empty-state p { font-size: 15px; line-height: 1.6; }

/* ==================== RESPONSIVE ==================== */
@media (min-width: 768px) {
    main { max-width: 720px; }

    .hero h1 { font-size: 64px; letter-spacing: -3px; }
    .hero p { font-size: 19px; }
    .home-actions { max-width: 460px; }
    .action-btn { padding: 20px 24px; }

    .sport-item { padding: 16px 20px; margin: 0 -20px; }
    .sport-emoji { font-size: 32px; }
    .sport-name { font-size: 18px; }
}

/* ==================== SCROLLBAR ==================== */
::-webkit-scrollbar { width: 3px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--text-quaternary); border-radius: 3px; }

/* ==================== FALLBACK ==================== */
/* ==================== EVENT CARDS ==================== */
.event-card {
    background: rgba(28,28,30,0.6);
    border: 0.5px solid var(--divider);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-bottom: 10px;
    transition: background 0.15s;
}

.event-card:active { background: var(--surface-hover); }

.event-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.event-title {
    font-size: 16px;
    font-weight: 600;
    color: #fff;
    letter-spacing: -0.2px;
    line-height: 1.35;
}

.event-live {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    font-weight: 700;
    color: var(--green);
    letter-spacing: 0.5px;
    flex-shrink: 0;
    padding: 2px 8px;
    background: var(--green-soft);
    border-radius: 100px;
}

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

.event-date {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.event-status {
    font-size: 12px;
    color: var(--text-tertiary);
    margin-top: 2px;
}

.event-broadcasts {
    margin-top: 10px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

.broadcast-label {
    font-size: 12px;
    color: var(--text-tertiary);
    font-weight: 500;
}

.broadcast-tag {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    background: rgba(255,255,255,0.06);
    padding: 3px 8px;
    border-radius: 6px;
    border: 0.5px solid var(--divider);
}

.event-pioneer {
    margin-top: 8px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

.pioneer-label {
    font-size: 12px;
    color: var(--accent);
    font-weight: 600;
}

.pioneer-tag {
    font-size: 11px;
    font-weight: 500;
    color: var(--accent-text);
    background: var(--accent-soft);
    padding: 3px 8px;
    border-radius: 6px;
    border: 0.5px solid rgba(10,132,255,0.2);
}

.pioneer-more {
    font-size: 11px;
    color: var(--text-tertiary);
}

/* ==================== FALLBACK ==================== */
@supports not (backdrop-filter: blur(8px)) {
    .navbar { background: rgba(0,0,0,0.95); }
    .action-btn, .cat-list, .fixture-list, .event-card { backdrop-filter: none; }
}
