:root {
    --bg: #050505;
    --fg: #edf0f4;
    --muted: #a5a9b2;
    --panel: rgba(15, 15, 15, 0.82);
    --panel-border: #2d2d2d;
    --chip: #141414;
    --chip-border: #343434;
    --accent: #60a5fa;
    --danger: #f87171;
    --warn: #f59e0b;
    --default-bg: #d4d4d4;
    --default-border: #ebebeb;
    --default-fg: #171717;
    --tile-gap: 3px;
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --safe-left: env(safe-area-inset-left, 0px);
    --safe-right: env(safe-area-inset-right, 0px);
    color-scheme: dark;
}

@media (prefers-color-scheme: light) {
    :root {
        --bg: #f6f7f9;
        --fg: #15171a;
        --muted: #5d636e;
        --panel: rgba(255, 255, 255, 0.86);
        --panel-border: #dcdfe4;
        --chip: #ffffff;
        --chip-border: #d5d9df;
        --accent: #2563eb;
        --danger: #dc2626;
        --warn: #b45309;
        --default-bg: #1d1f23;
        --default-border: #2b2e33;
        --default-fg: #f4f5f7;
        color-scheme: light;
    }
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    min-height: 100%;
}

body {
    background: var(--bg);
    color: var(--fg);
    font-family: "Sora", "Avenir Next", "Segoe UI", sans-serif;
    -webkit-tap-highlight-color: transparent;
    -webkit-text-size-adjust: 100%;
}

body.viewer-open {
    overflow: hidden;
}

button, input, select {
    font: inherit;
    color: inherit;
}

[hidden] { display: none !important; }

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    overflow: hidden;
    pointer-events: none;
}

.muted { color: var(--muted); }

/* --- Buttons and chips (as in whispr) --- */

.cta-btn {
    border-radius: 999px;
    border: 1px solid var(--chip-border);
    background: var(--chip);
    color: var(--fg);
    text-decoration: none;
    padding: 10px 20px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    min-width: 0;
    flex: 0 0 auto;
    user-select: none;
    transition: transform 120ms ease, background 120ms ease, border-color 120ms ease, opacity 120ms ease;
}

.cta-btn:hover { transform: translateY(-1px); }
.cta-btn:active { transform: translateY(0); }

.cta-btn.is-default {
    background: var(--default-bg);
    border-color: var(--default-border);
    color: var(--default-fg);
}

.cta-btn.is-danger {
    color: var(--danger);
}

.cta-btn:disabled {
    opacity: 0.55;
    cursor: default;
    transform: none;
}

.cta-btn:focus-within,
.cta-btn:focus-visible,
.chip:focus-visible,
.tile:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.chip {
    border-radius: 999px;
    border: 1px solid var(--chip-border);
    background: var(--chip);
    padding: 6px 12px 6px 10px;
    font-size: 14px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    max-width: 40vw;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#name-chip::before {
    content: "";
    flex: 0 0 auto;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--badge, transparent);
    border: 1px solid var(--chip-border);
}

.round-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: rgba(10, 10, 10, 0.55);
    color: #fff;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.round-btn:disabled { opacity: 0.25; cursor: default; }

/* --- Login (whispr's index card) --- */

#index-shell {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 18px;
    padding: calc(16px + var(--safe-top)) calc(16px + var(--safe-right)) calc(16px + var(--safe-bottom)) calc(16px + var(--safe-left));
    text-align: center;
    background: radial-gradient(circle at 50% 42%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 62%);
}

#index-title {
    margin: 0;
    font-size: 32px;
    font-weight: 700;
    letter-spacing: 0.01em;
}

#index-sub {
    margin: 0;
    color: var(--muted);
    line-height: 1.35;
}

#login-form {
    width: min(360px, 100%);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

input[type="password"],
input[type="text"] {
    width: 100%;
    border-radius: 14px;
    border: 1px solid var(--chip-border);
    background: var(--chip);
    padding: 13px 16px;
    font-size: 16px; /* 16px keeps iOS from zooming into the field */
    outline: none;
}

input[type="password"]:focus,
input[type="text"]:focus {
    border-color: var(--accent);
}

#login-error {
    min-height: 1.4em;
    margin: 0;
    color: var(--danger);
    font-size: 14px;
}

/* --- Top bar --- */

#topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    padding: calc(10px + var(--safe-top)) calc(14px + var(--safe-right)) 10px calc(14px + var(--safe-left));
    background: var(--panel);
    border-bottom: 1px solid var(--panel-border);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

