/* Roboto, for labels drawn over a video clip. Served with the app rather than fetched
   from a font host: a coach marking up a clip may have no way out to the internet, and a
   label that silently falls back to another face is a label that no longer matches the
   rest of the clip. Latin only - four files is what the annotator asks for. */
@font-face {
    font-family: 'Roboto';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('fonts/roboto-latin-400-normal.woff2') format('woff2');
}

@font-face {
    font-family: 'Roboto';
    font-style: italic;
    font-weight: 400;
    font-display: swap;
    src: url('fonts/roboto-latin-400-italic.woff2') format('woff2');
}

@font-face {
    font-family: 'Roboto';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url('fonts/roboto-latin-700-normal.woff2') format('woff2');
}

@font-face {
    font-family: 'Roboto';
    font-style: italic;
    font-weight: 700;
    font-display: swap;
    src: url('fonts/roboto-latin-700-italic.woff2') format('woff2');
}

/* ============================================================================
   Design tokens — "training ground" identity.
   The base UI stays quiet (pitch green, chalk, ink) so the user-defined data
   colors (difficulty levels, phases of play, availability) stay legible.
   --pw-accent is the club's own color; MainLayout overrides it per tenant.
   ============================================================================ */
:root {
    --pw-pitch: #0e3a2d;
    --pw-pitch-deep: #0a2b21;
    --pw-chalk: #f6f5f0;
    --pw-surface: #ffffff;
    --pw-ink: #131b17;
    --pw-line: #d9d6cc;
    --pw-muted: #4f5c55;
    --pw-accent: #1e7a5a;
    --pw-accent-contrast: #ffffff;
    /* Accent used AS TEXT on the page background. Never use raw --pw-accent for
       text: a club may pick a light accent that vanishes on chalk. MainLayout
       computes AA-safe variants per club; these are the defaults. */
    --pw-accent-text: #1e7a5a;
    --pw-shadow-1: 0 1px 2px rgba(19, 27, 23, .05);
    --pw-shadow-2: 0 10px 24px rgba(19, 27, 23, .12);

    --pw-font-display: 'Barlow Condensed', 'Arial Narrow', sans-serif;
    --pw-font-body: 'Public Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --pw-font-mono: 'IBM Plex Mono', ui-monospace, 'Cascadia Mono', Consolas, monospace;

    /* Retheme Bootstrap through its own variables instead of fighting it. */
    --bs-body-bg: var(--pw-chalk);
    --bs-body-color: var(--pw-ink);
    --bs-body-font-family: var(--pw-font-body);
    --bs-border-color: var(--pw-line);
    --bs-secondary-color: var(--pw-muted);
    --bs-secondary-bg: color-mix(in srgb, var(--pw-chalk), var(--pw-ink) 6%);
    --bs-tertiary-bg: var(--pw-chalk);
    --bs-link-color: var(--pw-accent-text);
    --bs-link-hover-color: color-mix(in srgb, var(--pw-accent-text), var(--pw-ink) 25%);
    --bs-focus-ring-color: color-mix(in srgb, var(--pw-accent), transparent 65%);
}

/* MainLayout writes the per-club accent variables on .page; the text-safe
   variant has to be resolved there so those inline values are visible. */
.page {
    --pw-accent-text: var(--pw-accent-text-light, #1e7a5a);
}

:root[data-bs-theme="dark"] {
    --pw-accent-text: #4fae89;
}

    :root[data-bs-theme="dark"] .page {
        --pw-accent-text: var(--pw-accent-text-dark, #4fae89);
    }

/* ============================================================================
   Themes. A theme is a named set of values for the tokens above, selected by
   data-pw-theme on <html> (assigned per club by the System Admin, or resolved
   from the OS preference for "system"). Every non-light theme also sets
   data-bs-theme="dark" so Bootstrap flips its own internals (hover and active
   states, emphasis text, close buttons, form arrows) together with our tokens.
   The club accent color layers on top of every theme.
   ============================================================================ */

/* Dark: the light identity with inverted, neutral surfaces. */
:root[data-pw-theme="dark"] {
    --pw-chalk: #121815;
    --pw-surface: #1a221e;
    --pw-ink: #e8e6df;
    --pw-line: #2e3833;
    --pw-muted: #9caaa2;
    --pw-shadow-1: 0 1px 2px rgba(0, 0, 0, .4);
    --pw-shadow-2: 0 10px 24px rgba(0, 0, 0, .5);
    color-scheme: dark;
}

/* Chalkboard: the coach's tactics board — deep pitch-green surfaces, chalk text. */
:root[data-pw-theme="chalkboard"] {
    --pw-chalk: #0d211a;
    --pw-surface: #123227;
    --pw-ink: #eef2ea;
    --pw-line: #24473a;
    --pw-muted: #93b0a3;
    --pw-shadow-1: 0 1px 2px rgba(0, 0, 0, .45);
    --pw-shadow-2: 0 10px 24px rgba(0, 0, 0, .55);
    color-scheme: dark;
}

html, body {
    font-family: var(--pw-font-body);
    background-color: var(--pw-chalk);
    color: var(--pw-ink);
}

/* Typography roles: condensed display face carries the personality;
   the body face stays plain and readable. */
h1, h2, h3, .font-display {
    font-family: var(--pw-font-display);
    font-weight: 600;
    letter-spacing: .01em;
}

h1 {
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .02em;
}

::selection {
    background-color: color-mix(in srgb, var(--pw-accent), transparent 70%);
}

.font-mono {
    font-family: var(--pw-font-mono);
}

a, .btn-link {
    color: var(--pw-accent-text);
}

/* Primary actions take the club accent. */
.btn-primary {
    --bs-btn-color: var(--pw-accent-contrast);
    --bs-btn-bg: var(--pw-accent);
    --bs-btn-border-color: var(--pw-accent);
    --bs-btn-hover-color: var(--pw-accent-contrast);
    --bs-btn-hover-bg: color-mix(in srgb, var(--pw-accent), black 12%);
    --bs-btn-hover-border-color: color-mix(in srgb, var(--pw-accent), black 18%);
    --bs-btn-active-color: var(--pw-accent-contrast);
    --bs-btn-active-bg: color-mix(in srgb, var(--pw-accent), black 20%);
    --bs-btn-active-border-color: color-mix(in srgb, var(--pw-accent), black 24%);
    --bs-btn-disabled-color: var(--pw-accent-contrast);
    --bs-btn-disabled-bg: color-mix(in srgb, var(--pw-accent), var(--pw-chalk) 45%);
    --bs-btn-disabled-border-color: transparent;
}

/* Bootstrap's outline-secondary gray reads poorly on dark surfaces; lift it. */
:root[data-bs-theme="dark"] .btn-outline-secondary {
    --bs-btn-color: #b7c2bb;
    --bs-btn-border-color: #55625b;
    --bs-btn-hover-bg: #55625b;
    --bs-btn-hover-border-color: #55625b;
    --bs-btn-hover-color: #ffffff;
}

.btn-outline-primary {
    --bs-btn-color: var(--pw-accent-text);
    --bs-btn-border-color: var(--pw-accent);
    --bs-btn-hover-color: var(--pw-accent-contrast);
    --bs-btn-hover-bg: var(--pw-accent);
    --bs-btn-hover-border-color: var(--pw-accent);
    --bs-btn-active-color: var(--pw-accent-contrast);
    --bs-btn-active-bg: var(--pw-accent);
    --bs-btn-active-border-color: var(--pw-accent);
}

.text-primary {
    color: var(--pw-accent-text) !important;
}

.bg-primary {
    background-color: var(--pw-accent) !important;
}

/* Visible, accent-colored keyboard focus. */
.btn:focus-visible, .btn:active:focus-visible, .btn-link.nav-link:focus-visible,
.form-control:focus, .form-check-input:focus, .form-select:focus {
    border-color: color-mix(in srgb, var(--pw-accent), var(--pw-chalk) 40%);
    box-shadow: 0 0 0 .25rem var(--bs-focus-ring-color);
}

.form-check-input:checked {
    background-color: var(--pw-accent);
    border-color: var(--pw-accent);
}

/* ============================================================================
   Account pages (sign in, reset, complete registration). Stacked labels over
   plain fields: the brand panel beside them does the talking, so the form
   itself stays as quiet as possible.
   ============================================================================ */
.auth-heading {
    margin-bottom: 2rem;
}

.auth-title {
    margin-bottom: .35rem;
    font-size: 2.4rem;
    line-height: 1;
}

.auth-lede {
    margin: 0;
    color: var(--pw-muted);
    line-height: 1.5;
}

.auth-field {
    margin-bottom: 1.25rem;
}

.auth-label-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1rem;
}

.auth-label {
    display: block;
    margin-bottom: .4rem;
    font-family: var(--pw-font-mono);
    font-size: .72rem;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--pw-muted);
}

.auth-aside-link {
    font-size: .82rem;
    text-decoration: none;
}

    .auth-aside-link:hover {
        text-decoration: underline;
    }

.auth-input.form-control {
    height: 3rem;
    padding: .6rem .9rem;
    font-size: 1rem;
    background-color: var(--pw-surface);
    border: 1px solid var(--pw-line);
    border-radius: .5rem;
    color: var(--pw-ink);
}

    .auth-input.form-control::placeholder {
        color: color-mix(in srgb, var(--pw-muted), transparent 45%);
    }

.auth-remember {
    margin: .25rem 0 1.75rem;
    color: var(--pw-muted);
    font-size: .92rem;
}

.auth-submit {
    height: 3rem;
    margin-bottom: 1.75rem;
    font-weight: 600;
    letter-spacing: .02em;
    border-radius: .5rem;
}

.auth-note {
    margin: 0;
    padding-top: 1.25rem;
    border-top: 1px solid var(--pw-line);
    font-size: .85rem;
    line-height: 1.55;
    color: var(--pw-muted);
}

/* Tables read like fixture lists: quiet mono headers, generous rows. */
.table > thead {
    font-family: var(--pw-font-mono);
    font-size: .74rem;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: var(--pw-muted);
}

.table > tbody > tr > td {
    padding-top: .65rem;
    padding-bottom: .65rem;
}

.table-hover > tbody > tr:hover > * {
    --bs-table-bg-state: color-mix(in srgb, var(--pw-accent), transparent 94%);
}

.table-responsive {
    background-color: var(--pw-surface);
    border: 1px solid var(--pw-line);
    border-radius: .6rem;
    padding: .25rem .75rem;
    box-shadow: var(--pw-shadow-1);
}

    .table-responsive > .table {
        margin-bottom: .25rem;
    }

.table {
    --bs-table-bg: transparent;
    --bs-table-color: var(--pw-ink);
}

/* Surfaces: soft corners, hairline borders, one quiet shadow level. */
.card {
    --bs-card-bg: var(--pw-surface);
    --bs-card-color: var(--pw-ink);
    --bs-card-border-color: var(--pw-line);
    --bs-card-border-radius: .6rem;
    box-shadow: var(--pw-shadow-1);
}

.btn {
    --bs-btn-border-radius: .45rem;
    font-weight: 500;
}

/* A subtle physical push on press. */
.btn:not(:disabled):active {
    transform: translateY(1px);
}

.btn-sm {
    --bs-btn-border-radius: .4rem;
}

.form-control, .form-select {
    border-radius: .45rem;
}

.modal-content {
    --bs-modal-bg: var(--pw-surface);
    --bs-modal-color: var(--pw-ink);
    border: none;
    border-radius: .75rem;
    box-shadow: 0 18px 48px rgba(19, 27, 23, .28);
}

/* An EditForm puts a form between .modal-content and the header, body and footer,
   which breaks the scrollable layout Bootstrap expects. Let the form carry it. */
.modal-dialog-scrollable .modal-content > form {
    display: flex;
    flex-direction: column;
    max-height: 100%;
    min-height: 0;
    overflow: hidden;
}

.modal-header {
    border-bottom-color: var(--pw-line);
}

.modal-footer {
    border-top-color: var(--pw-line);
}

.list-group {
    --bs-list-group-border-color: var(--pw-line);
    --bs-list-group-border-radius: .6rem;
}

.alert {
    --bs-alert-border-radius: .6rem;
}

.badge {
    font-weight: 600;
    letter-spacing: .02em;
}

.content {
    padding-top: 1.25rem;
    padding-bottom: 2.5rem;
}

/* Blazor focuses the h1 after navigation; hide the ring for that programmatic
   focus but keep it for keyboard users. */
h1:focus:not(:focus-visible) {
    outline: none;
}

/* Removes the 300ms double-tap-to-zoom delay on touch devices. */
button, a, select, input, label, textarea {
    touch-action: manipulation;
}

/* Keep background pages from scrolling behind open dialogs. */
.modal, .dropdown-menu {
    overscroll-behavior: contain;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid #e50000;
}

.validation-message {
    color: #e50000;
}

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "An error has occurred."
    }

.darker-border-checkbox.form-check-input {
    border-color: #929292;
}

/* ============================================================================
   Shared page header: kicker, condensed title, description and actions.
   ============================================================================ */
.page-header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: .75rem 1.5rem;
    padding-bottom: .9rem;
    margin-bottom: 1.25rem;
    border-bottom: 1px solid var(--pw-line);
}

.page-kicker {
    font-size: .72rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: .22em;
    color: var(--pw-accent-text);
    margin-bottom: .2rem;
}

.page-title {
    line-height: 1.1;
    transition: font-size .18s ease;
}

.page-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    margin-left: auto;
}

/* A header that follows a long page down. It bleeds out to the article's own padding
   so nothing scrolls past it in the gutters, and sits below the sticky top row. */
.page-header-sticky {
    position: sticky;
    top: 0;
    z-index: 3;
    background-color: var(--pw-chalk);
    margin-left: -1.5rem;
    margin-right: -1.5rem;
    padding-left: 1.5rem;
    padding-right: 1.5rem;
    transition: padding .18s ease, margin-bottom .18s ease, box-shadow .18s ease;
}

@media (min-width: 641px) {
    .page-header-sticky {
        top: 3.5rem;
        margin-left: -2rem;
        padding-left: 2rem;
    }
}

/* Pinned: down to one line, so the page below it keeps as much room as it can.
   The flag is set on <html> by sticky-header.js, out of reach of Blazor's diffing. */
html[data-pw-header-stuck] .page-header-sticky {
    padding-top: .35rem;
    padding-bottom: .45rem;
    margin-bottom: .75rem;
    box-shadow: 0 10px 18px -14px rgba(19, 27, 23, .8);
}

html[data-pw-header-stuck] .page-header-sticky .page-kicker {
    display: none;
}

html[data-pw-header-stuck] .page-header-sticky .page-title {
    font-size: 1.4rem;
}

/* Too narrow for the buttons to share the line, and a header that grows taller as it
   shrinks defeats the point; they come back as soon as the page is scrolled up. */
@media (max-width: 767.98px) {
    html[data-pw-header-stuck] .page-header-sticky .page-actions {
        display: none;
    }
}

/* ============================================================================
   Responsive tables: below md, rows become labeled cards so no data is hidden.
   Cells opt in with data-label="..."; the actions cell uses .pw-actions.
   ============================================================================ */
@media (max-width: 767.98px) {
    .pw-table-stack thead {
        display: none;
    }

    .pw-table-stack tbody, .pw-table-stack tr, .pw-table-stack td {
        display: block;
        width: 100%;
    }

    .pw-table-stack tbody tr {
        padding: .6rem .25rem;
        border-bottom: 1px solid var(--pw-line);
    }

        .pw-table-stack tbody tr:last-child {
            border-bottom: none;
        }

    .pw-table-stack td {
        display: flex;
        justify-content: space-between;
        align-items: baseline;
        gap: 1rem;
        border: none;
        padding: .22rem 0;
        text-align: left !important;
    }

        .pw-table-stack td:empty {
            display: none;
        }

        .pw-table-stack td[data-label]::before {
            content: attr(data-label);
            font-family: var(--pw-font-mono);
            font-size: .68rem;
            text-transform: uppercase;
            letter-spacing: .07em;
            color: var(--pw-muted);
            flex-shrink: 0;
        }

    .pw-table-stack .pw-actions {
        justify-content: flex-end;
        padding-top: .55rem;
    }

        /* Comfortable touch targets when actions stack into the card. */
        .pw-table-stack .pw-actions .btn {
            padding: .45rem .85rem;
            font-size: .875rem;
        }
}

.pw-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .35rem;
    justify-content: flex-end;
}

/* ============================================================================
   Loading skeletons and empty states.
   ============================================================================ */
.pw-skeleton {
    display: block;
    height: 1rem;
    border-radius: .35rem;
    background: linear-gradient(90deg,
            color-mix(in srgb, var(--pw-line), transparent 45%) 25%,
            color-mix(in srgb, var(--pw-line), transparent 70%) 40%,
            color-mix(in srgb, var(--pw-line), transparent 45%) 55%);
    background-size: 300% 100%;
    animation: pw-shimmer 1.4s ease-in-out infinite;
}

@keyframes pw-shimmer {
    from { background-position: 100% 0; }
    to { background-position: 0 0; }
}

.empty-state {
    text-align: center;
    padding: 3.25rem 1.5rem;
    background-color: var(--pw-surface);
    /* A faint accent wash keeps the blank canvas from feeling dead. */
    background-image: radial-gradient(ellipse 60% 75% at 50% 0%,
            color-mix(in srgb, var(--pw-accent), transparent 95%), transparent);
    border: 1px dashed color-mix(in srgb, var(--pw-line), var(--pw-muted) 25%);
    border-radius: .6rem;
}

.empty-state-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 3.4rem;
    height: 3.4rem;
    margin-bottom: .85rem;
    border-radius: 50%;
    background-color: color-mix(in srgb, var(--pw-accent), transparent 88%);
    box-shadow: 0 0 0 .45rem color-mix(in srgb, var(--pw-accent), transparent 95%);
    color: var(--pw-accent-text);
    font-family: var(--pw-font-display);
    font-size: 1.5rem;
    font-weight: 700;
}

/* The mark can double as an "Add" button. */
button.empty-state-mark-btn {
    border: 0;
    cursor: pointer;
    transition: background-color .15s ease, transform .15s ease;
}

button.empty-state-mark-btn:hover,
button.empty-state-mark-btn:focus-visible {
    background-color: color-mix(in srgb, var(--pw-accent), transparent 70%);
    transform: scale(1.08);
}

.empty-state-title {
    font-family: var(--pw-font-display);
    font-size: 1.3rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .03em;
    margin-bottom: .25rem;
}

/* ============================================================================
   Floating action button (mobile): the explicit add affordance where
   double-click doesn't exist.
   ============================================================================ */
.pw-fab {
    position: fixed;
    right: 1rem;
    bottom: calc(1rem + env(safe-area-inset-bottom));
    z-index: 1040;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 3.4rem;
    height: 3.4rem;
    border-radius: 50%;
    background-color: var(--pw-accent);
    color: var(--pw-accent-contrast);
    font-size: 1.9rem;
    font-weight: 400;
    line-height: 1;
    text-decoration: none;
    box-shadow: 0 6px 18px rgba(19, 27, 23, .3);
}

    .pw-fab:hover, .pw-fab:focus {
        color: var(--pw-accent-contrast);
        background-color: color-mix(in srgb, var(--pw-accent), black 12%);
    }

/* ============================================================================
   Sticky save bar for long forms: the primary action stays in reach.
   ============================================================================ */
.pw-save-bar {
    position: sticky;
    bottom: 0;
    /* Above the cards it covers while pinned, below the page header it rides up into. */
    z-index: 2;
    display: flex;
    justify-content: flex-end;
    gap: .5rem;
    margin: 1rem -1rem -1rem;
    padding: .75rem 1rem calc(.75rem + env(safe-area-inset-bottom));
    background-color: color-mix(in srgb, var(--pw-surface), transparent 6%);
    backdrop-filter: blur(6px);
    border-top: 1px solid var(--pw-line);
    border-radius: 0 0 .6rem .6rem;
}

/* ============================================================================
   Toast notifications.
   ============================================================================ */
.toast-host {
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    z-index: 1090;
    display: flex;
    flex-direction: column;
    gap: .5rem;
    max-width: min(22rem, calc(100vw - 2rem));
}

.pw-toast {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .65rem .9rem;
    background-color: var(--pw-ink);
    color: var(--pw-chalk);
    border-radius: .55rem;
    box-shadow: var(--pw-shadow-2);
    font-size: .9rem;
    animation: pw-toast-in .18s ease-out;
}

    .pw-toast::before {
        content: "";
        width: .55rem;
        height: .55rem;
        flex-shrink: 0;
        border-radius: 50%;
        background-color: var(--pw-accent);
    }

    .pw-toast.pw-toast-error::before {
        background-color: #d64545;
    }

@keyframes pw-toast-in {
    from { transform: translateY(.5rem); opacity: 0; }
    to { transform: none; opacity: 1; }
}

/* ============================================================================
   Sidebar icon rail (desktop). The checkbox lives inside NavMenu; :has() lets
   it drive the sidebar width across component style scopes.
   ============================================================================ */
.rail-toggler {
    display: none;
}

@media (min-width: 641px) {
    .rail-toggler {
        display: block;
        appearance: none;
        cursor: pointer;
        width: 100%;
        height: 2.4rem;
        margin: 0;
        border: none;
        border-top: 1px solid rgba(255, 255, 255, .08);
        background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='rgba(255,255,255,.75)'%3E%3Cpath d='M11.354 1.646a.5.5 0 0 1 0 .708L5.707 8l5.647 5.646a.5.5 0 0 1-.708.708l-6-6a.5.5 0 0 1 0-.708l6-6a.5.5 0 0 1 .708 0z'/%3E%3C/svg%3E") no-repeat center / 1rem transparent;
    }

        .rail-toggler:hover {
            background-color: rgba(255, 255, 255, .06);
        }

        .rail-toggler:checked {
            background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='rgba(255,255,255,.75)'%3E%3Cpath d='M4.646 1.646a.5.5 0 0 1 .708 0l6 6a.5.5 0 0 1 0 .708l-6 6a.5.5 0 0 1-.708-.708L10.293 8 4.646 2.354a.5.5 0 0 1 0-.708z'/%3E%3C/svg%3E");
        }

    .sidebar:has(.rail-toggler:checked) {
        width: 4.6rem;
    }

        .sidebar:has(.rail-toggler:checked) .brand-text {
            display: none;
        }

        .sidebar:has(.rail-toggler:checked) .navbar-brand {
            margin-right: 0;
        }

        /* font-size: 0 hides the link's text node while the icon spans keep
           their fixed pixel size. */
        .sidebar:has(.rail-toggler:checked) .nav-link {
            font-size: 0;
            justify-content: center;
            padding-left: 0;
            padding-right: 0;
        }

        .sidebar:has(.rail-toggler:checked) .bi {
            margin-right: 0;
        }

        /* In the icon rail, group labels shrink to a hairline divider. */
        .sidebar:has(.rail-toggler:checked) .nav-section {
            font-size: 0;
            padding: .35rem 1rem;
            border-top: 1px solid rgba(255, 255, 255, .14);
            margin: .35rem .35rem 0;
        }
}

/* ============================================================================
   Pitch zones: translucent rectangles drawn over the pitch image. The image sets
   the size; zones are positioned with percentages of it, so the normalized (0..1)
   geometry stored per zone maps 1:1 to CSS.
   ============================================================================ */
.pw-pitch {
    display: flex;
    align-items: center;
    gap: .3rem;
    width: 100%;
    user-select: none;
}

/* The coordinate anchor: zone rectangles are positioned with percentages of this
   element, and it wraps the pitch image exactly — so the stored normalized geometry
   maps 1:1 onto the pitch regardless of what sits beside it (the direction marker). */
.pw-pitch-field {
    position: relative;
    flex: 1;
    min-width: 0;
}

    .pw-pitch-field img {
        display: block;
        width: 100%;
        height: auto;
        border-radius: var(--pw-radius, .6rem);
    }

.pw-pitch-zone {
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid;
    border-radius: .3rem;
    overflow: hidden;
}

/* Oval zones: the ellipse inscribed in the zone's bounding box. */
.pw-pitch-zone-ellipse {
    border-radius: 50%;
}

.pw-pitch-zone-clickable {
    cursor: pointer;
}

.pw-pitch-zone-label {
    font-family: var(--pw-font-display, inherit);
    font-size: .8rem;
    font-weight: 600;
    letter-spacing: .02em;
    line-height: 1.2;
    padding: .1rem .45rem;
    border-radius: .3rem;
    max-width: 96%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Other zones shown for reference while drawing: visible but clearly secondary. */
.pw-pitch-zone-context {
    border-style: dashed;
    border-width: 1px;
}

.pw-pitch-zone-label-context {
    background: none;
    padding: 0;
    color: rgba(255, 255, 255, .85);
    text-shadow: 0 1px 2px rgba(0, 0, 0, .6);
}

/* Transparent layer on top of the editor pitch that receives the drawing gestures.
   touch-action none: without it, touch devices scroll instead of drawing. The JS
   module swaps the cursor to move/resize arrows when hovering the box or a handle. */
.pw-pitch-surface {
    position: absolute;
    inset: 0;
    cursor: crosshair;
    touch-action: none;
}

/* Resize handles on the zone being edited. Purely visual: the surface above captures
   the pointer and the gesture engine hit-tests by coordinates. */
.pw-zone-handle {
    position: absolute;
    width: 11px;
    height: 11px;
    transform: translate(-50%, -50%);
    background: #fff;
    border: 2px solid var(--pw-accent, var(--bs-primary));
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .35);
    pointer-events: none;
}

/* "Direction of attack" marker: sits in a narrow gutter to the right of the pitch,
   an upward arrow stacked above text rotated to read along it (bottom to top).
   It is on the page surface (not the white pitch), so the color follows the theme. */
.pw-pitch-direction {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .3rem;
    flex-shrink: 0;
    color: var(--bs-secondary-color, rgba(20, 20, 20, .55));
    pointer-events: none;
}

    .pw-pitch-direction span {
        writing-mode: vertical-rl;
        transform: rotate(180deg);
        font-size: .68rem;
        font-weight: 600;
        letter-spacing: .06em;
        text-transform: uppercase;
        white-space: nowrap;
    }

/* Clickable color swatch in overview tables: clicking it opens the row's editor,
   so colors are one click away everywhere (Club Settings, Zones, Phases of Play). */
.color-swatch:hover span {
    outline: 2px solid var(--bs-primary);
    outline-offset: 1px;
}

/* ============================================================================
   Position slots and the training-day lineup board
   Both boards anchor elements at fractions of the pitch image (0..1), like
   zones. Slots and chips center on their spot via translate(-50%, -50%).
   ============================================================================ */

/* --- Club Settings: arrange position slots on the mini pitch --- */

/* touch-action none: without it, touch devices scroll instead of dragging. */
.pw-spot-board {
    touch-action: none;
}

