* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Courier New', Courier, monospace;
}

body {
    display: flex;
    flex-direction: column;
}

main {
    flex: 1;
    font-family: 'Courier New', Courier, monospace;
    background-image: url('/assets/water-texture.webp');
    background-repeat: repeat;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 20px;
    padding-top: 20px;
    overflow-y: auto;
}

.container {
    background: transparent;
    border-radius: 0;
    padding: 30px;
    box-shadow: none;
    max-width: 1600px;
    width: 100%;
    z-index: 100;
}

h1 {
    display: none;
}

.logo {
    width: 100%;
    max-width: 600px;
    height: auto;
    margin: 0 auto 30px;
    display: block;
}

.screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.hidden {
    display: none !important;
}

.blocked {
    background-color: #f44336;
    color: white;
}

.form-group {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 20px;
}

.form-group label {
    font-weight: bold;
    color: #333;
    font-family: 'Courier New', Courier, monospace;
}

.form-group input {
    padding: 10px;
    border: 2px solid #1a2980;
    border-radius: 0;
    font-size: 16px;
    width: 200px;
    font-family: 'Courier New', Courier, monospace;
}

.game-controls {
    display: flex;
    gap: 15px;
    margin-bottom: 30px;
}

button {
    padding: 12px 24px;
    background: white;
    color: black;
    border: none;
    border-radius: 0;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.3);
    font-family: 'Courier New', Courier, monospace;
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 5px 5px 0 rgba(0, 0, 0, 0.3);
}

button:active {
    transform: translateY(0);
}

.boards-container {
    display: flex;
    gap: 40px;
    justify-content: center;
    flex-wrap: wrap;
}

.board-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.board-section h3 {
    color: #333;
    margin-bottom: 10px;
    font-family: 'Courier New', Courier, monospace;
}

.board {
    display: grid;
    grid-template-columns: repeat(10, 35px);
    grid-template-rows: repeat(10, 35px);
    gap: 0;
    background: #ffffff;
    padding: 0;
    border: 2px solid #000000;
    border-radius: 0;
    box-shadow: 8px 8px 0 rgba(0, 0, 0, 0.3);
    transition: background 0.3s ease;
}

.board.disabled {
    background: #d3d3d3;
}

.board.disabled-opponent {
    background: #d3d3d3;
}

.cell {
    background: #ffffff;
    border: 1px solid #000000;
    border-radius: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    cursor: default;
    transition: all 0.2s ease;
    font-family: 'Courier New', Courier, monospace;
}

.board.disabled .cell {
    background: #e8e8e8;
}

.board.disabled-opponent .cell {
    background: #e8e8e8;
}

.cell.ship {
    background: url('/assets/ship.png') center/cover no-repeat;
}

.cell.ship.dead {
    background: url('/assets/dead.png') center/cover no-repeat;
}

.cell.hit {
    background: url('/assets/ship-attacked.png') center/cover no-repeat;
}
.cell.miss {
    background: url('/assets/miss.png') center/cover no-repeat;
    opacity: 0.4;
    position: relative;
}

.cell.miss:not(.ship)::after {
    display: none;
}

.cell.clickable {
    cursor: pointer;
}

.cell.clickable:hover {
    background: #f5f5f5;
    transform: scale(1.05);
}

@keyframes sunkPulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(211, 47, 47, 0.7);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 0 0 10px rgba(211, 47, 47, 0);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(211, 47, 47, 0);
    }
}

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

#game-over-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 20px;
}

#game-over-screen.hidden {
    display: none !important;
}

.game-result-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 600px;
}

.result-container {
    background: white;
    border-radius: 0;
    padding: 40px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    text-align: center;
    width: 100%;
}

.result-container.winner {
    border: 4px solid #4CAF50;
    background-color: #d0e0ff;
}

.result-container.loser {
    border: 4px solid #f44336;
    background-color: #d0e0ff;
}

.result-container h2 {
    font-size: 2.5em;
    margin-bottom: 20px;
    color: #333;
    font-family: 'Courier New', Courier, monospace;
}

.result-container p {
    font-size: 1.2em;
    color: #666;
    margin-bottom: 20px;
    font-family: 'Courier New', Courier, monospace;
}

.result-stats {
    background: rgba(0, 0, 0, 0.05);
    padding: 15px;
    border-radius: 0;
    margin: 20px 0;
    text-align: left;
}

