/* =============================================================================
 * Judging page tokens
 *
 * Theme-aware values are defined in :root (dark — default behaviour) and
 * redefined under [data-theme="light"] on <html>. Theme switching is just an
 * attribute flip; future Breakdance toggle wires into the same hook.
 *
 * Brand / status / tooltip values stay constant across themes.
 * Stage 2a (tokenisation) — values map 1:1 to the previous hardcoded colours
 * in dark mode. Light values are best-effort defaults; refined when we
 * actually flip and test.
 * ============================================================================= */

:root {
    /* Brand — constant across themes */
    --ccr-color-brand: #4E00FF;
    --ccr-color-brand-soft: #c5b5fb;
    --ccr-color-brand-deep: #59008e;

    /* State — constant across themes */
    --ccr-color-danger: #f85c5c;

    /* Annotation type stripe colours — constant across themes. Used as the
     * 3px left edge on each annotation row to encode type at a glance. */
    --ccr-type-warning: #f5a623;
    --ccr-type-legality: #3b82f6;
    --ccr-type-deduction: #f85c5c;
    --ccr-type-comment: #94a3b8;

    /* Status / notice — constant across themes */
    --ccr-error-bg: #f8d7da;
    --ccr-error-text: #721c24;
    --ccr-error-border: #f5c6cb;

    /* Tooltip — constant across themes */
    --ccr-tooltip-bg: rgba(0, 0, 0, 0.75);

    /* Floating comments (legacy, may be dead) */
    --ccr-surface-floating-bg: #f6f6f6;
    --ccr-border-floating: #c7c7c7;

    /* Text on coloured/dark surfaces — constant across themes */
    --ccr-text-on-action: #ffffff;

    /* Theme-aware: dark (default) */
    --ccr-text-strong: #ffffff;
    --ccr-text-muted: #ffffffcc;
    --ccr-text-faint: #ffffffaa;
    --ccr-text-disabled: #ffffff61;

    --ccr-surface-2: #ffffff11;
    --ccr-surface-3: #ffffff22;
    --ccr-surface-4: #ffffff33;
    --ccr-surface-input: #2b2b2b;
    --ccr-surface-input-dark: #00000055;
    --ccr-surface-button-cancel: #000000;
    --ccr-surface-inverse: #ffffff;

    --ccr-border-faint: #ffffff22;
    --ccr-border-soft: #ffffff33;
    --ccr-border-tab: #ffffff44;
    --ccr-border: #ffffff55;
    --ccr-border-strong: #ffffff;
    --ccr-border-input: #565656;

    --ccr-overlay-hover: #ffffff55;

    --ccr-marker-range-bg: #ffffff85;
}

[data-theme="light"] {
    --ccr-text-strong: #1c1c1e;
    --ccr-text-muted: #2c2c2e;
    --ccr-text-faint: #6c6c70;
    --ccr-text-disabled: #c4c4c6;

    --ccr-surface-2: #00000005;
    --ccr-surface-3: #0000000d;
    --ccr-surface-4: #00000018;
    --ccr-surface-input: #ffffff;
    --ccr-surface-input-dark: #00000018;
    --ccr-surface-button-cancel: #2c2c2e;
    --ccr-surface-inverse: #1c1c1e;

    --ccr-border-faint: #0000001a;
    --ccr-border-soft: #00000026;
    --ccr-border-tab: #00000033;
    --ccr-border: #00000040;
    --ccr-border-strong: #1c1c1e;
    --ccr-border-input: #c4c4c6;

    --ccr-overlay-hover: #00000018;

    --ccr-marker-range-bg: #00000060;
}

/* Backwards-compat aliases — referenced by the <video> inline style for
 * --plyr-color-main. Don't drop. */
body {
    --cc-judging-theme-color: var(--ccr-color-brand);
    --cc-judging-theme-lighter: var(--ccr-color-brand-soft);
}

/* =============================================================================
 * Design-system tokens (Phase 1 of the Claude Design redesign)
 *
 * Layered on top of the existing --ccr-* tokens. Scoped to .ccr-judging-container
 * so they don't leak to the rest of CCRW. New components added in Phases 2-4
 * use these tokens; existing rules continue to use --ccr-* until migrated.
 *
 * Accent is remapped from the design's Supabase green to Cheercast brand purple.
 * Type colours use semantic --type-* tokens that reference the palette, so
 * swapping a type's colour later means changing one variable.
 * ============================================================================= */

.ccr-judging-container {
    /* Surfaces (dark theme — design is dark-mode only at the moment) */
    --bg:            #171717;
    --panel:         #1c1c1c;
    --surface:       #202020;
    --surface-2:     #262626;
    --hover:         #2a2a2a;

    /* Borders */
    --border:        #2a2a2a;
    --border-2:      #333333;
    --border-3:      #3d3d3d;
    --border-strong: #3d3d3d;

    /* Foreground / text */
    --fg:   #ededed;
    --fg-2: #b4b4b4;
    --fg-3: #8a8a8a;
    --fg-4: #5f5f5f;

    /* Accent — design uses Supabase green (#3ecf8e); remapped to Cheercast
     * brand purple. Text on accent stays white. */
    --accent:        var(--ccr-color-brand);
    --accent-fg:     #ffffff;
    --accent-soft:   rgba(78, 0, 255, 0.14);
    --accent-border: rgba(78, 0, 255, 0.30);

    /* Lighter accent for TEXT and BORDER contexts on dark surfaces.
     * The deep brand purple (#4E00FF) has very low contrast against
     * --panel / --bg, so we use this lavender variant wherever the
     * accent is used as a foreground colour rather than a background. */
    --accent-text:        var(--ccr-color-brand-soft);
    --accent-border-strong: var(--ccr-color-brand-soft);

    /* Palette colours (used by --type-* below and by status UI) */
    --warn:        #f5a524;
    --warn-soft:   rgba(245, 165, 36, 0.14);
    --info:        #6aa9ff;
    --info-soft:   rgba(106, 169, 255, 0.14);
    --danger:      #f43f5e;
    --danger-soft: rgba(244, 63, 94, 0.12);

    /* Annotation type → colour mapping. Indirected through palette tokens so
     * a single type's colour can be rebalanced without touching component CSS.
     * (Existing --ccr-type-* tokens in :root still drive the current row stripe
     * rendering until Phase 2 migrates components over.) */
    --type-warning:        var(--warn);
    --type-warning-soft:   var(--warn-soft);
    --type-legality:       #fb923c;
    --type-legality-soft:  rgba(251, 146, 60, 0.14);
    --type-deduction:      var(--danger);
    --type-deduction-soft: var(--danger-soft);
    --type-comment:        var(--info);
    --type-comment-soft:   var(--info-soft);

    /* Radii */
    --radius:    8px;
    --radius-sm: 6px;
    --radius-lg: 12px;

    /* Shadows */
    --shadow-1:   0 1px 0 rgba(255, 255, 255, 0.04) inset, 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-pop: 0 10px 30px rgba(0, 0, 0, 0.55), 0 2px 6px rgba(0, 0, 0, 0.35);

    /* Root line-height — set as a ratio so descendants inherit a sensible
     * scaling multiplier, not the resolved pixel value from body. Matches
     * the Breakdance global setting of 1.4. */
    line-height: 1.4;
}

    /* * {
        margin: 0;
        padding: 0;
        box-sizing: border-box;
        font-family: Arial, sans-serif;
    }

    body {
        background-color: #f8f8f8;
        color: #333;
        display: flex;
        justify-content: center;
        align-items: center;
        min-height: 100vh;
    } */

    /* CONTAINER THAT HOLDS EVERYTHING */

    /* change to ccr-judging-container */
    .ccr-judging-container {
        /* min-width: 1200px;*/
        min-height: 100vh;
        /* display: flex; */
        background: transparent;
        border-radius: 3px;
        overflow: visible;
        padding-bottom: 0;
    }

    /* nested container under "judging-container" - may be unnecessary/leftover from other code */
    .ccr-judging-player-container {
        flex: 2;
        position: relative;
        box-sizing: border-box;
    }

    /* may also not be necessary? contains "cc-judging-annotation-container" which also contains player? If we're targeting a plyr video why not use plyr elements */
    /* .ccr-judging-player-container video {
        width: 100%;
        height: 100%;
        object-fit: cover;
    } */

    /* this seems to be the immediate parent of the two columns, change to ccr */
    .ccr-judging-annotation-container {
        display: flex;
        gap: 0;
        width: 100%;
        margin-bottom: 0;
        align-items: flex-start;
    }

    /* START "LEFT COLUMN" - VIDEO */

    /* START "OLD ROUTINE INFO SECTION" */

    /* Assuming this is the old info section? lets change this to "ccr-routine-info-container" */

/* Assuming this is the old info section? lets change this to "ccr-routineinfo-section" */

/* Assuming this is the old info section? lets change this to "ccr-routineinfo-id" */

/* Assuming this is the old info section? lets change this to "ccr-routineinfo-id p" */

/* Assuming this is the old info section? lets change this to "ccr-routineinfo-title" */

/* Assuming this is the old info section? lets change this to "ccr-routineinfo-value" */

/* END "OLD ROUTINE INFO SECTION" */

    /* START "VIDEO/PLYR" SECTION */

    /* change to ccr */
    .ccr-plyr-container {
        /* position: relative; */
        width: 70%;
        flex: 2;
        z-index: 1;
        height: 0px;
        position: -webkit-sticky;
        position: sticky;
        top: 10px;
        align-self: flex-start;
        /* Visual niceties */
        transition: box-shadow 0.18s ease;
        z-index: 1000;

        height: auto !important;
        /* width: auto !important; */
        min-width: 0 !important;
        /* allow it to shrink inside flex */

    }

    /* change to ccr */
    .ccr-plyr-container .plyr--video {
        border-radius: 5px 5px 0px 0px;
        border-width: 1px 1px 0px 1px;
        border-style: solid;
        border-color: var(--ccr-border-faint);
    }

/* change to ccr */
    .ccr-judging-player,
    .ccr-judging-canvas {
        display: block !important;
        /* position: absolute !important; */
        position: absolute !important;
        /* position: static !important; */
        top: 0 !important;
        left: 0 !important;
        /* width: 100% !important;
        height: 100% !important; */
    }

    #player {
        width: 100% !important;
        aspect-ratio: 16/9 !important;
        position: static !important;
        /* background: black; */
    }

    .canvas-container {
        height: unset !important;
        position: unset !important;
        width: 100% !important;
    }

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

    #ccr-judging-comment-button.disabled {
        pointer-events: none;
        opacity: 0.9;
    }

    #ccr-judging-player-container .plyr__progress {
        position: relative;
    }

    #ccr-judging-player-container .plyr-marker {
        position: absolute;
        top: 50%;
        transform: translateY(-50%);
        height: 75%;
        width: 5px;
        border-radius: 3px;
        /* background: #ffffff; */
        cursor: pointer;
        z-index: 101;
    }

    #ccr-judging-player-container .plyr-marker-range {
        position: absolute;
        top: 50%;
        transform: translateY(-50%);
        height: 35%;
        background: var(--ccr-marker-range-bg);
        border-radius: 3px;
        z-index: 100;
        pointer-events: none;
    }

    #ccr-judging-player-container .plyr-marker-tooltip {

        position: absolute;
        top: -25px;
        left: 50%;
        transform: translateX(-50%);
        background: var(--ccr-tooltip-bg);
        color: white;
        padding: 3px 6px;
        font-size: 12px;
        border-radius: 4px;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.2s;

        min-width: 100px;
        max-width: 400px;
        display: -webkit-box;
        line-clamp: 2;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: normal;
    }

    #ccr-judging-player-container .plyr-marker:hover .plyr-marker-tooltip {
        opacity: 1;
    }

    #ccr-judging-player-container .plyr__control--overlaid {
        display: none !important;
    }

    #ccr-judging-player-container .plyr-marker-start-end-time {
        position: absolute;
        top: 50%;
        transform: translateY(-50%);
        height: 75%;
        width: 5px;
        border-radius: 3px;
        background: var(--ccr-color-danger);
        cursor: pointer;
        z-index: 100;

    }

/* START "RIGHT COLUMN" - COMMENTS */

    /*  change to ccr-comments-container - is top level container for right sidebar/commenting section */

/* START "ADD COMMENT" SECTION */

    /* replace with ".ccr-addcomment-container", container for start/stop and add annotation, (sibling to ".ccr-viewcomments-container") */
    /* currently this includes existing comments, but these should be moved to ".ccr-viewcomments-container" */

/* container for both of the set start/ set end elements, change to .ccr-addcomment-startstop-container */
    .ccr-addcomment-startstop-container {
        display: flex;
        justify-content: space-between;
        gap: 10px;
    }

/* container for individual set start and set end elements, change to .ccr-addcomment-startstop-action */

/* the actual button that sets the start and end time values, change to ".ccr-addcomment-startstop-button" */
    /* you can also leave the IDs that exist for each button but just update to "ccr" instead of "cc"  */

/* styles the text inside the button for the start and end time, change ".ccr-addcomment-startstop-button-text" */

/* shows the start and end time values, change to ".ccr-addcomment-startstop-value" */

/* the text inside the value, change to ".ccr-addcomment-startstop-value-text */

/* the button to add a new annotation */

/* the text inside the add annotation button, note updated element above is ".ccr-addcomment-addnew" */

.w-150 {
        min-width: 150px
    }

    /* Read-only comment display (rendered after save). See ccr-comment-editor.css
     * for the editor surface. Capped height with scroll so long comments don't
     * push the rest of the comment list off-screen. */
    .ccr-comment-text-container {
        border: 0;
        padding: 15px;
        color: var(--ccr-text-strong);
        max-height: 250px;
        overflow-y: auto;
    }

    /* holds all of the controls at the top of the add comment section */

/* each individual control inside the container */

/* the title of each control item, change to ".ccr-addcomment-control-title" */

/* the container that holds the annotation ID, change to ".ccr-addcomment-control-id" */
    .ccr-addcomment-control-id {
        background-color: var(--cc-judging-theme-color);
        /* display: none; */
    }

    /* p element under above element, note changed to ".ccr-addcomment-control-id" */
    .ccr-addcomment-control-id p {
        color: var(--ccr-text-on-action);
    }

    /* the class applied to selects in the control area, change to ".ccr-addcomment-control-select" */

/* the class applied to selects in the control area, */

/* control values style (i.e comment id etc), change to ".ccr-addcomment-control-value" */

/* holds the action buttons in the footer/submit area */

/* buttons in the footer/submit area, change to ".ccr-addcomment-footer-button" */

/* text inside footer buttons, see above change */

.rounded {
        border-radius: 5px;
    }

    /* change to ".ccr-addcomment-footer-button-delete" */

