/* Basic Reset & Body Styles */
body {
    margin: 0;
    padding: 0;
    font-family: 'Space Mono', monospace; /* Futuristic font */
    background: linear-gradient(135deg, #0f0f0f 0%, #1a1a1a 100%); /* Dark, subtle gradient */
    color: #00ffcc; /* Neon green text */
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    overflow-x: hidden; /* Prevent horizontal scroll */
}

/* Debug Outlines - Now part of base styling for visibility */
#game-layout-container {
    border: 2px dashed yellow;
}
.board-section {
    border: 2px dashed orange;
}
#control-column {
    border: 2px dashed lightblue;
}

/* Main Container for Battleship Game */
.battleship-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    background-color: rgba(0, 0, 0, 0.7); /* Semi-transparent background */
    border-radius: 10px;
    box-shadow: 0 0 20px rgba(0, 255, 204, 0.5); /* Neon glow effect */
    max-width: 1200px;
    width: 95%;
    margin-top: 20px;
    margin-bottom: 20px;
}

h1 {
    color: #00ffff; /* Brighter neon blue for title */
    text-shadow: 0 0 10px #00ffff, 0 0 20px #00ffff;
    margin-bottom: 30px;
    font-size: 2.5em;
}

h2 {
    color: #00ffcc;
    margin-top: 15px;
    margin-bottom: 10px;
    font-size: 1.5em;
}

/* Game Layout Container */
#game-layout-container {
    display: grid;
    grid-template-columns: 1fr auto 1fr; /* Player 1 Board | Center Column | Player 2 Board */
    gap: 30px;
    width: 100%;
    align-items: flex-start; /* Align items to the top */
    margin-top: 20px;
}

/* Board Section Styling */
.board-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    background-color: rgba(0, 50, 50, 0.3);
    padding: 15px;
    border-radius: 8px;
    box-shadow: inset 0 0 8px rgba(0, 255, 204, 0.3);
    flex-grow: 1; /* Allow boards to grow */
}

/* Battle Grid Styling */
.battle-grid {
    display: grid;
    grid-template-columns: repeat(10, 30px); /* 10x10 grid of 30px cells */
    grid-template-rows: repeat(10, 30px);
    width: 300px; /* 10 * 30px */
    height: 300px; /* 10 * 30px */
    border: 2px solid #00ffff;
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.5);
    background-color: #0a0a0a;
    margin-top: 10px;
}

/* Individual Cell Styling */
.cell {
    width: 30px;
    height: 30px;
    border: 1px solid #005544; /* Darker neon border for cells */
    box-sizing: border-box; /* Include padding/border in element's total width and height */
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 0.7em;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.1s ease;
}

.cell:hover {
    background-color: rgba(0, 255, 204, 0.2);
}

/* Cell States */
.cell.ship {
    background-color: rgba(0, 150, 200, 0.7); /* Blueish for ships */
    border-color: #00ffff;
}

.cell.hit {
    background-color: #ff0066; /* Neon red for hits */
    border-color: #ff0066;
    box-shadow: 0 0 8px #ff0066;
    animation: pulse-hit 0.5s infinite alternate;
}

.cell.miss {
    background-color: #333333; /* Dark grey for misses */
    border-color: #555555;
    position: relative;
}
.cell.miss::before {
    content: 'X';
    color: rgba(255, 255, 255, 0.5);
    font-weight: bold;
    font-size: 1.2em;
}

.cell.hover.valid {
    background-color: rgba(0, 255, 0, 0.3); /* Green for valid placement hover */
    border-color: #0f0;
}

.cell.hover.invalid {
    background-color: rgba(255, 0, 0, 0.3); /* Red for invalid placement hover */
    border-color: #f00;
}


/* Center Control Column */
#control-column {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    padding: 20px;
    background-color: rgba(0, 0, 0, 0.8);
    border-radius: 10px;
    box-shadow: 0 0 15px rgba(0, 255, 204, 0.4);
    min-width: 250px; /* Ensure it has some width */
}

.game-message {
    color: #00ffcc;
    font-size: 1.1em;
    text-align: center;
    min-height: 40px; /* Reserve space */
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(0, 0, 0, 0.6);
    border: 1px solid #00ffff;
    padding: 10px;
    border-radius: 5px;
    width: 100%;
    box-sizing: border-box;
}

.controls-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
    align-items: center;
}

.game-button {
    background: linear-gradient(45deg, #00ffff, #00ffcc); /* Neon gradient button */
    color: #000;
    border: none;
    padding: 12px 25px;
    font-size: 1em;
    font-weight: bold;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.5);
    width: 80%; /* Make buttons take up more width */
    max-width: 200px;
}

.game-button:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.8);
    background: linear-gradient(45deg, #00ffcc, #00ffff);
}

.game-button:active {
    transform: translateY(0);
    box-shadow: 0 0 5px rgba(0, 255, 255, 0.5);
}

/* Specific Ship Colors (optional for more flair) */
.ship-carrier { background-color: rgba(100, 100, 255, 0.7); } /* Darker blue */
.ship-battleship { background-color: rgba(0, 150, 255, 0.7); }
.ship-destroyer { background-color: rgba(0, 200, 200, 0.7); }
.ship-submarine { background-color: rgba(50, 200, 150, 0.7); }
.ship-patrolboat { background-color: rgba(150, 255, 100, 0.7); }


/* Keyframe Animations */
@keyframes pulse-hit {
    0% { box-shadow: 0 0 8px #ff0066; }
    100% { box-shadow: 0 0 15px #ff0066, 0 0 20px #ff0066; }
}

/* Responsive Design */
@media (max-width: 900px) {
    #game-layout-container {
        grid-template-columns: 1fr; /* Stack vertically on smaller screens */
        gap: 20px;
    }

    .battleship-container {
        padding: 10px;
    }

    h1 {
        font-size: 1.8em;
    }

    .board-section {
        width: 100%; /* Take full width */
    }

    #control-column {
        width: 100%;
        min-width: unset;
    }
}

@media (max-width: 480px) {
    .battle-grid {
        grid-template-columns: repeat(10, 25px);
        grid-template-rows: repeat(10, 25px);
        width: 250px;
        height: 250px;
    }

    .cell {
        width: 25px;
        height: 25px;
    }

    .game-button {
        padding: 10px 15px;
        font-size: 0.9em;
    }
}
