/**
 * Top Rank (templates/top-rank.php, .wod-toprank) - homepage vibe, no wheel: cards on a podium.
 * Views (data-view on .wod-toprank, set by top-rank.js):
 *   setup   - homepage hero: intro + "Add entries" + "Hide the winners" on the left; podium
 *             preview, options + Generate and a two-row marquee where the wheel would be;
 *   show    - the generated page: the same podium with face-down cards, reveal button, marquee;
 *   loading - a ?show= link while the saved page loads.
 * Winner pop-up = the homepage .result-modal + a big card. Loaded after home-v5.css; uses its
 * tokens (--h-*) and shared parts. States: .is-running / .is-paused / .is-done / .is-drawing.
 *
 * @package WOD_v4
 */

body.wod-v5 .wod-toprank,
body.wod-v5 .tr-result {
    --gold: #ffbe4d;
    --silver: #c3c9d4;
    --bronze: #e39a6b;
}

body.wod-v5 .wod-toprank[data-view="show"] .tr-setup-stage,
body.wod-v5 .wod-toprank[data-view="setup"] .tr-show,
body.wod-v5 .wod-toprank[data-view="loading"] .tr-setup-stage {
    display: none;
}

body.wod-v5 .wod-toprank[data-view="loading"] {
    min-height: 80vh;
}

/* ==========================================================================
   SETUP: left column (entries button, hide switch, saved pages)
   ========================================================================== */
body.wod-v5 .wod-toprank .tr-side {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

body.wod-v5 .wod-toprank .tr-hide-switch {
    --card-accent: var(--h-violet);
    padding: 16px 20px;
    border: 1px solid var(--h-line);
    border-radius: 24px;
    background: var(--h-surface);
    box-shadow: var(--h-shadow);
}

body.wod-v5 .wod-toprank .tr-hide-switch.active {
    border-color: color-mix(in srgb, var(--h-violet) 55%, transparent);
}

body.wod-v5 .wod-toprank .tr-saved {
    padding: 18px;
    border: 1px solid var(--h-line);
    border-radius: 24px;
    background: var(--h-surface);
    box-shadow: var(--h-shadow);
}

body.wod-v5 .wod-toprank .tr-saved__title,
body.wod-v5 .wod-toprank .tr-panel__label,
body.wod-v5 .wod-toprank .tr-marquee__label {
    margin: 0 0 10px;
    font-size: 0.9rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--h-muted);
}

body.wod-v5 .wod-toprank .tr-saved__list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 0;
    padding: 0;
    list-style: none;
}

body.wod-v5 .wod-toprank .tr-saved__item {
    display: flex;
    align-items: center;
    gap: 6px;
}

body.wod-v5 .wod-toprank .tr-saved__open {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-width: 0;
    padding: 10px 14px;
    border: 1px solid var(--h-line);
    border-radius: 16px;
    background: var(--h-surface-2);
    color: var(--h-text);
    text-decoration: none;
    transition: border-color 0.2s ease;
}

body.wod-v5 .wod-toprank .tr-saved__open:hover {
    border-color: var(--h-yellow);
}

body.wod-v5 .wod-toprank .tr-saved__name {
    overflow: hidden;
    font-size: 1.05rem;
    font-weight: 800;
    text-overflow: ellipsis;
    white-space: nowrap;
}

body.wod-v5 .wod-toprank .tr-saved__meta {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--h-muted);
}

body.wod-v5 .wod-toprank .tr-saved__del {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--h-muted);
    cursor: pointer;
}

body.wod-v5 .wod-toprank .tr-saved__del:hover {
    background: color-mix(in srgb, var(--h-coral) 18%, transparent);
    color: var(--h-coral);
}

/* ==========================================================================
   SETUP: right column (preview board + options + marquee)
   ========================================================================== */
body.wod-v5 .wod-toprank .tr-setup-wrap {
    align-self: start;
}

body.wod-v5 .wod-toprank .tr-board {
    position: relative;
    width: min(680px, 52vw);
    margin: 0 auto;
}

body.wod-v5 .wod-toprank .tr-board .wheel-glow {
    inset: -8%;
}

body.wod-v5 .wod-toprank .tr-panel {
    position: relative;
    z-index: 1;
    overflow: hidden;
    padding: 22px 24px 24px;
    border: 1px solid var(--h-line);
    border-radius: 32px;
    background:
        radial-gradient(120% 40% at 50% 0%, color-mix(in srgb, var(--h-yellow) 14%, transparent), transparent 70%),
        var(--h-surface);
    box-shadow: var(--h-shadow), 0 30px 70px rgba(0, 0, 0, 0.2);
}

body.wod-v5 .wod-toprank .tr-panel::before {
    content: '';
    position: absolute;
    inset: 0 0 auto;
    height: 4px;
    background: linear-gradient(90deg, var(--h-yellow), var(--h-coral), var(--h-violet));
}

body.wod-v5 .wod-toprank .tr-panel__label {
    text-align: center;
}

/* Options under the preview */
body.wod-v5 .wod-toprank .tr-options {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px 18px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--h-line);
}

body.wod-v5 .wod-toprank .tr-option {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}

body.wod-v5 .wod-toprank .tr-option--wide {
    grid-column: 1 / -1;
}

body.wod-v5 .wod-toprank .tr-option__label {
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--h-text);
}

body.wod-v5 .wod-toprank .tr-option__row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

body.wod-v5 .wod-toprank .tr-option__row .tr-seg {
    flex: 1 1 320px;
}

body.wod-v5 .wod-toprank .tr-option .home-stepper {
    align-self: flex-start;
}

body.wod-v5 .wod-toprank .tr-option .home-stepper[hidden] {
    display: none;
}

body.wod-v5 .wod-toprank .tr-option .home-stepper__btn:hover {
    background: var(--h-yellow);
}

body.wod-v5 .wod-toprank .tr-switches {
    --card-accent: #3fd8b0;
    gap: 0;
}

body.wod-v5 .wod-toprank .tr-switches .home-setting {
    padding: 10px 0;
}

body.wod-v5 .wod-toprank .tr-switches .home-setting:first-child {
    padding-top: 0;
}

/* Segmented choices */
body.wod-v5 .wod-toprank .tr-seg {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 4px;
    border: 1px solid var(--h-line);
    border-radius: 20px;
    background: var(--h-surface-2);
}

body.wod-v5 .wod-toprank .tr-seg button {
    flex: 1 1 auto;
    padding: 10px 12px;
    border: 0;
    border-radius: 16px;
    background: transparent;
    color: var(--h-text);
    font-family: var(--h-font);
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
}

body.wod-v5 .wod-toprank .tr-seg button:hover {
    background: var(--h-surface);
}

body.wod-v5 .wod-toprank .tr-seg button[aria-checked="true"] {
    background: var(--h-yellow);
    color: var(--h-ink);
    box-shadow: 0 4px 12px rgba(255, 190, 77, 0.3);
}

body.wod-v5 .wod-toprank .tr-seg button:focus-visible {
    outline: 3px solid var(--h-yellow);
    outline-offset: 2px;
}

