*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    background: var(--c-bg);
    -webkit-text-size-adjust: 100%;
    touch-action: manipulation;
}

html.has-dialog {
    overflow: hidden;
}

body {
    min-width: 20rem;
    min-height: 100dvh;
    margin: 0;
    background: var(--c-bg);
    color: var(--c-text);
    font-family: var(--font-body);
    font-size: 1rem;
    line-height: 1.45;
}

h1, h2, h3, h4, p, ol, ul, figure {
    margin: 0;
}

ol, ul {
    padding: 0;
    list-style: none;
}

a {
    color: inherit;
}

button, select {
    font: inherit;
    color: inherit;
}

button {
    cursor: pointer;
}

:focus-visible {
    outline: 3px solid var(--c-accent);
    outline-offset: 2px;
}

/* FocusOnNavigate puts focus on the page heading for screen readers; that is not a user action, so no ring. */
[tabindex="-1"]:focus {
    outline: none;
}

.visually-hidden {
    position: absolute !important;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

.muted {
    color: var(--c-text-muted);
    font-size: .9rem;
}

/* ---------- Shell ---------- */

.shell {
    display: flex;
    flex-direction: column;
    min-height: 100dvh;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    background: color-mix(in srgb, var(--c-bg) 88%, transparent);
    backdrop-filter: saturate(1.4) blur(10px);
    border-bottom: 1px solid var(--c-border);
    padding-top: env(safe-area-inset-top);
}

.topbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--s-3);
    max-width: var(--content-max);
    margin: 0 auto;
    padding: var(--s-2) var(--s-4);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: var(--s-2);
    font-weight: 750;
    letter-spacing: -.01em;
    text-decoration: none;
    white-space: nowrap;
}

.brand-mark {
    width: auto;
    height: 40px;
}

.tabs {
    display: flex;
    gap: var(--s-1);
    padding: 3px;
    border-radius: var(--radius-pill);
    background: var(--c-surface-hi);
}

.tab {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    padding: 0 var(--s-4);
    border-radius: var(--radius-pill);
    color: var(--c-text-muted);
    font-size: .92rem;
    font-weight: 600;
    text-decoration: none;
    transition: background var(--dur-fast), color var(--dur-fast);
}

.tab.is-active {
    background: var(--c-surface);
    color: var(--c-text);
    box-shadow: var(--shadow-card);
}

.content {
    flex: 1;
    width: 100%;
    max-width: var(--content-max);
    margin: 0 auto;
    padding: var(--s-4) var(--s-4) var(--s-8);
}

.footer {
    padding: var(--s-4) var(--s-4) calc(var(--s-4) + env(safe-area-inset-bottom));
    color: var(--c-text-muted);
    font-size: .8rem;
    text-align: center;
}

.app-loading {
    display: grid;
    place-content: center;
    justify-items: center;
    gap: var(--s-3);
    min-height: 100dvh;
    color: var(--c-text-muted);
}

/* ---------- Round navigation ---------- */

.page {
    min-height: 60vh;
}

.round-nav {
    display: grid;
    grid-template-columns: var(--touch-min) 1fr var(--touch-min);
    align-items: center;
    gap: var(--s-2);
    margin-bottom: var(--s-4);
}

.round-nav.is-loading {
    grid-template-columns: 1fr;
    justify-items: center;
    min-height: var(--touch-min);
}

.round-arrow {
    display: grid;
    place-items: center;
    width: var(--touch-min);
    height: var(--touch-min);
    border: 1px solid var(--c-border);
    border-radius: 50%;
    background: var(--c-surface);
    box-shadow: var(--shadow-card);
}

