:root {
    --brand: #006B3F;
    --brand-dark: #004D2C;
    --brand-light: #E8F5E9;
    --win: #006B3F;
    --loss: #9B1C1C;
    --draw: #555555;
    --live: #FF1744;
    --bg: #FAFAFA;
    --bg-card: #FFFFFF;
    --text: #1A1A1A;
    --text-secondary: #666666;
    --text-muted: #555555;
    --gold: #FFD700;
    --shadow: 0 4px 20px rgba(0,107,63,0.1);
    --shadow-dark: 0 4px 20px rgba(0,0,0,0.15);
    --radius: 16px;

    /* Competition colors */
    --comp-bsa: #006B3F;
    --comp-cli: #DAA520;
    --comp-copa: #1E88E5;
    --comp-other: #9E9E9E;

    /* Dark mode defaults (overridden by .dark class) */
    --bg-dark: #1A1A2E;
    --bg-card-dark: #16213E;
    --text-dark: #E8E8E8;
    --text-secondary-dark: #B0B0B0;
    --text-muted-dark: #707070;
    --brand-light-dark: #0F3D2B;
    --shadow-dark-mode: 0 4px 20px rgba(0,0,0,0.3);
}

/* Dark theme */
body.dark {
    --bg: var(--bg-dark);
    --bg-card: var(--bg-card-dark);
    --text: var(--text-dark);
    --text-secondary: var(--text-secondary-dark);
    --text-muted: var(--text-muted-dark);
    --shadow: var(--shadow-dark-mode);
    --brand-light: var(--brand-light-dark);
    background: linear-gradient(135deg, #1A1A2E 0%, #16213E 100%);
}

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

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.skip-link {
    position: fixed;
    top: 0.75rem;
    left: 0.75rem;
    z-index: 2000;
    transform: translateY(-150%);
    background: var(--brand-dark);
    color: white;
    padding: 0.65rem 0.9rem;
    border-radius: 8px;
    font-weight: 700;
    text-decoration: none;
    transition: transform 0.2s ease;
}
.skip-link:focus-visible { transform: translateY(0); }

button { font: inherit; }

#main-content:focus { outline: none; }

body {
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    padding-bottom: 2rem;
    transition: background 0.3s ease, color 0.3s ease;
}

/* Theme toggle */
.theme-toggle {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 1000;
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    width: 44px;
    height: 44px;
    cursor: pointer;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    backdrop-filter: blur(8px);
}
.theme-toggle:hover {
    background: rgba(255,255,255,0.25);
    transform: scale(1.1);
}
body.dark .theme-toggle {
    background: rgba(0,0,0,0.3);
    border-color: rgba(255,255,255,0.15);
}

/* Header */
.header {
    background: linear-gradient(135deg, var(--brand), var(--brand-dark));
    padding: 1.5rem 1.5rem 2rem;
    text-align: center;
}
.header-content { display: inline-flex; align-items: center; gap: 1rem; text-align: left; }
.logo {
    width: 80px; height: 80px;
    background: white; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}
.header-text h1 { font-size: 1.5rem; color: white; font-weight: 800; letter-spacing: -0.02em; }
.header-text .subtitle { color: rgba(255,255,255,0.8); font-size: 0.8rem; }
.refresh-btn {
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 8px;
    padding: 0.35rem 0.6rem;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    margin-left: auto;
}
.refresh-btn:hover { background: rgba(255,255,255,0.15); }
.refresh-btn:hover .refresh-icon { animation: spin-once 0.4s ease; display: inline-block; }

.container { max-width: 900px; margin: -1.5rem auto 0; padding: 0 1rem; }

/* Default (mobile): single column */
.main-layout {
    display: contents; /* Let children flow normally on mobile */
}

.main-content {
    display: block;
}

/* ============================================
   HERO — Next match + Countdown + Form
   ============================================ */
.hero-hub {
    background: linear-gradient(145deg, #006B3F 0%, #003D22 60%, #00261A 100%);
    border-radius: var(--radius);
    color: white;
    margin-bottom: 0.75rem;
    box-shadow: 0 8px 32px rgba(0,60,30,0.35);
    overflow: hidden;
    position: relative;
}
/* Subtle texture overlay */
.hero-hub::before {
    content: '';
    position: absolute; inset: 0;
    background: radial-gradient(circle at 30% 20%, rgba(255,255,255,0.06) 0%, transparent 60%),
                radial-gradient(circle at 80% 80%, rgba(255,255,255,0.03) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}
.hero-hub > * { position: relative; z-index: 1; }

/* Match Card */
.hero-card {
    padding: 1.75rem 1.5rem 1rem;
    text-align: center;
}
.hero-card.live {
    box-shadow: inset 0 0 0 3px var(--live);
    animation: livePulse 2s ease-in-out infinite;
    background: linear-gradient(135deg, rgba(255,23,68,0.08) 0%, transparent 50%);
}
@keyframes livePulse {
    0%, 100% { box-shadow: inset 0 0 0 3px var(--live); }
    50% { box-shadow: inset 0 0 0 5px var(--live), 0 0 24px rgba(255,23,68,0.25); }
}

.hero-comp {
    display: inline-block;
    background: rgba(255,255,255,0.15);
    padding: 0.25rem 0.9rem; border-radius: 20px;
    font-size: 0.75rem; font-weight: 700;
    letter-spacing: 0.04em; text-transform: uppercase;
    margin-bottom: 1.25rem;
}
.hero-teams { display: flex; justify-content: space-around; align-items: center; }
.hero-team { flex: 1; text-align: center; }
.hero-team img { width: 64px; height: 64px; object-fit: contain; filter: drop-shadow(0 2px 8px rgba(0,0,0,0.2)); }
.hero-team-name { font-size: 1rem; font-weight: 700; margin-top: 0.6rem; letter-spacing: -0.01em; }
.hero-center-score { display: flex; flex-direction: column; align-items: center; gap: 0.3rem; min-width: 70px; }
.hero-vs { font-size: 1.6rem; font-weight: 800; opacity: 0.6; }
.hero-score {
    font-size: 3rem; font-weight: 800; letter-spacing: 0.08em;
    font-variant-numeric: tabular-nums; line-height: 1;
}
.hero-score.live-score { animation: scorePulse 3s ease-in-out infinite; }
.hero-score .score-sep { opacity: 0.5; margin: 0 0.1em; }
@keyframes scorePulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.85; text-shadow: 0 0 20px rgba(255,255,255,0.3); }
}
.hero-minute {
    display: inline-block; background: rgba(255,255,255,0.18);
    padding: 0.2rem 0.7rem; border-radius: 10px;
    font-size: 0.8rem; font-weight: 700;
}
.hero-ht { font-size: 0.7rem; opacity: 0.55; margin-top: 0.15rem; }

/* Meta row — date + pills in one line */
.hero-meta {
    display: flex; flex-wrap: wrap; align-items: center;
    justify-content: center; gap: 0.4rem;
    margin-top: 1.25rem; padding-top: 0.85rem;
    border-top: 1px solid rgba(255,255,255,0.1);
    font-size: 0.78rem;
}
.hero-meta-date { font-weight: 600; white-space: nowrap; }
.hero-meta-sep { opacity: 0.3; font-weight: 300; }
.hero-meta-pill {
    background: rgba(255,255,255,0.1);
    padding: 0.2rem 0.55rem; border-radius: 10px;
    white-space: nowrap; font-size: 0.72rem;
}

/* Live dot */
.live-dot {
    display: inline-block; width: 7px; height: 7px;
    background: var(--live); border-radius: 50%;
    margin-right: 5px; animation: dotPulse 1.5s ease-in-out infinite;
    vertical-align: middle;
}
@keyframes dotPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(1.4); }
}

