/* Every modal on the site: the parts they all share first, then each modal's
   own rules, under its name. Linked straight after main.css by
   pcf_render_stylesheets(), on every page that links main.css, so a page's own
   sheet comes after this one.

   The shared parts are the vocabulary every modal is built from - .modalBackdrop,
   .modal, .modalHeader, .modalTitle, .modalBody, .modalSection, .modalField, .modalLabel, .modalInput, .modalHint,
   .modalStatus, .modalActions, and the rest below - and a modal reaches for one of them
   before it names anything of its own. What a modal keeps of its own is sized
   on its id, or named for the modal (memo…, pickHistory…, logo…, payout…). */

/* ── The modal system ───────────────────────────────────────────────────── */

/* The dimming runs to the window's right edge, over the score strip and the
   page's scrollbar gutter alike; the gutter's width comes back as padding, so
   the modal still centres on the content beside the gutter (see
   --db-scroll-gutter in main.css). */
.modalBackdrop{
    align-items: center;
    background: rgb(from var(--c1) r g b / 0.6);
    -webkit-backdrop-filter: blur(1px);
    box-sizing: border-box;
    display: none;
    justify-content: center;
    padding: 0 var(--db-scroll-gutter, 0px) 0 0;
    position: fixed;
    z-index: 310;
    border-radius: 0;
    bottom: var(--db-edge-gap);
    left: var(--db-content-left);
    overflow: hidden;
    right: var(--db-edge-gap);
    top: var(--db-edge-gap);
}

.modalBackdrop.is-visible{
    display: flex;
}

/* Anything in a modal that is marked hidden stays hidden, whatever display
   its class gives it. */
.modalBackdrop [hidden],
.modalFrame [hidden],
.prizeSheet [hidden]{
    display: none;
}

/* A backdrop is inset to the dashboard's content area, so a modal centres
   there rather than in the raw window. The landing page has no sidebar, only
   the corner badge, so there the backdrop covers the whole window. */
#landingPageBody .modalBackdrop{
    inset: 0;
    border-radius: 0;
    padding: 20px;
}

/* On the dashboard, the backdrop's lower left corner follows the sidebar's
   elbow. */
#leagueBody .modalBackdrop{
    border-bottom-left-radius: var(--db-sidebar-elbow-radius);
}

/* The parking backdrops of the commissioner tools must never paint: they hold
   the panels not in use, and a panel is only visible once moved into the tools
   modal's pane. */
.modalBackdrop.modalParked{
    display: none;
}

.modal{
    background: var(--c-surface);
    font-family: var(--ff-body);
    font-size: var(--fs-small1);
    color: var(--c-text-primary);
    border-radius: var(--r3);
    box-sizing: border-box;
    padding: 32px;
    /* The panel is the box its close button measures its corner from. */
    position: relative;
    max-width: 100%;
    width: fit-content;
    /* Held to the backdrop it sits in, less 48px above and below, and never
       taller than the backdrop where it is inset (--db-edge-gap). One that
       reaches it scrolls, in the modals' scrollbar (below). A modal whose body
       scrolls on its own lets the panel's overflow show instead (see .modalBody),
       so the select menus that open inside it are not clipped at its edge. */
    max-height: calc(100% - 96px);
    overflow-y: auto;
}

/* Every scrollbar in a modal is an overlay one, as a Mac draws them with a
   trackpad, whatever the viewer's system shows elsewhere. The browser's own
   bar is hidden in everything inside a backdrop, so it never takes room from
   the content, and site.js draws a thin thumb over the right or bottom edge of
   whatever scrolls (.overlayScrollbar, below). Zero specificity, so a part
   that hides its bar in its own rule still does. A part whose scrolling is
   shown some other way - fades of its own - sets --scroll-cues: none and
   gets neither the thumb nor the fades below. */
:where(.modalBackdrop, .modalBackdrop *){
    scrollbar-width: none;
}

:where(.modalBackdrop, .modalBackdrop *)::-webkit-scrollbar{
    display: none;
}

/* The thumb: in the backdrop rather than in what scrolls, so it stays put
   while the content moves under it, and placed by site.js over that part's
   edge. Seen while the part scrolls or is pointed at, and while the thumb is
   hovered or dragged; faded out a second after. */
.overlayScrollbar{
    background: var(--scrollbar-thumb);
    border-radius: 999px;
    cursor: default;
    opacity: 0;
    pointer-events: none;
    position: absolute;
    transition: opacity .3s ease, background-color .12s ease;
    z-index: 3;
}

.overlayScrollbar--y{
    width: 6px;
}

.overlayScrollbar--x{
    height: 6px;
}

.overlayScrollbar.is-visible{
    opacity: 1;
    pointer-events: auto;
    transition: opacity .12s ease, background-color .12s ease;
}

.overlayScrollbar:hover,
.overlayScrollbar.is-dragging{
    background: var(--c1-n9);
}

/* A fade to the background along an edge of a modal's main scrolling part -
   the panel, its .modalBody or .modalPages, or a .modalScroll - with more past that edge: at
   the bottom while there is more below, at the top once scrolled down from
   the top. In the backdrop like the thumb, and placed and shown by site.js,
   which sets the part's own background as --scroll-fade-color and rounds the
   fade's corners as the part's are. Under the close button and the thumb, and
   never in the way of a click. */
.scrollFade{
    --scroll-fade-color: var(--c-surface);
    height: 40px;
    opacity: 0;
    pointer-events: none;
    position: absolute;
    transition: opacity .16s linear;
    z-index: 1;
}

.scrollFade--top{
    background: linear-gradient(to bottom, var(--scroll-fade-color), transparent);
}

.scrollFade--bottom{
    background: linear-gradient(to top, var(--scroll-fade-color), transparent);
}

.scrollFade.is-visible{
    opacity: 1;
}

/* A modal whose title and close button stay put while what is under them
   scrolls: the panel is a column, and its .modalBody alone scrolls, as tall as its
   content up to the panel's height. */
.modal:has(> .modalBody){
    display: flex;
    flex-direction: column;
    overflow: visible;
}

.modal:has(> .modalBody) > .modalHeader{
    flex: 0 0 auto;
}

.modalBody{
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
}

/* An alert holds a sentence or two, which would otherwise stretch the modal
   into one long line across the page. */
.modal[role="alertdialog"]{
    width: 480px;
}

/* --- The header ----------------------------------------------------------- */

.modalHeader{
    align-items: center;
    display: flex;
    justify-content: space-between;
    margin-bottom: 18px;
}

.modalHeader:has(+ .modalBlurb){
    margin-bottom: 0px;   
}

/* The close button sits in the modal's corner rather than in the header row,
   so the row keeps the button's 32px height and gives up its right side to
   clear it: the button ends 46px in from the panel's edge. */
.modalHeader:has(.modalCloseX){
    min-height: 32px;
    padding-right: 28px;
}

/* A header ruled off from what is under it, for a modal whose content starts
   straight below the line - a wrap-up's story, a team's schedule. */
.modalHeader--ruled{
    border-bottom: 1px solid var(--c1-n4);
    margin-bottom: 0;
    padding-bottom: 14px;
}

.modalTitle{
    font-size: var(--fs-big4);
    font-weight: var(--fw3);
    line-height: 1.4;
    margin: 0;
}

/* A line over the title that says what kind of thing it names - the week's
   wrap-up, the league an entry is being made in. */
.modalEyebrow{
    color: var(--c-text-muted);
    font-family: var(--ff-body);
    font-size: var(--fs-small3);
    font-weight: var(--fw3);
    letter-spacing: var(--ls2);
    line-height: 1.25;
    text-transform: uppercase;
}

.modalEyebrow + .modalTitle{
    margin-top: 2px;
}

/* Under an eyebrow the title's line starts the eyebrow's line and 2px lower,
   so the close button goes down with it. The eyebrow's line-height is set
   rather than left to the font so that this can count it. */
.modalHeader:has(.modalEyebrow){
    --modal-title-top: calc(32px + 1.25 * var(--fs-small3) + 2px);
    --modal-title-line: calc(1.4 * var(--fs-big4));
}

.modalTitleMeta{
    color: var(--c-text-muted);
    font-size: var(--fs-body);
    font-weight: var(--fw1);
}

/* Controls at the end of the header row, beside the title: a menu, a status,
   a bell. */
.modalControls{
    align-items: center;
    display: flex;
    flex: 0 0 auto;
    gap: var(--g2);
}

/* "Saved" beside a title after a change that saves itself. Shown with
   is-visible, red with is-error. */
.modalSaveStatus{
    color: var(--c-text-muted);
    font-family: var(--ff-body);
    font-size: var(--fs-small1);
    opacity: 0;
    transition: opacity .2s ease;
}

.modalSaveStatus.is-visible{
    opacity: 1;
}

.modalSaveStatus.is-error{
    color: var(--c-red);
}

.modalHeader > .modalSaveStatus{
    margin: 0 16px 0 auto;
}

/* The one close button for every modal on the site: a plain x in a round,
   borderless button that fills in faintly on hover, 24px in from the right
   edge of its modal and centred on the line of its title.

   The centring is measured from the panel's top edge: the title's line starts
   --modal-title-top below it (the panel's 32px padding, unless a header puts
   more above the title), and the button sits half of what that line is taller
   than its own 32px further down. --modal-title-line is the line's height,
   counted as at least 32px because a header row is never shorter than the
   button (see .modalHeader:has(.modalCloseX)).

   It belongs to the top of its modal, so it goes when the modal is scrolled
   away from the top. Where the whole panel scrolls, the button is in what
   scrolls and goes with it on its own. Where the panel keeps its header and a
   body under it scrolls - marked data-modal-scroll - site.js writes how far
   that body has scrolled to --modal-scroll-offset, and the button rises by
   the same distance and is cut off at the panel's top edge, so it leaves as
   the content does. --modal-close-top is its distance from that edge. */
.modalCloseX{
    --modal-close-top: calc(var(--modal-title-top, 32px) + (var(--modal-title-line, max(32px, 1.4 * var(--fs-big4))) - 32px) / 2);
    position: absolute;
    top: var(--modal-close-top);
    right: 24px;
    translate: 0 calc(-1 * var(--modal-scroll-offset, 0px));
    /* 4px of room on every side for the focus outline, except past the panel's
       top edge once the button reaches it. */
    clip-path: inset(max(-4px, var(--modal-scroll-offset, 0px) - var(--modal-close-top)) -4px -4px -4px);
    z-index: 2;
    appearance: none;
    -webkit-appearance: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--c1-n8);
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    transition: background-color 140ms ease, color 140ms ease;
}

@media (hover: hover) {
    .modalCloseX:hover{
        background: rgba(23, 33, 54, 0.07);
        color: var(--c-text-primary);
    }
}

.modalCloseX:active{
    background: rgba(23, 33, 54, 0.12);
    color: var(--c-text-primary);
}

/* An outline rather than the hover fill: a modal moves focus to this button
   as it opens, and the browser counts that as keyboard focus whenever the
   modal was opened from the keyboard. */
.modalCloseX:focus-visible{
    outline: 2px solid var(--c2);
    outline-offset: 2px;
}

/* --- The content ---------------------------------------------------------- */

.modalSection{
    font-size: var(--fs-body);
    display: flex;
    gap: var(--g3);
    padding-bottom: 18px;
}

.modalSection--column{
    flex-direction: column;
}

/* A rule after a section is the space under it already. */
.modalSection:has(+ .modalRule){
    padding-bottom: 0;
}

.modalSection ~ .modalSection{
    border-top: 1px solid var(--c1-n7);
    padding: 18px 0;
}

.modalSectionTitle{
    margin: 0;
    font-family: var(--ff-body);
    font-size: var(--fs-small2);
    font-weight: var(--fw3);
    letter-spacing: var(--ls3);
    text-transform: uppercase;
}

.settingLabel{
    font-weight: var(--fw1);
    color: var(--c-text-muted);
}

.settingLabel ~ .settingLabel{
    margin-top: 12px;
}

.settingValue{
    font-weight: var(--fw3);
}

/* A divider across the modal's content box, in the grey the sections are
   ruled off in. */
.modalRule{
    border: 0;
    border-top: 1px solid var(--c1-n7);
    flex: 0 0 auto;
    margin: 18px 0;
}

/* A sentence or two under the title, saying what the modal is for. */
.modalBlurb{
    color: var(--c-text-muted);
    font-family: var(--ff-body);
    line-height: 1.4;
    flex: 0 0 auto;
    /* No margin above, whatever element carries it. */
    margin-top: 0;
    margin-bottom: 18px;
    text-align: left;
    box-sizing: border-box;
    width: 0;
    min-width: 100%;
}

/* A blurb that is a list of points rather than a sentence. */
ul.modalBlurb{
    display: flex;
    flex-direction: column;
    gap: var(--g2);
    padding-left: 18px;
}

/* A blurb that runs to two paragraphs separates them with a blank line: 1lh
   is one line of the blurb's own text, so it stays a blank line whatever the
   type size. */
.modalBlurb > p{
    margin: 0;
}

.modalBlurb > p + p{
    margin-top: 1lh;
}

/* A line under everything else, ruled off from it: where the content came
   from, or when. */
.modalFooter{
    border-top: 1px solid var(--c1-n4);
    color: var(--c-text-muted);
    flex: 0 0 auto;
    font-family: var(--ff-body);
    font-size: var(--fs-small3);
    margin-top: 14px;
    padding-top: 10px;
}

/* A grey panel inside a modal - the payout editor in the league builder. */
.modalPanel{
    /*background: var(--c1-n3);*/
    padding: 24px;
    border-radius: var(--r2);
}

/* Two columns side by side, a hairline between them: the theme modal's logo
   and colours. */
.modalColumns{
    align-items: stretch;
    display: flex;
}

