body {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    min-height: 100vh;
    margin: 0;
    padding: 0;
    background: url('./BattleShipBackground.png') no-repeat center center fixed;
    background-size: cover;
    box-sizing: border-box;
}

.game-container {
    background: rgba(30,60,114,0.92);
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
    text-align: center;
    width: 95vw;
    max-width: 800px;
    margin: 0 auto;
    margin-top: 60px; /* Space for navbar */
    min-height: calc(100vh - 80px); /* Full height minus navbar space */
}

.game-grid {
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    gap: 2px;
    background-color: #333;
    padding: 10px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
    max-width: 95vw;
    margin: 20px auto;
}

.grid-cell {
    position: relative;
    background-color: #444;
    border-radius: 6px;
    min-width: 24px;
    min-height: 24px;
    aspect-ratio: 1;
    font-size: 3vw;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.grid-cell:hover {
    background-color: #666;
    transform: scale(1.1);
}

.grid-cell.hit {
    position: relative;
    background: url('./dog.webp') no-repeat center center;
    background-size: cover;
    transform: scale(0.95);
    pointer-events: none;
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Base fire effect for hit ships */
.grid-cell.hit::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('./Fire_GIF.gif') no-repeat center center;
    background-size: contain;
    mix-blend-mode: screen;
    opacity: 0;
    pointer-events: none;
    z-index: 1;
    animation: fadeInFire 0.3s ease-out forwards;
}

/* Override for destroyed ships - crying dog base image */
.grid-cell.hit.ship-destroyed {
    background: url('./crying\ dog.png') no-repeat center center;
    background-size: cover;
    transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Remove fire and add explosion for destroyed ships */
.grid-cell.hit.ship-destroyed::after {
    content: '';
    position: absolute;
    top: -25%;
    left: -25%;
    right: -25%;
    bottom: -25%;
    background: url('./smoke.gif') no-repeat center center;
    background-size: 100% 100%;
    opacity: 0;
    mix-blend-mode: lighten;
    z-index: 2;
    transform: scale(1.25);
    animation: smokeEffect 0.8s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.grid-cell.miss {
    background-color: #666;
    transform: scale(0.95);
    pointer-events: none;
}

.navbar {
    background-color: #1e3c72;
    padding: 10px 0;
    text-align: center;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    width: 100%;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000;
}

.navbar ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: center;
    gap: 20px;
}

.navbar li {
    display: inline;
}

.navbar a {
    text-decoration: none;
    color: white;
    font-size: 1.2rem;
    font-weight: bold;
    transition: color 0.3s ease;
}

.navbar a:hover {
    color: lightblue;
}

.page-title {
    margin: 0 0 30px 0;
    text-align: center;
    font-size: 6vw;
    min-font-size: 1.5rem;
    font-weight: bold;
    color: white;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.ship-input {
    margin: 6px 0;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    display: grid;
    grid-template-columns: 1fr 50px;  /* Adjusted to give more space for the ship names with sizes */
    gap: 10px;
    align-items: center;
    transition: all 0.3s ease;
}

.ship-input:hover {
    background: rgba(255, 255, 255, 0.18);
    transform: translateX(5px);
}

.ship-input label {
    color: #ffffff;
    font-size: 1.05rem;
    font-weight: 500;
    letter-spacing: 0.5px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.4);
    text-align: left;
    white-space: nowrap;
}

.ship-input input {
    width: 50px;
    padding: 6px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.95);
    color: #1e3c72;
    font-weight: bold;
    font-size: 0.95rem;
    text-align: center;
    transition: all 0.2s ease;
}

.ship-input input:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.4);
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.1);
}

.ship-status table {
    width: 100%;
    max-width: 400px;
    margin: 20px auto;
    border-collapse: separate;
    border-spacing: 0 6px;
}

.ship-status td {
    padding: 10px 15px;
    color: white;
    background: rgba(255, 255, 255, 0.12);
    transition: all 0.3s ease;
    letter-spacing: 0.5px;
}

.ship-status td:first-child {
    border-radius: 8px 0 0 8px;
    font-weight: 500;
    font-size: 1.05rem;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.4);
    padding-right: 20px;  /* Added more padding for the ship names with sizes */
}