/* Bottom bar */
.hero-bottom {
    display: flex; align-items: center; justify-content: center;
    gap: 1.5rem;
    padding: 0.6rem 1.5rem 0.8rem;
    background: rgba(0,0,0,0.15);
    border-top: 1px solid rgba(255,255,255,0.06);
}

/* Countdown */
.hero-countdown { text-align: center; }
.countdown-label {
    font-size: 0.6rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.12em;
    opacity: 0.5; margin-bottom: 0.25rem;
}
.countdown-digits {
    display: flex; align-items: center; justify-content: center; gap: 0.15rem;
}
.cd-unit { display: flex; flex-direction: column; align-items: center; min-width: 36px; }
.cd-val {
    font-size: 1.2rem; font-weight: 800;
    font-variant-numeric: tabular-nums; line-height: 1;
}
.cd-lbl { font-size: 0.5rem; text-transform: uppercase; letter-spacing: 0.06em; opacity: 0.4; margin-top: 1px; }
.cd-sep { font-size: 1rem; font-weight: 700; opacity: 0.25; align-self: flex-start; padding-top: 0.1rem; }

/* Form Widget */
.form-widget {
    display: flex; align-items: center; gap: 0.5rem;
    padding-left: 1.25rem;
    border-left: 1px solid rgba(255,255,255,0.1);
}
.form-label {
    font-size: 0.6rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.06em;
    opacity: 0.45;
}
.form-dots { display: flex; gap: 0.3rem; }
.form-dot {
    display: inline-flex; align-items: center; justify-content: center;
    width: 26px; height: 26px; border-radius: 6px;
    font-size: 0.65rem; font-weight: 800;
    letter-spacing: 0.02em;
}
.form-dot.win { background: rgba(255,255,255,0.15); color: #4ade80; box-shadow: inset 0 0 0 1.5px rgba(74,222,128,0.35); }
.form-dot.loss { background: rgba(255,255,255,0.15); color: #f87171; box-shadow: inset 0 0 0 1.5px rgba(248,113,113,0.35); }
.form-dot.draw { background: rgba(255,255,255,0.1); color: rgba(255,255,255,0.5); box-shadow: inset 0 0 0 1.5px rgba(255,255,255,0.15); }

/* ============================================
   COMPETITION LEGEND (inside Próximos tab)
   ============================================ */
.comp-legend {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
    padding: 0.6rem 0.75rem;
    background: var(--bg);
    border-radius: 12px;
    border: 1px solid rgba(0,0,0,0.06);
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.03);
}
.comp-legend-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.75rem;
    border-radius: 22px;
    cursor: pointer;
    transition: all 0.22s ease;
    border: 1.5px solid rgba(0,0,0,0.08);
    font-size: 0.78rem;
    font-weight: 600;
    background: var(--bg-card);
    color: var(--text-secondary);
    appearance: none;
    -webkit-appearance: none;
}
.comp-legend-item:hover {
    background: var(--brand-light);
    border-color: var(--brand);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0,107,63,0.12);
}
.comp-legend-item.active {
    background: var(--brand);
    color: white;
    border-color: var(--brand);
    box-shadow: 0 2px 10px rgba(0,107,63,0.3), 0 1px 2px rgba(0,0,0,0.1);
    transform: translateY(-1px);
}
.comp-legend-item.active .comp-legend-label { color: white; }
.comp-legend-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    flex-shrink: 0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
    border: 1px solid rgba(255,255,255,0.3);
}
.comp-legend-label {
    color: var(--text-secondary);
    transition: color 0.2s;
    letter-spacing: 0.01em;
}
.comp-legend-item.active .comp-legend-label {
    color: rgba(255,255,255,0.95);
}