/* update to ccr */

.disable-pointers {
        pointer-events: none !important;
    }

    .enable-pointer {
        pointer-events: auto !important;
    }

    /* Tab container — segmented pill control. Single rounded container,
     * subtle background, active tab fills with brand colour. */
    .ccr-addcomment-tabslist {
        display: flex;
        gap: 0;
        padding: 4px;
        margin: 10px 10px 0 10px;
        background-color: var(--ccr-surface-2);
        border: 1px solid var(--ccr-border-faint);
        border-radius: 6px;
    }

    .ccr-addcomment-tabslist-item {
        flex: 1;
        text-align: center;
        color: var(--ccr-text-faint);
        font-size: 12px;
        font-weight: 600;
        padding: 8px 12px;
        border-radius: 4px;
        cursor: pointer;
        margin: 0 !important;
        position: relative;
        transition: background-color 0.18s ease, color 0.18s ease;
        -webkit-user-select: none;
        user-select: none;
    }

    .ccr-addcomment-tabslist-item:hover {
        color: var(--ccr-text-strong);
        background-color: var(--ccr-overlay-hover);
    }

    .ccr-addcomment-tabslist-item.ccr-active-tab {
        color: var(--ccr-text-on-action);
        background-color: var(--ccr-color-brand);
    }

    .ccr-addcomment-tabslist-item.ccr-active-tab:hover {
        background-color: var(--ccr-color-brand);
        filter: brightness(1.05);
    }

    /* Old underline ::after disabled — segmented design uses fill instead */
    .ccr-active-tab::after {
        display: none;
    }

    /* the "draw" tab, change to ".ccr-addcomment-drawtab", generic tab content container is ".ccr-addcomment-tab-content" */
    /* NEEDS TO BE FIXED, see above for correct generic container, using the one that is currently referenced in HTML for now but should be fixed */
    /* other tabs are ".ccr-addcomment-commenttab" and ".ccr-addcomment-permissionstab" */
    .ccr-addcomment-tab-content {
        height: auto;
        display: flex;
        justify-content: space-between;
        background: transparent;
        color: var(--ccr-text-strong);
        padding: 10px;
    }

    .ccr-add-comment-tab-contents {
        height: auto;
        display: flex;
        justify-content: space-between;
        background: transparent;
        color: var(--ccr-text-strong);
        padding: 15px 10px;
    }

/* section that holds buttons in the draw tab, change to ".ccr-addcomment-drawtab-section" along with ".ccr-addcomment-drawtab-section-left" and ".ccr-addcomment-drawtab-section-right" */

/* tab titles */

/* buttons in tabs - change to ".ccr-addcomment-tab-button" */

.ccr-active-shape {
        border-color: var(--ccr-border-strong);
    }

/* additional class for colour picker button, change to ccr */
    .ccr-color-picker {
        display: flex;
        cursor: default;
        flex-direction: column;
    }

    /* additional class for colour picker button label, change to ccr */

/* contains the color picker input */

/* input for colour picker, change to ".ccr-color-picker-input" */
    .ccr-color-picker-input {
        display: inline-block;
        width: 200%;
        height: 200%;
        margin: -50%;
        background: #ff0000;
        /* Default color */
        border: 0px solid #fff;
        cursor: pointer;
        position: relative;
    }

.ccr-addcomment-permissionstab {
        flex-direction: column;
        justify-content: flex-start;
        gap: 0;
    }

    .ccr-addcomment-permissionstab p,
    .ccr-addcomment-permissionstab div {
        width: 100%;
    }

    /* wrapper for permissions radios, change to ".ccr-addcomment-permissionstab-radio-container */

/* hides actual radios */

/* label for permissions radios, change to ".ccr-addcomment-permissionstab-radio-label" */

/* Legacy rule removed — the share-link container now sits in the
     * composer footer and is styled by .ccr-composer-share-link (Phase 3c). */

    /* container that holds sharing URL and button */

/* actual input for sharing URL, change to ".ccr-addcomment-permissionstab-url-value" */
    input[type=text].ccr-addcomment-permissionstab-url-value {
        font-size: 11px;
        padding: 10px;
        background-color: var(--ccr-surface-input-dark);
        border: 1px solid var(--ccr-border);
        width: 80%;
        color: var(--ccr-text-strong);
        margin-top: 0;
    }

    /* button for copying sharing URL, change to ".ccr-addcomment-permissionstab-url-button" */
    .ccr-addcomment-permissionstab .ccr-addcomment-permissionstab-url-button {
        width: 20%;
        background-color: var(--ccr-surface-2);
        border: 1px solid var(--ccr-border);
        align-content: center;
        cursor: pointer;
        padding: 10px;
    }

    .ccr-addcomment-permissionstab .ccr-addcomment-permissionstab-url-button:hover {
        background-color: var(--ccr-surface-4);
    }

    /* text inside button, update as above */

/* change to ccr */
    .ccr-judging-floating-comments {
        display: none;
        position: fixed;
        /* right: 10px; */
        bottom: 10px;
        /* width: 250px; */
        max-height: 200px;
        background-color: var(--ccr-surface-floating-bg);
        padding: 10px;
        border: 1px solid var(--ccr-border-floating);
        border-radius: 5px;
        overflow: scroll;
        z-index: 99999;
    }

    .spinner {
        width: 16px;
        height: 16px;
        border: 2px solid #fff;
        border-top: 2px solid #000;
        border-radius: 50%;
        animation: spin 0.7s linear infinite;
        margin-left: 10px;
        display: inline-block;
        vertical-align: middle;
    }

    /* END "ADD COMMENT" SECTION */

/* START "VIEW COMMENT" SECTION" */

    /* holds comments */

/* individual comment section change to .ccr-comment */
    .ccr-comment {
        display: flex;
        gap: 10px;
        margin-bottom: 15px;
        background-color: var(--ccr-surface-2);
        border: 1px solid var(--ccr-border-faint);
        border-radius: 5px;
        overflow: hidden;
    }

    /* change to ".ccr-comment-body" */
    .ccr-comment-body {
        width: 100%;
    }

    /* change to "ccr-comment-body p" */
    .ccr-comment-body p {
        font-size: 14px;
    }

/* unsure if used but if so change to "ccr-comment-add-input" */
    .ccr-comment-add-input {
        margin-top: auto;
        align-items: center;
    }

    .small {
        font: 120px sans-serif;
        font-weight: 300;
    }

    /* wraps control sections of comments i.e top section, change to .ccr-comment-control-container */
    .ccr-comment-control-container {
        border-bottom: 1px solid var(--ccr-border-faint);
    }

    /* very generic section used to wrap controls for comments, suggest wrapping info sections in ccr-info-section so .ccr-control-section just has actual controls, change to ccr */
    .ccr-control-section {
        display: flex;
        padding-bottom: 5px;
        margin: 0px 10px 10px 10px;
        color: var(--ccr-text-strong);
        gap: 10px;
    }

    /* suggested new container for the info section above the comment controls, still sits under .ccr-comment-control-container  */
    .ccr-info-section {
        display: flex;
        padding-bottom: 5px;
        margin: 10px 10px 5px 10px;
        color: var(--ccr-text-strong);
        gap: 10px;
    }

    /* holds various controls for comments */
    .ccr-comment-control {
        border-radius: 3px;
        padding: 5px;
        color: #007bff;
        flex-grow: 1;
    }

    /* suggested to add .ccr-comment-info to wrap info boxes inside ".ccr-comment-control-container" to differentiate between actual controls vs info boxes) */
    .ccr-comment-info {
        border-radius: 3px;
        padding: 5px;
        color: #007bff;
        flex-grow: 1;
    }

    /* can stay the same and we will use either .ccr-comment-control or .ccr-comment-info to handle different styles */
    .ccr-comment-info-title {
        font-size: 10px !important;
        margin-bottom: 2px !important;
        color: var(--ccr-text-strong) !important;
        font-weight: 600 !important;
        text-transform: capitalize !important;
    }

    /* can stay the same and we will use either .ccr-comment-control or .ccr-comment-info to handle different styles */
    .ccr-comment-info-value{
        font-size: 12px !important;
        margin-bottom: 0px !important;
        color: var(--ccr-text-strong) !important;
        text-transform: capitalize !important;
    }

    /* can stay the same and we will use either .ccr-comment-control or .ccr-comment-info to handle different styles */
    .ccr-comment-control-title {
        margin-bottom: 0px !important;
        /* color: black; */
    }

    /* comment control button container - placed inside a control element */
    .ccr-control-button-container {
        display: flex;
        justify-content: center;
        align-items: center;
        text-align: center;
        padding: 10px;
        cursor: pointer;
        font-size: 0.9rem;
        color: var(--ccr-text-strong);
        border: 1px solid var(--ccr-border-soft);
        background-color: var(--ccr-surface-2);
        font-weight: 600;
        font-size: 12px;
        transition: all ease-in-out 300ms;
    }

    /* comment control button text */
    .ccr-control-button-container p {
        font-weight: 600;
        font-size: 12px;
    }

    /* comment control button hover */
    .ccr-control-button-container:hover {
        background-color: var(--ccr-surface-4);
        color: var(--ccr-text-strong);
        transition: all ease-in-out 300ms;
    }

    /* DONE */
    /* delete comment button */
    .ccr-control-end {
        border-right: 0px;
        background-color: var(--ccr-color-danger);
        border: 0;
    }

    /* delete comment button hover */
    .ccr-control-end:hover {
        background-color: var(--ccr-color-danger);
    }

    /* delete comment button text */
    .ccr-control-end p {
        margin: 0px;
        color: var(--ccr-text-on-action);
        font-weight: 600;
    }

    .plyr__menu__container [role="menu"] {
        display: flex;
        flex-direction: row;
    }

    .plyr__menu__container [role="menu"] button[data-plyr="speed"] {
        width: auto;
    }

    .hidden {
        display: none;
    }

    .disabled {
        pointer-events: none;
        opacity: 0.6;
    }

    /* .plyr--video .plyr__controls {
  position: static;
  margin-top: 8px;
} */
    #ccr-custom-controls {
        padding-left: 10px;
        padding-right: 10px;
        background-color: #000000;
    }

    #ccr-custom-controls .plyr__controls__item {
        color: var(--ccr-text-strong);
    }

    #ccr-custom-controls .plyr__progress progress {
        background-color: var(--ccr-surface-3);
    }

    #ccr-custom-controls #ccr-custom-current-time {
        min-width: 50px;
    }

    #ccr-custom-progress {
        color: var(--ccr-text-disabled);
    }

    .ccr-judging-error-container {
        width: 100%;
        padding: 20px;
        margin: 0px 0px 20px 0px;
        background-color: var(--ccr-error-bg);
        color: var(--ccr-error-text);
        border: 1px solid var(--ccr-error-border);
        border-radius: 5px;
        text-align: center;
    }

    .plyr__video-wrapper {
        aspect-ratio: 16/9;
        /* background: black; */
    }

    .ccr-highlighted-comment {
        border: 1px solid var(--cc-judging-theme-color);
        box-shadow: 0 0 10px var(--cc-judging-theme-color);
    }

    .plyr {
        display: flex !important;
        flex-direction: column !important;
    }

    .plyr__video-wrapper {
        order: 1;
    }

    .plyr__controls {
        order: 2;
        position: static !important;
        width: 100% !important;
        padding: 10px !important;
    }

    @media screen and (max-width: 1023px) {
        .ccr-judging-annotation-container {
            flex-direction: column;
        }

        .ccr-plyr-container {
            width: 100%;
            flex: unset;
            height: auto;
            /* Disable sticky in stacked layout — otherwise the player pins
             * to the top and covers the annotation list scrolling underneath. */
            position: static;
            top: auto;
        }

.ccr-judging-player-container {
            flex: unset;
        }
    }

    /* =========================================================================
     * Primitives — composed by element-specific classes in markup. Each
     * primitive provides typography/padding/border/surface baselines; specific
     * class rules layer on layout (width, gap, position).
     *
     * Defined after element-specific rules so primitive values win on equal
     * specificity. Existing class declarations that duplicate primitives are
     * functionally inert; cleanup deferred.
     * ===================================================================== */

    /* Base: typography, padding, layout reset only. No background, colour, or
     * border — variants own those, or the variant-less element keeps whatever
     * its existing class rule provides (e.g. .ccr-addcomment-footer-button-delete
     * keeps providing the filled-black look on the Cancel button). */

.ccr-btn.disabled {
        opacity: 0.5;
        pointer-events: none;
    }

    .ccr-card {
        background-color: var(--ccr-surface-2);
        border: 1px solid var(--ccr-border-faint);
        border-radius: 5px;
        overflow: hidden;
    }

/* =========================================================================
     * Routine Bounds card — wraps Set Start/End + derived Duration readout.
     * Replaces the previous three-equal-rows layout that made Routine Duration
     * look like a button affordance.
     * ===================================================================== */

/* =========================================================================
     * Click-to-seek affordances
     * - Set Start / Set End time readouts: clicking the displayed time seeks
     *   the player back to that point.
     * - Annotation ID box (purple) on owner-editable cards: click → seek.
     * - Whole annotation card on read-only cards: click → seek.
     * ===================================================================== */

.ccr-comment .ccr-addcomment-control-id {
        cursor: pointer;
        transition: filter 0.18s ease;
    }

    .ccr-comment .ccr-addcomment-control-id:hover {
        filter: brightness(1.15);
    }

    .ccr-comment-readonly {
        cursor: pointer;
        transition: filter 0.18s ease;
    }

    .ccr-comment-readonly:hover {
        filter: brightness(1.1);
    }

    /* =========================================================================
     * Visibility tab — card-list permissions chooser. Replaces the four-radio
     * list with selectable cards. Each card has a title + description; the
     * "Anyone with the link" option gets a subtle warning treatment per the
     * 8 May call (goal: reduce reliance for safety/deduction notes).
     * ===================================================================== */

    .ccr-permission-options {
        display: flex;
        flex-direction: column;
        gap: 6px;
        margin-bottom: 0;
    }

    .ccr-permission-option {
        border: 1px solid var(--ccr-border-faint);
        border-radius: 5px;
        transition: border-color 0.18s ease, background-color 0.18s ease;
    }

    .ccr-permission-option:hover {
        border-color: var(--ccr-border);
        background-color: var(--ccr-surface-2);
    }

    .ccr-permission-option:has(input:checked) {
        border-color: var(--ccr-color-brand);
        background-color: var(--ccr-surface-2);
    }

/* Override inherited ::before radio dot — selection is shown by the
     * card border/background instead. */
    .ccr-permission-options .ccr-permission-option label::before {
        display: none;
    }

