/**
 * 5x5 熄灯游戏样式
 */

/* 游戏容器优化 */
#game-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.game-board {
    display: inline-block;
    background: #f8f9fa;
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    margin: 0 auto !important;
    border: 1px solid #e9ecef;
    text-align: center;
    width: fit-content;
    position: relative;
}

.game-row {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
}

.game-cell {
    width: 60px;
    height: 60px;
    margin: 3px;
    border: 2px solid #dee2e6;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    user-select: none;
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
}

/* 大尺寸游戏的格子调整 */
.game-board[data-size="6"] .game-cell,
.game-board[data-size="7"] .game-cell,
.game-board[data-size="8"] .game-cell {
    width: 50px;
    height: 50px;
    font-size: 20px;
    margin: 2px;
}

.game-board[data-size="9"] .game-cell,
.game-board[data-size="10"] .game-cell {
    width: 45px;
    height: 45px;
    font-size: 18px;
    margin: 2px;
}

.game-cell:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.2);
    z-index: 1;
}

.game-cell:active {
    transform: scale(0.95);
}

.light-off {
    background-color: #ffffff;
    color: #6c757d;
    border-color: #adb5bd;
}

.light-on {
    background: linear-gradient(135deg, #ffc107, #ffb300);
    color: #ffffff;
    box-shadow: 0 0 20px rgba(255, 193, 7, 0.6);
    border-color: #ffc107;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* 状态显示优化 */
.status-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    padding: 12px 16px;
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border-radius: 8px;
    border: 1px solid #dee2e6;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.status-item:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.status-item i {
    font-size: 20px;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .game-cell {
        width: 50px;
        height: 50px;
        font-size: 20px;
        margin: 2px;
    }

    .game-board {
        padding: 20px;
        border-radius: 12px;
    }

    .status-item {
        font-size: 14px;
        padding: 8px 12px;
        gap: 6px;
    }

    #game-container {
        padding: 15px;
    }

    /* 移动端按钮优化 */
    .btn {
        padding: 6px 12px;
        font-size: 14px;
    }

    /* 移动端卡片优化 */
    .card-body {
        padding: 20px;
    }

    /* 移动端表单优化 */
    .form-select,
    .form-control {
        font-size: 14px;
        padding: 8px 12px;
    }
}

@media (max-width: 576px) {
    .game-cell {
        width: 45px;
        height: 45px;
        font-size: 18px;
        margin: 1px;
    }

    .game-board {
        padding: 15px;
        border-radius: 10px;
    }

    .status-item {
        font-size: 12px;
        padding: 6px 8px;
        gap: 4px;
    }

    #game-container {
        padding: 10px;
    }

    /* 小屏幕按钮优化 */
    .btn {
        padding: 5px 10px;
        font-size: 12px;
        margin-bottom: 5px;
    }

    /* 小屏幕卡片优化 */
    .card-body {
        padding: 15px;
    }

    /* 小屏幕表单优化 */
    .form-select,
    .form-control {
        font-size: 12px;
        padding: 6px 10px;
    }

    /* 小屏幕标题优化 */
    h3 {
        font-size: 1.2rem;
    }

    /* 小屏幕说明文字优化 */
    .alert-info small {
        font-size: 12px;
        line-height: 1.4;
    }
}

@media (max-width: 480px) {
    .game-cell {
        width: 40px;
        height: 40px;
        font-size: 16px;
        margin: 1px;
    }

    .game-board {
        padding: 12px;
        border-radius: 8px;
    }

    .status-item {
        font-size: 11px;
        padding: 5px 6px;
        gap: 3px;
    }

    #game-container {
        padding: 8px;
    }

    /* 超小屏幕按钮优化 */
    .btn {
        padding: 4px 8px;
        font-size: 11px;
        margin-bottom: 3px;
    }

    /* 超小屏幕卡片优化 */
    .card-body {
        padding: 12px;
    }

    /* 超小屏幕表单优化 */
    .form-select,
    .form-control {
        font-size: 11px;
        padding: 5px 8px;
    }

    /* 超小屏幕标题优化 */
    h3 {
        font-size: 1.1rem;
    }

    /* 超小屏幕说明文字优化 */
    .alert-info small {
        font-size: 11px;
        line-height: 1.3;
    }

    /* 超小屏幕状态显示优化 */
    .d-flex.justify-content-center.align-items-center.gap-4.flex-wrap {
        gap: 0.5rem !important;
    }
}