.round-arrow svg {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.4;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.round-arrow:disabled {
    opacity: .35;
    cursor: default;
}

.round-select {
    position: relative;
    display: grid;
    place-items: center;
    min-height: var(--touch-min);
    padding: 0 var(--s-3);
    border-radius: var(--radius-md);
    text-align: center;
}

.round-select:hover {
    background: var(--c-surface-hi);
}

.round-select:has(:focus-visible) {
    outline: 3px solid var(--c-accent);
    outline-offset: 2px;
}

.round-label {
    pointer-events: none;
    font-size: 1.05rem;
}

.round-label::after {
    content: "";
    display: inline-block;
    width: .45em;
    height: .45em;
    margin-left: .5em;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: translateY(-.2em) rotate(45deg);
    opacity: .6;
}

.round-dates {
    color: var(--c-text-muted);
}

/* The native select covers the label: one tap opens the platform picker. */
.round-select select {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

/* ---------- Match list ---------- */

.matches {
    display: grid;
    gap: var(--s-2);
}

.day-heading {
    margin-top: var(--s-3);
    color: var(--c-text-muted);
    font-size: .8rem;
    font-weight: 650;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.day-heading:first-child {
    margin-top: 0;
}

.match-item {
    display: grid;
}

/* Row 1 = home, row 2 = away; scores (or the kick-off time) in a column on the right. */
.match-card {
    display: grid;
    /* Fixed right column: scores and kick-off times share the same width, so the divider lines up on every card. */
    grid-template-columns: minmax(0, 1fr) auto 4.75rem;
    grid-template-areas:
        "home status home-score"
        "away status away-score";
    align-items: center;
    column-gap: var(--s-3);
    row-gap: 0;
    min-height: 72px;
    padding: 10px var(--s-3) 10px var(--s-4);
    border: 1px solid var(--c-border);
    border-radius: var(--radius-md);
    background: var(--c-surface);
    box-shadow: var(--shadow-card);
    color: var(--c-text);
    text-decoration: none;
}

.match-card.is-link {
    transition: transform var(--dur-fast) var(--ease-out), border-color var(--dur-fast);
}

.match-card.is-link:hover {
    border-color: color-mix(in srgb, var(--c-accent) 45%, var(--c-border));
}

.match-card.is-link:active {
    transform: scale(.985);
}

.match-card.is-live {
    border-color: color-mix(in srgb, var(--c-live) 55%, var(--c-border));
}

.match-card.is-postponed {
    opacity: .7;
}

.mc-team {
    display: flex;
    align-items: center;
    gap: var(--s-3);
    min-width: 0;
    padding: 2px 0;
    font-weight: 500;
}

.mc-home { grid-area: home; }
.mc-away { grid-area: away; }

.mc-team .logo {
    width: 28px;
    height: 28px;
}

/* Full club names: they get the whole card width and only wrap as a last resort. */
.mc-name {
    min-width: 0;
    overflow-wrap: anywhere;
    line-height: 1.25;
}

.match-card.is-finished:has(.is-winner) .mc-team:not(.is-winner),
.match-card.is-finished:has(.is-winner) .mc-score:not(.is-winner) {
    color: var(--c-text-muted);
}

.is-winner {
    font-weight: 750;
}

.mc-status {
    grid-area: status;
}

.mc-score,
.mc-side {
    display: grid;
    align-items: center;
    justify-items: center;
    align-self: stretch;
    padding-left: var(--s-3);
    border-left: 1px solid var(--c-grid);
    font-family: var(--font-num);
    font-size: 1.15rem;
    font-variant-numeric: tabular-nums;
    line-height: 1.25;
}

.mc-score-home { grid-area: home-score; }
.mc-score-away { grid-area: away-score; }

.match-card.is-live .mc-score {
    color: var(--c-live);
    font-weight: 750;
}

/* Upcoming: one time centred across both rows. */
.mc-side {
    grid-column: 3;
    grid-row: 1 / 3;
    align-self: stretch;
    justify-items: center;
}

.mc-time {
    font-weight: 700;
}

.score-sep {
    color: var(--c-text-muted);
    font-weight: 400;
}

.logo {
    position: relative;
    display: inline-grid;
    flex: none;
    place-items: center;
    width: 36px;
    height: 36px;
}

.logo img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.logo-initials {
    display: grid;
    place-items: center;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: var(--c-surface-hi);
    color: var(--c-text-muted);
    font-size: .65rem;
    font-weight: 700;
}

.logo:has(img) .logo-initials {
    visibility: hidden;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: .35em;
    padding: 1px 8px;
    border-radius: var(--radius-pill);
    background: var(--c-surface-hi);
    color: var(--c-text-muted);
    font-size: .68rem;
    font-weight: 750;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.badge-live {
    background: var(--c-live-soft);
    color: var(--c-live);
}

.badge-live::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    animation: pulse 1.4s ease-in-out infinite;
}

@keyframes pulse {
    50% { opacity: .25; }
}

/* ---------- States ---------- */

.state {
    display: grid;
    justify-items: center;
    gap: var(--s-3);
    padding: var(--s-8) var(--s-4);
    color: var(--c-text-muted);
    text-align: center;
}

.state h1 {
    color: var(--c-text);
    font-size: 1.3rem;
}

.state-error p {
    color: var(--c-text);
}

.button {
    display: inline-flex;
    align-items: center;
    min-height: var(--touch-min);
    padding: 0 var(--s-5);
    border: 0;
    border-radius: var(--radius-pill);
    background: var(--c-accent);
    color: var(--c-on-accent);
    font-weight: 650;
    text-decoration: none;
}

.notice {
    margin-bottom: var(--s-3);
    padding: var(--s-2) var(--s-3);
    border-radius: var(--radius-sm);
    background: var(--c-accent-soft);
    font-size: .85rem;
}

.refresh-note {
    margin-top: var(--s-4);
    color: var(--c-text-muted);
    font-size: .8rem;
    text-align: center;
}

.skeleton {
    display: block;
    border-radius: var(--radius-sm);
    background: linear-gradient(90deg, var(--c-skeleton) 25%, var(--c-skeleton-hi) 50%, var(--c-skeleton) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.2s linear infinite;
}

.skeleton-label {
    width: 12rem;
    height: 1.4rem;
}

.skeleton-row {
    grid-template-areas: none;
    grid-template-columns: 1fr;
}

.skeleton-row .skeleton {
    width: 70%;
    height: 1.2rem;
}

.skeleton-standing {
    height: 3rem;
}

@keyframes shimmer {
    to { background-position: -200% 0; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0s !important;
        transition-duration: 0s !important;
    }
}

/* ---------- Match sheet (bottom sheet on mobile, modal on desktop) ---------- */

/* The dialog itself is transparent; the panel inside is a flex column with a fixed head and scrolling body. */
.sheet {
    width: 100%;
    max-width: 100%;
    max-height: 92dvh;
    margin: auto 0 0;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--c-text);
    overflow: visible;
}

.sheet[open] {
    display: flex;
    animation: sheet-up var(--dur-base) var(--ease-out);
}

.sheet::backdrop {
    background: var(--c-backdrop);
}

@keyframes sheet-up {
    from { transform: translateY(40%); opacity: 0; }
}

.sheet-panel {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-height: 92dvh;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    background: var(--c-surface);
    box-shadow: var(--shadow-sheet);
    overflow: hidden;
    will-change: transform;
}

.sheet-head {
    position: relative;
    flex: none;
    display: grid;
    gap: var(--s-3);
    padding: var(--s-3) var(--s-4) var(--s-4);
    border-bottom: 1px solid var(--c-grid);
    /* The head is the drag area of the bottom sheet (js/dialog.js). */
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
}

.sheet.is-dragging .sheet-head {
    cursor: grabbing;
}

.sheet-scroll {
    flex: 1 1 auto;
    display: grid;
    align-content: start;
    gap: var(--s-6);
    min-height: 0;
    padding: var(--s-5) var(--s-4) calc(var(--s-6) + env(safe-area-inset-bottom));
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

.sheet-handle {
    justify-self: center;
    width: 40px;
    height: 5px;
    border-radius: var(--radius-pill);
    background: var(--c-border);
    cursor: grab;
}

.sheet-close {
    position: absolute;
    top: var(--s-2);
    right: var(--s-2);
    z-index: 1;
    display: grid;
    place-items: center;
    width: var(--touch-min);
    height: var(--touch-min);
    border: 0;
    border-radius: 50%;
    background: var(--c-surface-hi);
}

.sheet-close:hover {
    background: var(--c-border);
}

.sheet-close svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.2;
    stroke-linecap: round;
}

.sheet-title {
    padding-right: var(--touch-min);
    font-size: 1.15rem;
}

.sheet-header {
    display: grid;
    gap: var(--s-3);
    text-align: center;
}

.sheet-meta {
    padding: 0 var(--touch-min);
    color: var(--c-text-muted);
    font-size: .85rem;
}

.scoreboard {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: start;
    gap: var(--s-3);
    font-size: 1rem;
    font-weight: 500;
}

.scoreboard-team {
    display: grid;
    justify-items: center;
    gap: var(--s-2);
    min-width: 0;
}

.scoreboard-team .logo {
    width: 56px;
    height: 56px;
}

.scoreboard-name {
    max-width: 100%;
    overflow-wrap: anywhere;
    line-height: 1.25;
}

.scoreboard-team.is-winner .scoreboard-name {
    font-weight: 750;
}

.scoreboard-mid {
    display: grid;
    justify-items: center;
    align-content: center;
    gap: var(--s-1);
    min-height: 56px;
}

.scoreboard-score {
    display: inline-flex;
    gap: .3em;
    font-family: var(--font-num);
    font-size: 2.4rem;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    line-height: 1;
}

.scoreboard-score .is-winner {
    font-weight: 800;
}

.scoreboard-time {
    font-family: var(--font-num);
    font-size: 1.8rem;
    font-weight: 750;
    line-height: 1;
}

.scoreboard-half {
    color: var(--c-text-muted);
    font-size: .85rem;
    font-variant-numeric: tabular-nums;
}

.sheet-live {
    display: inline-flex;
    align-items: center;
    gap: var(--s-1);
}

.sheet-minute {
    color: var(--c-live);
    font-size: .8rem;
    font-weight: 750;
    font-variant-numeric: tabular-nums;
}

.sheet-section {
    display: grid;
    gap: var(--s-3);
}

.sheet-section h3 {
    font-size: .8rem;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: var(--c-text-muted);
}

.scorers {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--s-4);
}

.scorer-team {
    display: flex;
    align-items: center;
    gap: var(--s-2);
    margin-bottom: var(--s-2);
    font-size: .95rem;
}

.scorer-team .logo {
    width: 20px;
    height: 20px;
}

.scorer-list li {
    display: flex;
    justify-content: space-between;
    gap: var(--s-2);
    padding: 3px 0;
    border-bottom: 1px solid var(--c-grid);
    font-size: .9rem;
}

.scorer-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.scorer-goals {
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.sheet-skeleton {
    display: grid;
    gap: var(--s-4);
}

.skeleton-score { height: 6rem; }
.skeleton-block { height: 7rem; }
.skeleton-chart { height: 10rem; }

/* ---------- Score chart ---------- */

.chart {
    display: grid;
    gap: var(--s-2);
}

.chart svg {
    width: 100%;
    height: auto;
    overflow: visible;
}

.chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: var(--s-2) var(--s-4);
    font-size: .9rem;
    font-weight: 650;
}

/* Club colours arrive as --home-line/--away-line plus outline switches per theme (ScoreChart). */
.chart {
    --home-color: var(--home-line, var(--c-home));
    --away-color: var(--away-line, var(--c-away));
    --home-halo: var(--home-halo-light, 0);
    --away-halo: var(--away-halo-light, 0);
}

.legend-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--c-text);
}

