/* ============================================================
   Super League Analytics — Styles
   Dark-mode-first, responsive, modern typography
   ============================================================ */

:root {
    --bg-primary: #11141c;
    --bg-secondary: #171c27;
    --bg-card: #202635;
    --bg-hover: #2b3243;
    --text-primary: #e4e6eb;
    --text-secondary: #9ca3b0;
    --text-muted: #6b7280;
    --accent-blue: #3b82f6;
    --accent-green: #22c55e;
    --accent-yellow: #eab308;
    --accent-red: #ef4444;
    --accent-orange: #f97316;
    --accent-purple: #8b5cf6;
    --border-color: #374055;
    --trajectory-panel-bg: #1b2231;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
    --transition: 0.2s ease;
}

[data-theme="light"] {
    --bg-primary: #f2f4f9;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --bg-hover: #e9edf5;
    --text-primary: #1a1d27;
    --text-secondary: #4b5563;
    --text-muted: #9ca3af;
    --border-color: #d8dde8;
    --trajectory-panel-bg: #e9eef7;
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
    font-family: var(--font);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
a { color: var(--accent-blue); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--accent-orange); }

/* Navbar */
.brand-floating {
    position: fixed;
    top: 1px;
    left: 8px;
    z-index: 210;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.brand-floating-logo {
    width: 140px;
    height: 140px;
    object-fit: cover;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.28);
}
.navbar {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: 0 2rem 0 12rem;
    height: 64px;
    display: flex;
    align-items: center;
    gap: 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(12px);
}
.nav-icon { font-size: 1.4rem; }
.nav-links { display: flex; gap: 0.25rem; flex: 1; }
.nav-link { color: var(--text-secondary); padding: 0.5rem 1rem; border-radius: var(--radius-sm); font-weight: 500; font-size: 0.9rem; transition: all var(--transition); }
.nav-link:hover, .nav-link.active { color: var(--text-primary); background: var(--bg-hover); }
.nav-menu-toggle {
    display: none;
    background: var(--bg-hover);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.45rem 0.7rem;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 1rem;
}
.theme-toggle { background: var(--bg-hover); border: 1px solid var(--border-color); border-radius: var(--radius-sm); padding: 0.5rem 0.75rem; cursor: pointer; color: var(--text-secondary); font-size: 1.1rem; transition: all var(--transition); }
.theme-toggle:hover { color: var(--accent-yellow); border-color: var(--accent-yellow); }

/* Container */
.container { max-width: 1400px; margin: 0 auto; padding: 2rem; flex: 1; width: 100%; }

/* Global ops status bar */
.global-ops-status {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: 0.45rem 2rem 0.45rem 12rem;
    font-size: 0.78rem;
    color: var(--text-secondary);
}
.global-ops-status strong { color: var(--text-primary); }
.ops-pill {
    display: inline-block;
    margin-right: 0.45rem;
    padding: 0.1rem 0.45rem;
    border-radius: 999px;
    font-weight: 700;
    font-size: 0.7rem;
}
.ops-pill.ok { background: rgba(34, 197, 94, 0.18); color: var(--accent-green); }
.ops-pill.warn { background: rgba(234, 179, 8, 0.18); color: var(--accent-yellow); }
.ops-pill.err { background: rgba(239, 68, 68, 0.18); color: var(--accent-red); }

/* Page header */
.page-header { margin-bottom: 2rem; }
.page-header h1 { font-size: 2rem; font-weight: 800; letter-spacing: -0.02em; margin-bottom: 0.25rem; }
.subtitle { color: var(--text-secondary); font-size: 1rem; }
.section-title { font-size: 1.15rem; font-weight: 700; margin-bottom: 1rem; color: var(--text-primary); }
.text-muted { color: var(--text-muted); font-size: 0.9rem; }

