/* ============================================================
   Live draft stage (/league/draft). Built on the --scu-* theme
   tokens; the draft's own colours are tuned per theme below.
   ============================================================ */

:root {
    /* The SOLD stamp and winning tile: brass against the red theme */
    --ld-sold:        #e0b04a;
    --ld-sold-glow:   rgba(224, 176, 74, 0.30);
    --ld-locked:      #5fbf86;
    --ld-win:         #4fbf7a;
    --ld-loss:        #c84545;
    --ld-race-p:      #d4a800;
    --ld-race-t:      #3b82d6;
    --ld-race-z:      #b8322a;
    --ld-race-r:      #7a5cc4;
    --ld-muted:       var(--scu-text-muted);
    /* Text on a solid accent fill: white reads on the red */
    --ld-on-accent:   #fff;
    /* The sold screen's cover: near-black with the theme's warmth, lit by a red ember */
    --ld-scrim:       rgba(14, 5, 5, 0.9);
    --ld-spotlight:   rgba(200, 40, 40, 0.28);
    /* Notable-win cards over a game still: a warm black scrim and a solid red tag */
    --ld-shot-scrim:      rgba(12, 4, 4, 0.92);
    --ld-shot-scrim-soft: rgba(12, 4, 4, 0.55);
    --ld-shot-text:       #fff;
    --ld-shot-text-muted: rgba(255, 228, 220, 0.78);
    --ld-shot-tag-bg:     rgba(190, 30, 30, 0.92);
}

[data-theme="cyan"] {
    /* Warm amber reads as "money" against cyan without borrowing the red theme's brass */
    --ld-sold:        #ffcf5c;
    --ld-sold-glow:   rgba(255, 207, 92, 0.26);
    --ld-locked:      #3ee6a8;
    --ld-win:         #3ee6a8;
    --ld-loss:        #ff5d73;
    --ld-race-p:      #e8bd2c;
    --ld-race-t:      #4f9cf0;
    --ld-race-z:      #e0524a;
    --ld-race-r:      #9b7cf0;
    /* The cyan theme's muted text is too dark for small labels on the stage */
    --ld-muted:       #6a8a9a;
    /* Bright cyan needs dark text */
    --ld-on-accent:   #03161c;
    /* Deep teal-black, lit from behind in cyan */
    --ld-scrim:       rgba(2, 13, 18, 0.92);
    --ld-spotlight:   rgba(0, 200, 230, 0.22);
    /* Teal-black scrim and a cyan tag, which takes the dark on-accent text */
    --ld-shot-scrim:      rgba(2, 12, 17, 0.92);
    --ld-shot-scrim-soft: rgba(2, 12, 17, 0.55);
    --ld-shot-text:       #eafcff;
    --ld-shot-text-muted: rgba(190, 232, 242, 0.8);
    --ld-shot-tag-bg:     rgba(0, 200, 230, 0.9);
}

.stage-layout {
    min-height: 100vh;
    background: var(--scu-bg);
    color: var(--scu-text);
    font-family: var(--scu-font-body);
}

.ld-empty {
    max-width: 36rem;
    margin: 18vh auto 0;
    padding: 0 1rem;
    text-align: center;
    color: var(--ld-muted);
}

.ld-empty h1 {
    font-family: var(--scu-font-display);
    color: var(--scu-text-bright);
    font-size: 1.6rem;
}

/* ---- Frame ---- */

.ld-stage {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Header, rehearsal note, docks and ticker take what they need; the stage takes the rest */
.ld-stage > * {
    min-width: 0;
}

.ld-stage > .ld-main {
    flex: 1;
}

.ld-top {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    padding: 0.7rem 1.5rem;
    border-bottom: 1px solid var(--scu-border-bright);
    background: var(--scu-bg-panel);
    flex-wrap: wrap;
}

.ld-home {
    font-family: var(--scu-font-display);
    font-weight: 900;
    font-size: 0.95rem;
    color: var(--scu-red);
    text-decoration: none;
}

.ld-title {
    display: flex;
    align-items: baseline;
    gap: 0.85rem;
    flex-wrap: wrap;
}

.ld-title h1 {
    font-family: var(--scu-font-display);
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--scu-text-bright);
    margin: 0;
}

.ld-round {
    font-family: var(--scu-font-display);
    font-size: 0.9rem;
    color: var(--scu-red);
}

.ld-paused {
    padding: 0.1rem 0.55rem;
    border: 1px solid var(--scu-warning);
    border-radius: 3px;
    color: var(--scu-warning);
    font-size: 0.75rem;
    font-weight: 600;
}

.ld-rotation {
    display: flex;
    gap: 0.45rem;
    margin: 0 0 0 auto;
    padding: 0;
    list-style: none;
}

.ld-rotation li {
    border: 1px solid transparent;
    border-radius: 4px;
    padding: 2px;
    transition: opacity var(--scu-transition), border-color var(--scu-transition);
}

.ld-rotation li.is-up {
    border-color: var(--scu-red);
    box-shadow: 0 0 12px var(--scu-red-glow-lg);
}

.ld-rotation li.is-out {
    opacity: 0.35;
    filter: grayscale(1);
}

.ld-sound {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.3rem 0.65rem;
    border: 1px solid var(--scu-border-bright);
    border-radius: 4px;
    background: transparent;
    color: var(--ld-muted);
    font-size: 0.8rem;
    font-weight: 600;
    transition: color var(--scu-transition), border-color var(--scu-transition);
    /* Pushed right on its own; beside the rotation strip when there is one */
    margin-left: auto;
}

.ld-rotation + .ld-sound {
    margin-left: 0;
}

.ld-sound svg {
    width: 1rem;
    height: 1rem;
}

.ld-sound:hover:not(:disabled),
.ld-sound.is-on {
    color: var(--scu-text-bright);
    border-color: var(--scu-red);
}

.ld-sound:focus-visible {
    outline: 2px solid var(--scu-red);
    outline-offset: 2px;
}

.ld-sound:disabled {
    opacity: 0.5;
}

.ld-rehearsal {
    padding: 0.5rem 1.5rem;
    border-bottom: 1px solid var(--scu-warning);
    background: repeating-linear-gradient(-45deg,
        color-mix(in srgb, var(--scu-warning) 14%, transparent) 0 14px,
        color-mix(in srgb, var(--scu-warning) 6%, transparent) 14px 28px);
    color: var(--scu-text-bright);
    font-size: 0.9rem;
}

.ld-rehearsal strong {
    color: var(--scu-warning);
}

.ld-main {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 260px;
    gap: 1.25rem;
    padding: 1.25rem 1.5rem;
    align-items: start;
}

