:root {
    color-scheme: dark;
    --bg: #0d0a1a;
    --panel: #151128;
    --panel-strong: #1d1736;
    --panel-soft: rgba(255, 255, 255, 0.055);
    --text: #f7f5ff;
    --muted: #aaa4c0;
    --line: rgba(255, 255, 255, 0.1);
    --purple: #7c5cff;
    --purple-bright: #9d82ff;
    --coral: #ff5e7d;
    --cyan: #25d9cb;
    --danger: #ff5676;
    --sidebar-width: 292px;
    --radius: 20px;
    --shadow: 0 24px 80px rgba(0, 0, 0, 0.42);
    font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-synthesis: none;
}

* {
    box-sizing: border-box;
}

html,
body {
    min-height: 100%;
    margin: 0;
    background: var(--bg);
    color: var(--text);
}

body {
    overflow-x: hidden;
}

button,
input {
    font: inherit;
}

button,
a {
    -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible,
input:focus-visible {
    outline: 3px solid rgba(157, 130, 255, 0.65);
    outline-offset: 3px;
}

.app-shell {
    min-height: 100dvh;
    display: grid;
    grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
}

.sidebar {
    position: fixed;
    z-index: 30;
    inset: 0 auto 0 0;
    width: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    padding: 24px 17px 17px;
    background:
        radial-gradient(circle at 15% 0%, rgba(124, 92, 255, 0.18), transparent 30%),
        linear-gradient(180deg, #17122b 0%, #100d20 100%);
    border-right: 1px solid var(--line);
    box-shadow: 14px 0 50px rgba(0, 0, 0, 0.16);
}

.brand {
    min-height: 48px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 8px;
}

.brand-mark {
    position: relative;
    width: 40px;
    height: 40px;
    flex: 0 0 auto;
    border-radius: 13px;
    overflow: hidden;
    background: #0f0b1d;
    box-shadow: 0 8px 26px rgba(124, 92, 255, 0.28);
}

.brand-mark::after {
    content: "";
    position: absolute;
    inset: 0;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: inherit;
}

.brand-mark span {
    position: absolute;
    inset-block: 0;
    width: 52%;
}

.brand-mark span:first-child {
    left: 0;
    background: linear-gradient(145deg, var(--purple-bright), var(--purple));
    clip-path: polygon(0 0, 100% 0, 70% 100%, 0 100%);
}

.brand-mark span:last-child {
    right: 0;
    background: linear-gradient(145deg, var(--coral), #ff966e);
    clip-path: polygon(30% 0, 100% 0, 100% 100%, 0 100%);
}

.brand strong,
.brand small {
    display: block;
}

.brand strong {
    font-size: 15px;
    letter-spacing: 0.19em;
}

.brand small {
    margin-top: 3px;
    color: var(--muted);
    font-size: 11px;
    letter-spacing: 0.07em;
}

.library-heading {
    display: flex;
    justify-content: space-between;
    align-items: end;
    margin: 40px 8px 15px;
}

.eyebrow {
    display: block;
    margin-bottom: 5px;
    color: var(--purple-bright);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.library-heading strong {
    font-size: 14px;
}

.icon-button {
    width: 39px;
    height: 39px;
    display: inline-grid;
    place-items: center;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--panel-soft);
    color: var(--muted);
    cursor: pointer;
    transition: 160ms ease;
}

.icon-button:hover {
    border-color: rgba(157, 130, 255, 0.42);
    background: rgba(124, 92, 255, 0.12);
    color: var(--text);
}

.icon-button svg,
.button svg,
.row-delete svg,
.danger-icon svg {
    width: 19px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.comparison-list {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.16) transparent;
}

.comparison-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 38px;
    align-items: center;
    gap: 1px;
    margin: 4px 0;
    border: 1px solid transparent;
    border-radius: 14px;
    transition: 160ms ease;
}

.comparison-row:hover {
    background: rgba(255, 255, 255, 0.045);
}

.comparison-row.is-active {
    border-color: rgba(157, 130, 255, 0.34);
    background: linear-gradient(90deg, rgba(124, 92, 255, 0.2), rgba(124, 92, 255, 0.07));
    box-shadow: inset 3px 0 var(--purple-bright);
}

.comparison-row > a {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 9px 4px 9px 10px;
    color: inherit;
    text-decoration: none;
}

.thumbnail-stack {
    position: relative;
    width: 48px;
    height: 42px;
    flex: 0 0 auto;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    background: #090711;
}

.thumbnail-stack img {
    position: absolute;
    inset-block: 0;
    width: 55%;
    height: 100%;
    object-fit: cover;
}

.thumbnail-stack img:first-child {
    left: 0;
    clip-path: polygon(0 0, 100% 0, 78% 100%, 0 100%);
}

.thumbnail-stack img:last-child {
    right: 0;
    clip-path: polygon(22% 0, 100% 0, 100% 100%, 0 100%);
}

.comparison-name {
    min-width: 0;
}

.comparison-name strong,
.comparison-name small {
    display: block;
}

.comparison-name strong {
    overflow: hidden;
    color: #eeeafd;
    font-size: 13px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.comparison-name small {
    margin-top: 4px;
    color: var(--muted);
    font-size: 10px;
}

.row-delete {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    padding: 0;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: #777089;
    cursor: pointer;
    opacity: 0;
    transition: 160ms ease;
}

.comparison-row:hover .row-delete,
.comparison-row:focus-within .row-delete {
    opacity: 1;
}

.row-delete:hover {
    background: rgba(255, 86, 118, 0.13);
    color: #ff7892;
}

.sidebar-bulk-actions {
    flex: 0 0 auto;
    padding: 8px 4px 7px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.delete-all-trigger {
    width: 100%;
    min-height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 0 10px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: #777184;
    font-size: 10px;
    font-weight: 650;
    cursor: pointer;
    transition: 150ms ease;
}

.delete-all-trigger svg {
    width: 15px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.delete-all-trigger:hover {
    background: rgba(255, 86, 118, 0.08);
    color: #d895a2;
}

.sidebar-guide {
    display: flex;
    align-items: center;
    gap: 7px;
    flex: 0 0 auto;
    padding: 7px 9px;
    border: 1px solid rgba(255, 255, 255, 0.055);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.018);
    opacity: 0.64;
    transition: 150ms ease;
}

.sidebar-guide:hover,
.sidebar-guide:focus-within {
    border-color: rgba(255, 255, 255, 0.1);
    opacity: 1;
}

.guide-icon {
    width: 20px;
    height: 20px;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    color: #8d879a;
    font-size: 11px;
    font-weight: 750;
    line-height: 1;
}

.sidebar-guide a {
    min-width: 0;
    display: block;
    color: inherit;
    text-decoration: none;
}

.sidebar-guide strong {
    display: block;
    color: #a29bad;
    font-size: 9px;
    font-weight: 650;
    letter-spacing: 0.02em;
}

.sidebar-guide small {
    display: block;
    margin-top: 1px;
    color: #6f697a;
    font-size: 8px;
}

.sidebar-footnote {
    margin: 11px 0 0;
    color: #6e687e;
    font-size: 9px;
    letter-spacing: 0.07em;
    text-align: center;
}

.sidebar-scrim {
    display: none;
}

.workspace {
    position: relative;
    grid-column: 2;
    min-width: 0;
    min-height: 100dvh;
    overflow: hidden;
    background:
        radial-gradient(circle at 86% 8%, rgba(255, 94, 125, 0.1), transparent 25%),
        radial-gradient(circle at 50% 90%, rgba(124, 92, 255, 0.12), transparent 38%),
        var(--bg);
}

.workspace::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: 0.16;
    background-image: radial-gradient(rgba(255, 255, 255, 0.25) 0.6px, transparent 0.6px);
    background-size: 24px 24px;
    mask-image: linear-gradient(to bottom, black, transparent 58%);
}

.topbar {
    position: relative;
    z-index: 3;
    min-height: 90px;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px clamp(22px, 3vw, 52px);
    border-bottom: 1px solid var(--line);
    background: rgba(13, 10, 26, 0.68);
    backdrop-filter: blur(18px);
}

.mobile-menu {
    display: none;
}

.page-title {
    min-width: 0;
}

.page-title h1 {
    overflow: hidden;
    margin: 0;
    font-size: clamp(21px, 2.3vw, 30px);
    letter-spacing: -0.025em;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.top-actions {
    display: flex;
    gap: 9px;
    margin-left: auto;
}

.button {
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 16px;
    border: 1px solid transparent;
    border-radius: 12px;
    color: var(--text);
    font-size: 12px;
    font-weight: 750;
    text-decoration: none;
    cursor: pointer;
    transition: transform 140ms ease, border-color 140ms ease, background 140ms ease, box-shadow 140ms ease;
}

.button:hover {
    transform: translateY(-1px);
}

.button:active {
    transform: translateY(0);
}

.button.secondary {
    border-color: var(--line);
    background: rgba(255, 255, 255, 0.055);
    color: #d6d1e7;
}

.button.secondary:hover {
    border-color: rgba(157, 130, 255, 0.38);
    background: rgba(124, 92, 255, 0.1);
}

.button.primary {
    background: linear-gradient(135deg, var(--purple), #6846f4);
    box-shadow: 0 10px 28px rgba(124, 92, 255, 0.28);
}

.button.primary:hover {
    box-shadow: 0 12px 34px rgba(124, 92, 255, 0.4);
}

.button.ghost {
    background: transparent;
    color: var(--muted);
}

.button.ghost:hover {
    background: var(--panel-soft);
    color: var(--text);
}

.flash {
    position: fixed;
    z-index: 50;
    top: 104px;
    right: 24px;
    max-width: min(430px, calc(100vw - 48px));
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 13px 13px 13px 17px;
    border: 1px solid;
    border-radius: 13px;
    background: #1a1530;
    box-shadow: var(--shadow);
    font-size: 13px;
}

.flash.success {
    border-color: rgba(37, 217, 203, 0.34);
}

.flash.error {
    border-color: rgba(255, 86, 118, 0.4);
}

.flash button {
    width: 28px;
    height: 28px;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.06);
    color: var(--muted);
    cursor: pointer;
}

.viewer-section {
    position: relative;
    z-index: 1;
    max-width: 1500px;
    margin: 0 auto;
    padding: clamp(24px, 3.8vw, 54px) clamp(20px, 4.5vw, 74px) 28px;
}

.compare-frame {
    width: 100%;
    display: grid;
    place-items: center;
    padding: clamp(8px, 1vw, 14px);
    border: 1px solid rgba(255, 255, 255, 0.11);
    border-radius: calc(var(--radius) + 6px);
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.025));
    box-shadow: var(--shadow);
}

.compare-stage {
    --position: 50%;
    position: relative;
    width: 100%;
    max-height: calc(100dvh - 290px);
    min-height: 320px;
    overflow: hidden;
    isolation: isolate;
    border-radius: var(--radius);
    background:
        linear-gradient(45deg, #161326 25%, transparent 25%, transparent 75%, #161326 75%),
        linear-gradient(45deg, #161326 25%, #0d0b16 25%, #0d0b16 75%, #161326 75%);
    background-position: 0 0, 12px 12px;
    background-size: 24px 24px;
    user-select: none;
    touch-action: pan-y;
}

.compare-stage:fullscreen {
    width: 100vw !important;
    height: 100vh !important;
    max-height: none !important;
    border-radius: 0;
}

.fullscreen-navigator {
    display: none;
}

.compare-stage:fullscreen .fullscreen-navigator {
    position: absolute;
    z-index: 12;
    right: 50%;
    bottom: max(22px, env(safe-area-inset-bottom));
    width: min(520px, calc(100% - 32px));
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr) 48px;
    align-items: center;
    gap: 10px;
    padding: 8px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 18px;
    background: rgba(11, 8, 22, 0.72);
    box-shadow: 0 14px 42px rgba(0, 0, 0, 0.42);
    backdrop-filter: blur(16px);
    transform: translateX(50%);
}

.fullscreen-nav-button {
    width: 48px;
    height: 48px;
    display: grid;
    place-items: center;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 13px;
    background: rgba(255, 255, 255, 0.08);
    color: white;
    cursor: pointer;
    transition: 150ms ease;
}

.fullscreen-nav-button:hover {
    border-color: rgba(157, 130, 255, 0.55);
    background: rgba(124, 92, 255, 0.22);
}

.fullscreen-nav-button:disabled {
    color: #777181;
    cursor: not-allowed;
    opacity: 0.45;
}

.fullscreen-nav-button svg {
    width: 25px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.fullscreen-nav-status {
    min-width: 0;
    text-align: center;
}

.fullscreen-nav-status strong,
.fullscreen-nav-status small {
    display: block;
}

.fullscreen-nav-status strong {
    overflow: hidden;
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.fullscreen-nav-status small {
    margin-top: 3px;
    color: #aaa3b8;
    font-size: 9px;
    font-weight: 750;
    letter-spacing: 0.08em;
}

.compare-image,
.before-layer {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.compare-image {
    display: block;
    object-fit: cover;
    pointer-events: none;
}

.compare-stage.fit-contain .compare-image {
    object-fit: contain;
}

.before-layer {
    z-index: 2;
    overflow: hidden;
    clip-path: inset(0 calc(100% - var(--position)) 0 0);
    will-change: clip-path;
}

.before-layer .compare-image {
    max-width: none;
}

.image-label {
    position: absolute;
    z-index: 4;
    top: 18px;
    padding: 7px 11px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 999px;
    background: rgba(10, 8, 17, 0.63);
    box-shadow: 0 5px 18px rgba(0, 0, 0, 0.23);
    backdrop-filter: blur(10px);
    font-size: 10px;
    font-weight: 850;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.label-before {
    left: 18px;
}

.label-after {
    right: 18px;
}

.slider-line {
    position: absolute;
    z-index: 6;
    top: 0;
    bottom: 0;
    left: var(--position);
    width: 2px;
    background: white;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.14), 0 0 18px rgba(0, 0, 0, 0.45);
    pointer-events: none;
}

.slider-handle {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 54px;
    height: 54px;
    display: grid;
    place-items: center;
    border: 3px solid #fff;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--purple), var(--coral));
    box-shadow: 0 8px 30px rgba(10, 7, 22, 0.52);
    transform: translate(-50%, -50%);
}

.slider-handle svg {
    width: 31px;
    fill: none;
    stroke: white;
    stroke-width: 2.1;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.compare-range {
    position: absolute;
    z-index: 8;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    opacity: 0.001;
    cursor: ew-resize;
}

.viewer-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 18px 4px 0;
}

.file-legend {
    min-width: 0;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto auto minmax(0, 1fr);
    align-items: center;
    gap: 9px;
}

.file-legend > span:not(.legend-dot):not(.legend-divider) {
    min-width: 0;
}

.file-legend small,
.file-legend strong {
    display: block;
}

.file-legend small {
    margin-bottom: 3px;
    color: var(--muted);
    font-size: 9px;
    font-weight: 750;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.file-legend strong {
    overflow: hidden;
    max-width: 230px;
    color: #dcd7eb;
    font-size: 11px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.legend-dot.before {
    background: var(--purple-bright);
    box-shadow: 0 0 10px rgba(157, 130, 255, 0.6);
}

.legend-dot.after {
    background: var(--coral);
    box-shadow: 0 0 10px rgba(255, 94, 125, 0.55);
}

.legend-divider {
    width: 1px;
    height: 28px;
    margin: 0 4px;
    background: var(--line);
}

.viewer-actions {
    display: flex;
    gap: 8px;
    flex: 0 0 auto;
}

.interaction-hint {
    margin: 18px 0 0;
    color: #777188;
    font-size: 11px;
    text-align: center;
}

.interaction-hint span {
    margin-right: 5px;
    color: var(--purple-bright);
}

.empty-state {
    position: relative;
    z-index: 1;
    width: min(640px, calc(100% - 40px));
    min-height: calc(100dvh - 90px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    padding: 45px 0 85px;
    text-align: center;
}

.empty-visual {
    position: relative;
    width: 220px;
    height: 160px;
    margin-bottom: 30px;
}

.empty-card {
    position: absolute;
    top: 10px;
    width: 130px;
    height: 140px;
    border: 1px solid rgba(255, 255, 255, 0.13);
    border-radius: 18px;
    box-shadow: 0 18px 45px rgba(0, 0, 0, 0.28);
}

.empty-card.left {
    left: 4px;
    background: linear-gradient(145deg, rgba(124, 92, 255, 0.8), #271b5d);
    transform: rotate(-7deg);
}

.empty-card.right {
    right: 4px;
    background: linear-gradient(145deg, rgba(255, 94, 125, 0.82), #62253f);
    transform: rotate(7deg);
}

.empty-slider {
    position: absolute;
    z-index: 3;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 2px;
    background: white;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.4);
}

.empty-slider i {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 36px;
    height: 36px;
    border: 3px solid white;
    border-radius: 50%;
    background: var(--purple);
    transform: translate(-50%, -50%);
}

.empty-state h2 {
    margin: 7px 0 10px;
    font-size: clamp(26px, 4vw, 42px);
    letter-spacing: -0.04em;
}

.empty-state > p {
    max-width: 540px;
    margin: 0;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.7;
}

.path-example {
    display: grid;
    grid-template-columns: auto auto;
    margin: 25px 0;
    padding: 13px 18px;
    border: 1px solid var(--line);
    border-radius: 13px;
    background: rgba(255, 255, 255, 0.045);
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 12px;
    text-align: left;
}

.path-example span {
    color: var(--muted);
}

.path-example strong {
    color: var(--purple-bright);
}

.path-example small {
    grid-column: 1 / -1;
    margin-top: 7px;
    color: #827b94;
}

.delete-dialog {
    width: min(470px, calc(100vw - 30px));
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 22px;
    background: #171229;
    color: var(--text);
    box-shadow: 0 30px 100px rgba(0, 0, 0, 0.72);
}

.delete-dialog::backdrop {
    background: rgba(5, 4, 12, 0.76);
    backdrop-filter: blur(8px);
}

.delete-dialog form {
    position: relative;
    padding: 31px;
}

.dialog-close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 0;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.06);
    color: var(--muted);
    font-size: 22px;
    cursor: pointer;
}

.danger-icon {
    width: 48px;
    height: 48px;
    display: grid;
    place-items: center;
    margin-bottom: 22px;
    border-radius: 15px;
    background: rgba(255, 86, 118, 0.12);
    color: var(--danger);
}

.danger-icon svg {
    width: 25px;
}

.eyebrow.danger {
    color: #ff7892;
}

.delete-dialog h2 {
    margin: 5px 0 9px;
    font-size: 23px;
    letter-spacing: -0.025em;
}

.delete-dialog p {
    margin: 0 0 24px;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.55;
}

.delete-dialog label {
    display: block;
    margin-bottom: 8px;
    color: #c9c4d7;
    font-size: 12px;
}

.delete-dialog label strong {
    color: white;
}

.text-input {
    width: 100%;
    height: 46px;
    padding: 0 13px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 11px;
    background: #0e0b1a;
    color: white;
    outline: 0;
}

.text-input:focus {
    border-color: var(--purple-bright);
    box-shadow: 0 0 0 3px rgba(124, 92, 255, 0.15);
}

.dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 9px;
    margin-top: 24px;
}

.button.danger-button {
    background: var(--danger);
    color: white;
}

.button.danger-button:disabled {
    background: #4a3040;
    color: #8d7481;
    cursor: not-allowed;
    transform: none;
}

@media (max-width: 960px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        width: min(318px, 88vw);
        transform: translateX(-105%);
        transition: transform 230ms cubic-bezier(0.22, 1, 0.36, 1);
    }

    body.sidebar-open {
        overflow: hidden;
    }

    body.sidebar-open .sidebar {
        transform: translateX(0);
    }

    .sidebar-scrim {
        position: fixed;
        z-index: 20;
        inset: 0;
        display: block;
        border: 0;
        background: rgba(5, 3, 12, 0.7);
        opacity: 0;
        pointer-events: none;
        backdrop-filter: blur(4px);
        transition: opacity 200ms ease;
    }

    body.sidebar-open .sidebar-scrim {
        opacity: 1;
        pointer-events: auto;
    }

    .workspace {
        grid-column: 1;
    }

    .mobile-menu {
        display: inline-grid;
        flex: 0 0 auto;
    }

    .viewer-section {
        padding-inline: clamp(15px, 4vw, 38px);
    }

    .compare-stage {
        max-height: calc(100dvh - 270px);
    }

    .row-delete {
        color: #a59db8;
        opacity: 1;
    }
}

@media (hover: none) {
    .row-delete {
        opacity: 1;
    }
}

@media (max-width: 680px) {
    .topbar {
        min-height: 76px;
        padding: 13px 15px;
    }

    .page-title .eyebrow {
        display: none;
    }

    .page-title h1 {
        font-size: 19px;
    }

    .top-actions {
        gap: 5px;
    }

    .top-actions .button {
        width: 39px;
        min-height: 39px;
        padding: 0;
    }

    .top-actions .button span {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
        white-space: nowrap;
    }

    .viewer-section {
        padding-top: 18px;
        padding-bottom: 18px;
    }

    .compare-frame {
        padding: 6px;
        border-radius: 19px;
    }

    .compare-stage {
        min-height: clamp(340px, 58dvh, 560px);
        max-height: none;
        border-radius: 14px;
    }

    .image-label {
        top: 12px;
        padding: 6px 9px;
        font-size: 9px;
    }

    .label-before {
        left: 12px;
    }

    .label-after {
        right: 12px;
    }

    .slider-handle {
        width: 48px;
        height: 48px;
    }

    .compare-stage:fullscreen .fullscreen-navigator {
        bottom: max(12px, env(safe-area-inset-bottom));
        width: calc(100% - 20px);
        grid-template-columns: 44px minmax(0, 1fr) 44px;
        gap: 7px;
        padding: 7px;
        border-radius: 15px;
    }

    .fullscreen-nav-button {
        width: 44px;
        height: 44px;
        border-radius: 11px;
    }

    .viewer-toolbar {
        align-items: stretch;
        flex-direction: column;
        gap: 14px;
        padding-top: 14px;
    }

    .file-legend {
        width: 100%;
    }

    .file-legend strong {
        max-width: 120px;
    }

    .viewer-actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }

    .interaction-hint {
        display: none;
    }

    .flash {
        top: 88px;
        right: 15px;
        left: 15px;
        max-width: none;
    }

    .delete-dialog form {
        padding: 26px 21px 21px;
    }

    .dialog-actions {
        display: grid;
        grid-template-columns: 1fr;
    }

    .dialog-actions .button {
        width: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}