.pw-spot {
    position: absolute;
    transform: translate(-50%, -50%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 1.9rem;
    padding: 0 .55rem;
    border: 2px solid rgba(0, 0, 0, .3);
    border-radius: 999px;
    background-color: rgba(255, 255, 255, .93);
    color: #14281d;
    font-size: .68rem;
    font-weight: 700;
    white-space: nowrap;
    cursor: grab;
    user-select: none;
    box-shadow: 0 1px 4px rgba(0, 0, 0, .35);
}

.pw-spot-dragging {
    cursor: grabbing;
    z-index: 5;
    box-shadow: 0 5px 14px rgba(0, 0, 0, .45);
}

.pw-spot-label {
    max-width: 7rem;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* --- Training day: lineup board --- */

/* The pitch image is portrait (2:3), so at full container width it grows far
   taller than the screen. Cap the board's width from the viewport height so the
   whole pitch is visible without scrolling (leaving room for the surrounding
   chrome: modal header/footer, session line and the unassigned tray). */
.pw-lineup .pw-pitch {
    max-width: min(100%, max(16rem, calc((100vh - 21rem) * 2 / 3)));
    margin-inline: auto;
}

.pw-lineup-slot {
    position: absolute;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .15rem;
    min-width: 3.6rem;
    max-width: 34%;
    padding: .2rem .3rem .3rem;
    border: 2px dashed transparent;
    border-radius: .5rem;
    background-color: rgba(0, 0, 0, .14);
}

.pw-lineup-slot-name {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: .58rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: rgba(255, 255, 255, .92);
    text-shadow: 0 1px 2px rgba(0, 0, 0, .65);
}

.pw-lineup-slot-players {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .2rem;
    min-height: .25rem;
}

/* The chip carries the availability status colors (background and text) itself. */
.pw-lineup-chip {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    padding: .12rem .55rem;
    border-radius: 999px;
    font-size: .72rem;
    font-weight: 600;
    line-height: 1.3;
    white-space: nowrap;
    user-select: none;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .4);
    /* touch-action none: chips are drag handles; the rest of the pitch still scrolls. */
    touch-action: none;
}

.pw-lineup-editable .pw-lineup-chip {
    cursor: grab;
}

.pw-lineup-chip-number {
    font-variant-numeric: tabular-nums;
    font-weight: 800;
    opacity: .85;
}

/* Guests: players from another team marked visible to this one. */
.pw-chip-guest {
    outline: 1.5px dotted rgba(255, 255, 255, .85);
    outline-offset: 1px;
}

.pw-chip-guest-mark {
    font-size: .62rem;
    opacity: .8;
}

/* Separator row above the guest block in the availability list. */
.pw-guest-divider {
    background-color: var(--pw-chalk, var(--bs-tertiary-bg));
    letter-spacing: .06em;
}

/* Moved for this session only (a per-day placement, not the player's profile). */
.pw-chip-placed {
    outline: 2px dashed rgba(255, 255, 255, .75);
    outline-offset: 1px;
}

/* The chip left behind while its ghost follows the pointer. */
.pw-chip-lifted {
    opacity: .35;
}

/* The visual cue that the chip is moving: a clone glued to the pointer.
   pointer-events none, so hit-testing always sees the board underneath. */
.pw-chip-ghost {
    position: fixed;
    z-index: 1060;
    pointer-events: none;
    opacity: .92;
    box-shadow: 0 8px 20px rgba(0, 0, 0, .45);
    cursor: grabbing;
}

/* Highlights while dragging: the player's additional positions, his main slot,
   and whatever drop target sits under the pointer right now. */
.pw-slot-alt {
    border-color: rgba(255, 224, 70, .95);
    background-color: rgba(255, 224, 70, .22);
}

.pw-slot-main {
    border-color: rgba(255, 255, 255, .85);
}

.pw-lineup-slot.pw-slot-over {
    border-color: #fff;
    border-style: solid;
    background-color: rgba(255, 255, 255, .3);
}

.pw-lineup-tray {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .35rem;
    min-height: 2.6rem;
    margin-top: .6rem;
    padding: .5rem .6rem;
    border: 1px dashed var(--pw-line);
    border-radius: .5rem;
    background-color: var(--pw-surface);
}

.pw-lineup-tray-label {
    margin-right: .25rem;
    font-size: .66rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--pw-muted, var(--bs-secondary-color));
}

.pw-lineup-tray.pw-slot-over {
    border-style: solid;
    border-color: var(--pw-accent);
    background-color: color-mix(in srgb, var(--pw-accent), transparent 90%);
}

/* One squad or two teams; sits above the board, since it changes what the board is. */
.pw-lineup-modes {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .4rem;
    margin-bottom: .6rem;
}

/* --- Two teams: the same formation in each half, the far one turned around --- */

/* Each half is claimed by a faint wash and a name, so a chip's team is legible at a
   glance without colouring the chips themselves, which already carry availability. */
.pw-lineup-half {
    position: absolute;
    left: 0;
    right: 0;
    height: 50%;
    pointer-events: none;
}

.pw-lineup-half-0 {
    top: 50%;
    background: linear-gradient(to top, rgba(90, 170, 255, .16), transparent 70%);
}

/* Its own bottom edge is the halfway line, which reads as the boundary between them. */
.pw-lineup-half-1 {
    top: 0;
    background: linear-gradient(to bottom, rgba(255, 150, 80, .16), transparent 70%);
    border-bottom: 1px dashed rgba(255, 255, 255, .5);
}

.pw-lineup-half-label {
    position: absolute;
    left: .5rem;
    padding: .1rem .4rem;
    border-radius: .35rem;
    background-color: rgba(0, 0, 0, .4);
    color: #fff;
    font-size: .6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .07em;
    white-space: nowrap;
}

.pw-lineup-half-0 .pw-lineup-half-label {
    bottom: .4rem;
}

.pw-lineup-half-1 .pw-lineup-half-label {
    top: .4rem;
}

/* Two formations in the space of one: the slots come in closer together. */
.pw-lineup-two-teams .pw-lineup-slot {
    transform: translate(-50%, -50%) scale(.86);
}

/* --- Drag-to-reorder table rows (Club Settings, Phases of Play, Players, Teams) --- */

/* touch-action none: touch devices must drag the row, not scroll the page. */
.drag-handle {
    cursor: grab;
    touch-action: none;
    user-select: none;
    text-align: center;
    transition: color .15s ease, transform .15s ease;
}

/* Table rows carry the grip in a cell of their own; tint it like the grip on the
   card lists so the same handle reads the same everywhere. */
td.drag-handle {
    color: color-mix(in srgb, var(--pw-muted), transparent 35%);
}

.drag-handle:hover {
    color: var(--pw-accent, var(--bs-primary)) !important;
    transform: scale(1.15);
}

.drag-handle:active {
    cursor: grabbing;
}

/* The row being dragged: tinted cells and an accent outline so it clearly
   stands out from its siblings while it travels through the list. */
.table > tbody > tr.dragging > * {
    --bs-table-bg-state: var(--bs-primary-bg-subtle);
}

tr.dragging {
    outline: 2px solid var(--pw-accent, var(--bs-primary));
    outline-offset: -2px;
    cursor: grabbing;
}

tr.dragging .drag-handle {
    color: var(--pw-accent, var(--bs-primary)) !important;
}

/* Non-table reorder rows (e.g. the drill cards on a training day): same accent
   treatment as dragged table rows so the travelling card clearly stands out. */
.pw-drill-row > .flex-grow-1 {
    min-width: 0;
}

.pw-drill-row.dragging {
    outline: 2px solid var(--pw-accent, var(--bs-primary));
    outline-offset: 2px;
    border-radius: .5rem;
    background: var(--bs-primary-bg-subtle);
}

.pw-drill-row.dragging .drag-handle {
    color: var(--pw-accent, var(--bs-primary)) !important;
}

/* A block of the session: its drills fenced off together so a split block reads as one
   thing on the page, the way it runs on the pitch. */
.pw-block {
    display: flex;
    flex-direction: column;
    gap: .5rem;
    padding: .625rem .75rem .75rem;
    border: 1px solid var(--bs-border-color);
    border-radius: .625rem;
    background: var(--bs-tertiary-bg);
}

.pw-block.dragging {
    outline: 2px solid var(--pw-accent, var(--bs-primary));
    outline-offset: 2px;
    background: var(--bs-primary-bg-subtle);
}

.pw-block.dragging .drag-handle {
    color: var(--pw-accent, var(--bs-primary)) !important;
}

.pw-block-head {
    display: flex;
    align-items: center;
    gap: .5rem;
    flex-wrap: wrap;
}

.pw-block-title {
    margin-right: auto;
    font-weight: 600;
    letter-spacing: .01em;
}

.pw-block-add {
    width: auto;
    max-width: 14rem;
}

/* Long coaching points would otherwise push the remove button off the row. */
.pw-block-drill {
    min-width: 0;
}

/* Reorderable cards in a grid (the principles and sub-principles overviews): the
   outline goes on the card itself so it follows the card's rounded corners. */
.pw-reorder-card.dragging > .card {
    outline: 2px solid var(--pw-accent, var(--bs-primary));
    outline-offset: 2px;
    background: var(--bs-primary-bg-subtle);
}

.pw-reorder-card.dragging .drag-handle {
    color: var(--pw-accent, var(--bs-primary)) !important;
}

/* --- Attachments on a card: one text line each, playing over the page --- */
.pw-media-links {
    margin: .5rem 0 0;
    padding: 0;
    list-style: none;
}

.pw-media-link {
    display: flex;
    align-items: center;
    gap: .35rem;
    width: 100%;
    padding: 0;
    color: var(--bs-secondary-color);
    font-size: .8rem;
    text-align: left;
    text-decoration: none;
    background: none;
    border: 0;
}

.pw-media-link:hover,
.pw-media-link:focus-visible {
    color: var(--pw-accent, var(--bs-primary));
    text-decoration: underline;
}

.pw-media-link-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* The player itself, over everything: above the sticky header and the save bar. */
.pw-lightbox {
    position: fixed;
    inset: 0;
    z-index: 1080;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2.5rem 1rem;
    background-color: rgba(0, 0, 0, .82);
}

.pw-lightbox-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
}

.pw-lightbox-figure {
    max-width: 100%;
    margin: 0;
    text-align: center;
}

.pw-lightbox-media {
    max-width: 100%;
    max-height: 80vh;
    border-radius: .4rem;
}

.pw-lightbox-caption {
    margin-top: .5rem;
    color: rgba(255, 255, 255, .8);
    font-size: .85rem;
}

/* A phone or tablet has no room to spare around the clip: the scrim's padding goes
   and the media takes the screen. Where the browser grants native fullscreen this is
   what shows underneath it; where it refuses, this is the whole effect. */
@media (max-width: 991.98px) {
    .pw-lightbox {
        padding: 0;
    }

    .pw-lightbox-figure {
        width: 100%;
    }

    .pw-lightbox-media {
        max-height: 100vh;
        border-radius: 0;
    }

    .pw-lightbox-caption {
        position: absolute;
        bottom: .75rem;
        left: 0;
        right: 0;
        padding: 0 1rem;
    }
}

/* --- A thumbnail whose job is to open the file, not to play it in miniature --- */

.pw-media-thumb {
    position: relative;
    display: block;
    width: 100%;
    height: 100px;
    padding: 0;
    border: 0;
    border-radius: var(--bs-card-inner-border-radius) var(--bs-card-inner-border-radius) 0 0;
    overflow: hidden;
    background-color: #000;
    cursor: pointer;
}

    .pw-media-thumb > img,
    .pw-media-thumb > video {
        width: 100%;
        height: 100%;
        object-fit: cover;
        pointer-events: none;
    }

    .pw-media-thumb:focus-visible {
        outline: 2px solid var(--pw-accent);
        outline-offset: 2px;
    }

.pw-media-thumb-play {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.2rem;
    height: 2.2rem;
    border-radius: 50%;
    font-size: 1.4rem;
    color: #fff;
    background-color: rgba(0, 0, 0, .55);
    transition: background-color .15s ease;
}

.pw-media-thumb:hover .pw-media-thumb-play {
    background-color: rgba(0, 0, 0, .78);
}

/* --- Game Model Wheel (drill-down sunburst of phases > principles > subs) --- */
/* Files, wheel and detail panel in three columns. The side columns are held open
   whether they have anything in them or not, so picking a segment never moves the
   wheel. Below the breakpoint the columns become rows under the wheel. */
.pw-sunburst-layout {
    display: grid;
    grid-template-columns: 9rem minmax(0, 1fr) 19rem;
    align-items: start;
    gap: 1.25rem;
}

/* The explicit width matters: auto margins alone would stop the grid item from
   stretching, leaving the wheel at the svg's own 300px. */
.pw-sunburst {
    width: 100%;
    max-width: 36rem;
    margin-inline: auto;
    padding: .75rem 0 1.25rem;
}

/* Printed, the wheel fills whatever the sheet gives it and answers to nothing: no
   hover, no cursor, no entry animation to be caught halfway through by the printer. */
.pw-sunburst-poster {
    max-width: none;
    padding: 0;
    pointer-events: none;
}

/* Printed, the type comes down to about three quarters of the screen's, which is what
   lets every name on the model be spelt out on the sheet instead of cut to an ellipsis
   the reader cannot click through. The sizes here are what PrincipleSunburst's TypeScale
   measures its line-fitting against, so the two move together. */
.pw-sunburst-poster .pw-sunburst-label-1 {
    font-size: 9.4px;
    letter-spacing: .07em;
}

.pw-sunburst-poster .pw-sunburst-label-2 {
    font-size: 7.6px;
}

.pw-sunburst-poster .pw-sunburst-label-3 {
    font-size: 6.8px;
}

.pw-sunburst-poster .pw-sunburst-label-1.pw-sunburst-label-sm {
    font-size: 7.6px;
    letter-spacing: .04em;
}

.pw-sunburst-poster .pw-sunburst-label-2.pw-sunburst-label-sm {
    font-size: 6.1px;
    letter-spacing: .01em;
}

.pw-sunburst-poster .pw-sunburst-label-3.pw-sunburst-label-sm {
    font-size: 5.8px;
    letter-spacing: .01em;
}

/* The smallest cut, which only the poster reaches for: a sliver of an outer ring holds
   very little text at any size, and the sheet has no tooltip to fall back on, so the
   type comes down rather than the name being cut. Printing blows the whole sheet up to
   fill the page, so these sizes are read larger than they look here. */
.pw-sunburst-poster .pw-sunburst-label-1.pw-sunburst-label-xs {
    font-size: 6px;
    letter-spacing: .02em;
}

.pw-sunburst-poster .pw-sunburst-label-2.pw-sunburst-label-xs {
    font-size: 4.9px;
    letter-spacing: 0;
}

.pw-sunburst-poster .pw-sunburst-label-3.pw-sunburst-label-xs {
    font-size: 4.6px;
    letter-spacing: 0;
}

/* The washed rings leave the segment edges barely there, so a hairline of paper between
   them is what keeps the reader's eye on which ring is which. */