.ld-center {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

/* ---- Team marks ---- */

.ld-team-mark {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
}

.ld-team-mark img,
.ld-team-initials {
    width: 28px;
    height: 28px;
    border-radius: 4px;
    object-fit: cover;
    flex-shrink: 0;
}

.ld-team-initials {
    display: inline-grid;
    place-items: center;
    background: var(--scu-bg-elevated);
    border: 1px solid var(--scu-border-bright);
    font-family: var(--scu-font-display);
    font-size: 0.6rem;
    font-weight: 700;
    color: var(--scu-text-bright);
}

.ld-team-name {
    font-weight: 600;
    color: var(--scu-text-bright);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ld-team-mark--large {
    flex-direction: column;
    gap: 0.75rem;
}

.ld-team-mark--large img,
.ld-team-mark--large .ld-team-initials {
    width: 112px;
    height: 112px;
    border-radius: 10px;
    font-size: 2rem;
}

.ld-team-mark--large .ld-team-name {
    font-family: var(--scu-font-display);
    font-size: clamp(1.4rem, 3vw, 2.2rem);
    font-weight: 900;
    white-space: normal;
    text-align: center;
}

/* ---- Holding screens ---- */

.ld-hold,
.ld-clock-stage {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.75rem;
    padding: 4rem 1rem;
    border: 1px solid var(--scu-border);
    border-radius: 8px;
    background:
        radial-gradient(ellipse at 50% 0%, var(--scu-red-glow-md), transparent 70%),
        var(--scu-bg-panel);
}

/* Before the draft starts and while a team proposes: no card, the scene floats in the middle of the stage */
.ld-center:has(> .ld-hold--starting),
.ld-center:has(> .ld-clock-stage) {
    align-self: stretch;
    justify-content: center;
}

.ld-hold.ld-hold--starting,
.ld-clock-stage {
    border: 0;
    background: none;
}

/* The proposing team's logo grows with the screen: 112px on small ones, up to 220px when there's room */
.ld-clock-stage .ld-team-mark--large img,
.ld-clock-stage .ld-team-mark--large .ld-team-initials {
    width: clamp(112px, 22vh, 220px);
    height: clamp(112px, 22vh, 220px);
    border-radius: 14px;
    font-size: clamp(2rem, 6vh, 4rem);
}

.ld-hold-logo {
    /* As big as the stage allows: up to the image's own 500px, short enough to leave room for the text */
    width: min(500px, 80%, 45vh);
    height: auto;
    margin-bottom: 0.5rem;
}

.ld-hold-title {
    font-family: var(--scu-font-display);
    font-size: clamp(1.8rem, 4vw, 3rem);
    font-weight: 900;
    color: var(--scu-text-bright);
    margin: 0;
}

.ld-hold p {
    max-width: 38rem;
    margin: 0;
}

.ld-hold-note {
    color: var(--ld-muted);
    font-size: 0.9rem;
}

.ld-clock-caption {
    font-size: 1.05rem;
    color: var(--scu-text);
    margin: 0;
}

/* ---- Clock ---- */

.ld-clock {
    --ld-size: 64px;
    position: relative;
    width: var(--ld-size);
    height: var(--ld-size);
    flex-shrink: 0;
}

.ld-clock--large {
    --ld-size: 116px;
}

.ld-clock svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.ld-clock-track,
.ld-clock-arc {
    fill: none;
    stroke-width: 6;
}

.ld-clock-track {
    stroke: var(--scu-border-bright);
}

.ld-clock-arc {
    stroke: var(--scu-red);
    stroke-linecap: round;
    stroke-dasharray: 1;
    stroke-dashoffset: calc(1 - var(--ld-left, 1));
}

.ld-clock-value {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    font-family: var(--scu-font-display);
    font-weight: 700;
    font-size: calc(var(--ld-size) * 0.34);
    color: var(--scu-text-bright);
    font-variant-numeric: tabular-nums;
}

.ld-clock--urgent .ld-clock-arc {
    stroke: var(--scu-danger);
}

.ld-clock--urgent .ld-clock-value {
    color: var(--scu-danger);
    animation: ld-pulse 1s ease-in-out infinite;
}

.ld-clock--paused .ld-clock-arc {
    stroke: var(--scu-warning);
}

@keyframes ld-pulse {
    50% { transform: scale(1.12); }
}

/* ---- Reveal banner ---- */

.ld-reveal {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.ld-race-p { --ld-race: var(--ld-race-p); }
.ld-race-t { --ld-race: var(--ld-race-t); }
.ld-race-z { --ld-race: var(--ld-race-z); }
.ld-race-r { --ld-race: var(--ld-race-r); }

/* A compact header: the race colour as a faint light behind the avatar, name and clock */
.ld-reveal-head {
    position: relative;
    display: flex;
    align-items: center;
    gap: 1.25rem;
    padding: 1rem 1.25rem;
    overflow: hidden;
    border: 1px solid var(--scu-border-bright);
    border-left: 3px solid var(--ld-race);
    border-radius: 8px;
    background: var(--scu-bg-panel);
}

.ld-reveal-backdrop {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        radial-gradient(ellipse at 0% 50%, color-mix(in srgb, var(--ld-race) 26%, transparent), transparent 55%),
        repeating-linear-gradient(90deg, transparent 0 46px, color-mix(in srgb, var(--ld-race) 7%, transparent) 46px 47px);
}

.ld-avatar {
    position: relative;
    flex-shrink: 0;
    width: 84px;
    height: 84px;
    border-radius: 50%;
    overflow: hidden;
    display: grid;
    place-items: center;
    background: color-mix(in srgb, var(--ld-race) 22%, var(--scu-bg-elevated));
    box-shadow: 0 0 0 2px var(--ld-race), 0 0 18px color-mix(in srgb, var(--ld-race) 40%, transparent);
    animation: ld-appear 0.4s ease-out both;
}

.ld-avatar-initials {
    font-family: var(--scu-font-display);
    font-size: 1.7rem;
    font-weight: 900;
    color: var(--scu-text-bright);
}

.ld-avatar img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}


.ld-reveal-id {
    position: relative;
    flex: 1;
    min-width: 0;
}

.ld-reveal-clock {
    position: relative;
    flex-shrink: 0;
    margin-left: auto;
}

.ld-reveal-clock .ld-clock--large {
    --ld-size: 92px;
}

@media (max-width: 640px) {
    .ld-reveal-head {
        flex-wrap: wrap;
        gap: 0.9rem;
        padding: 0.85rem;
    }

    .ld-avatar {
        width: 60px;
        height: 60px;
    }

    .ld-avatar-initials {
        font-size: 1.2rem;
    }
}

.ld-reveal-tags {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.35rem;
}

.ld-reveal-tags .race-badge {
    font-size: 0.7rem;
}

.ld-pill {
    padding: 0.12rem 0.55rem;
    border-radius: 3px;
    background: rgba(0, 0, 0, 0.45);
    border: 1px solid var(--scu-border-bright);
    color: var(--scu-text-bright);
    font-size: 0.8rem;
    font-weight: 600;
}

.ld-pill--quiet {
    color: var(--scu-text);
    font-weight: 400;
}

.ld-reveal-name {
    font-family: var(--scu-font-display);
    font-size: clamp(1.8rem, 4vw, 3.25rem);
    font-weight: 900;
    line-height: 1.05;
    color: var(--scu-text-bright);
    margin: 0;
    overflow-wrap: anywhere;
    text-shadow: 0 0 28px var(--scu-red-glow-lg), 0 2px 0 rgba(0, 0, 0, 0.6);
    animation: ld-slam 0.75s cubic-bezier(0.2, 0.9, 0.25, 1.15) both;
}

@keyframes ld-slam {
    from {
        opacity: 0;
        transform: translateY(0.25em) scale(1.1);
        letter-spacing: 0.25em;
        filter: blur(6px);
    }
    to {
        opacity: 1;
        transform: none;
        letter-spacing: 0.01em;
        filter: none;
    }
}

.ld-rookie-line {
    margin: 0.3rem 0 0;
    font-size: 0.92rem;
    color: var(--scu-text);
}

.ld-reveal-loading {
    color: var(--ld-muted);
    padding: 0.5rem 0.25rem;
}

/* ---- Reveal body ---- */

.ld-reveal-body {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 1.4rem;
    align-items: start;
}

.ld-reveal-main {
    display: flex;
    flex-direction: column;
    gap: 1.4rem;
    min-width: 0;
}

/* Wide screens: the player's history gets its own column beside the record */
@media (min-width: 1400px) {
    .ld-reveal-body {
        grid-template-columns: minmax(0, 1fr) minmax(260px, 340px);
    }

    .ld-reveal-body .ld-history {
        grid-template-columns: minmax(0, 1fr);
        padding-left: 1.4rem;
        border-left: 1px solid var(--scu-border);
    }
}

.ld-section-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--ld-muted);
    margin: 0 0 0.6rem;
}