/* ============================================================
   Dashboard grid (two columns)
   ============================================================ */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 2rem;
    align-items: start;
}
.dashboard-main { min-width: 0; }
.dashboard-sidebar { min-width: 0; }
.team-insights-sidebar {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.55rem;
    margin-bottom: 1.2rem;
}
.team-insight-card {
    text-align: left;
    padding: 0.5rem 0.58rem;
}
.ad-mock {
    border: 1px dashed rgba(148, 163, 184, 0.55);
    background: rgba(148, 163, 184, 0.06);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
}
.ad-mock-label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 18px;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.5);
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.ad-mock-text {
    font-size: 0.78rem;
    opacity: 0.88;
}
.ad-mock-banner {
    height: 84px;
    margin: 0.25rem 0 1rem 0;
}
.ad-mock-rect {
    height: 150px;
    margin-bottom: 1rem;
}
.ad-slot-live {
    display: block;
    min-height: 70px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    overflow: hidden;
}
.ad-slot-live ins.adsbygoogle {
    display: block;
    width: 100%;
    min-height: 70px;
}
.global-ad-slot {
    width: min(1220px, calc(100% - 2.4rem));
    margin-left: auto;
    margin-right: auto;
}
.global-ad-slot-top {
    margin-top: 0.35rem;
    margin-bottom: 0.75rem;
}
.global-ad-slot-bottom {
    margin-top: 0.8rem;
    margin-bottom: 0.6rem;
}
.cookie-banner {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: 12px;
    z-index: 250;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow);
    padding: 0.65rem 0.75rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
}
.cookie-banner-text {
    color: var(--text-secondary);
    font-size: 0.78rem;
}
.cookie-banner-actions {
    display: flex;
    gap: 0.45rem;
    flex-shrink: 0;
}

/* ============================================================
   Insights strip
   ============================================================ */
.insights-strip {
    display: block;
    margin-bottom: 2rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background: var(--bg-card);
    overflow: hidden;
}
.dashboard-top-ticker {
    width: 100vw;
    max-width: 100vw;
    margin-top: -2rem;
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
    border-left: 0;
    border-right: 0;
    border-top: 0;
    border-radius: 0;
}
.insight-ticker-shell {
    position: relative;
    overflow: hidden;
    white-space: nowrap;
    padding: 0.6rem 0;
}
.insight-ticker-track {
    display: inline-block;
    white-space: nowrap;
    will-change: transform;
    animation: insightTickerMove 72s linear infinite;
}
.insight-ticker-item {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin-right: 2.2rem;
    font-size: 0.86rem;
    color: var(--text-secondary);
}
.insight-ticker-icon {
    font-size: 1rem;
}
@keyframes insightTickerMove {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}
.insight-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    transition: all var(--transition);
}
.insight-card:hover { border-color: var(--accent-blue); }
.insight-card.title_race { border-left: 3px solid var(--accent-yellow); }
.insight-card.european { border-left: 3px solid var(--accent-blue); }
.insight-card.relegation { border-left: 3px solid var(--accent-red); }
.insight-card.form { border-left: 3px solid var(--accent-green); }
.insight-card.upset { border-left: 3px solid var(--accent-orange); }
.insight-icon { font-size: 1.3rem; flex-shrink: 0; margin-top: 2px; }
.insight-text strong { display: block; font-size: 0.9rem; margin-bottom: 0.25rem; }
.insight-text p { font-size: 0.8rem; color: var(--text-secondary); line-height: 1.5; margin: 0; }

/* Compact card layout for Targets narrative strip */
#impact-story-strip {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 0.65rem;
    padding: 0.6rem;
    overflow: visible;
}
#impact-story-strip .insight-card {
    padding: 0.65rem 0.8rem;
    min-height: 74px;
    align-items: center;
}
#impact-story-strip .insight-icon {
    margin-top: 0;
}
#impact-story-strip .insight-text strong {
    margin-bottom: 0.1rem;
}
#impact-story-strip .insight-text p {
    line-height: 1.35;
}

/* ============================================================
   Predictions grid & match cards
   ============================================================ */
