/* Enhanced Flip Book Carousel Styles */
.flip-carousel-container {
    position: relative;
    width: 100%;
    max-width: 300px;
    height: 533px; /* 9:16 比例 (300 * 16/9 = 533) */
    perspective: 1200px;
    perspective-origin: center center;
    overflow: hidden;
    background: linear-gradient(135deg, rgba(236, 72, 153, 0.05) 0%, rgba(20, 184, 166, 0.05) 100%);
    border-radius: 25px;
    padding: 15px;
    box-shadow: inset 0 0 50px rgba(236, 72, 153, 0.1);
}

.flip-book {
    position: relative;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    transition: transform 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.flip-page {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 25px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    box-shadow: 
        0 25px 50px rgba(0, 0, 0, 0.3),
        0 0 0 1px rgba(255, 255, 255, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    backface-visibility: hidden;
    transform-style: preserve-3d;
    border: 3px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
}

.flip-page-content {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.flip-page-content img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    opacity: 1;
    filter: brightness(0.9) contrast(1.1) saturate(1.1);
    border-radius: 22px;
}

.flip-page-content img.loading {
    opacity: 0.7;
    transform: scale(0.95);
}

.flip-page-content img.loaded {
    opacity: 1;
    transform: scale(1);
}

/* Page Positions and Transforms */
.flip-page:nth-child(1) {
    transform: translateZ(0px) rotateY(0deg);
    z-index: 6;
}

.flip-page:nth-child(2) {
    transform: translateZ(-20px) rotateY(-5deg);
    z-index: 5;
}

.flip-page:nth-child(3) {
    transform: translateZ(-40px) rotateY(-10deg);
    z-index: 4;
}

.flip-page:nth-child(4) {
    transform: translateZ(-60px) rotateY(-15deg);
    z-index: 3;
}

.flip-page:nth-child(5) {
    transform: translateZ(-80px) rotateY(-20deg);
    z-index: 2;
}

.flip-page:nth-child(6) {
    transform: translateZ(-100px) rotateY(-25deg);
    z-index: 1;
}

/* Active Page */
.flip-page.active {
    transform: translateZ(20px) rotateY(0deg) scale(1.05);
    z-index: 10;
    box-shadow: 0 20px 60px rgba(236, 72, 153, 0.4), 0 12px 40px rgba(0, 0, 0, 0.3);
    border-color: rgba(236, 72, 153, 0.6);
    animation: pageGlow 1.5s ease-out;
}

/* Hover Effects */
.flip-page:hover:not(.active) {
    transform: translateZ(10px) rotateY(-2deg) scale(1.02);
    box-shadow: 0 16px 50px rgba(0, 0, 0, 0.4);
    border-color: rgba(236, 72, 153, 0.3);
}

.flip-page:hover .flip-page-content img {
    transform: scale(1.08) rotate(1deg);
    filter: brightness(1) contrast(1.2) saturate(1.3);
}

/* Page Flip Animation */
.flip-page.flipping {
    animation: pageFlip 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
    z-index: 15;
}

.flip-page.flipping-back {
    animation: pageFlipBack 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
    z-index: 15;
}

/* Page Content Overlay */
.page-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(236, 72, 153, 0.1), rgba(59, 130, 246, 0.1));
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.flip-page.active .page-overlay {
    opacity: 1;
}

/* Page Info - Always Visible */
.page-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.9));
    backdrop-filter: blur(15px);
    border-bottom-left-radius: 25px;
    border-bottom-right-radius: 25px;
    padding: 25px;
    color: white;
    opacity: 1;
    transform: translateY(0);
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    z-index: 10;
    display: none; /* 隐藏标题 */
}

.page-emoji {
    font-size: 2.5rem;
    margin-bottom: 10px;
    display: block;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
    animation: float 3s ease-in-out infinite;
}

.page-title {
    font-size: 1.8rem;
    font-weight: bold;
    margin-bottom: 6px;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.7);
    background: linear-gradient(45deg, #ec4899, #14b8a6, #a855f7);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.page-subtitle {
    font-size: 1rem;
    opacity: 0.9;
    text-shadow: 0 1px 5px rgba(0, 0, 0, 0.5);
}

/* Enhanced Navigation Dots */
.flip-nav {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    display: none; /* 隐藏导航点 */
    gap: 12px;
    z-index: 20;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(20px);
    padding: 10px 20px;
    border-radius: 25px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.flip-nav-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.4);
    border: 2px solid rgba(255, 255, 255, 0.3);
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    position: relative;
}