.modalColumn{
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.modalColumn:first-child{
    padding-right: 24px;
}

.modalColumn + .modalColumn{
    border-left: 1px solid var(--c1-n7);
    padding-left: 24px;
}

/* A list of samples, each beside what it means - the legends. */
.modalList{
    display: flex;
    flex-direction: column;
    gap: var(--g3);
    list-style: none;
    margin: 0;
    padding: 0;
}

.modalListItem{
    align-items: center;
    display: grid;
    gap: 16px;
    grid-template-columns: 52px 1fr;
}

.modalSample{
    display: flex;
    font-size: var(--fs-body);
    justify-content: center;
}

/* Nothing to show, or not yet: one quiet line in the middle of the room the
   content would take. */
.modalEmpty{
    color: var(--c-text-muted);
    font-family: var(--ff-body);
    font-size: var(--fs-body);
    margin: 0;
    padding: 24px 0;
    text-align: center;
}

/* A ring that turns while something loads. */
.modalSpinner{
    animation: spin 1.6s linear infinite;
    border: 3px solid var(--c1-n4);
    border-radius: 50%;
    border-top-color: var(--c1);
    box-sizing: border-box;
    height: 36px;
    width: 36px;
}

/* --- Forms ---------------------------------------------------------------- */

/* A form of several fields, spaced evenly down the modal, its actions as
   close under the last as the fields are to one another. */
.modalForm{
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.modalForm > .modalActions,
.modalForm > .modalStatus{
    margin-top: 0;
}

.modalForm > .modalStatus{
    margin-bottom: 0;
}

/* A row of a form: the setting's name in a fixed column and its control
   beside it, so every control starts on the same line. A modal whose names
   are shorter sets a narrower column, or a different gap beside it, through
   the two properties. */
.modalRow{
    align-items: center;
    column-gap: var(--modal-row-gap, 16px);
    display: grid;
    grid-template-columns: var(--modal-row-label-width, 180px) minmax(0, 1fr);
    row-gap: var(--g1);
}

/* A row's name and first control share a first line one standard control tall
   (--button-height-standard, in main.css), and both are centred in it. So every
   name sits the same distance under its section's heading whatever its
   control, and stays centred on that control: a text field or a row of
   segment buttons fills the line, and a shorter one - a switch, a checkbox -
   sits in its middle. Whatever comes under the first control (a hint, the
   chips, an error, more checkboxes) runs on below the line in the control's
   column, and never moves the name.

   The field around a row's control lets its parts into the row itself, so its
   first control is the one placed beside the name. The parts keep the field's
   6px between them, as the row's own gap between lines, and as the field
   did, none of them widens the column past the row.

   Not every row: one that shows a value instead of a control (League
   Settings), the payout editor across the whole form, and a row with no name
   of its own, whose control continues the row above it, have no first line
   to hold. Beside the name only - a name stacked over its control (below)
   needs no line. */
.modalRow:not(.modalRow--full) > .modalField{
    display: contents;
}

.modalRow:not(.modalRow--full) > .modalField > *{
    min-width: 0;
}

@media (min-width: 641px) {
    .modalRow:not(.modalRow--full, :has(> .settingValue, > :first-child:empty)){
        grid-template-rows: minmax(var(--button-height-standard), auto);
    }

    .modalRow:not(.modalRow--full, :has(> .settingValue)) > :first-child{
        grid-area: 1 / 1;
    }

    /* Centred in its line whatever its own alignment - a switch keeps to the
       top of a field, which no longer holds it. */
    .modalRow:not(.modalRow--full, :has(> .settingValue)) > :not(:first-child),
    .modalRow:not(.modalRow--full) > .modalField > *{
        align-self: center;
        grid-column: 2;
    }
}

.modalRow.is-hidden,
.modalRow[hidden]{
    display: none;
}

/* A row whose name column is only as wide as its name, and set off from its
   control by the gap between a field's parts. */
.modalRow--fit{
    --modal-row-gap: var(--g1);
    --modal-row-label-width: max-content;
}

/* A row shown only while the setting above it calls for it; the page script
   toggles is-visible. */
.modalRow--reveal{
    display: none;
}

.modalRow--reveal.is-visible{
    display: grid;
}

/* The payout editor takes the whole width of the form rather than the control
   column: it is a panel of its own, not a field with a label beside it. */
.modalRow--full.is-visible{
    display: block;
}

/* Controls a row reveals in place - a kickoff reminder's selects while its
   switch is on, the account fields while they are being changed - opening by
   height, with what is below sliding down rather than jumping. Its one child
   holds them. site.js's setModalExpanded() adds is-visible to open it.

   It runs from a grid row of 0fr to 1fr, so no height has to be guessed.
   Opening, the height leads and the fade follows behind, so the controls
   never appear before there is room for them; closing, the fade is the
   shorter, so they are gone before the space closes, and the whole is
   quicker, because the member has already decided. Ease-out as they arrive,
   ease-in as they leave. visibility goes hidden only once it has closed, so
   they leave the tab order without cutting the animation short.

   The times are for a line of controls; a taller reveal sets longer ones
   through the properties, so it seems to move at the same speed. */
.modalExpand{
    --expand-open: 200ms;
    --expand-close: 150ms;
    --expand-fade-in: 150ms;
    --expand-fade-delay: 50ms;
    --expand-fade-out: 100ms;
    display: grid;
    grid-template-rows: 0fr;
    opacity: 0;
    transition:
        grid-template-rows var(--expand-close) ease-in,
        opacity var(--expand-fade-out) ease-in,
        visibility 0s linear var(--expand-close);
    visibility: hidden;
}

.modalExpand.is-visible{
    grid-template-rows: 1fr;
    opacity: 1;
    transition:
        grid-template-rows var(--expand-open) ease-out,
        opacity var(--expand-fade-in) ease-out var(--expand-fade-delay),
        visibility 0s;
    visibility: visible;
}

/* Clipped while it opens and closes, but not once open, where a select's
   menu or a field's focus ring would be cut off at its edge. site.js adds
   is-open when the opening ends. */
.modalExpand > *{
    min-height: 0;
    overflow: hidden;
}

.modalExpand.is-open > *{
    overflow: visible;
}

@media (prefers-reduced-motion: reduce) {
    .modalExpand,
    .modalExpand.is-visible{
        transition: none;
    }
}

/* A select in a row sits at the start of its column, at its own width. */
.modalRow > .selectMenu{
    justify-self: start;
    max-width: 100%;
}

@media (max-width: 640px) {
    /* The name goes above its control rather than beside it. */
    .modalRow{
        column-gap: var(--g1);
        grid-template-columns: 1fr;
    }
}

/* Controls on one line, wrapping only where the modal is too narrow for
   them: a field and its note, a search and its Add, a link and its Copy. */
.modalInline{
    align-items: center;
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: var(--g2) var(--g2);
}

.modalInline > .modalInput:not(.modalInput--limit){
    flex: 1 1 0;
    min-width: 0;
}

.modalInline > .modalField,
.modalInline > .btn-standard,
.modalInline > .btn-lg{
    flex: 0 0 auto;
}

/* A note beside a field in the league builder wraps within the row rather
   than widening the modal, which sizes itself to its rows. */
.modalFrameContent .modalInline > .modalHint{
    flex: 1 1 0;
    min-width: 0;
}

.modalInline > .modalOption{
    white-space: nowrap;
}

/* A control's name on its own line, before it, in the row's value column. */
.modalInlineLabel{
    color: var(--c-text-muted);
    font-size: var(--fs-small2);
    white-space: nowrap;
}

.modalInline > .modalActions{
    align-self: flex-end;
    margin-top: 0;
}

/* "Pay the top", the count, and "finishers" read as one line of words, so
   they share a baseline rather than centring on one another. */
.modalInline.modalInputSentence{
    align-items: baseline;
    font-size: var(--fs-small2);
}

/* A field: its label over its control, and under it any error the control
   has, spaced by the field's gap. A label beside its control is a .modalRow. */
.modalField{
    display: flex;
    flex-direction: column;
    gap: var(--g1);
    min-width: 0;
}

.modalField.is-hidden,
.modalField[hidden]{
    display: none;
}

.modalLabel{
    display: block;
    font-weight: var(--fw1);
}

.modalLabel--small{
    font-size: var(--fs-small2);   
}

.modalLabel.is-disabled{
    cursor: default;
}

/* A checkbox and its words on one line: a label wrapping both. */
.modalOption{
    align-items: flex-start;
    cursor: pointer;
    display: flex;
    font-weight: var(--fw1);
    gap: var(--g2);
    margin: 0;
}

/* The box centred on the first line of its words, however many lines they
   wrap to: in their font, 1lh is that line's height. */
.modalOption > input[type="checkbox"]{
    font: inherit;
    margin-top: calc((1lh - 12px) / 2);
}

/* A switch and its words on one line, centred on each other. */
.modalOption--switch{
    align-items: center;
    font-size: var(--fs-small1);
}

.modalOption--switch > input[type="checkbox"]{
    margin-top: 0;
}

/* Further apart than a switch is from its words, so each reads as a pair. */
.modalInline:has(> .modalOption--switch){
    column-gap: var(--modal-row-gap, 16px);
}

.modalOption:has(input:disabled){
    cursor: default;
}

.modalOption.is-hidden,
.modalOption[hidden]{
    display: none;
}

/* An option that qualifies the setting above it - a sub-setting, or an
   entry under its member in a table - set in under it, and faded while the
   setting it depends on is off. */
.modalOption.modalSubRow{
    margin-left: 22px;
}

.modalOption.modalSubRow:has(input:disabled){
    opacity: .45;
}

/* A text field, a number, or a select: one look wherever it is, a modal's or
   a page that borrows it - the contact page. */
.modalInput{
    height: var(--button-height-standard);
    width: 100%;
    border-radius: var(--r2);
    border: 1px solid var(--c1-n6);
    background: var(--c-surface);
    color: var(--c-text-primary);
    font-family: var(--f2);
    font-size: var(--fs-body);
    box-sizing: border-box;
}

.modalInput--small{
    height: var(--button-height-small);
    font-size: var(--fs-small2);
}

/* A one-line field's height and room; a text box takes its own. */
/*
.modalInput:not(textarea){
    min-height: 38px;
    padding: 8px 12px;
}
*/

textarea.modalInput{
    font-family: var(--ff-body);
    line-height: 1.45;
    min-height: 140px;
    padding: 10px;
    resize: vertical;
}

.modalInput:focus{
    border-color: var(--c2);
    box-shadow: var(--ring);
    outline: none;
}

.modalInput.is-error,
.modalField.is-error .modalInput{
    border-color: #c9302c;
    box-shadow: var(--ring-error);
}

.modalInput[readonly]{
    background: var(--c1-n2);
    cursor: default;
}

/* A number field without the browser's spinner. */
.modalInput[type=number]::-webkit-inner-spin-button,
.modalInput[type=number]::-webkit-outer-spin-button{
    -webkit-appearance: none;
    margin: 0;
}

.modalInput[type=number]{
    -moz-appearance: textfield;
}

/* A field that holds a short count: a box the width of a few digits. */
.modalInput--limit{
    flex: 0 0 auto;
    text-align: center;
    width: 80px;
}

/* A count as wide as the largest value it can take: payouts.js sets --digits
   to that value's digit count. The width is those digits, in the field's own
   ch, plus its side padding (.5rem each, input[type=text] in main.css) and
   its 1px border either side. */
.modalInput--digits{
    width: calc(var(--digits, 2) * 1ch + 1rem + 2px);
}

/* What is wrong with a field, under it. */
.modalFieldError{
    color: #842029;
    font-size: 9pt;
    margin-top: 6px;
}

.modalField > .modalFieldError{
    margin-top: 0;
}

.modalFieldError:empty,
.modalFieldError[hidden]{
    display: none;
}

/* A word or two of help beside or under a control, in grey; red when it is
   a warning. */
.modalHint{
    color: var(--c-text-muted);
    display: block;
    font-family: var(--ff-body);
    font-size: var(--fs-small3);
    line-height: 1.35;
    margin: 0;
}

.modalHint.is-error{
    color: var(--c-red);
}

.modalHint:empty,
.modalHint[hidden]{
    display: none;
}

/* A checkbox drawn as a switch, so the form posts it as it would any
   checkbox. Named with its element to outweigh the site's own checkbox rule
   (input[type="checkbox"] in main.css), which sizes every box at 12px. */
input.toggle{
    -webkit-appearance: none;
    appearance: none;
    align-self: flex-start;
    background: var(--c1-n6);
    border-radius: 999px;
    cursor: pointer;
    flex: 0 0 auto;
    height: 22px;
    margin: 0;
    position: relative;
    transition: background-color 140ms linear;
    width: 38px;
}

input.toggle::after{
    background: var(--c-surface);
    border-radius: 50%;
    box-shadow: var(--shadow-button);
    content: "";
    height: 16px;
    left: 3px;
    position: absolute;
    top: 3px;
    transition: transform 140ms ease;
    width: 16px;
}

input.toggle:checked{
    background: var(--c2);
}

input.toggle:checked::after{
    transform: translateX(16px);
}

input.toggle:focus-visible{
    outline: 2px solid var(--c2);
    outline-offset: 2px;
}

input.toggle:disabled{
    cursor: default;
    opacity: .6;
}

/* A switch for a line of small type, centred on its words. */
input.toggle--small{
    align-self: center;
    height: 16px;
    width: 28px;
}

input.toggle--small::after{
    height: 12px;
    left: 2px;
    top: 2px;
    width: 12px;
}

input.toggle--small:checked::after{
    transform: translateX(12px);
}

/* A select that buttons stand in for: posted with the form and read by the
   page script, never shown. */
.modalNativeSelect{
    display: none;
}

/* The buttons at the end: Cancel beside Save, set to the right. Nested rows
   of actions stack. */
.modalActions{
    align-items: center;
    display: flex;
    flex: 0 0 auto;
    gap: var(--g1);
    justify-content: flex-end;
    margin-top: 24px;
}

.modalActions[hidden]{
    display: none;
}

.modalActions > .modalActions{
    margin-top: 0;
}

.modalActions > form{
    margin: 0;
}

/* An action that destroys reads as destructive before it is clicked, not
   only in the confirmation that follows. */
.modalDangerButton{
    border-color: var(--c-red);
    color: var(--c-red);
}

.modalDangerButton:hover{
    background: var(--c-red);
    color: var(--c-surface);
}

/* A button that is words alone: small, grey, no box. */
.modalTextButton{
    appearance: none;
    background: none;
    border: 0;
    color: var(--c-text-muted);
    cursor: pointer;
    font-family: var(--ff-body);
    font-size: var(--fs-small2);
    padding: 0;
}

.modalTextButton:hover:not(:disabled){
    color: var(--c-text-primary);
    text-decoration: underline;
}

.modalTextButton:disabled{
    cursor: default;
    opacity: .4;
}

/* A text button that opens and closes something under it carries a caret,
   which turns over while it is open. */
.modalTextButton > .fa-caret-down{
    transition: transform 120ms linear;
}

.modalTextButton[aria-expanded="true"] > .fa-caret-down{
    transform: rotate(180deg);
}

/* A glyph alone that takes something away - a chip, a prize, a member: a
   round button that fills in under the pointer. */
.chipDelete,
.modalRemoveButton{
    align-items: center;
    appearance: none;
    -webkit-appearance: none;
    background: red;
    border: 0;
    border-radius: 50%;
    color: var(--c-surface);
    cursor: pointer;
    display: inline-flex;
    flex: 0 0 auto;
    font-size: var(--fs-small4);
    height: 22px;
    justify-content: center;
    line-height: 1;
    padding: 0;
    width: 22px;
    transition: scale 120ms linear;
}

.modalRemoveButton:hover,
.modalRemoveButton:focus-visible{
    background: none;
    color: var(--c-text-primary);
    scale: 1.2;
}

/* A removal that destroys - a member or an entry from a league - reads as
   destructive before it is clicked. */
.modalRemoveButton.modalDangerButton{
    color: var(--c-red);
}

/* What a save, or the server, has to say: a line that shows only while it
   has something to say, boxed in red for a failure and green for a success,
   amber for something still in flight. */
.modalStatus{
    display: block;
    font-family: var(--ff-body);
    font-size: var(--fs-small1);
    line-height: 1.35;
    margin: 0 0 12px;
}

.modalStatus:empty,
.modalStatus[hidden]{
    display: none;
}

.modalStatus.is-error{
    background: #fef2f2;
    border: 1px solid #e0a0a0;
    border-radius: var(--r2);
    color: #991b1b;
    padding: 9px 11px;
}

.modalStatus.is-success{
    background: rgba(154, 255, 154, .42);
    border: 1px solid var(--c-win);
    border-radius: var(--r2);
    color: var(--c-text-primary);
    padding: 9px 11px;
}

.modalStatus.is-warning{
    background: color-mix(in srgb, var(--c-yellow) 12%, transparent);
    border: 1px solid var(--c-yellow);
    border-left-width: 3px;
    border-radius: var(--r2);
    color: var(--c-text-primary);
    overflow-wrap: anywhere;
    padding: 10px 12px;
}

.modalStatus > .modalActions{
    margin-top: 8px;
}

/* --- Tables --------------------------------------------------------------- */

/* A table wider than the modal scrolls inside it rather than widening it. */
.modalTableScroll{
    overflow-x: auto;
    width: 100%;
}

/* Sized to its content rather than stretched to the modal, in tight rows:
   a list to scan. */
.modalTable{
    border-collapse: collapse;
    font-size: var(--fs-small1);
    width: auto;
}

.modalTable th,
.modalTable td{
    border-bottom: 1px solid var(--c1-n4);
    padding: 4px 10px;
    text-align: left;
    vertical-align: middle;
    white-space: nowrap;
}

.modalTable th{
    color: var(--c-text-muted);
    font-size: var(--fs-small3);
    font-weight: var(--fw3);
    letter-spacing: var(--ls1);
    text-transform: uppercase;
}

.modalTable tbody tr:last-child td{
    border-bottom: 0;
}

/* A row that belongs to the one above it - a member's entries under their
   name: indented, a step smaller, and closed off from the next member only
   after the last of them. */
.modalTable .modalSubRow td{
    border-bottom-color: var(--c1-n2);
    color: var(--c1-n8);
    font-size: var(--fs-small3);
}

.modalTable .modalSubRow td:first-child{
    padding-left: 28px;
}

.modalTable tr:has(+ .modalSubRow) td{
    border-bottom: 0;
}

/* A table's actions sit in their cell, not under a form. */
.modalTable .modalActions{
    margin-top: 0;
}

.modalTable .modalTextButton{
    color: inherit;
    font: inherit;
}

.modalTable .modalTextButton:hover{
    color: var(--c2);
    text-decoration: none;
}

/* A single letter after a name - C for a commissioner - in a small pill. */
.modalBadge{
    background: var(--c1-n2);
    border-radius: var(--r-pill);
    color: var(--c1-n8);
    display: inline-block;
    font-size: var(--fs-small3);
    margin-left: 6px;
    min-width: 18px;
    padding: 1px 0;
    text-align: center;
}

/* --- Lookups and chips ---------------------------------------------------- */

/* A search field with its matches in a menu under it, and the names chosen
   from it as chips that can be taken off again: the commissioner lookups,
   and the members to email. */
.modalLookup{
    flex: 1 1 auto;
    min-width: 0;
    position: relative;
}

/* The search glyph set inside the start of the field. */
.modalLookup > .fa-magnifying-glass{
    color: var(--c1-n8);
    left: 12px;
    pointer-events: none;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
}

.modalLookup:has(> .fa-magnifying-glass) > .modalInput{
    padding-left: 34px;
}

.modalLookupMenu{
    background: var(--c-surface);
    border: 1px solid var(--c1-n6);
    border-radius: var(--r2);
    box-shadow: var(--shadow-dropdown);
    box-sizing: border-box;
    left: 0;
    list-style: none;
    margin: 0;
    max-height: 220px;
    overflow-y: auto;
    padding: 0;
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    z-index: 60;
}

.modalLookupMenu[hidden]{
    display: none;
}

.modalLookupOption{
    align-items: flex-start;
    appearance: none;
    -webkit-appearance: none;
    background: transparent;
    border: 0;
    border-radius: 0;
    color: var(--c-text-primary);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    font-family: var(--ff-body);
    font-size: var(--fs-small1);
    gap: 2px;
    padding: 8px 10px;
    text-align: left;
    width: 100%;
}

.modalLookupOption:hover,
.modalLookupOption.is-active{
    background: var(--c1-n4);
}

/* A match already chosen: still listed, faded, and not chosen twice. */
.modalLookupOption.is-chosen{
    color: var(--c-text-muted);
    cursor: default;
}

.modalLookupOption.is-chosen:hover{
    background: none;
}

.modalLookupOptionName{
    font-weight: var(--fw4);
    line-height: 1.2;
}

.modalLookupOptionEmail{
    color: var(--c-text-muted);
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.modalLookupEmpty{
    color: var(--c1-n8);
    font-size: var(--fs-small1);
    padding: 8px 10px;
}

.modalChips{
    display: flex;
    flex-wrap: wrap;
    gap: var(--g1);
}

.modalChips:empty{
    display: none;
}

/* A name in a pill, with its remove button at its end, and slid into place
   as it arrives. */
.modalChip{
    align-items: center;
    background: var(--c2);
    border-radius: var(--r2);
    color: var(--c-surface);
    display: inline-flex;
    font-family: var(--ff-body);
    font-size: var(--fs-small1);
    gap: 4px;
    padding: 4px 4px 4px 12px;
    animation: pcfChipEnter 190ms cubic-bezier(.2, .8, .2, 1) both;
}

/* A chip that cannot be taken off - the league's creator. */
.modalChip--static{
    padding-right: 12px;
}

/* A chip with a delete button comes off from a click anywhere on it. */
.modalChip:has(.chipDelete):hover{
    cursor: pointer;
}

@keyframes pcfChipEnter {
    from {
        opacity: 0;
        transform: translateX(-14px);
    }
}

@media (prefers-reduced-motion: reduce) {
    .modalChip{
        animation-duration: 1ms;
    }
}

/* --- A modal with a nav ---------------------------------------------------- */

/* A modal with a nav down its left - the settings modal and the commissioner
   tools - and beside it the page chosen from the nav. One size for every
   page, so switching does not resize the dialog under the pointer. */
.modalSplit{
    display: grid;
    grid-template-columns: 180px minmax(0, 1fr);
    gap: 20px;
    align-items: stretch;
    /* Sized to the settings modal's Account page, the tallest of the pages
       in either modal at 502px. */
    height: 520px;
}

.modalNav{
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding-right: 20px;
    border-right: 1px solid var(--c1-n6);
}

.modalNavItem{
    appearance: none;
    -webkit-appearance: none;
    display: block;
    width: 100%;
    box-sizing: border-box;
    padding: 9px 12px;
    border: 0;
    border-radius: var(--r2);
    background: transparent;
    color: var(--c-text-primary);
    cursor: pointer;
    font-family: var(--ff-body);
    font-size: var(--fs-body);
    line-height: 1.2;
    text-align: left;
    white-space: nowrap;
}

.modalNavItem:hover{
    background: var(--c1-n2);
}

.modalNavItem.is-active{
    background: var(--c1-n4);
    font-weight: var(--fw4);
}

.modalNavItem:focus-visible{
    outline: 2px solid var(--c1);
    outline-offset: -2px;
}

/* An item that destroys rather than shows - the commissioner's Delete
   League. */
.modalNavItem--danger{
    color: var(--c-red);
}

/* An item at the foot of the nav and apart from the pages above it - the
   settings modal's Log out. It leaves the site rather than showing a page,
   so it is muted until hovered. */
.modalNavFoot{
    margin: auto 0 0;
}

.modalNavItem--logout{
    color: var(--c1-n8);
}

.modalNavItem--logout:hover,
.modalNavItem--logout:focus-visible{
    color: var(--c-text-primary);
}

/* The pages column carries the scrollbar, not the dialog, so the nav stays
   put and only the page moves if it ever outgrows the fixed height. */
.modalPages{
    min-width: 0;
    height: 100%;
    overflow-y: auto;
}

.modalPage[hidden]{
    display: none;
}

/* A panel moved into the pane - a commissioner tool - is still the .modal it
   was, so its modal chrome comes off: it is the content of a dialog now, not
   one of its own. Its header goes with it; the shared modal above carries the
   title and the close button. The pane scrolls, not the panel's body inside
   it, so sticky elements - the payout bar - have something to stick to. */
.modalPages > .modal{
    width: auto;
    max-width: none;
    max-height: none;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: none;
    box-shadow: none;
    overflow: visible;
}

.modalPages > .modal > .modalHeader{
    display: none;
}

.modalPages > .modal > .modalBody{
    overflow: visible;
    padding: 0 4px 4px 0;
}

/* --- A frame, a viewer ---------------------------------------------------- */

/* A frame for a page loaded into it as it opens - the league builder, or one
   of the landing page's info pages - which brings its own layout, so the
   frame has none of a .modal's padding or type. */
.modalFrame{
    display: none;
    position: relative;
    width: 90%;
    max-width: 900px;
    height: 620px;
    max-height: var(--modal-max-height);
    border-radius: var(--r3);
    overflow: hidden;
    font-family: var(--ff-body);
}

.modalFrameContent{
    width: 100%;
    height: 100%;
    overflow-y: auto;
    border-radius: var(--r3);
    background: var(--c-surface);
}

/* The modal is as wide as its widest row, so messages and the chips wrap
   within that width rather than widening it when they appear. */
.modalFrameContent :is(.modalStatus, .modalHint, .modalChips, .modalFieldError){
    contain: inline-size;
}

/* The logo viewer: the league's logo, or a member's picture, larger, in the
   middle of the page, with Edit under it. Its ring grows with the square root
   of the size rather than in proportion - six times the hero's circle, √6
   (2.45) times its ring - so the larger logo reads at the weight the hero's
   does. What is inside is copied from the hero's logo when it opens. */
.modalViewer{
    --logo-viewer-gap: calc(20 * var(--chrome-px));
    /* What the page's height has to hold besides the logo: the gap and Edit
       under it (the button's 32px), and 24px clear above and below. */
    --logo-viewer-reserve: calc(var(--logo-viewer-gap) + 32px + 2 * 24px);
    align-items: center;
    display: flex;
    flex-direction: column;
    gap: var(--logo-viewer-gap);
}

/* The viewer's drawing takes its football and border colours, and its glow,
   as every other drawing does - see .pageHeroLeagueLogo in dashboard.css. */
.modalViewerLogo{
    --c-league-logo-football: var(--c-league-theme-ink, var(--c2));
    --c-league-logo-border: var(--c-league-theme-accent, var(--c2));
    --logo-glow-size: calc(var(--size) * .1);
}

/* 480 at the design size, or as much as the page's height can hold. */
.circleLogo.modalViewerLogo{
    --size: min(
        calc(480 * var(--chrome-px)),
        calc(100dvh - var(--db-edge-gap) * 2 - var(--logo-viewer-reserve))
    );
    /* The hero's share, 4 on 80, divided by √6. */
    border: calc(var(--size) * 4 / 80 / 2) solid var(--c-league-logo-border);
    color: var(--c-league-logo-football);
    cursor: default;
    isolation: isolate;
    overflow: hidden;
}

.circleLogo.modalViewerLogo--hasImage{
    background: var(--c-league-logo-border);
}

.modalViewerLogo .modalViewerImage,
.modalViewerLogo .modalViewerIcon{
    border-radius: 50%;
    box-sizing: border-box;
    height: 100%;
    transform-origin: center center;
    width: 100%;
}

.modalViewerLogo .modalViewerImage{
    object-fit: contain;
}

.modalViewerLogo .modalViewerIcon{
    align-items: center;
    font-size: calc(var(--size) * 0.5);
    justify-content: center;
    line-height: 1;
}

/* A commissioner's Edit: the logo itself, showing on hover as the hero's View
   does, its word in the share of the circle the hero's has, 13.76 on 80. Not
   on focus alone, so the logo isn't covered as the viewer opens with the
   focus on it, unless that came from the keyboard (:focus-visible). */
.modalViewerLogo:hover .pageHeroLogoEditOverlay{
    opacity: 1;
}

.modalViewerLogo .pageHeroLogoEditOverlay{
    font-size: calc(var(--size) * .172);
}

/* A member's picture on their profile, drawn as the profile's hero draws it:
   a picture cropped to fill the circle on navy, or the initial in the colour
   from their name, white, at 4/7 of the circle and nudged as the hero's is,
   in proportion. */
#profileBody .modalViewerLogo .modalViewerImage{
    object-fit: cover;
}

#profileBody .modalViewerLogo .modalViewerIcon{
    background: oklch(var(--avatar-lightness) var(--avatar-chroma) var(--avatar-hue, 0));
    font-family: var(--ff-body);
    font-size: calc(var(--size) * 4 / 7);
    font-weight: 800;
    padding: calc(var(--size) * 2 / 80) 0 0 calc(var(--size) * 4 / 80);
}

#profileBody .circleLogo.modalViewerLogo--hasImage{
    background: var(--c1);
}

/* --- An author line ------------------------------------------------------- */

/* Who wrote something and when: the author's avatar and name, and the time. */
.modalAuthor{
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: var(--fs-small1);
    font-weight: var(--fw4);
    line-height: 1;
    color: #1a1a1a;
    min-width: 0;
    max-width: min(220px, 100%);
    white-space: nowrap;
}

.modalAuthorAvatar{
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: oklch(var(--avatar-lightness) var(--avatar-chroma) var(--avatar-hue, 0));
    color: var(--c-surface);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 24px;
    overflow: hidden;
    font-family: var(--ff-body);
    font-size: 9pt;
    font-weight: var(--fw4);
    line-height: 1;
    text-align: center;
    text-decoration: none;
    text-shadow: none;
    text-indent: 1px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.modalAuthorAvatar img{
    display: block;
    width: 100%;
    height: 100%;
    border: 0;
    border-radius: 50%;
    box-shadow: none;
    object-fit: cover;
    outline: 0;
}

.modalAuthorName{
    display: block;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.modalTime{
    display: inline-flex;
    align-items: center;
    min-height: 22px;
    font-size: var(--fs-small1);
    line-height: 1;
    color: #555;
    flex: 0 0 auto;
    margin-left: 16px;
    white-space: nowrap;
}

/* --- Opening and closing -------------------------------------------------- */

.modalBackdrop.is-visible,
.modalBackdrop.is-modal-closing{
    animation: pcfModalBackdropOpen 190ms ease-out both;
}

.modalBackdrop.is-modal-closing{
    animation: pcfModalBackdropClose 150ms ease-in both;
}

/* Every panel rises 12px into place as it fades in, and sinks as it fades
   out: a .modal, and the panels that are not one - a frame, Sign In's. */
#sidebarSignInModal.is-visible .modalSignInPanel,
#sidebarSignInModal.is-modal-closing .modalSignInPanel,
.modalFrame.is-visible,
.modalFrame.is-modal-closing,
.modalBackdrop.is-visible .modal,
.modalBackdrop.is-modal-closing .modal,
#leagueNotePanel.is-history-detail-open #leagueNoteHistoryDetailModal,
#leagueNotePanel.is-history-detail-closing #leagueNoteHistoryDetailModal,
#leagueNotePanel.is-modal-closing.is-history-detail-open #leagueNoteHistoryDetailModal{
    animation: pcfModalPanelOpen 190ms ease-out both;
}

#sidebarSignInModal.is-modal-closing .modalSignInPanel,
.modalFrame.is-modal-closing,
.modalBackdrop.is-modal-closing .modal,
#leagueNotePanel.is-history-detail-closing #leagueNoteHistoryDetailModal,
#leagueNotePanel.is-modal-closing.is-history-detail-open #leagueNoteHistoryDetailModal{
    animation: pcfModalPanelClose 150ms ease-in both;
}

/* The Alert Settings panel is the largest on the site, and Safari repaints
   its whole subtree every frame of the fade rather than compositing it.
   Promoting the two animating elements for the life of the animation moves
   the work to the GPU; will-change is scoped to the animation classes so no
   layer is held once the modal is at rest. */
#alertSettingsModalWindow.is-visible,
#alertSettingsModalWindow.is-modal-closing{
    will-change: opacity;
}

#alertSettingsModalWindow.is-visible > .modal,
#alertSettingsModalWindow.is-modal-closing > .modal{
    will-change: opacity, transform;
}

@keyframes pcfModalBackdropOpen {
    from {
        opacity: 0;
    }
}

@keyframes pcfModalBackdropClose {
    to {
        opacity: 0;
    }
}

@keyframes pcfModalPanelOpen {
    from {
        opacity: 0;
        translate: 0 12px;
    }
    to {
        opacity: 1;
        translate: 0 0;
    }
}

@keyframes pcfModalPanelClose {
    from {
        opacity: 1;
        translate: 0 0;
    }
    to {
        opacity: 0;
        translate: 0 12px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .modalBackdrop.is-visible,
    .modalBackdrop.is-modal-closing,
    #sidebarSignInModal.is-visible .modalSignInPanel,
    #sidebarSignInModal.is-modal-closing .modalSignInPanel,
    .modalFrame.is-visible,
    .modalFrame.is-modal-closing,
    .modalBackdrop.is-visible .modal,
    .modalBackdrop.is-modal-closing .modal,
    #leagueNotePanel.is-history-detail-open #leagueNoteHistoryDetailModal,
    #leagueNotePanel.is-history-detail-closing #leagueNoteHistoryDetailModal,
    #leagueNotePanel.is-modal-closing.is-history-detail-open #leagueNoteHistoryDetailModal{
        animation-duration: 0ms;
    }
}

/* ── Sign In ────────────────────────────────────────────────────────────── */

/* The sign-in dialog reuses the landing page's card, which stays at its
   design size, and sits over everything else. */
#sidebarSignInModal{
    --chrome-px: 1px;
    --chrome-text-px: 1px;
    z-index: 900;
    padding: calc(18 * var(--chrome-px));
}

.modalSignInPanel{
    position: relative;
    max-width: calc(100vw - calc(36 * var(--chrome-px)));
    max-height: var(--modal-max-height);
    overflow-y: auto;
    border-radius: 16px;
}

/* The landing page's card is frosted over a plain blue background. In the
   modal it sits over a busy page, which would show through, so there it is
   solid. */
#sidebarSignInModal .landingAuthCard{
    background: var(--c-surface);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

#sidebarSignInModal .landingAuthCard:before{
    content: none;
}

#sidebarSignInModal .landingAuthHeading{
    padding: 8px 36px 0 0;
}

/* Its close button centred on the card's title: the title's line starts at
   the card's top padding (main.css, less in shorter windows) and the
   heading's 8px, and is 1.2 times its 1.5rem. */
#sidebarSignInModal .modalCloseX{
    --modal-title-top: 28px;
    --modal-title-line: calc(1.2 * 1.5rem);
}

@media (max-height: 800px) {
    #sidebarSignInModal .modalCloseX{
        --modal-title-top: 24px;
    }
}

@media (max-height: 680px) {
    #sidebarSignInModal .modalCloseX{
        --modal-title-top: 20px;
    }
}

/* ── Settings ───────────────────────────────────────────────────────────── */

/* As wide as the widest of its pages, the panel's own fit-content: every page
   is laid out, the hidden ones at no height, so each counts toward the width
   and switching pages never resizes the panel. The Alerts page's form is
   borrowed as the modal opens, not as its page is chosen, for the same
   reason; see openSettingsModal() in site.js. */
#accountSettingsModalWindow > .modal{
    max-width: calc(100vw - 40px);
    overflow: auto;
    /* No room kept for a scrollbar: the panel is one fixed size, so it scrolls
       only in a window too short for it, never as its content grows. */
    scrollbar-gutter: auto;
}

