/* jjs19pool — mobile-first, ESPN-inspired dark theme.
   Layout strategy:
     - < 600px: mobile (1 col, compact stats, vertical stacks)
     - 600-900px: tablet (2 col stats grid)
     - 900-1200px: desktop (4 col stats grid)
     - > 1200px: wide desktop (4 col with bigger numbers)
*/

:root {
    --bg:        #0b1020;
    --bg-2:      #131a32;
    --fg:        #f5f7fb;
    --fg-dim:    #aeb5c6;
    --accent:    #00d4aa;
    --warn:      #ffb648;
    --bad:       #ff5468;
    --good:      #5ce39a;
    --border:    #232b48;
    --card:      #181f3a;
    --shadow:    0 8px 24px rgba(0,0,0,0.45);
    --r:         12px;
    --content-max: 720px;   /* mobile default */
}

* { box-sizing: border-box; }
html, body {
    margin: 0; padding: 0;
    background: var(--bg);
    color: var(--fg);
    font: 16px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; display: block; }

/* ──────────────────────────────────────────────
   HEADER
   ────────────────────────────────────────────── */
.topbar {
    position: sticky; top: 0;
    background: linear-gradient(180deg, #0b1020 0%, #131a32 100%);
    border-bottom: 1px solid var(--border);
    padding: 10px 16px;
    display: flex; align-items: center; justify-content: space-between;
    flex-wrap: wrap;
    gap: 6px;
    z-index: 10;
}
.brand { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }
.brand-title {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-weight: 900;
    font-size: 20px;
    letter-spacing: -0.8px;
    line-height: 1;
    background: linear-gradient(135deg, #008cff 0%, #00d4ff 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    display: inline-block;
}
.brand-title .accent {
    -webkit-text-fill-color: var(--accent);
    color: var(--accent);
    background: none;
}
.brand-emoji { font-size: 18px; line-height: 1; }
.brand-sub   {
    font-size: 11px;
    color: var(--fg-dim);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
}
.nav { display: flex; flex-wrap: wrap; gap: 2px; }
.nav a {
    color: var(--fg);
    padding: 6px 10px;
    border-radius: 8px;
    font-size: 14px;
}
.nav a.active, .nav a:hover { background: var(--bg-2); text-decoration: none; }
.nav .nav-logout { color: var(--fg-dim); font-size: 12px; }

@media (max-width: 720px) {
    .topbar { padding: 8px 12px; }
    .nav.nav-admin { width: 100%; justify-content: flex-start; overflow-x: auto; flex-wrap: nowrap; padding-bottom: 4px; }
    .nav a { font-size: 12px; padding: 4px 8px; white-space: nowrap; }
    .brand-title { font-size: 17px; letter-spacing: -0.6px; }
    .brand-emoji { font-size: 16px; }
}

/* ──────────────────────────────────────────────
   MAIN CONTAINER
   ────────────────────────────────────────────── */
.main {
    max-width: var(--content-max);
    margin: 0 auto;
    padding: 12px;
}
@media (min-width: 600px)  { .main { padding: 16px; } }
@media (min-width: 900px)  { .main { --content-max: 920px; padding: 20px; } }
@media (min-width: 1200px) { .main { --content-max: 1180px; padding: 24px; } }

.footer {
    text-align: center;
    color: var(--fg-dim);
    padding: 28px 16px 32px;
    font-size: 13px;
    border-top: 1px solid var(--border);
    margin-top: 40px;
}
.footer-inner {
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: center;
}
.footer-brand {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-weight: 700;
    font-size: 15px;
    letter-spacing: -0.3px;
    color: var(--fg);
}
.footer-copy {
    font-size: 12px;
    color: var(--fg-dim);
}

/* ──────────────────────────────────────────────
   CARD
   ────────────────────────────────────────────── */
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--r);
    padding: 12px;
    margin-bottom: 12px;
    box-shadow: var(--shadow);
}
@media (min-width: 600px) { .card { padding: 16px; margin-bottom: 16px; } }
.card h2 { font-size: 18px; }
.card h3 { font-size: 15px; }
@media (min-width: 900px) {
    .card h2 { font-size: 22px; }
    .card h3 { font-size: 16px; }
}
.card h2, .card h3 { margin-top: 0; }

/* ──────────────────────────────────────────────
   STAT GRID — the Money / Pool / Stats rows
   Mobile: 2 cols
   Tablet+: 4 cols
   ────────────────────────────────────────────── */
/* stat grid — Money / Pool cards
   Mobile:  2 cols, tights gap so cards don't pile up vertically
   Tablet+: 4 cols side-by-side (the "looks great" desktop layout)
   Numbers dominate: big, tabular, bold. Label dim, sub dimmer. */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}
