* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #000;
    color: white;
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    touch-action: manipulation;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

body.modal-open {
    overflow: hidden;
}

.slideshow-container {
    flex-grow: 1;
    position: relative;
    overflow: hidden;
    background: #000;
}

.slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity var(--fade-duration, 1.5s) ease-in-out;
    display: flex;
    justify-content: center;
    align-items: center;
}

.slide.active {
    opacity: 1;
}

.slide img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
    -webkit-touch-callout: none;
    -webkit-user-drag: none;
    user-select: none;
}

.slide.loading img {
    opacity: 0;
}

.slide:not(.loading) img {
    opacity: 1;
}

.slide img:focus {
    outline: 2px solid #4a90e2;
    outline-offset: 2px;
}

.slide img.zoom {
    transform: scale(1.05);
}

.slide img.double-zoom {
    transform: scale(1.1);
}

.slide.loading {
    background: #1a1a1a;
    display: flex;
    justify-content: center;
    align-items: center;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid #4a90e2;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.controls {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(10, 10, 10, 0.95);
    padding: 10px 12px;
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    z-index: 100;
    transition: all 0.3s ease;
    backdrop-filter: blur(20px);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.5);
    min-height: auto;
    box-sizing: border-box;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.2) rgba(0, 0, 0, 0.1);
}

.controls::-webkit-scrollbar {
    height: 4px;
}

.controls::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 2px;
}

.controls::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
}

.controls:hover {
    background: rgba(15, 15, 15, 0.95);
}

.control-group {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 8px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    flex-shrink: 0;
    min-width: fit-content;
}

label {
    font-size: 0.75rem;
    white-space: nowrap;
    color: rgba(255, 255, 255, 0.8);
    font-weight: 500;
}

input[type="number"] {
    width: 45px;
    padding: 6px;
    border: none;
    border-radius: 5px;
    text-align: center;
    font-size: 0.8rem;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.15);
    transition: all 0.2s ease;
}

input[type="number"]:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
    box-shadow: 0 0 0 2px rgba(74, 144, 226, 0.3);
}

button {
    padding: 8px 12px;
    border: none;
    border-radius: 6px;
    background: linear-gradient(135deg, #4a90e2, #357ae8);
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.8rem;
    white-space: nowrap;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(74, 144, 226, 0.3);
    min-height: 36px;
    min-width: 36px;
    -webkit-tap-highlight-color: transparent;
    flex-shrink: 0;
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(74, 144, 226, 0.4);
}

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

button:disabled {
    background: linear-gradient(135deg, #666, #555);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
    opacity: 0.6;
}

button::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

button:hover::after {
    left: 100%;
}

#pauseBtn {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    box-shadow: 0 4px 15px rgba(231, 76, 60, 0.3);
}

#pauseBtn:hover:not(:disabled) {
    box-shadow: 0 6px 20px rgba(231, 76, 60, 0.4);
}

#fullscreenBtn {
    background: linear-gradient(135deg, #27ae60, #219653);
    box-shadow: 0 4px 15px rgba(39, 174, 96, 0.3);
}

#fullscreenBtn:hover {
    box-shadow: 0 6px 20px rgba(39, 174, 96, 0.4);
}

#zoomInBtn, #zoomOutBtn {
    background: linear-gradient(135deg, #3498db, #2980b9);
    box-shadow: 0 4px 15px rgba(52, 152, 219, 0.3);
}

#zoomInBtn:hover, #zoomOutBtn:hover {
    box-shadow: 0 6px 20px rgba(52, 152, 219, 0.4);
}

.loading-bar-indicator {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 6px;
    background: rgba(0, 0, 0, 0.9);
    z-index: 1001;
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    pointer-events: none;
    overflow: hidden;
}

.loading-bar-indicator.visible {
    opacity: 1;
    transform: translateY(0);
}

.loading-bar-container {
    position: relative;
    width: 100%;
    height: 100%;
}

.loading-bar-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg,
        rgba(255, 255, 255, 0.05) 0%,
        rgba(255, 255, 255, 0.1) 50%,
        rgba(255, 255, 255, 0.05) 100%);
}

.loading-bar-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg,
        #4a90e2 0%,
        #5fa3ff 25%,
        #4ecdc4 50%,
        #06d6a0 75%,
        #2ecc71 100%);
    background-size: 200% 100%;
    animation: loading-bar-gradient 3s ease infinite;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 0 2px 2px 0;
    box-shadow: 0 0 10px rgba(74, 144, 226, 0.3);
}

.loading-bar-text {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    text-align: center;
    padding: 8px 0;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.8);
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    pointer-events: none;
}

.loading-bar-indicator.visible:hover .loading-bar-text {
    opacity: 1;
    transform: translateY(0);
}

.loading-bar-percentage {
    font-weight: 700;
    color: #4a90e2;
}

