/* ==================== CSS VARIABLES ==================== */
:root {
    --bg-primary: #0c1929;
    --bg-secondary: #1a2f4a;
    --bg-tertiary: #243b55;
    --bg-card: rgba(26, 47, 74, 0.95);
    --bg-glass: rgba(255, 255, 255, 0.05);
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --accent: #0ea5e9;
    --accent-light: #38bdf8;
    --accent-glow: rgba(14, 165, 233, 0.4);
    --hit: #ef4444;
    --hit-glow: rgba(239, 68, 68, 0.5);
    --miss: #64748b;
    --miss-glow: rgba(100, 116, 139, 0.3);
    --ship: #3b82f6;
    --ship-glow: rgba(59, 130, 246, 0.4);
    --sunk: #dc2626;
    --sunk-glow: rgba(220, 38, 38, 0.5);
    --success: #00d26a;
    --warning: #ffc048;
    --error: #ff4757;
    --border-radius: 16px;
    --border-radius-sm: 8px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 30px var(--accent-glow);
}

/* ==================== RESET & BASE ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html,
body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: 'Outfit', sans-serif;
    background: var(--bg-primary);
    background-image: radial-gradient(ellipse at top, rgba(14, 165, 233, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at bottom, rgba(59, 130, 246, 0.1) 0%, transparent 50%);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* ==================== HOME BUTTON ==================== */
.home-button {
    position: fixed;
    top: 20px;
    left: 20px;
    width: 48px;
    height: 48px;
    background: var(--bg-glass);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    text-decoration: none;
    transition: var(--transition);
    z-index: 1000;
}

.home-button:hover {
    background: var(--accent);
    color: white;
    transform: scale(1.05);
    box-shadow: var(--shadow-glow);
}

.home-button svg {
    width: 24px;
    height: 24px;
}

/* ==================== SCREENS ==================== */
.screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.screen.active {
    display: flex;
}

/* ==================== MENU ==================== */
.menu-container {
    text-align: center;
    max-width: 400px;
    width: 100%;
}

.logo {
    margin-bottom: 40px;
}

.logo-ships {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 20px;
}

.logo-ships .ship {
    font-size: 3rem;
    animation: shipFloat 3s ease-in-out infinite;
}

.logo-ships .ship-1 {
    animation-delay: 0s;
}

.logo-ships .ship-2 {
    animation-delay: 0.5s;
}

.logo-ships .ship-3 {
    animation-delay: 1s;
}

@keyframes shipFloat {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

.logo h1 {
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent), var(--accent-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.player-info {
    margin-bottom: 30px;
}

.player-info input {
    width: 100%;
    padding: 14px 18px;
    background: var(--bg-glass);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 1rem;
    transition: var(--transition);
    text-align: center;
}

.player-info input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* ==================== BUTTONS ==================== */
.btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 16px 24px;
    border: none;
    border-radius: var(--border-radius);
    font-family: inherit;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.btn-icon {
    font-size: 1.3rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent), var(--accent-light));
    color: white;
    box-shadow: var(--shadow-md), 0 0 20px var(--accent-glow);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg), 0 0 30px var(--accent-glow);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-primary.btn-confirmed {
    background: linear-gradient(135deg, #10b981, #34d399) !important;
    box-shadow: var(--shadow-md), 0 0 20px rgba(16, 185, 129, 0.4) !important;
    opacity: 1 !important;
    cursor: default !important;
}

.btn-secondary {
    background: linear-gradient(135deg, var(--ship), #60a5fa);
    color: white;
    box-shadow: var(--shadow-md);
}

.btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg), 0 0 20px var(--ship-glow);
}

.btn-tertiary {
    background: var(--bg-glass);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: var(--text-primary);
    backdrop-filter: blur(10px);
}

.btn-tertiary:hover {
    background: var(--bg-tertiary);
    border-color: var(--accent);
}

.btn-back {
    background: transparent;
    color: var(--text-secondary);
    padding: 12px;
}

.btn-back:hover {
    color: var(--text-primary);
}

.btn-copy {
    background: var(--bg-glass);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    padding: 12px 20px;
    font-size: 0.95rem;
}

