:root {
    --primary-color: #3498db;
    --secondary-color: #2ecc71;
    --accent-color: #e74c3c;
    --dark-color: #2c3e50;
    --light-color: #ecf0f1;
    --shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

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

body {
    font-family: 'Microsoft YaHei', sans-serif;
    background: linear-gradient(135deg, #1a2a6c, #b21f1f, #1a2a6c);
    color: var(--light-color);
    min-height: 100vh;
    padding: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.container {
    max-width: 800px;
    width: 100%;
    background-color: rgba(44, 62, 80, 0.9);
    border-radius: 15px;
    padding: 25px;
    box-shadow: var(--shadow);
    text-align: center;
}

h1 {
    margin-bottom: 20px;
    color: var(--light-color);
    font-size: 2.5rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

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

button {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 50px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: bold;
    transition: all 0.3s ease;
    box-shadow: var(--shadow);
}

button:hover {
    background-color: #2980b9;
    transform: translateY(-3px);
}

button:active {
    transform: translateY(1px);
}

#reset-btn {
    background-color: var(--accent-color);
}

#auto-solve-btn {
    background-color: var(--secondary-color);
}

.game-info {
    display: flex;
    justify-content: space-around;
    margin-bottom: 20px;
    font-size: 1.2rem;
    background-color: rgba(0, 0, 0, 0.2);
    padding: 10px;
    border-radius: 10px;
}

.game-container {
    background-color: #34495e;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 25px;
    box-shadow: inset 0 0 15px rgba(0, 0, 0, 0.5);
}

#game-board {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(4, 1fr);
    gap: 10px;
    width: 400px;
    height: 400px;
    margin: 0 auto;
    position: relative;
    background: #2c3e50;
    border-radius: 8px;
    padding: 10px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.4);
}

.tile {
    display: flex;
    justify-content: center;
    align-items: center;
    background: linear-gradient(145deg, #3498db, #1a5276);
    color: white;
    font-size: 2rem;
    font-weight: bold;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: var(--shadow);
    user-select: none;
}

.tile:hover {
    background: linear-gradient(145deg, #3da5e0, #1f6ca5);
    transform: scale(1.03);
}

.empty {
    background: #7f8c8d;
    visibility: hidden;
}

/* 模式2的方块样式 */
.size-2x2 {
    grid-column: span 2;
    grid-row: span 2;
    background: linear-gradient(145deg, #e74c3c, #c0392b);
}

.size-1x2.horizontal {
    grid-column: span 2;
    grid-row: span 1;
    background: linear-gradient(145deg, #2ecc71, #27ae60);
}

.size-1x2.vertical {
    grid-column: span 1;
    grid-row: span 2;
    background: linear-gradient(145deg, #f39c12, #d35400);
}

.size-1x1 {
    grid-column: span 1;
    grid-row: span 1;
    background: linear-gradient(145deg, #9b59b6, #8e44ad);
}

/* 出口样式 */
.exit {
    position: absolute;
    bottom: -30px;
    left: 50%;
    transform: translateX(-50%);
    width: 84px;
    height: 20px;
    background: linear-gradient(to right, #e74c3c, #c0392b);
    border-radius: 0 0 10px 10px;
    box-shadow: 0 5px 10px rgba(0, 0, 0, 0.3);
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
    font-weight: bold;
    font-size: 0.9rem;
}

.instructions {
    background-color: rgba(0, 0, 0, 0.2);
    padding: 20px;
    border-radius: 10px;
    text-align: left;
}

.instructions h3 {
    margin-bottom: 10px;
    color: var(--light-color);
    text-align: center;
}

#legend {
    display: flex;
    justify-content: space-around;
    margin-top: 15px;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 0 10px;
}

.legend-block {
    width: 60px;
    height: 60px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 8px;
    border-radius: 6px;
    color: white;
    font-weight: bold;
    box-shadow: var(--shadow);
}

.size-2x2 {
    width: 60px;
    height: 60px;
}

.size-1x2.vertical {
    width: 30px;
    height: 60px;
}

.size-1x1 {
    width: 30px;
    height: 30px;
}

.hidden {
    display: none;
}

/* 响应式设计 */
@media (max-width: 600px) {
    #game-board {
        width: 320px;
        height: 320px;
    }
    
    .tile {
        font-size: 1.5rem;
    }
}

@media (max-width: 400px) {
    #game-board {
        width: 280px;
        height: 280px;
    }
    
    .game-controls {
        flex-direction: column;
    }
    
    button {
        width: 100%;
    }
}
