.video-selection-panel {
    position: fixed;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: calc(75vh * 4 / 3);
    height: 75vh;
    right: auto;
    bottom: auto;
    max-width: none;
    max-height: none;
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: var(--gallery-radius);
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    font: 11px monospace;
    overflow: hidden;
}
.video-selection-panel::backdrop { background: rgba(0, 0, 0, 0.25); }
.video-selection-tile {
    position: relative;
    width: 100%;
    height: 100%;
    border-radius: var(--gallery-radius);
    background: #111;
    overflow: hidden;
}
/* the start picture fills the frame without contributing intrinsic layout height. */
.video-selection-preview {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    z-index: 0;
}
.video-selection-info {
    /* labels and controls overlay both pictures. */
    z-index: 2;
    position: absolute;
    right: 24px;
    top: 24px;
    text-align: right;
    white-space: pre;
    line-height: 1.5;
    text-shadow: 0 0 8px #000, 0 1px 2px #000;
    pointer-events: none;
}
.video-selection-status {
    /* labels and controls overlay both pictures. */
    z-index: 2;
    position: absolute;
    top: 50%;
    left: 12px;
    right: 12px;
    text-align: center;
    overflow-wrap: anywhere;
    text-shadow: 0 0 8px #000;
    pointer-events: none;
}
.video-selection-controls {
    /* labels and controls overlay both pictures. */
    z-index: 2;
    position: absolute;
    bottom: 8px;
    left: 12px;
    right: 12px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) repeat(3, max-content);
    align-items: center;
    gap: 8px;
}
.video-selection-controls > button {
    grid-row: 1;
    padding: 8px 12px;
    border: 0;
    border-radius: 5px;
    color: #fff;
    background: #000;
    font: inherit;
    cursor: pointer;
}
.video-selection-controls > button:hover { background: #fff; color: #000; }
.video-selection-controls > button:disabled { opacity: 0.4; cursor: default; }
.video-selection-controls > .video-selection-rotate { grid-column: 1; justify-self: start; align-self: stretch; line-height: 1; }
.video-selection-controls > .video-selection-crop { grid-column: 2; background: #333; }
.video-selection-controls > .video-selection-cancel { grid-column: 3; }
.video-selection-controls > .video-selection-convert { grid-column: 4; }
.video-selection-slider { position: relative; grid-column: 1 / -1; grid-row: 2; min-width: 0; height: 28px; touch-action: none; }
.video-selection-track, .video-selection-interval { position: absolute; top: 12px; height: 4px; }
.video-selection-track { left: 0; right: 0; background: #555; }
.video-selection-interval { background: #ddd; pointer-events: none; }
.video-selection-handle {
    position: absolute;
    top: 4px;
    transform: translateX(-50%);
    width: 12px;
    height: 20px;
    padding: 0;
    border: 2px solid #fff;
    border-radius: 3px;
    background: #111;
    cursor: ew-resize;
    touch-action: none;
}
.video-selection-handle:focus-visible { outline: 2px solid #aaa; outline-offset: 2px; }

/* Upper-right result/last-frame inset, with information overlaid inside it. */
.video-selection-end-preview {
    position: absolute;
    right: 12px;
    top: 12px;
    width: 40%;
    height: auto;
    aspect-ratio: var(--output-aspect, 4 / 3);
    max-height: none;
    z-index: 1;
    object-fit: contain;
    background: #111;
    border-radius: var(--gallery-radius);
    pointer-events: none;
}

/* source-pixel crop box, with only corner resizing and interior movement. */
.video-selection-controls > .video-selection-crop[aria-pressed="true"] { background: #444; }
.video-crop-box {
    position: absolute;
    z-index: 1;
    border: 1px solid #fff;
    box-shadow: 0 0 0 300vmax rgba(0, 0, 0, 0.5);
    cursor: move;
    touch-action: none;
}
.video-crop-box[hidden] { display: none; }
.video-crop-corner {
    position: absolute;
    width: 12px;
    height: 12px;
    padding: 0;
    border: 2px solid #111;
    border-radius: 2px;
    background: #fff;
    touch-action: none;
}
.video-crop-corner.crop-nw { left: 0; top: 0; cursor: nwse-resize; }
.video-crop-corner.crop-ne { right: 0; top: 0; cursor: nesw-resize; }
.video-crop-corner.crop-sw { left: 0; bottom: 0; cursor: nesw-resize; }
.video-crop-corner.crop-se { right: 0; bottom: 0; cursor: nwse-resize; }
