/* NFV Billiards — dark navy + gold + green broadcast aesthetic. */

:root {
    --bg-deep:      #0a1e3a;
    --bg-mid:       #102a52;
    --bg-light:     #1a3a6e;
    --gold:         #d4a64a;
    --gold-bright:  #f0c060;
    --gold-line:    rgba(212,166,74,.65);
    --gold-dim:     rgba(212,166,74,.35);
    --green:        #4caf50;
    --green-bright: #6fdc6f;
    --green-glow:   rgba(76,175,80,.25);
    --danger:       #e25b65;
    --warn:         #ffa726;
    --text:         #ffffff;
    --text-dim:     rgba(255,255,255,.55);
    --text-bye:     rgba(180,195,220,.32);
    --card-bg:      rgba(10,30,60,.65);
    --card-border:  rgba(255,255,255,.10);
    --input-bg:     rgba(0,0,0,.35);
    --input-border: rgba(255,255,255,.18);
    --radius:       8px;
    --radius-sm:    5px;
    --shadow:       0 4px 18px rgba(0,0,0,.34), 0 1px 2px rgba(0,0,0,.4);

    /* Legacy aliases so older inline styles still resolve */
    --felt: var(--bg-light);
    --felt-deep: var(--bg-deep);
    --felt-line: var(--gold-line);
    --felt-tint: rgba(255,255,255,.05);
    --gold-tint: rgba(240,192,96,.18);
    --chalk: #f6f1e6;
    --ink: var(--text);
    --muted: var(--text-dim);
    --soft: rgba(255,255,255,.08);
    --ok: var(--green-bright);
}

* { box-sizing: border-box; }
html, body {
    margin: 0; padding: 0;
    font-family: 'Segoe UI', system-ui, -apple-system, Roboto, Arial, sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at 30% 15%, rgba(64,110,180,.18), transparent 50%),
        radial-gradient(circle at 80% 85%, rgba(60,100,160,.12), transparent 55%),
        linear-gradient(160deg, var(--bg-mid) 0%, var(--bg-deep) 65%, #060f1f 100%);
    background-attachment: fixed;
    min-height: 100vh;
}
body { padding-bottom: 4rem; }
a { color: var(--gold-bright); text-decoration: none; transition: color .12s; }
a:hover { color: var(--gold); text-decoration: underline; }
h1, h2, h3, h4 { color: var(--gold); margin: 0 0 .5rem; font-weight: 700; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.05rem; }
.muted { color: var(--text-dim); }
.small { font-size: .85rem; }
.ok    { color: var(--green-bright); }
.error { color: var(--danger); }
hr { border: 0; border-top: 1px solid var(--card-border); margin: 1rem 0; }
code { background: rgba(0,0,0,.35); color: var(--gold-bright); padding: 1px 6px; border-radius: 4px; font-size: .9em; }

/* ----- masthead + nav ----- */
.masthead {
    background:
        radial-gradient(circle at 0% 0%, rgba(212,166,74,.08), transparent 50%),
        linear-gradient(180deg, rgba(10,30,60,.85) 0%, rgba(6,15,31,.95) 100%);
    border-bottom: 2px solid var(--gold);
    color: var(--text);
    padding: 1rem 1.4rem;
    display: flex; align-items: center; gap: 1rem;
    box-shadow: 0 4px 18px rgba(0,0,0,.4);
}
.brand { display: flex; align-items: center; gap: .85rem; }
.brand-mark {
    width: 40px; height: 40px; border-radius: 50%;
    background: linear-gradient(135deg, var(--gold-bright) 0%, var(--gold) 100%);
    display: grid; place-items: center; color: var(--bg-deep);
    font-weight: 800; font-size: 1.25rem;
    box-shadow: 0 2px 8px rgba(212,166,74,.4);
}
.brand h1 { color: var(--gold); font-size: 1.2rem; margin: 0; font-weight: 800; letter-spacing: .3px; }
.brand p  { color: var(--gold-bright); font-size: .8rem; margin: 0; font-weight: 600; opacity: .85; }
.session { margin-left: auto; display: flex; align-items: center; gap: .8rem; color: var(--text); }
.session a { color: var(--text); font-weight: 600; }
.session a:hover { color: var(--gold-bright); text-decoration: none; }
.session span { color: var(--gold-bright); }

/* Navigation lives behind a hamburger (saves a full row of screen space —
   the tab strip used to eat ~50px on every page). The burger button sits in
   the masthead; tapping it drops this panel down in-flow. */
