:root { --gold: #c89b3c; --dark: #010a13; --card: #091428; --text: #f0e6d2; }

body { background: var(--dark); color: var(--text); font-family: 'Segoe UI', sans-serif; margin: 0; padding-bottom: 64px; }

/* TOP BAR */
.top-bar { background: var(--card); border-bottom: 2px solid var(--gold); padding: 15px 40px; display: flex; justify-content: space-between; align-items: center; }
.brand { color: var(--gold); text-decoration: none; font-weight: 900; font-size: 1.5rem; letter-spacing: 2px; }
.user-link { color: var(--text); text-decoration: none; }
.guest-login-trigger { padding: 8px 14px; border: 1px solid var(--gold); border-radius: 4px; background: #1e2328; box-shadow: inset 0 1px rgba(255,255,255,0.1), 0 2px 3px rgba(0,0,0,0.25); color: var(--text); cursor: pointer; font: inherit; font-weight: 600; transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease; }
.guest-login-trigger:hover { background: var(--gold); box-shadow: inset 0 1px rgba(255,255,255,0.25), 0 3px 5px rgba(0,0,0,0.3); color: var(--dark); }
.guest-login-trigger:focus-visible { outline: 2px solid var(--text); outline-offset: 3px; }

/* LAYOUT */
.container { max-width: 1200px; margin: 20px auto; padding: 0 20px; }
.main-layout { display: grid; grid-template-columns: 2fr 1fr; gap: 30px; }
.pick-lock-banner { position: fixed; z-index: 900; right: 0; bottom: 0; left: 0; display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: 4px 16px; padding: 10px 20px calc(10px + env(safe-area-inset-bottom)); border-top: 2px solid var(--gold); background: rgba(9,20,40,0.97); box-shadow: 0 -4px 14px rgba(0,0,0,0.35); color: var(--text); text-align: center; font-size: 0.9rem; font-weight: 600; }
.scoring-help-link { padding: 2px 0; border: 0; background: none; color: var(--gold); cursor: pointer; font: inherit; text-decoration: underline; text-underline-offset: 3px; }
.scoring-help-link:hover { color: #f0c96f; }
.scoring-help-link:focus-visible { outline: 2px solid var(--text); outline-offset: 3px; }

/* MATCHES */
.hidden-match { display: none; }
.match-card { background: var(--card); border: 1px solid #1e2328; padding: 15px; border-radius: 4px; margin-bottom: 15px; }
.matches-footer { display: flex; justify-content: center; padding: 2px 0 12px; }
.match-toggle { display: inline-flex; align-items: center; gap: 10px; padding: 9px 14px; border: 1px solid #46505d; border-radius: 4px; background: transparent; box-shadow: inset 0 1px rgba(255,255,255,0.08), 0 2px 3px rgba(0,0,0,0.25); color: var(--text); cursor: pointer; font: inherit; font-weight: 600; transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease; }
.match-toggle::after { width: 7px; height: 7px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; content: ''; transform: rotate(45deg) translateY(-2px); transition: transform 0.2s ease; }
.match-toggle:hover { border-color: var(--gold); background: var(--gold); color: var(--dark); }
.match-toggle[aria-expanded='true']::after { transform: rotate(225deg) translateY(-2px); }
.pick-row { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; position: relative; }
.pick-row > .team-side:first-of-type { justify-self: start; }
.pick-row > .team-side:nth-of-type(3) { justify-self: end; }
.score-control { position: absolute; top: 50%; width: 138px; height: 36px; min-width: 0; opacity: 0; overflow: hidden; pointer-events: none; transform: translateY(-50%) scaleX(0); transform-origin: left center; transition: opacity 0.18s ease, transform 0.25s ease; z-index: 1; }
.pick-row.score-side-a .score-control { left: 0; }
.pick-row.score-side-b .score-control { right: 0; transform-origin: right center; }
.pick-row.score-visible .score-control { opacity: 1; pointer-events: auto; transform: translateY(-50%) scaleX(1); }
.t-btn { box-sizing: border-box; background: #1e2328; border: 1px solid var(--gold); border-radius: 4px; box-shadow: inset 0 1px rgba(255,255,255,0.12), 0 2px 3px rgba(0,0,0,0.3); color: white; padding: 8px; width: 138px; height: 36px; cursor: pointer; transition: filter 0.15s ease, box-shadow 0.15s ease; }
.t-btn:not(:disabled):hover { filter: brightness(1.12); box-shadow: inset 0 1px rgba(255,255,255,0.18), 0 3px 5px rgba(0,0,0,0.35); }
.t-btn.selected { background: var(--gold); color: black; font-weight: bold; }
.t-btn.winner { background: #236b3b; border-color: #54c878; color: #fff; font-weight: bold; }
.t-btn.winner-missed { background: #8f3434; border-color: #e66b6b; color: #fff; font-weight: bold; }
.t-btn.loser-muted { background: #34383d; border-color: #555b62; color: #a3a8ae; }
.t-btn:disabled { opacity: 1; }
.vs-center { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.series-result { color: #54c878; font-size: 0.85rem; font-weight: 700; }
.series-result.score-correct { color: #54c878; }
.series-result.score-missed { color: #ff7777; }
.score-prediction { color: var(--gold); font-size: 0.85rem; font-weight: 700; }
.score-guess-muted { color: #a3a8ae; font-size: 0.75rem; }
.score-select { box-sizing: border-box; width: 100%; height: 100%; border-radius: 4px; background: #1e2328; color: white; border: 1px solid var(--gold); box-shadow: inset 0 1px rgba(255,255,255,0.1), 0 2px 3px rgba(0,0,0,0.25); font-size: 0.8rem; }

/* LEADERBOARD */
.lb-box { background: var(--card); border-radius: 4px; border: 1px solid #1e2328; }
.lb-row { display: flex; justify-content: space-between; padding: 12px; border-bottom: 1px solid #1e2328; cursor: pointer; transition: 0.2s; }
.lb-row:hover { background: #1a232e; color: var(--gold); }

/* MODAL */
.modal-overlay { 
    display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; 
    background: rgba(0,0,0,0.85); z-index: 1000; align-items: center; justify-content: center; 
}
.modal-card { 
    background: var(--card); border: 2px solid var(--gold); padding: 30px; 
    width: min(94%, 1120px); max-height: 85vh; overflow-y: auto; border-radius: 8px; position: relative; 
}
.user-pick-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 16px 0; }
.user-pick-stat { display: grid; gap: 4px; padding: 12px; border: 1px solid #354150; border-radius: 4px; background: #0d1a2d; }
.user-pick-stat strong { color: var(--gold); font-size: 1.4rem; }
.user-pick-stat small { color: #a3a8ae; }
.score-pick-stats { margin: 16px 0 20px; }
.score-pick-stats h3, .pick-history-group h3 { margin: 0 0 10px; font-size: 1rem; }
.score-counts { display: flex; flex-wrap: wrap; gap: 8px 16px; color: #c5ccd5; font-size: 0.9rem; }
.pick-history-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: start; gap: 14px; margin-top: 20px; }
.pick-history-group { min-width: 0; margin: 0; }
.pick-history-group h3 { padding-bottom: 8px; border-bottom: 1px solid #354150; }
.pick-history-row { display: flex; flex-wrap: wrap; align-items: baseline; gap: 5px 10px; padding: 10px; border-bottom: 1px solid #263448; font-size: 0.82rem; }
.pick-history-row strong { flex-basis: 100%; }
.pick-history-group.correct .pick-history-row { border-left: 3px solid #54c878; }
.pick-history-group.incorrect .pick-history-row { border-left: 3px solid #e66b6b; }
.pick-history-group.upcoming .pick-history-row { border-left: 3px solid #738094; }
.score-pick-correct { color: #54c878; font-weight: 700; }
.score-pick-missed { color: #ff7777; font-weight: 700; }
.pick-history-empty { color: #a3a8ae; font-size: 0.9rem; }
.close-btn { position: absolute; top: 10px; right: 15px; font-size: 2rem; background: none; border: none; color: var(--gold); cursor: pointer; }
.login-card { max-width: 380px; }
.login-form { display: grid; gap: 10px; }
.login-form input { box-sizing: border-box; width: 100%; padding: 10px; border: 1px solid #515967; border-radius: 4px; background: #010a13; color: var(--text); font: inherit; }
.login-form button { margin-top: 8px; padding: 10px; border: 0; border-radius: 4px; background: var(--gold); box-shadow: inset 0 1px rgba(255,255,255,0.35), 0 2px 3px rgba(0,0,0,0.3); color: #010a13; cursor: pointer; font: inherit; font-weight: 700; }
.login-error { color: #ff7777; }

table { width: 100%; border-collapse: collapse; }
td { padding: 10px; border-bottom: 1px solid #1e2328; }
.win { color: #28a745; }

@media (max-width: 600px) {
    .modal-card { padding: 24px 16px; }
    .pick-history-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (min-width: 601px) and (max-width: 900px) {
    .pick-history-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .pick-history-group.upcoming { grid-column: 1 / -1; }
}
.scoring-info-card { width: 90%; max-width: 520px; }
.scoring-info-card h3 { margin: 20px 0 8px; font-size: 1rem; }
.scoring-info-card p { line-height: 1.5; }
.scoring-table td { padding: 8px 6px; }
.scoring-table td:last-child { text-align: right; font-weight: 700; white-space: nowrap; }
.scoring-example { color: #c5ccd5; font-size: 0.9rem; }