body {
    font-family: Arial, sans-serif;
    text-align: center;
    background-color: #f0f0f0;
    margin: 0;
    padding: 20px;
}
h1, h2 {
    color: #333;
}
.board {
    display: grid;
    grid-template-columns: repeat(10, 40px);
    grid-template-rows: repeat(10, 40px);
    gap: 5px;
    justify-content: center;
    margin: 10px auto;
}
.cell {
    width: 40px;
    height: 40px;
    background-color: lightblue;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: 1px solid #000;
    transition: background-color 0.3s ease;
}
.cell:hover {
    background-color: #add8e6;
}
.cell.placing {
    background-color: #90ee90;
}
.cell.placing:hover {
    background-color: #76c776;
}
.cell.hit {
    background-color: red;
}
.cell.miss {
  background-image: url('../miss.png');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  animation: splashFade 0.4s ease-out;
}
@keyframes splashFade {
    from { opacity: 0; }
    to { opacity: 1; }
}
.cell.ship {
    background-color: #006400;
}
#message {
    margin-top: 20px;
    font-size: 1.2em;
    color: #333;
    white-space: pre-line;
}
#turn-indicator {
    margin-top: 10px;
    font-size: 1.1em;
    font-weight: bold;
    color: #555;
}
#reset-button {
    margin-top: 20px;
    padding: 10px 20px;
    font-size: 1em;
    font-weight: bold;
    color: #fff;
    background-color: #333;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}