.ld-statline {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem 2.25rem;
}

/* Which record the stat row is showing: league, tournament, total. The current one is lit in
   the theme's accent; the rest stay muted. One kind of history shows a single, lit label. */
.ld-record-steps {
    display: flex;
    gap: 0.9rem;
    margin-bottom: -0.8rem;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ld-muted);
}

.ld-record-step {
    padding-bottom: 0.2rem;
    border-bottom: 2px solid transparent;
    transition: color 0.3s ease, border-color 0.3s ease;
}

.ld-record-step.is-current {
    color: var(--scu-text-bright);
    border-bottom-color: var(--scu-red);
}

/* Each record slides in as the row turns over */
.ld-record {
    animation: ld-record-in 0.45s ease both;
}

@keyframes ld-record-in {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

.ld-stat {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.ld-stat-value {
    font-family: var(--scu-font-display);
    font-size: 1.45rem;
    font-weight: 700;
    color: var(--scu-text-bright);
    font-variant-numeric: tabular-nums;
}

.ld-stat-label {
    font-size: 0.78rem;
    color: var(--ld-muted);
}

.ld-form {
    display: inline-flex;
    gap: 3px;
    height: 1.9rem;
    align-items: center;
}

.ld-form-pip {
    display: inline-grid;
    place-items: center;
    width: 1.35rem;
    height: 1.35rem;
    border-radius: 3px;
    font-family: var(--scu-font-display);
    font-size: 0.6rem;
    font-weight: 700;
    color: #fff;
}

.ld-form-pip--w { background: var(--ld-win); color: #04140b; }
.ld-form-pip--l { background: var(--ld-loss); }

.ld-scouting p {
    color: var(--ld-muted);
    margin: 0 0 0.75rem;
}

/* Notable wins: a carousel of league wins over their game stills. --ld-n (how many) and
   --ld-tick (pages turned so far) come from the component; how many fit decides --ld-per-page,
   and from those CSS picks the page to show. Where mod()/round() aren't supported the transform
   is dropped and the first page simply stays up. */

.ld-wins {
    container-type: inline-size;
}

.ld-wins-viewport {
    --ld-gap: 0.6rem;
    --ld-per-page: 1;
    --ld-pages: round(up, calc(var(--ld-n) / var(--ld-per-page)), 1);
    --ld-page: mod(var(--ld-tick), var(--ld-pages));
    overflow: hidden;
    border-radius: 6px;
}

@container (min-width: 560px) {
    .ld-wins-viewport { --ld-per-page: 2; }
}

@container (min-width: 1080px) {
    .ld-wins-viewport { --ld-per-page: 3; }
}

.ld-wins-track {
    display: flex;
    gap: var(--ld-gap);
    transform: translateX(calc(var(--ld-page) * -1 * (100% + var(--ld-gap))));
    transition: transform 1.1s cubic-bezier(0.65, 0, 0.25, 1);
}

.ld-win {
    position: relative;
    flex: 0 0 calc((100% - (var(--ld-per-page) - 1) * var(--ld-gap)) / var(--ld-per-page));
    display: flex;
    align-items: flex-end;
    /* Big enough to read the game, small enough that the whole file fits on one screen */
    height: clamp(130px, 19vh, 190px);
    overflow: hidden;
    border: 1px solid var(--scu-border-bright);
    border-radius: 6px;
    background: var(--scu-bg-card);
    min-width: 0;
}

.ld-win--bare {
    align-items: center;
}

/* The still drifts slowly across the card; each card starts at a different point in the drift */
.ld-win-shot {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scale(1.18) translate(-6%, -4%);
    animation: ld-shot-pan 32s ease-in-out infinite alternate;
    animation-delay: calc(var(--ld-i, 0) * -7s);
}

@keyframes ld-shot-pan {
    from { transform: scale(1.18) translate(-6%, -4%); }
    to   { transform: scale(1.18) translate(6%, 4%); }
}

/* Darkens the bottom-left, where the score sits, and leaves the rest of the game clear */
.ld-win:not(.ld-win--bare)::after {
    content: "";
    position: absolute;
    inset: 0;
    background:
        linear-gradient(to top, var(--ld-shot-scrim) 0%, var(--ld-shot-scrim-soft) 45%, transparent 75%),
        linear-gradient(to right, var(--ld-shot-scrim-soft), transparent 60%);
    pointer-events: none;
}

.ld-win-text {
    position: relative;
    z-index: 1;
    min-width: 0;
    padding: 0.6rem 0.75rem;
}

.ld-win:not(.ld-win--bare) .ld-win-score,
.ld-win:not(.ld-win--bare) .ld-win-score span {
    color: var(--ld-shot-text);
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}

.ld-win:not(.ld-win--bare) .ld-win-context {
    color: var(--ld-shot-text-muted);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

/* Tournament wins: no stills, so a compact row of their own */

.ld-twins-row {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr));
    gap: 0.5rem;
}

.ld-twin {
    padding: 0.45rem 0.65rem;
    border: 1px solid var(--scu-border);
    border-left: 2px solid var(--ld-sold);
    border-radius: 4px;
    background: var(--scu-bg-card);
    min-width: 0;
}

.ld-twin .ld-win-score {
    font-size: 0.95rem;
}

.ld-twin .ld-win-tags {
    margin: 0.15rem 0;
}

.ld-win-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    margin: 0.2rem 0;
}

.ld-win-tag {
    padding: 0.05rem 0.4rem;
    border-radius: 2px;
    background: var(--scu-red-glow-md);
    color: var(--scu-red);
    font-size: 0.7rem;
    font-weight: 600;
}

/* Over a still the tag needs a solid fill to stay legible */
.ld-win:not(.ld-win--bare) .ld-win-tag {
    background: var(--ld-shot-tag-bg);
    color: var(--ld-on-accent);
}

.ld-win-score {
    font-family: var(--scu-font-display);
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--scu-text-bright);
}

