/* DACH OS Liga (liga.geissgrind.ch) — Components/Layout/LigaLayout.razor and Components/Pages/Liga/*.
   Uses the site's colour tokens from app.css, so light/dark follow the site. */

.lg-shell {
    --lg-wash-w: rgba(250, 236, 170, 0.75);
    --lg-wash-u: rgba(110, 165, 235, 0.38);
    --lg-wash-b: rgba(120, 100, 140, 0.22);
    --lg-wash-r: rgba(225, 95, 70, 0.32);
    --lg-wash-g: rgba(80, 160, 90, 0.32);
    position: relative;
    isolation: isolate;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--bg);
    color: var(--text);
}

/* Five-colour wash: W top left, U top right, B centre bottom, R bottom right, G bottom left. A fixed layer
   (not background-attachment: fixed, which iOS ignores and which makes phones repaint on scroll). */
.lg-shell::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background:
        radial-gradient(circle at 0 0, var(--lg-wash-w), transparent 42%),
        radial-gradient(circle at 100% 0, var(--lg-wash-u), transparent 42%),
        radial-gradient(ellipse at 50% 115%, var(--lg-wash-b), transparent 45%),
        radial-gradient(circle at 100% 100%, var(--lg-wash-r), transparent 42%),
        radial-gradient(circle at 0 100%, var(--lg-wash-g), transparent 42%);
}

:root[data-theme="dark"] .lg-shell {
    --lg-wash-w: rgba(240, 225, 160, 0.13);
    --lg-wash-u: rgba(70, 130, 225, 0.24);
    --lg-wash-b: rgba(150, 110, 200, 0.16);
    --lg-wash-r: rgba(215, 65, 50, 0.22);
    --lg-wash-g: rgba(60, 155, 75, 0.2);
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .lg-shell {
        --lg-wash-w: rgba(240, 225, 160, 0.13);
        --lg-wash-u: rgba(70, 130, 225, 0.24);
        --lg-wash-b: rgba(150, 110, 200, 0.16);
        --lg-wash-r: rgba(215, 65, 50, 0.22);
        --lg-wash-g: rgba(60, 155, 75, 0.2);
    }
}

/* Card art strip under the header, fading into the page at the bottom. */
.lg-hero {
    position: relative;
    height: 150px;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    /* Text lines up with .lg-section's 1080px column on wide screens. */
    padding: 0 max(1.25rem, calc((100% - 1080px) / 2 + 1rem)) 2.1rem;
    color: #fff;
    background:
        linear-gradient(180deg, rgba(0, 0, 0, 0.05) 0%, rgba(0, 0, 0, 0.5) 100%),
        url("https://cards.scryfall.io/art_crop/front/f/4/f4e32327-380d-471e-813b-4c27477787ce.jpg") center 38% / cover no-repeat,
        #8a5a2b;
    -webkit-mask-image: linear-gradient(180deg, #000 72%, transparent 100%);
    mask-image: linear-gradient(180deg, #000 72%, transparent 100%);
}

.lg-hero-tagline {
    max-width: 1080px;
    font-weight: 700;
    font-size: 1.05rem;
    letter-spacing: 0.02em;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.7);
}

.lg-hero-credit {
    font-size: 0.72rem;
    opacity: 0.8;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
    white-space: nowrap;
}

@media (max-width: 640px) {
    .lg-hero { height: 96px; padding: 0 1rem 1.5rem; }
    .lg-hero-tagline { font-size: 0.9rem; }
    .lg-hero-credit { display: none; }
}

.lg-header {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.75rem 1.25rem;
    background: var(--nav-bg);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--surface-border);
}

.lg-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    font-weight: 800;
    font-size: 1.15rem;
    color: var(--text);
    text-decoration: none;
}

.lg-flags { display: inline-flex; gap: 2px; }

.lg-flag {
    display: inline-block;
    width: 18px;
    height: 12px;
    border-radius: 2px;
}

