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

body {
    font-family: Arial, sans-serif;
    text-align: center;
    background-color: #111;
    color: #eee;
}

.page_title {
    padding: 10px;
}

#authForm {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.7);
    justify-content: center;
    align-items: center;
}

#authForm.active {
    display: flex;
}

.header {
    display: flex;
    width: 100%;
    justify-content: space-between;
    align-items: center;
    padding: 15px 40px;
    background-color: #1a1a1a;
    color: white;
}

.logo {
    font-size: 1.4rem;
    font-weight: bold;
    letter-spacing: 1px;
}

.nav ul {
    list-style: none;
    display: flex;
    gap: 30px;
}

.nav a {
    text-decoration: none;
    color: white;
    font-weight: 500;
    transition: color 0.3s;
}

.nav a:hover {
    color: #00ff88;
}

.nav a.active {
    color: #00ff88;
}

.menu-item {
    cursor: pointer;
}

/* 📱 Адаптив */
@media (max-width: 700px) {
    .nav ul {
        flex-direction: column;
        background-color: #1a1a1a;
        position: absolute;
        top: 60px;
        right: 0;
        width: 200px;
        display: none;
        padding: 20px;
    }

    .nav.active ul {
        display: flex;
    }

    .header {
        position: relative;
    }
}

.page_title {
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 24px;
    font-weight: bold;
}

#player_panel_container {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

#player_container {
    display: flex;
    justify-content: center;
}

#enemy_container {
    display: flex;
    justify-content: center;
}

.battleButtonsContainer {
    display: flex;
    justify-content: center;
    gap: 15px;
}

.battle_menu_item {
    background: linear-gradient(180deg, #0b3b5b, #07334a);
    padding: 8px;
    border-radius: 12px;
}

#fields_container {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 20px;
}

#fields_container.active {
    display: flex;
}

/* #player_field {
    border: 3px solid yellowgreen;
    border-radius: 5px;
    height: fit-content;
}

#enemy_field {
    border: 3px solid red;
    border-radius: 5px;
} */

:root {
    --cell-size: 35px;
    --gap: 2px;
    --border-radius: 5px;
}



#left {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.palette {
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
    background: rgba(255, 255, 255, 0.03);
    padding: 5px;
    border-radius: 8px;
}

.palette_line {
    display: flex;
    gap: 8px;
    justify-content: center;
    align-items: center;
}

.palette .ship {
    width: fit-content;
    height: fit-content;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--gap);
    padding: 2px;
    border-radius: var(--border-radius);
    background: linear-gradient(180deg, #183b3b, #0b2a2a);
    cursor: grab;
    user-select: none;
    color: #fff;
    font-weight: 600;
}

.palette .ship.vertical {
    flex-direction: column;
}

/* visual of ship: each ship is a row of cells */
.ship .seg {
    width: var(--cell-size);
    height: var(--cell-size);
    /* margin: 2px; */
    background: linear-gradient(180deg, #5eead4, #2dd4bf);
    border-radius: var(--border-radius);
    box-shadow: inset 0 -6px 12px rgba(0, 0, 0, 0.25);
}

.board-wrap {
    position: relative;
    display: flex;
    width: fit-content;
    background: linear-gradient(180deg, #042403, #0f3b04);
    padding: 8px;
    border-radius: 8px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.6);
}

.board {
    display: grid;
    grid-template-columns: repeat(10, var(--cell-size));
    grid-template-rows: repeat(10, var(--cell-size));
    gap: var(--gap);
    position: relative;
    background: transparent;
    touch-action: none;
}

.enemy-wrap {
    position: relative;
    display: flex;
    width: fit-content;
    background: linear-gradient(180deg, #240303, #3b0404);
    padding: 8px;
    border-radius: 8px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.6);
}

.enemyBoard {
    display: grid;
    grid-template-columns: repeat(10, var(--cell-size));
    grid-template-rows: repeat(10, var(--cell-size));
    gap: var(--gap);
    position: relative;
    background: transparent;
    touch-action: none;
    cursor: url('../battleship/assets/fireCursor.svg') 24 24, crosshair;
}

.enemyBoard.shootEffect {
    cursor: url('../battleship/assets/shootCursor.svg') 24 24, crosshair;
}

.cell.checkingCell {
    background: linear-gradient(180deg, #ffb443, #cf6f00);
}

.cell {
    width: var(--cell-size);
    height: var(--cell-size);
    box-sizing: border-box;
    background: linear-gradient(180deg, #0b3b5b, #07334a);
    border: 1px solid #005fa3;
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
}

.cell.hover-ok {
    outline: 3px solid rgba(34, 197, 94, 0.6);
}

.cell.hover-bad {
    outline: 3px solid rgba(239, 68, 68, 0.6);
}

/* placed ships */
.placed-ship {
    position: absolute;
    display: flex;
    gap: var(--gap);
    align-items: center;
    cursor: grab;
    touch-action: none;
    user-select: none;
    transform-origin: left top;
}

.placed-ship .seg {
    width: var(--cell-size);
    height: var(--cell-size);
    /* margin: 1px 1px 0px 0px; */
    background: linear-gradient(180deg, #fcfaa5, #efc144);
    border-radius: var(--border-radius);
}

.placed-ship.finish {
    cursor: default;
}

.placed-ship.finish .seg {
    cursor: default;
    background: linear-gradient(180deg, #affca5, #13f839);
}

.placed-ship.vertical {
    flex-direction: column;
}

.locked-ship .seg {
    width: var(--cell-size);
    height: var(--cell-size);
    /* margin: 1px 1px 0px 0px; */
    background: linear-gradient(180deg, #a5fcb1, #66ef44);
    border-radius: var(--border-radius);
}

/* ghost during drag */
.ghost {
    position: fixed;
    display: flex;
    pointer-events: none;
    opacity: 0.9;
    transform: translate(-50%, -50%);
    z-index: 9999;
}

.controls {
    margin-top: 12px;
    display: flex;
    justify-content: space-between;
    gap: 8px;
}

button {
    padding: 8px 12px;
    border-radius: 8px;
    border: 0;
    background: #0ea5a4;
    color: #012;
    font-weight: 700;
    cursor: pointer;
}

small {
    opacity: 0.75;
    display: block;
    margin-top: 6px;
}