/* Mobile viewer and compact card actions. Desktop layout stays with its owner. */
@media (max-width: 760px) {
    #content .bench-shot-actions,.screenshots-carousel .bench-shot-actions {
        top: 8px !important;right: 8px !important;left: auto !important;
        gap: 3px !important;padding: 3px !important;max-width: calc(100% - 16px);
        box-sizing: border-box;transform: none !important;
        box-shadow: 0 3px 10px #0002 !important;
    }
    #content .bench-shot-actions .bench-shot-btn,.screenshots-carousel .bench-shot-actions .bench-shot-btn {
        font-size: 10px !important;line-height: 1 !important;padding: 7px 8px !important;
        min-height: 28px !important;height: 28px !important;width:auto !important;min-width:0 !important;box-sizing: border-box;white-space: nowrap;
    }
    #content .bench-shot-btn__text,.screenshots-carousel .bench-shot-btn__text {font-size:10px !important;}
    html.bench-mobile-modal-open,html.bench-mobile-modal-open body {background: #151618 !important;overscroll-behavior: none;}
    #lightbox {
        inset: 0 !important;margin: 0 !important;width: 100% !important;
        height: 100vh !important;height: 100dvh !important;max-height: none !important;
        background: rgba(15,16,18,.97) !important;box-sizing: border-box;
        padding: env(safe-area-inset-top,0px) 0 env(safe-area-inset-bottom,0px) !important;
        overflow: hidden !important;
    }
    #lightbox .modal-inner {width:100% !important;height:100% !important;display:flex !important;flex-direction:column-reverse !important;min-height:0;}
    #lightbox #modal-left-sidebar {width:100% !important;flex:0 0 50px !important;height:50px !important;min-height:0;overflow:hidden;}
    #lightbox #tags {height:50px !important;margin:0 !important;padding:0 12px !important;display:flex !important;flex-direction:row !important;align-items:center !important;gap:16px;overflow-x:auto !important;overflow-y:hidden !important;box-sizing:border-box;}
    #lightbox #tags .title-tags,#lightbox #tags .benchmark-modal-filter-summary {display:none !important;}
    #lightbox #tags .item,#lightbox #tags .benchmark-smart-modal-tag {flex:none !important;width:auto !important;min-width:max-content;font-size:13px !important;padding:8px 0 !important;}
    #lightbox .modal-img {width:100% !important;flex:1 1 auto !important;min-height:0;height:auto !important;display:flex;align-items:center;justify-content:center;padding:42px 32px calc(var(--bench-mobile-tools-height,62px) + 38px) !important;box-sizing:border-box;position:relative;overflow:hidden !important;}
    #lightbox img.modal-content {display:block !important;margin:0 !important;width:auto !important;height:auto !important;max-width:100% !important;max-height:calc(100dvh - 130px - var(--bench-mobile-tools-height,62px) - env(safe-area-inset-top,0px) - env(safe-area-inset-bottom,0px)) !important;object-fit:contain;touch-action:pan-y pinch-zoom;}
    #lightbox .close {top:calc(8px + env(safe-area-inset-top,0px)) !important;right:10px !important;width:32px !important;height:32px !important;font-size:32px !important;line-height:32px !important;padding:0 !important;z-index:10020;}
    #lightbox .prev,#lightbox .next {background-size:20px 20px !important;background-repeat:no-repeat !important;background-position:center !important;width:24px !important;height:40px !important;top:45% !important;margin:0 !important;padding:0 !important;z-index:10010;}
    #lightbox .prev {left:4px !important;}#lightbox .next {right:4px !important;}
    #lightbox .prev img,#lightbox .next img,#lightbox .close img {width:100% !important;height:100% !important;object-fit:contain;}
    #lightbox .modal-img-counter {top:8px !important;bottom:auto !important;left:0 !important;height:26px !important;pointer-events:none;}
    #lightbox #image-counter {font-size:11px !important;padding:6px 10px !important;}
    #lightbox .bench-mobile-viewer-tools {position:absolute;bottom:10px;left:12px;right:12px;display:flex;flex-wrap:wrap;align-items:center;justify-content:center;gap:6px;z-index:10015;}
    #lightbox .bench-mobile-viewer-tools .bench-mobile-app-name,
    #lightbox .bench-mobile-viewer-tools .benchmark-modal-app-info,
    #lightbox .bench-mobile-viewer-tools .benchmark-modal-upload-date,
    #lightbox .bench-mobile-viewer-tools .bench-ui-toggle {
        position:static !important;inset:auto !important;transform:none !important;margin:0 !important;
        display:inline-flex;align-items:center;justify-content:center;gap:6px;
        min-height:28px !important;height:28px !important;width:168px !important;max-width:100%;
        padding:5px 9px !important;border:1px solid #ffffff15 !important;border-radius:999px !important;
        background:rgba(35,36,39,.9) !important;color:#f5f5f6 !important;
        font-family:PragmaticaWebMedium,Arial,sans-serif !important;font-size:11px !important;line-height:16px !important;
        box-sizing:border-box;box-shadow:none !important;white-space:nowrap;
    }
    #lightbox .bench-mobile-viewer-tools .benchmark-modal-app-info {order:0;}
    #lightbox .bench-mobile-viewer-tools .benchmark-modal-upload-date {order:2;}
    #lightbox .bench-mobile-viewer-tools .bench-ui-toggle {order:1;}
    #lightbox .bench-mobile-viewer-tools .benchmark-modal-app-info__icon {width:18px !important;height:18px !important;flex:0 0 18px !important;margin:0 !important;}
    #lightbox .bench-mobile-viewer-tools .benchmark-modal-app-info__title {font-size:11px !important;line-height:16px !important;color:inherit !important;max-width:160px;overflow:hidden;text-overflow:ellipsis;}
    #lightbox .bench-mobile-viewer-tools .bench-theme-toggle__track {width:30px !important;height:18px !important;box-shadow:none !important;}
    #lightbox .bench-mobile-viewer-tools .bench-theme-toggle__thumb {width:14px !important;height:14px !important;top:1px !important;left:1px !important;}
    #lightbox .bench-mobile-viewer-tools .bench-ui-toggle[aria-checked=true] .bench-theme-toggle__thumb {transform:translateX(12px) !important;}
    #lightbox .bench-mobile-viewer-tools .bench-ui-toggle__beta {font-size:9px !important;}
}
@media (max-width:380px){#content .bench-shot-actions .bench-shot-btn{font-size:9px !important;padding:6px !important;}}

@media (max-width:760px) {
    .gallery .img-container > .shimmer-effect {position:relative;}
    #lightbox .bench-mobile-app-name__icon {width:18px;height:18px;flex:0 0 18px;object-fit:cover;border-radius:5px;display:block;}
    #lightbox .bench-mobile-app-name__title {min-width:0;overflow:hidden;text-overflow:ellipsis;}
}

/* One consistent information stack beside the desktop screenshot. */
@media (min-width:761px) {
    #lightbox .bench-mobile-viewer-tools {position:absolute;right:24px;bottom:24px;left:auto;z-index:10015;display:flex;flex-direction:column;align-items:stretch;gap:8px;width:max-content;max-width:calc(100% - 48px);}
    #lightbox .bench-mobile-viewer-tools .bench-mobile-app-name,
    #lightbox .bench-mobile-viewer-tools .benchmark-modal-app-info,
    #lightbox .bench-mobile-viewer-tools .benchmark-modal-upload-date,
    #lightbox .bench-mobile-viewer-tools .bench-ui-toggle {
        position:static !important;inset:auto !important;transform:none !important;margin:0 !important;
        display:flex;align-items:center;justify-content:flex-start;gap:8px;
        width:100% !important;height:32px !important;min-height:32px !important;max-width:100%;padding:5px 12px !important;
        box-sizing:border-box;border:1px solid #ffffff15 !important;border-radius:999px !important;
        background:rgba(25,26,29,.82) !important;color:#f5f5f6 !important;
        font-family:PragmaticaWebMedium,Arial,sans-serif !important;font-size:13px !important;line-height:20px !important;
        box-shadow:none !important;white-space:nowrap;
    }
    #lightbox .bench-mobile-viewer-tools .benchmark-modal-app-info,
    #lightbox .bench-mobile-viewer-tools .bench-mobile-app-name {order:0;}
    #lightbox .bench-mobile-viewer-tools .bench-ui-toggle {order:1;}
    #lightbox .bench-mobile-viewer-tools .benchmark-modal-upload-date {order:2;}
    #lightbox .bench-mobile-viewer-tools .benchmark-modal-app-info__icon,
    #lightbox .bench-mobile-app-name__icon {display:block;width:20px !important;height:20px !important;flex:0 0 20px !important;margin:0 !important;object-fit:cover;border-radius:5px;}
    #lightbox .bench-mobile-viewer-tools .benchmark-modal-app-info__body {min-width:0;}
    #lightbox .bench-mobile-viewer-tools .benchmark-modal-app-info__title,
    #lightbox .bench-mobile-app-name__title {font-size:13px !important;line-height:20px !important;color:inherit !important;min-width:0;max-width:196px;overflow:hidden;text-overflow:ellipsis;}
    #lightbox .bench-mobile-viewer-tools .bench-theme-toggle__track {width:34px !important;height:20px !important;box-shadow:none !important;}
    #lightbox .bench-mobile-viewer-tools .bench-theme-toggle__thumb {width:16px !important;height:16px !important;top:1px !important;left:1px !important;}
    #lightbox .bench-mobile-viewer-tools .bench-ui-toggle[aria-checked=true] .bench-theme-toggle__thumb {transform:translateX(14px) !important;}
}

