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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #000;
    overflow: hidden;
    position: fixed;
    width: 100%;
    height: 100%;
    -webkit-user-select: none;
    user-select: none;
    touch-action: pan-y;
}

#video-container {
    position: relative;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
}

.top-btn {
    position: absolute;
    top: calc(14px + env(safe-area-inset-top, 0px));
    right: 14px;
    z-index: 20;
    height: 40px;
    padding: 0 12px;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    color: #fff;
    text-decoration: none;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    transition: transform 0.12s ease, background 0.12s ease;
}

.top-btn svg {
    width: 18px;
    height: 18px;
    fill: #fff;
}

.top-btn span {
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.2px;
}

.top-btn:active {
    transform: scale(0.95);
    background: rgba(0, 0, 0, 0.75);
}

@media (hover: hover) {
    .top-btn:hover {
        background: rgba(0, 0, 0, 0.75);
        transform: scale(1.02);
    }
}

.video-item {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
    transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.video-item video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #000;
}

.video-item.active {
    z-index: 2;
}

.video-item.prev {
    transform: translateY(-100%);
    z-index: 1;
}

.video-item.next {
    transform: translateY(100%);
    z-index: 1;
}

.video-item.transitioning {
    pointer-events: none;
}

#loading {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
    z-index: 1000;
}

#loading.hidden {
    display: none;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.2);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.video-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 120px;
    background: linear-gradient(to bottom, rgba(0,0,0,0.6) 0%, rgba(0,0,0,0) 100%);
    z-index: 1;
    pointer-events: none;
}

.video-item::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 120px;
    background: linear-gradient(to top, rgba(0,0,0,0.6) 0%, rgba(0,0,0,0) 100%);
    z-index: 1;
    pointer-events: none;
}

.progress {
    position: absolute;
    left: 10px;
    right: 10px;
    bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    height: 2px;
    background: rgba(255, 255, 255, 0.22);
    border-radius: 999px;
    overflow: hidden;
    z-index: 4;
    pointer-events: none;
}

.progress-fill {
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    transform-origin: left center;
    transform: scaleX(0);
    transition: transform 0s linear;
    will-change: transform;
}

.progress-fill.no-transition {
    transition: none;
}

.video-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    display: block;
    --pause-size: 80px;
    --overlay-gap: 14px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 3;
}

.video-item.paused .video-overlay {
    opacity: 1;
    pointer-events: auto;
}

.pause-icon {
    position: absolute;
    left: 50%;
    top: 50%;
    width: var(--pause-size);
    height: var(--pause-size);
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.pause-icon svg {
    width: 36px;
    height: 36px;
    fill: #fff;
}

.overlay-btn {
    --btn-scale: 1;
    transform: scale(var(--btn-scale));
    height: 44px;
    padding: 0 14px;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: none;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.overlay-actions {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, calc(var(--pause-size) / 2 + var(--overlay-gap)));
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.overlay-btn:active {
    --btn-scale: 0.9;
    background: rgba(0, 0, 0, 0.75);
}

.overlay-btn svg {
    width: 20px;
    height: 20px;
    fill: #fff;
}

.overlay-btn span {
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    letter-spacing: 0.2px;
}

@media (hover: hover) {
    .overlay-btn:hover {
        background: rgba(0, 0, 0, 0.75);
        --btn-scale: 1.05;
    }
}

@media (orientation: landscape) {
    .video-item video {
        object-fit: cover;
    }
}

@media (max-width: 768px) {
    .video-item video {
        object-fit: cover;
    }
    
    .pause-icon {
        width: calc(var(--pause-size) - 10px);
        height: calc(var(--pause-size) - 10px);
    }
    
    .pause-icon svg {
        width: 32px;
        height: 32px;
    }
}
