/* Weekly wager race page + lobby banner (business audit 2026-10-10).
   Mobile first; 76% of sessions are phones. Uses the site tokens from
   css/styles.css with fallbacks so the page reads right even if a token moves. */

.race-main {
    max-width: 920px;
    margin: 0 auto;
    padding: 16px 16px 48px;
    color: var(--text-primary, #f5f5f5);
}

.race-hero {
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, #131825 0%, #0f1219 60%, #161020 100%);
    border: 1px solid rgba(247, 147, 26, 0.25);
    border-radius: 16px;
    padding: 20px 18px 18px;
    margin-bottom: 16px;
}
.race-hero::before {
    content: '';
    position: absolute;
    inset: -60% -10% auto;
    height: 220%;
    background: radial-gradient(ellipse at 20% 40%, rgba(247, 147, 26, 0.10) 0%, transparent 55%);
    pointer-events: none;
}
.race-badge {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--primary, #f7931a);
    background: rgba(247, 147, 26, 0.12);
    border: 1px solid rgba(247, 147, 26, 0.35);
    border-radius: 999px;
    padding: 4px 10px;
    margin-bottom: 10px;
}
.race-hero h1 {
    font-size: 1.6rem;
    line-height: 1.2;
    margin: 0 0 8px;
}
.race-sub {
    color: var(--text-secondary, #c9c9c9);
    margin: 0 0 16px;
    font-size: 0.98rem;
    line-height: 1.5;
}

.race-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}
.race-stat {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 10px 10px 9px;
    min-width: 0;
}
.race-stat-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-secondary, #a3a3a3);
    margin-bottom: 4px;
}
.race-stat-value {
    font-size: 1.05rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    overflow-wrap: anywhere;
}
.race-stat-value.pool { color: var(--primary, #f7931a); }
@media (max-width: 400px) {
    .race-stats { grid-template-columns: 1fr; }
}

.race-you {
    margin-top: 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: rgba(16, 185, 129, 0.08);
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: 12px;
    padding: 12px 14px;
    font-size: 0.95rem;
}
.race-you[hidden] { display: none; }
.race-you strong { font-variant-numeric: tabular-nums; }
.race-you .race-you-cta {
    flex: 0 0 auto;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    padding: 0 14px;
    border-radius: 10px;
    background: linear-gradient(135deg, #f7931a, #cc7a15);
    color: #1a1205;
    font-weight: 700;
    text-decoration: none;
}

.race-section {
    background: var(--bg-card, #1a1a1a);
    border: 1px solid var(--border, rgba(255, 255, 255, 0.08));
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 16px;
}
.race-section h2 {
    font-size: 1.1rem;
    margin: 0 0 12px;
}
.race-section[hidden] { display: none; }

.pf-table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.race-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}
.race-table th,
.race-table td {
    padding: 10px 8px;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    white-space: nowrap;
}
.race-table th {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-secondary, #a3a3a3);
    font-weight: 600;
}
.race-table td.num,
.race-table th.num {
    text-align: right;
    font-variant-numeric: tabular-nums;
}
.race-table td.player {
    max-width: 38vw;
    overflow: hidden;
    text-overflow: ellipsis;
}
.race-table tr.is-you td {
    background: rgba(16, 185, 129, 0.08);
}
.race-table tr.is-you td.player::after {
    content: ' (you)';
    color: var(--success, #10b981);
    font-size: 0.8em;
}
.race-rank {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.06);
    font-weight: 700;
    font-size: 0.85rem;
}
.race-rank.r1 { background: rgba(247, 147, 26, 0.25); color: var(--primary, #f7931a); }
.race-rank.r2 { background: rgba(203, 213, 225, 0.18); }
.race-rank.r3 { background: rgba(180, 120, 60, 0.25); }
.race-prize { color: var(--success, #10b981); font-weight: 600; }
.race-empty {
    color: var(--text-secondary, #a3a3a3);
    margin: 8px 0 0;
    font-size: 0.95rem;
}
.race-empty[hidden] { display: none; }

.race-how ol {
    margin: 0;
    padding-left: 1.4em;
    list-style: decimal;
    line-height: 1.55;
    color: var(--text-secondary, #d4d4d4);
}
.race-how li { margin-bottom: 8px; }
.race-how li strong { color: var(--text-primary, #f5f5f5); }
.race-split {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}
.race-split span {
    font-size: 0.8rem;
    padding: 4px 8px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.06);
    font-variant-numeric: tabular-nums;
}
.race-games {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 12px 0 0;
    padding: 0;
    list-style: none;
}
.race-games a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 0 14px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary, #f5f5f5);
    text-decoration: none;
    font-weight: 600;
}
.race-games a:hover { background: rgba(255, 255, 255, 0.1); }

.race-footnote {
    color: var(--text-secondary, #a3a3a3);
    font-size: 0.85rem;
    line-height: 1.5;
    margin: 12px 0 0;
}

@media (min-width: 640px) {
    .race-main { padding: 24px 20px 64px; }
    .race-hero { padding: 26px 24px 22px; }
    .race-hero h1 { font-size: 2rem; }
    .race-section { padding: 20px; }
    .race-table td.player { max-width: none; }
}

/* Lobby banner: reuses the tournament banner chrome (casino/css/tournament.css),
   these rules only tint it toward the race. */
.race-lobby-banner { border-color: rgba(247, 147, 26, 0.28); }
.race-lobby-banner[hidden] { display: none; }
.race-lobby-banner .tournament-lobby-pool { color: var(--primary, #f7931a); }

/* Race disabled/unavailable: hide data-dependent blocks that would show placeholders */
#race-page[data-state="off"] .race-sub:not([data-race="status"]),
#race-page[data-state="off"] .race-stats,
#race-page[data-state="off"] .race-you,
#race-page[data-state="off"] .race-section,
#race-page[data-state="loading"] .race-sub:not([data-race="status"]),
#race-page[data-state="loading"] .race-stats,
#race-page[data-state="loading"] .race-you,
#race-page[data-state="loading"] .race-section { display: none; }

/* Let the title wrap so the prize pool and cadence stay visible at large text. */
.race-lobby-banner .tournament-lobby-title {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    text-wrap: balance;
}

/* Phones: fit rank, player, wagered and prize without sideways scroll. */
@media (max-width: 480px) {
    .race-table { font-size: 0.85rem; }
    .race-table th,
    .race-table td { padding: 9px 4px; }
    .race-table th { letter-spacing: 0.02em; font-size: 0.66rem; }
    .race-table td.player { max-width: 24vw; }
}
