/* Game-specific styles for Cute Minesweeper */

/* Game Section */
.game-section {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 3rem 5%;
    gap: 2rem;
    min-height: calc(100vh - 200px);
}

.game-container {
    background-color: white;
    border-radius: var(--border-radius);
    padding: 2rem;
    box-shadow: var(--shadow);
    max-width: 800px;
    width: 100%;
}

.game-title {
    text-align: center;
    margin-bottom: 2rem;
    font-size: 2.5rem;
}

/* Game Controls */
.game-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    margin-bottom: 2rem;
    align-items: center;
    justify-content: space-between;
}

.difficulty-selector {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.difficulty-selector label {
    font-weight: 600;
    font-size: 1.1rem;
}

.difficulty-selector select {
    padding: 0.5rem 1rem;
    border: 3px solid var(--secondary-color);
    border-radius: 50px;
    font-family: 'Nunito', sans-serif;
    font-size: 1rem;
    background-color: white;
    cursor: pointer;
    transition: all 0.3s ease;
}

.difficulty-selector select:hover {
    border-color: var(--primary-color);
    transform: translateY(-2px);
}

.game-info {
    display: flex;
    gap: 2rem;
}

.info-item {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    background-color: var(--light-color);
    padding: 0.8rem 1.2rem;
    border-radius: 50px;
    box-shadow: var(--shadow);
}

.info-icon {
    font-size: 1.5rem;
    color: var(--primary-color);
}

.info-value {
    font-family: 'Bubblegum Sans', cursive;
    font-size: 1.8rem;
    font-weight: bold;
    color: var(--dark-color);
}

.game-buttons {
    display: flex;
    gap: 1rem;
}

/* Game Board */
.game-board-container {
    display: flex;
    justify-content: center;
    margin-bottom: 2rem;
    overflow: auto;
    padding: 1rem;
    background-color: var(--light-color);
    border-radius: var(--border-radius);
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.05);
}

.game-board {
    display: grid;
    gap: 2px;
    padding: 1rem;
    background-color: var(--secondary-color);
    border-radius: 10px;
    box-shadow: var(--shadow);
    max-width: 100%;
    overflow: hidden;
}

/* Hard模式下的等比例缩小样式 */
.game-board.hard-mode {
    gap: 1px;
    padding: 0.5rem;
}

.game-board.hard-mode .tile {
    width: 22px;
    height: 22px;
    font-size: 0.8rem;
    border-radius: 4px;
    border-width: 2px;
}

/* 确保Hard模式下的图标也等比例缩小 */
.game-board.hard-mode .tile.flagged::before,
.game-board.hard-mode .tile.bomb.revealed::before {
    width: 16px;
    height: 16px;
}

/* Medium模式下的样式（稍微调整） */
.game-board.medium-mode {
    gap: 1.5px;
}

.tile {
    width: 35px;
    height: 35px;
    background-color: #e9e9e9;
    border: 3px solid #ffffff;
    border-radius: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: bold;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
}

/* Tile hover effects */
.tile:hover:not(.revealed):not(.flagged) {
    transform: scale(1.05);
    background-color: #ffffff;
}

/* Revealed tiles */
.tile.revealed {
    background-color: #ffffff;
    cursor: default;
    transform: scale(0.98);
    box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.1);
}

/* Flagged tiles */
.tile.flagged {
    background-color: var(--accent-color);
}