.pw-sunburst-poster .pw-sunburst-seg {
    stroke: var(--pw-surface, #fff);
    stroke-width: .5;
}

.pw-sunburst-files {
    padding-top: .75rem;
}

/* Keyed by the focused node so a new selection replays the entry fade. */
.pw-sunburst-detail {
    margin-top: .75rem;
    animation: pw-detail-in .3s ease;
}

/* The focused item's files, one under another so the column stays narrow. */
.pw-sunburst-media {
    display: flex;
    flex-direction: column;
    gap: .6rem;
    animation: pw-detail-in .3s ease;
}

.pw-sunburst-file {
    display: block;
    width: 100%;
    padding: 0;
    text-align: left;
    text-decoration: none;
    color: inherit;
    background: none;
    border: 0;
}

.pw-sunburst-file-thumb {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    background-color: var(--bs-secondary-bg);
    border: 1px solid var(--pw-line, var(--bs-border-color));
    border-radius: .4rem;
    transition: border-color .15s ease, transform .15s ease;
}

.pw-sunburst-file-thumb > img,
.pw-sunburst-file-thumb > video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.pw-sunburst-file:hover .pw-sunburst-file-thumb,
.pw-sunburst-file:focus-visible .pw-sunburst-file-thumb {
    border-color: var(--pw-accent, var(--bs-primary));
    transform: translateY(-1px);
}

/* Says at a glance which tiles play, since a first frame can look like a photo. */
.pw-sunburst-file-play {
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.9rem;
    height: 1.9rem;
    color: #fff;
    font-size: 1.1rem;
    background-color: rgba(0, 0, 0, .55);
    border-radius: 50%;
}

.pw-sunburst-file-doc {
    font-family: var(--pw-font-mono, monospace);
    font-size: .8rem;
    letter-spacing: .08em;
    color: var(--bs-secondary-color);
}

.pw-sunburst-file-name {
    display: block;
    margin-top: .2rem;
    overflow: hidden;
    font-size: .72rem;
    line-height: 1.25;
    color: var(--bs-secondary-color);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pw-sunburst-file:hover .pw-sunburst-file-name {
    color: var(--bs-body-color);
}

@keyframes pw-detail-in {
    from {
        opacity: 0;
        transform: translateY(6px);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

.pw-sunburst-detail-kicker {
    display: flex;
    align-items: center;
    gap: .4rem;
    font-family: var(--pw-font-display, inherit);
    font-size: .72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .1em;
    color: var(--bs-secondary-color);
    margin-bottom: .35rem;
}

.pw-sunburst-detail-dot {
    width: .65rem;
    height: .65rem;
    border-radius: 50%;
    border: 1px solid var(--pw-line, var(--bs-border-color));
    flex-shrink: 0;
}

.pw-sunburst-detail-desc {
    font-size: .9rem;
    white-space: pre-line;
}

.pw-sunburst-detail-pitch {
    max-width: 13rem;
}

/* Not wide enough for three columns without shrinking the wheel: the files move under
   it instead, which still leaves the wheel where it was. */
@media (max-width: 1199.98px) {
    .pw-sunburst-layout {
        grid-template-columns: minmax(0, 1fr) 19rem;
    }

    .pw-sunburst {
        grid-area: 1 / 1;
    }

    .pw-sunburst-files {
        grid-area: 2 / 1;
        padding-top: 0;
    }

    .pw-sunburst-aside {
        grid-area: 1 / 2 / span 2;
    }

    /* A row of tiles rather than a column, now that they have the width. */
    .pw-sunburst-media {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .pw-sunburst-media-group {
        flex-basis: 100%;
        flex-direction: row;
        flex-wrap: wrap;
        align-items: flex-start;
    }

    /* Its own line, so the tiles under it clearly belong to it. */
    .pw-sunburst-media-phase {
        flex-basis: 100%;
    }

    .pw-sunburst-file {
        width: 8rem;
    }
}

/* Narrower still: one column, wheel first with its panels underneath. */
@media (max-width: 991.98px) {
    .pw-sunburst-layout {
        grid-template-columns: minmax(0, 1fr);
    }

    .pw-sunburst-aside {
        grid-area: 3 / 1;
    }

    .pw-sunburst-detail {
        margin-top: 0;
    }
}

/* Keyed by the current root: every drill-down remounts the stage and replays this. */
.pw-sunburst-stage {
    animation: pw-wheel-in .5s cubic-bezier(.22, .9, .3, 1.02);
    transform-origin: center;
}

@keyframes pw-wheel-in {
    from {
        opacity: 0;
        transform: scale(.86) rotate(-10deg);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

.pw-sunburst svg {
    display: block;
    width: 100%;
    height: auto;
    overflow: visible;
    filter: drop-shadow(0 14px 30px rgba(12, 24, 18, .16));
}

[data-bs-theme="dark"] .pw-sunburst svg {
    filter: drop-shadow(0 14px 30px rgba(0, 0, 0, .45));
}

.pw-sunburst-seg {
    stroke: none;
    transform-box: view-box;
    transform-origin: center;
    transition: transform .22s cubic-bezier(.22, .9, .3, 1.2), filter .22s ease, opacity .22s ease;
}

/* Hovering one segment gently mutes the rest so the wheel reads as a whole. */
.pw-sunburst svg:hover .pw-sunburst-seg:not(:hover) {
    opacity: .88;
}

.pw-sunburst-drillable {
    cursor: pointer;
}

.pw-sunburst-seg.pw-sunburst-drillable:hover {
    transform: scale(1.03);
    filter: saturate(1.12) brightness(1.04);
    opacity: 1;
}

.pw-sunburst-seg.pw-sunburst-drillable:active {
    transform: scale(.985);
    transition-duration: .08s;
}

.pw-sunburst-label {
    pointer-events: none;
    font-weight: 600;
    letter-spacing: .03em;
}

/* Phase ring: club-crest voice. Inner rings: quieter body type. */
.pw-sunburst-label-1 {
    font-family: var(--pw-font-display);
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .09em;
}

.pw-sunburst-label-2 {
    font-size: 10.5px;
}

.pw-sunburst-label-3 {
    font-size: 9.5px;
    font-weight: 500;
}

/* Fit-ladder step: long names shrink before they are ever cut with an ellipsis. */
.pw-sunburst-label-1.pw-sunburst-label-sm {
    font-size: 10.5px;
    letter-spacing: .06em;
}

.pw-sunburst-label-2.pw-sunburst-label-sm {
    font-size: 8.5px;
    letter-spacing: .02em;
}

.pw-sunburst-label-3.pw-sunburst-label-sm {
    font-size: 8px;
    letter-spacing: .02em;
}

/* The rings while the hub is open on the core behaviors: still there for context, but
   quietly behind them and out of the way of the pointer. */
.pw-sunburst-rings {
    transition: opacity .34s ease, filter .34s ease;
}

.pw-sunburst-rings-back {
    opacity: .3;
    filter: saturate(.55);
    pointer-events: none;
}

/* The hub grown into a fan of the club's constants. It scales up out of the middle, so
   the gesture reads as the center opening rather than as a panel arriving. */
.pw-sunburst-core {
    transform-box: view-box;
    transform-origin: center;
    animation: pw-core-open .4s cubic-bezier(.22, .9, .3, 1.02);
}

@keyframes pw-core-open {
    from {
        opacity: 0;
        transform: scale(.16);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

/* Lifts the fan off the receded rings without a hard edge. */
.pw-sunburst-core-halo {
    fill: var(--pw-surface, var(--bs-body-bg));
    opacity: .82;
}

.pw-core-slice {
    cursor: pointer;
    stroke: none;
    transform-box: view-box;
    transform-origin: center;
    transition: transform .22s cubic-bezier(.22, .9, .3, 1.2), filter .22s ease, opacity .22s ease;
}

.pw-core-slice:hover {
    transform: scale(1.03);
    filter: saturate(1.12) brightness(1.05);
}

.pw-core-slice:active {
    transform: scale(.985);
    transition-duration: .08s;
}

/* The one being read stays lit while its neighbours step back. */
.pw-sunburst-core:has(.pw-core-slice-on) .pw-core-slice:not(.pw-core-slice-on) {
    opacity: .55;
}

.pw-core-slice-on {
    filter: saturate(1.15) brightness(1.04) drop-shadow(0 2px 6px rgba(12, 24, 18, .28));
}

.pw-sunburst-core-kicker {
    font-family: var(--pw-font-display);
    font-size: 9px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .12em;
    text-anchor: middle;
    fill: var(--pw-ink, var(--bs-body-color));
    pointer-events: none;
}

/* A phase's clips kept together under its own badge, since a behavior is asked for in
   all of them and the clips would otherwise read as one heap. */
.pw-sunburst-media-group {
    display: flex;
    flex-direction: column;
    gap: .5rem;
}

.pw-sunburst-media-phase {
    align-self: flex-start;
    font-size: .68rem;
    letter-spacing: .04em;
    text-transform: uppercase;
}

/* Unphased clips get a plain label rather than a phase's colors. */
.pw-sunburst-media-phase-any {
    color: var(--bs-secondary-color);
    font-family: var(--pw-font-mono, monospace);
}

.pw-sunburst-center-halo {
    fill: var(--pw-surface, var(--bs-body-bg));
    opacity: .55;
}

.pw-sunburst-center-disc {
    fill: var(--pw-surface, var(--bs-body-bg));
    stroke: var(--pw-line, var(--bs-border-color));
    stroke-width: 1;
    transition: stroke .2s ease, stroke-width .2s ease;
}

.pw-sunburst-center.pw-sunburst-drillable:hover .pw-sunburst-center-disc {
    stroke: var(--pw-accent, var(--bs-primary));
    stroke-width: 2;
}

.pw-sunburst-center-name {
    font-family: var(--pw-font-display);
    font-size: 17px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .05em;
    text-anchor: middle;
    fill: var(--pw-ink, var(--bs-body-color));
    pointer-events: none;
}

.pw-sunburst-center-name-sm {
    font-size: 13.5px;
}

.pw-sunburst-center-sub {
    font-size: 8.5px;
    letter-spacing: .02em;
    text-anchor: middle;
    fill: var(--pw-muted, var(--bs-secondary-color));
    pointer-events: none;
}

.pw-sunburst-center-hint {
    font-size: 8.5px;
    font-weight: 600;
    text-anchor: middle;
    fill: var(--pw-accent, var(--bs-primary));
    pointer-events: none;
}

.pw-sunburst-crumbs {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .3rem;
    justify-content: center;
    margin-bottom: .25rem;
}

.pw-sunburst-crumb {
    border: 0;
    background: none;
    padding: .15rem .5rem;
    border-radius: 999px;
    color: var(--pw-muted, var(--bs-secondary-color));
    cursor: pointer;
    transition: background-color .15s ease, color .15s ease;
}

.pw-sunburst-crumb:hover {
    background-color: var(--bs-tertiary-bg);
    color: var(--pw-ink, var(--bs-body-color));
}

.pw-sunburst-crumb.active {
    color: var(--pw-ink, var(--bs-body-color));
    background-color: var(--bs-tertiary-bg);
    font-weight: 600;
}

@media (prefers-reduced-motion: reduce) {
    .pw-sunburst-stage {
        animation: none;
    }

    .pw-sunburst-seg {
        transition: none;
    }
}

/* --- Zone thumbnail on Principle / Sub-Principle cards ---
   A miniature of the Zones pitch showing where the principle applies. Labels and
   the direction marker are hidden at this size; the tooltip carries the names. */
.pw-zone-thumb {
    width: 4rem;
    flex-shrink: 0;
}

.pw-zone-thumb .pw-pitch-zone {
    border-width: 1px;
    border-radius: 2px;
}

.pw-zone-thumb .pw-pitch-zone-ellipse {
    border-radius: 50%;
}

/* --- Availability status "on/off pitch" pill (Club Settings overview) ---
   A clickable quick-edit. Bootstrap's subtle color tokens keep contrast right in
   every theme: green (participation, positive) for on; neutral gray for off,
   because sitting out is a state, not an error. The dot doubles the signal
   (filled = on, hollow = off) so it never relies on color alone. */
.pw-onpitch-pill {
    display: inline-flex;
    align-items: center;
    gap: .32rem;
    margin-left: .45rem;
    padding: .1rem .55rem;
    border-radius: 999px;
    border: 1px solid;
    font-size: .72rem;
    font-weight: 600;
    letter-spacing: .02em;
    line-height: 1.4;
    cursor: pointer;
    transition: filter .12s ease;
}

.pw-onpitch-pill:hover {
    filter: brightness(.94);
}

[data-pw-theme="dark"] .pw-onpitch-pill:hover,
[data-bs-theme="dark"] .pw-onpitch-pill:hover {
    filter: brightness(1.18);
}

.pw-onpitch-pill:focus-visible {
    outline: 2px solid var(--pw-accent, var(--bs-primary));
    outline-offset: 1px;
}

.pw-onpitch-dot {
    width: .45rem;
    height: .45rem;
    border-radius: 50%;
    flex-shrink: 0;
}

.pw-onpitch-on {
    color: var(--bs-success-text-emphasis);
    background-color: var(--bs-success-bg-subtle);
    border-color: var(--bs-success-border-subtle);
}

.pw-onpitch-on .pw-onpitch-dot {
    background-color: currentColor;
}

.pw-onpitch-off {
    color: var(--bs-secondary-color);
    background-color: var(--bs-tertiary-bg);
    border-color: var(--bs-border-color);
}

.pw-onpitch-off .pw-onpitch-dot {
    background-color: transparent;
    border: 1.5px solid currentColor;
}

/* ============================================================================
   Club Settings: a grouped rail beside one section at a time.
   The eleven areas are too many for a tab strip, and they are not peers — they
   belong to training, the squad, games, events, medical and the club's own
   identity. Rows show the value the way the rest of the app draws it, so a
   coach recognises a difficulty level or a status instead of decoding a swatch.
   ============================================================================ */
.pw-set {
    display: grid;
    grid-template-columns: 14.5rem minmax(0, 1fr);
    gap: 1.25rem;
    align-items: start;
}

.pw-set-rail {
    position: sticky;
    top: 1rem;
    display: flex;
    flex-direction: column;
    gap: .1rem;
    padding: .6rem .5rem .75rem;
    background: var(--pw-surface);
    border: 1px solid var(--bs-border-color);
    border-radius: .7rem;
    box-shadow: var(--pw-shadow-1);
}

.pw-set-rail-group {
    margin: .7rem .55rem .25rem;
    font-size: .64rem;
    font-weight: 600;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--pw-muted);
}

    .pw-set-rail-group:first-child {
        margin-top: .15rem;
    }

.pw-set-rail-link {
    display: flex;
    align-items: center;
    gap: .55rem;
    width: 100%;
    padding: .38rem .55rem;
    border: 0;
    /* The accent edge only shows on the active item; reserving it here keeps the
       labels from shifting sideways as the selection moves. */
    border-left: 2px solid transparent;
    border-radius: .35rem;
    background: transparent;
    color: inherit;
    font-size: .875rem;
    text-align: left;
    transition: background-color .12s ease, color .12s ease;
}

    .pw-set-rail-link:hover {
        background: color-mix(in srgb, var(--pw-accent), transparent 92%);
    }

    .pw-set-rail-link:focus-visible {
        outline: 2px solid var(--pw-accent);
        outline-offset: -2px;
    }

    .pw-set-rail-link.active {
        border-left-color: var(--pw-accent);
        background: color-mix(in srgb, var(--pw-accent), transparent 86%);
        color: var(--pw-accent-text);
        font-weight: 600;
    }

.pw-set-rail-icon {
    flex-shrink: 0;
    width: 1rem;
    font-size: .9rem;
    color: var(--pw-muted);
}

.pw-set-rail-link.active .pw-set-rail-icon {
    color: inherit;
}

.pw-set-rail-name {
    flex: 1 1 auto;
    min-width: 0;
}

.pw-set-rail-count {
    flex-shrink: 0;
    font-size: .7rem;
    font-variant-numeric: tabular-nums;
    color: var(--pw-muted);
}

.pw-set-panel {
    min-width: 0;
}

.pw-set-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: .75rem;
    padding-bottom: .7rem;
    margin-bottom: .9rem;
    border-bottom: 2px solid var(--bs-border-color);
}

.pw-set-head-text {
    min-width: 0;
}

    .pw-set-head-text h2 {
        margin: 0;
        font-size: 1.5rem;
        font-weight: 700;
        letter-spacing: .02em;
        text-transform: uppercase;
    }

.pw-set-usage {
    margin: .15rem 0 0;
    max-width: 52ch;
    font-size: .875rem;
    color: var(--pw-muted);
}

.pw-set-add {
    flex-shrink: 0;
}

.pw-set-hint, .pw-list-hint {
    margin: -.35rem 0 .7rem;
    font-size: .78rem;
    color: var(--pw-muted);
}

.pw-list-hint {
    display: flex;
    align-items: center;
    gap: .35rem;
    margin-top: 0;
}

/* --- A settings list: rows on one card, hairlines between them ---
   The same shape serves the club's other management lists (teams, drills,
   coaches, members), so each rule carries a neutral .pw-list-* name beside the
   .pw-set-* one it was born with. */

.pw-set-list, .pw-list {
    background: var(--pw-surface);
    border: 1px solid var(--bs-border-color);
    border-radius: .6rem;
    box-shadow: var(--pw-shadow-1);
    overflow: hidden;
}

    .pw-set-list:empty, .pw-list:empty {
        display: none;
    }

.pw-set-row, .pw-list-row {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .55rem .85rem .55rem .35rem;
    border-top: 1px solid var(--bs-border-color);
    transition: background-color .12s ease;
}

    .pw-set-row:first-child, .pw-list-row:first-child {
        border-top: 0;
    }

    .pw-set-row:hover, .pw-list-row:hover {
        background: color-mix(in srgb, var(--pw-accent), transparent 95%);
    }

    /* Same treatment as the other reorderable lists: the travelling row is
       outlined and tinted rather than faded, so it stays readable in flight. */
    .pw-set-row.dragging, .pw-list-row.dragging {
        outline: 2px solid var(--pw-accent, var(--bs-primary));
        outline-offset: -2px;
        background: var(--bs-primary-bg-subtle);
        cursor: grabbing;
    }

/* touch-action none: without it, touch devices scroll instead of dragging. */
.pw-set-grip, .pw-list-grip {
    flex-shrink: 0;
    width: 1.4rem;
    text-align: center;
    color: color-mix(in srgb, var(--pw-muted), transparent 35%);
    cursor: grab;
    user-select: none;
    touch-action: none;
}

.pw-set-grip-empty, .pw-list-grip-empty {
    cursor: default;
}

.pw-set-row-main, .pw-list-main {
    flex: 1 1 auto;
    min-width: 0;
}

.pw-set-row-title, .pw-list-title {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .35rem;
}

.pw-set-name, .pw-list-name {
    font-weight: 600;
}

.pw-set-row-desc, .pw-list-desc {
    margin-top: .1rem;
    font-size: .82rem;
    line-height: 1.35;
    color: var(--pw-muted);
}

.pw-set-row-aside, .pw-list-aside {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: .4rem;
    font-size: .82rem;
    color: var(--pw-muted);
}

/* The value drawn the way it appears on the schedule, the calendar and the
   availability panel: its own colors, its own name. */
.pw-set-chip, .pw-list-chip {
    display: inline-block;
    padding: .12rem .5rem;
    border-radius: .3rem;
    font-size: .82rem;
    font-weight: 600;
    line-height: 1.5;
}

.pw-set-tag, .pw-list-tag {
    display: inline-block;
    padding: .05rem .45rem;
    border: 1px solid var(--bs-border-color);
    border-radius: 999px;
    background: var(--bs-tertiary-bg);
    font-size: .7rem;
    color: var(--pw-muted);
}

.pw-set-metric, .pw-list-metric {
    font-size: .95rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--pw-ink);
}

.pw-set-place {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
}

.pw-set-row-actions, .pw-list-actions {
    flex-shrink: 0;
    display: flex;
    gap: .2rem;
}

/* Icon-only row actions: the label is on the button's title, and deleting asks
   first, so the row stays quiet until it is being worked on. */
/* A form that exists only to post one button: it takes no space of its own, so the
   button sits among its neighbours exactly as a link would. */
.pw-inline-form {
    display: contents;
}

.pw-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border: 1px solid transparent;
    border-radius: .35rem;
    background: transparent;
    color: var(--pw-muted);
    transition: background-color .12s ease, color .12s ease, border-color .12s ease;
}

    .pw-icon-btn:hover {
        border-color: var(--bs-border-color);
        background: var(--bs-tertiary-bg);
        color: var(--pw-ink);
    }

    .pw-icon-btn:focus-visible {
        outline: 2px solid var(--pw-accent);
        outline-offset: 1px;
    }

.pw-icon-btn-danger:hover {
    border-color: var(--bs-danger-border-subtle);
    background: var(--bs-danger-bg-subtle);
    color: var(--bs-danger-text-emphasis);
}

/* Filled at rest, not just on hover: the point is to be spotted down a list of grey icons. */
.pw-icon-btn-warning {
    border-color: var(--bs-warning-border-subtle);
    background: var(--bs-warning-bg-subtle);
    color: var(--bs-warning-text-emphasis);
}

    .pw-icon-btn-warning:hover {
        border-color: var(--bs-warning);
        background: var(--bs-warning-bg-subtle);
        color: var(--bs-warning-text-emphasis);
    }

/* An empty section is an invitation, not a dead end. */
.pw-set-empty, .pw-list-empty {
    padding: 2rem 1.25rem;
    border: 1px dashed var(--bs-border-color);
    border-radius: .6rem;
    text-align: center;
}

    .pw-set-empty p, .pw-list-empty p {
        margin: 0 auto .75rem;
        max-width: 44ch;
        color: var(--pw-muted);
    }

/* --- Injuries: a register, so it keeps a table --- */

.pw-set-table, .pw-table-card {
    background: var(--pw-surface);
    border: 1px solid var(--bs-border-color);
    border-radius: .6rem;
    box-shadow: var(--pw-shadow-1);
    overflow-x: auto;
}

    .pw-set-table .table > :not(caption) > * > *,
    .pw-table-card .table > :not(caption) > * > * {
        background: transparent;
    }

    /* The card already draws the outer frame, so the table must not draw a
       second one under its last row. */
    .pw-table-card .table {
        margin-bottom: 0;
    }

        .pw-table-card .table > :not(caption) > *:last-child > * {
            border-bottom-width: 0;
        }

    .pw-table-card thead th {
        font-family: var(--pw-font-mono);
        font-size: .68rem;
        font-weight: 600;
        letter-spacing: .07em;
        text-transform: uppercase;
        color: var(--pw-muted);
        white-space: nowrap;
    }

.pw-set-thumb {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: .35rem;
    object-fit: cover;
}

.pw-set-thumb-empty {
    background: var(--bs-tertiary-bg);
    color: color-mix(in srgb, var(--pw-muted), transparent 40%);
}

.pw-set-notes {
    max-width: 20rem;
}

.pw-set-dates {
    font-size: .82rem;
    font-variant-numeric: tabular-nums;
}

.pw-set-return {
    font-size: .75rem;
    color: var(--pw-muted);
}

.pw-set-return-due {
    color: var(--bs-danger-text-emphasis);
    font-weight: 600;
}

/* A closed injury: good news, and the one line on the row worth reading as such. */
.pw-set-return-done {
    color: var(--bs-success-text-emphasis);
    font-weight: 600;
}

/* --- Club colors: the pickers next to the figures they paint --- */

.pw-kit {
    display: grid;
    grid-template-columns: minmax(0, 20rem) minmax(0, 1fr);
    gap: 1.25rem;
    align-items: start;
    padding: 1.25rem;
    background: var(--pw-surface);
    border: 1px solid var(--bs-border-color);
    border-radius: .6rem;
    box-shadow: var(--pw-shadow-1);
}

.pw-kit-fields {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: flex-start;
}

.pw-kit-field {
    width: 100%;
}

.pw-kit-preview {
    margin: 0;
}

/* Mown grass rather than the brand's deep green: a club whose kit is dark would
   otherwise disappear into the backdrop of the very preview meant to show it. */
.pw-kit-pitch {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.75rem;
    padding: 1.75rem 1rem;
    background: #35785a;
    background-image: linear-gradient(90deg, rgba(255, 255, 255, .07) 50%, transparent 50%);
    background-size: 3.5rem 100%;
    border-radius: .5rem;
}

.pw-kit-side {
    display: flex;
    align-items: center;
    gap: .35rem;
}

.pw-kit-figure {
    display: block;
    flex-shrink: 0;
    width: 3rem;
}

.pw-kit-figure-wide {
    width: 6rem;
}

    .pw-kit-figure svg {
        width: 100%;
        height: auto;
        display: block;
    }

.pw-kit-vs {
    font-size: .8rem;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, .7);
}

.pw-kit-preview figcaption {
    margin-top: .45rem;
    font-size: .7rem;
    letter-spacing: .08em;
    text-transform: uppercase;
    text-align: center;
    color: var(--pw-muted);
}

/* The date format choice: today's date in each guise, the chosen one framed. */
.pw-date-format {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: flex-start;
    padding: 1.25rem;
    background: var(--pw-surface);
    border: 1px solid var(--bs-border-color);
    border-radius: .6rem;
}

    .pw-date-format fieldset {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr));
        gap: .6rem;
        width: 100%;
        max-width: 40rem;
    }

.pw-date-format-option {
    display: flex;
    align-items: center;
    gap: .7rem;
    padding: .7rem .9rem;
    border: 1px solid var(--bs-border-color);
    border-radius: .5rem;
    cursor: pointer;
}

    .pw-date-format-option:hover {
        border-color: var(--pw-accent);
    }

.pw-date-format-option-on {
    border-color: var(--pw-accent);
    box-shadow: inset 0 0 0 1px var(--pw-accent);
}

.pw-date-format-option .form-check-input {
    margin: 0;
    flex-shrink: 0;
}

.pw-date-format-sample {
    font-size: 1rem;
    font-weight: 600;
}

.pw-date-format-name {
    margin-left: auto;
    font-size: .72rem;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--pw-muted);
}

/* Below the sidebar breakpoint the rail lies down into a chip scroller, so the
   section list never eats a screen's worth of height above the content. */
@media (max-width: 991.98px) {
    .pw-set {
        grid-template-columns: minmax(0, 1fr);
        gap: .85rem;
    }

    .pw-set-rail {
        position: static;
        flex-direction: row;
        align-items: center;
        gap: .35rem;
        padding: .45rem .5rem;
        overflow-x: auto;
        scrollbar-width: thin;
    }

    .pw-set-rail-group {
        display: none;
    }

    .pw-set-rail-link {
        width: auto;
        flex-shrink: 0;
        border-left: 0;
        border-radius: 999px;
        white-space: nowrap;
    }

        .pw-set-rail-link.active {
            border-left: 0;
        }

    .pw-kit {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* ============================================================================
   The club's management lists — teams, drills, coaches, players, members.
   They share the Club Settings row: a grip, the thing drawn as the rest of the
   app draws it, a quiet second line, detail on the right, and actions that stay
   as icons until the pointer is on the row. What differs between pages is only
   what goes in each slot.
   ============================================================================ */

/* A face for the row: initials until the club uploads photographs. */
.pw-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 50%;
    background: color-mix(in srgb, var(--pw-accent), transparent 88%);
    color: var(--pw-accent-text);
    font-family: var(--pw-font-display, inherit);
    font-size: .8rem;
    font-weight: 700;
    letter-spacing: .02em;
    text-transform: uppercase;
    user-select: none;
}

.pw-list-lead {
    flex-shrink: 0;
    display: flex;
    align-items: center;
}

/* The counts and quiet facts that used to need a column each. */
.pw-list-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .3rem .5rem;
    margin-top: .2rem;
    font-family: var(--pw-font-mono);
    font-size: .7rem;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--pw-muted);
}

    .pw-list-meta .sep {
        opacity: .45;
    }

/* A number worth reading at a glance, with its unit underneath rather than
   beside it, so a row of them lines up. */
.pw-list-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 3.1rem;
    line-height: 1.1;
}

.pw-list-stat-value {
    font-size: 1.05rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--pw-ink);
}

.pw-list-stat-label {
    font-family: var(--pw-font-mono);
    font-size: .6rem;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--pw-muted);
}

.pw-list-chip-link {
    text-decoration: none;
}

    .pw-list-chip-link:hover {
        filter: brightness(1.08);
        text-decoration: none;
    }

    .pw-list-chip-link:focus-visible {
        outline: 2px solid var(--pw-accent);
        outline-offset: 2px;
    }

/* --- The strip above a list: what narrows it, and how much is left --- */

.pw-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .5rem;
    margin-bottom: .9rem;
}

.pw-toolbar-search {
    position: relative;
    flex: 1 1 14rem;
    max-width: 22rem;
}

    .pw-toolbar-search .bi {
        position: absolute;
        top: 50%;
        left: .65rem;
        transform: translateY(-50%);
        color: var(--pw-muted);
        pointer-events: none;
    }

    .pw-toolbar-search .form-control {
        padding-left: 2rem;
    }

/* Wide enough for the longest placeholder the filters carry; below that the
   button's label wraps onto a second line and the strip loses its baseline. */
.pw-toolbar-select {
    flex: 0 1 17.5rem;
}

    .pw-toolbar-select .form-select {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

/* The one control that lives on a row rather than in an editor: a member's role
   is the whole point of the members list, so it is changed where it is read. */
.pw-role-select {
    width: auto;
    min-width: 11rem;
}

/* Pushed to the far end: a tally, not a control. */
.pw-toolbar-count {
    margin-left: auto;
    font-family: var(--pw-font-mono);
    font-size: .7rem;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--pw-muted);
    white-space: nowrap;
}

/* The view switch sits after the tally, at the very end of the strip. */
.pw-toolbar-views {
    flex: 0 0 auto;
}

/* A dropdown that needs its label spelled out rather than a placeholder. */
.pw-toolbar-field {
    display: flex;
    flex: 0 1 auto;
    align-items: center;
    gap: .4rem;
}

/* The shared game-model filter stands alone on the pages that still stack their
   filters, so it carries its own bottom margin. Plain CSS rather than Bootstrap's
   mb-3, whose !important would survive into the strip and drop the control a few
   pixels below the ones beside it. */
.pw-gamemodel-filter {
    margin-bottom: 1rem;
}

.pw-toolbar .pw-gamemodel-filter {
    margin-bottom: 0;
}

/* --- The strip that says you are inside somebody else's club --- */

.pw-entered-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .6rem;
    padding: .55rem 1.5rem;
    font-size: .875rem;
    color: #fff;
    /* Deliberately not the club's accent: the point is that this strip is the platform
       speaking, not the club whose pages are underneath it. */
    background-color: #7a4b16;
}

/* --- The strip that says one of the squad has a birthday today --- */

.pw-birthday-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .6rem;
    padding: .55rem 1.5rem;
    font-size: .875rem;
    /* The club's own colour: this is the club's news, unlike the platform strip above. */
    background-color: var(--pw-accent);
    color: var(--pw-accent-contrast);
}

    .pw-birthday-bar .bi {
        font-size: 1.1rem;
    }

    /* Inherits the contrast colour, which a Bootstrap close button (black by default) would not. */
    .pw-birthday-bar .pw-birthday-dismiss {
        margin-left: auto;
        border: 0;
        background: transparent;
        color: inherit;
        opacity: .8;
        line-height: 1;
    }

        .pw-birthday-bar .pw-birthday-dismiss:hover {
            opacity: 1;
        }

/* --- A club's crest, leading its row on the platform's Clubs page --- */

.pw-club-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    object-fit: contain;
    /* A ring from the ink, so a white crest still has an edge on a light surface. */
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--pw-ink), transparent 85%);
}

/* The lettered stand-in wears the club's own colour, which is the point of it. */
.pw-club-logo-empty {
    font-family: var(--pw-font-display);
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1;
}

/* In the editor, where the crest is the thing being changed rather than a marker. */
.pw-club-logo-lg {
    width: 4rem;
    height: 4rem;
}

/* --- A zone's colour, leading its row --- */

.pw-zone-swatch {
    display: inline-flex;
    padding: 0;
    border: 0;
    background: none;
    line-height: 0;
}

    .pw-zone-swatch > span {
        display: block;
        width: 2.2rem;
        height: 1.6rem;
        border-radius: .3rem;
        /* A ring drawn from the ink, so a pale zone still has an edge on the light
           surface and a dark one keeps its edge when the app turns dark. */
        box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--pw-ink), transparent 82%);
    }

    /* The ring belongs on the colour, not on the button box around it. */
    .pw-zone-swatch:focus-visible {
        outline: none;
    }

        .pw-zone-swatch:focus-visible > span {
            outline: 2px solid var(--pw-accent);
            outline-offset: 2px;
        }

/* --- The same things as cards: a grid that keeps its columns readable --- */

.pw-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr));
    gap: .75rem;
}

.pw-drill-card {
    display: flex;
    flex-direction: column;
    gap: .5rem;
    padding: .85rem .95rem;
    border: 1px solid var(--pw-line);
    border-radius: .55rem;
    background: var(--pw-surface, var(--bs-body-bg));
    transition: border-color .15s ease, box-shadow .15s ease;
}

    .pw-drill-card:hover {
        border-color: color-mix(in srgb, var(--pw-accent), transparent 60%);
        box-shadow: 0 .35rem .9rem rgba(0, 0, 0, .06);
    }

.pw-drill-card.dragging {
    outline: 2px solid var(--pw-accent, var(--bs-primary));
    outline-offset: 2px;
    background: var(--bs-primary-bg-subtle);
    cursor: grabbing;
}

    .pw-drill-card.dragging .drag-handle {
        color: var(--pw-accent, var(--bs-primary));
    }

/* The name takes the room; the grip and the actions hold their own width. */
.pw-drill-card-head {
    display: flex;
    align-items: flex-start;
    gap: .4rem;
}

.pw-drill-card-grip {
    flex-shrink: 0;
    padding-top: .1rem;
    color: color-mix(in srgb, var(--pw-muted), transparent 35%);
}

.pw-drill-card-name {
    flex: 1 1 auto;
    min-width: 0;
    margin: 0;
    font-size: 1rem;
    font-weight: 650;
    line-height: 1.3;
    color: var(--pw-ink);
}

.pw-drill-card-phases {
    display: flex;
    flex-wrap: wrap;
    gap: .25rem;
}

/* Three lines of the description: enough to recognise the drill, not so much
   that the cards in a row end up at wildly different heights. */
.pw-drill-card-desc {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin: 0;
    font-size: .875rem;
    color: var(--pw-muted);
}

/* Facts and animations sit at the foot, whatever the description's length. */
.pw-drill-card-facts {
    margin-top: auto;
}

.pw-drill-card-anims {
    padding-top: .1rem;
}

/* --- Rows on a phone: the aside drops under the name rather than squeezing --- */

@media (max-width: 575.98px) {
    .pw-list-row {
        flex-wrap: wrap;
        padding-right: .55rem;
    }

    .pw-list-main {
        flex: 1 1 60%;
    }

    .pw-list-aside {
        order: 3;
        flex-basis: 100%;
        padding-left: 1.4rem;
    }

    .pw-toolbar-count {
        margin-left: 0;
    }
}

/* --- The squad list's own marks --- */

/* Team-sheet shirt number: a chalk ring with the number in the display face. */
.shirt-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2rem;
    height: 2rem;
    padding: 0 .3rem;
    border: 1.5px solid color-mix(in srgb, var(--pw-ink), transparent 65%);
    border-radius: 50%;
    font-size: 1.05rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--pw-ink);
}

.pos-chip {
    display: inline-block;
    margin: .1rem .25rem .1rem 0;
    padding: .1rem .5rem;
    border-radius: 999px;
    font-size: .74rem;
    font-weight: 600;
    letter-spacing: .02em;
    background-color: color-mix(in srgb, var(--pw-accent), transparent 88%);
    color: var(--pw-accent-text);
}

.pos-chip-alt {
    background-color: transparent;
    border: 1px solid var(--pw-line);
    color: var(--pw-muted);
    font-weight: 500;
}

/* Small standing marks next to the name: home grown, loan, sold. */
.pw-player-tag {
    display: inline-block;
    margin-left: .35rem;
    padding: .05rem .35rem;
    border: 1px solid var(--pw-line);
    border-radius: 999px;
    font-family: var(--pw-font-mono);
    font-size: .62rem;
    font-weight: 600;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--pw-muted);
    vertical-align: middle;
}

.pw-player-tag-sold {
    border-style: dashed;
}

/* Away for a spell rather than for good, so it reads as a state, not an exit. */
.pw-player-tag-loan {
    border-style: dashed;
    border-color: #a16207;
    color: #a16207;
}

/* A sold player still belongs on this management list, just quieter. */
.pw-player-sold > td {
    opacity: .68;
}

/* The loans a player has been away on and come back from: a plain record, read
   down the dates, so it never competes with the fields being edited above it. */
.pw-loan-history {
    list-style: none;
    margin: 0;
    padding: 0;
    border: 1px solid var(--pw-line);
    border-radius: .5rem;
    overflow: hidden;
}

.pw-loan-spell {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: .1rem .6rem;
    padding: .4rem .6rem;
    font-size: .85rem;
}

    .pw-loan-spell + .pw-loan-spell {
        border-top: 1px solid var(--pw-line);
    }

/* The dates identify the spell, so they lead and line up down the list. */
.pw-loan-spell-dates {
    flex: 0 0 auto;
    min-width: 12rem;
    font-family: var(--pw-font-mono);
    font-size: .78rem;
    color: var(--pw-muted);
}

.pw-loan-spell-club {
    flex: 1 1 auto;
    font-weight: 600;
}

/* The note wraps under the rest rather than stretching the row. */
.pw-loan-spell-note {
    flex: 1 1 100%;
    color: var(--pw-muted);
    font-style: italic;
}

/* The player's details card: a two-column record, labels quiet and values leading,
   read down the left edge the way an ID card is. */
.pw-details {
    display: grid;
    grid-template-columns: minmax(8rem, auto) 1fr;
    gap: .55rem 1.25rem;
    margin: 0;
}

    .pw-details dt {
        font-size: .72rem;
        font-weight: 600;
        letter-spacing: .06em;
        text-transform: uppercase;
        color: var(--pw-muted);
        align-self: baseline;
    }

    .pw-details dd {
        margin: 0;
        font-weight: 500;
        overflow-wrap: anywhere;
    }

/* Players whose status keeps them off the pitch: listed but muted, not draggable. */
.pw-lineup-sitting-out {
    margin-top: .4rem;
    opacity: .75;
}

.pw-lineup-sitting-out .pw-lineup-chip {
    cursor: default;
}

/* ============================================================================
   Animation editor: a tool rail, the pitch on a felt board, and the frames as a
   filmstrip of thumbnails below it. Item positions are percentages of the
   canvas, so the stored normalized (0..1) coordinates map 1:1 to CSS at any
   size. The rail folds away to give the board the full width.
   ============================================================================ */
.anim-editor {
    background: var(--pw-surface);
    border: 1px solid var(--bs-border-color);
    border-radius: var(--pw-radius, .75rem);
    box-shadow: var(--pw-shadow-1);
    overflow: hidden;
}

.anim-editor-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: .75rem;
    padding: .75rem 1rem;
    background: color-mix(in srgb, var(--pw-chalk), var(--pw-ink) 4%);
    border-bottom: 1px solid var(--bs-border-color);
}

.anim-editor-title {
    display: flex;
    align-items: center;
    gap: .5rem;
    align-self: center;
    font-family: var(--pw-font-display);
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: .02em;
    text-transform: uppercase;
}

    .anim-editor-title .bi {
        color: var(--pw-accent-text);
    }

.anim-editor-field {
    display: flex;
    flex-direction: column;
    gap: .15rem;
    min-width: 8rem;
}

    .anim-editor-field .form-label {
        margin: 0;
        font-size: .7rem;
        font-weight: 600;
        letter-spacing: .05em;
        text-transform: uppercase;
        color: var(--bs-secondary-color);
    }

.anim-editor-field-grow {
    flex: 1 1 12rem;
}

.anim-editor-head-actions {
    display: flex;
    gap: .5rem;
    margin-left: auto;
}

.anim-editor-layout {
    display: grid;
    grid-template-columns: 16.5rem minmax(0, 1fr);
    gap: 1rem;
    padding: 1rem;
}

.anim-editor-rail-closed .anim-editor-layout {
    grid-template-columns: minmax(0, 1fr);
}

.anim-editor-rail-closed .anim-rail {
    display: none;
}

/* ---- The tool rail ---- */

.anim-rail {
    position: sticky;
    top: 1rem;
    align-self: start;
    max-height: calc(100vh - 6rem);
    overflow-y: auto;
    overscroll-behavior: contain;
    padding-right: .25rem;
}

.anim-group {
    border: 1px solid var(--bs-border-color);
    border-radius: .6rem;
    background: color-mix(in srgb, var(--pw-chalk), var(--pw-surface) 55%);
    margin-bottom: .5rem;
}