@media (min-width: 720px) {
    .stat-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 14px;
    }
}
.stat {
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px 10px;
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 96px;
}
@media (min-width: 720px) {
    .stat { padding: 18px 14px; min-height: 116px; }
}
@media (min-width: 900px) {
    .stat { padding: 22px 16px; min-height: 132px; }
}
.stat .stat-lbl {
    color: var(--fg-dim);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    line-height: 1.2;
}
@media (min-width: 720px) { .stat .stat-lbl { font-size: 12px; } }
.stat .stat-val {
    font-size: 28px;
    font-weight: 800;
    line-height: 1;
    margin-top: 8px;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.5px;
}
@media (min-width: 600px)  { .stat .stat-val { font-size: 34px; } }
@media (min-width: 900px)  { .stat .stat-val { font-size: 42px; } }
@media (min-width: 1200px) { .stat .stat-val { font-size: 46px; } }
.stat .stat-sub {
    color: var(--fg-dim);
    font-size: 11px;
    margin-top: 6px;
    line-height: 1.3;
}
@media (min-width: 720px) { .stat .stat-sub { font-size: 12px; margin-top: 8px; } }

/* ──────────────────────────────────────────────
   LEGACY .row — still used by some pages (e.g. quick actions)
   ────────────────────────────────────────────── */
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 0; }

/* ──────────────────────────────────────────────
   BUTTONS / FORMS
   ────────────────────────────────────────────── */