.nav-burger {
    background: rgba(0,0,0,.35);
    border: 1px solid var(--gold-dim);
    color: var(--gold-bright);
    border-radius: 8px;
    padding: .45rem .7rem;
    font-size: 1.15rem; line-height: 1;
    cursor: pointer;
}
.nav-burger:hover { background: rgba(212,166,74,.18); }
.nav-burger[aria-expanded="true"] { background: rgba(212,166,74,.28); }
nav.tabs {
    display: none;
    flex-direction: column;
    background: rgba(0,0,0,.55);
    border-bottom: 1px solid var(--card-border);
}
nav.tabs.open { display: flex; }
nav.tabs a {
    color: var(--text-dim);
    padding: .9rem 1.4rem;
    font-weight: 600;
    font-size: .95rem;
    border-left: 3px solid transparent;
    border-bottom: 1px solid rgba(255,255,255,.05);
    transition: all .12s;
    white-space: nowrap;
}
nav.tabs a:hover { color: var(--text); text-decoration: none; background: rgba(255,255,255,.04); }
nav.tabs a.active {
    color: var(--gold);
    border-left-color: var(--gold);
    background: rgba(212,166,74,.08);
}

main { padding: 1.2rem 1.4rem; max-width: 1400px; margin: 0 auto; }

/* ----- cards ----- */
.card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    padding: 1.1rem 1.3rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow);
    backdrop-filter: blur(6px);
}
.card h2 { color: var(--gold); margin-bottom: .6rem; }
.card h3 { color: var(--gold-bright); margin-bottom: .5rem; }
.card p { color: var(--text); }
.card p.muted { color: var(--text-dim); }