.result-stats p {
    margin: 8px 0;
    font-size: 1em;
    font-family: 'Courier New', Courier, monospace;
}

.result-stats span {
    font-weight: bold;
    color: black;
    font-family: 'Courier New', Courier, monospace;
}

.main-menu-btn {
    background: white;
    color: black;
    border: none;
    padding: 15px 30px;
    font-size: 18px;
    border-radius: 0;
    cursor: pointer;
    margin: 10px;
    width: 100%;
    max-width: 300px;
    font-family: 'Courier New', Courier, monospace;
    box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.3);
}

.main-menu-btn:hover {
    transform: translateY(-3px);
    box-shadow: 5px 5px 0 rgba(0, 0, 0, 0.3);
}

.play-again-btn {
    background: white;
    color: black;
    border: none;
    padding: 15px 30px;
    font-size: 18px;
    border-radius: 0;
    cursor: pointer;
    margin: 10px;
    width: 100%;
    max-width: 300px;
    font-family: 'Courier New', Courier, monospace;
    box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.3);
}

.play-again-btn:hover {
    transform: translateY(-3px);
    box-shadow: 5px 5px 0 rgba(0, 0, 0, 0.3);
}

#hint {
    text-align: center;
    color: #666;
    font-style: italic;
    margin-top: 10px;
    font-family: 'Courier New', Courier, monospace;
}

.setup-layout {
    display: grid;
    grid-template-columns: 280px 280px 1fr;
    gap: 20px;
    width: 100%;
    align-items: start;
}

.setup-header-block {
    background: #d0e0ff;
    border: 1px solid #000;
    border-radius: 0;
    display: flex;
    flex-direction: column;
    box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.2);
    overflow: hidden;
    height: fit-content;
}
.setup-info {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.form-group-setup {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group-setup label {
    font-weight: bold;
    color: #333;
    font-size: 18px;
    font-family: 'Courier New', Courier, monospace;
}

.nickname-input-group {
    display: flex;
    gap: 8px;
    align-items: center;
}

.form-group-setup input {
    padding: 10px;
    border: 1px solid #f5f5f5;
    border-radius: 0;
    font-size: 14px;
    font-family: 'Courier New', Courier, monospace;
    box-sizing: border-box;
    flex: 1;
    box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.3);
}

.form-group-setup input:focus {
    outline: none;
    border-color: #000000;
}

.nickname-save-btn {
    width: 35px;
    height: 35px;
    background: url('/assets/save.gif') center/cover no-repeat;
    border: none;
    border-radius: 0;
    cursor: pointer;
    flex-shrink: 0;
    box-shadow: none;
}

.nickname-save-btn:hover {
    transform: scale(1.3);
    box-shadow: none;
}

.nickname-save-btn:active {
    transform: scale(0.95);
    box-shadow: none;
}

.game-controls-setup {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.game-controls-setup button {
    padding: 10px;
    font-size: 20px;
}

#find-game-btn img {
    transform: translateY(2px);
}
.setup-ships-block {
    background: #d0e0ff;
    border: 1px solid #000;
    border-radius: 0;
    display: flex;
    flex-direction: column;
    box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.2);
    overflow: hidden;
    height: fit-content;
}

.clear-board-btn {
    padding: 10px;
    font-size: 20px;
    margin: 8px;
    margin-bottom: 0;
}

.setup-ships-block .ships-list {
    padding: 15px;
    flex: 1;
    overflow-y: auto;
}
.setup-board-block {
    background: #d0e0ff;
    border: 1px solid #000;
    border-radius: 0;
    display: flex;
    flex-direction: column;
    box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.2);
    overflow: hidden;
    padding: 20px;
    align-items: center;
    gap: 15px;
    height: fit-content;
}

.board-header {
    width: 100%;
    text-align: center;
    background: white;
    padding: 8px;
    box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.3);
    margin: 8px;
    border: 1px solid #000;
}

.board-header h3 {
    margin: 0;
    color: black;
    font-family: 'Courier New', Courier, monospace;
}

.ships-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 0;
    min-height: auto;
    padding: 0;
    background: transparent;
    border-radius: 0;
    border: none;
}

.ship-to-place {
    cursor: move;
    padding: 5px;
    background: white;
    border: 1px solid white;
    border-radius: 0;
    box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.3);
}

.ship-to-place:hover {
    border: 1px solid black;
}