/* Room above the first row for its control's focus ring, which the pages
   column, as it scrolls, would otherwise clip at its top edge - the General
   page's time zone. The margin takes the room back, so nothing moves. */
#accountSettingsModalWindow .modalPages{
    margin-top: -4px;
    padding-top: 4px;
}

#accountSettingsModalWindow .modalPage[hidden]{
    display: block;
    height: 0;
    overflow: hidden;
    visibility: hidden;
}

/* The text field's padding (main.css) for the email and password fields too,
   which that rule's types leave to the browser. */
#settingsModalPage-account .modalInput{
    max-width: 420px;
    padding: 0 .5rem;
}

/* The Account and General pages are laid out as the league builder is: every
   row's name in one column, as wide as the longest name, and its section and
   rows take that column through subgrid, so every control starts on the same
   line. Their forms lay their parts straight into the section, so their rows take the
   column too and are spaced as the rest are; the email form's pending change
   runs across both columns. Beside the names only - stacked, a row has one
   column. */
:is(#settingsModalPage-account, #settingsModalPage-site) form{
    display: contents;
}

/* Change opens the fields in place of the value and its Change: a
   .modalExpand in the same place in the row, its fields in the control
   column, as far apart as the rows are, and the email's notice across both
   columns. The value and its Change fade out as it starts to open, so the
   opening does not push them about, and back in once it has closed. It is
   four lines and more to the alert selects' one, so it takes longer, to seem
   to move at the same speed. */
#settingsModalPage-account .modalExpand{
    --expand-open: 275ms;
    --expand-close: 200ms;
    --expand-fade-in: 200ms;
    --expand-fade-delay: 75ms;
    --expand-fade-out: 135ms;
    grid-template-columns: subgrid;
}

/* Room above for the first field's floated name, which would otherwise be
   clipped as it opens; the margin gives it back. */
#settingsModalPage-account .modalExpand > div{
    display: grid;
    grid-column: 1 / -1;
    grid-template-columns: subgrid;
    margin-top: -8px;
    padding-top: 8px;
    row-gap: var(--g3);
}

#settingsModalPage-account .modalExpand > div > *{
    grid-column: 2;
}

/* The notice wraps to the width the rows give it rather than widening the
   page - and the settings modal, which takes its widest page's width. */
#settingsModalPage-account .modalExpand > div > .modalHint{
    grid-column: 1 / -1;
    min-width: 100%;
    width: 0;
}

#settingsModalPage-account .modalExpand .modalActions{
    justify-content: flex-start;
    margin-top: 0;
}

/* Back in once the fields have faded out of the line it shares with them -
   their --expand-fade-out. */
#settingsModalPage-account .modalRow > .modalInline{
    transition:
        opacity 100ms ease-out 135ms,
        visibility 0s;
}

#settingsModalPage-account .modalRow:has(> .modalExpand.is-visible) > .modalInline{
    opacity: 0;
    transition:
        opacity 100ms ease-in,
        visibility 0s linear 100ms;
    visibility: hidden;
}

@media (prefers-reduced-motion: reduce) {
    #settingsModalPage-account .modalRow > .modalInline,
    #settingsModalPage-account .modalRow:has(> .modalExpand.is-visible) > .modalInline{
        transition: none;
    }
}

/* The password fields - the email form's one and the new password's three -
   name themselves with a label floated on the input's top edge at its left
   end, breaking the border, rather than one over it. The field is as wide as
   its input, so the two share their edges. */
#settingsModalPage-account .modalExpand .modalField{
    max-width: 420px;
    position: relative;
}

#settingsModalPage-account .modalExpand .modalField > .settingLabel{
    background: var(--c-surface);
    line-height: 1;
    padding: 0 4px;
    left: 10px;
    position: absolute;
    top: 0;
    transform: translateY(-50%);
}

/* In the focused field's colour while its input has focus. */
#settingsModalPage-account .modalExpand .modalField:has(> .modalInput:focus) > .settingLabel{
    color: var(--c2);
}

#settingsModalPage-account{
}

@media (min-width: 641px) {
    :is(#settingsModalPage-account, #settingsModalPage-site) > div:has(> .modalSection){
        column-gap: 16px;
        display: grid;
        grid-template-columns: max-content minmax(0, 1fr);
    }

    :is(#settingsModalPage-account, #settingsModalPage-site) :is(.modalSection, .modalRow){
        column-gap: normal;
        display: grid;
        grid-column: 1 / -1;
        grid-template-columns: subgrid;
    }

    #settingsModalPage-account .modalRow[hidden]{
        display: none;
    }

    :is(#settingsModalPage-account, #settingsModalPage-site) form > :not(.modalRow){
        grid-column: 1 / -1;
    }

    :is(#settingsModalPage-account, #settingsModalPage-site) .modalRow > :first-child{
        white-space: nowrap;
    }

    /* The value and the fields that open in its place share the row's
       first line, the fields growing down from it; the name and the value
       keep to that line - one standard control tall, centred in it - as
       the fields open under them. The opening fields run across the row so
       the email's notice can, and leave the pointer to the name beneath
       them where they hold nothing. */
    #settingsModalPage-account .modalRow:has(> .modalExpand) > :first-child,
    #settingsModalPage-account .modalRow > .modalInline{
        align-items: center;
        align-self: start;
        display: flex;
        min-height: var(--button-height-standard);
    }

    #settingsModalPage-account .modalRow > .modalInline{
        grid-area: 1 / 2;
    }

    #settingsModalPage-account .modalRow > .modalExpand{
        align-self: start;
        grid-area: 1 / 1 / 2 / -1;
        pointer-events: none;
    }

    #settingsModalPage-account .modalExpand > div > *{
        pointer-events: auto;
    }
}

/* A preference's name beside its control, on the General page. */
#settingsModalPage-site .modalRow > .settingLabel[for]{
    cursor: pointer;
}

/* The General page's two menus, Time zone and Preferred default picks, alike:
   each as wide as its column allows, up to the 420px the League order list
   takes, and bordered as the segmented row above them is - .selectMenu's own
   border names a colour no stylesheet defines, so it draws none. */
#settingsModalPage-site .modalRow > .selectMenu{
    border: 1px solid var(--c1-n6);
    justify-self: stretch;
    max-width: 420px;
    width: 100%;
}

/* The league order lists as wide as the Account page's fields, under Sort
   by, with their hints under them. */
#settingsModalPage-league-order .leagueTypeOrderList,
#settingsModalPage-league-order .leagueSortList{
    margin-top: 0;
    max-width: 420px;
}

/* ── Alert Settings ─────────────────────────────────────────────────────── */

.modalAlertsForm{
    column-gap: 16px;
    display: grid;
    grid-template-columns: max-content minmax(0, 1fr);
    margin: 0;
    min-height: 0;
    width: max-content;
}

/* One list, as the league builder is: every alert's name in one column, as
   wide as the longest name, which stays on one line, and its control beside
   it. The sections and their rows take the column through subgrid. */
.modalAlertsForm .modalSection,
.modalAlertsForm .modalRow{
    column-gap: normal;
    grid-column: 1 / -1;
    grid-template-columns: subgrid;
}

.modalAlertsForm .modalSection{
    display: grid;
}

.modalAlertsForm .modalSectionTitle{
    grid-column: 1 / -1;
}

.modalAlertsForm .modalRow > :first-child{
    white-space: nowrap;
}

/* The switches, and the league pickers at the width of what they show, sit
   at the end of the control column. */
.modalAlertsForm .modalRow > .selectMenuField,
.modalAlertsForm .modalRow > .modalField > input.toggle{
    justify-self: end;
}

/* The delivery notice sits under the control it is about, in the control
   column, as wide as it. */
.modalAlertsForm .modalSection > .modalStatus{
    grid-column: 2;
    margin: 0;
    max-width: 320px;
    /* Wraps within the column rather than widening it, so the form - and the
       settings modal sized to it - keeps its width when the notice appears. */
    min-width: 100%;
    width: 0;
}

/* The form keeps its own width at any window width, so its rows keep their
   names beside their controls where a .modalRow would stack them, and what
   comes under a control stays in the control column. */
@media (max-width: 640px) {
    .modalAlertsForm .modalRow > :not(:first-child),
    .modalAlertsForm .modalRow > .modalField > *{
        grid-column: 2;
    }
}

/* When neither delivery channel is on, everything the settings govern is
   shown inert rather than cleared: the values are still there and still save,
   they just have nowhere to go. Pointer events go with the disabled
   attribute, because the custom select widgets are driven by their own
   button, not the <select>. */
.modalAlertsForm.is-disabled > .modalSection:not(:first-child){
    opacity: 0.6;
    pointer-events: none;
}

/* A kickoff reminder's selects, on the line under its name and starting
   where it does, shown only while its switch is on: a .modalExpand, which
   site.js opens and closes with the switch. The row's gap above them opens
   and closes with them, on the same timing. */
.modalAlertsForm .modalRow > .modalField > .modalExpand{
    grid-column: 1 / -1;
}

.modalAlertsForm .modalRow:has(> .modalField > .modalExpand){
    row-gap: 0;
    transition: row-gap var(--expand-close) ease-in;
}

.modalAlertsForm .modalRow:has(> .modalField > .modalExpand.is-visible){
    row-gap: var(--g1);
    transition: row-gap var(--expand-open) ease-out;
}

@media (prefers-reduced-motion: reduce) {
    .modalAlertsForm .modalRow:has(> .modalField > .modalExpand),
    .modalAlertsForm .modalRow:has(> .modalField > .modalExpand.is-visible){
        transition: none;
    }
}

.modalAlertsSelects{
    align-items: center;
    display: grid;
    gap: var(--g1);
    grid-template-columns: max-content max-content;
}

/* The before-1pm row finishes its sentence with a single select. */
.modalAlertsSelects--single{
    grid-template-columns: max-content;
}

/* ── Create League, League Settings, and the landing page's info pages ──── */

#leagueBody #createLeagueModal,
#leagueBody #leagueSettingsModalWindow,
#leagueDirectoryPage #createLeagueModal{
    background: var(--c-surface);
    box-sizing: border-box;
    height: auto;
    max-height: var(--modal-max-height);
    /* One column each: Create League a labelled form, League Settings the same rows read-only. */
    width: min(680px, calc(100vw - var(--db-content-left) - 100px));
    max-width: none;
}

/* Create League takes the width of its widest row, Pick Deadline; the
   text fields fill whatever that leaves them. League Settings takes the width
   of its longest name and value. */
#leagueBody #createLeagueModal,
#leagueBody #leagueSettingsModalWindow,
#leagueDirectoryPage #createLeagueModal{
    width: fit-content;
    max-width: calc(100vw - var(--db-content-left) - 100px);
}

#leagueBody #createLeagueModal .modalFrameContent,
#leagueBody #leagueSettingsModalWindow .modalFrameContent,
#leagueDirectoryPage #createLeagueModal .modalFrameContent{
    height: auto;
    max-height: var(--modal-max-height);
    overflow-y: auto;
}

#landingPageBody #createLeagueModal{
    width: fit-content;
    max-width: calc(100vw - 48px);
    height: auto;
    max-height: var(--modal-max-height);
}

#landingPageBody #createLeagueModal .modalFrameContent{
    height: auto;
    max-height: var(--modal-max-height);
}

/* The frame scrolls, and the page's own panel in it grows to its full
   height, so the panel is no scroll box of its own: one would hold the
   payouts' sticky bar (.payoutPotBarSticky) to a box that never moves, and
   the bar would scroll away with the rest. */
#createLeagueModal .modalFrameContent > .modal{
    overflow: visible;
}

#leagueSettingsModalContent{
    height: 100%;
}

/* ── Create Entry, Invite Friends, and the directory's Sign In and password ─── */

#leagueDirectoryLoginModal,
#leagueDirectoryPasswordModal{
    width: 390px;
}

#leagueDirectoryEntrySetupModal,
#dashboardEntrySetupModal,
#dashboardInviteFriendsModal{
    width: 430px;
}

/* Invite Friends: its share options, each a glyph over a word. */
.modalInviteOptions{
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    margin-bottom: 20px;
}

.modalInviteOption{
    appearance: none;
    -webkit-appearance: none;
    align-items: center;
    background: var(--c-surface);
    border: 1px solid var(--c1);
    border-radius: 6px;
    box-sizing: border-box;
    color: var(--c-text-primary);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    font-family: var(--ff-body);
    font-size: var(--fs-small1);
    font-weight: var(--fw4);
    gap: var(--g2);
    justify-content: center;
    line-height: 1.2;
    min-height: 74px;
    padding: 12px 8px;
    text-align: center;
    text-decoration: none;
    text-transform: uppercase;
    transition: all 120ms linear;
}

.modalInviteOption > i{
    font-size: 20px;
    line-height: 1;
}

.modalInviteOption:hover{
    background: var(--c1);
    color: var(--c-surface);
}

.modalInviteOption[hidden]{
    display: none;
}

/* ── League Memo ────────────────────────────────────────────────────────── */

/* The memo's backdrop. */
#leagueBody #leagueNotePanel{
    --c1-n2: #f1f3f9;
    --c1-n4: #e6ebf4;
    font-family: var(--ff-body);
    margin: 0;
    padding: 24px;
}

#leagueNotePanel.is-history-detail-open #leagueNoteModal{
    display: none;
}

#leagueNoteModal{
    --league-note-modal-width: 560px;
    --league-note-history-width: 260px;
    display: flex;
    flex-direction: column;
    height: 480px;
    overflow: hidden;
    /* It never scrolls - the parts in it do - so it keeps no room for a
       scrollbar of its own. */
    scrollbar-gutter: auto;
    /* Widening the modal makes room for the history rather than taking it
       from the editor; the timing matches the sidebar column so the editor
       never flexes. */
    transition: width 0.18s ease;
    width: min(var(--league-note-modal-width), 100%);
}

#leagueNotePanel.is-history-open #leagueNoteModal{
    width: min(calc(var(--league-note-modal-width) + var(--league-note-history-width)), 100%);
}

#leagueNoteModal .modalActions{
    align-items: stretch;
    gap: 10px;
}

/* Reading and editing are two modes of the one modal. Read-only is what
   opens, for the commissioner as much as for anyone else; the Edit button
   swaps is-editing onto the panel and the pair trade places. Members never
   have the editor rendered at all. */
#leagueNoteEditorShell{
    align-items: stretch;
    display: none;
    flex: 1 1 auto;
    /* Grid, not flex: the two-column shell the history sidebar slides out
       of. */
    grid-template-columns: 0 minmax(0, 1fr);
    min-height: 0;
    overflow: hidden;
    transition: grid-template-columns 0.18s ease;
}

#leagueNotePanel.is-editing #leagueNoteEditorShell{
    display: grid;
}

#leagueNotePanel.is-editing #leagueNoteReadOnly,
#leagueNotePanel.is-editing #leagueNoteReadOnlyActions{
    display: none;
}

#leagueNoteEditorShell.is-history-open{
    grid-template-columns: var(--league-note-history-width) minmax(0, 1fr);
}

#leagueNoteEditorMain{
    display: flex;
    flex-direction: column;
    min-height: 0;
    min-width: 0;
}

#leagueNoteForm{
    flex: 1 1 auto;
    min-height: 0;
}

#leagueNoteForm > .modalStatus,
#leagueNoteForm > .modalField:not(:has(#leagueNoteInput)),
#leagueNoteForm > .modalActions{
    flex: 0 0 auto;
}

/* The body's field, and the editor in it, take whatever height the panel
   leaves, and the editor's surface alone scrolls. */
#leagueNoteForm > .modalField:has(#leagueNoteInput){
    flex: 1 1 auto;
    min-height: 0;
}

#leagueNoteForm .pcf-lexical-editor{
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-height: 0;
}

#leagueNoteForm .pcf-lexical-toolbar{
    flex: 0 0 auto;
}

#leagueNoteForm .pcf-lexical-surface-wrap{
    display: flex;
    min-height: 0;
}

#leagueNoteForm .pcf-lexical-surface{
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
}

/* Two stacked rows of actions, both right-aligned, so Save Quietly sits
   directly under Save and Notify. Memo History alone sits at the left edge. */
#leagueNoteForm > .modalActions{
    flex-direction: column;
    gap: var(--g2);
}

#leagueNoteForm .modalActions > .modalActions{
    gap: 0;
}

#leagueNoteHistoryButton{
    margin-right: auto;
}

#leagueNoteHistoryButton[aria-expanded="true"]{
    background: var(--c1-n4);
    color: var(--c-text-primary);
}

/* The history sidebar: closed, it takes no room; open, it slides out to its
   column's width. */
#leagueNoteHistorySidebar{
    border-right: 0 solid transparent;
    box-sizing: border-box;
    min-width: 0;
    opacity: 0;
    overflow: hidden;
    pointer-events: none;
    transition:
        opacity 0.16s ease,
        padding-right 0.16s ease,
        margin-right 0.16s ease,
        border-color 0.16s ease;
}

#leagueNoteEditorShell.is-history-open #leagueNoteHistorySidebar{
    opacity: 1;
    padding-right: 6px;
    pointer-events: auto;
}

#leagueNoteHistoryList{
    max-height: min(330px, calc(100vh - 250px));
    overflow-y: auto;
    padding-right: 6px;
}

/* One entry per published memo, showing its header and when it was made;
   the body appears when the entry is opened. Memos saved quietly are
   versions of the memo above them, collapsed behind an edits toggle. */
.modalMemoHistoryEntry{
    border-bottom: 1px solid var(--c1-n4);
}

.modalMemoHistoryItem{
    background: transparent;
    border: 0;
    box-sizing: border-box;
    cursor: pointer;
    display: block;
    font-family: var(--ff-body);
    margin: 0;
    padding: 6px;
    text-align: left;
    width: 100%;
}

.modalMemoHistoryItem:hover,
.modalMemoHistoryItem:focus-visible{
    background: var(--c1-n2);
    border-radius: var(--r2);
    outline: none;
}

.modalMemoHistoryItemTitle{
    color: #1a1a1a;
    font-size: 10.5pt;
    font-weight: var(--fw3);
    line-height: 1.25;
    margin-bottom: 4px;
    overflow-wrap: anywhere;
}

.modalMemoHistoryItemMeta{
    color: #6a6f78;
    font-size: 8.5pt;
    line-height: 1.35;
}

#leagueNoteHistoryList .modalTextButton{
    align-items: center;
    display: inline-flex;
    gap: var(--g1);
    margin: 0 0 8px 12px;
    padding: 2px 0;
}

.modalMemoHistoryEdits{
    border-left: 2px solid var(--c1-n4);
    margin: 0 0 8px 18px;
}

.modalMemoHistoryEdits .modalMemoHistoryItem{
    padding: 6px 12px;
}

.modalMemoHistoryEdits .modalMemoHistoryItemMeta{
    margin-bottom: 0;
}

/* The memo as it reads: the author line, the header, and the body, in a
   box. The read-only view's is held to the panel's height and its body
   scrolls; the history detail's may be taller. */
.modalMemoDisplay{
    background: var(--c-surface);
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: var(--r3);
    box-sizing: border-box;
    color: #222;
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    font-family: var(--ff-body);
    max-height: min(420px, calc(100vh - 210px));
    min-height: 200px;
    overflow: hidden;
    padding: 18px 20px;
    overflow-wrap: anywhere;
    text-align: left;
    width: 100%;
}

.modalMemoDisplay > :first-child{
    margin-top: 0;
}

.modalMemoDisplay > :last-child{
    margin-bottom: 0;
}

#leagueNoteHistoryDetailModal .modalMemoDisplay{
    max-height: min(540px, calc(100vh - 250px));
}

/* The author line over the memo, tight to the header that follows it. */
.modalMemoMeta{
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    min-height: 24px;
    flex: 0 0 auto;
}

.modalMemoTitle{
    color: #1a1a1a;
    font-family: var(--ff-body);
    font-size: 17pt;
    font-weight: var(--fw3);
    line-height: 1.25;
    margin: 12px 0;
    flex: 0 0 auto;
}

.modalMemoBody{
    color: var(--c1);
    flex: 1 1 auto;
    font-size: var(--fs-body);
    line-height: 1.65;
    min-height: 0;
    overflow: auto;
    padding-right: 6px;
}

.modalMemoBody p{
    margin: 0 0 0.75em;
}

.modalMemoBody p:last-child{
    margin-bottom: 0;
}

.modalMemoBody img{
    border-radius: var(--r3);
    display: block;
    height: auto;
    margin: 8px 0;
    max-width: 100%;
}

#leagueNoteHistoryDetailModal{
    display: none;
    flex-direction: column;
    /* It never scrolls - its body does - so it keeps no room for a
       scrollbar of its own. */
    scrollbar-gutter: auto;
    max-height: var(--modal-max-height);
    overflow: hidden;
    width: min(920px, 100%);
}

#leagueNoteHistoryDetailModal > .modalHeader{
    flex: 0 0 auto;
}

#leagueNotePanel.is-history-detail-open #leagueNoteHistoryDetailModal{
    display: flex;
}

/* ── Weekly Wrap-Up ─────────────────────────────────────────────────────── */

/* The whole panel scrolls as one: the header, the wrap-up, and the footer
   all move together. The scrollbar is hidden; the fades below say instead
   when there is more to read. */
#weeklyWrapUpModal > .modal{
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    padding: 24px 28px;
    scrollbar-width: none;
    --scroll-cues: none;
    width: min(680px, 92vw);
}

#weeklyWrapUpModal > .modal::-webkit-scrollbar{
    display: none;
}

/* A fade to white along the panel's bottom edge while there is more below,
   and along its top edge once the reader has scrolled down from the top.
   dashboard.js sets is-scrollable-down and is-scrollable-up. Each is a sticky
   strip at an end of the scroll, given a negative margin so it takes no room
   of its own. */
#weeklyWrapUpModal > .modal::before,
#weeklyWrapUpModal > .modal::after{
    content: "";
    flex: 0 0 auto;
    height: 56px;
    opacity: 0;
    pointer-events: none;
    position: sticky;
    transition: opacity 160ms linear;
    z-index: 3;
}

#weeklyWrapUpModal > .modal::before{
    background: linear-gradient(to top, rgba(255, 255, 255, 0), var(--c-surface) 85%);
    margin: -24px -28px -32px;
    top: -24px;
}

#weeklyWrapUpModal > .modal::after{
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0), var(--c-surface) 85%);
    bottom: -24px;
    margin: -32px -28px -24px;
}

#weeklyWrapUpModal > .modal.is-scrollable-up::before,
#weeklyWrapUpModal > .modal.is-scrollable-down::after{
    opacity: 1;
}

#weeklyWrapUpModal .modalHeader{
    /* The panel's top padding is 24px here, not 32px. */
    --modal-title-top: calc(24px + 1.25 * var(--fs-small3) + 2px);
    align-items: flex-start;
    flex: 0 0 auto;
    gap: 16px;
}

/* Held at its full height rather than shrunk to fit the panel, so the panel
   scrolls instead of the body. */
#weeklyWrapUpModal .modalBody{
    flex: 0 0 auto;
    overflow: visible;
    padding: 18px 4px 4px 0;
}

@media (max-width: 700px) {
    #weeklyWrapUpModal > .modal{
        padding: 18px;
        width: 94vw;
    }

    #weeklyWrapUpModal .modalHeader{
        --modal-title-top: calc(18px + 1.25 * var(--fs-small3) + 2px);
    }
}

.wrapupParagraph{
    color: var(--c-text-primary);
    font-family: var(--ff-body);
    font-size: var(--fs-body);
    line-height: 1.62;
    margin: 0 0 1.05em;
}

.wrapupParagraph:last-child{
    margin-bottom: 0;
}

/* The names in a wrap-up, set from the tokens the writer leaves in their
   place (see pcf_wrapup_render_markup()): an entry's name in bold, a username
   underlined as the link to the profile it is, and a team's logo before the
   words naming it, sized to the line. */
.wrapupEntry{
    font-weight: var(--fw4);
}

.wrapupParagraph a.wrapupUser{
    color: inherit;
    text-decoration: underline;
    text-underline-offset: .15em;
}

.wrapupTeam{
    white-space: nowrap;
}

.wrapupTeamLogo{
    height: 1.15em;
    margin-right: .25em;
    object-fit: contain;
    vertical-align: -.22em;
    width: 1.15em;
}

/* --- Charts ------------------------------------------------------------- */
.wrapupChart{
    background: var(--c1-n2);
    border: 1px solid var(--c1-n4);
    border-radius: var(--r3);
    margin: 0 0 1.3em;
    padding: 14px 16px 12px;
}

.wrapupChartTitle{
    color: var(--c1-n8);
    font-family: var(--ff-body);
    font-size: var(--fs-small3);
    font-weight: var(--fw4);
    letter-spacing: var(--ls1);
    margin-bottom: 8px;
    text-transform: uppercase;
}