.anim-group-summary {
    display: flex;
    align-items: center;
    gap: .4rem;
    padding: .45rem .6rem;
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .07em;
    text-transform: uppercase;
    color: var(--bs-secondary-color);
    cursor: pointer;
    list-style: none;
}

    .anim-group-summary::-webkit-details-marker {
        display: none;
    }

    .anim-group-summary::before {
        content: "";
        width: .32rem;
        height: .32rem;
        border-right: 2px solid currentColor;
        border-bottom: 2px solid currentColor;
        transform: rotate(-45deg);
        transition: transform .15s ease;
    }

.anim-group[open] > .anim-group-summary::before {
    transform: rotate(45deg);
}

.anim-group-body {
    padding: 0 .6rem .6rem;
}

.anim-group-row {
    display: flex;
    align-items: center;
    gap: .4rem;
    margin: .5rem 0 .3rem;
}

.anim-group-label {
    flex: 1 1 auto;
    font-size: .75rem;
    font-weight: 600;
    color: var(--bs-secondary-color);
}

.anim-group-hint,
.anim-rail-foot {
    margin: .5rem 0 0;
    font-size: .72rem;
    line-height: 1.35;
    color: var(--bs-secondary-color);
}

/* The panel for whatever is selected on the pitch: the one place its color,
   size and facing can be set without hunting for a handle. */
.anim-inspector {
    padding: .6rem;
    margin-bottom: .6rem;
    border: 1px solid color-mix(in srgb, var(--pw-accent), transparent 55%);
    border-left-width: 3px;
    border-radius: .6rem;
    background: color-mix(in srgb, var(--pw-accent), var(--pw-surface) 92%);
}

.anim-inspector-head {
    display: flex;
    align-items: center;
    gap: .45rem;
    margin-bottom: .45rem;
}

.anim-inspector-icon {
    display: grid;
    place-items: center;
    width: 1.9rem;
    height: 1.9rem;
    background: var(--pw-surface);
    border: 1px solid var(--bs-border-color);
    border-radius: .4rem;
}

    .anim-inspector-icon svg {
        display: block;
        width: 1.4rem;
        height: 1.4rem;
    }

.anim-inspector-name {
    flex: 1 1 auto;
    font-weight: 600;
    font-size: .85rem;
}

.anim-inspector-close {
    padding: 0;
    line-height: 1;
    font-size: .7rem;
    color: var(--bs-secondary-color);
    background: none;
    border: none;
}

.anim-inspector-row {
    display: flex;
    align-items: center;
    gap: .5rem;
    margin-bottom: .35rem;
    font-size: .78rem;
}

    .anim-inspector-row > span:first-child {
        flex: 0 0 3.2rem;
        color: var(--bs-secondary-color);
    }

.anim-inspector-range {
    flex: 1 1 auto;
    min-width: 0;
}

.anim-inspector-value {
    flex: 0 0 2.6rem;
    text-align: right;
    font-family: var(--pw-font-mono);
    font-size: .72rem;
    color: var(--bs-secondary-color);
}

/* An area's size is a phrase ("30 x 25 m"), not a figure, so it needs the room. */
.anim-inspector-value-wide {
    flex: 0 0 auto;
    margin-left: auto;
}

/* The size the slider is setting, typed instead of dragged. Sits in the same column the
   read-out used to, with the unit outside the field so the number stays a plain number. */
.anim-inspector-number {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: .15rem;
    font-family: var(--pw-font-mono);
    font-size: .72rem;
    color: var(--bs-secondary-color);
}

    .anim-inspector-number input {
        width: 3.4rem;
        padding: .1rem .25rem;
        font-family: var(--pw-font-mono);
        font-size: .72rem;
        text-align: right;
    }

    /* The spinners would leave no room for the digits at this width. */
    .anim-inspector-number input::-webkit-outer-spin-button,
    .anim-inspector-number input::-webkit-inner-spin-button {
        appearance: none;
        margin: 0;
    }

    .anim-inspector-number input[type="number"] {
        -moz-appearance: textfield;
    }

.anim-inspector-hint {
    margin: .4rem 0;
    font-size: .72rem;
    line-height: 1.35;
    color: var(--bs-secondary-color);
}

.anim-inspector-actions {
    display: flex;
    gap: .35rem;
}

    .anim-inspector-actions .btn {
        flex: 1 1 auto;
        font-size: .72rem;
    }

/* ---- The toolbar above the board ---- */

.anim-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .3rem;
    padding: .35rem .5rem;
    margin-bottom: .6rem;
    background: color-mix(in srgb, var(--pw-chalk), var(--pw-ink) 5%);
    border: 1px solid var(--bs-border-color);
    border-radius: .6rem;
}

.anim-toolbar-divider {
    width: 1px;
    height: 1.3rem;
    margin: 0 .2rem;
    background: var(--bs-border-color);
}

.anim-toolbar-status {
    margin-left: auto;
    padding-left: .5rem;
    font-size: .75rem;
    color: var(--bs-secondary-color);
    white-space: nowrap;
}

.anim-icon-btn {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    min-width: 2rem;
    height: 2rem;
    padding: 0 .45rem;
    justify-content: center;
    font-size: .85rem;
    color: var(--bs-body-color);
    background: var(--pw-surface);
    border: 1px solid var(--bs-border-color);
    border-radius: .45rem;
}

    .anim-icon-btn:hover:not(:disabled) {
        border-color: var(--pw-accent);
        color: var(--pw-accent-text);
    }

    .anim-icon-btn:disabled {
        opacity: .4;
    }

    .anim-icon-btn.is-on {
        color: var(--pw-accent-contrast);
        background: var(--pw-accent);
        border-color: var(--pw-accent);
    }

.anim-icon-btn-accent {
    color: var(--pw-accent-contrast);
    background: var(--pw-accent);
    border-color: var(--pw-accent);
    font-weight: 600;
}

    .anim-icon-btn-accent:hover:not(:disabled) {
        color: var(--pw-accent-contrast);
        filter: brightness(1.08);
    }

.anim-icon-btn-text {
    font-size: .78rem;
}

.anim-speed {
    width: 5.4rem;
    height: 2rem;
    padding-block: 0;
    font-size: .78rem;
}

/* How far playback has got; driven straight from js so it stays smooth. */
.anim-progress {
    flex: 1 1 4rem;
    min-width: 3rem;
    height: .3rem;
    margin: 0 .3rem;
    background: color-mix(in srgb, var(--pw-ink), transparent 88%);
    border-radius: 1rem;
    overflow: hidden;
}

.anim-progress-bar {
    width: 0;
    height: 100%;
    background: var(--pw-accent);
    border-radius: inherit;
}

/* ---- The board the pitch lies on ---- */

.anim-board {
    display: flex;
    justify-content: center;
    padding: 1rem;
    border-radius: .9rem;
    background:
        radial-gradient(130% 100% at 50% -10%, rgba(255, 255, 255, .10), transparent 62%),
        linear-gradient(180deg, #164836, #0a2a20);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .10), inset 0 -14px 28px rgba(0, 0, 0, .22);
}

.anim-toolbox-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .4rem;
}

.anim-tool {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .25rem;
    padding: .4rem .25rem;
    font-size: .72rem;
    color: var(--bs-body-color);
    background: var(--bs-tertiary-bg, rgba(0, 0, 0, .03));
    border: 1px solid var(--bs-border-color);
    border-radius: .5rem;
    cursor: grab;
    touch-action: none;
}

    .anim-tool:hover:not(:disabled) {
        border-color: var(--pw-accent, var(--bs-primary));
    }

    .anim-tool svg {
        width: 2.2rem;
        height: 1.6rem;
    }

/* Arrows read better wide and short than boxed into a square cell. */
.anim-toolbox-grid-wide .anim-tool svg {
    width: 3rem;
    height: 1.1rem;
}

/* All 100 numbers per collection as a compact grid of small circles. */
.anim-button-grid {
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    gap: 2px;
}

/* Each grid button holds the very same svg the item gets on the pitch. */
.anim-number-btn {
    aspect-ratio: 1;
    min-width: 0;
    padding: 0;
    border: none;
    background: none;
    border-radius: 50%;
    cursor: grab;
    touch-action: none;
}

    .anim-number-btn svg {
        display: block;
        width: 100%;
        height: 100%;
        pointer-events: none;
    }

    .anim-number-btn:hover:not(:disabled) {
        outline: 2px solid var(--pw-accent, var(--bs-primary));
        outline-offset: 1px;
    }

/* The armed figure's wide wing span makes its body circle small inside a square
   svg, so the arms grid uses fewer, larger cells and lets the svg spill slightly
   over its cell to keep the numbers readable. */
.anim-button-grid-arms {
    grid-template-columns: repeat(7, 1fr);
    column-gap: 3px;
}

    .anim-button-grid-arms .anim-number-btn svg {
        width: 112%;
        height: 112%;
        margin: -6%;
    }

.anim-color-picker {
    width: 1.6rem;
    height: 1.3rem;
    padding: 0;
    border: 1px solid var(--bs-border-color);
    border-radius: .3rem;
    background: none;
    cursor: pointer;
}

.anim-color-undo {
    color: var(--bs-secondary-color);
    line-height: 1;
}

    .anim-color-undo:disabled {
        opacity: .35;
    }

/* Alignment cue: while an item is dragged level with another of its own sort, a thin
   line runs the length of the pitch through both of them. Added by js/align-guides.js
   for the length of the gesture only, so it never takes a pointer or prints. */
.pw-align-guide {
    position: absolute;
    z-index: 3;
    pointer-events: none;
    background: var(--pw-accent, var(--bs-primary));
    opacity: .75;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, .55);
}

.pw-align-guide-v {
    top: 0;
    bottom: 0;
    width: 1px;
    transform: translateX(-.5px);
}

.pw-align-guide-h {
    left: 0;
    right: 0;
    height: 1px;
    transform: translateY(-.5px);
}

/* Ghost that follows the pointer while dragging a toolbox item onto the pitch. */
.anim-tool-ghost {
    position: fixed;
    z-index: 2000;
    width: 2.4rem;
    transform: translate(-50%, -50%);
    opacity: .8;
    pointer-events: none;
    transition: transform .12s ease, opacity .12s ease;
}

    .anim-tool-ghost svg {
        display: block;
        width: 100%;
        height: auto;
    }

    .anim-tool-ghost > * {
        pointer-events: none;
    }

.anim-tool-ghost-droppable {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.15);
}

/* The pitch lights up while a dragged toolbox item is over it. */
.anim-canvas-droptarget {
    outline: 3px solid var(--pw-accent, var(--bs-primary));
    outline-offset: 3px;
}

.anim-number-input {
    max-width: 6rem;
}

.anim-caption-field {
    min-width: 12rem;
}

/* The frame's text below the animation; min-height keeps the layout steady when
   frames without text play. */
.anim-caption {
    min-height: 1.6rem;
    margin-top: .5rem;
    text-align: center;
    font-size: .95rem;
    color: var(--bs-body-color);
}

/* ---- The filmstrip: every frame as a thumbnail of the pitch ---- */

.anim-timeline {
    display: flex;
    align-items: stretch;
    gap: .5rem;
    padding: .6rem .25rem;
    overflow-x: auto;
    scroll-snap-type: x proximity;
}

.anim-frame-tile,
.anim-frame-add {
    flex: 0 0 7.5rem;
    scroll-snap-align: center;
    padding: .3rem;
    background: var(--pw-surface);
    border: 1px solid var(--bs-border-color);
    border-radius: .55rem;
    cursor: pointer;
    transition: border-color .12s ease, box-shadow .12s ease, transform .12s ease;
}

    .anim-frame-tile:hover:not(:disabled),
    .anim-frame-add:hover:not(:disabled) {
        border-color: var(--pw-accent);
        transform: translateY(-1px);
    }

    .anim-frame-tile.is-current {
        border-color: var(--pw-accent);
        box-shadow: 0 0 0 2px color-mix(in srgb, var(--pw-accent), transparent 65%);
    }

    .anim-frame-tile.is-playing {
        border-color: var(--pw-accent);
        box-shadow: 0 0 0 2px var(--pw-accent);
    }

    .anim-frame-tile:disabled {
        cursor: default;
    }

.anim-frame-tile-head {
    display: flex;
    align-items: baseline;
    gap: .3rem;
    padding: 0 .1rem .25rem;
}

.anim-frame-tile-index {
    font-family: var(--pw-font-display);
    font-size: .95rem;
    font-weight: 700;
    line-height: 1;
}

.anim-frame-tile-caption {
    display: block;
    margin-top: .25rem;
    font-size: .68rem;
    line-height: 1.25;
    color: var(--bs-secondary-color);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.anim-frame-add {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .3rem;
    font-size: .75rem;
    color: var(--bs-secondary-color);
    border-style: dashed;
    background: none;
}

/* ---- The controls for the frame being edited ---- */

.anim-frame-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: .75rem;
    padding: .6rem .7rem;
    background: color-mix(in srgb, var(--pw-chalk), var(--pw-ink) 4%);
    border: 1px solid var(--bs-border-color);
    border-radius: .6rem;
}

.anim-frame-bar-actions {
    display: flex;
    gap: .3rem;
    margin-left: auto;
}

.anim-preview-canvas {
    position: relative;
    display: block;
    pointer-events: none;
}

    /* Same sizing as the main canvas: the image fills the preview's width so the
       normalized item coordinates keep lining up at the smaller scale. */
    .anim-preview-canvas img.anim-bg {
        display: block;
        width: 100%;
        height: auto;
        border-radius: .4rem;
        pointer-events: none;
    }

    .anim-preview-canvas .anim-item {
        cursor: default;
        pointer-events: none;
    }

    /* Arrows are built from fixed-size CSS parts, so they need trimming down to
       thumbnail scale. */
    .anim-preview-canvas .anim-arrow {
        height: .5rem;
    }

        .anim-preview-canvas .anim-arrow .anim-arrow-shaft {
            right: .22rem;
            height: 2px;
        }

        .anim-preview-canvas .anim-arrow .anim-arrow-head {
            right: -.04rem;
            border-left-width: .3rem;
            border-top-width: .19rem;
            border-bottom-width: .19rem;
        }

/* The coordinate anchor: the background image sets the size and items are
   positioned with percentages of this element. touch-action none: touch devices
   must drag items, not scroll. */
.anim-canvas {
    position: relative;
    user-select: none;
    touch-action: none;
    width: 100%;
    max-width: 32rem;
}

    .anim-canvas img.anim-bg {
        display: block;
        width: 100%;
        height: auto;
        border-radius: .5rem;
        pointer-events: none;
    }

.anim-board .anim-canvas {
    box-shadow: 0 10px 26px rgba(0, 0, 0, .3);
    border-radius: .5rem;
}

.anim-item {
    position: absolute;
    cursor: grab;
    z-index: 1;
}

    .anim-item svg {
        display: block;
        width: 100%;
        height: auto;
    }

.anim-item-selected {
    outline: 2px solid var(--pw-accent, var(--bs-primary));
    outline-offset: 2px;
    border-radius: .3rem;
}

/* Nothing on the pitch yet: say so over the middle of it, without swallowing
   the pointer that is about to drop the first item. */
.anim-empty {
    position: absolute;
    left: 50%;
    top: 50%;
    z-index: 2;
    width: min(20rem, 84%);
    transform: translate(-50%, -50%);
    padding: .8rem 1rem;
    text-align: center;
    font-size: .85rem;
    line-height: 1.4;
    color: #f2f5f1;
    background: rgba(10, 30, 23, .74);
    border: 1px dashed rgba(255, 255, 255, .35);
    border-radius: .6rem;
    pointer-events: none;
}

    .anim-empty .bi {
        display: block;
        margin-bottom: .3rem;
        font-size: 1.2rem;
        opacity: .85;
    }

/* ---- Arrows: a bar laid along the line between the frame's two points ---- */

.anim-arrow {
    height: 1rem;
    transform-origin: 0 50%;
    z-index: 0; /* Players and the ball read on top of the arrows. */
}

    .anim-arrow .anim-arrow-shaft {
        position: absolute;
        left: 0;
        right: .42rem;
        top: 50%;
        height: 3px;
        transform: translateY(-50%);
        background: currentColor;
        border-radius: 2px;
    }

/* A run is drawn dashed, the way a coach draws a player moving without the ball. */
.anim-arrow-run .anim-arrow-shaft {
    background: repeating-linear-gradient(90deg, currentColor 0 7px, transparent 7px 13px);
    border-radius: 0;
}

.anim-arrow .anim-arrow-head {
    position: absolute;
    right: -.08rem;
    top: 50%;
    width: 0;
    height: 0;
    transform: translateY(-50%);
    border-left: .55rem solid currentColor;
    border-top: .34rem solid transparent;
    border-bottom: .34rem solid transparent;
}

/* The outline box of a turned bar is misleading, so a selected arrow is marked
   by the handles on its ends instead. */
.anim-arrow.anim-item-selected {
    outline: none;
}

.anim-arrow-end {
    position: absolute;
    top: 50%;
    width: .8rem;
    height: .8rem;
    margin: -.4rem 0 0 -.4rem;
    background: var(--pw-surface, #fff);
    border: 2px solid var(--pw-accent, var(--bs-primary));
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .4);
    cursor: grab;
}

    .anim-arrow-end[data-end="start"] {
        left: 0;
    }

    .anim-arrow-end[data-end="end"] {
        left: 100%;
    }

/* Onion skin: where everything stood one frame ago. Untouchable, so it never
   gets in the way of the frame being edited. */
.anim-ghost {
    position: absolute;
    z-index: 0;
    opacity: .3;
    filter: grayscale(.35);
    pointer-events: none;
}

    .anim-ghost svg {
        display: block;
        width: 100%;
        height: auto;
    }

/* Drag handle for rotating goals and cones: a small knob above the item,
   connected by a short stem. It lives inside the rotated element, so it
   travels around the item as the rotation changes. */
.anim-rotate-handle {
    position: absolute;
    left: 50%;
    top: -1.35rem;
    width: .85rem;
    height: .85rem;
    transform: translateX(-50%);
    background: var(--pw-accent, var(--bs-primary));
    border: 2px solid #fff;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .4);
    cursor: grab;
}

    .anim-rotate-handle::after {
        content: "";
        position: absolute;
        left: 50%;
        top: 100%;
        width: 2px;
        height: .55rem;
        transform: translateX(-50%);
        background: var(--pw-accent, var(--bs-primary));
    }

/* Drag handle for resizing goals: a small square knob at the bottom-right corner.
   It lives inside the (possibly rotated) element so it follows the item's frame. */
.anim-resize-handle {
    position: absolute;
    right: -.55rem;
    bottom: -.55rem;
    width: .8rem;
    height: .8rem;
    background: var(--pw-accent, var(--bs-primary));
    border: 2px solid #fff;
    border-radius: .15rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .4);
    cursor: nwse-resize;
}

.anim-playing .anim-item {
    cursor: default;
    pointer-events: none;
}

.anim-playing .anim-ghost {
    display: none;
}

.anim-canvas-readonly .anim-item {
    cursor: default;
    pointer-events: none;
}

/* The pop-up player: the pitch shrinks to fit the viewport height, whatever the
   background's aspect ratio. The canvas hugs the image so the normalized item
   coordinates stay aligned. */
.anim-player .anim-canvas {
    width: fit-content;
    max-width: 100%;
    margin: 0 auto;
}

    .anim-player .anim-canvas img.anim-bg {
        width: auto;
        max-width: 100%;
        max-height: calc(100vh - 16rem);
    }

.anim-frame-duration {
    font-family: var(--pw-font-mono);
    font-size: .65rem;
    color: var(--bs-secondary-color);
}

/* Narrow screens: the rail moves above the board, and the board loses its
   padding so the pitch keeps as much width as it can. */
@media (max-width: 991.98px) {
    .anim-editor-layout {
        grid-template-columns: minmax(0, 1fr);
        padding: .75rem;
    }

    /* Groups sit side by side so the stacked rail stays short and the pitch is
       still within reach without a long scroll. */
    .anim-rail {
        position: static;
        max-height: none;
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
        gap: 0 .5rem;
        align-items: start;
    }

    /* Full width would blow the number circles up to thumb-sized blobs. */
    .anim-button-grid {
        max-width: 20rem;
    }

    .anim-board {
        padding: .5rem;
    }

    .anim-toolbar-status {
        width: 100%;
        margin-left: 0;
        padding-left: 0;
    }
}

/* ============================================================================
   Accessibility: skip link for keyboard users.
   ============================================================================ */
.skip-link {
    position: absolute;
    top: -100px;
    left: .75rem;
    z-index: 2000;
    padding: .5rem 1rem;
    background-color: var(--pw-ink);
    color: var(--pw-chalk);
    border-radius: 0 0 .4rem .4rem;
    text-decoration: none;
}

    .skip-link:focus {
        top: 0;
        color: var(--pw-chalk);
    }

/* ============================================================================
   Print: strip the chrome so schedules and lists print cleanly.
   ============================================================================ */
@media print {
    .sidebar, .top-row, .toast-host, .skip-link, .btn, .modal, #blazor-error-ui {
        display: none !important;
    }

    body, .page, article {
        background: #fff !important;
        color: #000 !important;
    }

    article {
        max-width: none !important;
        padding: 0 !important;
    }

    .card, .table-responsive {
        box-shadow: none !important;
        border-color: #999 !important;
    }

    a {
        color: #000 !important;
        text-decoration: none !important;
    }
}

/* ---------------------------------------------------------------------------
   Games: principle result rows and the drill cards on a training day.
--------------------------------------------------------------------------- */

/* Outcome rows carry a colored spine like the calendar's session cards. */
.pw-result-success {
    box-shadow: inset 3px 0 0 var(--bs-success);
}

.pw-result-failed {
    box-shadow: inset 3px 0 0 var(--bs-danger);
}

/* A select-looking control that opens a searchable list. Anchored so the menu hangs off
   the field, and above what follows it on the form. */
.pw-picker {
    position: relative;
}

.pw-picker-toggle::after {
    /* The select's own caret; the button has none of its own. */
    content: "";
    position: absolute;
    top: 50%;
    right: .75rem;
    transform: translateY(-25%);
    border: .3rem solid transparent;
    border-top-color: currentColor;
    opacity: .6;
}