#app-title {
    margin: 0 auto 0 0;
    font-size: 19px;
    font-weight: 700;
    letter-spacing: 0.01em;
    white-space: nowrap;
}

#add-btn {
    position: relative;
    padding: 9px 20px;
}

#add-btn::before {
    content: "+";
    margin-right: 6px;
    font-size: 18px;
    line-height: 1;
}

.icon-btn {
    flex: 0 0 auto;
    width: 36px;
    height: 36px;
    margin-left: -8px;
    border: 0;
    border-radius: 50%;
    background: none;
    cursor: pointer;
}

.icon-btn:active { background: var(--chip); }

/* Chevrons drawn from two borders, so they sit dead centre whatever the font. */
.chevron-left::before,
.chevron-right::before {
    content: "";
    display: block;
    width: 11px;
    height: 11px;
    margin: auto;
    border: solid currentColor;
    border-width: 0 0 2.5px 2.5px;
    transform: translateX(2px) rotate(45deg);
}

.chevron-right::before {
    border-width: 2.5px 2.5px 0 0;
    transform: translateX(-2px) rotate(45deg);
}

#folder-name {
    flex: 1 1 auto;
    min-width: 0;
    margin: 0 auto 0 0;
    padding: 4px 0;
    border: 0;
    background: none;
    font-size: 19px;
    font-weight: 700;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
}

/* A small down chevron: tap the name for rename / delete. */
#folder-name::after {
    content: "";
    display: inline-block;
    width: 7px;
    height: 7px;
    margin: 0 0 5px 9px;
    border: solid var(--muted);
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    vertical-align: middle;
}

#folder-bar {
    flex-basis: 100%;
    display: flex;
    align-items: center;
    gap: 8px;
}

#folder-bar .chip {
    padding: 5px 12px;
    font-size: 13px;
    max-width: none;
}

#sort-btn { margin-left: auto; }

#delete-folder-btn {
    margin-left: 0;
    color: var(--danger);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

#sort-btn::before {
    content: "⇅";
    color: var(--muted);
}

.countdown {
    font-variant-numeric: tabular-nums;
    color: var(--muted);
}

.countdown.big {
    font-size: 15px;
    font-weight: 600;
    color: var(--fg);
}

.countdown.big::before {
    content: "⏱ ";
    font-weight: 400;
}

.countdown.soon { color: var(--warn); }
.countdown.urgent { color: var(--danger); }

/* --- Upload progress --- */

#upload-status {
    flex-basis: 100%;
    padding-top: 2px;
}

.progress {
    height: 4px;
    border-radius: 2px;
    background: var(--chip-border);
    overflow: hidden;
}

#progress-bar {
    height: 100%;
    width: 0;
    background: var(--accent);
    transition: width 200ms ease;
}

#upload-status.done #progress-bar { background: #24b36b; }
#upload-status.failed #progress-bar { background: var(--danger); }

/* Waiting for the phone to hand the files over: a stripe sliding along, no percentage to show yet. */
#upload-status.preparing #progress-bar {
    width: 35%;
    transition: none;
    animation: preparing 1.2s ease-in-out infinite;
}

@keyframes preparing {
    from { transform: translateX(-100%); }
    to { transform: translateX(290%); }
}

#upload-text {
    margin: 6px 0 0;
    font-size: 13px;
    color: var(--muted);
}

/* --- Home: folders --- */

#home {
    padding: 14px calc(14px + var(--safe-right)) calc(24px + var(--safe-bottom)) calc(14px + var(--safe-left));
}

#folder-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 14px;
}

.folder-card {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
    padding: 0;
    border: 0;
    background: none;
    text-align: left;
    cursor: pointer;
}

.folder-card .cover {
    position: relative;
    aspect-ratio: 4 / 3;
    margin-bottom: 5px;
    border-radius: 14px;
    overflow: hidden;
    background: var(--chip);
    border: 1px solid var(--chip-border);
}

.folder-card .cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.folder-card .cover:empty::after {
    content: "Empty";
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    font-size: 13px;
}

.folder-card.new-folder .cover {
    border-style: dashed;
    background: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.plus {
    position: relative;
    width: 26px;
    height: 26px;
}

.plus::before,
.plus::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    width: 26px;
    height: 2.5px;
    border-radius: 2px;
    background: var(--muted);
    transform: translate(-50%, -50%);
}

.plus::after { transform: translate(-50%, -50%) rotate(90deg); }