/* =========================================================================
     * Empty state — shown in the comments container when a routine has zero
     * annotations. Subtle dashed border so it reads as "scaffolding to fill"
     * rather than a real card.
     * ===================================================================== */

    .ccr-empty-state {
        padding: 24px 16px;
        /* Match the rail-header's 14px inset so the dashed border doesn't
         * hug the AddBar above or the bottom of the rail. */
        margin: 14px;
        text-align: center;
        border: 1px dashed var(--ccr-border-faint);
        border-radius: 5px;
        background-color: transparent;
    }

    .ccr-empty-state-title {
        margin: 0 0 4px 0 !important;
        font-size: 13px;
        font-weight: 600;
        color: var(--ccr-text-muted);
        text-transform: none;
    }

    .ccr-empty-state-description {
        margin: 0 !important;
        font-size: 11px;
        color: var(--ccr-text-faint);
        text-transform: none;
        line-height: 1.4;
    }

    /* =========================================================================
     * Touch-target floor for tablet/coarse pointers. Judges work primarily
     * from laptops + tablets; tablets use coarse pointer (touch). Bump
     * actionable controls to ≥44px under that query. Mouse-driven laptops
     * (fine pointer) keep tighter sizing.
     * ===================================================================== */

    @media (pointer: coarse) {

/* Plyr's default controls are 32×32; bump for touch */
        .ccr-plyr-container .plyr__control {
            min-width: 44px;
            min-height: 44px;
        }
    }

    /* =========================================================================
     * Option B — Rail restructure
     * Right rail is now a single container with:
     *   - Routine Bounds flat 3-col row at top
     *   - Composer (always-visible single-line input; expands on click)
     *   - Annotation list below
     *
     * Desktop (>= 1024px): rail is sticky-top so it stays visible as page
     * scrolls; composer is sticky inside the rail so it remains at the top
     * of the rail viewport-area.
     *
     * Tablet (< 1024px): rail switches to a grid (player + composer + list)
     * with the list taking remaining viewport height and scrolling
     * internally.
     * ===================================================================== */

    .ccr-judging-rail {
        width: 30%;
        display: flex;
        flex-direction: column;
        gap: 0;
        align-self: stretch;
        position: sticky;
        top: 10px;
        max-height: calc(100vh - 20px);
        min-height: 500px;
        background: var(--panel);
        border-bottom: 1px solid var(--border);
        /* Rail is now the scroll container — bounds + composer + annotation
         * list all flow inside it. Composer below uses its existing
         * `position: sticky; top: 0` to pin to the rail's scroll top once
         * the bounds row scrolls past. */
        overflow-y: auto;
    }

    /* Routine Bounds — flat 3-column row, no card framing */
    .ccr-routine-bounds-row {
        display: grid;
        grid-template-columns: 1fr 1fr 1fr;
        gap: 12px;
        padding: 0 2px;
    }

.ccr-rb-label {
        grid-row: 1;
        grid-column: 1 / -1;
        font-size: 10px;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.04em;
        color: var(--ccr-text-faint);
    }

    .ccr-rb-value {
        grid-row: 2;
        grid-column: 1;
        font-size: 16px;
        font-weight: 700;
        color: var(--ccr-text-strong);
        font-variant-numeric: tabular-nums;
        cursor: pointer;
        transition: color 0.18s ease;
        line-height: 1;
    }

    .ccr-rb-value:hover {
        color: var(--ccr-color-brand-soft);
    }

    .ccr-rb-action {
        grid-row: 2;
        grid-column: 2;
        font-size: 11px;
        font-weight: 600;
        color: var(--ccr-text-muted);
        background-color: var(--ccr-surface-2);
        border: 1px solid var(--ccr-border-soft);
        padding: 4px 10px;
        border-radius: 4px;
        cursor: pointer;
        transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease;
        line-height: 1;
    }

    .ccr-rb-action:hover {
        background-color: var(--ccr-surface-4);
        border-color: var(--ccr-border);
        color: var(--ccr-text-strong);
    }

    /* Composer — always-visible at top of rail. Single-line collapsed by
     * default; clicking expands to the full annotation form. */
    .ccr-composer {
        position: sticky;
        top: 0;
        z-index: 5;
        /* Opaque bg so the routine-bounds row scrolling underneath is
         * hidden behind the composer when it pins to the top. */
        background-color: var(--panel);
    }

.ccr-composer-time {
        font-variant-numeric: tabular-nums;
        font-weight: 600;
        color: var(--ccr-text-muted);
    }

.ccr-composer-expanded {
        display: none;
    }

    /* When the composer is expanded, hide the collapsed line and show the
     * expanded form. JS toggles data-state on the composer wrapper. */
    .ccr-composer[data-state="expanded"] .ccr-composer-collapsed {
        display: none;
    }

    .ccr-composer[data-state="expanded"] .ccr-composer-expanded {
        display: block;
    }

    /* When expanded, the composer escapes the rail-header's 14px padding so
     * the editor sits edge-to-edge of the rail (per Claude Design EditorCard
     * which renders at the rail width, no surrounding padding). The collapsed
     * AddBar keeps the inset so it matches the Routine Bounds row width. */
    .ccr-judging-container .ccr-rail-header .ccr-composer[data-state="expanded"] {
        margin: 0 -14px -14px;
    }

    /* Annotation list — flat rows separated by spacing, no per-item card.
     * Each row has a 3px type-coloured stripe on the left, summary in the
     * collapsed state (ID pill + time + truncated preview), and full
     * details in the expanded state. */
    .ccr-annotation-list {
        /* Rail is now the scroll container — annotation-list is just flow
         * content inside it, sized to its own content height. */
        flex: 0 0 auto;
        min-height: 0;
        overflow: visible;
        padding-right: 2px;
        margin-top: 0;
        display: flex;
        flex-direction: column;
    }

    .ccr-annotation-row {
        display: flex;
        align-items: stretch;
        gap: 10px;
        padding: 10px 0;
        border-bottom: 1px solid var(--ccr-border-faint);
        transition: background-color 0.18s ease;
    }

    .ccr-annotation-row:last-child {
        border-bottom: 0;
    }

    .ccr-annotation-row:hover {
        background-color: var(--ccr-surface-2);
    }

    .ccr-annotation-stripe {
        width: 3px;
        flex-shrink: 0;
        border-radius: 2px;
        background-color: var(--ccr-type-comment);
    }

    .ccr-annotation-row[data-type="warning"] .ccr-annotation-stripe {
        background-color: var(--ccr-type-warning);
    }

    .ccr-annotation-row[data-type="legality"] .ccr-annotation-stripe {
        background-color: var(--ccr-type-legality);
    }

    .ccr-annotation-row[data-type="deduction"] .ccr-annotation-stripe {
        background-color: var(--ccr-type-deduction);
    }

    .ccr-annotation-row[data-type="comment"] .ccr-annotation-stripe {
        background-color: var(--ccr-type-comment);
    }

    .ccr-annotation-body {
        flex: 1;
        min-width: 0;
        display: flex;
        flex-direction: column;
        gap: 6px;
    }

    .ccr-annotation-summary {
        display: grid;
        grid-template-columns: auto auto 1fr;
        align-items: center;
        gap: 10px;
        cursor: pointer;
        min-width: 0;
    }

    .ccr-annotation-id {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-width: 28px;
        height: 22px;
        padding: 0 8px;
        background-color: var(--cc-judging-theme-color);
        color: var(--ccr-text-on-action);
        font-size: 11px;
        font-weight: 700;
        border-radius: 4px;
        cursor: pointer;
        transition: filter 0.18s ease;
    }

    .ccr-annotation-id:hover {
        filter: brightness(1.15);
    }

    .ccr-annotation-time {
        font-size: 12px;
        font-weight: 600;
        font-variant-numeric: tabular-nums;
        color: var(--ccr-text-muted);
        white-space: nowrap;
    }

    .ccr-annotation-preview {
        font-size: 12px;
        color: var(--ccr-text-faint);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        min-width: 0;
    }

    /* Expanded state — show full body + actions. Hide preview text since
     * the full content is now visible. */
    .ccr-annotation-row[data-expanded="true"] .ccr-annotation-preview {
        display: none;
    }

    .ccr-annotation-details {
        display: none;
    }

    .ccr-annotation-row[data-expanded="true"] .ccr-annotation-details {
        display: flex;
        flex-direction: column;
        gap: 8px;
    }

    .ccr-annotation-meta {
        display: flex;
        gap: 12px;
        font-size: 11px;
        color: var(--ccr-text-faint);
    }

.ccr-annotation-row .ccr-comment-text-container {
        padding: 0;
        max-height: 250px;
        overflow-y: auto;
        color: var(--ccr-text-strong);
        font-size: 12px;
        line-height: 1.4;
    }

.ccr-annotation-actions.hidden {
        display: none;
    }

/* Tablet stacked layout: player full-width with natural 16:9 at top,
     * then rail below in normal page flow. The composer stays sticky to
     * the top of the viewport once the user scrolls past the player, so
     * it's always accessible while reading the annotation list. List
     * scrolls with the page (no internal scroll container) — keeps the
     * Breakdance routine info bar accessible above without fighting it.
     *
     * Previously experimented with a viewport-fit grid (auto/auto/auto/1fr
     * with list overflow-y:auto) but the Breakdance routine info bar
     * pushed composer/list below the fold on iPad portrait. The simpler
     * page-flow pattern works better. */
    @media screen and (max-width: 1023px) {
        .ccr-judging-rail {
            width: 100%;
            position: static;
            max-height: none;
            min-height: 0;
            margin-top: 0;
        }

        .ccr-composer {
            background-color: var(--ccr-surface-1);
        }

        .ccr-annotation-list {
            overflow-y: visible;
            max-height: none;
        }
    }

    /* =========================================================================
     * Draw tab — single-row toolbar.
     * Replaces the previous two-column "Add Shape" / "Edit Selected Shape"
     * grouping with one horizontal toolbar: shape tools | spacer | colour
     * swatch + Delete. Colour swatch is persistent (always interactive) so
     * its picker sets the colour for both new shapes and the currently
     * selected shape.
     * ===================================================================== */

/* Persistent colour swatch: keep visually active even when no shape is
     * selected (JS still toggles .disabled, but this overrides the visual). */
    .ccr-addcomment-tab-content .ccr-color-picker.disabled,
    .ccr-draw-toolbar .ccr-color-picker.disabled {
        opacity: 1;
        pointer-events: auto;
    }

/* =============================================================================
 * Phase 2 — Rail content (Routine Bounds chips, AddBar, AnnotationRow, ExpandedCard)
 *
 * All scoped under .ccr-judging-container so they consume the Phase 1 design
 * tokens (--bg, --panel, --surface, --accent, etc.) without leaking out.
 *
 * Phase 2 replaces only the rail-content visuals. Older rules above (e.g.
 * .ccr-rb-item, the original .ccr-composer-collapsed, .ccr-annotation-id
 * brand-purple pill) no longer match the new markup; they're dead and get
 * removed in Phase 5 cleanup.
 * ============================================================================= */

.ccr-judging-container .mono {
    font-family: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, monospace;
    font-feature-settings: "ss01";
    font-variant-numeric: tabular-nums;
}

.ccr-judging-container .ccr-svg-icon {
    width: 1em;
    height: 1em;
    display: inline-block;
    vertical-align: middle;
}

/* --- Rail header (chip row + AddBar) -------------------------------------- */

.ccr-judging-container .ccr-rail-header {
    padding: 14px;
    border-bottom: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ccr-judging-container .ccr-rail-header .ccr-routine-bounds-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 10px;
    padding: 0;
}

.ccr-judging-container .ccr-rb-chip {
    padding: 11px 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-width: 0;
}

.ccr-judging-container .ccr-rb-chip-meta {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}

.ccr-judging-container .ccr-rail-header .ccr-rb-label {
    font-size: 9.5px;
    font-weight: 500;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: var(--fg-4);
}

.ccr-judging-container .ccr-rail-header .ccr-rb-value {
    font-size: 13px;
    color: var(--fg);
    font-variant-numeric: tabular-nums;
    font-weight: 500;
}

.ccr-judging-container .ccr-rail-header .ccr-rb-action {
    padding: 6px 10px;
    font-size: 10px;
    font-weight: 500;
    background: var(--surface-2);
    color: var(--fg-2);
    border: 1px solid var(--border-2);
    border-radius: 4px;
    cursor: pointer;
    transition: background 100ms, border-color 100ms, color 100ms;
    line-height: 1;
}

.ccr-judging-container .ccr-rail-header .ccr-rb-action:hover {
    background: var(--hover);
    border-color: var(--border-3);
    color: var(--fg);
}

.ccr-judging-container .ccr-rail-header .ccr-rb-action[data-loading="true"] {
    pointer-events: none;
    color: transparent;
    position: relative;
}

.ccr-judging-container .ccr-rail-header .ccr-rb-action[data-loading="true"]::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 10px;
    height: 10px;
    margin: -5px 0 0 -5px;
    border: 1.5px solid var(--fg-2);
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

/* --- AddBar (primary CTA) ------------------------------------------------- */

.ccr-judging-container .ccr-addbar {
    display: flex;
    align-items: stretch;
    gap: 0;
    height: 44px;
    width: 100%;
    padding: 0;
    background: var(--accent);
    border: none;
    border-radius: 7px;
    overflow: hidden;
    cursor: pointer;
    text-align: left;
    color: var(--accent-fg);
    font-family: inherit;
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.18) inset, 0 1px 2px rgba(0, 0, 0, 0.3);
    transition: filter 120ms, box-shadow 120ms;
}

.ccr-judging-container .ccr-addbar:hover {
    filter: brightness(1.06);
    box-shadow: 0 0 0 3px var(--accent-soft), 0 1px 0 rgba(255, 255, 255, 0.18) inset;
}

.ccr-judging-container .ccr-addbar-time {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 12px;
    background: rgba(0, 0, 0, 0.10);
    border-right: 1px solid rgba(0, 0, 0, 0.14);
    color: var(--accent-fg);
    font-size: 12.5px;
    font-weight: 600;
    opacity: 0.9;
}

.ccr-judging-container .ccr-addbar-time .ccr-svg-icon {
    width: 13px;
    height: 13px;
    opacity: 0.75;
}

.ccr-judging-container .ccr-addbar-label {
    flex: 1;
    display: flex;
    align-items: center;
    padding: 0 14px;
    font-size: 13.5px;
    font-weight: 600;
    letter-spacing: 0.1px;
}

.ccr-judging-container .ccr-addbar-plus {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 14px;
}

.ccr-judging-container .ccr-addbar-plus .ccr-svg-icon {
    width: 16px;
    height: 16px;
}

/* --- Annotation list (rebuild on top of Stage-3 base) -------------------- */

.ccr-judging-container .ccr-annotation-list {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: visible;
    padding: 0;
    margin-top: 0;
    display: block;
}