.wrapupChartSvg{
    display: block;
    height: auto;
    overflow: visible;
    width: 100%;
}

.wrapupChartCaption{
    color: var(--c-text-muted);
    font-family: var(--ff-body);
    font-size: var(--fs-small3);
    line-height: 1.45;
    margin-top: 10px;
}

.wrapupGrid{
    stroke: var(--c1-n6);
    stroke-dasharray: 3 4;
    stroke-width: 1;
}

.wrapupAxisText{
    fill: var(--c1-n9);
    font-family: var(--ff-body);
    font-size: 10px;
}

.wrapupAxisText--y{
    text-anchor: end;
}

.wrapupLine{
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2.5;
}

.wrapupDot{
    stroke: var(--c-surface);
    stroke-width: 1.5;
}

/* Four series colours, assigned by position. The first is the league's own
   theme colour, so a chart about one entry sits in the league's palette. */
.wrapupLine.wrapupSeries--1{ stroke: var(--c-league-theme-accent); }

.wrapupLine.wrapupSeries--2{ stroke: var(--c1-series2); }

.wrapupLine.wrapupSeries--3{ stroke: var(--c1-series3); }

.wrapupLine.wrapupSeries--4{ stroke: var(--c1-series4); }

.wrapupDot.wrapupSeries--1{ fill: var(--c-league-theme-accent); }

.wrapupDot.wrapupSeries--2{ fill: var(--c1-series2); }

.wrapupDot.wrapupSeries--3{ fill: var(--c1-series3); }

.wrapupDot.wrapupSeries--4{ fill: var(--c1-series4); }

.wrapupLegendSwatch.wrapupSeries--1{ background: var(--c-league-theme-accent); }

.wrapupLegendSwatch.wrapupSeries--2{ background: var(--c1-series2); }

.wrapupLegendSwatch.wrapupSeries--3{ background: var(--c1-series3); }

.wrapupLegendSwatch.wrapupSeries--4{ background: var(--c1-series4); }

.wrapupLegend{
    display: flex;
    flex-wrap: wrap;
    gap: 6px 14px;
    list-style: none;
    margin: 10px 0 0;
    padding: 0;
}

.wrapupLegendItem{
    align-items: center;
    display: flex;
    gap: var(--g1);
}

.wrapupLegendSwatch{
    border-radius: var(--r1);
    display: inline-block;
    height: 10px;
    width: 10px;
}

.wrapupLegendLabel{
    color: var(--c1-n8);
    font-family: var(--ff-body);
    font-size: var(--fs-small3);
}

/* --- Pick bias ---------------------------------------------------------- */
.wrapupBiasRow + .wrapupBiasRow{
    margin-top: 14px;
}

.wrapupBiasHeader{
    align-items: baseline;
    display: flex;
    font-family: var(--ff-body);
    font-size: var(--fs-small3);
    justify-content: space-between;
    margin-bottom: 5px;
}

.wrapupBiasMatchup{
    color: var(--c-text-primary);
    font-weight: var(--fw3);
}

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

.wrapupBiasBar{
    border-radius: var(--r2);
    display: flex;
    height: 26px;
    overflow: hidden;
}

.wrapupBiasSegment{
    align-items: center;
    display: flex;
    justify-content: center;
    min-width: 0;
    overflow: hidden;
}

/* Either side that did not cover gets the same grey, so one colour means one
   thing: a wrong pick. The divider keeps the two sides apart on a push. */
.wrapupBiasSegment--away,
.wrapupBiasSegment--home{ background: var(--c1-n9); }

.wrapupBiasSegment + .wrapupBiasSegment{ border-left: 2px solid var(--c-surface); }

/* Entries that took neither side, in leagues where entries pick only some
   games. Pale so the two sides still read as the story. */
.wrapupBiasSegment--neither{ background: var(--c1-n2); }

.wrapupBiasSegment--neither .wrapupBiasSegmentLabel{ color: var(--c1-n8); }

/* The side that actually covered is filled in the league's colour, so the
   bar answers "did the crowd get it right" at a glance. */
.wrapupBiasSegment.is-covered{
    background: var(--c-league-theme-accent);
}

.wrapupBiasSegmentLabel{
    color: var(--c-surface);
    font-family: var(--ff-body);
    font-size: var(--fs-small3);
    font-weight: var(--fw3);
    padding: 0 6px;
    white-space: nowrap;
}

.wrapupBiasResult{
    color: var(--c1-n8);
    font-family: var(--ff-body);
    font-size: var(--fs-small3);
    margin-top: 4px;
}

/* ── Pick History ───────────────────────────────────────────────────────── */

/* An entry's picks through the season: the modal an entry's name opens
   (#pickHistoryModal in dashboard.php, pcfInitPickHistory() in dashboard.js).
   In a pick-all league each week is a table headed as the Overview's My
   Picks table is (.overviewPicksTable in overview.css) over one row of the
   entry's selections, each drawn as the Board draws one (.teamInTD in
   board.css), labelled with its week. With the headers hidden, each week is
   that labelled row alone. A pick-5 league's weeks are always labelled rows
   of five. A week never wraps. The pills' colours are board.css's alone. */

/* As wide as the widest week needs, up to the room the page gives it; never
   narrower than leaves the title and the button their room while the picks
   load. A column whose body alone scrolls, as a .modalBody does, though the body
   sits in the frame below rather than in the panel itself. */
#pickHistoryModal > .modal{
    display: flex;
    flex-direction: column;
    overflow: visible;
    max-width: calc(100% - 32px);
    min-width: min(480px, calc(100% - 32px));
    width: max-content;
}

/* Below the title, on one line: the combobox, Reset to its right, and, at the
   right end, the button that shows or hides the usernames and, in a pick-all
   league, the one that shows or hides the headers. */
.modalPickHistorySelects{
    align-items: center;
    column-gap: var(--g2);
    display: grid;
    flex: 0 0 auto;
    grid-template-areas: "picker reset . toggles";
    grid-template-columns: auto auto minmax(0, 1fr) auto;
}

#pickHistoryPicker{
    grid-area: picker;
}

.modalEntryPicker{
    width: 260px;
}

#pickHistoryReset{ grid-area: reset; }

.modalPickHistoryToggles{
    display: flex;
    gap: var(--g2);
    grid-area: toggles;
}

/* The field: a menu's button that can be typed in. Closed, what is shown reads as
   a menu's value does, and the chevron sits over the field's right end. */
.modalEntryPicker > input{
    cursor: pointer;
    padding-right: 2em;
}

.modalEntryPicker > input:focus{
    cursor: text;
}

.modalEntryPicker > input::placeholder{
    color: var(--c-text-primary);
    opacity: 1;
}

.modalEntryPicker .selectMenuChevron{
    pointer-events: none;
    position: absolute;
    right: .7em;
    top: 50%;
    translate: 0 -50%;
}

.modalEntryPicker > .selectMenuList{
    min-width: 100%;
}

/* A member heading their entries, the entries indented under them. */
.modalEntryPickerOption--entry{
    padding-left: 1.5em;
}

/* A member with some of their entries ticked: a dash where the tick goes. */
.modalEntryPickerOption--partial .selectMenuOptionCheck{
    visibility: visible;
}

.modalEntryPickerOption--partial .selectMenuOptionCheck i::before{
    content: "\f068";
}

/* Each option's name in the list's weight, chosen or not; the tick says which. */
.modalEntryPickerOption .selectMenuOptionLabel{
    font-weight: var(--fw1);
}

.modalEntryPickerOption--user .selectMenuOptionLabel{
    font-weight: var(--fw3);
}

/* A username under an entry's name, where no member holds more than one. */
.modalEntryPickerOptionUser{
    color: var(--c-text-muted);
    display: block;
    font-size: var(--fs-small3);
    overflow: hidden;
    text-overflow: ellipsis;
}

/* The body and the loading ring laid over it. It is the part of the modal
   that gives up height when the season is longer than the screen, so the
   body inside it can scroll. */
#pickHistoryBodyFrame{
    display: flex;
    flex-direction: column;
    margin-top: 14px;
    min-height: 0;
    position: relative;
}

/* Loading another entry's picks over ones already shown: those stay, blurred
   and out of reach, and a ring turns in the middle of what is visible. */
#pickHistoryLoading{
    align-items: center;
    display: none;
    inset: 0;
    justify-content: center;
    pointer-events: none;
    position: absolute;
}

#pickHistoryBodyFrame.is-loading #pickHistoryLoading{
    display: flex;
}

#pickHistoryBodyFrame.is-loading .modalBody{
    filter: blur(3px);
    pointer-events: none;
    user-select: none;
}

/* Out across the panel's 32px of padding, so its scrollbar runs down the panel's
   right edge, as a modal that scrolls edge to edge has it. The same 32px inside
   keeps what it holds where the padding had it. */
#pickHistoryBody{
    margin-right: -32px;
    padding-right: 32px;
}

#pickHistoryBody .modalEmpty{
    padding: 8px 0;
    text-align: left;
}

/* The weeks do not scroll on their own, as the Overview's table does: the
   modal is as wide as they are, and its body is the one place that could.
   Each is given 2px more than its table needs, so a width rounded to the
   pixel - as Safari rounds them - cannot leave a week a fraction short and
   scrolling. */
.modalPickHistoryWeeks .overviewPicksScroll.modalPickHistoryWeek{
    overflow-x: visible;
    padding-right: 2px;
    border-radius: var(--r3);
}

/* The padding around a week is for the headers view alone; with the headers
   hidden, the weeks' rows stack without it. */
.modalPickHistoryWeeks:not(.is-headers-hidden) .overviewPicksScroll.modalPickHistoryWeek{
    padding: 20px;
    position: relative;
}

/* Every even-numbered week on a pale ground (set by the endpoint), its
   header and rows alike - while the headers show. */
.modalPickHistoryWeek--even{
    background: var(--c1-n3);
}

.modalPickHistoryWeeks.is-headers-hidden .modalPickHistoryWeek--even{
    background: none;
}

/* Every week's table is laid out to the same columns, so every row's
   selections start at one place and every selection column is one width:
   the username and label columns, the points, then each game's selection cell. */
.modalPickHistoryWeekTable{
    table-layout: fixed;
    width: max-content;
}

/* Each header cell draws its own rule, once: collapsed, the rule's
   translucent grey was painted twice under some cells in Safari. */
.overviewTable.modalPickHistoryWeekTable{
    border-collapse: separate;
    border-spacing: 0;
}

.modalPickHistoryWeekTable .modalPickHistoryUserCol,
.modalPickHistoryWeekTable .overviewEntryCol{
    box-sizing: border-box;
    max-width: 120px;
    min-width: 120px;
    width: 120px;
}

/* Against the table's left edge, as the week's label is, and clear of the name. */
.modalPickHistoryWeekTable td.modalPickHistoryUserCol{
    overflow: hidden;
    padding: 0 8px 0 1px;
    white-space: nowrap;
}

/* The viewer's rows go by their bold name here, without the Overview's navy line. */
.overviewTable.modalPickHistoryWeekTable tbody tr.overviewRow--own > td:first-child{
    box-shadow: none;
}

.modalPickHistoryWeekTable .overviewGameCol,
.modalPickHistoryWeekTable td.modalPickHistoryTd{
    box-sizing: border-box;
    max-width: var(--board-fixed-col-width);
    min-width: var(--board-fixed-col-width);
    width: var(--board-fixed-col-width);
}

.modalPickHistoryWeekTable .overviewNumberCol{
    box-sizing: border-box;
    max-width: 48px;
    min-width: 48px;
    width: 48px;
}

/* The selection cell brings its own border and padding (.teamInTD in board.css). */
.modalPickHistoryWeekTable td.modalPickHistoryTd{
    padding: 0;
    white-space: nowrap;
}

/* The username and entry columns' labels, over what they label and level with
   the PTS beside them. */
.overviewTable.modalPickHistoryWeekTable thead th.modalPickHistoryUserCol,
.overviewTable.modalPickHistoryWeekTable thead th.overviewEntryCol{
    padding-left: 1px;
    padding-right: 1px;
    text-align: left;
    vertical-align: bottom;
    white-space: nowrap;
}

/* With the headers shown, the week's label stands in the top-left corner of the
   week's container. */
.modalPickHistoryWeekHeadLabel{
    color: var(--c-text-primary);
    font-size: var(--fs-body);
    font-weight: var(--fw4);
    left: 8px;
    position: absolute;
    top: 8px;
}

/* Where the headers are not shown: the week's label on a row of its own above
   its picks, a rule centred on the text running from it to the table's right
   edge. */
.modalPickHistoryWeekRuleRow{
    display: none;
}

.modalPickHistoryWeeks.is-headers-hidden .modalPickHistoryWeekRuleRow{
    display: table-row;
}

.modalPickHistoryWeekRuleRow > th{
    padding: 10px 1px 4px;
    text-align: left;
}

.modalPickHistoryWeekRule{
    align-items: center;
    display: flex;
    gap: 10px;
    white-space: nowrap;
}

.modalPickHistoryWeekRule::after{
    background: rgba(23, 33, 54, .22);
    content: "";
    flex: 1 1 auto;
    height: 1px;
}

.modalPickHistoryEntryLabel{
    font-weight: var(--fw1);
    overflow: hidden;
    padding-block: 0;
    text-align: left;
    white-space: nowrap;
}

/* Cut short where the column ends. */
.modalPickHistoryEntryName{
    color: var(--c-text-primary);
    display: block;
    font-size: var(--fs-body);
    font-weight: var(--fw2);
    overflow: hidden;
    text-overflow: ellipsis;
    text-transform: none;
    letter-spacing: normal;
}

.modalPickHistoryWeekTable tr.overviewRow--own .modalPickHistoryEntryName{
    font-weight: var(--fw3);
}

.modalPickHistoryWeeks.is-usernames-hidden .modalPickHistoryUserCol{
    display: none;
}

/* The Standings' username, which there waits on its toggle, shown here with its column. */
.modalPickHistoryUserCol .standingsEntryUsername{
    opacity: 1;
    visibility: visible;
}

/* No stripe on the row of an entry set under this one: the two rows read as
   one week. */
.overviewTable.modalPickHistoryWeekTable tbody tr:nth-child(even){
    background: none;
}

/* Headers hidden: each week's table is its labelled row alone, except the
   first week's, whose header row stays, showing only the labels of the username,
   entry, and points columns over the stacked weeks, with no rule under it. */
.modalPickHistoryWeeks.is-headers-hidden .modalPickHistoryWeekTable thead{
    display: none;
}

.modalPickHistoryWeeks.is-headers-hidden .modalPickHistoryWeek:first-child .modalPickHistoryWeekTable thead{
    display: table-header-group;
}

.modalPickHistoryWeeks.is-headers-hidden .modalPickHistoryWeek:first-child thead th{
    border-bottom: none;
}

.modalPickHistoryWeeks.is-headers-hidden .modalPickHistoryWeekHeadLabel{
    display: none;
}

.modalPickHistoryWeeks.is-headers-hidden .modalPickHistoryWeek:first-child thead th.overviewGameCol > *{
    display: none;
}

.modalPickHistoryWeeks.is-headers-hidden .modalPickHistoryWeek + .modalPickHistoryWeek{
    margin-top: 2px;
}

.modalPickHistoryCell[data-game]:focus-visible{
    border-radius: var(--r1);
    outline: 2px solid var(--c2);
    outline-offset: 1px;
}

/* ── Commissioner Tools ─────────────────────────────────────────────────── */

/* The tools modal: the tools in a nav down its left, each one's panel in the
   pane beside it - see pcfInitCommissionerTools() in dashboard.js. */
#commissionerToolsModal > .modal{
    width: 980px;
    max-width: calc(100vw - 40px);
    overflow: auto;
    /* No room kept for a scrollbar, as the settings modal keeps none: one
       fixed size, it scrolls only in a window too short for it. */
    scrollbar-gutter: auto;
}

/* 180px will not hold "Members and Entries" on one line. */
#commissionerToolsModal .modalSplit{
    grid-template-columns: 220px minmax(0, 1fr);
}

/* --- Members and Entries -------------------------------------------------- */

/* Centred under its heading and no wider than it needs to be. */
.modalCommishPaid{
    text-align: center;
}

.modalCommishPaid input{
    cursor: pointer;
    margin: 0;
    vertical-align: middle;
}

/* The removals are a glyph rather than a worded button: two of them on
   every member would otherwise be the widest thing in the table. */
.modalTable .modalRemoveButton.modalDangerButton{
    font-size: var(--fs-body);
}

/* --- Email League --------------------------------------------------------- */

/* The members to write to, shown once Only the members I choose is picked:
   the search and its matches, and the members picked under it. The field is
   set down by the height of the Send to label, so the two boxes line up. */
#commishRecipientList{
    align-self: flex-start;
    flex: 1 1 220px;
    padding-top: calc(1lh + 6px);
}

/* The Send to menu sits with the fields, so its widget button is sized to
   match them. */
.selectMenuField:has(#commishRecipientMode){
    width: auto;
}

.selectMenuField:has(#commishRecipientMode) .selectMenuButton{
    border-color: var(--c1-n4);
    border-radius: var(--r3);
    font-size: var(--fs-body);
    height: auto;
    min-height: 46px;
    padding: 12px 14px;
}

/* --- Manual picks --------------------------------------------------------- */

/* The entry and the week, with Load in the row beside them, over the games. */
#commishPickChooser{
    align-items: flex-end;
    margin-bottom: 18px;
}

/* One compact cell per game: the away, home, and None buttons side by side.
   The cells flow into as many columns as the modal has room for. */
.modalCommishPickGrid{
    display: grid;
    gap: 8px 16px;
    grid-template-columns: repeat(auto-fill, minmax(236px, 1fr));
}

.modalCommishPicks{
    display: flex;
    gap: var(--g1);
}

.modalCommishPick{
    align-items: center;
    border-radius: var(--r2);
    box-sizing: border-box;
    cursor: pointer;
    display: flex;
    flex: 0 0 auto;
    flex-direction: column;
    font-size: var(--fs-small3);
    height: 40px;
    justify-content: center;
    line-height: 1.2;
    position: relative;
    white-space: nowrap;
    /* One size for every team and for None, so the columns line up down the
       grid whatever the abbreviation. */
    width: 76px;
}

/* The button's own fill shows which one is picked, so the radio itself is
   hidden visually but stays in place for the keyboard and screen readers. */
.modalCommishPick input{
    height: 1px;
    margin: 0;
    opacity: 0;
    position: absolute;
    width: 1px;
}

.modalCommishPick:has(input:focus-visible){
    outline: 2px solid var(--c1);
    outline-offset: 2px;
}

.modalCommishPickTeam{
    font-weight: var(--fw3);
}

@media screen and (max-width: 700px) {
    .modalTable .modalActions{
        justify-content: flex-start;
    }
}

/* ── The Board ──────────────────────────────────────────────────────────── */

/* The legend, opened by the question mark in the tool row. It holds two
   legends, one for the standard look and one for color blind mode, and only
   the one for the mode in use is shown. */
#boardLegendModal{
    text-align: left;
    width: min(480px, 100%);
}

/* Its body, the part that scrolls, reaches across the panel's 32px of right
   padding to the panel's edge and takes the same 32px back inside, so the
   text stays where it was and the scrollbar, drawn over the body's right
   edge, runs down the modal's edge as League Settings' does. */
#boardLegendModal > .modalBody{
    margin-right: -32px;
    padding-right: 32px;
}

.modalLegend--colorblind,
.is-colorblindMode .modalLegend--standard{
    display: none;
}

.is-colorblindMode .modalLegend--colorblind{
    display: block;
}

/* The sample in a column the width of a pick cell, so every description
   starts at the same edge. */
#boardLegendModal .modalListItem{
    grid-template-columns: var(--board-fixed-col-width) 1fr;
}

/* A legend sample opens nothing, so it takes no lift under the pointer. */
.modalSample .teamInTD:hover{
    transform: none;
}

/* The wand as the projecting row's wand shows it: lit, and at half strength
   while only some of its picks are projected to win. See .boardPPButton. */
.modalLegendWand{
    color: var(--c-text-primary);
    font-size: 13.333px;
    transform: translateY(1.5px) scale(1.2);
}

.modalLegendWand--some{
    opacity: .5;
}

/* The points and the CSE as the table's figures show them: in italics, and
   at half strength. */
.modalLegendNumber{
    color: var(--c-text-primary);
    font-variant-numeric: tabular-nums;
}

.modalLegendNumber--italic{
    font-style: italic;
}

.modalLegendNumber--muted{
    color: var(--board-ink-1, var(--c1-n9));
    opacity: .5;
}

/* The Pick 5 distribution. Wide rather than tall on purpose: every team
   playing in the week gets a line, up to thirty-two of them, and laid out in
   columns the whole week is readable at once. The teams read down a column
   before moving across, so the grid is given its row count - written on the
   element as --dist-rows - and fills by column. */
.modalDistributionGrid{
    --dist-ball-width: 16px;
    align-content: start;
    box-sizing: border-box;
    display: grid;
    flex: 1 1 auto;
    gap: 0 42px;
    grid-auto-columns: min-content;
    grid-auto-flow: column;
    grid-template-rows: repeat(var(--dist-rows, 16), auto);
    /* Teams' two columns against the modal's two sides, as Games' teams are. */
    justify-content: space-between;
    min-height: 0;
    /* The first and last rows' pills as far from the ends as they are from each other. */
    padding-block: var(--board-cell-edge);
    /* Not scrolled at this width - the whole week fits. The narrow fallback
       below turns the scroll on. */
    overflow: visible;
}

/* Its Games view: each game a row, its away team in the left column, its home
   team in the right, and its bar between them, read across rather than down. */
.modalDistributionGrid--games{
    column-gap: var(--g2);
    grid-auto-flow: row;
    grid-template-columns: min-content 104px min-content;
    grid-template-rows: none;
}

/* A game's bar: the away team's entries, those that took neither side, and the
   home team's (pcf_week_pick_distribution_bar_html()). */
.modalDistributionBar{
    align-self: center;
    border-radius: var(--r1);
    display: flex;
    gap: 1px;
    height: 8px;
    overflow: hidden;
}

.modalDistributionBarSegment{
    flex-basis: 0;
}

.modalDistributionBarSegment--win{
    background-color: var(--c-win);
}

.modalDistributionBarSegment--loss{
    background-color: var(--c-loss);
}

.modalDistributionBarSegment--push{
    background-color: var(--c-push);
}

.modalDistributionBarSegment--pending{
    background-color: var(--c2-n4);
}

.modalDistributionBarSegment--none{
    background-color: var(--c1-n3);
}

/* A viewer with no Harvey balls to show: the balls' track closes. */
.modalDistributionGrid--noBalls{
    --dist-ball-width: 0;
}

/* The view not showing keeps its width and gives up its height, so the modal is
   as wide as its wider view, Games, on both. Unseen, so it takes no tap or focus. */
.modalDistributionGrid[hidden]{
    display: grid;
    flex: 0 0 0;
    height: 0;
    overflow: hidden;
    padding-block: 0;
    visibility: hidden;
}

/* Teams and Games, above the view, as far from it as the blurb is from them. */
.modalDistributionViews{
    flex: 0 0 auto;
    margin-bottom: 18px;
}

/* Harvey ball, logo, code, and share. The code's column is a Board pick cell's
   width. The share's takes what the card has left: the grid's column is as wide
   as its widest card and every card fills it, so each column of shares is as
   wide as its own widest value and they line up down it. */
.modalDistributionCard{
    align-content: center;
    align-items: center;
    box-sizing: border-box;
    display: grid;
    grid-template-columns: var(--dist-ball-width) 30px var(--board-fixed-col-width) auto;
    cursor: default !important;
}

/* A team nobody took still belongs on the board - it is a real and useful
   zero - but it should not compete with the teams that were picked. */
.modalDistributionCard.is-empty > *{
    opacity: .45;
}

/* A fixed box for art that is not uniformly shaped, so the codes do not
   step left and right down the column with every change of logo. */
.modalDistributionLogo{
    display: block;
    height: 20px;
    object-fit: contain;
    width: 26px;
}

.modalDistributionLogo--blank{
    visibility: hidden;
}

/* The code and the share sit on one baseline - the code's on its pill's
   text - so the share reads level with the code. */
.modalDistributionTeam,
.modalDistributionPercent{
    align-self: baseline;
}

.modalDistributionPercent{
    color: var(--c-text-primary);
    font-family: var(--ff-body);
    font-size: var(--fs-body);
    font-variant-numeric: tabular-nums;
    line-height: 1.2;
    padding-left: var(--g1);
    text-align: right;
}

/* In Games, a home team - the right column - is the away team's mirror image:
   share, code, logo, and Harvey ball, the share set against the gap between
   the columns and the ball against the outer edge. */
.modalDistributionGrid--games > .modalDistributionCard:nth-child(3n){
    grid-template-columns: auto var(--board-fixed-col-width) 30px var(--dist-ball-width);
}