.folder-title {
    font-weight: 650;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.folder-meta,
.folder-card .countdown {
    font-size: 13px;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.folder-card .countdown.soon { color: var(--warn); }
.folder-card .countdown.urgent { color: var(--danger); }

#home .empty-note {
    margin-top: 28px;
    font-size: 14px;
}

/* --- Timeline --- */

#timeline {
    padding: 0 var(--safe-right) calc(24px + var(--safe-bottom)) var(--safe-left);
}

body.has-selection #timeline {
    padding-bottom: calc(96px + var(--safe-bottom));
}

.empty-note {
    margin: 22vh auto 0;
    max-width: 320px;
    padding: 0 16px;
    text-align: center;
    color: var(--muted);
    line-height: 1.5;
}

.day-header {
    display: flex;
    align-items: baseline;
    gap: 8px;
    padding: 18px 14px 8px;
}

.day-header h2 {
    margin: 0;
    font-size: 16px;
    font-weight: 650;
}

.day-count {
    color: var(--muted);
    font-size: 13px;
}

.day-select {
    margin-left: auto;
    border: 0;
    background: none;
    color: var(--accent);
    font-size: 14px;
    font-weight: 600;
    padding: 4px 0 4px 12px;
    cursor: pointer;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: var(--tile-gap);
}

.tile {
    position: relative;
    aspect-ratio: 1;
    overflow: hidden;
    background: var(--chip);
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

.tile img,
.tile .placeholder {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 140ms ease, opacity 140ms ease;
}

.tile .placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.06em;
}

.tile.selected img,
.tile.selected .placeholder {
    transform: scale(0.88);
    border-radius: 6px;
}

.tile.selected {
    background: color-mix(in srgb, var(--accent) 22%, var(--chip));
}

.badge {
    position: absolute;
    max-width: calc(100% - 12px);
    padding: 2px 7px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.58);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.5;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    pointer-events: none;
}

.badge.uploader {
    left: 6px;
    bottom: 6px;
    max-width: calc(100% - 50px);
    border-left: 3px solid var(--badge, transparent);
}

.badge.duration {
    right: 6px;
    bottom: 6px;
}

.tile.video .badge.uploader { max-width: calc(50% - 6px); }

.select-btn {
    position: absolute;
    top: 0;
    left: 0;
    width: 48px;
    height: 48px;
    padding: 0;
    border: 0;
    background: none;
    cursor: pointer;
}

.check {
    position: absolute;
    top: 7px;
    left: 7px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.92);
    background: rgba(0, 0, 0, 0.22);
    box-shadow: 0 0 3px rgba(0, 0, 0, 0.45);
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    line-height: 22px;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.tile.selected .check,
.select-btn.on .check {
    background: var(--accent);
    border-color: #fff;
}

.select-btn:focus-visible { outline: none; }
.select-btn:focus-visible .check { outline: 2px solid var(--accent); outline-offset: 2px; }

@media (min-width: 700px) {
    .grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
}

/* --- Action bar --- */

#action-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px calc(12px + var(--safe-right)) calc(10px + var(--safe-bottom)) calc(14px + var(--safe-left));
    background: var(--panel);
    border-top: 1px solid var(--panel-border);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

#selection-info {
    margin-right: auto;
    display: flex;
    flex-direction: column;
    min-width: 0;
    font-size: 14px;
    line-height: 1.3;
}

#selection-count { font-weight: 600; }

#selection-size {
    color: var(--muted);
    font-size: 12px;
}

#selection-info span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#selection-size.warn {
    color: var(--warn);
}

#selection-size.warn::after {
    content: " · large, may reload";
}

#action-bar .cta-btn {
    padding: 10px 14px;
}

#share-btn {
    min-width: 84px;
}

/* Filling up as the files arrive: blue over the button, so it's plain something's happening. */
#share-btn.loading {
    background: linear-gradient(90deg, var(--accent) var(--progress, 0%), color-mix(in srgb, var(--accent) 45%, #0b1220) var(--progress, 0%));
    border-color: var(--accent);
    color: #fff;
    font-variant-numeric: tabular-nums;
}

.progress.big {
    height: 10px;
    border-radius: 5px;
    margin: 4px 0 10px;
}

#share-progress {
    height: 100%;
    width: 0;
    background: var(--accent);
    border-radius: 5px;
    transition: width 150ms linear;
}

#share-progress.failed { background: var(--danger); }

#share-status {
    margin: 0;
    font-size: 14px;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}

@media (max-width: 360px) {
    #clear-btn { display: none; }
}

/* --- Viewer --- */

#viewer {
    position: fixed;
    inset: 0;
    z-index: 30;
    background: #000;
    color: #fff;
}

