/* 数字华容道游戏样式 */

.game-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
}

.game-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    z-index: -1;
}

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

.game-header h1 {
    font-size: 2.5rem;
    margin: 0 0 10px 0;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    background: linear-gradient(45deg, #fff, #f0f0f0);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.game-subtitle {
    font-size: 1.1rem;
    margin: 0;
    opacity: 0.9;
}

.game-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 15px;
    margin: 20px 0;
}

.stat-box {
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 15px;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.3);
    transition: all 0.3s ease;
}

.stat-box:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.best-stat {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.3), rgba(255, 193, 7, 0.3));
}

.stat-label {
    font-size: 0.9rem;
    margin-bottom: 5px;
    color: rgba(255, 255, 255, 0.8);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: bold;
    color: white;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

.game-controls {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    gap: 15px;
}

.difficulty-selector {
    display: flex;
    align-items: center;
    gap: 10px;
    color: white;
}

.difficulty-selector label {
    font-weight: 500;
    min-width: 40px;
}

.difficulty-dropdown {
    padding: 8px 12px;
    border: none;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.9);
    color: #333;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.difficulty-dropdown:hover {
    background: white;
    transform: translateY(-1px);
}

.control-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.button {
    padding: 10px 20px;
    border: none;
    border-radius: 25px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: relative;
    overflow: hidden;
}

.button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.button:hover::before {
    left: 100%;
}

.button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

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

.button:not(.secondary):not(.third):not(.fourth) {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
}

.button.secondary {
    background: linear-gradient(135deg, #f093fb, #f5576c);
    color: white;
}

.button.third {
    background: linear-gradient(135deg, #4facfe, #00f2fe);
    color: white;
}

.button.fourth {
    background: linear-gradient(135deg, #43e97b, #38f9d7);
    color: white;
}

.game-board-container {
    position: relative;
    display: flex;
    justify-content: center;
    margin-bottom: 30px;
}

.puzzle-board {
    display: grid;
    gap: 5px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.2);
    position: relative;
}

.puzzle-board.size-3 {
    grid-template-columns: repeat(3, 1fr);
    width: 320px;
    height: 320px;
}

.puzzle-board.size-4 {
    grid-template-columns: repeat(4, 1fr);
    width: 360px;
    height: 360px;
}

.puzzle-board.size-5 {
    grid-template-columns: repeat(5, 1fr);
    width: 400px;
    height: 400px;
}

.puzzle-tile {
    background: linear-gradient(135deg, #ffffff, #f8f9fa);
    border: 2px solid rgba(0, 0, 0, 0.1);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: bold;
    color: #333;
    cursor: pointer;
    transition: all 0.3s ease;
    user-select: none;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.puzzle-tile::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.8), rgba(255, 255, 255, 0.4));
    opacity: 0;
    transition: opacity 0.3s ease;
}

.puzzle-tile:hover::before {
    opacity: 1;
}

.puzzle-tile:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
    border-color: #667eea;
}

.puzzle-tile:active {
    transform: translateY(0) scale(0.98);
}

.puzzle-tile.movable {
    background: linear-gradient(135deg, #43e97b, #38f9d7);
    color: white;
    animation: pulse 2s infinite;
}

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

.puzzle-tile.empty {
    background: transparent;
    border: 2px dashed rgba(255, 255, 255, 0.3);
    cursor: default;
}

.puzzle-tile.empty:hover {
    transform: none;
    box-shadow: none;
    border-color: rgba(255, 255, 255, 0.3);
}

.puzzle-tile.moving {
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 10;
}

.win-overlay, .hint-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 15px;
    z-index: 100;
}

.win-content, .hint-content {
    background: linear-gradient(135deg, #667eea, #764ba2);
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    color: white;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    position: relative;
    overflow: hidden;
}

.win-content::before, .hint-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    z-index: -1;
}

.win-content h2 {
    margin: 0 0 20px 0;
    font-size: 2rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.win-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin: 20px 0;
}

.win-stat {
    background: rgba(255, 255, 255, 0.2);
    padding: 15px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.win-stat-label {
    display: block;
    font-size: 0.9rem;
    opacity: 0.8;
    margin-bottom: 5px;
}

.win-stat-value {
    font-size: 1.3rem;
    font-weight: bold;
}

.new-record {
    background: linear-gradient(135deg, #FFD700, #FFA500);
    color: white;
    padding: 10px 20px;
    border-radius: 25px;
    margin: 15px 0;
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
    animation: bounce 0.5s ease-in-out;
}

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

.win-buttons {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-top: 20px;
}

.game-instructions {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 25px;
    margin-top: 30px;
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.game-instructions h3 {
    margin: 0 0 20px 0;
    font-size: 1.5rem;
    text-align: center;
    color: white;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

.instructions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

.instruction-item {
    display: flex;
    align-items: flex-start;
    gap: 15px;
    background: rgba(255, 255, 255, 0.1);
    padding: 20px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
}

.instruction-item:hover {
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 0.15);
}

.instruction-icon {
    font-size: 2rem;
    flex-shrink: 0;
}

.instruction-text {
    flex: 1;
}

.instruction-text strong {
    display: block;
    margin-bottom: 5px;
    color: white;
}

.game-tips {
    background: rgba(255, 255, 255, 0.05);
    padding: 20px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.game-tips h4 {
    margin: 0 0 15px 0;
    color: white;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

.game-tips ul {
    margin: 0;
    padding-left: 20px;
}

.game-tips li {
    margin-bottom: 8px;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.9);
}

.hint-text {
    background: rgba(255, 255, 255, 0.1);
    padding: 20px;
    border-radius: 10px;
    margin: 20px 0;
    line-height: 1.6;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.message-area {
    background: linear-gradient(135deg, #43e97b, #38f9d7);
    color: white;
    padding: 15px 20px;
    border-radius: 10px;
    margin: 20px 0;
    text-align: center;
    font-weight: 500;
    box-shadow: 0 4px 15px rgba(67, 233, 123, 0.3);
    animation: slideIn 0.5s ease-out;
}

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

/* 响应式设计 */
@media (max-width: 768px) {
    .game-container {
        margin: 10px;
        padding: 15px;
    }
    
    .game-header h1 {
        font-size: 1.8rem;
    }
    
    .game-stats {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .game-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .control-buttons {
        justify-content: center;
    }
    
    .puzzle-board.size-3 {
        width: 280px;
        height: 280px;
    }
    
    .puzzle-board.size-4 {
        width: 300px;
        height: 300px;
    }
    
    .puzzle-board.size-5 {
        width: 320px;
        height: 320px;
    }
    
    .puzzle-tile {
        font-size: 1.2rem;
    }
    
    .instructions-grid {
        grid-template-columns: 1fr;
    }
    
    .win-stats {
        grid-template-columns: 1fr;
    }
    
    .win-buttons {
        flex-direction: column;
        align-items: stretch;
    }
}

@media (max-width: 480px) {
    .game-header h1 {
        font-size: 1.8rem;
    }
    
    .puzzle-board.size-3 {
        width: 240px;
        height: 240px;
    }
    
    .puzzle-board.size-4 {
        width: 260px;
        height: 260px;
    }
    
    .puzzle-board.size-5 {
        width: 280px;
        height: 280px;
    }
    
    .puzzle-tile {
        font-size: 1rem;
    }
    
    .button {
        padding: 8px 16px;
        font-size: 0.9rem;
    }
    
    .win-content, .hint-content {
        padding: 30px 20px;
    }
}