#reset-button:hover {
    background-color: #555;
}
.game-container {
    display: flex;
    justify-content: center;
    gap: 50px;
    flex-wrap: wrap;
}
.board-column {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}
#player1-attack-board,
#player2-attack-board {
     background-image: url('../attack-grid-bg.png');
    background-size: 100% 100%;
    background-position: center;
    background-repeat: no-repeat;
    width: 470px;
    height: 468px;
    display: grid;
    grid-template-columns: repeat(10, 40px);
    grid-template-rows: repeat(10, 40px);
    gap: 0;
}
#player1-attack-board .cell,
#player2-attack-board .cell {
    width: 40px;
    height: 42px;
    background-color: rgba(255, 255, 255, 0.01);
    border: 1px solid rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
    margin-top: 51.5px;
    margin-left: 2px;
}
#player1-board,
#player2-board {
   background-image: url('../attack-grid-bg.png');
    background-size: 100% 100%;
    background-position: center;
    background-repeat: no-repeat;
    width: 470px;
    height: 468px;
    display: grid;
    grid-template-columns: repeat(10, 40px);
    grid-template-rows: repeat(10, 40px);
    gap: 0;
}
#player1-board .cell,
#player2-board .cell {
    width: 40px;
    height: 42px;
    background-color: rgba(255, 255, 255, 0.01);
    border: 1px solid rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
    margin-top: 51.5px;
    margin-left: 2px;
}
.cell.hit {
  background-image: url('../hit.png');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  animation: hitFade 0.3s ease-out;
}
.hidden {
    display: none !important;
}
.cell.ship.carrier-horizontal-1 {
  background-image: url('../ships/carrier-horizontal-1.jpg');
}
.cell.ship.carrier-horizontal-2 {
  background-image: url('../ships/carrier-horizontal-2.jpg'); 
}
.cell.ship.carrier-horizontal-3 {
  background-image: url('../ships/carrier-horizontal-3.jpg'); 
}
.cell.ship.carrier-horizontal-4 {
  background-image: url('../ships/carrier-horizontal-4.jpg'); 
}
.cell.ship.carrier-horizontal-5 {
  background-image: url('../ships/carrier-horizontal-5.jpg');
}
.cell.ship.carrier-horizontal-1,
.cell.ship.carrier-horizontal-2,
.cell.ship.carrier-horizontal-3,
.cell.ship.carrier-horizontal-4,
.cell.ship.carrier-horizontal-5 {
    background-size: 100%;
    background-repeat: no-repeat;
    background-position: center 42%;
    border: 1px solid #000;
}
.cell.ship.battleship-horizontal-1 {
  background-image: url('../ships/battleship-horizontal-1.jpg');
}
.cell.ship.battleship-horizontal-2 {
  background-image: url('../ships/battleship-horizontal-2.jpg');
}
.cell.ship.battleship-horizontal-3 {
  background-image: url('../ships/battleship-horizontal-3.jpg');
}
.cell.ship.battleship-horizontal-4 {
  background-image: url('../ships/battleship-horizontal-4.jpg');
}
.cell.ship.battleship-horizontal-1,
.cell.ship.battleship-horizontal-2,
.cell.ship.battleship-horizontal-3,
.cell.ship.battleship-horizontal-4 {
    background-size: 100%;
    background-repeat: no-repeat;
    background-position: center 42%;
    border: 1px solid #000;
}
.menu-button {
    margin-top: 10px;
    padding: 10px 20px;
    font-size: 1em;
    font-weight: bold;
    color: #fff;
    background-color: #333;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}
.menu-button:hover {
    background-color: #555;
}
#victory-message {
    font-size: 2em;
    color: #222;
    margin-bottom: 20px;
    animation: popIn 0.4s ease-out;
}
@keyframes popIn {
    0% {
        transform: scale(0.8);
        opacity: 0;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}
.cell.ship.battleship-vertical-1 {
  background-image: url('../ships/battleship-vertical-1.jpg');
}
.cell.ship.battleship-vertical-2 {
  background-image: url('../ships/battleship-vertical-2.jpg');
}
.cell.ship.battleship-vertical-3 {
  background-image: url('../ships/battleship-vertical-3.jpg');
}
.cell.ship.battleship-vertical-4 {
  background-image: url('../ships/battleship-vertical-4.jpg');
}
.cell.ship.battleship-vertical-1,
.cell.ship.battleship-vertical-2,
.cell.ship.battleship-vertical-3,
.cell.ship.battleship-vertical-4 {
    background-size: cover;
    background-repeat: no-repeat;
    background-position: center 42%;
    border: 1px solid #000;
}
.cell.ship.carrier-vertical-1 {
  background-image: url('../ships/carrier-vertical-1.jpg');
}
.cell.ship.carrier-vertical-2 {
  background-image: url('../ships/carrier-vertical-2.jpg');
}
.cell.ship.carrier-vertical-3 {
  background-image: url('../ships/carrier-vertical-3.jpg');
}
.cell.ship.carrier-vertical-4 {
  background-image: url('../ships/carrier-vertical-4.jpg');
}
.cell.ship.carrier-vertical-5 {
  background-image: url('../ships/carrier-vertical-5.jpg');
}
.cell.ship.carrier-vertical-1,
.cell.ship.carrier-vertical-2,
.cell.ship.carrier-vertical-3,
.cell.ship.carrier-vertical-4,
.cell.ship.carrier-vertical-5 {
    background-size: cover;
    background-repeat: no-repeat;
    background-position: center;
    border: 1px solid #000;
}
body {
    background-image: url('../bg-battleship.jpg');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
}
h1, h2, p, label, select, #message, #turn-indicator {
    color: #000;
    text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.9);
}
.top-text-container {
    background-color: rgba(255, 255, 255, 0.8);
    display: inline-block;
    padding: 20px 30px;
    border-radius: 12px;
    box-shadow: 0 0 12px rgba(0, 0, 0, 0.2);
    margin-top: 20px;
    margin-bottom: 10px;
}
.mute-button {
    position: fixed;
    top: 15px;
    right: 15px;
    z-index: 1000;
    background-color: rgba(255, 255, 255, 0.85);
    border: none;
    border-radius: 50%;
    font-size: 22px;
    cursor: pointer;
    padding: 10px;
    box-shadow: 0 0 8px rgba(0, 0, 0, 0.2);
    transition: background-color 0.2s ease;
}
.mute-button:hover {
    background-color: rgba(255, 255, 255, 1);
}
.confirm-button {
    margin-top: 20px;
    padding: 10px 26px;
    font-size: 1.15em;
    font-family: "Georgia", serif;
    font-weight: 600;
    color: #f0f0f0;
    background-color: #1c2f45;
    border: 2px solid #d4d4d4;
    border-radius: 8px;
    cursor: pointer;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
    box-shadow: 0 4px 6px rgba(0,0,0,0.2);
    transition: all 0.2s ease;
  }
  .confirm-button:hover {
    background-color: #284a63;
    border-color: #ffffff;
    transform: translateY(-2px);
  }
