* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, #1e3c72, #2a5298);
    color: white;
    min-height: 100vh;
    padding: 10px;
    overflow-x: auto;
}

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

h1 {
    text-align: center;
    margin-bottom: 20px;
    font-size: 2.2em;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.game-mode-selection {
    text-align: center;
    margin-bottom: 30px;
    background: rgba(0,0,0,0.3);
    padding: 30px;
    border-radius: 10px;
}

.game-mode-selection h2 {
    margin-bottom: 20px;
    font-size: 1.8em;
}

.mode-btn {
    background-color: #4a90e2;
    color: white;
    border: none;
    padding: 15px 30px;
    margin: 10px;
    border-radius: 8px;
    font-size: 1.2em;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 150px;
}

.mode-btn:hover {
    background-color: #5ba3f5;
    transform: translateY(-2px);
}

.game-info {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin-bottom: 30px;
    font-size: 1.2em;
}

.game-boards {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.player-section, .opponent-section {
    text-align: center;
}

.opponent-section {
    width: fit-content;
    margin: 0 auto;
}

.player-section h2, .opponent-section h2 {
    margin-bottom: 20px;
    font-size: 1.5em;
}

.board {
    display: grid;
    grid-template-columns: repeat(10, 40px);
    grid-template-rows: repeat(10, 40px);
    gap: 2px;
    background-color: rgba(0,0,0,0.3);
    padding: 10px;
    border-radius: 8px;
    margin: 0 auto;
}

.cell {
    width: 40px;
    height: 40px;
    background-color: #4a90e2;
    border: 1px solid #2c5282;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    transition: all 0.2s ease;
}

.cell:hover {
    background-color: #5ba3f5;
}

.cell.ship {
    background-color: #2d3748;
    border-color: #1a202c;
}

.cell.hit {
    background-color: #e53e3e;
    color: white;
}

.cell.hit::after {
    content: '💥';
    font-size: 16px;
}

.cell.miss {
    background-color: #90cdf4;
    color: #2c5282;
}

.cell.miss::after {
    content: '○';
    font-size: 20px;
}

.cell.sunk {
    background-color: #742a2a;
}

.cell.preview {
    background-color: rgba(45, 55, 72, 0.7);
    border-color: #90cdf4;
}

.cell.invalid {
    background-color: rgba(229, 62, 62, 0.7);
}

.ships-to-place {
    margin-top: 20px;
    background: rgba(0,0,0,0.2);
    padding: 15px;
    border-radius: 8px;
    max-width: 300px;
}

.ships-to-place h3 {
    margin-bottom: 15px;
}

.ship-list {
    margin-bottom: 20px;
}

.ship-item {
    background-color: #4a90e2;
    margin: 3px 0;
    padding: 8px 12px;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.9em;
}

.ship-item:hover {
    background-color: #5ba3f5;
}

.ship-item.selected {
    background-color: #2d3748;
    border: 2px solid #90cdf4;
}

.ship-item.placed {
    background-color: #48bb78;
    cursor: not-allowed;
    opacity: 0.7;
}

button {
    background-color: #4a90e2;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    font-size: 0.9em;
    cursor: pointer;
    margin: 3px;
    transition: background-color 0.2s ease;
}

button:hover:not(:disabled) {
    background-color: #5ba3f5;
}

button:disabled {
    background-color: #a0a0a0;
    cursor: not-allowed;
}

#ready-btn {
    background-color: #48bb78;
}

#ready-btn:hover:not(:disabled) {
    background-color: #38a169;
}

.game-messages {
    text-align: center;
    margin-top: 15px;
}

#message-display {
    background: rgba(0,0,0,0.3);
    padding: 12px;
    border-radius: 8px;
    font-size: 1em;
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: 420px;
    margin: 0 auto;
}

.opponent-controls {
    margin-top: 15px;
    text-align: center;
}

#new-game-btn {
    background-color: #e53e3e;
    font-size: 0.9em;
    padding: 10px 20px;
}

#new-game-btn:hover {
    background-color: #c53030;
}

@media (max-width: 768px) {
    body {
        padding: 5px;
    }
    
    .game-boards {
        flex-direction: column;
        align-items: center;
        gap: 20px;
    }
    
    .board {
        grid-template-columns: repeat(10, 30px);
        grid-template-rows: repeat(10, 30px);
    }
    
    .cell {
        width: 30px;
        height: 30px;
    }
    
    h1 {
        font-size: 1.8em;
        margin-bottom: 15px;
    }
    
    .game-info {
        flex-direction: column;
        gap: 5px;
        margin-bottom: 15px;
    }
    
    .ships-to-place {
        margin-top: 15px;
        padding: 10px;
    }
    
    .ship-item {
        padding: 6px 10px;
        font-size: 0.8em;
    }
    
    button {
        padding: 8px 16px;
        font-size: 0.8em;
    }
}