button, .btn {
    background: var(--accent);
    color: #06121b;
    border: 0;
    padding: 10px 16px;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    display: inline-block;
    text-align: center;
    font-size: 14px;
}
@media (min-width: 720px) {
    button, .btn { padding: 12px 18px; font-size: 15px; }
}
button.secondary, .btn.secondary {
    background: var(--bg-2);
    color: var(--fg);
    border: 1px solid var(--border);
}
button.danger, .btn.danger { background: var(--bad); color: #2a070d; }
button[disabled], .btn[disabled] { opacity: 0.4; cursor: not-allowed; }
button.large, .btn.large { width: 100%; padding: 16px; font-size: 16px; }

input[type=text], input[type=email], input[type=password], input[type=number], select, textarea {
    width: 100%;
    background: var(--bg-2);
    color: var(--fg);
    border: 1px solid var(--border);
    padding: 10px;
    border-radius: 8px;
    font: inherit;
}
@media (min-width: 720px) { input[type=text], input[type=email], input[type=password], input[type=number], select, textarea { padding: 12px; } }
label { display: block; margin: 6px 0 2px; color: var(--fg-dim); font-size: 12px; }
@media (min-width: 720px) { label { font-size: 13px; margin: 8px 0 4px; } }

/* ──────────────────────────────────────────────
   TABLES
   ────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 8px 6px; border-bottom: 1px solid var(--border); text-align: left; font-size: 13px; }
@media (min-width: 720px) { th, td { padding: 10px 8px; font-size: 14px; } }
th { color: var(--fg-dim); font-weight: 500; font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; }
@media (min-width: 720px) { th { font-size: 12px; } }

/* ──────────────────────────────────────────────
   GAME CARD — player dashboard centerpiece
   Mobile: stack vertical
   Desktop: 3-col
   ────────────────────────────────────────────── */
.game-card {
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
    padding: 14px;
    background: var(--card);
    border-radius: var(--r);
    border: 1px solid var(--border);
    margin-bottom: 12px;
}
.game-card .matchup { display: flex; align-items: center; gap: 16px; }
.game-card .vs-block { display: flex; flex-direction: column; align-items: center; }
@media (min-width: 720px) {
    .game-card {
        display: grid;
        grid-template-columns: 1fr auto 1fr;
        gap: 20px;
        padding: 24px;
    }
}
@media (min-width: 900px) {
    .game-card { gap: 32px; padding: 28px; }
}
.game-team {
    display: flex; flex-direction: column; align-items: center; text-align: center;
    min-width: 100px;
}
.game-team .team-logo {
    width: 72px; height: 72px;
    object-fit: contain;
    background: var(--bg-2);
    border-radius: 50%;
    padding: 4px;
}
@media (min-width: 720px) {
    .game-team .team-logo { width: 104px; height: 104px; padding: 6px; }
}
@media (min-width: 900px) {
    .game-team .team-logo { width: 124px; height: 124px; padding: 8px; }
}
.game-team .team-name { font-size: 12px; color: var(--fg-dim); margin-top: 4px; }
.game-team .team-abbr { font-weight: 700; font-size: 16px; margin-top: 2px; }
@media (min-width: 720px) { .game-team .team-abbr { font-size: 22px; } }
@media (min-width: 900px) { .game-team .team-name { font-size: 14px; } .game-team .team-abbr { font-size: 24px; } }

.game-vs { color: var(--fg-dim); font-size: 13px; }
.game-score { font-size: 32px; font-weight: 800; letter-spacing: 1px; font-variant-numeric: tabular-nums; }
@media (min-width: 720px) { .game-score { font-size: 48px; } }

.game-meta { text-align: center; margin-top: 8px; color: var(--fg-dim); font-size: 12px; }
@media (min-width: 720px) { .game-meta { font-size: 13px; } }
.game-meta .status {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 999px;
    background: var(--bg-2);
    margin-top: 4px;
    font-size: 11px;
}
.game-meta .status.final { background: var(--good); color: #08251a; }
.game-meta .status.live  { background: var(--bad); color: #2a070d; }
.game-meta .status.scheduled { background: var(--bg-2); color: var(--fg-dim); }

/* ──────────────────────────────────────────────
   POT BANNER + WINNER BANNER
   ────────────────────────────────────────────── */
.pot-banner {
    background: linear-gradient(135deg, var(--accent) 0%, #5ce39a 100%);
    color: #06121b;
    border-radius: var(--r);
    padding: 16px;
    text-align: center;
    margin-bottom: 12px;
}
.pot-banner .pot-amt { font-size: 32px; font-weight: 800; }
.pot-banner .pot-lbl { font-size: 12px; opacity: 0.7; }
@media (min-width: 720px) {
    .pot-banner { padding: 24px; }
    .pot-banner .pot-amt { font-size: 48px; }
    .pot-banner .pot-lbl { font-size: 14px; }
}

.winner-banner {
    background: linear-gradient(135deg, #ffb648 0%, #ff7d 100%);
    color: #2a1700;
    border-radius: var(--r);
    padding: 20px;
    text-align: center;
    margin: 12px 0;
    animation: pulse 1.6s ease-in-out infinite;
}
.winner-banner .lbl { font-size: 12px; opacity: 0.7; }
.winner-banner .amt { font-size: 32px; font-weight: 900; letter-spacing: 1px; }
@media (min-width: 720px) {
    .winner-banner { padding: 24px; }
    .winner-banner .lbl { font-size: 14px; }
    .winner-banner .amt { font-size: 48px; }
}
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.02); } }

/* ──────────────────────────────────────────────
   STATUS CHIPS
   ────────────────────────────────────────────── */
.chip {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
    background: var(--bg-2);
    color: var(--fg-dim);
}
@media (min-width: 720px) { .chip { font-size: 12px; padding: 3px 10px; } }
.chip.good { background: var(--good); color: #08251a; }
.chip.bad  { background: var(--bad);  color: #2a070d; }
.chip.warn { background: var(--warn); color: #2a1700; }

/* ──────────────────────────────────────────────
   LOGIN
   ────────────────────────────────────────────── */
.login-shell {
    max-width: 360px;
    margin: 32px auto;
    padding: 16px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--r);
}
@media (min-width: 720px) {
    .login-shell { margin: 64px auto; padding: 24px; }
}

/* ──────────────────────────────────────────────
   HISTORY GRID
   ────────────────────────────────────────────── */
.history-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 6px;
}
@media (min-width: 720px) {
    .history-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
}
.history-cell {
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px;
    text-align: center;
    font-size: 12px;
}
.history-cell .w { color: var(--fg-dim); font-size: 10px; }
.history-cell .t { font-weight: 700; margin-top: 4px; }
.history-cell .s { font-size: 16px; font-weight: 700; margin-top: 2px; }
.history-cell.won { border-color: var(--good); }
.history-cell.won .s { color: var(--good); }
.history-cell.bye { opacity: 0.55; }
@media (min-width: 720px) {
    .history-cell { padding: 10px; font-size: 13px; }
    .history-cell .s { font-size: 18px; }
}

/* ──────────────────────────────────────────────
   ADMIN-SPECIFIC
   ────────────────────────────────────────────── */
.card-anchors {
    display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px;
}
.card-anchors a {
    padding: 6px 12px;
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: 999px;
    font-size: 12px;
    color: var(--fg);
}
@media (min-width: 720px) { .card-anchors a { font-size: 13px; } }
.card-anchors a:hover { background: var(--accent); color: #06121b; text-decoration: none; }
[id^="card-"] { scroll-margin-top: 80px; }
.card-foot { text-align: right; margin-top: 8px; }
.card-foot a { color: var(--fg-dim); font-size: 11px; text-decoration: none; }
.card-foot a:hover { color: var(--accent); }

/* Activity log — compact stacked cards on mobile, table on desktop */
.activity-list { display: flex; flex-direction: column; gap: 6px; }
.activity-item {
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 10px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.activity-item .a-time {
    color: var(--fg-dim);
    font-size: 11px;
}
.activity-item .a-action {
    display: flex; align-items: center; gap: 6px;
    font-size: 13px; flex-wrap: wrap;
}
.activity-item .a-by { color: var(--fg-dim); font-size: 12px; }
.activity-item .a-notes { font-size: 12px; color: var(--fg-dim); word-break: break-word; }

/* Quick actions — full width on mobile, inline on desktop */
.action-row {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 8px;
}
.action-row .btn, .action-row button { width: 100%; }
@media (min-width: 720px) {
    .action-row { flex-direction: row; flex-wrap: wrap; gap: 6px; }
    .action-row .btn, .action-row button { width: auto; }
}

/* Anchor pills row of "what to do next" */
.next-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px;
}
.next-actions .btn { width: 100%; }
@media (min-width: 720px) {
    .next-actions { flex-direction: row; flex-wrap: wrap; }
    .next-actions .btn { width: auto; }
}