* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

body {
    background: linear-gradient(135deg, #0B2B40 0%, #1A4B6D 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 12px;
}

.game-container {
    width: 100%;
    max-width: 400px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 24px;
    padding: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.screen {
    width: 100%;
}

.hidden {
    display: none !important;
}

/* Header styles */
.header {
    text-align: center;
    margin-bottom: 20px;
}

h1 {
    color: #FFD700;
    font-size: 28px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
    margin-bottom: 8px;
}

.subtitle {
    color: #B0E0FF;
    font-size: 14px;
}

/* Game header */
.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding: 10px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    color: white;
}

.room-code {
    font-size: 14px;
    color: #FFD700;
    background: rgba(0, 0, 0, 0.3);
    padding: 5px 10px;
    border-radius: 8px;
}

.player-status {
    font-size: 14px;
    color: #B0E0FF;
}

/* Code input section */
.code-section {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 20px;
}

.input-group {
    margin-bottom: 15px;
}

.input-label {
    display: block;
    color: #B0E0FF;
    margin-bottom: 5px;
    font-size: 14px;
}

.code-input {
    width: 100%;
    padding: 12px;
    border: 2px solid #4A90E2;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 18px;
    text-align: center;
    letter-spacing: 2px;
    outline: none;
}

.code-input::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

.code-input:focus {
    border-color: #FFD700;
}

/* Buttons */
.btn {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 5px;
    margin-top: 5px;
}

.btn-primary {
    background: linear-gradient(135deg, #4A90E2 0%, #357ABD 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(74, 144, 226, 0.4);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(74, 144, 226, 0.6);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.btn-secondary:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.3);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Boards */
.boards-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.board-section {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 16px;
    padding: 15px;
}

.board-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    color: white;
}

.board-title h3 {
    font-size: 16px;
}

.ships-left {
    font-size: 14px;
    color: #FFD700;
}

.grid {
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    gap: 2px;
    background: #2C3E50;
    padding: 2px;
    border-radius: 8px;
}

.cell {
    aspect-ratio: 1;
    background: #34495E;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: white;
    cursor: pointer;
    transition: all 0.2s;
}

.cell.ship {
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.cell.ship::before {
    content: '🚢';
}

.cell.hit {
    background: transparent;  /* Прозрачный фон */
    position: relative;
}

.cell.hit::before,
.cell.hit::after {
    content: '';
    position: absolute;
    width: 3px;
    height: 80%;
    background: #E74C3C;  /* Красный крестик */
    top: 10%;
    left: 50%;
    transform: translateX(-50%) rotate(45deg);
}

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

.cell.miss {
    background: transparent;  /* Прозрачный фон */
    position: relative;
}

.cell.miss::before {
    content: '';
    position: absolute;
    width: 8px;
    height: 8px;
    background: #95A5A6;  /* Серая точка */
    border-radius: 50%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.cell.ship.hit {
    background: transparent;  /* Прозрачный фон для подбитого корабля */
    position: relative;
}

.cell.ship.hit::before,
.cell.ship.hit::after {
    content: '';
    position: absolute;
    width: 3px;
    height: 80%;
    background: #E74C3C;  /* Красный крестик */
    top: 10%;
    left: 50%;
    transform: translateX(-50%) rotate(45deg);
}

.cell.ship.hit::after {
    transform: translateX(-50%) rotate(-45deg);
}

/* Ships placement */
.placement-instructions {
    text-align: center;
    color: #B0E0FF;
    margin: 15px 0;
    padding: 10px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    font-size: 14px;
}

.ships-placement {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin: 15px 0;
}

.ship-item {
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: white;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.ship-item.placed {
    opacity: 0.5;
    text-decoration: line-through;
}

.ship-dot {
    height: 20px;
    background: #2ECC71;
    border-radius: 4px;
}

/* Waiting screen */
.waiting-message {
    text-align: center;
    color: white;
    padding: 30px 20px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 16px;
    margin: 20px 0;
}

.room-code-large {
    font-size: 32px;
    color: #FFD700;
    margin: 20px 0;
    font-weight: bold;
    letter-spacing: 4px;
}

.loader {
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top: 3px solid #FFD700;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Turn indicator */
.turn-indicator {
    text-align: center;
    color: white;
    padding: 15px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    font-size: 16px;
}

.turn-indicator.my-turn {
    background: rgba(46, 204, 113, 0.3);
}

/* Result screen */
.game-result {
    text-align: center;
    padding: 30px 20px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 16px;
    margin: 20px 0;
}

.result-title {
    font-size: 32px;
    color: #FFD700;
    margin-bottom: 15px;
    font-weight: bold;
}

.result-message {
    color: white;
    margin-bottom: 25px;
    font-size: 18px;
}

/* Профессиональный статус флота */
.fleet-status {
    width: 100%;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 16px;
    padding: 16px;
    margin: 10px 0 15px 0;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-sizing: border-box;
}

.fleet-status-header {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.fleet-status-title {
    font-size: 16px;
    font-weight: 600;
    color: #B0E0FF;
    letter-spacing: 0.5px;
}

.fleet-status-count {
    font-size: 16px;
    font-weight: 600;
    color: #FFD700;
    background: rgba(0, 0, 0, 0.3);
    padding: 4px 12px;
    border-radius: 20px;
}

.fleet-status-bars {
    width: 100%;
    display: block;
}

.fleet-bar-item {
    width: 100%;
    margin-bottom: 10px;
}

.fleet-bar-item:last-child {
    margin-bottom: 0;
}

.fleet-bar-label {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
    font-size: 13px;
    color: white;
}

.fleet-bar-size {
    display: inline-block;
    min-width: 24px;
    height: 24px;
    line-height: 24px;
    text-align: center;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    color: #FFD700;
    font-weight: 600;
    font-size: 12px;
}

.fleet-bar-name {
    color: rgba(255, 255, 255, 0.8);
    font-size: 13px;
}

.fleet-bar-value {
    margin-left: auto;
    color: rgba(255, 255, 255, 0.5);
    font-size: 12px;
}

.fleet-bar-progress {
    width: 100%;
    height: 4px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 2px;
    overflow: hidden;
}

.fleet-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #4A90E2, #2ECC71);
    border-radius: 2px;
    transition: width 0.3s ease;
}

/* Адаптация под мобильные устройства */
@media (max-width: 380px) {
    .fleet-status {
        padding: 12px;
    }

    .fleet-bar-size {
        min-width: 22px;
        height: 22px;
        line-height: 22px;
        font-size: 11px;
    }

    .fleet-bar-name {
        font-size: 12px;
    }
}

/* Панель выбора кораблей */
.fleet-panel {
    width: 100%;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 16px;
    padding: 16px;
    margin: 10px 0 15px 0;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-sizing: border-box;
}

.fleet-panel-header {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.fleet-panel-title {
    font-size: 16px;
    font-weight: 600;
    color: #B0E0FF;
}

.placement-mode {
    display: flex;
    align-items: center;
    gap: 8px;
}

.mode-indicator {
    font-size: 14px;
    color: white;
    background: rgba(255, 255, 255, 0.1);
    padding: 4px 8px;
    border-radius: 12px;
}

.mode-btn {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    padding: 4px 10px;
    border-radius: 16px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.mode-btn:hover {
    background: rgba(255, 255, 255, 0.25);
}

.ships-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin: 15px 0;
}

.ship-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 12px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.ship-card:hover:not(.disabled) {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
}

.ship-card.selected {
    background: rgba(74, 144, 226, 0.2);
    border-color: #4A90E2;
    box-shadow: 0 0 15px rgba(74, 144, 226, 0.3);
}

.ship-card.disabled {
    opacity: 0.3;
    cursor: not-allowed;
    filter: grayscale(1);
}

.ship-card-preview {
    font-size: 20px;
    letter-spacing: 2px;
    margin-bottom: 8px;
    color: #FFD700;
}

.ship-card-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
}

.ship-card-name {
    color: white;
}

.ship-card-count {
    color: #B0E0FF;
    font-size: 12px;
}

.ship-card-select {
    position: absolute;
    top: 8px;
    right: 8px;
    background: #4A90E2;
    color: white;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 10px;
    opacity: 0;
    transition: opacity 0.2s;
}

.ship-card:hover .ship-card-select {
    opacity: 1;
}

.selected-ship-info {
    margin-top: 10px;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 20px;
    color: white;
    font-size: 14px;
    text-align: center;
}

#selectedShipDisplay {
    color: #FFD700;
    font-weight: 600;
}

/* Адаптация под мобильные */
@media (max-width: 380px) {
    .ships-grid {
        grid-template-columns: 1fr;
    }

    .placement-mode {
        flex-direction: column;
        align-items: flex-end;
        gap: 4px;
    }

    .mode-indicator {
        font-size: 12px;
    }

    .mode-btn {
        font-size: 12px;
        padding: 3px 8px;
    }
}

/* Кнопки выбора ориентации */
.orientation-buttons {
    display: flex;
    gap: 10px;
    margin: 10px 0 15px 0;
    width: 100%;
}

.orientation-btn {
    flex: 1;
    padding: 10px;
    border: none;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.orientation-btn.active {
    background: #4A90E2;
    border-color: #4A90E2;
    box-shadow: 0 4px 10px rgba(74, 144, 226, 0.3);
}

.orientation-btn:hover:not(.active) {
    background: rgba(255, 255, 255, 0.2);
}

/* Обновленные стили для fleet-panel */
.fleet-panel {
    width: 100%;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 16px;
    padding: 16px;
    margin: 10px 0 15px 0;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-sizing: border-box;
}

.fleet-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.fleet-panel-title {
    font-size: 16px;
    font-weight: 600;
    color: #B0E0FF;
}

.fleet-panel-count {
    font-size: 14px;
    color: #FFD700;
    background: rgba(0, 0, 0, 0.3);
    padding: 4px 10px;
    border-radius: 16px;
}

.ships-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin: 10px 0;
}

.ship-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 12px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.ship-card:hover:not(.disabled) {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
}

.ship-card.selected {
    background: rgba(74, 144, 226, 0.2);
    border-color: #4A90E2;
    box-shadow: 0 0 15px rgba(74, 144, 226, 0.3);
}

.ship-card.disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.ship-card-preview {
    font-size: 20px;
    letter-spacing: 2px;
    margin-bottom: 8px;
    color: #FFD700;
}

.ship-card-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
}

.ship-card-name {
    color: white;
}

.ship-card-count {
    color: #B0E0FF;
}

.ship-card-select {
    position: absolute;
    top: 8px;
    right: 8px;
    background: #4A90E2;
    color: white;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 10px;
    opacity: 0;
    transition: opacity 0.2s;
}

.ship-card:hover .ship-card-select {
    opacity: 1;
}

.selected-ship-info {
    margin-top: 10px;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 20px;
    color: white;
    font-size: 14px;
    text-align: center;
}

#selectedShipDisplay {
    color: #FFD700;
    font-weight: 600;
}

/* Адаптация под мобильные */
@media (max-width: 380px) {
    .ships-grid {
        grid-template-columns: 1fr;
    }

    .orientation-buttons {
        flex-direction: column;
        gap: 5px;
    }

    .orientation-btn {
        width: 100%;
    }
}

/* Обновленный стиль для room-code */
.room-code {
    font-size: 14px;
    color: #FFD700;
    background: rgba(0, 0, 0, 0.4);
    padding: 6px 10px 6px 14px;
    border-radius: 30px;
    border: 1px solid rgba(255, 215, 0, 0.2);
    font-weight: 500;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 8px;
}

#roomCodeValue {
    font-weight: 700;
    letter-spacing: 1px;
}

.copy-code-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 20px;
    color: #FFD700;
    cursor: pointer;
    font-size: 14px;
    padding: 4px 8px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.copy-code-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
    border-color: #FFD700;
}

.copy-code-btn:active {
    transform: scale(0.95);
}

.copy-code-btn.copied {
    background: #2ECC71;
    color: white;
    border-color: #2ECC71;
}

/* Адаптация под мобильные */
@media (max-width: 380px) {
    .room-code {
        font-size: 12px;
        padding: 4px 8px 4px 12px;
    }

    .copy-code-btn {
        font-size: 12px;
        padding: 3px 6px;
    }
}

.cell.ship.revealed {
    background: #2ECC71;
    opacity: 0.7;
    position: relative;
}

/* Или вариант с обводкой вместо заливки */
.cell.ship.revealed {
    background: transparent;
    border: 2px solid #2ECC71;
    box-shadow: 0 0 10px rgba(46, 204, 113, 0.5);
}