.ccr-judging-container .ccr-annotation-row {
    position: relative;
    display: block;
    gap: 0;
    padding: 0;
    background: transparent;
    border-bottom: 1px solid var(--border);
    transition: background 100ms;
}

.ccr-judging-container .ccr-annotation-row:hover {
    background: rgba(255, 255, 255, 0.02);
}

.ccr-judging-container .ccr-annotation-row[data-expanded="true"] {
    background: var(--surface);
}

.ccr-judging-container .ccr-annotation-row .ccr-annotation-stripe {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 2px;
    background-color: var(--type-comment);
    border-radius: 2px;
    opacity: 0.7;
    /* Render above the sticky meta-header (z-index:1) so the stripe
     * stays visible across the full row height when expanded — the
     * meta-header's --surface background would otherwise cover it. */
    z-index: 2;
    flex: none;
}

.ccr-judging-container .ccr-annotation-row[data-expanded="true"] .ccr-annotation-stripe {
    opacity: 1;
}

.ccr-judging-container .ccr-annotation-row[data-type="warning"] .ccr-annotation-stripe {
    background-color: var(--type-warning);
}
.ccr-judging-container .ccr-annotation-row[data-type="legality"] .ccr-annotation-stripe {
    background-color: var(--type-legality);
}
.ccr-judging-container .ccr-annotation-row[data-type="deduction"] .ccr-annotation-stripe {
    background-color: var(--type-deduction);
}
.ccr-judging-container .ccr-annotation-row[data-type="comment"] .ccr-annotation-stripe {
    background-color: var(--type-comment);
}

.ccr-judging-container .ccr-annotation-row .ccr-annotation-body {
    flex: none;
    display: block;
    margin-left: 0;
    min-width: 0;
}

/* --- Summary (collapsed) ------------------------------------------------- */

.ccr-judging-container .ccr-annotation-row .ccr-annotation-summary {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 12px 11px 14px;
    cursor: pointer;
    grid-template-columns: none;
}

.ccr-judging-container .ccr-annotation-row[data-expanded="true"] .ccr-annotation-summary {
    display: none;
}

/* IDChip — neutral mono chip, overrides Stage-3's brand-purple pill */
.ccr-judging-container .ccr-annotation-row .ccr-annotation-id {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 26px;
    height: 22px;
    padding: 0 6px;
    background: var(--surface-2);
    color: var(--fg-2);
    border: 1px solid var(--border-2);
    border-radius: 5px;
    font-size: 11px;
    font-weight: 600;
    line-height: 1;
    font-variant-numeric: tabular-nums;
    cursor: pointer;
    transition: filter 100ms, background 100ms;
    font-family: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, monospace;
}

.ccr-judging-container .ccr-annotation-row .ccr-annotation-id:hover {
    background: var(--hover);
}

.ccr-judging-container .ccr-annotation-row .ccr-annotation-time {
    font-size: 12px;
    color: var(--fg-2);
    font-variant-numeric: tabular-nums;
    min-width: 40px;
}

.ccr-judging-container .ccr-annotation-row .ccr-annotation-preview {
    flex: 1;
    min-width: 0;
    font-size: 13px;
    color: var(--fg);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ccr-judging-container .ccr-row-chevron {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 5px;
    color: var(--fg-3);
    cursor: pointer;
    padding: 0;
    opacity: 0.6;
    transition: background 100ms, color 100ms, opacity 100ms;
    flex: none;
}

.ccr-judging-container .ccr-row-chevron .ccr-svg-icon { width: 12px; height: 12px; }

.ccr-judging-container .ccr-row-chevron:hover {
    background: var(--hover);
    color: var(--fg-2);
    opacity: 1;
}

/* --- Expanded card (details) -------------------------------------------- */

.ccr-judging-container .ccr-annotation-row .ccr-annotation-details {
    display: none;
}

.ccr-judging-container .ccr-annotation-row[data-expanded="true"] .ccr-annotation-details {
    display: block;
}

.ccr-judging-container .ccr-annotation-meta-header {
    position: sticky;
    top: 0;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px 10px 14px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    cursor: pointer;
}

.ccr-judging-container .ccr-annotation-duration {
    font-size: 12px;
    color: var(--fg-4);
    font-variant-numeric: tabular-nums;
}

.ccr-judging-container .ccr-annotation-meta-spacer {
    flex: 1;
}

/* Type badge */
.ccr-judging-container .ccr-type-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 6px 2px 5px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 0.2px;
    border: 1px solid;
    line-height: 1;
}

.ccr-judging-container .ccr-type-badge .ccr-svg-icon {
    width: 10px;
    height: 10px;
}

.ccr-judging-container .ccr-type-badge-label {
    text-transform: capitalize;
}

.ccr-judging-container .ccr-type-warning {
    background: var(--type-warning-soft);
    color: var(--type-warning);
    border-color: rgba(245, 165, 36, 0.30);
}
.ccr-judging-container .ccr-type-legality {
    background: var(--type-legality-soft);
    color: var(--type-legality);
    border-color: rgba(251, 146, 60, 0.30);
}
.ccr-judging-container .ccr-type-deduction {
    background: var(--type-deduction-soft);
    color: var(--type-deduction);
    border-color: rgba(244, 63, 94, 0.30);
}
.ccr-judging-container .ccr-type-comment {
    background: var(--type-comment-soft);
    color: var(--type-comment);
    border-color: rgba(106, 169, 255, 0.30);
}

/* Card actions — icon buttons in expanded meta header */
.ccr-judging-container .ccr-card-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 5px;
    color: var(--fg-2);
    cursor: pointer;
    padding: 0;
    transition: background 100ms, color 100ms, border-color 100ms;
}

.ccr-judging-container .ccr-card-action .ccr-svg-icon {
    width: 13px;
    height: 13px;
}

.ccr-judging-container .ccr-card-action:hover {
    background: var(--hover);
    color: var(--fg);
}

.ccr-judging-container .ccr-card-action--danger {
    color: var(--danger);
}

.ccr-judging-container .ccr-card-action--danger:hover {
    background: rgba(244, 63, 94, 0.08);
    color: var(--danger);
}

.ccr-judging-container .ccr-card-action.disabled,
.ccr-judging-container .ccr-card-action[disabled] {
    opacity: 0.35;
    pointer-events: none;
}

/* Expanded body — rich text */
.ccr-judging-container .ccr-annotation-row .ccr-comment-text-container {
    max-height: 280px;
    overflow-y: auto;
    padding: 14px 16px 16px;
    font-size: 13px;
    line-height: 1.55;
    color: var(--fg);
    border: 0;
    margin: 0;
}

/* Links inside rendered comments — match the editor's link styling
 * (ccr-comment-editor.css `.ProseMirror a`) so a comment looks identical
 * before/after save. The browser default blue would otherwise read as
 * a different element. */
.ccr-judging-container .ccr-annotation-row .ccr-comment-text-container a {
    color: var(--cc-judging-theme-lighter, #c5b5fb);
    text-decoration: underline;
}

.ccr-judging-container .ccr-empty-body {
    color: var(--fg-4);
}

/* =========================================================================
 * PHASE 3a — COMPOSER EDITOR CARD (single-row meta)
 *
 * Matches the canonical Judging Page EditorCard from rail.jsx:
 *   .ccr-composer-card  — outer (panel bg, border-bottom only; flush in rail)
 *   .ccr-composer-meta  — single horizontal row, surface bg, border-bottom:
 *                         [#id chip] [🕐 time] ─spacer─ [Type ▾] [− 3s +]
 *
 * Tabs / textarea / drawing toolbar / permissions / footer below the meta
 * row are still legacy markup — they'll be rewritten in Phase 3b/3c.
 * ===================================================================== */

/* AddBar disappears when the composer expands so it doesn't double up with
 * the form. JS toggles data-state on #ccr-composer. */
.ccr-judging-container .ccr-composer[data-state="expanded"] .ccr-addbar {
    display: none;
}

.ccr-judging-container .ccr-composer-card {
    width: 100%;
    background: var(--panel);
    border-bottom: 1px solid var(--border);
}

/* --- Single meta row ---------------------------------------------------- */

.ccr-judging-container .ccr-composer-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 12px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

.ccr-judging-container .ccr-composer-id-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 24px;
    padding: 0 8px;
    background: var(--accent-soft);
    color: var(--accent-text);
    border: 1px solid var(--accent-border);
    border-radius: 5px;
    font-size: 12px;
    font-weight: 600;
}

.ccr-judging-container .ccr-composer-meta-time {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 0 4px;
    color: var(--fg-2);
}

.ccr-judging-container .ccr-composer-meta-clock {
    width: 12px;
    height: 12px;
    color: var(--fg-3);
}

.ccr-judging-container .ccr-composer-meta-time-value {
    font-size: 12px;
}

.ccr-judging-container .ccr-composer-meta-spacer {
    flex: 1;
}

/* --- Duration stepper (compact 24px variant for meta row) --------------- */

.ccr-judging-container .ccr-duration-stepper {
    display: flex;
    align-items: stretch;
    height: 24px;
    max-width: 150px;
    background: var(--surface-2);
    border: 1px solid var(--border-2);
    border-radius: 6px;
}

/* First/last button carry the rounded corners (matching parent radius
 * minus its 1px border) so hover fills still clip to the rounded
 * shape without needing overflow:hidden on the parent — which would
 * clip the keyboard focus ring on left/right/top/bottom edges. */
.ccr-judging-container .ccr-stepper-btn {
    width: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--fg-2);
    cursor: pointer;
    padding: 0;
    transition: background 100ms, color 100ms;
}

.ccr-judging-container .ccr-stepper-btn:first-child {
    border-top-left-radius: 5px;
    border-bottom-left-radius: 5px;
}

.ccr-judging-container .ccr-stepper-btn:last-child {
    border-top-right-radius: 5px;
    border-bottom-right-radius: 5px;
}

.ccr-judging-container .ccr-stepper-btn:hover {
    background: var(--hover);
    color: var(--fg);
}

.ccr-judging-container .ccr-stepper-btn:disabled,
.ccr-judging-container .ccr-stepper-btn[aria-disabled="true"] {
    opacity: 0.35;
    cursor: not-allowed;
    pointer-events: none;
}

.ccr-judging-container .ccr-stepper-btn .ccr-svg-icon {
    width: 11px;
    height: 11px;
}

.ccr-judging-container .ccr-stepper-value {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 12px;
    min-width: 36px;
    font-size: 12px;
    font-weight: 500;
    color: var(--fg);
    border-left: 1px solid var(--border-2);
    border-right: 1px solid var(--border-2);
}

/* --- Type dropdown (compact inline variant for meta row) ---------------- */

.ccr-judging-container .ccr-type-dropdown {
    position: relative;
}

.ccr-judging-container .ccr-type-dropdown-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 24px;
    padding: 0 6px 0 8px;
    gap: 5px;
    background: var(--surface-2);
    color: var(--fg);
    border: 1px solid var(--border-2);
    border-radius: 5px;
    font-size: 12px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: background 100ms, border-color 100ms;
}

.ccr-judging-container .ccr-type-dropdown-trigger:hover {
    background: var(--hover);
    border-color: var(--border-3);
}

.ccr-judging-container .ccr-type-dropdown-current {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-width: 0;
}

.ccr-judging-container .ccr-type-dropdown-current-icon {
    width: 11px;
    height: 11px;
    flex: none;
}

.ccr-judging-container .ccr-type-dropdown-current-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ccr-judging-container .ccr-type-dropdown-trigger > .ccr-svg-icon {
    width: 10px;
    height: 10px;
    color: var(--fg-3);
    flex: none;
}

.ccr-judging-container .ccr-type-dropdown-menu {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    min-width: 180px;
    background: var(--surface);
    border: 1px solid var(--border-3);
    border-radius: 7px;
    box-shadow:
        0 12px 28px rgba(0, 0, 0, 0.55),
        0 2px 6px rgba(0, 0, 0, 0.4);
    padding: 4px;
    z-index: 10;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.ccr-judging-container .ccr-type-dropdown-menu[hidden] {
    display: none;
}

.ccr-judging-container .ccr-type-dropdown-item {
    display: flex;
    align-items: center;
    gap: 9px;
    width: 100%;
    height: 30px;
    padding: 0 8px;
    background: transparent;
    color: var(--fg);
    border: 1px solid transparent;
    border-radius: 5px;
    font-size: 13px;
    font-weight: 400;
    font-family: inherit;
    cursor: pointer;
    text-align: left;
    transition: background 80ms;
}

.ccr-judging-container .ccr-type-dropdown-item:hover {
    background: var(--hover);
}

.ccr-judging-container .ccr-type-dropdown-item[aria-selected="true"] {
    background: var(--hover);
}

.ccr-judging-container .ccr-type-dropdown-item-icon {
    width: 13px;
    height: 13px;
    flex: none;
}

.ccr-judging-container .ccr-type-dropdown-item-label {
    flex: 1;
}

.ccr-judging-container .ccr-type-dropdown-item-check {
    width: 12px;
    height: 12px;
    color: var(--accent-text);
    display: none;
}

.ccr-judging-container .ccr-type-dropdown-item-check .ccr-svg-icon {
    width: 12px;
    height: 12px;
}

.ccr-judging-container .ccr-type-dropdown-item[aria-selected="true"] .ccr-type-dropdown-item-check {
    display: inline-flex;
}

/* =========================================================================
 * PHASE 3b — DRAWING TOOLBAR + RICH TEXT TOOLBAR
 *
 * The canonical EditorCard stacks:
 *   .ccr-composer-meta          — surface bg (3a)
 *   .ccr-composer-draw-toolbar  — bg / deeper background
 *   .ccr-editor-toolbar         — panel bg (TipTap toolbar reskinned below)
 *   .ccr-addcomment-commenttab  — panel bg, textarea (becomes --surface on focus)
 *
 * The TipTap toolbar markup lives in ccr-comment-editor.js — we just override
 * the visual style here, scoped to .ccr-composer-card, so the editor outside
 * the composer (if any) is unaffected.
 * ===================================================================== */

/* --- Drawing toolbar (deeper bg, sits below meta row) ------------------ */

.ccr-judging-container .ccr-composer-draw-toolbar {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px 12px;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
}

.ccr-judging-container .ccr-composer-toolbar-divider {
    width: 1px;
    height: 16px;
    background: var(--border-2);
    margin: 0 4px;
    flex: none;
}

.ccr-judging-container .ccr-draw-tool-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
    width: 28px;
    height: 28px;
    padding: 0;
    background: transparent;
    color: var(--fg-3);
    border: 1px solid transparent;
    border-radius: 5px;
    cursor: pointer;
    transition: background 100ms, color 100ms, border-color 100ms;
}