/* Inputs (options + dialog) */
body.wod-v5 .wod-toprank .tr-input {
    width: 100%;
    min-width: 0;
    padding: 13px 18px;
    border: 1px solid var(--h-line);
    border-radius: 999px;
    background: var(--h-surface-2);
    color: var(--h-text);
    font-family: var(--h-font);
    font-size: 1.05rem;
    font-weight: 600;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

body.wod-v5 .wod-toprank textarea.tr-input {
    border-radius: 18px;
    resize: vertical;
}

body.wod-v5 .wod-toprank .tr-input:focus {
    border-color: var(--h-yellow);
    box-shadow: 0 0 0 4px rgba(255, 190, 77, 0.18);
}

body.wod-v5 .wod-toprank .tr-msg {
    margin: 0;
    font-size: 0.98rem;
    font-weight: 700;
    color: var(--h-muted);
}

body.wod-v5 .wod-toprank .tr-msg:empty {
    display: none;
}

body.wod-v5 .wod-toprank .tr-msg.is-error {
    color: var(--h-coral);
}

body.wod-v5 .wod-toprank .tr-msg--generate {
    text-align: center;
}

body.wod-v5 .wod-toprank .tr-hint {
    margin: 0;
    font-size: 0.95rem;
    line-height: 1.4;
    color: var(--h-muted);
}

body.wod-v5 .wod-toprank .tr-privacy {
    margin-top: -6px;
    text-align: center;
}

body.wod-v5 .wod-toprank .tr-linkish {
    padding: 0;
    border: 0;
    background: none;
    color: var(--h-text);
    font: inherit;
    text-decoration: underline;
    text-decoration-color: var(--h-yellow);
    text-decoration-thickness: 2px;
    text-underline-offset: 3px;
    cursor: pointer;
}

body.wod-v5 .wod-toprank .tr-controls {
    display: flex;
    justify-content: center;
}

/* The arcade button (same as the Team Generator's) */
body.wod-v5 .wod-toprank .tr-start {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: auto;
    min-width: 260px;
    max-width: 100%;
    min-height: 62px;
    margin: 0 0 7px;
    padding: 12px 30px;
    border: 4px solid var(--h-ink);
    border-radius: 999px;
    background: radial-gradient(120% 160% at 50% 0%, #ffe2a6, var(--h-yellow) 55%, #f59e2b);
    color: var(--h-ink);
    font-family: var(--h-font);
    font-size: 1.15rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    line-height: 1.15;
    text-transform: uppercase;
    box-shadow: 0 7px 0 #9a5a10, 0 12px 24px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.2s ease;
}

body.wod-v5 .wod-toprank .tr-start svg {
    flex-shrink: 0;
}

body.wod-v5 .wod-toprank .tr-start:hover:not(:disabled) {
    transform: translateY(-2px);
}

body.wod-v5 .wod-toprank .tr-start:active:not(:disabled),
body.wod-v5 .wod-toprank .tr-start:disabled {
    transform: translateY(5px);
    box-shadow: 0 2px 0 #9a5a10, 0 6px 14px rgba(0, 0, 0, 0.3);
}

body.wod-v5 .wod-toprank .tr-start:disabled {
    filter: saturate(0.6) brightness(0.92);
    cursor: default;
}

body.wod-v5 .wod-toprank .tr-start:focus-visible {
    outline: 3px solid var(--h-yellow);
    outline-offset: 3px;
}

/* ==========================================================================
   PODIUM (preview + show): Top 2 | Top 1 (raised) | Top 3, the rest below
   ========================================================================== */
body.wod-v5 .wod-toprank .tr-ranks {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
}

body.wod-v5 .wod-toprank .tr-podium {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: clamp(8px, 2vw, 22px);
    max-width: 100%;
}

body.wod-v5 .wod-toprank .tr-rest {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding-top: 16px;
    border-top: 1px dashed var(--h-line);
}

body.wod-v5 .wod-toprank .tr-rank {
    --medal: var(--h-violet);
    --medal-ink: #ffffff;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

body.wod-v5 .wod-toprank .tr-rank:nth-child(even) { --medal: #3fd8b0; --medal-ink: #121019; }
body.wod-v5 .wod-toprank .tr-rank--1 { --medal: var(--gold); --medal-ink: #121019; }
body.wod-v5 .wod-toprank .tr-rank--2 { --medal: var(--silver); --medal-ink: #121019; }
body.wod-v5 .wod-toprank .tr-rank--3 { --medal: var(--bronze); --medal-ink: #121019; }

body.wod-v5 .wod-toprank .tr-rest .tr-rank {
    padding: 10px 12px 12px;
    border: 1px solid var(--h-line);
    border-radius: 20px;
    background: var(--h-surface-2);
}

body.wod-v5 .wod-toprank .tr-rank__badge {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

body.wod-v5 .wod-toprank .tr-rank__medal {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--medal);
    color: var(--medal-ink);
    font-size: 1.05rem;
    font-weight: 800;
    box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.15);
}

body.wod-v5 .wod-toprank .tr-rank--1 .tr-rank__medal {
    width: 44px;
    height: 44px;
    font-size: 1.3rem;
    box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.15), 0 0 0 4px color-mix(in srgb, var(--gold) 30%, transparent);
}

body.wod-v5 .wod-toprank .tr-rank__label {
    font-size: 0.9rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    white-space: nowrap;
    color: var(--h-text);
}

body.wod-v5 .wod-toprank .tr-rank__cards {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    max-width: 100%;
}

/* Podium steps under Top 1-3 */
body.wod-v5 .wod-toprank .tr-rank__step {
    display: block;
    align-self: stretch;
    min-width: 90px;
    height: 22px;
    border-radius: 14px 14px 6px 6px;
    background:
        linear-gradient(180deg, color-mix(in srgb, var(--medal) 75%, #ffffff), var(--medal));
    box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.15), 0 10px 22px rgba(0, 0, 0, 0.15);
}

body.wod-v5 .wod-toprank .tr-rank--1 .tr-rank__step { height: 62px; }
body.wod-v5 .wod-toprank .tr-rank--2 .tr-rank__step { height: 40px; }

/* ==========================================================================
   CARDS (face down = back, revealed = front; they flip)
   ========================================================================== */
body.wod-v5 .wod-toprank .tr-card {
    --w: 120px;
    position: relative;
    flex-shrink: 0;
    width: var(--w);
    aspect-ratio: 3 / 4;
    perspective: 900px;
}

body.wod-v5 .wod-toprank .tr-rank--1 .tr-card {
    --w: 146px;
}

body.wod-v5 .wod-toprank .tr-rest .tr-card {
    --w: 92px;
}

/* Setup preview: smaller */
body.wod-v5 .wod-toprank .tr-ranks--preview .tr-card {
    --w: 96px;
}

body.wod-v5 .wod-toprank .tr-ranks--preview .tr-rank--1 .tr-card {
    --w: 116px;
}

body.wod-v5 .wod-toprank .tr-ranks--preview .tr-rest .tr-card {
    --w: 70px;
}

body.wod-v5 .wod-toprank .tr-ranks--preview .tr-rest .tr-card__tag,
body.wod-v5 .wod-toprank .tr-ranks--preview .tr-rest .tr-card__name {
    font-size: 0.75rem;
}

body.wod-v5 .wod-toprank .tr-card__inner {
    position: absolute;
    inset: 0;
    transform-style: preserve-3d;
    transition: transform 0.75s cubic-bezier(0.34, 1.3, 0.64, 1);
}

body.wod-v5 .wod-toprank .tr-card.is-flipped .tr-card__inner {
    transform: rotateY(180deg);
}

body.wod-v5 .wod-toprank .tr-card__face {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-radius: 16px;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}

/* Back: the rank colour, a pattern, a "?" */
body.wod-v5 .wod-toprank .tr-card__back {
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: 3px solid var(--medal);
    background:
        repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.07) 0 8px, transparent 8px 16px),
        radial-gradient(90% 70% at 50% 30%, color-mix(in srgb, var(--medal) 55%, #1a1724), #121019);
    color: #ffffff;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.25);
}

body.wod-v5 .wod-toprank .tr-card__q {
    font-size: calc(var(--w) * 0.36);
    font-weight: 800;
    line-height: 1;
    color: var(--medal);
    text-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
}

body.wod-v5 .wod-toprank .tr-card__back svg {
    color: var(--medal);
}

body.wod-v5 .wod-toprank .tr-card__tag {
    padding: 4px 9px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
    font-size: 0.8rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    white-space: nowrap;
}

/* Front: picture (or initials) + name */
body.wod-v5 .wod-toprank .tr-card__front {
    border: 3px solid var(--medal);
    background: var(--h-surface);
    box-shadow: 0 14px 30px rgba(0, 0, 0, 0.22);
    transform: rotateY(180deg);
}

body.wod-v5 .wod-toprank .tr-card__pic {
    flex: 1;
    min-height: 0;
}

body.wod-v5 .wod-toprank .tr-card__pic .tr-avatar {
    width: 100%;
    height: 100%;
    border-radius: 0;
    font-size: calc(var(--w) * 0.3);
}

body.wod-v5 .wod-toprank .tr-card__name {
    padding: 7px 7px 8px;
    overflow: hidden;
    background: var(--medal);
    color: var(--medal-ink);
    font-size: 0.95rem;
    font-weight: 800;
    line-height: 1.2;
    text-align: center;
    text-overflow: ellipsis;
    white-space: nowrap;
}

body.wod-v5 .wod-toprank .tr-card.is-set .tr-card__back {
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.25), inset 0 0 0 3px rgba(255, 255, 255, 0.22);
}

/* Being drawn right now */
body.wod-v5 .wod-toprank .tr-card.is-next {
    animation: trPulse 0.9s ease-in-out infinite;
}

body.wod-v5 .wod-toprank .tr-card.is-next .tr-card__back {
    animation: trGlow 0.9s ease-in-out infinite;
}

/* ==========================================================================
   AVATARS (picture or initials on a brand colour)
   ========================================================================== */
body.wod-v5 .tr-avatar {
    --av: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: var(--av);
    height: var(--av);
    overflow: hidden;
    border-radius: 12px;
    background: var(--tone, var(--h-yellow));
    color: #121019;
    font-family: var(--h-font);
    font-size: calc(var(--av) * 0.4);
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1;
    user-select: none;
}

body.wod-v5 .tr-avatar img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ==========================================================================
   MARQUEE: two rows moving opposite ways
   ========================================================================== */
body.wod-v5 .wod-toprank .tr-marquee {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
    margin-top: 26px;
}

body.wod-v5 .wod-toprank .tr-setup-wrap .tr-marquee {
    width: min(680px, 52vw);
    margin-left: auto;
    margin-right: auto;
}

body.wod-v5 .wod-toprank .tr-marquee__label {
    margin-bottom: 0;
    text-align: center;
}

body.wod-v5 .wod-toprank .tr-marquee__viewport {
    overflow: hidden;
    padding: 4px 0 8px;
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 7%, #000 93%, transparent);
    mask-image: linear-gradient(90deg, transparent, #000 7%, #000 93%, transparent);
}

body.wod-v5 .wod-toprank .tr-marquee__track {
    display: flex;
    gap: 10px;
    width: max-content;
    animation: trMarqueeLeft var(--marquee-time, 40s) linear infinite;
}

body.wod-v5 .wod-toprank .tr-marquee__track--right {
    animation-name: trMarqueeRight;
}

body.wod-v5 .wod-toprank .tr-marquee:hover .tr-marquee__track {
    animation-play-state: paused;
}

body.wod-v5 .wod-toprank.is-drawing .tr-marquee__track {
    animation-duration: calc(var(--marquee-time, 40s) / 5);
    animation-play-state: running;
}

/* A contestant: a small card */
body.wod-v5 .wod-toprank .tr-chip {
    position: relative;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    width: 104px;
    overflow: hidden;
    border: 1px solid var(--h-line);
    border-radius: 16px;
    background: var(--h-surface);
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.08);
    transition: opacity 0.3s ease, border-color 0.3s ease, filter 0.3s ease;
}

body.wod-v5 .wod-toprank .tr-chip .tr-avatar {
    width: 100%;
    height: 84px;
    border-radius: 0;
    font-size: 2rem;
}

body.wod-v5 .wod-toprank .tr-chip__name {
    padding: 6px 8px 7px;
    overflow: hidden;
    font-size: 0.92rem;
    font-weight: 700;
    text-align: center;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--h-text);
}

body.wod-v5 .wod-toprank .tr-chip__tag {
    position: absolute;
    top: 6px;
    left: 6px;
    padding: 3px 8px;
    border-radius: 999px;
    background: var(--h-yellow);
    color: var(--h-ink);
    font-size: 0.78rem;
    font-weight: 800;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

body.wod-v5 .wod-toprank .tr-chip.is-winner {
    border-color: var(--h-yellow);
    box-shadow: 0 0 0 2px var(--h-yellow), 0 6px 14px rgba(0, 0, 0, 0.08);
}

body.wod-v5 .wod-toprank .tr-chip.is-out {
    opacity: 0.4;
    filter: grayscale(0.7);
}

/* Few contestants / reduced motion: a still, wrapped row */
body.wod-v5 .wod-toprank .tr-marquee.is-static .tr-marquee__viewport {
    -webkit-mask-image: none;
    mask-image: none;
}

body.wod-v5 .wod-toprank .tr-marquee.is-static .tr-marquee__track {
    flex-wrap: wrap;
    justify-content: center;
    width: auto;
    animation: none;
}

/* ==========================================================================
   ENTRIES DIALOG (upload, rename, place)
   ========================================================================== */
body.wod-v5 .tr-entries-modal {
    width: min(720px, calc(100vw - 32px));
}

body.wod-v5 .tr-entries-modal .entries-modal__box {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: calc(100svh - 32px);
}

body.wod-v5 .tr-entries-modal .entries-modal__head {
    margin-bottom: 4px;
}

body.wod-v5 .tr-entries-modal.is-dragover .entries-modal__box {
    outline: 3px dashed var(--h-yellow);
    outline-offset: -10px;
}

body.wod-v5 .tr-entries-modal .tr-drop {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 18px 20px;
    border: 2px dashed color-mix(in srgb, var(--h-yellow) 60%, var(--h-line));
    border-radius: 22px;
    background: color-mix(in srgb, var(--h-yellow) 7%, var(--h-surface-2));
    color: var(--h-text);
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease;
}

body.wod-v5 .tr-entries-modal .tr-drop:hover,
body.wod-v5 .tr-entries-modal.is-dragover .tr-drop {
    border-color: var(--h-yellow);
    background: color-mix(in srgb, var(--h-yellow) 14%, var(--h-surface-2));
}

body.wod-v5 .tr-entries-modal .tr-drop:focus-visible {
    outline: 3px solid var(--h-yellow);
    outline-offset: 3px;
}

body.wod-v5 .tr-entries-modal .tr-drop__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 52px;
    height: 52px;
    border-radius: 16px;
    background: var(--h-yellow);
    color: var(--h-ink);
}

body.wod-v5 .tr-entries-modal .tr-drop__text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 1.1rem;
}

body.wod-v5 .tr-entries-modal .tr-drop__text u {
    text-decoration-color: var(--h-yellow);
    text-decoration-thickness: 2px;
    text-underline-offset: 3px;
}

body.wod-v5 .tr-entries-modal .tr-drop__text small {
    font-size: 0.92rem;
    color: var(--h-muted);
}

body.wod-v5 .tr-entries-modal .tr-add {
    display: flex;
    gap: 8px;
}

body.wod-v5 .tr-entries-modal .tr-input,
body.wod-v5 .tr-entries-modal textarea.tr-input {
    width: 100%;
    min-width: 0;
    padding: 12px 18px;
    border: 1px solid var(--h-line);
    border-radius: 999px;
    background: var(--h-surface-2);
    color: var(--h-text);
    font-family: var(--h-font);
    font-size: 1.05rem;
    font-weight: 600;
    outline: none;
}

body.wod-v5 .tr-entries-modal textarea.tr-input {
    border-radius: 18px;
    resize: vertical;
}

body.wod-v5 .tr-entries-modal .tr-input:focus {
    border-color: var(--h-yellow);
    box-shadow: 0 0 0 4px rgba(255, 190, 77, 0.18);
}

body.wod-v5 .tr-entries-modal .tr-add__btn {
    flex-shrink: 0;
    padding: 11px 22px;
    border: 1px solid var(--h-yellow);
    border-radius: 999px;
    background: var(--h-yellow);
    color: var(--h-ink);
    font-family: var(--h-font);
    font-size: 1.05rem;
    font-weight: 800;
    cursor: pointer;
}

body.wod-v5 .tr-entries-modal .tr-add-tools {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

body.wod-v5 .tr-entries-modal .tr-tool-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 16px;
    border: 1px solid var(--h-line);
    border-radius: 999px;
    background: var(--h-surface-2);
    color: var(--h-text);
    font-family: var(--h-font);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
}

body.wod-v5 .tr-entries-modal .tr-tool-btn:hover,
body.wod-v5 .tr-entries-modal .tr-tool-btn[aria-expanded="true"] {
    border-color: var(--h-yellow);
}

body.wod-v5 .tr-entries-modal .tr-tool-btn--quiet {
    margin-left: auto;
    background: transparent;
    color: var(--h-muted);
}

body.wod-v5 .tr-entries-modal .tr-tool-btn--quiet:hover {
    border-color: var(--h-coral);
    color: var(--h-coral);
}

body.wod-v5 .tr-entries-modal .tr-paste {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

body.wod-v5 .tr-entries-modal .tr-paste[hidden] {
    display: none;
}

body.wod-v5 .tr-entries-modal .tr-paste .tr-add__btn {
    align-self: flex-end;
}

body.wod-v5 .tr-entries-modal .tr-msg {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--h-muted);
}

body.wod-v5 .tr-entries-modal .tr-msg:empty {
    display: none;
}

body.wod-v5 .tr-entries-modal .tr-msg.is-error {
    color: var(--h-coral);
}

body.wod-v5 .tr-entries-modal .tr-hint {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--h-muted);
}

/* The list: picture | name | place | remove */
body.wod-v5 .tr-entries-modal .tr-entries {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1 1 auto;
    min-height: 120px;
    max-height: 46vh;
    margin: 0;
    padding: 6px;
    overflow-y: auto;
    list-style: none;
    border: 1px solid var(--h-line);
    border-radius: 20px;
    background: var(--h-surface-2);
    scrollbar-width: thin;
    scrollbar-color: var(--h-yellow) transparent;
}

body.wod-v5 .tr-entries-modal .tr-entries:empty::before {
    content: 'No entries yet. Upload pictures or type a name.';
    padding: 22px;
    text-align: center;
    font-weight: 700;
    color: var(--h-muted);
}

body.wod-v5 .tr-entries-modal .tr-entry {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) minmax(0, 170px) auto;
    align-items: center;
    gap: 10px;
    padding: 6px 8px 6px 6px;
    border: 1px solid transparent;
    border-radius: 14px;
    background: var(--h-surface);
}

body.wod-v5 .tr-entries-modal .tr-entry.is-placed {
    border-color: color-mix(in srgb, var(--h-yellow) 55%, transparent);
}

body.wod-v5 .tr-entries-modal .tr-entry__pic {
    position: relative;
    padding: 0;
    border: 0;
    border-radius: 12px;
    background: none;
    cursor: pointer;
}

body.wod-v5 .tr-entries-modal .tr-entry__pic .tr-avatar {
    --av: 52px;
}

/* Plus badge: add / change the picture */
body.wod-v5 .tr-entries-modal .tr-entry__pic::after {
    content: '';
    position: absolute;
    right: -4px;
    bottom: -4px;
    width: 20px;
    height: 20px;
    border: 2px solid var(--h-surface);
    border-radius: 50%;
    background: var(--h-ink) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ffbe4d' stroke-width='2.6' stroke-linecap='round'%3E%3Cpath d='M12 5v14M5 12h14'/%3E%3C/svg%3E") center / 12px no-repeat;
}

body.wod-v5 .tr-entries-modal .tr-entry__name {
    width: 100%;
    min-width: 0;
    padding: 9px 10px;
    border: 1px solid transparent;
    border-radius: 10px;
    background: transparent;
    color: var(--h-text);
    font-family: var(--h-font);
    font-size: 1.05rem;
    font-weight: 700;
    outline: none;
}

body.wod-v5 .tr-entries-modal .tr-entry__name:hover {
    border-color: var(--h-line);
}

body.wod-v5 .tr-entries-modal .tr-entry__name:focus {
    border-color: var(--h-yellow);
    background: var(--h-surface-2);
}

body.wod-v5 .tr-entries-modal .tr-entry__place {
    width: 100%;
    min-width: 0;
    padding: 9px 34px 9px 14px;
    border: 1px solid var(--h-line);
    border-radius: 999px;
    background: var(--h-surface-2) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") right 12px center / 14px no-repeat;
    color: var(--h-text);
    font-family: var(--h-font);
    font-size: 0.98rem;
    font-weight: 700;
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
}

body.wod-v5 .tr-entries-modal .tr-entry.is-placed .tr-entry__place {
    border-color: var(--h-yellow);
    background-color: color-mix(in srgb, var(--h-yellow) 18%, var(--h-surface-2));
}

body.wod-v5 .tr-entries-modal .tr-entry__place option {
    background: var(--h-surface);
    color: var(--h-text);
}

body.wod-v5 .tr-entries-modal .tr-entry__remove {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--h-muted);
    cursor: pointer;
}

body.wod-v5 .tr-entries-modal .tr-entry__remove:hover {
    background: color-mix(in srgb, var(--h-coral) 18%, transparent);
    color: var(--h-coral);
}