@media (min-width:761px) {
    #lightbox .bench-mobile-viewer-tools .benchmark-modal-app-info,
    #lightbox .bench-mobile-viewer-tools .bench-mobile-app-name {
        background:none !important;border-color:transparent !important;border-radius:0 !important;
        backdrop-filter:none !important;-webkit-backdrop-filter:none !important;box-shadow:none !important;
    }
    #lightbox .bench-mobile-viewer-tools .benchmark-modal-app-info__icon,
    #lightbox .bench-mobile-viewer-tools .benchmark-modal-app-info__icon img,
    #lightbox .bench-mobile-app-name__icon {border-radius:50% !important;overflow:hidden;}
    #lightbox .bench-mobile-viewer-tools .benchmark-modal-app-info__body,
    #lightbox .bench-mobile-viewer-tools .benchmark-modal-app-info__title,
    #lightbox .bench-mobile-app-name__title {text-align:left !important;}
}

/* Explicit border-box switch geometry: equal inset at both ends and vertically. */
#lightbox .bench-mobile-viewer-tools .bench-theme-toggle__track {box-sizing:border-box !important;border:0 !important;padding:0 !important;}
#lightbox .bench-mobile-viewer-tools .bench-theme-toggle__thumb {box-sizing:border-box !important;top:2px !important;left:2px !important;margin:0 !important;}
#lightbox .bench-mobile-viewer-tools .bench-ui-toggle[aria-checked=false] .bench-theme-toggle__thumb {transform:translateX(0) !important;}
@media (min-width:761px) {
    #lightbox .bench-mobile-viewer-tools .bench-ui-toggle {justify-content:space-between;}
}