/* Dark mode overrides */
body.dark .comp-legend {
    border-color: rgba(255,255,255,0.1);
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.2);
}

/* Dark mode hub overrides */
body.dark .hero-hub {
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}
body.dark .form-dot.win { color: #86efac; box-shadow: inset 0 0 0 2px rgba(134,239,172,0.5); }
body.dark .form-dot.loss { color: #fca5a5; box-shadow: inset 0 0 0 2px rgba(252,165,165,0.4); }
body.dark .form-dot.draw { color: rgba(255,255,255,0.6); box-shadow: inset 0 0 0 2px rgba(255,255,255,0.15); }

/* Mobile overrides for Hub */
/* Tabs */
.info-icon { font-size: 1.3rem; }
.info-label { font-size: 0.7rem; color: var(--text-muted); text-transform: uppercase; }
.info-value { font-size: 0.9rem; font-weight: 600; }

/* Cards */
.card {
    background: var(--bg-card); border-radius: var(--radius);
    padding: 1.5rem; margin-bottom: 1rem; box-shadow: var(--shadow);
    transition: background 0.3s ease, box-shadow 0.3s ease;
}
.card-title {
    color: var(--brand); font-size: 1.1rem; font-weight: 700;
    margin-bottom: 1rem; display: flex; align-items: center; gap: 0.5rem;
}

/* Tabs */
.tabs { display: flex; gap: 0.5rem; margin-bottom: 1rem; flex-wrap: wrap; }
.tab-btn {
    padding: 0.6rem 1rem; background: var(--bg-card); border: none;
    border-radius: 8px; color: var(--text-secondary); cursor: pointer;
    font-size: 0.85rem; font-weight: 600; box-shadow: var(--shadow);
    transition: all 0.25s ease;
}
.tab-btn:hover { background: var(--brand-light); }
.tab-btn.active { background: var(--brand); color: white; }
.tab-content {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.4s ease, opacity 0.3s ease;
}
.tab-content.active {
    max-height: 10000px;
    opacity: 1;
}

/* Competition Filters */
.comp-filters {
    display: flex; gap: 0.5rem; flex-wrap: wrap;
    margin-bottom: 1rem;
}
.comp-filter {
    padding: 0.4rem 0.9rem; background: var(--bg); border: 1px solid var(--brand);
    border-radius: 20px; color: var(--brand); cursor: pointer;
    font-size: 0.8rem; font-weight: 600;
    transition: all 0.2s ease;
}
.comp-filter:hover { background: var(--brand-light); }
.comp-filter.active {
    background: var(--brand); color: white;
}

/* Match Items */
.match-item {
    padding: 1rem; background: var(--bg); border-radius: 8px;
    margin-bottom: 0.75rem; border-left: 4px solid var(--brand);
    cursor: pointer; transition: all 0.2s ease;
}
.match-item:hover { background: var(--brand-light); }
.match-item.win { border-left-color: var(--win); }
.match-item.loss { border-left-color: var(--loss); }
.match-item.draw { border-left-color: var(--draw); }

.match-header { display: flex; justify-content: space-between; margin-bottom: 0.5rem; font-size: 0.8rem; color: var(--text-muted); }
.match-teams { display: flex; justify-content: space-between; align-items: center; font-weight: 500; }

.match-score-badge {
    background: var(--brand);
    color: white;
    padding: 0.2rem 0.6rem;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    white-space: nowrap;
}
.match-score-badge.live {
    background: var(--live);
    animation: badgePulse 2s ease-in-out infinite;
}
@keyframes badgePulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255,23,68,0.4); }
    50% { box-shadow: 0 0 0 4px rgba(255,23,68,0.15); }
}
.live-minute {
    display: inline-block;
    background: rgba(255,23,68,0.15);
    color: var(--live);
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 700;
    margin-left: 6px;
    white-space: nowrap;
}
.match-extra {
    max-height: 0; overflow: hidden; padding: 0 0.75rem;
    background: var(--brand); border-radius: 8px;
    margin-top: 0.75rem; color: white;
    transition: max-height 0.3s ease-out, padding 0.3s ease-out;
}
.match-extra.open {
    max-height: 400px; padding: 0.75rem;
}
.match-extra-row {
    display: flex; align-items: center; gap: 0.5rem;
    margin: 0.3rem 0; font-size: 0.8rem;
}
.match-extra-row .icon { font-size: 1rem; }