.ship-visual {
    display: flex;
    gap: 2px;
    margin: 0 auto;
    justify-content: center;
}

.ship-cell {
    width: 30px !important;
    height: 30px !important;
    background: url('/assets/ship.png') center/cover no-repeat !important;
    border-radius: 0 !important;
    border: 1px solid black !important;
    flex-shrink: 0 !important;
}

.placement-board {
    position: relative;
}

.placement-board .cell {
    transition: none;
}

.placement-board .cell.drop-valid {
    border: 2px solid #4CAF50;
    box-shadow: inset 0 0 0 2px #4CAF50, inset 0 0 0 3px #c8e6c9;
}

.placement-board .cell.drop-invalid {
    border: 2px solid #f44336;
    box-shadow: inset 0 0 0 100px rgba(255, 77, 77, 0.5);
}

.placement-board .cell.ship {
    cursor: move;
    background: url('/assets/ship.png') center/cover no-repeat;
}
.ship-drag-image {
    pointer-events: none;
    z-index: 10000;
}
.hint {
    font-size: 12px;
    color: #666;
    margin-top: 10px;
    text-align: center;
    font-style: italic;
    font-family: 'Courier New', Courier, monospace;
}

.game-layout {
    display: grid;
    grid-template-columns: 280px 1fr 280px;
    gap: 20px;
    width: 100%;
    align-items: start;
}

.game-info-block {
    background: #d0e0ff;
    border: 1px solid #000;
    border-radius: 0;
    display: flex;
    flex-direction: column;
    box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.2);
    overflow: hidden;
    height: fit-content;
}

.game-info-header {
    background: white;
    color: black;
    padding: 8px 15px;
    text-align: center;
    box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.3);
    margin: 8px;
    border: 1px solid #000;
}

.game-info-header h2 {
    margin: 0;
    font-size: 1.3em;
    font-family: 'Courier New', Courier, monospace;
}

.game-info-content {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.player-info-item {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 12px;
    background: #f5f5f5;
    border-radius: 0;
}

.player-info-item .label {
    font-size: 12px;
    font-weight: bold;
    color: #666;
    text-transform: uppercase;
    font-family: 'Courier New', Courier, monospace;
}

.player-info-item .nickname {
    font-size: 16px;
    font-weight: bold;
    color: black;
    word-break: break-word;
    font-family: 'Courier New', Courier, monospace;
}

.turn-status {
    background: #f5f5f5;
    border: none;
    border-radius: 0;
    padding: 12px;
    text-align: center;
}

.turn-status p {
    margin: 0;
    font-weight: bold;
    color: black;
    font-family: 'Courier New', Courier, monospace;
}

.surrender-btn {
    background: white;
    color: black;
    padding: 12px;
    font-weight: bold;
    border: none;
    border-radius: 0;
    cursor: pointer;
    font-family: 'Courier New', Courier, monospace;
    box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.3);
}

.surrender-btn:hover {
    background: white;
    transform: translateY(-2px);
    box-shadow: 5px 5px 0 rgba(0, 0, 0, 0.3);
}

.chat-container {
    background: #d0e0ff;
    border: 1px solid #000;
    border-radius: 0;
    display: flex;
    flex-direction: column;
    height: 600px;
    box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
    overflow: hidden;
}

.chat-header {
    background: white;
    color: black;
    padding: 8px 15px;
    border-radius: 0;
    text-align: center;
    font-weight: bold;
    font-family: 'Courier New', Courier, monospace;
    box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.3);
    margin: 8px;
    border: 1px solid #000;
}

.chat-header h3 {
    margin: 0;
    font-size: 1.2em;
    font-family: 'Courier New', Courier, monospace;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: #d0e0ff;
}

.chat-message {
    padding: 10px;
    border-radius: 0;
    max-width: 85%;
    word-wrap: break-word;
    font-size: 14px;
    line-height: 1.4;
    font-family: 'Courier New', Courier, monospace;
    background-color: white;
    color: black;
    box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.3);
}

.chat-message.own {
    align-self: flex-end;
    border-bottom-right-radius: 0;
}

.chat-message.opponent {
    align-self: flex-start;
    border-bottom-left-radius: 0;
}

.chat-message-author {
    font-weight: bold;
    font-size: 12px;
    margin-bottom: 4px;
    opacity: 0.9;
    font-family: 'Courier New', Courier, monospace;
}