.legend-item::before {
    content: "";
    width: 20px;
    height: 6px;
    border-radius: 3px;
    background: var(--legend);
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--c-text) calc(var(--legend-halo) * 100%), transparent);
}

.legend-home { --legend: var(--home-color); --legend-halo: var(--home-halo); }
.legend-away { --legend: var(--away-color); --legend-halo: var(--away-halo); }

.chart-grid {
    stroke: var(--c-grid);
    stroke-width: 1;
}

.chart-axis {
    stroke: var(--c-text-muted);
    stroke-width: 1;
}

.chart-tick {
    fill: var(--c-text-muted);
    font-size: 10px;
    font-variant-numeric: tabular-nums;
}

.chart-half {
    stroke: var(--c-text-muted);
    stroke-width: 1;
    stroke-dasharray: 3 3;
}

.chart-half-label {
    fill: var(--c-text-muted);
    font-size: 9px;
}

.chart-line {
    fill: none;
    stroke-width: 2.4;
    stroke-linejoin: round;
    stroke-linecap: round;
}

.chart-line-home { stroke: var(--home-color); }
.chart-line-away { stroke: var(--away-color); }

.chart-halo {
    fill: none;
    stroke: var(--c-text);
    stroke-width: 4.4;
    stroke-linejoin: round;
    stroke-linecap: round;
}

