* {
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

/* 主菜单样式 */
.main-menu {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: url('IMAGE/背景.jpg') center center/cover no-repeat;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}





.menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 45px;
    align-items: center;
}

.menu-btn {
    position: relative;
    padding: 28px 70px;
    font-size: 36px;
    font-weight: 700;
    color: white;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    min-width: 350px;
    font-family: "Microsoft YaHei", "SimHei", sans-serif;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    letter-spacing: 1px;
}

/* 单人游戏按钮 - 绿色主题 */
.menu-btn:nth-child(1) {
    background: linear-gradient(135deg, #66BB6A 0%, #4CAF50 50%, #388E3C 100%);
    box-shadow:
        0 8px 25px rgba(76, 175, 80, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.menu-btn:nth-child(1):hover {
    background: linear-gradient(135deg, #4CAF50 0%, #388E3C 50%, #2E7D32 100%);
    transform: translateY(-5px) scale(1.02);
    box-shadow:
        0 15px 35px rgba(76, 175, 80, 0.6),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

/* 局域网联机按钮 - 橙色主题 */
.menu-btn:nth-child(2) {
    background: linear-gradient(135deg, #FFB74D 0%, #FF9800 50%, #F57C00 100%);
    box-shadow:
        0 8px 25px rgba(255, 152, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.menu-btn:nth-child(2):hover {
    background: linear-gradient(135deg, #FF9800 0%, #F57C00 50%, #E65100 100%);
    transform: translateY(-5px) scale(1.02);
    box-shadow:
        0 15px 35px rgba(255, 152, 0, 0.6),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

/* 远程联机按钮 - 蓝色主题 */
.menu-btn:nth-child(3) {
    background: linear-gradient(135deg, #64B5F6 0%, #2196F3 50%, #1976D2 100%);
    box-shadow:
        0 8px 25px rgba(33, 150, 243, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.menu-btn:nth-child(3):hover {
    background: linear-gradient(135deg, #2196F3 0%, #1976D2 50%, #1565C0 100%);
    transform: translateY(-5px) scale(1.02);
    box-shadow:
        0 15px 35px rgba(33, 150, 243, 0.6),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

/* 按钮按下效果 */
.menu-btn:active {
    transform: translateY(-2px) scale(0.98);
    transition: all 0.1s ease;
}

/* 按钮聚焦效果 */
.menu-btn:focus {
    outline: none;
    box-shadow:
        0 0 0 3px rgba(255, 255, 255, 0.5),
        0 8px 25px rgba(0, 0, 0, 0.3);
}

/* 添加按钮图标效果 */
.menu-btn:nth-child(1):after {
    content: '🎮';
    position: absolute;
    right: 25px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 28px;
    opacity: 0.8;
    transition: all 0.3s ease;
}

.menu-btn:nth-child(1):hover:after {
    transform: translateY(-50%) scale(1.2);
    opacity: 1;
}

.menu-btn:nth-child(2):after {
    content: '🌐';
    position: absolute;
    right: 25px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 28px;
    opacity: 0.8;
    transition: all 0.3s ease;
}

.menu-btn:nth-child(2):hover:after {
    transform: translateY(-50%) scale(1.2);
    opacity: 1;
}

.menu-btn:nth-child(3):after {
    content: '☁️';
    position: absolute;
    right: 25px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 28px;
    opacity: 0.8;
    transition: all 0.3s ease;
}

.menu-btn:nth-child(3):hover:after {
    transform: translateY(-50%) scale(1.2);
    opacity: 1;
}

/* 按钮脉冲动画效果 */
@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.4);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(255, 255, 255, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(255, 255, 255, 0);
    }
}

.menu-btn:hover {
    animation: pulse 2s infinite;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .menu-btn {
        padding: 20px 50px;
        font-size: 28px;
        min-width: 280px;
    }

    .menu-btn:nth-child(1):after,
    .menu-btn:nth-child(2):after,
    .menu-btn:nth-child(3):after {
        font-size: 22px;
        right: 20px;
    }
}

@media (max-width: 480px) {
    .menu-btn {
        padding: 16px 40px;
        font-size: 24px;
        min-width: 240px;
    }

    .menu-btn:nth-child(1):after,
    .menu-btn:nth-child(2):after,
    .menu-btn:nth-child(3):after {
        font-size: 20px;
        right: 15px;
    }
}

.game-container {
    text-align: center;
    margin: 0;
    padding: 1vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1vh;
    position: relative;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
}

.setup-container {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    width: 100%;
    height: 100%;
    margin: 0;
    position: relative;
    gap: 2vw;
    padding: 8vh 1vw 0 1vw;
}

.piece-storage {
    width: 12vw;
    min-width: 120px;
    max-width: 180px;
    padding: 1.5vh 1vw;
    border: 2px solid #8B4513;
    border-radius: 10px;
    background-color: #F5DEB3;
    margin-top: 9vh;
    flex-shrink: 0;
}

.piece-storage h3 {
    margin: 0 0 1vh 0;
    font-size: clamp(12px, 1.2vw, 18px);
    color: #8B4513;
}

.storage-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5vw;
    min-height: 30vh;
    max-height: 50vh;
}

.storage-slot {
    width: min(4.5vw, 5vh);
    height: min(4.5vw, 5vh);
    min-width: 40px;
    min-height: 40px;
    max-width: 70px;
    max-height: 70px;
    border: 1px dashed #8B4513;
    border-radius: 5px;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

.storage-slot.drag-over {
    background-color: rgba(0, 255, 0, 0.3);
    border-color: #00ff00;
}

.storage-slot.drag-over-invalid {
    background-color: rgba(255, 0, 0, 0.3);
    border-color: #ff0000;
    border-width: 2px;
}

.storage-slot.selected {
    background-color: rgba(0, 0, 255, 0.3);
    border-color: #0000ff;
    border-width: 3px;
}

.position.available-placement {
    background-color: rgba(0, 255, 0, 0.5) !important;
    border: 2px solid #00ff00 !important;
}

.position.available-placement:hover {
    background-color: rgba(0, 255, 0, 0.7) !important;
}

.piece-count {
    position: absolute;
    top: -5px;
    right: -5px;
    background-color: #ff0000;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 12px;
    font-weight: bold;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 15;
}

.draggable-piece {
    width: min(4vw, 4.5vh) !important;
    height: min(4vw, 4.5vh) !important;
    min-width: 35px !important;
    min-height: 35px !important;
    max-width: 60px !important;
    max-height: 60px !important;
    cursor: grab;
    position: relative;
    z-index: 10;
    transition: transform 0.2s;
}

.draggable-piece:hover {
    transform: scale(1.1);
}

.draggable-piece.dragging {
    cursor: grabbing;
    transform: scale(1.2);
    z-index: 1000;
    opacity: 0.8;
}

.start-game-btn {
    padding: 1vh 2vw;
    font-size: clamp(12px, 1.4vw, 20px);
    font-weight: bold;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.3s;
    min-height: 40px;
}

.start-game-btn:hover {
    background-color: #45a049;
}

.start-game-btn:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
}

.position.drag-over-valid {
    background-color: rgba(0, 255, 0, 0.3) !important;
    width: min(6vw, 7vh) !important;
    height: min(6vw, 7vh) !important;
}

.position.drag-over-invalid {
    background-color: rgba(255, 0, 0, 0.3) !important;
    width: min(6vw, 7vh) !important;
    height: min(6vw, 7vh) !important;
}

.victory-message {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 28px;
    font-weight: bold;
    color: #ff0000;
    background-color: #ffff99;
    padding: 20px 30px;
    border: 4px solid #ff0000;
    border-radius: 15px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    z-index: 1000;
    text-align: center;
    min-width: 300px;
    display: none;
}

.connection-status {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: bold;
    z-index: 1500;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.connection-status.connecting {
    background-color: #FF9800;
    color: white;
    border: 2px solid #F57C00;
}

.connection-status.connected {
    background-color: #4CAF50;
    color: white;
    border: 2px solid #45a049;
}

.connection-status.disconnected {
    background-color: #f44336;
    color: white;
    border: 2px solid #d32f2f;
}

.chessboard {
    position: relative;
    width: min(60vw, 70vh);
    height: min(67.5vw, 78.75vh);
    margin: 0;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    flex-shrink: 0;
}

.chessboard img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.grid {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    display: grid;
    grid-template-columns: repeat(9, 1fr);
    grid-template-rows: repeat(5, 1fr) repeat(3, 0.96fr) repeat(2, 1fr);
    justify-content: space-evenly;
    padding: 2% 4%;
    column-gap: 2.2vw;
}

.position {
    border: 1px solid transparent;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    position: relative;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

.chess-piece {
    width: min(6vw, 7vh) !important;
    height: min(6vw, 7vh) !important;
    min-width: 40px !important;
    min-height: 40px !important;
    max-width: 80px !important;
    max-height: 80px !important;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 3;
    pointer-events: auto;
    object-fit: contain;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

/* 四个角的三角框架 - 蓝色（选中棋子） - 围绕棋子图片 */
.position.selected .corner-frame {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: min(6vw, 7vh);
    height: min(6vw, 7vh);
    pointer-events: none;
    z-index: 5;
}

/* 左上角三角框 - 更大 */
.position.selected .corner-frame::before {
    content: '';
    position: absolute;
    top: -0.3vw;
    left: -0.3vw;
    width: 0;
    height: 0;
    border-left: 1.0vw solid #0064FF;
    border-bottom: 1.0vw solid transparent;
}

/* 右上角三角框 - 更大 */
.position.selected .corner-frame::after {
    content: '';
    position: absolute;
    top: -0.3vw;
    right: -0.3vw;
    width: 0;
    height: 0;
    border-right: 1.0vw solid #0064FF;
    border-bottom: 1.0vw solid transparent;
}

.position.selected .corner-bottom {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: min(6vw, 7vh);
    height: min(6vw, 7vh);
    pointer-events: none;
    z-index: 5;
}

/* 左下角三角框 - 更大 */
.position.selected .corner-bottom::before {
    content: '';
    position: absolute;
    bottom: -0.3vw;
    left: -0.3vw;
    width: 0;
    height: 0;
    border-left: 1.0vw solid #0064FF;
    border-top: 1.0vw solid transparent;
}

/* 右下角三角框 - 更大 */
.position.selected .corner-bottom::after {
    content: '';
    position: absolute;
    bottom: -0.3vw;
    right: -0.3vw;
    width: 0;
    height: 0;
    border-right: 1.0vw solid #0064FF;
    border-top: 1.0vw solid transparent;
}

/* 四个角的三角框架 - 红色（空位点击） - 围绕空位 */
.position.empty-target .corner-frame {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: min(6vw, 7vh);
    height: min(6vw, 7vh);
    pointer-events: none;
    z-index: 5;
}

/* 左上角三角框 - 红色 */
.position.empty-target .corner-frame::before {
    content: '';
    position: absolute;
    top: -0.3vw;
    left: -0.3vw;
    width: 0;
    height: 0;
    border-left: 1.0vw solid red;
    border-bottom: 1.0vw solid transparent;
}

/* 右上角三角框 - 红色 */
.position.empty-target .corner-frame::after {
    content: '';
    position: absolute;
    top: -0.3vw;
    right: -0.3vw;
    width: 0;
    height: 0;
    border-right: 1.0vw solid red;
    border-bottom: 1.0vw solid transparent;
}

.position.empty-target .corner-bottom {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: min(6vw, 7vh);
    height: min(6vw, 7vh);
    pointer-events: none;
    z-index: 5;
}

/* 左下角三角框 - 红色 */
.position.empty-target .corner-bottom::before {
    content: '';
    position: absolute;
    bottom: -0.3vw;
    left: -0.3vw;
    width: 0;
    height: 0;
    border-left: 1.0vw solid red;
    border-top: 1.0vw solid transparent;
}

/* 右下角三角框 - 红色 */
.position.empty-target .corner-bottom::after {
    content: '';
    position: absolute;
    bottom: -0.3vw;
    right: -0.3vw;
    width: 0;
    height: 0;
    border-right: 1.0vw solid red;
    border-top: 1.0vw solid transparent;
}

/* 四个角的三角框架 - 红色（移动历史起点） - 围绕棋子图片或空位 */
.position.move-from .corner-frame {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: min(6vw, 7vh);
    height: min(6vw, 7vh);
    pointer-events: none;
    z-index: 5;
}

/* 左上角三角框 - 红色 */
.position.move-from .corner-frame::before {
    content: '';
    position: absolute;
    top: -0.3vw;
    left: -0.3vw;
    width: 0;
    height: 0;
    border-left: 1.0vw solid red;
    border-bottom: 1.0vw solid transparent;
}

/* 右上角三角框 - 红色 */
.position.move-from .corner-frame::after {
    content: '';
    position: absolute;
    top: -0.3vw;
    right: -0.3vw;
    width: 0;
    height: 0;
    border-right: 1.0vw solid red;
    border-bottom: 1.0vw solid transparent;
}

.position.move-from .corner-bottom {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: min(6vw, 7vh);
    height: min(6vw, 7vh);
    pointer-events: none;
    z-index: 5;
}

/* 左下角三角框 - 红色 */
.position.move-from .corner-bottom::before {
    content: '';
    position: absolute;
    bottom: -0.3vw;
    left: -0.3vw;
    width: 0;
    height: 0;
    border-left: 1.0vw solid red;
    border-top: 1.0vw solid transparent;
}

/* 右下角三角框 - 红色 */
.position.move-from .corner-bottom::after {
    content: '';
    position: absolute;
    bottom: -0.3vw;
    right: -0.3vw;
    width: 0;
    height: 0;
    border-right: 1.0vw solid red;
    border-top: 1.0vw solid transparent;
}

/* 四个角的三角框架 - 红色（移动历史终点） - 围绕棋子图片或空位 */
.position.move-to .corner-frame {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: min(6vw, 7vh);
    height: min(6vw, 7vh);
    pointer-events: none;
    z-index: 5;
}

/* 左上角三角框 - 红色 */
.position.move-to .corner-frame::before {
    content: '';
    position: absolute;
    top: -0.3vw;
    left: -0.3vw;
    width: 0;
    height: 0;
    border-left: 1.0vw solid red;
    border-bottom: 1.0vw solid transparent;
}

/* 右上角三角框 - 红色 */
.position.move-to .corner-frame::after {
    content: '';
    position: absolute;
    top: -0.3vw;
    right: -0.3vw;
    width: 0;
    height: 0;
    border-right: 1.0vw solid red;
    border-bottom: 1.0vw solid transparent;
}

.position.move-to .corner-bottom {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: min(6vw, 7vh);
    height: min(6vw, 7vh);
    pointer-events: none;
    z-index: 5;
}

/* 左下角三角框 - 红色 */
.position.move-to .corner-bottom::before {
    content: '';
    position: absolute;
    bottom: -0.3vw;
    left: -0.3vw;
    width: 0;
    height: 0;
    border-left: 1.0vw solid red;
    border-top: 1.0vw solid transparent;
}

/* 右下角三角框 - 红色 */
.position.move-to .corner-bottom::after {
    content: '';
    position: absolute;
    bottom: -0.3vw;
    right: -0.3vw;
    width: 0;
    height: 0;
    border-right: 1.0vw solid red;
    border-top: 1.0vw solid transparent;
}



/* 四个角的三角框架 - 红色（敌方移动起始点） - 围绕棋子图片 */
.position.enemy-move-from .corner-frame {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: min(6vw, 7vh);
    height: min(6vw, 7vh);
    pointer-events: none;
    z-index: 5;
}

/* 左上角三角框 - 红色 */
.position.enemy-move-from .corner-frame::before {
    content: '';
    position: absolute;
    top: -0.3vw;
    left: -0.3vw;
    width: 0;
    height: 0;
    border-left: 1.0vw solid red;
    border-bottom: 1.0vw solid transparent;
}

/* 右上角三角框 - 红色 */
.position.enemy-move-from .corner-frame::after {
    content: '';
    position: absolute;
    top: -0.3vw;
    right: -0.3vw;
    width: 0;
    height: 0;
    border-right: 1.0vw solid red;
    border-bottom: 1.0vw solid transparent;
}

.position.enemy-move-from .corner-bottom {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: min(6vw, 7vh);
    height: min(6vw, 7vh);
    pointer-events: none;
    z-index: 5;
}

/* 左下角三角框 - 红色 */
.position.enemy-move-from .corner-bottom::before {
    content: '';
    position: absolute;
    bottom: -0.3vw;
    left: -0.3vw;
    width: 0;
    height: 0;
    border-left: 1.0vw solid red;
    border-top: 1.0vw solid transparent;
}

/* 右下角三角框 - 红色 */
.position.enemy-move-from .corner-bottom::after {
    content: '';
    position: absolute;
    bottom: -0.3vw;
    right: -0.3vw;
    width: 0;
    height: 0;
    border-right: 1.0vw solid red;
    border-top: 1.0vw solid transparent;
}

/* 四个角的三角框架 - 红色（敌方移动终点） - 围绕目标位置 */
.position.enemy-move-to .corner-frame {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: min(6vw, 7vh);
    height: min(6vw, 7vh);
    pointer-events: none;
    z-index: 5;
}

/* 左上角三角框 - 红色 */
.position.enemy-move-to .corner-frame::before {
    content: '';
    position: absolute;
    top: -0.3vw;
    left: -0.3vw;
    width: 0;
    height: 0;
    border-left: 1.0vw solid red;
    border-bottom: 1.0vw solid transparent;
}

/* 右上角三角框 - 红色 */
.position.enemy-move-to .corner-frame::after {
    content: '';
    position: absolute;
    top: -0.3vw;
    right: -0.3vw;
    width: 0;
    height: 0;
    border-right: 1.0vw solid red;
    border-bottom: 1.0vw solid transparent;
}

.position.enemy-move-to .corner-bottom {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: min(6vw, 7vh);
    height: min(6vw, 7vh);
    pointer-events: none;
    z-index: 5;
}

/* 左下角三角框 - 红色 */
.position.enemy-move-to .corner-bottom::before {
    content: '';
    position: absolute;
    bottom: -0.3vw;
    left: -0.3vw;
    width: 0;
    height: 0;
    border-left: 1.0vw solid red;
    border-top: 1.0vw solid transparent;
}

/* 右下角三角框 - 红色 */
.position.enemy-move-to .corner-bottom::after {
    content: '';
    position: absolute;
    bottom: -0.3vw;
    right: -0.3vw;
    width: 0;
    height: 0;
    border-right: 1.0vw solid red;
    border-top: 1.0vw solid transparent;
}





/* 规则按钮样式 - 初始化阶段，使用固定定位 */
.rules-btn-setup {
    position: fixed;
    bottom: 5vh;
    right: 2vw;
    width: 12vw;
    min-width: 100px;
    max-width: 150px;
    padding: 1vh 1.5vw;
    margin: 0;
    font-size: clamp(12px, 1.4vw, 20px);
    z-index: 100;
}

/* 游戏阶段按钮组样式 */
.game-stage-buttons {
    position: fixed;
    bottom: 3vh;
    left: 2vw;
    display: flex;
    flex-direction: column;
    gap: 1vh;
    z-index: 100;
}

/* 单人模式下隐藏投降按钮 */
.single-player-mode .game-surrender-btn {
    display: none;
}

/* 游戏阶段返回按钮样式 */
.game-return-btn {
    width: 12vw;
    min-width: 100px;
    max-width: 150px;
    padding: 1vh 1.5vw;
    margin: 0;
    font-size: clamp(12px, 1.4vw, 20px);
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.game-return-btn:hover {
    background-color: #45a049;
}

/* 游戏阶段投降按钮样式 */
.game-surrender-btn {
    width: 12vw;
    min-width: 100px;
    max-width: 150px;
    padding: 1vh 1.5vw;
    margin: 0;
    font-size: clamp(12px, 1.4vw, 20px);
    background-color: #f44336;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.game-surrender-btn:hover {
    background-color: #d32f2f;
}

/* 规则按钮样式 - 游戏阶段，使用绝对定位 */
.rules-btn-game {
    position: fixed;
    bottom: 3vh;
    right: 2vw;
    width: 12vw;
    min-width: 100px;
    max-width: 150px;
    padding: 1vh 1.5vw;
    margin: 0;
    font-size: clamp(12px, 1.4vw, 20px);
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.3s;
    z-index: 100;
}

.rules-btn-game:hover {
    background-color: #45a049;
}

/* 确认对话框样式 */
.confirm-dialog {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    backdrop-filter: blur(5px);
}

.confirm-content {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 20px;
    padding: 40px;
    text-align: center;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    max-width: 400px;
    width: 90%;
    animation: confirmSlideIn 0.3s ease-out;
}

@keyframes confirmSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.confirm-icon {
    font-size: 60px;
    margin-bottom: 20px;
    animation: confirmIconPulse 2s infinite;
}

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

.confirm-content h2 {
    color: white;
    font-size: 28px;
    margin: 0 0 15px 0;
    font-weight: bold;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.confirm-content p {
    color: rgba(255, 255, 255, 0.9);
    font-size: 18px;
    margin: 0 0 30px 0;
    line-height: 1.5;
}

.confirm-buttons {
    display: flex;
    gap: 20px;
    justify-content: center;
}

.confirm-btn {
    padding: 15px 30px;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 100px;
}

.confirm-yes {
    background: linear-gradient(135deg, #ff6b6b, #ee5a24);
    color: white;
    box-shadow: 0 4px 15px rgba(238, 90, 36, 0.4);
}

.confirm-yes:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(238, 90, 36, 0.6);
}

.confirm-no {
    background: linear-gradient(135deg, #74b9ff, #0984e3);
    color: white;
    box-shadow: 0 4px 15px rgba(9, 132, 227, 0.4);
}

.confirm-no:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(9, 132, 227, 0.6);
}

/* 通知面板样式 */
.notification-panel {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    backdrop-filter: blur(5px);
}

.notification-content {
    background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
    border-radius: 20px;
    padding: 40px;
    text-align: center;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    max-width: 400px;
    width: 90%;
    animation: notificationSlideIn 0.3s ease-out;
}

@keyframes notificationSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.notification-icon {
    font-size: 60px;
    margin-bottom: 20px;
    animation: notificationIconBounce 1s ease-in-out infinite alternate;
}

@keyframes notificationIconBounce {
    from { transform: translateY(0); }
    to { transform: translateY(-10px); }
}

.notification-content h2 {
    color: #2d3436;
    font-size: 28px;
    margin: 0 0 15px 0;
    font-weight: bold;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.notification-content p {
    color: #636e72;
    font-size: 18px;
    margin: 0 0 30px 0;
    line-height: 1.5;
}

.notification-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

.notification-btn {
    padding: 15px 30px;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 120px;
    background: linear-gradient(135deg, #00b894, #00a085);
    color: white;
    box-shadow: 0 4px 15px rgba(0, 184, 148, 0.4);
}

.notification-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 184, 148, 0.6);
}

/* 返回按钮样式 - 初始化界面，使用固定定位 */
.return-btn {
    position: fixed;
    bottom: 5vh;
    left: 2vw;
    width: 12vw;
    min-width: 100px;
    max-width: 150px;
    padding: 1vh 1.5vw;
    margin: 0;
    font-size: clamp(12px, 1.4vw, 20px);
    z-index: 100;
}

/* 游戏阶段容器 */
.game-stage-container {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    width: 100%;
    height: 100vh;
    padding: 8vh 0 0 0;
}

/* 游戏阶段棋盘居中 */
.game-stage-container .chessboard {
    margin: 0 auto;
}

/* 规则面板样式 */
.rules-panel {
    position: fixed;
    top: 2vh;
    right: 2vw;
    width: min(30vw, 400px);
    max-width: 90vw;
    max-height: 80vh;
    background-color: #f5f5f5;
    border: 3px solid #4CAF50;
    border-radius: 15px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    overflow-y: auto;
}

.rules-content {
    padding: 20px;
}

.rules-content h2 {
    color: #4CAF50;
    text-align: center;
    margin: 0 0 20px 0;
    font-size: 24px;
    font-weight: bold;
}

.rules-content h3 {
    color: #2E7D32;
    margin: 15px 0 10px 0;
    font-size: 18px;
    font-weight: bold;
    border-bottom: 2px solid #4CAF50;
    padding-bottom: 5px;
}

.rules-text p {
    margin: 8px 0;
    line-height: 1.6;
    font-size: 14px;
    color: #333;
}

.rules-text strong {
    color: #1B5E20;
    font-weight: bold;
}

/* 规则主要文字样式 - 吃掉将 */
.rules-main-text {
    display: flex;
    flex-direction: column; /* 垂直排列，每个字一行 */
    justify-content: center;
    align-items: center;
    gap: 55px; /* 字与字之间55px间距 */
    margin: 20px 0;
}

.rules-main-text span {
    font-size: 120px; /* 字体大小改为120px */
    font-weight: bold;
    color: #1B5E20;
    text-align: center;
    display: inline-block;
}

/* 响应式媒体查询 */
@media screen and (max-width: 1200px) {
    .setup-container {
        flex-direction: column;
        align-items: center;
        gap: 2vh;
    }

    .chessboard {
        width: min(80vw, 60vh);
        height: min(90vw, 67.5vh);
        order: 2;
    }

    .piece-storage {
        width: 20vw;
        min-width: 150px;
        max-width: 200px;
    }

    .return-btn, .rules-btn-setup {
        position: fixed;
        bottom: 2vh;
    }

    .return-btn {
        left: 2vw;
    }

    .rules-btn-setup {
        right: 2vw;
    }
}

@media screen and (max-width: 768px) {
    .chessboard {
        width: 95vw;
        height: 106.875vw;
    }

    .piece-storage {
        width: 40vw;
        min-width: 180px;
    }

    .storage-grid {
        grid-template-columns: repeat(4, 1fr);
        min-height: 20vh;
    }

    .setup-container {
        flex-direction: column;
        padding: 0 2vw;
    }

    .rules-panel {
        width: 90vw;
        top: 5vh;
        right: 5vw;
    }
}

@media screen and (max-height: 600px) {
    .chessboard {
        width: min(50vw, 80vh);
        height: min(56.25vw, 90vh);
    }

    .piece-storage {
        margin-top: 1vh;
    }

    .storage-grid {
        min-height: 25vh;
        max-height: 35vh;
    }
}