.btn-copy:hover {
    background: var(--accent);
}

/* ==================== MODAL CONTAINER ==================== */
.modal-container {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius);
    padding: 40px;
    text-align: center;
    max-width: 450px;
    width: 100%;
    box-shadow: var(--shadow-lg);
}

.modal-container h2 {
    font-size: 1.6rem;
    margin-bottom: 24px;
    background: linear-gradient(135deg, var(--text-primary), var(--text-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.modal-container input {
    width: 100%;
    padding: 16px 20px;
    background: var(--bg-glass);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 1.1rem;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 4px;
    margin-bottom: 20px;
    transition: var(--transition);
}

.modal-container input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.modal-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Difficulty Buttons */
.difficulty-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

.difficulty-btn {
    display: flex;
    align-items: center;
    padding: 20px;
    background: var(--bg-glass);
    border: 1px solid rgba(255, 255, 255, 0.1);
    text-align: left;
}

.difficulty-btn:hover {
    border-color: var(--accent);
    background: var(--bg-tertiary);
}

.difficulty-icon {
    font-size: 2rem;
    margin-right: 16px;
}

.difficulty-name {
    font-size: 1.1rem;
    font-weight: 600;
    display: block;
}

.difficulty-desc {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.difficulty-btn.easy:hover {
    border-color: var(--success);
}

.difficulty-btn.medium:hover {
    border-color: var(--warning);
}

.difficulty-btn.hard:hover {
    border-color: var(--error);
}

/* Waiting Screen */
.modal-container.waiting {
    padding: 50px 40px;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 4px solid var(--bg-glass);
    border-top-color: var(--accent);
    border-radius: 50%;
    margin: 0 auto 24px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.room-code {
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: 8px;
    color: var(--accent-light);
    background: var(--bg-glass);
    padding: 16px 24px;
    border-radius: var(--border-radius-sm);
    margin: 20px 0;
    font-family: monospace;
}

/* ==================== PLACEMENT SCREEN ==================== */
.placement-container {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius);
    padding: 30px;
    max-width: 900px;
    width: 100%;
}

.placement-container h2 {
    text-align: center;
    font-size: 1.8rem;
    margin-bottom: 10px;
    background: linear-gradient(135deg, var(--accent), var(--accent-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.placement-instructions {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.placement-content {
    display: flex;
    gap: 30px;
    justify-content: center;
    align-items: flex-start;
}

.ships-panel {
    background: var(--bg-glass);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius);
    padding: 20px;
    min-width: 200px;
}

.ships-panel h3 {
    font-size: 1.1rem;
    margin-bottom: 16px;
    color: var(--text-secondary);
}

.ships-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 20px;
}

.ship-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    background: var(--bg-tertiary);
    border: 2px solid transparent;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: var(--transition);
}

.ship-item:hover {
    border-color: var(--accent);
}

.ship-item.selected {
    border-color: var(--accent);
    background: rgba(14, 165, 233, 0.2);
    box-shadow: 0 0 15px var(--accent-glow);
}

.ship-item.placed {
    opacity: 0.5;
    cursor: not-allowed;
}

.ship-item.placed:hover {
    border-color: transparent;
}

.ship-icon {
    font-size: 1.5rem;
}

.ship-name {
    flex: 1;
    font-weight: 500;
}

.ship-size {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.placement-controls {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.placement-controls .btn {
    padding: 10px;
    font-size: 0.9rem;
}

.placement-grid-container {
    position: relative;
}

.grid-labels {
    position: relative;
}

.col-labels {
    display: flex;
    justify-content: space-around;
    margin-bottom: 5px;
    margin-left: 25px;
}

.col-labels span {
    width: 36px;
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 600;
}

.row-labels {
    position: absolute;
    left: 0;
    top: 25px;
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    height: 360px;
}

.row-labels span {
    height: 36px;
    display: flex;
    align-items: center;
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 600;
}

/* Grid */
.grid {
    display: grid;
    grid-template-columns: repeat(10, 36px);
    grid-template-rows: repeat(10, 36px);
    gap: 2px;
    padding: 10px;
    background: linear-gradient(145deg, #1a3a5c, #0d2a4a);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg), inset 0 2px 10px rgba(255, 255, 255, 0.05);
    margin-left: 25px;
}

.cell {
    width: 36px;
    height: 36px;
    border-radius: 4px;
    background: rgba(14, 165, 233, 0.1);
    border: 1px solid rgba(14, 165, 233, 0.2);
    cursor: pointer;
    transition: var(--transition);
    position: relative;
}

.cell:hover {
    background: rgba(14, 165, 233, 0.3);
    border-color: var(--accent);
}

.cell.ship {
    background: linear-gradient(135deg, var(--ship), #2563eb);
    border-color: var(--ship);
    box-shadow: inset 0 0 10px rgba(255, 255, 255, 0.2);
}

.cell.preview {
    background: rgba(14, 165, 233, 0.4);
    border-color: var(--accent);
}

.cell.preview-invalid {
    background: rgba(239, 68, 68, 0.4);
    border-color: var(--hit);
}

.cell.hit {
    background: linear-gradient(135deg, var(--hit), #dc2626);
    border-color: var(--hit);
    box-shadow: 0 0 15px var(--hit-glow);
}

.cell.hit::after {
    content: '💥';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.2rem;
}

.cell.miss {
    background: var(--miss);
    border-color: var(--miss);
}

.cell.miss::after {
    content: '•';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.5rem;
    color: rgba(255, 255, 255, 0.5);
}

.cell.sunk {
    background: #000000 !important;
    border-color: #111111 !important;
    box-shadow: inset 0 0 15px rgba(0, 0, 0, 1) !important;
    animation: sinkShip 0.6s ease-out forwards;
}

.cell.sunk::after {
    content: '☠️';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1rem;
}

@keyframes sinkShip {
    0% {
        transform: scale(1.2);
        opacity: 0.5;
    }

    50% {
        transform: scale(0.9);
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.cell.attacking {
    animation: attackPulse 0.5s ease-in-out;
}

@keyframes attackPulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(0.9);
    }

    100% {
        transform: scale(1);
    }
}

.placement-actions {
    display: flex;
    justify-content: space-between;
    margin-top: 24px;
}

/* ==================== GAME SCREEN ==================== */
.game-container {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-rows: auto 1fr;
    gap: 20px;
    max-width: 1200px;
    width: 100%;
    height: 100%;
    max-height: 750px;
    padding: 20px;
}

.players-bar {
    grid-column: 1 / -1;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 30px;
    padding: 16px 24px;
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius);
}

.player {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    border-radius: var(--border-radius-sm);
    transition: var(--transition);
}

.player.active {
    background: var(--bg-glass);
    box-shadow: 0 0 20px var(--accent-glow);
}

.player-avatar {
    font-size: 2rem;
}

.player-details {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.player-name {
    font-weight: 600;
    font-size: 1rem;
}

.player-ships {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.turn-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--bg-glass);
    transition: var(--transition);
}

.turn-indicator.active {
    background: var(--success);
    box-shadow: 0 0 10px var(--success);
    animation: pulse 1.5s infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

.vs {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-muted);
}

.boards-container {
    display: flex;
    gap: 30px;
    justify-content: center;
    align-items: flex-start;
}

.board-section {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius);
    padding: 20px;
}

.board-section h3 {
    text-align: center;
    margin-bottom: 15px;
    font-size: 1.1rem;
    color: var(--text-secondary);
}

.board-section.enemy-board .grid .cell:not(.hit):not(.miss) {
    cursor: crosshair;
}

.board-section.enemy-board .grid .cell:not(.hit):not(.miss):hover {
    background: rgba(239, 68, 68, 0.3);
    border-color: var(--hit);
}

.my-grid .cell {
    cursor: default;
}

.my-grid .cell:hover {
    background: rgba(14, 165, 233, 0.1);
}

/* ==================== ENEMY TABS (4-Player) ==================== */
.enemy-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 15px;
    justify-content: center;
}

.enemy-tab {
    padding: 10px 20px;
    background: var(--bg-glass);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.9rem;
}

.enemy-tab:hover {
    border-color: var(--accent);
    color: var(--text-primary);
}

.enemy-tab.active {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

.enemy-tab.eliminated {
    opacity: 0.4;
    text-decoration: line-through;
    cursor: not-allowed;
}

/* ==================== SIDE PANEL ==================== */
.side-panel {
    display: flex;
    flex-direction: column;
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius);
    overflow: hidden;
    min-width: 280px;
    max-height: 500px;
}

.panel-tabs {
    display: flex;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.tab-btn {
    flex: 1;
    padding: 14px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--transition);
}

.tab-btn.active {
    color: var(--text-primary);
    background: var(--bg-glass);
}

.tab-btn:hover:not(.active) {
    color: var(--text-secondary);
}

.tab-content {
    display: none;
    flex: 1;
    flex-direction: column;
    min-height: 0;
}

.tab-content.active {
    display: flex;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.chat-message {
    padding: 10px 14px;
    border-radius: var(--border-radius-sm);
    background: var(--bg-glass);
    max-width: 90%;
}

.chat-message.player-0 {
    align-self: flex-start;
    border-left: 3px solid var(--accent);
}

.chat-message.player-1 {
    align-self: flex-end;
    border-right: 3px solid var(--ship);
}

.chat-message.system {
    align-self: center;
    background: transparent;
    color: var(--text-muted);
    font-style: italic;
    font-size: 0.85rem;
}

.chat-sender {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.chat-text {
    font-size: 0.95rem;
    word-break: break-word;
}

.chat-input-container {
    display: flex;
    gap: 8px;
    padding: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.chat-input-container input {
    flex: 1;
    padding: 10px 14px;
    background: var(--bg-glass);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.9rem;
}

.chat-input-container input:focus {
    outline: none;
    border-color: var(--accent);
}

.btn-send {
    padding: 10px 16px;
    background: var(--accent);
    border: none;
    border-radius: var(--border-radius-sm);
    color: white;
    cursor: pointer;
    transition: var(--transition);
}

.btn-send:hover {
    background: var(--accent-light);
}

.game-log {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.log-entry {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: var(--border-radius-sm);
    margin-bottom: 6px;
    background: var(--bg-glass);
    font-size: 0.9rem;
}

.log-entry.hit {
    border-left: 3px solid var(--hit);
}

.log-entry.miss {
    border-left: 3px solid var(--miss);
}

.log-entry.sunk {
    border-left: 3px solid var(--sunk);
    background: rgba(220, 38, 38, 0.1);
}

/* ==================== GAME OVER MODAL ==================== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius);
    padding: 50px 40px;
    text-align: center;
    max-width: 400px;
    width: 100%;
    box-shadow: var(--shadow-lg);
}

.result-icon {
    font-size: 5rem;
    margin-bottom: 20px;
}

.result-title {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 10px;
    background: linear-gradient(135deg, var(--accent), var(--accent-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.result-message {
    color: var(--text-secondary);
    margin-bottom: 30px;
    font-size: 1.1rem;
}

.rematch-status {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: 15px;
}

.modal-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 900px) {
    .placement-content {
        flex-direction: column;
        align-items: center;
    }

    .ships-panel {
        width: 100%;
        min-width: unset;
    }

    .boards-container {
        flex-direction: column;
    }

}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.chat-message {
    padding: 10px 14px;
    border-radius: var(--border-radius-sm);
    background: var(--bg-glass);
    max-width: 90%;
}

.chat-message.player-0 {
    align-self: flex-start;
    border-left: 3px solid var(--accent);
}

.chat-message.player-1 {
    align-self: flex-end;
    border-right: 3px solid var(--ship);
}

.chat-message.system {
    align-self: center;
    background: transparent;
    color: var(--text-muted);
    font-style: italic;
    font-size: 0.85rem;
}

.chat-sender {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.chat-text {
    font-size: 0.95rem;
    word-break: break-word;
}

.chat-input-container {
    display: flex;
    gap: 8px;
    padding: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.chat-input-container input {
    flex: 1;
    padding: 10px 14px;
    background: var(--bg-glass);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.9rem;
}

.chat-input-container input:focus {
    outline: none;
    border-color: var(--accent);
}

.btn-send {
    padding: 10px 16px;
    background: var(--accent);
    border: none;
    border-radius: var(--border-radius-sm);
    color: white;
    cursor: pointer;
    transition: var(--transition);
}

.btn-send:hover {
    background: var(--accent-light);
}

.game-log {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.log-entry {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: var(--border-radius-sm);
    margin-bottom: 6px;
    background: var(--bg-glass);
    font-size: 0.9rem;
}

.log-entry.hit {
    border-left: 3px solid var(--hit);
}

.log-entry.miss {
    border-left: 3px solid var(--miss);
}

.log-entry.sunk {
    border-left: 3px solid var(--sunk);
    background: rgba(220, 38, 38, 0.1);
}

/* ==================== GAME OVER MODAL ==================== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius);
    padding: 50px 40px;
    text-align: center;
    max-width: 400px;
    width: 100%;
    box-shadow: var(--shadow-lg);
}

.result-icon {
    font-size: 5rem;
    margin-bottom: 20px;
}

.result-title {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 10px;
    background: linear-gradient(135deg, var(--accent), var(--accent-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.result-message {
    color: var(--text-secondary);
    margin-bottom: 30px;
    font-size: 1.1rem;
}

.rematch-status {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: 15px;
}

.modal-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 900px) {
    .placement-content {
        flex-direction: column;
        align-items: center;
    }

    .ships-panel {
        width: 100%;
        min-width: unset;
    }

    .boards-container {
        flex-direction: column;
    }

}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.chat-message {
    padding: 10px 14px;
    border-radius: var(--border-radius-sm);
    background: var(--bg-glass);
    max-width: 90%;
}

.chat-message.player-0 {
    align-self: flex-start;
    border-left: 3px solid var(--accent);
}

.chat-message.player-1 {
    align-self: flex-end;
    border-right: 3px solid var(--ship);
}

.chat-message.system {
    align-self: center;
    background: transparent;
    color: var(--text-muted);
    font-style: italic;
    font-size: 0.85rem;
}

.chat-sender {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.chat-text {
    font-size: 0.95rem;
    word-break: break-word;
}

.chat-input-container {
    display: flex;
    gap: 8px;
    padding: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.chat-input-container input {
    flex: 1;
    padding: 10px 14px;
    background: var(--bg-glass);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.9rem;
}

.chat-input-container input:focus {
    outline: none;
    border-color: var(--accent);
}

.btn-send {
    padding: 10px 16px;
    background: var(--accent);
    border: none;
    border-radius: var(--border-radius-sm);
    color: white;
    cursor: pointer;
    transition: var(--transition);
}

.btn-send:hover {
    background: var(--accent-light);
}

.game-log {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.log-entry {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: var(--border-radius-sm);
    margin-bottom: 6px;
    background: var(--bg-glass);
    font-size: 0.9rem;
}

.log-entry.hit {
    border-left: 3px solid var(--hit);
}

.log-entry.miss {
    border-left: 3px solid var(--miss);
}

.log-entry.sunk {
    border-left: 3px solid var(--sunk);
    background: rgba(220, 38, 38, 0.1);
}

/* ==================== GAME OVER MODAL ==================== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius);
    padding: 50px 40px;
    text-align: center;
    max-width: 400px;
    width: 100%;
    box-shadow: var(--shadow-lg);
}

.result-icon {
    font-size: 5rem;
    margin-bottom: 20px;
}

.result-title {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 10px;
    background: linear-gradient(135deg, var(--accent), var(--accent-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.result-message {
    color: var(--text-secondary);
    margin-bottom: 30px;
    font-size: 1.1rem;
}

.rematch-status {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: 15px;
}

.modal-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 900px) {
    .placement-content {
        flex-direction: column;
        align-items: center;
    }

    .ships-panel {
        width: 100%;
        min-width: unset;
    }

    .boards-container {
        flex-direction: column;
    }

    .game-container {
        grid-template-columns: 1fr;
        max-height: none;
    }

    .side-panel {
        min-width: 100%;
    }
}