.predictions-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 1rem; }
.predictions-grid-compact { grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 0.68rem; }
.predictions-grid-compact .match-card { padding: 0.82rem; }
.predictions-grid-compact .match-date { font-size: 0.69rem; margin-bottom: 0.4rem; }
.predictions-grid-compact .match-teams { gap: 0.55rem; margin-bottom: 0.28rem; }
.predictions-grid-compact .team { font-size: 1.15rem; }
.predictions-grid-compact .team-crest-card { width: 22px; height: 22px; margin: 0 0.22rem; }
.predictions-grid-compact .match-fullnames { font-size: 0.69rem; margin-bottom: 0.35rem; }
.predictions-grid-compact .xg-line { font-size: 0.74rem; margin-bottom: 0.34rem; }
.predictions-grid-compact .prob-bar-container { height: 21px; margin-bottom: 0.22rem; }
.predictions-grid-compact .prob-bar { font-size: 0.64rem; min-width: 22px; }
.predictions-grid-compact .prob-labels { font-size: 0.6rem; margin-bottom: 0.42rem; }
.predictions-grid-compact .prediction-badge { padding: 0.2rem 0.66rem; font-size: 0.67rem; }
.predictions-grid-compact .confidence-badge { padding: 0.15rem 0.42rem; font-size: 0.58rem; }
.predictions-grid-compact .model-badge { font-size: 0.55rem; margin-top: 0.2rem; }
.predictions-grid-compact .explain-btn { margin-top: 0.38rem !important; font-size: 0.72rem; padding: 0.3rem 0.52rem; }
.match-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 1.25rem;
    transition: all var(--transition);
    box-shadow: var(--shadow);
}
.match-card:hover { border-color: var(--accent-blue); transform: translateY(-2px); }
.match-date { font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 0.6rem; }
.match-teams { display: flex; align-items: center; justify-content: center; gap: 0.75rem; margin-bottom: 0.4rem; }
.team { font-size: 1.4rem; font-weight: 800; letter-spacing: 0.02em; }
.home-team { color: var(--text-primary); }
.away-team { color: var(--text-primary); }
.vs { color: var(--text-muted); font-size: 0.8rem; font-weight: 500; }
.match-fullnames { display: flex; justify-content: space-between; font-size: 0.75rem; color: var(--text-secondary); margin-bottom: 0.5rem; padding: 0 0.25rem; }
.xg-line { text-align: center; font-size: 0.8rem; color: var(--accent-purple); font-weight: 600; margin-bottom: 0.5rem; }