.result-badge {
    padding: 0.2rem 0.6rem; border-radius: 4px;
    font-size: 0.75rem; font-weight: 700;
}
.result-badge.win { background: rgba(0,107,63,0.15); color: var(--win); }
.result-badge.loss { background: rgba(211,47,47,0.15); color: var(--loss); }
.result-badge.draw { background: rgba(117,117,117,0.15); color: var(--draw); }
.match-score {
    font-size: 1.3rem; font-weight: 800;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.05em;
}
/* Results tab — score-first layout */
.result-highlight {
    padding: 0.25rem 0 0.5rem;
}
.result-highlight .match-score {
    font-size: 1.6rem; font-weight: 800;
    letter-spacing: 0.08em;
}
.result-score-wrap {
    display: flex; align-items: center; gap: 0.6rem;
}
.match-item.win { border-left: 3px solid var(--win); }
.match-item.loss { border-left: 3px solid var(--loss); }
.match-item.draw { border-left: 3px solid var(--draw); }

/* Standings */
.position-badge {
    display: inline-block; background: var(--brand); color: white;
    width: 56px; height: 56px; line-height: 56px;
    border-radius: 50%; font-size: 1.4rem; font-weight: 800;
}
.standings-row {
    display: flex; align-items: center; padding: 0.6rem 0.75rem;
    border-bottom: 1px solid var(--bg); transition: background 0.2s;
}
.standings-row.palmeiras {
    background: rgba(0, 107, 63, 0.15);
    border-left: 3px solid var(--brand);
    border-radius: 8px;
    font-weight: 600;
}
.standings-row .pos { width: 30px; font-weight: 700; color: var(--brand); }
.standings-row .team { flex: 1; font-size: 0.9rem; }
.standings-row .stats { display: flex; gap: 1rem; font-size: 0.8rem; color: var(--text-secondary); }
.standings-row .pts { font-weight: 800; color: var(--brand); }

.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.75rem; margin-top: 1rem; }

/* Standings summary: always 3 columns full width */
#standings .stats-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
}

.stat-box { text-align: center; padding: 0.75rem; background: var(--bg); border-radius: 8px; }
.stat-value { font-size: 1.2rem; font-weight: 700; color: var(--brand); }
.stat-label { font-size: 0.7rem; color: var(--text-muted); }

/* Performance Chart */
.chart-container {
    margin: 1rem 0;
    background: var(--bg);
    border-radius: 12px;
    padding: 1rem;
}
.chart-container canvas {
    max-height: 300px;
}

/* News */
.news-item {
    display: block; padding: 1rem; background: var(--bg); border-radius: 8px;
    margin-bottom: 0.75rem; cursor: pointer; transition: all 0.2s;
    text-decoration: none; color: inherit;
}
.news-item:hover { background: var(--brand-light); transform: translateX(4px); text-decoration: none; }
.news-title { font-weight: 600; font-size: 0.95rem; margin-bottom: 0.25rem; }
.news-meta { font-size: 0.75rem; color: var(--text-muted); }
.news-source { color: var(--brand); font-weight: 600; }

/* Stats */
.stat-row { display: flex; justify-content: space-between; padding: 0.75rem 0; border-bottom: 1px solid var(--bg); transition: background 0.3s ease; }
.stat-row:last-child { border-bottom: none; }
.stat-name { font-weight: 500; }
.stat-number { font-weight: 700; min-width: 40px; text-align: right; }

/* Stats Summary */
.stats-summary { margin-bottom: 1rem; }
.stats-row { display: flex; gap: 1rem; margin-bottom: 0.75rem; }
.stats-col { flex: 1; background: var(--bg); border-radius: 10px; padding: 0.75rem; }
.stats-col-title { font-size: 0.8rem; font-weight: 700; color: var(--brand); margin-bottom: 0.5rem; }
.mini-stats { display: flex; gap: 0.75rem; flex-wrap: wrap; font-size: 0.8rem; color: var(--text-secondary); }
.mini-stats span { white-space: nowrap; }

/* Form Guide */
.form-guide { display: flex; gap: 0.4rem; }
.form-badge {
    display: inline-flex; align-items: center; justify-content: center;
    width: 32px; height: 32px; border-radius: 8px;
    font-size: 0.8rem; font-weight: 800; cursor: default;
}
.form-badge.win { background: rgba(0,107,63,0.15); color: var(--win); }
.form-badge.loss { background: rgba(211,47,47,0.15); color: var(--loss); }
.form-badge.draw { background: rgba(117,117,117,0.15); color: var(--draw); }

/* ================================================
   CALENDAR — Premium FullCalendar-inspired UX
   ================================================ */

/* ============================================
   CALENDAR — LIGHT MINIMAL STYLE
   Clean like Google Calendar / Notion
   ============================================ */

