/* SportyPants design system — shared across landing/web/admin */
@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap");

:root {
    color-scheme: light dark;

    /* Brand */
    --brand-50:  #ecfdf5;
    --brand-100: #d1fae5;
    --brand-300: #6ee7b7;
    --brand-400: #34d399;
    --brand-500: #10b981;
    --brand-600: #059669;
    --brand-700: #047857;
    --brand-grad: linear-gradient(135deg, #10b981 0%, #14b8a6 50%, #06b6d4 100%);

    /* Neutrals — light */
    --bg: #f8fafc;
    --bg-elev: #ffffff;
    --bg-soft: #f1f5f9;
    --border: #e2e8f0;
    --border-strong: #cbd5e1;
    --text: #0f172a;
    --text-muted: #475569;
    --text-soft: #64748b;

    /* Status */
    --danger: #dc2626;
    --danger-bg: #fef2f2;
    --warn: #d97706;
    --success: #16a34a;
    --info: #0284c7;

    /* Misc */
    --radius-sm: 0.4rem;
    --radius: 0.75rem;
    --radius-lg: 1rem;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
    --shadow: 0 4px 16px rgba(15, 23, 42, 0.08);
    --shadow-lg: 0 16px 40px rgba(15, 23, 42, 0.12);
    --container: 64rem;
    --container-wide: 76rem;
    --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --font-mono: "JetBrains Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #060b14;
        --bg-elev: #0f172a;
        --bg-soft: #111c2f;
        --border: #1e293b;
        --border-strong: #334155;
        --text: #f1f5f9;
        --text-muted: #cbd5e1;
        --text-soft: #94a3b8;
        --danger-bg: #2a1010;
        --shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
        --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.55);
    }
}

/* Reset */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
    margin: 0;
    font-family: var(--font-sans);
    font-size: 15px;
    line-height: 1.55;
    color: var(--text);
    background: var(--bg);
    background-image:
        radial-gradient(1200px 600px at 90% -10%, rgba(16, 185, 129, 0.10), transparent 60%),
        radial-gradient(800px 500px at -10% 20%, rgba(6, 182, 212, 0.08), transparent 60%);
    background-attachment: fixed;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}
img, svg { max-width: 100%; display: block; }
hr { border: 0; border-top: 1px solid var(--border); margin: 1.25rem 0; }
code, pre, kbd { font-family: var(--font-mono); font-size: 0.85em; }
code { background: var(--bg-soft); padding: 0.1rem 0.35rem; border-radius: 0.3rem; border: 1px solid var(--border); }
pre {
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    overflow: auto;
    box-shadow: var(--shadow-sm);
}

/* Typography */
h1, h2, h3, h4 { margin: 0 0 0.5rem; line-height: 1.2; letter-spacing: -0.02em; font-weight: 700; }
h1 { font-size: clamp(1.75rem, 2.4vw, 2.5rem); }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.1rem; }
p { margin: 0 0 0.75rem; }
small, .text-sm { font-size: 0.85rem; }
.muted { color: var(--text-muted); }
.soft { color: var(--text-soft); font-size: 0.9rem; }
.eyebrow {
    display: inline-block;
    color: var(--brand-600);
    font-weight: 600;
    font-size: 0.75rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}
@media (prefers-color-scheme: dark) {
    .eyebrow { color: var(--brand-300); }
}

a { color: var(--brand-600); text-decoration: none; }
a:hover { text-decoration: underline; }
@media (prefers-color-scheme: dark) {
    a { color: var(--brand-300); }
}

/* Layout */
.container, .container-wide { width: 100%; margin: 0 auto; padding: 0 1.25rem; }
.container { max-width: var(--container); }
.container-wide { max-width: var(--container-wide); }
.stack > * + * { margin-top: 1rem; }
.stack-tight > * + * { margin-top: 0.5rem; }
.row { display: flex; gap: 1rem; flex-wrap: wrap; align-items: center; }
.row.between { justify-content: space-between; }
.grid { display: grid; gap: 1rem; }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); }

/* Top nav */
.site-header {
    position: sticky;
    top: 0;
    z-index: 10;
    backdrop-filter: saturate(140%) blur(10px);
    -webkit-backdrop-filter: saturate(140%) blur(10px);
    background: color-mix(in oklab, var(--bg) 80%, transparent);
    border-bottom: 1px solid var(--border);
}
.site-header .inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 56px;
    gap: 1rem;
}
.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 800;
    color: var(--text);
    font-size: 1.05rem;
    letter-spacing: -0.01em;
}
.brand:hover { text-decoration: none; }
.brand-mark {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: var(--brand-grad);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.35);
    display: inline-grid;
    place-items: center;
    color: #fff;
    font-weight: 800;
    font-size: 14px;
}
.brand .pill { margin-left: 0.25rem; }
.nav { display: flex; align-items: center; gap: 0.25rem; }
.nav a, .nav button {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.45rem 0.7rem;
    border-radius: 0.55rem;
    color: var(--text-muted);
    font-weight: 500;
    background: transparent;
    border: 0;
    cursor: pointer;
    font: inherit;
}
.nav a:hover, .nav button:hover { background: var(--bg-soft); color: var(--text); text-decoration: none; }
.nav .who { color: var(--text-soft); font-size: 0.85rem; padding: 0 0.5rem; border-left: 1px solid var(--border); margin-left: 0.25rem; }
.nav .nav-signout { display: inline-flex; border-left: 1px solid var(--border); margin-left: 0.25rem; padding-left: 0.25rem; }

.nav-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    margin-left: auto;
    border: 1px solid var(--border);
    border-radius: 0.55rem;
    background: var(--bg-elev);
    color: var(--text);
    cursor: pointer;
    flex-shrink: 0;
}
.nav-toggle:hover { background: var(--bg-soft); border-color: var(--border-strong); }
.nav-toggle-bars,
.nav-toggle-bars::before,
.nav-toggle-bars::after {
    display: block;
    width: 1.1rem;
    height: 2px;
    border-radius: 1px;
    background: currentColor;
    transition: transform 160ms ease, opacity 160ms ease;
}
.nav-toggle-bars { position: relative; }
.nav-toggle-bars::before,
.nav-toggle-bars::after {
    content: "";
    position: absolute;
    left: 0;
}
.nav-toggle-bars::before { top: -6px; }
.nav-toggle-bars::after { top: 6px; }
.site-header.is-nav-open .nav-toggle-bars { background: transparent; }
.site-header.is-nav-open .nav-toggle-bars::before { transform: translateY(6px) rotate(45deg); }
.site-header.is-nav-open .nav-toggle-bars::after { transform: translateY(-6px) rotate(-45deg); }