.ld-win-score span {
    font-family: var(--scu-font-body);
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--scu-text);
}

.ld-win-context {
    font-size: 0.78rem;
    color: var(--ld-muted);
}

/* Fun facts: dealt in one at a time while captains bid */

.ld-facts {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 0.75rem;
}

.ld-fact {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    padding: 0.8rem 0.9rem;
    border: 1px solid var(--scu-border-bright);
    border-left: 3px solid var(--ld-sold);
    border-radius: 4px;
    background: var(--scu-bg-card);
    opacity: 0;
    animation: ld-deal 0.5s ease-out forwards;
    animation-delay: calc(var(--ld-i) * 1.4s + 0.9s);
}

@keyframes ld-deal {
    from {
        opacity: 0;
        transform: translateY(14px) rotate(-1.5deg);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

.ld-fact-icon {
    width: 36px;
    height: 36px;
    object-fit: contain;
    flex-shrink: 0;
}

.ld-fact-kicker {
    font-family: var(--scu-font-display);
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    color: var(--ld-sold);
    margin-bottom: 0.2rem;
}

.ld-fact-headline {
    font-weight: 600;
    color: var(--scu-text-bright);
    line-height: 1.3;
}

.ld-fact-detail {
    font-size: 0.8rem;
    color: var(--ld-muted);
    margin-top: 0.15rem;
}

/* History */

.ld-history {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.25rem;
}

.ld-stints,
.ld-awards {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.ld-stints li,
.ld-awards li {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.88rem;
}

.ld-stints img,
.ld-awards img {
    width: 22px;
    height: 22px;
    object-fit: contain;
    border-radius: 3px;
}

.ld-award-count {
    color: var(--ld-sold);
    font-family: var(--scu-font-display);
    font-size: 0.75rem;
    font-weight: 700;
}

.ld-stint-team {
    color: var(--scu-text-bright);
    font-weight: 600;
}

.ld-stint-season {
    color: var(--ld-muted);
}

.ld-stint-price {
    margin-left: auto;
    font-variant-numeric: tabular-nums;
    color: var(--scu-text);
}

/* ---- Bid board ---- */

.ld-board-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 0.75rem;
}

.ld-tile {
    perspective: 900px;
    min-height: 128px;
}

.ld-tile-inner {
    position: relative;
    height: 100%;
    min-height: 128px;
    transform-style: preserve-3d;
}

.ld-tile-face {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.75rem;
    border: 1px solid var(--scu-border-bright);
    border-radius: 6px;
    background: var(--scu-bg-card);
    backface-visibility: hidden;
    text-align: center;
}

.ld-tile-face .ld-team-mark {
    flex-direction: column;
    gap: 0.35rem;
    max-width: 100%;
}

.ld-tile-face .ld-team-name {
    font-size: 0.85rem;
    max-width: 100%;
}

.ld-tile-status {
    font-size: 0.75rem;
    color: var(--ld-muted);
}

.ld-tile-bucks {
    font-size: 0.75rem;
    color: var(--scu-text);
    font-variant-numeric: tabular-nums;
}

.ld-tile--locked .ld-tile-front {
    border-color: var(--ld-locked);
}

.ld-tile--locked .ld-tile-front .ld-tile-status {
    color: var(--ld-locked);
    font-weight: 600;
}

.ld-tile-back {
    transform: rotateY(180deg);
    background: var(--scu-bg-elevated);
}

.ld-tile-amount {
    font-family: var(--scu-font-display);
    font-size: 2rem;
    font-weight: 900;
    line-height: 1;
    color: var(--scu-text-bright);
    font-variant-numeric: tabular-nums;
}

/* The reveal: one bid at a time (--ld-step apart, lowest first), a beat, then the winner.
   --ld-lead, --ld-step and --ld-winner-at are set on the board from LiveDraftRules. */

.ld-board--revealed .ld-tile-inner {
    animation: ld-flip 0.8s cubic-bezier(0.3, 0.7, 0.3, 1) forwards;
    animation-delay: calc(var(--ld-lead) + var(--ld-flip) * var(--ld-step));
}

/* The tile pops forward as it turns, so each bid gets its own moment */
@keyframes ld-flip {
    0% { transform: rotateY(0) scale(1); }
    50% { transform: rotateY(90deg) scale(1.12); }
    80% { transform: rotateY(180deg) scale(1.06); }
    100% { transform: rotateY(180deg) scale(1); }
}

.ld-board--revealed .ld-tile-back {
    animation: ld-bid-glint 0.9s ease-out both;
    animation-delay: calc(var(--ld-lead) + var(--ld-flip) * var(--ld-step) + 0.4s);
}

@keyframes ld-bid-glint {
    from { box-shadow: 0 0 0 2px var(--scu-text-bright), 0 0 26px var(--scu-red-glow-lg); }
    to { box-shadow: none; }
}

/* Once the winner is announced the others step back */
.ld-tile--loser {
    animation: ld-step-back 0.5s ease forwards;
    animation-delay: var(--ld-winner-at);
}

@keyframes ld-step-back {
    to { opacity: 0.4; filter: grayscale(0.7); }
}

.ld-tile--winner .ld-tile-back {
    animation: ld-bid-glint 0.9s ease-out both, ld-crown 0.8s ease forwards;
    animation-delay: calc(var(--ld-lead) + var(--ld-flip) * var(--ld-step) + 0.4s), var(--ld-winner-at);
}

/* Gold only once the winner is announced, so a tie isn't given away when the bids turn over */
.ld-tile--winner .ld-tile-amount {
    animation: ld-gild 0.4s ease forwards;
    animation-delay: var(--ld-winner-at);
}

@keyframes ld-gild {
    to { color: var(--ld-sold); }
}

@keyframes ld-crown {
    from { border-color: var(--scu-border-bright); }
    to {
        border-color: var(--ld-sold);
        box-shadow: 0 0 0 1px var(--ld-sold), 0 0 28px var(--ld-sold-glow);
    }
}

/* The winner takes the stage */
.ld-winner {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-top: 1.25rem;
    padding: 1.25rem 1.5rem;
    border: 1px solid var(--ld-sold);
    border-radius: 8px;
    background:
        radial-gradient(ellipse at 0% 50%, var(--ld-sold-glow), transparent 65%),
        var(--scu-bg-card);
    box-shadow: 0 0 40px var(--ld-sold-glow);
    opacity: 0;
    animation: ld-winner-in 0.6s cubic-bezier(0.2, 1.2, 0.3, 1) forwards;
    animation-delay: var(--ld-winner-at);
}

.ld-winner--void {
    border-color: var(--scu-border-bright);
    background: var(--scu-bg-card);
    box-shadow: none;
}

@keyframes ld-winner-in {
    from {
        opacity: 0;
        transform: translateY(18px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

@keyframes ld-appear {
    to { opacity: 1; }
}

.ld-winner .ld-team-mark--large img,
.ld-winner .ld-team-mark--large .ld-team-initials {
    width: 96px;
    height: 96px;
}

.ld-winner-text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35rem;
    min-width: 0;
}

.ld-winner-line {
    margin: 0.3rem 0 0;
    font-size: 1.25rem;
    color: var(--scu-text);
}

.ld-winner-line strong {
    font-family: var(--scu-font-display);
    color: var(--scu-text-bright);
}

.ld-winner-price {
    margin: 0;
    font-family: var(--scu-font-display);
    font-size: clamp(2rem, 4vw, 3rem);
    font-weight: 900;
    line-height: 1;
    color: var(--ld-sold);
    font-variant-numeric: tabular-nums;
}

.ld-winner-price span {
    font-size: 0.4em;
    font-weight: 700;
    color: var(--scu-text);
}

.ld-winner-note {
    margin: 0;
    font-size: 0.85rem;
    color: var(--ld-muted);
}

.ld-sold-stamp {
    display: inline-block;
    padding: 0.15rem 0.8rem;
    border: 3px solid var(--ld-sold);
    border-radius: 4px;
    color: var(--ld-sold);
    font-family: var(--scu-font-display);
    font-size: 1.5rem;
    font-weight: 900;
    letter-spacing: 0.08em;
    transform: rotate(-5deg);
    box-shadow: 0 0 24px var(--ld-sold-glow);
    animation: ld-stamp 0.45s cubic-bezier(0.2, 1.5, 0.4, 1) both;
    animation-delay: calc(var(--ld-winner-at) + 0.25s);
}

.ld-sold-stamp--void {
    border-color: var(--ld-muted);
    color: var(--ld-muted);
    box-shadow: none;
}

@keyframes ld-stamp {
    from {
        opacity: 0;
        transform: scale(2.4) rotate(-5deg);
    }
    to {
        opacity: 1;
        transform: scale(1) rotate(-5deg);
    }
}

/* ---- Team rail ---- */

.ld-rail {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    position: sticky;
    top: 1rem;
    max-height: calc(100vh - 2rem);
    overflow-y: auto;
    /* Stretch to the stage row's height without the rail's own content making the page taller:
       the pool panel then fills only what the teams leave above the docks and ticker. Layout and
       paint containment keep anything absolutely positioned inside (the screen-reader-only labels)
       from overflowing the page */
    align-self: stretch;
    contain: size layout paint;
}

.ld-rail-team {
    padding: 0.55rem 0.7rem;
    border: 1px solid var(--scu-border);
    border-radius: 5px;
    background: var(--scu-bg-card);
}

.ld-rail-team.is-up {
    border-color: var(--scu-red);
}

.ld-rail-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.ld-rail-bucks {
    font-family: var(--scu-font-display);
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--ld-sold);
    font-variant-numeric: tabular-nums;
}

.ld-rail-picks {
    list-style: none;
    margin: 0.45rem 0 0;
    padding: 0.4rem 0 0;
    border-top: 1px solid var(--scu-border);
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.ld-rail-picks li {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
    font-size: 0.8rem;
}

.ld-rail-picks li span:last-child {
    color: var(--ld-muted);
    font-variant-numeric: tabular-nums;
}

/* ---- Pool panel: available and drafted players ---- */

.ld-pool-panel {
    margin-top: 0.5rem;
    border: 1px solid var(--scu-border);
    border-radius: 5px;
    background: var(--scu-bg-card);
    /* Fills the rail below the teams, never shorter than 360px (the rail scrolls instead) */
    flex: 1 0 360px;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.ld-pool-panel > [role="tabpanel"] {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.ld-pool-panel > [role="tabpanel"] > .ld-pool-rows {
    flex: 1;
    max-height: none;
}

.ld-tabs {
    display: flex;
    border-bottom: 1px solid var(--scu-border);
    container-type: inline-size;
}

.ld-tab {
    flex: 1;
    padding: 0.55rem 0.5rem;
    border: 0;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    background: transparent;
    color: var(--ld-muted);
    font-size: 0.85rem;
    font-weight: 600;
    transition: color var(--scu-transition), border-color var(--scu-transition);
}

.ld-tab:hover {
    color: var(--scu-text-bright);
}

.ld-tab:focus-visible {
    outline: 2px solid var(--scu-red);
    outline-offset: -2px;
}

.ld-tab.is-active {
    color: var(--scu-text-bright);
    border-bottom-color: var(--scu-red);
}

.ld-tab-count {
    margin-left: 0.25rem;
    font-family: var(--scu-font-display);
    font-size: 0.72rem;
    color: var(--scu-red);
}

/* Too narrow for "Available 49" on one line: every count drops below its label, not just the one that wraps */
@container (max-width: 340px) {
    .ld-tab-count {
        display: block;
        margin-left: 0;
    }
}

.ld-pool-rows {
    list-style: none;
    margin: 0;
    padding: 0.25rem 0;
    max-height: 360px;
    overflow-y: auto;
}

.ld-pool-row {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.5rem;
    padding: 0.32rem 0.7rem;
    font-size: 0.85rem;
}

.ld-pool-row + .ld-pool-row {
    border-top: 1px solid var(--scu-border);
}

.ld-pool-row.is-on-block {
    grid-template-columns: auto minmax(0, 1fr) auto auto;
    background: var(--scu-red-glow-md);
}

.ld-pool-row-name {
    min-width: 0;
    color: var(--scu-text-bright);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ld-pool-row--sold .ld-pool-row-name {
    display: flex;
    flex-direction: column;
    white-space: normal;
}

.ld-pool-row-team .ld-team-mark img,
.ld-pool-row-team .ld-team-initials {
    width: 16px;
    height: 16px;
    font-size: 0.45rem;
}

.ld-pool-row-team .ld-team-name {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--ld-muted);
}

.ld-pool-row-tag {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--scu-red);
}

.ld-pool-row-value {
    color: var(--ld-muted);
    font-variant-numeric: tabular-nums;
}

.ld-pool-row-price {
    font-family: var(--scu-font-display);
    font-weight: 700;
    color: var(--ld-sold);
}

/* Drafted rows open on hover or focus to show what every team bid */
.ld-pool-row--sold.has-bids {
    cursor: default;
}

.ld-pool-row--sold.has-bids:hover,
.ld-pool-row--sold.has-bids:focus-visible {
    background: var(--scu-bg-panel);
    outline: none;
}

.ld-pool-row--sold.has-bids:focus-visible {
    box-shadow: inset 2px 0 0 var(--scu-red);
}

.ld-sale-bids {
    display: none;
    grid-column: 1 / -1;
    list-style: none;
    margin: 0.15rem 0 0.1rem;
    padding: 0.3rem 0 0;
    border-top: 1px dashed var(--scu-border);
    font-size: 0.75rem;
}

.ld-pool-row--sold.has-bids:hover .ld-sale-bids,
.ld-pool-row--sold.has-bids:focus-visible .ld-sale-bids {
    display: block;
}

.ld-sale-bids li {
    display: flex;
    align-items: baseline;
    gap: 0.4rem;
    padding: 0.08rem 0;
    color: var(--ld-muted);
}

.ld-sale-bid-team {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ld-sale-bid-auto {
    font-size: 0.65rem;
    font-style: italic;
}

.ld-sale-bid-amount {
    font-family: var(--scu-font-display);
    font-variant-numeric: tabular-nums;
}

.ld-sale-bids li.is-winner {
    color: var(--scu-text-bright);
    font-weight: 600;
}

.ld-sale-bids li.is-winner .ld-sale-bid-amount {
    color: var(--ld-sold);
}

.ld-pool-row-round {
    font-family: var(--scu-font-display);
    font-size: 0.68rem;
    color: var(--scu-red);
}

/* Proposing order: one column per team (display order), one row per round */
.ld-order {
    width: 100%;
    border-collapse: separate;
    border-spacing: 3px;
    padding: 0 0.45rem 0.45rem;
    table-layout: fixed;
    font-variant-numeric: tabular-nums;
}

.ld-order th,
.ld-order td {
    height: 1.9rem;
    padding: 0;
    text-align: center;
    border-radius: 3px;
}

.ld-order thead th {
    font-family: var(--scu-font-display);
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--ld-muted);
}

.ld-order thead th:first-child,
.ld-order tbody th {
    width: 2.4rem;
}

.ld-order tbody th {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--ld-muted);
    text-align: left;
    padding-left: 0.2rem;
}

.ld-order td {
    background: var(--scu-bg-elevated);
}

.ld-order td.is-out {
    background: transparent;
    color: var(--ld-muted);
    opacity: 0.6;
}

.ld-order td.is-proposer {
    background: color-mix(in srgb, var(--scu-red) 22%, var(--scu-bg-elevated));
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--scu-red) 55%, transparent);
    font-family: var(--scu-font-display);
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--scu-text-bright);
}

.ld-order tr.is-current th {
    color: var(--scu-text-bright);
}

.ld-order tr.is-current td.is-proposer {
    background: var(--scu-red);
    box-shadow: 0 0 10px var(--scu-red-glow-md);
    color: var(--ld-on-accent);
}

/* Fills the panel like the player lists and scrolls the rounds under a pinned team header */
.ld-order-scroll {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    /* Contains the cells' absolutely positioned screen-reader labels, so they scroll and clip with
       the table instead of stretching an outer box to where an unscrolled row would be */
    position: relative;
}

.ld-order thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: var(--scu-bg-card);
    /* Covers the border-spacing gaps so scrolled rows don't show through around the header */
    box-shadow: 0 0 0 3px var(--scu-bg-card);
}

