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;
}
#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;
}
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;
}
.hidden {
    display: none;
  }
  #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; 
  }
  #warning-box.show {
    opacity: 1;        
  }
  #attack-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
  }
  #attack-wrapper .board-row-wrapper {
    display: flex;
    justify-content: center;
    gap: 40px; 
  }
  .turn-indicator {
    text-align: center;
    font-size: 24px;
    font-weight: bold;
    color: white;
    margin-bottom: 20px;
  }
  .hidden {
    display: none;
  }
  body {
    background-image: url('../bg-battleship.jpg');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
  }
  .dot-loader::after {
    content: '';
    display: inline-block;
    animation: dot-ellipses 1.5s steps(4, end) infinite;
    width: 1em;
  } 
  @keyframes dot-ellipses {
    0%   { content: ''; }
    25%  { content: '.'; }
    50%  { content: '..'; }
    75%  { content: '...'; }
    100% { content: ''; }
  }
  #timer-display {
    font-family: Impact, sans-serif;
    font-size: 28px;
    font-weight: bold;
    color: white;
    text-align: center;
    text-shadow:
      -1px -1px 0 #000,
       1px -1px 0 #000,
      -1px  1px 0 #000,
       1px  1px 0 #000;
    margin-top: 8px;
    min-height: 32px;      
    line-height: 32px;    
    transition: color 0.3s ease, text-shadow 0.3s ease;
}
  #timer-display.red-warning {
    color: #ff3c3c;
    text-shadow:
      0 0 5px rgba(255, 0, 0, 0.9),
      0 0 10px rgba(255, 0, 0, 0.7),
      -1px -1px 0 #000,
       1px -1px 0 #000,
      -1px  1px 0 #000,
       1px  1px 0 #000;
  }
  #timer-display.pulse {
    animation: pulse-red 1s infinite;
  }
  @keyframes pulse-red {
    0%   { transform: scale(1); opacity: 1; }
    50%  { transform: scale(1.1); opacity: 0.75; }
    100% { transform: scale(1); opacity: 1; }
  }
  body.matchmaking-mode #menu-button {
    margin-top: 30px;
  }
  @keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
  }
  @keyframes scaleIn {
    from { transform: scale(0.95); opacity: 0; }
    to   { transform: scale(1); opacity: 1; }
  }
  .invisible-temp {
    visibility: hidden;
    position: absolute;
}
.popup {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  animation: fadeIn 0.3s ease-out;
}
  .popup-content {
  background: #fff;
  border-radius: 16px;
  padding: 24px 32px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
  text-align: center;
  font-family: "Segoe UI", sans-serif;
  max-width: 400px;
  width: 90%;
  animation: scaleIn 0.2s ease-out;
}
.popup-content .emoji {
  font-size: 40px;
  display: block;
  margin-bottom: 12px;
}
.popup-content .text {
  font-size: 18px;
  color: #333;
  line-height: 1.4;
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes scaleIn {
  from { transform: scale(0.95); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}
.container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin-top: 100px;
}
#matchmaking-status {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  font-size: 1.6rem;
  color: #ffffff;
  text-shadow: 0 0 5px #000;
  background: rgba(0, 0, 0, 0.3);
  padding: 10px 20px;
  border-radius: 16px;
  box-shadow: 0 0 12px rgba(255, 255, 255, 0.2);
  animation: pulse 2s infinite;
}
#waiting-dots::after {
  content: '';
  animation: dots 1.5s steps(3,end) infinite;
}
@keyframes dots {
  0%,20%   { content: ''; }
  40%      { content: '.'; }
  60%      { content: '..'; }
  80%,100% { content: '...'; }
}
@keyframes pulse {
  0%,100% { transform: scale(1); }
  50%     { transform: scale(1.02); }
}
#matchmaking-timer {
  font-family: Impact, sans-serif;
  font-size: 28px;
  font-weight: bold;
  color: white;
  text-shadow: -1px -1px 0 #000, 1px -1px 0 #000,
               -1px  1px 0 #000, 1px  1px 0 #000;
  margin-top: 8px;
  min-height: 32px;
  line-height: 32px;
}
.menu-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;
}
.menu-button:hover {
  background-color: #555;
}
#server-full-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(30, 30, 30, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}
#server-full-modal .modal-content {
  background: #fff;
  color: #222;
  padding: 2rem;
  border-radius: 1rem;
  text-align: center;
  width: 90%;
  max-width: 400px;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.4);
  animation: fadeIn 0.3s ease-in-out;
}
#server-full-modal h2 {
  margin-bottom: 1.5rem;
  font-size: 1.5rem;
}
#server-full-modal p {
  font-size: 1.2rem;
  margin-bottom: 1.5rem;
}
#server-full-modal .menu-button {
  margin-top: 0; 
}
@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.9); }
  to { opacity: 1; transform: scale(1); }
}
#lobby-selection.lobby-popup {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  justify-content: center;
  align-items: center;
  z-index: 999;
}
#lobby-selection.lobby-popup.show {
  display: flex;
}
#lobby-selection.lobby-popup .popup-content {
  background: #ffffff;
  border-radius: 20px;
  padding: 32px 24px;
  max-width: 360px;
  width: 90%;
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
  text-align: center;
  animation: lobbyPop 0.35s ease-out forwards;
  opacity: 0;
  transform: translateY(-20px);
}
@keyframes lobbyPop {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
#lobby-selection.lobby-popup .popup-content h2 {
  margin-bottom: 20px;
  font-size: 1.6rem;
  font-weight: 700;
  color: #222;
}
#lobby-selection.lobby-popup .lobby-option {
  width: 100%;
  max-width: 240px;
  margin: 0 auto;
  padding: 12px 0;
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
  background-color: #007acc;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.2s, transform 0.1s;
}
#lobby-selection.lobby-popup .lobby-option:hover {
  background-color: #005f99;
  transform: translateY(-1px);
}
#lobby-selection.lobby-popup #back-to-menu-btn {
  margin-top: 20px;
}
@media (max-width: 640px) {
  :root {
    --bg-left: 8%;
    --bg-top: 11%;
    --bg-right: 7%;
    --bg-bottom: 3%;
  }
  #player1-attack-board,
  #player2-attack-board,
  #player1-board,
  #player2-board {
    width: 92vw;
    height: calc(92vw * 468 / 470);
    background-size: 100% 100%;
    background-position: center;
    background-repeat: no-repeat;
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    grid-template-rows: repeat(10, 1fr);
    box-sizing: border-box;
    padding-left: var(--bg-left);
    padding-top: var(--bg-top);
    padding-right: var(--bg-right);
    padding-bottom: var(--bg-bottom);
    margin: 0 auto;
    gap: 0;
  }
  #player1-attack-board .cell,
  #player2-attack-board .cell,
  #player1-board .cell,
  #player2-board .cell {
    width: 100%;
    height: 100%;
    margin: 0;
    border: 0;
    box-sizing: border-box;
    background-color: rgba(255, 255, 255, 0.01);
  }
}