.chart-halo-home { opacity: var(--home-halo); }
.chart-halo-away { opacity: var(--away-halo); }

@media (prefers-color-scheme: dark) {
    .chart {
        --home-halo: var(--home-halo-dark, 0);
        --away-halo: var(--away-halo-dark, 0);
    }
}

/* ---------- Standings ---------- */

.page-title {
    margin-bottom: var(--s-4);
    font-size: 1.4rem;
    letter-spacing: -.01em;
}

.standings {
    overflow: hidden;
    border: 1px solid var(--c-border);
    border-radius: var(--radius-md);
    background: var(--c-surface);
    box-shadow: var(--shadow-card);
}

.standings.is-loading {
    display: grid;
    gap: var(--s-2);
    padding: var(--s-3);
}

.standings-table {
    width: 100%;
    border-collapse: collapse;
    font-variant-numeric: tabular-nums;
}

.standings-table th,
.standings-table td {
    padding: var(--s-2) var(--s-1);
    border-bottom: 1px solid var(--c-grid);
    text-align: center;
    vertical-align: middle;
}

.standings-table tbody tr:last-child > * {
    border-bottom: 0;
}

.standings-table thead th {
    padding-top: var(--s-3);
    color: var(--c-text-muted);
    font-size: .75rem;
    font-weight: 650;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.standings-table abbr {
    text-decoration: none;
}

.st-pos {
    width: 2.25rem;
    padding-left: var(--s-3) !important;
    color: var(--c-text-muted);
    font-weight: 650;
}

.standings-table .st-team {
    text-align: left;
    font-weight: 400;
}

.st-team-inner {
    display: flex;
    align-items: center;
    gap: var(--s-3);
    min-width: 0;
}

.st-team-inner .logo {
    width: 28px;
    height: 28px;
}

.st-names {
    display: grid;
    min-width: 0;
    line-height: 1.2;
}

.st-name {
    font-weight: 650;
    overflow-wrap: anywhere;
}

.st-sponsor {
    color: var(--c-text-muted);
    font-size: .78rem;
    overflow-wrap: anywhere;
}

.st-num {
    width: 2.5rem;
}

.standings-table td.st-points {
    font-weight: 800;
}

.standings-table tr > :last-child {
    padding-right: var(--s-3);
}

.st-wide {
    display: none;
}

a.st-team-inner {
    text-decoration: none;
}

a.st-team-inner:hover .st-name {
    text-decoration: underline;
}

/* ---------- Teams ---------- */

.team-grid {
    display: grid;
    gap: var(--s-2);
}

.skeleton-team {
    height: 72px;
    border-radius: var(--radius-md);
}

/* Tile with a stripe in the club colour (--club, set per team) on the left. */
.team-tile {
    display: flex;
    align-items: center;
    gap: var(--s-3);
    min-height: 72px;
    padding: var(--s-3) var(--s-4);
    border: 1px solid var(--c-border);
    border-left: 6px solid var(--club, var(--c-border));
    border-radius: var(--radius-md);
    background: var(--c-surface);
    box-shadow: var(--shadow-card);
    text-decoration: none;
    transition: transform var(--dur-fast) var(--ease-out), border-color var(--dur-fast);
}

.team-tile:hover {
    border-top-color: color-mix(in srgb, var(--c-accent) 45%, var(--c-border));
    border-right-color: color-mix(in srgb, var(--c-accent) 45%, var(--c-border));
    border-bottom-color: color-mix(in srgb, var(--c-accent) 45%, var(--c-border));
}

.team-tile:active {
    transform: scale(.985);
}

.team-tile .logo {
    width: 44px;
    height: 44px;
}

.team-tile-names {
    display: grid;
    flex: 1;
    min-width: 0;
    line-height: 1.25;
}

.team-tile-name {
    font-weight: 700;
    overflow-wrap: anywhere;
}

.team-tile-sponsor {
    color: var(--c-text-muted);
    font-size: .8rem;
    overflow-wrap: anywhere;
}

.team-tile-rank {
    display: grid;
    justify-items: end;
    font-variant-numeric: tabular-nums;
    line-height: 1.25;
}

.team-tile-pos {
    font-family: var(--font-num);
    font-size: 1.15rem;
    font-weight: 800;
}

.team-tile-points {
    color: var(--c-text-muted);
    font-size: .8rem;
}

/* ---------- Team page ---------- */

.skeleton-hero {
    height: 9rem;
    margin-bottom: var(--s-4);
    border-radius: var(--radius-lg);
}

/* Header band in the club colour; --on-club is white or near-black, whichever contrasts more. */
.team-hero {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: var(--s-3) var(--s-4);
    margin-bottom: var(--s-4);
    padding: var(--s-5) var(--s-4) var(--s-4);
    border-radius: var(--radius-lg);
    background:
        linear-gradient(135deg, rgb(255 255 255 / .12), transparent 55%),
        var(--club);
    color: var(--on-club);
    box-shadow: var(--shadow-card);
}

/* Logos are made for light backgrounds: put them on a white disc. */
.team-hero-logo {
    display: grid;
    place-items: center;
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 2px 8px rgb(0 0 0 / .18);
}

.team-hero-logo .logo {
    width: 56px;
    height: 56px;
}

.team-hero-names {
    display: grid;
    min-width: 0;
}

.team-hero-name {
    font-size: 1.6rem;
    line-height: 1.1;
    letter-spacing: -.01em;
    overflow-wrap: anywhere;
}

.team-hero-sponsor {
    font-size: .95rem;
    opacity: .85;
    overflow-wrap: anywhere;
}

.team-hero-stats {
    display: grid;
    grid-column: 1 / -1;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--s-2);
    margin: 0;
}