.pw-picker-menu {
    position: absolute;
    z-index: 1000;
    top: calc(100% + .2rem);
    left: 0;
    right: 0;
    padding: .4rem;
    background-color: var(--pw-surface, #fff);
    border: 1px solid var(--pw-line, #dee2e6);
    border-radius: .375rem;
    box-shadow: 0 .5rem 1rem rgba(0, 0, 0, .12);
}

.pw-picker-search {
    margin-bottom: .35rem;
}

/* Long lists scroll rather than running off the bottom of the page. */
.pw-picker-options {
    max-height: 13rem;
    overflow-y: auto;
}

.pw-picker-option {
    display: block;
    width: 100%;
    padding: .3rem .5rem;
    text-align: left;
    background: none;
    border: 0;
    border-radius: .25rem;
    color: inherit;
}

    .pw-picker-option:hover {
        background-color: color-mix(in srgb, var(--pw-accent), transparent 90%);
    }

.pw-picker-option-on {
    font-weight: 600;
    background-color: color-mix(in srgb, var(--pw-accent), transparent 85%);
}

.pw-picker-empty,
.pw-picker-error {
    padding: .3rem .5rem;
    color: var(--bs-secondary-color);
}

.pw-picker-error {
    color: var(--bs-danger);
}

.pw-picker-create {
    display: block;
    width: 100%;
    margin-top: .35rem;
    padding: .3rem .5rem;
    text-align: left;
    background: none;
    border: 0;
    border-top: 1px solid var(--pw-line, #dee2e6);
    border-radius: 0;
    color: var(--bs-primary);
    font-size: .875rem;
}

    .pw-picker-create:hover:not(:disabled) {
        background-color: color-mix(in srgb, var(--bs-primary), transparent 90%);
    }

/* A card header that is itself the expand/collapse control, so the whole banner is the
   click target rather than a button parked at its right edge. */
.pw-banner-toggle {
    width: 100%;
    /* Keep the header's own bottom rule; a button's default box is what has to go.
       The rounded top corners come from Bootstrap's .card-header:first-child. */
    border-top: 0;
    border-left: 0;
    border-right: 0;
    color: var(--pw-ink);
}

    .pw-banner-toggle:hover {
        background-color: color-mix(in srgb, var(--pw-accent), transparent 90%);
    }

/* Expandable drill summary on a training day. */
.pw-drill-card {
    background-color: var(--pw-surface);
    overflow: hidden;
}

.pw-drill-card-header {
    /* Room on the right for the caret, which sits out of the wrapping flow. */
    padding: .55rem 2rem .55rem .75rem;
    background: none;
    border: none;
    color: var(--pw-ink);
    position: relative;
    /* A row too narrow for name and phases side by side gives the phases their own line
       instead of running them off the card. */
    flex-wrap: wrap;
    /* What the phase badges size themselves against; see .pw-phase-badge. */
    container: drill-row / inline-size;
}

/* The open/closed caret keeps the top right corner however the row wraps, so it reads as
   the whole card's control rather than as the tail of the badges. */
.pw-drill-card-caret {
    position: absolute;
    top: .55rem;
    right: .75rem;
}

    .pw-drill-card-header:hover {
        background-color: color-mix(in srgb, var(--pw-accent), transparent 93%);
    }

.pw-drill-card-mark {
    color: var(--pw-accent);
    flex-shrink: 0;
}

/* The name is what the row is read for, so it takes the space and keeps a floor the
   badges cannot squeeze it below. It is measured at that floor rather than at its own
   length, so a long name grows into the room left over instead of pushing the badges
   down a line on a row wide enough to hold them. */
.pw-drill-row-name {
    flex: 1 1 7rem;
    min-width: 7rem;
}

/* The phases as one travelling group: they wrap among themselves once they are on a
   line of their own. */
.pw-drill-card-phases {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    min-width: 0;
}

/* The warm-up and extra work cards flanking the blocks: same picker as a block's, so
   the three sections read as one list of the session. */
.pw-section-add {
    width: auto;
    max-width: 14rem;
}

/* The three session sections a drill can be marked for: one line while there is room. */
.pw-uses-picker {
    display: flex;
    flex-wrap: wrap;
    gap: .35rem 1.25rem;
    padding: .45rem .75rem;
    border: 1px solid var(--pw-line);
    border-radius: .5rem;
    background-color: var(--pw-surface);
}

    .pw-uses-picker .form-check {
        margin-bottom: 0;
    }

/* Phase badges give way instead: their initials until the row itself is wide enough for
   the full phase. Measured on the row rather than the window, because the same card sits
   in a narrow column on the training day and full width elsewhere. The title carries the
   whole phase name either way. */
.pw-phase-badge {
    flex-shrink: 0;
    white-space: nowrap;
}

.pw-phase-full {
    display: none;
}

@container drill-row (min-width: 34rem) {
    .pw-phase-full {
        display: inline;
    }

    .pw-phase-short {
        display: none;
    }
}

.pw-drill-card-open .pw-drill-card-header {
    border-bottom: 1px solid var(--pw-line);
}

.pw-drill-card-body {
    padding: .75rem;
}

.pw-drill-card-points {
    padding-left: 1.2rem;
    margin-bottom: 0;
}

    .pw-drill-card-points li + li {
        margin-top: .15rem;
    }

/* A drill's rules and coaching points on a training day, side by side while there is
   room so a coach reads the whole session at a glance. */
.pw-drill-lists {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
    gap: .75rem;
    margin-bottom: .5rem;
}

.pw-drill-list-head {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: .35rem;
    margin-bottom: .25rem;
}

/* Lines this session added: tinted so it is obvious they are not on the drill itself. */
.pw-drill-line-day {
    color: var(--pw-accent);
}

.pw-drill-line-input {
    display: inline-block;
    width: auto;
    min-width: 10rem;
    max-width: 100%;
    color: var(--pw-ink);
}

.pw-drill-line-tag {
    margin-left: .25rem;
    font-size: .65rem;
    vertical-align: middle;
}

.pw-drill-list-add {
    display: flex;
    gap: .35rem;
    margin-top: .35rem;
}

/* Ordered short-text lists (a drill's rules, its coaching points). */
.pw-line-editor-row {
    display: flex;
    gap: .5rem;
    margin-bottom: .5rem;
}

.pw-line-editor-index {
    align-self: center;
    min-width: 1.25rem;
    font-size: .875rem;
    color: var(--bs-secondary-color);
}

/* Named animations offered as play chips wherever drills are listed, so a pattern
   can be watched without opening the drill it belongs to. */
.pw-anim-chips {
    display: flex;
    flex-wrap: wrap;
    gap: .25rem;
}

.pw-anim-chip {
    display: inline-flex;
    align-items: center;
    gap: .25rem;
    max-width: 12rem;
    padding: .1rem .5rem .1rem .35rem;
    font-size: .8rem;
    color: var(--pw-ink);
    background-color: color-mix(in srgb, var(--bs-success), transparent 90%);
    border: 1px solid color-mix(in srgb, var(--bs-success), transparent 65%);
    border-radius: 1rem;
    cursor: pointer;
}

    .pw-anim-chip .bi {
        color: var(--bs-success);
    }

    .pw-anim-chip:hover:not(:disabled),
    .pw-anim-chip:focus-visible:not(:disabled) {
        background-color: color-mix(in srgb, var(--bs-success), transparent 78%);
        border-color: var(--bs-success);
    }

    .pw-anim-chip:disabled {
        color: var(--bs-secondary-color);
        background-color: transparent;
        border-color: var(--pw-line);
        cursor: default;
    }

        .pw-anim-chip:disabled .bi {
            color: var(--bs-secondary-color);
        }

.pw-anim-chip-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Zone overlays on the animation pitch: decoration only, never a pointer target,
   so dragging an item across a zone keeps working. */
.anim-zone {
    position: absolute;
    border: 2px solid;
    border-radius: .3rem;
    pointer-events: none;
}

.anim-zone-ellipse {
    border-radius: 50%;
}

/* Color dot next to an added zone's name in the editor toolbox. */
.anim-zone-swatch {
    display: inline-block;
    width: .6rem;
    height: .6rem;
    border-radius: 50%;
    margin-right: .25rem;
    vertical-align: baseline;
}

/* ============================================================================
   Body map: clickable front/back silhouettes for picking an injury location.
   The figure is built from the region shapes, so everything visible is a target.
   ============================================================================ */
.body-map-figures {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
}

.body-map-figure {
    margin: 0;
    flex: 0 1 10rem;
    min-width: 0;
}

.body-map-figure svg {
    width: 100%;
    height: auto;
    display: block;
}

.body-map-caption {
    text-align: center;
    font-size: .62rem;
    text-transform: uppercase;
    letter-spacing: .18em;
    color: var(--bs-secondary-color);
    margin-top: .25rem;
}

.body-map-region {
    fill: var(--bs-secondary-bg);
    stroke: var(--bs-border-color);
    stroke-width: 0.8;
    cursor: pointer;
    transition: fill .12s ease;
}

.body-map-region:hover {
    fill: color-mix(in srgb, var(--pw-accent) 35%, var(--bs-secondary-bg));
}

.body-map-region:focus-visible {
    outline: none;
    stroke: var(--pw-accent);
    stroke-width: 2;
}

.body-map-region-selected {
    fill: var(--pw-accent);
    stroke: color-mix(in srgb, var(--pw-accent) 70%, black);
}

.body-map-disabled .body-map-region {
    cursor: default;
    pointer-events: none;
}

.body-map-status {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: .75rem;
    margin-top: .35rem;
    font-size: .875rem;
}

.body-map-selected-name {
    font-weight: 600;
}

.body-map-other {
    font-size: .78rem;
    white-space: nowrap;
}

/* Per-day drill duration: badge always visible in the header, narrow editor in the body. */
.pw-drill-duration {
    font-weight: 600;
    white-space: nowrap;
}

/* Work / Rest / Sets and the total they add up to. The fields keep their labels beside
   them and wrap as a set, so a narrow card drops the total to its own line rather than
   squeezing the inputs. */
.pw-drill-prescription {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .5rem .75rem;
}

.pw-drill-prescription-field {
    display: flex;
    align-items: center;
    gap: .35rem;
}

    .pw-drill-prescription-field input {
        width: 5rem;
    }

.pw-drill-prescription-total {
    white-space: nowrap;
}

/* Per-day removal "x" inside a principle badge on a drill card. */
.pw-badge-remove {
    border: 0;
    padding: 0;
    margin-left: .2rem;
    background: transparent;
    color: inherit;
    opacity: .55;
    line-height: 1;
    vertical-align: text-bottom;
    cursor: pointer;
}

    .pw-badge-remove:hover,
    .pw-badge-remove:focus-visible {
        opacity: 1;
        color: var(--bs-danger);
    }

/* Small screens: safe-area padding for phones with notches. */
@media (max-width: 640.98px) {
    body {
        padding-left: env(safe-area-inset-left);
        padding-right: env(safe-area-inset-right);
    }
}

/* A day with nothing scheduled at all. Deliberately unlike a session card: no
   surface, no spine, just a dashed outline so it reads as rest at a glance. */
.pw-dayoff {
    display: inline-flex;
    align-items: center;
    gap: .25rem;
    font-family: var(--pw-font-mono);
    font-size: .62rem;
    text-transform: uppercase;
    letter-spacing: .1em;
    color: var(--pw-muted);
    padding: .05rem .35rem;
    border: 1px dashed var(--pw-line);
    border-radius: 999px;
    background-color: transparent;
}

/* Player Availability week matrix. */
.pw-availability-week th, .pw-availability-week td {
    min-width: 9.5rem;
}

.pw-availability-week .pw-week-name-col {
    min-width: 11rem;
    position: sticky;
    left: 0;
    /* Must be opaque to mask columns scrolling underneath, but identical to the card surface. */
    background-color: var(--bs-card-bg, var(--bs-body-bg));
    z-index: 1;
}

/* The name column pins to the scroll container's content edge, so the container's own
   horizontal padding would leave a strip beside it for the scrolled columns to show
   through. The inset moves onto the edge cells instead, which leaves the text where it
   was and lets the opaque name column reach the card's border.

   The block padding goes for the same reason: the pinned date row sticks to the padding
   edge, so any inset above it is a strip the squad scrolls through in plain sight.

   The container is also capped at the viewport, making it the vertical scroller: sticky
   cells can only pin against their own scroll container, so this is what lets the date
   row stay put while a long squad scrolls underneath it. */
.pw-week-scroll {
    padding: 0;
    max-height: calc(100vh - 8rem);
    max-height: calc(100dvh - 8rem);
    overflow: auto;
}

/* The date row rides along the top the way the names do along the left. The second
   header row (sessions, "Add training") scrolls away with the body: pinning it too
   would cost a phone half its screen. */
.pw-availability-week thead tr:first-child > th {
    position: sticky;
    top: 0;
    background-color: var(--bs-card-bg, var(--bs-body-bg));
    z-index: 2;
    /* Collapsed-table borders scroll off with the content, so the pinned row draws
       its own dividing line. */
    box-shadow: inset 0 -1px 0 var(--pw-line);
}

    /* The corner cell pins on both axes and must win over the pinned dates and the
       pinned names alike. */
    .pw-availability-week thead tr:first-child > th.pw-week-name-col {
        z-index: 3;
    }

    /* .75rem of container inset plus the .25rem this table already gives its cells. */
    .pw-week-scroll .pw-availability-week > * > tr > :first-child {
        padding-left: 1rem;
    }

    .pw-week-scroll .pw-availability-week > * > tr > :last-child {
        padding-right: 1rem;
    }

/* One player is one band of color. A long name has to wrap in a column this narrow, and
   two lines of a wrapped name read as two players if the only thing telling them apart is
   the hairline between rows. The stripe has to be opaque, since the name column is what
   masks the days scrolling under it. */
.pw-availability-week tbody tr:nth-child(even) > td {
    background-color: color-mix(in srgb, var(--pw-ink) 4%, var(--pw-surface));
}

/* A wrapped surname is indented, so it reads as the same player carried over. */
.pw-availability-week tbody .pw-week-name-col > a {
    display: block;
    padding-left: .7rem;
    text-indent: -.7rem;
}

.pw-week-add {
    --bs-btn-padding-y: .1rem;
    --bs-btn-padding-x: .4rem;
    --bs-btn-font-size: .75rem;
}

.pw-week-cell + .pw-week-cell {
    margin-top: .5rem;
    padding-top: .5rem;
    border-top: 1px dashed var(--bs-border-color);
}

/* Deep-linked day column: a short accent flash that fades away. */
.pw-day-flash {
    animation: pw-day-flash 2.5s ease-out 1;
}

@keyframes pw-day-flash {
    0%, 35% {
        background-color: color-mix(in srgb, var(--pw-accent), transparent 65%);
    }

    100% {
        background-color: transparent;
    }
}

/* ============================================================================
   Session plan editor: A4-styled sheets, drawable pitches with meter-labelled
   areas, and print rules that put both sheets on A4 landscape.
   ============================================================================ */

.sp-layout {
    display: grid;
    grid-template-columns: 15rem minmax(0, 1fr);
    gap: 1rem;
}

/* The toolbox follows the scroll so accessories stay reachable while drawing on
   any pitch; it scrolls internally when taller than the viewport. */
.sp-toolbox {
    position: sticky;
    top: 3.9rem;
    align-self: start;
    max-height: calc(100vh - 4.75rem);
    overflow-y: auto;
    scrollbar-width: thin;
}

@media (max-width: 991.98px) {
    .sp-layout {
        grid-template-columns: 1fr;
    }

    /* Stacked layout: a sticky toolbox would cover the sheets. */
    .sp-toolbox {
        position: static;
        max-height: none;
    }
}

/* ---- Sticky action bar: plan name, autosave state, print ---- */

.sp-bar {
    position: sticky;
    top: 0;
    z-index: 3;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .5rem .75rem;
    margin-bottom: 1rem;
    padding: .5rem .75rem;
    border: 1px solid var(--bs-border-color);
    border-radius: .6rem;
    background: color-mix(in srgb, var(--bs-body-bg) 92%, transparent);
    backdrop-filter: blur(6px);
    box-shadow: 0 1px 2px rgba(0, 0, 0, .06);
}

.sp-name-input {
    max-width: 18rem;
}

.sp-bar-kicker {
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--bs-secondary-color);
}

.sp-bar-actions {
    margin-left: auto;
    display: flex;
    gap: .5rem;
}

/* Autosave pill. Saved is deliberately quiet; only a failure asks for attention. */
.sp-status {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    font-size: .75rem;
    font-weight: 600;
    padding: .1rem .5rem;
    border: 1px solid transparent;
    border-radius: 999px;
    transition: color .15s ease, background-color .15s ease;
}

.sp-status-saved {
    color: var(--bs-secondary-color);
}

.sp-status-saving {
    color: var(--bs-secondary-color);
}

    .sp-status-saving .bi {
        animation: sp-spin 1s linear infinite;
    }

.sp-status-failed {
    color: var(--bs-danger-text-emphasis, #842029);
    background: var(--bs-danger-bg-subtle, #f8d7da);
    border-color: var(--bs-danger-border-subtle, #f1aeb5);
}

@keyframes sp-spin {
    to {
        transform: rotate(360deg);
    }
}

@media (prefers-reduced-motion: reduce) {
    .sp-status-saving .bi {
        animation: none;
    }
}

.sp-sheets {
    display: flex;
    flex-direction: column;
    gap: 1.75rem;
    min-width: 0;
}

/* Screen-only chip naming each sheet; the printout stays clean. */
.sp-sheet-label {
    display: inline-flex;
    align-items: center;
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--pw-accent, var(--bs-primary));
    background: color-mix(in srgb, var(--pw-accent, var(--bs-primary)) 10%, #fff);
    border: 1px solid color-mix(in srgb, var(--pw-accent, var(--bs-primary)) 25%, #fff);
    border-radius: 999px;
    padding: .1rem .55rem;
    margin-bottom: .75rem;
}

/* The sheets always render on white with dark ink, matching the printed page.
   The accent hairline at the top reads as the club's letterhead. */
.session-sheet {
    position: relative;
    background: #fff;
    color: #111;
    border: 1px solid #dfe3e8;
    border-radius: .5rem;
    box-shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 8px 24px -12px rgba(16, 24, 40, .28);
    padding: 1.25rem 1.25rem 1.1rem;
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
}

    .session-sheet::before {
        content: "";
        position: absolute;
        inset: 0 0 auto;
        height: 3px;
        border-radius: .5rem .5rem 0 0;
        background: linear-gradient(90deg,
            var(--pw-accent, var(--bs-primary)),
            color-mix(in srgb, var(--pw-accent, var(--bs-primary)) 35%, #fff));
        print-color-adjust: exact;
        -webkit-print-color-adjust: exact;
    }

/* ---- Toolbox rail: grouped sections divided by hairlines ---- */

.sp-tool-group {
    margin-top: .85rem;
    padding-top: .85rem;
    border-top: 1px solid var(--bs-border-color);
}

.sp-tool-head {
    display: flex;
    align-items: center;
    gap: .5rem;
    margin-bottom: .45rem;
}

.sp-tool-swatch {
    display: flex;
    align-items: center;
    gap: .5rem;
    margin-top: .4rem;
}

.sp-tool-swatch-label {
    margin-right: auto;
    font-size: .75rem;
    color: var(--bs-secondary-color);
}

.sp-color {
    display: inline-flex;
    align-items: center;
    gap: .25rem;
}

.sp-tool-hint {
    margin: .5rem 0 0;
    font-size: .72rem;
    line-height: 1.35;
    color: var(--bs-secondary-color);
}

/* How many of the squad the session has. */
.sp-tool-count {
    padding: 0 .4rem;
    font-family: var(--pw-font-mono, monospace);
    font-size: .7rem;
    color: var(--bs-secondary-color);
    background: var(--bs-tertiary-bg);
    border-radius: 999px;
}

/* Whose squad a standalone plan is drawing from. It sits above the names rather than in
   the group's heading row, where a team name would crowd out the count. */
.sp-squad-team {
    margin-top: .4rem;
    font-size: .78rem;
}

/* The squad, one name per line: a coach picks a player by name, not by picture, so
   the list reads down rather than across like the numbered grid. */
.sp-squad {
    display: flex;
    flex-direction: column;
    gap: .15rem;
    margin-top: .45rem;
    /* Long enough to scan, short enough to leave the rest of the toolbox in reach. */
    max-height: 21rem;
    overflow-y: auto;
    scrollbar-width: thin;
}

.sp-squad-btn {
    display: flex;
    align-items: center;
    gap: .45rem;
    padding: .15rem .3rem;
    border: 1px solid transparent;
    border-radius: .4rem;
    background: none;
    color: inherit;
    font-size: .78rem;
    text-align: left;
    cursor: grab;
    transition: background-color .15s ease, border-color .15s ease;
}

.sp-squad-btn:hover:not(:disabled), .sp-squad-btn:focus-visible {
    border-color: var(--pw-accent, var(--bs-primary));
    background-color: color-mix(in srgb, var(--pw-accent, #0d6efd) 8%, transparent);
}

.sp-squad-btn-icon {
    display: flex;
    flex-shrink: 0;
    width: 1.6rem;
    height: 1.6rem;
    align-items: center;
    justify-content: center;
}

    .sp-squad-btn-icon svg {
        width: 100%;
        height: 100%;
    }

.sp-squad-btn-name {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

/* Out on the highlighted pitch already: struck through and greyed, but still listed,
   because he is the same player who is available on the other pitches. */
.sp-squad-btn.is-used {
    cursor: default;
    color: var(--bs-secondary-color);
}

    .sp-squad-btn.is-used .sp-squad-btn-icon {
        opacity: .35;
    }

    .sp-squad-btn.is-used .sp-squad-btn-name {
        text-decoration: line-through;
    }

.sp-squad-btn-used {
    margin-left: auto;
    color: var(--pw-accent-text, var(--bs-primary));
}

    .sp-tool-hint.is-live {
        color: var(--pw-accent, var(--bs-primary));
    }

    .sp-tool-hint kbd {
        font-size: .68rem;
        padding: .05rem .25rem;
    }

/* Segmented control: one connected strip instead of two loose buttons. */
.sp-seg {
    display: flex;
    width: 100%;
    padding: .15rem;
    gap: .15rem;
    border: 1px solid var(--bs-border-color);
    border-radius: .45rem;
    background: var(--bs-tertiary-bg);
}

    /* Two of these stack in the squad group; they are separate choices, so they need
       air between them rather than reading as one six-button row. */
    .sp-seg + .sp-seg {
        margin-top: .25rem;
    }

.sp-seg-btn {
    flex: 1 1 0;
    min-width: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .25rem;
    padding: .2rem .3rem;
    font-size: .75rem;
    font-weight: 600;
    color: var(--bs-body-color);
    background: transparent;
    border: 0;
    border-radius: .35rem;
    cursor: pointer;
    transition: background-color .15s ease, color .15s ease;
}

    .sp-seg-btn:hover {
        background: var(--bs-secondary-bg);
    }

    .sp-seg-btn.is-on {
        color: #fff;
        background: var(--pw-accent, var(--bs-primary));
    }

.sp-inspector {
    /* The one panel that appears and disappears; tinting it keeps the rail readable. */
    border-radius: .45rem;
    padding: .6rem;
    background: color-mix(in srgb, var(--pw-accent, var(--bs-primary)) 7%, transparent);
    border-top-color: transparent;
}

    /* The plan's rail is narrower than the animation builder's, so "Remove from pitch"
       would break across lines beside the other button. */
    .sp-inspector .anim-inspector-actions {
        flex-direction: column;
    }

.sp-field-label {
    display: block;
    font-size: .62rem;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: #555;
    margin-bottom: .15rem;
}

    .sp-field-label .bi {
        opacity: .65;
    }

/* Nothing drawn yet: a quiet placeholder instead of a bare sentence. */
.sp-empty {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: 1rem;
    border: 1px dashed #d3d8de;
    border-radius: .45rem;
    color: #6b7280;
    font-size: .82rem;
}

    .sp-empty .bi {
        font-size: 1.35rem;
        opacity: .5;
    }

.sp-input {
    width: 100%;
    font-size: .8rem;
    padding: .2rem .4rem;
    border: 1px solid #c9ced6;
    border-radius: .25rem;
    background: #fff;
    color: #111;
}

    .sp-input:focus {
        outline: 2px solid var(--pw-accent, var(--bs-primary));
        outline-offset: 1px;
    }

.sp-cell-text {
    font-size: .8rem;
}

/* The combined page title: session name large, date and matchday type inline after
   it. The inputs read as plain title text until hovered or focused. */
.sp-title-row {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: .25rem .75rem;
    padding-bottom: .6rem;
    margin-bottom: .9rem;
    border-bottom: 2px solid #eceff3;
}

    .sp-title-row .sp-input {
        border-color: transparent;
        background: transparent;
        padding-left: .15rem;
        padding-right: .15rem;
    }

        .sp-title-row .sp-input:hover {
            border-color: #d7dbe1;
        }

        .sp-title-row .sp-input:focus {
            background: #fff;
        }

.sp-title-name {
    flex: 1 1 14rem;
    min-width: 0;
    font-size: 1.45rem;
    font-weight: 700;
    letter-spacing: -.01em;
}

.sp-title-meta {
    display: flex;
    align-items: baseline;
    gap: .3rem;
}

    .sp-title-meta .sp-input {
        font-size: .9rem;
        color: #444;
    }

/* Icon-labelled meta fields: the icon says what the value is without a caption. */
.sp-title-field {
    display: inline-flex;
    align-items: baseline;
    gap: .3rem;
}

    .sp-title-field > .bi {
        font-size: .78rem;
        color: #9aa2ad;
    }

.sp-title-date {
    width: 8.5rem;
}

.sp-title-type {
    width: 8rem;
}

.sp-title-sep {
    color: #c2c8d0;
}

/* Sheet 2 carries up to four whole drill columns under its heading, so the heading gives
   way to them: it says the same thing in less height than sheet 1's, which has only the
   one pitch to fit. */
.session-sheet-2 .sp-title-row {
    padding-bottom: .15rem;
    margin-bottom: .25rem;
    border-bottom-width: 1px;
}

.session-sheet-2 .sp-title-name {
    font-size: .75rem;
}

.session-sheet-2 .sp-title-meta .sp-input {
    font-size: .65rem;
}

/* The inputs' own padding is most of the row's height once the text is this small. */
.session-sheet-2 .sp-title-row .sp-input {
    padding-top: .05rem;
    padding-bottom: .05rem;
}

/* Landscape sheet: the pitch gets half the width so drawings have room. */
.sp-sheet1-body {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 50%);
    gap: 1rem;
    align-items: start;
}

/* Screen only: a printed page box can be narrower than this breakpoint, and stacking
   the pitch under the table there would push it off the sheet's single page. */
@media screen and (max-width: 767.98px) {
    .sp-sheet1-body {
        grid-template-columns: 1fr;
    }
}

/* The aim is the one thing a coach reads first, so it gets a tinted block. */
.sp-aim {
    margin-bottom: .9rem;
    padding: .5rem .6rem;
    border-left: 3px solid var(--pw-accent, var(--bs-primary));
    border-radius: 0 .35rem .35rem 0;
    background: #f7f9fb;
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
}

.sp-aim-text {
    resize: vertical;
    border-color: transparent;
    background: transparent;
}

    .sp-aim-text:hover {
        border-color: #d7dbe1;
    }

    .sp-aim-text:focus {
        background: #fff;
    }

/* Whatever the table has no column for, under the table where it belongs. */
.sp-notes {
    margin-top: .5rem;
}

.sp-notes-text {
    resize: vertical;
    width: 100%;
    border-color: #e3e6ea;
    background: transparent;
}

    .sp-notes-text:focus {
        background: #fff;
    }

/* The mark on a row that is listed on sheet 1 but drawn on no pitch. */
.sp-row-section {
    display: inline-block;
    margin-left: .3rem;
    padding: 0 .28rem;
    border: 1px solid #c9ced5;
    border-radius: .2rem;
    font-size: .62rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .02em;
    color: #55606d;
    white-space: nowrap;
}

/* The pair marker both drills of a split block wear. It carries the accent so the two
   rows find each other down a long table, where the quiet section mark would not. */
.sp-row-split {
    border-color: color-mix(in srgb, var(--pw-accent, var(--bs-primary)) 45%, #c9ced5);
    background: color-mix(in srgb, var(--pw-accent, var(--bs-primary)) 8%, #fff);
    color: color-mix(in srgb, var(--pw-accent, var(--bs-primary)) 70%, #33383f);
}

    .sp-row-split .bi {
        font-size: .58rem;
        opacity: .8;
    }

/* ---- What the session is working on ----
   Stated above the drills, on its own band so it reads as the session's heading
   rather than another field. Ruled off top and bottom because on paper a rule
   separates sections more quietly than a box does. */
.sp-focus {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem 1.6rem;
    margin: .55rem 0 .6rem;
    padding: .5rem 0;
    border-top: 1px solid #e3e6ea;
    border-bottom: 1px solid #e3e6ea;
}

/* Each group takes what it needs and wraps whole rather than splitting its chips
   away from its heading. */
.sp-focus-group {
    flex: 1 1 12rem;
    min-width: 0;
}

.sp-focus-tags {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .3rem;
}

.sp-tag {
    display: inline-flex;
    align-items: center;
    gap: .1rem;
    max-width: 100%;
    padding: .1rem .1rem .1rem .42rem;
    border-radius: 999px;
    font-size: .72rem;
    font-weight: 600;
    line-height: 1.5;
}

/* A phase wears its own color, the same one its badges carry everywhere else. */
.sp-tag-phase {
    background: var(--sp-tag-color, #4b5563);
    color: var(--sp-tag-ink, #fff);
}

/* A principle has no color of its own, so it reads as an outline. */
.sp-tag-principle {
    border: 1px solid #c9ced5;
    color: #2b3138;
}

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

/* The x is there for the coach, not for the paper: it earns its space on hover or
   focus and prints not at all. */
.sp-tag-remove {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.1rem;
    height: 1.1rem;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: inherit;
    font-size: .8rem;
    line-height: 1;
    opacity: 0;
    cursor: pointer;
}

    .sp-tag:hover .sp-tag-remove,
    .sp-tag-remove:focus-visible {
        opacity: .8;
    }

    .sp-tag-remove:hover,
    .sp-tag-remove:focus-visible {
        opacity: 1;
        background: rgba(0, 0, 0, .18);
    }

/* Touch has no hover to reveal it with, so it simply stays there. */
@media (hover: none) {
    .sp-tag-remove {
        opacity: .75;
    }
}

/* Whatever has been struck off, and the way back. Deliberately the quietest thing
   on the band: it reports a choice already made. */
.sp-focus-restore {
    padding: 0 .2rem;
    border: 0;
    background: transparent;
    color: #6b7280;
    font-size: .68rem;
    text-decoration: underline dotted;
    text-underline-offset: .15em;
    cursor: pointer;
}

    .sp-focus-restore:hover,
    .sp-focus-restore:focus-visible {
        color: #111;
    }

.sp-drill-table {
    /* Fixed layout so Rules gets all the width the sized columns leave over. */
    table-layout: fixed;
    width: 100%;
    border-collapse: collapse;
    font-size: .78rem;
    color: #111;
}

    /* Borderless by request: the small uppercase headings carry the structure. */
    .sp-drill-table th,
    .sp-drill-table td {
        border: none;
        padding: .3rem .35rem;
        vertical-align: top;
        text-align: left;
    }

    .sp-drill-table th {
        font-size: .62rem;
        font-weight: 700;
        letter-spacing: .05em;
        text-transform: uppercase;
        color: #444;
        border-bottom: 1px solid #e4e8ed;
    }

    .sp-drill-table .sp-input {
        border: none;
        padding: .1rem .15rem;
        border-radius: 0;
    }

    /* Banding gives a wide row an easy line to follow across the sheet. */
    .sp-drill-table tbody tr:nth-child(even) {
        background: #f7f9fb;
        print-color-adjust: exact;
        -webkit-print-color-adjust: exact;
    }

    .sp-drill-table tbody tr:hover {
        background: color-mix(in srgb, var(--pw-accent, var(--bs-primary)) 6%, #fff);
    }

.sp-col-index {
    width: 1.5rem;
    font-size: .68rem;
    font-weight: 700;
    color: #9aa2ad;
    text-align: right !important;
    font-variant-numeric: tabular-nums;
}

.sp-col-name {
    width: 24%;
}

.sp-col-minutes {
    width: 4.5rem;
    font-variant-numeric: tabular-nums;
}

.sp-col-size {
    width: 5.5rem;
}

/* The session's length, so nobody has to add the column up by hand. */
.sp-total-row {
    font-size: .7rem;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: #444;
}

    .sp-total-row td {
        border-top: 1px solid #e4e8ed !important;
        padding-top: .35rem !important;
    }

    .sp-total-row .sp-col-minutes {
        font-size: .8rem;
        color: #111;
    }

/* Rules grow with their text (with a manual-resize fallback); the plain-text twin
   below only shows in print, guaranteeing nothing is ever cut off on paper. */
.sp-rules-input {
    resize: vertical;
    min-height: calc(1.4em + .3rem);
    field-sizing: content;
}

.sp-print-text {
    display: none;
    white-space: pre-wrap;
    overflow-wrap: break-word;
}

.sp-col-actions {
    width: 1.75rem;
    border: none !important;
    background: none !important;
}

/* The highlighted pitch is where toolbox clicks land. */
.sp-pitch-wrap {
    border-radius: .4rem;
}

/* A soft ring rather than a hard frame: it has to read as "clicks land here"
   without competing with the drawing inside it. */
.sp-pitch-active {
    outline: 2px solid color-mix(in srgb, var(--pw-accent, var(--bs-primary)) 45%, transparent);
    outline-offset: 3px;
    box-shadow: 0 0 0 6px color-mix(in srgb, var(--pw-accent, var(--bs-primary)) 8%, transparent);
}

@media print {
    .sp-pitch-active {
        outline: none;
        box-shadow: none;
    }
}

/* ---- Drawable pitch canvas ---- */

.spp-canvas {
    position: relative;
    user-select: none;
    touch-action: none;
}

    .spp-canvas img.spp-bg {
        display: block;
        width: 100%;
        height: auto;
        pointer-events: none;
        -webkit-user-drag: none;
    }

.spp-canvas-drawing {
    cursor: crosshair;
}

/* Drawn areas sit behind the items (DOM order) and carry their size in meters. */
.spp-area {
    position: absolute;
    border: 2px solid var(--spp-area-color, #1d4ed8);
    background: color-mix(in srgb, var(--spp-area-color, #1d4ed8) 16%, transparent);
    border-radius: .15rem;
    cursor: move;
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
}

.spp-area-ellipse {
    border-radius: 50%;
}

.spp-area-selected {
    box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--spp-area-color, #1d4ed8);
}

.spp-area-preview {
    pointer-events: none;
}

.spp-area-label {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    font-size: .62rem;
    font-weight: 700;
    color: #111;
    background: rgba(255, 255, 255, .85);
    padding: 0 .3rem;
    border-radius: .5rem;
    white-space: nowrap;
    pointer-events: none;
}

.spp-area-resize {
    position: absolute;
    right: -.45rem;
    bottom: -.45rem;
    width: .8rem;
    height: .8rem;
    background: var(--spp-area-color, #1d4ed8);
    border: 2px solid #fff;
    border-radius: .15rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .4);
    cursor: nwse-resize;
}

/* ---- Sheet 2: drill pitches side by side ---- */

.sp-drill-columns {
    display: grid;
    gap: .75rem;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.sp-drill-columns-1 {
    grid-template-columns: minmax(0, 1fr);
}

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

.sp-drill-columns-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

/* Screen only, for the same reason as the sheet-1 body: on paper the columns have to
   stay side by side, however narrow the page box is. */
@media screen and (max-width: 767.98px) {
    .sp-drill-columns,
    .sp-drill-columns-3,
    .sp-drill-columns-4 {
        grid-template-columns: minmax(0, 1fr);
    }
}

.sp-drill-col {
    display: flex;
    flex-direction: column;
    gap: .45rem;
    min-width: 0;
    padding: .6rem;
    border: 1px solid #e6eaee;
    border-radius: .45rem;
    background: #fcfdfe;
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
}

/* The drill name sits centered above its pitch; both share the same width cap so
   the name centers over the pitch, not the whole column. */
.sp-drill-name {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: .35rem;
    font-weight: 700;
    font-size: .85rem;
    color: #111;
    width: 100%;
    max-width: 17rem;
    margin-inline: auto;
}

/* Ties the pitch back to its numbered row on sheet 1. */
.sp-drill-index {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.15rem;
    height: 1.15rem;
    font-size: .66rem;
    font-weight: 700;
    color: #fff;
    background: var(--pw-accent, var(--bs-primary));
    border-radius: 50%;
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
}

.sp-drill-name-text {
    min-width: 0;
}

/* A split block names both its drills over the one pitch: on a line together where the
   column allows it, wrapping onto their own lines where it does not. */
.sp-drill-name-split {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: center;
    column-gap: .3rem;
    line-height: 1.2;
}

.sp-drill-name-plus {
    font-weight: 600;
    color: color-mix(in srgb, var(--pw-accent, var(--bs-primary)) 60%, #8a929b);
}

.sp-drill-name-input {
    flex: 1;
    min-width: 0;
    text-align: center;
}

/* Capped pitch size keeps room for the info below on the printed page. */
.sp-drill-col .sp-pitch-wrap {
    width: 100%;
    max-width: 17rem;
    margin-inline: auto;
}

/* A lone drill keeps its pitch (and the name centered over it) to the left,
   instead of floating in the middle of the wide sheet. */
.sp-drill-columns-1 .sp-drill-name,
.sp-drill-columns-1 .sp-pitch-wrap {
    margin-inline: 0;
}

.sp-drill-detail {
    display: flex;
    flex-direction: column;
    gap: .4rem;
}

.sp-coaching-list {
    margin: 0;
    padding-left: .95rem;
    font-size: .74rem;
    line-height: 1.4;
    color: #111;
}

    .sp-coaching-list li::marker {
        color: var(--pw-accent, var(--bs-primary));
    }

    .sp-coaching-list li > span {
        margin-right: .25rem;
    }

.sp-coaching-text {
    resize: vertical;
}

/* On a shared pitch each drill's points sit under its own name, ruled off on the left so
   the eye can follow one drill's coaching down the column without counting bullets. */
.sp-coaching-group + .sp-coaching-group {
    margin-top: .3rem;
}

.sp-coaching-group {
    padding-left: .4rem;
    border-left: 2px solid color-mix(in srgb, var(--pw-accent, var(--bs-primary)) 30%, #e3e6ea);
}

.sp-coaching-group-name {
    display: block;
    font-size: .64rem;
    font-weight: 700;
    letter-spacing: .01em;
    color: #444c55;
}

/* Rules and coaching points that come from the training day: read-only here, and they
   print as plain lists rather than as form controls. */
.sp-synced-list {
    margin: 0;
    padding-left: 1.1rem;
    font-size: .74rem;
    color: #111;
}

.sp-synced-note,
.sp-synced-empty {
    margin: .25rem 0 0;
    font-size: .68rem;
    font-style: italic;
    color: #6b7280;
}

.sp-principles {
    display: flex;
    flex-wrap: wrap;
    gap: .25rem;
}

.sp-principle-chip {
    font-size: .62rem;
    font-weight: 600;
    color: #111;
    background: #eef2f7;
    border: 1px solid #d7dde5;
    padding: .05rem .4rem;
    border-radius: 999px;
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
}

.sp-drill-facts {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .4rem;
}

.sp-drill-fact-wide {
    grid-column: 1 / -1;
}

/* The two drills of a split block, each under its own name. They stand side by side
   where the column is wide enough and stack where it is not, so a narrow sheet reads
   rather than squeezing both into nothing. */
.sp-drill-split {
    display: grid;
    /* Two fixed columns, however narrow the pitch column is: a split is read as the two
       drills running at the same time, which stacking them would hide. */
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .4rem;
    margin-bottom: .3rem;
}

.sp-drill-split-part {
    padding-left: .4rem;
    border-left: 2px solid color-mix(in srgb, var(--pw-accent, var(--bs-primary)) 30%, #e3e6ea);
}

/* How a drill's total is arrived at: quieter than the total it sits under. Half a pitch
   column is narrow, so it wraps rather than running past the edge of its half. */
.sp-row-prescription {
    display: block;
    font-size: .64rem;
    color: #5a6169;
}

.sp-add-pitch-select {
    max-width: 14rem;
}

/* ---- Printing the session plan ----
   session-plan-editor.js toggles pw-print-session-plan on <body> around window.print().
   Everything under the article that is not a sheet, inside a sheet, or an ancestor of
   one is removed, so only the two sheets print, both on A4 landscape. */
@media print {
    body.pw-print-session-plan article :not(.session-sheet):not(.session-sheet *):not(:has(.session-sheet)) {
        display: none !important;
    }

    /* Bootstrap's grid wrappers are flattened so the sheets sit directly on the page.
       Table cells are excluded on purpose: the drills table names its columns
       sp-col-*, and turning a cell into a block collapses the column widths. */
    body.pw-print-session-plan article :is(.card, .card-body, .sp-layout, .sp-sheets, .row, [class*="col-"]):not(th, td) {
        display: block !important;
        position: static !important;
        padding: 0 !important;
        margin: 0 !important;
        border: none !important;
        box-shadow: none !important;
        background: #fff !important;
    }

    body.pw-print-session-plan .session-sheet {
        border: none;
        border-radius: 0;
        box-shadow: none;
        padding: 0;
        margin: 0;
        break-inside: avoid;
    }

    /* Sheet 1 on one landscape page: the pitch (aspect 74:111) gets a fixed column
       sized so its height fits below the header row; everything else stays on the
       left half of the page. The percentage is the fallback for a page box narrower
       than landscape A4, where a rigid 110mm would squeeze the table to nothing. */
    body.pw-print-session-plan .sp-sheet1-body {
        grid-template-columns: minmax(0, 1fr) min(104mm, 45%);
    }

    /* A full table of drills with wordy rules is what pushes sheet 1 over its page, so
       the aim and the table give up a little air on paper. */
    body.pw-print-session-plan .sp-aim {
        margin-bottom: .5rem;
        padding: .4rem .5rem;
    }

    body.pw-print-session-plan .sp-drill-table {
        font-size: .72rem;
    }

        body.pw-print-session-plan .sp-drill-table th,
        body.pw-print-session-plan .sp-drill-table td {
            padding: .22rem .3rem;
        }

    /* Sheet 1 is pinned to exactly one page so the aim and drills table always print
       on the first page under the title, never spilling onto a second sheet. */
    body.pw-print-session-plan .session-sheet-1 {
        page: sp-landscape;
        height: 189mm;
        overflow: hidden;
    }

    /* Sheet 2 is one page too: the pitch is capped so its name, coaching points,
       principles and Size/Time/Rules always fit below it. */
    body.pw-print-session-plan .session-sheet-2 {
        page: sp-landscape;
        break-before: page;
        height: 189mm;
        overflow: hidden;
    }

    /* The columns are restated here so nothing about the page box can collapse them:
       a stacked second card would start below the sheet's one page and be cut away. */
    body.pw-print-session-plan .sp-drill-columns {
        gap: 3mm;
    }

    /* The pitch is half again as tall as it is wide, so its width cap is what decides
       whether the text under it still fits the page. Fewer drills, bigger pitch; with
       four, the column itself is already the limit. */
    body.pw-print-session-plan .sp-drill-columns-1 {
        grid-template-columns: minmax(0, 1fr);
        --sp-print-pitch: 88mm;
    }

    body.pw-print-session-plan .sp-drill-columns-2 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        --sp-print-pitch: 84mm;
    }

    body.pw-print-session-plan .sp-drill-columns-3 {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        --sp-print-pitch: 78mm;
    }

    body.pw-print-session-plan .sp-drill-columns-4 {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        --sp-print-pitch: 100%;
    }

    body.pw-print-session-plan .sp-drill-col .sp-pitch-wrap,
    body.pw-print-session-plan .sp-drill-name {
        max-width: min(var(--sp-print-pitch, 64mm), 100%);
    }

    /* The screen-only card chrome would eat into the one page each sheet gets. */
    body.pw-print-session-plan .sp-drill-col {
        padding: 0;
        border: none;
        background: #fff;
        gap: .3rem;
    }

    /* Every millimetre under the title is one the sheet's content needs. */
    body.pw-print-session-plan .sp-title-row {
        padding-bottom: .3rem;
        margin-bottom: .45rem;
    }

    /* On paper the drill cards have one page and no scrolling, so sheet 2's heading gives
       up more again than it does on screen. */
    body.pw-print-session-plan .session-sheet-2 .sp-title-name {
        font-size: .74rem;
    }

    body.pw-print-session-plan .session-sheet-2 .sp-title-row {
        padding-bottom: .1rem;
        margin-bottom: .2rem;
    }

    body.pw-print-session-plan .sp-drill-detail {
        gap: .28rem;
    }

    body.pw-print-session-plan .sp-coaching-list,
    body.pw-print-session-plan .sp-synced-list,
    body.pw-print-session-plan .sp-drill-detail .sp-cell-text {
        font-size: .68rem;
        line-height: 1.3;
    }

    body.pw-print-session-plan .sp-coaching-group-name {
        font-size: .6rem;
    }

    /* The accent letterhead is drawn over the title once the sheet loses its padding. */
    body.pw-print-session-plan .session-sheet::before {
        display: none;
    }

    /* Inputs print as plain text on the sheet lines; the title stays borderless. */
    body.pw-print-session-plan .sp-input {
        border-color: #ddd;
    }

    /* Every free-text field prints as wrapped plain text: a field only shows the rows it
       has room for, and on paper there is no scrolling to reach the rest. */
    body.pw-print-session-plan .sp-rules-input,
    body.pw-print-session-plan .sp-coaching-text,
    body.pw-print-session-plan .sp-aim-text,
    body.pw-print-session-plan .sp-notes-text {
        display: none;
    }

    /* A note nobody wrote should not print its label into an empty box. */
    body.pw-print-session-plan .sp-notes:not(:has(.sp-print-text:not(:empty))) {
        display: none;
    }

    body.pw-print-session-plan .sp-print-text {
        display: block;
    }

    body.pw-print-session-plan .sp-title-row .sp-input {
        border-color: transparent;
    }
}

@page sp-landscape {
    size: A4 landscape;
    margin: 10mm;
}

/* --- Player availability report --- */
/* Status shares as one bar: the parts carry their own status colors, which the
   browser must keep when printing. */
.pw-report-bar {
    display: flex;
    width: 100%;
    height: 1.75rem;
    border-radius: .375rem;
    overflow: hidden;
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
}

.pw-report-bar-part {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .75rem;
    font-weight: 600;
    min-width: 0;
    white-space: nowrap;
}

/* One bar per table row rather than one for the page: short enough to sit on a line of
   text, and without room for the percentages the headline bar labels its bands with. */
.pw-report-bar-slim {
    height: .85rem;
    border-radius: .25rem;
}

/* A bar with one measure in it rather than a split, so it needs a track behind the
   fill for the empty remainder to read as "out of the whole" and not as nothing. */
.pw-report-bar:has(.pw-report-bar-fill) {
    height: .6rem;
    background-color: color-mix(in srgb, var(--pw-ink), transparent 90%);
}

.pw-report-bar-fill {
    display: block;
    height: 100%;
    border-radius: inherit;
    background-color: var(--pw-accent);
}

/* The handful of numbers a report is opened for, before any of the tables. */
.pw-report-figures {
    display: flex;
    flex-wrap: wrap;
    gap: 1.75rem;
}

.pw-report-figure {
    display: flex;
    flex-direction: column;
}

.pw-report-figure-value {
    font-family: var(--pw-font-display);
    font-size: 2.25rem;
    line-height: 1.05;
    color: var(--pw-ink);
}

.pw-report-figure-label {
    font-family: var(--pw-font-mono);
    font-size: .7rem;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--pw-muted);
}

@media print {
    /* Print the report sheet alone: everything on the page that is neither the sheet,
       inside it, nor an ancestor of it is dropped (same approach as the session plan). */
    body.pw-print-availability-report article :not(.pw-report-sheet):not(.pw-report-sheet *):not(:has(.pw-report-sheet)) {
        display: none !important;
    }

    body.pw-print-availability-report .pw-report-sheet {
        page: pw-portrait;
    }

    /* A long session list runs over several sheets; repeat the header on each. */
    body.pw-print-availability-report thead {
        display: table-header-group;
    }

    body.pw-print-availability-report tr {
        break-inside: avoid;
    }

    body.pw-print-availability-report .badge,
    body.pw-print-availability-report .pw-report-bar-part {
        print-color-adjust: exact;
        -webkit-print-color-adjust: exact;
    }
}

@page pw-portrait {
    size: A4 portrait;
    margin: 12mm;
}

/* --- Scatter charts (Player Charts) --- */
.pw-scatter svg {
    display: block;
    width: 100%;
    height: auto;
    overflow: visible;
}

.pw-scatter-axis {
    stroke: color-mix(in srgb, var(--pw-ink), transparent 55%);
    stroke-width: 1.25;
}

/* A marked value on the vertical axis, e.g. an age a squad is read against. */
.pw-scatter-guide {
    stroke: color-mix(in srgb, var(--pw-ink), transparent 65%);
    stroke-width: 1;
    stroke-dasharray: 5 4;
}

.pw-scatter-guide-label {
    fill: var(--pw-muted);
    font-family: var(--pw-font-mono);
    font-size: 10px;
    text-anchor: end;
}

/* A shaded stretch of an axis: how a value reads before you get to the dot. Kept faint so
   the dots and names on top stay legible. Where two bands cross, both fills are painted and
   the overlap compounds into a deeper tint on its own, which is the point. */
.pw-scatter-band {
    fill: currentColor;
    opacity: .08;
}

/* Where you want to be. */
.pw-scatter-band-green {
    fill: #198754;
    opacity: .09;
}

/* Fine, but on the turn. Amber reads fainter than the others, so it gets a little more. */
.pw-scatter-band-yellow {
    fill: #ffc107;
    opacity: .16;
}

/* The wrong end: too old, or barely playing. */
.pw-scatter-band-red {
    fill: #dc3545;
    opacity: .08;
}

/* The verdict written across a corner of the plot. Sized in step with RegionLabelSize in
   ScatterChart, which uses it to decide whether the text fits the corner at all. Faint and
   uppercase, so it reads as a watermark under the dots rather than another label among them. */
.pw-scatter-region-label {
    fill: var(--pw-ink);
    font-size: 16px;
    font-weight: 700;
    letter-spacing: .06em;
    opacity: .12;
    pointer-events: none;
    text-anchor: middle;
    text-transform: uppercase;
    user-select: none;
}

.pw-scatter-tick {
    fill: var(--pw-muted);
    font-family: var(--pw-font-mono);
    font-size: 11px;
    font-variant-numeric: tabular-nums;
}

.pw-scatter-tick-x {
    text-anchor: middle;
}

.pw-scatter-tick-y {
    text-anchor: end;
}

.pw-scatter-axis-label {
    fill: var(--pw-ink);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .04em;
    text-anchor: middle;
    text-transform: uppercase;
}

.pw-scatter-dot {
    fill: var(--pw-accent);
    stroke: var(--pw-paper);
    stroke-width: 1.5;
}

/* Home grown: a ring instead of a filled dot, so the two read apart in print too. */
.pw-scatter-dot-outlined {
    fill: color-mix(in srgb, var(--pw-accent), transparent 78%);
    stroke: var(--pw-accent);
    stroke-width: 2.5;
}

/* A player who has left the club is still plotted, just quieter. */
.pw-scatter-point-muted {
    opacity: .45;
}

.pw-scatter-label {
    fill: var(--pw-muted);
    font-family: var(--pw-font-mono);
    font-size: 10px;
    pointer-events: none;
}

/* Labels on dots near the right edge are drawn back towards the middle instead. */
.pw-scatter-label-left {
    text-anchor: end;
}

/* ============================================================================
   Stale training notice: what the team has been leaving alone, said while a
   session is being planned. A rule in the phase's own color down the left, an
   amber wash when something has actually been left too long, and otherwise the
   same shape kept quiet so a glance is enough.
   ============================================================================ */
.pw-stale {
    --pw-stale-tone: color-mix(in srgb, var(--pw-muted), transparent 75%);
    display: block;
    padding: .6rem .85rem .55rem;
    background-color: color-mix(in srgb, var(--pw-stale-tone), var(--pw-surface) 82%);
    border: 1px solid color-mix(in srgb, var(--pw-stale-tone), transparent 35%);
    border-left: .25rem solid var(--pw-stale-color, var(--pw-accent));
    border-radius: .5rem;
}

/* Left too long: amber, the colour the app already uses for "on the turn". */
.pw-stale.is-stale {
    --pw-stale-tone: #d98b0a;
}

.pw-stale-kicker {
    display: flex;
    align-items: center;
    gap: .35rem;
    margin: 0;
    color: var(--pw-muted);
    font-family: var(--pw-font-mono);
    font-size: .64rem;
    letter-spacing: .14em;
    text-transform: uppercase;
}

.pw-stale.is-stale .pw-stale-kicker {
    color: #a2660a;
}

:root[data-bs-theme="dark"] .pw-stale.is-stale .pw-stale-kicker {
    color: #e6ab41;
}

.pw-stale-line {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: .1rem .6rem;
    margin: .15rem 0 0;
}

.pw-stale-name {
    font-family: var(--pw-font-display);
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: .02em;
    text-transform: uppercase;
}

.pw-stale-detail {
    color: var(--pw-muted);
    font-family: var(--pw-font-mono);
    font-size: .74rem;
}

.pw-stale-zones {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .3rem;
    margin: .5rem 0 0;
    padding-top: .45rem;
    border-top: 1px dashed color-mix(in srgb, var(--pw-stale-tone), transparent 45%);
}

.pw-stale-zones-label {
    margin-right: .2rem;
    color: var(--pw-muted);
    font-family: var(--pw-font-mono);
    font-size: .62rem;
    letter-spacing: .12em;
    text-transform: uppercase;
}

.pw-stale-chip {
    padding: .05rem .45rem;
    font-size: .76rem;
    background-color: color-mix(in srgb, var(--pw-stale-chip-color, var(--pw-muted)), transparent 88%);
    border: 1px solid color-mix(in srgb, var(--pw-stale-chip-color, var(--pw-muted)), transparent 60%);
    border-radius: 999px;
    cursor: default;
}

/* The phase a zone belongs to reads as a qualifier, not part of its name. */
.pw-stale-chip-sep {
    color: var(--pw-muted);
}

.pw-stale-chip-rest {
    color: var(--pw-muted);
    font-family: var(--pw-font-mono);
    font-size: .7rem;
    background-color: transparent;
    border-style: dashed;
}

/* ============================================================================
   Training focus: what the season's sessions actually went on, as one bar.
   Kept to a single line — a count, then every item stacked end to end in its
   own color, each band as wide as its share of the work. The figures live in
   the band's tooltip, so the line states the shape of the season and nothing
   more until it is asked.
   ============================================================================ */
.pw-usage {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .55rem 1.1rem;
    margin-bottom: 1.25rem;
    padding: .6rem 1rem;
    background-color: var(--pw-surface);
    border: 1px solid var(--pw-line);
    border-radius: .75rem;
    box-shadow: var(--pw-shadow-1);
    /* A hairline of pitch green along the top: the panel belongs to the training ground. */
    border-top: 3px solid color-mix(in srgb, var(--pw-accent), transparent 45%);
}

.pw-usage-lede {
    display: flex;
    align-items: baseline;
    gap: .4rem;
    margin: 0;
    white-space: nowrap;
}

.pw-usage-kicker {
    color: var(--pw-muted);
    font-family: var(--pw-font-mono);
    font-size: .62rem;
    letter-spacing: .16em;
    text-transform: uppercase;
}

.pw-usage-count {
    font-family: var(--pw-font-display);
    font-size: 1.35rem;
    font-weight: 700;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.pw-usage-since {
    color: var(--pw-muted);
    font-size: .78rem;
}

.pw-usage-team select {
    min-width: 8.5rem;
}

/* The season end to end, clipped as one piece so the bands read as divisions of a
   whole rather than a row of separate bars. */
.pw-usage-bar {
    display: flex;
    flex: 1 1 16rem;
    gap: 2px;
    min-width: 9rem;
    height: 1.5rem;
    background-color: color-mix(in srgb, var(--pw-chalk), var(--pw-ink) 9%);
    border-radius: .3rem;
}

/* Not clipped, since each band holds the tooltip that rises out of it: the name
   inside does its own clipping instead. */
.pw-usage-seg {
    position: relative;
    display: flex;
    flex: 0 1 auto;
    align-items: center;
    justify-content: center;
    min-width: .3rem;
    background-image: linear-gradient(180deg,
        color-mix(in srgb, var(--pw-usage-color, var(--pw-accent)), white 14%),
        var(--pw-usage-color, var(--pw-accent)));
    cursor: default;
    transition: filter .15s ease;
}

.pw-usage-seg:first-child {
    border-radius: .3rem 0 0 .3rem;
}

.pw-usage-seg:last-child {
    border-radius: 0 .3rem .3rem 0;
}

.pw-usage-seg:hover,
.pw-usage-seg:focus-visible {
    filter: brightness(1.08);
    outline: none;
}

/* Named inside the band where there is room to read it, in whichever of ink or
   paper stands out against the band's own color. */
.pw-usage-seg-name {
    /* min-width: 0 so a long name shrinks to the band and takes an ellipsis, rather
       than holding the band open at its own width. */
    min-width: 0;
    max-width: 100%;
    padding: 0 .35rem;
    overflow: hidden;
    color: var(--pw-usage-ink, #fff);
    font-family: var(--pw-font-mono);
    font-size: .62rem;
    letter-spacing: .07em;
    text-overflow: ellipsis;
    text-transform: uppercase;
    white-space: nowrap;
}

/* Trained, but not lately: hatched, so the gap shows without hovering for it. */
.pw-usage-seg.is-stale::after {
    content: "";
    position: absolute;
    inset: 0;
    background-image: repeating-linear-gradient(45deg,
        transparent 0 3px, color-mix(in srgb, var(--pw-ink), transparent 62%) 3px 5px);
    border-radius: inherit;
    pointer-events: none;
}

/* The figures, kept off the line until a band is hovered or tabbed to. */
.pw-usage-tip {
    position: absolute;
    bottom: calc(100% + .45rem);
    left: 50%;
    /* Centred with translate, so the transform is free to carry the lift. */
    translate: -50% 0;
    z-index: 2;
    display: grid;
    gap: .1rem;
    min-width: 10.5rem;
    padding: .5rem .65rem;
    text-align: left;
    white-space: nowrap;
    background-color: var(--pw-surface);
    border: 1px solid var(--pw-line);
    border-left: 3px solid var(--pw-usage-color, var(--pw-accent));
    border-radius: .5rem;
    box-shadow: var(--pw-shadow-2);
    opacity: 0;
    visibility: hidden;
    transform: translateY(.25rem);
    transition: opacity .12s ease, transform .12s ease, visibility .12s;
    pointer-events: none;
}

.pw-usage-seg:hover > .pw-usage-tip,
.pw-usage-seg:focus-visible > .pw-usage-tip,
.pw-usage-untouched:hover > .pw-usage-tip,
.pw-usage-untouched:focus-visible > .pw-usage-tip {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* A tooltip on the first or last band would hang off the panel, so those open
   from the edge they sit against rather than from their own middle. */
.pw-usage-seg.is-start > .pw-usage-tip {
    left: 0;
    translate: 0 0;
}

.pw-usage-seg.is-end > .pw-usage-tip {
    left: auto;
    right: 0;
    translate: 0 0;
}

.pw-usage-name {
    font-family: var(--pw-font-display);
    font-size: .85rem;
    font-weight: 600;
    letter-spacing: .03em;
    text-transform: uppercase;
}

.pw-usage-figure {
    font-family: var(--pw-font-mono);
    font-size: .8rem;
    font-variant-numeric: tabular-nums;
}

.pw-usage-of {
    color: var(--pw-muted);
    font-size: .7rem;
}

.pw-usage-share,
.pw-usage-date,
.pw-usage-when {
    color: var(--pw-muted);
    font-family: var(--pw-font-mono);
    font-size: .68rem;
}

/* Trained, but not lately: marked without shouting, since the band still shows the work. */
.pw-usage-when.is-stale {
    color: #b26a00;
    text-decoration: underline dotted;
    text-underline-offset: .2em;
}

:root[data-bs-theme="dark"] .pw-usage-when.is-stale {
    color: #e0a63c;
}

/* The gap in the work: counted on the line, named on hover. */
.pw-usage-untouched {
    position: relative;
    display: flex;
    align-items: baseline;
    gap: .3rem;
    margin: 0;
    padding: .15rem .55rem;
    color: var(--pw-muted);
    cursor: default;
    border: 1px dashed var(--pw-line);
    border-radius: 999px;
}

.pw-usage-untouched:hover,
.pw-usage-untouched:focus-visible {
    color: var(--pw-ink);
    border-color: color-mix(in srgb, var(--pw-ink), transparent 70%);
    outline: none;
}

/* It sits at the right-hand end of the line, so its tooltip opens leftwards. */
.pw-usage-untouched > .pw-usage-tip {
    left: auto;
    right: 0;
    translate: 0 0;
}

.pw-usage-untouched-count {
    font-family: var(--pw-font-mono);
    font-size: .8rem;
    font-variant-numeric: tabular-nums;
}

.pw-usage-untouched-label {
    font-family: var(--pw-font-mono);
    font-size: .62rem;
    letter-spacing: .12em;
    text-transform: uppercase;
}

/* Names wrap, so this tooltip is given the room the band tooltips do not need. */
.pw-usage-tip-wide {
    min-width: 13rem;
    max-width: 21rem;
    white-space: normal;
    border-left-color: var(--pw-line);
}

/* Chips in each item's color, so they read as the same family as the bands. */
.pw-usage-chips {
    display: flex;
    flex-wrap: wrap;
    gap: .3rem;
    margin-top: .2rem;
}

.pw-usage-chip {
    padding: .1rem .5rem;
    color: var(--pw-ink);
    font-size: .75rem;
    background-color: color-mix(in srgb, var(--pw-usage-color, var(--pw-muted)), transparent 88%);
    border: 1px dashed color-mix(in srgb, var(--pw-usage-color, var(--pw-muted)), transparent 55%);
    border-radius: 999px;
}

.pw-usage-chip-rest {
    color: var(--pw-muted);
    font-family: var(--pw-font-mono);
    font-size: .7rem;
    background-color: transparent;
}

@media (max-width: 767.98px) {
    /* No room for the bar beside the count, so it takes a line of its own. */
    .pw-usage-bar {
        flex-basis: 100%;
        order: 3;
    }
}

/* ============================================================================
   Player charts: the pickers stay put while the charts scroll past them.
   ============================================================================ */
.pw-charts-filters {
    position: sticky;
    /* Above the chart cards, below the picker's own popup (z-index 1055). */
    z-index: 10;
    /* Bleeds into the article's padding so nothing shows through at the sides. */
    margin: 0 -1.5rem 1rem;
    padding: .75rem 1.5rem;
    background-color: var(--pw-chalk);
    border-bottom: 1px solid var(--pw-line);
}

@media (min-width: 641px) {
    .pw-charts-filters {
        /* Clears the sticky top bar, which is 3.5rem tall. */
        top: 3.5rem;
        margin-left: -2rem;
        padding-left: 2rem;
    }
}

@media (max-width: 640.98px) {
    .pw-charts-filters {
        /* The top bar scrolls away on narrow screens, so there is nothing to clear. */
        top: 0;
    }
}

/* ============================================================================
   Core behaviors: asked for the whole game through, so they are kept in sight on
   the top bar rather than filed away on a page of their own. Wide screens read
   the names; narrow ones get one chip that opens the same list.
   ============================================================================ */
.pw-core-bar {
    display: flex;
    align-items: center;
    gap: .375rem;
    /* Names are given up before the signed-in name beside them is squeezed. */
    min-width: 0;
    overflow: hidden;
}

.pw-core-bar-label {
    font-size: .7rem;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--bs-secondary-color);
    white-space: nowrap;
}

.pw-core-chip {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    max-width: 12rem;
    padding: .2rem .6rem;
    border: 1px solid var(--pw-line);
    border-radius: 999px;
    background-color: transparent;
    color: var(--pw-accent-text, var(--bs-body-color));
    font-size: .8rem;
    line-height: 1.4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: background-color .12s ease, border-color .12s ease;
}

    .pw-core-chip:hover, .pw-core-chip:focus-visible {
        border-color: var(--pw-accent, var(--bs-primary));
        background-color: color-mix(in srgb, var(--pw-accent, #0d6efd) 12%, transparent);
    }

.pw-core-chip-more {
    color: var(--bs-secondary-color);
}

.pw-core-chip-count {
    padding: 0 .35rem;
    border-radius: 999px;
    background-color: var(--pw-accent, var(--bs-primary));
    color: var(--pw-accent-contrast, #fff);
    font-size: .7rem;
}

/* Heading above one phase's files in a core behavior's overview. */
.pw-core-phase-heading {
    margin: 1rem 0 .5rem;
    font-size: .95rem;
}

    .pw-core-phase-heading:first-of-type {
        margin-top: 0;
    }

/* ============================================================================
   Video analysis: the clip library and the annotation editor.
   ============================================================================ */

/* ---- Library cards ---- */

.pw-clip-thumb {
    position: relative;
    display: block;
    width: 100%;
    height: 150px;
    padding: 0;
    overflow: hidden;
    background-color: #000;
    border: 0;
    border-radius: calc(var(--bs-border-radius) - 1px) calc(var(--bs-border-radius) - 1px) 0 0;
}

    .pw-clip-thumb video {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

.pw-clip-thumb-play {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    color: #fff;
    text-shadow: 0 2px 8px rgba(0, 0, 0, .6);
    opacity: .85;
    transition: opacity .12s ease;
}

.pw-clip-thumb:hover .pw-clip-thumb-play {
    opacity: 1;
}

.pw-clip-duration {
    position: absolute;
    right: .4rem;
    bottom: .4rem;
    padding: .05rem .3rem;
    font-size: .7rem;
    color: #fff;
    background-color: rgba(0, 0, 0, .65);
    border-radius: .25rem;
}

/* What a clip is an example of, on its card in the library and in the reel. */
.pw-clip-tags {
    display: flex;
    flex-wrap: wrap;
    gap: .3rem;
    font-weight: 500;
}

/* ---- Finding a clip ----
   A match yields a dozen clips and a season several hundred, so the search, the filters
   and the order sit above the library as one bar. It wraps rather than scrolls: on a
   phone every control is still reachable, stacked. */
.pw-clip-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .5rem .75rem;
}

/* The search grows into whatever the rest leaves, down to a width still worth typing in. */
.pw-clip-search {
    position: relative;
    flex: 1 1 14rem;
    min-width: 12rem;
}

    .pw-clip-search > .bi {
        position: absolute;
        top: 50%;
        left: .7rem;
        color: var(--bs-secondary-color);
        transform: translateY(-50%);
        pointer-events: none;
    }

    .pw-clip-search input {
        padding-left: 2.1rem;
    }

.pw-clip-filter {
    flex: 0 1 13rem;
    min-width: 10rem;
}

.pw-clip-sort {
    display: flex;
    align-items: center;
    gap: .4rem;
}

    .pw-clip-sort select {
        width: auto;
    }

    /* The reverse button keeps its width as its label flips, so the bar does not shuffle. */
    .pw-clip-sort .btn {
        min-width: 4.5rem;
    }

/* ---- Clips filed on a match or a session ----
   How many marks are already on a clip, in the corner of its thumbnail: a clip somebody
   has drawn on is one that already makes a point. */
.pw-clip-drawn {
    position: absolute;
    top: .35rem;
    right: .35rem;
    display: inline-flex;
    align-items: center;
    gap: .2rem;
    padding: .05rem .3rem;
    font-size: .7rem;
    font-weight: 600;
    color: #fff;
    background-color: rgba(0, 0, 0, .65);
    border-radius: .25rem;
}

/* ---- Picking a clip out of the library ----
   Picked by its picture: nobody remembers a clip by its filename, and the whole reason
   for picking rather than uploading is that the footage is already there to look at. */
.pw-clip-pick {
    display: block;
    width: 100%;
    padding: .35rem;
    text-align: left;
    background: none;
    border: 2px solid var(--bs-border-color);
    border-radius: var(--bs-border-radius);
}

    .pw-clip-pick:hover {
        border-color: var(--bs-primary-border-subtle);
    }

    .pw-clip-pick.is-picked {
        border-color: var(--bs-primary);
        background-color: var(--bs-primary-bg-subtle);
    }

.pw-clip-pick-film {
    position: relative;
    display: block;
    height: 90px;
    overflow: hidden;
    background-color: #000;
    border-radius: calc(var(--bs-border-radius) - 2px);
}

    .pw-clip-pick-film video {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

/* The tick only appears once picked, and sits over the picture rather than beside it so
   the row of thumbnails keeps its rhythm either way. */
.pw-clip-pick-tick {
    position: absolute;
    top: .3rem;
    right: .3rem;
    display: none;
    width: 1.4rem;
    height: 1.4rem;
    line-height: 1.4rem;
    text-align: center;
    color: #fff;
    background-color: var(--bs-primary);
    border-radius: 50%;
}

.pw-clip-pick.is-picked .pw-clip-pick-tick {
    display: block;
}

.pw-clip-pick-name {
    display: block;
    margin-top: .3rem;
    overflow: hidden;
    font-size: .85rem;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pw-clip-pick-meta {
    display: block;
    overflow: hidden;
    font-size: .75rem;
    color: var(--bs-secondary-color);
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ---- The game model's reel ---- */

/* The running order beside the picture rather than lettered over it: a coach taking a
   meeting needs to see what is coming next as well as what is on, and the corner of the
   screen is where the play itself is. Narrow enough for one hand's worth of titles. */
.pw-reel-player {
    display: grid;
    grid-template-columns: minmax(14rem, 18rem) minmax(0, 1fr);
    gap: 1rem;
    align-items: start;
}

@media (max-width: 767.98px) {
    /* No room for a column beside the picture; the order goes underneath it, and the
       picture keeps the width. */
    .pw-reel-player {
        grid-template-columns: minmax(0, 1fr);
    }

        .pw-reel-player > .pw-reel-queue {
            order: 2;
        }
}

.pw-reel-queue {
    display: flex;
    flex-direction: column;
    min-width: 0;
    max-height: min(70vh, 34rem);
    border: 1px solid var(--bs-border-color);
    border-radius: .65rem;
    background: var(--pw-surface, var(--bs-body-bg));
    overflow: hidden;
}

.pw-reel-queue-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: .75rem;
    padding: .5rem .75rem;
    border-bottom: 1px solid var(--bs-border-color);
    background: color-mix(in srgb, var(--pw-ink) 4%, transparent);
    font-size: .78rem;
    color: var(--pw-muted, var(--bs-secondary-color));
}

.pw-reel-queue-kicker {
    font-family: var(--pw-font-display);
    font-size: .72rem;
    font-weight: 600;
    letter-spacing: .16em;
    text-transform: uppercase;
}

.pw-reel-cues {
    margin: 0;
    padding: 0;
    list-style: none;
    overflow-y: auto;
}

.pw-reel-cue {
    display: flex;
    align-items: flex-start;
    gap: .55rem;
    width: 100%;
    padding: .55rem .75rem;
    border: 0;
    border-bottom: 1px solid color-mix(in srgb, var(--bs-border-color), transparent 45%);
    /* The strip down the left edge is what the playing cue fills in, so the marker has
       somewhere to appear from rather than shifting the text when it does. */
    border-left: 3px solid transparent;
    background: none;
    color: inherit;
    text-align: left;
    transition: background-color .15s ease, border-color .15s ease;
}

.pw-reel-cue:hover {
    background: color-mix(in srgb, var(--pw-accent, var(--bs-primary)) 8%, transparent);
}

/* What is on now: the accent strip, a filled marker and weight on the title, so it is
   read at a glance from across a room and not just by the play icon. */
.pw-reel-cue.is-playing {
    border-left-color: var(--pw-accent, var(--bs-primary));
    background: color-mix(in srgb, var(--pw-accent, var(--bs-primary)) 14%, transparent);
}

.pw-reel-cue-mark {
    flex: 0 0 1.5rem;
    display: grid;
    place-items: center;
    height: 1.5rem;
    border-radius: 50%;
    background: color-mix(in srgb, var(--pw-ink) 8%, transparent);
    font-size: .72rem;
    color: var(--pw-muted, var(--bs-secondary-color));
}

.pw-reel-cue.is-playing .pw-reel-cue-mark {
    background: var(--pw-accent, var(--bs-primary));
    color: var(--pw-accent-ink, #fff);
}

.pw-reel-cue-body {
    flex: 1 1 auto;
    min-width: 0;
}

.pw-reel-cue-title {
    display: block;
    font-size: .88rem;
    line-height: 1.25;
}

.pw-reel-cue.is-playing .pw-reel-cue-title {
    font-weight: 600;
}

.pw-reel-cue-tags {
    display: flex;
    flex-wrap: wrap;
    gap: .2rem;
    margin-top: .25rem;
}

/* Small enough that a clip filed under several things still fits the column. */
.pw-reel-cue-phase,
.pw-reel-cue-tag {
    padding: .05rem .3rem;
    border-radius: .25rem;
    font-size: .62rem;
    line-height: 1.4;
    white-space: nowrap;
}

.pw-reel-cue-tag {
    border: 1px solid var(--bs-border-color);
    color: var(--pw-muted, var(--bs-secondary-color));
}

.pw-reel-cue-length {
    flex: 0 0 auto;
    padding-top: .1rem;
    font-size: .7rem;
    color: var(--pw-muted, var(--bs-secondary-color));
}

.pw-reel-main {
    min-width: 0;
}

.pw-reel-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .5rem;
    margin-top: .75rem;
}

/* The fullscreen button says which way it goes by asking the browser rather than by
   being told, so pressing Escape cannot leave the label lying about the state. */
.pw-reel-fs-off {
    display: none;
}

.pw-reel-player:fullscreen .pw-reel-fs-on {
    display: none;
}

.pw-reel-player:fullscreen .pw-reel-fs-off {
    display: inline;
}

/* Handed the whole screen, the reel takes it: the page's chrome is gone, and the
   playlist runs beside a picture as wide as what is left. The row is centred rather
   than stretched, because the picture keeps its own proportions and stretching it to
   the screen would put the drawing in the wrong place on the pitch. */
.pw-reel-player:fullscreen {
    align-content: center;
    padding: 1.25rem;
    background: var(--pw-surface, var(--bs-body-bg));
    overflow: auto;
}

    .pw-reel-player:fullscreen .pw-reel-queue {
        max-height: calc(100vh - 2.5rem);
    }

/* A table's cell is the drag handle itself here, so it needs the column's width
   rather than letting the grip float in a full-width cell. */
.pw-reel-order {
    width: 2.5rem;
}

/* ---- The annotation editor ---- */

.pw-va {
    display: flex;
    flex-direction: column;
    gap: .6rem;
}

.pw-va-tools {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .5rem;
    padding: .35rem .5rem;
    background: color-mix(in srgb, var(--pw-chalk), var(--pw-ink) 5%);
    border: 1px solid var(--bs-border-color);
    border-radius: .6rem;
}

.pw-va-tool-group,
.pw-va-tool-actions,
.pw-va-swatches {
    display: flex;
    align-items: center;
    gap: .25rem;
}

.pw-va-style {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .6rem;
    padding-left: .5rem;
    border-left: 1px solid var(--bs-border-color);
}

.pw-va-style-item {
    display: flex;
    align-items: center;
    gap: .3rem;
    margin: 0;
    font-size: .72rem;
    color: var(--bs-secondary-color);
}

/* Each slider's own reading, kept on its label so it cannot be read as belonging
   to the control next to it. */
.pw-va-style-label {
    min-width: 5.4rem;
    white-space: nowrap;
}

/* Solid, dashed or dotted, as three buttons that draw what they mean. */
.pw-va-dashes {
    display: flex;
    align-items: center;
    gap: .15rem;
}

/* Unlike the sliders, this label has no reading to leave room for. */
.pw-va-dash-group .pw-va-style-label {
    min-width: auto;
}

.pw-va-dash-icon {
    width: 1.35rem;
    height: .7rem;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
}

/* The typeface, and whether the label is set heavy or slanted. */
.pw-va-fonts {
    display: flex;
    align-items: center;
    gap: .15rem;
}

.pw-va-font-group .pw-va-style-label {
    min-width: auto;
}

.pw-va-font {
    width: 6rem;
}

/* B and I, each shown in the effect it turns on, which is the whole label. */
.pw-va-letter {
    font-size: .9rem;
    line-height: 1;
}

/* Names the shape the style controls are working on, or "New shapes". */
.pw-va-style-target {
    font-size: .68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    padding: .1rem .4rem;
    border-radius: .25rem;
    background: color-mix(in srgb, var(--pw-accent), transparent 82%);
    color: var(--bs-body-color);
    white-space: nowrap;
}

.pw-va-range {
    width: 5.5rem;
    margin: 0;
}

.pw-va-color {
    width: 2rem;
    height: 2rem;
    padding: 0;
    background: none;
    border: 1px solid var(--bs-border-color);
    border-radius: .45rem;
}

.pw-va-swatch {
    width: 1.2rem;
    height: 1.2rem;
    padding: 0;
    border: 1px solid var(--bs-border-color);
    border-radius: 999px;
}

    .pw-va-swatch.is-on {
        box-shadow: 0 0 0 2px var(--pw-accent);
    }

.pw-va-tool {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2rem;
    height: 2rem;
    padding: 0 .45rem;
    font-size: .85rem;
    color: var(--bs-body-color);
    background: var(--pw-surface);
    border: 1px solid var(--bs-border-color);
    border-radius: .45rem;
}

    .pw-va-tool:hover:not(:disabled) {
        border-color: var(--pw-accent);
        color: var(--pw-accent-text);
    }

    .pw-va-tool:disabled {
        opacity: .4;
    }

    .pw-va-tool.is-on {
        color: var(--pw-accent-contrast);
        background: var(--pw-accent);
        border-color: var(--pw-accent);
    }

/* The picture and its overlay. The aspect ratio is replaced with the clip's own once
   the browser reports it, which is what keeps the overlay exactly over the frame. */
.pw-va-stage {
    position: relative;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    /* The annotator caps the width once it knows the picture's proportions, so a tall
       clip cannot push the timeline off the screen; centred for when it does. */
    margin-inline: auto;
    background-color: #000;
    border-radius: .6rem;
}

.pw-va-video {
    display: block;
    width: 100%;
    height: 100%;
}

.pw-va-overlay {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    touch-action: none;
}

    .pw-va-overlay[data-tool="select"] {
        cursor: default;
    }

    .pw-va-overlay:not([data-tool="select"]) {
        cursor: crosshair;
    }

.pw-va-item.pw-va-hidden {
    display: none;
}

/* Laid under a thin line so it can be grabbed by pointing near it. */
.pw-va-hit {
    stroke: transparent;
    fill: none;
}

/* The same idea for a shape that is grabbed by its middle rather than by its edge: a
   marker round a player is a thin ring of paint, and asking the coach to hit the ring
   itself makes moving one a fiddle. The whole disc takes the pointer instead. */
.pw-va-hit-area {
    fill: transparent;
    stroke: none;
}

/* A spotlight's beam reaches the top of the frame, so it must not swallow the pointer:
   the pool of light on the player is what selects it. */
.pw-va-beam {
    pointer-events: none;
}

/* A label facing the camera. Html inside the picture rather than svg text, because svg
   cannot break a line and a narrowed label has to. The box is only there to lay the text
   out - it must not swallow the pointer, or a label would cover the shapes beside it with
   an invisible rectangle. The text itself does take the pointer, so a label can still be
   picked up and dragged. */
.pw-va-label {
    position: relative;
    pointer-events: none;
    line-height: 1.25;
    paint-order: stroke;
}

    /* A label that follows a player is written over his head: its box is centred on the
       point he was found at and the words are pushed to the foot of it, so they sit just
       clear of him however many lines they run to. */
    .pw-va-label-over {
        display: flex;
        flex-direction: column;
        justify-content: flex-end;
        align-items: center;
        height: 100%;
        text-align: center;
    }

    .pw-va-label-text {
        pointer-events: auto;
    }

/* A magnifier's lens: a round window onto a redrawn piece of the video. Filling its
   foreign object exactly, so the circle it is clipped to is the circle the rim is drawn
   round. The pointer goes through it to the rim and the hit circle underneath, which are
   what the coach grabs. */
.pw-va-lens {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    pointer-events: none;
}

/* Where a carried player is painted: the hole he left filled in with grass borrowed from
   beside it, and the copy of him put down somewhere else. Both are pieces of the frame
   itself, so nothing about it is styled here beyond letting the pointer through to the
   box underneath, which is what the coach takes hold of to move him. */
.pw-va-carry {
    display: block;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

/* What was picked up and where it went, shown only while the clip is stopped: dotted for
   the box round the player as he stands, dashed for where the copy has been put down. */
.pw-va-carry-from,
.pw-va-carry-to {
    opacity: 0.75;
}

/* A clock counting up on the picture. Tabular figures and a fixed width for the tenths
   column, because digits that change ten times a second must not shuffle the number
   sideways under the eye. Takes the pointer so it can be picked up and repositioned. */
.pw-va-clock {
    display: inline-block;
    padding: .1em .3em;
    border-radius: .16em;
    line-height: 1.25;
    font-family: "Roboto", ui-monospace, "Cascadia Mono", Consolas, monospace;
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum" 1;
    font-weight: 700;
    white-space: nowrap;
    pointer-events: auto;
    cursor: move;
}

/* The box a selected label's words are set in, and the grip that drags it narrower so
   they break over more lines. Shown on the label itself rather than drawn in the overlay:
   a label lying on the grass carries a perspective transform, and everything inside it
   goes through the same transform - so the box hugs the words wherever the label lies,
   with no second copy of the perspective maths to keep in step. */
.pw-va-boxed {
    outline: 2px solid rgba(255, 255, 255, .85);
    outline-offset: .08em;
}

    /* Where the box starts, for measuring the drag against. Nothing to see. */
    .pw-va-grip-anchor {
        position: absolute;
        left: 0;
        top: 50%;
        width: 1px;
        height: 1px;
        pointer-events: none;
    }

    /* A name of its own rather than the timeline's grip class: that one is a dark sliver
       stretched down a coloured bar, and inherited here it left the one thing the coach
       has to find and drag all but invisible against his own lettering.

       Sized to be seen against lettering of any colour, and shadowed so it also shows
       against the grass behind it. */
    .pw-va-width-grip {
        position: absolute;
        left: 100%;
        top: 50%;
        width: .34em;
        height: 1.1em;
        margin: -.55em 0 0 .14em;
        border: .05em solid rgba(0, 0, 0, .65);
        border-radius: .1em;
        background: #facc15;
        box-shadow: 0 0 .25em rgba(0, 0, 0, .55);
        pointer-events: auto;
        touch-action: none;
        cursor: ew-resize;
    }

        /* What the pointer actually catches, which reaches well outside the grip itself.
           A control the size of a letter is easy to see and hard to hit, and the coach is
           aiming at it over moving football. */
        .pw-va-width-grip::before {
            content: "";
            position: absolute;
            inset: -.45em -.6em;
        }

        .pw-va-width-grip:hover,
        .pw-va-width-grip:active {
            background: #fde68a;
            border-color: #000;
        }

.pw-va-handle {
    fill: #fff;
    stroke: var(--pw-ink, #111);
    stroke-width: 1.5;
    cursor: grab;
}

/* The handle that turns a label, held off above it on a stalk so it cannot be mistaken
   for the one that moves it. Amber rather than white for the same reason. */
.pw-va-handle-turn {
    fill: #fbbf24;
    cursor: crosshair;
}

.pw-va-turn-arm {
    stroke: #fbbf24;
    stroke-width: 1.5;
    stroke-dasharray: 4 3;
    opacity: .8;
}

/* ---- Transport and timeline ---- */

.pw-va-transport {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .35rem;
}

.pw-va-timecode {
    padding: 0 .5rem;
    font-size: .8rem;
    white-space: nowrap;
}

.pw-va-speed {
    width: auto;
    min-width: 4.5rem;
}

.pw-va-hint {
    margin-left: auto;
    font-size: .75rem;
    color: var(--bs-secondary-color);
}

.pw-va-timeline {
    position: relative;
    padding: .3rem 0;
    cursor: pointer;
    touch-action: none;
}

/* One row per effect, each spanning the whole clip: a label column that selects, and a
   track the effect's bar is dragged and trimmed in. */
.pw-va-lane {
    display: flex;
    align-items: stretch;
    gap: .4rem;
    margin-bottom: .2rem;
}

.pw-va-lane-label {
    display: flex;
    flex: 0 0 8rem;
    align-items: center;
    gap: .35rem;
    padding: 0 .4rem;
    overflow: hidden;
    font-size: .72rem;
    color: var(--bs-secondary-color);
    text-align: left;
    background: none;
    border: 0;
    border-radius: .25rem;
}

.pw-va-lane.is-on .pw-va-lane-label {
    font-weight: 600;
    color: var(--bs-body-color);
    background: color-mix(in srgb, var(--pw-accent), transparent 88%);
}

.pw-va-lane-name {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.pw-va-lane-chip {
    flex: 0 0 auto;
    width: .6rem;
    height: .6rem;
    border: 1px solid rgba(0, 0, 0, .25);
    border-radius: 50%;
}

.pw-va-lane-track {
    position: relative;
    flex: 1 1 auto;
    height: 1.5rem;
    background: color-mix(in srgb, var(--pw-chalk), var(--pw-ink) 8%);
    border: 1px solid var(--bs-border-color);
    border-radius: .35rem;
}

/* The ruler carries the playhead, the pause markers, and scrubbing. */
.pw-va-lane-ruler .pw-va-lane-track {
    height: 1.9rem;
    background: color-mix(in srgb, var(--pw-chalk), var(--pw-ink) 14%);
}

/* One bar per annotation, at the stretch of the clip it shows for. */
.pw-va-bar {
    position: absolute;
    top: .2rem;
    bottom: .2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-width: 10px;
    border-radius: .2rem;
    opacity: .75;
    cursor: grab;
}

    .pw-va-bar.is-on {
        opacity: 1;
        box-shadow: 0 0 0 2px var(--pw-accent);
    }

/* The reading is only worth showing when the bar is wide enough to hold it. */
.pw-va-bar-length {
    flex: 1 1 auto;
    overflow: hidden;
    font-size: .62rem;
    color: rgba(0, 0, 0, .65);
    text-align: center;
    pointer-events: none;
}

/* The grabbable ends. Wider than they look, because trimming a four-second bar on a
   long clip means aiming at a few pixels. */
.pw-va-grip {
    flex: 0 0 auto;
    width: .5rem;
    align-self: stretch;
    border-radius: .2rem;
    background: rgba(0, 0, 0, .3);
    cursor: col-resize;
}

    .pw-va-grip:hover {
        background: rgba(0, 0, 0, .55);
    }

/* A break takes up room on the timeline because it takes up time in the room, so it is a
   block with two grips rather than a marker: the far grip sets how long it holds, the
   near one moves the frame it freezes on. */
.pw-va-pause {
    position: absolute;
    top: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-width: 1.1rem;
    padding: 0;
    overflow: hidden;
    font-size: .6rem;
    color: #fff;
    background: var(--pw-ink, #111);
    border: 0;
    border-radius: .2rem;
    cursor: grab;
}

    .pw-va-pause.is-on {
        background: var(--pw-accent, #0d6efd);
        box-shadow: 0 0 0 2px color-mix(in srgb, var(--pw-accent), transparent 40%);
    }

    /* Centred in whatever room is left between the grips, and never the drag target. */
    .pw-va-pause-icon {
        flex: 1 1 auto;
        pointer-events: none;
    }

/* Driven by the annotator's animation-frame loop, so it moves with the picture. */
.pw-va-playhead {
    position: absolute;
    top: 0;
    bottom: 0;
    left: var(--pw-va-playhead, 0%);
    width: 2px;
    background-color: var(--pw-accent, #0d6efd);
    pointer-events: none;
}

/* A grabbable head on the line: dragging a two-pixel line is a game of darts, and this
   has to be catchable while the clip is playing. */
.pw-va-playhead-knob {
    position: absolute;
    top: -.25rem;
    left: 50%;
    width: 1rem;
    height: 1rem;
    background-color: var(--pw-accent, #0d6efd);
    border: 2px solid #fff;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .4);
    transform: translateX(-50%);
    cursor: grab;
    pointer-events: auto;
}

    .pw-va-playhead-knob:active {
        cursor: grabbing;
    }

/* A label painted onto the grass. Laid down by a perspective transform the module works
   out each frame, which is why this is html and not part of the svg overlay. */
/* A label lying on the grass. The line box is 100px and the letters 82px of it, which is
   what FLAT_BOX_PX in video-annotator.js divides the label's height in metres by to lay
   it down - so a label that breaks over three lines covers three times the grass. The
   height is left to the content for exactly that reason. Everything about the lettering
   itself is written inline, from the same place the upright labels get theirs. */
.pw-va-flat {
    position: absolute;
    inset: 0 auto auto 0;
    line-height: 100px;
    font-size: 82px;
    transform-origin: 0 0;
    pointer-events: none;
    paint-order: stroke;
}

    .pw-va-flat.pw-va-hidden {
        display: none;
    }

/* Sticking a shape to the grass, and the pass that makes it possible. */
.pw-va-pin {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .5rem;
}

.pw-va-check {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    margin: 0;
    white-space: nowrap;
}

/* Typing an angle, for when a particular one is wanted rather than whatever the drag
   lands on. Narrow: it holds at most four characters. */
.pw-va-turn {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    margin: 0;
    white-space: nowrap;
}

    .pw-va-turn input {
        width: 4.5rem;
    }

.pw-va-turn-unit {
    opacity: .7;
}

/* ---- Calibrating the pitch ---- */

/* A landmark the coach has pointed out, drawn as a cross on the picture. */
.pw-va-landmark line,
.pw-va-landmark circle {
    fill: none;
    stroke: #22d3ee;
    stroke-width: 2;
    /* A dark rim under the bright stroke, so a landmark stays visible over both the
       white pitch markings and the dark grass. */
    paint-order: stroke;
    vector-effect: non-scaling-stroke;
}

    .pw-va-landmark.is-on line,
    .pw-va-landmark.is-on circle {
        stroke: #fbbf24;
        stroke-width: 3;
    }

    /* A landmark the fit could not reconcile with the others. Red where the rest are
       blue, because the coach has to find this one cross among twenty to put it right,
       and the panel can only tell him its name. */
    .pw-va-landmark.is-suspect line,
    .pw-va-landmark.is-suspect circle {
        stroke: #f87171;
        stroke-width: 3;
    }

    .pw-va-landmark.is-suspect circle {
        fill: rgba(248, 113, 113, .25);
    }

/* Naming the landmark that disagrees. Not an error state: the calibration works without
   it, so this warns rather than stops. */
.pw-va-suspect {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .1rem .5rem;
    border-radius: .75rem;
    color: #fca5a5;
    background: rgba(248, 113, 113, .12);
    border: 1px solid rgba(248, 113, 113, .35);
}

/* The magnifier that follows the pointer while landmarks are being pointed out. A corner
   flag is a pixel or two wide on a picture scaled to fit a window, and the perspective is
   only ever as good as the clicks it was built from. The module draws into this from the
   video's own full resolution, so it shows detail the stage is not showing at all. */
.pw-va-loupe {
    position: absolute;
    /* Sits over the picture and takes no part in it: every press has to reach the overlay
       underneath, or the glass would swallow the very click it is there to help with. */
    pointer-events: none;
    z-index: 6;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, .85);
    box-shadow: 0 .5rem 1.25rem rgba(0, 0, 0, .45), 0 0 0 1px rgba(0, 0, 0, .35);
    background: rgba(0, 0, 0, .35);
    /* Follows the pointer frame by frame, so any easing would only lag behind it. */
    transition: opacity .12s ease-out;
    opacity: 1;
}

    .pw-va-loupe.pw-va-hidden {
        opacity: 0;
        /* Kept in the layout rather than hidden outright, so showing it again is a fade
           rather than a jump into place. */
        visibility: hidden;
    }

/* The landmark being placed, named beside the glass. Worth the screen space: a click aimed
   at one feature while the list has quietly moved on to another is how a landmark ends up
   the length of the pitch from where it belongs. */
.pw-va-loupe-label {
    position: absolute;
    pointer-events: none;
    z-index: 6;
    max-width: 15rem;
    padding: .15rem .5rem;
    border-radius: .375rem;
    font-size: .75rem;
    font-weight: 600;
    line-height: 1.3;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #0b1220;
    background: rgba(251, 191, 36, .95);
    box-shadow: 0 .25rem .75rem rgba(0, 0, 0, .4);
    transition: opacity .12s ease-out;
    opacity: 1;
}

    .pw-va-loupe-label.pw-va-hidden {
        opacity: 0;
        visibility: hidden;
    }

/* While landmarks are being pointed out the pointer itself is the instrument, so the
   picture gets a crosshair rather than an arrow. */
.pw-va-stage[data-va-calibrating="true"] .pw-va-overlay {
    cursor: crosshair;
}

.pw-va-calibrate-body {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: flex-start;
}

/* The frames a coach has pinned down by hand. Usually one, so this reads as a single
   quiet chip rather than as a list demanding to be filled in. */
.pw-va-cal-frames {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    align-items: center;
}

.pw-va-cal-frame {
    display: inline-flex;
    align-items: center;
}

.pw-va-cal-frame .btn {
    font-variant-numeric: tabular-nums;
}

/* The two buttons of a droppable calibration read as one control, so the seam between
   them is closed up. */
.pw-va-cal-frame .btn:first-child:not(:only-child) {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

.pw-va-cal-frame .btn:last-child:not(:only-child) {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    margin-left: -1px;
}

/* The diagram: a pitch to point at, so a landmark is picked by recognising it rather
   than by reading a name off a list. */
.pw-va-pitch {
    flex: 1 1 22rem;
    max-width: 34rem;
    height: auto;
    border-radius: .4rem;
}

.pw-va-pitch-grass {
    fill: #14532d;
}

.pw-va-pitch-line {
    fill: none;
    stroke: rgba(255, 255, 255, .55);
    stroke-width: .4;
}

.pw-va-pitch-dot {
    fill: rgba(255, 255, 255, .25);
    stroke: rgba(255, 255, 255, .7);
    stroke-width: .4;
    cursor: pointer;
}

    .pw-va-pitch-dot:hover {
        fill: rgba(255, 255, 255, .6);
    }

    .pw-va-pitch-dot.is-placed {
        fill: #22d3ee;
        stroke: #0e7490;
    }

    .pw-va-pitch-dot.is-on {
        fill: #fbbf24;
        stroke: #fff;
        stroke-width: .8;
    }

.pw-va-calibrate-side {
    flex: 1 1 14rem;
    min-width: 12rem;
}

/* The square-metre readout on an area. Outlined so it reads over any colour of grass. */
.pw-va-measure {
    font-weight: 700;
    text-anchor: middle;
    dominant-baseline: middle;
    stroke: rgba(0, 0, 0, .75);
    paint-order: stroke;
    pointer-events: none;
}

/* Shown over the picture while a pause marker is holding the clip. */
.pw-va-countdown {
    position: absolute;
    top: .6rem;
    left: 50%;
    padding: .25rem .6rem;
    font-size: .8rem;
    font-weight: 600;
    color: #fff;
    background: rgba(0, 0, 0, .7);
    border-radius: 2rem;
    transform: translateX(-50%);
    pointer-events: none;
}

    .pw-va-countdown.pw-va-hidden {
        display: none;
    }

    /* A break the coach has stopped on. It says so, because a countdown that has stopped
       counting otherwise reads as one that has got stuck. */
    .pw-va-countdown.pw-va-held {
        background: rgba(180, 83, 9, .85);
    }

.pw-va-panel {
    padding: .5rem .65rem;
    background: var(--pw-surface);
    border: 1px solid var(--bs-border-color);
    border-radius: .5rem;
}

.pw-va-track-controls {
    display: flex;
    align-items: center;
    gap: .4rem;
}

.pw-va-track-state {
    font-size: .75rem;
    color: var(--bs-secondary-color);
}

/* A short number entry with its unit beside it, e.g. "Shows for [4] s". */
.pw-va-field {
    display: flex;
    align-items: center;
    gap: .35rem;
    margin: 0;
    font-size: .8rem;
    color: var(--bs-secondary-color);
    white-space: nowrap;
}

    .pw-va-field input {
        width: 4.5rem;
    }

/* ============================================================================
   The Game Model Poster: the model as a printed broadsheet - a headline, a
   banner of the phases' colors, four columns and a colophon. It is set in type
   and hairlines alone, and the only color on it is each phase's own, which is
   what lets a sheet of five phases be read from across the room. Columns are
   stated once and shared by the head and every row, so the rules line up
   straight down the sheet.
   ============================================================================ */
.pw-poster {
    --pw-poster-columns: minmax(12rem, .95fr) minmax(10rem, 1fr) minmax(10rem, 1.1fr) minmax(10rem, 1.1fr);
    --pw-poster-gutter: clamp(1rem, 2.5vw, 2rem);
    position: relative;
    background-color: var(--pw-surface);
    /* The faintest tint down from the top edge: paper, not a panel. */
    background-image: linear-gradient(180deg, color-mix(in srgb, var(--pw-ink) 3%, transparent), transparent 22rem);
    border: 1px solid var(--pw-ink);
    box-shadow: var(--pw-shadow-2);
    overflow: hidden;
}

/* --- The headline: what is asked for whatever else is going on --- */
.pw-poster-masthead {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1.5rem;
    padding: clamp(1.1rem, 2.2vw, 1.9rem) var(--pw-poster-gutter) clamp(1.2rem, 2.4vw, 1.75rem);
}

.pw-poster-masthead-main {
    min-width: 0;
}

.pw-poster-overline {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: .2rem .9rem;
    margin: 0 0 .7rem;
    font-family: var(--pw-font-mono);
    font-size: .63rem;
    letter-spacing: .22em;
    text-transform: uppercase;
    color: var(--pw-ink);
}

    /* The second half of the line explains the first, so it steps back. */
    .pw-poster-overline span {
        letter-spacing: .14em;
        color: var(--pw-muted);
    }

.pw-poster-headline {
    display: flex;
    flex-wrap: wrap;
    margin: 0;
    padding: 0;
    list-style: none;
}

.pw-poster-headline-item {
    font-family: var(--pw-font-display);
    font-size: clamp(1.6rem, 3.6vw, 2.9rem);
    font-weight: 600;
    line-height: 1.02;
    letter-spacing: .005em;
    text-transform: uppercase;
}

    /* A hairline between the names rather than a comma: they read as equals. */
    .pw-poster-headline-item + .pw-poster-headline-item {
        margin-left: 1.15rem;
        border-left: 1px solid var(--pw-line);
        padding-left: 1.15rem;
    }

.pw-poster-headline-empty,
.pw-poster-blank {
    margin: 0;
    font-size: .85rem;
    color: var(--pw-muted);
}

.pw-poster-blank {
    padding: 1.6rem var(--pw-poster-gutter);
    border-top: 1px solid var(--pw-ink);
}

/* Which model the sheet is of, stamped in the corner. */
.pw-poster-stamp {
    flex: none;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: .15rem;
    padding-left: 1.2rem;
    border-left: 1px solid var(--pw-line);
    text-align: right;
}

.pw-poster-stamp-label {
    font-family: var(--pw-font-mono);
    font-size: .58rem;
    letter-spacing: .2em;
    text-transform: uppercase;
    color: var(--pw-muted);
}

.pw-poster-stamp-name {
    max-width: 12rem;
    font-family: var(--pw-font-display);
    font-size: 1.05rem;
    line-height: 1.15;
    letter-spacing: .02em;
    text-transform: uppercase;
}

/* --- The banner: every phase's color in one strip, and the key to the sheet --- */
.pw-poster-chord {
    display: flex;
    height: .5rem;
}

    .pw-poster-chord > span {
        flex: 1;
        background-color: var(--pw-phase);
    }

/* --- The columns --- */
.pw-poster-columns,
.pw-poster-row {
    display: grid;
    grid-template-columns: var(--pw-poster-columns);
}

.pw-poster-columns {
    /* The heavy rule a printed sheet hangs its columns from. */
    border-bottom: 2px solid var(--pw-ink);
}

    .pw-poster-columns > span {
        padding: .8rem .9rem .55rem;
        font-family: var(--pw-font-mono);
        font-size: .6rem;
        letter-spacing: .18em;
        text-transform: uppercase;
        color: var(--pw-ink);
    }

        .pw-poster-columns > span:first-child {
            padding-left: var(--pw-poster-gutter);
        }

        .pw-poster-columns > span + span {
            border-left: 1px solid var(--pw-line);
        }

/* --- A phase of play to a row --- */
.pw-poster-row {
    position: relative;
    border-bottom: 1px solid var(--pw-line);
}

    /* Sections only: the colophon comes after the last of them. */
    .pw-poster-row:last-of-type {
        border-bottom: 0;
    }

    /* The phase's color down the edge of its own row: the sheet's spine. */
    .pw-poster-row::before {
        content: "";
        position: absolute;
        inset: 0 auto 0 0;
        width: 5px;
        background-color: var(--pw-phase);
        z-index: 1;
    }

.pw-poster-phase {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: .35rem;
    padding: 1.35rem .9rem 1.5rem var(--pw-poster-gutter);
    overflow: hidden;
    /* The color washes out of the spine and is gone before the next column. */
    background-image: linear-gradient(95deg, color-mix(in srgb, var(--pw-phase) 12%, transparent), transparent 85%);
}

/* The numeral printed big and faint behind the phase: the sheet's page number. */
.pw-poster-ghost {
    position: absolute;
    right: .4rem;
    bottom: -1.1rem;
    font-family: var(--pw-font-display);
    font-size: clamp(4.5rem, 8vw, 7rem);
    font-weight: 600;
    line-height: .78;
    letter-spacing: -.04em;
    color: color-mix(in srgb, var(--pw-phase) 16%, transparent);
    pointer-events: none;
}

.pw-poster-numeral {
    position: relative;
    font-family: var(--pw-font-mono);
    font-size: .58rem;
    letter-spacing: .2em;
    text-transform: uppercase;
    /* Kept nearer the ink than the phase color, which a club may pick light. */
    color: color-mix(in srgb, var(--pw-phase) 45%, var(--pw-ink));
}

.pw-poster-phase-name {
    position: relative;
    margin: 0;
    padding-bottom: .4rem;
    /* A rule under the name in the phase's own color, the width of the name itself. */
    border-bottom: 3px solid var(--pw-phase);
    font-family: var(--pw-font-display);
    font-size: clamp(1.45rem, 2.6vw, 2.1rem);
    font-weight: 600;
    line-height: 1.02;
    letter-spacing: .01em;
    text-transform: uppercase;
}

.pw-poster-phase-desc {
    position: relative;
    max-width: 22rem;
    margin: .1rem 0 0;
    font-size: .78rem;
    line-height: 1.4;
    color: var(--pw-muted);
}

/* --- What is coached in the phase --- */
.pw-poster-cell {
    display: flex;
    flex-direction: column;
    gap: .4rem;
    padding: 1.35rem .9rem 1.5rem;
    border-left: 1px solid var(--pw-line);
}

/* One column of the phase is one list, so what separates the entries in it is
   space rather than a rule: a principle and its own words stay together. */
.pw-poster-cell-principle {
    gap: .95rem;
}

.pw-poster-lead {
    display: block;
    font-family: var(--pw-font-display);
    font-size: clamp(1rem, 1.5vw, 1.2rem);
    font-weight: 600;
    line-height: 1.1;
    letter-spacing: .015em;
    text-transform: uppercase;
}

/* What the principle asks for. Set in the body face so it reads as a sentence
   against the condensed caps above it. */
.pw-poster-lead-desc {
    display: block;
    max-width: 24rem;
    margin-top: .3rem;
    font-family: var(--pw-font-body);
    font-size: .76rem;
    font-weight: 400;
    line-height: 1.4;
    letter-spacing: 0;
    text-transform: none;
    color: var(--pw-muted);
}

/* The figure a principle is filed under: the phase, then its place in the phase. */
.pw-poster-index {
    display: block;
    margin-bottom: .2rem;
    font-family: var(--pw-font-mono);
    font-size: .56rem;
    font-weight: 400;
    letter-spacing: .16em;
    color: color-mix(in srgb, var(--pw-phase) 45%, var(--pw-ink));
}

.pw-poster-item {
    position: relative;
    padding-left: 1rem;
    font-size: .85rem;
    line-height: 1.35;
}

    /* A short rule before each, a shade lighter the deeper the column, so how far
       into the detail the eye has read shows without a second color. */
    .pw-poster-item::before {
        content: "";
        position: absolute;
        left: 0;
        top: .62em;
        width: .5rem;
        height: 2px;
        background-color: var(--pw-poster-mark, var(--pw-phase));
    }

.pw-poster-cell-sub {
    --pw-poster-mark: color-mix(in srgb, var(--pw-phase) 70%, transparent);
}

.pw-poster-cell-nested {
    --pw-poster-mark: color-mix(in srgb, var(--pw-phase) 40%, transparent);
}

/* Said of a sub-principle asked for across the phase with no principle above it,
   and of a phase nothing has been written for yet. */
.pw-poster-tag {
    font-family: var(--pw-font-mono);
    font-size: .58rem;
    letter-spacing: .16em;
    text-transform: uppercase;
    color: color-mix(in srgb, var(--pw-phase) 45%, var(--pw-ink));
}

.pw-poster-tag-quiet {
    color: var(--pw-muted);
}

.pw-poster-group {
    display: flex;
    flex-direction: column;
    gap: .3rem;
    padding-left: .7rem;
    border-left: 1px solid color-mix(in srgb, var(--pw-phase) 35%, transparent);
}

    .pw-poster-group + .pw-poster-group,
    /* The ones asked for across the phase, listed after the named groups. */
    .pw-poster-group + .pw-poster-item {
        margin-top: .6rem;
    }

/* Which sub-principle the ones beside it were written under. */
.pw-poster-group-label {
    font-family: var(--pw-font-mono);
    font-size: .56rem;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--pw-muted);
}

.pw-poster-group .pw-poster-item {
    padding-left: .8rem;
}

/* ============================================================================
   The wheel poster: the same sheet, with the wheel as the picture and a key
   beside it. Everything the two posters share - masthead, chord, stamp,
   colophon, print pipeline - is inherited from .pw-poster above.
   ============================================================================ */
.pw-poster-plate {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(16rem, .85fr);
    align-items: center;
    gap: var(--pw-poster-gutter);
    padding: clamp(1rem, 2.2vw, 1.9rem) var(--pw-poster-gutter) clamp(1.2rem, 2.4vw, 2rem);
}

.pw-poster-wheel-stage {
    /* The wheel is the picture, so it takes whatever the plate gives it. */
    min-width: 0;
}

.pw-poster-key-head {
    margin: 0 0 .9rem;
    padding-bottom: .5rem;
    border-bottom: 2px solid var(--pw-ink);
    font-family: var(--pw-font-mono);
    font-size: .6rem;
    letter-spacing: .18em;
    text-transform: uppercase;
    color: var(--pw-ink);
}

.pw-poster-key-list {
    display: flex;
    flex-direction: column;
    gap: .9rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

/* One phase of the key: its color, its number, and what is coached in it. */
.pw-poster-key-item {
    display: grid;
    grid-template-columns: .35rem auto minmax(0, 1fr);
    align-items: start;
    gap: 0 .7rem;
}

.pw-poster-key-swatch {
    align-self: stretch;
    min-height: 100%;
    border-radius: 1px;
    background-color: var(--pw-phase);
}

.pw-poster-key-numeral {
    font-family: var(--pw-font-mono);
    font-size: .72rem;
    line-height: 1.5;
    letter-spacing: .1em;
    color: color-mix(in srgb, var(--pw-phase) 72%, var(--pw-ink));
}

.pw-poster-key-body {
    display: flex;
    flex-direction: column;
    gap: .18rem;
    min-width: 0;
}

.pw-poster-key-name {
    font-family: var(--pw-font-display);
    font-size: clamp(.95rem, 1.35vw, 1.15rem);
    font-weight: 600;
    line-height: 1.1;
    letter-spacing: .015em;
    text-transform: uppercase;
}

.pw-poster-key-desc {
    font-size: .76rem;
    line-height: 1.4;
    color: var(--pw-muted);
}

.pw-poster-key-count {
    margin-top: .1rem;
    font-family: var(--pw-font-mono);
    font-size: .56rem;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--pw-muted);
}

/* What the tints mean, set apart from the key it explains. */
.pw-poster-key-foot {
    margin: 1.1rem 0 0;
    padding-top: .7rem;
    border-top: 1px solid var(--pw-line);
    font-size: .72rem;
    line-height: 1.45;
    color: var(--pw-muted);
}

@media (max-width: 991.98px) {
    .pw-poster-plate {
        grid-template-columns: 1fr;
    }
}

/* --- The colophon: what is on the sheet, told in figures --- */
.pw-poster-colophon {
    display: flex;
    flex-wrap: wrap;
    gap: .3rem 1.6rem;
    padding: .7rem var(--pw-poster-gutter) .8rem;
    border-top: 2px solid var(--pw-ink);
    font-family: var(--pw-font-mono);
    font-size: .58rem;
    letter-spacing: .16em;
    text-transform: uppercase;
    color: var(--pw-muted);
}

/* The column headings are repeated inside each cell for a screen too narrow to
   hold four columns, where the sheet stacks instead. */
.pw-poster-cell-label {
    display: none;
}

@media (max-width: 991.98px) {
    .pw-poster-columns {
        display: none;
    }

    .pw-poster-row {
        grid-template-columns: 1fr;
    }

    .pw-poster-cell {
        border-left: 0;
        border-top: 1px dashed var(--pw-line);
        padding: 1rem var(--pw-poster-gutter);
    }

    .pw-poster-cell-label {
        display: block;
        margin-bottom: .1rem;
        font-family: var(--pw-font-mono);
        font-size: .56rem;
        letter-spacing: .16em;
        text-transform: uppercase;
        color: var(--pw-muted);
    }
}

.pw-poster-actions {
    display: flex;
    justify-content: flex-end;
    margin-bottom: .6rem;
}

/* Pinned to a wall is where this belongs, so it prints as what it is. */
@media print {
    .pw-poster {
        border-color: var(--pw-ink);
        box-shadow: none;
    }

    .pw-poster-row {
        break-inside: avoid;
    }

    /* The phases' colors are the sheet itself, not decoration on it. */
    .pw-poster-chord,
    .pw-poster-row::before,
    .pw-poster-phase {
        print-color-adjust: exact;
        -webkit-print-color-adjust: exact;
    }

    .pw-poster-actions {
        display: none;
    }
}

/* ============================================================================
   Pinning the sheet for a print.

   The poster breathes with the window: its gutters and its type are set in
   clamps against the viewport, which is right on a screen and wrong on paper.
   Print resolves a viewport unit against the page box, so the sheet the script
   measures on a wide screen is not the sheet the printer lays out - and a sheet
   a few percent taller than measured is a second piece of paper.

   So for the length of a print every viewport-relative length on the sheet is
   held at the size a wide screen gives it: the most generous of the range, and
   the same number on both sides of the measurement. The flag is set before the
   script measures and cleared after the print, so this is what it measures and
   what comes out.
   ============================================================================ */
:root[data-pw-print-poster] .pw-poster {
    --pw-poster-gutter: 2rem;
}

    :root[data-pw-print-poster] .pw-poster-masthead {
        padding: 1.9rem var(--pw-poster-gutter) 1.75rem;
    }

    :root[data-pw-print-poster] .pw-poster-plate {
        padding: 1.9rem var(--pw-poster-gutter) 2rem;
    }

    :root[data-pw-print-poster] .pw-poster-headline-item {
        font-size: 2.9rem;
    }

    :root[data-pw-print-poster] .pw-poster-ghost {
        font-size: 7rem;
    }

    :root[data-pw-print-poster] .pw-poster-phase-name {
        font-size: 2.1rem;
    }

    :root[data-pw-print-poster] .pw-poster-lead {
        font-size: 1.2rem;
    }

    :root[data-pw-print-poster] .pw-poster-key-name {
        font-size: 1.15rem;
    }

/* ============================================================================
   Printing a poster by its own button: the sheet alone, on one side of one piece
   of paper, looking like what is on the screen. The flag is set on <html> by
   js/poster-print.js only for the length of the print, so printing any other
   page is unaffected. The paper is turned landscape by a rule the same script
   adds, since @page cannot be put behind a selector.

   Everything that is not the poster, inside it, or an ancestor of it is dropped
   outright. Hiding it instead would leave the page as tall as the app around the
   sheet, and the browser would page out the emptiness.

   The sheet is then held at the width it has on the screen - print lays out to
   the paper, which is much narrower, and would reflow the sheet into something
   nobody has seen - and shrunk with zoom, which takes the box down with what is
   drawn in it. A transform would leave a sheet thousands of pixels wide behind
   the shrunken picture, and that is what was spilling onto further pages.
   Holding the width means nothing reflows: what comes out of the printer is the
   sheet on the screen, smaller.
   ============================================================================ */
@media print {
    :root[data-pw-print-poster] body
    :not(.pw-poster):not(.pw-poster *):not(:has(.pw-poster)) {
        display: none !important;
    }

    /* The wrappers the sheet hangs in give up their own contribution to the page:
       an app's padding and max-width have nothing to do with a printed poster. */
    :root[data-pw-print-poster] body,
    :root[data-pw-print-poster] body :has(.pw-poster) {
        max-width: none !important;
        min-height: 0 !important;
        height: auto !important;
        padding: 0 !important;
        margin: 0 !important;
        border: 0 !important;
        overflow: visible !important;
        background: none !important;
        box-shadow: none !important;
    }

    :root[data-pw-print-poster] .pw-poster {
        width: var(--pw-poster-print-width, auto);
        max-width: none;
        /* Centred, because a sheet taller than the paper is shape leaves the paper
           over on one side or the other and the margin should be even. */
        margin: 0 auto;
        zoom: var(--pw-poster-print-scale, 1);
    }

    /* What is on paper is what was on screen. The app's print rules blanch every
       article white and every word black so a table of figures reads plainly; a
       poster is the one page where the colors are the content, so every one of
       them is asked for by name. The sheet's own paper and ink are left exactly
       as the screen sets them - overriding them here is how the sheet came out
       with no background at all. */
    :root[data-pw-print-poster] .pw-poster,
    :root[data-pw-print-poster] .pw-poster * {
        print-color-adjust: exact !important;
        -webkit-print-color-adjust: exact !important;
    }

    /* The blanching rules reach inside the sheet, so what they touch is put back:
       a word on the poster is the color the poster gave it, not the flat black an
       article of prose is printed in. */
    :root[data-pw-print-poster] .pw-poster {
        color: var(--pw-ink) !important;
    }

    :root[data-pw-print-poster] .pw-poster a {
        color: inherit !important;
    }

    /* Whole, or it is not a poster: nothing on the sheet may be broken across a
       page. It is measured to fit one, so any break is a fault worth showing. */
    :root[data-pw-print-poster] .pw-poster,
    :root[data-pw-print-poster] .pw-poster-row,
    :root[data-pw-print-poster] .pw-poster-cell {
        break-inside: avoid-page;
    }
}

/* Respect users who prefer less motion. */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
}