.modalDistributionGrid--games > .modalDistributionCard:nth-child(3n) > .modalDistributionPercent{
    order: -1;
    padding-left: 0;
    padding-right: var(--g1);
    text-align: left;
}

.modalDistributionGrid--games > .modalDistributionCard:nth-child(3n) > .modalDistributionLogo{
    justify-self: end;
    order: 1;
}

.modalDistributionGrid--games > .modalDistributionCard:nth-child(3n) > .modalDistributionTeam{
      justify-self: end;
}


/* The viewer's Harvey ball: the share of the viewer's own entries that took
   the team, a wedge from 12 o'clock (pcf_harvey_ball_svg()). Its track comes
   before the logo's, the ball and the 4px the logo leaves after it; a team the
   viewer did not take keeps the track empty. */
.modalDistributionBall{
    display: block;
    fill: var(--c-text-muted);
    stroke: var(--c-text-muted);
    width: 10px;
    height: 10px;
}

/* A home team's ball is on the outer edge, to the right of its logo. */
.modalDistributionGrid--games > .modalDistributionCard:nth-child(3n) > .modalDistributionBall{
    justify-self: end;
    order: 2;
}

/* A loss's glyph is put before its code by running the pill's grid from the
   right rather than by moving the glyph first (board.css): the first of them
   sets the pill's baseline, and the share and the count belong on the
   code's. */
.is-colorblindMode #boardDistributionModal .modalDistributionCard .modalDistributionTeam.incorrect > .teamInTDFill:not(:empty, .teamInTDFill--hidden){
    direction: rtl;
    grid-template-columns: minmax(0, 1fr) auto;
}

.is-colorblindMode #boardDistributionModal .modalDistributionCard .modalDistributionTeam.incorrect > .teamInTDFill:not(:empty, .teamInTDFill--hidden)::after{
    order: 0;
}

@media (max-width: 700px) {
    .modalDistributionGrid{
        grid-auto-flow: row;
        grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
        grid-template-rows: none;
        /* Two columns of a full week genuinely will not fit here, so the
           panel scrolls. */
        overflow-y: auto;
    }

    /* Still two across, so each game's teams stay side by side, its bar between
       them. */
    .modalDistributionGrid--games{
        grid-template-columns: minmax(132px, 1fr) minmax(0, 104px) minmax(132px, 1fr);
    }
}

/* ── Week Odds ──────────────────────────────────────────────────────────── */

/* Every entry's odds of finishing in the range of places chosen (pcfInitWeekOdds()
   in dashboard.js). Its width does not follow the names, so the bars do not change
   length as the list narrows. */
#weekOddsModal > .modal{
    display: flex;
    flex-direction: column;
    width: min(640px, 100%);
}

/* The combobox, then the range: From, To, and the presets. */
.weekOddsControls{
    display: flex;
    flex: 0 0 auto;
    flex-direction: column;
    gap: var(--g3);
    margin-bottom: 14px;
}

.weekOddsRange{
    align-items: flex-end;
    display: flex;
    flex-wrap: wrap;
    gap: var(--g3);
}

.weekOddsBound{
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* A number box with its arrows inside its right end. */
.weekOddsStepper{
    display: block;
    position: relative;
    width: 72px;
}

.weekOddsStepper .modalInput{
    padding-right: 24px;
}

.weekOddsStepperArrows{
    bottom: 1px;
    display: flex;
    flex-direction: column;
    position: absolute;
    right: 1px;
    top: 1px;
    width: 22px;
}

.weekOddsStepperArrows > button{
    appearance: none;
    background: none;
    border: 0;
    color: var(--c-text-muted);
    cursor: pointer;
    flex: 1 1 50%;
    font-size: 9px;
    line-height: 1;
    padding: 0;
}

.weekOddsStepperArrows > button:hover{
    background: var(--c1-n4);
    color: var(--c-text-primary);
}

.weekOddsPresets{
    display: flex;
    flex-wrap: wrap;
    gap: var(--g1);
}

/* A preset, filled while the range is the one it names. */
.weekOddsPreset{
    appearance: none;
    background: var(--c-surface);
    border: 1px solid var(--c1-n6);
    border-radius: 999px;
    color: var(--c-text-primary);
    cursor: pointer;
    font-family: var(--ff-body);
    font-size: var(--fs-small1);
    height: var(--button-height-standard);
    padding: 0 var(--g3);
}

.weekOddsPreset:hover{
    background: var(--c1-n4);
}

.weekOddsPreset[aria-pressed="true"]{
    background: var(--c1);
    border-color: var(--c1);
    color: var(--c-surface);
}

.weekOddsList{
    display: grid;
    grid-template-columns: minmax(0, 160px) minmax(0, 1fr) auto;
    list-style: none;
    margin: 0;
    padding: 0;
}

/* Name, bar, and percentage, each row's lined up with every other's. */
.weekOddsRow{
    align-items: center;
    column-gap: var(--g3);
    display: grid;
    grid-column: 1 / -1;
    grid-template-columns: subgrid;
    padding: 5px 0;
}

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

/* The whole of the place's chance across, and the part of it this entry has. */
.weekOddsBar{
    background: var(--c1-n3);
    border-radius: 4px;
    height: 10px;
    overflow: hidden;
}

.weekOddsBarFill{
    background: var(--c2);
    border-radius: 0 4px 4px 0;
    display: block;
    height: 100%;
    min-width: 0;
}

/* Any chance at all shows, however slight. */
.weekOddsBarFill.has-odds{
    min-width: 2px;
}

.weekOddsRowOdds{
    font-variant-numeric: tabular-nums;
    min-width: 3.4em;
    text-align: right;
    white-space: nowrap;
}

/* ── NFL Hub team schedule ──────────────────────────────────────────────── */

/* A team's season, loaded into the panel as it opens - its header, with the
   team and year menus, and its schedule. */
#teamScheduleModal{
    font-family: var(--ff-body);
    width: min(1054px, 100%);
}

/* The header comes with the content, so the close button is not in it; it
   keeps clear of the button as a header holding it does. */
#teamScheduleModal .modalHeader{
    padding-right: 28px;
}

#teamScheduleModal.is-team-schedule-loading #teamScheduleModalContent{
    opacity: .42;
    pointer-events: none;
}

#teamScheduleTeamSelect{
    min-width: 230px;
}

.modalScheduleSections{
    display: grid;
    gap: 18px;
    padding-top: 18px;
}

#teamScheduleModal .modalTable{
    width: 1006px;
    table-layout: fixed;
}

#teamScheduleModal .modalColWeek{ width: 60px; }

#teamScheduleModal .modalColDate{ width: 110px; }

#teamScheduleModal .modalColTime{ width: 90px; }

#teamScheduleModal .modalColOpponent{ width: 260px; }

#teamScheduleModal .modalColResult{ width: 150px; }

#teamScheduleModal .modalColRecord{ width: 70px; }

#teamScheduleModal .modalColResultWide{ width: 220px; }

#teamScheduleModal .modalColVenue{ width: 266px; }

.modalScheduleOpponent{
    min-width: 220px;
}

/* The glyph or logo and the words beside it, on one line. */
.modalScheduleInner{
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

.modalScheduleSite{
    width: 18px;
    flex: 0 0 18px;
    color: rgba(0, 0, 0, .55);
    text-align: center;
}

.modalScheduleLogo{
    width: 20px;
    height: 20px;
    flex: 0 0 20px;
    object-fit: contain;
}

.modalScheduleOutcome{
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    min-width: 18px;
    font-weight: var(--fw5);
}

.modalScheduleOutcome--win{
    color: #18803a;
}

.modalScheduleOutcome--loss{
    color: #b42318;
}

.modalScheduleOutcome--tie{
    color: #6b7280;
}

/* ── Admin: league commissioners ────────────────────────────────────────── */

/* Over the whole window: this page has no sidebar for it to leave room for. */
#adminCommissionersModal{
    inset: 0;
}

#adminCommissionersModal > .modal{
    max-width: calc(100vw - 40px);
    width: 520px;
}

/* ── My Picks ───────────────────────────────────────────────────────────── */

/* The matchup badge legend. */
#pickBadgeLegendModal{
    text-align: left;
    width: min(480px, 100%);
}

/* A badge out of its game: in the row rather than over the gap between two
   tiles, at a size of its own, and still - it opens nothing, so it neither
   grows under the pointer nor takes the pointer's hand. */
.modalSample .matchupBadge{
    cursor: default;
    font-size: 18px;
    left: auto;
    position: relative;
    top: auto;
    transition: none;
    translate: none;
    will-change: auto;
    z-index: auto;
}

.modalSample .matchupBadge:hover{
    scale: none;
}

/* Entry Settings. The modal takes focus itself as it opens, so that focus
   must not draw a ring the way a control's would. */
#pickEntrySettingsModal:focus,
#pickEntrySettingsModal:focus-visible{
    outline: none;
}

/* One grid for every entry: the names in the first column, as wide as the
   longest name, and the pick options in the second. Each row lays its two
   parts straight into these columns, so every name shows in full and every
   row's options start and end in the same place. Only where the window
   leaves too little room does the name column give way, ending names in an
   ellipsis. */
.modalEntryList{
    --pick-settings-fade: 28px;
    box-sizing: border-box;
    display: grid;
    grid-template-columns: minmax(0, max-content) max-content;
    align-items: center;
    align-content: start;
    row-gap: var(--g1);
    padding-bottom: 12px;
    flex: 1 1 auto;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    /* The list clips sideways because it scrolls: the padding moves the clip
       edge past the rows' borders and the names' hover backgrounds, and the
       matching negative margin keeps the list where it was. */
    margin-left: -6px;
    padding-left: 6px;
    padding-right: 2px;
    width: max-content;
    max-width: calc(100% + 6px);
    /* The scrollbar is replaced by the fades below. */
    scrollbar-width: none;
    --scroll-cues: none;
    -ms-overflow-style: none;
}

.modalEntryList::-webkit-scrollbar{
    display: none;
}

/* A fade at whichever end has more past it, as a mask on the scroller
   itself - set by syncSettingsScrollFades() in my-picks.php. Both ends at
   once needs the one gradient that fades at both. */
.modalEntryList.is-scrollable-up{
    -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 var(--pick-settings-fade));
    mask-image: linear-gradient(to bottom, transparent 0, #000 var(--pick-settings-fade));
}

.modalEntryList.is-scrollable-down{
    -webkit-mask-image: linear-gradient(to top, transparent 0, #000 var(--pick-settings-fade));
    mask-image: linear-gradient(to top, transparent 0, #000 var(--pick-settings-fade));
}

.modalEntryList.is-scrollable-up.is-scrollable-down{
    -webkit-mask-image: linear-gradient(
        to bottom,
        transparent 0,
        #000 var(--pick-settings-fade),
        #000 calc(100% - var(--pick-settings-fade)),
        transparent 100%
    );
    mask-image: linear-gradient(
        to bottom,
        transparent 0,
        #000 var(--pick-settings-fade),
        #000 calc(100% - var(--pick-settings-fade)),
        transparent 100%
    );
}

/* No box of its own: its name and its options go straight into the list's
   two columns. The row element stays for the page script. */
.modalEntryRow{
    display: contents;
}

.modalEntryName{
    align-items: stretch;
    align-self: stretch;
    display: flex;
    gap: var(--g1);
    justify-content: flex-start;
    margin-right: 12px;
    min-width: 0;
    text-align: left;
}

/* The pen and, where it can be renamed, the name after it: one control, so
   one hover background and one click area take in both. */
.modalEntryName .modalLabel{
    align-items: center;
    display: flex;
    flex: 1 1 auto;
    gap: 7px;
    margin: 0 0 0 -6px;
    min-width: 0;
    padding: 3px 6px;
    white-space: nowrap;
}

.modalEntryName .modalLabel[hidden]{
    display: none;
}

.modalEntryName .modalLabel[role="button"]{
    border-radius: var(--r2);
    cursor: pointer;
}

.modalEntryName .modalLabel[role="button"]:hover{
    background: rgba(23, 33, 54, .07);
}

.modalEntryName .modalLabel[role="button"]:focus-visible{
    outline: 2px solid var(--c2-n10);
    outline-offset: 2px;
}

.modalEntryName .modalLabel[aria-disabled="true"]{
    cursor: default;
    opacity: .45;
}

/* The pen before a name that can be renamed, to say so. */
.modalEntryName .fa-pen{
    color: var(--c-text-muted);
    flex: 0 0 auto;
    font-size: 0.8em;
}

/* The name on a single line, cut short only if the window is too narrow. */
.modalEntryNameText{
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.modalEntryPicks{
    justify-self: end;
}

/* Each option as wide as its own words. Every entry's row offers the same
   options, so the rows still line up above and below one another. */
.modalDefaultPickButton{
    box-sizing: border-box;
    justify-content: center;
    text-align: center;
}

@media (max-width: 560px) {
    .modalEntryList{
        width: 100%;
    }

    .modalEntryPicks{
        justify-self: start;
    }
}

/* Edit Entry Name, opened from Entry Settings. Its z-index clears
   .modalBackdrop's so it stacks over the settings modal that opened it. */
#pickEntryRenameBackdrop{
    z-index: 4200;
}

#pickEntryRenameModal{
    width: 320px;
    max-width: calc(100vw - 32px);
}

/* Edit Entry Name where the page has no script to open the one above. */
#entryEditModal{
    width: min(360px, 100%);
}

/* ── Edit League Theme and Logo, and Edit Profile Picture ───────────────── */

/* The two share one layout: the logo in the left column and its colours in
   the right - the profile picture modal has only the left. */
#logo-modal .modalColumn:first-child,
#profile-avatar-modal .modalColumn:first-child{
    align-items: center;
}

#logo-modal .modalColumn:first-child{
    gap: var(--fs-small2);
}

#logo-modal .modalColumn + .modalColumn{
    gap: 18px;
}

/* The colour sets' names, and League name, in the ink, a step above the
   controls' own labels. */
#logo-modal .settingLabel{
    color: var(--c-text-primary);
    font-family: var(--ff-body);
    font-size: var(--fs-small1);
    font-weight: var(--fw4);
    line-height: 1.2;
    text-align: left;
}

/* Hue, Shade, Hex code, and the rest: a small grey label over or beside each
   control, closer to it than to the control above. */
#logo-modal .modalLabel{
    color: var(--c1-n8);
    font-family: var(--ff-body);
    font-size: var(--fs-small2);
    font-weight: var(--fw3);
    line-height: 1.2;
    text-align: left;
}

/* A section's heading with Reset at its right: the Logo heading, the Colors
   heading, and the Secondary set's heading with its switch beside it. */
.logoHead{
    align-items: center;
    align-self: stretch;
    display: flex;
    gap: 10px;
    justify-content: space-between;
    margin-bottom: 6px;
}

/* The heading's own bottom margin would sit it high against the button. */
.logoHead > .modalSectionTitle{
    margin-bottom: 0;
}

/* The profile picture modal has Reset with no heading across from it, so it
   sits at the row's right alone. */
#profile-avatar-modal .logoHead{
    justify-content: flex-end;
}

/* Reset, and Team colors while it is hidden, with the Team colors pop-up
   hanging from them. */
.logoActions{
    display: flex;
    flex: none;
    gap: var(--g2);
    position: relative;
}

.logoActions > [hidden]{
    display: none;
}

/* The league logo's football and border, each in the primary or the
   secondary as chosen in the theme modal (the body's data-league-logo-*
   markers), declared on each drawing of the logo so they resolve against the
   theme colours as they stand there. */
.logoPreviewFrame,
.logoCropCircle{
    --c-league-logo-football: var(--c-league-theme-ink, var(--c2));
    --c-league-logo-border: var(--c-league-theme-accent, var(--c2));
}

/* The preview, the crop slider under it, and the Upload button under that,
   each centred in a column. */
.logoPreviewGrid{
    align-items: center;
    display: grid;
    grid-template-areas:
        "preview"
        "slider"
        "actions";
    grid-template-columns: max-content;
    grid-template-rows: auto auto auto;
    justify-content: center;
    min-height: 7rem;
    position: relative;
    row-gap: var(--fs-small2);
    width: 100%;
}

.logoPreviewColumn{
    align-items: center;
    align-self: center;
    display: flex;
    flex-direction: column;
    grid-area: preview;
    justify-self: center;
    min-width: 0;
    position: relative;
    width: max-content;
}

.logoPreviewWrap{
    display: flex;
    justify-content: center;
    margin-bottom: 0;
}

.logoPreviewFrame{
    --logo-glow-size: 1.25rem;
    background: var(--c-surface);
    border: 10px solid var(--c-league-logo-border);
    border-radius: 50%;
    box-sizing: border-box;
    height: 14rem;
    overflow: hidden;
    position: relative;
    width: 14rem;
}

/* In the league theme modal, the logo stands on the ink. */
#logo-modal .logoPreviewFrame{
    background: var(--c1);
}

.logoPreviewImage,
.logoPreviewIcon{
    box-sizing: border-box;
    height: 100%;
    object-fit: contain;
    transform-origin: center center;
    width: 100%;
}

.logoPreviewIcon{
    align-items: center;
    font-size: 7rem;
    justify-content: center;
    line-height: 1;
}

/* Upload logo, and Reset Image, side by side under the preview. */
.logoPreviewGrid > .modalActions{
    grid-area: actions;
    justify-content: center;
    margin-top: 0;
}

.logoPreviewGrid > .modalActions > .btn-standard{
    align-items: center;
    display: inline-flex;
    gap: 0.5rem;
    white-space: nowrap;
}

/* The crop: the uploaded picture in a circle the size of the preview, dragged
   into place and zoomed by the slider under it. */
.logoCropArea{
    align-items: center;
    display: none;
    flex-direction: column;
    gap: var(--fs-small2);
    margin-bottom: 0;
}

.logoCropCircle{
    background: #f5f5f5;
    border: 10px solid var(--c-league-logo-border);
    border-radius: 50%;
    box-sizing: border-box;
    cursor: grab;
    height: 14rem;
    width: 14rem;
    margin: 0 auto;
    overflow: hidden;
    position: relative;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
}

.logoCropCircle--disabled{
    cursor: default;
}

/* In the profile picture modal, the picture sits on the ink. Where the
   picture's rounded edge meets the ring, the smoothing lets a sliver of what
   is behind it show through, so the outermost 2px behind the picture are
   the ring's own colour. */
#profile-avatar-modal .logoCropCircle{
    background: radial-gradient(
        circle closest-side,
        var(--c1) calc(100% - 2px),
        var(--c-league-logo-border) calc(100% - 2px)
    );
}

.logoCropImage{
    left: 50%;
    max-width: none;
    pointer-events: none;
    position: absolute;
    top: 50%;
    transform-origin: center center;
    will-change: transform;
}

.logoCropControls{
    align-items: center;
    display: none;
    flex-direction: column;
    gap: 0.35rem;
    grid-area: slider;
    justify-self: center;
    width: 100%;
}

.logoCropControls--disabled{
    opacity: 0.45;
}

.logoCropZoomRow{
    align-items: center;
    display: flex;
    gap: 0.6rem;
    justify-content: center;
    width: 100%;
}

.logoCropZoomButton{
    align-items: center;
    appearance: none;
    -webkit-appearance: none;
    /* The glyph is the circle, so the button draws none of its own. */
    background: none;
    border: 0;
    border-radius: 50%;
    color: var(--c1-n8);
    cursor: pointer;
    display: flex;
    flex: 0 0 auto;
    font-size: 26px;
    height: 26px;
    justify-content: center;
    line-height: 1;
    padding: 0;
    width: 26px;
}

.logoCropZoomSlider{
    cursor: pointer;
    flex: 1;
    width: 100%;
}

.logoCropControls--disabled .logoCropZoomButton,
.logoCropControls--disabled .logoCropZoomSlider,
.logoCropControls--disabled .logoCropResetButton{
    cursor: default;
}

/* Football and Border under Upload logo, one over the other: each a label
   at the left of its segmented row, laid in a grid so the rows start level
   whatever their labels' lengths. */
.logoRoles{
    align-items: center;
    column-gap: 10px;
    display: grid;
    grid-template-columns: auto auto;
    justify-content: center;
    margin-top: 14px;
    row-gap: 14px;
}

.logoRole{
    display: contents;
}

.logoRole > .modalLabel{
    grid-column: 1;
}

.logoRole > .segmentedRow{
    justify-self: start;
}

/* --- Colours -------------------------------------------------------------- */

#logo-color-section{
    display: grid;
    flex: 0 0 auto;
    gap: var(--g2);
    margin-bottom: 20px;
    min-width: 0;
    width: 100%;
}

/* The name preview across the top, and under it the three sections and, to
   their right, the NFL historical colors menu; and the Shade pad's size,
   square. */
#logo-color-sliders{
    --logo-slider-thickness: 39px;
    --logo-field-gap: 14px;
    --logo-pad-size: 72px;
    align-items: start;
    box-sizing: border-box;
    column-gap: 24px;
    display: grid;
    grid-template-columns: 320px 480px;
    margin: 0 auto;
    row-gap: var(--g1);
}

#logo-color-sliders > .modalLabel,
#logo-color-sliders > .logoPreviews{
    grid-column: 1 / -1;
}

/* Too narrow a window for the two side by side: the menu under the sections,
   and the preview no wider than they are. */
@media (max-width: 1279px) {
    #logo-color-sliders{
        grid-template-columns: 504px;
        row-gap: var(--g3);
    }
}

/* The colour circles and, under them, the links and icons preview, the two as
   tall together as the name preview to their right, which takes the rest of
   the width. */
.logoPreviews{
    column-gap: var(--g2);
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    margin-bottom: 8px;
    min-width: 0;
}

.logoPreviewSamples{
    align-content: space-between;
    display: grid;
    row-gap: var(--g1);
}

.logoColorCircles{
    display: flex;
    gap: var(--g1);
}

/* The league's name at the top of the controls, as .pageHeroLeagueName draws
   it - the same face, weight, size, text colour, and outline in the theme
   colour - on the ink. The size is the one site.js fitted the hero's name to. The box is the controls' width and
   no wider: a longer name ends in an ellipsis, which the page script writes
   into the text (truncateNamePreview()) so it carries the outline. */
.logoNamePreview{
    --c-league-name-text: var(--c-league-title-text, #fff);
    --c-league-name-outline: var(--c-league-theme-accent, var(--c2));
    background: var(--c1);
    box-sizing: border-box;
    max-width: 100%;
    min-width: 0;
    overflow: hidden;
    padding: 10px 12px;
    color: var(--c-league-name-text);
    font-family: var(--ff-display);
    font-weight: var(--fw5);
    font-size: var(--page-hero-league-name-size, calc(56 * var(--chrome-text-px)));
    line-height: 1;
    text-align: center;
    -webkit-text-stroke: 0.03em var(--c-league-name-outline);
    white-space: nowrap;
}

/* Primary, Secondary, and League name, one over the other. */
.logoColorSets{
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    row-gap: var(--g3);
}

.logoColorSet{
    display: grid;
    gap: var(--g1);
    min-width: 0;
}

/* The Secondary heading with its switch beside it. */
.logoColorSet > .logoHead{
    justify-content: flex-start;
    margin-bottom: 0;
}

#logo-secondary-body{
    display: grid;
    gap: var(--g1);
    min-width: 0;
}

#logo-secondary-body[hidden]{
    display: none;
}

/* The overview Standings card's glyph and Full standings link, at the card's
   own sizes and weights, in the primary, in a box drawn in the ink with the
   two centred in it. */
.logoInkPreview{
    align-items: center;
    border: 1px solid var(--c1);
    border-radius: var(--r2);
    box-sizing: border-box;
    color: var(--c-league-theme-ink, var(--c2));
    display: flex;
    font-family: var(--ff-body);
    gap: var(--g3);
    height: 24px;
    justify-content: center;
    padding: 0 var(--g2);
}

/* Outlined in the ink so a pale colour still shows on the modal. */
.logoColorCircle{
    border: 1px solid var(--c1);
    border-radius: 50%;
    box-sizing: border-box;
    flex: none;
    height: 24px;
    width: 24px;
}

.logoColorCircle--primary{
    background: var(--c-league-theme-ink, var(--c2));
}

.logoColorCircle--secondary{
    background: var(--c-league-theme-accent, var(--c2));
}

.logoInkPreviewGlyph{
    font-size: var(--fs-body);
}

.logoInkPreviewLink{
    align-items: center;
    display: inline-flex;
    font-size: var(--fs-small1);
    font-weight: var(--fw3);
    gap: var(--g1);
    white-space: nowrap;
}

/* The NFL historical colors menu, set into the modal: the teams in a rail down
   its left, and the chosen team's colours in a section of their own to the
   right of it, each scrolling on its own. Its height is its own, so the modal
   holds its size as the Secondary switch changes the sections beside it. */