.team-hero-stats > div {
    display: grid;
    justify-items: center;
    padding: var(--s-2);
    border-radius: var(--radius-sm);
    background: color-mix(in srgb, var(--on-club) 12%, transparent);
}

.team-hero-stats dt {
    font-size: .72rem;
    font-weight: 650;
    letter-spacing: .04em;
    text-transform: uppercase;
    opacity: .85;
}

.team-hero-stats dd {
    margin: 0;
    font-family: var(--font-num);
    font-size: 1.35rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}

/* Segmented control (links, so each section has its own address). */
.segmented {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--s-1);
    margin-bottom: var(--s-4);
    padding: 3px;
    border-radius: var(--radius-pill);
    background: var(--c-surface-hi);
}

.segment {
    display: grid;
    place-items: center;
    min-height: 40px;
    border-radius: var(--radius-pill);
    color: var(--c-text-muted);
    font-size: .92rem;
    font-weight: 600;
    text-decoration: none;
    transition: background var(--dur-fast), color var(--dur-fast);
}

.segment.is-active {
    background: var(--c-surface);
    color: var(--c-text);
    box-shadow: var(--shadow-card);
}

.team-section {
    display: grid;
    gap: var(--s-5);
}

.overview-block {
    display: grid;
    gap: var(--s-2);
}