@media (max-width: 900px) {
    .site-header .inner {
        flex-wrap: wrap;
        height: auto;
        min-height: 56px;
        padding-top: 0.5rem;
        padding-bottom: 0.5rem;
    }
    .nav-toggle { display: inline-flex; }
    .nav {
        display: none;
        flex-basis: 100%;
        flex-direction: column;
        align-items: stretch;
        gap: 0.15rem;
        padding-top: 0.5rem;
        border-top: 1px solid var(--border);
        margin-top: 0.35rem;
    }
    .site-header.is-nav-open .nav { display: flex; }
    .nav a, .nav button {
        width: 100%;
        justify-content: flex-start;
        padding: 0.7rem 0.85rem;
    }
    .nav .nav-signout {
        display: block;
        border-left: 0;
        margin-left: 0;
        padding-left: 0;
        margin-top: 0.25rem;
        padding-top: 0.35rem;
        border-top: 1px solid var(--border);
    }
    .nav .nav-signout .btn { width: 100%; justify-content: flex-start; }
}

/* Footer */
.site-footer {
    margin-top: 4rem;
    border-top: 1px solid var(--border);
    color: var(--text-soft);
    font-size: 0.85rem;
    padding: 1.25rem 0 2rem;
}

/* Cards */
.card {
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: var(--shadow-sm);
}
.card.hover { transition: transform 120ms ease, box-shadow 120ms ease, border-color 120ms ease; }
.card.hover:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--border-strong); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 0.75rem; }
.card-head h2, .card-head h3 { margin: 0; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.55rem 0.95rem;
    border-radius: 0.55rem;
    background: var(--bg-elev);
    color: var(--text);
    border: 1px solid var(--border-strong);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 120ms ease, border-color 120ms ease, transform 60ms ease;
    text-decoration: none;
}
.btn:hover { background: var(--bg-soft); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: 0.6; cursor: not-allowed; }
.btn-primary {
    background: var(--brand-grad);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 6px 16px rgba(16, 185, 129, 0.25);
}
.btn-primary:hover { filter: brightness(1.05); background: var(--brand-grad); color: #fff; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-muted); }
.btn-ghost:hover { color: var(--text); background: var(--bg-soft); }
.btn-danger { background: #fef2f2; color: #b91c1c; border-color: #fecaca; }
@media (prefers-color-scheme: dark) {
    .btn-danger { background: rgba(220, 38, 38, 0.14); color: #fca5a5; border-color: rgba(220, 38, 38, 0.35); }
    .btn-danger:hover { background: rgba(220, 38, 38, 0.22); }
}
.btn-sm { padding: 0.35rem 0.6rem; font-size: 0.8rem; }
.btn-lg { padding: 0.75rem 1.25rem; font-size: 1rem; }
.btn-block { width: 100%; }

/* Forms */
.field { display: block; margin-bottom: 0.75rem; }
.field > label { display: block; font-weight: 600; font-size: 0.85rem; color: var(--text-muted); margin-bottom: 0.35rem; }
.input, .select, .textarea {
    width: 100%;
    padding: 0.6rem 0.75rem;
    background: var(--bg-elev);
    color: var(--text);
    border: 1px solid var(--border-strong);
    border-radius: 0.55rem;
    font-size: 0.95rem;
    font: inherit;
    line-height: 1.4;
    transition: border-color 120ms ease, box-shadow 120ms ease;
}
.select { appearance: none; padding-right: 2.5rem; background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path d='M1 1l5 5 5-5' stroke='%2364748b' stroke-width='1.6' fill='none' stroke-linecap='round' stroke-linejoin='round'/></svg>"); background-repeat: no-repeat; background-position: right 0.75rem center; }
.input:focus, .select:focus, .textarea:focus { outline: 0; border-color: var(--brand-500); box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.20); }
.input[readonly], .select[readonly] { background: var(--bg-soft); color: var(--text-muted); }
.help { color: var(--text-soft); font-size: 0.8rem; margin-top: 0.3rem; }

/* Pills / badges */
.pill {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.15rem 0.55rem;
    background: var(--bg-soft);
    color: var(--text-muted);
    border: 1px solid var(--border);
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    white-space: nowrap;
}
.pill-brand { background: var(--brand-50); color: var(--brand-700); border-color: var(--brand-100); }
.pill-success { background: #dcfce7; color: #166534; border-color: #bbf7d0; }
.pill-info { background: #e0f2fe; color: #075985; border-color: #bae6fd; }
.pill-warn { background: #fef3c7; color: #92400e; border-color: #fde68a; }
.pill-danger { background: #fee2e2; color: #991b1b; border-color: #fecaca; }
@media (prefers-color-scheme: dark) {
    .pill-brand { background: rgba(16, 185, 129, 0.12); color: var(--brand-300); border-color: rgba(16, 185, 129, 0.30); }
    .pill-success { background: rgba(34, 197, 94, 0.12); color: #86efac; border-color: rgba(34, 197, 94, 0.3); }
    .pill-info { background: rgba(2, 132, 199, 0.15); color: #7dd3fc; border-color: rgba(56, 189, 248, 0.3); }
    .pill-warn { background: rgba(245, 158, 11, 0.15); color: #fcd34d; border-color: rgba(245, 158, 11, 0.3); }
    .pill-danger { background: rgba(220, 38, 38, 0.15); color: #fca5a5; border-color: rgba(220, 38, 38, 0.3); }
}

/* Alerts */
.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-soft);
    color: var(--text);
    font-size: 0.9rem;
}
.alert-error { background: var(--danger-bg); color: var(--danger); border-color: rgba(220,38,38,0.25); }
.alert-info { background: #eff6ff; color: #1e40af; border-color: #bfdbfe; }
@media (prefers-color-scheme: dark) {
    .alert-error { color: #fca5a5; }
    .alert-info  { background: rgba(59,130,246,0.10); color: #93c5fd; border-color: rgba(59,130,246,0.25); }
}

/* Tables */
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 0.9rem; }
.table th, .table td { text-align: left; padding: 0.65rem 0.75rem; border-bottom: 1px solid var(--border); }
.table th { color: var(--text-soft); font-weight: 600; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--bg-soft); }

/* Stepper */
.stepper { display: flex; gap: 0.5rem; align-items: center; margin: 0 0 1.25rem; flex-wrap: wrap; }
.step { display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.4rem 0.7rem; border-radius: 999px; background: var(--bg-soft); color: var(--text-muted); font-size: 0.8rem; font-weight: 600; border: 1px solid var(--border); }
.step .num { width: 1.4rem; height: 1.4rem; border-radius: 999px; background: var(--bg-elev); color: var(--text-soft); font-size: 0.75rem; display: inline-grid; place-items: center; border: 1px solid var(--border-strong); }
.step.is-current { color: var(--brand-700); background: var(--brand-50); border-color: var(--brand-100); }
.step.is-current .num { background: var(--brand-grad); color: #fff; border-color: transparent; }
.step.is-done { color: var(--text); }
.step.is-done .num { background: var(--brand-500); color: #fff; border-color: transparent; }
@media (prefers-color-scheme: dark) {
    .step.is-current { color: var(--brand-300); background: rgba(16, 185, 129, 0.1); border-color: rgba(16, 185, 129, 0.3); }
}
.step-sep { color: var(--text-soft); }

/* Hero (landing) */
.hero { padding: 4rem 0 3rem; text-align: center; }
.hero h1 { font-size: clamp(2.25rem, 4vw, 3.6rem); margin-bottom: 1rem; }
.hero .lede { color: var(--text-muted); font-size: 1.15rem; max-width: 38rem; margin: 0 auto 1.5rem; }
.hero .gradient-text {
    background: var(--brand-grad);
    -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero-cta { display: inline-flex; gap: 0.6rem; flex-wrap: wrap; justify-content: center; }

/* Selectable list (create wizard) */
.choice-list { display: grid; gap: 0.5rem; grid-template-columns: 1fr; }
.choice {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    text-decoration: none;
    transition: border-color 120ms ease, transform 120ms ease, background 120ms ease;
}
.choice:hover { border-color: var(--brand-500); background: var(--bg-soft); text-decoration: none; transform: translateY(-1px); }
.choice .arrow { color: var(--text-soft); transition: transform 120ms ease, color 120ms ease; }
.choice:hover .arrow { color: var(--brand-600); transform: translateX(2px); }
.choice .meta { color: var(--text-soft); font-size: 0.85rem; }
@media (prefers-color-scheme: dark) {
    .choice:hover .arrow { color: var(--brand-300); }
}

/* Match card (game dashboard) */
.match {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    background: var(--bg-elev);
    display: grid;
    gap: 0.75rem;
}
.match-head { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; color: var(--text-soft); font-size: 0.8rem; }
.match-teams { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 0.75rem; }
.match-team { display: flex; align-items: center; gap: 0.5rem; }
.match-team.away { justify-content: flex-end; }
.match-team .crest { width: 28px; height: 28px; border-radius: 8px; background: var(--bg-soft); border: 1px solid var(--border); display: grid; place-items: center; font-weight: 800; color: var(--text-muted); font-size: 12px; }
.match-vs { color: var(--text-soft); font-weight: 700; font-size: 0.8rem; letter-spacing: 0.08em; }
.match-actions { display: flex; gap: 0.5rem; }
.match-actions form { flex: 1; }
.match-actions .btn { width: 100%; }

/* Rank cells */
.rank { display: inline-grid; place-items: center; width: 1.6rem; height: 1.6rem; border-radius: 999px; background: var(--bg-soft); color: var(--text-muted); font-size: 0.75rem; font-weight: 700; border: 1px solid var(--border); }
.rank.gold   { background: #fef3c7; color: #92400e; border-color: #fde68a; }
.rank.silver { background: #e2e8f0; color: #334155; border-color: #cbd5e1; }
.rank.bronze { background: #fed7aa; color: #9a3412; border-color: #fdba74; }

/* Team monogram badge (colored circle with initials/abbreviation).
   Background = team primary color, text = team secondary color.
   Set the colors as inline CSS vars on the element:
       <span class="team-badge" style="--team-bg:#0C2340; --team-fg:#C4CED4;">NYY</span>
   Falls back to neutral chrome when --team-bg / --team-fg aren't supplied. */
.team-badge {
    --team-bg: var(--bg-soft);
    --team-fg: var(--text-muted);
    --team-size: 2.25rem;
    display: inline-grid;
    place-items: center;
    width: var(--team-size);
    height: var(--team-size);
    border-radius: 999px;
    background: var(--team-bg);
    color: var(--team-fg);
    font-family: var(--font-sans);
    font-weight: 800;
    font-size: calc(var(--team-size) * 0.36);
    letter-spacing: 0.02em;
    line-height: 1;
    border: 1px solid color-mix(in oklab, var(--team-bg) 70%, #000 30%);
    box-shadow:
        inset 0 0 0 2px color-mix(in oklab, var(--team-fg) 30%, transparent),
        0 1px 2px rgba(0, 0, 0, 0.15);
    flex-shrink: 0;
    user-select: none;
}
.team-badge.sm { --team-size: 1.75rem; }
.team-badge.lg { --team-size: 3rem; }

.team-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}
.team-row .team-meta { display: flex; flex-direction: column; gap: 0.05rem; min-width: 0; }
.team-name { font-weight: 700; line-height: 1.15; }
.team-sub { color: var(--text-soft); font-size: 0.78rem; line-height: 1.2; }

/* -----------------------------------------------------------------
   Teams page — conference + division grid
   Goals: equal-height cards within a row, balanced columns based on
   the number of child divisions, and a compact "groups grid" mode
   for leagues like the World Cup that have many leaf groups.
   ----------------------------------------------------------------- */
.team-grid {
    display: grid;
    gap: 1rem;
    align-items: stretch;
    grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr));
}
.team-grid[data-cols="2"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.team-grid[data-cols="3"] { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.team-grid[data-cols="4"] { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.team-grid[data-cols="5"] { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.team-grid[data-cols="6"] { grid-template-columns: repeat(6, minmax(0, 1fr)); }
@media (max-width: 1280px) {
    .team-grid[data-cols="5"],
    .team-grid[data-cols="6"] { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .team-grid[data-cols="4"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 880px) {
    .team-grid,
    .team-grid[data-cols] { grid-template-columns: 1fr; }
}

.team-card {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.85rem 0.95rem 0.5rem;
    min-width: 0;
}
.team-card .team-card-head {
    display: flex; align-items: center; justify-content: space-between;
    gap: 0.5rem; margin-bottom: 0.35rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.4rem;
    min-width: 0;
}
.team-card .team-card-head h3 {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.team-card .team-card-head .team-card-meta {
    font-size: 0.72rem;
    color: var(--text-soft);
    white-space: nowrap;
    flex-shrink: 0;
}
.team-card .team-card-actions {
    display: flex;
    gap: 0.25rem;
    margin-left: 0;
    flex-shrink: 0;
}

.team-list {
    width: 100%;
    max-width: 100%;
    border-collapse: collapse;
    flex: 1;
    table-layout: fixed;
}
.team-list td {
    padding: 0.4rem 0.45rem;
    vertical-align: middle;
    border-bottom: 1px solid var(--border);
    overflow: hidden;
    box-sizing: border-box;
}
.team-list tr:last-child td { border-bottom: none; }
.team-list tr:hover td { background: var(--bg-soft); }
.team-list .team-cell-badge {
    width: 2.25rem; padding-right: 0; padding-left: 0;
    text-align: center;
}
.team-list .team-cell-name {
    line-height: 1.15;
    overflow: hidden;
    min-width: 0;
}
.team-list .team-cell-name .team-name {
    font-size: 0.88rem;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    max-width: 100%;
}
.team-list .team-cell-name .team-sub {
    font-size: 0.72rem;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    max-width: 100%;
}
.team-list .team-cell-actions {
    width: 3.95rem;
    text-align: right;
    white-space: nowrap;
    padding-left: 0;
}
.team-list .team-cell-actions .btn { padding: 0.1rem 0.45rem; font-size: 0.72rem; }
.team-list .team-cell-actions .btn-icon { margin-left: 0.15rem; }

/* Compact icon-only button used in dense rows (team list, etc.).
   Square footprint so two icons fit beside even very long team names. */
.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.55rem;
    height: 1.55rem;
    padding: 0 !important;
    font-size: 0.85rem !important;
    line-height: 1;
    border-radius: 6px;
}
.btn-icon > * { line-height: 1; }

.team-card-empty {
    display: grid; place-items: center;
    flex: 1;
    color: var(--text-soft); font-size: 0.85rem;
    padding: 1rem 0;
    border: 1px dashed var(--border);
    border-radius: 8px;
    margin-top: 0.25rem;
}

/* Conference (top-level division) wrapper */
.team-conference { padding: 1rem 1.1rem; }
.team-conference > .card-head { margin-bottom: 0.65rem; padding-bottom: 0.5rem; border-bottom: 1px solid var(--border); }
.team-conference .team-conference-meta { display: flex; gap: 0.4rem; align-items: center; flex-wrap: wrap; }

/* Empty state */
.empty {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--text-soft);
}
.empty .ico {
    width: 44px; height: 44px; border-radius: 12px;
    background: var(--bg-soft); border: 1px solid var(--border);
    display: inline-grid; place-items: center; margin-bottom: 0.5rem;
}

/* Utilities */
.flex { display: flex; gap: 0.5rem; align-items: center; }
.flex.col { flex-direction: column; align-items: stretch; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.text-center { text-align: center; }
.no-underline { text-decoration: none; }
.hidden { display: none !important; }

/* Operator sign-in */
.auth-firebase { display: block; }
.btn-google {
    background: #fff;
    color: #1f2937;
    border: 1px solid var(--border, #e2e8f0);
    font-weight: 600;
}
.btn-google:hover { background: var(--bg-soft, #f8fafc); filter: none; }
.auth-divider {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 0;
}
.auth-divider::before,
.auth-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--border);
}
.auth-divider span { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; }

/* Focus */
:focus-visible { outline: 0; box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.40); border-radius: 0.4rem; }

/* Flash messages — appended to top of pages via ?flash=success|error&msg=... */
.flash {
    border-radius: var(--radius-sm);
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    background: var(--bg-elev);
    margin: 0 0 1rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.92rem;
}
.flash strong { font-weight: 700; }
.flash-success { background: var(--brand-50); color: var(--brand-700); border-color: var(--brand-100); }
.flash-error   { background: var(--danger-bg); color: var(--danger); border-color: rgba(220,38,38,0.25); }
.flash-warn    { background: #fff7ed; color: #92400e; border-color: #fed7aa; }
@media (prefers-color-scheme: dark) {
    .flash-success { color: var(--brand-300); background: rgba(16,185,129,0.10); border-color: rgba(16,185,129,0.30); }
    .flash-warn    { background: rgba(217,119,6,0.10); color: #fcd34d; border-color: rgba(217,119,6,0.30); }
}

/* Soft-deleted row treatment */
.row-deleted td:not(.row-actions) { color: var(--text-soft); text-decoration: line-through; }
.row-deleted .team-badge { opacity: 0.5; }
.deleted-pill {
    display: inline-block; font-size: 0.7rem; padding: 0.1rem 0.45rem; border-radius: 999px;
    background: var(--danger-bg); color: var(--danger); border: 1px solid rgba(220,38,38,0.25);
    margin-left: 0.4rem; vertical-align: middle;
}

/* Danger-strong button for hard delete */
.btn-danger-strong { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger-strong:hover { background: #b91c1c; border-color: #b91c1c; color: #fff; filter: brightness(1.05); }

/* Compact row-action button. Buttons wrap on narrow viewports instead of
   pushing the table column past its parent card border. */
.row-actions {
    text-align: right;
    white-space: normal;
    line-height: 1.9;
}
.row-actions form { display: inline-block; }
.row-actions .btn {
    margin-left: 0.25rem;
    margin-bottom: 0.15rem;
    vertical-align: middle;
}
.card { overflow-wrap: anywhere; }
.card > .table { table-layout: auto; }

/* Venue link in schedule + jump-to-row highlight on the Venues page */
.venue-link { color: inherit; text-decoration: none; border-bottom: 1px dashed var(--border); }
.venue-link:hover { color: var(--brand); border-bottom-color: var(--brand); }

/* Schedule page: compact game cards + kickoff tz */
.schedule-toolbar .tz-control {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.85rem;
}
.schedule-toolbar .tz-control .input-sm,
.schedule-toolbar #kickoff-tz {
    min-width: 11rem;
    padding: 0.3rem 0.55rem;
    font-size: 0.85rem;
}
.schedule-section {
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1rem 1.15rem 1.2rem;
    box-shadow: var(--shadow-sm);
}
.schedule-section > .card-head { margin-bottom: 0.9rem; }
.game-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(15.5rem, 1fr));
    gap: 0.75rem;
    width: 100%;
}
.game-card {
    --game-accent: var(--border-strong);
    --game-wash: transparent;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    padding: 0.8rem 0.9rem 0.8rem 1rem;
    border: 1px solid color-mix(in srgb, var(--game-accent) 28%, var(--border));
    border-radius: var(--radius);
    background:
        linear-gradient(180deg, var(--game-wash), transparent 72%),
        var(--bg-elev);
    box-shadow: var(--shadow-sm);
    min-width: 0;
    position: relative;
    overflow: hidden;
}
.game-card::before {
    content: "";
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 4px;
    background: var(--game-accent);
}
.game-card--tone-emerald { --game-accent: #059669; --game-wash: color-mix(in srgb, #10b981 14%, transparent); }
.game-card--tone-sky     { --game-accent: #0284c7; --game-wash: color-mix(in srgb, #0ea5e9 14%, transparent); }
.game-card--tone-amber   { --game-accent: #d97706; --game-wash: color-mix(in srgb, #f59e0b 14%, transparent); }
.game-card--tone-rose    { --game-accent: #e11d48; --game-wash: color-mix(in srgb, #f43f5e 12%, transparent); }
.game-card--tone-violet  { --game-accent: #7c3aed; --game-wash: color-mix(in srgb, #8b5cf6 14%, transparent); }
.game-card--tone-slate   { --game-accent: #475569; --game-wash: color-mix(in srgb, #64748b 12%, transparent); }
.game-card--live {
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--warn) 35%, transparent), var(--shadow-sm);
}
.game-card--completed {
    opacity: 0.92;
}
.game-card--completed .game-card__score { color: var(--brand-700); }
@media (prefers-color-scheme: dark) {
    .game-card--tone-emerald { --game-wash: color-mix(in srgb, #10b981 18%, transparent); }
    .game-card--tone-sky     { --game-wash: color-mix(in srgb, #0ea5e9 18%, transparent); }
    .game-card--tone-amber   { --game-wash: color-mix(in srgb, #f59e0b 16%, transparent); }
    .game-card--tone-rose    { --game-wash: color-mix(in srgb, #f43f5e 16%, transparent); }
    .game-card--tone-violet  { --game-wash: color-mix(in srgb, #8b5cf6 18%, transparent); }
    .game-card--tone-slate   { --game-wash: color-mix(in srgb, #64748b 14%, transparent); }
    .game-card--completed .game-card__score { color: var(--brand-300); }
}
.game-card__top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.5rem;
}
.game-card__meta {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-width: 0;
}
.game-card__code {
    font-size: 0.72rem;
    width: fit-content;
}
.game-card__kickoff {
    font-size: 0.82rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-variant-numeric: tabular-nums;
}
.game-card__score-actions {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    flex-shrink: 0;
}
.game-card__score {
    font-size: 0.95rem;
    font-variant-numeric: tabular-nums;
    margin-right: 0.15rem;
}
.game-card__matchup {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 0.4rem;
    align-items: start;
}
.game-card__side {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-width: 0;
}
.game-card__side:last-child { align-items: flex-end; text-align: right; }
.game-card__side:last-child .schedule-team { flex-direction: row-reverse; }
.game-card__role { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.04em; }
.game-card__vs {
    align-self: center;
    font-size: 0.72rem;
    color: var(--text-soft);
    font-weight: 600;
    padding-top: 0.35rem;
}
.schedule-team {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    max-width: 100%;
}
.schedule-team__name {
    font-size: 0.86rem;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.game-card__footer {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 0.5rem;
    padding-top: 0.55rem;
    border-top: 1px solid var(--border);
}
.game-card__venue { min-width: 0; flex: 1; font-size: 0.8rem; }
.game-card__venue .schedule-venue__city { font-size: 0.78em; margin-top: 0.1rem; }
.game-card__status { flex-shrink: 0; }
.kickoff-cell { font-variant-numeric: tabular-nums; }

.schedule-week + .schedule-week { margin-top: 1.15rem; }
.schedule-week__divider {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 0 0 0.75rem;
}
.schedule-week__divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, var(--border-strong), transparent);
}
.schedule-week__label {
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text);
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 0.25rem 0.7rem;
}
.schedule-week__count { font-size: 0.78rem; white-space: nowrap; }
.map-link {
    display: inline-block; margin-left: 0.4rem; font-size: 0.78rem; line-height: 1;
    padding: 0.1rem 0.4rem; border-radius: 999px; text-decoration: none;
    color: var(--brand); border: 1px solid var(--border); background: var(--bg-soft, transparent);
    vertical-align: middle; white-space: nowrap;
}
.map-link:hover { color: #fff; background: var(--brand); border-color: var(--brand); }
.venue-row { scroll-margin-top: 5rem; transition: background-color 0.4s ease; }
.venue-row:target { background: var(--brand-soft, #d1fae5); animation: venue-flash 1.6s ease-out 1; }
@keyframes venue-flash {
    0%   { background: rgba(16,185,129,0.45); }
    60%  { background: rgba(16,185,129,0.20); }
    100% { background: transparent; }
}

/* Modal dialog (vanilla, no JS framework) */
[hidden] { display: none !important; }
.modal-backdrop {
    position: fixed; inset: 0;
    background: rgba(15, 23, 42, 0.55);
    display: grid; place-items: center;
    z-index: 90;
    padding: 1rem;
    overflow-y: auto;
}
.modal-card {
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    width: min(36rem, 100%);
    max-height: calc(100vh - 2rem);
    overflow-y: auto;
    display: flex; flex-direction: column;
}
.modal-card.sm { width: min(28rem, 100%); }
.modal-card.lg { width: min(48rem, 100%); }
.modal-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
}
.modal-head h3 { margin: 0; font-size: 1.05rem; }
.modal-close {
    background: transparent; border: 0; color: var(--text-soft);
    font-size: 1.25rem; cursor: pointer; padding: 0.25rem 0.5rem; border-radius: 0.4rem;
}
.modal-close:hover { background: var(--bg-soft); color: var(--text); }
.modal-body { padding: 1rem 1.25rem; }
.modal-foot {
    padding: 0.85rem 1.25rem;
    border-top: 1px solid var(--border);
    display: flex; gap: 0.5rem; justify-content: flex-end;
    background: var(--bg-soft);
}
.modal-warning {
    background: #fff7ed; color: #92400e; border: 1px solid #fed7aa;
    border-radius: var(--radius-sm); padding: 0.7rem 0.85rem; margin: 0 0 0.85rem;
    font-size: 0.88rem;
}
.modal-danger {
    background: var(--danger-bg); color: var(--danger); border: 1px solid rgba(220,38,38,0.25);
    border-radius: var(--radius-sm); padding: 0.7rem 0.85rem; margin: 0 0 0.85rem;
    font-size: 0.88rem;
}

/* Catalog: sport “extra match scoring” schema editor (visible, not a generic footer field) */
.score-ext-block {
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    background: var(--bg-soft);
    padding: 0.9rem 1rem 1rem;
    margin-top: 0.35rem;
}
.score-ext-heading {
    margin: 0 0 0.35rem;
    font-size: 1.02rem;
    font-weight: 600;
    color: var(--text);
}
.score-ext-lead { margin: 0 0 0.6rem; font-size: 0.88rem; line-height: 1.5; }
.score-ext-example-title {
    margin: 0.65rem 0 0.35rem;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-muted);
}
.score-ext-block .field { margin-top: 0.75rem; }
.score-ext-pre {
    margin: 0 0 0.25rem;
    padding: 0.65rem 0.75rem;
    font-family: var(--font-mono), ui-monospace, monospace;
    font-size: 0.8rem;
    line-height: 1.45;
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow-x: auto;
    white-space: pre;
    color: var(--text);
}

/* ---- Schedule: Set / Edit score — extra detail panel ---- */
.field.score-modal-extra { margin-bottom: 0; }
.score-modal-matchup {
    text-align: center;
    font-size: 0.95rem;
    padding: 0.5rem 0.75rem;
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}
.score-modal-vs { color: var(--text-soft); font-weight: 500; margin: 0 0.35rem; }
.score-modal-team--home { color: var(--text); }
.score-modal-team--away { color: var(--text); }

.score-detail-card {
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    background: var(--bg-soft);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}
.score-detail-card__header {
    padding: 0.85rem 1rem 0.65rem;
    border-bottom: 1px solid var(--border);
    background: var(--bg-elev);
}
.score-detail-card__title {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text);
    text-align: left;
}
.score-detail-card__hint {
    margin: 0.4rem 0 0;
    font-size: 0.88rem;
    line-height: 1.45;
    color: var(--text-muted);
    text-align: left;
}
.score-detail-card__viewbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem 1rem;
    padding: 0.55rem 1rem;
    background: var(--bg-elev);
    border-bottom: 1px solid var(--border);
}
.score-detail-card__view-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.score-detail-segmented {
    display: inline-flex;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--bg);
    box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.04);
}
.score-detail-segmented .score-detail-seg {
    border: 0;
    border-radius: 0;
    box-shadow: none;
    font-size: 0.8rem;
    font-weight: 500;
    padding: 0.4rem 0.85rem;
    min-height: 2.1rem;
    color: var(--text-muted);
    background: transparent;
}
.score-detail-segmented .score-detail-seg + .score-detail-seg {
    border-left: 1px solid var(--border);
}
.score-detail-segmented .score-detail-seg:hover {
    color: var(--text);
    background: var(--bg-soft);
}
.score-detail-segmented .score-detail-seg.btn-primary {
    color: var(--text);
    background: var(--bg-elev);
    box-shadow: 0 1px 0 rgba(15, 23, 42, 0.06);
}
@media (prefers-color-scheme: dark) {
    .score-detail-segmented { box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.2); }
}

.score-detail-card__body {
    padding: 0;
    background: var(--bg-elev);
}
.score-detail-panel-blk { margin: 0; }

/* Schema-driven extra fields: list of rows */
.ext-score-fields {
    display: flex;
    flex-direction: column;
    gap: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    margin: 0.75rem 1rem 1rem;
    background: var(--bg-elev);
}
.ext-score-row {
    display: block;
    margin: 0;
    padding: 0;
    border-bottom: 1px solid var(--border);
    text-align: left;
}
.ext-score-row:last-child {
    border-bottom: 0;
}
.ext-score-row--toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.7rem 0.85rem;
    min-height: 2.75rem;
    background: var(--bg-elev);
}
.ext-score-toggle-label {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text);
    line-height: 1.35;
    margin: 0;
    flex: 1;
    text-align: left;
}
.ext-score-toggle-wrap {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: flex-end;
}
input.ext-score-checkbox {
    width: 1.15rem;
    height: 1.15rem;
    margin: 0;
    cursor: pointer;
    accent-color: var(--brand-600);
}
.ext-score-row--input {
    padding: 0.7rem 0.85rem;
    background: var(--bg-elev);
}
.ext-score-input-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    margin: 0 0 0.4rem;
    text-align: left;
}
.ext-score-row--input .input {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

/* Key/value (no sport schema) */
.score-detail-kv {
    padding: 0.75rem 1rem 0.5rem;
}
.score-detail-nested-hint {
    margin: 0.75rem 1rem 1rem;
    font-size: 0.88rem;
    line-height: 1.45;
    text-align: left;
}
.kv-pair--row {
    align-items: flex-end;
    gap: 0.65rem;
    margin-bottom: 0.5rem;
    padding: 0.5rem 0.65rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-elev);
}
.kv-pair--row .kv-pair__cell {
    flex: 1;
    min-width: 0;
    margin-bottom: 0;
}
.kv-pair--row .kv-pair__cell .field { margin-bottom: 0; }
.kv-pair--row .kv-pair__cell > label { margin-bottom: 0.3rem; }
.kv-pair__del {
    flex: 0 0 auto;
    padding-bottom: 0.15rem;
    align-self: flex-end;
}
.score-detail-kv__foot {
    margin-top: 0.5rem;
    margin-bottom: 0.25rem;
}
.score-detail-kv__hint {
    font-size: 0.8rem;
    line-height: 1.5;
    margin: 0.5rem 0 0.25rem;
    text-align: left;
}

/* Raw JSON panel */
.score-detail-raw {
    padding: 0.75rem 1rem 1rem;
    border-top: 1px solid var(--border);
    margin-top: 0;
    background: var(--bg-elev);
}
[data-panel="raw"][hidden] { display: none !important; }
.score-detail-raw__label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    margin: 0 0 0.4rem;
    text-align: left;
}
.score-detail-raw .js-score-raw {
    width: 100%;
    min-height: 7rem;
    font-family: var(--font-mono), ui-monospace, monospace;
    font-size: 0.85rem;
    line-height: 1.45;
    box-sizing: border-box;
    resize: vertical;
}
.modal-warning ul, .modal-danger ul { margin: 0.4rem 0 0; padding-left: 1.1rem; }
@media (prefers-color-scheme: dark) {
    .modal-warning { background: rgba(217,119,6,0.10); color: #fcd34d; border-color: rgba(217,119,6,0.30); }
}

/* Compact, two-column inline field rows for modals */
.field-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); gap: 0.85rem; }
.field-row { display: flex; gap: 0.75rem; align-items: end; flex-wrap: wrap; }
.field-row > .field { flex: 1 1 11rem; min-width: 0; }

/* Color picker pair (used in team modal) */
.color-pair { display: flex; gap: 0.5rem; align-items: center; }
.color-pair input[type=color] {
    width: 2.5rem; height: 2.25rem; padding: 0; border: 1px solid var(--border-strong);
    border-radius: 0.4rem; background: transparent; cursor: pointer;
}
.color-pair input[type=text] { font-family: var(--font-mono); font-size: 0.85rem; }

/* ============================================================
   Brand & sport / league / mode iconography
   ============================================================
   Replaces the gradient SP square with the Sporty Pants splash.
   .brand-mark.image keeps the same footprint but renders the PNG.
   .sport-icon / .league-icon / .mode-icon are reusable rounded
   square thumbnails sized for inline lists, choice rows, and
   marketing hero callouts.
*/
.brand-logo {
    display: inline-block;
    width: 36px;
    height: 36px;
    border-radius: 9px;
    object-fit: contain;
    background: transparent;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.18);
}
.brand-logo.sm { width: 28px; height: 28px; border-radius: 7px; box-shadow: 0 3px 10px rgba(15, 23, 42, 0.16); }
.brand-logo.lg { width: 64px; height: 64px; border-radius: 14px; box-shadow: 0 8px 22px rgba(15, 23, 42, 0.20); }
@media (prefers-color-scheme: dark) {
    .brand-logo { box-shadow: 0 4px 14px rgba(0, 0, 0, 0.55); }
}

.sport-icon, .league-icon, .mode-icon {
    display: inline-block;
    width: 28px;
    height: 28px;
    border-radius: 7px;
    object-fit: contain;
    flex-shrink: 0;
    background: transparent;
}
.sport-icon.sm, .league-icon.sm, .mode-icon.sm { width: 22px; height: 22px; border-radius: 6px; }
.sport-icon.md, .league-icon.md, .mode-icon.md { width: 40px; height: 40px; border-radius: 9px; }
.sport-icon.lg, .league-icon.lg, .mode-icon.lg { width: 64px; height: 64px; border-radius: 12px; }
.sport-icon.xl, .league-icon.xl, .mode-icon.xl { width: 96px; height: 96px; border-radius: 18px; box-shadow: 0 6px 18px rgba(15, 23, 42, 0.18); }

/* Round-card wrappers when you want a soft tinted background behind
   an icon (looks great in choice lists / mode pickers). */
.icon-tile {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    background: var(--bg-soft);
    border: 1px solid var(--border);
    display: inline-grid;
    place-items: center;
    flex-shrink: 0;
}
.icon-tile img { width: 44px; height: 44px; object-fit: contain; }
.icon-tile.lg { width: 84px; height: 84px; border-radius: 18px; }
.icon-tile.lg img { width: 68px; height: 68px; }

/* Choice-row variant for the create-pool wizard sport / mode lists. */
.choice .choice-icon {
    margin-right: 0.65rem;
}

/* Hero illustration (landing page). The splash already has its own
   shadow baked into the artwork, so we don't add another one. */
.hero-illustration {
    width: clamp(180px, 22vw, 280px);
    height: auto;
    display: block;
    margin: 0 auto 1rem;
    filter: drop-shadow(0 18px 40px rgba(15, 23, 42, 0.25));
}
@media (prefers-color-scheme: dark) {
    .hero-illustration { filter: drop-shadow(0 18px 40px rgba(0, 0, 0, 0.6)); }
}

/* Subtle hover on icon list rows (catalog, teams page header). */
.with-icon { display: inline-flex; align-items: center; gap: 0.55rem; }
.with-icon img { vertical-align: middle; }

/* Game modes admin page */
.mode-grid {
    /* min() so a 22rem track never overflows a narrower phone */
    grid-template-columns: repeat(auto-fit, minmax(min(22rem, 100%), 1fr));
    gap: 1.25rem;
}
.mode-card {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}
.mode-card-head {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    min-width: 0;
}
.mode-card-icon { flex-shrink: 0; }
.mode-card-title { flex: 1 1 auto; min-width: 0; }
.mode-card-title h2 {
    font-size: 1.15rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.mode-card-status { flex-shrink: 0; }
.mode-card-desc { margin: 0; }
.mode-card-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.65rem 0.5rem;
}
.mode-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.1rem;
}
.mode-stat-num {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--text);
    line-height: 1;
}
.mode-stat-label {
    font-size: 0.7rem;
    color: var(--text-soft);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.mode-switch {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-soft);
}
.mode-switch-copy {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
}
.mode-switch-copy .soft { font-size: 0.8rem; }
.mode-rule-help { font-size: 0.8rem; }
.mode-rule-form {
    display: flex;
    align-items: flex-end;
    gap: 0.6rem;
    flex-wrap: wrap;
    border-top: 1px solid var(--border);
}
.mode-rule-form label {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    font-size: 0.8rem;
    min-width: 0;
}
.mode-rule-form select { max-width: 16rem; }
.mode-section {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-elev);
}
.mode-section > summary {
    cursor: pointer;
    padding: 0.55rem 0.75rem;
    list-style: none;
    border-radius: var(--radius-sm);
    user-select: none;
    color: var(--text);
}
.mode-section > summary::-webkit-details-marker { display: none; }
.mode-section > summary::before {
    content: "▸";
    display: inline-block;
    color: var(--text-soft);
    margin-right: 0.4rem;
    transition: transform 120ms ease;
}
.mode-section[open] > summary::before { transform: rotate(90deg); }
.mode-section > summary:hover { background: var(--bg-soft); }
.mode-section[open] > summary { border-bottom: 1px solid var(--border); }
.mode-section > *:not(summary) {
    padding: 0.65rem 0.85rem;
    margin: 0;
}
.mode-mini-table {
    font-size: 0.85rem;
    margin: 0;
}
.mode-mini-table th,
.mode-mini-table td { padding: 0.45rem 0.5rem; }
.mode-mini-table th { white-space: nowrap; }
.mode-config-json {
    margin: 0;
    font-size: 0.78rem;
    line-height: 1.45;
    max-height: 14rem;
    overflow: auto;
    white-space: pre-wrap;
    word-break: break-all;
}
.mode-config-snippet {
    display: block;
    max-width: min(28rem, 100%);
    font-size: 0.72rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ============================================================
   Small-screen / touch refinements
   ============================================================
   The console is desktop-first, but operators do fix things from
   a phone. Three building blocks are defined here:

     .page-head          — title + toolbar that stacks and gives
                           the toolbar full-width tap targets.
     .table-wrap         — horizontal scroller so a wide table
                           never pushes the page sideways.
     .table-stack        — below 680px each <tr> becomes a card;
                           every <td data-label="…"> prints its
                           column header beside the value, the
                           .cell-title cell is the card heading
                           and .row-actions becomes a button bar.

   Modals turn into bottom sheets with a sticky header/footer, and
   text inputs go to 16px so iOS Safari stops zooming on focus. */

/* --- Page header ------------------------------------------------ */
.page-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem 1rem;
}
/* a long unbroken title/email (user detail) must not stretch the page */
.page-head > * { min-width: 0; }
.page-head h1,
.page-head p { overflow-wrap: anywhere; }
.page-head__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

/* --- Wide tables ------------------------------------------------ */
.table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.table-wrap > .table--wide { min-width: 62rem; }
.table-wrap > .table--wide-sm { min-width: 44rem; }

/* --- Inline search form ----------------------------------------- */
.search-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}
.search-row .input { flex: 1 1 12rem; width: auto; }

/* --- Selected row (catalog: current sport) ---------------------- */
.table tbody tr.is-current > td { background: var(--brand-50); }
.table tbody tr.is-current > td:first-child { box-shadow: inset 3px 0 0 var(--brand-500); }
@media (prefers-color-scheme: dark) {
    .table tbody tr.is-current > td { background: rgba(16, 185, 129, 0.10); }
}

/* Inside a scroller, headers and codes stay on one line and the
   wrapper scrolls — tables without a wrapper must still wrap. */
.table-wrap > .table th { white-space: nowrap; }
.table-wrap > .table td > code { white-space: nowrap; }

@media (max-width: 900px) {
    /* Two-pane page bodies collapse to a single column */
    .split-grid { grid-template-columns: minmax(0, 1fr) !important; }
}

@media (max-width: 680px) {
    /* Give content back the side padding the phone bezel eats */
    .container, .container-wide { padding: 0 0.85rem; }
    .card { padding: 0.9rem 0.95rem; }
    .card-head { flex-wrap: wrap; gap: 0.35rem 0.75rem; }
    h1 { font-size: 1.5rem; }
    h2 { font-size: 1.2rem; }

    .page-head { flex-direction: column; align-items: stretch; }
    .page-head__actions { width: 100%; }
    .page-head__actions > .btn,
    .page-head__actions > form { flex: 1 1 9rem; }
    .page-head__actions .btn { min-height: 2.4rem; }

    /* Stacked table rows --------------------------------------- */
    .table-wrap { overflow-x: visible; }
    .table-wrap > .table-stack:is(.table--wide, .table--wide-sm) { min-width: 0; }
    .search-row .btn { flex: 1 1 100%; }
    .table-stack thead {
        position: absolute;
        width: 1px; height: 1px;
        padding: 0; margin: -1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
        white-space: nowrap;
        border: 0;
    }
    .table-stack,
    .table-stack tbody,
    .table-stack td { display: block; width: 100%; }
    /* flex column so .cell-title / .row-actions can be re-ordered
       into card-heading / footer position regardless of column order */
    .table-stack tr {
        display: flex;
        flex-direction: column;
        width: 100%;
        border: 1px solid var(--border);
        border-radius: var(--radius-sm);
        background: var(--bg-elev);
        padding: 0.7rem 0.8rem;
    }
    .table-stack tr + tr { margin-top: 0.6rem; }
    .table-stack tbody tr:hover { background: var(--bg-elev); }
    .table-stack td {
        border-bottom: 0;
        padding: 0.15rem 0;
        text-align: left;
    }
    .table-stack td[data-label] {
        display: flex;
        align-items: baseline;
        justify-content: space-between;
        gap: 0.75rem;
        text-align: right;
    }
    .table-stack td[data-label]::before {
        content: attr(data-label);
        flex: 0 0 auto;
        color: var(--text-soft);
        font-size: 0.7rem;
        font-weight: 600;
        letter-spacing: 0.06em;
        text-transform: uppercase;
        text-align: left;
        text-decoration: none;
    }
    .table-stack td[data-label] > * { min-width: 0; }
    .table-wrap > .table-stack td > code { white-space: normal; overflow-wrap: anywhere; }
    .table-stack td:empty { display: none; }
    .table-stack td.cell-title {
        order: -1;
        font-size: 1rem;
        padding-bottom: 0.3rem;
    }
    .table-stack td.row-actions {
        order: 1;
        display: flex;
        flex-wrap: wrap;
        gap: 0.4rem;
        margin-top: 0.55rem;
        padding-top: 0.55rem;
        border-top: 1px solid var(--border);
        line-height: 1.2;
    }
    .table-stack td.row-actions form { display: flex; flex: 1 1 8rem; }
    .table-stack td.row-actions .btn {
        flex: 1 1 7rem;
        margin: 0;
        min-height: 2.35rem;
    }
    /* text-decoration propagates into ::before, so strike the value
       text itself rather than the whole stacked cell */
    .table-stack tr.row-deleted { opacity: 0.8; }
    .table-stack tr.row-deleted td:not(.row-actions) { text-decoration: none; }
    .table-stack tr.row-deleted td.cell-title strong,
    .table-stack tr.row-deleted td.cell-title a { text-decoration: line-through; }

    /* Selected row reads as a selected card, not a tinted cell */
    .table-stack tbody tr.is-current {
        border-color: var(--brand-500);
        background: var(--brand-50);
    }
    .table-stack tbody tr.is-current > td {
        background: transparent;
        box-shadow: none;
    }

    /* Modals become bottom sheets ------------------------------ */
    .modal-backdrop {
        padding: 0;
        display: flex;
        align-items: flex-end;
        justify-content: stretch;
    }
    .modal-card,
    .modal-card.sm,
    .modal-card.lg {
        width: 100%;
        max-height: 92dvh;
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
        border-left: 0;
        border-right: 0;
        border-bottom: 0;
    }
    .modal-head {
        position: sticky;
        top: 0;
        z-index: 2;
        background: var(--bg-elev);
        padding: 0.85rem 1rem;
    }
    .modal-head h3 { font-size: 1rem; min-width: 0; overflow-wrap: anywhere; }
    .modal-close { font-size: 1.5rem; padding: 0.15rem 0.6rem; }
    .modal-body { padding: 0.9rem 1rem; }
    .modal-foot {
        position: sticky;
        bottom: 0;
        z-index: 2;
        flex-direction: column-reverse;
        padding: 0.75rem 1rem calc(0.75rem + env(safe-area-inset-bottom));
    }
    .modal-foot .btn { width: 100%; min-height: 2.6rem; }

    /* Forms ----------------------------------------------------- */
    .field-row { gap: 0.5rem 0.75rem; }
    .kv-pair--row > .kv-pair__cell { flex: 1 1 8rem; }
    /* 16px keeps iOS Safari from zooming the page on focus */
    .input, .select, .textarea { font-size: 16px; min-height: 2.6rem; }
    .btn { min-height: 2.4rem; }
    .btn-sm { min-height: 2.2rem; padding: 0.4rem 0.7rem; }
    .btn-icon { width: 2.2rem; height: 2.2rem; min-height: 0; }

    /* Score-schema editor: one field definition per card -------- */
    .score-ext-block { padding: 0.75rem 0.8rem 0.85rem; }
    .score-schema-field-table tr { padding: 0.6rem 0.7rem; }
    .score-schema-field-table td { padding: 0.2rem 0; }
    .score-schema-field-table td[data-label] {
        display: block;
        text-align: left;
    }
    .score-schema-field-table td[data-label]::before {
        display: block;
        margin-bottom: 0.2rem;
    }
    .score-schema-field-table td[data-sf-cell="del"] {
        margin-top: 0.4rem;
        text-align: right;
    }
    .score-schema-field-table td[data-sf-cell="del"] .btn { width: 100%; }
    .score-ext-pre { font-size: 0.72rem; }

    /* Game modes ------------------------------------------------ */
    .mode-grid { gap: 0.85rem; }
    .mode-card-head { gap: 0.6rem; }
    .mode-card-icon .mode-icon.lg { width: 44px; height: 44px; border-radius: 10px; }
    /* long mode names wrap instead of being ellipsised away */
    .mode-card-title h2 {
        font-size: 1.05rem;
        white-space: normal;
        overflow: visible;
        text-overflow: clip;
    }
    .mode-card-stats { padding: 0.6rem 0.4rem; }
    .mode-stat-num { font-size: 1.1rem; }
    .mode-stat-label { font-size: 0.63rem; letter-spacing: 0.03em; }
    .mode-section > summary { padding: 0.7rem 0.75rem; min-height: 2.75rem; }
    .mode-section > *:not(summary) { padding: 0.6rem 0.7rem; }
    /* the raw layer JSON gets its own full-width line under the label */
    .mode-mini-table td.mode-config-cell { display: block; text-align: left; }
    .mode-mini-table td.mode-config-cell::before {
        display: block;
        margin-bottom: 0.2rem;
    }
    .mode-config-snippet { max-width: 100%; }
    .mode-config-json { font-size: 0.72rem; max-height: 11rem; }
}

@media (max-width: 680px) and (prefers-color-scheme: dark) {
    .table-stack tbody tr.is-current {
        background: rgba(16, 185, 129, 0.10);
        border-color: rgba(16, 185, 129, 0.45);
    }
}