* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

#secret {
    will-change: transform;
    opacity: 0.1;
    font-size: 1px;
}

body {
    font-family: 'Courier New', monospace;
    background-image: url("/images/background.png");
    color: white;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    overflow: hidden;
}

h1 {
    text-align: center;
    font-size: 50px;
    letter-spacing: 3px;
}

#game-container {
    position: relative;
    background-color: #0000007e;
    width: 800px;
    height: 800px;
    border: 2px solid #5a5a5ab2;
    border-radius: 10px;
    overflow: hidden;
    transform: translateZ(0);
}

#game-stats {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 50px;
    padding: 10px;
    display: flex;
    justify-content: space-between;
    z-index: 10;
    transform: translateZ(0);
}

#game-area {
    position: absolute;
    overflow: hidden;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    transform: translateZ(0);
}

#pause-container,
#start-container {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: rgba(0, 0, 0, 0.658);
    display: none;
}

#start-container {
    display: flex;
}

#start-menu {
    display: flex;
    flex-direction: column;
    align-items: left;
    gap: 10px;
}

.start-icons {
    display: flex;
    align-items: center;
    gap: 10px;
    width: fit-content;
    height: fit-content;
    text-wrap: wrap;
    font-family: 'Courier New', monospace;
}

#start-menu img {
    width: 70px;
    padding: 5px 20px;
    background-color: #ffffff57;
    color: #ffffff;
    border-radius: 10px;
}

#start {
    margin-top: 60px;
}

#pause-menu h1 {
    font-size: 50px;
}

#pause-menu {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    display: none;
    z-index: 20;
}

.menu-button {
    display: block;
    font-size: 20px;
    width: 200px;
    margin: 10px auto;
    padding: 10px 10px;
    background-color: #ffffff57;
    color: #ffffff;
    border: none;
    cursor: pointer;
    font-family: 'Courier New', monospace;
}

.menu-button:hover {
    background-color: #64646479;
}

.menu-button:disabled {
    background-color: #ffffff2f;
    color: #cfcfcf;
    cursor: not-allowed;
}

.ship {
    position: absolute;
    will-change: transform;
    transition: transform 0.1s ease-out;
}

.bullet {
    position: absolute;
    width: 4px;
    height: 12px;
    background-color: aqua;
    border-radius: 2px;
    will-change: transform;
    box-shadow: 0 0 5px aqua, 0 0 10px white, 0 0 15px white;
}

.alien {
    position: absolute;
    will-change: transform;
    transition: 0.1s ease-out;
}

.alien-bullet {
    position: absolute;
    width: 4px;
    height: 12px;
    background-color: #ff0000;
    border-radius: 2px;
    will-change: transform;
    box-shadow: 0 0 5px #ff0000, 0 0 10px #ff0000, 0 0 15px rgb(255, 0, 0);
}

/* Visual Effects */
/* explosion of aliens */
.explosion {
    position: absolute;
    width: 50px;
    height: 50px;
}


/* spaceShip hits with an alien's bullet */
.player-hit {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 0, 0, 0.3);
    animation: flash 0.2s ease-out forwards;
    pointer-events: none;
}

/* game over message */
.message-container {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    pointer-events: none;
}

.game-message {
    font-size: 48px;
    font-weight: bold;
    text-align: center;
    animation: fadeInOut 2s ease-in-out forwards;
    will-change: opacity;
    pointer-events: none;
}

.player-name {
    padding: 5px;
    min-width: 50%;
    margin-bottom: 10px;
}

/* keyframes */
@keyframes flash {
    0% {
        opacity: 1;
    }

    100% {
        opacity: 0;
    }
}

@keyframes fadeInOut {
    0% {
        opacity: 0;
    }

    15% {
        opacity: 1;
    }

    85% {
        opacity: 1;
    }

    100% {
        opacity: 0;
    }
}

.victory {
    color: #00ff00;
    text-shadow: 0 0 10px rgba(0, 255, 0, 0.5);
}

.defeat {
    color: #ff0000;
    text-shadow: 0 0 10px rgba(255, 0, 0, 0.5);
}

.story-dialog {
    position: absolute;
    top: 25%;
    left: 10%;
    background-color: rgba(0, 0, 0, 0.9);
    padding: 10px;
    border-radius: 10px;
    border: 2px solid #5a5a5ab2;
    color: white;
    text-align: center;
    max-width: 80%;
    z-index: 1000;
}

.story-dialog h2 {
    font-size: 30px;
    margin-bottom: 15px;
    color: #e5ff00;
    text-shadow: 0 0 10px rgba(229, 255, 0, 0.712);
}

.story-dialog p {
    font-size: 20px;
    line-height: 1.6;
    margin-bottom: 15px;
}

.story-dialog .menu-button {
    font-size: 20px;
    padding: 10px 20px;
}

