/* styles.css */
body {
    margin: 0;
    overflow: hidden;
    background-color: black;
    width: 100vw;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

#game-container {
    position: relative;
    width: 800px;
    height: 600px;
    background-color: #000;
    border: 2px solid #fff;
    touch-action: none;
    user-select: none;
    transform-origin: center center;
}

#score, #high-score, #lives  {
    position: absolute;
    top: 10px; /* Position at the top */
    color: white;
    font-family: Arial, sans-serif;
    font-size: 20px;
    z-index: 100; /* Ensure they are above other elements */
}

#score {
    left: 10px; /* Position on the left */
}

#high-score {
    left: 350px; /* Position on the left */
}

#lives {
    right: 10px; /* Position on the right */
}

#version {
    position: absolute;
    right: 10px;
    bottom: 10px;
    color: #9aa0a6;
    font-family: Arial, sans-serif;
    font-size: 12px;
    z-index: 100;
}

#scoreboard {
    position: absolute;
    top: 50px;
    right: 10px;
    width: 180px;
    color: white;
    font-family: Arial, sans-serif;
    font-size: 16px;
    z-index: 100;
    text-align: left;
    display: none;
}

#scoreboard-title {
    font-weight: bold;
    margin-bottom: 6px;
}

#high-score-list {
    margin: 0;
    padding-left: 20px;
}

#high-score-list li {
    display: flex;
    justify-content: space-between;
    gap: 8px;
}

#highscore-screen {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.95);
    color: white;
    font-family: Arial, sans-serif;
    z-index: 80;
    pointer-events: none;
}

#highscore-screen.is-hidden {
    display: none;
}

.highscore-screen-card {
    border: 2px solid #fff;
    padding: 16px 24px;
    min-width: 260px;
    text-align: center;
}

#highscore-screen-title {
    font-size: 22px;
    margin-bottom: 10px;
    font-weight: bold;
}

#highscore-screen-list {
    margin: 0;
    padding-left: 20px;
    text-align: left;
}

#highscore-screen-list li {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin: 4px 0;
}

#name-entry {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.6);
    z-index: 200;
}

#name-entry.is-hidden {
    display: none;
}

.name-entry-card {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    background: #111;
    border: 2px solid #fff;
    padding: 16px 20px;
    text-align: center;
    color: white;
    font-family: Arial, sans-serif;
    min-width: 220px;
}

.name-entry-title {
    font-size: 20px;
    margin-bottom: 6px;
}

.name-entry-score {
    margin-bottom: 10px;
}

#player-name {
    width: 100%;
    padding: 6px 8px;
    margin-bottom: 8px;
    background: #000;
    border: 1px solid #777;
    color: white;
    text-align: center;
}

#submit-score {
    padding: 6px 12px;
    font-size: 14px;
    cursor: pointer;
}

.is-hidden {
    display: none;
}

.showing-highscores #scoreboard {
    display: none;
}

.is-playing #scoreboard {
    display: none;
}

#player {
    position: absolute;
    bottom: 10px;
    left: 0;
    width: 80px;
    height: 40px;
    background-image: url('Turret.png');
    background-size: cover;
}


#shelters {
    position: absolute;
    inset: 0;
}

#game-over-text {
    position: absolute;
    top: 20%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 48px;
    color: red;
    font-weight: bold;
    text-shadow: 2px 2px 4px black;
}

#start-button {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: 10px 20px;
    font-size: 24px;
    cursor: pointer;
    z-index: 120;
}

.hidden {
    visibility: hidden;
}


.shelter {
    position: absolute;
    width: 80px;
    height: 40px;
    background-color: transparent;
    border: 2px solid darkgray; /* Optional: Add a border for better visibility */
}

#shelter-1,
#shelter-2,
#shelter-3 {
    left: 0;
    right: auto;
    transform: none;
}

.enemy {
    position: absolute;
    width: 50px; /* Adjust based on your GIF size */
    height: 50px; /* Adjust based on your GIF size */
    background: url('Evader1.gif') no-repeat center center;
    background-size: cover;
}


.laser {
    position: absolute;
    width: 5px;
    height: 20px;
    background-color: yellow;
}

.bomb {
    position: absolute;
    width: 10px;
    height: 20px;
    background-color: orange;
}

.ufo {
    position: absolute;
    width: 60px;
    height: 24px;
    border: 2px solid #f00;
    border-radius: 14px;
    box-shadow: 0 0 10px rgba(255, 0, 0, 0.6);
    background: linear-gradient(180deg, #ff4d4d, #990000);
}

.shelter-smoke {
    position: absolute;
    width: var(--smoke-size, 18px);
    height: var(--smoke-size, 18px);
    background: rgba(150, 150, 150, 0.7);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    filter: blur(1px);
    animation: shelterSmoke 700ms ease-out forwards;
    pointer-events: none;
    z-index: 70;
}

.shelter-particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: #6f6f6f;
    transform: translate(-50%, -50%);
    animation: shelterDebris 800ms ease-out forwards;
    pointer-events: none;
    z-index: 70;
}

.enemy-particle {
    position: absolute;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: hsl(var(--hue), 90%, 60%);
    box-shadow: 0 0 6px hsl(var(--hue), 90%, 60%);
    transform: translate(-50%, -50%);
    animation: enemyBurst 900ms ease-out forwards;
    pointer-events: none;
    z-index: 80;
}

@keyframes enemyBurst {
    0% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    100% { opacity: 0; transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(0.3); }
}

@keyframes shelterSmoke {
    0% { opacity: 0.8; transform: translate(-50%, -50%) scale(0.6); }
    100% { opacity: 0; transform: translate(-50%, -70%) scale(1.4); }
}

@keyframes shelterDebris {
    0% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    100% { opacity: 0; transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) rotate(var(--spin)) scale(0.4); }
}

.floating-score {
    position: absolute;
    color: #ffd700;
    font-family: Arial, sans-serif;
    font-size: 18px;
    font-weight: bold;
    transform: translate(-50%, -50%);
    animation: floatScore 2s ease-out forwards;
    pointer-events: none;
    z-index: 90;
}

#level-cleared {
    position: absolute;
    top: 35%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-family: Arial, sans-serif;
    font-size: 32px;
    font-weight: bold;
    text-shadow: 0 0 8px rgba(255, 255, 255, 0.4);
    z-index: 90;
}

@keyframes floatScore {
    0% { opacity: 1; transform: translate(-50%, -50%) translateY(0); }
    100% { opacity: 0; transform: translate(-50%, -50%) translateY(-30px); }
}
