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

body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    overflow-y: auto;
}

.hidden {
    display: none !important;
}

/* 关卡选择界面 */
.level-select-container {
    background: white;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 900px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
}

.select-title {
    color: #667eea;
    text-align: center;
    margin-bottom: 20px;
    font-size: 2.5em;
}

.test-tool-link {
    text-align: center;
    margin-bottom: 20px;
}

.test-link-btn {
    display: inline-block;
    padding: 12px 30px;
    background: linear-gradient(135deg, #51cf66 0%, #37b24d 100%);
    color: white;
    text-decoration: none;
    border-radius: 25px;
    font-weight: bold;
    transition: transform 0.2s;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

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

.level-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 15px;
    padding: 10px;
}

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

.level-btn:hover:not(.locked) {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

.level-btn.locked {
    background: #ccc;
    cursor: not-allowed;
    opacity: 0.5;
}

.level-number {
    font-size: 1.8em;
    font-weight: bold;
    margin-bottom: 5px;
}

.level-difficulty {
    font-size: 0.9em;
    font-weight: normal;
}

/* 关卡信息 */
.level-info {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
}

.level-label {
    font-size: 1.2em;
    color: #333;
    font-weight: bold;
}

.difficulty-badge {
    padding: 5px 15px;
    border-radius: 20px;
    font-weight: bold;
    font-size: 1em;
    background: rgba(255, 255, 255, 0.3);
}

.container {
    background: white;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 600px;
}

.header {
    text-align: center;
    margin-bottom: 20px;
}

h1 {
    color: #667eea;
    margin-bottom: 15px;
    font-size: 2.5em;
}

.score-board {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.score-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.label {
    font-size: 0.9em;
    color: #666;
    margin-bottom: 5px;
}

.value {
    font-size: 1.8em;
    font-weight: bold;
    color: #764ba2;
}

.game-board {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 5px;
    background: #f0f0f0;
    padding: 10px;
    border-radius: 10px;
    margin-bottom: 20px;
}

.tile {
    aspect-ratio: 1;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2em;
    transition: all 0.2s ease;
    user-select: none;
}

.tile:hover {
    transform: scale(1.05);
}

.tile.selected {
    border: 3px solid #ffd700;
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.6);
}

.tile.matched {
    animation: pop 0.3s ease;
}

@keyframes pop {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); opacity: 0.5; }
    100% { transform: scale(0); opacity: 0; }
}

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

.btn {
    padding: 12px 25px;
    font-size: 1em;
    border: none;
    border-radius: 25px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    cursor: pointer;
    transition: transform 0.2s;
    font-weight: bold;
}

.btn-secondary {
    background: linear-gradient(135deg, #868e96 0%, #495057 100%);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.btn:active {
    transform: translateY(0);
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: white;
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.modal-content h2 {
    color: #667eea;
    margin-bottom: 20px;
    font-size: 2em;
}

.modal-content p {
    font-size: 1.3em;
    margin-bottom: 15px;
    color: #333;
}

.modal-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 20px;
}

#final-score, #complete-score, #required-score {
    color: #764ba2;
    font-weight: bold;
    font-size: 1.5em;
}

@media (max-width: 600px) {
    .container, .level-select-container {
        padding: 15px;
    }

    h1, .select-title {
        font-size: 1.8em;
    }

    .tile {
        font-size: 1.5em;
    }

    .level-grid {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
        gap: 10px;
    }

    .level-btn {
        padding: 15px 5px;
    }

    .level-number {
        font-size: 1.5em;
    }

    .level-difficulty {
        font-size: 0.8em;
    }

    .score-board {
        gap: 15px;
    }

    .controls {
        gap: 8px;
    }

    .btn {
        padding: 10px 15px;
        font-size: 0.9em;
    }
}
