/* ─── Global Variables ───────────────────────────────────────────────────────── */

:root {
    --bs-body-font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* ─── HDR / SDR Info Bar ────────────────────────────────────────────────────── */

.hdr-info-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 6px 16px;
    background: rgba(43, 108, 255, 0.12);
    border-bottom: 1px solid rgba(43, 108, 255, 0.25);
    font-size: 12px;
    color: #bbb;
    line-height: 1.4;
    overflow: visible;
    position: relative;
    z-index: 500;
}

.hdr-info-bar strong {
    color: #00ff86;
}

/* SDR warning overrides — more prominent red tint */
.hdr-info-bar-sdr {
    background: rgba(220, 60, 60, 0.18);
    border-bottom: 1px solid rgba(220, 60, 60, 0.4);
    color: #e08080;
}

.hdr-info-bar-sdr strong {
    color: #f87171;
}

.lightbox-hdr-info-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 2000;
    border-radius: 0;
    padding: 2px 14px;
    backdrop-filter: blur(8px);
    pointer-events: none;
    width: 100%;
}

/* Settings path tooltip */
.hdr-info-path-tip {
    display: inline-block;
    position: relative;
    cursor: help;
    outline: none;
    text-decoration: underline;
    text-decoration-style: dashed;
    text-decoration-color: rgba(255, 253, 0, 0.35);
    text-underline-offset: 3px;
}

.hdr-info-path-tooltip {
    display: none;
    position: fixed;
    top: auto;
    left: auto;
    transform: none;
    background: #1e1e1e;
    border: 1px solid rgba(255,255,255,0.12);
    color: #ccc;
    font-size: 12px;
    font-weight: 400;
    white-space: nowrap;
    padding: 6px 10px 0;
    border-radius: 5px;
    pointer-events: none;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0,0,0,0.5);
}

.hdr-info-path-tooltip-text {
    display: block;
    font-size: 18px; 
    padding-bottom: 8px;
    font-weight: bold;
    color: #ffffff;
}

.hdr-info-path-tooltip-img {
    display: block;
    width: 100%;
    max-width: 320px;
    border-radius: 0 0 4px 4px;
    margin: 0 -10px;
    width: calc(100% + 20px);
}

.hdr-info-path-tooltip::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-bottom-color: #1e1e1e;
}

/* show/hide handled by JS for accurate positioning */

/* SDR browser compatibility tooltip */
.sdr-browser-tip {
    display: inline-block;
    position: relative;
    cursor: help;
    text-decoration: underline;
    text-decoration-style: dashed;
    text-decoration-color: rgba(248, 113, 113, 0.4);
    text-underline-offset: 3px;
    pointer-events: auto;
}

.sdr-browser-tooltip {
    display: none;
    position: fixed;
    background: #1e1e1e;
    border: 1px solid rgba(255,255,255,0.12);
    color: #ccc;
    font-size: 12px;
    font-weight: 400;
    white-space: nowrap;
    padding: 8px 12px;
    border-radius: 5px;
    pointer-events: none;
    z-index: 4000;
    box-shadow: 0 4px 12px rgba(0,0,0,0.5);
    display: none;
    flex-direction: column;
    gap: 6px;
}

.sdr-browser-tooltip strong {
    color: #eee;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    opacity: 0.6;
}

.sdr-browser-row {
    display: flex;
    align-items: center;
    gap: 7px;
}

/* ─── Base ──────────────────────────────────────────────────────────────────── */

* { box-sizing: border-box; }

html, body {
    margin: 0;
    overflow-x: hidden;
}

body {
    font-family: var(--bs-body-font-family);
    background: #030303;
    color: #eee;
    text-align: center;
}

/* ─── Layout ────────────────────────────────────────────────────────────────── */

.container {
    max-width: 100%;
    margin: 0 auto;
    padding: 12px 20px;
    text-align: center;
}