.flip-nav-dot:hover {
    transform: scale(1.2);
    background: rgba(236, 72, 153, 0.6);
    border-color: rgba(236, 72, 153, 0.8);
}

.flip-nav-dot.active {
    background: rgba(236, 72, 153, 0.9);
    border-color: rgba(236, 72, 153, 1);
    transform: scale(1.3);
    box-shadow: 0 0 20px rgba(236, 72, 153, 0.6);
    animation: dotPulse 0.6s ease-out;
}

/* Auto Play Button */
.flip-autoplay {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    z-index: 20;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.flip-autoplay:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
    background: rgba(255, 255, 255, 1);
}

.flip-autoplay svg {
    width: 16px;
    height: 16px;
    color: #374151;
}

.flip-autoplay span {
    font-size: 12px;
    font-weight: 600;
    color: #374151;
}

/* Page Turn Indicators */
.page-turn-indicator {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    z-index: 20;
    opacity: 0;
    pointer-events: none;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.flip-carousel-container:hover .page-turn-indicator {
        opacity: 1;
    pointer-events: all;
}

.page-turn-indicator:hover {
    transform: translateY(-50%) scale(1.1);
    background: rgba(236, 72, 153, 0.9);
    box-shadow: 0 8px 30px rgba(236, 72, 153, 0.3);
}

.page-turn-indicator svg {
    width: 20px;
    height: 20px;
    color: #374151;
    transition: color 0.3s ease;
}

.page-turn-indicator:hover svg {
    color: white;
}

.page-turn-prev {
    left: 20px;
}

.page-turn-next {
    right: 20px;
}

/* Animations */
@keyframes pageFlip {
    0% {
        transform: translateZ(0px) rotateY(0deg) scale(1);
    }
    25% { 
        transform: translateZ(50px) rotateY(-45deg) scale(1.1);
    }
    50% { 
        transform: translateZ(100px) rotateY(-90deg) scale(1.05);
    }
    75% { 
        transform: translateZ(50px) rotateY(-135deg) scale(1.1);
    }
    100% {
        transform: translateZ(0px) rotateY(-180deg) scale(1);
    }
}

@keyframes pageFlipBack {
    0% {
        transform: translateZ(0px) rotateY(-180deg) scale(1);
    }
    25% {
        transform: translateZ(50px) rotateY(-135deg) scale(1.1);
    }
    50% { 
        transform: translateZ(100px) rotateY(-90deg) scale(1.05);
    }
    75% {
        transform: translateZ(50px) rotateY(-45deg) scale(1.1);
    }
    100% { 
        transform: translateZ(0px) rotateY(0deg) scale(1);
    }
}

@keyframes pageGlow {
    0% {
        box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
    }
    50% {
        box-shadow: 0 0 50px rgba(236, 72, 153, 0.6), 0 20px 60px rgba(0, 0, 0, 0.3);
    }
    100% {
        box-shadow: 0 20px 60px rgba(236, 72, 153, 0.4), 0 12px 40px rgba(0, 0, 0, 0.3);
    }
}

@keyframes dotPulse {
    0% { transform: scale(1.3); }
    50% { transform: scale(1.5); }
    100% { transform: scale(1.3); }
}

@keyframes float {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-10px);
    }
}

@keyframes glow {
    0%, 100% {
        box-shadow: 
            0 25px 50px rgba(0, 0, 0, 0.3),
            0 0 0 1px rgba(255, 255, 255, 0.1);
    }
    50% {
        box-shadow: 
            0 25px 50px rgba(0, 0, 0, 0.3),
            0 0 0 1px rgba(255, 255, 255, 0.1),
            0 0 30px rgba(236, 72, 153, 0.3);
    }
}

@keyframes sparkle {
    0%, 100% {
        transform: rotate(0deg) scale(1);
        opacity: 0.1;
    }
    50% { 
        transform: rotate(180deg) scale(1.1);
        opacity: 0.3;
    }
}

@keyframes particleFloat {
    0% {
        transform: translate(0, 0) scale(1);
        opacity: 1;
    }
    100% { 
        transform: translate(var(--end-x), var(--end-y)) scale(0);
        opacity: 0;
    }
}

/* Enhanced Page Effects */
.flip-page::before {
    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.6s;
    z-index: 1;
}

.flip-page:hover::before {
    left: 100%;
}

/* Particle Effects */
.flip-page::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(236, 72, 153, 0.1) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.5s ease;
    pointer-events: none;
    z-index: 1;
}