.ccr-judging-container .ccr-draw-tool-btn:hover {
background: var(--hover);
    color: var(--fg);
}

.ccr-judging-container .ccr-draw-tool-btn.ccr-active-shape,
.ccr-judging-container .ccr-draw-tool-btn[data-active="true"] {
    background: var(--surface-2);
    color: var(--fg);
    border-color: var(--border-3);
}

.ccr-judging-container .ccr-draw-tool-btn .ccr-svg-icon {
    width: 14px;
    height: 14px;
}

/* --- Color presets + custom color -------------------------------------- *
 * Layout matches the Preferences panel swatch row so the user sees the
 * same control vocabulary in both places — 28x28 button with a 16x16
 * coloured fill inside, plus a labeled Custom pill with the current
 * custom colour visible at rest. */

.ccr-judging-container .ccr-draw-color-swatch {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    width: 28px;
    height: 28px;
    padding: 0;
    background: transparent;
    border: 1.5px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    transition: border-color 100ms;
}


.ccr-judging-container .ccr-draw-color-swatch[data-selected="true"] {
    border-color: var(--fg);
}

.ccr-judging-container .ccr-draw-color-swatch-fill {
    width: 22px;
    height: 22px;
    border-radius: 5px;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18);
}

.ccr-judging-container .ccr-draw-color-custom {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 28px;
    margin: 0;
    padding: 0 10px 0 2px;
    background: var(--surface-2);
    border: 1.5px solid var(--border-2);
    border-radius: 8px;
    cursor: pointer;
    transition: border-color 100ms;
}

.ccr-judging-container .ccr-draw-color-custom[data-selected="true"] {
    border-color: var(--fg);
}

.ccr-judging-container .ccr-draw-color-custom-fill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
}

.ccr-judging-container .ccr-draw-color-custom-fill::before {
    content: "";
    width: 22px;
    height: 22px;
    border-radius: 5px;
    background: conic-gradient(from 180deg, #f43f5e, #f5a524, #3ecf8e, #6aa9ff, #a78bfa, #f43f5e);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18);
}

.ccr-judging-container .ccr-draw-color-custom[data-selected="true"] .ccr-draw-color-custom-fill::before {
    background: var(--ccr-draw-custom-color, conic-gradient(from 180deg, #f43f5e, #f5a524, #3ecf8e, #6aa9ff, #a78bfa, #f43f5e));
}

.ccr-judging-container .ccr-draw-color-custom-label {
    font-size: 11.5px;
    font-weight: 500;
    color: var(--fg-2);
}

.ccr-judging-container .ccr-draw-color-custom input[type="color"] {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    /* Override the legacy .ccr-color-picker-input rule's `margin: -50%`
     * (line ~895) which would otherwise float this input 41px outside
     * its label, where it sits on top of the Type dropdown and
     * intercepts its clicks. */
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
    opacity: 0;
    /* Hint to the browser/OS to render the native colour picker dialog
     * with a dark theme when it opens. Honoured by Chrome on most
     * platforms. */
    color-scheme: dark;
}

/* --- Clear (delete shape) button --------------------------------------- *
 * Two states: disabled (no shape selected) is a neutral grey button so it
 * doesn't read as a destructive action when there's nothing to delete.
 * Enabled (shape selected) goes red-tinted to signal danger. */

.ccr-judging-container .ccr-draw-clear-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    background: var(--danger-soft);
    color: var(--danger);
    border: 1px solid rgba(244, 63, 94, 0.30);
    border-radius: 5px;
    cursor: pointer;
    transition: background 100ms, color 100ms, border-color 100ms, opacity 100ms;
}

.ccr-judging-container .ccr-draw-clear-btn:hover {
    background: rgba(244, 63, 94, 0.20);
}

.ccr-judging-container .ccr-draw-clear-btn:disabled,
.ccr-judging-container .ccr-draw-clear-btn.disabled {
    background: transparent;
    color: var(--fg-3);
    border-color: var(--border-2);
    opacity: 0.6;
    pointer-events: none;
}


.ccr-judging-container .ccr-draw-clear-btn .ccr-svg-icon {
    width: 14px;
    height: 14px;
}

/* --- Rich text toolbar reskin (overrides ccr-comment-editor.css inside the
 *     composer only — TipTap markup unchanged) --------------------------
 *
 * The legacy ccr-editor stylesheet uses `min-width: 36px; min-height: 36px;
 * padding: 6px 8px` on .ccr-editor-btn and a separate `border / radius /
 * padding` on the toolbar host. We override both inside the composer so the
 * text toolbar matches the drawing toolbar (28×28 ghost buttons, no border
 * around the host). The coarse-pointer media query bumps to 44×44; we also
 * override that for the composer.
 */

.ccr-judging-container .ccr-composer-card .ccr-editor-toolbar-host {
    background: var(--panel);
    border: 0;
    border-bottom: 1px solid var(--border);
    border-radius: 0;
    padding: 0;
}

.ccr-judging-container .ccr-composer-card .ccr-editor-toolbar {
    display: flex;
    align-items: center;
    gap: 0;
    padding: 8px 12px;
    background: transparent;
    border: 0;
}

.ccr-judging-container .ccr-composer-card .ccr-editor-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    min-width: 28px;
    min-height: 28px;
    padding: 0;
    background: transparent;
    color: var(--fg-2);
    border: 1px solid transparent;
    border-radius: 5px;
    font-size: 12px;
    cursor: pointer;
    transition: background 80ms, color 80ms;
}

.ccr-judging-container .ccr-composer-card .ccr-editor-btn:hover {
background: var(--hover);
    color: var(--fg);
}

.ccr-judging-container .ccr-composer-card .ccr-editor-btn.is-active {
    background: var(--surface-2);
    color: var(--fg);
    border-color: var(--border-3);
}

.ccr-judging-container .ccr-composer-card .ccr-editor-btn .ccr-svg-icon {
    width: 14px;
    height: 14px;
}

.ccr-judging-container .ccr-composer-card .ccr-editor-btn .ccr-editor-btn-heading-label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 14px;
    font-size: 11px;
    font-weight: 600;
    line-height: 14px;
}

.ccr-judging-container .ccr-composer-card .ccr-editor-btn i {
    font-size: 12px;
}

.ccr-judging-container .ccr-composer-card .ccr-editor-btn-suffix {
    font-size: 9px;
    font-weight: 600;
    margin-left: 1px;
    line-height: 1;
}

.ccr-judging-container .ccr-composer-card .ccr-editor-divider {
    width: 1px;
    height: 14px;
    background: var(--border-2);
    margin: 0 4px;
    flex: none;
}

@media (pointer: coarse) {
    .ccr-judging-container .ccr-composer-card .ccr-editor-btn {
        width: 28px;
        height: 28px;
        min-width: 28px;
        min-height: 28px;
        padding: 0;
        font-size: 12px;
    }
}

/* --- Textarea container — bg goes --surface on focus ------------------ */

.ccr-judging-container .ccr-composer-card .ccr-addcomment-commenttab {
    background: var(--panel);
    transition: background 140ms ease;
}

.ccr-judging-container .ccr-composer-card .ccr-addcomment-commenttab:focus-within {
    background: var(--surface);
}

.ccr-judging-container .ccr-composer-card #ccr-addcomment-editor {
    min-height: 110px;
    padding: 16px 18px;
    font-size: 13px;
    line-height: 1.55;
    color: var(--fg);
    background: transparent;
    border: 0;
    border-radius: 0;
}

.ccr-judging-container .ccr-composer-card #ccr-addcomment-editor .ProseMirror {
    background: transparent;
    padding: 0;
    color: var(--fg);
}

/* Paragraph break must read as a paragraph, not a soft line break.
 * Legacy ccr-comment-editor.css sets 0.6em (≈7.8px) — too tight at this
 * font-size. Override to one full line so adjacent paragraphs sit apart. */
.ccr-judging-container .ccr-composer-card #ccr-addcomment-editor .ProseMirror p {
    margin: 0 0 1.5em;
}

.ccr-judging-container .ccr-composer-card #ccr-addcomment-editor .ProseMirror p:last-child {
    margin-bottom: 0;
}

/* =========================================================================
 * PHASE 3c — COMPOSER FOOTER (visibility + share-link + Cancel/Save)
 *
 * Per canonical EditorCard (rail.jsx lines 603-625):
 *   .ccr-composer-footer       — surface bg, border-top, padding 12px, gap 10
 *   .ccr-visibility-dropdown   — full-width pill, drops UP
 *   .ccr-composer-share-link   — attached-above row when visibility = 'all'
 *   .ccr-composer-actions      — right-aligned Cancel + Save (primary)
 * ===================================================================== */

.ccr-judging-container .ccr-composer-footer {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px;
    background: var(--surface);
    border-top: 1px solid var(--border);
}

/* --- Visibility dropdown (drops up, full-width) ----------------------- */

.ccr-judging-container .ccr-visibility-dropdown {
    position: relative;
    width: 100%;
}

.ccr-judging-container .ccr-visibility-dropdown-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    height: 32px;
    padding: 0 12px;
    gap: 7px;
    background: var(--surface-2);
    color: var(--fg);
    border: 1px solid var(--border-2);
    border-radius: 6px;
    font-size: 12px;
    font-family: inherit;
    cursor: pointer;
    transition: background 100ms, border-color 100ms;
}

.ccr-judging-container .ccr-visibility-dropdown-trigger:hover {
    background: var(--hover);
    border-color: var(--border-3);
}

.ccr-judging-container .ccr-visibility-dropdown[data-attached-below="true"] .ccr-visibility-dropdown-trigger {
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}

