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

body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #333;
}

.game-container {
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    padding: 20px;
    max-width: 800px;
    width: 100%;
    text-align: center;
}

h1 {
    color: #2d3748;
    margin-bottom: 20px;
    font-size: 2.5rem;
}

.game-info {
    display: flex;
    justify-content: space-around;
    margin-bottom: 20px;
    background: #f7fafc;
    padding: 15px;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: bold;
    flex-wrap: wrap;
    gap: 10px;
}

.info-item {
    display: flex;
    align-items: center;
    gap: 8px;
    background: white;
    padding: 8px 15px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.info-item span:first-child {
    color: #718096;
}

.info-item span:last-child {
    color: #2d3748;
    font-weight: bold;
}

.game-board {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    grid-template-rows: repeat(8, 1fr);
    gap: 5px;
    padding: 20px;
    background: #f7fafc;
    border-radius: 10px;
    margin: 20px auto;
    max-width: 500px;
    aspect-ratio: 1;
}

.tile {
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.5rem;
    font-weight: bold;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
}

.tile:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.tile.selected {
    border-color: #4299e1;
    background: #ebf8ff;
    transform: scale(1.1);
}

.tile.matched {
    animation: match 0.6s ease forwards;
    pointer-events: none;
}

.tile.falling {
    animation: fall 0.5s ease forwards;
}

.tile.new {
    animation: appear 0.5s ease forwards;
}

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

@keyframes fall {
    0% { transform: translateY(-100px); opacity: 0; }
    100% { transform: translateY(0); opacity: 1; }
}

@keyframes appear {
    0% { transform: scale(0); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

/* 不同颜色的方块 */
.tile.color-0 { background: linear-gradient(135deg, #ff6b6b 0%, #ee5a52 100%); color: white; }
.tile.color-1 { background: linear-gradient(135deg, #4ecdc4 0%, #45b7d1 100%); color: white; }
.tile.color-2 { background: linear-gradient(135deg, #45b7d1 0%, #2980b9 100%); color: white; }
.tile.color-3 { background: linear-gradient(135deg, #96ceb4 0%, #38a169 100%); color: white; }
.tile.color-4 { background: linear-gradient(135deg, #ffeaa7 0%, #fdcb6e 100%); color: #2d3748; }
.tile.color-5 { background: linear-gradient(135deg, #dda0dd 0%, #9b59b6 100%); color: white; }
.tile.color-6 { background: linear-gradient(135deg, #ff8c42 0%, #e67e22 100%); color: white; }

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

.control-btn {
    padding: 12px 24px;
    font-size: 1rem;
    font-weight: bold;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #4299e1;
    color: white;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.control-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

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

.control-btn:disabled {
    background: #a0aec0;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

#resetBtn {
    background: #f56565;
}

#hintBtn {
    background: #ed8936;
}

.instructions {
    background: #f7fafc;
    padding: 15px;
    border-radius: 10px;
    margin-top: 20px;
}

.instructions h3 {
    color: #4a5568;
    margin-bottom: 10px;
}

.instructions p {
    color: #718096;
    margin: 5px 0;
    font-size: 0.95rem;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .game-container {
        margin: 10px;
        padding: 15px;
    }
    
    h1 {
        font-size: 2rem;
    }
    
    .game-info {
        flex-direction: column;
        align-items: center;
    }
    
    .info-item {
        width: 100%;
        max-width: 300px;
        justify-content: center;
    }
    
    .game-board {
        grid-template-columns: repeat(6, 1fr);
        grid-template-rows: repeat(6, 1fr);
        max-width: 400px;
    }
    
    .tile {
        font-size: 1.2rem;
    }
    
    .controls {
        flex-direction: column;
        align-items: center;
    }
    
    .control-btn {
        width: 80%;
    }
}

@media (max-width: 480px) {
    h1 {
        font-size: 1.8rem;
    }
    
    .game-board {
        grid-template-columns: repeat(6, 1fr);
        grid-template-rows: repeat(6, 1fr);
        max-width: 300px;
        gap: 3px;
        padding: 10px;
    }
    
    .tile {
        font-size: 1rem;
        border-radius: 4px;
    }
}