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

body {
    font-family: 'Microsoft YaHei', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    user-select: none;
    overflow-x: hidden;
}

.game-container {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.3);
    padding: 20px;
    text-align: center;
    max-width: 900px;
    width: 95%;
}

h1 {
    color: #333;
    margin-bottom: 15px;
    font-size: 2.2em;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.1);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.game-info {
    display: flex;
    justify-content: space-around;
    align-items: center;
    margin: 15px 0;
    padding: 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 10px;
    color: white;
    flex-wrap: wrap;
    gap: 10px;
}

.info-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 80px;
}

.info-label {
    font-size: 0.8em;
    opacity: 0.9;
    margin-bottom: 3px;
}

.info-value {
    font-size: 1.1em;
    font-weight: bold;
}

.difficulty-selector {
    margin: 15px 0;
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

.difficulty-btn {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 15px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.difficulty-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.3);
}

.difficulty-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    transform: translateY(-2px);
}

.image-selector {
    margin: 15px 0;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.image-selector label {
    font-weight: bold;
    color: #333;
}

.image-selector select {
    padding: 8px 12px;
    border: 2px solid #667eea;
    border-radius: 10px;
    background: white;
    font-size: 14px;
    outline: none;
    cursor: pointer;
}

.controls {
    margin: 15px 0;
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.3);
}

button:active {
    transform: translateY(0);
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.game-board {
    margin: 20px auto;
    display: flex;
    justify-content: center;
}

.puzzle-container {
    display: flex;
    gap: 20px;
    align-items: flex-start;
    flex-wrap: wrap;
    justify-content: center;
}

.puzzle-grid {
    display: grid;
    gap: 2px;
    background: #333;
    border-radius: 10px;
    padding: 5px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.3);
}

.puzzle-piece {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: bold;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
    user-select: none;
    position: relative;
    overflow: hidden;
}

.puzzle-piece:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

.puzzle-piece.empty {
    background: transparent;
    cursor: default;
}

.puzzle-piece.empty:hover {
    transform: none;
    box-shadow: none;
}

.puzzle-piece.movable {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    animation: glow 1.5s infinite alternate;
}

@keyframes glow {
    from { box-shadow: 0 0 5px rgba(79, 172, 254, 0.5); }
    to { box-shadow: 0 0 20px rgba(79, 172, 254, 0.8); }
}

.puzzle-piece.correct {
    background: linear-gradient(135deg, #56ab2f 0%, #a8e6cf 100%);
    animation: correctPulse 0.5s ease;
}

@keyframes correctPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.puzzle-piece img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 6px;
}

.reference-image {
    background: white;
    border-radius: 10px;
    padding: 15px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    min-width: 200px;
}

.reference-image h4 {
    margin-bottom: 10px;
    color: #333;
    font-size: 1.1em;
}

.reference-display {
    width: 180px;
    height: 180px;
    border: 2px solid #ddd;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
    position: relative;
    overflow: hidden;
}

.reference-display img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 6px;
}

.reference-display.numbers {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-size: 18px;
    font-weight: bold;
}

.game-status-panel {
    margin: 20px 0;
    min-height: 60px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.status-message {
    font-size: 1.1em;
    font-weight: bold;
    color: #4a5568;
    padding: 10px 20px;
    background: #f7fafc;
    border-radius: 20px;
    border: 2px solid #e2e8f0;
}

.progress-bar {
    width: 300px;
    height: 8px;
    background: #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    width: 0%;
    transition: width 0.3s ease;
    border-radius: 4px;
}

.victory-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease;
}

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

.victory-content {
    background: white;
    border-radius: 20px;
    padding: 40px;
    text-align: center;
    box-shadow: 0 20px 40px rgba(0,0,0,0.3);
    animation: slideIn 0.3s ease;
    max-width: 400px;
    width: 90%;
}

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

.victory-content h2 {
    color: #333;
    margin-bottom: 20px;
    font-size: 2em;
}

.victory-stats {
    margin: 20px 0;
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 15px;
    color: white;
}

.victory-stats div {
    margin: 8px 0;
    font-size: 1.1em;
}

#newRecord {
    color: #FFD700;
    font-weight: bold;
    animation: sparkle 1s infinite;
}

@keyframes sparkle {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.victory-content button {
    margin: 10px;
    background: linear-gradient(135deg, #56ab2f 0%, #a8e6cf 100%);
}

.instructions {
    margin-top: 20px;
    padding: 20px;
    background: linear-gradient(135deg, #FF6B6B 0%, #4ECDC4 100%);
    border-radius: 15px;
    color: white;
    text-align: left;
}

.instructions h3 {
    margin-bottom: 15px;
    font-size: 1.3em;
    text-align: center;
}

.instructions ul {
    margin-left: 20px;
    line-height: 1.6;
}

.instructions li {
    margin: 8px 0;
}

.instructions li strong {
    color: #FFD700;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .game-container {
        padding: 15px;
        width: 98%;
    }
    
    h1 {
        font-size: 1.8em;
    }
    
    .puzzle-container {
        flex-direction: column;
        align-items: center;
    }
    
    .puzzle-piece {
        width: 60px;
        height: 60px;
        font-size: 18px;
    }
    
    .reference-display {
        width: 120px;
        height: 120px;
    }
    
    .difficulty-selector {
        flex-direction: column;
        gap: 8px;
    }
    
    .controls {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    button {
        padding: 8px 16px;
        font-size: 12px;
    }
    
    .progress-bar {
        width: 200px;
    }
    
    .instructions {
        text-align: center;
        padding: 15px;
    }
    
    .instructions ul {
        margin-left: 0;
        list-style-position: inside;
    }
    
    .instructions li {
        font-size: 0.9em;
    }
}

@media (max-width: 480px) {
    .puzzle-piece {
        width: 50px;
        height: 50px;
        font-size: 16px;
    }
    
    .reference-display {
        width: 100px;
        height: 100px;
    }
    
    .game-info {
        flex-direction: column;
        gap: 5px;
    }
    
    .info-item {
        min-width: 60px;
    }
    
    .info-label {
        font-size: 0.7em;
    }
    
    .info-value {
        font-size: 1em;
    }
    
    .victory-content {
        padding: 30px 20px;
    }
}