.ld-pool-empty {
    margin: 0;
    padding: 0.75rem;
    color: var(--ld-muted);
    font-size: 0.85rem;
}

/* ---- Docks ---- */

.ld-docks {
    position: sticky;
    bottom: 0;
    z-index: 5;
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    padding: 0.85rem 1.5rem;
    background: var(--scu-bg-panel);
    border-top: 1px solid var(--scu-border-bright);
    box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.35);
}

.ld-dock-panel {
    flex: 1 1 320px;
    max-width: 560px;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.ld-dock-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.ld-dock-balance {
    color: var(--ld-muted);
    font-size: 0.85rem;
}

.ld-dock-balance strong {
    color: var(--ld-sold);
    font-family: var(--scu-font-display);
}

.ld-dock-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--scu-text-bright);
}

.ld-dock-note,
.ld-dock-hint {
    margin: 0;
    color: var(--ld-muted);
    font-size: 0.85rem;
}

.ld-dock-hint {
    font-size: 0.78rem;
}

.ld-dock-max strong {
    color: var(--scu-text-bright);
    font-variant-numeric: tabular-nums;
}

.ld-dock-error {
    margin: 0;
    color: var(--scu-danger);
    font-size: 0.85rem;
}

.ld-propose,
.ld-bid {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.ld-pool-list {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid var(--scu-border);
    border-radius: 4px;
}

.ld-pool-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.35rem 0.6rem;
    border: 0;
    border-bottom: 1px solid var(--scu-border);
    background: transparent;
    color: var(--scu-text);
    text-align: left;
    font-size: 0.88rem;
}

