/* TwentyTwenty Image Compare Styles */
.twentytwenty-container {
    position: relative;
    width: 100%;
    height: 0;
    padding-bottom: 56.25%; /* 16:9 比例 */
    overflow: hidden;
    background: #f8f9fa;
    border-radius: 8px;
}

.twentytwenty-container.aspect-ratio-4-3 {
    padding-bottom: 75%; /* 4:3 比例 */
}

.twentytwenty-container img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
}

.twentytwenty-handle {
    position: absolute;
    z-index: 30;
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(0, 0, 0, 0.3);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    cursor: ew-resize;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.twentytwenty-handle::before,
.twentytwenty-handle::after {
    content: "";
    position: absolute;
    background: rgba(0, 0, 0, 0.3);
    width: 2px;
    height: 100vh;
}

.twentytwenty-handle::before {
    left: 50%;
    transform: translateX(-50%);
    top: -50vh;
}

.twentytwenty-handle::after {
    left: 50%;
    transform: translateX(-50%);
    bottom: -50vh;
}

.twentytwenty-vertical .twentytwenty-handle {
    cursor: ns-resize;
}

.twentytwenty-vertical .twentytwenty-handle::before {
    top: 50%;
    left: -50vw;
    transform: translateY(-50%);
    width: 100vw;
    height: 2px;
}

.twentytwenty-vertical .twentytwenty-handle::after {
    top: 50%;
    left: auto;
    right: -50vw;
    transform: translateY(-50%);
    width: 100vw;
    height: 2px;
}

/* 深色模式支持 */
@media (prefers-color-scheme: dark) {
    .twentytwenty-handle {
        background: rgba(30, 30, 30, 0.8);
        border: 1px solid rgba(255, 255, 255, 0.3);
    }
    
    .twentytwenty-handle::before,
    .twentytwenty-handle::after {
        background: rgba(255, 255, 255, 0.3);
    }
    
    .twentytwenty-label {
        background: rgba(30, 30, 30, 0.8);
    }
}

.twentytwenty-before {
    z-index: 10;
}

.twentytwenty-after {
    z-index: 20;
    clip-path: inset(0 0 0 50%);
}

.twentytwenty-arrow {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
}

.twentytwenty-horizontal .twentytwenty-arrow {
    border-top: 6px solid rgba(0, 0, 0, 0.3);
    border-bottom: 6px solid rgba(0, 0, 0, 0.3);
}

.twentytwenty-vertical .twentytwenty-arrow {
    border-left: 6px solid rgba(0, 0, 0, 0.3);
    border-right: 6px solid rgba(0, 0, 0, 0.3);
}

/* 深色模式箭头 */
@media (prefers-color-scheme: dark) {
    .twentytwenty-horizontal .twentytwenty-arrow {
        border-top: 6px solid rgba(255, 255, 255, 0.3);
        border-bottom: 6px solid rgba(255, 255, 255, 0.3);
    }
    
    .twentytwenty-vertical .twentytwenty-arrow {
        border-left: 6px solid rgba(255, 255, 255, 0.3);
        border-right: 6px solid rgba(255, 255, 255, 0.3);
    }
}

.twentytwenty-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.twentytwenty-label {
    position: absolute;
    top: 10px;
    padding: 4px 8px;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    font-size: 12px;
    border-radius: 4px;
    pointer-events: none;
    z-index: 40;
}

.twentytwenty-before-label {
    left: 10px;
}

.twentytwenty-after-label {
    right: 10px;
}

.twentytwenty-vertical .twentytwenty-before-label {
    left: 10px;
    top: 10px;
}

.twentytwenty-vertical .twentytwenty-after-label {
    right: 10px;
    top: 10px;
}

/* Responsive */
@media (max-width: 768px) {
    .twentytwenty-handle {
        width: 32px;
        height: 32px;
    }

    .twentytwenty-label {
        font-size: 10px;
        padding: 2px 6px;
    }
}