.logoHistoryMenu{
    background: var(--c-surface);
    border: 1px solid var(--c1-n6);
    border-radius: var(--r3);
    box-sizing: border-box;
    color: var(--c-text-primary);
    display: grid;
    font-family: var(--ff-body);
    grid-template-columns: 184px minmax(0, 1fr);
    height: 400px;
    min-width: 0;
    overflow: hidden;
}

.logoHistoryTeams{
    border-right: 1px solid var(--c1-n4);
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 8px;
}

.logoHistoryTeam{
    appearance: none;
    -webkit-appearance: none;
    background: none;
    border: 0;
    border-radius: var(--r2);
    color: var(--c-text-primary);
    cursor: pointer;
    flex-shrink: 0;
    font-family: var(--ff-body);
    font-size: var(--fs-small2);
    line-height: 1.3;
    padding: 6px 8px;
    text-align: left;
}

.logoHistoryTeam:hover{
    background: var(--c1-n4);
}

.logoHistoryTeam[aria-selected="true"]{
    background: var(--c1);
    color: var(--c-surface);
    font-weight: var(--fw4);
}

/* The colours' section. All but the years keep their height; the years give
   up room when the menu is held shorter than its contents, and scroll. */
.logoHistoryBody{
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 0;
    padding: 12px;
}

.logoHistoryBody > *{
    flex-shrink: 0;
}

.logoHistoryBody > .modalHint{
    text-align: left;
}

/* The team's years, newest first, scrolling within their section: the
   colours that can be the primary in the first column, and the whites,
   blacks, and grays in the second, lined up down the list. */
.logoHistoryYears{
    align-content: start;
    column-gap: 20px;
    display: grid;
    flex: 1 1 auto;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    row-gap: var(--g3);
}

.logoHistoryYears:empty{
    display: none;
}

.logoHistoryYear{
    display: grid;
    grid-column: 1 / -1;
    grid-template-columns: subgrid;
    row-gap: var(--g1);
    text-align: left;
}

/* A year's label wraps to the list rather than widening it. */
.logoHistoryYearLabel{
    color: var(--c-text-primary);
    contain: inline-size;
    font-family: var(--ff-body);
    font-size: var(--fs-small1);
    font-weight: var(--fw4);
    grid-column: 1 / -1;
}

/* Why a year cannot be chosen, where its colours would be, in full ink so
   it reads while its whites, blacks, and grays are dimmed. */
.logoHistoryYearNote{
    color: var(--c-text-primary);
    contain: inline-size;
    font-family: var(--ff-body);
    font-size: var(--fs-small2);
    grid-column: 1;
    line-height: 1.3;
    margin: 0;
}

.logoHistorySwatches{
    align-content: start;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    grid-column: 1;
}

.logoHistorySwatches--neutral{
    grid-column: 2;
}

/* Over the second column, which can only be the secondary. */
.logoHistorySwatchesLabel{
    color: var(--c1-n8);
    contain: inline-size;
    font-family: var(--ff-body);
    font-size: var(--fs-small4);
    font-weight: var(--fw3);
    grid-column: 2;
    line-height: 1.2;
    text-align: left;
    text-wrap: balance;
}

/* A colour: a box of it, with 1 in it once chosen as the primary and 2 as
   the secondary. Its name shows on hover. */
.logoHistorySwatch{
    align-items: center;
    appearance: none;
    -webkit-appearance: none;
    background: var(--swatch-color);
    border: 1px solid var(--c1-n6);
    border-radius: var(--r2);
    box-sizing: border-box;
    color: var(--swatch-ink);
    cursor: pointer;
    display: flex;
    font-family: var(--ff-body);
    font-size: var(--fs-small2);
    font-weight: var(--fw4);
    height: 28px;
    justify-content: center;
    padding: 0;
    width: 28px;
}

.logoHistorySwatch:hover:not(:disabled){
    border-color: var(--c1-n8);
}

.logoHistorySwatch.is-chosen{
    border-color: var(--c1);
    box-shadow: 0 0 0 1px var(--c1);
}

.logoHistorySwatch:disabled{
    cursor: default;
}

.logoHistoryYear.is-disabled .logoHistorySwatch{
    opacity: .5;
}

/* What Apply will do, over it: each colour with a chip of it, and a primary
   to be adjusted with a chip of what it will become. */
.logoHistorySummary{
    border-top: 1px solid var(--c1-n4);
    display: grid;
    gap: 4px;
    padding-top: 10px;
}

.logoHistorySummary[hidden]{
    display: none;
}

.logoHistorySummaryLine{
    color: var(--c-text-primary);
    font-family: var(--ff-body);
    font-size: var(--fs-small2);
    line-height: 1.5;
    margin: 0;
    text-align: left;
}

.logoHistorySummaryChip{
    background: var(--swatch-color);
    border: 1px solid var(--c1-n6);
    border-radius: 3px;
    box-sizing: border-box;
    display: inline-block;
    height: 12px;
    margin: 0 4px -1px 0;
    width: 12px;
}

.logoHistoryBody > .modalActions{
    margin-top: 0;
}

/* The Team colors pop-up (hidden for now): a select of every team, and under
   it a sample of each colour in the chosen team's scheme, beside the
   buttons. */
.logoTeamColorsPopup{
    background: var(--c-surface);
    border: 1px solid var(--c1-n6);
    border-radius: var(--r3);
    box-shadow: var(--shadow-popover);
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: 10px;
    left: calc(100% + 8px);
    padding: 10px;
    position: absolute;
    top: 0;
    width: 280px;
    z-index: 20;
}

.logoTeamColorsPopup[hidden]{
    display: none;
}

/* Each colour is a tile, two to a row, with its name and the years it was
   worn written on it. Past a few rows the list scrolls. */
.logoTeamColorsSwatches{
    display: flex;
    flex-direction: column;
    gap: var(--g1);
    max-height: 320px;
    overflow-y: auto;
    padding: 4px;
    margin: -4px;
}

.logoTeamColorsSwatches:empty{
    display: none;
}

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

.logoTeamColorsSet + .modalSectionTitle{
    margin-top: 4px;
}

.logoTeamColorSwatch{
    appearance: none;
    -webkit-appearance: none;
    background: var(--swatch-color);
    border: 1px solid var(--c1-n7);
    border-radius: var(--r2);
    box-sizing: border-box;
    color: var(--c-surface);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    font-family: var(--ff-body);
    gap: 2px;
    justify-content: flex-end;
    min-height: 48px;
    padding: 6px 8px;
    text-align: left;
    transition: transform 120ms ease, box-shadow 120ms ease;
}

.logoTeamColorSwatch.is-light{
    color: var(--c-text-primary);
}

.logoTeamColorSwatchName{
    font-size: var(--fs-small2);
    font-weight: var(--fw3);
    line-height: 1.15;
}

.logoTeamColorSwatchYears{
    font-size: var(--fs-small3);
    line-height: 1.15;
    opacity: .8;
}

.logoTeamColorSwatch:hover,
.logoTeamColorSwatch:focus-visible{
    box-shadow: 0 0 0 2px var(--c-surface), 0 0 0 4px var(--c1);
    outline: none;
    transform: translateY(-1px);
}

/* The hex field over the hue, and the pad beside them. The field stands level
   with the pad's top and the hue with its foot. */
.logoColorControls{
    column-gap: var(--logo-field-gap);
    display: grid;
    grid-template-columns: 220px var(--logo-pad-size);
}

.logoColorStack{
    align-content: space-between;
    display: grid;
    min-width: 0;
}

/* The colour the sliders are on, as a hex, and the way to set it without
   them. Monospaced digits, because a hex code is read character by character
   and proportional figures make the pairs hard to tell apart. Not a colour
   yet - part-typed, or a typo - it goes red (is-invalid). */
.logoHex{
    width: 98px;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: var(--fs-small1);
    letter-spacing: 0.08em;
    text-align: center;
    text-transform: uppercase;
}

.logoHex.is-invalid{
    border-color: var(--c-red);
}

/* Saturation and brightness in one pad under the hue: saturation rises from
   left to right and brightness from bottom to top. The thumb stays inside
   the pad, so its centre travels half its width in from every edge, and the
   colours are laid along that same path, as the hue track's are: the colour
   under the thumb is always the one it picks. */
.logoColorPad{
    /* The thumb's full width with its 3px border. */
    --pad-thumb: 18px;
    --pad-inset: calc(var(--pad-thumb) / 2);
    position: relative;
    box-sizing: border-box;
    width: var(--logo-pad-size);
    height: var(--logo-pad-size);
    border: 3px solid var(--c1);
    border-radius: var(--r2);
    background:
        linear-gradient(to bottom, rgba(0, 0, 0, 0) var(--pad-inset), rgba(0, 0, 0, var(--logo-pad-wash, .4)) calc(100% - var(--pad-inset))),
        linear-gradient(
            to right,
            var(--logo-slider-saturation-start, #fff) var(--pad-inset),
            var(--logo-slider-full-color, hsl(var(--logo-slider-hue), 100%, 50%)) calc(100% - var(--pad-inset))
        );
    cursor: crosshair;
    touch-action: none;
}

/* The two range inputs inside are out of sight but still take the keyboard;
   the pad shows where the focus is. */
.logoColorPad:focus-within{
    outline: 2px solid var(--c2);
    outline-offset: 2px;
}

/* The same ring as the sliders' thumbs, centred on the point it marks: the
   page script gives it --pad-x and --pad-y, each 0-1 across the path. */
.logoColorPadThumb{
    position: absolute;
    left: calc(var(--pad-inset) + var(--pad-x, 1) * (100% - 2 * var(--pad-inset)));
    top: calc(var(--pad-inset) + var(--pad-y, 0) * (100% - 2 * var(--pad-inset)));
    width: 12px;
    height: 12px;
    border: 3px solid var(--c-surface);
    box-shadow: 0 0 0 3px var(--c1);
    border-radius: var(--r1);
    transform: translate(-50%, -50%);
    cursor: grab;
}

/* The ink ring is drawn as a shadow, which takes no pointer; this reaches
   out over it so the whole visible thumb grabs. */
.logoColorPadThumb::before{
    content: "";
    position: absolute;
    inset: -6px;
    border-radius: inherit;
}

.logoColorPad.is-dragging,
.logoColorPad.is-dragging .logoColorPadThumb{
    cursor: grabbing;
}

/* A slider in a frame drawn in the ink: the hue's track is the spectrum, the
   text colour's runs from white to the ink. The track's colours are laid
   along the path the thumb's centre travels, not the frame's full width, so
   the thumb always sits over the colour it picks. */
.logoColorSliderFrame{
    --slider-height: 39px;
    --slider-inset: 8px;
    --slider-thumb: 18px;
    border: 3px solid var(--c1);
    border-radius: var(--r2);
    box-sizing: border-box;
    display: block;
    height: var(--slider-height);
    position: relative;
}

.logoColorSliderFrame--hue{
    --slider-height: 32px;
    --hue-track-start: calc(var(--slider-inset) + var(--slider-thumb) / 2);
    --hue-track-length: calc(100% - 2 * var(--hue-track-start));
    background: linear-gradient(
        90deg,
        #f00 var(--hue-track-start),
        #ff0 calc(var(--hue-track-start) + var(--hue-track-length) / 6),
        #0f0 calc(var(--hue-track-start) + var(--hue-track-length) * 2 / 6),
        #0ff calc(var(--hue-track-start) + var(--hue-track-length) * 3 / 6),
        #00f calc(var(--hue-track-start) + var(--hue-track-length) * 4 / 6),
        #f0f calc(var(--hue-track-start) + var(--hue-track-length) * 5 / 6),
        #f00 calc(100% - var(--hue-track-start))
    );
}

.logoColorSliderFrame--text{
    background: linear-gradient(90deg, #fff 0%, var(--c1) 100%);
}

.logoColorSlider{
    height: var(--slider-height);
    width: calc(100% - 2 * var(--slider-inset));
    left: var(--slider-inset);
    top: -11px;
    appearance: none;
    -webkit-appearance: none;
    background: transparent;
    /* A crosshair over the track, where a press jumps the thumb there, and
       a hand over the thumb, which a press takes hold of. */
    cursor: crosshair;
    display: block;
    margin: 0;
    position: absolute;
}

.logoColorSlider:active{
    cursor: grabbing;
}

.logoColorSlider::-webkit-slider-runnable-track{
    background: transparent;
    border: 0;
    box-sizing: border-box;
    height: var(--slider-height);
}

.logoColorSlider::-moz-range-track{
    background: transparent;
    border: 0;
    box-sizing: border-box;
    height: var(--slider-height);
}

.logoColorSlider::-webkit-slider-thumb{
    -webkit-appearance: none;
    cursor: grab;
    background: transparent;
    border: 3px solid var(--c-surface);
    box-shadow: 0 0 0 3px var(--c1);
    border-radius: var(--r1);
    height: var(--slider-height);
    margin-top: 8px;
    width: 12px;
}

.logoColorSlider::-moz-range-thumb{
    cursor: grab;
    background: transparent;
    border: 3px solid var(--c-surface);
    box-shadow: 0 0 0 3px var(--c1);
    border-radius: var(--r1);
    box-sizing: content-box;
    height: var(--slider-height);
    width: 12px;
}

.logoColorSlider:active::-webkit-slider-thumb{
    cursor: grabbing;
}

.logoColorSlider:active::-moz-range-thumb{
    cursor: grabbing;
}

/* Text color and Outline color, label and row, one over the other, and the
   Neutral shade slider under Text color's row, its label over it, shown only
   while Neutral is. Each label and row stands in a band the slider's height,
   at the foot of its grid row, so the label and the row share a middle. */
.logoNameRoles{
    align-items: end;
    column-gap: 10px;
    display: grid;
    grid-template-columns: auto auto;
    justify-content: start;
    row-gap: 14px;
}

.logoNameRoles > .logoRole > *{
    align-items: center;
    display: flex;
    min-height: var(--logo-slider-thickness);
}

.logoNeutralShadeField{
    display: grid;
    gap: var(--g1);
    grid-column: 2;
    min-width: 0;
}

.logoNeutralShadeField[hidden]{
    display: none;
}

#logo-modal .modalStatus{
    grid-column: 1 / -1;
}

/* The note on the glow, across from Cancel. */
#logo-modal .modalActions > .modalHint{
    margin: 0 auto 0 0;
}

@media (max-width: 1060px) {
    .logoPreviewGrid{
        grid-template-columns: 1fr;
    }

    .logoPreviewColumn,
    .logoCropControls{
        justify-self: center;
    }

    .logoCropControls{
        width: min(180px, 100%);
    }
}

/* --- The profile picture's preview ---------------------------------------- */

/* The preview has to read as the same avatar as the page hero: the dark
   fill, the white initial in the body font at twice the hero's size, and
   cover rather than contain. */
#profileBody .logoPreviewFrame{
    background: var(--c1);
    border-color: var(--c-league-theme-accent, var(--c2));
}

#profileBody .logoPreviewImage{
    object-fit: cover;
}

#profileBody #profile-avatar-preview-initial{
    align-items: center;
    background: oklch(var(--avatar-lightness) var(--avatar-chroma) var(--avatar-hue, 0));
    box-sizing: border-box;
    color: var(--c-surface);
    font-family: var(--ff-body);
    font-size: 8rem;
    font-weight: 800;
    height: 100%;
    justify-content: center;
    line-height: 1;
    width: 100%;
    /* The same optical centring the hero applies, at twice its size. */
    transform: translate(4px, 2px);
}

/* ── Create League and League Settings: the league builder ──────────────── */

/* The page loaded into the frame: Create League a form of rows, League
   Settings a list of values, both under the plain title the site's other
   modals use, in the modals' own type. */

#createLeagueForm > .modalActions{
    margin: 6px 12px 0;
}

/* Every row's name in one column, as wide as the longest name, which stays on
   one line: the sections and their rows take the column through subgrid, as
   League Settings' do, so every control still starts on the same line. Beside
   the names only - stacked, a row has one column. */
@media (min-width: 641px) {
    :is(#createLeagueForm, #commishFinancesForm) > div:has(> .modalSection){
        column-gap: 16px;
        display: grid;
        grid-template-columns: max-content minmax(0, 1fr);
    }

    :is(#createLeagueForm, #commishFinancesForm, .prizeSheet) .modalSection,
    :is(#createLeagueForm, #commishFinancesForm, .prizeSheet) .modalRow{
        column-gap: normal;
        grid-column: 1 / -1;
        grid-template-columns: subgrid;
    }

    :is(#createLeagueForm, #commishFinancesForm, .prizeSheet) .modalSection{
        display: grid;
    }

    :is(#createLeagueForm, #commishFinancesForm, .prizeSheet) :is(.modalSectionTitle, .modalSectionHead){
        grid-column: 1 / -1;
    }

    :is(#createLeagueForm, #commishFinancesForm, .prizeSheet) .modalRow > :first-child{
        white-space: nowrap;
    }
}

/* The prize builder sheet: a panel centred over the whole window, the Create
   League modal and everything else dimmed behind it, with Cancel, its name, the
   count of what needs fixing, and Done in a bar across the top, and the editor
   scrolling under it. The script moves it to the page's body while it is open,
   since the modal's backdrop and frame would otherwise hold a fixed box to
   their own. */
.prizeSheet{
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgb(from var(--c1) r g b / 0.6);
    -webkit-backdrop-filter: blur(1px);
    color: var(--c-text-primary);
    font-family: var(--ff-body);
    font-size: var(--fs-small1);
}

.prizeSheet[hidden]{
    display: none;
}

/* As wide as the editor and its padding, and as tall as a modal may be. */
.prizeSheetPanel{
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    width: fit-content;
    max-width: 100%;
    height: var(--modal-max-height);
    border-radius: var(--r3);
    background: var(--c-surface);
    overflow: hidden;
}

.prizeSheetHeader{
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: var(--g3);
    padding: 16px 32px;
    border-bottom: 1px solid var(--c1-n4);
}

.prizeSheetTitle{
    flex: 1 1 auto;
    min-width: 0;
    margin: 0;
    font-size: var(--fs-big3);
    font-weight: var(--fw3);
    text-align: center;
}

/* How many things stop the structure being applied: in the prize sheet's
   bar, and beside Finances' title in Commissioner Tools. */
.payoutIssueCount{
    color: var(--c-red);
    font-size: var(--fs-small2);
    font-weight: var(--fw3);
    white-space: nowrap;
}

.modalHeader > .payoutIssueCount{
    margin-left: auto;
    margin-right: var(--g3);
}

/* Done or Save with something to fix points here: the count nudges side to
   side. */
.payoutIssueCount.is-pointed{
    animation: payoutIssueCountPoint 420ms ease-in-out;
}

@keyframes payoutIssueCountPoint {
    20% { translate: -4px 0; }
    40% { translate: 4px 0; }
    60% { translate: -3px 0; }
    80% { translate: 2px 0; }
}

/* Commissioner Tools' offer of an unfinished prize draft, above the
   structure the league has: "Unfinished prize draft · Resume · Discard". */
.payoutDraftLine{
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--g1);
    margin-bottom: var(--g3);
    padding: 10px 14px;
    border: 1px solid var(--c1-n6);
    border-radius: var(--r2);
    background: var(--c1-n2);
    font-size: var(--fs-small2);
    font-weight: var(--fw3);
}

.payoutDraftLineDot{
    color: var(--c-text-muted);
    font-weight: var(--fw1);
}

.payoutDraftLine > .btn-text{
    margin-left: 0;
    padding: 0;
    background: none;
    cursor: pointer;
    font-family: inherit;
}

.payoutDraftLine > .btn-text:hover{
    text-decoration: underline;
}

.prizeSheetBody{
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 24px 32px 32px;
}

/* The first thing Done found to fix, ringed in red a moment as it is
   scrolled to. */
.is-issueFlash{
    animation: payoutIssueFlash 1600ms ease-out;
}

@keyframes payoutIssueFlash {
    0%, 50% { box-shadow: 0 0 0 3px color-mix(in srgb, var(--c-red) 40%, transparent); }
    100% { box-shadow: 0 0 0 3px transparent; }
}

@media (prefers-reduced-motion: reduce) {
    .payoutIssueCount.is-pointed{
        animation: none;
    }
}

@media (max-width: 640px) {
    .prizeSheetHeader{
        padding: 12px 16px;
    }

    .prizeSheetBody{
        padding: 20px 18px 24px;
    }
}

/* --- The prize sheet's payout structure ---------------------------------
   Settings down the left, everything they come to in one summary on the
   right, held in view as the settings scroll. See the sheet layout of
   pcf_payouts_section_html(). */
.payoutSheetColumns{
    display: grid;
    grid-template-columns: minmax(0, 1fr) 340px;
    gap: 32px;
    align-items: start;
}

.payoutSheetSettings{
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-width: 0;
}

/* Start from and the Pot split: the name on a line of its own over what it
   sets. */
.payoutsSection--sheet .payoutOptionRow{
    margin-bottom: 0;
}

.payoutsSection--sheet .payoutOptionRow > .payoutOptionLabel{
    flex-basis: 100%;
}

