/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Microsoft YaHei', Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f0f8ff;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.hidden {
    display: none !important;
}

/* 标题样式 */
header {
    text-align: center;
    margin-bottom: 30px;
}

header h1 {
    font-size: 2.5rem;
    color: #0066cc;
    margin-bottom: 10px;
}

header p {
    font-size: 1.1rem;
    color: #666;
}

/* 区块样式 */
.section {
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    padding: 20px;
    margin-bottom: 30px;
}

.section h2 {
    color: #0066cc;
    margin-bottom: 20px;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}

/* 按钮样式 */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.btn:hover {
    opacity: 0.9;
}

.primary {
    background-color: #0066cc;
    color: white;
}

.secondary {
    background-color: #6c757d;
    color: white;
}

.danger {
    background-color: #dc3545;
    color: white;
}

/* 游戏设置区域 */
.setup-options {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 20px;
}

.option {
    flex: 1;
    min-width: 200px;
}

label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}

select, input {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.buttons {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
}

.join-game {
    display: flex;
    gap: 10px;
}

#room-id {
    width: 150px;
}

/* 游戏信息区域 */
#game-info {
    display: flex;
    justify-content: space-between;
}

.room-info, .player-info {
    flex: 1;
}

#game-info p {
    margin-bottom: 10px;
}

#game-info span {
    font-weight: bold;
    color: #0066cc;
}

/* 部署区域 */
#game-deployment .instruction {
    margin-bottom: 15px;
}

/* 游戏板样式 */
.board {
    display: grid;
    gap: 2px;
    margin: 20px 0;
    width: 100%;
    max-width: 400px;
}

.board.size-6 {
    grid-template-columns: repeat(6, 1fr);
}

.board.size-8 {
    grid-template-columns: repeat(8, 1fr);
}

.cell {
    aspect-ratio: 1;
    background-color: #81C7D4;
    border: 1px solid #5DA9B9;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.cell:hover {
    background-color: #A5D3DC;
}

.cell.ship {
    background-color: #4682B4;
}

.cell.hit {
    background-color: #CB1B45;
}

.cell.miss {
    background-color: #888888;
}

/* 预判模式特殊样式 */
.cell.ship.hit {
    background-color: #CB1B45; /* 红色优先显示 */
    border: 2px solid #4682B4; /* 蓝色边框表示是舰船 */
}

.cell.ship.miss {
    background-color: #888888; /* 灰色表示预判 */
    border: 2px solid #4682B4; /* 蓝色边框表示是舰船 */
}

/* 战斗区域 */
.boards-container {
    display: flex;
    flex-wrap: wrap;
    gap: 30px;
    justify-content: center;
}

.board-wrapper {
    flex: 1;
    min-width: 300px;
    max-width: 400px;
}

.board-wrapper h3 {
    text-align: center;
    margin-bottom: 10px;
    color: #0066cc;
}

.game-status {
    text-align: center;
    margin-top: 20px;
}

#battle-message {
    font-size: 1.2rem;
    margin-bottom: 15px;
    font-weight: bold;
}

/* 游戏结果区域 */
#game-result {
    text-align: center;
}

#result-message {
    font-size: 1.5rem;
    margin: 20px 0;
    font-weight: bold;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .boards-container {
        flex-direction: column;
        align-items: center;
    }
    
    .board-wrapper {
        width: 100%;
    }
    
    .setup-options {
        flex-direction: column;
    }
    
    .buttons {
        flex-direction: column;
        gap: 15px;
    }
    
    .join-game {
        width: 100%;
    }
    
    #room-id {
        flex: 1;
    }
}