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

html,
body {
    width: 100vw;
    height: 100dvh;
    /* Dynamic viewport height for mobile browsers */
    margin: 0;
    padding: 0;
    overflow: hidden;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    position: fixed;
    touch-action: none;
}

#app {
    width: 100%;
    height: 100%;
    display: grid;
    place-items: center;
    position: relative;
    -webkit-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

#image-container {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

#main-image {
    max-width: 90%;
    max-height: 85%;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 30px;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.3),
        0 10px 30px rgba(0, 0, 0, 0.2);
    transition: opacity 0.5s ease, transform 0.3s ease;
    background: white;
}

#main-image:hover {
    transform: scale(1.02);
}

#main-image.fade-out {
    opacity: 0;
    transform: scale(1.05);
}

#main-image.fade-in {
    opacity: 1;
    transform: scale(1);
}

/* Transition Overlay */
#transition-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, transparent 0%, rgba(102, 126, 234, 0.8) 100%);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
}

#transition-overlay.active {
    opacity: 1;
}

/* Loading State */
#main-image.loading {
    filter: blur(10px);
}

/* Landscape mode on mobile */
@media (max-height: 500px) and (orientation: landscape) {
    #main-image {
        max-height: 90%;
        max-width: 70%;
    }
}

/* Touch device optimizations */
@media (pointer: coarse) {
    #main-image {
        border-radius: 20px;
    }

    #main-image:active {
        transform: scale(0.98);
    }
}