/* ── 13 Runs Baseball Pool — Public Styles ──────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --red:      #c84726;
    --red-dk:   #a83820;
    --navy:     #1c3a5e;
    --navy-lt:  #274f7d;
    --green:    #2a7a4e;
    --gold:     #c87a00;
    --bg:       #f5f0eb;
    --card:     #ffffff;
    --border:   #e2d4c8;
    --text:     #1a1a1a;
    --muted:    #777;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 15px;
    color: var(--text);
    background: var(--bg);
}

/* ── Site Header ─────────────────────────────────────────────────────────── */
.site-header {
    background: var(--red);
    color: #fff;
    padding: .75rem 1.25rem;
    display: flex;
    align-items: center;
    gap: .75rem;
    flex-wrap: wrap;
}
.site-title { font-size: 1.3rem; font-weight: 800; letter-spacing: -.02em; }
.site-sub   { font-size: .75rem; opacity: .65; margin-left: auto; }

/* ── Tab Navigation ──────────────────────────────────────────────────────── */
.site-nav {
    background: var(--navy);
    display: flex;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.site-nav a {
    display: inline-flex;
    align-items: center;
    padding: .65rem 1.1rem;
    color: rgba(255,255,255,.65);
    text-decoration: none;
    font-size: .85rem;
    font-weight: 600;
    white-space: nowrap;
    border-bottom: 3px solid transparent;
    transition: color .15s, background .15s;
}
.site-nav a:hover  { color: #fff; background: rgba(255,255,255,.08); }
.site-nav a.active { color: #fff; border-bottom-color: var(--red); }

/* ── Season Hero ─────────────────────────────────────────────────────────── */
.season-hero {
    background: var(--navy);
    color: #fff;
    padding: 1.5rem 1.25rem 1.25rem;
    text-align: center;
}
.hero-week-label {
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    opacity: .6;
    margin-bottom: .15rem;
}
.hero-dates {
    font-size: 1.1rem;
    opacity: .88;
    margin-bottom: 1rem;
}
.hero-pot-label {
    font-size: .72rem;
    letter-spacing: .08em;
    text-transform: uppercase;
    opacity: .55;
    margin-bottom: .2rem;
}
.hero-pot-amount {
    font-size: 3.4rem;
    font-weight: 900;
    line-height: 1;
    letter-spacing: -.04em;
}
.hero-pot-amount.rollover {
    color: #ffc840;
    text-shadow: 0 0 30px rgba(255, 210, 0, .35);
}
.rollover-badge {
    display: inline-block;
    background: #ff9900;
    color: #fff;
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    padding: .2rem .55rem;
    border-radius: 99px;
    margin-left: .5rem;
    vertical-align: middle;
    position: relative;
    top: -.25rem;
}
.hero-hit-status {
    font-size: .85rem;
    opacity: .7;
    margin-top: .5rem;
    letter-spacing: .02em;
}
.hero-progress {
    margin-top: 1.1rem;
    max-width: 300px;
    margin-left: auto;
    margin-right: auto;
}
.progress-bar {
    height: 5px;
    background: rgba(255,255,255,.18);
    border-radius: 99px;
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    background: var(--red);
    border-radius: 99px;
}
.progress-label {
    font-size: .82rem;
    opacity: .62;
    margin-top: .35rem;
    display: block;
}

/* ── Main content wrapper ────────────────────────────────────────────────── */
.site-main {
    max-width: 780px;
    margin: 1.5rem auto;
    padding: 0 1rem 3rem;
}

/* ── Empty / coming-soon state ───────────────────────────────────────────── */
.empty-state {
    background: var(--card);
    border-radius: 10px;
    padding: 3rem 2rem;
    text-align: center;
    box-shadow: 0 2px 12px rgba(0,0,0,.07);
}
.empty-state h2 { font-size: 1.6rem; color: var(--red); margin-bottom: .75rem; }
.empty-state p  { color: var(--muted); }

/* ── Sort bar ────────────────────────────────────────────────────────────── */
.sort-bar {
    display: flex;
    align-items: center;
    gap: .4rem;
    margin-bottom: .65rem;
    font-size: .78rem;
    color: var(--muted);
}
.sort-bar a {
    display: inline-block;
    padding: .2rem .55rem;
    border-radius: 4px;
    border: 1px solid var(--border);
    color: var(--muted);
    text-decoration: none;
    font-weight: 600;
    background: var(--card);
}
.sort-bar a.active { background: var(--navy); color: #fff; border-color: var(--navy); }

/* ── Leaderboard table ───────────────────────────────────────────────────── */
.lb-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--card);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0,0,0,.07);
    font-size: .9rem;
}
.lb-table thead th {
    background: var(--navy);
    color: #fff;
    font-size: .75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    padding: .6rem .75rem;
    text-align: left;
}
.lb-table thead th:not(:first-child):not(:nth-child(2)) { text-align: right; }

/* Player rows */
.player-row {
    cursor: pointer;
    transition: background .12s;
}
.player-row td {
    border-top: 1px solid #f0e8e0;
    padding: .65rem .75rem;
    vertical-align: middle;
}
.player-row:hover td { background: #fdf7f3; }

.player-row td.rank {
    font-weight: 700;
    color: var(--muted);
    font-size: .8rem;
    width: 32px;
}
.player-row td.p-name { font-weight: 700; color: var(--navy); }
.player-row td.p-hits,
.player-row td.p-won  { text-align: right; }
.player-row td.p-won  { font-weight: 700; color: var(--green); }
.player-row td.p-won.zero { color: var(--muted); font-weight: 400; }

/* Expand chevron */
.expand-chevron {
    display: inline-block;
    font-size: .62rem;
    margin-left: .4rem;
    opacity: .35;
    transition: transform .2s;
    vertical-align: middle;
}
.expand-chevron.open { transform: rotate(180deg); opacity: .6; }

/* ── Player detail (expandable) ──────────────────────────────────────────── */
.detail-row td {
    padding: 0;
    border-top: none;
}
.detail-inner {
    display: none;
    padding: .5rem 1rem .75rem 1.5rem;
    border-top: 2px solid #f0e8e0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.detail-inner.shown { display: block; }

.detail-table {
    border-collapse: collapse;
    font-size: .76rem;
    white-space: nowrap;
    min-width: 460px;
}
.detail-table th {
    background: #f5e8de;
    color: var(--muted);
    font-size: .67rem;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    padding: .3rem .5rem;
    text-align: left;
}
.detail-table td { padding: .3rem .5rem; border-bottom: 1px solid #f4ede6; }
.detail-table tr:last-child td { border-bottom: none; }
.detail-table tr.wk-current td { background: #fffbf2; }

.d-hit     { color: var(--green); font-weight: 700; }
.d-est     { color: var(--gold);  font-weight: 700; }
.d-miss    { color: #ccc; }
.d-future  { color: #bbb; font-style: italic; }
.d-won     { text-align: right; font-weight: 700; color: var(--green); }
.d-est-won { text-align: right; font-weight: 700; color: var(--gold); }
.d-neutral { text-align: right; color: var(--muted); }

/* ── Grid page ───────────────────────────────────────────────────────────── */
.grid-page-main { padding-bottom: 3rem; }

.grid-legend {
    display: flex;
    flex-wrap: wrap;
    gap: .6rem .9rem;
    padding: .65rem 1rem;
    font-size: .78rem;
    color: var(--muted);
    background: var(--card);
    border-top: 1px solid var(--border);
}
.legend-item { display: flex; align-items: center; gap: .3rem; }
.legend-swatch {
    width: 13px;
    height: 13px;
    border-radius: 3px;
    border: 1px solid rgba(0,0,0,.12);
    flex-shrink: 0;
}

/* Grid scroll container */
.grid-wrap {
    overflow: auto;
    max-height: calc(100vh - 130px);
    -webkit-overflow-scrolling: touch;
}

/* The grid table itself */
.big-grid {
    border-collapse: collapse;
    font-size: .76rem;
    white-space: nowrap;
}
.big-grid th,
.big-grid td {
    border: 1px solid #d8c8ba;
    padding: .28rem .42rem;
    text-align: center;
    vertical-align: middle;
}

/* Sticky header row */
.big-grid thead th {
    background: var(--navy);
    color: #fff;
    font-weight: 600;
    font-size: .73rem;
    position: sticky;
    top: 0;
    z-index: 3;
    min-width: 72px;
}
/* Sticky week-label column header (corner) */
.big-grid thead th:first-child {
    left: 0;
    z-index: 4;
    min-width: 108px;
    text-align: left;
    padding-left: .55rem;
}
/* Player balance under name in header */
.big-grid thead th .p-bal {
    display: block;
    font-size: .63rem;
    font-weight: 400;
    opacity: .6;
    margin-top: 1px;
}
/* Sticky week label column */
.big-grid tbody td:first-child {
    background: #f5ede6;
    position: sticky;
    left: 0;
    z-index: 2;
    text-align: left;
    padding-left: .55rem;
    min-width: 108px;
    border-right: 2px solid #c8b0a0;
}
.big-grid tbody tr:hover td { background: #f9f5f1; }
.big-grid tbody tr:hover td:first-child { background: #ede5da; }

/* Week label contents */
.wk-num   { font-weight: 800; font-size: .88rem; }
.wk-dates { display: block; font-size: .62rem; color: var(--muted); font-weight: 400; }
.wk-pot   { display: block; font-size: .63rem; color: var(--gold);  font-weight: 600; }

/* Cell states */
.g-hit {
    background: #d4edda !important;
    color: var(--green);
    font-weight: 700;
}
.g-hit .hit-amount {
    display: block;
    font-size: .65rem;
    font-weight: 600;
}
.g-est {
    background: #fff3cd !important;
    color: var(--gold);
    font-weight: 700;
}
.g-est .hit-amount {
    display: block;
    font-size: .65rem;
    font-style: italic;
}
.g-future { color: #bbb; font-style: italic; }
.g-past   { color: #bbb; }

/* Active week row */
.big-grid tbody tr.wk-active td:first-child {
    background: #fffbe6;
    border-left: 3px solid var(--gold);
}

/* ── How It Works ────────────────────────────────────────────────────────── */
.how-main {
    max-width: 660px;
    margin: 1.5rem auto;
    padding: 0 1rem 3rem;
}
.how-card {
    background: var(--card);
    border-radius: 10px;
    padding: 1.4rem 1.5rem;
    box-shadow: 0 2px 12px rgba(0,0,0,.07);
    margin-bottom: 1.1rem;
}
.how-card h2 {
    font-size: 1.02rem;
    color: var(--navy);
    margin-bottom: .65rem;
    padding-bottom: .45rem;
    border-bottom: 2px solid #f0e8e0;
}
.how-card p {
    color: #333;
    line-height: 1.65;
    margin-bottom: .55rem;
    font-size: .9rem;
}
.how-card p:last-child { margin-bottom: 0; }
.how-card ul {
    padding-left: 1.2rem;
    color: #333;
    line-height: 1.7;
    font-size: .9rem;
}
.how-card ul li { margin-bottom: .3rem; }
.how-card .big-stat {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--red);
    display: block;
    margin-bottom: .45rem;
}
.how-card a { color: var(--navy); font-weight: 600; }
.how-card a:hover { color: var(--red); }

/* ── Responsive (grid + how-it-works pages) ──────────────────────────────── */
@media (max-width: 600px) {
    .site-title      { font-size: 1.1rem; }
    .hero-pot-amount { font-size: 2.6rem; }
    .how-main        { padding: 0 .75rem 2rem; }
    .how-card        { padding: 1rem 1.1rem; }
}

/* ════════════════════════════════════════════════════════════════════════════
   Option A: Two-column standings layout (index.php)
   Desktop: list left | cards right
   Mobile:  cards top (hidden until player selected) | list below
   ════════════════════════════════════════════════════════════════════════════ */

/* ── Page body: CSS grid container ──────────────────────────────────────── */
.page-body {
    display: grid;
    grid-template-columns: 1fr;   /* mobile: single column */
    align-items: start;
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 0 3rem;
}

/* Desktop: two columns — list LEFT, cards RIGHT */
@media (min-width: 780px) {
    .page-body {
        grid-template-columns: 320px 1fr;
        padding: 1.25rem 1.25rem 3rem;
        gap: 1.5rem;
    }
    /* panel-col is first in DOM; CSS order flips it to right on desktop */
    .list-col  { order: 1; }
    .panel-col { order: 2; position: sticky; top: 1rem; align-self: start; }
}

/* ── List column ─────────────────────────────────────────────────────────── */
.list-col {
    background: var(--card);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0,0,0,.07);
}

/* Sort bar */
.sort-bar {
    display: flex;
    align-items: center;
    gap: .4rem;
    padding: .6rem .85rem;
    border-bottom: 1px solid #f0e8e0;
    background: #fdf9f6;
}
.sort-label { font-size: .75rem; color: var(--muted); }
.sort-btn {
    padding: .2rem .55rem;
    border-radius: 4px;
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--muted);
    font-size: .75rem;
    font-weight: 600;
    cursor: pointer;
    line-height: 1.4;
    font-family: inherit;
}
.sort-btn.active { background: var(--navy); color: #fff; border-color: var(--navy); }
.sort-btn:hover:not(.active) { background: #f0f4fa; color: var(--navy); }

/* Leaderboard table */
.lb-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .88rem;
}
.lb-table thead th {
    background: var(--navy);
    color: #fff;
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    padding: .5rem .7rem;
    text-align: left;
}
.col-rank { width: 32px; text-align: center !important; }
.col-hits { width: 44px; text-align: right !important; }
.col-won  { width: 82px; text-align: right !important; }

.player-row {
    cursor: pointer;
    transition: background .12s;
}
.player-row td {
    padding: .6rem .7rem;
    border-bottom: 1px solid #f4ece5;
    vertical-align: middle;
    color: var(--text);
}
.player-row:last-child td { border-bottom: none; }
.player-row:hover td { background: #fdf5f0; }

.player-row td.col-rank { color: var(--muted); font-size: .78rem; font-weight: 700; text-align: center; }
.player-row td.col-name { font-weight: 600; }
.player-row td.col-hits { text-align: right; color: var(--muted); font-size: .82rem; }
.player-row td.col-won  { text-align: right; font-weight: 700; color: var(--green); }
.player-row td.col-won.zero { color: var(--muted); font-weight: 400; }

/* Selected player row */
.player-row.selected td { background: #fff0eb; }
.player-row.selected td.col-name { color: var(--red); }
.player-row.selected td.col-rank { color: var(--red); }
.player-row.selected:hover td { background: #ffe8de; }

/* Hint text below table */
.lb-hint {
    font-size: .72rem;
    color: var(--muted);
    text-align: center;
    padding: .55rem .7rem .7rem;
    border-top: 1px solid #f4ece5;
}

/* ── Panel column ────────────────────────────────────────────────────────── */
.panel-col {
    /* Mobile: no visible background — the card-panel handles it */
}

/* ── Empty state (desktop only, shown before player selected) ────────────── */
.panel-empty {
    display: none; /* hidden on mobile */
    border: 2px dashed var(--border);
    border-radius: 12px;
    padding: 3rem 2rem;
    text-align: center;
    color: var(--muted);
    font-size: .88rem;
    line-height: 1.6;
    transition: opacity .3s;
}
.panel-empty.hidden { display: none !important; }
.panel-empty-icon { font-size: 2rem; margin-bottom: .75rem; opacity: .4; }

@media (min-width: 780px) {
    .panel-empty { display: block; }
}

/* ── Card panel container ────────────────────────────────────────────────── */
.card-panel {
    display: flex;
    flex-direction: column;
    gap: .75rem;
    /* Mobile: slides down from height 0 */
    max-height: 0;
    overflow: hidden;
    transition: max-height .4s ease;
    padding: 0 .75rem;
}
.card-panel.visible {
    max-height: 900px;   /* generous ceiling for the three cards */
    padding: .75rem .75rem .5rem;
}

/* Desktop: no height clipping — opacity-based animation instead */
@media (min-width: 780px) {
    .card-panel {
        max-height: none;
        overflow: visible;
        padding: 0;
        transition: opacity .2s ease;
    }
    .card-panel.visible { padding: 0; }
}

/* ── Individual cards ─────────────────────────────────────────────────────── */
.pc {
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 3px 16px rgba(0,0,0,.11);
    /* Entry animation — plays whenever card is added to DOM */
    animation: cardIn .35s ease forwards;
}
.pc:nth-child(2) { animation-delay: .07s; opacity: 0; }
.pc:nth-child(3) { animation-delay: .14s; opacity: 0; }

@keyframes cardIn {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: none; }
}

/* ── Card 1: Identity ────────────────────────────────────────────────────── */
.pc-identity {
    background: var(--navy);
    color: #fff;
    padding: 1.25rem 1.25rem 1.1rem;
    position: relative;
}
.pc-close {
    position: absolute;
    top: .75rem;
    right: .85rem;
    background: rgba(255,255,255,.15);
    border: none;
    color: rgba(255,255,255,.7);
    border-radius: 50%;
    width: 26px;
    height: 26px;
    font-size: .8rem;
    cursor: pointer;
    line-height: 26px;
    text-align: center;
    padding: 0;
    transition: background .15s;
}
.pc-close:hover { background: rgba(255,255,255,.28); color: #fff; }
.ic-rank {
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    opacity: .55;
    margin-bottom: .15rem;
}
.ic-name {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -.025em;
    line-height: 1.1;
    margin-bottom: .45rem;
    padding-right: 2rem;  /* avoid the × button */
}
.ic-stats {
    display: flex;
    align-items: center;
    gap: .35rem;
    font-size: .8rem;
    opacity: .72;
}
.ic-dot { opacity: .4; }
.ic-won { color: #7dffa0; font-weight: 600; opacity: 1; }

/* ── Card 2 & 3: Week cards ──────────────────────────────────────────────── */
.pc-week {
    background: var(--card);
    border: 1px solid var(--border);
}
.wc-top {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: .65rem 1rem .3rem;
    border-bottom: 1px solid #f0e8e0;
}
.wc-label {
    font-size: .7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--navy);
}
.wc-dates {
    font-size: .7rem;
    color: var(--muted);
}
.wc-matchup {
    font-size: 1.6rem;
    font-weight: 800;
    letter-spacing: -.025em;
    text-align: center;
    padding: .65rem 1rem .55rem;
    color: var(--navy);
    line-height: 1.15;
}
.wc-foot {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: .4rem 1rem .65rem;
}
.wc-status {
    font-size: .82rem;
    font-weight: 700;
}
.wc-pot {
    font-size: .76rem;
    color: var(--muted);
}
.wc-note {
    font-size: .72rem;
    font-weight: 400;
    color: var(--muted);
    padding: 0 1rem .45rem;
    margin-top: -.25rem;
}
.live-amt {
    font-size: 1.15rem;
    font-weight: 700;
}
.live-note {
    font-size: .75rem;
    font-weight: 400;
    opacity: .65;
}
.est-tag {
    font-size: .65rem;
    font-weight: 400;
    opacity: .6;
}
.hit-shares {
    font-size: .75rem;
    opacity: .75;
}

/* Status: HIT */
.pc-current.status-hit { border-top: 4px solid var(--green); }
.pc-current.status-hit .wc-label  { color: var(--green); }
.pc-current.status-hit .wc-matchup { color: var(--green); }
.s-hit { color: var(--green); font-size: .9rem; }

/* Status: live/estimated */
.pc-current.status-live { border-top: 4px solid var(--gold); }
.pc-current.status-live .wc-label { color: var(--gold); }
.s-live { color: var(--gold); }

/* Status: watching */
.pc-current.status-watching { border-top: 4px solid var(--navy); }
.s-watching { color: var(--navy); display: flex; align-items: center; gap: .4rem; }

/* Pulsing dot for "watching" */
.pulse-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    background: var(--red);
    border-radius: 50%;
    flex-shrink: 0;
    animation: pulse 1.6s ease-in-out infinite;
}
@keyframes pulse {
    0%, 100% { opacity: 1;  transform: scale(1); }
    50%       { opacity: .3; transform: scale(.75); }
}

/* Status: miss */
.pc-current.status-miss { border-top: 4px solid #ddd; }
.pc-current.status-miss .wc-matchup { color: #bbb; }
.s-miss { color: #bbb; }

/* Status: upcoming */
.s-upcoming { color: var(--muted); font-weight: 400; }

/* Next week card — lighter, softer */
.pc-next { background: #faf6f1; border: 1px solid var(--border); }
.pc-next .wc-label   { color: var(--muted); }
.pc-next .wc-matchup { color: var(--navy); font-size: 1.3rem; opacity: .75; }
.pc-next .wc-top     { border-bottom-color: #eee; }