/* Calendar Header */
.cal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 0.75rem;
}
.cal-title {
    color: var(--brand);
    font-size: 1.05rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.cal-title select {
    appearance: none;
    -webkit-appearance: none;
    background: var(--brand);
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 0.25rem 1.6rem 0.25rem 0.6rem;
    font: inherit;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='white' viewBox='0 0 16 16'%3E%3Cpath d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.45rem center;
    background-size: 12px;
    transition: opacity 0.15s;
}
.cal-title select:hover {
    opacity: 0.85;
}
.cal-title select:focus {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
}
/* Dark mode */
body.dark .cal-title select {
    background: var(--bg-card);
    color: var(--text);
    border: 1px solid rgba(255,255,255,0.12);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23999' viewBox='0 0 16 16'%3E%3Cpath d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z'/%3E%3C/svg%3E");
}

/* Calendar Grid */
.calendar-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    gap: 0.5rem;
}
.calendar-nav span {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text);
    min-width: 160px;
    text-align: center;
    letter-spacing: 0.01em;
}
.cal-nav-btn {
    background: transparent;
    color: var(--text-muted);
    border: none;
    border-radius: 6px;
    width: 30px;
    height: 30px;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}
.cal-nav-btn:hover {
    color: var(--text);
    background: rgba(0,0,0,0.05);
}
.cal-nav-btn:active { transform: scale(0.9); }

/* Calendar Grid */

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

.calendar-grid {
    display: grid !important;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    margin-bottom: 0.75rem;
}
.cal-head {
    text-align: center;
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--text-muted);
    padding: 0.25rem 0;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.cal-day {
    appearance: none;
    -webkit-appearance: none;
    aspect-ratio: 1;
    min-height: 50px;
    width: 100%;
    color: inherit;
    background: transparent;
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 4px 2px;
    cursor: pointer;
    transition: all 0.12s ease;
    position: relative;
    border: 1px solid rgba(0,0,0,0.07);
}
.cal-day:hover {
    border-color: rgba(0,0,0,0.18);
    background: rgba(0,0,0,0.02);
}
.cal-day.other-month { opacity: 0.25; border-color: transparent; }
.cal-day.other-month:hover { opacity: 0.35; border-color: transparent; }
.cal-day.today {
    border-color: rgba(0,0,0,0.12);
}
.cal-day.today .cal-day-num {
    background: var(--brand);
    color: #fff;
    font-weight: 700;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 4px;
}
.cal-day.selected {
    border-color: var(--brand);
    background: rgba(0, 107, 63, 0.04);
}
.cal-day.selected .cal-day-num { color: var(--brand); font-weight: 700; }
.cal-day.selected.today .cal-day-num {
    background: var(--brand);
    color: #fff;
}
.cal-day.selected .cal-dots .cal-dot { opacity: 1; }
.cal-day-num {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text);
    line-height: 1;
    margin-bottom: 4px;
    transition: color 0.12s;
}
.cal-dots {
    display: flex;
    gap: 2.5px;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
}
.cal-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
    transition: transform 0.12s;
}
.cal-day:hover .cal-dot { transform: scale(1.15); }
.cal-dot.bsa { background: var(--comp-bsa); }
.cal-dot.cli { background: var(--comp-cli); }
.cal-dot.copa { background: var(--comp-copa); }
.cal-dot.other { background: var(--comp-other); }
.cal-overflow {
    font-size: 0.58rem;
    color: var(--text-muted);
    font-weight: 700;
}

