:root {
    --navy-950: #07111f;
    --navy-900: #101d35;
    --navy-800: #172844;
    --navy-700: #28405f;
    --ink: #172033;
    --muted: #697386;
    --line: #dce2ea;
    --surface: #ffffff;
    --surface-soft: #f4f7fa;
    --field: #16825d;
    --field-dark: #0c6547;
    --gold: #f4b63e;
    --gold-soft: #fff2d3;
    --red: #bd3344;
    --red-soft: #fff0f2;
    --success: #087f5b;
    --shadow: 0 18px 50px rgba(13, 29, 52, .09);
    --radius: 18px;
}

* { box-sizing: border-box; }

html { color-scheme: light; scroll-behavior: smooth; }

body {
    margin: 0;
    min-height: 100vh;
    color: var(--ink);
    background: var(--surface-soft);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.5;
}

button, input, select, textarea { font: inherit; }
button, select { cursor: pointer; }
a { color: inherit; }

.site-header {
    min-height: 74px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 12px max(20px, calc((100vw - 1180px) / 2));
    color: white;
    background: var(--navy-900);
    border-bottom: 3px solid var(--field);
    position: sticky;
    top: 0;
    z-index: 20;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 11px;
    color: white;
    text-decoration: none;
    line-height: 1.05;
}

.brand-mark {
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    color: white;
    background: var(--field);
    border: 2px solid rgba(255,255,255,.75);
    border-radius: 13px 13px 13px 5px;
    transform: rotate(-3deg);
    font-size: 17px;
}

