/* 全局样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
    overflow-x: hidden;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.header {
    text-align: center;
    margin-bottom: 40px;
    color: white;
}

.title {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
    animation: fadeInDown 1s ease-out;
}

.subtitle {
    font-size: 1.2rem;
    opacity: 0.9;
    animation: fadeInUp 1s ease-out 0.3s both;
}

.main-content {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 20px 0;
}

.puzzle-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    gap: 15px;
    width: 100%;
    max-width: 600px;
    aspect-ratio: 1;
}

.puzzle-piece {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.2);
    position: relative;
    overflow: hidden;
    animation: fadeInScale 0.6s ease-out both;
}

.puzzle-piece:nth-child(1) { animation-delay: 0.1s; }
.puzzle-piece:nth-child(2) { animation-delay: 0.2s; }
.puzzle-piece:nth-child(3) { animation-delay: 0.3s; }
.puzzle-piece:nth-child(4) { animation-delay: 0.4s; }
.puzzle-piece:nth-child(5) { animation-delay: 0.5s; }
.puzzle-piece:nth-child(6) { animation-delay: 0.6s; }
.puzzle-piece:nth-child(7) { animation-delay: 0.7s; }
.puzzle-piece:nth-child(8) { animation-delay: 0.8s; }
.puzzle-piece:nth-child(9) { animation-delay: 0.9s; }

.puzzle-piece:hover {
    transform: translateY(-8px) scale(1.05);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    border-color: rgba(255, 255, 255, 0.4);
}

.puzzle-piece.completed {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
    transform: scale(0.95);
    border-color: rgba(255, 255, 255, 0.6);
    box-shadow: 0 15px 35px rgba(79, 172, 254, 0.4);
}

.puzzle-piece.completed::before {
    content: '✓';
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 1.5rem;
    font-weight: bold;
    color: white;
    animation: checkmark 0.5s ease-out;
}

.piece-content {
    text-align: center;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.piece-icon {
    font-size: 2.5rem;
    margin-bottom: 15px;
    transition: transform 0.3s ease;
}

.puzzle-piece:hover .piece-icon {
    transform: scale(1.2) rotate(5deg);
}

.piece-content h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 8px;
    line-height: 1.3;
}

.piece-content p {
    font-size: 0.9rem;
    opacity: 0.8;
    line-height: 1.4;
}

.footer {
    text-align: center;
    color: white;
    opacity: 0.8;
    margin-top: 40px;
    animation: fadeIn 1s ease-out 1s both;
}

.completion-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
}

.completion-modal.show {
    display: flex;
    animation: modalFadeIn 0.5s ease-out;
}

.modal-content {
    background: white;
    padding: 40px;
    border-radius: 25px;
    text-align: center;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.modal-icon {
    font-size: 4rem;
    margin-bottom: 20px;
    animation: bounce 1s ease-in-out infinite;
}

.modal-content h2 {
    font-size: 2rem;
    color: #333;
    margin-bottom: 20px;
    font-weight: 700;
}

.modal-content p {
    font-size: 1.1rem;
    color: #666;
    margin-bottom: 15px;
    line-height: 1.6;
}

.modal-close-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 50px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 20px;
}

.modal-close-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.4);
}

.background-pattern {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="50" cy="50" r="1" fill="rgba(255,255,255,0.1)"/></pattern></defs><rect width="100" height="100" fill="url(%23grain)"/></svg>');
    opacity: 0;
    transition: opacity 2s ease;
    pointer-events: none;
    z-index: -1;
}

.background-pattern.show {
    opacity: 1;
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

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

@keyframes checkmark {
    from {
        opacity: 0;
        transform: scale(0) rotate(-180deg);
    }
    to {
        opacity: 1;
        transform: scale(1) rotate(0deg);
    }
}

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

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.8) translateY(-50px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-10px);
    }
    60% {
        transform: translateY(-5px);
    }
}

@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    .title {
        font-size: 2.2rem;
    }
    
    .subtitle {
        font-size: 1rem;
    }
    
    .puzzle-grid {
        gap: 10px;
        max-width: 100%;
    }
    
    .puzzle-piece {
        padding: 15px;
        border-radius: 15px;
    }
    
    .piece-icon {
        font-size: 2rem;
        margin-bottom: 10px;
    }
    
    .piece-content h3 {
        font-size: 1rem;
        margin-bottom: 6px;
    }
    
    .piece-content p {
        font-size: 0.8rem;
    }
    
    .modal-content {
        padding: 30px 20px;
        margin: 20px;
    }
    
    .modal-content h2 {
        font-size: 1.5rem;
    }
    
    .modal-content p {
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .puzzle-grid {
        gap: 8px;
    }
    
    .puzzle-piece {
        padding: 12px;
        border-radius: 12px;
    }
    
    .piece-icon {
        font-size: 1.8rem;
        margin-bottom: 8px;
    }
    
    .piece-content h3 {
        font-size: 0.9rem;
    }
    
    .piece-content p {
        font-size: 0.75rem;
    }
}