.ccr-judging-container .ccr-visibility-dropdown-current {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.ccr-judging-container .ccr-visibility-dropdown-current-icon {
    width: 13px;
    height: 13px;
    color: var(--fg-3);
    flex: none;
}

.ccr-judging-container .ccr-visibility-dropdown-current-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ccr-judging-container .ccr-visibility-dropdown-chevron {
    width: 11px;
    height: 11px;
    color: var(--fg-3);
    flex: none;
    transform: rotate(180deg);
}

.ccr-judging-container .ccr-visibility-dropdown-menu {
    position: absolute;
    bottom: calc(100% + 4px);
    left: 0;
    right: 0;
    background: var(--surface);
    border: 1px solid var(--border-3);
    border-radius: 7px;
    box-shadow:
        0 -12px 28px rgba(0, 0, 0, 0.55),
        0 -2px 6px rgba(0, 0, 0, 0.4);
    padding: 4px;
    z-index: 20;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.ccr-judging-container .ccr-visibility-dropdown-menu[hidden] {
    display: none;
}

.ccr-judging-container .ccr-visibility-dropdown-item {
    display: flex;
    align-items: center;
    gap: 9px;
    width: 100%;
    height: 30px;
    padding: 0 8px;
    background: transparent;
    color: var(--fg);
    border: 1px solid transparent;
    border-radius: 5px;
    font-size: 13px;
    font-weight: 400;
    font-family: inherit;
    cursor: pointer;
    text-align: left;
    transition: background 80ms;
}

.ccr-judging-container .ccr-visibility-dropdown-item:hover,
.ccr-judging-container .ccr-visibility-dropdown-item[aria-selected="true"] {
    background: var(--hover);
}

.ccr-judging-container .ccr-visibility-dropdown-item-icon {
    width: 13px;
    height: 13px;
    color: var(--fg-3);
    flex: none;
}

.ccr-judging-container .ccr-visibility-dropdown-item-label {
    flex: 1;
}

.ccr-judging-container .ccr-visibility-dropdown-item-check {
    width: 12px;
    height: 12px;
    color: var(--accent-text);
    display: none;
}

.ccr-judging-container .ccr-visibility-dropdown-item-check .ccr-svg-icon {
    width: 12px;
    height: 12px;
}

.ccr-judging-container .ccr-visibility-dropdown-item[aria-selected="true"] .ccr-visibility-dropdown-item-check {
    display: inline-flex;
}

/* --- Share link row (attached below visibility pill when value=all) --- */

.ccr-judging-container .ccr-composer-share-link {
    display: flex;
    align-items: center;
    height: 32px;
    background: var(--surface-2);
    border: 1px solid var(--border-2);
    border-top: none;
    border-top-left-radius: 0;
    border-top-right-radius: 0;
    border-bottom-left-radius: 6px;
    border-bottom-right-radius: 6px;
    margin-top: -10px;
    overflow: hidden;
}

.ccr-judging-container .ccr-composer-share-link[hidden] {
    display: none;
}

.ccr-judging-container .ccr-composer-share-link-url {
    flex: 1;
    min-width: 0;
    padding: 0 10px;
    font-size: 12px;
    line-height: 1.4;
    color: var(--fg-2);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ccr-judging-container .ccr-composer-share-link-copy {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
    align-self: stretch;
    width: 38px;
    padding: 0;
    background: transparent;
    color: var(--fg-2);
    border: none;
    border-left: 1px solid var(--border-2);
    cursor: pointer;
    transition: background 80ms, color 80ms;
}


.ccr-judging-container .ccr-composer-share-link-copy:hover {
    background: var(--hover);
    color: var(--fg);
}

.ccr-judging-container .ccr-composer-share-link-copy.is-copied {
    color: var(--accent-text);
}

.ccr-judging-container .ccr-composer-share-link-copy .ccr-svg-icon {
    width: 14px;
    height: 14px;
}

/* --- Action buttons (Cancel + Save) ----------------------------------- */

.ccr-judging-container .ccr-composer-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.ccr-judging-container .ccr-composer-cancel,
.ccr-judging-container .ccr-composer-save {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 32px;
    padding: 0 14px;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    border-radius: 6px;
    cursor: pointer;
    transition: background 100ms, border-color 100ms, filter 100ms;
}

.ccr-judging-container .ccr-composer-cancel {
    background: var(--surface-2);
    color: var(--fg);
    border: 1px solid var(--border-2);
}

.ccr-judging-container .ccr-composer-cancel:hover {
    background: var(--hover);
    border-color: var(--border-3);
}

.ccr-judging-container .ccr-composer-save {
    background: var(--accent);
    color: var(--accent-fg);
    border: 1px solid var(--accent);
}

.ccr-judging-container .ccr-composer-save:hover {
    filter: brightness(1.08);
}

.ccr-judging-container .ccr-composer-save .ccr-svg-icon {
    width: 13px;
    height: 13px;
}

.ccr-judging-container .ccr-composer-cancel p,
.ccr-judging-container .ccr-composer-save p {
    margin: 0;
    line-height: 1;
}

/* =========================================================================
 * Focus rings (a11y)
 *
 * Two-layer approach so mouse clicks stay clean but keyboard nav has a
 * clear focus indicator:
 *
 *   :focus            → outline: none (suppresses Chrome's default blue
 *                       outline on mouse click — was visual noise).
 *   :focus-visible    → 2px light-purple ring (--ccr-color-brand-soft).
 *                       The :focus-visible pseudo-class only matches on
 *                       keyboard nav / programmatic focus — never mouse
 *                       clicks — so the ring is keyboard-only.
 *
 * Where a parent has `overflow: hidden` and the focusable element sits
 * flush with the parent's bounds (editor textarea, share-link inputs),
 * the outline gets clipped — those elements use an inset box-shadow
 * instead, painted on the appropriate container.
 *
 * Contrast: #c5b5fb on #1c1c1c ≈ 9.4:1 (passes WCAG AAA for
 * non-text contrast / 3:1 for focus indicators).
 * ===================================================================== */
.ccr-judging-container button:focus,
.ccr-judging-container input:focus,
.ccr-judging-container [tabindex]:focus,
.ccr-judging-container .ProseMirror:focus {
    outline: none;
}

.ccr-judging-container button:focus-visible,
.ccr-judging-container input:focus-visible,
.ccr-judging-container [tabindex]:focus-visible,
.ccr-judging-container a:focus-visible {
    outline: 2px solid var(--ccr-color-brand-soft);
    outline-offset: 2px;
}

/* Custom colour swatch — focusable element is the opacity:0 <input
 * type="color"> inside the label. Paint the ring on the label so it
 * matches the visible button's bounds. */
.ccr-judging-container .ccr-draw-color-custom input[type="color"]:focus-visible {
    outline: none;
}
.ccr-judging-container .ccr-draw-color-custom:has(input[type="color"]:focus-visible) {
    outline: 2px solid var(--ccr-color-brand-soft);
    outline-offset: 2px;
}

/* TipTap / ProseMirror editor — padding is on the parent container,
 * so paint the ring there. Inset box-shadow because the rail's
 * overflow:auto clips an outline at the editor's outer edge. */
.ccr-judging-container .ProseMirror:focus-visible {
    outline: none;
}
.ccr-judging-container #ccr-addcomment-editor:has(.ProseMirror:focus-visible) {
    box-shadow: inset 0 0 0 2px var(--ccr-color-brand-soft);
}

/* Share-link row — parent has overflow:hidden, so inset rings on its
 * focusable children. */
.ccr-judging-container .ccr-composer-share-link-copy:focus-visible {
    outline: none;
    box-shadow: inset 0 0 0 2px var(--ccr-color-brand-soft);
}

/* Routines dropdown items — stacked flush against each other and the
 * panel's rounded edges (panel has overflow:hidden). Inset ring. */
.ccr-judging-container .ccr-routines-dropdown-item:focus-visible {
    outline: none;
    box-shadow: inset 0 0 0 2px var(--ccr-color-brand-soft);
}

/* Search input inside the routines dropdown — the search row already
 * has a border-bottom separating it from the list. On focus recolour
 * that border to the focus colour rather than drawing a full ring (the
 * input is borderless on three sides). */
.ccr-judging-container .ccr-routines-dropdown-input:focus-visible {
    outline: none;
}
.ccr-judging-container .ccr-routines-dropdown-search:has(.ccr-routines-dropdown-input:focus-visible) {
    border-bottom-color: var(--ccr-color-brand-soft);
    box-shadow: inset 0 -1px 0 0 var(--ccr-color-brand-soft);
}

.ccr-judging-container .ccr-composer-cancel.disabled,
.ccr-judging-container .ccr-composer-save.disabled {
    opacity: 0.6;
    cursor: wait;
}

/* --- Dim other rows while the composer is open (per app.jsx line 378) --
 * `anyEditing` (composer expanded for add OR edit) → non-expanded rows
 * become opacity 0.35, saturate(0.6), pointer-events none, with a 140ms
 * cross-fade. CSS-only via :has() — Chromium 105+ / Safari 15.4+. */

.ccr-judging-container .ccr-annotation-row {
    transition: opacity 140ms, filter 140ms;
}

/* Read-only expanded row → dim others to opacity 0.5, no saturate, no
 * pointer-events block (per app.jsx line 378: dimOpacity = 0.5 when
 * anyOpen && !anyEditing). Less aggressive than the editing dim below. */
.ccr-judging-container .ccr-judging-rail:has(.ccr-annotation-row[data-expanded="true"]) .ccr-annotation-row:not([data-expanded="true"]) {
    opacity: 0.5;
}

/* Composer expanded (add or edit) → dim others harder + desaturate +
 * block clicks. Wins by being declared later when both selectors match. */
.ccr-judging-container .ccr-judging-rail:has(.ccr-composer[data-state="expanded"]) .ccr-annotation-row:not([data-expanded="true"]) {
    opacity: 0.35;
    filter: saturate(0.6);
    pointer-events: none;
}

/* When a row itself is being edited (the row container is replaced by the
 * editor card, so .ccr-composer-card is its descendant) it is not in the
 * "other rows" set. The :has-based rule above naturally excludes it. */

/* =========================================================================
 * PHASE 4a — TOP BREADCRUMB + ROUTINES DROPDOWN
 *
 * Sits at the top of .ccr-judging-container, above the video + rail row.
 * Hierarchy crumbs (ep · event · day) on the left, routines-dropdown trigger
 * as the leaf segment, empty placeholder area on the right (where the
 * connection chip + settings cog land in 4b/4c).
 *
 * Per Claude Design Breadcrumb function (project/app.jsx:115-340):
 *   height 38, padding 0 10px 0 14px, panel bg, 12px fg-3 text.
 *   Crumb spans get 0 4px padding. Separators are 10px chevrons rotated
 *   -90deg at 50% opacity. The routines trigger is a 26-tall button on
 *   --surface bg with --border-2 border, mono accent ID + label + chevron.
 * ===================================================================== */

.ccr-judging-container .ccr-page-breadcrumb {
    display: flex;
    align-items: center;
    gap: 4px;
    /* Desktop: 45px gives the chips + chip text more breathing room. The
     * tablet phase will override back down for narrower viewports. */
    height: 45px;
    padding: 0 10px 0 14px;
    background: var(--panel);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    font-size: 12px;
    color: var(--fg-3);
    position: relative;
    /* Above .ccr-plyr-container which has z-index:1000 (sticky video).
     * The dropdown panel inside the breadcrumb inherits this stacking
     * context. */
    z-index: 1100;
}

.ccr-judging-container .ccr-page-breadcrumb-crumb {
    padding: 0 4px;
    white-space: nowrap;
}

.ccr-judging-container .ccr-page-breadcrumb-sep {
    width: 10px;
    height: 10px;
    color: currentColor;
    opacity: 0.5;
    flex: none;
}

.ccr-judging-container .ccr-page-breadcrumb-spacer {
    flex: 1;
    min-width: 0;
}

/* --- Routines dropdown ------------------------------------------------ */

.ccr-judging-container .ccr-routines-dropdown {
    position: relative;
}

.ccr-judging-container .ccr-routines-dropdown-trigger {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 26px;
    padding: 0 8px;
    background: var(--surface);
    color: var(--fg);
    border: 1px solid var(--border-2);
    border-radius: 5px;
    font-family: inherit;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: background 100ms, border-color 100ms;
}

.ccr-judging-container .ccr-routines-dropdown[data-open="true"] .ccr-routines-dropdown-trigger,
.ccr-judging-container .ccr-routines-dropdown-trigger:hover {
    background: var(--surface-2);
    border-color: var(--border-strong);
}


.ccr-judging-container .ccr-routines-current-id {
    font-size: 11px;
    font-weight: 600;
    color: var(--accent-text);
    /* Force matching line-height so the mono ID and the regular-weight
     * team name share a visual centerline within the trigger. */
    line-height: 1;
    display: inline-flex;
    align-items: center;
}

.ccr-judging-container .ccr-routines-current-team {
    color: var(--fg);
    line-height: 1;
    display: inline-flex;
    align-items: center;
}

.ccr-judging-container .ccr-routines-dropdown-chevron {
    color: var(--fg-3);
    transition: transform 120ms;
    flex: none;
}

.ccr-judging-container .ccr-routines-dropdown[data-open="true"] .ccr-routines-dropdown-chevron {
    transform: rotate(180deg);
}

/* Panel — absolutely positioned below the trigger. */
.ccr-judging-container .ccr-routines-dropdown-panel {
    position: absolute;
    top: 30px;
    left: 0;
    z-index: 11;
    width: 360px;
    background: var(--surface);
    border: 1px solid var(--border-2);
    border-radius: 8px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
    overflow: hidden;
}

.ccr-judging-container .ccr-routines-dropdown-panel[hidden] {
    display: none;
}

/* Search row inside the panel. */
.ccr-judging-container .ccr-routines-dropdown-search {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px;
    background: var(--panel);
    border-bottom: 1px solid var(--border);
}

.ccr-judging-container .ccr-routines-dropdown-search > svg {
    color: var(--fg-3);
    flex: none;
}

.ccr-judging-container .ccr-routines-dropdown-input {
    flex: 1;
    min-width: 0;
    margin: 0;
    padding: 0;
    background: transparent;
    border: none;
    outline: none;
    color: var(--fg);
    font-family: inherit;
    font-size: 13px;
}

.ccr-judging-container .ccr-routines-dropdown-input::placeholder {
    color: var(--fg-4);
}

.ccr-judging-container .ccr-routines-dropdown-count {
    font-size: 10px;
    color: var(--fg-4);
    flex: none;
}

/* Routines list. */
.ccr-judging-container .ccr-routines-dropdown-list {
    max-height: 360px;
    overflow-y: auto;
}

.ccr-judging-container .ccr-routines-dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 11px 12px;
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--border);
    color: var(--fg);
    text-align: left;
    cursor: pointer;
    font-family: inherit;
    transition: background 100ms;
}

.ccr-judging-container .ccr-routines-dropdown-item:hover {
    background: var(--hover);
}

.ccr-judging-container .ccr-routines-dropdown-item[data-current="true"] {
    background: var(--accent-soft);
}

.ccr-judging-container .ccr-routines-dropdown-item-id {
    flex: none;
    min-width: 48px;
    font-size: 11px;
    font-weight: 600;
    color: var(--fg-2);
}

.ccr-judging-container .ccr-routines-dropdown-item[data-current="true"] .ccr-routines-dropdown-item-id {
    color: var(--accent-text);
}

.ccr-judging-container .ccr-routines-dropdown-item-meta {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.ccr-judging-container .ccr-routines-dropdown-item-team {
    font-size: 12.5px;
    font-weight: 500;
    color: var(--fg);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ccr-judging-container .ccr-routines-dropdown-item-division {
    font-size: 11px;
    color: var(--fg-3);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ccr-judging-container .ccr-routines-dropdown-item-current-badge {
    flex: none;
    font-size: 10px;
    font-weight: 600;
    color: var(--accent-text);
    letter-spacing: 0.4px;
}

.ccr-judging-container .ccr-routines-dropdown-empty {
    padding: 20px;
    text-align: center;
    font-size: 12px;
    color: var(--fg-4);
}

/* =========================================================================
 * PHASE 4b — CONNECTION CHIP + MODE POPOVER
 *
 * Lives at the right of the breadcrumb. Reflects sessionStorage
 * 'ccr_judging_location' (auto | onsite | remote) and the current onsite
 * reachability. Status colour palette:
 *   green  --accent      → Connected (mode resolves to onsite + reachable)
 *   blue   --info        → Online    (remote, or auto + onsite unreachable)
 *   amber  --warn        → Connecting… (onsite forced but unreachable)
 *
 * Per Claude Design Breadcrumb function (project/app.jsx:330-360).
 * ===================================================================== */

.ccr-judging-container .ccr-conn-chip {
    position: relative;
}

.ccr-judging-container .ccr-conn-chip-trigger {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 26px;
    padding: 0 10px;
    background: var(--surface);
    color: var(--fg);
    border: 1px solid var(--border-2);
    border-radius: 5px;
    font-family: inherit;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: background 100ms, border-color 100ms;
}

.ccr-judging-container .ccr-conn-chip[data-open="true"] .ccr-conn-chip-trigger,
.ccr-judging-container .ccr-conn-chip-trigger:hover {
    background: var(--surface-2);
    border-color: var(--border-strong);
}


.ccr-judging-container .ccr-conn-chip-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--warn);
    box-shadow: 0 0 0 3px rgba(245, 165, 36, 0.2);
    flex: none;
    transition: background 140ms, box-shadow 140ms;
}

.ccr-judging-container .ccr-conn-chip[data-status="connected"] .ccr-conn-chip-dot,
.ccr-judging-container .ccr-conn-chip[data-status="connected"] .ccr-conn-chip-footer-dot {
    background: var(--accent);
    box-shadow: 0 0 0 3px rgba(78, 0, 255, 0.2);
}

.ccr-judging-container .ccr-conn-chip[data-status="online"] .ccr-conn-chip-dot,
.ccr-judging-container .ccr-conn-chip[data-status="online"] .ccr-conn-chip-footer-dot {
    background: var(--info);
    box-shadow: 0 0 0 3px rgba(106, 169, 255, 0.2);
}

.ccr-judging-container .ccr-conn-chip[data-status="offline"] .ccr-conn-chip-dot,
.ccr-judging-container .ccr-conn-chip[data-status="offline"] .ccr-conn-chip-footer-dot {
    background: var(--danger);
    box-shadow: 0 0 0 3px rgba(244, 63, 94, 0.2);
}

.ccr-judging-container .ccr-conn-chip-label {
    color: var(--fg-2);
}

.ccr-judging-container .ccr-conn-chip-sep {
    color: var(--fg-4);
}

.ccr-judging-container .ccr-conn-chip-mode {
    text-transform: capitalize;
}

.ccr-judging-container .ccr-conn-chip-chevron {
    color: var(--fg-3);
    transition: transform 120ms;
    flex: none;
}

.ccr-judging-container .ccr-conn-chip[data-open="true"] .ccr-conn-chip-chevron {
    transform: rotate(180deg);
}

/* Popover — anchored to the right edge of the chip. */
.ccr-judging-container .ccr-conn-chip-popover {
    position: absolute;
    top: 30px;
    right: 0;
    width: 320px;
    background: var(--surface);
    border: 1px solid var(--border-2);
    border-radius: 8px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    padding: 6px;
}

.ccr-judging-container .ccr-conn-chip-popover[hidden] {
    display: none;
}

.ccr-judging-container .ccr-conn-chip-popover-header {
    padding: 8px 10px 6px;
    font-size: 11px;
    font-weight: 600;
    color: var(--fg-3);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ccr-judging-container .ccr-conn-chip-option {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px 10px;
    background: transparent;
    border: none;
    border-radius: 5px;
    color: var(--fg);
    text-align: left;
    cursor: pointer;
    font-family: inherit;
    transition: background 100ms;
}

.ccr-judging-container .ccr-conn-chip-option:hover {
    background: var(--hover);
}

.ccr-judging-container .ccr-conn-chip-option-radio {
    flex: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 1.5px solid var(--border-strong);
    box-sizing: border-box;
    background: transparent;
    position: relative;
    transition: border-color 100ms;
}

.ccr-judging-container .ccr-conn-chip-option[aria-checked="true"] .ccr-conn-chip-option-radio {
    border-color: var(--accent-text);
}

.ccr-judging-container .ccr-conn-chip-option[aria-checked="true"] .ccr-conn-chip-option-radio::after {
    content: "";
    position: absolute;
    inset: 2px;
    border-radius: 50%;
    background: var(--accent-text);
}

.ccr-judging-container .ccr-conn-chip-option-text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.ccr-judging-container .ccr-conn-chip-option-title {
    font-size: 13px;
    font-weight: 500;
    color: var(--fg);
}

.ccr-judging-container .ccr-conn-chip-option-desc {
    font-size: 11.5px;
    color: var(--fg-3);
    line-height: 1.4;
}

.ccr-judging-container .ccr-conn-chip-popover-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 4px;
    padding: 10px;
    border-top: 1px solid var(--border);
    font-size: 11.5px;
    line-height: 1;
    color: var(--fg-3);
    text-align: center;
}

.ccr-judging-container .ccr-conn-chip-footer-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--warn);
    box-shadow: 0 0 0 3px rgba(245, 165, 36, 0.2);
    flex: none;
    transition: background 140ms, box-shadow 140ms;
}