/* Score badges in calendar cells */
.cal-score {
    font-size: 0.6rem;
    font-weight: 700;
    margin-top: 2px;
    padding: 1px 4px;
    border-radius: 3px;
    line-height: 1.2;
    white-space: nowrap;
}
.cal-score.win { background: #d9f4e5; color: #005a35; }
.cal-score.loss { background: #f8dddd; color: #8a1f1f; }
.cal-score.draw { background: #f4f1d9; color: #5f5200; }
.cal-score.live { background: #ffe1e5; color: #9b0000; }
.cal-day.has-match { border-color: rgba(0,0,0,0.12); }
.cal-day.is-live {
    border-color: rgba(255, 60, 60, 0.4);
    background: rgba(255, 60, 60, 0.04);
    animation: livePulse 2s ease-in-out infinite;
}
body.dark .cal-score.win { background: rgba(0, 200, 100, 0.2); color: #4c4; }
body.dark .cal-score.loss { background: rgba(255, 80, 80, 0.2); color: #f66; }
body.dark .cal-score.draw { background: rgba(220, 200, 0, 0.2); color: #cc0; }
body.dark .cal-score.live { background: rgba(255, 80, 80, 0.2); color: #f55; }
body.dark .cal-day.has-match { border-color: rgba(255,255,255,0.1); }
body.dark .cal-day.is-live { border-color: rgba(255, 80, 80, 0.5); background: rgba(255, 80, 80, 0.08); }

/* Expanded Day Detail */
.cal-expanded {
    border-top: 1px solid rgba(0,0,0,0.08);
    padding-top: 0.75rem;
    margin-top: 0.25rem;
    animation: fadeSlideIn 0.2s ease;
}
.cal-expanded-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.6rem;
    gap: 0.5rem;
}
.cal-expanded-date {
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--text);
}
.cal-expanded-btn {
    padding: 0.28rem 0.7rem;
    background: transparent;
    color: var(--brand);
    border: 1.5px solid var(--brand);
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.18s;
}
.cal-expanded-btn:hover {
    background: var(--brand);
    color: white;
}
.cal-match {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.65rem 0.75rem;
    background: transparent;
    border-radius: 8px;
    margin-bottom: 0.4rem;
    font-size: 0.85rem;
    transition: all 0.15s ease;
    border: 1px solid rgba(0,0,0,0.06);
    border-left: 3px solid transparent;
}
.cal-match:hover {
    background: rgba(0,0,0,0.02);
    border-color: rgba(0,0,0,0.12);
}
.cal-match.bsa { border-left-color: var(--comp-bsa); }
.cal-match.cli { border-left-color: var(--comp-cli); }
.cal-match.copa { border-left-color: var(--comp-copa); }
.cal-match.other { border-left-color: var(--comp-other); }
.cal-match-time { 
    font-weight: 700; 
    color: var(--text); 
    min-width: 46px; 
    font-size: 0.82rem; 
    flex-shrink: 0;
}
.cal-match-comp {
    padding: 0.18rem 0.45rem;
    border-radius: 4px;
    font-size: 0.65rem;
    font-weight: 800;
    color: white;
    flex-shrink: 0;
    letter-spacing: 0.03em;
}
.cal-match-comp.bsa { background: var(--comp-bsa); }
.cal-match-comp.cli { background: var(--comp-cli); }
.cal-match-comp.copa { background: var(--comp-copa); }
.cal-match-comp.other { background: var(--comp-other); }
.cal-match-teams {
    flex: 1 1 auto;
    font-weight: 500;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.25rem;
    row-gap: 0.18rem;
    font-size: 0.85rem;
    color: var(--text);
    min-width: 0;
}
.cal-match-crest {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}
.cal-match-team-name {
    min-width: 0;
    white-space: normal;
    overflow-wrap: anywhere;
    line-height: 1.25;
}
.cal-match-vs { 
    color: var(--text-muted); 
    margin: 0 0.1rem; 
    font-weight: 400; 
    flex-shrink: 0;
}
.cal-match-score {
    font-weight: 800;
    font-size: 0.95rem;
    font-variant-numeric: tabular-nums;
    color: var(--brand);
    margin-left: 0.25rem;
    flex-shrink: 0;
}
.cal-match-status {
    font-size: 0.68rem;
    font-weight: 700;
    color: var(--text-muted);
    min-width: 65px;
    text-align: right;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    flex-shrink: 0;
}
.cal-match-status.live { color: var(--live); }

/* Calendar List View — clean minimal */
/* ================================================
   DARK MODE — Calendar Light Minimal overrides
   ================================================ */
body.dark .cal-day {
    border-color: rgba(255,255,255,0.1);
}
body.dark .cal-day:hover {
    border-color: rgba(255,255,255,0.25);
    background: rgba(255,255,255,0.04);
}
body.dark .cal-day.other-month {
    border-color: transparent;
}
body.dark .cal-day.today {
    border-color: rgba(255,255,255,0.1);
}
body.dark .cal-day.today .cal-day-num {
    background: var(--brand);
    color: #fff;
}
body.dark .cal-day.selected {
    background: rgba(0, 107, 63, 0.12);
}
body.dark .cal-expanded {
    border-color: rgba(255,255,255,0.1);
}
body.dark .cal-match {
    border-color: rgba(255,255,255,0.08);
}
body.dark .cal-match:hover {
    background: rgba(255,255,255,0.04);
    border-color: rgba(255,255,255,0.15);
}
body.dark .cal-nav-btn:hover {
    color: rgba(255,255,255,0.8);
    background: rgba(255,255,255,0.08);
}
/* Dark sticky nav bar */
body.dark .calendar-nav {
    background: var(--bg-card);
    border-bottom-color: rgba(255,255,255,0.1);
}
/* Better dark tab indicators */
body.dark .tab-btn.active {
    border-bottom-color: #4ade80;
    color: #4ade80;
}

/* ================================================
   DASHBOARD GRID — Base styles 
   ================================================ */
.dashboard-grid {
    display: block; /* Default behavior for mobile/tablet */
}

/* ================================================
   RESPONSIVE — Desktop Dashboard Layout
   ================================================ */
@media (min-width: 1024px) {
    /* Keep dashboard-grid as block to preserve tab behavior */
    .dashboard-grid {
        display: block;
    }
    
    /* Keep tabs visible on desktop */
    .tabs {
        display: flex;
    }
    
    /* Desktop hero split layout */
    .hero-hub {
        display: grid;
        grid-template-columns: minmax(0, 1.35fr) minmax(300px, 0.75fr);
    }
    
    .hero-bottom {
        flex-direction: column;
        justify-content: center;
        align-items: stretch;
        gap: 1rem;
        border-top: none;
        border-left: 1px solid rgba(255,255,255,0.08);
        padding: 1.5rem;
    }
    
    .hero-countdown {
        text-align: left;
    }
    
    .form-widget {
        border-left: none;
        border-top: 1px solid rgba(255,255,255,0.12);
        padding-left: 0;
        padding-top: 1rem;
    }
}

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

/* Prediction */
.prediction-card { 
    text-align: center; 
    padding: 1.5rem; 
}

.prediction-match {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.75rem;
}

.prediction-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 1.25rem;
}

.prediction-badge.likely {
    background: rgba(34, 197, 94, 0.1);
    color: #22c55e;
}

.prediction-badge.maybe {
    background: rgba(234, 179, 8, 0.1);
    color: #eab308;
}

.prediction-badge.risky {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.prediction-probs { 
    display: flex; 
    justify-content: space-around; 
    gap: 0.5rem;
    margin: 1.5rem 0;
}

.prob-box { 
    text-align: center;
    flex: 1;
    padding: 0.75rem;
    border-radius: 0.5rem;
    background: var(--bg-card);
    border: 1px solid rgba(0,0,0,0.06);
    transition: all 0.2s ease;
}

.prob-box.primary {
    background: rgba(0, 100, 55, 0.1);
    border-color: var(--brand);
}

.prob-value { 
    font-size: 1.5rem; 
    font-weight: 700; 
    color: var(--brand);
    line-height: 1;
    margin-bottom: 0.25rem;
}

.prob-label { 
    font-size: 0.8rem; 
    color: var(--text-muted); 
    font-weight: 500;
}

.prediction-factors {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.prediction-factor {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    background: var(--bg);
    border-radius: 0.375rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    border: 1px solid rgba(0,0,0,0.08);
}

.prediction-note {
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.4;
    font-style: italic;
}

@media (max-width: 640px) {
    .prediction-probs {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .prob-box {
        padding: 1rem;
    }
    
    .prob-value {
        font-size: 2rem;
    }
    
    .prediction-factors {
        gap: 0.375rem;
    }
    
    .prediction-factor {
        font-size: 0.7rem;
    }
}

/* Dark mode overrides for prediction styles */
body.dark .prob-box {
    border-color: rgba(255,255,255,0.1);
}

body.dark .prediction-factor {
    border-color: rgba(255,255,255,0.15);
}

/* Loading */
.skeleton { background: linear-gradient(90deg, var(--bg) 25%, #e0e0e0 50%, var(--bg) 75%); background-size: 200% 100%; animation: shimmer 1.5s infinite; border-radius: 4px; }
.skeleton-card { padding: 1rem; background: var(--bg); border-radius: 8px; margin-bottom: 0.75rem; }
.skeleton-line { height: 16px; background: linear-gradient(90deg, var(--bg) 25%, #e0e0e0 50%, var(--bg) 75%); background-size: 200% 100%; animation: shimmer 1.5s infinite; border-radius: 4px; margin-bottom: 8px; }
body.dark .skeleton,
body.dark .skeleton-line { background: linear-gradient(90deg, var(--bg) 25%, rgba(255,255,255,0.08) 50%, var(--bg) 75%); background-size: 200% 100%; }
.skeleton-line.short { width: 40%; }
.skeleton-line.medium { width: 70%; }

/* Error */
.error-state { text-align: center; padding: 2rem; color: var(--loss); }
.error-state .error-icon { font-size: 2rem; margin-bottom: 0.5rem; }
.error-state .error-message { color: var(--text-secondary); font-size: 0.9rem; margin-bottom: 1rem; }
.error-state .retry-btn {
    background: var(--brand); color: white; border: none;
    padding: 0.5rem 1rem; border-radius: 6px; cursor: pointer; font-size: 0.85rem;
}
.error-state .retry-btn:hover { background: var(--brand-dark); }

@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* Empty state */
.empty {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
    font-style: italic;
}

/* Footer */
.footer {
    text-align: center;
    padding: 1.5rem;
    color: var(--text-muted);
    border-top: 1px solid rgba(0,0,0,0.06);
    margin: 2rem 0 0;
    font-size: 0.8rem;
}
.footer p {
    margin: 0.3rem 0;
}
.footer-updated {
    font-size: 0.7rem;
    opacity: 1;
    margin-top: 0.25rem;
}
.footer-actions {
    display: flex;
    justify-content: center;
    gap: 0.6rem;
    margin-top: 0.75rem;
    flex-wrap: wrap;
}
.footer-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: var(--bg-card);
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: 8px;
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}
.footer-btn:hover {
    background: var(--brand);
    color: white;
    border-color: var(--brand);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0,107,63,0.25);
}

/* Responsive */
/* ================================================
   TABLET LAYOUT (601px–1023px)
   ================================================ */
@media (min-width: 601px) and (max-width: 1023px) {
    .container { max-width: 720px; }
    
    /* Stats grid: 4 columns on tablet */
    .stats-grid { grid-template-columns: repeat(4, 1fr); }
    
    /* Slightly larger hero */
    .hero-team img { width: 72px; height: 72px; }
}

/* ================================================
   DESKTOP LAYOUT (1024px+)
   ================================================ */
@media (min-width: 1024px) {
    .container { max-width: 1100px; }
    
    /* Side-by-side: Calendar + Tabs content */
    .main-layout {
        display: grid;
        grid-template-columns: 420px 1fr;
        gap: 1.5rem;
        align-items: start;
    }
    
    /* Make calendar sticky on desktop scroll */
    .calendar-hub {
        position: sticky;
        top: 1rem;
    }
    
    /* Ensure main content stacks properly in right column */
    .main-content {
        min-width: 0; /* Prevent overflow issues */
    }
    
    /* Hero bottom: countdown and form widget side by side with more space */
    .hero-bottom {
        gap: 2rem;
        padding: 0.75rem 2rem 1rem;
    }
    
    /* Larger hero team images */
    .hero-team img { width: 80px; height: 80px; }
    .hero-score { font-size: 3.5rem; }
    
    /* Stats grid: 6 columns on wide screens */
    .stats-grid { grid-template-columns: repeat(6, 1fr); }
    
    /* Wider standings stats spacing */
    .standings-row .stats { gap: 1.5rem; }
}

@media (min-width: 1400px) {
    .container { max-width: 1280px; }
    
    .main-layout {
        grid-template-columns: 450px 1fr;
        gap: 2rem;
    }
}

@media (max-width: 600px) {
    .header h1 { font-size: 1.5rem; }
    .container { padding: 0 0.75rem; }
    .hero-teams { flex-direction: column; gap: 0.5rem; }
    .hero-score { font-size: 2.2rem; }
    .standings-row .stats { gap: 0.5rem; }

    /* Calendar — mobile */
    .calendar-grid {
        gap: 2px;
        min-width: 0;
        overflow: hidden;
    }
    .cal-day {
        min-height: 44px;
        min-width: 0;
        padding: 3px 2px;
        border-radius: 8px;
        -webkit-tap-highlight-color: transparent;
    }
    .cal-day:active {
        transform: scale(0.92);
        background: rgba(0,0,0,0.06);
        transition: transform 0.1s ease, background 0.1s ease;
    }
    .cal-day-num {
        font-size: 0.7rem;
        margin-bottom: 2px;
    }
    .cal-dot {
        width: 6px;
        height: 6px;
    }
    .cal-score {
        font-size: 0.5rem;
        padding: 1px 3px;
        margin-top: 1px;
    }
    .cal-overflow {
        font-size: 0.5rem;
    }
    .cal-head {
        font-size: 0.55rem;
        padding: 0.15rem 0;
    }

    /* --- 6. Sticky calendar nav --- */
    .calendar-nav {
        position: sticky;
        top: 0;
        z-index: 10;
        background: var(--bg-card);
        margin-bottom: 0.5rem;
        padding: 0.5rem 0;
        border-bottom: 1px solid rgba(0,0,0,0.06);
    }
    .calendar-nav span {
        font-size: 0.9rem;
        min-width: 120px;
    }
    .cal-nav-btn {
        width: 36px;
        height: 36px;
        font-size: 1.1rem;
    }

    /* --- 2. Better tap targets for expanded matches --- */
    .cal-match {
        font-size: 0.75rem;
        padding: 0.6rem 0.5rem;
        -webkit-tap-highlight-color: transparent;
        border-radius: 8px;
        gap: 0.4rem; /* Reduce gap on mobile */
    }
    .cal-match:active {
        background: rgba(0,0,0,0.04);
        transform: scale(0.98);
    }
    
    /* Mobile-specific overflow fixes for calendar matches */
    .cal-match-time {
        min-width: 38px; /* Reduce from 46px on mobile */
        font-size: 0.75rem;
    }
    .cal-match-status {
        min-width: 50px; /* Reduce from 65px on mobile */
        font-size: 0.6rem;
    }
    .cal-match-teams {
        font-size: 0.75rem;
        gap: 0.2rem;
        row-gap: 0.15rem;
    }

    /* --- 7. Better tab indicators --- */
    .tabs {
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        -ms-overflow-style: none;
        padding-bottom: 0;
        gap: 0.35rem;
    }
    .tabs::-webkit-scrollbar { display: none; }
    .tab-btn {
        scroll-snap-align: start;
        white-space: nowrap;
        flex-shrink: 0;
        padding: 0.55rem 0.85rem;
        font-size: 0.8rem;
        border-radius: 8px 8px 0 0;
        border-bottom: 2.5px solid transparent;
        box-shadow: none;
    }
    .tab-btn.active {
        border-bottom-color: var(--brand);
        background: var(--bg-card);
        color: var(--brand);
        font-weight: 700;
    }
    .tab-btn:not(.active) {
        background: transparent;
        color: var(--text-secondary);
    }

    /* --- 8. Hero bottom - mobile layout --- */
    .hero-bottom {
        flex-direction: column;
        gap: 0.75rem;
        padding: 0.75rem 1rem;
    }
    
    .form-widget {
        border-left: none;
        padding-left: 0;
        justify-content: center;
    }
    
    .countdown-digits {
        gap: 0.1rem;
    }
    
    .cd-unit {
        min-width: 30px;
    }
    
    .cd-val {
        font-size: 1.1rem;
    }
    
    .cd-sep {
        font-size: 0.9rem;
    }

    /* --- 9. Compact footer --- */
    .footer { padding: 1.25rem 0.75rem; }
    .footer p { font-size: 0.7rem; margin: 0.15rem 0; }
    .footer-actions { gap: 0.4rem; margin-top: 0.5rem; }
    .footer-btn { padding: 0.4rem 0.75rem; font-size: 0.72rem; border-radius: 6px; }
}

/* Focus-visible styles */
:focus-visible {
    outline: 2px solid #006437;
    outline-offset: 2px;
}
body.dark :focus-visible {
    outline-color: #4ade80;
}

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