body.wod-v5 .tr-entries-modal .tr-entry__pic:focus-visible,
body.wod-v5 .tr-entries-modal .tr-entry__place:focus-visible,
body.wod-v5 .tr-entries-modal .tr-entry__remove:focus-visible,
body.wod-v5 .tr-entries-modal .tr-tool-btn:focus-visible,
body.wod-v5 .tr-entries-modal .tr-add__btn:focus-visible,
body.wod-v5 .wod-toprank .tr-saved__open:focus-visible,
body.wod-v5 .wod-toprank .tr-saved__del:focus-visible {
    outline: 3px solid var(--h-yellow);
    outline-offset: 2px;
}

body.wod-v5 .tr-entries-modal .entries-modal__foot {
    margin-top: 4px;
}

/* ==========================================================================
   SHOW VIEW (the generated page)
   ========================================================================== */
body.wod-v5 .wod-toprank .tr-show {
    max-width: 1280px;
    margin: 0 auto;
}

body.wod-v5 .wod-toprank .tr-show__center {
    position: relative;
}

body.wod-v5 .wod-toprank .tr-show__bar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 12px;
}

body.wod-v5 .wod-toprank .tr-show__spacer {
    flex: 1;
}

body.wod-v5 .wod-toprank .tr-bar-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 48px;
    padding: 0 18px 0 12px;
    border: 1px solid var(--h-line);
    border-radius: 999px;
    background: var(--h-surface);
    color: var(--h-text);
    font-family: var(--h-font);
    font-size: 1.02rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

body.wod-v5 .wod-toprank .tr-bar-btn--icon {
    width: 48px;
    padding: 0;
}

body.wod-v5 .wod-toprank .tr-bar-btn:hover {
    border-color: var(--h-yellow);
    background: var(--h-yellow);
    color: var(--h-ink);
}

body.wod-v5 .wod-toprank .tr-bar-btn:focus-visible {
    outline: 3px solid var(--h-yellow);
    outline-offset: 3px;
}

body.wod-v5 .wod-toprank .tr-bar-btn[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    top: calc(100% + 8px);
    left: 50%;
    z-index: 5;
    padding: 6px 10px;
    border: 1px solid var(--h-line);
    border-radius: 8px;
    background: var(--h-surface);
    color: var(--h-text);
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
    opacity: 0;
    transform: translateX(-50%);
    pointer-events: none;
    transition: opacity 0.2s ease;
}

body.wod-v5 .wod-toprank .tr-bar-btn[data-tooltip]:hover::after,
body.wod-v5 .wod-toprank .tr-bar-btn[data-tooltip]:focus-visible::after {
    opacity: 1;
}

body.wod-v5 .wod-toprank .tr-show__head {
    margin: 0 0 26px;
    text-align: center;
}

body.wod-v5 .wod-toprank .tr-show__title {
    margin: 10px 0 0;
    font-size: clamp(2.4rem, 1.6rem + 3.4vw, 4.4rem);
    font-weight: 800;
    line-height: 1.02;
    letter-spacing: -0.04em;
    overflow-wrap: anywhere;
    color: var(--h-text);
}

body.wod-v5 .wod-toprank.is-done .tr-show__title {
    animation: trPop 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}

body.wod-v5 .wod-toprank .tr-show .tr-ranks {
    position: relative;
    padding: 26px 22px 0;
    border: 1px solid var(--h-line);
    border-bottom: 0;
    border-radius: 32px 32px 0 0;
    background:
        radial-gradient(70% 60% at 50% 0%, color-mix(in srgb, var(--h-yellow) 16%, transparent), transparent 70%),
        var(--h-surface);
    box-shadow: var(--h-shadow);
    overflow: hidden;
}

body.wod-v5 .wod-toprank .tr-show .tr-ranks::before {
    content: '';
    position: absolute;
    inset: 0 0 auto;
    height: 4px;
    background: linear-gradient(90deg, var(--h-yellow), var(--h-coral), var(--h-violet));
}

/* With places below the podium, the board gets a bottom edge */
body.wod-v5 .wod-toprank .tr-show .tr-ranks:has(.tr-rest) {
    padding-bottom: 22px;
    border-bottom: 1px solid var(--h-line);
    border-radius: 32px;
}

body.wod-v5 .wod-toprank.is-done .tr-show .tr-ranks {
    border-color: var(--h-yellow);
    box-shadow: var(--h-shadow), 0 0 0 4px color-mix(in srgb, var(--h-yellow) 30%, transparent);
}

body.wod-v5 .wod-toprank .tr-note {
    margin: 18px 0 0;
    text-align: center;
}

body.wod-v5 .wod-toprank .tr-show .tr-controls {
    margin-top: 18px;
}

/* Fullscreen: the show view fills the screen; cards sized by the screen height */
body.wod-v5 .wod-toprank .tr-show__center.fullscreen-mode {
    position: fixed;
    inset: 0;
    z-index: 100000;
    padding: 16px clamp(16px, 3vw, 40px);
    overflow: auto;
    background:
        radial-gradient(48rem 32rem at 82% 10%, rgba(139, 108, 255, 0.16), transparent 70%),
        radial-gradient(40rem 28rem at 6% 0%, rgba(255, 190, 77, 0.2), transparent 70%),
        var(--h-bg);
}

body.wod-v5 .wod-toprank .fullscreen-mode .tr-show__bar {
    margin-bottom: 0;
}

body.wod-v5 .wod-toprank .fullscreen-mode .tr-show__head {
    margin: -40px 0 12px;
}

body.wod-v5 .wod-toprank .fullscreen-mode .tr-show__title {
    margin-top: 4px;
    font-size: clamp(1.8rem, 5vh, 3.4rem);
}

body.wod-v5 .wod-toprank .fullscreen-mode .tr-card {
    --w: clamp(84px, 13vh, 170px);
}

body.wod-v5 .wod-toprank .fullscreen-mode .tr-rank--1 .tr-card {
    --w: clamp(100px, 16vh, 210px);
}

body.wod-v5 .wod-toprank .fullscreen-mode .tr-rest .tr-card {
    --w: clamp(70px, 9vh, 120px);
}

body.wod-v5 .wod-toprank .fullscreen-mode .tr-note {
    margin-top: 8px;
}

body.wod-v5 .wod-toprank .fullscreen-mode .tr-controls {
    margin-top: 10px;
}

body.wod-v5 .wod-toprank .fullscreen-mode .tr-marquee {
    margin-top: 10px;
}

/* ==========================================================================
   PANELS (past rankings, statistics)
   ========================================================================== */
@media (min-width: 1100px) {
    body.wod-v5 .wod-toprank .tr-panels {
        grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
    }
}

body.wod-v5 .wod-toprank .tr-past {
    padding: 14px 0;
    border-top: 1px solid var(--h-line);
}

body.wod-v5 .wod-toprank .tr-past:first-child {
    padding-top: 0;
    border-top: 0;
}

body.wod-v5 .wod-toprank .tr-past__when {
    margin: 0 0 8px;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--h-muted);
}

body.wod-v5 .wod-toprank .tr-past__when b {
    color: var(--h-text);
}

body.wod-v5 .wod-toprank .tr-past__row {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin: 0 0 4px;
    font-size: 1.05rem;
    color: var(--h-text);
}

body.wod-v5 .wod-toprank .tr-past__rank {
    flex-shrink: 0;
    min-width: 4.4em;
    font-weight: 800;
}

body.wod-v5 .wod-toprank .tr-past__names {
    min-width: 0;
    font-weight: 600;
    overflow-wrap: anywhere;
}

/* ==========================================================================
   WINNER POP-UP (homepage .result-modal + a big card, names roll first)
   ========================================================================== */
body.wod-v5 .tr-result .tr-result__card {
    display: flex;
    justify-content: center;
    margin: 4px auto 22px;
}

body.wod-v5 .tr-result .tr-result__card:empty {
    display: none;
}

body.wod-v5 .tr-result .tr-result__card .tr-avatar {
    --av: 190px;
    height: calc(var(--av) * 1.2);
    border-radius: 26px;
    font-size: 4rem;
    box-shadow:
        0 0 0 6px var(--h-surface),
        0 0 0 9px var(--medal, var(--h-yellow)),
        0 24px 60px rgba(255, 190, 77, 0.35);
}

body.wod-v5 .tr-result .result-eyebrow {
    background: color-mix(in srgb, var(--medal, var(--h-yellow)) 30%, transparent);
}

body.wod-v5 .tr-result .result-eyebrow svg {
    color: var(--h-text);
}

body.wod-v5 .tr-result.is-rolling .tr-result__card .tr-avatar,
body.wod-v5 .tr-result.is-rolling .result-content h2 {
    animation: trRoll 0.09s ease-out;
}

body.wod-v5 .tr-result.is-rolling .result-content h2 {
    background-image: none !important;
    color: var(--h-text);
    -webkit-text-fill-color: currentColor;
    opacity: 0.8;
}

body.wod-v5 .tr-result.is-rolling .result-actions {
    visibility: hidden;
}