#viewer-stage {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    touch-action: none; /* pinch, pan and swipe are handled here */
}

/* With a selection, the action bar shows over the viewer: share without leaving it. */
body.has-selection #viewer-stage {
    bottom: calc(68px + var(--safe-bottom));
}

body.has-selection.viewer-open #action-bar {
    z-index: 35;
    background: rgba(12, 12, 12, 0.92);
    border-top-color: #222;
    color: #fff;
}

/* The viewer is always dark, so its action bar is too, whatever the phone's theme. */
body.viewer-open #action-bar .cta-btn {
    background: #161616;
    border-color: #343434;
    color: #edf0f4;
}

body.viewer-open #action-bar .cta-btn.is-default {
    background: #d4d4d4;
    border-color: #ebebeb;
    color: #171717;
}

body.viewer-open #action-bar .cta-btn.is-danger { color: #f87171; }
body.viewer-open #selection-size { color: #a5a9b2; }

#viewer.zoomed #viewer-stage { cursor: grab; }
#viewer.zoomed #viewer-stage:active { cursor: grabbing; }

/* The strip: the current item, with its neighbours just off either side, all moving together. */
#viewer-stage .track {
    position: absolute;
    inset: 0;
    will-change: transform;
}

#viewer-stage .slide {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

#viewer-stage .slide .placeholder {
    color: #a5a9b2;
}

#viewer-stage img,
#viewer-stage video {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    user-select: none;
    -webkit-user-select: none;
    transform-origin: center;
    will-change: transform;
}

#viewer-stage video {
    width: 100%;
    height: 100%;
}

#viewer-top {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: calc(10px + var(--safe-top)) calc(12px + var(--safe-right)) 22px calc(12px + var(--safe-left));
    background: linear-gradient(rgba(0, 0, 0, 0.7), transparent);
    pointer-events: none;
}

#viewer-top > * { pointer-events: auto; }

#viewer-info {
    flex: 1;
    margin: 0;
    font-size: 13px;
    line-height: 1.35;
    color: rgba(255, 255, 255, 0.86);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}

#viewer-select {
    position: relative;
    flex: 0 0 auto;
    width: 44px;
    height: 44px;
}

#viewer-select .check {
    top: 8px;
    left: 8px;
    width: 28px;
    height: 28px;
    line-height: 24px;
}

.nav-btn {
    position: absolute;
    top: 50%;
    margin-top: -24px;
    width: 48px;
    height: 48px;
    color: #fff;
}

.nav-btn.chevron-left::before,
.nav-btn.chevron-right::before {
    width: 13px;
    height: 13px;
}

#viewer-prev { left: calc(12px + var(--safe-left)); }
#viewer-next { right: calc(12px + var(--safe-right)); }

#viewer.zoomed .nav-btn { opacity: 0.35; }

/* Touch screens swipe, as their own galleries do; the arrows are for a mouse (and the keys for a keyboard). */
@media (hover: none) {
    .nav-btn { display: none; }
}

/* Centred on the picture, which sits above the action bar while something's selected. */
body.has-selection .nav-btn {
    top: calc((100% - 68px - var(--safe-bottom)) / 2);
}

#viewer-loading {
    position: absolute;
    left: 50%;
    top: calc(70px + var(--safe-top));
    transform: translateX(-50%);
    margin: 0;
    padding: 6px 12px;
    border-radius: 999px;
    background: rgba(20, 20, 20, 0.8);
    color: #edf0f4;
    font-size: 12.5px;
    pointer-events: none;
}

#viewer-note {
    position: absolute;
    left: 50%;
    bottom: calc(80px + var(--safe-bottom));
    transform: translateX(-50%);
    width: min(420px, calc(100% - 32px));
    margin: 0;
    padding: 10px 14px;
    border-radius: 14px;
    background: rgba(20, 20, 20, 0.85);
    font-size: 13px;
    text-align: center;
}

/* --- Name dialog and toast --- */

dialog {
    width: min(380px, calc(100% - 32px));
    border: 1px solid var(--panel-border);
    border-radius: 20px;
    background: var(--bg);
    color: var(--fg);
    padding: 22px;
}

dialog::backdrop {
    background: rgba(0, 0, 0, 0.6);
}

dialog h2 {
    margin: 0 0 6px;
    font-size: 20px;
}

dialog p {
    margin: 0 0 16px;
    font-size: 14px;
    line-height: 1.4;
}

.dialog-actions .spacer { flex: 1; }

.dialog-actions {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-top: 16px;
}