.ld-pool-option:hover,
.ld-pool-option:focus-visible {
    background: var(--scu-bg-elevated);
    outline: none;
}

.ld-pool-option.is-selected {
    background: var(--scu-red-glow-md);
    color: var(--scu-text-bright);
}

.ld-pool-name {
    flex: 1;
}

.ld-pool-mmr {
    color: var(--ld-muted);
    font-variant-numeric: tabular-nums;
}

.ld-bid-row {
    display: flex;
    gap: 0.4rem;
}

.ld-bid-input {
    max-width: 8rem;
    font-family: var(--scu-font-display);
    font-weight: 700;
}

.ld-admin-link {
    font-size: 0.8rem;
}

.ld-admin-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.ld-admin-alert {
    margin: 0;
    padding: 0.45rem 0.65rem;
    border: 1px solid var(--scu-warning);
    border-radius: 4px;
    color: var(--scu-warning);
    font-size: 0.85rem;
}

/* ---- Admin panel: a button in the corner that opens the controls above it ---- */

.ld-admin-float {
    position: fixed;
    right: 1rem;
    bottom: 1rem;
    z-index: 20;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.6rem;
    max-width: calc(100vw - 2rem);
}

.ld-admin-pop {
    width: min(420px, calc(100vw - 2rem));
    max-height: calc(100vh - 6rem);
    overflow-y: auto;
    padding: 0.9rem 1rem;
    border: 1px solid var(--scu-border-bright);
    border-radius: 8px;
    background: var(--scu-bg-panel);
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.55);
}