.lg-flag--de { background: linear-gradient(#000 0 33%, #dd0000 33% 66%, #ffce00 66%); }
.lg-flag--at { background: linear-gradient(#ed2939 0 33%, #fff 33% 66%, #ed2939 66%); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08); }
.lg-flag--ch { background: #da291c; position: relative; }
.lg-flag--ch::before, .lg-flag--ch::after { content: ""; position: absolute; background: #fff; left: 50%; top: 50%; transform: translate(-50%, -50%); }
.lg-flag--ch::before { width: 8px; height: 2px; }
.lg-flag--ch::after { width: 2px; height: 8px; }

.lg-header-links {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.92rem;
}

.lg-lang a {
    padding: 0.15rem 0.35rem;
    border-radius: 6px;
    color: var(--text-muted);
    text-decoration: none;
}

.lg-lang a.is-active {
    color: var(--accent-strong);
    background: var(--accent-soft);
    font-weight: 700;
}

.lg-inline-form { display: inline; margin: 0; }

.lg-link-btn {
    background: none;
    border: none;
    padding: 0;
    color: var(--accent-strong);
    font: inherit;
    cursor: pointer;
}

.lg-link-btn:hover { text-decoration: underline; }
.lg-danger { color: #dc2626; }

.lg-main { flex: 1; }

.lg-footer {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 0.5rem 1rem;
    padding: 1.25rem;
    color: var(--text-faint);
    font-size: 0.85rem;
    border-top: 1px solid var(--surface-border);
}

.lg-section {
    max-width: 1080px;
    margin: 0 auto;
    padding: 1.5rem 1rem 4rem;
}

.lg-section h1 { margin: 0.25rem 0 0.5rem; }

.lg-lead {
    color: var(--text-muted);
    max-width: 72ch;
    margin-bottom: 1.5rem;
}

.lg-title {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
}

.lg-subtitle { margin: 2rem 0 0.75rem; }

.lg-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.lg-card,
.lg-panel {
    background: var(--surface);
    border: 1px solid var(--surface-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

.lg-card {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    padding: 1rem 1.1rem;
    color: var(--text);
    text-decoration: none;
    transition: border-color 0.15s ease, transform 0.15s ease;
}

.lg-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    text-decoration: none;
}

.lg-card--spice { border-left: 4px solid #f97316; }

.lg-card-head {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35rem;
}

.lg-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 0.75rem;
    font-size: 0.88rem;
    color: var(--text-muted);
}

.lg-badge {
    display: inline-block;
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
    background: var(--accent-soft);
    color: var(--accent-strong);
}

.lg-badge--open { background: rgba(34, 197, 94, 0.14); color: #15803d; }
.lg-badge--groups, .lg-badge--bracket { background: rgba(249, 115, 22, 0.14); color: #c2410c; }
.lg-badge--finished { background: var(--accent-soft); color: var(--accent-strong); }
.lg-badge--cancelled { background: rgba(120, 120, 140, 0.16); color: var(--text-muted); }

.lg-votes {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0.3rem;
    font-size: 0.88rem;
}

.lg-votes li {
    display: grid;
    grid-template-columns: minmax(6rem, auto) 1fr 2rem;
    align-items: center;
    gap: 0.5rem;
}

.lg-vote-bar {
    height: 8px;
    border-radius: 999px;
    background: var(--bg-soft);
    overflow: hidden;
}

.lg-vote-bar i {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--accent-strong));
}

.lg-votes b { text-align: right; }

.lg-panel {
    padding: 1.1rem 1.25rem;
    margin-bottom: 1.25rem;
}

.lg-panel h2 {
    font-size: 1.15rem;
    margin: 0 0 0.75rem;
}

.lg-admin { border-style: dashed; border-color: var(--accent); }

.lg-form {
    display: grid;
    gap: 0.9rem;
    max-width: 520px;
}

.lg-form--row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.6rem;
    max-width: none;
    margin-top: 0.75rem;
}

.lg-form label {
    display: grid;
    gap: 0.25rem;
    font-size: 0.9rem;
}

.lg-form label > span { font-weight: 600; }

.lg-form small,
.lg-hint,
.lg-muted {
    color: var(--text-faint);
    font-size: 0.85rem;
}

.lg-shell input[type="text"],
.lg-shell input[type="search"],
.lg-shell select {
    font: inherit;
    padding: 0.5rem 0.7rem;
    border: 1px solid var(--surface-border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    min-width: 0;
}

.lg-shell input:focus,
.lg-shell select:focus {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
}

.lg-search { width: 100%; max-width: 320px; margin-bottom: 0.75rem; }

.lg-formats {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem 1rem;
    border: none;
    padding: 0;
    margin: 0 0 0.5rem;
}

.lg-formats legend {
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 0.35rem;
}

.lg-formats > small {
    flex-basis: 100%;
    color: var(--text-faint);
}

/* "I'll play anything": on its own line below the formats */
.lg-radio--all {
    flex-basis: 100%;
    font-weight: 600;
}

/* A manager's per-player format switches in the registration list */
.lg-chips {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.lg-chip {
    border: 1px solid currentColor;
    border-radius: 999px;
    padding: 0.05rem 0.55rem;
    font: inherit;
    font-size: 0.8rem;
    background: transparent;
    color: inherit;
    opacity: 0.45;
    cursor: pointer;
}

.lg-chip.is-on {
    opacity: 1;
    font-weight: 600;
}

.lg-form .lg-radio,
.lg-radio {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    cursor: pointer;
}

.lg-suggest {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem;
    border-radius: var(--radius-sm);
    background: var(--accent-soft);
}

.lg-suggest p { width: 100%; margin: 0; font-weight: 600; }

.lg-form .btn-primary { justify-self: start; }

.lg-message { margin: 0.5rem 0; font-weight: 600; }
.lg-message.is-ok { color: #15803d; }
.lg-message.is-error { color: #dc2626; }

.lg-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
}

.lg-champion {
    margin: 0 0 1.25rem;
    padding: 0.9rem 1.1rem;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, rgba(234, 179, 8, 0.2), rgba(249, 115, 22, 0.12));
    font-size: 1.15rem;
}

.lg-players {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0.35rem;
}

.lg-players li {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 0.75rem;
    padding: 0.35rem 0;
    border-bottom: 1px solid var(--surface-border);
}

.lg-players li > span:first-child { font-weight: 600; min-width: 10rem; }

.lg-groups {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 480px), 1fr));
    gap: 1rem;
}

.lg-group-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}

.lg-table-wrap { overflow-x: auto; }

.lg-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}

.lg-table th,
.lg-table td {
    padding: 0.35rem 0.4rem;
    text-align: right;
    white-space: nowrap;
    border-bottom: 1px solid var(--surface-border);
}

.lg-table th:nth-child(2),
.lg-table td:nth-child(2) { text-align: left; width: 100%; white-space: normal; }

.lg-table th { color: var(--text-faint); font-weight: 600; }
.lg-table tr.is-qualified td:first-child { box-shadow: inset 3px 0 0 #22c55e; }
.lg-table tr.is-third td:first-child { box-shadow: inset 3px 0 0 #eab308; }
.lg-row-actions { display: flex; gap: 0.4rem; justify-content: flex-end; }
.lg-row-actions select { padding: 0.2rem 0.4rem; font-size: 0.82rem; }

.lg-matches {
    display: grid;
    gap: 0.35rem;
    margin-top: 0.9rem;
}

.lg-match {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    grid-template-areas: "p1 score p2" "actions actions actions";
    align-items: center;
    gap: 0.2rem 0.6rem;
    padding: 0.45rem 0.6rem;
    border-radius: var(--radius-sm);
    background: var(--bg-soft);
    font-size: 0.9rem;
}

.lg-match-player:first-child { grid-area: p1; }
.lg-match-score { grid-area: score; font-weight: 800; font-variant-numeric: tabular-nums; min-width: 3.2rem; text-align: center; }
.lg-match-player--right { grid-area: p2; text-align: right; }
.lg-match-player.is-winner { font-weight: 700; }
.lg-match-actions { grid-area: actions; display: flex; justify-content: center; gap: 0.75rem; font-size: 0.82rem; }
.lg-match-actions:empty { display: none; }
.lg-match.is-bye { opacity: 0.7; }

.lg-score-picker {
    grid-column: 1 / -1;
    display: grid;
    gap: 0.35rem;
    justify-items: center;
}

.lg-score-options {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.35rem;
}

.lg-score-btn {
    font: inherit;
    font-weight: 700;
    padding: 0.3rem 0.6rem;
    border-radius: 8px;
    border: 1px solid var(--surface-border);
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    font-variant-numeric: tabular-nums;
}

.lg-score-btn:hover { border-color: var(--accent); color: var(--accent-strong); }

.lg-bracket {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(240px, 1fr);
    gap: 1rem;
    overflow-x: auto;
}

.lg-bracket-round {
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    gap: 0.6rem;
}

.lg-bracket-round h3 {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-faint);
    margin: 0;
}

.lg-past { margin-top: 1.5rem; }

@media (max-width: 640px) {
    .lg-header { padding: 0.6rem 1rem; }
    .lg-header-links { gap: 0.6rem; }
    .lg-bracket { grid-auto-flow: row; grid-auto-columns: auto; }
    .lg-table .lg-hide-sm { display: none; }
}

.lg-lead span + span { margin-left: 0.3em; }

/* ── Light / dark ─────────────────────────────────────────────────────────
   The header shows the switch to the other theme: the explicit choice (data-theme on <html>, from the
   tgg-theme cookie) wins; without one the OS decides, like app.css. */
.lg-theme-toggle { flex-shrink: 0; }
.lg-theme-toggle--to-light { display: none; }

:root[data-theme="dark"] .lg-theme-toggle--to-light { display: inline-flex; }
:root[data-theme="dark"] .lg-theme-toggle--to-dark { display: none; }

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .lg-theme-toggle--to-light { display: inline-flex; }
    :root:not([data-theme="light"]) .lg-theme-toggle--to-dark { display: none; }
}

/* The fixed status colours above are dark shades for light backgrounds; lighter ones on dark. */
:root[data-theme="dark"] .lg-badge--open,
:root[data-theme="dark"] .lg-message.is-ok { color: #4ade80; }
:root[data-theme="dark"] .lg-badge--groups,
:root[data-theme="dark"] .lg-badge--bracket { color: #fb923c; }
:root[data-theme="dark"] .lg-danger,
:root[data-theme="dark"] .lg-message.is-error { color: #f87171; }

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .lg-badge--open,
    :root:not([data-theme="light"]) .lg-message.is-ok { color: #4ade80; }
    :root:not([data-theme="light"]) .lg-badge--groups,
    :root:not([data-theme="light"]) .lg-badge--bracket { color: #fb923c; }
    :root:not([data-theme="light"]) .lg-danger,
    :root:not([data-theme="light"]) .lg-message.is-error { color: #f87171; }
}

/* ── Collapsible section (past leagues) ──────────────────────────────────── */
.lg-collapse {
    background: var(--surface);
    border: 1px solid var(--surface-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

.lg-collapse > summary {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.85rem 1.1rem;
    font-weight: 600;
    cursor: pointer;
    list-style: none;
    user-select: none;
}

.lg-collapse > summary::-webkit-details-marker { display: none; }

.lg-collapse > summary::before {
    content: "";
    width: 0.45rem;
    height: 0.45rem;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(-45deg);
    transition: transform 0.15s ease;
    opacity: 0.6;
    flex-shrink: 0;
}

.lg-collapse[open] > summary::before { transform: rotate(45deg); }
.lg-collapse > summary:hover { color: var(--accent-strong); }
.lg-collapse > :not(summary) { padding: 0 1.1rem 1.1rem; }
.lg-collapse .lg-cards--past { margin: 0; }

/* Managers: the Discord text that starts a group (inside the group panel) */
.lg-discord { margin: 0.75rem 0; box-shadow: none; }
.lg-discord > summary { padding: 0.6rem 0.9rem; }
.lg-discord > textarea {
    display: block;
    box-sizing: border-box;
    width: calc(100% - 1.8rem);
    margin: 0 0.9rem 0.6rem;
    padding: 0.5rem 0.7rem;
    font: 0.9rem/1.45 ui-monospace, SFMono-Regular, Consolas, monospace;
    border: 1px solid var(--surface-border);
    border-radius: var(--radius-sm);
    background: var(--bg-soft);
    color: var(--text);
    resize: vertical;
}
.lg-discord > .lg-actions { padding: 0 0.9rem 0.8rem; align-items: center; }

/* ── Rule tones: restricted (1), banned / not allowed (0, No), any number (∞) ── */
.lg-tone--restricted { background: rgba(234, 179, 8, 0.2); }
.lg-tone--banned { background: rgba(239, 68, 68, 0.18); }
.lg-tone--unlimited { background: rgba(34, 197, 94, 0.18); }


.lg-formats-link {
    flex-basis: 100%;
    font-size: 0.85rem;
    color: var(--accent-strong);
}

/* ── The formats: one tile per ruleset (Components/Liga/LigaFormatOverview.razor) ── */
.lg-ov-tiles {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(215px, 1fr));
    gap: 0.9rem;
}

.lg-ov-tile {
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
    padding: 1rem;
    border: 1px solid var(--surface-border);
    border-radius: var(--radius-sm);
    background: var(--bg-soft);
}

.lg-ov-tile-head {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.lg-ov-tile-head h3 {
    margin: 0;
    font-size: 1rem;
    line-height: 1.2;
}

.lg-ov-badge {
    display: inline-grid;
    place-items: center;
    min-width: 2.6rem;
    height: 2.6rem;
    padding: 0 0.35rem;
    border-radius: 10px;
    background: var(--accent);
    color: var(--accent-contrast);
    font-weight: 800;
    font-size: 0.78rem;
    letter-spacing: 0.03em;
    white-space: nowrap;
    flex-shrink: 0;
}

.lg-ov-note {
    margin: -0.3rem 0 0;
    font-size: 0.78rem;
    color: var(--text-faint);
}

.lg-ov-switches { display: flex; flex-wrap: wrap; gap: 0.35rem; }

.lg-ov-switch {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
}

.lg-ov-switch.is-on { background: rgba(34, 197, 94, 0.16); }
.lg-ov-switch.is-off { background: rgba(239, 68, 68, 0.18); }
.lg-ov-switch.is-special { box-shadow: inset 0 0 0 1.5px currentColor; }

.lg-ov-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0.15rem;
    font-size: 0.82rem;
}

.lg-ov-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.12rem 0.35rem;
    border-radius: 6px;
}

/* The usual 4 copies fade back, so the limits stand out. */
.lg-ov-list li.is-normal { color: var(--text-faint); }

/* What this format does unlike most others. */
.lg-ov-list li.is-special { background: var(--surface); font-weight: 600; color: var(--text); }
.lg-ov-list li.is-special .lg-ov-card::after,
.lg-ov-dot {
    content: "";
    display: inline-block;
    width: 0.4rem;
    height: 0.4rem;
    margin-left: 0.35rem;
    border-radius: 50%;
    background: var(--accent);
    vertical-align: middle;
}

.lg-ov-tile { min-width: 0; }
.lg-ov-list { grid-template-columns: minmax(0, 1fr); }
.lg-ov-card { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.lg-ov-count {
    display: inline-grid;
    place-items: center;
    min-width: 1.6rem;
    height: 1.35rem;
    padding: 0 0.3rem;
    border-radius: 6px;
    font-weight: 700;
    font-style: normal;
    font-size: 0.78rem;
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
}

.lg-ov-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem 1.2rem;
    list-style: none;
    margin: 1rem 0 0;
    padding: 0;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.lg-ov-legend li { display: inline-flex; align-items: center; gap: 0.4rem; }
.lg-ov-legend .lg-ov-dot { margin: 0 0.25rem; }

.lg-ov-lists {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1rem;
    margin-top: 1.1rem;
}

.lg-ov-lists h4 { margin: 0 0 0.45rem; font-size: 0.88rem; }

.lg-ov-cards {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.lg-ov-cards li {
    padding: 0.1rem 0.55rem;
    border-radius: 999px;
    font-size: 0.78rem;
}

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

/* Jump targets (#register, #formats) stop below the sticky header. */
.lg-shell [id] { scroll-margin-top: 4.5rem; }

/* Header on phones: brand, sign-in and DE/EN each stay on one line (the sign-in link sits up here too). */
.lg-brand, .lg-lang, .lg-header-links a { white-space: nowrap; }

@media (max-width: 420px) {
    .lg-header { gap: 0.5rem; padding: 0.55rem 0.75rem; }
    .lg-brand { font-size: 1rem; gap: 0.4rem; }
    .lg-header-links { gap: 0.45rem; font-size: 0.88rem; }
}

/* ── History, Hall of Fame and Kreuztabelle ─────────────────────────────── */

.lg-badge--imported { background: var(--bg-soft); color: var(--text-muted); border: 1px solid var(--surface-border); }

.lg-stat-links { display: flex; flex-wrap: wrap; gap: 0.6rem; margin: 0 0 1.5rem; }
.lg-stat-links a { text-decoration: none; }

.lg-facts { list-style: none; padding: 0; margin: 0 0 1rem; display: flex; flex-wrap: wrap; gap: 0.4rem 1.2rem; }

.lg-pairing { margin: -0.1rem 0 0.4rem; font-size: 0.85rem; }
.lg-pairing select { max-width: 12rem; }

.lg-report {
    white-space: pre-wrap;
    font-size: 0.8rem;
    max-height: 24rem;
    overflow: auto;
    padding: 0.75rem;
    background: var(--bg-soft);
    border-radius: var(--radius-sm);
}

/* The stats tables: every column left-aligned text or right-aligned numbers, no stretched second column. */
.lg-stats-wrap .lg-table th:nth-child(2),
.lg-stats-wrap .lg-table td:nth-child(2) { width: auto; }
.lg-hof th, .lg-hof td { text-align: left; white-space: nowrap; }
.lg-alltime th { white-space: normal; min-width: 4.2rem; vertical-align: bottom; }
.lg-alltime td:nth-child(2) { text-align: left; }
.lg-opponents tfoot td { font-weight: 700; border-top: 2px solid var(--surface-border); }

/* Kreuztabelle: scrolls both ways inside its box; the header row and the player column stay put. */
.lg-xt-wrap {
    overflow: auto;
    max-height: 75vh;
    max-width: 100%;
    border: 1px solid var(--surface-border);
    border-radius: var(--radius-md);
    background: var(--surface);
    -webkit-overflow-scrolling: touch;
}

.lg-xt { border-collapse: separate; border-spacing: 0; font-size: 0.78rem; }
.lg-xt th, .lg-xt td {
    padding: 0.25rem 0.4rem;
    text-align: center;
    white-space: nowrap;
    border-right: 1px solid var(--surface-border);
    border-bottom: 1px solid var(--surface-border);
    background: var(--surface);
}
.lg-xt thead th { position: sticky; top: 0; z-index: 2; vertical-align: bottom; color: var(--text-faint); font-weight: 600; }
.lg-xt-col { height: 8.5rem; }
.lg-xt-col span { writing-mode: vertical-rl; transform: rotate(180deg); display: inline-block; max-height: 8rem; overflow: hidden; text-overflow: ellipsis; }
.lg-xt-row, .lg-xt-corner { position: sticky; left: 0; text-align: left !important; z-index: 1; min-width: 9rem; max-width: 12rem; overflow: hidden; text-overflow: ellipsis; }
.lg-xt-row { font-weight: 600; }
.lg-xt thead .lg-xt-corner { z-index: 3; }
.lg-xt-num { font-variant-numeric: tabular-nums; }
.lg-xt-self { background: var(--bg-soft) !important; }
.lg-xt-win { color: #15803d; font-weight: 600; }
.lg-xt-loss { color: #b91c1c; }
.lg-xt-even { color: var(--text-muted); }
:root[data-theme="dark"] .lg-xt-win { color: #4ade80; }
:root[data-theme="dark"] .lg-xt-loss { color: #f87171; }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .lg-xt-win { color: #4ade80; }
    :root:not([data-theme="light"]) .lg-xt-loss { color: #f87171; }
}
.lg-xt thead .lg-xt-num { white-space: normal; width: 4rem; min-width: 4rem; }
@media (max-width: 640px) {
    .lg-xt-row, .lg-xt-corner { min-width: 6.5rem; max-width: 7.5rem; }
    .lg-xt-col { height: 7rem; }
}
.lg-round-title { font-size: 0.95rem; margin: 1rem 0 0.4rem; color: var(--text-muted); }
.lg-round-title:first-of-type { margin-top: 0.2rem; }