.cell.ship.battleship-horizontal-hit-1 {
  background-image: url('../ships-hit/battleship-horizontal-hit-1.jpg');
}
.cell.ship.battleship-horizontal-hit-2 {
  background-image: url('../ships-hit/battleship-horizontal-hit-2.jpg');
}
.cell.ship.battleship-horizontal-hit-3 {
  background-image: url('../ships-hit/battleship-horizontal-hit-3.jpg');
}
.cell.ship.battleship-horizontal-hit-4 {
  background-image: url('../ships-hit/battleship-horizontal-hit-4.jpg');
}
.cell.ship.battleship-horizontal-hit-1,
.cell.ship.battleship-horizontal-hit-2,
.cell.ship.battleship-horizontal-hit-3,
.cell.ship.battleship-horizontal-hit-4 {
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    border: 1px solid #000;
}
.cell.ship.cruiser-horizontal-1 {
  background-image: url('../ships/cruiser-horizontal-1.jpg');
}
.cell.ship.cruiser-horizontal-2 {
  background-image: url('../ships/cruiser-horizontal-2.jpg');
}
.cell.ship.cruiser-horizontal-3 {
  background-image: url('../ships/cruiser-horizontal-3.jpg');
}
.cell.ship.cruiser-horizontal-1,
.cell.ship.cruiser-horizontal-2,
.cell.ship.cruiser-horizontal-3 {
    background-size: 100%;
    background-repeat: no-repeat;
    background-position: center 42%;
    border: 1px solid #000;
}
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(20, 20, 20, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
  }
  .modal-content.fancy-modal {
    background-color: #ffffff;
    padding: 40px 30px;
    border-radius: 20px;
    text-align: center;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    animation: popIn 0.4s ease-out;
  }
  .victory-buttons {
    margin-top: 30px;
    display: flex;
    gap: 20px;
    justify-content: center;
  }
  .victory-btn {
    background-color: #1c2f45;
    color: #f0f0f0;
    padding: 12px 28px;
    border: 2px solid #ccc;
    border-radius: 10px;
    font-size: 1.1em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
  }
  .victory-btn:hover {
    background-color: #2e4f70;
    border-color: #fff;
    transform: translateY(-2px);
  }