.ld-admin-pop .ld-dock-panel {
    max-width: none;
}

.ld-admin-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.5rem 0.9rem;
    border: 1px solid var(--scu-border-bright);
    border-radius: 999px;
    background: var(--scu-bg-elevated);
    color: var(--scu-text-bright);
    font-size: 0.85rem;
    font-weight: 600;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
    transition: border-color var(--scu-transition), background var(--scu-transition);
}

.ld-admin-toggle svg {
    width: 1rem;
    height: 1rem;
}

.ld-admin-toggle:hover {
    border-color: var(--scu-red);
}

.ld-admin-toggle:focus-visible {
    outline: 2px solid var(--scu-red);
    outline-offset: 2px;
}

.ld-admin-float.is-open .ld-admin-toggle {
    border-color: var(--scu-red);
}

/* The draft is waiting on an admin: hard to miss even when tucked away */
.ld-admin-toggle.is-alert {
    border-color: var(--scu-warning);
    color: var(--scu-warning);
    animation: ld-admin-alert 1.2s ease-in-out infinite;
}

@keyframes ld-admin-alert {
    50% { box-shadow: 0 0 0 4px color-mix(in srgb, var(--scu-warning) 30%, transparent), 0 6px 18px rgba(0, 0, 0, 0.45); }
}

/* ---- Ticker ---- */

.ld-ticker {
    display: flex;
    gap: 1.75rem;
    overflow-x: auto;
    padding: 0.55rem 1.5rem;
    border-top: 1px solid var(--scu-border);
    background: var(--scu-bg);
    white-space: nowrap;
    font-size: 0.85rem;
}

.ld-ticker-item strong {
    color: var(--ld-sold);
    margin-left: 0.3rem;
}

.ld-ticker-round {
    font-family: var(--scu-font-display);
    font-size: 0.7rem;
    color: var(--scu-red);
    margin-right: 0.3rem;
}

.ld-ticker-to {
    color: var(--ld-muted);
}

/* ---- Small screens ---- */

@media (max-width: 960px) {
    .ld-main {
        grid-template-columns: minmax(0, 1fr);
        padding: 1rem;
    }

    .ld-clock--large {
        --ld-size: 84px;
    }

    .ld-rail {
        position: static;
        align-self: start;
        contain: none;
        max-height: none;
        overflow: visible;
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    }

    .ld-pool-panel {
        grid-column: 1 / -1;
        flex: none;
    }

    .ld-pool-panel > [role="tabpanel"] > .ld-pool-rows,
    .ld-order-scroll {
        max-height: 360px;
    }

    .ld-top {
        padding: 0.6rem 1rem;
    }

    .ld-rotation {
        margin-left: 0;
        overflow-x: auto;
        max-width: 100%;
    }

    .ld-docks {
        padding: 0.75rem 1rem;
    }
}

/* ---- Reduced motion: show results, skip the theatre ---- */

@media (prefers-reduced-motion: reduce) {
    .ld-win-shot {
        animation: none;
    }

    .ld-wins-track {
        transition: none;
    }

    .ld-reveal-name,
    .ld-record,
    .ld-admin-toggle.is-alert,
    .ld-avatar,
    .ld-clock--urgent .ld-clock-value {
        animation: none;
    }

    .ld-fact {
        animation: ld-appear 0.3s ease forwards;
        animation-delay: 0s;
        transform: none;
    }

    /* Still one bid at a time on the same schedule, turned over instantly instead of flipped.
       The back face keeps its own rotation: without it, a turned tile shows neither side. */
    .ld-board--revealed .ld-tile-inner {
        animation-duration: 0.01s;
    }

    .ld-winner {
        animation-name: ld-appear;
    }

    .ld-sold-stamp {
        animation: ld-appear 0.3s ease both;
        animation-delay: var(--ld-winner-at);
    }
}

/* ---- Sold screen ----
   A team photo over the whole stage once the winner is called (--ld-winner-at, set on the
   screen from LiveDraftRules): crest and name, the roster in the back row, this draft's picks
   in front of them, then the new player walking in at the front beside the price. */

.ld-sold {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: grid;
    place-items: center;
    padding: 1.5rem 1rem;
    overflow-y: auto;
    background:
        radial-gradient(ellipse at 50% 70%, var(--ld-spotlight), transparent 60%),
        var(--ld-scrim);
    backdrop-filter: blur(6px);
    /* Hidden (and click-through) until the winner is called */
    animation: ld-sold-in 0.45s ease-out both;
    animation-delay: var(--ld-winner-at);
}

@keyframes ld-sold-in {
    from { opacity: 0; visibility: hidden; }
    to { opacity: 1; visibility: visible; }
}

.ld-sold-backdrop {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    overflow: hidden;
    pointer-events: none;
}

.ld-sold-backdrop img {
    width: min(80vmin, 720px);
    height: auto;
    opacity: 0.07;
    filter: blur(2px) saturate(0.6);
    animation: ld-sold-drift 9s ease-out both;
    animation-delay: var(--ld-winner-at);
}

@keyframes ld-sold-drift {
    from { transform: scale(1.25) rotate(-4deg); }
    to { transform: scale(1) rotate(0); }
}

.ld-sold-frame {
    position: relative;
    width: min(100%, 980px);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    text-align: center;
}

/* Crest and team */
.ld-sold-head {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    animation: ld-sold-drop 0.55s cubic-bezier(0.2, 1.3, 0.4, 1) both;
    animation-delay: calc(var(--ld-winner-at) + 0.1s);
}

@keyframes ld-sold-drop {
    from { opacity: 0; transform: translateY(-24px) scale(0.9); }
    to { opacity: 1; transform: none; }
}

.ld-sold-head .ld-team-mark--large img,
.ld-sold-head .ld-team-mark--large .ld-team-initials {
    width: 104px;
    height: 104px;
    box-shadow: 0 0 0 2px var(--ld-sold), 0 0 36px var(--ld-sold-glow);
}

.ld-sold-team {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35rem;
    min-width: 0;
}

.ld-sold-team .ld-sold-stamp {
    font-size: 1.1rem;
    animation-delay: calc(var(--ld-winner-at) + 0.3s);
}

.ld-sold-team-name {
    margin: 0;
    font-family: var(--scu-font-display);
    font-size: clamp(1.6rem, 4vw, 2.6rem);
    font-weight: 900;
    line-height: 1.05;
    color: var(--scu-text-bright);
    text-align: left;
    overflow-wrap: anywhere;
}

.ld-sold-round {
    font-size: 0.8rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ld-muted);
}

