﻿body {
    font-family: Arial, sans-serif;
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    background: linear-gradient(135deg, #1e3c72, #2a5298);
    color: white;
    min-height: 100vh;
}

.container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.connection-panel {
    background: rgba(255,255,255,0.1);
    padding: 20px;
    border-radius: 10px;
    backdrop-filter: blur(10px);
    text-align: center;
    min-width: 400px;
}

.input-with-icon {
    position: relative;
    display: inline-block;
    margin: 5px;
}

    .input-with-icon input {
        padding: 10px 40px 10px 10px;
        border: none;
        border-radius: 5px;
        font-size: 16px;
        width: 200px;
    }

.input-icon {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    font-size: 20px;
    transition: transform 0.2s;
}

    .input-icon:hover {
        transform: translateY(-50%) scale(1.2);
    }

.connection-panel input {
    padding: 10px;
    margin: 5px;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    width: 200px;
}

.share-link-container {
    margin-top: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    position: relative;
}

.share-link-input {
    flex: 1;
    max-width: 400px;
    padding: 10px;
    border: none;
    border-radius: 5px;
    font-size: 14px;
    background: rgba(255,255,255,0.9);
    color: #333;
}

.copy-icon {
    cursor: pointer;
    font-size: 24px;
    padding: 8px;
    background: rgba(255,255,255,0.2);
    border-radius: 5px;
    transition: all 0.2s;
}

    .copy-icon:hover {
        background: rgba(255,255,255,0.3);
        transform: scale(1.1);
    }

.copy-message {
    position: absolute;
    background: #2ecc71;
    color: white;
    padding: 8px 15px;
    border-radius: 5px;
    font-size: 14px;
    top: -40px;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
}

    .copy-message.show {
        opacity: 1;
    }

.connection-panel button {
    padding: 10px 20px;
    margin: 5px;
    border: none;
    border-radius: 5px;
    background: #4CAF50;
    color: white;
    font-size: 16px;
    cursor: pointer;
    transition: background 0.3s;
}

    .connection-panel button:hover:not(:disabled) {
        background: #45a049;
    }

    .connection-panel button:disabled {
        background: #666;
        cursor: not-allowed;
    }

.status-panel {
    background: rgba(255,255,255,0.1);
    padding: 15px;
    border-radius: 10px;
    backdrop-filter: blur(10px);
    text-align: center;
    font-weight: bold;
    min-width: 400px;
}

.lobby-panel {
    background: rgba(255,255,255,0.1);
    padding: 20px;
    border-radius: 10px;
    backdrop-filter: blur(10px);
    min-width: 600px;
}

.lobby-title {
    text-align: center;
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 20px;
}

.lobby-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    gap: 20px;
}

.lobby-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

.ready-checkbox-container {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 16px;
    cursor: pointer;
    user-select: none;
}

    .ready-checkbox-container input[type="checkbox"] {
        width: 20px;
        height: 20px;
        cursor: pointer;
    }

.leave-lobby-btn {
    background: #e74c3c !important;
    padding: 6px 12px !important;
    font-size: 13px !important;
    width: auto !important;
    min-width: auto !important;
}

.countdown-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.9);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.countdown-number {
    font-size: 120px;
    font-weight: bold;
    color: #2ecc71;
    animation: countdownPulse 1s ease-in-out;
}

.countdown-text {
    font-size: 24px;
    color: #bbb;
    margin-top: 20px;
}