.chat-message-time {
    font-size: 10px;
    opacity: 0.7;
    margin-top: 4px;
    font-family: 'Courier New', Courier, monospace;
}

.chat-input-container {
    display: flex;
    gap: 5px;
    padding: 10px;
    background: #d0e0ff;
    border-radius: 0;
    border-top: 2px solid #fff;
    box-sizing: border-box;
    min-width: 0;
}

.chat-input-container input {
    flex: 1;
    padding: 8px;
    border: 1px solid white;
    border-radius: 0;
    font-size: 14px;
    min-width: 0;
    box-sizing: border-box;
    font-family: 'Courier New', Courier, monospace;
    box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.3);
}

.chat-input-container input:focus {
    outline: none;
    border-color: #000000;
}

.chat-input-container button {
    padding: 8px 12px;
    background: white;
    color: black;
    border: none;
    border-radius: 0;
    font-size: 13px;
    font-weight: bold;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    box-sizing: border-box;
    font-family: 'Courier New', Courier, monospace;
    box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.3);
}

.chat-input-container button:hover {
    transform: translateY(-2px);
    box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.3);
}

.chat-input-container button:active {
    transform: translateY(0);
}

.game-boards-block {
    background: #d0e0ff;
    border: 1px solid #000;
    border-radius: 0;
    padding: 20px;
    box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    height: fit-content;
}

@media (max-width: 1024px) {
    .game-layout {
        grid-template-columns: 1fr;
    }
    
    .chat-container {
        height: auto;
        min-height: 300px;
    }
}

@media (max-width: 1400px) {
    .setup-layout {
        grid-template-columns: 1fr;
    }

    .waiting-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .boards-container {
        flex-direction: column;
        align-items: center;
    }

    .board {
        grid-template-columns: repeat(10, 30px);
        grid-template-rows: repeat(10, 30px);
    }

    .container {
        padding: 20px;
    }

    h1 {
        font-size: 2em;
    }
    
    .setup-layout {
        grid-template-columns: 1fr;
    }
}

.waiting-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 20px;
    width: 100%;
    align-items: start;
}

.waiting-nickname-block {
    background: #d0e0ff;
    border: 1px solid #000;
    border-radius: 0;
    display: flex;
    flex-direction: column;
    box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.2);
    overflow: hidden;
    height: fit-content;
}

.waiting-header {
    background: white;
    color: black;
    padding: 8px 15px;
    text-align: center;
    box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.3);
    margin: 8px;
    border: 1px solid #000;
}

.waiting-header h2 {
    margin: 0;
    font-size: 1.3em;
    font-family: 'Courier New', Courier, monospace;
}

.waiting-nickname-content {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    text-align: center;
}

.waiting-nickname-content p {
    margin: 0;
    font-size: 18px;
    font-weight: bold;
    color: black;
    word-break: break-word;
    font-family: 'Courier New', Courier, monospace;
}

.waiting-main-block {
    background: #d0e0ff;
    border: 1px solid #000;
    border-radius: 0;
    display: flex;
    flex-direction: column;
    box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.2);
    overflow: hidden;
    height: fit-content;
    width: 100%;
    max-width: 1600px;
}

.waiting-main-header {
    background: white;
    color: black;
    padding: 8px 15px;
    text-align: center;
    box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.3);
    margin: 8px;
    border: 1px solid #000;
}

.waiting-main-header h3 {
    margin: 0;
    font-size: 1.2em;
    font-family: 'Courier New', Courier, monospace;
}

.waiting-main-content {
    padding: 30px 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.waiting-main-content p {
    margin: 0;
    font-size: 20px;
    font-family: 'Courier New', Courier, monospace;
    font-weight: bold;
}

.cancel-btn {
    padding: 10px 20px;
    font-size: 20px;
    background: white;
    color: black;
    margin-top: 10px;
    box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.3);
    font-weight: normal;
}

.searching-gif-main {
    height: 19vh;
}

.searching-gif-inline {
    height: 25px;
}

.turn-info {
    font-size: 18px;
}

.turn-gif {
    height: 18px;
}

.result-gif {
    height: 1.5em;
}

.page-footer {
    padding: 10px;
    background-color: #d0e0ff;
    border: 1px solid black;
    text-align: center;
    font-family: 'Courier New', Courier, monospace;
    box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.3);
    display: flex;
    justify-content: space-between;
}

.page-header {
    display: flex;
    justify-content: center;
}

.logo-sub {
    height: 80%;
}