/* =========================================================================
 * PHASE 4c — SETTINGS COG + SLIDE-DOWN PREFERENCES PANEL
 *
 * Cog button sits at the right of the breadcrumb beside the connection
 * chip. Click toggles the SettingsPanel, which slides down from below the
 * breadcrumb (full width of the page) and pushes the video + rail down.
 * Auto-saves on every change via cc_update_judge_preferences AJAX.
 *
 * Per Claude Design SettingsPanel (project/app.jsx:430-580).
 * ===================================================================== */

.ccr-judging-container .ccr-settings-cog {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    margin-left: 4px;
    padding: 0;
    background: transparent;
    color: var(--fg-2);
    border: 1px solid transparent;
    border-radius: 5px;
    cursor: pointer;
    transition: background 100ms, color 100ms, border-color 100ms;
}

.ccr-judging-container .ccr-settings-cog:hover {
    background: var(--hover);
    color: var(--fg);
}

.ccr-judging-container .ccr-settings-cog[aria-expanded="true"] {
    background: var(--surface-2);
    color: var(--fg);
    border-color: var(--border-2);
}


/* Panel — full width, slides down beneath the breadcrumb. */
.ccr-judging-container .ccr-settings-panel {
    flex-shrink: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    animation: ccrSettingsSlideDown 160ms ease-out;
}

.ccr-judging-container .ccr-settings-panel[hidden] {
    display: none;
}

@keyframes ccrSettingsSlideDown {
    from {
        transform: translateY(-8px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.ccr-judging-container .ccr-settings-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--panel);
    border-bottom: 1px solid var(--border);
}

.ccr-judging-container .ccr-settings-panel-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--fg);
}

.ccr-judging-container .ccr-settings-panel-title > svg {
    color: var(--fg-3);
    flex: none;
}

/* Save-state indicator next to the Preferences title. Three states:
 *   idle   → small grey "Saved automatically" (default)
 *   saving → spinner + "Saving…"
 *   saved  → green check + "Saved" (auto-reverts to idle after ~1.4s)
 */
.ccr-judging-container .ccr-settings-panel-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-left: 4px;
    font-size: 11px;
    font-weight: 500;
    color: var(--fg-4);
    transition: color 140ms;
}

.ccr-judging-container .ccr-settings-panel-status-spinner,
.ccr-judging-container .ccr-settings-panel-status-check {
    display: none;
    flex: none;
}

.ccr-judging-container .ccr-settings-panel-status[data-state="saving"] {
    color: var(--fg-3);
}

.ccr-judging-container .ccr-settings-panel-status[data-state="saving"] .ccr-settings-panel-status-spinner {
    display: inline-block;
    width: 10px;
    height: 10px;
    border: 1.5px solid var(--border-strong);
    border-top-color: var(--fg);
    border-radius: 50%;
    animation: ccrSettingsStatusSpin 700ms linear infinite;
}

.ccr-judging-container .ccr-settings-panel-status[data-state="saved"] {
    color: var(--accent-text);
}

.ccr-judging-container .ccr-settings-panel-status[data-state="saved"] .ccr-settings-panel-status-check {
    display: inline-block;
    color: var(--accent-text);
}

@keyframes ccrSettingsStatusSpin {
    to { transform: rotate(360deg); }
}

.ccr-judging-container .ccr-settings-panel-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    padding: 0;
    background: transparent;
    color: var(--fg-3);
    border: 1px solid transparent;
    border-radius: 4px;
    cursor: pointer;
    transition: background 100ms, color 100ms;
}

.ccr-judging-container .ccr-settings-panel-close:hover {
    background: var(--hover);
    color: var(--fg);
}


.ccr-judging-container .ccr-settings-panel-body {
    display: flex;
    flex-direction: column;
    gap: 18px;
    padding: 16px;
}

.ccr-judging-container .ccr-settings-section-title {
    font-size: 11.5px;
    font-weight: 500;
    color: var(--fg-2);
    margin-bottom: 2px;
}

.ccr-judging-container .ccr-settings-section-desc {
    font-size: 11px;
    color: var(--fg-4);
    margin-bottom: 10px;
}

.ccr-judging-container .ccr-settings-divider {
    height: 1px;
    background: var(--border);
}

/* --- Colour swatches row ---------------------------------------------- */

.ccr-judging-container .ccr-settings-colour-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.ccr-judging-container .ccr-settings-colour-swatch {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    background: transparent;
    border: 1.5px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    transition: border-color 100ms;
}

.ccr-judging-container .ccr-settings-colour-swatch[data-selected="true"] {
    border-color: var(--fg);
}


.ccr-judging-container .ccr-settings-colour-swatch-fill {
    width: 22px;
    height: 22px;
    border-radius: 5px;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18);
}

.ccr-judging-container .ccr-settings-colour-divider {
    width: 1px;
    height: 18px;
    background: var(--border-2);
    margin: 0 4px;
    flex: none;
}

.ccr-judging-container .ccr-settings-colour-custom {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 28px;
    margin: 0;
    padding: 0 10px 0 2px;
    background: var(--surface-2);
    border: 1.5px solid var(--border-2);
    border-radius: 8px;
    cursor: pointer;
    transition: border-color 100ms;
}

.ccr-judging-container .ccr-settings-colour-custom[data-selected="true"] {
    border-color: var(--fg);
}

.ccr-judging-container .ccr-settings-colour-custom-fill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
}

.ccr-judging-container .ccr-settings-colour-custom-fill::before {
    content: "";
    width: 22px;
    height: 22px;
    border-radius: 5px;
    background: conic-gradient(from 180deg, #f43f5e, #f5a524, #3ecf8e, #6aa9ff, #a78bfa, #f43f5e);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18);
}

.ccr-judging-container .ccr-settings-colour-custom[data-selected="true"] .ccr-settings-colour-custom-fill::before {
    background: var(--ccr-settings-custom-color, conic-gradient(from 180deg, #f43f5e, #f5a524, #3ecf8e, #6aa9ff, #a78bfa, #f43f5e));
}

.ccr-judging-container .ccr-settings-colour-custom-label {
    font-size: 11.5px;
    font-weight: 500;
    color: var(--fg-2);
}

.ccr-judging-container .ccr-settings-colour-custom-input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    border: none;
    padding: 0;
    margin: 0;
    /* Hint to the browser/OS to render the native colour picker dialog
     * in dark mode. */
    color-scheme: dark;
}

/* --- Pause / Continue segment ---------------------------------------- */

.ccr-judging-container .ccr-settings-segment {
    display: flex;
    gap: 6px;
}

.ccr-judging-container .ccr-settings-segment-btn {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 32px;
    padding: 0 14px;
    background: var(--surface-2);
    color: var(--fg-2);
    border: 1px solid var(--border-2);
    border-radius: 6px;
    cursor: pointer;
    font-family: inherit;
    font-size: 12.5px;
    font-weight: 500;
    transition: background 120ms, color 120ms, border-color 120ms;
}

.ccr-judging-container .ccr-settings-segment-btn[data-selected="true"] {
    background: var(--accent-soft);
    color: var(--accent-text);
    border-color: var(--accent-text);
}


/* =========================================================================
 * PHASE 4d — ROUTINE IDENTITY CARD (under the video player)
 *
 * Sits directly below the sticky video. 72px-min-height row with:
 *   - 88px-wide accent-soft ID block on the left (28/600 mono accent)
 *   - 5-column field grid: TEAM · PROGRAM · DIVISION · DISCIPLINE
 *     · COMPETE TIME (10px uppercase labels, 13/500 values, 1px left
 *     divider on cells 2-5)
 *   - Trailing Shortcuts toggle pill (4e wires the panel)
 *
 * Per Claude Design RoutineCard (project/app.jsx:353-428).
 *
 * To make this work in the existing left/right layout, the video and
 * the card sit inside a new .ccr-judging-center-column flex-column
 * wrapper. The wrapper takes the same flex: 2 share the video used to
 * have; the inner .ccr-plyr-container drops to width: 100% inside it.
 * ===================================================================== */

.ccr-judging-container .ccr-judging-center-column {
    flex: 2;
    min-width: 0;
    display: flex;
    flex-direction: column;
    /* Sticky the whole column (video + card together) so the routine
     * identity stays under the video as the rail scrolls past. Replaces
     * the per-element sticky that used to live on .ccr-plyr-container. */
    position: -webkit-sticky;
    position: sticky;
    top: 10px;
    align-self: flex-start;
    z-index: 1000;
}

/* Inner video container is now a flex-column child, not flex-row child.
 * Drop the old flex: 2 / width: 70% / sticky — the column owns those. */
.ccr-judging-container .ccr-judging-center-column .ccr-plyr-container {
    flex: none;
    width: 100%;
    position: static;
    top: auto;
    z-index: auto;
}

.ccr-judging-container .ccr-routine-card {
    display: flex;
    align-items: stretch;
    min-height: 72px;
    flex-shrink: 0;
    background: var(--panel);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.ccr-judging-container .ccr-routine-card-id {
    flex: none;
    width: 88px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-soft);
    border-right: 1px solid var(--border);
}

.ccr-judging-container .ccr-routine-card-id-value {
    /* Heavy Area Normal (inherits from body) instead of mono — reads as a
     * branded ID badge rather than a numeric mono code. */
    font-size: 28px;
    font-weight: 900;
    color: var(--accent-text);
}

.ccr-judging-container .ccr-routine-card-fields {
    flex: 1;
    min-width: 0;
    display: grid;
    grid-template-columns: repeat(5, 1fr) auto;
    align-items: center;
}

.ccr-judging-container .ccr-routine-card-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    padding: 14px 16px;
    border-left: 1px solid var(--border);
}

.ccr-judging-container .ccr-routine-card-field:first-child {
    border-left: none;
}

.ccr-judging-container .ccr-routine-card-field-label {
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    color: var(--fg-4);
}

.ccr-judging-container .ccr-routine-card-field-value {
    font-size: 13px;
    font-weight: 500;
    color: var(--fg);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Shortcuts cell — trailing column in the grid. */
.ccr-judging-container .ccr-routine-card-shortcuts-cell {
    padding: 0 14px;
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
}

.ccr-judging-container .ccr-routine-card-shortcuts-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 28px;
    padding: 0 10px;
    background: var(--surface-2);
    color: var(--fg-2);
    border: 1px solid var(--border-2);
    border-radius: 6px;
    cursor: pointer;
    font-family: inherit;
    font-size: 12px;
    font-weight: 500;
    transition: background 100ms, color 100ms, border-color 100ms;
}

.ccr-judging-container .ccr-routine-card-shortcuts-toggle:hover {
    background: var(--hover);
    color: var(--fg);
}

.ccr-judging-container .ccr-routine-card-shortcuts-toggle[aria-expanded="true"] {
    background: var(--accent-soft);
    color: var(--accent-text);
    border-color: var(--accent-border);
}


.ccr-judging-container .ccr-routine-card-shortcuts-glyph {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 1px solid currentColor;
    font-size: 10px;
    font-weight: 600;
}

/* =========================================================================
 * PHASE 4e — SHORTCUTS PANEL (under the RoutineCard)
 *
 * Reference card only — opens beneath the RoutineCard when the Shortcuts
 * pill is toggled. 4-column grid of shortcut groups (Playback /
 * Annotations / Routine span / Editor). Keys are mono cap chips, labels
 * are --fg-2 12px.
 *
 * Per Claude Design ShortcutsPanel (project/app.jsx:583-625).
 * ===================================================================== */

.ccr-judging-container .ccr-shortcuts-panel {
    flex-shrink: 0;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 18px;
    padding: 16px 18px 18px;
    background: var(--surface);
    border-top: 1px solid var(--border);
}

.ccr-judging-container .ccr-shortcuts-panel[hidden] {
    display: none;
}

.ccr-judging-container .ccr-shortcuts-group-label {
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    color: var(--fg-4);
    margin-bottom: 10px;
}

.ccr-judging-container .ccr-shortcuts-group-items {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.ccr-judging-container .ccr-shortcuts-row {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12px;
}

.ccr-judging-container .ccr-shortcuts-key {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 22px;
    padding: 0 6px;
    background: var(--surface-2);
    border: 1px solid var(--border-2);
    border-radius: 4px;
    color: var(--fg);
    font-size: 11px;
    font-weight: 500;
    flex: none;
}

.ccr-judging-container .ccr-shortcuts-label {
    color: var(--fg-2);
}

/* =========================================================================
 * DARK SCROLLBARS — scoped to .ccr-judging-container.
 *
 * Mirrors the Claude Design HTML reference (Judging Page.html lines 50-53):
 * 10px-wide WebKit scrollbar with a #2e2e2e thumb and a transparent track
 * (the track reveals the surrounding panel/bg). 2px border on the thumb
 * uses --bg as its colour, so the thumb appears inset.
 *
 * Firefox uses the equivalent scrollbar-color / scrollbar-width properties.
 * Applies to every scrollable descendant inside the judging container
 * (annotation list, routines dropdown list, type dropdown menu, etc.).
 * ===================================================================== */

.ccr-judging-container,
.ccr-judging-container * {
    scrollbar-width: thin;
    scrollbar-color: #2e2e2e transparent;
}

.ccr-judging-container *::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

.ccr-judging-container *::-webkit-scrollbar-track {
    background: transparent;
}

.ccr-judging-container *::-webkit-scrollbar-thumb {
    background: #2e2e2e;
    border-radius: 10px;
    border: 2px solid var(--bg);
}

.ccr-judging-container *::-webkit-scrollbar-thumb:hover {
    background: #3a3a3a;
}

/* =========================================================================
 * PHASE 4f-a — RESPONSIVE BREAKPOINTS
 *
 * Breakpoint matrix (locked with the user):
 *   >= 1280px              Full desktop layout (current).
 *   1024-1279px            Desktop layout with a narrower rail (360px).
 *   768-1023px             Tablet stack (rail below video, single column).
 *                          The 768-1023px range is where the Claude
 *                          Design tablet handoff applies; 4f-b/4f-c
 *                          will layer the tablet-specific components
 *                          (routine strip, settings-as-popover, drag
 *                          handle) on top of this stacking baseline.
 *   < 768px                Mobile warning: hide the judging page, show
 *                          "use a larger device" panel.
 *
 * Existing tablet-stacking rules earlier in this file already trigger
 * at < 1024px (their media query was updated from 1119 in 4f-a).
 * ===================================================================== */

/* --- Narrow rail (1024-1279px) -------------------------------------------- *
 * Desktop layout still applies; just shrink the rail from 30% to a fixed
 * 360px so the video gets more room on a small laptop / landscape iPad. */

@media screen and (min-width: 1024px) and (max-width: 1279px) {
    .ccr-judging-container .ccr-judging-rail {
        width: 360px;
        flex: none;
    }
}

/* --- Mobile (< 768px) ---------------------------------------------------- *
 * Mobile users are mostly shared-link viewers (coaches, program owners)
 * who need to watch the video and read the annotation. We keep those
 * surfaces visible. The judging-action row (Routine Bounds + AddBar)
 * is hidden and replaced by an in-rail notice explaining a larger
 * device is required to add or edit annotations. */

.ccr-judging-container .ccr-mobile-notice {
    display: none;
    align-items: flex-start;
    gap: 12px;
    padding: 14px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    color: var(--fg-2);
}

.ccr-judging-container .ccr-mobile-notice-icon {
    flex: none;
    width: 22px;
    height: 22px;
    color: var(--fg-3);
}

.ccr-judging-container .ccr-mobile-notice-text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.ccr-judging-container .ccr-mobile-notice-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--fg);
}