body.wod-v5 .tr-result.is-landed .tr-result__card .tr-avatar,
body.wod-v5 .tr-result.is-landed .result-content h2 {
    animation: wodWinner 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

/* Last winner: no "Reveal all", the main button takes the row */
body.wod-v5 .tr-result .result-btn[hidden] {
    display: none;
}

body.wod-v5 .tr-result .result-actions:has(.result-btn[hidden]) {
    grid-template-columns: minmax(0, 1fr);
}

/* Next button: a fill that runs out when it moves on by itself */
body.wod-v5 .tr-result .result-btn--spin {
    position: relative;
    overflow: hidden;
}

body.wod-v5 .tr-result .result-btn--spin > span:not(.tr-result__timer) {
    position: relative;
    z-index: 1;
}

body.wod-v5 .tr-result .tr-result__timer {
    position: absolute;
    inset: 0;
    z-index: 0;
    background: rgba(255, 255, 255, 0.4);
    transform-origin: left;
    transform: scaleX(0);
}

body.wod-v5 .tr-result.is-counting .tr-result__timer {
    animation: trTimer var(--auto-time, 4s) linear forwards;
}

body.wod-v5 .tr-result .tr-confetti {
    position: fixed;
    inset: 0;
    z-index: 100004;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */
@media (max-width: 1099.98px) {
    body.wod-v5 .wod-toprank .tr-board,
    body.wod-v5 .wod-toprank .tr-setup-wrap .tr-marquee {
        width: min(700px, 100%);
    }

    /* One column: title, then entries + hide switch, then the preview */
    body.wod-v5 .wod-toprank .tr-side {
        order: 2;
        width: min(700px, 100%);
        margin: 0 auto 28px;
    }

    body.wod-v5 .wod-toprank .tr-setup-wrap {
        order: 3;
    }
}

@media (max-width: 759.98px) {
    body.wod-v5 .wod-toprank .tr-card { --w: 92px; }
    body.wod-v5 .wod-toprank .tr-rank--1 .tr-card { --w: 108px; }
    body.wod-v5 .wod-toprank .tr-rest .tr-card { --w: 74px; }
    body.wod-v5 .wod-toprank .tr-ranks--preview .tr-card { --w: 80px; }
    body.wod-v5 .wod-toprank .tr-ranks--preview .tr-rank--1 .tr-card { --w: 94px; }

    body.wod-v5 .wod-toprank .tr-rank__step {
        min-width: 0;
    }

    body.wod-v5 .wod-toprank .tr-rank__label {
        font-size: 0.78rem;
    }

    body.wod-v5 .wod-toprank .tr-card__tag {
        padding: 3px 7px;
        font-size: 0.7rem;
    }

    body.wod-v5 .wod-toprank .tr-card__name {
        font-size: 0.82rem;
    }

    body.wod-v5 .wod-toprank .tr-show .tr-ranks {
        padding: 18px 10px 0;
        border-radius: 26px 26px 0 0;
    }
}

@media (max-width: 599.98px) {
    body.wod-v5 .wod-toprank .tr-panel {
        padding: 18px 14px 20px;
        border-radius: 26px;
    }

    body.wod-v5 .wod-toprank .tr-options {
        grid-template-columns: minmax(0, 1fr);
    }

    body.wod-v5 .wod-toprank .tr-start {
        width: 100%;
        min-width: 0;
    }

    body.wod-v5 .wod-toprank .tr-podium {
        gap: 6px;
    }

    /* Two winners per place don't fit three across: stack them */
    body.wod-v5 .wod-toprank .tr-podium .tr-rank__cards {
        flex-direction: column;
        flex-wrap: nowrap;
    }

    body.wod-v5 .wod-toprank .tr-bar-btn {
        height: 44px;
    }

    body.wod-v5 .wod-toprank .tr-bar-btn--icon {
        width: 44px;
    }

    body.wod-v5 .tr-entries-modal .tr-entry {
        grid-template-columns: auto minmax(0, 1fr) auto;
    }

    body.wod-v5 .tr-entries-modal .tr-entry__place {
        grid-column: 2 / 3;
    }

    body.wod-v5 .tr-entries-modal .tr-entry__remove {
        grid-row: 1;
        grid-column: 3;
    }

    body.wod-v5 .tr-entries-modal .tr-entry__pic {
        grid-row: 1 / span 2;
    }

    body.wod-v5 .tr-entries-modal .tr-drop {
        padding: 14px;
    }

    body.wod-v5 .tr-result .tr-result__card .tr-avatar {
        --av: 150px;
    }
}

@media (prefers-reduced-motion: reduce) {
    body.wod-v5 .wod-toprank .tr-marquee__track,
    body.wod-v5 .wod-toprank .tr-card,
    body.wod-v5 .wod-toprank .tr-card__back,
    body.wod-v5 .tr-result .tr-avatar,
    body.wod-v5 .tr-result .result-content h2 {
        animation: none !important;
    }

    body.wod-v5 .wod-toprank .tr-card__inner {
        transition-duration: 0.01s;
    }
}

/* ==========================================================================
   ANIMATIONS
   ========================================================================== */
@keyframes trMarqueeLeft {
    from { transform: translateX(0); }
    to { transform: translateX(-50%); }
}

@keyframes trMarqueeRight {
    from { transform: translateX(-50%); }
    to { transform: translateX(0); }
}

@keyframes trPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

@keyframes trGlow {
    0%, 100% { box-shadow: 0 12px 28px rgba(0, 0, 0, 0.25), 0 0 0 0 rgba(255, 190, 77, 0.6); }
    50% { box-shadow: 0 12px 28px rgba(0, 0, 0, 0.25), 0 0 0 8px rgba(255, 190, 77, 0); }
}

@keyframes trPop {
    0% { transform: scale(0.88); }
    100% { transform: scale(1); }
}

@keyframes trRoll {
    from { transform: translateY(-12%); opacity: 0.4; }
    to { transform: none; opacity: 1; }
}

@keyframes trTimer {
    from { transform: scaleX(0); }
    to { transform: scaleX(1); }
}

/* ==========================================================================
   TOP 3 - the special podium (user's reference, 2026-11-03): framed photo
   cards - thick white frame, the photo, a gold / silver / bronze medal
   rosette on the photo, the name + "Champion / Runner-up / Third place"
   below. Runner-up tilts left, third place right; the champion is bigger,
   upright and in front, on a warm glow with a crown and sparkles. Face-down
   cards use the same frame. (Markup: polaroidFaces() / renderPodium() in
   top-rank.js)
   ========================================================================== */
@property --tr-halo {
    syntax: '<angle>';
    inherits: false;
    initial-value: 0deg;
}

body.wod-v5 .wod-toprank .tr-rank--1,
body.wod-v5 .tr-result[data-rank="1"] {
    --metal: linear-gradient(135deg, #fff4c2 0%, #ffd36b 22%, #e9a21f 45%, #fff0a8 62%, #c98612 82%, #ffd978 100%);
    --metal-flat: #ffbe4d;
    --metal-deep: #b87410;
    --ribbon-a: #e5484d;
    --ribbon-b: #b5262b;
}

body.wod-v5 .wod-toprank .tr-rank--2,
body.wod-v5 .tr-result[data-rank="2"] {
    --metal: linear-gradient(135deg, #ffffff 0%, #dfe4ea 22%, #9aa4b2 45%, #f4f6f9 62%, #8c96a5 82%, #e3e8ee 100%);
    --metal-flat: #c3c9d4;
    --metal-deep: #6c7584;
    --ribbon-a: #4c7dff;
    --ribbon-b: #2a55c9;
}

body.wod-v5 .wod-toprank .tr-rank--3,
body.wod-v5 .tr-result[data-rank="3"] {
    --metal: linear-gradient(135deg, #ffe0c7 0%, #f0ae80 22%, #b8663a 45%, #f7c39d 62%, #a3572c 82%, #eaa577 100%);
    --metal-flat: #e39a6b;
    --metal-deep: #8a4520;
    --ribbon-a: #2fbf86;
    --ribbon-b: #1d8a5f;
}

/* The podium row: no blocks or medal headers - the cards carry the rank */
body.wod-v5 .wod-toprank .tr-podium {
    position: relative;
    isolation: isolate;
    align-items: center;
    gap: clamp(4px, 1.4vw, 16px);
    padding: 46px 8px 18px;
}

body.wod-v5 .wod-toprank .tr-rank--podium .tr-rank__badge,
body.wod-v5 .wod-toprank .tr-rank--podium .tr-rank__step {
    display: none;
}

body.wod-v5 .wod-toprank .tr-rank--podium {
    position: relative;
}

body.wod-v5 .wod-toprank .tr-rank--1 {
    z-index: 2;
}

/* Warm glow behind the champion, softer light on the others */
body.wod-v5 .wod-toprank .tr-podium::before {
    content: '';
    position: absolute;
    inset: -10px -10% -10px -10%;
    z-index: -1;
    background:
        radial-gradient(30% 62% at 50% 52%, rgba(255, 110, 60, 0.38), transparent 70%),
        radial-gradient(42% 80% at 50% 45%, rgba(255, 196, 77, 0.32), transparent 72%),
        radial-gradient(22% 55% at 24% 55%, rgba(76, 125, 255, 0.12), transparent 70%),
        radial-gradient(22% 55% at 76% 55%, rgba(47, 191, 134, 0.12), transparent 70%);
    pointer-events: none;
}

/* Crown above the champion */
body.wod-v5 .wod-toprank .tr-rank__crown {
    position: absolute;
    top: -44px;
    left: 50%;
    z-index: 3;
    display: flex;
    transform: translateX(-50%) rotate(-8deg);
    filter: drop-shadow(0 4px 10px rgba(255, 170, 40, 0.55));
    animation: trCrown 3.2s ease-in-out infinite;
}

body.wod-v5 .wod-toprank .tr-rank__crown svg {
    fill: #ffcf5c;
    stroke: #b8780f;
    stroke-width: 1.6;
}

/* ---- The framed photo card ---------------------------------------------- */
body.wod-v5 .wod-toprank .tr-card--polaroid {
    --w: 150px;
    aspect-ratio: 4 / 5;
}

body.wod-v5 .wod-toprank .tr-rank--1 .tr-card--polaroid { --w: 188px; }
body.wod-v5 .wod-toprank .tr-ranks--preview .tr-card--polaroid { --w: 112px; }
body.wod-v5 .wod-toprank .tr-ranks--preview .tr-rank--1 .tr-card--polaroid { --w: 138px; }
body.wod-v5 .wod-toprank .fullscreen-mode .tr-card--polaroid { --w: clamp(120px, 17vh, 210px); }
body.wod-v5 .wod-toprank .fullscreen-mode .tr-rank--1 .tr-card--polaroid { --w: clamp(150px, 22vh, 260px); }

/* Tilts: runner-up left, third place right */
body.wod-v5 .wod-toprank .tr-rank--2 .tr-card--polaroid { transform: rotate(-6deg) translateY(14px); }
body.wod-v5 .wod-toprank .tr-rank--3 .tr-card--polaroid { transform: rotate(6deg) translateY(14px); }
body.wod-v5 .wod-toprank .tr-rank--2 .tr-card--polaroid + .tr-card--polaroid { transform: rotate(-2deg) translateY(14px); }
body.wod-v5 .wod-toprank .tr-rank--3 .tr-card--polaroid + .tr-card--polaroid { transform: rotate(2deg) translateY(14px); }

body.wod-v5 .wod-toprank .tr-card--polaroid.is-next {
    animation: none;
}

body.wod-v5 .wod-toprank .tr-card--polaroid .tr-card__face {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 0;
    padding: calc(var(--w) * 0.055) calc(var(--w) * 0.055) 0;
    border: 0;
    border-radius: 14px;
    background: #fffdf8;
    color: #1b1622;
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.9) inset,
        0 18px 36px rgba(20, 12, 4, 0.28),
        0 2px 6px rgba(20, 12, 4, 0.18);
}

body.wod-v5 .wod-toprank .tr-card--polaroid .tr-card__front {
    transform: rotateY(180deg);
}

/* Photo area */
body.wod-v5 .wod-toprank .tr-card--polaroid .tr-card__photo {
    position: relative;
    flex: 1;
    min-height: 0;
    overflow: hidden;
    border-radius: 9px;
    background: radial-gradient(80% 70% at 50% 40%, color-mix(in srgb, var(--metal-flat) 70%, #ffffff), var(--metal-flat));
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
}

body.wod-v5 .wod-toprank .tr-rank--1 .tr-card--polaroid .tr-card__photo {
    background: radial-gradient(80% 70% at 50% 35%, #ffcf5c, #ff6b3d 60%, #d63a2a);
}

body.wod-v5 .wod-toprank .tr-card--polaroid .tr-card__photo .tr-avatar {
    width: 100%;
    height: 100%;
    border-radius: 0;
    font-size: calc(var(--w) * 0.3);
}

/* Face down: the photo area is the patterned back with a "?" */
body.wod-v5 .wod-toprank .tr-card--polaroid .tr-card__photo--back {
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.07) 0 8px, transparent 8px 16px),
        radial-gradient(90% 70% at 50% 35%, color-mix(in srgb, var(--metal-flat) 45%, #1a1724), #110f18);
    color: var(--metal-flat);
}

body.wod-v5 .wod-toprank .tr-card--polaroid .tr-card__q {
    font-size: calc(var(--w) * 0.36);
    font-weight: 800;
    line-height: 1;
    background: var(--metal);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    text-shadow: none;
    filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.45));
}

/* Shine sweeping over the face-down photo */
body.wod-v5 .wod-toprank .tr-card--polaroid .tr-card__photo--back::after {
    content: '';
    position: absolute;
    inset: -30%;
    background: linear-gradient(115deg, transparent 42%, rgba(255, 255, 255, 0.26) 50%, transparent 58%);
    transform: translateX(-70%);
    animation: trShine 5s ease-in-out infinite;
    pointer-events: none;
}

body.wod-v5 .wod-toprank .tr-rank--2 .tr-card__photo--back::after { animation-delay: 0.6s; }
body.wod-v5 .wod-toprank .tr-rank--3 .tr-card__photo--back::after { animation-delay: 1.2s; }

/* Caption under the photo: name + title */
body.wod-v5 .wod-toprank .tr-card--polaroid .tr-card__caption {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1px;
    flex: none;
    height: calc(var(--w) * 0.33);
    padding: calc(var(--w) * 0.06) 4px calc(var(--w) * 0.02);
    text-align: center;
}

body.wod-v5 .wod-toprank .tr-card--polaroid .tr-card__caption b {
    max-width: 100%;
    overflow: hidden;
    font-size: calc(var(--w) * 0.105);
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: -0.01em;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #1b1622;
}

body.wod-v5 .wod-toprank .tr-card--polaroid .tr-card__back .tr-card__caption b {
    color: #8a8494;
}

body.wod-v5 .wod-toprank .tr-card--polaroid .tr-card__caption small {
    font-size: max(11px, calc(var(--w) * 0.068));
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--metal-deep);
}

/* Medal on the photo's bottom-left corner: the coin (.tr-rosette__num) with two ribbon tails
   hanging down from behind it (notched ends), ending around the photo's bottom edge */
body.wod-v5 .wod-toprank .tr-rosette {
    --r: calc(var(--w) * 0.26);
    position: absolute;
    left: calc(var(--w) * 0.08);
    bottom: calc(var(--w) * 0.33 + var(--r) * 0.42);
    z-index: 2;
    width: var(--r);
    height: var(--r);
}

/* The two tails, from the middle of the coin downward, slightly apart */
body.wod-v5 .wod-toprank .tr-rosette::before,
body.wod-v5 .wod-toprank .tr-rosette::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: 0;
    width: 38%;
    height: 100%;
    background: linear-gradient(180deg, var(--ribbon-a), var(--ribbon-b));
    box-shadow: inset -2px 0 0 rgba(0, 0, 0, 0.12);
    clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 78%, 0 100%);
    transform-origin: 50% 0;
}

body.wod-v5 .wod-toprank .tr-rosette::before {
    transform: translateX(-88%) rotate(16deg);
}

body.wod-v5 .wod-toprank .tr-rosette::after {
    transform: translateX(-12%) rotate(-16deg);
}

/* The coin, in front of the tails */
body.wod-v5 .wod-toprank .tr-rosette__num {
    position: absolute;
    inset: 0;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--metal);
    box-shadow:
        0 0 0 3px #fffdf8,
        inset 0 0 0 3px rgba(255, 255, 255, 0.5),
        inset 0 -3px 0 rgba(0, 0, 0, 0.18),
        0 6px 14px rgba(0, 0, 0, 0.3);
    font-size: calc(var(--r) * 0.5);
    font-weight: 800;
    line-height: 1;
    color: #3a2706;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.6);
}

body.wod-v5 .wod-toprank .tr-rank--2 .tr-rosette__num { color: #3a414c; }
body.wod-v5 .wod-toprank .tr-rank--3 .tr-rosette__num { color: #4a230c; }

/* Champion: a slowly turning warm halo, brighter once revealed */
body.wod-v5 .wod-toprank .tr-rank--1 .tr-card--polaroid::before {
    content: '';
    position: absolute;
    inset: -12px;
    z-index: -1;
    border-radius: 26px;
    background: conic-gradient(from var(--tr-halo), #ffbe4d, #ff6b3d, #fff1b8, #ff7a59, #ffbe4d);
    filter: blur(16px);
    opacity: 0.6;
    animation: trHalo 6s linear infinite;
}

body.wod-v5 .wod-toprank .tr-rank--1 .tr-card--polaroid.is-flipped::before {
    opacity: 0.95;
}

/* Being drawn: the frame glows */
body.wod-v5 .wod-toprank .tr-card--polaroid.is-next .tr-card__back {
    animation: trGlow 0.9s ease-in-out infinite;
}

/* Sparkles around the champion */
body.wod-v5 .wod-toprank .tr-spark {
    position: absolute;
    z-index: 3;
    width: 14px;
    height: 14px;
    background: #ffd36b;
    clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%);
    filter: drop-shadow(0 0 6px rgba(255, 210, 100, 0.9));
    opacity: 0;
    animation: trTwinkle 2.6s ease-in-out infinite;
    pointer-events: none;
}

body.wod-v5 .wod-toprank .tr-spark--0 { top: 6%; left: -16px; animation-delay: 0s; }
body.wod-v5 .wod-toprank .tr-spark--1 { top: 18%; right: -18px; width: 18px; height: 18px; animation-delay: 0.7s; }
body.wod-v5 .wod-toprank .tr-spark--2 { top: 56%; left: -22px; width: 10px; height: 10px; animation-delay: 1.3s; }
body.wod-v5 .wod-toprank .tr-spark--3 { top: 70%; right: -14px; width: 12px; height: 12px; animation-delay: 1.9s; }
body.wod-v5 .wod-toprank .tr-spark--4 { top: -14px; right: 12%; width: 10px; height: 10px; animation-delay: 1s; }

/* Show board: no open bottom edge needed without the blocks */
body.wod-v5 .wod-toprank .tr-show .tr-ranks {
    padding-bottom: 30px;
    border-bottom: 1px solid var(--h-line);
    border-radius: 32px;
}

/* ---- Winner pop-up for the top 3: framed photo, rosette colours, crown ---- */
body.wod-v5 .tr-result[data-rank="1"] .tr-result__card,
body.wod-v5 .tr-result[data-rank="2"] .tr-result__card,
body.wod-v5 .tr-result[data-rank="3"] .tr-result__card {
    position: relative;
}

body.wod-v5 .tr-result[data-rank="1"] .tr-result__card .tr-avatar,
body.wod-v5 .tr-result[data-rank="2"] .tr-result__card .tr-avatar,
body.wod-v5 .tr-result[data-rank="3"] .tr-result__card .tr-avatar {
    border: 10px solid #fffdf8;
    border-radius: 18px;
    box-shadow: 0 0 0 3px var(--metal-flat), 0 24px 60px color-mix(in srgb, var(--metal-flat) 45%, transparent);
}

body.wod-v5 .tr-result[data-rank="1"] .tr-result__card .tr-avatar {
    box-shadow: 0 0 0 3px var(--metal-flat), 0 0 60px 14px rgba(255, 120, 60, 0.4), 0 24px 60px rgba(255, 170, 40, 0.4);
}

body.wod-v5 .tr-result[data-rank="1"] .tr-result__card::before {
    content: '';
    position: absolute;
    top: -42px;
    left: 50%;
    z-index: 2;
    width: 64px;
    height: 54px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23ffcf5c' stroke='%23b8780f' stroke-width='1.4' stroke-linejoin='round'%3E%3Cpath d='M11.562 3.266a.5.5 0 0 1 .876 0L15.39 8.87a1 1 0 0 0 1.516.294L21.183 5.5a.5.5 0 0 1 .798.519l-2.834 10.246a1 1 0 0 1-.956.734H5.81a1 1 0 0 1-.957-.734L2.02 6.02a.5.5 0 0 1 .798-.519l4.276 3.664a1 1 0 0 0 1.516-.294z'/%3E%3C/svg%3E") center / contain no-repeat;
    filter: drop-shadow(0 4px 10px rgba(255, 170, 40, 0.6));
    transform: translateX(-50%) rotate(-8deg);
}

body.wod-v5 .tr-result.is-rolling[data-rank="1"] .tr-result__card::before {
    opacity: 0;
}

body.wod-v5 .tr-result.is-landed[data-rank="1"] .tr-result__card::before {
    animation: trCrownDrop 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

body.wod-v5 .tr-result[data-rank="1"] .result-eyebrow,
body.wod-v5 .tr-result[data-rank="2"] .result-eyebrow,
body.wod-v5 .tr-result[data-rank="3"] .result-eyebrow {
    background: var(--metal);
    color: #241806 !important;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.45);
}

body.wod-v5 .tr-result[data-rank="1"] .result-eyebrow svg,
body.wod-v5 .tr-result[data-rank="2"] .result-eyebrow svg,
body.wod-v5 .tr-result[data-rank="3"] .result-eyebrow svg {
    color: #241806;
}

body.wod-v5 .tr-result[data-rank="1"] .result-content {
    border-color: rgba(255, 190, 77, 0.6);
}

/* Phones: three cards across */
@media (max-width: 599.98px) {
    body.wod-v5 .wod-toprank .tr-card--polaroid,
    body.wod-v5 .wod-toprank .tr-ranks--preview .tr-card--polaroid { --w: 96px; }
    body.wod-v5 .wod-toprank .tr-rank--1 .tr-card--polaroid,
    body.wod-v5 .wod-toprank .tr-ranks--preview .tr-rank--1 .tr-card--polaroid { --w: 118px; }

    body.wod-v5 .wod-toprank .tr-podium {
        gap: 2px;
        padding-top: 40px;
    }

    body.wod-v5 .wod-toprank .tr-podium .tr-rank__cards {
        flex-direction: column;
        flex-wrap: nowrap;
        gap: 14px;
    }
}

@media (prefers-reduced-motion: reduce) {
    body.wod-v5 .wod-toprank .tr-rank__crown,
    body.wod-v5 .wod-toprank .tr-rank--1 .tr-card--polaroid::before,
    body.wod-v5 .wod-toprank .tr-card--polaroid .tr-card__photo--back::after,
    body.wod-v5 .wod-toprank .tr-spark,
    body.wod-v5 .tr-result[data-rank="1"] .tr-result__card::before {
        animation: none !important;
    }

    body.wod-v5 .wod-toprank .tr-spark {
        opacity: 0.8;
    }
}

@keyframes trHalo {
    to { --tr-halo: 360deg; }
}

@keyframes trShine {
    0%, 55% { transform: translateX(-70%); }
    85%, 100% { transform: translateX(70%); }
}

@keyframes trTwinkle {
    0%, 100% { opacity: 0; transform: scale(0.4) rotate(0deg); }
    50% { opacity: 1; transform: scale(1) rotate(45deg); }
}

@keyframes trCrown {
    0%, 100% { transform: translateX(-50%) rotate(-8deg) translateY(0); }
    50% { transform: translateX(-50%) rotate(-4deg) translateY(-4px); }
}

@keyframes trCrownDrop {
    from { opacity: 0; transform: translateX(-50%) translateY(-24px) rotate(-30deg) scale(0.6); }
    to { opacity: 1; transform: translateX(-50%) rotate(-8deg); }
}

/* ==========================================================================
   PRESENTING (user's request, 2026-11-03): fullscreen shows only the board -
   no buttons; Space / Enter / -> / Page Down (a clicker) reveal. The audience
   screen (?show=ID&screen=1, body.tr-screen) is a second window with only the
   board; the host's page drives it.
   ========================================================================== */
body.wod-v5 .wod-toprank .fullscreen-mode .tr-show__bar,
body.wod-v5 .wod-toprank .fullscreen-mode .tr-controls,
body.wod-v5 .wod-toprank .fullscreen-mode .tr-note {
    display: none;
}

body.wod-v5 .wod-toprank .fullscreen-mode .tr-show__head {
    margin: 4px 0 14px;
}

/* Key hint: a pill along the bottom that fades away */
body.wod-v5 .wod-toprank .tr-keyhint {
    position: fixed;
    left: 50%;
    bottom: 22px;
    z-index: 100002;
    max-width: calc(100vw - 32px);
    margin: 0;
    padding: 10px 18px;
    border: 1px solid var(--h-line);
    border-radius: 999px;
    background: color-mix(in srgb, var(--h-surface) 92%, transparent);
    box-shadow: var(--h-shadow);
    color: var(--h-text);
    font-size: 0.98rem;
    font-weight: 700;
    text-align: center;
    opacity: 0;
    transform: translate(-50%, 10px);
    transition: opacity 0.4s ease, transform 0.4s ease;
    pointer-events: none;
}

body.wod-v5 .wod-toprank .tr-keyhint.is-on {
    opacity: 1;
    transform: translate(-50%, 0);
}

body.wod-v5 .wod-toprank .tr-keyhint:empty {
    display: none;
}

/* Audience screen button */
body.wod-v5 .wod-toprank .tr-bar-btn--screen {
    padding: 0 18px 0 14px;
}

body.wod-v5 .wod-toprank .tr-bar-btn--screen[hidden] {
    display: none;
}

@media (max-width: 599.98px) {
    /* A second screen is a desktop thing */
    body.wod-v5 .wod-toprank .tr-bar-btn--screen {
        display: none;
    }
}

/* ---- The audience window ------------------------------------------------- */
body.wod-v5.tr-screen .nav-v5,
body.wod-v5.tr-screen .nav-v5__burger,
body.wod-v5.tr-screen .site-footer,
body.wod-v5.tr-screen .cookie-consent-banner,
body.wod-v5.tr-screen .wod-ad,
body.wod-v5.tr-screen .tr-panels,
body.wod-v5.tr-screen .tool-guide,
body.wod-v5.tr-screen .wod-toprank .tr-show__bar,
body.wod-v5.tr-screen .wod-toprank .tr-controls,
body.wod-v5.tr-screen .wod-toprank .tr-note,
body.wod-v5.tr-screen .tr-result .result-close {
    display: none !important;
}

body.wod-v5.tr-screen {
    overflow-x: hidden;
}

body.wod-v5.tr-screen .wod-toprank {
    min-height: 100vh;
    padding: 18px clamp(16px, 3vw, 40px);
}

body.wod-v5.tr-screen .wod-toprank .tr-show {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: calc(100vh - 36px);
    max-width: none;
}

body.wod-v5.tr-screen .wod-toprank .tr-show__head {
    margin: 0 0 14px;
}

body.wod-v5.tr-screen .wod-toprank .tr-show__title {
    font-size: clamp(2rem, 6vh, 4.4rem);
}

body.wod-v5.tr-screen .wod-toprank .tr-card {
    --w: clamp(84px, 13vh, 170px);
}

body.wod-v5.tr-screen .wod-toprank .tr-card--polaroid {
    --w: clamp(120px, 19vh, 230px);
}

body.wod-v5.tr-screen .wod-toprank .tr-rank--1 .tr-card--polaroid {
    --w: clamp(150px, 24vh, 290px);
}

body.wod-v5.tr-screen .wod-toprank .tr-rest .tr-card {
    --w: clamp(70px, 10vh, 130px);
}

body.wod-v5.tr-screen .wod-toprank .tr-marquee {
    margin-top: 16px;
}

/* User's requests (2026-11-03): no wrapper behind the podium on the ranking page
   (cards sit on the page background), and no contestant marquee on the audience screen */
body.wod-v5 .wod-toprank .tr-show .tr-ranks,
body.wod-v5 .wod-toprank .tr-show .tr-ranks:has(.tr-rest),
body.wod-v5 .wod-toprank.is-done .tr-show .tr-ranks {
    padding: 10px 0 20px;
    border: 0;
    border-radius: 0;
    background: none;
    box-shadow: none;
    overflow: visible;
}

body.wod-v5 .wod-toprank .tr-show .tr-ranks::before {
    content: none;
}

body.wod-v5 .wod-toprank .tr-show .tr-rest {
    border-top-color: color-mix(in srgb, var(--h-text) 12%, transparent);
}

body.wod-v5.tr-screen .wod-toprank .tr-marquee {
    display: none !important;
}

/* Rename the ranking on its page: pencil beside the title, the title edits in place */
body.wod-v5 .wod-toprank .tr-show__titlerow {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 10px;
}

body.wod-v5 .wod-toprank .tr-show__titlerow .tr-show__title {
    margin: 0;
    min-width: 2ch;
    border-radius: 14px;
    outline: none;
}

body.wod-v5 .wod-toprank.is-renaming .tr-show__title {
    padding: 0 12px;
    background: var(--h-surface);
    box-shadow: 0 0 0 3px var(--h-yellow), var(--h-shadow);
    cursor: text;
}

body.wod-v5 .wod-toprank .tr-rename {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 1px solid var(--h-line);
    border-radius: 50%;
    background: var(--h-surface);
    color: var(--h-muted);
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

body.wod-v5 .wod-toprank .tr-rename:hover,
body.wod-v5 .wod-toprank.is-renaming .tr-rename {
    border-color: var(--h-yellow);
    background: var(--h-yellow);
    color: var(--h-ink);
}

body.wod-v5 .wod-toprank .tr-rename:focus-visible {
    outline: 3px solid var(--h-yellow);
    outline-offset: 3px;
}

/* Not while presenting */
body.wod-v5 .wod-toprank .fullscreen-mode .tr-rename,
body.wod-v5.tr-screen .wod-toprank .tr-rename {
    display: none;
}

@media (max-width: 599.98px) {
    body.wod-v5 .wod-toprank .tr-rename {
        width: 38px;
        height: 38px;
    }
}

/* Live selection (user's request, 2026-11-03): on the host's page the contestants become a
   clickable grid - the click is the next winner. Not shown on the audience screen. */
body.wod-v5 .wod-toprank .tr-live-dot {
    display: inline-block;
    flex-shrink: 0;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #e5484d;
    box-shadow: 0 0 0 0 rgba(229, 72, 77, 0.6);
    animation: trLive 1.4s ease-out infinite;
}

body.wod-v5 .wod-toprank .tr-bar-btn--live {
    padding: 0 18px 0 16px;
    gap: 9px;
}

body.wod-v5 .wod-toprank .tr-bar-btn--live:not(.is-on) .tr-live-dot {
    background: var(--h-muted);
    animation: none;
}

body.wod-v5 .wod-toprank .tr-bar-btn--live.is-on {
    border-color: #e5484d;
    background: color-mix(in srgb, #e5484d 12%, var(--h-surface));
    color: var(--h-text);
}

body.wod-v5 .wod-toprank .tr-bar-btn--live.is-on:hover {
    background: color-mix(in srgb, #e5484d 20%, var(--h-surface));
}

body.wod-v5 .wod-toprank .tr-marquee.is-live {
    padding: 18px;
    border: 2px solid color-mix(in srgb, #e5484d 45%, transparent);
    border-radius: 26px;
    background: var(--h-surface);
    box-shadow: var(--h-shadow);
}

body.wod-v5 .wod-toprank .tr-live__label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin: 0 0 14px;
    color: var(--h-text);
    font-size: 1rem;
}

body.wod-v5 .wod-toprank .tr-live__grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
}

body.wod-v5 .wod-toprank .tr-live__pick {
    padding: 0;
    font: inherit;
    text-align: center;
    cursor: pointer;
    transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, opacity 0.2s ease;
}

body.wod-v5 .wod-toprank .tr-live__pick:hover:not(:disabled) {
    transform: translateY(-3px);
    border-color: var(--h-yellow);
    box-shadow: 0 0 0 3px var(--h-yellow), 0 10px 20px rgba(0, 0, 0, 0.12);
}

body.wod-v5 .wod-toprank .tr-live__pick:focus-visible {
    outline: 3px solid var(--h-yellow);
    outline-offset: 3px;
}

body.wod-v5 .wod-toprank .tr-live__pick:disabled {
    opacity: 0.45;
    cursor: default;
}

body.wod-v5.tr-screen .wod-toprank .tr-bar-btn--live {
    display: none;
}

/* Fullscreen on the host's page keeps the picker (it's how the next winner is chosen) */
body.wod-v5 .wod-toprank .fullscreen-mode .tr-marquee.is-live {
    margin-top: 12px;
    padding: 12px;
}

@keyframes trLive {
    0% { box-shadow: 0 0 0 0 rgba(229, 72, 77, 0.6); }
    100% { box-shadow: 0 0 0 10px rgba(229, 72, 77, 0); }
}

@media (prefers-reduced-motion: reduce) {
    body.wod-v5 .wod-toprank .tr-live-dot {
        animation: none;
    }
}

/* Live selection: "click a contestant or [Draw at random]" */
body.wod-v5 .wod-toprank .tr-live__head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 10px 12px;
    margin: 0 0 14px;
}

body.wod-v5 .wod-toprank .tr-live__head .tr-live__label {
    margin: 0;
}

body.wod-v5 .wod-toprank .tr-live__random {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 16px;
    border: 1px solid var(--h-yellow);
    border-radius: 999px;
    background: var(--h-yellow);
    color: var(--h-ink);
    font-family: var(--h-font);
    font-size: 1rem;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 6px 16px rgba(255, 190, 77, 0.35);
    transition: transform 0.15s ease;
}

body.wod-v5 .wod-toprank .tr-live__random:hover {
    transform: translateY(-2px);
}

body.wod-v5 .wod-toprank .tr-live__random:focus-visible {
    outline: 3px solid var(--h-yellow);
    outline-offset: 3px;
}

/* Drawing time (user's request, 2026-11-03): 10 s - 2 min, a slider in the setup and one under
   the reveal button (host only), and a countdown in the pop-up while the names roll */
body.wod-v5 .wod-toprank .tr-drawtime {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

body.wod-v5 .wod-toprank .tr-drawtime__value {
    flex-shrink: 0;
    min-width: 6.5ch;
    padding: 5px 12px;
    border-radius: 999px;
    background: var(--h-surface-2);
    color: var(--h-text);
    font-size: 1rem;
    font-weight: 800;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

/* Brand slider */
body.wod-v5 .wod-toprank .tr-range {
    width: 100%;
    height: 28px;
    margin: 0;
    background: transparent;
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
}

body.wod-v5 .wod-toprank .tr-range::-webkit-slider-runnable-track {
    height: 8px;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--h-yellow), var(--h-coral));
}

body.wod-v5 .wod-toprank .tr-range::-moz-range-track {
    height: 8px;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--h-yellow), var(--h-coral));
}

body.wod-v5 .wod-toprank .tr-range::-webkit-slider-thumb {
    width: 24px;
    height: 24px;
    margin-top: -8px;
    border: 3px solid var(--h-ink);
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.25);
    -webkit-appearance: none;
    appearance: none;
}

body.wod-v5 .wod-toprank .tr-range::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border: 3px solid var(--h-ink);
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.25);
}