.scoreboard {
    position: absolute;
    top: 10%;
    left: 10%;
    background-color: rgba(0, 0, 0, 0.9);
    padding: 10px;
    border-radius: 10px;
    border: 2px solid #5a5a5ab2;
    color: white;
    text-align: center;
    width: 80%;
    z-index: 1000;
}

.scoreboard h2 {
    font-size: 24px;
    margin-bottom: 15px;
    color: #e5ff00;
}

.scores {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.score-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    border-radius: 5px;
    background-color: #1a1a1a;
}

.score-card.first {
    background: linear-gradient(90deg, gold, #1a1a1a);
    color: black;
    font-weight: bold;
}

.score-card.second {
    background: linear-gradient(90deg, silver, #1a1a1a);
    color: black;
    font-weight: bold;
}

.score-card.third {
    background: linear-gradient(90deg, #cd7f32, #1a1a1a);
    color: black;
    font-weight: bold;
}

.rank,
.name,
.score,
.time {
    width: 25%;
    text-align: center;
}

.pagination {
    margin-top: 15px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
}

.page-btn {
    padding: 5px 10px;
    background-color: #ffffff57;
    color: #ffffff;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}

.page-btn:disabled {
    background-color: #ffffff2f;
    color: #cfcfcf;
    cursor: not-allowed;
}

#play-again {
    display: none;
    position: absolute;
    top: 70%;
    left: 37%;
    font-size: 20px;
    width: 200px;
    margin: 10px auto;
    padding: 10px 10px;
    background-color: #ffffff57;
    color: #ffffff;
    border: none;
    cursor: pointer;
    font-family: 'Courier New', monospace;
}

#play-again:hover {
    background-color: #64646479;
}

/* Map Selection Styles */
#map-select-container {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: rgba(0, 0, 0, 0.658);
}

#map-select-menu {
    width: 80%;
    padding: 20px;
    background-color: rgba(0, 0, 0, 0.8);
    border-radius: 10px;
    border: 2px solid #5a5a5ab2;
}

#map-select-menu h2 {
    text-align: center;
    font-size: 30px;
    margin-bottom: 20px;
    color: #e5ff00;
    text-shadow: 0 0 10px rgba(229, 255, 0, 0.712);
}

.map-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 20px;
    padding: 20px;
}

.map-card {
    flex: 0 1 calc(33.333% - 20px);
    min-width: 250px;
    background-color: #1a1a1a;
    border: 2px solid #5a5a5ab2;
    border-radius: 8px;
    padding: 15px;
    cursor: pointer;
    transition: transform 0.2s, border-color 0.2s;
    text-align: center;
}

.map-card:hover {
    transform: translateY(-5px);
    border-color: #e5ff00;
}

.map-card img {
    width: 100%;
    height: 120px;
    object-fit: cover;
    border-radius: 4px;
    margin-bottom: 10px;
}

.map-card h3 {
    font-size: 18px;
    margin-bottom: 5px;
    color: #fff;
}

.map-card p {
    font-size: 14px;
    color: #888;
}


/* responsive styles */
@media (max-width: 805px) {
    #game-container {
        width: 100%;
    }

    h1 {
        font-size: 30px;
        margin: 5px 0;
    }

    .map-card {
        flex: 0 1 calc(50% - 20px);
    }

    #map-select-menu {
        width: 90%;
    }
}

@media (max-width: 575px) {
    #start-menu {
        gap: 15px;
        width: 90%;
    }

    .start-icons {
        text-align: center;
        text-align: left;
    }

    #start-menu img {
        width: 50px;
        padding: 5px 10px;
    }

    .story-dialog {
        padding: 8px;
        border-radius: 8px;
    }

    .story-dialog h2 {
        font-size: 22px;
        margin-bottom: 10px;
    }

    .story-dialog p {
        font-size: 12px;
        line-height: 1.6;
        margin-bottom: 15px;
    }

    .story-dialog .menu-button {
        font-size: 20px;
        padding: 10px 20px;
    }
}

@media (max-width: 425px) {
    #game-stats {
        height: 50px;
        padding: 10px;
        font-size: 0.7rem;
        z-index: 10;
    }

    #game-container {
        height: 75%;
    }

    .story-dialog {
        top: 10%;
    }

    .story-dialog .menu-button {
        font-size: 15px;
        padding: 8px 15px;
    }

    h1 {
        font-size: 25px;
        margin-bottom: 20px;
    }

    .bullet {
        width: 2.5px;
        height: 8px;
    }

    .alien-bullet {
        width: 2.5px;
        height: 8px;
    }

    .map-card {
        flex: 0 1 100%;
    }

    #map-select-menu {
        width: 95%;
        padding: 15px;
    }

    .map-card img {
        height: 100px;
    }
}