.payoutsSection--sheet .payoutEditor{
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* A card: its name on its top border - the weekly card's switch at the
   other end of it - and its rows inside, each a name in one column and
   its settings beside it. */
.payoutCard{
    --payout-card-label: 64px;
    position: relative;
    display: flex;
    flex-direction: column;
    gap: var(--g3);
    margin-top: 9px;
    padding: 22px 18px 16px;
    border: 1px solid var(--c1-n6);
    border-radius: var(--r2);
    background: var(--c-surface);
}

.payoutCardLabel{
    position: absolute;
    top: 0;
    left: 12px;
    translate: 0 -50%;
    margin: 0;
    padding: 0 6px;
    background: inherit;
    color: var(--c-text-primary);
    font-size: var(--fs-small1);
    font-weight: var(--fw3);
    line-height: 1.2;
}

.payoutCardSwitch{
    position: absolute;
    top: 0;
    right: 12px;
    translate: 0 -50%;
    display: flex;
    padding: 0 6px;
    background: inherit;
}

.payoutCardBody,
.payoutCardPaid{
    display: flex;
    flex-direction: column;
    gap: var(--g3);
}

.payoutCardBody.payoutTrackControls{
    margin-top: 0;
}

.payoutCardRow{
    display: grid;
    grid-template-columns: var(--payout-card-label) minmax(0, 1fr);
    column-gap: var(--g3);
    align-items: center;
}

/* The place rows, for Custom: the places in the name column, the box
   holding a tier's last place where it can be moved, the share and its
   dollars (.payoutValuePair), and "each" where the tier is more than one
   place. */
.payoutCard .payoutCardPlaces{
    grid-template-columns: minmax(var(--payout-card-label), max-content) max-content max-content minmax(0, 1fr);
    column-gap: var(--g3);
}

.payoutCardPlaces .payoutRowOrdinal{
    min-width: 0;
    text-align: left;
}

.payoutCardPlaces .payoutRowDetail{
    color: var(--c-text-muted);
}

.payoutPlaceEnd.is-absent{
    visibility: hidden;
}

/* More options: what is rarely needed, folded under a line of its own. */
.payoutMoreOptions > summary{
    display: inline-flex;
    align-items: center;
    gap: var(--g1);
    color: var(--c2);
    cursor: pointer;
    font-size: var(--fs-small2);
    font-weight: var(--fw3);
    list-style: none;
}

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

.payoutMoreOptions > summary::before{
    content: "▸";
    transition: rotate 120ms ease;
}

.payoutMoreOptions[open] > summary::before{
    rotate: 90deg;
}

.payoutMoreOptions > .payoutMinPayout{
    margin-top: var(--g2);
}

.payoutCard--special > .modalHint{
    margin-top: -4px;
}

/* The summary: the preview, the bar, what each place is paid, and whether
   it all holds. */
.payoutSummary{
    position: sticky;
    top: 0;
    z-index: 5;
    padding: 20px;
    border: 1px solid var(--c1-n6);
    border-radius: var(--r3);
    background: var(--c1-n2);
}

.payoutSummaryBar{
    display: none;
}

.payoutSummaryDetail{
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.payoutSummaryHeading{
    color: var(--c-text-muted);
    font-size: var(--fs-small3);
    font-weight: var(--fw3);
    letter-spacing: var(--ls1);
    text-transform: uppercase;
}

.payoutSummary .payoutEntries{
    margin-bottom: 0;
}

.payoutSummary .payoutEntriesPot{
    font-size: var(--fs-body);
}

.payoutSummary .payoutPotBarSticky{
    position: static;
    margin: 0;
    padding: 0;
}

.payoutSummary .payoutPotBar{
    margin-bottom: 0;
}

.payoutSummaryGroup + .payoutSummaryGroup{
    margin-top: 12px;
}

.payoutSummaryRow{
    display: flex;
    justify-content: space-between;
    gap: var(--g3);
    padding: 3px 0;
    font-size: var(--fs-small2);
    font-variant-numeric: tabular-nums;
}

.payoutSummaryStatus{
    display: flex;
    flex-direction: column;
    gap: var(--g1);
}

.payoutSummaryStatus:empty{
    display: none;
}

.payoutSummaryLine{
    margin: 0;
    font-size: var(--fs-small2);
}

.payoutSummaryLine.is-valid{
    color: var(--c-green);
    font-weight: var(--fw3);
}

.payoutSummaryLine.is-issue{
    color: var(--c-red);
}

.payoutSummaryLine.is-note{
    color: var(--c-text-muted);
}

/* An issue, in the summary or the list beside Done, taking the
   commissioner to its card. */
.payoutIssueLink{
    appearance: none;
    -webkit-appearance: none;
    padding: 0;
    border: 0;
    background: none;
    color: inherit;
    cursor: pointer;
    font: inherit;
    text-align: left;
    text-decoration: underline;
    text-underline-offset: 2px;
}

/* The issues beside Done: their count a button, opening the list of them. */
.payoutIssues{
    position: relative;
}

.payoutIssues > .payoutIssueCount{
    appearance: none;
    -webkit-appearance: none;
    height: var(--button-height-standard);
    padding: 0 12px;
    border: 1px solid color-mix(in srgb, var(--c-red) 45%, transparent);
    border-radius: var(--r2);
    background: none;
    cursor: pointer;
    font-family: inherit;
}

.payoutIssueList{
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    z-index: 10;
    width: max-content;
    max-width: 340px;
    margin: 0;
    padding: 6px;
    border: 1px solid var(--c1-n6);
    border-radius: var(--r2);
    background: var(--c-surface);
    box-shadow: var(--shadow-tooltip);
    list-style: none;
}

.payoutIssueList .payoutIssueLink{
    display: block;
    width: 100%;
    padding: 8px 10px;
    border-radius: var(--r1);
    color: var(--c-text-primary);
    font-size: var(--fs-small2);
    text-decoration: none;
}

.payoutIssueList .payoutIssueLink:hover{
    background: var(--c1-n4);
}

/* The modified template's mark, lighter than its name. */
.payoutTemplateMark{
    margin-left: 1px;
    font-weight: var(--fw1);
    opacity: .6;
}

/* On a phone: one column, the cards stacked, and the summary a bar held at
   the foot - the pot and the status - opening to the rest. It shares the
   settings' grid cell, set at its foot, so it can be held there all the way
   down; the settings keep room under them for it. */
@media (max-width: 760px) {
    .payoutSheetColumns{
        grid-template-columns: minmax(0, 1fr);
    }

    .payoutSheetSettings{
        grid-area: 1 / 1;
        padding-bottom: 76px;
    }

    .payoutSummary{
        grid-area: 1 / 1;
        align-self: end;
        top: auto;
        /* Down over the sheet's padding to the foot of the screen. */
        bottom: -24px;
        margin: 0 -18px -24px;
        padding: 0;
        border-width: 1px 0 0;
        border-radius: var(--r3) var(--r3) 0 0;
        box-shadow: var(--shadow-tooltip);
    }

    .payoutSummaryBar{
        display: flex;
        align-items: center;
        gap: var(--g2);
        width: 100%;
        padding: 14px 18px;
        border: 0;
        background: none;
        color: var(--c-text-primary);
        cursor: pointer;
        font-family: inherit;
        font-size: var(--fs-small1);
        text-align: left;
    }

    .payoutSummaryBarPot{
        font-weight: var(--fw3);
    }

    .payoutSummaryBarStatus{
        flex: 1 1 auto;
        color: var(--c-green);
        font-size: var(--fs-small2);
    }

    .payoutSummaryBarStatus.is-issue{
        color: var(--c-red);
    }

    .payoutSummaryBarCaret{
        transition: rotate 120ms ease;
    }

    .payoutSummary.is-expanded .payoutSummaryBarCaret{
        rotate: 180deg;
    }

    .payoutSummaryDetail{
        display: none;
        max-height: 60vh;
        overflow-y: auto;
        padding: 0 18px 18px;
    }

    .payoutSummary.is-expanded .payoutSummaryDetail{
        display: flex;
    }

    .prizeSheetHeader{
        gap: var(--g2);
    }

    .prizeSheetTitle{
        font-size: var(--fs-body);
    }

    /* The operands stay on the entries' line. */
    .payoutSummary .payoutEntriesMath{
        flex-basis: auto;
    }
}

/* Narrower still, a card row's name sits over its settings, which take the
   card's width. */
@media (max-width: 640px) {
    .payoutCardRow{
        grid-template-columns: minmax(0, 1fr);
        row-gap: var(--g1);
    }
}

@media (prefers-reduced-motion: reduce) {
    .payoutMoreOptions > summary::before,
    .payoutSummaryBarCaret{
        transition: none;
    }
}

/* Minimum Selections' menu holds one digit, so it is as wide as that rather
   than the whole control column. Its .modalField is display: contents, which
   makes the menu a grid item of the row: start-justified with a content
   width, so the grid cannot stretch it across the column. */
#minSelectionsRow .selectMenuField{
    justify-self: start;
    width: fit-content;
}

/* A places count over half the Estimated Entries, outlined in red - focused
   or not - with the note beside it saying why. */
:is(#createLeagueForm, #commishFinancesForm, .prizeSheet) .modalInput.is-over,
:is(#createLeagueForm, #commishFinancesForm, .prizeSheet) .modalInput.is-over:focus{
    border-color: var(--c-red);
}

:is(#createLeagueForm, #commishFinancesForm, .prizeSheet) input[type='number']:enabled{
    background: var(--c-surface);
}

/* Every number in the builder sits at the right of its field: the number
   fields, and the text fields that take numbers alone - digits
   (inputmode="numeric": Max Entries, the buy-in, the preview's entries, the Pay
   the top counts, and the tiers' last places) or dollars and cents
   (inputmode="decimal": the prizes). */
:is(#createLeagueForm, #commishFinancesForm, .prizeSheet) :is(input[type=number], input[inputmode=numeric], input[inputmode=decimal]){
    text-align: right;
}

:is(#createLeagueForm, #commishFinancesForm, .prizeSheet) input:disabled{
    background: var(--c1-n4);
}

/* A switch held on still reads as on, only faded. */
:is(#createLeagueForm, #commishFinancesForm, .prizeSheet) input.toggle:checked:disabled{
    background: var(--c2);
}

/* The radios the segmented rows stand in for. */
#createLeagueForm input[type=radio]{
    display: none;
}

/* Each special prize in two lines - its name, Weekly or Season, and the ×
   that removes it; under those its description and its value - set apart
   from the next by a rule. */
.specialPrizes{
    display: flex;
    flex-direction: column;
    gap: var(--g3);
}

.specialPrizes:empty{
    display: none;
}

.specialPrize{
    align-items: center;
    display: grid;
    gap: 8px 10px;
    grid-template-columns: minmax(0, 1fr) auto 26px;
}

.specialPrize + .specialPrize{
    border-top: 1px solid var(--c1-n4);
    padding-top: 12px;
}

.specialPrize > .specialDescription{
    grid-column: 1;
}

.specialPrize > .payoutValuePair{
    grid-column: 2;
    justify-self: start;
}

/* A share and what it pays, side by side: the percent box, "≈" before the
   season starts or "=" once it has, then the dollar box. */
.payoutValuePair{
    align-items: center;
    display: inline-flex;
    gap: var(--g1);
}

.payoutValueSign{
    color: var(--c-text-muted);
    font-family: var(--ff-body);
    font-size: var(--fs-body);
}

/* --- League Settings ------------------------------------------------------ */

/* Read-only, but laid out as the builder's form is: the same sections and
   rows, each setting's name in the left column and its value beside it.
   The two columns run through every section, as wide as the longest name
   and the longest value, so nothing wraps and the values all start on the
   same line; the modal takes the width they come to. The gap between them
   is wider than a form row's, and set once here: the sections and rows
   share these columns through subgrid, and each declares the same gap so
   none falls back to its own. */
.leagueSettingsList > div:has(> .modalSection){
    --settings-column-gap: 36px;
    column-gap: var(--settings-column-gap);
    display: grid;
    grid-template-columns: minmax(180px, max-content) minmax(var(--payout-places-width), max-content) max-content 1fr;
}

/* The value column is three tracks, so the prize lists below can share two
   of them: the places paid, then the amounts. Every value spans all three,
   and since each crosses the last track, a flexible one, it is that track
   alone that grows to fit a long value - the amounts' track is only as wide
   as the widest amount. */
.leagueSettingsList .settingValue{
    grid-column: 2 / -1;
}

.leagueSettingsList .modalSection{
    column-gap: var(--settings-column-gap);
    display: grid;
    grid-column: 1 / -1;
    grid-template-columns: subgrid;
}

.leagueSettingsList .modalSectionTitle,
.leagueSettingsList .modalRow{
    grid-column: 1 / -1;
}

.leagueSettingsList .modalRow{
    column-gap: var(--settings-column-gap);
    grid-template-columns: subgrid;
    white-space: nowrap;
}

/* Weekly Prizes and Season Prizes: the places paid, then the tiers under it. The setting's
   name stays level with the count rather than the list's middle. */
.leagueSettingsList .modalRow:has(.leagueSettingsPayouts){
    align-items: start;
}

/* Commissioners, one to a line: the setting's name on the first one's
   baseline rather than centred on them all. */
.leagueSettingsList .modalRow:has(> .settingValue br){
    align-items: baseline;
}

/* Both lists set their places and amounts in the tracks above, through
   subgrid, so one list's amounts sit in the same column as the other's,
   right-aligned on the same edge. The 12px between places and amount is
   the lists' own gap, in place of the settings' wider one. */
.leagueSettingsList .settingValue:has(> .leagueSettingsPayouts),
.leagueSettingsList .leagueSettingsPayouts,
.leagueSettingsList .leagueSettingsPayoutTiers{
    display: grid;
    grid-template-columns: subgrid;
}

.leagueSettingsList .settingValue:has(> .leagueSettingsPayouts){
    column-gap: var(--g3);
}

.leagueSettingsList .leagueSettingsPayouts,
.leagueSettingsList .leagueSettingsPayoutTiers,
.leagueSettingsList .leagueSettingsPayoutsCount,
.leagueSettingsList .leagueSettingsPayoutsRule,
.leagueSettingsList .leagueSettingsPayoutsMore{
    grid-column: 1 / -1;
}

/* A special prize's description, under its name and amount in the prize
   list (see Special prizes in leagues/create.php): muted, smaller, and held
   to two lines until "more" opens it in place. */
.leagueSettingsSpecialDescription{
    color: var(--c-text-muted);
    /* Wrapped in the width the names and amounts give the list, rather than
       widening it to sit on one line. */
    contain: inline-size;
    font-size: var(--fs-small3);
    font-weight: var(--fw1);
    grid-column: 1 / -1;
    /* Wrapped within the names' width, under the full name. */
    max-width: var(--payout-name-max);
    /* Half the list's 6px row gap under its prize's name and amount. */
    margin-top: -4px;
    /* The settings' values are held to one line; a description wraps. */
    white-space: normal;
}

/* The next prize a full row - a name line's 18px - below a description,
   rather than the list's 6px, so each prize reads as one group. */
.leagueSettingsPayoutTier:has(+ .leagueSettingsPayoutTier) .leagueSettingsSpecialDescription{
    margin-bottom: 12px;
}

.leagueSettingsSpecialText{
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    display: -webkit-box;
    overflow: hidden;
}

.leagueSettingsSpecialDescription:has(.leagueSettingsPayoutsMoreInput:checked) .leagueSettingsSpecialText{
    -webkit-line-clamp: unset;
    display: block;
}

/* "More" is the prize lists' Show more toggle, gone once it has opened the
   description, or where the description fits. */
.leagueSettingsSpecialDescription .leagueSettingsPayoutsMore:has(.leagueSettingsPayoutsMoreInput:checked),
.leagueSettingsSpecialDescription .leagueSettingsPayoutsMore[hidden]{
    display: none;
}

/* How a scaling track's places are worked out, under its count. */
.leagueSettingsPayoutsRule{
    color: var(--c-text-muted);
    font-size: var(--fs-small2);
}

.leagueSettingsList .leagueSettingsPayoutsMore{
    justify-self: start;
}

.leagueSettingsList{
    /* The widest a prize list's name may be - a special prize's - before it
       wraps; the places column, and every list's amounts after it, go no
       further out than this. */
    --payout-name-max: 160px;
}

/* A long name wraps within that width rather than being cut short, its
   amount level with its first line. */
.leagueSettingsList .leagueSettingsPayoutPlaces{
    grid-column: 1;
    max-width: var(--payout-name-max);
    white-space: normal;
}

.leagueSettingsList .leagueSettingsPayoutAmount{
    align-self: start;
    grid-column: 2;
}

@media (max-width: 640px) {
    .leagueBuilder{
        padding: 20px 18px;
    }

    #createLeagueForm > .modalActions > .btn-standard{
        width: 100%;
    }

    :is(#createLeagueForm, #commishFinancesForm, .prizeSheet) .modalInline > .modalOption{
        justify-self: start;
    }
}

/* --- The info tooltips ---------------------------------------------------- */

/* A short explanation beside a setting, opened by its info button. Lifted
   out of the form and placed against the window by positionTooltip() in
   assets/js/info-tooltips.js (is-floating), above the modals. */
.infoTooltip{
    position: absolute;
    z-index: 9999;
    width: max-content;
    max-width: 320px;
    padding: 14px 16px;
    background: var(--c-surface);
    color: var(--c1);
    font-family: var(--ff-body);
    font-size: var(--fs-small1);
    font-weight: var(--fw1);
    line-height: 1.5;
    text-align: left;
    white-space: normal;
    border-radius: var(--r3);
    box-shadow: var(--shadow-tooltip);
    border: 1px solid #ddd;
    display: none;
    opacity: 0;
    transform: translateX(-14px);
    will-change: transform, opacity;
}

.infoTooltip.is-floating{
    bottom: auto;
    position: fixed;
    right: auto;
    z-index: 10000;
}

.infoTooltip.is-visible,
.infoTooltip.is-closing{
    display: block;
}

.infoTooltip.is-visible{
    opacity: 1;
    transform: translateX(0);
}

/* Its orientation: to the right of its icon, opening upward from the icon's
   bottom edge, or downward from its top. */
.infoTooltip--up{
    left: calc(100% + 8px);
    bottom: 0;
}

.infoTooltip--down{
    left: calc(100% + 8px);
    top: 0;
}

.infoTooltip.is-opening{
    animation:
        infoTooltipOpenTransform 190ms cubic-bezier(.2, .8, .2, 1) both,
        infoTooltipOpenOpacity 190ms cubic-bezier(.2, .8, .2, 1) both;
}

.infoTooltip.is-closing{
    pointer-events: none;
    animation:
        infoTooltipCloseTransform 135ms cubic-bezier(.4, 0, .2, 1) both,
        infoTooltipCloseOpacity 135ms cubic-bezier(.4, 0, .2, 1) both;
}

@keyframes infoTooltipOpenTransform {
    0% {
        transform: translateX(-14px);
    }

    100% {
        transform: translateX(0);
    }
}

@keyframes infoTooltipOpenOpacity {
    0% {
        opacity: 0;
    }

    100% {
        opacity: 1;
    }
}

@keyframes infoTooltipCloseTransform {
    0% {
        transform: translateX(0);
    }

    100% {
        transform: translateX(-14px);
    }
}

@keyframes infoTooltipCloseOpacity {
    0% {
        opacity: 1;
    }

    100% {
        opacity: 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    .infoTooltip.is-opening,
    .infoTooltip.is-closing{
        animation-duration: 1ms;
    }
}

/* An info button: the circled i that opens a short explanation of what it
   sits beside. A real button, so it takes the keyboard, in a quiet grey
   square that a wash marks under the pointer. 16px, inside the line of words
   it sits in, so a row with one is no taller than a row without; see the
   rule after these for how it is centred on that line. */
.infoButton{
    align-items: center;
    appearance: none;
    -webkit-appearance: none;
    background: none;
    border: 0;
    border-radius: var(--r2);
    box-sizing: border-box;
    color: var(--c1-n7);
    cursor: pointer;
    display: inline-flex;
    flex: 0 0 16px;
    font-family: inherit;
    font-size: var(--fs-small1);
    height: 16px;
    justify-content: center;
    line-height: 1;
    margin: 0;
    padding: 0;
    position: relative;
    width: 16px;
    transition: color 120ms linear;
}

/* A section of the league builder whose settings cannot change once the league
   exists: its title, then a lock and a note saying so, on the title's line. */
.modalSectionHead{
    align-items: center;
    column-gap: var(--g2);
    display: flex;
    flex-wrap: wrap;
}

/* The lock and its note take the rest of the title's line. A hint has no
   width of its own in the frame (contain: inline-size, below), so the note
   is given that room rather than sized by its words. */
.modalSectionLock{
    align-items: center;
    column-gap: .25em;
    display: inline-flex;
    flex: 1 1 auto;
    min-width: 0;
}

.modalSectionLock > .modalHint{
    flex: 1 1 auto;
}

/* The lock, drawn as an info button's circled i is (.infoButton above): the
   same grey glyph in the same 16px square, but nothing to press. */
.modalLockIcon{
    align-items: center;
    color: var(--c1-n7);
    display: inline-flex;
    flex: 0 0 16px;
    font-size: var(--fs-small1);
    height: 16px;
    justify-content: center;
    line-height: 1;
    width: 16px;
}

/* The words an info button follows, laid out as a centred flex line: the
   line is the words' own height, the button is centred on it, and the space
   the markup leaves between them is kept as the gap. Zero specificity, so a
   rule that lays one of these out itself still wins. */
:where(:has(> .infoButton)){
    align-items: center;
    column-gap: .25em;
    display: inline-flex;
}

.infoButton:hover{
    /*background: var(--c1-n4);*/
    color: var(--c-text-primary);
}

.infoButton:focus-visible{
    outline: 2px solid var(--c1);
    outline-offset: 1px;
}

/* ── Payouts ────────────────────────────────────────────────────────────── */

/* The editor in Commissioner Tools and the league builder: the pot divided
   between two tracks at the top, each track's tiers under it, and what it
   all comes to at the foot. One column throughout. */
.payoutEditor{
    --payout-label-width: 200px;
    --payout-field-width: 80px;
    --payout-row-height: 38px;
    --payout-row-gap: var(--g2);
    --payout-column-gap: 10px;
    /* One grid for both tracks, so the weekly and season rows share their
       columns: a tier's first place, in a column as wide as the longest one
       could be (see .payoutRowOrdinal), then the box holding its last place,
       its amount, and what it comes to - as wide as the longest of those,
       and cut short with an ellipsis only where the editor is too narrow for
       it. A last column takes what is left, so everything else in the
       editor, which spans the grid, keeps the editor's full width. Each track's
       .payoutGrid lays its rows into these columns as a subgrid. */
    column-gap: var(--payout-column-gap);
    display: grid;
    grid-template-columns:
        max-content
        max-content
        max-content
        minmax(0, max-content)
        minmax(0, 1fr);
}

.payoutEditor > *,
.payoutTrack > *{
    grid-column: 1 / -1;
}

/* The builder's sections take its name column through subgrid (see
   #createLeagueForm .modalSection); inside the editor - a track's Pay the
   top count, Special Prizes - a section keeps a column of its own instead of
   taking the tiers' columns. */
:is(#createLeagueForm, #commishFinancesForm, .prizeSheet) .payoutEditor > .modalSection{
    grid-template-columns: minmax(0, 1fr);
}

/* Except a track's own section - its name, its Pay the top count, and its
   tiers - which passes the editor's columns through to the tiers, so the two
   tracks' rows still line up. Its name and count span them. */
:is(#createLeagueForm, #commishFinancesForm, .prizeSheet) .payoutEditor > .modalSection:has(> .payoutTrack){
    grid-template-columns: subgrid;
}

:is(#createLeagueForm, #commishFinancesForm, .prizeSheet) .payoutEditor > .modalSection:has(> .payoutTrack) > :not(.payoutTrack){
    grid-column: 1 / -1;
}

/* Pay weekly winners, Places paid, and the tier editor, folded under one
   heading in Commissioner Tools and the Create League form alike. A rule
   above it sets it off from the fee settings; in the league builder the
   payouts follow Hypothetical Entries with no rule or heading between. */
.payoutsSection{
    border-top: 1px solid var(--c1-n4);
    padding-top: 14px;
}

.payoutsSection.is-hidden{
    display: none;
}

#createPayoutsSection{
    border-top: 0;
    padding-top: 0;
}

.payoutsSummary{
    align-items: center;
    cursor: pointer;
    display: flex;
    gap: 10px;
    list-style: none;
    user-select: none;
}

.payoutsSummary > .modalSectionTitle{
    margin: 0;
}

.payoutsSummary::-webkit-details-marker{
    display: none;
}

/* A chevron that points down while the section is open. */
.payoutsSummary::before{
    border-bottom: 2px solid var(--c1-n8);
    border-right: 2px solid var(--c1-n8);
    content: "";
    flex: 0 0 auto;
    height: 7px;
    margin-left: 3px;
    transform: rotate(-45deg);
    transition: transform .15s ease;
    width: 7px;
}

.payoutsSection[open] > .payoutsSummary::before{
    transform: rotate(45deg);
}

.payoutsSummary:focus-visible{
    border-radius: var(--r2);
    outline: 2px solid rgba(30, 144, 255, 0.45);
    outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
    .payoutsSummary::before{
        transition: none;
    }
}

.payoutsBody{
    display: flex;
    flex-direction: column;
    gap: var(--g1);
}

/* The entry total the league builder's payouts are previewed with: its
   sentence, the slider bound to its field under that, and the slider's scale
   under the slider. --entries-thumb is the thumb's width, which the scale's
   labels are set in from so each sits under the thumb at its value. */
.payoutEntries{
    --entries-thumb: 18px;
    display: flex;
    flex-direction: column;
    gap: var(--g1);
    margin-bottom: var(--g2);
}

/* The operands follow the field, muted; the pot they come to sits at the
   row's right end, over the bar's Remaining, in the text's own colour. */
.payoutEntriesMath{
    align-items: baseline;
    color: var(--c-text-muted);
    display: flex;
    flex: 1 1 auto;
    gap: var(--g2);
    justify-content: space-between;
}

.payoutEntriesPot{
    color: var(--c-text-primary);
    font-weight: var(--fw3);
    white-space: nowrap;
}

.payoutEntriesSlider{
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    cursor: pointer;
    display: block;
    height: var(--entries-thumb);
    margin: 0;
    width: 100%;
}

.payoutEntriesSlider:focus-visible{
    outline: none;
}

.payoutEntriesSlider::-webkit-slider-runnable-track{
    background: var(--c1-n6);
    border-radius: 999px;
    height: 4px;
}

.payoutEntriesSlider::-moz-range-track{
    background: var(--c1-n6);
    border-radius: 999px;
    height: 4px;
}

.payoutEntriesSlider::-webkit-slider-thumb{
    -webkit-appearance: none;
    background: var(--c2);
    border: 2px solid var(--c-surface);
    border-radius: 50%;
    box-shadow: var(--shadow-button);
    box-sizing: border-box;
    height: var(--entries-thumb);
    margin-top: calc((4px - var(--entries-thumb)) / 2);
    width: var(--entries-thumb);
}

.payoutEntriesSlider::-moz-range-thumb{
    background: var(--c2);
    border: 2px solid var(--c-surface);
    border-radius: 50%;
    box-shadow: var(--shadow-button);
    box-sizing: border-box;
    height: var(--entries-thumb);
    width: var(--entries-thumb);
}

/* Focused, the thumb takes the ring the site's switches do. */
.payoutEntriesSlider:focus-visible::-webkit-slider-thumb{
    box-shadow: var(--shadow-button), 0 0 0 2px var(--c-surface), 0 0 0 4px var(--c2);
}

.payoutEntriesSlider:focus-visible::-moz-range-thumb{
    box-shadow: var(--shadow-button), 0 0 0 2px var(--c-surface), 0 0 0 4px var(--c2);
}

/* The range's ends, and faintly the breakpoints between them where the
   track's scale changes pace, so its uneven spacing reads as meant. Each
   label is centred under the thumb at its value (--at, its share of the
   track), but for the ends, held within the track's edges. The script
   hides a breakpoint that would run into an end. */
.payoutEntriesScale{
    color: var(--c-text-placeholder);
    font-size: var(--fs-small3);
    height: 1.2em;
    line-height: 1.2;
    position: relative;
}