.tile.flagged::before {
    content: '';
    display: inline-block;
    width: 24px;
    height: 24px;
    background-image: url('../images/flag.svg');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

/* Bomb tile */
.tile.bomb.revealed::before {
    content: '';
    display: inline-block;
    width: 24px;
    height: 24px;
    background-image: url('../images/bomb.svg');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

/* Bomb exploded */
.tile.bomb.exploded {
    background-color: var(--primary-color);
    animation: explode 0.5s ease;
}

@keyframes explode {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); background-color: #ff4444; }
    100% { transform: scale(0.95); }
}

/* Number colors */
.tile.number-1 { color: #4a6fa5; }
.tile.number-2 { color: #7b8e61; }
.tile.number-3 { color: #ff6b6b; }
.tile.number-4 { color: #5a4b81; }
.tile.number-5 { color: #cc6633; }
.tile.number-6 { color: #4ecdc4; }
.tile.number-7 { color: #292f36; }
.tile.number-8 { color: #999999; }

/* Game Message */
.game-message {
    text-align: center;
    padding: 1.5rem;
    border-radius: var(--border-radius);
    font-size: 1.5rem;
    font-weight: 600;
    transition: all 0.3s ease;
    min-height: 80px;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    padding-left: 2.5rem;
}

.game-message.win {
    background-color: rgba(78, 205, 196, 0.2);
    color: #2e8b86;
    border: 3px solid var(--secondary-color);
    animation: bounce 0.6s ease;
}

.game-message.lose {
    background-color: rgba(255, 107, 107, 0.2);
    color: #c74040;
    border: 3px solid var(--primary-color);
    animation: shake 0.6s ease;
}

.game-message.win::before {
    content: '';
    position: absolute;
    left: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    background-image: url('../images/smile.svg');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

.game-message.lose::before {
    content: '';
    position: absolute;
    left: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    background-image: url('../images/bomb.svg');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

@keyframes bounce {
    0%, 20%, 53%, 80%, 100% {
        transform: translate3d(0,0,0);
    }
    40%, 43% {
        transform: translate3d(0, -10px, 0);
    }
    70% {
        transform: translate3d(0, -5px, 0);
    }
    90% {
        transform: translate3d(0, -2px, 0);
    }
}

@keyframes shake {
    0%, 100% {
        transform: translate3d(0, 0, 0);
    }
    10%, 30%, 50%, 70%, 90% {
        transform: translate3d(-5px, 0, 0);
    }
    20%, 40%, 60%, 80% {
        transform: translate3d(5px, 0, 0);
    }
}

/* Game Sidebar */
.game-sidebar {
    background-color: white;
    border-radius: var(--border-radius);
    padding: 2rem;
    box-shadow: var(--shadow);
    width: 300px;
    height: fit-content;
}

.instructions, .game-stats {
    margin-bottom: 2rem;
}

.instructions h3, .game-stats h3 {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    margin-bottom: 1rem;
    color: var(--primary-color);
}

.instructions ul {
    list-style: none;
    padding-left: 0;
}

.instructions li {
    margin-bottom: 0.8rem;
    padding-left: 1.5rem;
    position: relative;
    font-size: 1rem;
}

.instructions li::before {
    content: '•';
    position: absolute;
    left: 0;
    color: var(--primary-color);
    font-size: 1.5rem;
    line-height: 1;
}

.stats-grid {
    display: grid;
    gap: 1rem;
}

.stat-item {
    background-color: var(--light-color);
    padding: 1rem;
    border-radius: 10px;
    box-shadow: var(--shadow);
}

.stat-label {
    font-size: 0.9rem;
    color: var(--dark-color);
    opacity: 0.8;
    margin-bottom: 0.3rem;
}

.stat-value {
    font-family: 'Bubblegum Sans', cursive;
    font-size: 1.3rem;
    color: var(--primary-color);
    font-weight: bold;
}

/* Responsive Design for Game */
@media (max-width: 1200px) {
    .game-section {
        flex-direction: column;
        align-items: center;
    }
    
    .game-sidebar {
        width: 100%;
        max-width: 800px;
    }
}

@media (max-width: 768px) {
    .game-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }
    
    .difficulty-selector {
        justify-content: center;
    }
    
    .game-info {
        justify-content: center;
    }
    
    .game-buttons {
        justify-content: center;
    }
    
    .tile {
        width: 30px;
        height: 30px;
        font-size: 1rem;
    }
    
    .game-board {
        padding: 0.5rem;
    }
}

/* 减小Hard模式下的单元格大小，使其能在大多数屏幕上完整显示 */
@media (max-width: 1200px) {
    .game-board {
        /* 限制棋盘最大宽度，使其能在大多数屏幕上完整显示 */
        max-width: 90vw;
    }
    
    .tile {
        width: 28px;
        height: 28px;
        font-size: 0.9rem;
    }
}

/* 为较小屏幕添加更严格的调整，确保Hard模式的16x30棋盘也能完整显示 */
@media (max-width: 1024px) {
    .tile {
        width: 24px;
        height: 24px;
        font-size: 0.8rem;
    }
    
    /* 确保图标也随之缩小 */
    .tile.flagged::before,
    .tile.bomb.revealed::before {
        width: 20px;
        height: 20px;
    }
}

@media (max-width: 480px) {
    .tile {
        width: 20px;
        height: 20px;
        font-size: 0.7rem;
    }
    
    /* 进一步缩小移动设备上的图标 */
    .tile.flagged::before,
    .tile.bomb.revealed::before {
        width: 16px;
        height: 16px;
    }
    
    .game-container {
        padding: 1.5rem 1rem;
    }
    
    .game-sidebar {
        padding: 1.5rem 1rem;
    }
    
    .game-title {
        font-size: 2rem;
    }
    
    .info-item {
        padding: 0.6rem 1rem;
    }
    
    .info-value {
        font-size: 1.5rem;
    }
}