*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; background: #f0f4f8; color: #1a1a2e; line-height: 1.6; -webkit-font-smoothing: antialiased; }
a { color: #2563eb; text-decoration: none; transition: color 0.2s; }
a:hover { text-decoration: underline; color: #1d4ed8; }

.navbar { background: #1e3a5f; color: #fff; padding: 0.75rem 1.25rem; display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 100; box-shadow: 0 2px 8px rgba(30,58,95,0.3); }
.nav-brand { color: #f97316; font-weight: 800; font-size: 1.15rem; letter-spacing: 0.3px; transition: opacity 0.2s; }
.nav-brand:hover { text-decoration: none; opacity: 0.9; }
.nav-links { display: flex; gap: 1.1rem; align-items: center; }
.nav-links a { color: #fff; font-size: 0.9rem; font-weight: 500; transition: color 0.2s; }
.nav-links a:hover { color: #f97316; text-decoration: none; }
.nav-btn { background: none; border: none; color: #fff; cursor: pointer; font-size: 0.9rem; font-weight: 500; transition: color 0.2s; }
.nav-btn:hover { color: #f97316; }
.logo-img { height: 32px; margin-right: 0.5rem; vertical-align: middle; }

.pool-indicator { text-align: center; padding: 0.4rem; font-size: 0.8rem; font-weight: 700; letter-spacing: 0.5px; text-transform: uppercase; }
.pool-indicator-live { background: #dcfce7; color: #166534; }
.pool-indicator-sandbox { background: #fef3c7; color: #92400e; }
.pool-list { display: flex; flex-direction: column; gap: 0.75rem; }
.pool-row { display: flex; justify-content: space-between; align-items: center; padding: 0.85rem 1rem; border-radius: 10px; border: 1px solid #e0e7ef; flex-wrap: wrap; gap: 0.5rem; background: #fff; transition: box-shadow 0.2s, border-color 0.2s; }
.pool-row:hover { box-shadow: 0 2px 8px rgba(30,58,95,0.1); }
.pool-row.pool-active { border-color: #22c55e; background: #f0fdf4; }
.pool-info { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.pool-actions { display: flex; gap: 0.5rem; }
.pool-badge { font-size: 0.65rem; padding: 0.15rem 0.45rem; border-radius: 4px; font-weight: 700; text-transform: uppercase; }
.pool-badge-live { background: #22c55e; color: #fff; }
.pool-badge-sandbox { background: #9ca3af; color: #fff; }
.container { max-width: 720px; margin: 0 auto; padding: 1.25rem 1rem; }
h1 { margin-bottom: 1rem; font-size: 1.6rem; color: #1e3a5f; font-weight: 800; }
h2 { margin: 1.5rem 0 0.75rem; font-size: 1.3rem; color: #1e3a5f; font-weight: 700; }
h3 { margin-bottom: 0.5rem; font-size: 1.1rem; color: #1e3a5f; font-weight: 700; }

.card { background: #fff; border-radius: 12px; padding: 1.25rem; margin-bottom: 1rem; box-shadow: 0 2px 8px rgba(30,58,95,0.08); border: 1px solid rgba(30,58,95,0.06); transition: box-shadow 0.2s; }
.card:hover { box-shadow: 0 4px 16px rgba(30,58,95,0.12); }
.form-card { max-width: 420px; }

label { display: block; font-weight: 600; margin: 0.6rem 0 0.3rem; font-size: 0.9rem; color: #374151; }
input[type="text"], input[type="email"], input[type="password"], input[type="number"], select, input[type="file"] {
    width: 100%; padding: 0.65rem 0.75rem; border: 1px solid #d1d5db; border-radius: 8px; font-size: 1rem; margin-bottom: 0.25rem; background: #fff; transition: border-color 0.2s, box-shadow 0.2s;
}
input:focus, select:focus { outline: none; border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37,99,235,0.15); }

.btn { display: inline-block; padding: 0.65rem 1.3rem; border: none; border-radius: 8px; font-size: 0.95rem; font-weight: 600; cursor: pointer; transition: all 0.2s; text-align: center; }
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary { background: #f97316; color: #fff; box-shadow: 0 2px 6px rgba(249,115,22,0.3); }
.btn-primary:hover { background: #ea580c; box-shadow: 0 4px 12px rgba(249,115,22,0.35); text-decoration: none; }
.btn-secondary { background: #64748b; color: #fff; }
.btn-secondary:hover { background: #475569; text-decoration: none; }
.btn-danger { background: #dc2626; color: #fff; box-shadow: 0 2px 6px rgba(220,38,38,0.25); }
.btn-danger:hover { background: #b91c1c; text-decoration: none; }
.btn-sm { padding: 0.4rem 0.85rem; font-size: 0.85rem; }
.btn-block { width: 100%; }

.alert { padding: 0.85rem 1rem; border-radius: 8px; margin-bottom: 1rem; font-size: 0.9rem; font-weight: 500; border-left: 4px solid transparent; }
.alert.info { background: #dbeafe; color: #1e40af; border-left-color: #2563eb; }
.alert.error { background: #fee2e2; color: #991b1b; border-left-color: #dc2626; }

.muted { color: #6b7280; font-size: 0.9rem; }

/* Leaderboard */
.lb-table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(30,58,95,0.08); }
.lb-table th, .lb-table td { padding: 0.7rem 0.6rem; text-align: left; border-bottom: 1px solid #edf2f7; }
.lb-table th { font-size: 0.75rem; text-transform: uppercase; color: #64748b; background: #f8fafc; letter-spacing: 0.5px; font-weight: 700; }
.lb-table tbody tr { transition: background 0.15s; }
.lb-table tbody tr:nth-child(even) { background: #f8fafc; }
.lb-table tbody tr:hover { background: #eff6ff; }
.lb-table .rank { font-weight: 700; color: #1e3a5f; width: 50px; }
.lb-table .pts { font-weight: 700; text-align: right; color: #2563eb; }
.trophy-gold { color: #d97706; }
.trophy-gold .rank { color: #d97706; }
.trophy-silver { color: #64748b; }
.trophy-silver .rank { color: #64748b; }
.trophy-bronze { color: #b45309; }
.trophy-bronze .rank { color: #b45309; }

/* Round nav */
.round-nav { display: flex; gap: 0.5rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.round-tab { padding: 0.55rem 1.1rem; background: #e2e8f0; border-radius: 8px; font-weight: 600; font-size: 0.9rem; color: #475569; display: flex; align-items: center; gap: 0.4rem; transition: all 0.2s; }
a.round-tab { color: #475569; }
a.round-tab.active, a.round-tab.active:hover { background: #1e3a5f; color: #fff; box-shadow: 0 2px 6px rgba(30,58,95,0.25); }
a.round-tab.active .round-name { color: #fff; }
.round-tab:hover { text-decoration: none; opacity: 0.9; transform: translateY(-1px); }
.status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.status-dot.status-open { background: #22c55e; }
.status-dot.status-locked { background: #f59e0b; }
.status-dot.status-finalized { background: #6b7280; }
.round-name { display: block; font-weight: 700; font-size: 1.15rem; color: #1e3a5f; margin-bottom: 0.15rem; }
.round-dates { display: block; font-size: 0.8rem; color: #64748b; font-weight: 500; }

/* Admin tabs */
.admin-tabs { display: flex; gap: 0; margin-bottom: 1.5rem; border-bottom: 2px solid #e2e8f0; }
.admin-tab { padding: 0.75rem 1.5rem; font-weight: 600; font-size: 1rem; color: #64748b; background: none; border: none; border-bottom: 3px solid transparent; cursor: pointer; transition: all 0.2s; margin-bottom: -2px; }
.admin-tab:hover { color: #1e3a5f; }
.admin-tab.active { color: #1e3a5f; border-bottom-color: #f97316; }

/* Matchup cards */
.games-list { display: flex; flex-direction: column; gap: 0.85rem; }
.matchup-card { background: #fff; border-radius: 12px; padding: 0.85rem 1rem; box-shadow: 0 2px 8px rgba(30,58,95,0.06); border: 1px solid rgba(30,58,95,0.05); transition: box-shadow 0.2s; }
.matchup-card:hover { box-shadow: 0 4px 12px rgba(30,58,95,0.1); }
.region-label { font-size: 0.72rem; text-transform: uppercase; color: #64748b; font-weight: 700; margin-bottom: 0.3rem; letter-spacing: 0.5px; }
.game-time { font-size: 0.75rem; color: #94a3b8; margin-bottom: 0.5rem; }
.pick-buttons { display: flex; align-items: center; gap: 0.5rem; }
.pick-btn { flex: 1; padding: 0.75rem 0.5rem; border: 2px solid #e2e8f0; border-radius: 10px; background: #fff; font-size: 0.95rem; font-weight: 600; cursor: pointer; transition: all 0.2s; text-align: center; position: relative; }
.pick-btn:hover:not(:disabled) { border-color: #2563eb; background: #eff6ff; transform: translateY(-1px); }
.pick-btn.selected { border-color: #2563eb; background: #dbeafe; color: #1e40af; box-shadow: 0 2px 8px rgba(37,99,235,0.15); }
.pick-btn.winner { border-color: #22c55e; background: #dcfce7; color: #166534; }
.pick-btn.loser { border-color: #fca5a5; background: #fff5f5; opacity: 0.65; }
.pick-btn:disabled { cursor: default; opacity: 0.85; }
.seed { color: #94a3b8; font-weight: 400; font-size: 0.85rem; }
.score { display: block; font-size: 1.1rem; color: #2563eb; margin-top: 0.25rem; font-weight: 700; }
.vs { font-size: 0.8rem; color: #94a3b8; font-weight: 700; }
.auto-badge { background: #f97316; color: #fff; font-size: 0.65rem; padding: 0.12rem 0.4rem; border-radius: 4px; font-weight: 700; margin-left: 0.25rem; vertical-align: middle; }
.result-line { font-size: 0.8rem; color: #64748b; margin-top: 0.5rem; text-align: center; }
.date-tag { font-size: 0.75rem; color: #64748b; background: #edf2f7; padding: 0.15rem 0.5rem; border-radius: 4px; margin-left: 0.5rem; }
.ff-region-label { display: block; font-weight: 600; font-size: 0.85rem; color: #1e3a5f; margin-top: 0.75rem; margin-bottom: 0.25rem; }
.sync-badge { font-size: 0.65rem; padding: 0.1rem 0.35rem; border-radius: 4px; font-weight: 700; margin-left: 0.25rem; vertical-align: middle; }
.sync-final_updated { background: #d1fae5; color: #065f46; }
.sync-ambiguous { background: #fef3c7; color: #92400e; }
.sync-not_found { background: #fee2e2; color: #991b1b; }
.sync-error { background: #fee2e2; color: #991b1b; }
.sync-skipped { background: #e5e7eb; color: #4b5563; }

/* Save status */
.save-status { font-size: 0.75rem; text-align: center; min-height: 1.2em; margin-top: 0.25rem; }
.save-status.saving { color: #64748b; }
.save-status.saved { color: #16a34a; font-weight: 600; }
.save-status.error { color: #dc2626; font-weight: 600; }
.pick-hint { font-size: 0.85rem; color: #2563eb; margin-bottom: 0.75rem; font-weight: 500; }
.round-section .matchup-card { box-shadow: none; border-bottom: 1px solid #edf2f7; border-radius: 0; padding: 0.85rem 0; border-left: none; border-right: none; border-top: none; }
.round-section .matchup-card:last-child { border-bottom: none; }

/* My picks */
.score-big { font-size: 2rem; font-weight: 800; text-align: center; color: #2563eb; padding: 0.75rem; background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%); border-radius: 12px; }
.picks-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.picks-table th, .picks-table td { padding: 0.55rem 0.4rem; border-bottom: 1px solid #edf2f7; text-align: left; }
.picks-table th { font-size: 0.75rem; text-transform: uppercase; color: #64748b; font-weight: 700; }
.correct { color: #16a34a; font-weight: 600; }
.incorrect { color: #dc2626; font-weight: 600; }
.ff-list { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.ff-chip { background: #dbeafe; color: #1e40af; padding: 0.35rem 0.85rem; border-radius: 20px; font-size: 0.85rem; font-weight: 600; transition: transform 0.2s; }
.ff-chip:hover { transform: scale(1.05); }
.ff-input { margin-bottom: 0.5rem; }

/* Status badges */
.status-badge { display: inline-block; padding: 0.2rem 0.6rem; border-radius: 12px; font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.3px; }
.status-badge.status-open { background: #dcfce7; color: #166534; }
.status-badge.status-locked { background: #fef3c7; color: #92400e; }
.status-badge.status-finalized { background: #e2e8f0; color: #374151; }

/* Admin */
.rounds-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 0.85rem; }
.round-card { display: flex; flex-direction: column; align-items: center; gap: 0.5rem; background: #fff; border-radius: 12px; padding: 1.1rem; text-align: center; box-shadow: 0 2px 8px rgba(30,58,95,0.08); border: 1px solid rgba(30,58,95,0.05); transition: all 0.2s; }
.round-card:hover { text-decoration: none; box-shadow: 0 4px 16px rgba(30,58,95,0.14); transform: translateY(-2px); }
.round-num { font-weight: 700; font-size: 1rem; color: #1e3a5f; }
.back-link { display: inline-flex; align-items: center; margin-bottom: 1rem; font-size: 0.9rem; color: #2563eb; font-weight: 500; }
.back-link:hover { color: #1d4ed8; }

.inline-form { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; margin-top: 0.5rem; }
.action-buttons { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.admin-games { display: flex; flex-direction: column; gap: 0.75rem; }
.admin-game-row { border-bottom: 1px solid #edf2f7; padding-bottom: 0.75rem; }
.admin-game-row:last-child { border-bottom: none; }
.game-info { margin-bottom: 0.5rem; }
.region-tag { background: #ede9fe; color: #6d28d9; padding: 0.15rem 0.55rem; border-radius: 4px; font-size: 0.75rem; font-weight: 600; margin-right: 0.5rem; }
.result-inline { color: #16a34a; font-weight: 600; font-size: 0.85rem; margin-left: 0.5rem; }
.set-winner-form { flex-wrap: wrap; }
.score-input { width: 80px !important; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; margin-bottom: 0.25rem; }

/* Hero Section */
.hero-section { background: linear-gradient(135deg, #1e3a5f 0%, #2563eb 60%, #3b82f6 100%); color: #fff; padding: 3rem 1.5rem; text-align: center; border-radius: 16px; margin-bottom: 1.5rem; position: relative; overflow: hidden; }
.hero-section::before { content: ''; position: absolute; top: -50%; right: -30%; width: 60%; height: 200%; background: radial-gradient(ellipse, rgba(249,115,22,0.15) 0%, transparent 70%); pointer-events: none; }
.hero-section h1 { color: #fff; font-size: 2rem; font-weight: 800; margin-bottom: 0.5rem; }
.hero-section p { color: rgba(255,255,255,0.9); font-size: 1.1rem; margin-bottom: 1.25rem; }
.hero-section .btn { font-size: 1.1rem; padding: 0.8rem 2rem; }

/* Rules List */
.rules-list { list-style: none; counter-reset: rules-counter; padding: 0; }
.rules-list li { counter-increment: rules-counter; padding: 0.85rem 0.75rem 0.85rem 3.25rem; border-bottom: 1px solid #edf2f7; font-size: 0.95rem; position: relative; line-height: 1.5; }
.rules-list li:last-child { border-bottom: none; }
.rules-list li::before { content: counter(rules-counter); position: absolute; left: 0.75rem; top: 0.75rem; width: 1.8rem; height: 1.8rem; background: #1e3a5f; color: #fff; border-radius: 50%; font-size: 0.8rem; font-weight: 700; display: flex; align-items: center; justify-content: center; }

/* Payout Table */
.payout-table { width: 100%; border-collapse: collapse; margin-top: 0.5rem; }
.payout-table th, .payout-table td { padding: 0.65rem 0.75rem; text-align: left; border-bottom: 1px solid #edf2f7; }
.payout-table th { background: #1e3a5f; color: #fff; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.5px; font-weight: 700; }
.payout-table th:first-child { border-radius: 8px 0 0 0; }
.payout-table th:last-child { border-radius: 0 8px 0 0; }
.payout-table tbody tr:nth-child(even) { background: #f8fafc; }
.payout-table tbody tr:hover { background: #eff6ff; }
.payout-table td { font-weight: 500; }

/* Pay Card */
.pay-card { background: #fff; border-radius: 12px; padding: 1.5rem; margin-bottom: 1rem; box-shadow: 0 2px 8px rgba(30,58,95,0.08); border: 1px solid rgba(30,58,95,0.06); border-top: 4px solid #f97316; }
.pay-card h3 { color: #1e3a5f; }

/* Final Four Warning */
.ff-warning { background: #fff7ed; color: #c2410c; border: 1px solid #fed7aa; border-left: 4px solid #f97316; border-radius: 8px; padding: 0.85rem 1rem; margin-bottom: 1rem; font-size: 0.9rem; font-weight: 600; display: flex; align-items: center; gap: 0.5rem; }

/* Mobile responsive */
@media (max-width: 600px) {
    .container { padding: 1rem 0.75rem; }
    .form-row { grid-template-columns: 1fr; }
    .pick-buttons { flex-direction: column; }
    .vs { display: none; }
    .inline-form { flex-direction: column; align-items: stretch; }
    .score-input { width: 100% !important; }
    .hero-section { padding: 2rem 1rem; border-radius: 0; margin: 0 -0.75rem 1rem; }
    .hero-section h1 { font-size: 1.5rem; }
    .hero-section p { font-size: 0.95rem; }
    .navbar { padding: 0.65rem 0.75rem; }
    .nav-links { gap: 0.6rem; }
    .nav-links a { font-size: 0.8rem; }
    h1 { font-size: 1.35rem; }
    .round-nav { gap: 0.35rem; }
    .round-tab { padding: 0.45rem 0.75rem; font-size: 0.82rem; }
    .lb-table th, .lb-table td { padding: 0.5rem 0.35rem; font-size: 0.85rem; }
    .score-big { font-size: 1.6rem; }
}