/* Probability bars */
.prob-bar-container { display: flex; height: 28px; border-radius: var(--radius-sm); overflow: hidden; margin-bottom: 0.3rem; background: var(--bg-primary); }
.prob-bar { display: flex; align-items: center; justify-content: center; font-size: 0.7rem; font-weight: 700; color: #fff; min-width: 28px; transition: width 0.6s ease; }
.home-bar { background: var(--accent-green); }
.draw-bar { background: #ffffff; color: #1a1d27; border-left: 1px solid rgba(0,0,0,0.12); border-right: 1px solid rgba(0,0,0,0.12); }
.away-bar { background: var(--accent-red); }
.prob-labels { display: flex; justify-content: space-between; font-size: 0.65rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 0.6rem; padding: 0 0.25rem; }
.prediction-badge { display: inline-block; padding: 0.3rem 0.9rem; border-radius: 100px; font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; }
.prediction-badge.home { background: rgba(34, 197, 94, 0.15); color: var(--accent-green); }
.prediction-badge.draw { background: #ffffff; color: #1a1d27; border: 1px solid rgba(0,0,0,0.16); }
.prediction-badge.away { background: rgba(239, 68, 68, 0.15); color: var(--accent-red); }
.no-prediction { color: var(--text-muted); font-size: 0.8rem; font-style: italic; }
.model-badge { display: inline-block; margin-top: 0.3rem; padding: 0.15rem 0.5rem; border-radius: 4px; font-size: 0.6rem; font-weight: 600; letter-spacing: 0.03em; background: rgba(99, 102, 241, 0.15); color: var(--accent-blue); text-transform: uppercase; }
.confidence-badge {
    display: inline-block;
    margin-left: 0.4rem;
    padding: 0.2rem 0.5rem;
    border-radius: 999px;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.03em;
}
.confidence-badge.high { background: rgba(34, 197, 94, 0.16); color: var(--accent-green); }
.confidence-badge.med { background: rgba(234, 179, 8, 0.16); color: var(--accent-yellow); }
.confidence-badge.low { background: rgba(239, 68, 68, 0.16); color: var(--accent-red); }

/* ============================================================
   Elo ratings sidebar
   ============================================================ */
.ratings-list { display: flex; flex-direction: column; gap: 0.4rem; }
.rating-row { display: flex; align-items: center; gap: 0.5rem; padding: 0.35rem 0; }
.rating-pos { width: 1.5rem; text-align: center; font-weight: 800; font-size: 0.8rem; color: var(--accent-blue); }
.rating-name { width: 3.5rem; font-weight: 600; font-size: 0.85rem; flex-shrink: 0; }
.rating-bar-bg { flex: 1; height: 8px; background: var(--bg-primary); border-radius: 4px; overflow: hidden; }
.rating-bar-fill { height: 100%; background: linear-gradient(90deg, var(--accent-blue), var(--accent-purple)); border-radius: 4px; transition: width 0.4s ease; }
.rating-value { width: 3rem; text-align: right; font-size: 0.8rem; font-weight: 700; color: var(--text-secondary); }

/* ============================================================
   Match reports
   ============================================================ */
.reports-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 0.9rem; }
.report-group { margin-bottom: 0.9rem; }
.report-group-list { display: grid; gap: 0.45rem; }
.report-row-wrap {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    box-shadow: var(--shadow);
    overflow: hidden;
}
.report-game-row {
    width: 100%;
    background: transparent;
    border: 0;
    color: inherit;
    padding: 0.7rem 0.8rem;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}
.report-game-row:hover { background: var(--bg-hover); }
.report-game-row.open { border-bottom: 1px solid var(--border-color); }
.report-game-row .team { display: flex; align-items: center; gap: 0.4rem; font-weight: 700; }
.report-game-row .right { justify-content: flex-end; }
.report-game-row .center { text-align: center; }
.report-game-row .score { font-weight: 800; color: var(--accent-blue); }
.report-game-row .meta { font-size: 0.72rem; color: var(--text-muted); }
.xg-source-badge {
    display: inline-block;
    margin-top: 0.2rem;
    padding: 0.08rem 0.42rem;
    border-radius: 999px;
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.01em;
}
.xg-source-real {
    color: #065f46;
    background: rgba(16, 185, 129, 0.18);
    border: 1px solid rgba(16, 185, 129, 0.35);
}
.xg-source-est {
    color: #92400e;
    background: rgba(245, 158, 11, 0.18);
    border: 1px solid rgba(245, 158, 11, 0.35);
}
.xg-source-missing {
    color: #475569;
    background: rgba(148, 163, 184, 0.18);
    border: 1px solid rgba(148, 163, 184, 0.35);
}
.report-game-details {
    display: none;
    padding: 0.65rem 0.8rem 0.75rem;
}
.report-game-details.open { display: block; }
.report-teams-links {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    margin-bottom: 0.4rem;
    font-weight: 600;
    font-size: 0.85rem;
}
.report-stat-row { display: flex; justify-content: space-between; font-size: 0.78rem; color: var(--text-secondary); margin-top: 0.35rem; }
.report-stat-head {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    margin-top: 0.45rem;
    margin-bottom: 0.12rem;
    font-size: 0.76rem;
}
.report-stat-head .k { color: var(--text-muted); font-weight: 600; text-align: center; }
.report-stat-head .v { color: var(--text-primary); font-weight: 700; }
.report-stat-head .v.left { text-align: left; }
.report-stat-head .v.right { text-align: right; }
.report-stat-row .k { color: var(--text-muted); }
.report-stat-row .v { color: var(--text-primary); font-weight: 600; }
.report-dual-bar {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.35rem;
}
.report-dual-bar .half {
    height: 8px;
    background: rgba(148, 163, 184, 0.18);
    border-radius: 999px;
    overflow: hidden;
}
.report-dual-bar .half.left {
    display: flex;
    justify-content: flex-end;
}
.report-dual-bar .half.right {
    display: flex;
    justify-content: flex-start;
}
.report-dual-bar .fill {
    height: 100%;
    border-radius: 999px;
}
.report-dual-bar .half.left .fill {
    background: rgba(59, 130, 246, 0.9);
}
.report-dual-bar .half.right .fill {
    background: rgba(99, 102, 241, 0.78);
}
.report-foot {
    margin-top: 0.6rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border-color);
    font-size: 0.73rem;
    color: var(--text-secondary);
    display: flex;
    justify-content: space-between;
    gap: 0.6rem;
    flex-wrap: wrap;
}

/* ============================================================
   Tables
   ============================================================ */
.table-wrapper { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border-color); background: var(--bg-card); box-shadow: var(--shadow); }
.standings-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.standings-table thead { background: var(--bg-secondary); border-bottom: 2px solid var(--border-color); }
.standings-table th { padding: 0.65rem 0.8rem; text-align: left; font-weight: 700; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); white-space: nowrap; }
.standings-table td { padding: 0.55rem 0.8rem; border-bottom: 1px solid var(--border-color); white-space: nowrap; }
.standings-table tbody tr:hover { background: var(--bg-hover); }
.standings-table .pos { font-weight: 800; color: var(--accent-blue); width: 2rem; text-align: center; }
.standings-table .pts { font-weight: 800; color: var(--accent-orange); }
.standings-table .gd { font-weight: 600; }
.team-cell a { font-weight: 600; }
.form-cell { display: flex; gap: 3px; align-items: center; }
.form-badge { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 4px; font-size: 0.65rem; font-weight: 800; color: #fff; position: relative; cursor: pointer; }
.form-w { background: var(--accent-green); }
.form-d { background: #ffffff; color: #1a1d27; border: 1px solid rgba(0,0,0,0.16); }
.form-l { background: var(--accent-red); }

/* Form badge hover tooltip */
.form-badge[data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 0.35rem 0.65rem;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 500;
    white-space: nowrap;
    z-index: 20;
    color: var(--text-primary);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    pointer-events: none;
}
.form-badge[data-tooltip]:hover::before {
    content: '';
    position: absolute;
    bottom: calc(100% + 2px);
    left: 50%;
    transform: translateX(-50%);
    border: 4px solid transparent;
    border-top-color: var(--border-color);
    z-index: 20;
}

/* Streak badges */
.streak-badge { display: inline-block; padding: 0.15rem 0.4rem; border-radius: 4px; font-size: 0.7rem; font-weight: 700; }
.streak-good { background: rgba(34, 197, 94, 0.15); color: var(--accent-green); }
.streak-bad { background: rgba(239, 68, 68, 0.15); color: var(--accent-red); }
.streak-neutral { background: rgba(234, 179, 8, 0.15); color: var(--accent-yellow); }

/* Additional standings columns */
.home-record, .away-record { font-size: 0.75rem; font-family: var(--font-mono); letter-spacing: 0.03em; }
.season-label { text-align: center; color: var(--text-muted); font-size: 0.85rem; margin-top: 1rem; }

/* Mini probability bars (simulation table) */
.mini-bar-container { display: flex; align-items: center; gap: 0.4rem; min-width: 100px; }
.mini-bar-container span { font-size: 0.75rem; color: var(--text-secondary); font-weight: 600; white-space: nowrap; }
.mini-bar { height: 6px; border-radius: 3px; transition: width 0.4s ease; }
.title-bar { background: var(--accent-yellow); }
.euro-bar { background: var(--accent-blue); }
.top6-bar { background: var(--accent-green); }
.releg-bar { background: var(--accent-red); }
.sim-pct-pill {
    display: inline-block;
    min-width: 64px;
    text-align: center;
    padding: 0.14rem 0.42rem;
    border-radius: 999px;
    font-weight: 700;
    font-size: 0.74rem;
    line-height: 1.1;
    box-shadow: inset 0 0 0 1px rgba(34, 197, 94, 0.35);
}

/* Simulation meta bar */
.sim-meta {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 1rem 2rem;
    display: flex;
    justify-content: center;
    gap: 3rem;
    margin-bottom: 1.5rem;
}
.meta-item { display: flex; flex-direction: column; align-items: center; }
.meta-val { font-size: 1.1rem; font-weight: 700; color: var(--accent-blue); }
.meta-label { font-size: 0.7rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }

/* ============================================================
   Team page
   ============================================================ */
.team-stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 0.65rem; margin-bottom: 1.5rem; }
.stat-card { background: var(--bg-card); border: 1px solid var(--border-color); border-radius: var(--radius); padding: 1rem; text-align: center; transition: all var(--transition); }
.stat-card:hover { border-color: var(--accent-blue); }
.stat-card.highlight { border-color: var(--accent-orange); background: rgba(249, 115, 22, 0.08); }
.stat-card.accent-green { border-left: 3px solid var(--accent-green); }
.stat-card.accent-yellow { border-left: 3px solid var(--accent-yellow); }
.stat-card.accent-red { border-left: 3px solid var(--accent-red); }
.stat-value { font-size: 1.6rem; font-weight: 800; line-height: 1; margin-bottom: 0.2rem; }
.stat-label { font-size: 0.7rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.section-header { display: flex; align-items: center; gap: 1rem; margin: 1.5rem 0 1rem; }
.section-header h2 { font-size: 1.2rem; font-weight: 700; }
.form-badges { display: flex; gap: 4px; }
.ha-badge { font-weight: 700; font-size: 0.8rem; }

/* ============================================================
   Charts
   ============================================================ */
.chart-container { background: var(--bg-card); border: 1px solid var(--border-color); border-radius: var(--radius); padding: 1rem; }
.chart-container-wide { background: var(--bg-card); border: 1px solid var(--border-color); border-radius: var(--radius); padding: 1.5rem; }
.charts-row { display: grid; grid-template-columns: 1fr; gap: 1.5rem; }

/* ============================================================
   History page
   ============================================================ */
.accuracy-banner {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 1.25rem 2rem;
    display: flex;
    justify-content: center;
    gap: 3rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow);
}
.accuracy-stat { display: flex; flex-direction: column; align-items: center; }
.accuracy-value { font-size: 1.8rem; font-weight: 800; color: var(--accent-blue); }
.accuracy-label { font-size: 0.7rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.row-correct td:last-child { color: var(--accent-green); font-weight: 700; font-size: 1.1rem; }
.row-wrong td:last-child { color: var(--accent-red); font-weight: 700; font-size: 1.1rem; }

/* ============================================================
   Utilities
   ============================================================ */
/* Phase zone row highlights */
.zone-champ td:first-child { border-left: 5px solid var(--accent-green); background: rgba(34,197,94,0.12); }
.zone-euro td:first-child { border-left: 5px solid var(--accent-blue); background: rgba(59,130,246,0.12); }
.zone-releg td:first-child { border-left: 5px solid var(--accent-red); background: rgba(239,68,68,0.12); }
.zone-legend { display: flex; gap: 1.5rem; padding: 0.75rem 1rem; font-size: 0.75rem; color: var(--text-secondary); }
.legend-dot { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 0.25rem; vertical-align: middle; }
.zone-champ-dot { background: var(--accent-green); }
.zone-euro-dot { background: var(--accent-blue); }
.zone-releg-dot { background: var(--accent-red); }
.phase-desc { font-size: 0.8rem; color: var(--text-muted); margin: -0.5rem 0 0.75rem 0; }

/* Matchday divider */
.matchday-divider { grid-column: 1 / -1; padding: 0.5rem 0.75rem; margin: 0.5rem 0 0; font-size: 0.85rem; font-weight: 700; color: var(--accent-blue); border-bottom: 2px solid var(--accent-blue); letter-spacing: 0.03em; text-transform: uppercase; }

/* Team crests */
.team-crest { width: 20px; height: 20px; object-fit: contain; vertical-align: middle; margin-right: 0.4rem; border-radius: 2px; }
.team-crest-card { width: 28px; height: 28px; object-fit: contain; vertical-align: middle; margin: 0 0.3rem; border-radius: 2px; }
.team-crest-sm { width: 18px; height: 18px; object-fit: contain; vertical-align: middle; margin-right: 0.3rem; border-radius: 2px; }
.team-crest-hero { width: 56px; height: 56px; object-fit: contain; border-radius: 4px; filter: drop-shadow(0 2px 6px rgba(0,0,0,0.4)); }
.team-cell { white-space: nowrap; }
.trajectory-team-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.22rem 0.5rem;
    border-radius: 999px;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-secondary);
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
    user-select: none;
}
.trajectory-team-chip.is-active {
    opacity: 1;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 1px rgba(148,163,184,0.18) inset;
}
.trajectory-team-chip.is-inactive {
    opacity: 0.62;
    border-style: dashed;
}
.trajectory-team-chip.is-pinned {
    box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.55) inset, 0 0 0 1px rgba(34, 197, 94, 0.45);
}
.trajectory-color-dot {
    width: 9px;
    height: 9px;
    border-radius: 999px;
    display: inline-block;
    flex: 0 0 9px;
    border: 1px solid rgba(255,255,255,0.25);
}
.trajectory-chart-panel {
    max-width: 1100px;
    margin: 0 auto;
    background: var(--trajectory-panel-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 0.75rem 0.75rem 0.5rem 0.75rem;
}

/* Filter buttons */
.filter-btn { background: var(--bg-card); border: 1px solid var(--border-color); color: var(--text-secondary); padding: 0.35rem 0.75rem; border-radius: 6px; cursor: pointer; font-size: 0.8rem; transition: all 0.15s; }
.filter-btn:hover { border-color: var(--accent-blue); color: var(--accent-blue); }
.filter-btn.active { background: var(--accent-blue); color: #fff; border-color: var(--accent-blue); }

/* History table row coloring */
.row-correct { background: rgba(34,197,94,0.05); }
.row-wrong { background: rgba(239,68,68,0.05); }
.history-table td { padding: 0.35rem 0.4rem; font-size: 0.82rem; }
.history-table th { padding: 0.4rem; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.03em; }

.loading-spinner { text-align: center; padding: 3rem; color: var(--text-muted); font-size: 1rem; }
.empty-state { text-align: center; padding: 3rem 2rem; color: var(--text-secondary); }
.empty-state code { background: var(--bg-hover); padding: 0.2rem 0.5rem; border-radius: 4px; font-family: var(--font-mono); font-size: 0.85rem; }
.impact-note {
    text-align: left;
    padding: 0.5rem 0.7rem;
    font-size: 0.82rem;
    line-height: 1.35;
}
.impact-note code {
    font-size: 0.78rem;
    padding: 0.1rem 0.32rem;
}
.history-kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(185px, 1fr));
    gap: 0.55rem;
    margin-bottom: 0.8rem;
    align-items: stretch;
}
.history-kpi-card {
    padding: 0.58rem 0.55rem;
}
.history-kpi-value {
    font-size: 1.06rem;
    line-height: 1.15;
}
.history-kpi-label {
    font-size: 0.68rem;
    line-height: 1.2;
    margin-top: 0.22rem;
}
.history-coverage-badge {
    display: inline-block;
    margin-right: 0.35rem;
    margin-top: 0.18rem;
    padding: 0.08rem 0.42rem;
    border-radius: 999px;
    border: 1px solid var(--border-color);
    background: var(--bg-hover);
    color: var(--text-secondary);
    font-size: 0.66rem;
    font-weight: 600;
}
.footer { text-align: center; padding: 2rem; color: var(--text-muted); font-size: 0.8rem; border-top: 1px solid var(--border-color); margin-top: 2rem; }