.loading-bar-label {
    color: rgba(255, 255, 255, 0.6);
}

@keyframes loading-bar-gradient {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

@keyframes loading-bar-complete {
    0% {
        background: linear-gradient(90deg, #4a90e2, #2ecc71);
        box-shadow: 0 0 10px rgba(74, 144, 226, 0.3);
    }
    50% {
        background: linear-gradient(90deg, #2ecc71, #4a90e2);
        box-shadow: 0 0 15px rgba(46, 204, 113, 0.5);
    }
    100% {
        background: linear-gradient(90deg, #4a90e2, #2ecc71);
        box-shadow: 0 0 10px rgba(74, 144, 226, 0.3);
    }
}

.loading-bar-indicator.loading-complete .loading-bar-fill {
    animation: loading-bar-complete 2s ease infinite;
}

@keyframes loading-bar-fade-out {
    0% { opacity: 1; transform: translateY(0); }
    100% { opacity: 0; transform: translateY(-10px); }
}

.loading-bar-indicator.loading-complete {
    animation: loading-bar-fade-out 0.5s ease-out 1.5s forwards;
}

.loading-progress-indicator {
    display: none;
}

.error-message {
    text-align: center;
    padding: 20px;
    background: rgba(255, 0, 0, 0.1);
    border: 1px solid rgba(255, 0, 0, 0.3);
    border-radius: 8px;
    max-width: 90%;
    margin: 0 auto;
}

.error-message h3 {
    color: #e74c3c;
    margin-bottom: 10px;
}

.info-overlay {
    position: fixed;
    top: 10px;
    left: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.9);
    padding: 10px 15px;
    border-radius: 8px;
    font-size: 0.8rem;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    z-index: 95;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    text-align: center;
    max-width: 80%;
    margin: 0 auto;
    transition: all 0.3s ease;
}

.info-overlay.visible {
    opacity: 1;
}

.controls.hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateY(20px);
}

body.fullscreen .controls {
    padding: 8px 10px;
}

.hamburger-menu {
    display: none;
    position: relative;
    z-index: 101;
}

.hamburger-icon {
    width: 30px;
    height: 25px;
    position: relative;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    padding: 8px;
    background: linear-gradient(135deg, #6C63FF, #554FD8);
    border-radius: 6px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(108, 99, 255, 0.3);
}

.hamburger-icon span {
    display: block;
    height: 3px;
    width: 100%;
    background: white;
    border-radius: 3px;
    transition: all 0.3s ease;
}

.hamburger-icon:hover {
    background: linear-gradient(135deg, #7B73FF, #655FD8);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(108, 99, 255, 0.4);
}

.hamburger-icon.active {
    background: linear-gradient(135deg, #8A4FFF, #6A37D6);
}

.hamburger-icon.active span:nth-child(1) {
    transform: rotate(45deg) translate(6px, 6px);
}

.hamburger-icon.active span:nth-child(2) {
    opacity: 0;
}

.hamburger-icon.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -7px);
}

.mobile-controls-panel {
    display: none;
    position: fixed;
    bottom: 80px;
    left: 10px;
    right: 10px;
    background: rgba(10, 10, 10, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 12px;
    padding: 20px;
    flex-direction: column;
    gap: 15px;
    z-index: 99;
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s ease;
}

.mobile-controls-panel.active {
    display: flex;
    opacity: 1;
    transform: translateY(0);
}

.mobile-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    width: 100%;
}

.mobile-control-group {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 10px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.mobile-control-group label {
    font-size: 0.9rem;
}

.jump-input-group {
    display: flex;
    gap: 8px;
    width: 100%;
}

.jump-input-group input[type="number"] {
    flex: 1;
    width: 60px;
    padding: 10px;
    border: none;
    border-radius: 8px;
    text-align: center;
    font-size: 1rem;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.15);
    -webkit-appearance: none;
    -moz-appearance: textfield;
    height: 44px;
}

.jump-input-group button {
    flex-shrink: 0;
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    background: linear-gradient(135deg, #4a90e2, #357ae8);
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    white-space: nowrap;
    min-height: 44px;
    min-width: 60px;
    box-shadow: 0 4px 15px rgba(74, 144, 226, 0.3);
}

.jump-input-group button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(74, 144, 226, 0.4);
}

.jump-input-group button:active {
    transform: translateY(0);
}

.mobile-control-group input[type="number"] {
    width: 80px;
    padding: 8px;
    font-size: 1rem;
    height: 44px;
    -webkit-appearance: none;
    -moz-appearance: textfield;
}

.mobile-buttons {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
}

.mobile-buttons button {
    flex: 1;
}

.initial-loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    gap: 20px;
}

.initial-loading .loading-spinner {
    width: 60px;
    height: 60px;
    border-width: 6px;
}

.loading-text {
    color: white;
    font-size: 1.1rem;
    text-align: center;
}

.zoom-level {
    position: fixed;
    top: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 8px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
    z-index: 95;
    backdrop-filter: blur(10px);
}

.zoom-level.visible {
    opacity: 1;
}

.slide-counter {
    position: fixed;
    top: 20px;
    left: 20px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 8px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    z-index: 95;
    backdrop-filter: blur(10px);
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.1);
    min-width: 60px;
    max-width: 120px;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.slide-counter:hover {
    background: rgba(0, 0, 0, 0.8);
    border-color: rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
}

.slide-counter:active {
    background: rgba(74, 144, 226, 0.3);
    transition: background 0.2s;
}

.slide-counter.editing {
    background: rgba(0, 0, 0, 0.9);
    border-color: #4a90e2;
    box-shadow: 0 0 0 2px rgba(74, 144, 226, 0.3);
}

.jump-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(5px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.jump-modal.active {
    display: flex;
    opacity: 1;
    visibility: visible;
}

.jump-modal-content {
    background: rgba(20, 20, 20, 0.95);
    padding: 25px;
    border-radius: 12px;
    width: 90%;
    max-width: 400px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(20px);
    z-index: 1001;
    position: relative;
    transform: scale(0.95);
    transition: transform 0.3s ease;
}

.jump-modal.active .jump-modal-content {
    transform: scale(1);
}

.jump-modal h3 {
    margin-bottom: 15px;
    color: white;
    font-size: 1.2rem;
    text-align: center;
}

.jump-modal-input-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}

.jump-modal-input-group label {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.8);
}

.jump-modal-input-group input {
    padding: 12px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 1.1rem;
    text-align: center;
    width: 100%;
}

.jump-modal-input-group input:focus {
    outline: none;
    border-color: #4a90e2;
    box-shadow: 0 0 0 2px rgba(74, 144, 226, 0.3);
}

.jump-modal-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.jump-modal-buttons button {
    flex: 1;
    padding: 12px;
}

#jumpModalCancel {
    background: linear-gradient(135deg, #666, #555);
}

#jumpModalCancel:hover {
    background: linear-gradient(135deg, #777, #666);
}

.cache-indicator {
    position: fixed;
    bottom: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 4px 8px;
    border-radius: 10px;
    font-size: 0.7rem;
    z-index: 90;
    display: none;
}

@media (hover: none) {
    .slide img {
        cursor: grab;
    }
    .slide img:active {
        cursor: grabbing;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .controls {
        padding: 8px 10px;
        gap: 6px;
        justify-content: center;
        align-items: center;
    }

    .mobile-only {
        display: none;
    }

    .desktop-only {
        display: flex;
        flex-direction: row;
        align-items: center;
        justify-content: center;
        width: 100%;
        gap: 6px;
        flex-wrap: nowrap;
    }

    .row-1 {
        display: flex;
        flex-direction: row;
        align-items: center;
        gap: 6px;
        margin: 0;
        padding: 0;
        flex: 1;
        justify-content: flex-start;
    }

    .row-2 {
        display: flex;
        flex-direction: row;
        align-items: center;
        gap: 6px;
        margin: 0;
        padding: 0;
        flex: 1;
        justify-content: flex-end;
    }

    button {
        padding: 6px 8px;
        font-size: 0.75rem;
        min-height: 32px;
        min-width: 32px;
        border-radius: 5px;
    }

    #prevBtn {
        min-width: 80px;
        order: 1;
    }

    #startBtn {
        min-width: 60px;
        order: 2;
    }

    #pauseBtn {
        min-width: 60px;
        order: 3;
    }

    #nextBtn {
        min-width: 80px;
        order: 4;
    }

    #fullscreenBtn {
        min-width: 100px;
        order: 5;
        margin-left: 4px;
    }

    #zoomOutBtn {
        min-width: 60px;
        order: 6;
    }

    #zoomInBtn {
        min-width: 60px;
        order: 9;
    }

    .control-group {
        padding: 4px 6px;
        gap: 4px;
        background: rgba(255, 255, 255, 0.08);
        border: 1px solid rgba(255, 255, 255, 0.12);
        border-radius: 5px;
        min-width: 110px;
        order: 7;
    }

    .control-group:nth-of-type(2) {
        order: 8;
    }

    .control-group label {
        font-size: 0.7rem;
        color: rgba(255, 255, 255, 0.9);
    }

    input[type="number"] {
        width: 40px;
        padding: 5px 8px;
        font-size: 0.75rem;
        background: rgba(255, 255, 255, 0.12);
        border: 1px solid rgba(255, 255, 255, 0.2);
        border-radius: 4px;
        min-height: 32px;
        -webkit-appearance: none;
        -moz-appearance: textfield;
        padding-right: 12px;
    }

    input[type="number"]::-webkit-inner-spin-button,
    input[type="number"]::-webkit-outer-spin-button {
        -webkit-appearance: none;
        margin: 0;
    }

    .loading-bar-indicator {
        height: 6px;
    }

    .info-overlay {
        max-width: 85%;
        left: 7.5%;
        right: 7.5%;
        font-size: 0.85rem;
        padding: 12px 16px;
        background: rgba(0, 0, 0, 0.85);
        backdrop-filter: blur(15px);
        border: 1px solid rgba(255, 255, 255, 0.15);
        border-radius: 10px;
        top: 15px;
    }

    .slide-counter {
        top: 15px;
        left: 15px;
        padding: 6px 10px;
        font-size: 0.75rem;
        background: rgba(0, 0, 0, 0.85);
        backdrop-filter: blur(15px);
        border: 1px solid rgba(255, 255, 255, 0.15);
        border-radius: 16px;
        min-width: 60px;
        max-width: 90px;
    }

    .zoom-level {
        top: 15px;
        right: 15px;
        padding: 6px 10px;
        font-size: 0.75rem;
        background: rgba(0, 0, 0, 0.85);
        backdrop-filter: blur(15px);
        border: 1px solid rgba(255, 255, 255, 0.15);
        border-radius: 16px;
    }

    .hamburger-menu {
        display: none;
    }

    .mobile-controls-panel {
        display: none;
    }

    .jump-modal-content {
        width: 95%;
        max-width: 95%;
        padding: 20px 15px;
    }

    .jump-modal-input-group input {
        font-size: 1rem;
        padding: 10px;
    }

    .jump-modal-buttons button {
        padding: 10px;
        font-size: 0.9rem;
    }

    @media (min-width: 769px) and (max-width: 850px) {
        .controls {
            padding: 6px 8px;
            gap: 4px;
        }

        .desktop-only {
            gap: 4px;
        }

        button {
            padding: 5px 7px;
            font-size: 0.7rem;
            min-height: 30px;
            min-width: 30px;
        }

        #prevBtn, #nextBtn {
            min-width: 70px;
        }

        #startBtn, #pauseBtn {
            min-width: 55px;
        }

        #fullscreenBtn {
            min-width: 90px;
        }

        #zoomInBtn, #zoomOutBtn {
            min-width: 55px;
        }

        .control-group {
            min-width: 100px;
            padding: 3px 5px;
        }

        input[type="number"] {
            width: 35px;
            padding: 4px 6px;
            padding-right: 10px;
            font-size: 0.7rem;
        }
    }

    @media (min-width: 851px) and (max-width: 950px) {
        .controls {
            gap: 6px;
        }

        .desktop-only {
            gap: 6px;
        }

        button {
            padding: 6px 8px;
        }

        .control-group {
            min-width: 115px;
        }

        input[type="number"] {
            width: 42px;
            padding: 6px 8px;
            padding-right: 12px;
        }
    }

    @media (min-width: 951px) and (max-width: 1024px) {
        .controls {
            padding: 8px 12px;
            gap: 8px;
        }

        .desktop-only {
            gap: 8px;
        }

        button {
            padding: 7px 10px;
            font-size: 0.8rem;
            min-height: 34px;
        }

        #prevBtn, #nextBtn {
            min-width: 85px;
        }

        #startBtn, #pauseBtn {
            min-width: 65px;
        }

        #fullscreenBtn {
            min-width: 110px;
        }

        .control-group {
            min-width: 120px;
        }

        input[type="number"] {
            width: 45px;
            padding: 6px 8px;
            padding-right: 12px;
        }
    }

    @supports (padding: max(0px)) {
        .controls {
            padding-left: max(10px, env(safe-area-inset-left));
            padding-right: max(10px, env(safe-area-inset-right));
            padding-bottom: max(8px, env(safe-area-inset-bottom));
        }

        .slide-counter {
            left: max(15px, env(safe-area-inset-left));
        }

        .zoom-level {
            right: max(15px, env(safe-area-inset-right));
        }
    }
}