.cell.ship.submarine-horizontal-1 {
  background-image: url('../ships/submarine-horizontal-1.jpg');
}
.cell.ship.submarine-horizontal-2 {
  background-image: url('../ships/submarine-horizontal-2.jpg');
}
.cell.ship.submarine-horizontal-1,
.cell.ship.submarine-horizontal-2 {
    background-size: 100%;
    background-repeat: no-repeat;
    background-position: center 42%;
    border: 1px solid #000;
}
.cell.ship.destroyer-horizontal-1 {
  background-image: url('../ships/destroyer-horizontal-1.jpg');
  background-size: 125%;
  background-repeat: no-repeat;
  background-position: center 42%;
  border: 1px solid #000;
}
.cell.ship.destroyer-horizontal-hit-1 {
  background-image: url('../ships-hit/destroyer-horizontal-hit-1.jpg');
  background-size: 125%;
  background-repeat: no-repeat;
  background-position: center 42%;
  border: 1px solid #000;
}
.ship-selector {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 12px;
    margin: 20px auto 10px;
    padding: 10px;
    max-width: 500px;
    background-color: rgba(255, 255, 255, 0.75);
    border-radius: 10px;
    box-shadow: 0 0 8px rgba(0,0,0,0.1);
}
.ship-option {
    padding: 10px 16px;
    font-weight: bold;
    font-size: 1em;
    background-color: #fff;
    border: 2px solid #1c2f45;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 1px 1px 4px rgba(0,0,0,0.1);
    text-shadow: 0 0 1px rgba(0,0,0,0.2);
}
.ship-option:hover {
    background-color: #dce6f0;
    transform: scale(1.05);
}
.ship-option.selected {
    background-color: #1c2f45;
    color: white;
    border-color: #ffffff;
}
.toggle-btn {
    margin-top: 10px;
    padding: 10px 20px;
    font-size: 1em;
    font-weight: bold;
    color: #333;
    background-color: #f2f2f2;
    border: 2px solid #1c2f45;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.2s ease;
    box-shadow: 1px 1px 4px rgba(0,0,0,0.1);
}
.toggle-btn:hover {
    background-color: #e0e0e0;
    transform: translateY(-1px);
}
.cell.ship.destroyer-vertical-1 {
  background-image: url('../ships/destroyer-vertical-1.jpg');
  background-size: 125%;
  background-repeat: no-repeat;
  background-position: center 42%;
  border: 1px solid #000;
}
.cell.ship.submarine-horizontal-hit-1 {
  background-image: url('../ships-hit/submarine-horizontal-hit-1.jpg');
  background-size: 130%;
  background-repeat: no-repeat;
  background-position: center;
}
.cell.ship.submarine-horizontal-hit-2 {
  background-image: url('../ships-hit/submarine-horizontal-hit-2.jpg');
  background-size: 130%;
  background-repeat: no-repeat;
  background-position: center;
}
.cell.ship.submarine-vertical-1 {
  background-image: url('../ships/submarine-vertical-1.jpg');
  background-size: cover;
  background-repeat: no-repeat;
  background-position: center;
}
.cell.ship.submarine-vertical-2 {
  background-image: url('../ships/submarine-vertical-2.jpg');
  background-size: cover;
  background-repeat: no-repeat;
  background-position: center;
}
.cell.hit.ship
  :not(.destroyer-horizontal-1)
  :not(.destroyer-vertical-1)
  :not(.destroyer-horizontal-hit-1)
  :not(.destroyer-vertical-hit-1)
{
background-image: url('../hit.png')!important;
background-size: cover;
background-position: center;
background-repeat: no-repeat;
animation: hitFade 0.3s ease-out;
}
.cell.ship.cruiser-vertical-1 {
  background-image: url('../ships/cruiser-vertical-1.jpg');
}
.cell.ship.cruiser-vertical-2 {
  background-image: url('../ships/cruiser-vertical-2.jpg');
}
.cell.ship.cruiser-vertical-3 {
  background-image: url('../ships/cruiser-vertical-3.jpg');
}
.cell.ship.cruiser-vertical-1,
.cell.ship.cruiser-vertical-2,
.cell.ship.cruiser-vertical-3 {
    background-size: cover;
    background-repeat: no-repeat;
    background-position: center;
    border: 1px solid #000;
}
.cell.ship.cruiser-horizontal-hit-1 {
  background-image: url('../ships-hit/cruiser-horizontal-hit-1.jpg');
}
.cell.ship.cruiser-horizontal-hit-2 {
  background-image: url('../ships-hit/cruiser-horizontal-hit-2.jpg');
}
.cell.ship.cruiser-horizontal-hit-3 {
  background-image: url('../ships-hit/cruiser-horizontal-hit-3.jpg');
}
.cell.ship.cruiser-horizontal-hit-1,
.cell.ship.cruiser-horizontal-hit-2,
.cell.ship.cruiser-horizontal-hit-3 {
    background-size: 100%;
    background-repeat: no-repeat;
    background-position: center 42%;
    border: 1px solid #000;
}
.cell.ship.carrier-horizontal-hit-1 {
  background-image: url('../ships-hit/carrier-horizontal-hit-1.jpg');
}
.cell.ship.carrier-horizontal-hit-2 {
  background-image: url('../ships-hit/carrier-horizontal-hit-2.jpg');
}
.cell.ship.carrier-horizontal-hit-3 {
  background-image: url('../ships-hit/carrier-horizontal-hit-3.jpg');
}
.cell.ship.carrier-horizontal-hit-4 {
  background-image: url('../ships-hit/carrier-horizontal-hit-4.jpg');
}
.cell.ship.carrier-horizontal-hit-5 {
  background-image: url('../ships-hit/carrier-horizontal-hit-5.jpg');
}
.cell.ship.carrier-horizontal-hit-1,
.cell.ship.carrier-horizontal-hit-2,
.cell.ship.carrier-horizontal-hit-3,
.cell.ship.carrier-horizontal-hit-4,
.cell.ship.carrier-horizontal-hit-5 {
    background-size: 100%;
    background-repeat: no-repeat;
    background-position: center 42%;
    border: 1px solid #000;
}
.cell.ship.submarine-vertical-hit-1 {
  background-image: url('../ships-hit/submarine-vertical-hit-1.jpg');
  background-size: cover;
  background-repeat: no-repeat;
  background-position: center;
  border: 1px solid #000;
}
.cell.ship.submarine-vertical-hit-2 {
  background-image: url('../ships-hit/submarine-vertical-hit-2.jpg');
  background-size: cover;
  background-repeat: no-repeat;
  background-position: center;
  border: 1px solid #000;
}
.cell.ship.destroyer-horizontal-hit-1.hit {
  background-image: url('../ships-hit/destroyer-horizontal-hit-1.jpg') !important;
  background-size: 125%;
  background-position: center 42%;
  background-repeat: no-repeat;
  border: 1px solid #000;
}
.cell.ship.destroyer-vertical-hit-1.hit {
  background-image: url('../ships-hit/destroyer-vertical-hit-1.jpg') !important;
  background-size: 125%;
  background-position: center 42%;
  background-repeat: no-repeat;
  border: 1px solid #000;
}
.cell.ship.battleship-vertical-hit-1 {
  background-image: url('../ships-hit/battleship-vertical-hit-1.jpg');
}
.cell.ship.battleship-vertical-hit-2 {
  background-image: url('../ships-hit/battleship-vertical-hit-2.jpg');
}
.cell.ship.battleship-vertical-hit-3 {
  background-image: url('../ships-hit/battleship-vertical-hit-3.jpg');
}
.cell.ship.battleship-vertical-hit-4 {
  background-image: url('../ships-hit/battleship-vertical-hit-4.jpg');
}
.cell.ship.battleship-vertical-hit-1,
.cell.ship.battleship-vertical-hit-2,
.cell.ship.battleship-vertical-hit-3,
.cell.ship.battleship-vertical-hit-4 {
  background-size: cover;
  background-repeat: no-repeat;
  background-position: center;
  border: 1px solid #000;
}
.cell.ship.cruiser-vertical-hit-1 {
  background-image: url('../ships-hit/cruiser-vertical-hit-1.jpg');
}
.cell.ship.cruiser-vertical-hit-2 {
  background-image: url('../ships-hit/cruiser-vertical-hit-2.jpg');
}
.cell.ship.cruiser-vertical-hit-3 {
  background-image: url('../ships-hit/cruiser-vertical-hit-3.jpg');
}
.cell.ship.cruiser-vertical-hit-1,
.cell.ship.cruiser-vertical-hit-2,
.cell.ship.cruiser-vertical-hit-3 {
  background-size: cover;
  background-repeat: no-repeat;
  background-position: center;
  border: 1px solid #000;
}
.cell.ship.carrier-vertical-hit-1 {
  background-image: url('../ships-hit/carrier-vertical-hit-1.jpg');
}
.cell.ship.carrier-vertical-hit-2 {
  background-image: url('../ships-hit/carrier-vertical-hit-2.jpg');
}
.cell.ship.carrier-vertical-hit-3 {
  background-image: url('../ships-hit/carrier-vertical-hit-3.jpg');
}
.cell.ship.carrier-vertical-hit-4 {
  background-image: url('../ships-hit/carrier-vertical-hit-4.jpg');
}
.cell.ship.carrier-vertical-hit-5 {
  background-image: url('../ships-hit/carrier-vertical-hit-5.jpg');
}
.cell.ship.carrier-vertical-hit-1,
.cell.ship.carrier-vertical-hit-2,
.cell.ship.carrier-vertical-hit-3,
.cell.ship.carrier-vertical-hit-4,
.cell.ship.carrier-vertical-hit-5 {
    background-size: cover;
    background-repeat: no-repeat;
    background-position: center;
    border: 1px solid #000;
}
.cell.ship {
    transition: transform 0.3s ease;
    transform-origin: center center;
}
  #warning-box {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background-color: #ff4c4c;
    color: white;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 18px;
    font-weight: bold;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    z-index: 9999;
    opacity: 0;         
    transition: opacity 0.5s ease; 
  }
.top-text-container.minimized .ship-selector,
.top-text-container.minimized .toggle-btn,
.top-text-container.minimized p:not(:first-of-type),
.top-text-container.minimized div {
  display: none;
}