.ccr-judging-container .ccr-mobile-notice-body {
    font-size: 12px;
    color: var(--fg-3);
    line-height: 1.45;
}

@media screen and (max-width: 767px) {
    /* Hide the judging-action row entirely — the user can't add or edit
     * annotations at this width. */
    .ccr-judging-container .ccr-rail-header {
        display: none;
    }
    /* Show the in-rail notice in its place. */
    .ccr-judging-container .ccr-mobile-notice {
        display: flex;
    }
}

/* =========================================================================
 * PHASE 4f-b — ROUTINE STRIP (tablet only)
 *
 * The breadcrumb's inline routine-selector chip is too cramped on portrait
 * tablet widths. At < 1024px we hide the breadcrumb's routine dropdown
 * and surface a full-width row below the breadcrumb that wraps the same
 * dropdown control. Tap anywhere on the row opens the picker.
 * ===================================================================== */

.ccr-judging-container .ccr-routine-strip {
    display: none;
}

.ccr-judging-container .ccr-routine-strip .ccr-routines-dropdown {
    width: 100%;
}

.ccr-judging-container .ccr-routine-strip-trigger {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 46px;
    padding: 0 16px;
    background: var(--panel);
    color: var(--fg);
    border: none;
    border-bottom: 1px solid var(--border);
    border-radius: 0;
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background 100ms;
}

.ccr-judging-container .ccr-routine-strip-content {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
}

.ccr-judging-container .ccr-routine-strip-content .ccr-routines-dropdown-chevron {
    color: var(--fg-3);
    flex: none;
    margin-left: 4px;
    transition: transform 120ms;
}

.ccr-judging-container .ccr-routine-strip .ccr-routines-dropdown[data-open="true"] .ccr-routines-dropdown-chevron {
    transform: rotate(180deg);
}

.ccr-judging-container .ccr-routine-strip-trigger:hover {
    background: var(--surface);
}


.ccr-judging-container .ccr-routine-strip-trigger .ccr-routines-current-id {
    font-size: 12px;
}

.ccr-judging-container .ccr-routine-strip-sep {
    color: var(--fg-4);
    flex: none;
}

.ccr-judging-container .ccr-routine-strip-meta {
    font-size: 12px;
    color: var(--fg-3);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

/* Strip's dropdown panel — anchored to the strip's left edge instead of
 * the breadcrumb trigger's. Sits 6px below the strip bottom (strip
 * height 46 + 6 spacing) so it reads as a separate floating panel
 * rather than abutting the strip's border. */
.ccr-judging-container .ccr-routine-strip .ccr-routines-dropdown-panel {
    top: 52px;
    left: 12px;
    right: 12px;
    width: auto;
    max-width: calc(100vw - 24px);
}

@media screen and (max-width: 1023px) {
    /* Hide the inline routine dropdown in the breadcrumb. */
    .ccr-judging-container .ccr-page-breadcrumb .ccr-routines-dropdown {
        display: none;
    }
    /* Also hide the trailing separator that points to the (now-hidden)
     * routine dropdown. */
    .ccr-judging-container .ccr-page-breadcrumb-sep-routine {
        display: none;
    }
    /* Show the standalone routine strip. */
    .ccr-judging-container .ccr-routine-strip {
        display: block;
        position: relative;
        z-index: 1099; /* one below the breadcrumb's 1100 stacking context */
    }
    /* Hide the desktop RoutineCard — the strip carries the routine
     * identity info on tablet. */
    .ccr-judging-container .ccr-routine-card {
        display: none;
    }
}

/* =========================================================================
 * PHASE 4f-b — SETTINGS PANEL AS POPOVER (tablet)
 *
 * Desktop: panel renders as a slide-down at the top of the rail.
 * Tablet: panel becomes a floating popover anchored under the cog in
 * the breadcrumb (top-right of the page). Content + behaviour
 * unchanged — only positioning differs.
 * ===================================================================== */

@media screen and (max-width: 1023px) {
    .ccr-judging-container .ccr-settings-panel {
        position: fixed;
        top: 52px;
        right: 12px;
        width: 340px;
        max-width: calc(100vw - 24px);
        border: 1px solid var(--border-2);
        border-radius: 10px;
        box-shadow: 0 12px 32px rgba(0, 0, 0, 0.55), 0 2px 6px rgba(0, 0, 0, 0.4);
        z-index: 1101;
        animation: ccrSettingsPopoverIn 160ms ease-out;
    }

    /* Round the inner header corners so they match the popover. */
    .ccr-judging-container .ccr-settings-panel-header {
        border-top-left-radius: 9px;
        border-top-right-radius: 9px;
    }
}

@keyframes ccrSettingsPopoverIn {
    from { transform: translateY(-6px); opacity: 0; }
    to   { transform: translateY(0); opacity: 1; }
}

/* =========================================================================
 * PHASE 4f-b — 2-COLUMN BOTTOM PANEL (tablet)
 *
 * At < 1024px the rail switches to a 2-column grid:
 *   Left  168px  — Routine span (Start / End / Length stacked vertically)
 *   Right flex 1 — Composer (AddBar) + annotation list, stacked
 *
 * When the composer expands (Add or Edit), it spans both columns and the
 * Routine Bounds + annotation list are hidden — the composer takes over
 * the whole panel per the tablet handoff.
 *
 * Implementation: the existing markup has Bounds + Composer inside
 * .ccr-rail-header. At tablet we apply `display: contents` to the
 * header so its children participate in the rail's grid directly.
 * ===================================================================== */

@media screen and (max-width: 1023px) and (min-width: 768px) {
    .ccr-judging-container .ccr-judging-rail {
        display: grid;
        grid-template-columns: 168px 1fr;
        grid-template-rows: auto 1fr;
        grid-template-areas:
            "bounds composer"
            "bounds list";
        /* Drop the desktop rail's flex column layout — grid takes over. */
        flex-direction: initial;
        /* Drop the sticky / max-height — at tablet the rail stacks under
         * the video and scrolls with the page (existing tablet rules
         * already remove sticky / overflow on .ccr-judging-rail at <
         * 1024 via the rail-header override). */
        max-height: none;
        min-height: 0;
        position: static;
        /* Drawer treatment per tablet handoff: 14px top corners +
         * hairline top border, contents clipped to the rounded shape. */
        border-top: 1px solid var(--border);
        border-top-left-radius: 14px;
        border-top-right-radius: 14px;
        overflow: hidden;
    }

    /* Flatten rail-header so its children become direct grid items. */
    .ccr-judging-container .ccr-rail-header {
        display: contents;
    }

    /* Left sidebar — Routine span stacked vertically. */
    .ccr-judging-container .ccr-rail-header .ccr-routine-bounds-row {
        grid-area: bounds;
        display: flex;
        flex-direction: column;
        gap: 10px;
        padding: 14px;
        background: var(--panel);
        border-right: 1px solid var(--border);
    }

    /* Composer in top-right cell — collapsed AddBar shows as the primary
     * "Add annotation at HH:MM" CTA at the top of the right column. When
     * expanded, the composer spans both columns and the sidebar + list
     * disappear so the editor gets the full panel width.
     *
     * Composer's `position: sticky; top: 0` from Phase 3 is desktop-only
     * (it pins inside the rail's overflow-y scroll). At tablet there's
     * no rail scroll container, so sticky resolves against the body and
     * pins the composer to viewport top — overlapping the video. Force
     * static here. */
    .ccr-judging-container .ccr-rail-header .ccr-composer {
        grid-area: composer;
        margin: 14px;
        position: static;
        top: auto;
    }
    .ccr-judging-container .ccr-rail-header .ccr-composer[data-state="expanded"] {
        grid-column: 1 / -1;
        margin: 0;
    }

    /* Annotation list in bottom-right cell. */
    .ccr-judging-container .ccr-annotation-list {
        grid-area: list;
    }

    /* When composer is expanded, hide the sidebar + list — the composer
     * takes the full panel width. */
    .ccr-judging-container .ccr-judging-rail:has(.ccr-composer[data-state="expanded"]) .ccr-routine-bounds-row,
    .ccr-judging-container .ccr-judging-rail:has(.ccr-composer[data-state="expanded"]) .ccr-annotation-list {
        display: none;
    }
}

/* =========================================================================
 * PHASE 4f-c — TABLET DRAG HANDLE (resize video band)
 *
 * Visible at 768-1023px only. 16px hit area between the video band and
 * the 2-col bottom panel with a 44x4 centered grip pill. Drag adjusts
 * the video band's height between 200px (min) and aspect-fit max
 * (column-width × 9/16). Saved to localStorage as
 * 'ccr_judging_video_band_height' on dragend, restored on load.
 *
 * At all other widths the handle is `display: none` and the video
 * sits at its natural height as today.
 * ===================================================================== */

.ccr-judging-container .ccr-tablet-drag-handle {
    display: none;
}

.ccr-judging-container .ccr-tablet-drag-handle-grip {
    width: 44px;
    height: 4px;
    background: var(--border-strong);
    border-radius: 2px;
    pointer-events: none;
    transition: background 120ms, transform 120ms;
}

@media screen and (max-width: 1023px) and (min-width: 768px) {
    /* Kill the sticky / z-index on the center column at tablet. Sticky
     * is a desktop pattern for keeping the video pinned alongside a
     * side rail; at tablet the column stacks above the drag handle and
     * rail and the z-index makes the rail slide UNDER the column when
     * the user drags the handle. Normal flow is what we want here. */
    .ccr-judging-container .ccr-judging-center-column {
        position: static;
        top: auto;
        z-index: auto;
        align-self: stretch;
    }

    .ccr-judging-container .ccr-tablet-drag-handle {
        display: flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
        width: 100%;
        height: 16px;
        /* Transparent so the page bg (darker than --panel) shows through,
         * giving a clear visual gap between the video band above and the
         * rail/drawer below. */
        background: transparent;
        cursor: row-resize;
        touch-action: none;
        user-select: none;
    }
    .ccr-judging-container .ccr-tablet-drag-handle:hover .ccr-tablet-drag-handle-grip {
        background: var(--fg-2);
    }
    .ccr-judging-container .ccr-tablet-drag-handle[data-dragging="true"] .ccr-tablet-drag-handle-grip {
        background: var(--fg);
        transform: scaleX(1.2);
    }

    /* Drag-resize the video band by changing the container's WIDTH,
     * derived from the desired video-frame height (--ccr-tablet-video-
     * height). Plyr's .plyr__video-wrapper has `aspect-ratio: 16/9`
     * built-in, so its height auto-derives from its width: width 100%
     * of container → height = container-width × 9/16. By setting the
     * container's width proportionally, the video frame ends up at
     * exactly --ccr-tablet-video-height tall and 16:9 wide. The video
     * + canvas overlay both stay in 16:9 aspect (no squish). Plyr
     * controls add their natural ~52px below the frame. Container is
     * centered horizontally so the column has empty space on the sides
     * when the video is dragged smaller than column width. */
    .ccr-judging-container .ccr-judging-center-column {
        --ccr-tablet-video-height: auto;
    }
    .ccr-judging-container .ccr-judging-center-column[style*="--ccr-tablet-video-height"] .ccr-plyr-container {
        width: calc(var(--ccr-tablet-video-height) * 16 / 9);
        max-width: 100%;
        align-self: center;
        /* Become the positioning context for the Fabric canvas overlay,
         * which is absolute-positioned at top:0 left:0. Without this,
         * the canvas anchors to the column (full-width) and ends up
         * offset from the centered, narrower plyr-container. */
        position: relative;
        /* Tablet-only: player+playbar as a self-contained card with a
         * 1px border, 14px rounded corners, and a small gap above so
         * the border doesn't touch the routine selector strip's
         * border-bottom. */
        border: 1px solid var(--border);
        border-radius: 14px;
        overflow: hidden;
        margin-top: 12px;
    }

    /* When the player is at aspect-fit max (full column width), strip
     * the card treatment so it sits flush against the routine strip —
     * but keep the bottom border, which separates the playbar from the
     * drag handle strip below. JS toggles data-player-fullwidth on the
     * center column. */
    .ccr-judging-container .ccr-judging-center-column[data-player-fullwidth="true"] .ccr-plyr-container {
        border-top: none;
        border-left: none;
        border-right: none;
        border-radius: 0;
        margin-top: 0;
    }
}