@media (min-width: 1025px) {
    .controls {
        padding: 10px 15px;
        gap: 8px;
        justify-content: space-between;
        align-items: center;
    }

    .mobile-only {
        display: none;
    }

    .desktop-only {
        display: flex;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        width: 100%;
        gap: 8px;
        flex-wrap: nowrap;
    }

    .row-1 {
        display: flex;
        flex-direction: row;
        align-items: center;
        gap: 8px;
        margin: 0;
        padding: 0;
        flex: 1;
        justify-content: flex-start;
    }

    .row-2 {
        display: flex;
        flex-direction: row;
        align-items: center;
        gap: 8px;
        margin: 0;
        padding: 0;
        flex: 1;
        justify-content: flex-end;
    }

    button {
        padding: 8px 12px;
        font-size: 0.85rem;
        min-height: 38px;
        min-width: 38px;
        border-radius: 6px;
    }

    #prevBtn {
        min-width: 90px;
        order: 1;
    }

    #startBtn {
        min-width: 70px;
        order: 2;
    }

    #pauseBtn {
        min-width: 70px;
        order: 3;
    }

    #nextBtn {
        min-width: 90px;
        order: 4;
    }

    #fullscreenBtn {
        min-width: 120px;
        order: 5;
        margin-left: 8px;
    }

    #zoomOutBtn {
        min-width: 70px;
        order: 6;
    }

    #zoomInBtn {
        min-width: 70px;
        order: 9;
    }

    .control-group {
        padding: 6px 8px;
        gap: 6px;
        min-width: 125px;
        order: 7;
    }

    .control-group:nth-of-type(2) {
        order: 8;
    }

    .control-group label {
        font-size: 0.8rem;
    }

    input[type="number"] {
        width: 50px;
        padding: 7px 10px;
        font-size: 0.85rem;
        min-height: 38px;
        -webkit-appearance: none;
        -moz-appearance: textfield;
        padding-right: 14px;
    }

    input[type="number"]::-webkit-inner-spin-button,
    input[type="number"]::-webkit-outer-spin-button {
        -webkit-appearance: none;
        margin: 0;
    }

    .info-overlay {
        max-width: 80%;
        left: 10%;
        right: 10%;
        font-size: 0.85rem;
        padding: 12px 20px;
    }

    @media (min-width: 1025px) and (max-width: 1199px) {
        .controls {
            padding: 8px 12px;
            gap: 6px;
        }

        .desktop-only {
            gap: 6px;
        }

        .row-1, .row-2 {
            gap: 6px;
        }

        button {
            padding: 7px 10px;
            font-size: 0.8rem;
            min-height: 36px;
            min-width: 36px;
        }

        #prevBtn, #nextBtn {
            min-width: 85px;
        }

        #startBtn, #pauseBtn {
            min-width: 65px;
        }

        #fullscreenBtn {
            min-width: 110px;
        }

        .control-group {
            min-width: 120px;
            padding: 5px 7px;
        }

        input[type="number"] {
            width: 45px;
            padding: 6px 8px;
            padding-right: 12px;
            font-size: 0.8rem;
        }
    }

    @media (min-width: 1200px) {
        .controls {
            padding: 12px 20px;
            gap: 10px;
        }

        .desktop-only {
            gap: 10px;
        }

        .row-1, .row-2 {
            gap: 10px;
        }

        button {
            padding: 10px 14px;
            font-size: 0.9rem;
            min-height: 40px;
            min-width: 40px;
        }

        #prevBtn, #nextBtn {
            min-width: 100px;
        }

        #startBtn, #pauseBtn {
            min-width: 80px;
        }

        #fullscreenBtn {
            min-width: 130px;
        }

        #zoomInBtn, #zoomOutBtn {
            min-width: 80px;
        }

        .control-group {
            min-width: 135px;
            padding: 8px 10px;
        }

        .control-group label {
            font-size: 0.85rem;
        }

        input[type="number"] {
            width: 65px;
            padding: 8px 12px;
            padding-right: 16px;
            font-size: 0.9rem;
        }

        .info-overlay {
            max-width: 70%;
            left: 15%;
            right: 15%;
            font-size: 0.9rem;
        }
    }

    @media (min-width: 1440px) {
        .controls {
            padding: 14px 24px;
            gap: 12px;
        }

        .desktop-only {
            gap: 12px;
        }

        button {
            padding: 11px 16px;
            font-size: 0.95rem;
            min-height: 42px;
        }

        #prevBtn, #nextBtn {
            min-width: 110px;
        }

        #startBtn, #pauseBtn {
            min-width: 90px;
        }

        #fullscreenBtn {
            min-width: 140px;
        }

        .control-group {
            min-width: 145px;
            padding: 9px 12px;
        }

        input[type="number"] {
            width: 60px;
            padding: 9px 14px;
            padding-right: 18px;
        }

        .info-overlay {
            max-width: 65%;
            left: 17.5%;
            right: 17.5%;
            font-size: 0.95rem;
        }
    }
}