.brand strong, .brand small { display: block; }
.brand strong { font-size: 15px; letter-spacing: .01em; }
.brand small { margin-top: 4px; color: #b8c7da; font-size: 11px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; }
.brand-centered { justify-content: center; color: var(--ink); }
.brand-centered .brand-mark { color: white; }
.brand-centered small { color: var(--muted); }

.main-nav { display: flex; align-items: center; gap: 5px; }
.main-nav a { padding: 9px 13px; color: #c8d3e1; border-radius: 10px; text-decoration: none; font-size: 14px; font-weight: 700; }
.main-nav a:hover, .main-nav a.active { color: white; background: rgba(255,255,255,.1); }
.nav-toggle { display: none; padding: 8px 12px; color: white; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.16); border-radius: 10px; }

.page-shell { width: min(1180px, calc(100% - 40px)); margin: 0 auto; padding: 42px 0 72px; }
.site-footer { padding: 24px 20px 38px; color: #7b8798; text-align: center; font-size: 13px; }

.page-heading { margin-bottom: 28px; }
.page-heading h1 { margin: 5px 0 7px; color: var(--navy-900); font-size: clamp(30px, 5vw, 46px); line-height: 1.05; letter-spacing: -.035em; }
.page-heading p { max-width: 650px; margin: 0; color: var(--muted); }
.split-heading { display: flex; justify-content: space-between; align-items: flex-end; gap: 30px; }
.eyebrow { display: block; color: var(--field-dark); font-size: 11px; font-weight: 900; letter-spacing: .15em; text-transform: uppercase; }

.week-switcher { min-width: 220px; }
.week-switcher label { display: block; margin-bottom: 5px; color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.week-switcher select { width: 100%; }

input, select, textarea {
    width: 100%;
    color: var(--ink);
    background: white;
    border: 1px solid #cdd5df;
    border-radius: 10px;
    outline: none;
    transition: border-color .15s, box-shadow .15s;
}

input, select { min-height: 44px; padding: 9px 11px; }
textarea { padding: 11px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--field); box-shadow: 0 0 0 3px rgba(22, 130, 93, .14); }
input:disabled, select:disabled { color: #7d8795; background: #edf1f5; cursor: not-allowed; }
label { color: #384356; font-size: 13px; font-weight: 750; }
label > input, label > select, label > textarea { display: block; margin-top: 6px; font-weight: 500; }

.button {
    min-height: 43px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 9px 17px;
    border: 0;
    border-radius: 11px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 850;
    transition: transform .12s, background .12s, box-shadow .12s;
}
.button:hover { transform: translateY(-1px); }
.button-primary { color: white; background: var(--field); box-shadow: 0 8px 18px rgba(22,130,93,.2); }
.button-primary:hover { background: var(--field-dark); }
.button-secondary { color: white; background: var(--navy-800); }
.button-danger { color: var(--red); background: var(--red-soft); }
.button-quiet { min-height: 36px; padding: 7px 12px; color: var(--navy-800); background: #e8edf3; }
.button-full { width: 100%; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.section-block { margin-bottom: 24px; padding: 24px; }
.section-heading { display: flex; justify-content: space-between; align-items: center; gap: 18px; margin-bottom: 20px; }
.section-heading h2 { margin: 4px 0 0; color: var(--navy-900); font-size: 21px; }
.section-tag { padding: 6px 9px; color: var(--navy-700); background: #ecf1f6; border-radius: 8px; font-size: 12px; font-weight: 800; }

.alert { margin: 0 0 20px; padding: 13px 15px; border: 1px solid; border-radius: 12px; font-size: 14px; font-weight: 650; }
.alert-success { color: #075e44; background: #e8f8f2; border-color: #b9e8d8; }
.alert-error { color: #8f2332; background: var(--red-soft); border-color: #f0c2c8; }
.alert-info { color: #31536f; background: #edf6fc; border-color: #c9e1f1; }

.status-strip {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    margin-bottom: 18px;
    background: var(--navy-900);
    border-radius: 15px;
    overflow: hidden;
}
.status-strip div { display: flex; flex-direction: column; align-items: center; padding: 15px 12px; color: white; border-right: 1px solid rgba(255,255,255,.1); }
.status-strip div:last-child { border-right: 0; }
.status-strip strong { font-size: 19px; }
.status-strip span { color: #b4c3d7; font-size: 11px; font-weight: 700; letter-spacing: .04em; }

.privacy-note { display: flex; align-items: center; gap: 9px; margin-bottom: 20px; padding: 11px 14px; color: #6b5325; background: var(--gold-soft); border: 1px solid #f1d58c; border-radius: 11px; font-size: 13px; }
.privacy-note > span { color: var(--gold); font-size: 10px; }
.privacy-note-open { color: #075e44; background: #e8f8f2; border-color: #b9e8d8; }
.privacy-note-open > span { color: var(--success); font-size: 13px; font-weight: 900; }

.game-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.game-card { padding: 0; background: white; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 8px 26px rgba(16,29,53,.06); overflow: hidden; }
.game-card.is-locked { background: #fbfcfd; }
.game-meta { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 15px; color: var(--muted); background: #f4f6f9; border-bottom: 1px solid var(--line); font-size: 12px; font-weight: 700; }
.game-status { padding: 4px 8px; color: var(--field-dark); background: #dcf4e9; border-radius: 999px; font-size: 10px; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; }
.is-locked .game-status { color: #566477; background: #e4e9ef; }
.game-status.status-final { color: #674c10; background: var(--gold-soft); }

.team-choices { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--line); }
.team-choice { min-height: 112px; display: flex; flex-direction: column; justify-content: center; position: relative; padding: 18px; background: white; cursor: pointer; }
.team-choice input { width: 1px; height: 1px; min-height: 0; position: absolute; opacity: 0; }
.team-choice .team-location { color: var(--muted); font-size: 10px; font-weight: 850; letter-spacing: .12em; text-transform: uppercase; }
.team-choice strong { color: var(--navy-900); font-size: 16px; line-height: 1.2; }
.team-choice .team-score { position: absolute; top: 50%; right: 14px; translate: 0 -50%; color: var(--navy-900); font-size: 26px; font-weight: 900; }
.team-choice:has(input:checked) { background: #e9f7f2; box-shadow: inset 0 -4px 0 var(--field); }
.team-choice:has(input:checked)::after { content: "Picked"; position: absolute; top: 9px; right: 9px; padding: 3px 6px; color: white; background: var(--field); border-radius: 999px; font-size: 8px; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; }
.team-choice.actual-winner strong::after { content: " ✓"; color: var(--field); }
.is-locked .team-choice { cursor: default; }

.team-identity { display: flex; align-items: center; gap: 10px; min-width: 0; margin-top: 7px; }
.team-logo-wrap { width: 48px; height: 48px; display: grid; place-items: center; flex: 0 0 auto; position: relative; background: #eef2f6; border: 1px solid #d8e0e9; border-radius: 50%; overflow: hidden; }
.team-logo { width: 88%; height: 88%; position: absolute; object-fit: contain; opacity: 0; transition: opacity .15s; }
.team-logo-wrap.has-logo .team-logo { opacity: 1; }
.team-logo-wrap.has-logo .team-logo-fallback { opacity: 0; }
.team-logo-fallback { color: var(--navy-700); font-size: 10px; font-weight: 900; letter-spacing: .03em; }
.team-copy { min-width: 0; }
.team-copy strong, .team-copy small { display: block; }
.team-copy small { margin-top: 3px; color: var(--muted); font-size: 11px; font-weight: 750; }
.team-identity-compact { gap: 8px; margin-top: 0; }
.team-identity-compact .team-logo-wrap { width: 29px; height: 29px; }
.team-identity-compact .team-copy strong { font-size: 12px; }
.team-identity-compact .team-copy small { margin-top: 0; font-size: 9px; }

.margin-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 14px 15px; border-top: 1px solid var(--line); }
.margin-row > label { font-size: 12px; }
.number-field { display: flex; align-items: center; gap: 7px; }
.number-field input { width: 64px; min-height: 38px; margin: 0; text-align: center; }
.number-field span { color: var(--muted); font-size: 12px; }
.your-pick, .opponent-pick { padding: 10px 15px; border-top: 1px solid var(--line); font-size: 12px; }
.your-pick { color: var(--navy-700); background: #f4f7fa; }
.opponent-pick { color: #624e20; background: #fffaee; }
.muted { color: var(--muted); }

.sticky-submit { display: flex; align-items: center; justify-content: space-between; gap: 18px; position: sticky; bottom: 14px; z-index: 10; margin-top: 20px; padding: 14px 16px; color: white; background: rgba(16,29,53,.96); border: 1px solid rgba(255,255,255,.12); border-radius: 14px; box-shadow: 0 14px 35px rgba(7,17,31,.24); backdrop-filter: blur(8px); }
.sticky-submit span { color: #c8d3e1; font-size: 13px; }

.empty-state { padding: 54px 25px; text-align: center; }
.empty-state h1, .empty-state h2 { margin: 10px 0 6px; color: var(--navy-900); }
.empty-state p { max-width: 460px; margin: 0 auto 20px; color: var(--muted); }
.empty-state.compact { padding: 28px 20px; background: var(--surface-soft); border-radius: 12px; box-shadow: none; }
.empty-state.compact p { margin-bottom: 0; }
.empty-icon { display: block; color: var(--field); font-size: 38px; }

.scoreboard-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; margin-bottom: 20px; }
.score-card { display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; gap: 18px; padding: 19px; background: white; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.score-card.score-leader { border-color: #d5ad50; box-shadow: 0 18px 45px rgba(194,142,29,.14); }
.score-rank { color: #8b96a5; font-size: 12px; font-weight: 900; }
.score-person { display: flex; align-items: center; gap: 10px; }
.profile-avatar { width: 43px; height: 43px; display: inline-grid; place-items: center; flex: 0 0 auto; color: white; background: var(--navy-800); border-radius: 50%; font-weight: 900; }
.profile-avatar.small { width: 36px; height: 36px; font-size: 13px; }
.score-stat { min-width: 68px; text-align: center; }
.score-stat strong, .score-stat span { display: block; }
.score-stat strong { color: var(--navy-900); font-size: 25px; line-height: 1; }
.score-stat span { margin-top: 5px; color: var(--muted); font-size: 10px; font-weight: 800; text-transform: uppercase; }
.score-hidden { color: var(--muted); font-size: 12px; font-style: italic; }

.winner-banner { display: flex; align-items: center; gap: 20px; margin-bottom: 24px; padding: 24px; color: white; background: linear-gradient(120deg, var(--navy-900), #294464); border-radius: var(--radius); box-shadow: var(--shadow); }
.winner-banner.is-final { background: linear-gradient(120deg, #684f17, #a77e21); }
.winner-banner .eyebrow { color: #dce5f0; }
.winner-banner h2 { margin: 4px 0; font-size: 25px; }
.winner-banner p { margin: 0; color: #d9e2ed; }
.trophy { width: 58px; height: 58px; display: grid; place-items: center; flex: 0 0 auto; color: var(--gold); background: rgba(255,255,255,.12); border-radius: 50%; font-size: 26px; }

.comparison-list { border: 1px solid var(--line); border-radius: 13px; overflow: hidden; }
.comparison-row { display: grid; grid-template-columns: 1fr 1.4fr; gap: 24px; padding: 15px; border-bottom: 1px solid var(--line); }
.comparison-row:last-child { border-bottom: 0; }
.comparison-game > .comparison-status { display: block; margin-top: 5px; color: var(--muted); font-size: 12px; }
.comparison-game .team-identity + .at-divider { margin: 2px 0 2px 37px; color: #9aa4b2; font-size: 9px; font-weight: 900; text-transform: uppercase; }
.comparison-picks { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.comparison-picks div { padding: 8px 10px; background: var(--surface-soft); border-radius: 9px; }
.comparison-picks span, .comparison-picks strong { display: block; }
.comparison-picks span { color: var(--muted); font-size: 10px; font-weight: 800; text-transform: uppercase; }
.comparison-picks strong { margin-top: 2px; font-size: 12px; }

.season-totals { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.season-totals > div { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 11px; padding: 15px; background: var(--surface-soft); border-radius: 13px; }
.season-totals small { grid-column: 2; margin-top: -14px; color: var(--muted); }
.season-number { grid-row: span 2; color: var(--navy-900); font-size: 32px; font-weight: 900; }

.auth-shell { min-height: 100vh; display: grid; place-items: center; padding: 30px 18px; background: radial-gradient(circle at 50% 15%, #294769 0, var(--navy-900) 38%, var(--navy-950) 100%); }
.auth-card { width: min(470px, 100%); padding: 32px; background: white; border-radius: 22px; box-shadow: 0 30px 90px rgba(0,0,0,.3); }
.setup-shell .auth-card { width: min(720px, 100%); }
.auth-heading { margin: 30px 0 22px; text-align: center; }
.auth-heading h1 { margin: 4px 0 7px; color: var(--navy-900); font-size: 32px; letter-spacing: -.03em; }
.auth-heading p { margin: 0; color: var(--muted); }
.stacked-form { display: grid; gap: 15px; }
.form-grid { display: grid; gap: 13px; }
.two-column { grid-template-columns: repeat(2, 1fr); }
.three-column { grid-template-columns: 1fr 1fr 1.2fr; }
.result-grid { grid-template-columns: 1fr 1fr 1.4fr; }
.form-help { margin: -3px 0 0; color: var(--muted); font-size: 12px; font-weight: 450; }
.team-code-reference { margin-top: 18px; padding-top: 15px; border-top: 1px solid var(--line); }
.team-code-reference summary { color: var(--navy-700); cursor: pointer; font-size: 12px; font-weight: 800; }
.team-code-reference > div { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px 15px; margin-top: 12px; }
.team-code-reference span { color: var(--muted); font-size: 11px; }
.team-code-reference strong { display: inline-block; width: 34px; color: var(--navy-900); }

.profile-picker { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; margin: 0; padding: 0; border: 0; }
.profile-picker legend { grid-column: 1 / -1; margin-bottom: 7px; color: #384356; font-size: 13px; font-weight: 750; }
.profile-option { display: flex; align-items: center; gap: 10px; position: relative; padding: 12px; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; }
.profile-option input { width: 1px; min-height: 0; position: absolute; opacity: 0; }
.profile-option:has(input:checked) { background: #e9f7f2; border-color: var(--field); box-shadow: 0 0 0 2px rgba(22,130,93,.1); }

.admin-layout { display: grid; grid-template-columns: minmax(0, 1.8fr) minmax(280px, .8fr); gap: 24px; align-items: start; }
.admin-sidebar { position: sticky; top: 98px; }
.admin-game-list { display: grid; gap: 14px; }
.admin-game-card { padding: 17px; background: var(--surface-soft); border: 1px solid var(--line); border-radius: 13px; }
.admin-game-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 14px; }
.admin-game-heading > span { color: var(--muted); font-size: 12px; }
.admin-matchup-preview { display: flex; align-items: center; gap: 7px; min-width: 0; }
.admin-matchup-preview > span { font-size: 10px; font-weight: 800; text-transform: uppercase; }
.admin-home-row { margin-top: 13px; }
.card-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 14px; }
.player-admin-row { display: grid; gap: 10px; padding: 15px 0; border-bottom: 1px solid var(--line); }
.player-admin-row:last-child { border-bottom: 0; padding-bottom: 0; }
.player-admin-row > div { display: flex; justify-content: space-between; gap: 10px; }
.player-admin-row > div span { color: var(--muted); font-size: 11px; }
.rules-card { padding: 22px; color: white; background: var(--navy-900); border-color: var(--navy-900); }
.rules-card .eyebrow { color: #9fb2c9; }
.rules-card ul { margin: 13px 0 0; padding-left: 20px; color: #d5dfeb; font-size: 13px; }
.rules-card li + li { margin-top: 8px; }
.upgrade-card { max-width: 700px; }
.upgrade-list { margin: 0 0 24px; padding-left: 21px; color: var(--muted); }
.upgrade-list li + li { margin-top: 8px; }
.upgrade-card .empty-state .button { margin: 4px; }

@media (max-width: 850px) {
    .game-grid, .scoreboard-grid { grid-template-columns: 1fr; }
    .admin-layout { grid-template-columns: 1fr; }
    .admin-sidebar { position: static; }
    .three-column { grid-template-columns: 1fr 1fr; }
    .three-column label:last-child { grid-column: 1 / -1; }
}

@media (max-width: 650px) {
    .site-header { min-height: 65px; padding-inline: 16px; }
    .page-shell { width: min(100% - 26px, 1180px); padding-top: 28px; }
    .nav-toggle { display: inline-flex; }
    .main-nav { display: none; min-width: 170px; flex-direction: column; align-items: stretch; position: absolute; top: 60px; right: 14px; padding: 8px; background: var(--navy-800); border: 1px solid rgba(255,255,255,.12); border-radius: 12px; box-shadow: 0 18px 40px rgba(0,0,0,.3); }
    .main-nav.is-open { display: flex; }
    .split-heading { align-items: stretch; flex-direction: column; gap: 18px; }
    .week-switcher { width: 100%; }
    .status-strip span { font-size: 9px; }
    .game-grid { gap: 14px; }
    .sticky-submit { align-items: stretch; flex-direction: column; bottom: 8px; }
    .sticky-submit .button { width: 100%; }
    .score-card { grid-template-columns: auto 1fr auto; gap: 12px; }
    .score-stat:last-child { grid-column: 3; }
    .score-hidden { grid-column: 3; text-align: right; }
    .comparison-row { grid-template-columns: 1fr; gap: 10px; }
    .section-block { padding: 18px; }
    .season-totals { grid-template-columns: 1fr; }
    .two-column, .three-column, .result-grid { grid-template-columns: 1fr; }
    .three-column label:last-child { grid-column: auto; }
    .auth-card { padding: 25px 20px; }
    .card-actions { align-items: stretch; flex-direction: column; }
    .card-actions .button { width: 100%; }
    .team-code-reference > div { grid-template-columns: 1fr; }
}

@media (max-width: 420px) {
    .team-choice { min-height: 108px; padding: 14px; }
    .team-choice strong { font-size: 15px; }
    .team-logo-wrap { width: 42px; height: 42px; }
    .team-choice .team-score { position: static; margin-top: 6px; translate: none; }
    .margin-row { align-items: flex-start; flex-direction: column; }
    .number-field { width: 100%; }
    .number-field input { width: 80px; }
    .comparison-picks { grid-template-columns: 1fr; }
    .profile-picker { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
    * { scroll-behavior: auto !important; transition: none !important; }
}