.section-title {
    color: var(--c-text-muted);
    font-size: .8rem;
    font-weight: 650;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.match-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--s-2);
    color: var(--c-text-muted);
    font-size: .85rem;
}

.team-matches .match-item {
    gap: var(--s-1);
}

.result-chip {
    display: inline-grid;
    place-items: center;
    width: 1.6rem;
    height: 1.6rem;
    border-radius: var(--radius-sm);
    background: var(--c-draw);
    color: var(--c-on-result);
    font-size: .8rem;
    font-weight: 800;
    line-height: 1;
}

.match-meta .result-chip {
    width: 1.35rem;
    height: 1.35rem;
    font-size: .72rem;
}

.result-chip.is-win { background: var(--c-win); }
.result-chip.is-loss { background: var(--c-loss); }

.form {
    display: flex;
    gap: var(--s-2);
}

.form .result-chip {
    width: 2.25rem;
    height: 2.25rem;
    font-size: .95rem;
}

.form-legend {
    color: var(--c-text-muted);
    font-size: .78rem;
}

.facts {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--s-2);
}

.facts > li {
    display: grid;
}

.fact {
    display: grid;
    align-content: start;
    gap: 2px;
    padding: var(--s-3);
    border: 1px solid var(--c-border);
    border-radius: var(--radius-md);
    background: var(--c-surface);
    box-shadow: var(--shadow-card);
    color: var(--c-text);
    text-decoration: none;
}

.fact.is-link:hover {
    border-color: color-mix(in srgb, var(--c-accent) 45%, var(--c-border));
}

.fact-label {
    color: var(--c-text-muted);
    font-size: .75rem;
    font-weight: 650;
}