/* Skeleton loading */
@keyframes skPulse {
    0% { opacity: 0.42; }
    50% { opacity: 0.82; }
    100% { opacity: 0.42; }
}
.skeleton {
    background: linear-gradient(90deg, rgba(148,163,184,0.12) 25%, rgba(148,163,184,0.23) 50%, rgba(148,163,184,0.12) 75%);
    background-size: 200% 100%;
    animation: skPulse 1.25s ease-in-out infinite;
    border-radius: 8px;
}
.sk-card {
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background: var(--bg-card);
    padding: 1rem;
}
.sk-line { height: 10px; margin: 0.45rem 0; }
.sk-line.lg { height: 14px; }
.sk-line.sm { height: 8px; width: 60%; }
.sk-grid-3 {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1rem;
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 1024px) {
    .dashboard-grid { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
    .brand-floating {
        top: 2px;
        left: 7px;
    }
    .brand-floating-logo {
        width: 96px;
        height: 96px;
    }
    .navbar { padding: 0 1rem 0 7.6rem; gap: 0.5rem; position: sticky; }
    .nav-title { display: none; }
    .nav-menu-toggle { display: inline-flex; align-items: center; justify-content: center; margin-left: auto; }
    .theme-toggle { margin-left: 0; }
    .nav-links {
        display: none;
        position: absolute;
        left: 0;
        right: 0;
        top: 64px;
        background: var(--bg-secondary);
        border-bottom: 1px solid var(--border-color);
        flex-direction: column;
        padding: 0.5rem 0.75rem 0.75rem;
        gap: 0.35rem;
    }
    .navbar.nav-open .nav-links { display: flex; }
    .nav-link { width: 100%; padding: 0.65rem 0.8rem; }
    .global-ops-status { padding: 0.45rem 1rem 0.45rem 7.6rem; }
    .container { padding: 1rem; }
    .global-ad-slot {
        width: calc(100% - 2rem);
    }
    .ad-mock-banner { height: 72px; margin-bottom: 0.8rem; }
    .ad-mock-rect { height: 120px; }
    .dashboard-top-ticker {
        margin-top: -1rem;
        margin-left: calc(50% - 50vw);
        margin-right: calc(50% - 50vw);
    }
    .cookie-banner {
        left: 8px;
        right: 8px;
        bottom: 8px;
        flex-direction: column;
        align-items: stretch;
    }
    .cookie-banner-actions {
        width: 100%;
        justify-content: flex-end;
    }
    .page-header h1 { font-size: 1.5rem; }
    .predictions-grid { grid-template-columns: 1fr; }
    .reports-grid { grid-template-columns: 1fr; }
    .report-game-row {
        grid-template-columns: 1fr;
        gap: 0.2rem;
        text-align: left;
    }
    .report-game-row .center { text-align: left; }
    .report-game-row .right { justify-content: flex-start; }
    .team-stats-grid { grid-template-columns: repeat(auto-fill, minmax(85px, 1fr)); }
    .insight-ticker-track { animation-duration: 90s; }
    .accuracy-banner, .sim-meta { gap: 1.5rem; padding: 1rem; }
    .dashboard-top-grid { grid-template-columns: 1fr !important; }
    #waitlist-email { min-width: 0 !important; width: 100%; }
    #impact-movers-grid { grid-template-columns: 1fr !important; }
    #impact-story-strip {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.5rem;
        padding: 0.5rem;
    }
    #impact-story-strip .insight-card {
        padding: 0.55rem 0.65rem;
        min-height: 68px;
    }
    .chart-container-wide { padding: 1rem; }

    /* Touch targets and controls */
    .filter-btn,
    .theme-toggle,
    .nav-menu-toggle,
    .trajectory-team-chip {
        min-height: 40px;
    }
    .filter-btn {
        padding: 0.45rem 0.8rem;
        font-size: 0.86rem;
    }

    /* Dense data views: standings/simulations/history tables */
    .standings-table {
        font-size: 0.8rem;
    }
    .standings-table th,
    .standings-table td {
        padding: 0.5rem 0.55rem;
    }
    .table-wrapper {
        -webkit-overflow-scrolling: touch;
    }
    .zone-legend {
        display: grid;
        grid-template-columns: 1fr;
        gap: 0.35rem;
        padding: 0.55rem 0.75rem;
    }

    /* Simulations / summary cards */
    .sim-meta,
    .accuracy-banner {
        flex-wrap: wrap;
        justify-content: flex-start;
        gap: 0.8rem;
        padding: 0.8rem;
    }
    .meta-item,
    .accuracy-stat {
        min-width: 120px;
        align-items: flex-start;
    }
    .meta-val {
        font-size: 0.95rem;
    }

    /* Trajectory readability on mobile */
    #trajectory-team-legend {
        gap: 0.4rem !important;
    }
    .trajectory-team-chip {
        font-size: 0.78rem;
        padding: 0.3rem 0.55rem;
    }
    .trajectory-chart-panel {
        padding: 0.55rem;
    }
    #allTeamsTrajectoryChart {
        height: 270px !important;
    }
    #teamFocusChart {
        height: 240px !important;
    }
}

@media (max-width: 480px) {
    .navbar {
        height: 60px;
        padding: 0 0.75rem 0 6.6rem;
    }
    .brand-floating {
        top: 2px;
        left: 6px;
    }
    .brand-floating-logo {
        width: 82px;
        height: 82px;
    }
    .nav-links {
        top: 60px;
    }
    .global-ops-status {
        padding-left: 6.6rem;
    }
    #impact-story-strip {
        grid-template-columns: 1fr;
    }
    .container {
        padding: 0.75rem;
    }
    .global-ad-slot {
        width: calc(100% - 1.5rem);
    }
    .dashboard-top-ticker {
        margin-top: -0.75rem;
        margin-left: calc(50% - 50vw);
        margin-right: calc(50% - 50vw);
    }
    .page-header {
        margin-bottom: 1.1rem;
    }
    .page-header h1 {
        font-size: 1.35rem;
    }
    .subtitle {
        font-size: 0.9rem;
    }
    .team-crest-card {
        width: 24px;
        height: 24px;
    }
    .match-card {
        padding: 1rem;
    }
    .team {
        font-size: 1.2rem;
    }
    .report-foot {
        flex-direction: column;
        gap: 0.2rem;
    }
}