/* The photo: back row, then the picks, then the new player in front */
.ld-sold-photo {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

.ld-sold-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem 1rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.ld-sold-row--picks {
    margin-top: 0.85rem;
}

.ld-sold-member {
    --ld-face: 56px;
    position: relative;
    width: 5.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
    /* The roster arrives together, as one team */
    animation: ld-sold-pop 0.45s cubic-bezier(0.2, 1.4, 0.4, 1) both;
    animation-delay: calc(var(--ld-winner-at) + 0.35s);
}

/* The back row stands a little dimmer than the players in front */
.ld-sold-row--roster .ld-face {
    filter: saturate(0.85) brightness(0.92);
}

.ld-sold-member--pick {
    --ld-face: 66px;
    animation-delay: calc(var(--ld-winner-at) + 0.6s + var(--i, 0) * 0.08s);
}

.ld-sold-member--pick .ld-face {
    box-shadow: 0 0 0 2px var(--ld-sold), 0 0 14px var(--ld-sold-glow);
}

@keyframes ld-sold-pop {
    from { opacity: 0; transform: translateY(14px) scale(0.7); }
    to { opacity: 1; transform: none; }
}

.ld-sold-member-name {
    max-width: 100%;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--scu-text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ld-sold-tag {
    position: absolute;
    top: calc(var(--ld-face) - 1.1rem);
    left: calc(50% + var(--ld-face) / 2 - 0.9rem);
    min-width: 1.25rem;
    padding: 0.05rem 0.3rem;
    border-radius: 999px;
    background: var(--scu-red);
    color: var(--ld-on-accent);
    font-family: var(--scu-font-display);
    font-size: 0.65rem;
    font-weight: 900;
    line-height: 1.3;
}

.ld-sold-tag--price {
    background: var(--ld-sold);
    color: var(--scu-bg);
    font-variant-numeric: tabular-nums;
}

/* Avatars (shared shape; size comes from --ld-face) */
.ld-face {
    position: relative;
    width: var(--ld-face, 56px);
    height: var(--ld-face, 56px);
    flex-shrink: 0;
    display: grid;
    place-items: center;
    overflow: hidden;
    border-radius: 50%;
    background: var(--scu-bg-elevated);
    box-shadow: 0 0 0 2px var(--scu-border-bright);
}

.ld-face-initials {
    font-family: var(--scu-font-display);
    font-size: calc(var(--ld-face, 56px) * 0.32);
    font-weight: 900;
    color: var(--scu-text-bright);
}

.ld-face img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* The new player, front and centre: walks in from the side and takes their place */
.ld-sold-front {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.75rem;
    margin-top: 1.25rem;
    padding: 1.25rem 2rem;
    border-top: 1px solid color-mix(in srgb, var(--ld-sold) 45%, transparent);
    background: radial-gradient(ellipse at 50% 0%, var(--ld-sold-glow), transparent 70%);
}

.ld-sold-newcomer {
    --ld-face: clamp(120px, 20vmin, 176px);
    animation: ld-sold-join 0.95s cubic-bezier(0.25, 1.15, 0.35, 1) both;
    animation-delay: calc(var(--ld-winner-at) + 1s);
}

.ld-sold-newcomer .ld-face {
    box-shadow: 0 0 0 4px var(--ld-sold), 0 0 48px var(--ld-sold-glow);
    animation: ld-sold-halo 2.4s ease-in-out infinite;
    animation-delay: calc(var(--ld-winner-at) + 2s);
}

@keyframes ld-sold-join {
    0% { opacity: 0; transform: translateX(-38vw) scale(1.35); }
    60% { opacity: 1; }
    100% { opacity: 1; transform: none; }
}

@keyframes ld-sold-halo {
    50% { box-shadow: 0 0 0 4px var(--ld-sold), 0 0 72px var(--ld-sold-glow), 0 0 0 10px var(--ld-sold-glow); }
}

.ld-sold-deal {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.4rem;
    min-width: 0;
    text-align: left;
}

.ld-sold-joins {
    margin: 0;
    display: flex;
    flex-direction: column;
    animation: ld-sold-rise 0.5s ease-out both;
    animation-delay: calc(var(--ld-winner-at) + 1.5s);
}

.ld-sold-joins strong {
    font-family: var(--scu-font-display);
    font-size: clamp(1.8rem, 5vw, 3rem);
    font-weight: 900;
    line-height: 1;
    color: var(--scu-text-bright);
    overflow-wrap: anywhere;
}

.ld-sold-joins span {
    font-size: 1rem;
    color: var(--scu-text);
}

.ld-sold-price {
    margin: 0;
    font-family: var(--scu-font-display);
    font-size: clamp(3.2rem, 10vw, 6rem);
    font-weight: 900;
    line-height: 0.95;
    color: var(--ld-sold);
    text-shadow: 0 0 34px var(--ld-sold-glow);
    font-variant-numeric: tabular-nums;
    animation: ld-sold-slam 0.5s cubic-bezier(0.2, 1.5, 0.4, 1) both;
    animation-delay: calc(var(--ld-winner-at) + 1.7s);
}

.ld-sold-price span {
    margin-left: 0.35rem;
    font-size: 0.3em;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--scu-text);
    text-shadow: none;
}

@keyframes ld-sold-slam {
    from { opacity: 0; transform: scale(1.8); }
    to { opacity: 1; transform: none; }
}

@keyframes ld-sold-rise {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: none; }
}

.ld-sold-note {
    margin: 0;
    font-size: 0.9rem;
    color: var(--ld-muted);
    animation: ld-sold-rise 0.5s ease-out both;
    animation-delay: calc(var(--ld-winner-at) + 2.1s);
}

@media (max-width: 640px) {
    .ld-sold-head {
        flex-direction: column;
        gap: 0.75rem;
    }

    .ld-sold-head .ld-team-mark--large img,
    .ld-sold-head .ld-team-mark--large .ld-team-initials {
        width: 76px;
        height: 76px;
    }

    .ld-sold-team {
        align-items: center;
    }

    .ld-sold-team-name {
        text-align: center;
    }

    .ld-sold-member {
        --ld-face: 44px;
        width: 4.5rem;
    }

    .ld-sold-member--pick {
        --ld-face: 52px;
    }

    .ld-sold-front {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem 0.5rem;
    }

    .ld-sold-deal {
        align-items: center;
        text-align: center;
    }
}

/* Reduced motion: the same beats on the same schedule, faded in rather than flown */
@media (prefers-reduced-motion: reduce) {
    .ld-sold-backdrop img,
    .ld-sold-newcomer .ld-face {
        animation: none;
    }

    .ld-sold-head,
    .ld-sold-member,
    .ld-sold-newcomer,
    .ld-sold-joins,
    .ld-sold-price,
    .ld-sold-note {
        animation-name: ld-sold-fade;
        animation-duration: 0.3s;
    }
}

@keyframes ld-sold-fade {
    from { opacity: 0; }
    to { opacity: 1; }
}
