body {
    overflow: hidden;
    margin: 0;
    padding: 0;
    background: #000;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

amp-story {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 1;
    will-change: transform;
    transform: translateZ(0);
    backface-visibility: hidden;
    perspective: 1000px;
    touch-action: pan-y pinch-zoom;
}

.story-transition-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #000;
    z-index: 0;
    opacity: 0.8;
    pointer-events: none;
}

/* Disable native amp-story gestures */
amp-story {
    touch-action: pan-y !important;
}

/* Hide native amp-story UI elements */
amp-story:not([desktop]) .i-amphtml-story-button-container,
amp-story:not([desktop]) .i-amphtml-story-system-layer {
    display: none !important;
}

/* Custom progress bar */
.story-progress {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    z-index: 10;
}

.story-progress-bar {
    height: 100%;
    background: #fff;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Smooth animation classes */
.story-animate-out-up {
    animation: slideOutUp 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.story-animate-out-down {
    animation: slideOutDown 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.story-animate-in-up {
    animation: slideInUp 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.story-animate-in-down {
    animation: slideInDown 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* Hardware accelerated animations */
@keyframes slideOutUp {
    from {
        transform: translate3d(0, 0, 0);
    }
    to {
        transform: translate3d(0, -100vh, 0);
    }
}

@keyframes slideOutDown {
    from {
        transform: translate3d(0, 0, 0);
    }
    to {
        transform: translate3d(0, 100vh, 0);
    }
}

@keyframes slideInUp {
    from {
        transform: translate3d(0, 100vh, 0);
    }
    to {
        transform: translate3d(0, 0, 0);
    }
}

@keyframes slideInDown {
    from {
        transform: translate3d(0, -100vh, 0);
    }
    to {
        transform: translate3d(0, 0, 0);
    }
}

/* Touch feedback */
.story-touch-feedback {
    position: fixed;
    top: 50%;
    left: 50%;
    width: 50px;
    height: 50px;
    margin: -25px 0 0 -25px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    pointer-events: none;
    opacity: 0;
    transform: scale(0);
    z-index: 100;
}

.story-touch-feedback.active {
    animation: touchFeedback 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes touchFeedback {
    0% {
        opacity: 1;
        transform: scale(0);
    }
    100% {
        opacity: 0;
        transform: scale(2);
    }
}