/* 横屏模式优化 */
@media (max-width: 768px) and (orientation: landscape) {
    .game-cell {
        width: 35px;
        height: 35px;
        font-size: 14px;
        margin: 1px;
    }

    .game-board {
        padding: 10px;
    }

    .card-body {
        padding: 10px;
    }

    #game-container {
        padding: 8px;
    }
}

/* 触摸设备优化 */
@media (hover: none) and (pointer: coarse) {
    .game-cell:hover {
        transform: none;
    }

    .btn:hover {
        transform: none;
    }

    .status-item:hover {
        transform: none;
    }

    /* 增加触摸目标大小 */
    .game-cell {
        min-width: 44px;
        min-height: 44px;
    }

    .btn {
        min-height: 44px;
    }
}

/* 游戏完成动画 */
@keyframes winPulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }

    100% {
        transform: scale(1);
    }
}

.game-cell.win-animation {
    animation: winPulse 0.5s ease-in-out;
}

/* 提示动画 */
@keyframes hintGlow {
    0% {
        box-shadow: 0 0 5px #ff6b6b;
    }

    50% {
        box-shadow: 0 0 20px #ff6b6b;
    }

    100% {
        box-shadow: 0 0 5px #ff6b6b;
    }
}

.game-cell.hint {
    animation: hintGlow 1s ease-in-out;
}

/* 按钮样式增强 */
.btn {
    transition: all 0.3s ease;
    border-radius: 8px;
    font-weight: 500;
    padding: 8px 16px;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.2);
}

.btn:active {
    transform: translateY(0);
}

/* 成功消息样式 */
#success {
    font-weight: bold;
    font-size: 18px;
    color: #198754;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* 游戏说明样式 */
.alert-info {
    border-left: 4px solid #17a2b8;
    border-radius: 8px;
    background: linear-gradient(135deg, #d1ecf1, #bee5eb);
}

/* 标题样式 */
h3 i {
    margin-right: 10px;
    color: #ffc107;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* 卡片样式优化 */
.card {
    border-radius: 15px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    border: none;
}

.card-header {
    border-radius: 15px 15px 0 0 !important;
    background: linear-gradient(135deg, #007bff, #0056b3) !important;
}

.card-body {
    padding: 30px;
}

.card-footer {
    border-radius: 0 0 15px 15px !important;
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
}

/* 表单控件样式 */
.form-select,
.form-control {
    border-radius: 8px;
    border: 2px solid #dee2e6;
    transition: all 0.3s ease;
}

.form-select:focus,
.form-control:focus {
    border-color: #007bff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

/* 游戏板阴影效果 */
.game-board::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0));
    border-radius: 15px;
    pointer-events: none;
}

/* 游戏板包装层样式 */
.game-board-wrapper {
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    width: 100% !important;
    min-height: 200px;
}

/* 强制居中样式 */
.d-flex.justify-content-center {
    width: 100%;
    display: flex !important;
    justify-content: center !important;
}

/* 确保游戏板容器居中 */
#game-container>div:has(.game-board) {
    display: flex !important;
    justify-content: center !important;
    width: 100%;
}

/* 强制游戏板居中 */
#game-board {
    margin-left: auto !important;
    margin-right: auto !important;
    display: inline-block !important;
}

/* 确保游戏行居中 */
.game-row {
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    width: 100% !important;
}

/* 游戏板容器强制居中 */
.game-board-container {
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    width: 100% !important;
}