@media (max-width: 768px) {
    .controls {
        padding: 10px;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        gap: 5px;
        background: rgba(15, 15, 15, 0.98);
        border-top: 1px solid rgba(255, 255, 255, 0.1);
        box-shadow: 0 -5px 25px rgba(0, 0, 0, 0.6);
    }

    .desktop-only {
        display: none;
    }

    .mobile-only {
        display: flex;
        width: 100%;
    }

    .hamburger-menu {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .row-1, .row-2 {
        display: none;
    }

    .loading-bar-indicator {
        height: 4px;
    }

    .loading-bar-text {
        display: none;
    }

    .mobile-controls {
        display: flex;
        gap: 6px;
        flex: 1;
        justify-content: space-between;
        position: relative;
        z-index: 102;
        padding: 0 5px;
    }

    .mobile-controls button {
        flex: 1;
        padding: 12px 10px;
        font-size: 0.9rem;
        min-height: 44px;
        min-width: 44px;
        position: relative;
        z-index: 103;
        touch-action: manipulation;
        -webkit-tap-highlight-color: rgba(0,0,0,0);
        transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
        border: 1px solid rgba(255, 255, 255, 0.1) !important;
        overflow: hidden;
        user-select: none;
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
    }

    .mobile-controls button:not(:last-child) {
        border-right: 1px solid rgba(255, 255, 255, 0.05);
    }

    .mobile-controls button::before {
        content: '';
        position: absolute;
        top: 50%;
        left: 50%;
        width: 0;
        height: 0;
        border-radius: 50%;
        background: rgba(255, 255, 255, 0.3);
        transform: translate(-50%, -50%);
        transition: width 0.3s, height 0.3s;
        pointer-events: none;
    }

    .mobile-controls button:active::before {
        width: 200px;
        height: 200px;
    }

    .mobile-controls button:active {
        transform: scale(0.95) !important;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3) !important;
        opacity: 0.9;
    }

    #mobilePrevBtn {
        background: linear-gradient(135deg, #4A6FA5, #2E5073);
        box-shadow: 0 4px 15px rgba(74, 111, 165, 0.4);
        border: 1px solid rgba(255, 255, 255, 0.1) !important;
    }

    #mobileNextBtn {
        background: linear-gradient(135deg, #5D8A66, #3D6B47);
        box-shadow: 0 4px 15px rgba(93, 138, 102, 0.4);
        border: 1px solid rgba(255, 255, 255, 0.1) !important;
    }

    #mobileStartBtn {
        background: linear-gradient(135deg, #00A896, #00867D);
        box-shadow: 0 4px 15px rgba(0, 168, 150, 0.4);
        border: 1px solid rgba(255, 255, 255, 0.1) !important;
        animation: pulse-glow-turquoise 2s infinite;
    }

    #mobilePauseBtn {
        background: linear-gradient(135deg, #E54B4B, #C53030);
        box-shadow: 0 4px 15px rgba(229, 75, 75, 0.4);
        border: 1px solid rgba(255, 255, 255, 0.1) !important;
        animation: pulse-glow-red 2s infinite;
    }

    #mobilePrevBtn, #mobileNextBtn {
        flex: 1.5;
        min-width: 60px;
        font-size: 1.4rem;
        font-weight: bold;
    }

    #mobileStartBtn, #mobilePauseBtn {
        flex: 2;
        min-width: 70px;
        font-size: 1.1rem;
    }

    @keyframes pulse-glow-turquoise {
        0%, 100% {
            box-shadow: 0 4px 15px rgba(0, 168, 150, 0.4);
        }
        50% {
            box-shadow: 0 4px 20px rgba(0, 168, 150, 0.7);
        }
    }

    @keyframes pulse-glow-red {
        0%, 100% {
            box-shadow: 0 4px 15px rgba(229, 75, 75, 0.4);
        }
        50% {
            box-shadow: 0 4px 20px rgba(229, 75, 75, 0.7);
        }
    }

    .hamburger-menu {
        flex: 0 0 auto;
        z-index: 104;
    }

    .hamburger-icon {
        z-index: 105;
        position: relative;
    }

    .zoom-level {
        display: none;
    }

    .slide-counter {
        top: 10px;
        left: 10px;
        padding: 6px 10px;
        font-size: 0.75rem;
        z-index: 100;
        cursor: pointer;
        min-width: 50px;
        max-width: 80px;
        background: rgba(0, 0, 0, 0.85);
        backdrop-filter: blur(15px);
        border: 1px solid rgba(255, 255, 255, 0.15);
        border-radius: 16px;
    }

    .mobile-controls-panel {
        bottom: 70px;
        z-index: 99;
        background: rgba(15, 15, 15, 0.98);
        border: 1px solid rgba(255, 255, 255, 0.1);
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.7);
    }

    #mobileFullscreenBtn {
        background: linear-gradient(135deg, #8A4FFF, #6A37D6);
        box-shadow: 0 4px 15px rgba(138, 79, 255, 0.4);
        border: 1px solid rgba(255, 255, 255, 0.1) !important;
    }

    #mobileZoomInBtn {
        background: linear-gradient(135deg, #3AAFA9, #2B7A78);
        box-shadow: 0 4px 15px rgba(58, 175, 169, 0.4);
        border: 1px solid rgba(255, 255, 255, 0.1) !important;
    }

    #mobileZoomOutBtn {
        background: linear-gradient(135deg, #FF7E5F, #F15A4A);
        box-shadow: 0 4px 15px rgba(255, 126, 95, 0.4);
        border: 1px solid rgba(255, 255, 255, 0.1) !important;
    }

    #mobileGoToStartBtn {
        background: linear-gradient(135deg, #4ECDC4, #3DAFA9);
        box-shadow: 0 4px 15px rgba(78, 205, 196, 0.4);
        border: 1px solid rgba(255, 255, 255, 0.1) !important;
    }

    #mobileGoToEndBtn {
        background: linear-gradient(135deg, #FF6B6B, #EE5A52);
        box-shadow: 0 4px 15px rgba(255, 107, 107, 0.4);
        border: 1px solid rgba(255, 255, 255, 0.1) !important;
    }

    #mobileResetZoomBtn {
        background: linear-gradient(135deg, #95A5A6, #7F8C8D);
        box-shadow: 0 4px 15px rgba(149, 165, 166, 0.4);
        border: 1px solid rgba(255, 255, 255, 0.1) !important;
    }

    #mobileJumpGoBtn {
        background: linear-gradient(135deg, #06D6A0, #05B384);
        box-shadow: 0 4px 15px rgba(6, 214, 160, 0.4);
        border: 1px solid rgba(255, 255, 255, 0.1) !important;
    }

    .mobile-controls-panel button:hover {
        transform: translateY(-2px) !important;
        box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4) !important;
    }

    .mobile-controls-panel button:active {
        transform: translateY(0) scale(0.98) !important;
    }

    .mobile-controls button,
    .mobile-controls-panel button {
        color: #FFFFFF !important;
        text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
        font-weight: 600;
    }

    .mobile-controls button:disabled,
    .mobile-controls-panel button:disabled {
        opacity: 0.5 !important;
        pointer-events: none !important;
        filter: grayscale(0.5);
    }

    .mobile-controls button.active {
        box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.5) !important;
        transform: translateY(-2px);
    }

    .mobile-controls button {
        touch-action: manipulation;
    }

    #mobilePrevBtn, #mobileNextBtn, #mobileStartBtn, #mobilePauseBtn {
        -webkit-touch-callout: none;
        -webkit-user-select: none;
        user-select: none;
    }

    .mobile-control-group {
        padding: 15px 12px;
    }

    .mobile-control-group input[type="number"] {
        width: 80px;
        padding: 8px;
        font-size: 1.1rem;
        height: 50px;
    }

    .jump-input-group input[type="number"] {
        width: 100%;
        height: 50px;
        padding: 12px;
        font-size: 1.1rem;
    }

    .jump-input-group button {
        padding: 12px 20px;
        min-height: 50px;
        font-size: 1rem;
    }

    .mobile-control-group input[type="number"]:focus {
        background: rgba(255, 255, 255, 0.2);
        border-color: #4a90e2;
        box-shadow: 0 0 0 2px rgba(74, 144, 226, 0.3);
        outline: none;
    }

    .mobile-control-group input[type="number"] {
        font-size: 1.1rem;
        font-weight: 500;
        color: white;
    }

    .mobile-control-group label {
        font-size: 0.95rem;
        font-weight: 500;
        color: rgba(255, 255, 255, 0.9);
    }

    input[type="number"]::-webkit-inner-spin-button,
    input[type="number"]::-webkit-outer-spin-button {
        -webkit-appearance: none;
        margin: 0;
    }

    .info-overlay {
        display: none;
    }

    .jump-modal-content {
        width: 95%;
        max-width: 95%;
        padding: 20px 15px;
    }

    .jump-modal-input-group input {
        font-size: 1rem;
        padding: 10px;
    }

    .jump-modal-buttons button {
        padding: 10px;
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    .controls {
        padding: 8px 5px;
    }

    .mobile-controls button {
        padding: 10px 8px;
        font-size: 0.85rem;
        min-height: 40px;
        min-width: 40px;
    }

    #mobilePrevBtn, #mobileNextBtn {
        font-size: 1.3rem;
        min-width: 55px;
    }

    #mobileStartBtn, #mobilePauseBtn {
        font-size: 1rem;
        min-width: 65px;
    }

    .mobile-controls-panel {
        padding: 15px;
        gap: 12px;
        bottom: 65px;
    }

    .mobile-buttons {
        flex-direction: column;
        gap: 8px;
    }

    .mobile-buttons button {
        width: 100%;
    }

    .mobile-control-group input[type="number"] {
        width: 70px;
        padding: 10px;
        height: 44px;
    }

    .jump-input-group input[type="number"] {
        height: 44px;
        padding: 10px;
        font-size: 1rem;
    }

    .jump-input-group button {
        padding: 10px 16px;
        min-height: 44px;
        font-size: 0.9rem;
    }

    .slide-counter {
        top: 8px;
        left: 8px;
        padding: 5px 8px;
        font-size: 0.7rem;
        min-width: 45px;
        max-width: 70px;
    }
}