@keyframes countdownPulse {
    0% {
        transform: scale(0.5);
        opacity: 0;
    }

    50% {
        transform: scale(1.2);
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.users-grid {
    width: 100%;
    background: rgba(0,0,0,0.2);
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 20px;
}

.users-table {
    width: 100%;
    border-collapse: collapse;
}

.grid-header {
    background: rgba(255,255,255,0.2);
    padding: 12px;
    font-weight: bold;
    text-align: center;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

    .grid-header:first-child {
        text-align: left;
    }

.grid-cell {
    padding: 12px;
    text-align: center;
    background: rgba(255,255,255,0.05);
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

    .grid-cell:first-child {
        text-align: left;
        font-weight: bold;
    }

.user-row:hover .grid-cell {
    background: rgba(255,255,255,0.1);
}

.current-user .grid-cell {
    background: rgba(76, 175, 80, 0.2) !important;
}

.chat-panel {
    background: rgba(0,0,0,0.3);
    border-radius: 8px;
    padding: 15px;
}

.chat-messages {
    height: 200px;
    overflow-y: auto;
    background: rgba(0,0,0,0.3);
    padding: 10px;
    border-radius: 4px;
    margin-bottom: 10px;
    font-family: monospace;
    font-size: 14px;
}

.chat-input-area {
    display: flex;
    gap: 10px;
}

    .chat-input-area input {
        flex: 1;
        padding: 10px;
        border: none;
        border-radius: 4px;
        font-size: 14px;
    }

    .chat-input-area button {
        padding: 10px 20px;
        border: none;
        border-radius: 4px;
        background: #3498db;
        color: white;
        cursor: pointer;
    }

/* In-Game Chat Panel */
.game-chat-panel {
    background: rgba(0,0,0,0.3);
    border-radius: 8px;
    padding: 15px;
    width: 100%;
    max-width: 800px;
    margin-top: 20px;
}

.game-chat-messages {
    height: 100px;
    overflow-y: auto;
    background: rgba(0,0,0,0.3);
    padding: 10px;
    border-radius: 4px;
    margin-bottom: 10px;
    font-family: monospace;
    font-size: 13px;
}

.game-chat-input-area {
    display: flex;
    gap: 10px;
}

    .game-chat-input-area input {
        flex: 1;
        padding: 8px;
        border: none;
        border-radius: 4px;
        font-size: 14px;
    }

    .game-chat-input-area button {
        padding: 8px 16px;
        border: none;
        border-radius: 4px;
        background: #3498db;
        color: white;
        cursor: pointer;
        font-size: 14px;
    }

        .game-chat-input-area button:hover {
            background: #2980b9;
        }

.deployment-area {
    width: 100%;
}

.deployment-container {
    display: flex;
    gap: 40px;
    justify-content: center;
    flex-wrap: wrap;
}

.deployment-grid-container {
    text-align: center;
}

.ship-selection-container {
    background: rgba(255,255,255,0.1);
    padding: 20px;
    border-radius: 10px;
    backdrop-filter: blur(10px);
    min-width: 300px;
}

.ship-selection-title {
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 15px;
}

.ship-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ship-item {
    background: rgba(0,0,0,0.3);
    padding: 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    border: 2px solid transparent;
}

    .ship-item:hover:not(.deployed) {
        background: rgba(255,255,255,0.2);
        transform: translateX(5px);
    }

    .ship-item.selected {
        border-color: #2ecc71;
        background: rgba(46, 204, 113, 0.2);
    }

    .ship-item.deployed {
        opacity: 0.5;
        cursor: not-allowed;
    }

.ship-name {
    font-weight: bold;
    margin-bottom: 5px;
}

.ship-visual {
    display: flex;
    gap: 2px;
    justify-content: center;
}

.ship-block {
    width: 20px;
    height: 20px;
    background: #666;
    border: 1px solid #999;
}

.deployment-controls {
    margin-top: 15px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.orientation-toggle {
    padding: 10px;
    background: #3498db;
    border: none;
    border-radius: 5px;
    color: white;
    cursor: pointer;
    font-size: 14px;
}

    .orientation-toggle:hover {
        background: #2980b9;
    }

.reset-deployment-btn {
    padding: 10px;
    background: #e74c3c;
    border: none;
    border-radius: 5px;
    color: white;
    cursor: pointer;
    font-size: 14px;
}

    .reset-deployment-btn:hover {
        background: #c0392b;
    }

.deployment-progress {
    margin-top: 20px;
    background: rgba(0,0,0,0.3);
    padding: 15px;
    border-radius: 8px;
}

.progress-item {
    margin-bottom: 10px;
}

.progress-label {
    font-size: 14px;
    margin-bottom: 5px;
    display: flex;
    justify-content: space-between;
}

.progress-bar {
    width: 100%;
    height: 20px;
    background: rgba(255,255,255,0.1);
    border-radius: 10px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #3498db, #2ecc71);
    transition: width 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 12px;
    font-weight: bold;
}

.cell.preview {
    background: rgba(46, 204, 113, 0.5) !important;
}

.cell.preview-invalid {
    background: rgba(231, 76, 60, 0.5) !important;
}

.game-area {
    width: 100%;
}

.game-controls {
    text-align: center;
    margin-bottom: 20px;
}

.stat-box {
    background: rgba(0,0,0,0.4);
    padding: 15px 30px;
    border-radius: 10px;
    min-width: 200px;
    text-align: center;
}

.stat-label {
    font-size: 14px;
    color: #bbb;
    margin-bottom: 5px;
}

.stat-value {
    font-size: 32px;
    font-weight: bold;
}

.return-lobby-btn {
    background: #3498db !important;
    font-size: 18px;
    padding: 12px 40px !important;
}

    .return-lobby-btn:hover {
        background: #2980b9 !important;
    }

.game-boards {
    display: flex;
    gap: 40px;
    justify-content: center;
    flex-wrap: wrap;
}

.board-container {
    text-align: center;
}

.board-title {
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 10px;
}

.game-grid {
    display: grid;
    grid-template-columns: repeat(10, 40px);
    grid-template-rows: repeat(10, 40px);
    gap: 2px;
    border: 2px solid #fff;
    padding: 10px;
    background: rgba(255,255,255,0.1);
    border-radius: 10px;
}

.cell {
    width: 40px;
    height: 40px;
    border: 1px solid #ccc;
    background: #4a90e2;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 18px;
}

    .cell:hover {
        background: #357abd;
        transform: scale(1.05);
    }

    .cell.ship {
        background: #666;
    }

    .cell.hit {
        background: #e74c3c;
        color: white;
    }

    .cell.miss {
        background: #95a5a6;
        color: white;
    }

    .cell.sunk {
        background: #8e44ad;
        color: white;
    }

.enemy-grid .cell.ship {
    background: #4a90e2;
}

.hidden {
    display: none;
}

@media (max-width: 768px) {
    .connection-panel, .status-panel, .lobby-panel {
        min-width: auto;
        width: 100%;
    }

    .game-boards, .deployment-container {
        flex-direction: column;
    }

    .game-grid {
        grid-template-columns: repeat(10, 30px);
        grid-template-rows: repeat(10, 30px);
    }

    .cell {
        width: 30px;
        height: 30px;
    }

    .game-chat-panel {
        max-width: 100%;
    }
}

.intro-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.intro-content {
    background: linear-gradient(135deg, #1e3c72, #2a5298);
    padding: 40px;
    border-radius: 15px;
    max-width: 500px;
    text-align: center;
    border: 3px solid rgba(255,255,255,0.3);
}

    .intro-content h2 {
        margin: 0 0 20px 0;
        font-size: 32px;
    }

.intro-text {
    text-align: left;
    margin: 20px 0;
    background: rgba(0,0,0,0.3);
    padding: 20px;
    border-radius: 10px;
}

    .intro-text ol {
        margin: 10px 0 0 20px;
        padding: 0;
    }

    .intro-text li {
        margin: 8px 0;
    }

.intro-btn {
    background: #2ecc71;
    color: white;
    border: none;
    padding: 15px 30px;
    font-size: 18px;
    border-radius: 8px;
    cursor: pointer;
    margin-top: 20px;
}

    .intro-btn:hover {
        background: #27ae60;
    }

.intro-modal.hidden {
    display: none;
}