.upload-section {
    margin-bottom: 18px;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

/* ─── Page Title ────────────────────────────────────────────────────────────── */

h1 {
    font-family: var(--bs-body-font-family);
    background: linear-gradient(90deg, #fffe26  0%, #f917ff  100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 500;
}

/* ─── Drop Zone ─────────────────────────────────────────────────────────────── */

/* Dashed border via background-image gradients — allows marching-ants animation */
.drop-zone {
    padding: 20px 20px;
    border-radius: 8px;
    cursor: pointer;
    position: relative;
    background: #181416;
    background-image:
        linear-gradient(90deg, #838383 50%, transparent 50%),
        linear-gradient(90deg, #838383 50%, transparent 50%),
        linear-gradient(0deg,  #838383 50%, transparent 50%),
        linear-gradient(0deg,  #838383 50%, transparent 50%);
    background-repeat: repeat-x, repeat-x, repeat-y, repeat-y;
    background-size: 10px 2px, 10px 2px, 2px 10px, 2px 10px;
    background-position: 0 0, 0 100%, 0 0, 100% 0;
}

.drop-zone:hover,
.drop-zone.drag-over {
    background-image:
        linear-gradient(90deg, #ffd400 50%, transparent 50%),
        linear-gradient(90deg, #ffd400 50%, transparent 50%),
        linear-gradient(0deg,  #ffd400 50%, transparent 50%),
        linear-gradient(0deg,  #ffd400 50%, transparent 50%);
}

@keyframes dash-move {
    to { background-position: 20px 0, -20px 100%, 0 -20px, 100% 20px; }
}

.drop-zone.drag-over {
    animation: dash-move 1s linear infinite;
}

.drop-zone-icon {
    color: #57aa5f;
    opacity: 0.7;
    font-size: 40px !important;
    line-height: 1;
}

.drop-zone-text {
    margin: 0;
    color: #ff7cb5;
    font-size: 16px;
    position: relative;
    z-index: 1;
}

.drop-zone-formats {
    margin: 8px 0 0;
    color: #ffe4e4;
    font-size: 12px;
    letter-spacing: 0.04em;
    font-family: var(--bs-body-font-family);
}

/* ─── Status / Progress ─────────────────────────────────────────────────────── */

.status-message {
    margin-bottom: 12px;
    font-size: 14px;
    color: #bbb;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

/* ── Import progress ── */
.import-progress {
    display: flex;
    flex-direction: column;
    gap: 9px;
    padding: 6px 0 8px;
    user-select: none;
    width: 100%;
    max-width: 320px;
    margin: 0 auto;
}

.import-progress-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    width: 100%;
}

.import-progress-spinner {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 1.5px solid #444;
    border-top-color: #2b6cff;
    flex-shrink: 0;
    animation: import-spin 0.65s linear infinite;
}

@keyframes import-spin {
    to { transform: rotate(360deg); }
}

.import-progress-label {
    font-size: 12px;
    color: #ccc;
    white-space: nowrap;
}

.import-progress-spacer { display: none; }

.import-progress-counter {
    font-size: 12px;
    color: #aaa;
    white-space: nowrap;
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
}

.import-progress-counter em {
    color: #fff;
    font-style: normal;
}

/* Segmented bar */
.import-progress-segments {
    display: flex;
    gap: 3px;
    width: 100%;
    height: 5px;
}

.import-progress-segment {
    flex: 1;
    height: 100%;
    border-radius: 3px;
    background: #383838;
    transition: background 0.25s ease;
}

.import-progress-segment.seg-done {
    background: #1bc174;
}

.import-progress-segment.seg-active {
    
    background: #eedc16;
    animation: import-pulse 0.9s ease-in-out infinite;
}

@keyframes import-pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.3; }
}


/* ─── Gallery ───────────────────────────────────────────────────────────────── */

.gallery-section-header {
    max-width: 800px;
    margin: 0 auto 12px;
    width: 100%;
    text-align: center;
}

.gallery-section-title {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #fff;
    white-space: nowrap;
}

/* ─── Game Banner Header (shown when a game is filtered) ─────────────────── */

.game-banner-header {
    position: relative;
    width: 100%;
    height: 110px;
    border-radius: 10px;
    overflow: hidden;
    background-color: #100820;
    background-size: cover;
    background-position: center 25%;
    display: flex;
    align-items: flex-end;
    padding: 14px 18px;
    box-sizing: border-box;
    transition: background-image 0.3s ease;
}

.game-banner-overlay {
    position: absolute;
    inset: 0;
    background:
        linear-gradient(to right,  rgba(0,0,0,0.88) 0%, rgba(0,0,0,0.55) 50%, rgba(0,0,0,0.18) 100%),
        linear-gradient(to top,    rgba(0,0,0,0.75) 0%, transparent 65%);
}

.game-banner-title {
    position: relative;
    z-index: 1;
    font-size: 20px;
    font-weight: 800;
    color: #fff;
    letter-spacing: 0.01em;
    line-height: 1.1;
    text-shadow:
        0 0 24px rgba(180, 130, 255, 0.55),
        0 0  8px rgba(120,  80, 200, 0.35),
        0 2px 6px rgba(0, 0, 0, 0.9);
    /* Shimmer animation on load */
    animation: banner-title-in 0.4s ease both;
}

@keyframes banner-title-in {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0);   }
}

.game-banner-close {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.45);
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    line-height: 1;
    transform: none;
    box-shadow: none;
    transition: background 0.15s ease, color 0.15s ease;
}

.game-banner-close:hover {
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    transform: none;
    box-shadow: none;
}

.game-banner-close:active {
    transform: none;
    box-shadow: none;
}

.game-banner-close svg {
    display: block;
    flex-shrink: 0;
    margin: 0;
}

/* Subtle scanline texture over the whole banner */
.game-banner-header::after {
    content: '';
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 3px,
        rgba(0,0,0,0.06) 3px,
        rgba(0,0,0,0.06) 4px
    );
    pointer-events: none;
    z-index: 0;
}

/* Skeleton shimmer while image loads */
.game-banner-header.banner-loading {
    background-image: none !important;
    background: linear-gradient(90deg, #1a0d2e 25%, #2a1545 50%, #1a0d2e 75%);
    background-size: 200% 100%;
    animation: banner-skeleton 1.4s ease infinite;
}

@keyframes banner-skeleton {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.gallery {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: stretch;
    max-width: 800px;
    margin: 0 auto;
}

/* legacy — kept for compat but not used in main gallery */
.gallery-item {
    background: #1a1a1a;
    padding: 8px;
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
}

.gallery-image {
    width: 100%;
    height: auto;
    object-fit: contain;
    background: #000;
    display: block;
    margin: 0 auto;
    border-radius: 10px;
}

/* position:relative so the meta overlay can be absolutely positioned inside */
.image-wrapper {
    position: relative;
    display: block;
    width: 100%;
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    /* Subtle outer glow on hover — transitions on the wrapper so nothing clips */
    box-shadow: 0 0 0 1px rgba(255,255,255,0.04), 0 4px 24px rgba(0,0,0,0.5);
    transition: box-shadow 0.3s ease, transform 0.3s cubic-bezier(0.2, 0, 0, 1);
    will-change: transform;
}

.image-wrapper:hover {
    box-shadow: 0 0 0 1px rgba(43,108,255,0.35),
                0 0 18px 2px rgba(43,108,255,0.15),
                0 8px 32px rgba(0,0,0,0.7);
    transform: translateY(-3px) scale(1.005);
}

/* ── Expand icon overlay ── */
.image-wrapper::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0);
    transition: background 0.25s ease;
    pointer-events: none;
    border-radius: 10px;
}

.image-wrapper:hover::after {
    background: rgba(0,0,0,0.12);
}

/* Shimmer sweep on hover */
.image-wrapper::before {
    content: '';
    position: absolute;
    top: -60%;
    left: -75%;
    width: 50%;
    height: 200%;
    background: linear-gradient(
        105deg,
        transparent 30%,
        rgba(255,255,255,0.06) 50%,
        transparent 70%
    );
    transform: skewX(-10deg);
    transition: none;
    opacity: 0;
    pointer-events: none;
    z-index: 2;
}

.image-wrapper:hover::before {
    animation: img-shimmer 0.5s ease forwards;
    opacity: 1;
}

@keyframes img-shimmer {
    0%   { left: -75%; opacity: 1; }
    100% { left: 125%; opacity: 0; }
}

/* Expand icon that appears on hover */
.image-wrapper-expand-icon {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 30px;
    height: 30px;
    border-radius: 6px;
    background: rgba(0,0,0,0.55);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border: 1px solid rgba(255,255,255,0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: scale(0.75);
    transition: opacity 0.2s ease, transform 0.2s cubic-bezier(0.2, 0, 0, 1);
    pointer-events: none;
    z-index: 3;
    color: #fff;
}

.image-wrapper:hover .image-wrapper-expand-icon {
    opacity: 1;
    transform: scale(1);
}

/* ─── Image Info Footer ─────────────────────────────────────────────────────── */

.image-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    font-size: 13px;
    position: relative;
}

.image-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    align-items: center;
    min-width: 0;
    flex: 1;
}

.image-tag {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    white-space: nowrap;
    color: var(--tag-color, #aaa);
    background: color-mix(in srgb, var(--tag-color, #aaa) 12%, transparent);
    border: 1px solid color-mix(in srgb, var(--tag-color, #aaa) 35%, transparent);
    transition: background 0.15s ease, border-color 0.15s ease;
}

.image-tag:hover {
    background: color-mix(in srgb, var(--tag-color, #aaa) 20%, transparent);
    border-color: color-mix(in srgb, var(--tag-color, #aaa) 55%, transparent);
}

.image-tag-glow {
    box-shadow: 0 0 6px 1px color-mix(in srgb, var(--tag-color) 50%, transparent),
                0 0 12px 2px color-mix(in srgb, var(--tag-color) 20%, transparent);
}

.image-tag-fallback {
    --tag-color: #868e96;
    font-weight: 400;
    font-size: 12px;
    letter-spacing: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 240px;
}

/* Centred temporary status text overlaid on the info bar */
.item-status-message {
    display: none;
    position: absolute;
    left: 0;
    right: 0;
    text-align: center;
    font-size: 13px;
    pointer-events: none;
}

.image-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

/* ─── Buttons ───────────────────────────────────────────────────────────────── */

button svg {
    display: inline-block;
    vertical-align: middle;
    margin-right: 4px;
    margin-bottom: 1px;
    flex-shrink: 0;
}

button {
    background: #2b6cff;
    color: #fff;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-family: var(--bs-body-font-family);
    transition: transform 0.15s cubic-bezier(0.2, 0, 0, 1), box-shadow 0.15s ease, background 0.15s ease, border-color 0.15s ease;
    position: relative;
    will-change: transform;
}

button:hover {
    background: #1e5ae6;
    transform: translateY(-4px);
    box-shadow: 0 4px 10px rgba(43, 108, 255, 0.3);
}

button:active {
    transform: translateY(-2px);
    box-shadow: 0 2px 5px rgba(43, 108, 255, 0.2);
       
}

button:focus {
    outline: none;
   
}

button:focus-visible {
    outline: 2px solid #5a8fff;
    outline-offset: 2px;
}

button.button-secondary {
    background: #0d0d0f;
   
    border: 1px solid #444;
    box-shadow: none;
}

button.button-secondary:hover {
    background: #2c2c35;
    border-color: #444;
    transform: translateY(-4px);
    box-shadow: 0 4px 10px rgba(255, 255, 255, 0.05);
}

button.button-secondary:active {
    transform: translateY(-2px);
    background: #1a1a20;
    box-shadow: 0 2px 5px rgba(255, 255, 255, 0.03);
}

button.button-danger {
    background: #dc3545;
}

button.button-danger:hover {
    background: #c82333;
    transform: translateY(-4px);
    box-shadow: 0 4px 10px rgba(220, 53, 69, 0.3);
}

button.button-danger:active {
    transform: translateY(-2px);
    box-shadow: 0 2px 5px rgba(220, 53, 69, 0.2);
}

/* Toggle buttons representing an active/on state */
button.button-active {
    background: #2b6cff;
    border-color: transparent;
    color: #fff;
    box-shadow: none;
    transform: translateY(-4px);
}

button.button-active:hover {
    background: #1e5ae6;
    border-color: transparent;
    transform: translateY(-4px);
    box-shadow: 0 4px 10px rgba(43, 108, 255, 0.4);
}

button.button-active:active {
    transform: translateY(-2px);
    box-shadow: 0 2px 5px rgba(43, 108, 255, 0.3);
}

button.detail-button--blocked {
    opacity: 0.30;
    filter: grayscale(0.35);
}

button.detail-button--blocked:hover {
    background: #0d0d0f;
    border-color: #444;
    transform: none;
    box-shadow: none;
}

/* ─── Nit Hunt (per-pixel luminance sampler) ────────────────────────────────── */

/* Crosshair cursor with black outline for visibility on bright image areas */
.cursor-nit-hunt {
    cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cline x1='12' y1='2' x2='12' y2='10' stroke='black' stroke-width='5' stroke-linecap='round'/%3E%3Cline x1='12' y1='14' x2='12' y2='22' stroke='black' stroke-width='5' stroke-linecap='round'/%3E%3Cline x1='2' y1='12' x2='10' y2='12' stroke='black' stroke-width='5' stroke-linecap='round'/%3E%3Cline x1='14' y1='12' x2='22' y2='12' stroke='black' stroke-width='5' stroke-linecap='round'/%3E%3Cline x1='12' y1='2' x2='12' y2='10' stroke='white' stroke-width='1.5' stroke-linecap='round'/%3E%3Cline x1='12' y1='14' x2='12' y2='22' stroke='white' stroke-width='1.5' stroke-linecap='round'/%3E%3Cline x1='2' y1='12' x2='10' y2='12' stroke='white' stroke-width='1.5' stroke-linecap='round'/%3E%3Cline x1='14' y1='12' x2='22' y2='12' stroke='white' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E") 12 12, crosshair;
}

.nit-tooltip {
    position: fixed;
    pointer-events: none;
    z-index: 9000;
    background: rgba(0, 0, 0, 0.90);
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    font-family: monospace;
    padding: 4px 8px;
    border-radius: 4px;
    white-space: nowrap;
    letter-spacing: 0.03em;
    backdrop-filter: blur(4px);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.cursor-tooltip-zoom-visible .cursor-tooltip-nits {
    border-top: 1px solid rgba(255, 255, 255, 0.3);
    padding-top: 4px;
}

.cursor-tooltip-zoom {
    display: flex;
    align-items: center;
}

/* ─── HDR / SDR Comparison Slider ──────────────────────────────────────────── */

.inline-comparison-slider {
    position: relative;
    width: 100%;
    overflow: hidden;
    cursor: ew-resize;
    user-select: none;
    background: #000;
    display: block;
}

/* Analysis Tool active over the compare slider: crosshair everywhere except
   near the drag handle (handled in JS via proximity to the divider), where
   the default ew-resize cursor is kept so the handle still reads as draggable. */
.inline-comparison-slider.cursor-nit-hunt {
    cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cline x1='12' y1='2' x2='12' y2='10' stroke='black' stroke-width='5' stroke-linecap='round'/%3E%3Cline x1='12' y1='14' x2='12' y2='22' stroke='black' stroke-width='5' stroke-linecap='round'/%3E%3Cline x1='2' y1='12' x2='10' y2='12' stroke='black' stroke-width='5' stroke-linecap='round'/%3E%3Cline x1='14' y1='12' x2='22' y2='12' stroke='black' stroke-width='5' stroke-linecap='round'/%3E%3Cline x1='12' y1='2' x2='12' y2='10' stroke='white' stroke-width='1.5' stroke-linecap='round'/%3E%3Cline x1='12' y1='14' x2='12' y2='22' stroke='white' stroke-width='1.5' stroke-linecap='round'/%3E%3Cline x1='2' y1='12' x2='10' y2='12' stroke='white' stroke-width='1.5' stroke-linecap='round'/%3E%3Cline x1='14' y1='12' x2='22' y2='12' stroke='white' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E") 12 12, crosshair !important;
}

/* HDR layer is the base — its natural size drives the container height */
.inline-comparison-hdr {
    display: block;
    width: 100%;
    height: auto;
    pointer-events: none;
}

/* SDR layer sits on top, clipped left of the drag position */
.inline-comparison-sdr {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
}

.inline-comparison-divider {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 2px;
    background: #fff;
    transform: translateX(-50%);
    pointer-events: none;
    box-shadow: 0 0 6px rgba(0,0,0,0.6);
    z-index: 10;
}

/* Circular drag handle on the divider */
.inline-comparison-divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%23333' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 12H3'/%3E%3Cpath d='m7 8-4 4 4 4'/%3E%3Cpath d='m17 8 4 4-4 4'/%3E%3C/svg%3E") center/20px no-repeat;
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}

.inline-comparison-label {
    position: absolute;
    top: 10px;
    background: #2b2b2b;
    font-size: 11px;
    font-weight: 900;
    font-family: var(--bs-body-font-family);
    padding: 3px 6px;
    border-radius: 4px;
    border: 2px solid;
    pointer-events: none;
    z-index: 11;
    letter-spacing: 0.06em;
    line-height: 1.2;
    transition: opacity 0.15s ease;
}

.inline-comparison-label-sdr {
    left: 10px;
    color: #ccc;
    border-color: #888;
}

.inline-comparison-label-hdr {
    right: 10px;
    color: #f5c518;
    border-color: #f5c518;
}

/* Simplified variant used only in the compare-lightbox (two different images
   side by side) — plain text over the image instead of a bordered badge.
   The regular same-image SDR/HDR toggle keeps the badge style above. */
.inline-comparison-label.inline-comparison-label--compare {
    background: none;
    border: none;
    padding: 0;
    letter-spacing: normal;
    font-weight: 600;
    font-size: 12px;
    color: #fff;
    text-shadow: 0 1px 3px rgba(0,0,0,0.85), 0 0 10px rgba(0,0,0,0.5);
}

.inline-comparison-label-sdr.inline-comparison-label--compare {
    color: #ddd;
    top: 50%;
    left: 0;
    right: auto;
    transform: translate(-100%, -50%);
    white-space: nowrap;
}

.inline-comparison-label-hdr.inline-comparison-label--compare {
    color: #f5c518;
    top: 50%;
    left: 0;
    right: auto;
    transform: translateY(-50%);
    white-space: nowrap;
}

/* ─── Metadata Overlay Panels ───────────────────────────────────────────────── */

/* Full-image overlay; pointer-events:none lets clicks pass through to the image */
.image-meta-overlay {
    position: absolute;
    inset: 0;
    z-index: 2052;
    pointer-events: none;
    border-radius: 4px;
    overflow: visible;
}

/* Flex container for initial panel placement — panels go position:absolute on first drag */
.imo-panels {
    position: absolute;
    inset: 0;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    pointer-events: none;
    padding: 10px;
    gap: 8px;
}

.imo-panel {
    background: rgba(0, 0, 0, 0.92);
    border-radius: 6px;
    padding: 10px 10px;
    pointer-events: all;
    cursor: grab;
    font-weight: 500;
    font-family: var(--bs-body-font-family);
    transition: opacity 150ms ease;
}

.imo-panel.imo-panel-zoom-hidden {
    opacity: 0;
    pointer-events: none;
}

.cursor-nit-hunt .imo-panel {
    cursor: grab !important;
}

.cursor-nit-hunt .imo-panel:active {
    cursor: grabbing !important;
}

/* Text elements keep the standard cursor — panel is draggable from anywhere */

.imo-panel-single {
    min-width: 180px;
    max-width: 300px;
    width: fit-content;
    max-height: calc(100dvh - 180px); /* JS overrides this with exact available space */
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #444 transparent;
}

.imo-section-title {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    margin-bottom: 2px;
    margin-top: 0;
    cursor: grab;
}

.imo-row {
    display: grid;
    grid-template-columns: 72px 1fr;
    gap: 0 6px;
    padding: 1px 0;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    font-size: 13.5px;
}

.imo-row:last-child { border-bottom: none; }

/* Gamut rows have a third column for the percentage value */
.imo-gamut-row {
    grid-template-columns: 62px 1fr 60px;
    align-items: center;
    gap: 0 8px;
}

.imo-gamut-row .imo-label { justify-self: start; }

.imo-label {
    color: #888;
    white-space: nowrap;
    justify-self: start;
}

.imo-value {
    color: #eee;
    text-align: right;
    justify-self: end;
    white-space: normal;
    word-break: break-word;
}

.imo-pct {
    color: #eee;
    font-size: 13.5px;
    text-align: right;
    white-space: nowrap;
}

.gamut-bar-wrap {
    display: block;
    width: 100%;
    height: 6px;
    background: #333;
    border-radius: 3px;
    overflow: hidden;
}

.gamut-bar {
    display: block;
    height: 100%;
    border-radius: 3px;
    max-width: 100%;
}

/* Drag handle — fades in on panel hover, flush at the top of the panel */
.imo-drag-handle {
    height: 12px;
    margin: -10px -10px 6px -10px;
    border-radius: 6px 6px 0 0;
    cursor: grab;
    background: #edc815;
    opacity: 0;
    transition: opacity 0.15s ease;
}

.imo-drag-handle:active { cursor: grabbing; }

.imo-panel:hover .imo-drag-handle { opacity: 1; }

/* ─── Gallery Search Bar ─────────────────────────────────────────────────────── */

.filter-bar {
    display: flex;
    justify-content: center;
    margin: 0 auto 16px;
    width: 100%;
}

.filter-bar-inner {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    max-width: 560px;
}

.filter-bar-count {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 500;
    color: #54ff6b;
    white-space: nowrap;
    flex-shrink: 0;
}

.filter-bar-count svg {
    flex-shrink: 0;
}

.gallery-search-wrap {
    position: relative;
    flex: 1;
    min-width: 0;
}

/* ─── View Toggle Buttons ───────────────────────────────────────────────────── */

.view-toggle {
    display: flex;
    align-items: center;
    gap: 2px;
    background: #1a1a1a;
    border: 1px solid #383838;
    border-radius: 8px;
    padding: 3px;
    flex-shrink: 0;
}

.view-toggle-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 5px;
    border: none;
    background: transparent;
    color: #666;
    cursor: pointer;
    padding: 0;
    transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
    will-change: transform;
}

.view-toggle-btn svg {
    margin: 0;
    display: block;
    flex-shrink: 0;
}

.view-toggle-btn:hover {
    background: #2a2a2a;
    color: #bbb;
    transform: none;
    box-shadow: none;
}

.view-toggle-btn:active {
    transform: none;
    box-shadow: none;
}

.view-toggle-btn:focus-visible {
    outline: 2px solid #5a8fff;
    outline-offset: 1px;
}

.view-toggle-btn.active {
    background: #2b6cff;
    color: #fff;
    transform: none;
    box-shadow: none;
}

.view-toggle-btn.active:hover {
    background: #1e5ae6;
    transform: none;
    box-shadow: none;
}

/* ─── Latest Uploads title ────────────────────────────────────────────────────── */

.gallery-section-title {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #dddddd;
    letter-spacing: 0.05em;
    text-transform: capitalize;
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
}

/* ─── 2-Column & 3-Column Grid Modes ──────────────────────────────────────────── */

/* grid2/grid3 outer: single column, centered — inner grid handles columns */
.gallery.gallery-grid2-mode,
.gallery.gallery-grid3-mode {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    max-width: 800px;
}

.gallery.gallery-grid2-mode .collage-card,
.gallery.gallery-grid3-mode .collage-card {
    max-width: 800px;
    width: 100%;
    margin: 0;
}

.gallery.gallery-grid3-mode .collage-title {
    font-size: 11px;
}

.gallery.gallery-grid3-mode .collage-header {
    padding: 6px 8px 5px;
}

/* Inner grid for game-grouped cards */
.collage-grid-game {
    grid-auto-rows: auto;
    justify-items: center;
}

.collage-grid-game-2 {
    grid-template-columns: 1fr 1fr;
}

.collage-grid-game-3 {
    grid-template-columns: 1fr 1fr 1fr;
}

/* If the last image is alone on a row, center it */
.collage-grid-game-2 .collage-cell:last-child:nth-child(odd),
.collage-grid-game-3 .collage-cell:last-child:nth-child(3n+1),
.collage-grid-game-3 .collage-cell:last-child:nth-child(3n+2) {
    grid-column: 1 / -1;
    width: 33%;
}
.collage-grid-game-2 .collage-cell:last-child:nth-child(odd) {
    width: 50%;
}

/* ─── List View Mode ────────────────────────────────────────────────────────── */

.gallery.gallery-list-mode {
    gap: 8px;
}

/* Cards are invisible wrappers in list mode — no background, no border, no gap */
.gallery.gallery-list-mode .collage-card {
    display: flex;
    flex-direction: column;
    gap: 0;
    border-radius: 0;
    overflow: visible;
    background: transparent;
    border: none;
}

/* Grid stacks images with a consistent gap between every one */
.gallery.gallery-list-mode .collage-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Each image cell is its own rounded card */
.gallery.gallery-list-mode .collage-cell {
    border-radius: 10px;
    box-shadow: none;
    overflow: hidden;
}

.gallery.gallery-list-mode .collage-thumb {
    width: 100%;
    height: auto;
    display: block;
    object-fit: contain;
    background: #0a0a0a;
    border-radius: 10px;
}


.gallery.gallery-list-mode .collage-hdr-type {
    display: none;
}

/* Image count badge — hidden in batch view, shown in list view in right column */
.collage-title-count-badge {
    display: none;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
    font-size: 11px;
    font-weight: 500;
    color: #54ff6b;
    white-space: nowrap;
}

.collage-hidden-badge {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 600;
    color: #f87171;
    background: rgba(220, 60, 60, 0.15);
    border: 1px solid rgba(220, 60, 60, 0.35);
    padding: 2px 8px;
    border-radius: 20px;
    white-space: nowrap;
    flex-shrink: 0;
    margin-left: 8px;
}

.collage-hidden-badge svg {
    flex-shrink: 0;
}

.collage-title-count-badge svg {
    display: inline-block;
    vertical-align: middle;
    flex-shrink: 0;
    margin: 0;
}

.gallery.gallery-list-mode .collage-title-count-badge {
    display: flex;
}

/* Each image gets its own mini-header in list mode */
.collage-cell-list-label {
    display: none;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    background: #111;
    border-top: 1px solid #222;
    font-size: 11px;
    color: #555;
    font-family: var(--bs-body-font-family);
}

.gallery.gallery-list-mode .collage-cell-list-label {
    display: flex;
}

.gallery-search-field {
    display: flex;
    align-items: center;
    background: #222;
    border: 1px solid #444;
    border-radius: 8px;
    padding: 0 10px;
    gap: 8px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.gallery-search-field:focus-within {
    border-color: #5865f2;
    border-width: 2px;
    box-shadow: 0 0 0 3px rgba(88,101,242,0.15);
}

.gallery-search-icon {
    flex-shrink: 0;
    color: #777;
    pointer-events: none;
}

.gallery-search-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: #e8e8e8;
    font-size: 13.5px;
    font-family: var(--bs-body-font-family);
    padding: 9px 0;
    min-width: 0;
}

.gallery-search-input::placeholder {
    color: #666;
}

.gallery-search-clear {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    color: #aaa;
    cursor: pointer;
    padding: 0;
    transition: color 0.12s ease, transform 0.12s ease;
}

.gallery-search-clear:hover {
    background: none;
    color: #fff;
    transform: translateY(0) scale(1.2);
    box-shadow: none;
}

.gallery-search-dropdown {
    position: absolute;
    top: calc(100% + 5px);
    left: 0;
    right: 0;
    z-index: 200;
    display: none;
    flex-direction: column;
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.75);
    overflow: hidden;
    max-height: 260px;
    overflow-y: auto;
}

.gallery-search-suggestion {
    padding: 9px 14px;
    font-size: 16px;
    font-weight: 400;
    color: #ccc;
    cursor: pointer;
    border-bottom: 1px solid #252525;
    transition: background 0.1s ease, color 0.1s ease;
    text-align: left;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.gallery-search-suggestion-count {
    font-size: 12px;
    color: #54ff6b;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.gallery-search-suggestion:last-child {
    border-bottom: none;
}

.gallery-search-suggestion:hover {
    background: #252525;
    color: #fff;
}
.gallery-search-suggestion-highlighted {
    background: #1a3a8a;
    color: #fff;
}

.gallery-search-suggestion mark {
    background: none;
    color: #fff;
    font-weight: 600;
}


/* ─── Modal ──────────────────────────────────────────────────────────────────── */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal {
    background: #1a1a1a;
    border: 1px solid #303030;
    border-radius: 10px;
    width: 420px;
    max-width: calc(100vw - 32px);
    max-height: calc(100dvh - 32px);
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.modal-header {
    padding: 10px 16px 8px;
    border-bottom: 1px solid #252525;
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex-shrink: 0;
}

.modal-title {
    font-size: 13px;
    font-weight: 700;
    color: #f0f0f0;
}

.modal-subtitle {
    font-size: 11px;
    color: #c6c6c6;
}

.modal-file-list {
    list-style: none;
    margin: 0 0 16px;
    padding: 8px 10px;
    background: #141414;
    border: 1px solid #2a2a2a;
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    max-height: 100px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #333 transparent;
}

.modal-file-list-item {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 12px;
    color: #888;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.modal-file-list-item span {
    overflow: hidden;
    text-overflow: ellipsis;
}

.modal-file-icon {
    color: #54ff6b;
    flex-shrink: 0;
}

.modal-file-name {
    color: #e8e8e8;
}

.modal-thumb {
    width: 100%;
    max-height: 80px;
    object-fit: cover;
    border-radius: 6px;
    margin-top: 6px;
    margin-bottom: 0;
}

.modal-spoiler-label {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
    padding: 5px 8px;
    font-size: 12px;
    color: #e1e1e1;
    cursor: pointer;
    user-select: none;
    border-radius: 5px;
    transition: background 0.1s ease, color 0.1s ease;
}

.modal-spoiler-label:hover {
    background: #262626;
}

.modal-spoiler-checkbox {
    display: none;
}

.modal-spoiler-label::before {
    content: '';
    width: 14px;
    height: 14px;
    border-radius: 3px;
    border: 1px solid #383838;
    flex-shrink: 0;
    transition: background 0.1s ease, border-color 0.1s ease;
    background: #181818;
}

.modal-spoiler-label:has(.modal-spoiler-checkbox:checked) {
    background: rgba(87, 101, 242, 0.1);
    color: #b0b8fa;
    font-weight: 600;
}

.modal-spoiler-label:has(.modal-spoiler-checkbox:checked)::before {
    background: #5765f2;
    border-color: #5765f2;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10'%3E%3Cpath d='M2 5l2.5 2.5L8 3' stroke='%23fff' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round' fill='none'/%3E%3C/svg%3E");
    background-size: 10px;
    background-repeat: no-repeat;
    background-position: center;
}

.modal-hidden-checkbox {
    display: none;
}

.modal-hidden-label {
    margin-top: 2px;
}

.modal-hidden-label:has(.modal-hidden-checkbox:checked) {
    background: rgba(87, 101, 242, 0.1);
    color: #b0b8fa;
    font-weight: 600;
}

.modal-hidden-label:has(.modal-hidden-checkbox:checked)::before {
    background: #5765f2;
    border-color: #5765f2;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10'%3E%3Cpath d='M2 5l2.5 2.5L8 3' stroke='%23fff' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round' fill='none'/%3E%3C/svg%3E");
    background-size: 10px;
    background-repeat: no-repeat;
    background-position: center;
}

.modal-body {
    padding: 10px 16px;
    overflow-y: auto;
    flex: 1 1 auto;
    min-height: 0;
    scrollbar-width: thin;
    scrollbar-color: #333 transparent;
    overscroll-behavior: contain;
}

.modal-section-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.01em;
    text-transform: none;
    color: #c0c0c0;
    margin-bottom: 5px;
    text-align: left;
}

.modal-section-label-hdr {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #252525;
}

/* ── Custom HDR type dropdown ───────────────────────────────────────── */
.modal-select-row {
    cursor: pointer;
    user-select: none;
}
.modal-select-row.hdr-trigger-open {
    border-color: #5865f2;
    border-width: 2px;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    border-bottom-color: transparent;
}

.hdr-custom-label {
    flex: 1;
    font-size: 13px;
    color: #e1e1e1;
    padding: 7px 0;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: left;
}

.hdr-custom-chevron {
    flex-shrink: 0;
    pointer-events: none;
    transition: transform 0.15s ease;
}
.hdr-trigger-open .hdr-custom-chevron {
    transform: rotate(180deg);
}

.hdr-custom-select-wrap {
    position: relative;
    margin-bottom: 4px;
}

.hdr-custom-dropdown {
    display: none;
    flex-direction: column;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 3100;
    background: #1a1a1a;
    border: 2px solid #5865f2;
    border-top: none;
    border-bottom-left-radius: 5px;
    border-bottom-right-radius: 5px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.7);
    max-height: 260px;
    overflow-y: auto;
    user-select: none;
}

.hdr-custom-group-header {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #50b1f6;
    padding: 8px 12px 4px;
    text-align: left;
}

.hdr-custom-item {
    font-size: 13px;
    color: #ccc;
    padding: 8px 12px;
    cursor: pointer;
    border-bottom: 1px solid #252525;
    transition: background 0.1s ease, color 0.1s ease;
    text-align: left;
    user-select: none;
}
.hdr-custom-item:last-child { border-bottom: none; }
.hdr-custom-item:hover { background: #252525; color: #fff; }
.hdr-custom-item-indented { padding-left: 28px; }
.hdr-custom-item-active { color: #fff; background: #1a3a8a; }
.hdr-custom-item-active:hover { background: #1e44a0; }


.game-search-wrap {
    position: relative;
    margin-bottom: 4px;
}

.game-search-row {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    background: #141414;
    border: 1px solid #333;
    border-radius: 5px;
    padding: 0 10px;
    box-sizing: border-box;
    transition: border-color 0.15s ease;
}

.game-search-row:focus-within {
    border-color: #5865f2;
    border-width: 2px;
}

/* When the HDR dropdown is open, suppress the blue border on the game name row.
   The search input stays focused by design (blurring it would collapse the results
   dropdown via a stacking-context reflow), so we cancel the highlight explicitly. */
.modal:has(.hdr-trigger-open) .game-search-row:focus-within:not(.modal-select-row) {
    border-color: #3a3a3a;
    border-width: 1px;
}

.game-search-icon {
    flex-shrink: 0;
    color: #666;
    pointer-events: none;
}

.game-search-results {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    z-index: 3100;
    display: none;
    flex-direction: column;
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 6px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.7);
    overflow: hidden;
    max-height: 260px;
    overflow-y: auto;
}

.game-search-input {
    flex: 1;
    background: transparent;
    border: none;
    color: #e8e8e8;
    font-size: 13px;
    font-family: var(--bs-body-font-family);
    padding: 7px 0;
    outline: none;
}

.game-search-status {
    font-size: 12px;
    color: #666;
    padding: 8px 12px;
}

.game-result-item {
    color: #ccc;
    font-size: 13px;
    padding: 9px 12px;
    cursor: pointer;
    border-bottom: 1px solid #252525;
    transition: background 0.1s ease, color 0.1s ease;
}

.game-result-item:last-child {
    border-bottom: none;
}

.game-result-item:hover {
    background: #252525;
    color: #fff;
}
.game-result-item-highlighted {
    background: #1a3a8a;
    color: #fff;
}

.hdr-type-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.hdr-type-group {
    display: flex;
    flex-direction: column;
    gap: 0;
    background: #1f1f1f;
    border: 1px solid #2a2a2a;
    border-radius: 7px;
    overflow: hidden;
}

.hdr-type-group-label {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #d9b444de;
    padding: 8px 10px 6px;
    border-bottom: 1px solid #2a2a2a;
}

.hdr-type-row {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.hdr-type-chip:focus {
    outline: none;
}

.modal button:not(.hdr-type-chip):focus {
    outline: 2px solid rgba(255, 255, 255, 0.5);
    outline-offset: 2px;
}

.modal .game-search-input:focus {
    outline: none;
}

.hdr-type-chip {
    background: transparent;
    border: none;
    border-bottom: 1px solid #252525;
    color: #e1e1e1;
    padding: 7px 10px;
    border-radius: 0;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.1s ease, color 0.1s ease;
    text-align: left;
    width: 100%;
    display: flex;
    align-items: center;
    gap: 8px;
}

.hdr-type-chip:last-child {
    border-bottom: none;
}

.hdr-type-chip::before {
    content: '';
    width: 14px;
    height: 14px;
    border-radius: 3px;
    border: 1px solid #383838;
    flex-shrink: 0;
    transition: background 0.1s ease, border-color 0.1s ease;
    background: #181818;
}

.hdr-type-chip:hover {
    background: #262626;
    color: #ddd;
    border-color: #252525;
}

.hdr-type-chip.selected {
    background: rgba(87, 101, 242, 0.1);
    color: #b0b8fa;
    font-weight: 600;
    border-bottom-color: #252525;
}

.hdr-type-chip.selected::before {
    background: #5765f2;
    border-color: #5765f2;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10'%3E%3Cpath d='M2 5l2.5 2.5L8 3' stroke='%23fff' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round' fill='none'/%3E%3C/svg%3E");
    background-size: 10px;
    background-repeat: no-repeat;
    background-position: center;
}

.modal-footer {
    padding: 8px 16px 10px;
    border-top: 1px solid #252525;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    flex-shrink: 0;
}

.modal-import {
    background: #2b6cff;
    color: #fff;
    border: none;
    padding: 7px 18px;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.15s ease;
}

.modal-import:hover:not(:disabled) {
    background: #1e5ae6;
}

.modal-import:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}
/* ─── Collage Card ───────────────────────────────────────────────────────────── */

.collage-card {
    border-radius: 8px;
    overflow: hidden;
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
}

.collage-header {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    padding: 10px 12px 8px;
    gap: 8px;
}

.gallery.gallery-list-mode .collage-header,
.gallery.gallery-filtered .collage-header {
    display: none;
}

.collage-hdr-type {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--hdr-badge-color, #a78bfa);
    background: color-mix(in srgb, var(--hdr-badge-color, #a78bfa) 12%, transparent);
    border: 1px solid color-mix(in srgb, var(--hdr-badge-color, #a78bfa) 30%, transparent);
    border-radius: 4px;
    padding: 1px 4px;
    white-space: nowrap;
    align-self: center;
}

.collage-header .collage-hdr-type {
    justify-self: end;
}

.collage-hdr-type--renodx        { --hdr-badge-color: #34d399; }
.collage-hdr-type--luma          { --hdr-badge-color: #f59e0b; }
.collage-hdr-type--native        { --hdr-badge-color: #e2e8f0; }
.collage-hdr-type--specialk      { --hdr-badge-color: #e05252; }
.collage-hdr-type--rtxHdr        { --hdr-badge-color: #60a5fa; }
.collage-hdr-type--autoHdr       { --hdr-badge-color: #c084fc; }
.collage-hdr-type--dxvk          { --hdr-badge-color: #2dd4bf; }
.collage-hdr-type--pumboReshade  { --hdr-badge-color: #f472b6; }
.collage-hdr-type--liliumReshade { --hdr-badge-color: #22d3ee; }
.collage-hdr-type--nativeHdr     { --hdr-badge-color: #e2e8f0; }

.collage-title {
    font-size: 14px;
    font-weight: 600;
    color: #bababa;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: center;
    pointer-events: none;
    grid-column: 2;
}

.collage-title-link {
    pointer-events: auto;
    cursor: pointer;
    transition: color 0.15s ease;
}

.collage-title-link:hover {
    color: #fff;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.collage-title-count {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 11px;
    font-weight: 500;
    color: #666;
    margin-left: 6px;
    vertical-align: middle;
}

.collage-header-tags {
    display: none;
}

.collage-cell-tags {
    position: absolute;
    bottom: 8px;
    left: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    pointer-events: none;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.25s ease, transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.collage-cell:hover .collage-cell-tags {
    opacity: 1;
    transform: translateY(0);
}

/* ─── Collage Grid Layouts ───────────────────────────────────────────────────── */

.collage-grid {
    display: grid;
    gap: 2px;
    width: 100%;
    padding: 2px;
}

/* 1 image */
.collage-grid-1 {
    grid-template-columns: 1fr;
}

/* 2 images — side by side */
.collage-grid-2 {
    grid-template-columns: 1fr 1fr;
}

/* 3 images — 1 large left, 2 stacked right */
.collage-grid-3 {
    grid-template-columns: 2fr 1fr;
}
.collage-grid-3 .collage-cell:first-child {
    grid-row: 1 / 3;
}

/* 4 images — 1 large top, 3 bottom row */
.collage-grid-4 {
    grid-template-columns: 1fr 1fr 1fr;
}
.collage-grid-4 .collage-cell-hero {
    grid-column: 1 / 4;
    grid-row: 1;
}

/* 5+ images — 2 top, 3 bottom */
.collage-grid-5 {
    grid-template-columns: 1fr 1fr 1fr;
}

.collage-cell {
    overflow: hidden;
    cursor: pointer;
    position: relative;
    background: #000;
    border-radius: 6px;
    box-shadow: 0 0 0 1px rgba(255,255,255,0.04), 0 2px 12px rgba(0,0,0,0.6);
    transition: box-shadow 0.3s ease, transform 0.3s cubic-bezier(0.2, 0, 0, 1);
    will-change: transform;
}

.collage-cell:hover {
    box-shadow: 0 8px 32px 4px rgba(0,0,0,0.85);
    transform: translateY(-3px) scale(1.008);
    z-index: 2;
}

/* Dim overlay — sits on every cell; fades to transparent on the hovered one.
   The grid:hover selector activates all overlays, :not(:hover) keeps them dark. */
.collage-cell::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0);
    transition: background 0.25s ease;
    pointer-events: none;
    z-index: 3;
    border-radius: inherit;
}

.collage-grid:hover .collage-cell:not(:hover)::after {
    background: rgba(0,0,0,0.45);
}

/* Expand icon — injected via JS, shown on hover */
.collage-cell-expand {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    border-radius: 5px;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border: 1px solid rgba(255,255,255,0.13);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: scale(0.7) translateY(-4px);
    transition: opacity 0.2s ease, transform 0.2s cubic-bezier(0.2, 0, 0, 1);
    pointer-events: none;
    z-index: 5;
    color: rgba(255,255,255,0.85);
}

.collage-cell:hover .collage-cell-expand {
    opacity: 1;
    transform: scale(1) translateY(0);
}

.collage-cell:has(.collage-cell-tags)::before {
    display: none;
}

.collage-cell-tags {
    z-index: 4;
}

.collage-thumb {
    width: 100%;
    height: auto;
    display: block;
    user-select: none;
    -webkit-user-drag: none;
    transition: transform 0.35s cubic-bezier(0.2, 0, 0, 1);
}

.collage-cell:hover .collage-thumb {
    transform: scale(1.025);
}

/* ─── Spoiler ────────────────────────────────────────────────────────────────── */

.collage-cell-spoiler .collage-thumb {
    filter: blur(24px) brightness(0.4);
    transform: scale(1.08);
    transition: filter 0.3s ease, transform 0.3s ease;
}

.collage-cell-spoiler.spoiler-revealed .collage-thumb {
    filter: none;
    transform: scale(1);
}

.collage-spoiler-label {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    font-weight: 800;
    letter-spacing: 0.12em;
    color: #fff;
    background: rgba(0, 0, 0, 0.3);
    transition: opacity 0.3s ease;
    z-index: 3;
    cursor: pointer;
}

.collage-cell-spoiler.spoiler-revealed .collage-spoiler-label {
    opacity: 0;
    pointer-events: none;
}

.collage-spoiler-label span {
    background: rgba(0, 0, 0, 0.7);
    padding: 6px 18px;
    border-radius: 20px;
}

/* ─── Lightbox Spoiler ───────────────────────────────────────────────────────── */

.lightbox-spoiler-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    cursor: pointer;
    transition: opacity 0.3s ease;
}

.lightbox-spoiler-overlay.lightbox-spoiler-overlay-hidden {
    opacity: 0;
    pointer-events: none;
}

.lightbox-spoiler-badge {
    background: rgba(0, 0, 0, 0.72);
    color: #fff;
    font-size: 15px;
    font-weight: 800;
    letter-spacing: 0.12em;
    padding: 10px 28px;
    border-radius: 24px;
    user-select: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.lightbox-spoiler-badge-sub {
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.04em;
    opacity: 0.7;
}

.lightbox-filmstrip-thumb-spoiler {
    filter: blur(6px) brightness(0.4);
}

/* ─── Lightbox ───────────────────────────────────────────────────────────────── */

.lightbox-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.99);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding-top: 12px;
    gap: 0;
    opacity: 0;
    transition: opacity 450ms cubic-bezier(0.2, 0, 0, 1);
    will-change: opacity;
}

.lightbox-overlay.lightbox-closing {
    transition: opacity 400ms cubic-bezier(0.2, 0, 0, 1);
}

.lightbox-image-area {
    flex: 1;
    min-height: 0;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    box-sizing: border-box;
    touch-action: none; /* JS handles all touch gestures */
}

.lightbox-image-wrapper {
    position: relative;
    max-width: 100%;
    max-height: 100%;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: center;
}

.lightbox-image-container {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    align-self: center;
    flex-shrink: 0;
}

.lightbox-image {
    max-width: calc(100vw - 120px);
    max-height: calc(100vh - 12px - 52px - 72px - 44px - 8px);
    object-fit: contain;
    display: block;
    cursor: zoom-in;
    user-select: none;
    -webkit-user-drag: none;
}

/* While holding zoom, image escapes its container and covers everything except the close button */
.lightbox-image.lightbox-image-zooming {
    position: fixed;
    z-index: 2050;
    max-width: 100vw;
    max-height: 100vh;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    object-fit: contain;
}

.lightbox-image.cursor-nit-hunt {
    cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cline x1='12' y1='2' x2='12' y2='10' stroke='black' stroke-width='5' stroke-linecap='round'/%3E%3Cline x1='12' y1='14' x2='12' y2='22' stroke='black' stroke-width='5' stroke-linecap='round'/%3E%3Cline x1='2' y1='12' x2='10' y2='12' stroke='black' stroke-width='5' stroke-linecap='round'/%3E%3Cline x1='14' y1='12' x2='22' y2='12' stroke='black' stroke-width='5' stroke-linecap='round'/%3E%3Cline x1='12' y1='2' x2='12' y2='10' stroke='white' stroke-width='1.5' stroke-linecap='round'/%3E%3Cline x1='12' y1='14' x2='12' y2='22' stroke='white' stroke-width='1.5' stroke-linecap='round'/%3E%3Cline x1='2' y1='12' x2='10' y2='12' stroke='white' stroke-width='1.5' stroke-linecap='round'/%3E%3Cline x1='14' y1='12' x2='22' y2='12' stroke='white' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E") 12 12, crosshair !important;
}

/* ─── Lightbox Toolbar ───────────────────────────────────────────────────────── */

.lightbox-toolbar {
    width: 100%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    background: #0d0d0d;
    border-top: 1px solid #1a1a1a;
    height: 52px;
    min-height: 52px;
    overflow: visible;
}

/* Inner wrapper — always centered, no left/right split */
.lightbox-toolbar-inner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    overflow: visible;
    width: auto;
    max-width: 100%;
}

/* Labels always hidden — icon-only buttons */
.lightbox-toolbar-inner .btn-label {
    display: none;
}

/* SDR/HDR toggle label — always visible, no icon */
.sdr-toggle-mode-label {
    display: inline;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
}

/* SDR ↔ HDR pill toggle */
.sdr-pill-toggle {
    display: inline-flex;
    align-items: center;
    background: #1a1a20;
    border: 1px solid #444;
    border-radius: 6px;
    cursor: pointer;
    flex-shrink: 0;
    height: 28px;
    position: relative;
    padding: 2px;
    gap: 0;
}

/* Sliding highlight indicator */
.sdr-pill-toggle::before {
    content: '';
    position: absolute;
    top: 2px;
    bottom: 2px;
    width: calc(50% - 2px);
    border-radius: 4px;
    background: linear-gradient(135deg, #f5c518 0%, #e8a800 100%);
    box-shadow: 0 0 8px rgba(245, 197, 24, 0.55), 0 0 2px rgba(245, 197, 24, 0.3);
    transition: transform 0.22s cubic-bezier(0.34, 1.3, 0.64, 1), background 0.15s ease;
    left: 2px;
    transform: translateX(calc(100%));
    pointer-events: none;
}

/* When SDR is active, slide indicator to the left */
.sdr-pill-toggle.sdr-active::before {
    transform: translateX(0);
    background: #4a5060;
    box-shadow: 0 0 6px rgba(74, 80, 96, 0.3);
}

.sdr-pill-seg {
    position: relative;
    z-index: 1;
    padding: 0 9px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.05em;
    color: #666;
    line-height: 24px;
    flex: 1;
    text-align: center;
    user-select: none;
    transition: color 0.18s ease;
}

.sdr-pill-seg--active {
    color: #fff;
}

/* When HDR is active (not sdr-active), the active seg sits on gold — use dark text */
.sdr-pill-toggle:not(.sdr-active) .sdr-pill-seg--active {
    color: #1a1200;
}

.sdr-pill-toggle:hover .sdr-pill-seg:not(.sdr-pill-seg--active) {
    color: #aaa;
}

.sdr-pill-toggle:not(.sdr-active):active::before {
    transform: translateX(calc(100%)) scaleX(0.95);
}

.sdr-pill-toggle.sdr-active:active::before {
    transform: translateX(0) scaleX(0.95);
}

.lightbox-toolbar-inner button {
    padding: 6px 8px;
}

.lightbox-toolbar-inner button svg {
    margin-right: 0;
}

.lightbox-toolbar-left {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: nowrap;
    overflow: visible;
}

/* Prevent individual button text from wrapping onto a second line */
.lightbox-toolbar button {
    white-space: nowrap;
}

.toolbar-separator {
    width: 1px;
    height: 20px;
    background: #333;
    flex-shrink: 0;
    margin: 0 2px;
}

.lightbox-toolbar-right {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: nowrap;
    overflow: visible;
}

/* ── Toolbar button tooltip ── */
.lightbox-toolbar {
    position: relative;
    z-index: 2200;
}

.lightbox-toolbar button[data-tooltip] {
    position: relative;
    z-index: 1;
}

.lightbox-toolbar button[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: #1e1e1e;
    color: #e0e0e0;
    font-size: 11px;
    font-family: inherit;
    white-space: nowrap;
    padding: 4px 8px;
    border-radius: 5px;
    border: 1px solid #333;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s ease;
    z-index: 2201;
}

.lightbox-toolbar button[data-tooltip]:hover::after {
    opacity: 1;
}

/* Hide text labels on narrow screens — buttons become icon-only with title tooltips */
@media (max-width: 700px) {
    .lightbox-toolbar .btn-label {
        display: none;
    }

    .lightbox-toolbar button {
        padding: 6px 8px;
    }

    button svg {
        margin-right: 0;
    }

    /* Tighten vertical layout on small screens */
    .lightbox-overlay {
        padding-top: 0;
        justify-content: flex-start;
    }

    .lightbox-image-area {
        flex: 1;
        min-height: 0;
        max-height: none;
        overflow: hidden;
    }

    .lightbox-image-wrapper {
        max-height: 100%;
    }

    .lightbox-image {
        max-width: calc(100vw - 72px);
        max-height: calc(100svh - 52px - 56px - 44px - 8px);
    }

    /* Header sits flush above image */
    .lightbox-image-header {
        padding-bottom: 4px;
    }

    .lightbox-filmstrip {
        height: 56px;
        padding: 4px 8px;
    }

    .lightbox-filmstrip-item {
        height: 40px;
    }

    .lightbox-filmstrip-thumb {
        height: 100%;
    }

}

.lightbox-copy-link-btn {
    white-space: nowrap;
}

.lightbox-copy-link-btn--copied {
    color: #1bc174 !important;
    border-color: #1bc174 !important;
}

/* Tags + title — sits as a flex row directly above the image, same width */
.lightbox-image-header {
    width: 100%;
    z-index: 10;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 8px;
    padding: 0 0 8px 0;
    pointer-events: none;
    flex-shrink: 0;
}

.lightbox-image-header > :last-child {
    display: flex;
    justify-content: flex-end;
    pointer-events: auto;
}

.lightbox-image-header-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    align-items: center;
    pointer-events: auto;
}

.lightbox-image-header-title {
    font-size: 14px;
    font-weight: 600;
    color: #ccc;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: center;
}

.lightbox-image-header-title--link {
    cursor: pointer;
    pointer-events: auto;
}

.lightbox-image-header-title--link:hover {
    color: #fff;
    text-decoration: underline;
    text-underline-offset: 3px;
}



/* Lightbox SDR comparison slider — absolutely overlays the rendered image, no layout disruption */
.lightbox-comparison-slider {
    position: absolute !important;
    background: transparent !important;
    z-index: 2051;
}

.lightbox-comparison-slider .inline-comparison-hdr {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.lightbox-comparison-slider .inline-comparison-sdr {
    object-fit: contain;
    width: 100%;
    height: 100%;
}

/* ─── Lightbox Filmstrip ─────────────────────────────────────────────────────── */

.lightbox-filmstrip {
    width: 100%;
    height: 72px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: safe center;
    gap: 4px;
    padding: 6px 12px;
    background: #0d0d0d;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: thin;
    scrollbar-color: #333 transparent;
    touch-action: pan-x; /* allow horizontal swipe-scroll of thumbnails */
    -webkit-overflow-scrolling: touch;
}

/* Floating status message rendered inside the lightbox overlay — visible
   regardless of scroll position or which panel is showing, since #statusMessage
   (the base-page equivalent) sits behind the lightbox and can't be seen. */
.lightbox-toast {
    position: fixed;
    top: 72px;
    left: 50%;
    transform: translateX(-50%) translateY(-8px);
    z-index: 10000;
    padding: 10px 18px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    background: #1a1a1a;
    border: 1px solid #333;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s ease, transform 0.18s ease;
    white-space: nowrap;
    max-width: 90vw;
    text-overflow: ellipsis;
    overflow: hidden;
}

.lightbox-toast--visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.lightbox-toast--error {
    border-color: #ff6b6b;
    color: #ff6b6b;
}

.lightbox-toast--success {
    border-color: #51cf66;
    color: #51cf66;
}

.lightbox-toast--info {
    border-color: #444;
    color: #ddd;
}


.lightbox-filmstrip-item {
    position: relative;
    flex-shrink: 0;
    height: 56px;
    cursor: pointer;
    border-radius: 3px;
    border: 2px solid transparent;
    transition: border-color 0.15s ease;
    overflow: hidden;
}

.lightbox-filmstrip-item:hover .lightbox-filmstrip-thumb {
    opacity: 0.75;
}

.lightbox-filmstrip-thumb-active .lightbox-filmstrip-thumb {
    opacity: 1;
}

.lightbox-filmstrip-thumb-active {
    border-color: #2b6cff;
}

/* "Compare with..." picker mode — every thumbnail gets a dashed ready-to-pick
   outline and a crosshair cursor; hovering one previews the pick with a solid
   highlight before the click commits it. */
.lightbox-filmstrip-picking .lightbox-filmstrip-item {
    cursor: crosshair;
    border-color: rgba(43, 108, 255, 0.35);
    border-style: dashed;
}

.lightbox-filmstrip-picking .lightbox-filmstrip-item:hover {
    border-color: #2b6cff;
    border-style: solid;
}

.lightbox-filmstrip-picking .lightbox-filmstrip-item:hover .lightbox-filmstrip-thumb {
    opacity: 1;
}

.lightbox-filmstrip-thumb {
    height: 100%;
    width: auto;
    min-width: 40px;
    object-fit: cover;
    display: block;
    opacity: 0.45;
    transition: opacity 0.15s ease;
}

.lightbox-filmstrip-spoiler-label {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.lightbox-filmstrip-spoiler-label::after {
    content: 'SPOILER';
    background: rgba(0, 0, 0, 0.75);
    color: #fff;
    font-size: 7px;
    font-weight: 800;
    letter-spacing: 0.1em;
    padding: 3px 6px;
    border-radius: 10px;
}

/* ─── Lightbox Nav Arrows ────────────────────────────────────────────────────── */

.lightbox-nav {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(50, 50, 50, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #fff;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 2100;
    padding: 0;
    transition: background 0.15s ease, opacity 0.15s ease;
}

.lightbox-overlay:has(.lightbox-image-zooming) .lightbox-nav {
    display: none;
}

.lightbox-overlay:has(.lightbox-image-zooming) .lightbox-close {
    display: none;
}

.lightbox-overlay:has(.lightbox-image-zooming) .lightbox-toolbar,
.lightbox-overlay:has(.lightbox-image-zooming) .lightbox-filmstrip,
.lightbox-overlay:has(.lightbox-image-zooming) .lightbox-image-header {
    opacity: 0;
    pointer-events: none;
    transition: none;
}

/* When zooming, labels switch to fixed so JS can place them over the image rect */
.lightbox-overlay:has(.lightbox-image-zooming) .lightbox-comparison-slider .inline-comparison-label {
    position: fixed;
}

/* When zooming, the image is position:fixed full-viewport — match the slider to it */
.lightbox-overlay:has(.lightbox-image-zooming) .lightbox-comparison-slider {
    position: fixed !important;
    top: 0;
    left: 0;
    width: 100vw !important;
    height: 100vh !important;
}

.lightbox-nav:hover {
    background: rgba(43, 108, 255, 0.5);
    border-color: rgba(43, 108, 255, 0.6);
    transform: translateY(-50%) translateY(0);
    box-shadow: none;
}

.lightbox-nav svg { margin: 0; }

.lightbox-nav-prev { left: 16px; }
.lightbox-nav-next { right: 16px; }

/* ─── Lightbox Close Button ──────────────────────────────────────────────────── */

.lightbox-close {
    position: fixed;
    top: 14px;
    right: 16px;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #fff;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 2100;
    padding: 0;
    transition: background 0.15s ease;
}

.lightbox-close:hover {
    background: rgba(220, 53, 69, 0.5);
    border-color: rgba(220, 53, 69, 0.5);
    transform: none;
    box-shadow: none;
}

.lightbox-close svg { margin: 0; }

.gallery-search-dropdown-header {
    padding: 7px 14px 4px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #50b1f6;
}
/* ─── Nit Tooltip ────────────────────────────────────────────────────────────── */

.nit-grid {
    display: grid;
    grid-template-columns: auto auto minmax(3.5em, auto);
    gap: 0 4px;
    align-items: baseline;
}

.nit-grid__val  { text-align: right; }
.nit-grid__r    { color: #ff6b6b; }
.nit-grid__g    { color: #51cf66; }
.nit-grid__b    { color: #4dabf7; }

.nit-grid__gamut {
    margin-top: 3px;
    grid-column: 1 / -1;
    border-top: 1px solid rgba(255,255,255,0.08);
    padding-top: 3px;
}

.nit-grid__gamut--709  { color: #60a5fa; }
.nit-grid__gamut--p3   { color: #34d399; }
.nit-grid__gamut--2020 { color: #f472b6; }
.nit-grid__gamut--sdr  { color: #a3a3a3; }

/* ─── Nit Loading ────────────────────────────────────────────────────────────── */

.nit-loading {
    display: flex;
    align-items: center;
    gap: 6px;
}

.nit-loading__spinner {
    animation: import-spin 0.65s linear infinite;
    flex-shrink: 0;
}

.nit-loading__text {
    color: #ffffff;
    font-size: 0.85em;
}

/* ─── Zoom Icon ──────────────────────────────────────────────────────────────── */

.zoom-icon {
    display: inline-block;
    vertical-align: -2px;
    margin-right: 4px;
    flex-shrink: 0;
}

/* ─── IMO Section Titles ─────────────────────────────────────────────────────── */

.imo-section-title--file      { color: #aaa; }
.imo-section-title--hdr       { color: #2b6cff; margin-top: 8px; }
.imo-section-title--luminance { color: #51cf66; margin-top: 8px; }
.imo-section-title--gamut     { color: #a78bfa; margin-top: 8px; }
.imo-row--unavailable         { color: #666; font-size: 13px; }
/* ── Additional Info ────────────────────────────────────────────────────────── */
.modal-section-label-info {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #252525;
}

.modal-additional-info-input {
    flex: 1;
    background: transparent;
    border: none;
    color: #e8e8e8;
    font-size: 13px;
    font-family: inherit;
    padding: 7px 0;
    outline: none;
}
.modal-additional-info-input::placeholder {
    color: #555;
}

/* Lightbox header title + subtitle wrapper */
.lightbox-image-header-title-wrap {
    position: relative;
    display: flex;
    align-items: center;
    min-width: 0;
}

.lightbox-image-header-title-row {
    display: flex;
    flex-direction: row;
    align-items: baseline;
    min-width: 0;
}

.lightbox-image-header-subtitle {
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    font-size: 11px;
    font-weight: 400;
    color: #888;
    white-space: nowrap;
}

.lightbox-image-header-subtitle:not([hidden])::before {
    content: '|';
    color: #747474;
    font-size: 14px;
    margin: 0 5px;
    font-weight: 400;
}

.collage-title-count-badge svg {
    display: inline-block;
    vertical-align: middle;
    flex-shrink: 0;
    margin: 0;
    width: 14px;
    height: 14px;
}

/* ─── Responsive Modal Heights ───────────────────────────────────────────────── */

/* Short viewports (e.g. 768×600 or a browser window that's been resized down) */
@media (max-height: 700px) {
    .modal {
        max-height: calc(100dvh - 24px);
        border-radius: 8px;
    }

    .modal-header {
        padding: 8px 14px 6px;
    }

    .modal-body {
        padding: 8px 14px;
    }

    .modal-footer {
        padding: 6px 14px 8px;
    }

    /* Shrink the thumbnail in upload modals so it doesn't eat screen space */
    .modal-thumb {
        max-height: 56px;
    }

    /* Compress file list height */
    .modal-file-list {
        max-height: 72px;
    }
}

/* Very short viewports (landscape phone, tiny window) */
@media (max-height: 480px) {
    .modal {
        max-height: calc(100dvh - 16px);
        border-radius: 6px;
    }

    .modal-header {
        padding: 6px 12px 5px;
    }

    .modal-title {
        font-size: 12px;
    }

    .modal-subtitle {
        font-size: 10px;
    }

    .modal-body {
        padding: 6px 12px;
    }

    .modal-footer {
        padding: 5px 12px 6px;
    }

    .modal-thumb {
        max-height: 40px;
    }

    .modal-file-list {
        max-height: 52px;
    }

    .hdr-type-grid {
        grid-template-columns: 1fr;
    }
}

/* ─── Responsive IMO (Analysis) Panels ───────────────────────────────────────── */

/* On short viewports the metadata panels can overflow the image area */
@media (max-height: 700px) {
    .imo-panel-single {
        max-height: calc(100dvh - 160px);
        font-size: 12px;
    }

    .imo-row {
        font-size: 12px;
    }
}

@media (max-height: 480px) {
    .imo-panel-single {
        max-height: calc(100dvh - 120px);
        font-size: 11.5px;
        padding: 6px 8px;
    }

    .imo-section-title {
        font-size: 10.5px;
    }

    .imo-row {
        font-size: 11.5px;
    }
}