@media (max-height: 500px) and (orientation: landscape) {
    .controls {
        padding: 8px 5px;
        gap: 5px;
    }

    .mobile-controls button {
        padding: 6px 8px;
        font-size: 0.65rem;
        min-height: 32px;
        min-width: 32px;
    }

    #mobilePrevBtn, #mobileNextBtn {
        font-size: 1.1rem;
    }

    #mobileStartBtn, #mobilePauseBtn {
        font-size: 0.9rem;
    }

    .mobile-controls-panel {
        max-height: 80vh;
        overflow-y: auto;
        bottom: 60px;
        padding: 15px;
        left: 5px;
        right: 5px;
    }

    .slide-counter {
        top: 5px;
        left: 5px;
        padding: 4px 6px;
        font-size: 0.65rem;
    }

    .loading-bar-indicator {
        height: 3px;
    }

    .mobile-control-group {
        padding: 10px;
        flex-wrap: wrap;
    }

    .mobile-control-group label {
        font-size: 0.75rem;
        flex: 0 0 50%;
        margin-bottom: 5px;
    }

    .mobile-control-group input[type="number"] {
        height: 36px;
        padding: 8px;
        font-size: 0.9rem;
        flex: 0 0 45%;
    }

    .jump-input-group {
        flex-wrap: wrap;
        gap: 5px;
    }

    .jump-input-group input[type="number"] {
        height: 36px;
        padding: 8px;
        font-size: 0.9rem;
        flex: 1;
    }

    .jump-input-group button {
        padding: 8px 12px;
        min-height: 36px;
        font-size: 0.8rem;
        flex: 1;
    }

    .mobile-row {
        flex-wrap: wrap;
        gap: 8px;
    }

    .mobile-row button {
        padding: 8px 10px;
        font-size: 0.8rem;
        min-height: 36px;
        flex: 1;
    }

    .mobile-buttons {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 5px;
    }

    .mobile-buttons button {
        padding: 8px;
        font-size: 0.75rem;
        min-height: 36px;
        flex: 1;
        min-width: calc(33.333% - 10px);
    }

    .mobile-controls-panel::-webkit-scrollbar {
        width: 6px;
    }

    .mobile-controls-panel::-webkit-scrollbar-track {
        background: rgba(255, 255, 255, 0.05);
        border-radius: 3px;
    }

    .mobile-controls-panel::-webkit-scrollbar-thumb {
        background: rgba(255, 255, 255, 0.2);
        border-radius: 3px;
    }

    .mobile-controls-panel::-webkit-scrollbar-thumb:hover {
        background: rgba(255, 255, 255, 0.3);
    }
}

