:root {
    --bg: #0f172a;
    --board-bg: rgba(30, 41, 59, 0.7);
    --water: #38bdf8;
    --water-hover: #7dd3fc;
    --ship-color: #64748b;
    --hit: #ef4444;
    --miss: #94a3b8;
    --text: #f1f5f9;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Outfit', sans-serif;
}

body {
    background-color: var(--bg);
    color: var(--text);
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    padding: 2rem;
}

h1 {
    margin-bottom: 0.5rem;
    font-size: 2.5rem;
    color: var(--water);
}

.status-text {
    margin-bottom: 2rem;
    font-size: 1.2rem;
    height: 30px;
    font-weight: bold;
    text-align: center;
}

/* ─── Game Area ─────────────────────────────────────────────────── */

.game-area {
    display: flex;
    gap: 4rem;
    align-items: flex-start;
    justify-content: center;
    flex-wrap: wrap;
}

.board-container h2 {
    text-align: center;
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

.tracker-label {
    text-align: center;
    margin-top: 0.8rem;
    font-size: 0.85rem;
    color: var(--miss);
    letter-spacing: 0.05em;
}

/* ─── Board Grid ─────────────────────────────────────────────────── */

.board {
    display: grid;
    grid-template-columns: repeat(10, 35px);
    grid-template-rows: repeat(10, 35px);
    gap: 2px;
    background: var(--board-bg);
    padding: 8px;
    border-radius: 8px;
    border: 2px solid rgba(255, 255, 255, 0.1);
}

.cell {
    background-color: rgba(56, 189, 248, 0.1);
    border: 1px solid rgba(56, 189, 248, 0.3);
    cursor: crosshair;
    transition: background-color 0.2s;
    position: relative;
}

.cell.water:hover {
    background-color: var(--water-hover);
}

.cell.ship {
    background-color: var(--ship-color);
}

.cell.hit {
    background-color: var(--hit);
    cursor: not-allowed;
}

.cell.hit::after {
    content: 'X';
    position: absolute;
    color: white;
    font-weight: bold;
    font-size: 20px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.cell.miss {
    background-color: var(--miss);
    cursor: not-allowed;
    opacity: 0.5;
}

.cell.drag-over-valid {
    background-color: #4ade80 !important;
}

.cell.drag-over-invalid {
    background-color: #f87171 !important;
}

/* ─── Setup Panel ────────────────────────────────────────────────── */

.setup-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(255, 255, 255, 0.05);
    padding: 1rem 1.5rem;
    border-radius: 12px;
    gap: 1.2rem;
    width: 1000px;
    max-width: 98vw;
    min-height: 700px;
}

.setup-panel h2 {
    font-size: 1.4rem;
    color: var(--water);
}

.setup-controls {
    display: flex;
    gap: 1rem;
}

.setup-layout {
    display: flex;
    gap: 5rem;
    align-items: flex-start;
    justify-content: center;
    width: 100%;
}

.fleet-sidebar {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.8rem;
    width: 320px;
    flex-shrink: 0;
}

.fleet-label {
    font-size: 0.9rem;
    color: var(--miss);
    text-align: center;
}

.fleet {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px 20px;
    width: 100%;
    height: 340px;
    align-content: start;
}

.fleet-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: flex-start;
}

.fleet-item-label {
    font-size: 0.75rem;
    color: var(--miss);
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

/* ─── Draggable Ships ────────────────────────────────────────────── */

.draggable-ship {
    display: flex;
    flex-direction: row;
    gap: 2px;
    cursor: grab;
    user-select: none;
}

.draggable-ship:active {
    cursor: grabbing;
}

.draggable-ship[data-vertical="true"] {
    flex-direction: column;
}

.ship-segment {
    width: 35px;
    height: 35px;
    background-color: var(--ship-color);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

/* ─── Buttons ────────────────────────────────────────────────────── */

button {
    background: var(--water);
    color: var(--bg);
    border: none;
    padding: 0.8rem 1.5rem;
    border-radius: 8px;
    font-weight: bold;
    font-size: 1rem;
    cursor: pointer;
    transition: opacity 0.2s;
}

button:hover {
    opacity: 0.8;
}

button:disabled {
    cursor: not-allowed;
}

/* ─── Ship Tracker ───────────────────────────────────────────────── */

.ships-tracker {
    display: flex;
    gap: 10px;
    margin-top: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.tracker-ship {
    display: flex;
    gap: 2px;
}

.tracker-segment {
    width: 15px;
    height: 15px;
    background-color: var(--ship-color);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    position: relative;
}

.tracker-ship.sunk .tracker-segment {
    background-color: var(--hit);
    opacity: 0.7;
}

.tracker-ship.sunk .tracker-segment::after {
    content: 'X';
    position: absolute;
    color: white;
    font-size: 9px;
    font-weight: bold;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* ─── Utility ────────────────────────────────────────────────────── */

.hidden {
    display: none !important;
}