#toast {
    position: fixed;
    left: 50%;
    bottom: calc(20px + var(--safe-bottom));
    transform: translateX(-50%);
    z-index: 40;
    width: max-content;
    max-width: calc(100% - 32px);
    padding: 10px 16px;
    border-radius: 999px;
    background: var(--default-bg);
    color: var(--default-fg);
    font-size: 14px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
}

body.has-selection #toast {
    bottom: calc(84px + var(--safe-bottom));
}

/* --- Trim and mute (videos, in the viewer) --- */

#viewer-edit {
    flex: 0 0 auto;
    max-width: none;
    padding: 7px 13px;
    background: rgba(10, 10, 10, 0.55);
    border-color: rgba(255, 255, 255, 0.25);
    color: #fff;
}

.badge.duration.edited {
    background: color-mix(in srgb, var(--accent) 80%, black);
}

#viewer.editing #viewer-stage {
    bottom: calc(196px + var(--safe-bottom));
}

#viewer.editing .nav-btn,
#viewer.editing #viewer-select,
#viewer.editing #viewer-edit {
    display: none;
}

body:has(#viewer.editing) #action-bar { display: none; }

#trim-panel {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 14px calc(16px + var(--safe-right)) calc(12px + var(--safe-bottom)) calc(16px + var(--safe-left));
    background: rgba(12, 12, 12, 0.96);
    border-top: 1px solid #222;
    color: #edf0f4;
}

#trim-track {
    position: relative;
    height: 44px;
    margin: 0 12px 10px;
    border-radius: 8px;
    background: #222;
    touch-action: none;
    cursor: pointer;
}

/* Keyframes: where a quick cut can start. */
#trim-ticks span {
    position: absolute;
    bottom: 0;
    width: 2px;
    height: 10px;
    margin-left: -1px;
    background: rgba(255, 255, 255, 0.35);
    pointer-events: none;
}

#trim-range {
    position: absolute;
    top: 0;
    bottom: 0;
    background: color-mix(in srgb, #60a5fa 28%, transparent);
    border-top: 3px solid #60a5fa;
    border-bottom: 3px solid #60a5fa;
    pointer-events: none;
}

#trim-range.exact {
    border-left: 0;
}

#trim-playhead {
    position: absolute;
    top: -4px;
    bottom: -4px;
    width: 2px;
    margin-left: -1px;
    background: #fff;
    border-radius: 1px;
    pointer-events: none;
}

.trim-handle {
    position: absolute;
    top: -2px;
    bottom: -2px;
    width: 22px;
    margin-left: -11px;
    padding: 0;
    border: 0;
    border-radius: 6px;
    background: #60a5fa;
    cursor: ew-resize;
    touch-action: none;
}

/* A grip down the middle. */
.trim-handle::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 30%;
    bottom: 30%;
    width: 2px;
    margin-left: -1px;
    border-radius: 1px;
    background: rgba(0, 0, 0, 0.45);
}

/* An exact start: re-encoded when saved. */
.trim-handle.exact {
    background: #f59e0b;
}

.trim-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.trim-row .spacer { flex: 1; }

#trim-times {
    flex: 1;
    font-size: 14px;
    font-variant-numeric: tabular-nums;
}

#trim-mute {
    max-width: none;
    gap: 6px;
    background: #161616;
    border-color: #343434;
    color: #edf0f4;
}

#trim-mute .sound-off,
#trim-mute.on .sound-on { display: none; }
#trim-mute.on .sound-off { display: block; }

#trim-mute.on {
    background: #f87171;
    border-color: #f87171;
    color: #171717;
}

#trim-note {
    min-height: 2.6em;
    margin: 8px 0 10px;
    font-size: 12.5px;
    line-height: 1.3;
    color: #a5a9b2;
}

#trim-note.exact { color: #f59e0b; }

#trim-panel .cta-btn {
    padding: 9px 16px;
    background: #161616;
    border-color: #343434;
    color: #edf0f4;
}

#trim-panel .cta-btn.is-default {
    background: #d4d4d4;
    border-color: #ebebeb;
    color: #171717;
}

#trim-play {
    width: 40px;
    height: 40px;
    flex: 0 0 auto;
}

.play-icon {
    display: block;
    width: 0;
    height: 0;
    margin-left: 3px;
    border-style: solid;
    border-width: 8px 0 8px 13px;
    border-color: transparent transparent transparent #fff;
}

#trim-play.playing .play-icon {
    width: 12px;
    height: 15px;
    margin-left: 0;
    border-width: 0 4px;
    border-color: #fff;
}
