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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #fff;
}

.container {
    text-align: center;
    padding: 2rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 20px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    max-width: 600px;
    width: 90%;
}

h1 {
    font-size: 3rem;
    margin-bottom: 2rem;
    text-shadow: 0 0 20px rgba(0, 150, 255, 0.5);
    letter-spacing: 4px;
}

.menu {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.btn {
    padding: 1rem 2rem;
    font-size: 1.2rem;
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
    color: white;
    text-decoration: none;
    border-radius: 10px;
    transition: transform 0.3s, box-shadow 0.3s;
    border: none;
    cursor: pointer;
}

.btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(0, 123, 255, 0.4);
}

.btn-secondary {
    background: linear-gradient(135deg, #6c757d 0%, #495057 100%);
}

.btn-secondary:hover {
    box-shadow: 0 10px 30px rgba(108, 117, 125, 0.4);
}

.form-group {
    margin-bottom: 1.5rem;
    text-align: left;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
    color: #aaa;
}

input[type="text"] {
    width: 100%;
    padding: 1rem;
    font-size: 1.2rem;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    outline: none;
    transition: border-color 0.3s;
}

input[type="text"]:focus {
    border-color: #007bff;
}

input[type="text"]::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.game-code {
    font-size: 2.5rem;
    letter-spacing: 8px;
    background: rgba(0, 123, 255, 0.2);
    padding: 1rem 2rem;
    border-radius: 10px;
    margin: 1.5rem 0;
    font-family: monospace;
    border: 2px solid #007bff;
}

.game-info {
    background: rgba(255, 255, 255, 0.05);
    padding: 1rem;
    border-radius: 10px;
    margin: 1rem 0;
}

.game-info p {
    margin: 0.5rem 0;
    color: #aaa;
}

.boards-container {
    display: flex;
    gap: 2rem;
    justify-content: center;
    flex-wrap: wrap;
    margin: 2rem 0;
}

.board-section {
    text-align: center;
}

.board-section h3 {
    margin-bottom: 1rem;
    color: #007bff;
}

.cell {
    width: 30px;
    height: 30px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.2s;
}

.cell:hover {
    background: rgba(255, 255, 255, 0.2);
}

.cell.ship {
    background: linear-gradient(135deg, #28a745 0%, #1e7e34 100%);
}

.cell.ship-carrier {
    background: none;
    background-image: url("img/carrier_full.png");
    background-size: 500% 100%;
    background-position: 0% 0;
    background-repeat: no-repeat;
}

.cell.ship-battleship {
    background: none;
    background-image: url("img/battleship_full.png");
    background-size: 400% 100%;
    background-position: 0% 0;
    background-repeat: no-repeat;
}

.cell.ship-cruiser {
    background: none;
    background-image: url("img/cruiser_full.png");
    background-size: 300% 100%;
    background-position: 0% 0;
    background-repeat: no-repeat;
}

.cell.ship-submarine {
    background: none;
    background-image: url("img/submarine_full.png");
    background-size: 300% 100%;
    background-position: 0% 0;
    background-repeat: no-repeat;
}

.cell.ship-destroyer {
    background: none;
    background-image: url("img/destroyer_full.png");
    background-size: 200% 100%;
    background-position: 0% 0;
    background-repeat: no-repeat;
}

.cell.ship-carrier-vertical {
    background: none;
    background-image: url("img/carrier_vertical.png");
    background-size: 100% 500%;
    background-position: 0 0;
    background-repeat: no-repeat;
}

.cell.ship-battleship-vertical {
    background: none;
    background-image: url("img/battleship_vertical.png");
    background-size: 100% 400%;
    background-position: 0 0;
    background-repeat: no-repeat;
}

.cell.ship-cruiser-vertical {
    background: none;
    background-image: url("img/cruiser_vertical.png");
    background-size: 100% 300%;
    background-position: 0 0;
    background-repeat: no-repeat;
}

.cell.ship-submarine-vertical {
    background: none;
    background-image: url("img/submarine_vertical.png");
    background-size: 100% 300%;
    background-position: 0 0;
    background-repeat: no-repeat;
}

.cell.ship-destroyer-vertical {
    background: none;
    background-image: url("img/destroyer_vertical.png");
    background-size: 100% 200%;
    background-position: 0 0;
    background-repeat: no-repeat;
}

.cell.hit {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
}

.cell.miss {
    background: linear-gradient(135deg, #6c757d 0%, #495057 100%);
}

.cell.sunk {
    position: relative;
}

.cell.sunk::before,
.cell.sunk::after {
    content: '';
    position: absolute;
    width: 80%;
    height: 3px;
    background: #fff;
    top: 50%;
    left: 10%;
    transform: translateY(-50%) rotate(45deg);
    pointer-events: none;
}

.cell.sunk::after {
    transform: translateY(-50%) rotate(-45deg);
}

.cell.preview {
    background: rgba(40, 167, 69, 0.5);
}

.cell.preview.ship-carrier { background-image: url("img/carrier_full.png"); background-size: 500% 100%; opacity: 0.7; }
.cell.preview.ship-battleship { background-image: url("img/battleship_full.png"); background-size: 400% 100%; opacity: 0.7; }
.cell.preview.ship-cruiser { background-image: url("img/cruiser_full.png"); background-size: 300% 100%; opacity: 0.7; }
.cell.preview.ship-submarine { background-image: url("img/submarine_full.png"); background-size: 300% 100%; opacity: 0.7; }
.cell.preview.ship-destroyer { background-image: url("img/destroyer_full.png"); background-size: 200% 100%; opacity: 0.7; }

.cell.preview.ship-carrier-vertical { background-image: url("img/carrier_vertical.png"); background-size: 100% 500%; opacity: 0.7; }
.cell.preview.ship-battleship-vertical { background-image: url("img/battleship_vertical.png"); background-size: 100% 400%; opacity: 0.7; }
.cell.preview.ship-cruiser-vertical { background-image: url("img/cruiser_vertical.png"); background-size: 100% 300%; opacity: 0.7; }
.cell.preview.ship-submarine-vertical { background-image: url("img/submarine_vertical.png"); background-size: 100% 300%; opacity: 0.7; }
.cell.preview.ship-destroyer-vertical { background-image: url("img/destroyer_vertical.png"); background-size: 100% 200%; opacity: 0.7; }

.status {
    font-size: 1.5rem;
    margin: 1rem 0;
    padding: 1rem;
    border-radius: 10px;
}

.status.your-turn {
    background: rgba(40, 167, 69, 0.2);
    border: 1px solid #28a745;
}

.status.waiting {
    background: rgba(255, 193, 7, 0.2);
    border: 1px solid #ffc107;
}

.status.winner {
    background: rgba(0, 123, 255, 0.2);
    border: 1px solid #007bff;
}

.ship-selector {
    margin: 1rem 0;
}

.ship-selector h3 {
    margin-bottom: 1rem;
}

.ship-list {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.ship-option {
    padding: 0.8rem 1.5rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.3s;
}

.ship-option:hover {
    background: rgba(255, 255, 255, 0.2);
}

.ship-option.selected {
    border-color: #007bff;
    background: rgba(0, 123, 255, 0.2);
}

.ship-option.placed {
    opacity: 0.5;
    cursor: not-allowed;
}

.error {
    background: rgba(220, 53, 69, 0.2);
    border: 1px solid #dc3545;
    padding: 1rem;
    border-radius: 10px;
    margin: 1rem 0;
}

.success {
    background: rgba(40, 167, 69, 0.2);
    border: 1px solid #28a745;
    padding: 1rem;
    border-radius: 10px;
    margin: 1rem 0;
}

.waiting-message {
    font-size: 1.2rem;
    color: #aaa;
    margin: 2rem 0;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.refresh-btn {
    margin-top: 1rem;
}

.column-headers, .row-headers {
    display: flex;
    gap: 2px;
    margin-bottom: 5px;
}

.column-header {
    width: 30px;
    text-align: center;
    color: #aaa;
    font-size: 0.8rem;
}

.row-header {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 30px;
    color: #aaa;
    font-size: 0.8rem;
    width: 20px;
}

.board-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.board-grid {
    display: grid;
    /* 11 columns: 1 for row numbers + 10 for board cells */
    grid-template-columns: 30px repeat(10, 30px);
    /* 11 rows: 1 for column letters + 10 for board cells */
    grid-template-rows: 30px repeat(10, 30px);
    gap: 1px;
    background: rgba(255, 255, 255, 0.1);
    padding: 5px;
    border-radius: 10px;
}

.board-grid .corner-cell {
    width: 30px;
    height: 30px;
}

.board-grid .col-header {
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #aaa;
    font-size: 0.85rem;
    font-weight: bold;
}

.board-grid .row-header {
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #aaa;
    font-size: 0.85rem;
    font-weight: bold;
}

.rotate-btn {
    margin-top: 1rem;
    padding: 0.5rem 1rem;
    font-size: 1rem;
}

.orientation-indicator {
    margin-top: 0.5rem;
    color: #aaa;
    font-size: 0.9rem;
}