.row { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.row .spacer { flex: 1; }

/* ----- buttons ----- */
button, .btn {
    font: inherit; cursor: pointer; border: 0; border-radius: 99px;
    padding: .6rem 1.1rem; font-weight: 700; font-size: .95rem;
    background: rgba(255,255,255,.08);
    color: var(--text);
    border: 1px solid var(--card-border);
    transition: all .12s;
    letter-spacing: .02em;
}
button:hover, .btn:hover {
    background: rgba(255,255,255,.14);
    border-color: var(--gold-dim);
}
button.primary, .btn-primary, button[type=submit] {
    background: linear-gradient(180deg, var(--gold-bright) 0%, var(--gold) 100%);
    color: var(--bg-deep);
    border: 1px solid var(--gold);
    box-shadow: 0 2px 12px rgba(212,166,74,.25);
}
button.primary:hover, .btn-primary:hover, button[type=submit]:hover {
    box-shadow: 0 2px 18px rgba(212,166,74,.45);
    transform: translateY(-1px);
}
button.ghost {
    background: transparent;
    color: var(--gold-bright);
    border: 1px solid var(--gold-dim);
}
button.ghost:hover {
    background: rgba(212,166,74,.1);
    color: var(--gold-bright);
    border-color: var(--gold);
}
button.danger {
    background: linear-gradient(180deg, #e25b65 0%, #b53138 100%);
    color: #fff;
    border: 1px solid #b53138;
}
button.danger:hover { box-shadow: 0 2px 14px rgba(226,91,101,.4); }
button:disabled, button.disabled { opacity: .45; cursor: not-allowed; transform: none !important; }

/* ----- form fields ----- */
label {
    display: block;
    color: var(--gold-bright);
    font-weight: 600;
    font-size: .9rem;
    margin: .5rem 0 .3rem;
}
label input, label select, label textarea {
    margin-top: .3rem;
}
input[type=text], input[type=password], input[type=email], input[type=number],
input[type=date], input[type=file], select, textarea {
    background: var(--input-bg);
    color: var(--text);
    border: 1px solid var(--input-border);
    border-radius: var(--radius-sm);
    padding: .55rem .75rem;
    font: inherit;
    font-size: 1rem; /* 16px floor — below this iOS Safari force-zooms on focus */
    transition: border-color .12s, box-shadow .12s;
    width: 100%;
    max-width: 100%;
}
input[type=text]:focus, input[type=password]:focus, input[type=email]:focus,
input[type=number]:focus, input[type=date]:focus, select:focus, textarea:focus {
    outline: 0;
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(212,166,74,.18);
}
input[type=checkbox], input[type=radio] { accent-color: var(--gold); }
input[type=number] { width: auto; max-width: 6rem; }
input[type=date] { color-scheme: dark; }
input::placeholder, textarea::placeholder { color: rgba(255,255,255,.35); }

/* ----- tables ----- */
table, .standings-table {
    width: 100%;
    border-collapse: collapse;
    color: var(--text);
}
.standings-table thead, table thead { background: rgba(0,0,0,.3); }
.standings-table th, table th {
    color: var(--gold-bright);
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    text-align: left;
    padding: .65rem .9rem;
    font-weight: 700;
    border-bottom: 1px solid var(--gold-dim);
}
.standings-table td, table td {
    padding: .55rem .9rem;
    border-bottom: 1px solid rgba(255,255,255,.06);
}
.standings-table tbody tr:hover, table tbody tr:hover { background: rgba(255,255,255,.04); }
.standings-table td.r, table td.r, .standings-table th.r, table th.r { text-align: right; font-variant-numeric: tabular-nums; }
.standings-table .rank { width: 2.5rem; color: var(--text-dim); }
.standings-table .pts { color: var(--gold-bright); font-weight: 800; }
table.data { width: 100%; }

/* ----- flash messages ----- */
.flash {
    padding: .7rem 1rem;
    border-radius: var(--radius-sm);
    margin-bottom: .8rem;
    font-weight: 600;
    border: 1px solid;
}
.flash.ok {
    background: rgba(76,175,80,.15);
    color: var(--green-bright);
    border-color: rgba(76,175,80,.4);
}
.flash.error {
    background: rgba(226,91,101,.15);
    color: #ffb0b6;
    border-color: rgba(226,91,101,.4);
}

/* ----- view-toggle (Next Matches | Bracket) ----- */
.view-toggle {
    display: flex; gap: .4rem; margin-bottom: 1rem;
    background: rgba(0,0,0,.3);
    border: 1px solid var(--card-border);
    border-radius: 99px;
    padding: 4px;
    max-width: 600px; margin-left: auto; margin-right: auto;
}
.view-toggle .seg {
    flex: 1; text-align: center;
    padding: .7rem 1.2rem;
    border-radius: 99px;
    color: var(--text-dim);
    font-weight: 700; font-size: .95rem;
    transition: all .15s;
}
.view-toggle .seg:hover { color: var(--text); text-decoration: none; }
.view-toggle .seg.active {
    background: linear-gradient(180deg, var(--gold-bright) 0%, var(--gold) 100%);
    color: var(--bg-deep);
    box-shadow: 0 2px 10px rgba(212,166,74,.35);
}

button, .chip, a.btn, .seg, .player-pick {
    touch-action: manipulation; /* no double-tap zoom on controls (iOS) */
}

/* ----- chips, pills, badges ----- */
.chip {
    background: rgba(0,0,0,.35);
    color: var(--gold-bright);
    border: 1px solid var(--gold-dim);
    border-radius: 99px;
    min-width: 2.2rem;
    padding: .35rem .7rem;
    font-weight: 700;
    font-size: .9rem;
    cursor: pointer;
    transition: all .12s;
}
.chip:hover { background: rgba(212,166,74,.15); color: var(--gold-bright); }
.chip.on {
    background: linear-gradient(180deg, var(--gold-bright) 0%, var(--gold) 100%);
    color: var(--bg-deep);
    border-color: var(--gold);
    box-shadow: 0 2px 8px rgba(212,166,74,.4);
}
.chip.disabled, .chip:disabled {
    background: rgba(0,0,0,.2);
    color: rgba(255,255,255,.3);
    border-color: rgba(255,255,255,.08);
    cursor: not-allowed;
    opacity: .7;
}

.status-badge {
    display: inline-block; padding: .15rem .65rem; border-radius: 99px;
    font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
}
.status-badge.ready    { background: rgba(255,167,38,.2); color: var(--warn); border: 1px solid rgba(255,167,38,.4); }
.status-badge.complete { background: rgba(76,175,80,.2); color: var(--green-bright); border: 1px solid rgba(76,175,80,.4); }
.status-badge.waiting  { background: rgba(255,255,255,.08); color: var(--text-dim); border: 1px solid rgba(255,255,255,.12); }
.status-badge.bye      { background: rgba(180,195,220,.1); color: var(--text-bye); border: 1px solid rgba(180,195,220,.2); font-style: italic; }

.table-chip {
    background: linear-gradient(180deg, var(--green-bright) 0%, var(--green) 100%);
    color: #fff; border-radius: 99px;
    padding: .15rem .7rem;
    font-size: .75rem; font-weight: 800;
    letter-spacing: .04em;
    box-shadow: 0 2px 8px rgba(76,175,80,.3);
}

.race-chip {
    background: rgba(0,0,0,.35);
    color: var(--gold-bright);
    border: 1px solid var(--gold-dim);
    border-radius: 99px;
    min-width: 2rem; height: 2rem;
    display: inline-grid; place-items: center;
    font-weight: 800; font-size: .9rem;
    padding: 0 .7rem;
}

.retired-badge {
    background: rgba(255,255,255,.08);
    color: var(--text-dim);
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 99px;
    padding: .15rem .6rem;
    font-size: .72rem; font-weight: 600;
    text-transform: uppercase; letter-spacing: .04em;
    margin-left: .5rem;
}

/* ----- race badges: color-coded by race-to value ----- */
.race-badge {
    display: inline-flex; align-items: center; gap: .3rem;
    border-radius: 99px; padding: .05rem .5rem;
    font-size: .72rem; line-height: 1.55; white-space: nowrap;
    vertical-align: middle; border: 1px solid transparent;
}
.race-badge .race-pre { font-size: .6rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; opacity: .72; }
.race-badge .race-n   { font-weight: 400; font-size: .82rem; }
.race-badge.r1  { background: rgba(154,167,184,.16); color: #c2cede; border-color: rgba(154,167,184,.42); }
/* League races only span 2–5. User-specified coding: 2 = the site's default
   gold (it's the baseline everyone starts at, so it stays the quietest of the
   four), then 3 = green, 4 = yellow, 5 = red so a glance down a bar reads as a
   ladder. The yellow is a deliberately brighter, less orange lemon than
   --gold-bright so it never reads as a race 2.
   Keep tv.php/live.php inline palettes in sync. */
.race-badge.r2  { background: rgba(0,0,0,.3);        color: var(--gold-bright); border-color: var(--gold-dim); }
.race-badge.r3  { background: rgba(80,200,120,.18);  color: #7ee2a0; border-color: rgba(80,200,120,.6); }
.race-badge.r4  { background: rgba(245,222,70,.2);   color: #ffe95c; border-color: rgba(245,222,70,.62); }
.race-badge.r5  { background: rgba(235,80,80,.18);   color: #ff8a8a; border-color: rgba(235,80,80,.6); }
.race-badge.r6  { background: rgba(143,209,74,.16);  color: #a6e46f; border-color: rgba(143,209,74,.45); }
.race-badge.r7  { background: rgba(76,175,80,.18);   color: #6fdc6f; border-color: rgba(76,175,80,.5); }
.race-badge.r8  { background: rgba(63,184,160,.16);  color: #5fd6c0; border-color: rgba(63,184,160,.45); }
.race-badge.r9  { background: rgba(74,163,240,.16);  color: #79baf0; border-color: rgba(74,163,240,.45); }
.race-badge.r10 { background: rgba(111,123,240,.16); color: #94a0f0; border-color: rgba(111,123,240,.45); }
.race-badge.r11 { background: rgba(168,111,240,.16); color: #c19bf0; border-color: rgba(168,111,240,.45); }
.race-badge.r12 { background: rgba(240,111,208,.16); color: #f09bd9; border-color: rgba(240,111,208,.45); }

/* Race badges inside match cards are the operator's primary handicap cue —
   oversized so they read from across a table. */
.match-card .race-badge { padding: .15rem .7rem; gap: .35rem; }
.match-card .race-badge .race-n   { font-size: 1.25rem; line-height: 1.2; }
.match-card .race-badge .race-pre { font-size: .66rem; }

/* Roster race chips reuse the same 2–5 color coding as match badges. */
/* Race 2 intentionally has no rule here — the base .race-chip above is already
   the default gold, which is exactly what a baseline race should look like. */
.race-chip.r3 { background: rgba(80,200,120,.18);  color: #7ee2a0; border-color: rgba(80,200,120,.6); }
.race-chip.r4 { background: rgba(245,222,70,.2);   color: #ffe95c; border-color: rgba(245,222,70,.62); }
.race-chip.r5 { background: rgba(235,80,80,.18);   color: #ff8a8a; border-color: rgba(235,80,80,.6); }

/* Compact race badge next to each name on the Tables strip. */
.table-card .race-badge { padding: .05rem .45rem; margin-left: .35rem; }
.table-card .race-badge .race-n { font-size: .8rem; }

/* ----- match-card (Now page) ----- */
.match-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-left: 4px solid var(--bg-light);
    border-radius: var(--radius-sm);
    padding: .8rem 1rem;
    margin-bottom: .7rem;
    box-shadow: var(--shadow);
}
.match-card.wb { border-left-color: var(--gold); }
.match-card.lb { border-left-color: var(--gold-dim); }
.match-card.gf { border-left-color: var(--danger); }
.match-card.ready {
    border-color: rgba(76,175,80,.35);
    box-shadow: 0 0 0 1px rgba(76,175,80,.15), 0 4px 18px rgba(0,0,0,.34);
}
.match-card.complete { opacity: .65; }
.match-meta {
    display: flex; gap: .5rem; flex-wrap: wrap; align-items: center;
    font-size: .78rem; color: var(--text-dim);
    margin-bottom: .5rem;
}
.match-meta .game-type {
    color: var(--gold-bright); font-weight: 700;
    text-transform: uppercase; letter-spacing: .04em;
}
.players-line {
    display: flex; align-items: center; gap: 1rem; margin: .4rem 0;
}
/* Race badge in a FIXED column to the LEFT of the name — every badge sits on
   the same vertical line across every card (the sides are equal-width halves).
   Points-mode score pills render after the name instead, scoreboard-style. */
.players-line .player-side {
    flex: 1; min-width: 0;
    display: flex; align-items: center; justify-content: flex-start; gap: .5rem;
}
.players-line .player-side .name {
    font-size: 1.1rem; font-weight: 700; color: var(--text);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    min-width: 0; flex: 1 1 auto;
}
.players-line .player-side.winner .name { color: var(--green-bright); }
.players-line .player-side.loser .name { color: var(--text-dim); text-decoration: line-through; }
.players-line .player-side .race {
    font-size: .75rem; color: var(--gold-bright);
    text-transform: uppercase; letter-spacing: .04em;
    font-weight: 600;
    flex: 0 0 4.6rem; display: flex; justify-content: center;
}
.players-line .versus {
    color: var(--gold); font-weight: 800;
    font-size: .85rem;
    text-transform: uppercase; letter-spacing: .06em;
}
.match-actions {
    display: flex; gap: .5rem; align-items: center;
    margin-top: .5rem; flex-wrap: wrap;
}
.table-assign {
    display: flex; gap: .35rem; align-items: center;
    margin-top: .6rem; padding-top: .6rem;
    border-top: 1px solid var(--card-border);
    flex-wrap: wrap;
}
.table-assign .ta-label {
    color: var(--text-dim); font-size: .78rem;
    font-weight: 600; text-transform: uppercase; letter-spacing: .05em;
    margin-right: .3rem;
}

/* ----- tables strip (Now page top: Table 1, 2, 3) ----- */
.tables-card { padding: 1rem 1.2rem; }
.tables-head {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: .8rem;
}
.tables-count {
    display: flex; gap: .35rem; align-items: center;
}
.tables-strip {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: .8rem;
}
/* Table card layout: the table number is a left rail; each player row puts
   the name left and the race badge in a FIXED right column, so every badge
   lines up on the same vertical line within and across cards. */
.table-card {
    background: var(--card-bg);
    border: 2px dashed var(--card-border);
    border-radius: var(--radius);
    padding: .55rem .7rem;
    display: flex; align-items: stretch; gap: .7rem;
    text-align: left;
}
.table-card.busy {
    border: 2px solid var(--green);
    background: linear-gradient(180deg, rgba(76,175,80,.18) 0%, rgba(10,30,60,.55) 100%);
    box-shadow: 0 0 0 1px rgba(76,175,80,.3), 0 0 18px rgba(76,175,80,.2);
}
.table-card .tc-num {
    flex: 0 0 auto; align-self: center;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    min-width: 3rem; padding: .2rem .35rem;
    border-right: 1px solid rgba(255,255,255,.1);
}
.table-card .tc-label { color: var(--gold); font-weight: 700; font-size: .6rem; text-transform: uppercase; letter-spacing: .1em; }
.table-card .tc-n { color: var(--gold-bright); font-weight: 800; font-size: 1.5rem; line-height: 1.1; }
.table-card.busy .tc-label { color: var(--green-bright); }
.table-card.busy .tc-n { color: var(--green-bright); }
.table-card .tc-body { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; justify-content: center; }
.table-card .tc-row { display: flex; align-items: center; justify-content: flex-start; gap: .5rem; min-height: 1.55rem; }
.table-card .tc-name { color: var(--text); font-weight: 700; font-size: 1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
/* The badge column: fixed width, centered — this is what makes every race
   number sit on one vertical line. */
.table-card .tc-race { flex: 0 0 3rem; display: flex; justify-content: center; }
.table-card .tc-mid { color: var(--gold); font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; padding: .05rem 0; }
.table-card .table-open-label { color: var(--text-dim); font-style: italic; font-size: .95rem; padding: .35rem 0; }

/* ----- player list / roster ----- */
.player-list { display: flex; flex-direction: column; gap: .35rem; }
.player-row {
    display: flex; align-items: center; gap: .8rem; flex-wrap: wrap;
    padding: .55rem .8rem;
    background: rgba(255,255,255,.03);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-sm);
}
.player-row:hover { background: rgba(255,255,255,.06); }
/* Fixed-width date column so every row's race chip sits on the same vertical
   line regardless of "Never played" vs "Last played Jul 16, 2026". */
.player-row .last-played { width: 11rem; flex: 0 0 auto; }
.player-row.retired { opacity: .55; }
.player-row-name { flex: 1; min-width: 200px; }
.player-row-name a { color: var(--text); font-weight: 600; }
.player-row-name a:hover { color: var(--gold-bright); text-decoration: none; }

.player-photo {
    width: 96px; height: 96px; object-fit: cover;
    border-radius: 10px; border: 2px solid var(--gold);
    box-shadow: 0 4px 18px rgba(0,0,0,.35);
    flex: 0 0 auto;
}
.player-thumb {
    width: 30px; height: 30px; object-fit: cover; border-radius: 50%;
    border: 1px solid var(--gold-dim);
    vertical-align: middle; margin-right: .4rem;
}

/* ----- head-to-head ----- */
.h2h-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: .25rem .8rem;
}
.h2h-row {
    display: flex; justify-content: space-between; align-items: baseline;
    padding: .3rem 0;
    border-bottom: 1px solid rgba(255,255,255,.06);
}
.h2h-row a { color: var(--text); }
.h2h-row a:hover { color: var(--gold-bright); text-decoration: none; }
.h2h-rec { font-weight: 800; font-variant-numeric: tabular-nums; color: var(--text-dim); }
.h2h-rec.up   { color: var(--green-bright); }
.h2h-rec.down { color: var(--danger); }

/* ----- podium pill row ----- */
.podium { display: flex; gap: 1.2rem; flex-wrap: wrap; margin: .4rem 0; font-size: 1.05rem; font-weight: 600; }
.podium span { color: var(--gold-bright); }

/* ----- match timer ----- */
.match-timer { color: var(--warn); font-weight: 700; font-size: .82rem; }

/* ----- modals ----- */
.modal {
    position: fixed; inset: 0;
    background: rgba(0,0,0,.7);
    display: grid; place-items: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}
.modal[hidden] { display: none; }
.modal-card {
    background: linear-gradient(160deg, var(--bg-mid) 0%, var(--bg-deep) 100%);
    border: 2px solid var(--gold);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: 0 20px 80px rgba(0,0,0,.6);
    max-width: 480px; width: 90%;
}
.modal-card h2 { color: var(--gold); margin-bottom: .4rem; }
.modal-actions { display: flex; gap: .5rem; justify-content: flex-end; margin-top: 1rem; }
.player-pick {
    display: flex; align-items: center; gap: .6rem;
    padding: .7rem 1rem; margin-top: .5rem;
    background: rgba(255,255,255,.04);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all .12s;
}
.player-pick:hover {
    background: rgba(255,255,255,.08);
    border-color: var(--gold-dim);
}
.player-pick input[type=radio] { accent-color: var(--gold); }
.player-pick input[type=checkbox] { accent-color: var(--gold); }
.player-pick span { color: var(--text); font-weight: 600; flex: 1; min-width: 0; }

/* ----- bracket-tree (kept for any legacy display, the new bracket page has its own inline styles) ----- */
.bracket-card { background: var(--card-bg); border: 1px solid var(--card-border); border-radius: var(--radius); padding: 1rem; margin-bottom: 1rem; }
.bracket-title { margin: 0 0 .5rem; color: var(--gold); }
.bracket-title.wb { color: var(--gold); }
.bracket-title.lb { color: var(--gold-dim); }
.bracket-title.gf { color: var(--danger); }
.bracket-scroll { overflow-x: auto; padding: .5rem 0 1rem; }
.bracket-tree {
    position: relative;
    display: flex; gap: 2.5rem;
    padding: .5rem 0;
    min-height: 220px;
    align-items: stretch;
}
.bracket-round {
    display: flex; flex-direction: column;
    justify-content: space-around;
    min-width: 180px;
    position: relative; z-index: 2;
}
.bracket-round-title {
    text-align: center;
    color: var(--gold-bright);
    font-size: .72rem;
    text-transform: uppercase; letter-spacing: .07em;
    margin-bottom: .4rem;
    font-weight: 700;
}
.tree-match {
    background: rgba(10,30,60,.65);
    border: 1px solid var(--card-border);
    border-left: 3px solid var(--gold);
    border-radius: var(--radius-sm);
    padding: .5rem .7rem;
    margin: .3rem 0;
    font-size: .92rem;
    box-shadow: 0 2px 6px rgba(0,0,0,.3);
    position: relative; z-index: 2;
    min-width: 170px;
}
.tree-match.lb { border-left-color: var(--gold-dim); }
.tree-match.gf { border-left-color: var(--danger); }
.tree-match.status-complete { opacity: .85; }
.tree-match-head {
    display: flex; justify-content: space-between;
    color: var(--text-dim);
    font-size: .68rem;
    text-transform: uppercase; letter-spacing: .05em;
    margin-bottom: .25rem;
}
.tree-match .tn { color: var(--text); line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tree-match .tn.win  { font-weight: 800; color: var(--green-bright); }
.tree-match .tn.lose { color: var(--text-dim); text-decoration: line-through; }
.tree-tag {
    margin-top: .25rem;
    display: inline-block;
    background: linear-gradient(180deg, var(--green-bright) 0%, var(--green) 100%);
    color: #fff;
    font-size: .7rem; font-weight: 800;
    padding: .12rem .5rem;
    border-radius: 99px;
    letter-spacing: .04em;
}
.tree-feed {
    margin-top: .25rem;
    font-size: .65rem; color: var(--text-dim);
    display: flex; gap: .55rem;
}
.bracket-svg {
    position: absolute; inset: 0;
    width: 100%; height: 100%;
    pointer-events: none; z-index: 1;
}
.bracket-tree.wb .bracket-line,
.bracket-tree.lb .bracket-line,
.bracket-tree.gf .bracket-line { stroke: var(--gold-line); }

/* ----- footer ----- */
.footer {
    text-align: center;
    padding: 2rem 1rem 1rem;
    color: var(--text-dim);
    font-size: .85rem;
}
.footer a { color: var(--gold-bright); }

/* The hidden attribute must always win — author display rules (e.g. .row's
   flex) would otherwise override the UA's [hidden] display:none. */
[hidden] { display: none !important; }

/* ----- one-tap winner buttons (result modal) ----- */
.winner-btn {
    display: block; width: 100%;
    margin-top: .55rem;
    padding: 1.05rem 1.1rem;
    font: inherit; font-size: 1.15rem; font-weight: 700;
    text-align: center;
    background: rgba(255,255,255,.05);
    color: var(--text);
    border: 2px solid var(--gold-dim);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all .12s;
}
.winner-btn:hover { border-color: var(--gold); background: rgba(212,166,74,.12); }

/* ----- admin hub cards ----- */
.admin-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: .7rem; margin-top: .8rem; }
.admin-card {
    display: flex; gap: .8rem; align-items: flex-start;
    padding: .9rem 1rem;
    background: rgba(255,255,255,.04);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-sm);
    color: var(--text); text-decoration: none;
    transition: all .12s;
}
.admin-card:hover { border-color: var(--gold-dim); background: rgba(212,166,74,.08); text-decoration: none; }
.admin-icon { font-size: 1.4rem; line-height: 1.2; }
.admin-body { display: flex; flex-direction: column; gap: .15rem; }

/* ----- players page: collapsed edit panel ----- */
.player-actions {
    display: flex; flex-wrap: wrap; gap: .6rem 1.2rem; align-items: center;
    margin: -.1rem 0 .35rem;
    padding: .6rem .8rem .6rem 1.4rem;
    background: rgba(0,0,0,.25);
    border-left: 2px solid var(--gold-dim);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

/* ----- busy / toast / confirm primitives ----- */
button.busy { position: relative; color: transparent !important; pointer-events: none; }
button.busy::after {
    content: ''; position: absolute; inset: 0; margin: auto;
    width: 1em; height: 1em;
    border: 2px solid rgba(240,192,96,.35); border-top-color: var(--gold-bright, #f0c060);
    border-radius: 99px;
    animation: nfvSpin .7s linear infinite;
}
@keyframes nfvSpin { to { transform: rotate(360deg); } }

#nfv-toast {
    position: fixed; left: 50%; bottom: calc(1.2rem + env(safe-area-inset-bottom, 0px));
    transform: translate(-50%, 20px);
    background: linear-gradient(160deg, var(--bg-mid) 0%, var(--bg-deep) 100%);
    color: var(--text);
    border: 1px solid var(--gold-dim);
    border-radius: var(--radius-sm);
    padding: .7rem 1.1rem;
    font-weight: 600;
    box-shadow: 0 10px 40px rgba(0,0,0,.5);
    opacity: 0; pointer-events: none;
    transition: opacity .2s, transform .2s;
    z-index: 10000;
    max-width: min(92vw, 480px);
    text-align: center;
}
#nfv-toast.show { opacity: 1; transform: translate(-50%, 0); }
#nfv-toast.error { border-color: #c0392b; box-shadow: 0 10px 40px rgba(160,40,30,.45); }

/* safe areas (notched phones) — viewport-fit=cover is set in the layout */
.masthead { padding-left: max(1.4rem, env(safe-area-inset-left)); padding-right: max(1.4rem, env(safe-area-inset-right)); }
.footer   { padding-bottom: calc(1rem + env(safe-area-inset-bottom, 0px)); }

/* ----- mobile-friendly /now ----- */
@media (max-width: 680px) {
    main { padding: .8rem; }
    .masthead { padding: .8rem 1rem; }
    .brand h1 { font-size: 1.05rem; }
    nav.tabs a { padding: .8rem .9rem; font-size: .9rem; }
    .match-card .players-line { flex-direction: column; align-items: stretch; gap: .25rem; }
    .match-card .players-line .versus { display: none; }
    .match-card .table-assign .chip { min-width: 3rem; padding: .65rem .8rem; font-size: 1.05rem; }
    .tables-count .chip { min-width: 2.8rem; padding: .6rem .7rem; font-size: 1rem; }
    .tables-count { flex-wrap: wrap; }
    .match-card button.primary, .match-card button.ghost { padding: .7rem 1rem; font-size: 1rem; }
    .match-actions { flex-wrap: wrap; gap: .4rem; }
    .tables-strip { grid-template-columns: 1fr 1fr; }
    .view-toggle .seg { padding: .6rem .8rem; font-size: .88rem; }
}

/* ----- multi-tournament chooser (Now/Bracket/TV when several are live) ----- */
.live-list { display: flex; flex-direction: column; gap: .6rem; margin-top: .6rem; }
.live-item {
    display: flex; flex-direction: column; gap: .15rem;
    padding: .8rem 1rem;
    background: rgba(255,255,255,.04);
    border: 1px solid var(--gold-dim);
    border-radius: var(--radius);
    text-decoration: none;
    transition: background .12s, border-color .12s;
}
a.live-item:hover { background: rgba(212,166,74,.12); border-color: var(--gold-line); text-decoration: none; }
.live-item .live-name { color: var(--gold-bright); font-weight: 800; font-size: 1.05rem; }
.live-item .live-links a { font-weight: 600; }
.live-item.static { flex-direction: column; }

/* ----- sign out lives inside the burger menu ----- */
nav.tabs .nav-signout { border-top: 1px solid rgba(255,255,255,.08); color: var(--text-dim); }

/* ----- team builder (/new) ----- */
.team-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: .7rem; }
.team-card {
    background: rgba(10,30,60,.55);
    border: 1px solid rgba(212,166,74,.35);
    border-radius: 8px; padding: .7rem .8rem;
}
.team-card-head { display: flex; gap: .5rem; align-items: center; }
.team-card .team-name { flex: 1 1 auto; min-width: 0; font-weight: 700; }
.team-card .team-remove { flex: 0 0 auto; padding: .3rem .6rem; }
.team-members { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .55rem; align-items: center; }
.member-chip {
    display: inline-flex; align-items: center; gap: .3rem;
    background: rgba(0,0,0,.35); border: 1px solid rgba(255,255,255,.14);
    border-radius: 99px; padding: .18rem .3rem .18rem .6rem; font-size: .85rem;
}
.member-chip .member-x {
    background: none; border: none; color: var(--text-dim); cursor: pointer;
    font-size: .95rem; line-height: 1; padding: 0 .3rem;
}
.member-chip .member-x:hover { color: var(--danger); }
.team-members .member-add { width: auto; min-width: 9rem; padding: .3rem .5rem; font-size: .85rem; }

/* ----- points configuration (/new, team race-to-points) ----- */
.points-config {
    margin-top: .8rem; padding: .8rem 1rem;
    background: rgba(0,0,0,.22);
    border: 1px solid rgba(212,166,74,.3); border-radius: 8px;
}
.outcome-row { display: flex; gap: .5rem; align-items: center; margin-top: .45rem; flex-wrap: wrap; }
.outcome-row .o-label { flex: 1 1 12rem; min-width: 9rem; }
.outcome-row .o-points { width: 4.6rem; flex: 0 0 auto; }
.outcome-row .o-x { padding: .3rem .6rem; flex: 0 0 auto; }

/* ----- team points scoring (Now page match cards) ----- */
.score-pill {
    display: inline-grid; place-items: center;
    min-width: 2.1rem; height: 1.6rem; padding: 0 .5rem;
    background: rgba(0,0,0,.4); color: var(--gold-bright);
    border: 1px solid var(--gold-dim); border-radius: 99px;
    font-weight: 800; font-variant-numeric: tabular-nums;
}
.score-pill.big { height: 2rem; min-width: 2.6rem; font-size: 1.15rem; }
.score-panel {
    display: grid; grid-template-columns: 1fr 1fr; gap: .6rem;
    margin-top: .5rem; padding-top: .55rem;
    border-top: 1px solid var(--card-border);
}
.score-side { display: flex; flex-direction: column; gap: .35rem; align-items: stretch; min-width: 0; }
.score-side .score-who {
    color: var(--text-dim); font-size: .72rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: .05em;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.score-chip { text-align: center; font-weight: 700; }
@media (max-width: 560px) { .score-panel { grid-template-columns: 1fr; } }

/* ----- manage page controller list ----- */
.ctl-list { display: flex; flex-direction: column; gap: .3rem; }
.ctl-row {
    display: flex; gap: .55rem; align-items: center;
    padding: .45rem .6rem; margin: 0;
    background: rgba(255,255,255,.03);
    border: 1px solid var(--card-border); border-radius: var(--radius-sm);
    font-weight: 500;
}