body.wod-v5 .wod-toprank .tr-range:focus-visible {
    outline: 3px solid var(--h-yellow);
    outline-offset: 4px;
    border-radius: 999px;
}

/* Live slider under the reveal button */
body.wod-v5 .wod-toprank .tr-drawtime--live {
    justify-content: center;
    width: min(460px, 100%);
    margin: 14px auto 0;
    padding: 10px 16px;
    border: 1px solid var(--h-line);
    border-radius: 999px;
    background: var(--h-surface);
    box-shadow: var(--h-shadow);
}

body.wod-v5 .wod-toprank .tr-drawtime__label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    font-size: 1rem;
    font-weight: 800;
    color: var(--h-text);
    white-space: nowrap;
}

body.wod-v5 .wod-toprank .tr-drawtime--live .tr-range {
    flex: 1;
    min-width: 80px;
}

/* Not on the audience screen or in fullscreen */
body.wod-v5.tr-screen .wod-toprank .tr-drawtime--live,
body.wod-v5 .wod-toprank .fullscreen-mode .tr-drawtime--live {
    display: none;
}

/* Countdown in the pop-up (only while the names roll) */
body.wod-v5 .tr-result .tr-countdown {
    display: none;
    align-items: center;
    gap: 12px;
    width: min(320px, 100%);
    margin: -10px auto 18px;
}