.payoutEntriesScaleLabel{
    left: calc(var(--entries-thumb) / 2 + (100% - var(--entries-thumb)) * var(--at, 0));
    position: absolute;
    top: 0;
    transform: translateX(-50%);
    white-space: nowrap;
}

.payoutEntriesScaleLabel--start,
.payoutEntriesScaleLabel--end{
    color: var(--c-text-muted);
}

.payoutEntriesScaleLabel--start{
    left: 0;
    transform: none;
}

.payoutEntriesScaleLabel--end{
    left: auto;
    right: 0;
    transform: none;
}

.payoutEntriesScaleLabel[hidden]{
    display: none;
}

/* On a phone the math takes a line of its own under the field, at the
   right; and Start from's templates share the width, their names wrapping
   within them rather than running off the edge. */
@media (max-width: 640px) {
    .payoutEntriesMath{
        flex-basis: 100%;
        justify-content: flex-end;
    }

    .payoutOptionRow > .segmentedRow{
        display: flex;
        width: 100%;
    }

    .payoutOptionRow > .segmentedRow > .segment{
        flex: 1 1 0;
        line-height: 1.2;
        white-space: normal;
    }
}

/* How the pot divides, drawn rather than described. One line, unless every
   label together is wider than the bar: then payouts.js sets is-wrapped and
   the segments share two lines, so no label is ever cut off. */
/* Over the bar: "Allocated" and its amount at the left, "Remaining" and
   what is left to allocate at the right. */
.payoutPotTotals{
    color: var(--c-text-muted);
    display: flex;
    font-size: var(--fs-small2);
    gap: var(--g3);
    justify-content: space-between;
    margin-bottom: 4px;
}

.payoutPotBar{
    border-radius: var(--r2);
    display: flex;
    min-height: 34px;
    overflow: hidden;
    width: 100%;
    margin-bottom: 24px;
}

.payoutPotBar.is-wrapped{
    flex-wrap: wrap;
}

.payoutPotBar.is-wrapped .payoutPotSegment{
    flex-grow: 1;
}

/* Held at the top of the prize tracks as they scroll past, on the panel's
   own colour so the rows slide under it. The padding above the bar is the
   room it keeps from the top once stuck; the negative margin takes it back
   while the bar sits in place. Whatever comes just before the bar is lifted
   over the padding tucked behind it. */
.payoutPotBarSticky{
    margin: -8px 0 12px;
    padding-top: 12px;
    position: sticky;
    top: 0;
    z-index: 3;
}

:has(+ .payoutPotBarSticky){
    position: relative;
    z-index: 4;
}

/* Hidden by payouts.js while neither track pays anyone. */
.payoutPotBarSticky[hidden],
.payoutPotBar[hidden]{
    display: none;
}

/* Sized by its share of the pot, but never narrower than its own label. */
.payoutPotSegment{
    align-items: center;
    box-sizing: border-box;
    color: var(--c-surface);
    display: flex;
    flex: 0 1 auto;
    font-family: var(--ff-body);
    font-size: var(--fs-small3);
    justify-content: center;
    min-height: 34px;
    min-width: max-content;
    padding: 0 8px;
    transition: flex-basis 160ms ease;
    white-space: nowrap;
}

.payoutPotSegment--weekly,
.payoutPotSegment--specialWeekly{
    background: var(--c2);
}

.payoutPotSegment--season,
.payoutPotSegment--specialSeason{
    background: var(--c1);
}

/* What is left of the pot to allocate, light so it reads as empty room;
   over the pot, the last segment becomes the overrun. */
.payoutPotSegment--left{
    background: var(--c1-n6);
    color: var(--c-text-primary);
}

.payoutPotSegment--left.is-over{
    background: var(--c-red);
    color: var(--c-surface);
}

/* A track lends its heading, rows and foot straight to the editor rather
   than boxing them, so the one pot bar stays at the top through both
   tracks. The space that sets a track off goes on its heading instead. */
.payoutTrack{
    display: contents;
}

.payoutTrack[hidden]{
    display: none;
}

.payoutTrack .payoutGrid{
    margin-top: var(--payout-row-gap);
}

.payoutTrackHeader{
    align-items: baseline;
    display: flex;
    flex-wrap: wrap;
    gap: var(--g2);
    margin-top: 24px;
}

.payoutEditor > .payoutTrack:first-child > .payoutTrackHeader{
    margin-top: 0;
}

/* A dollar amount: its prefix and the figure in one box, the decimals
   lined up down the column. */
.payoutField{
    align-items: stretch;
    background: var(--c-surface);
    border: 1px solid var(--c1-n6);
    border-radius: var(--r2);
    box-sizing: border-box;
    display: inline-flex;
    max-width: 100%;
    overflow: hidden;
    width: var(--payout-field-width);
}

.payoutField:focus-within{
    border-color: var(--c2);
    box-shadow: var(--ring);
}

/* In the league builder, a currency field is the standard control height,
   its border included: the box is set rather than the input inside it,
   which stretches to fill it. */
:is(#createLeagueForm, #commishFinancesForm, .prizeSheet) .payoutField{
    height: var(--button-height-standard);
}

.payoutFieldInput{
    appearance: none;
    -webkit-appearance: none;
    background: none;
    border: 0;
    color: var(--c-text-primary);
    flex: 1 1 auto;
    font-family: var(--f2);
    font-size: var(--fs-body);
    font-variant-numeric: tabular-nums;
    min-width: 0;
    outline: none;
    padding: 0 6px 0 10px;
    text-align: right;
    width: 100%;
}

.payoutFieldInput[type="number"]::-webkit-inner-spin-button,
.payoutFieldInput[type="number"]::-webkit-outer-spin-button{
    -webkit-appearance: none;
    margin: 0;
}

.payoutFieldInput[type="number"]{
    -moz-appearance: textfield;
}

.payoutFieldPrefix{
    align-items: center;
    color: var(--c-text-muted);
    display: flex;
    flex: 0 0 auto;
    font-size: var(--fs-small1);
    padding-left: 10px;
    pointer-events: none;
    white-space: nowrap;
}

.payoutField--prefixed .payoutFieldInput{
    padding-left: 4px;
    text-align: left;
}

/* A tier: the places it covers, what each of them wins, and what it comes
   to. A track's rows and their cells are laid straight into the editor's
   columns (see .payoutEditor), so the two tracks line up. */
.payoutGrid{
    align-items: center;
    display: grid;
    grid-template-columns: subgrid;
    row-gap: var(--payout-row-gap);
}

.payoutRows,
.payoutRow{
    display: contents;
}

.payoutRow > *{
    min-height: 0;
}

.payoutRow--columnHeading[hidden]{
    display: none;
}

.payoutRow--columnHeading{
    min-height: 0;
}

.payoutRowLabel{
    color: var(--c-text-primary);
    font-family: var(--ff-body);
    font-size: var(--fs-small2);
    font-weight: var(--fw1);
}

/* What the columns below hold: the places - over a tier's first place and
   the box holding its last - and the dollars each is paid. */
.payoutColumnHeading:first-child{
    grid-column: 1 / span 2;
}

.payoutColumnHeading{
    color: var(--c-text-muted);
    font-size: var(--fs-small3);
    letter-spacing: var(--ls1);
    text-transform: uppercase;
}

/* A tier's last place, typed to change its size - the tier below starts
   from the next place. The last tier's is held to the places paid, and reads
   as fixed. */
.payoutRowPlaces .payoutPlaceEnd{
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: textfield;
    background: var(--c-surface);
    border: 1px solid var(--c1-n6);
    border-radius: var(--r2);
    box-sizing: border-box;
    color: var(--c-text-primary);
    font-family: Verdana, Geneva, Tahoma, sans-serif;
    font-size: var(--fs-small2);
    font-variant-numeric: tabular-nums;
    height: var(--button-height-standard);
    padding: 0 6px;
    text-align: right;
    /* As many digits as the largest place either track pays has, at least
       two - payouts.js sets --digits (syncPlaceEndSizes()) - plus the 6px
       padding and the 1px border either side. */
    width: calc(var(--digits, 2) * 1ch + 14px);
}

.payoutPlaceEnd::-webkit-inner-spin-button,
.payoutPlaceEnd::-webkit-outer-spin-button{
    -webkit-appearance: none;
    margin: 0;
}

.payoutPlaceEnd:focus{
    border-color: var(--c2);
    box-shadow: var(--ring);
    outline: none;
}

/* The last tier's box, held to the places paid, gives way to its number
   alone, in the ordinary ink: nothing to type in, so nothing drawn round it.
   The border is kept, transparent, so the number sits where the other
   boxes' numbers do. */
.payoutPlaceEnd[readonly]{
    background: none;
    border-color: transparent;
    color: var(--c-text-primary);
    cursor: default;
}

.payoutPlaceEnd[readonly]:focus{
    border-color: transparent;
    box-shadow: none;
}

/* A tier's first place and the box holding its last, each in its own
   column: the first place set to the right of its fixed column, against the
   box. */
.payoutRowPlaces{
    display: contents;
}

.payoutRowOrdinal{
    /* Each row starts in the first column; the editor's last column, there
       to take what is left, holds nothing. */
    grid-column: 1;
    /* As wide as the longest first place either track could show: a tier
       can start as late as the larger Pay the top count, whose characters,
       its thousands comma counted, payouts.js sets as --payout-ordinal-digits
       (syncPlaceEndSizes()). A
       digit is at most 1ch in this font, and the widest ending, "nd –",
       about 2.4em. A fixed tier's "1st–3rd" widens the column as it must. */
    min-width: calc(var(--payout-ordinal-digits, 1) * 1ch + 2.4em);
    text-align: right;
    white-space: nowrap;
}

.payoutRowDetail{
    color: var(--c1-n8);
    font-size: var(--fs-small1);
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* The foot - status and Reset - runs the width of the track. */
.payoutTrackFoot{
    align-items: center;
    display: flex;
    gap: 14px;
    grid-column: 1 / -1;
    padding-top: 6px;
}

/* "+ Add tier", gone while a curve sets the tiers. */
.payoutTrackFoot > [hidden]{
    display: none;
}

/* Start from and the Pool split: a name, then what it sets, on one line. */
/* Their names, and a track's Amounts or Split, in the size of the Pay the
   top line, under the tracks' own names. */
.payoutOptionLabel{
    font-size: var(--fs-small2);
}

.payoutOptionRow{
    align-items: center;
    margin-bottom: var(--g3);
}

.payoutOptionRow.modalInputSentence{
    align-items: baseline;
}

.payoutOptionRow[hidden]{
    display: none;
}

/* Reset, after the templates once the chosen one is modified, set off by a
   middle dot. */
.payoutTemplateReset{
    display: inline-flex;
    align-items: center;
    gap: var(--g1);
    font-size: var(--fs-small2);
}

.payoutTemplateReset[hidden]{
    display: none;
}

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

.payoutTemplateReset > .btn-text{
    margin-left: 0;
    padding: 0;
    background: none;
    cursor: pointer;
    font-family: inherit;
}

.payoutTemplateReset > .btn-text:hover{
    text-decoration: underline;
}

/* The modified template's tooltip, "Modified from Balanced", above it in the
   quick action tooltips' style (main.css), its fill from .tooltipFillHost. */
.payoutOptionRow .segment[data-tooltip]{
    position: relative;
    overflow: visible;
}

.payoutOptionRow .segment[data-tooltip]::after,
.payoutOptionRow .segment[data-tooltip]::before{
    opacity: 0;
    pointer-events: none;
    position: absolute;
    left: 50%;
    z-index: 200;
    transition: opacity 120ms linear;
}

.payoutOptionRow .segment[data-tooltip]::after{
    content: attr(data-tooltip);
    bottom: calc(100% + 7px);
    transform: translateX(-50%);
    width: max-content;
    max-width: 210px;
    padding: 6px 9px;
    border-radius: var(--r2);
    color: var(--c-surface);
    box-shadow: var(--shadow-tooltip);
    font-size: 0.7rem;
    font-weight: var(--fw1);
    line-height: 1.3;
    text-align: center;
    white-space: normal;
}

.payoutOptionRow .segment[data-tooltip]::before{
    content: "";
    bottom: calc(100% + 3px);
    width: 8px;
    height: 8px;
    transform: translateX(-50%) rotate(45deg);
}

.payoutOptionRow .segment[data-tooltip]:hover::after,
.payoutOptionRow .segment[data-tooltip]:hover::before,
.payoutOptionRow .segment[data-tooltip]:focus-visible::after,
.payoutOptionRow .segment[data-tooltip]:focus-visible::before{
    opacity: 1;
    transition: none;
}

@media (prefers-reduced-motion: reduce) {
    .payoutOptionRow .segment[data-tooltip]::after,
    .payoutOptionRow .segment[data-tooltip]::before{
        transition: none;
    }
}

/* The Pool split's shares and a scaling rule's numbers: boxes as wide as
   the longest each takes - "33.3", "8,000" - in the field's own ch (see
   .modalInput--digits). */
.payoutSplitInput,
.payoutScaleInput{
    --digits: 4;
}

/* A track's controls over its rows: its scaling rule while it scales, its
   mode, and the season's minimum payout. */
.payoutTrackControls{
    display: flex;
    flex-direction: column;
    gap: var(--g2);
    margin-top: var(--g2);
}

/* Scale with entries, after "finishers" on the Pay the top line. */
.modalInputSentence > .payoutScaleToggle{
    align-self: center;
    margin-left: var(--g2);
    white-space: nowrap;
}

.payoutScaleRule[hidden],
.payoutMinPayout[hidden]{
    display: none;
}

.payoutScaleDot,
.payoutScaleResult{
    color: var(--c-text-muted);
}

/* While a track scales, its count shows what the rule comes to: a number,
   not a box to type in, as a fixed tier end is. */
.modalInput.is-scaled,
:is(#createLeagueForm, #commishFinancesForm, .prizeSheet) .modalInput.is-scaled{
    background: none;
    border-color: transparent;
    box-shadow: none;
    cursor: default;
}

.payoutModeRow{
    align-items: center;
}

.payoutMinPayout{
    display: flex;
    flex-direction: column;
    gap: var(--g1);
}

/* The mode's segments, and the curve menu Curve opens under them, at
   their right. */
.payoutCurvePicker{
    display: inline-flex;
    position: relative;
}

.payoutCurveButton{
    align-items: center;
    display: inline-flex;
    gap: 6px;
}

.payoutCurveButtonSpark{
    display: inline-flex;
}

.payoutCurveButtonSpark:empty{
    display: none;
}

.payoutCurveCaret{
    font-size: 0.85em;
    transition: transform 160ms ease;
}

.payoutCurveButton[aria-expanded="true"] .payoutCurveCaret{
    transform: rotate(180deg);
}

@media (prefers-reduced-motion: reduce) {
    .payoutCurveCaret{
        transition: none;
    }
}

.payoutCurveMenu{
    background: var(--c-surface);
    border: 1px solid var(--c1-n6);
    border-radius: var(--r2);
    box-shadow: var(--shadow-dropdown);
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    min-width: 100%;
    overflow: hidden;
    position: absolute;
    right: 0;
    top: calc(100% + 4px);
    z-index: 10;
}

.payoutCurveMenu[hidden]{
    display: none;
}

.payoutCurveOption{
    align-items: center;
    appearance: none;
    -webkit-appearance: none;
    background: transparent;
    border: 0;
    color: var(--c-text-primary);
    cursor: pointer;
    display: flex;
    font-family: var(--ff-body);
    font-size: var(--fs-small1);
    gap: 10px;
    padding: 8px 12px;
    text-align: left;
    white-space: nowrap;
}

.payoutCurveOption:hover,
.payoutCurveOption:focus-visible{
    background: var(--c1-n2);
    outline: none;
}

.payoutCurveOption[aria-checked="true"]{
    background: var(--c1-n4);
    font-weight: var(--fw3);
}

/* A curve's shape: its first places' shares, falling from the left. */
.payoutSparkline{
    fill: none;
    flex: 0 0 auto;
    height: 12px;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.5;
    width: 30px;
}

/* A share: the figure, then its %. */
.payoutField--suffixed .payoutFieldInput{
    padding-right: 4px;
}

.payoutFieldSuffix{
    align-items: center;
    color: var(--c-text-muted);
    display: flex;
    flex: 0 0 auto;
    font-size: var(--fs-small1);
    padding-right: 10px;
    pointer-events: none;
}

/* A curve's shares, worked out rather than typed: shown on the panel's
   own ground, with no box drawn round them until one is typed in. */
.payoutField.is-computed{
    background: var(--c1-n3);
    border-color: transparent;
}

.payoutField.is-computed .payoutFieldInput{
    color: var(--c-text-muted);
}

/* What is allocated, what is left, or what is over - said, not corrected. */
.payoutStatusLine{
    font-size: var(--fs-small1);
}

.payoutStatusLine.is-under,
.payoutStatusLine.is-over{
    color: var(--c-amber, #b8770a);
    font-weight: var(--fw3);
}

.payoutStatusLine.is-over{
    color: var(--c-red);
}

@media (max-width: 640px) {
    /* One column, so the shared grid gives way to a stack. */
    .payoutEditor{
        --payout-label-width: 100%;
        --payout-field-width: 100%;
        display: flex;
        flex-direction: column;
    }

    .payoutTrackHeader{
        gap: 2px;
    }

    /* Each row its own small grid again, stacked, rather than cells in one
       grid for the track. */
    .payoutGrid,
    .payoutRows{
        align-items: stretch;
        display: flex;
        flex-direction: column;
        gap: var(--payout-row-gap);
    }

    .payoutRow{
        align-items: center;
        display: grid;
        gap: var(--payout-column-gap);
        grid-template-columns: minmax(0, 1fr);
        grid-template-areas:
            "label"
            "input"
            "detail";
        row-gap: 4px;
    }

    .payoutRowLabel{ grid-area: label; }

    /* A tier's first place and its last-place box share the label line. */
    .payoutRowPlaces{
        align-items: center;
        display: flex;
        gap: var(--g1);
        justify-content: flex-end;
    }

    .payoutField,
    .payoutColumnHeading{ grid-area: input; }

    /* The Places heading stays over the places, above the amounts heading. */
    .payoutColumnHeading:first-child{ grid-area: label; }

    .payoutRowDetail{ grid-area: detail; white-space: normal; }
}

/* ── Settings, General: league type order ───────────────────────────────── */

/* The formats as a list the member drags into the order their My Leagues
   menus use - see pcf_league_type_order_control_html() and
   assets/js/league-type-order.js. */
.leagueTypeOrderList{
    display: flex;
    flex-direction: column;
    gap: var(--g1);
    margin: 10px 0 0;
    padding: 0;
    list-style: none;
}

/* touch-action: none, so a finger on a row drags it rather than scrolling
   the modal. */
.leagueTypeOrderItem{
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border: 1px solid var(--c1-n7);
    border-radius: var(--r2);
    background: var(--c-surface);
    color: var(--c-text-primary);
    font-size: var(--fs-small1);
    font-weight: var(--fw3);
    cursor: grab;
    touch-action: none;
    user-select: none;
}

.leagueTypeOrderItem:focus-visible{
    outline: 2px solid var(--c2);
    outline-offset: 1px;
}

.leagueTypeOrderList.is-sorting,
.leagueTypeOrderList.is-sorting .leagueTypeOrderItem{
    cursor: grabbing;
}

.leagueTypeOrderItem.is-dragging{
    background: var(--c1-n2);
    border-color: var(--c2);
    box-shadow: var(--shadow-dragging);
}

.leagueTypeOrderGrip{
    flex: 0 0 auto;
    color: rgba(23,33,54,.4);
}

/* The rows' motion - see assets/js/league-type-order.js. Each is drawn
   --shift-y from its place: the dragged row by however far the pointer has
   taken it, the rest by a row while they make room for it. While the list
   is-animating they slide there rather than jump, ease-out, as they do to
   their new places once it is let go; the dragged row itself follows the
   pointer directly. Picked up, it lifts on a shadow, and settles off it. */
.leagueTypeOrderItem{
    position: relative;
    transform: translateY(var(--shift-y, 0px));
    transition:
        background-color 180ms ease-out,
        border-color 180ms ease-out,
        box-shadow 180ms ease-out;
}

.leagueTypeOrderList.is-animating .leagueTypeOrderItem{
    transition:
        transform 180ms ease-out,
        background-color 180ms ease-out,
        border-color 180ms ease-out,
        box-shadow 180ms ease-out;
}

.leagueTypeOrderList.is-animating .leagueTypeOrderItem.is-dragging{
    transition:
        background-color 180ms ease-out,
        border-color 180ms ease-out,
        box-shadow 180ms ease-out;
    z-index: 1;
}

@media (prefers-reduced-motion: reduce) {
    .leagueTypeOrderItem,
    .leagueTypeOrderList.is-animating .leagueTypeOrderItem{
        transition: none;
    }
}

/* Settings, League order: each format a group, one bordered box holding its
   header and its leagues - see $withLeagues in
   pcf_league_type_order_control_html(). The header is bold on a tint, with
   its own grip, and the leagues under it are lighter, indented rows ruled
   off by hairlines rather than boxes of their own, so the two levels never
   read as peers. Only the grips drag: the rest of a row takes no drag. */
.leagueTypeOrderList--groups > .leagueTypeOrderItem{
    display: block;
    padding: 0;
    cursor: auto;
    touch-action: auto;
}

.leagueTypeOrderHeader{
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: calc(var(--r2) - 1px) calc(var(--r2) - 1px) 0 0;
    background: var(--c1-n3);
}

/* A format with no leagues, or folded, is its header alone. */
.leagueTypeOrderItem:not(:has(.leagueOrderFold)) > .leagueTypeOrderHeader,
.leagueTypeOrderList.is-folded .leagueTypeOrderHeader{
    border-radius: calc(var(--r2) - 1px);
}

.leagueTypeOrderHeader:focus-visible,
.leagueOrderItem:focus-visible{
    outline: 2px solid var(--c2);
    outline-offset: -2px;
}

.leagueTypeOrderList--groups .leagueTypeOrderGrip{
    cursor: grab;
    touch-action: none;
}

.leagueTypeOrderList--groups.is-sorting .leagueTypeOrderGrip,
.leagueOrderList.is-sorting .leagueTypeOrderGrip{
    cursor: grabbing;
}

.leagueOrderList{
    margin: 0;
    padding: 0;
    list-style: none;
}

.leagueOrderItem{
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 12px 7px 32px;
    border-top: 1px solid var(--c1-n6);
    font-weight: var(--fw1);
    user-select: none;
    position: relative;
    transform: translateY(var(--shift-y, 0px));
    transition: background-color 180ms ease-out, box-shadow 180ms ease-out;
}

.leagueOrderList.is-animating .leagueOrderItem{
    transition: transform 180ms ease-out, background-color 180ms ease-out, box-shadow 180ms ease-out;
}

.leagueOrderItem.is-dragging{
    background: var(--c1-n2);
    box-shadow: var(--shadow-dragging);
    z-index: 1;
}

.leagueOrderList.is-animating .leagueOrderItem.is-dragging{
    transition: background-color 180ms ease-out, box-shadow 180ms ease-out;
}

/* A format's leagues fold away under its header while a format is dragged,
   and open again once it is let go, the header saying meanwhile how many it
   holds - see assets/js/league-type-order.js. */
.leagueOrderFold{
    display: grid;
    grid-template-rows: 1fr;
    transition: grid-template-rows 180ms ease-out;
}

.leagueOrderFold > .leagueOrderList{
    min-height: 0;
    overflow: hidden;
}

.leagueTypeOrderList.is-folded .leagueOrderFold{
    grid-template-rows: 0fr;
}

.leagueTypeOrderCount{
    display: none;
    color: var(--c-text-muted);
    font-weight: var(--fw1);
}

.leagueTypeOrderList.is-folded .leagueTypeOrderCount{
    display: inline;
}

@media (prefers-reduced-motion: reduce) {
    .leagueOrderItem,
    .leagueOrderList.is-animating .leagueOrderItem,
    .leagueOrderFold{
        transition: none;
    }
}

/* Settings, League order sorted by a measure: the member's leagues in that
   order, which there is nothing to drag in - one box ruled into rows, as a
   group's leagues are under its header. */
.leagueSortList{
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    list-style: none;
    border: 1px solid var(--c1-n7);
    border-radius: var(--r2);
    background: var(--c-surface);
    color: var(--c-text-primary);
    font-size: var(--fs-small1);
}

.leagueSortItem{
    padding: 7px 12px;
}

.leagueSortItem + .leagueSortItem{
    border-top: 1px solid var(--c1-n6);
}

/* Where a moved row's new position is announced to a screen reader. */
.leagueTypeOrderStatus{
    border: 0;
    clip-path: inset(50%);
    height: 1px;
    overflow: hidden;
    padding: 0;
    position: absolute;
    white-space: nowrap;
    width: 1px;
}