.flip-page:hover::after {
    opacity: 1;
    animation: sparkle 2s ease-in-out infinite;
}

/* Active Page Glow */
.flip-page.active {
    animation: glow 2s ease-in-out infinite;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .flip-carousel-container {
        height: 400px;
    }
    
    .flip-page {
        border-radius: 12px;
    }
    
    .page-info {
        bottom: 15px;
        left: 15px;
        right: 15px;
        padding: 12px;
    }
    
    .page-emoji {
        font-size: 20px;
    }
    
    .page-title {
        font-size: 16px;
    }
    
    .page-subtitle {
        font-size: 12px;
    }
    
    .flip-nav {
        bottom: 15px;
        gap: 8px;
    }
    
    .flip-nav-dot {
        width: 10px;
        height: 10px;
    }
    
    .flip-autoplay {
        top: 15px;
        right: 15px;
        padding: 10px 12px;
    }
    
    .page-turn-indicator {
        width: 35px;
        height: 35px;
    }
    
    .page-turn-prev {
        left: 15px;
    }
    
    .page-turn-next {
        right: 15px;
    }
}

/* Loading States */
.flip-page.loading {
    animation: pageShimmer 1.5s ease-in-out infinite;
}

@keyframes pageShimmer {
    0% { opacity: 0.7; }
    50% { opacity: 1; }
    100% { opacity: 0.7; }
}

/* Transition Effects */
.flip-page.transitioning {
    pointer-events: none;
}

.flip-page.transitioning .flip-page-content img {
    transition: opacity 0.3s ease, transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Home Page Styles */

/* Level Card Styles */
.level-card {
    transition: all 0.3s ease;
    border: 2px solid transparent;
    position: relative;
    overflow: hidden;
}

.level-card:hover {
    transform: translateY(-5px);
    border-color: #AA6436;
    box-shadow: 0 15px 30px rgba(170, 100, 54, 0.2);
}

.level-card-placeholder {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    animation: pulse 2s ease-in-out infinite;
}

.level-card-placeholder .bg-gray-200 {
    background: linear-gradient(90deg, #f3f4f6 25%, #e5e7eb 50%, #f3f4f6 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

/* Level Badge */
.level-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    background: linear-gradient(135deg, #AA6436, #8B4513);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(170, 100, 54, 0.3);
}

/* Level Image */
.level-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.level-card:hover .level-image {
    transform: scale(1.05);
}

/* Level Content */
.level-content {
    padding: 16px;
}

.level-title {
    font-size: 16px;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 8px;
    line-height: 1.4;
}

.level-description {
    font-size: 14px;
    color: #6b7280;
    line-height: 1.5;
    margin-bottom: 12px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.level-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: #9ca3af;
}

.level-views {
    display: flex;
    align-items: center;
    gap: 4px;
}

.level-difficulty {
    padding: 2px 8px;
    border-radius: 12px;
    font-weight: 500;
}

.difficulty-easy {
    background: #dcfce7;
    color: #166534;
}

.difficulty-medium {
    background: #fef3c7;
    color: #92400e;
}

.difficulty-hard {
    background: #fee2e2;
    color: #991b1b;
}

/* Level Tab Buttons */
.level-tab-btn {
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.level-tab-btn::before {
    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;
}

.level-tab-btn:hover::before {
    left: 100%;
}

/* Loading States */
.loading-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #f3f4f6;
    border-top: 2px solid #AA6436;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Error States */
.error-state {
    text-align: center;
    padding: 48px 24px;
}

.error-icon {
    font-size: 48px;
    color: #ef4444;
    margin-bottom: 16px;
}

.error-message {
    font-size: 18px;
    color: #374151;
    margin-bottom: 8px;
}

.error-submessage {
    font-size: 14px;
    color: #6b7280;
    margin-bottom: 24px;
}

/* Responsive Design */
@media (max-width: 640px) {
    .level-card {
        margin-bottom: 16px;
    }
    
    .level-image {
        height: 160px;
    }
    
    .level-title {
        font-size: 14px;
    }
    
    .level-description {
        font-size: 13px;
    }
}

/* Animation Classes */
.fade-in {
    animation: fadeIn 0.5s ease-in-out;
}

.slide-up {
    animation: slideUp 0.5s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Grid Layout */
.levels-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
    margin-top: 24px;
}

@media (max-width: 768px) {
    .levels-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 16px;
    }
}

@media (max-width: 480px) {
    .levels-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
}