body.wod-v5 .tr-result.is-timing .tr-countdown {
    display: flex;
}

body.wod-v5 .tr-result .tr-countdown__track {
    flex: 1;
    height: 8px;
    overflow: hidden;
    border-radius: 999px;
    background: var(--h-surface-2);
}

body.wod-v5 .tr-result .tr-countdown__bar {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--h-yellow), var(--h-coral));
    transform-origin: left;
}

body.wod-v5 .tr-result.is-timing .tr-countdown__bar {
    animation: trDrain var(--draw-time, 10s) linear forwards;
}

body.wod-v5 .tr-result .tr-countdown__num {
    min-width: 3ch;
    font-size: 1.6rem;
    font-weight: 800;
    line-height: 1;
    text-align: right;
    color: var(--h-text);
    font-variant-numeric: tabular-nums;
}

@keyframes trDrain {
    from { transform: scaleX(1); }
    to { transform: scaleX(0); }
}

/* ==========================================================================
   TOP 3 DRAWS (user's request, 2026-11-03) - in the winner pop-up, while it draws:
   3rd + 2nd = spotlight over a grid of faces (bronze / silver),
   1st = grand reveal (faces circle a gold "?" card, drop out, the champion flies in).
   data-draw on .tr-result: spot | grand | roll (4th and below keep the name roll).
   ========================================================================== */
body.wod-v5 .tr-result .tr-stage {
    display: none;
}

body.wod-v5 .tr-result.is-timing[data-draw="spot"] .tr-stage,
body.wod-v5 .tr-result.is-timing[data-draw="grand"] .tr-stage {
    display: block;
    margin: 0 auto 18px;
}

/* While a special draw runs: no single picture; the title line asks the question */
body.wod-v5 .tr-result.is-timing[data-draw="spot"] .tr-result__card,
body.wod-v5 .tr-result.is-timing[data-draw="grand"] .tr-result__card {
    display: none;
}

body.wod-v5 .tr-result.is-timing[data-draw="spot"] .result-content h2,
body.wod-v5 .tr-result.is-timing[data-draw="grand"] .result-content h2 {
    font-size: clamp(1.6rem, 1.2rem + 1.6vw, 2.4rem);
    animation: none;
}

/* Wider pop-up for the podium draws */
body.wod-v5 .tr-result[data-draw="spot"] .result-content {
    width: min(620px, 100%);
}

body.wod-v5 .tr-result[data-draw="grand"] .result-content {
    width: min(720px, 100%);
}

/* ---- 3rd + 2nd place: spotlight grid ------------------------------------------- */
body.wod-v5 .tr-result .tr-spot {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
    gap: 10px;
    max-height: 46vh;
    padding: 6px;
    overflow: hidden;
}

body.wod-v5 .tr-result .tr-spot--many {
    grid-template-columns: repeat(auto-fill, minmax(68px, 1fr));
}

body.wod-v5 .tr-result .tr-spot__cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    padding: 8px 4px 7px;
    border: 2px solid transparent;
    border-radius: 16px;
    background: var(--h-surface-2);
    opacity: 0.55;
    filter: grayscale(0.5);
    transition: opacity 0.12s ease, filter 0.12s ease, transform 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease;
}

body.wod-v5 .tr-result .tr-spot__cell .tr-avatar {
    --av: 54px;
    border-radius: 14px;
}

body.wod-v5 .tr-result .tr-spot--many .tr-spot__cell .tr-avatar {
    --av: 44px;
}

body.wod-v5 .tr-result .tr-spot__name {
    max-width: 100%;
    overflow: hidden;
    font-size: 0.8rem;
    font-weight: 800;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--h-text);
}