@media (max-height: 400px) and (orientation: landscape) {
    .mobile-controls-panel {
        max-height: 70vh;
        bottom: 50px;
        padding: 10px;
    }

    .mobile-control-group {
        padding: 8px;
    }

    .mobile-control-group label {
        font-size: 0.7rem;
    }

    .mobile-control-group input[type="number"] {
        height: 32px;
        padding: 6px;
        font-size: 0.85rem;
    }

    .mobile-row button {
        padding: 6px 8px;
        font-size: 0.75rem;
        min-height: 32px;
    }

    .mobile-buttons button {
        padding: 6px;
        font-size: 0.7rem;
        min-height: 32px;
    }
}

@media (max-width: 896px) and (max-height: 414px) and (orientation: landscape) {
    .mobile-controls-panel {
        bottom: 60px;
        left: env(safe-area-inset-left, 10px);
        right: env(safe-area-inset-right, 10px);
    }

    .controls {
        padding-left: env(safe-area-inset-left, 10px);
        padding-right: env(safe-area-inset-right, 10px);
    }
}

@keyframes pulse {
    0% { opacity: 0.6; }
    50% { opacity: 1; }
    100% { opacity: 0.6; }
}

.slide.loading .loading-spinner {
    animation: spin 1s linear infinite, pulse 2s ease-in-out infinite;
}

@supports (padding: max(0px)) {
    .controls {
        padding-bottom: max(10px, env(safe-area-inset-bottom));
    }

    .mobile-controls-panel {
        bottom: max(70px, calc(70px + env(safe-area-inset-bottom)));
    }

    .slide-counter {
        left: max(10px, env(safe-area-inset-left));
    }

    .zoom-level {
        right: max(10px, env(safe-area-inset-right));
    }
}

@media (min-width: 1024px) and (max-height: 1366px) and (orientation: portrait) {
    .controls {
        padding: 12px 15px;
    }

    .info-overlay {
        font-size: 0.9rem;
        padding: 12px 20px;
    }
}

@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .loading-bar-indicator {
        height: 8px;
    }

    .controls {
        border-top-width: 0.5px;
    }

    .mobile-controls-panel {
        border-width: 0.5px;
    }
}