.fact-value {
    font-size: 1.1rem;
    font-weight: 750;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.fact-detail {
    color: var(--c-text-muted);
    font-size: .8rem;
}

.venue {
    font-size: .95rem;
}

.players {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(7.5rem, 1fr));
    gap: var(--s-2);
}

.player {
    position: relative;
    display: grid;
    justify-items: center;
    align-content: start;
    gap: 2px;
    padding: var(--s-3) var(--s-2);
    border: 1px solid var(--c-border);
    border-radius: var(--radius-md);
    background: var(--c-surface);
    box-shadow: var(--shadow-card);
    text-align: center;
}

.player .photo {
    width: 80px;
    height: 80px;
    margin-bottom: var(--s-1);
}

.player-number {
    position: absolute;
    top: var(--s-2);
    left: var(--s-2);
    min-width: 1.6rem;
    padding: 1px 6px;
    border-radius: var(--radius-pill);
    background: var(--c-surface-hi);
    font-family: var(--font-num);
    font-size: .8rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}

.player-name {
    font-size: .88rem;
    font-weight: 600;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.player-goals {
    color: var(--c-text-muted);
    font-size: .75rem;
}

.photo {
    position: relative;
    display: inline-grid;
    flex: none;
    place-items: center;
    overflow: hidden;
    border-radius: 50%;
    background: var(--c-surface-hi);
}

.photo img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top;
}

.photo-initials {
    color: var(--c-text-muted);
    font-size: .85rem;
    font-weight: 700;
}

.staff {
    display: grid;
    gap: var(--s-2);
}

.staff-member {
    display: flex;
    align-items: center;
    gap: var(--s-3);
    padding: var(--s-2) var(--s-3);
    border: 1px solid var(--c-border);
    border-radius: var(--radius-md);
    background: var(--c-surface);
}

.staff-member .photo {
    width: 44px;
    height: 44px;
}

.staff-names {
    display: grid;
    line-height: 1.25;
}

.staff-name {
    font-weight: 600;
}

.staff-role {
    color: var(--c-text-muted);
    font-size: .8rem;
}

/* ---------- Error UI ---------- */

#blazor-error-ui {
    position: fixed;
    inset: auto 0 0;
    z-index: 1000;
    display: none;
    padding: var(--s-3) var(--s-4);
    background: var(--c-live);
    color: #fff;
}

#blazor-error-ui .dismiss {
    float: right;
    border: 0;
    background: none;
    color: inherit;
    font-size: 1.2rem;
}

/* ---------- Small phones ---------- */

@media (max-width: 26rem) {
    .brand span {
        display: none;
    }

    .tab {
        padding: 0 var(--s-3);
    }

    .round-dates {
        display: block;
        font-size: .85rem;
    }

    .round-label::after,
    .round-sep {
        display: none;
    }
}

/* ---------- Larger screens ---------- */

@media (min-width: 40rem) {
    .content {
        padding-top: var(--s-6);
    }

    /* Two columns of cards; day headings span both. */
    .matches {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: var(--s-3);
    }

    .day-heading {
        grid-column: 1 / -1;
    }

    .sheet {
        width: min(34rem, calc(100% - 2rem));
        max-height: 88dvh;
        margin: auto;
    }

    .sheet-panel {
        max-height: 88dvh;
        border-radius: var(--radius-lg);
    }

    .sheet[open] {
        animation-name: sheet-pop;
    }

    .sheet-handle {
        display: none;
    }

    .sheet-head {
        padding: var(--s-6) var(--s-6) var(--s-4);
        touch-action: auto;
        user-select: auto;
        -webkit-user-select: auto;
    }

    .sheet-scroll {
        padding: var(--s-5) var(--s-6) var(--s-6);
    }

    .st-wide {
        display: table-cell;
    }

    .team-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: var(--s-3);
    }

    /* Logo and names left, the three numbers on the right. */
    .team-hero {
        grid-template-columns: auto minmax(0, 1fr) auto;
        padding: var(--s-6);
    }

    .team-hero-stats {
        grid-column: auto;
        grid-template-columns: repeat(3, 5.5rem);
    }

    .team-hero-name {
        font-size: 2rem;
    }

    .facts {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@keyframes sheet-pop {
    from { transform: scale(.96); opacity: 0; }
}