body.wod-v5 .tr-result .tr-spot__cell.is-lit {
    border-color: var(--metal-flat, #e39a6b);
    background: color-mix(in srgb, var(--metal-flat, #e39a6b) 22%, var(--h-surface));
    opacity: 1;
    filter: none;
    transform: scale(1.08);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--metal-flat, #e39a6b) 30%, transparent), 0 10px 26px rgba(227, 154, 107, 0.45);
}

body.wod-v5 .tr-result .tr-spot.is-done .tr-spot__cell:not(.is-won) {
    opacity: 0.25;
}

body.wod-v5 .tr-result .tr-spot__cell.is-won {
    transform: scale(1.18);
    animation: trSpotWin 0.5s ease-in-out infinite alternate;
}

/* ---- 1st place: grand reveal --------------------------------------------- */
body.wod-v5 .tr-result .tr-grand {
    --R: clamp(120px, 26vw, 200px);
    --item: 74px;
    position: relative;
    width: calc(var(--R) * 2 + var(--item) + 20px);
    max-width: 100%;
    aspect-ratio: 1;
    margin: 0 auto;
    border-radius: 50%;
    background: radial-gradient(circle at 50% 50%, rgba(255, 190, 77, 0.28), rgba(214, 58, 42, 0.12) 45%, transparent 70%);
}

body.wod-v5 .tr-result .tr-grand--many {
    --item: 62px;
}

body.wod-v5 .tr-result .tr-grand__rays {
    position: absolute;
    inset: -14%;
    border-radius: 50%;
    background: repeating-conic-gradient(from 0deg, rgba(255, 200, 90, 0.22) 0deg 8deg, transparent 8deg 18deg);
    -webkit-mask-image: radial-gradient(closest-side, #000 35%, transparent 75%);
    mask-image: radial-gradient(closest-side, #000 35%, transparent 75%);
    animation: wodRays 10s linear infinite;
}

body.wod-v5 .tr-result .tr-grand__beam {
    position: absolute;
    top: -30%;
    width: 38%;
    height: 130%;
    background: linear-gradient(180deg, rgba(255, 236, 170, 0.5), transparent 75%);
    filter: blur(6px);
    opacity: 0.6;
    pointer-events: none;
    animation: trBeam 3.2s ease-in-out infinite alternate;
}

body.wod-v5 .tr-result .tr-grand__beam--l {
    left: 4%;
    transform-origin: 50% 0;
    clip-path: polygon(40% 0, 60% 0, 100% 100%, 0 100%);
}

body.wod-v5 .tr-result .tr-grand__beam--r {
    right: 4%;
    transform-origin: 50% 0;
    clip-path: polygon(40% 0, 60% 0, 100% 100%, 0 100%);
    animation-delay: -1.6s;
}

body.wod-v5 .tr-result .tr-grand__ring {
    --spin: 0deg;
    position: absolute;
    inset: 0;
}

body.wod-v5 .tr-result .tr-grand__item {
    position: absolute;
    left: 50%;
    top: 50%;
    width: var(--item);
    transform: translate(-50%, -50%) rotate(calc(var(--a) + var(--spin))) translateY(calc(-1 * var(--R))) rotate(calc(-1 * (var(--a) + var(--spin))));
    transition: opacity 0.6s ease, filter 0.6s ease;
}

body.wod-v5 .tr-result .tr-grand__face {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

body.wod-v5 .tr-result .tr-grand__face .tr-avatar {
    --av: var(--item);
    border: 3px solid #fffdf8;
    border-radius: 50%;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.3);
}

body.wod-v5 .tr-result .tr-grand__name {
    max-width: calc(var(--item) + 30px);
    padding: 2px 8px;
    overflow: hidden;
    border-radius: 999px;
    background: color-mix(in srgb, var(--h-surface) 85%, transparent);
    font-size: 0.78rem;
    font-weight: 800;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--h-text);
}

/* Dropping out */
body.wod-v5 .tr-result .tr-grand__item.is-out {
    opacity: 0;
    filter: grayscale(1) blur(2px);
}

body.wod-v5 .tr-result .tr-grand__item.is-out .tr-grand__face {
    transform: translateY(40px) scale(0.5);
}

/* The champion: glows, then flies into the middle */
body.wod-v5 .tr-result .tr-grand__item.is-chosen .tr-grand__face {
    transform: scale(1.35);
}

body.wod-v5 .tr-result .tr-grand__item.is-chosen .tr-avatar {
    border-color: #ffd36b;
    box-shadow: 0 0 0 4px rgba(255, 190, 77, 0.5), 0 0 40px 10px rgba(255, 190, 77, 0.6);
}

body.wod-v5 .tr-result .tr-grand.is-merge .tr-grand__item.is-chosen {
    transition: transform 0.7s cubic-bezier(0.5, 0, 0.2, 1);
    transform: translate(-50%, -50%) scale(1.6);
}

/* The gold "?" card in the middle */
body.wod-v5 .tr-result .tr-grand__card {
    position: absolute;
    left: 50%;
    top: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: calc(var(--R) * 0.75);
    aspect-ratio: 4 / 5;
    border: 6px solid transparent;
    border-radius: 18px;
    background:
        repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.07) 0 8px, transparent 8px 16px) padding-box,
        radial-gradient(90% 70% at 50% 35%, #5a3a0a, #160f05) padding-box,
        linear-gradient(135deg, #fff4c2 0%, #ffd36b 22%, #e9a21f 45%, #fff0a8 62%, #c98612 82%, #ffd978 100%) border-box;
    box-shadow: 0 0 0 4px rgba(255, 190, 77, 0.25), 0 0 60px 14px rgba(255, 150, 50, 0.45);
    transform: translate(-50%, -50%);
    animation: trGrandPulse 1.2s ease-in-out infinite;
}

body.wod-v5 .tr-result .tr-grand__crown {
    position: absolute;
    top: -34px;
    display: flex;
    transform: rotate(-8deg);
    filter: drop-shadow(0 4px 10px rgba(255, 170, 40, 0.6));
}

body.wod-v5 .tr-result .tr-grand__crown svg {
    fill: #ffcf5c;
    stroke: #b8780f;
    stroke-width: 1.6;
}

body.wod-v5 .tr-result .tr-grand__q {
    font-size: calc(var(--R) * 0.38);
    font-weight: 800;
    line-height: 1;
    background: linear-gradient(135deg, #fff4c2, #ffd36b 30%, #e9a21f 60%, #fff0a8);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.5));
}

body.wod-v5 .tr-result .tr-grand.is-chosen .tr-grand__card {
    animation-duration: 0.45s;
    box-shadow: 0 0 0 6px rgba(255, 190, 77, 0.45), 0 0 90px 30px rgba(255, 170, 40, 0.65);
}

body.wod-v5 .tr-result .tr-grand.is-merge .tr-grand__card {
    opacity: 0;
    transform: translate(-50%, -50%) scale(1.3);
    transition: opacity 0.5s ease 0.2s, transform 0.5s ease 0.2s;
}

/* Champion landing: a bigger burst */
body.wod-v5 .tr-result.is-champion .result-content {
    box-shadow: 0 0 0 4px rgba(255, 190, 77, 0.45), 0 0 120px 30px rgba(255, 150, 50, 0.35), 0 40px 100px rgba(0, 0, 0, 0.45);
}

body.wod-v5 .tr-result.is-champion .result-content h2 {
    font-size: clamp(3rem, 2rem + 5vw, 5.6rem);
}

/* Phones */
@media (max-width: 599.98px) {
    body.wod-v5 .tr-result .tr-grand {
        --R: 34vw;
        --item: 52px;
    }

    body.wod-v5 .tr-result .tr-grand__name {
        display: none;
    }

    body.wod-v5 .tr-result .tr-spot {
        grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
        gap: 6px;
    }

    body.wod-v5 .tr-result .tr-spot__cell .tr-avatar {
        --av: 40px;
    }
}

@media (prefers-reduced-motion: reduce) {
    body.wod-v5 .tr-result .tr-grand__rays,
    body.wod-v5 .tr-result .tr-grand__beam,
    body.wod-v5 .tr-result .tr-grand__card,
    body.wod-v5 .tr-result .tr-spot__cell.is-won {
        animation: none !important;
    }
}

@keyframes trSpotWin {
    from { box-shadow: 0 0 0 4px rgba(227, 154, 107, 0.35), 0 10px 26px rgba(227, 154, 107, 0.45); }
    to { box-shadow: 0 0 0 10px rgba(227, 154, 107, 0.15), 0 14px 36px rgba(227, 154, 107, 0.6); }
}


@keyframes trGrandPulse {
    0%, 100% { transform: translate(-50%, -50%) scale(1); }
    50% { transform: translate(-50%, -50%) scale(1.04); }
}

@keyframes trBeam {
    from { transform: rotate(-12deg); }
    to { transform: rotate(12deg); }
}

/* Audience screen: no countdown in the pop-up (user's request) - only the host sees the time */
body.wod-v5.tr-screen .tr-result .tr-countdown {
    display: none !important;
}

/* Room for the crown above the champion's picture (it overlapped the label) */
body.wod-v5 .tr-result[data-rank="1"] .tr-result__card {
    margin-top: 48px;
}

/* Confetti rain (champion pop-up + ranking complete): over everything, never in the way */
.tr-rain {
    position: fixed;
    inset: 0;
    z-index: 100004;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

/* 2nd place: the same spotlight in silver (darker silver so it shows on the light card) */
body.wod-v5 .tr-result[data-rank="2"] .tr-spot__cell.is-lit {
    border-color: #8c96a5;
    background: color-mix(in srgb, #c3c9d4 30%, var(--h-surface));
    box-shadow: 0 0 0 4px rgba(140, 150, 165, 0.35), 0 10px 26px rgba(110, 120, 140, 0.45);
}

body.wod-v5 .tr-result[data-rank="2"] .tr-spot__cell.is-won {
    animation-name: trSpotWinSilver;
}

@keyframes trSpotWinSilver {
    from { box-shadow: 0 0 0 4px rgba(140, 150, 165, 0.4), 0 10px 26px rgba(110, 120, 140, 0.45); }
    to { box-shadow: 0 0 0 10px rgba(140, 150, 165, 0.18), 0 14px 36px rgba(110, 120, 140, 0.6); }
}

/* ==========================================================================
   BIGGER WINNERS + PULSE WHEN THE DRAW IS DONE (user's request, 2026-11-03)
   Sizes follow the screen (audience screen / fullscreen get the biggest);
   once every card is revealed a pulse runs over the winners every few
   seconds: 3rd, 2nd, then the champion (biggest glow), then the rest.
   `scale` (not transform) so the tilts stay as they are.
   ========================================================================== */
body.wod-v5 .wod-toprank .tr-show .tr-card--polaroid {
    --w: clamp(150px, 12.5vw, 250px);
}

body.wod-v5 .wod-toprank .tr-show .tr-rank--1 .tr-card--polaroid {
    --w: clamp(188px, 16vw, 320px);
}

body.wod-v5 .wod-toprank .fullscreen-mode .tr-card--polaroid,
body.wod-v5.tr-screen .wod-toprank .tr-card--polaroid {
    --w: clamp(150px, min(26vh, 17vw), 360px);
}

body.wod-v5 .wod-toprank .fullscreen-mode .tr-rank--1 .tr-card--polaroid,
body.wod-v5.tr-screen .wod-toprank .tr-rank--1 .tr-card--polaroid {
    --w: clamp(190px, min(34vh, 22vw), 440px);
}

body.wod-v5.tr-screen .wod-toprank .tr-podium,
body.wod-v5 .wod-toprank .fullscreen-mode .tr-podium {
    gap: clamp(10px, 2.4vw, 48px);
    padding-top: clamp(46px, 7vh, 90px);
}

body.wod-v5.tr-screen .wod-toprank .tr-rest .tr-card,
body.wod-v5 .wod-toprank .fullscreen-mode .tr-rest .tr-card {
    --w: clamp(80px, min(12vh, 8vw), 150px);
}

/* The pulse */
body.wod-v5 .wod-toprank.is-done .tr-card.is-flipped {
    animation: trWinnerPulse 5s ease-in-out infinite;
}

body.wod-v5 .wod-toprank.is-done .tr-card.is-flipped .tr-card__front {
    animation: trWinnerGlow 5s ease-in-out infinite;
    animation-delay: inherit;
}

body.wod-v5 .wod-toprank.is-done .tr-rank--3 .tr-card.is-flipped { animation-delay: 0s; }
body.wod-v5 .wod-toprank.is-done .tr-rank--2 .tr-card.is-flipped { animation-delay: 0.45s; }
body.wod-v5 .wod-toprank.is-done .tr-rank--1 .tr-card.is-flipped {
    animation-name: trChampionPulse;
    animation-delay: 0.9s;
}

body.wod-v5 .wod-toprank.is-done .tr-rank--1 .tr-card.is-flipped .tr-card__front {
    animation-name: trChampionGlow;
}

body.wod-v5 .wod-toprank.is-done .tr-rest .tr-card.is-flipped {
    animation-name: trRestPulse;
    animation-delay: 1.6s;
}

body.wod-v5 .wod-toprank.is-done .tr-rest .tr-rank:nth-child(2) .tr-card.is-flipped { animation-delay: 1.8s; }
body.wod-v5 .wod-toprank.is-done .tr-rest .tr-rank:nth-child(3) .tr-card.is-flipped { animation-delay: 2s; }
body.wod-v5 .wod-toprank.is-done .tr-rest .tr-rank:nth-child(n+4) .tr-card.is-flipped { animation-delay: 2.2s; }

body.wod-v5 .wod-toprank.is-done .tr-rest .tr-card.is-flipped .tr-card__front {
    animation-name: none;
}

@keyframes trWinnerPulse {
    0%, 22%, 100% { scale: 1; }
    8% { scale: 1.08; }
    14% { scale: 0.99; }
}

@keyframes trWinnerGlow {
    0%, 22%, 100% { box-shadow: 0 18px 36px rgba(20, 12, 4, 0.28), 0 2px 6px rgba(20, 12, 4, 0.18); }
    8% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--metal-flat, #ffbe4d) 55%, transparent), 0 0 46px 10px color-mix(in srgb, var(--metal-flat, #ffbe4d) 55%, transparent), 0 18px 36px rgba(20, 12, 4, 0.28); }
}

@keyframes trChampionPulse {
    0%, 26%, 100% { scale: 1; }
    9% { scale: 1.12; }
    16% { scale: 0.98; }
    21% { scale: 1.03; }
}

@keyframes trChampionGlow {
    0%, 26%, 100% { box-shadow: 0 18px 40px rgba(255, 170, 40, 0.4); }
    9% { box-shadow: 0 0 0 8px rgba(255, 190, 77, 0.6), 0 0 80px 22px rgba(255, 150, 50, 0.6), 0 18px 40px rgba(255, 170, 40, 0.4); }
}

@keyframes trRestPulse {
    0%, 20%, 100% { scale: 1; }
    8% { scale: 1.06; }
}

@media (prefers-reduced-motion: reduce) {
    body.wod-v5 .wod-toprank.is-done .tr-card.is-flipped,
    body.wod-v5 .wod-toprank.is-done .tr-card.is-flipped .tr-card__front {
        animation: none !important;
    }
}

/* Bigger champion crown (user's request, 2026-11-03): sized with the screen on the podium,
   in the pop-up and in the grand reveal; the podium leaves room above for it */
body.wod-v5 .wod-toprank .tr-podium {
    --crown: clamp(56px, 5.5vw, 110px);
    padding-top: calc(var(--crown) * 0.95 + 14px);
}

body.wod-v5 .wod-toprank .tr-ranks--preview .tr-podium {
    --crown: 56px;
}

body.wod-v5.tr-screen .wod-toprank .tr-podium,
body.wod-v5 .wod-toprank .fullscreen-mode .tr-podium {
    --crown: clamp(70px, min(11vh, 7vw), 150px);
    padding-top: calc(var(--crown) * 0.95 + 14px);
}

body.wod-v5 .wod-toprank .tr-rank__crown {
    top: calc(var(--crown, 56px) * -0.92);
}

body.wod-v5 .wod-toprank .tr-rank__crown svg {
    width: var(--crown, 56px);
    height: var(--crown, 56px);
}

/* Pop-up */
body.wod-v5 .tr-result[data-rank="1"] .tr-result__card::before {
    top: -70px;
    width: 100px;
    height: 84px;
}

body.wod-v5 .tr-result[data-rank="1"] .tr-result__card {
    margin-top: 76px;
}

/* Grand reveal: the crown on the gold "?" card */
body.wod-v5 .tr-result .tr-grand__crown {
    top: calc(var(--R) * -0.32);
}

body.wod-v5 .tr-result .tr-grand__crown svg {
    width: calc(var(--R) * 0.42);
    height: calc(var(--R) * 0.42);
}

@media (max-width: 599.98px) {
    body.wod-v5 .wod-toprank .tr-podium {
        --crown: 52px;
    }

    body.wod-v5 .tr-result[data-rank="1"] .tr-result__card::before {
        top: -58px;
        width: 80px;
        height: 68px;
    }

    body.wod-v5 .tr-result[data-rank="1"] .tr-result__card {
        margin-top: 62px;
    }
}

/* Grand reveal: the losers leave in the last second, so the exits and the champion's
   fly-in are quick */
body.wod-v5 .tr-result .tr-grand__item.is-out {
    transition-duration: 0.35s;
}

body.wod-v5 .tr-result .tr-grand__item.is-out .tr-grand__face {
    transition-duration: 0.35s;
}

body.wod-v5 .tr-result .tr-grand__item.is-chosen .tr-grand__face {
    transition-duration: 0.3s;
}

body.wod-v5 .tr-result .tr-grand.is-merge .tr-grand__item.is-chosen {
    transition-duration: 0.25s;
}

body.wod-v5 .tr-result .tr-grand.is-merge .tr-grand__card {
    transition: opacity 0.2s ease, transform 0.2s ease;
}

/* ==========================================================================
   SEVERAL WINNERS IN A TOP 1-3 PLACE (user's request, 2026-11-03): one big
   "Top N" plaque in the podium spot (frame + tilt like the single cards, big
   coin, "Champions · 3 winners"), the winners as small upright cards below.
   ========================================================================== */
body.wod-v5 .wod-toprank .tr-rank--many {
    --mini: clamp(96px, 7.5vw, 150px);
    gap: 16px;
}

body.wod-v5 .wod-toprank .tr-rank--1.tr-rank--many {
    --mini: clamp(104px, 8.5vw, 170px);
}

body.wod-v5 .wod-toprank .tr-ranks--preview .tr-rank--many {
    --mini: 62px;
}

body.wod-v5.tr-screen .wod-toprank .tr-rank--many,
body.wod-v5 .wod-toprank .fullscreen-mode .tr-rank--many {
    --mini: clamp(100px, min(15vh, 9vw), 210px);
}

/* The plaque (sizes follow the single cards of the same place) */
body.wod-v5 .wod-toprank .tr-plaque {
    --w: clamp(150px, 12.5vw, 250px);
    position: relative;
    width: var(--w);
}

body.wod-v5 .wod-toprank .tr-rank--1 .tr-plaque { --w: clamp(188px, 16vw, 320px); }
body.wod-v5 .wod-toprank .tr-ranks--preview .tr-plaque { --w: 112px; }
body.wod-v5 .wod-toprank .tr-ranks--preview .tr-rank--1 .tr-plaque { --w: 138px; }
body.wod-v5.tr-screen .wod-toprank .tr-plaque,
body.wod-v5 .wod-toprank .fullscreen-mode .tr-plaque { --w: clamp(150px, min(24vh, 15vw), 320px); }
body.wod-v5.tr-screen .wod-toprank .tr-rank--1 .tr-plaque,
body.wod-v5 .wod-toprank .fullscreen-mode .tr-rank--1 .tr-plaque { --w: clamp(190px, min(30vh, 19vw), 400px); }

body.wod-v5 .wod-toprank .tr-rank--2 .tr-plaque { transform: rotate(-5deg); }
body.wod-v5 .wod-toprank .tr-rank--3 .tr-plaque { transform: rotate(5deg); }

body.wod-v5 .wod-toprank .tr-plaque__face {
    position: relative;
    display: flex;
    flex-direction: column;
    padding: calc(var(--w) * 0.055) calc(var(--w) * 0.055) 0;
    border-radius: 14px;
    background: #fffdf8;
    color: #1b1622;
    box-shadow: 0 18px 36px rgba(20, 12, 4, 0.28), 0 2px 6px rgba(20, 12, 4, 0.18);
}

body.wod-v5 .wod-toprank .tr-plaque__art {
    display: flex;
    align-items: center;
    justify-content: center;
    height: calc(var(--w) * 0.66);
    overflow: hidden;
    border-radius: 9px;
    background:
        repeating-conic-gradient(from 0deg, rgba(255, 255, 255, 0.16) 0deg 10deg, transparent 10deg 20deg),
        radial-gradient(80% 80% at 50% 40%, color-mix(in srgb, var(--metal-flat) 70%, #ffffff), var(--metal-flat));
}

body.wod-v5 .wod-toprank .tr-rank--1 .tr-plaque__art {
    background:
        repeating-conic-gradient(from 0deg, rgba(255, 255, 255, 0.18) 0deg 10deg, transparent 10deg 20deg),
        radial-gradient(80% 70% at 50% 35%, #ffcf5c, #ff6b3d 60%, #d63a2a);
}

/* The big coin in the middle of the plaque */
body.wod-v5 .wod-toprank .tr-rosette--big {
    --r: calc(var(--w) * 0.4);
    position: relative;
    left: auto;
    bottom: auto;
    margin-top: calc(var(--w) * -0.08);
}

body.wod-v5 .wod-toprank .tr-plaque .tr-card__caption {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1px;
    height: calc(var(--w) * 0.3);
    padding: calc(var(--w) * 0.04) 4px calc(var(--w) * 0.02);
    text-align: center;
}

body.wod-v5 .wod-toprank .tr-plaque .tr-card__caption b {
    font-size: calc(var(--w) * 0.12);
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -0.02em;
    color: #1b1622;
}

body.wod-v5 .wod-toprank .tr-plaque .tr-card__caption small {
    font-size: max(11px, calc(var(--w) * 0.062));
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--metal-deep);
}

/* Champions' plaque gets the turning halo */
body.wod-v5 .wod-toprank .tr-rank--1 .tr-plaque::before {
    content: '';
    position: absolute;
    inset: -12px;
    z-index: -1;
    border-radius: 26px;
    background: conic-gradient(from var(--tr-halo), #ffbe4d, #ff6b3d, #fff1b8, #ff7a59, #ffbe4d);
    filter: blur(16px);
    opacity: 0.75;
    animation: trHalo 6s linear infinite;
}

/* The winners below: small, upright, no halo */
body.wod-v5 .wod-toprank .tr-rank__cards--list {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    max-width: calc(var(--mini) * 3 + 20px);
}

body.wod-v5 .wod-toprank .tr-card--polaroid.tr-card--mini {
    --w: var(--mini) !important;
}

body.wod-v5 .wod-toprank .tr-rank--1 .tr-card--polaroid.tr-card--mini,
body.wod-v5 .wod-toprank .tr-rank--2 .tr-card--polaroid.tr-card--mini,
body.wod-v5 .wod-toprank .tr-rank--3 .tr-card--polaroid.tr-card--mini {
    transform: none;
}

body.wod-v5 .wod-toprank .tr-rank--1 .tr-card--polaroid.tr-card--mini::before {
    content: none;
}

/* Done: the plaques pulse with their winners */
body.wod-v5 .wod-toprank.is-done .tr-plaque {
    animation: trWinnerPulse 5s ease-in-out infinite;
}

body.wod-v5 .wod-toprank.is-done .tr-rank--3 .tr-plaque { animation-delay: 0s; }
body.wod-v5 .wod-toprank.is-done .tr-rank--2 .tr-plaque { animation-delay: 0.45s; }
body.wod-v5 .wod-toprank.is-done .tr-rank--1 .tr-plaque { animation-name: trChampionPulse; animation-delay: 0.9s; }

/* Phones: plaque + list stacked in each podium column */
@media (max-width: 599.98px) {
    body.wod-v5 .wod-toprank .tr-plaque,
    body.wod-v5 .wod-toprank .tr-ranks--preview .tr-plaque { --w: 96px; }
    body.wod-v5 .wod-toprank .tr-rank--1 .tr-plaque,
    body.wod-v5 .wod-toprank .tr-ranks--preview .tr-rank--1 .tr-plaque { --w: 114px; }

    body.wod-v5 .wod-toprank .tr-rank--many,
    body.wod-v5 .wod-toprank .tr-ranks--preview .tr-rank--many { --mini: 76px; }

    body.wod-v5 .wod-toprank .tr-rank__cards--list {
        flex-direction: column;
        align-items: center;
        max-width: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    body.wod-v5 .wod-toprank .tr-rank--1 .tr-plaque::before,
    body.wod-v5 .wod-toprank.is-done .tr-plaque {
        animation: none !important;
    }
}

/* Plaque caption can take two lines; small face-down cards show only the place name */
body.wod-v5 .wod-toprank .tr-plaque .tr-card__caption {
    height: auto;
    min-height: calc(var(--w) * 0.3);
    padding-bottom: calc(var(--w) * 0.05);
}

body.wod-v5 .wod-toprank .tr-card--mini .tr-card__back .tr-card__caption b {
    display: none;
}

/* Confetti canvas lives on <body> (instant reveals burst without the pop-up) */
.tr-confetti {
    position: fixed;
    inset: 0;
    z-index: 100004;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

/* Instant reveal (live selection only) */
body.wod-v5 .wod-toprank .tr-instant {
    display: none;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    padding: 7px 14px;
    border: 1px solid var(--h-line);
    border-radius: 999px;
    background: var(--h-surface-2);
    color: var(--h-text);
    font-family: var(--h-font);
    font-size: 0.95rem;
    font-weight: 800;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease;
}

body.wod-v5 .wod-toprank.is-live .tr-instant {
    display: inline-flex;
}

body.wod-v5 .wod-toprank .tr-instant[aria-pressed="true"] {
    border-color: #e5484d;
    background: #e5484d;
    color: #ffffff;
}

body.wod-v5 .wod-toprank .tr-instant:focus-visible {
    outline: 3px solid var(--h-yellow);
    outline-offset: 3px;
}

/* With instant on, the drawing time doesn't apply */
body.wod-v5 .wod-toprank.is-instant .tr-drawtime--live .tr-range,
body.wod-v5 .wod-toprank.is-instant .tr-drawtime--live .tr-drawtime__value {
    opacity: 0.35;
    pointer-events: none;
}

body.wod-v5 .wod-toprank .tr-instant-switch {
    --card-accent: #e5484d;
    margin-top: 6px;
    padding: 10px 0 0;
    border-top: 1px solid var(--h-line);
}

body.wod-v5 .wod-toprank .tr-instant-switch[hidden] {
    display: none;
}

@media (max-width: 599.98px) {
    body.wod-v5 .wod-toprank .tr-drawtime--live {
        flex-wrap: wrap;
        border-radius: 22px;
    }
}

/* ==========================================================================
   ROWS LAYOUT (user's sketch, 2026-11-03): when a Top 1-3 place has several
   winners - Top 1, Top 2, Top 3 as rows, the medal tile on the left and that
   place's winners as cards in a line (wrapping). One centred block, so the
   tiles line up. Top 4+ stay below as before.
   ========================================================================== */
body.wod-v5 .wod-toprank .tr-podium--rows {
    --mini: clamp(100px, 8vw, 160px);
    flex-direction: column;
    align-items: stretch;
    gap: 22px;
    width: fit-content;
    max-width: 100%;
    margin: 0 auto;
    padding-top: 12px;
}

body.wod-v5 .wod-toprank .tr-ranks--preview .tr-podium--rows {
    --mini: 58px;
    gap: 12px;
}

body.wod-v5.tr-screen .wod-toprank .tr-podium--rows,
body.wod-v5 .wod-toprank .fullscreen-mode .tr-podium--rows {
    --mini: clamp(100px, min(15vh, 8.5vw), 200px);
    gap: clamp(14px, 2.4vh, 30px);
    padding-top: 6px;
}

/* One row: tile + cards */
body.wod-v5 .wod-toprank .tr-podium--rows .tr-rank {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: clamp(14px, 2vw, 32px);
    --mini: inherit;
}

/* No crown, sparkles, podium steps or tilts in rows */
body.wod-v5 .wod-toprank .tr-podium--rows .tr-rank__crown,
body.wod-v5 .wod-toprank .tr-podium--rows .tr-spark,
body.wod-v5 .wod-toprank .tr-podium--rows .tr-rank__badge,
body.wod-v5 .wod-toprank .tr-podium--rows .tr-rank__step {
    display: none;
}

/* The medal tile: just the art, square, about as tall as the cards */
body.wod-v5 .wod-toprank .tr-podium--rows .tr-plaque,
body.wod-v5 .wod-toprank .tr-podium--rows .tr-rank--1 .tr-plaque,
body.wod-v5 .wod-toprank .tr-ranks--preview .tr-podium--rows .tr-plaque,
body.wod-v5.tr-screen .wod-toprank .tr-podium--rows .tr-plaque,
body.wod-v5 .wod-toprank .fullscreen-mode .tr-podium--rows .tr-plaque {
    --w: calc(var(--mini) * 1.25);
    transform: none;
}

body.wod-v5 .wod-toprank .tr-podium--rows .tr-plaque__face {
    padding: 0;
    background: none;
    box-shadow: none;
}

body.wod-v5 .wod-toprank .tr-podium--rows .tr-plaque__art {
    height: var(--w);
    border-radius: 16px;
    box-shadow: 0 14px 30px rgba(20, 12, 4, 0.22);
}

body.wod-v5 .wod-toprank .tr-podium--rows .tr-plaque .tr-card__caption {
    display: none;
}

body.wod-v5 .wod-toprank .tr-podium--rows .tr-rosette--big {
    --r: calc(var(--w) * 0.56);
    margin-top: calc(var(--w) * -0.1);
}

/* The champions' tile keeps a soft halo */
body.wod-v5 .wod-toprank .tr-podium--rows .tr-rank--1 .tr-plaque::before {
    inset: -8px;
    border-radius: 22px;
    opacity: 0.55;
}

/* The winners in a line */
body.wod-v5 .wod-toprank .tr-podium--rows .tr-rank__cards,
body.wod-v5 .wod-toprank .tr-podium--rows .tr-rank__cards--list {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: clamp(10px, 1.2vw, 20px);
    max-width: calc(var(--mini) * 7 + 7 * 20px);
}

body.wod-v5 .wod-toprank .tr-podium--rows .tr-card--polaroid.tr-card--mini {
    transform: none;
}

/* Phones: smaller tile, cards wrap beside it */
@media (max-width: 599.98px) {
    body.wod-v5 .wod-toprank .tr-podium--rows,
    body.wod-v5 .wod-toprank .tr-ranks--preview .tr-podium--rows {
        --mini: 70px;
        width: 100%;
        gap: 14px;
    }

    body.wod-v5 .wod-toprank .tr-podium--rows .tr-plaque,
    body.wod-v5 .wod-toprank .tr-podium--rows .tr-rank--1 .tr-plaque {
        --w: 64px;
    }

    body.wod-v5 .wod-toprank .tr-podium--rows .tr-rank {
        align-items: start;
        gap: 10px;
    }

    body.wod-v5 .wod-toprank .tr-podium--rows .tr-rank__cards,
    body.wod-v5 .wod-toprank .tr-podium--rows .tr-rank__cards--list {
        flex-direction: row;
        align-items: flex-start;
        gap: 8px;
    }
}

/* Rows with more than 3 winners (user's request): picture-only square cards - no name,
   title or small medal (the row's tile shows the place; the name is in the pop-up + tooltip) */
body.wod-v5 .wod-toprank .tr-rank--compact .tr-card--polaroid.tr-card--mini {
    aspect-ratio: 1;
}

body.wod-v5 .wod-toprank .tr-rank--compact .tr-card--mini .tr-card__face {
    padding: calc(var(--w) * 0.05);
}

body.wod-v5 .wod-toprank .tr-rank--compact .tr-card--mini .tr-card__caption,
body.wod-v5 .wod-toprank .tr-rank--compact .tr-card--mini .tr-rosette {
    display: none;
}

body.wod-v5 .wod-toprank .tr-podium--rows .tr-rank--compact .tr-plaque {
    --w: var(--mini);
}

/* ==========================================================================
   LIVE: choose the place to fill, set its winners (− / +), select several
   contestants and reveal them (user's request, 2026-11-03)
   ========================================================================== */
body.wod-v5 .wod-toprank .tr-live__ranks {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
}

body.wod-v5 .wod-toprank .tr-live__rank {
    display: inline-flex;
    align-items: baseline;
    gap: 6px;
    padding: 7px 12px;
    border: 2px solid color-mix(in srgb, var(--medal) 45%, var(--h-line));
    border-radius: 999px;
    background: var(--h-surface);
    color: var(--h-text);
    font-family: var(--h-font);
    font-size: 0.95rem;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}

body.wod-v5 .wod-toprank .tr-live__rank b {
    font-weight: 800;
}

body.wod-v5 .wod-toprank .tr-live__rank small {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--h-muted);
    font-variant-numeric: tabular-nums;
}

body.wod-v5 .wod-toprank .tr-live__rank.is-on {
    border-color: var(--medal);
    background: color-mix(in srgb, var(--medal) 28%, var(--h-surface));
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--medal) 30%, transparent);
}

body.wod-v5 .wod-toprank .tr-live__rank.is-full small {
    color: #2fbf86;
}

body.wod-v5 .wod-toprank .tr-live__rank:focus-visible {
    outline: 3px solid var(--h-yellow);
    outline-offset: 2px;
}

body.wod-v5 .wod-toprank .tr-live__bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px 16px;
    margin: 0 0 14px;
    padding: 10px 12px;
    border: 1px solid var(--h-line);
    border-radius: 18px;
    background: var(--h-surface-2);
}

body.wod-v5 .wod-toprank .tr-live__slots,
body.wod-v5 .wod-toprank .tr-live__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

body.wod-v5 .wod-toprank .tr-live__slots-label {
    font-size: 1rem;
    font-weight: 800;
    color: var(--h-text);
}

body.wod-v5 .wod-toprank .tr-live__slots .home-stepper__btn:hover:not(:disabled) {
    background: var(--h-yellow);
}

body.wod-v5 .wod-toprank .tr-live__slots .home-stepper__btn:disabled {
    opacity: 0.35;
    cursor: default;
}

body.wod-v5 .wod-toprank .tr-live__filled {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--h-muted);
}

body.wod-v5 .wod-toprank .tr-live__go {
    padding: 10px 18px;
    border: 3px solid var(--h-ink);
    border-radius: 999px;
    background: radial-gradient(120% 160% at 50% 0%, #ffe2a6, var(--h-yellow) 55%, #f59e2b);
    color: var(--h-ink);
    font-family: var(--h-font);
    font-size: 1rem;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 4px 0 #9a5a10;
}

body.wod-v5 .wod-toprank .tr-live__go:disabled {
    border-color: var(--h-line);
    background: var(--h-surface);
    color: var(--h-muted);
    box-shadow: none;
    cursor: default;
}

body.wod-v5 .wod-toprank .tr-live__clear {
    padding: 9px 14px;
    border: 1px solid var(--h-line);
    border-radius: 999px;
    background: transparent;
    color: var(--h-muted);
    font-family: var(--h-font);
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
}

body.wod-v5 .wod-toprank .tr-live__go:focus-visible,
body.wod-v5 .wod-toprank .tr-live__clear:focus-visible {
    outline: 3px solid var(--h-yellow);
    outline-offset: 3px;
}

/* Selected contestants: yellow ring + their number in click order */
body.wod-v5 .wod-toprank .tr-live__pick.is-selected {
    border-color: var(--h-yellow);
    box-shadow: 0 0 0 3px var(--h-yellow), 0 10px 20px rgba(255, 190, 77, 0.35);
    transform: translateY(-3px);
}

body.wod-v5 .wod-toprank .tr-live__num {
    position: absolute;
    top: 6px;
    right: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 26px;
    height: 26px;
    padding: 0 6px;
    border-radius: 999px;
    background: var(--h-ink);
    color: var(--h-yellow);
    font-size: 0.9rem;
    font-weight: 800;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.3);
}

@media (max-width: 599.98px) {
    body.wod-v5 .wod-toprank .tr-live__bar {
        flex-direction: column;
        align-items: stretch;
    }
}