.ship-status td:last-child {
    border-radius: 0 8px 8px 0;
    font-weight: bold;
    text-align: center;
    width: 50px;
    background: rgba(255, 255, 255, 0.15);
}

.ship-setup h3, .ship-status h3 {
    color: white;
    font-size: 1.3rem;
    margin-bottom: 15px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    letter-spacing: 0.5px;
}

.game-boards {
    display: none; /* Hide initially */
}

.game-boards.show {
    display: block; /* Show when class is added */
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.game-controls {
    margin-top: 20px;
    display: flex;
    gap: 10px;
    justify-content: center;
}

.game-controls button {
    padding: 10px 20px;
    font-size: 1.1rem;
    border-radius: 5px;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    background-color: #4CAF50;
    color: white;
    font-weight: bold;
    width: auto;
    min-width: 90px;
    max-width: 180px;
}

.game-controls button:hover {
    transform: translateY(-2px);
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.game-controls #reset-game {
    background-color: #f44336;
}

@keyframes fadeInFire {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes smokeEffect {
    0% {
        opacity: 0;
        transform: scale(0.8) translateY(10px);
    }
    20% {
        opacity: 1;
    }
    100% {
        opacity: 0.9;
        transform: scale(1.25) translateY(-5px);
    }
}

#health-container {
    width: 100%;
    max-width: 500px;
    margin: 20px auto;
    padding: 15px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.health-bar {
    height: 25px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 10px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.1);
}

.health-fill {
    height: 100%;
    background: linear-gradient(90deg, #4CAF50, #45a049);
    width: 100%;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.lives-text {
    color: white;
    font-size: 1.2rem;
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
    text-align: center;
}

.gameover-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    animation: fadeIn 0.5s ease-in-out;
}

.gameover-overlay img {
    max-width: 80%;
    max-height: 80%;
    animation: scaleIn 0.7s ease-out;
}

.hidden {
    display: none;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes scaleIn {
    from {
        transform: scale(0);
    }
    to {
        transform: scale(1);
    }
}

.difficulty-setup {
    margin: 20px 0;
}

.difficulty-options {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin-top: 10px;
}

.difficulty-options label {
    background: rgba(255, 255, 255, 0.12);
    padding: 8px 15px;
    border-radius: 8px;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
}

.difficulty-options label[for="easy"] {
    background: rgba(76, 175, 80, 0.6);
    color: #e8f5e9;
}

.difficulty-options label[for="easy"]:hover {
    background: rgba(76, 175, 80, 0.8);
}

.difficulty-options label[for="medium"] {
    background: rgba(255, 152, 0, 0.6);
    color: #fff3e0;
}

.difficulty-options label[for="medium"]:hover {
    background: rgba(255, 152, 0, 0.8);
}

.difficulty-options label[for="hard"] {
    background: rgba(244, 67, 54, 0.6);
    color: #ffebee;
}

.difficulty-options label[for="hard"]:hover {
    background: rgba(244, 67, 54, 0.8);
}

.difficulty-options label[for="extreme"] {
    background: rgba(183, 28, 28, 0.7);
    color: #ffebee;
}

.difficulty-options label[for="extreme"]:hover {
    background: rgba(183, 28, 28, 0.9);
}

.difficulty-options input[type="radio"] {
    margin-right: 8px;
}

.difficulty-options input[type="radio"]:checked + label {
    transform: scale(1.05);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

@media (max-width: 600px) {
    .game-container {
        padding: 8px;
        max-width: 99vw;
    }
    .game-grid {
        max-width: 99vw;
        padding: 2vw;
    }
    .grid-cell {
        min-width: 8vw;
        min-height: 8vw;
        font-size: 6vw;
    }
    .page-title {
        font-size: 8vw;
    }
    .game-controls button {
        width: 80vw;
        font-size: 6vw;
    }
    .ship-status table {
        font-size: 4vw;
    }
}

@media (min-width: 1200px) {
    .game-container {
        max-width: 1000px;
    }
    .game-grid {
        max-width: 700px;
    }
    .grid-cell {
        min-width: 40px;
        min-height: 40px;
        font-size: 2vw;
    }
    .page-title {
        font-size: 3vw;
    }
}