:root {
    --border: #d8dce0;
    --bg: #f5f6f8;
    --card-bg: #ffffff;
    --text: #1c2226;
    --muted: #6b7280;
    --primary: #1c5fbe;
    --win: #1a8a4a;
    --loss: #c23636;
    --push: #b8860b;
    --pending: #6b7280;
    --live: #d97706;
}

* { box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    margin: 0;
    font-size: 14px;
}

.site-header {
    background: #10233f;
    color: white;
    padding: 10px 0;
}

.site-header-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
}

.brand {
    color: white;
    text-decoration: none;
    font-weight: 700;
    font-size: 18px;
}

.main-nav {
    display: flex;
    align-items: center;
}

.main-nav a {
    color: #cbd5e1;
    text-decoration: none;
    margin-left: 20px;
    font-weight: 500;
}

.main-nav a:hover { color: white; }

.nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    width: 32px;
    height: 32px;
    padding: 0;
    background: transparent;
    border: none;
    cursor: pointer;
}

.nav-toggle span {
    display: block;
    width: 100%;
    height: 2px;
    background: #e2e8f0;
    border-radius: 1px;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.nav-toggle.open span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.nav-toggle.open span:nth-child(2) { opacity: 0; }
.nav-toggle.open span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

@media (max-width: 640px) {
    .nav-toggle { display: flex; }

    .main-nav {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        flex-direction: column;
        align-items: stretch;
        background: #10233f;
        border-top: 1px solid #1e3a5f;
        padding: 8px 16px 16px;
    }

    .main-nav.open { display: flex; }

    .main-nav a {
        margin-left: 0;
        padding: 10px 0;
        border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    }

    .nav-user {
        margin-left: 0;
        padding: 10px 0;
    }

    .logout-form {
        margin-left: 0;
        margin-top: 8px;
    }

    .logout-button {
        width: 100%;
        padding: 8px 10px;
    }
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 16px;
}

h1 { font-size: 22px; margin: 8px 0 16px; }
h2.section-heading { font-size: 16px; margin: 24px 0 10px; }

.messages { list-style: none; padding: 0; margin: 0 0 12px; }
.message {
    padding: 8px 12px;
    border-radius: 4px;
    margin-bottom: 6px;
    font-size: 13px;
}
.message.success { background: #dcf5e3; color: #1a5c33; }
.message.warning { background: #fff3cd; color: #7a5b00; }
.message.error { background: #fbdada; color: #942222; }

.date-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 10px 14px;
    margin-bottom: 12px;
}

.nav-arrow {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    font-size: 13px;
    white-space: nowrap;
}

.current-date { display: flex; align-items: center; gap: 10px; min-width: 0; }
.current-date-label { font-weight: 700; font-size: 16px; }
.date-picker-form input[type="date"] { border: 1px solid var(--border); border-radius: 4px; padding: 4px 6px; }

.refresh-form {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

@media (max-width: 700px) {
    .date-nav {
        display: grid;
        grid-template-columns: 1fr 1fr;
        grid-template-areas:
            "current current"
            "prev next";
        gap: 10px 12px;
        padding: 12px;
    }

    .current-date {
        grid-area: current;
        flex-direction: column-reverse;
        justify-content: center;
        gap: 8px;
    }

    .current-date-label {
        font-size: 15px;
        text-align: center;
        line-height: 1.3;
    }

    .date-picker-form {
        width: 100%;
        display: flex;
        justify-content: center;
    }

    .date-picker-form input[type="date"] {
        width: 100%;
        max-width: 200px;
        min-height: 36px;
    }

    .nav-arrow-prev { grid-area: prev; justify-self: start; }
    .nav-arrow-next { grid-area: next; justify-self: end; text-align: right; }

    .refresh-form {
        flex-direction: column;
        align-items: stretch;
    }

    .refresh-form .btn {
        width: 100%;
    }
}

.btn {
    border: none;
    border-radius: 5px;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}
.btn-secondary { background: #e7ebf0; color: var(--text); }
.btn-secondary:hover { background: #dbe1e8; }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: #164a97; }
.btn-large { padding: 14px 28px; font-size: 16px; }
.btn-small { padding: 5px 10px; font-size: 12px; }
.btn:disabled { opacity: 0.6; cursor: default; }

.muted { color: var(--muted); }
.small { font-size: 12px; }

.summary-banner, .saved-banner {
    background: #eef4ff;
    border: 1px solid #c7dbff;
    border-radius: 6px;
    padding: 8px 14px;
    margin-bottom: 12px;
    font-size: 13px;
}
.saved-banner { background: #dcf5e3; border-color: #b7e6c6; }
.summary-money {
    margin-top: 4px;
}
.summary-balance.bal-up { color: var(--win); }
.summary-balance.bal-down { color: var(--loss); }

.live-tracker { margin-bottom: 14px; }
.live-tracker-heading-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
}
.live-tracker-heading {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.4px;
    color: var(--muted);
}
.live-tracker-refresh-form { margin: 0; }
.live-tracker-list {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}
.live-tracker-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 10px 12px;
}
.live-tracker-header {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
}
.live-tracker-matchup { font-weight: 700; font-size: 13px; }
.live-tracker-score { font-weight: 700; font-size: 13px; }
.live-tracker-inning { color: var(--muted); font-size: 12px; }
.live-tracker-bal {
    margin-left: auto;
    font-weight: 700;
    font-size: 12px;
    color: var(--text);
}
.live-tracker-bal.bal-up { color: var(--win); }
.live-tracker-bal.bal-down { color: var(--loss); }
.live-tracker-picks {
    display: flex;
    flex-direction: column;
    gap: 5px;
}
.live-pick-chip {
    display: block;
    font-size: 12px;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 4px;
    border: 2px solid var(--border);
}
.live-pick-win { background: #eef4ff; border-color: #1c5fbe; color: #1c5fbe; }
.live-pick-loss { background: #fff4d6; border-color: #d97706; color: #92400e; }
.live-pick-pending { background: #f5f6f8; border-color: var(--border); color: var(--muted); }
.live-pick-final-win { background: #dcf5e3; border-color: var(--win); color: var(--win); }
.live-pick-final-loss { background: #fbdada; border-color: var(--loss); color: var(--loss); }
.live-pick-final-push { background: #fdf3d9; border-color: var(--push); color: var(--push); }

@media (max-width: 700px) {
    .live-tracker-list { grid-template-columns: 1fr; }
    .live-tracker-heading-row { align-items: stretch; }
    .live-tracker-refresh-form .btn { width: 100%; }
}

.missing-picks-banner {
    background: #fff4d6;
    border: 1px solid #f0d78c;
    border-radius: 6px;
    padding: 8px 14px;
    margin-bottom: 12px;
    font-size: 13px;
    font-weight: 600;
}
.missing-picks-banner-complete {
    background: #dcf5e3;
    border-color: #b7e6c6;
    font-weight: 400;
}

.games-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

.game-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 10px 14px;
    position: relative;
    overflow: hidden;
}

.game-card.game-final { border-left: 4px solid var(--win); }
.game-card.game-live { border-left: 4px solid var(--live); }

/* Subtle team-colored accent: a thin two-tone bar along the top of each
   card, split between the away and home team's primary color. Purely
   decorative - delete the .team-color-bar rule (and the two inline
   background/color styles on .away-team/.home-team below) to revert. */
.team-color-bar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(to right, var(--away-color) 0%, var(--away-color) 50%, var(--home-color) 50%, var(--home-color) 100%);
}

.game-card-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 4px;
    margin-top: 4px;
}

.matchup { font-size: 16px; font-weight: 700; display: flex; align-items: center; }
.at-sign { color: var(--muted); margin: 0 6px; font-weight: 400; }
.away-team, .home-team {
    padding: 2px 8px;
    border-radius: 4px;
    letter-spacing: 0.3px;
}

.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 700;
    margin-right: 6px;
}
.badge-final { background: #dcf5e3; color: var(--win); }
.badge-live { background: #fef1dd; color: var(--live); }
.badge-scheduled { background: #e7ebf0; color: var(--text); }
.score { font-weight: 600; font-size: 13px; }

.game-card-meta {
    display: flex;
    gap: 24px;
    margin-bottom: 8px;
    font-size: 12px;
    flex-wrap: wrap;
}
.team-meta { flex: 1; min-width: 200px; }
.team-meta .record { color: var(--muted); margin-left: 6px; }
.pitcher { color: var(--muted); margin-top: 2px; }
.pitcher-stats { margin-left: 6px; }

.stats-section {
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    padding: 6px 0;
    margin-bottom: 8px;
}
.stats-heading {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: var(--muted);
    margin-bottom: 4px;
}
.stats-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}
.stats-table th, .stats-table td {
    text-align: center;
    padding: 2px 6px;
}
.stats-table th:first-child, .stats-table td:first-child {
    text-align: left;
    color: var(--muted);
    font-weight: 400;
    width: 45%;
}
.stats-table th { font-weight: 700; }
.stats-table tr:not(:last-child) td { border-bottom: 1px solid #eef0f2; }
.chris-metrics-divider td { padding: 2px 0; border-bottom: none !important; }
.chris-metrics-divider hr { border: none; border-top: 1px dashed var(--border); margin: 2px 0; }
.chris-metrics-row td { font-weight: 700; border-bottom: none !important; }
.chris-metrics-row td:first-child { color: var(--text); font-size: 10px; letter-spacing: 0.5px; }

.side-by-side {
    display: flex;
    gap: 14px;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    padding: 6px 0;
    margin-bottom: 10px;
}

.injuries-section, .h2h-section {
    flex: 1;
    min-width: 0;
    font-size: 12px;
}
.injuries-section { padding-right: 14px; border-right: 1px solid var(--border); }

.injuries-team { margin-bottom: 3px; }
.injuries-team:last-child { margin-bottom: 0; }
.injuries-team-label { font-weight: 700; margin-right: 4px; }
.injuries-list { color: #a15c00; }

.h2h-summary { font-weight: 700; margin-bottom: 2px; }
.h2h-meetings { line-height: 1.5; }

.weather-line {
    font-size: 12px;
    margin-bottom: 10px;
}
.weather-label { color: var(--muted); margin-right: 6px; }
.park-factor-sep { color: var(--border); margin: 0 6px; }
.park-factor-label { color: var(--muted); margin-right: 6px; }
.park-factor-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 8px;
    letter-spacing: 0.2px;
    vertical-align: middle;
}
.park-factor-hitter { background: #fde4cf; color: #c2410c; }
.park-factor-neutral { background: #e5e7eb; color: #4b5563; }
.park-factor-pitcher { background: #dbeafe; color: #1d4ed8; }

.ai-section {
    position: relative;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    padding: 8px 0;
    margin-bottom: 10px;
}
.ai-loading-overlay {
    display: none;
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.85);
    align-items: center;
    justify-content: center;
    z-index: 2;
}
.ai-loading-overlay.active { display: flex; }
.ai-spinner {
    width: 22px;
    height: 22px;
    border: 3px solid #dbe1e8;
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: ai-spin 0.7s linear infinite;
}
@keyframes ai-spin {
    to { transform: rotate(360deg); }
}
.ai-result:empty { margin-bottom: 0; }
.ai-result { margin-bottom: 8px; }
.ai-prediction {
    background: #f3f6fa;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 8px 10px;
    font-size: 12px;
}
.ai-overall { margin-bottom: 8px; line-height: 1.4; }
.ai-pick-block { margin-bottom: 8px; }
.ai-pick-block:last-of-type { margin-bottom: 0; }
.ai-pick { margin-bottom: 2px; }
.ai-confidence { color: var(--muted); }
.ai-why { color: var(--muted); line-height: 1.4; }
.ai-why em { color: var(--text); font-style: normal; font-weight: 600; }
.ai-missing { color: var(--muted); margin-top: 6px; }
.ai-missing ul { margin: 4px 0 0; padding-left: 18px; }
.ai-missing li { margin-bottom: 2px; }
.ai-timestamp { margin-top: 6px; }
.ai-error { color: #b3261e; font-size: 12px; margin-bottom: 6px; }

.picks-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

@media (max-width: 900px) {
    .picks-grid { grid-template-columns: 1fr 1fr; }
}

.pick-group {
    border: 1px solid var(--border);
    border-radius: 5px;
    padding: 6px 8px;
    margin: 0;
    position: relative;
}
.pick-group legend {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--muted);
    padding: 0 2px;
}

.radio-option {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 3px 4px;
    border-radius: 3px;
    font-size: 13px;
    cursor: pointer;
}
.radio-option:hover { background: #f0f3f7; }
.radio-option.selected {
    background: #dbe9ff;
    font-weight: 700;
}
.radio-option.small { display: inline-flex; margin-right: 4px; padding: 3px 6px; }

.confidence-options { display: flex; align-items: center; flex-wrap: wrap; }

.save-game-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
}
.save-game-status { font-size: 12px; }
.save-game-status-success { color: var(--win); font-weight: 600; }
.save-game-status-error { color: var(--loss); font-weight: 600; }

.fav-meter {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 8px;
    margin-left: 6px;
    letter-spacing: 0.2px;
    vertical-align: middle;
}
.fav-meter-tossup { background: #e5e7eb; color: #4b5563; }
.fav-meter-slight { background: #dbeafe; color: #1d4ed8; }
.fav-meter-moderate { background: #fef3c7; color: #92400e; }
.fav-meter-heavy { background: #fde4cf; color: #c2410c; }
.fav-meter-lock { background: #fbdada; color: #b91c1c; }

.clear-btn {
    background: none;
    border: none;
    color: var(--muted);
    font-size: 11px;
    cursor: pointer;
    text-decoration: underline;
    padding: 2px 0;
}

.picks-readout {
    border-top: 1px solid var(--border);
    padding-top: 6px;
    font-size: 13px;
}
.pick-line { margin-bottom: 2px; }

.result-badge {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 700;
    margin-left: 4px;
}
.result-win { background: #dcf5e3; color: var(--win); }
.result-loss { background: #fbdada; color: var(--loss); }
.result-push { background: #fff3cd; color: var(--push); }
.result-pending { background: #e7ebf0; color: var(--pending); }

.save-bar {
    text-align: center;
    margin: 24px 0;
}

.results-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}
@media (max-width: 800px) {
    .results-grid { grid-template-columns: repeat(2, 1fr); }
}
.results-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 12px;
    text-align: center;
}
.results-card h2, .results-card h3 { margin: 0 0 6px; font-size: 13px; color: var(--muted); text-transform: uppercase; }
.results-card .record { font-size: 20px; font-weight: 700; margin: 0; }
.results-card .pct { margin: 4px 0 0; color: var(--muted); }

.history-date-form { margin-bottom: 8px; }

.nav-user {
    margin-left: 20px;
    color: #94a3b8;
    font-size: 13px;
}

.logout-form {
    margin: 0;
    margin-left: 12px;
}

.logout-button {
    background: transparent;
    border: 1px solid #64748b;
    color: #e2e8f0;
    border-radius: 4px;
    padding: 4px 10px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
}

.logout-button:hover {
    border-color: #e2e8f0;
    color: white;
}

.home-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(160deg, #0f172a 0%, #1e3a5f 55%, #10233f 100%);
}

.home-hero {
    text-align: center;
    color: white;
    padding: 32px 24px;
    max-width: 480px;
}

.home-hero h1 {
    font-size: 32px;
    margin: 0 0 12px;
}

.home-lead {
    color: #cbd5e1;
    margin: 0 0 28px;
    font-size: 16px;
    line-height: 1.5;
}

.btn-google {
    display: inline-block;
    background: white;
    color: #10233f;
    text-decoration: none;
    font-weight: 600;
    padding: 12px 24px;
    border-radius: 6px;
    font-size: 15px;
}

.btn-google:hover {
    background: #f1f5f9;
}

.home-setup-hint {
    color: #fecaca;
    background: rgba(127, 29, 29, 0.45);
    border: 1px solid #f87171;
    border-radius: 6px;
    padding: 12px 16px;
    font-size: 14px;
    line-height: 1.5;
    text-align: left;
}

.home-setup-hint code {
    font-size: 13px;
    background: rgba(0, 0, 0, 0.25);
    padding: 1px 4px;
    border-radius: 3px;
}
