/* Base Template Styles - Clean minimal version */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    outline: none !important;
    -webkit-tap-highlight-color: transparent !important;
}

/* Additional focus state removal for all interactive elements */
*:focus,
*:active,
*:focus-visible {
    outline: none !important;
    box-shadow: none !important;
    -webkit-tap-highlight-color: transparent !important;
}

/* Specifically target buttons to remove default focus states */
button,
input,
select,
textarea,
[role="button"],
[tabindex] {
    outline: none !important;
    -webkit-tap-highlight-color: transparent !important;
}

button:focus,
button:active,
button:focus-visible,
input:focus,
input:active,
select:focus,
select:active,
textarea:focus,
textarea:active {
    outline: none !important;
    box-shadow: none !important;
    -webkit-tap-highlight-color: transparent !important;
}

body {
    font-family: 'Jersey 20', sans-serif;
    font-weight: 700;
    background: transparent;
    color: #f0e6d2;
    overflow: hidden;
    touch-action: manipulation;
    position: fixed;
    width: 100%;
    height: 100%;
}

button {
    font-family: 'Jersey 20', sans-serif;
}

#gameContainer {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: transparent;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
}

/* Loading Screen */
.loading-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 1);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    opacity: 1;
    transition: opacity 0.3s ease-in-out;
}

.loading-screen.hidden {
    opacity: 0;
    pointer-events: none;
}

.loading-bar {
    width: 300px;
    height: 6px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
    overflow: hidden;
    box-shadow: 0 0 10px rgba(76, 175, 80, 0.3);
}

.loading-progress {
    height: 100%;
    background: linear-gradient(90deg, #4CAF50, #45a049);
    width: 0%;
    transition: width 0.3s ease;
    border-radius: 3px;
    box-shadow: 0 0 10px rgba(76, 175, 80, 0.5);
}

/* Mute button */
#mute-btn {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 48px;
    height: 48px;
    background: rgba(0, 0, 0, 0.6);
    border: 2px solid #fff;
    border-radius: 8px;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    font-size: 20px;
}

#mute-btn:hover {
    background: rgba(0, 0, 0, 0.8);
}

#mute-icon {
    font-size: 20px;
}

/* Loading overlay */
#loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    color: #fff;
}

#loading-overlay.hidden {
    display: none;
}

.loading-progress-container {
    text-align: center;
}

.loading-progress-bar {
    position: relative;
    width: 300px;
    height: 20px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 16px;
}

.loading-progress-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: #4CAF50;
    border-radius: 10px;
    transition: width 0.3s ease;
    width: 0%;
}

.loading-progress-text {
    font-size: 18px;
    font-weight: bold;
}

/* Utility classes */
.hidden {
    opacity: 0 !important;
    pointer-events: none !important;
}

/* Back Button */
.back-button {
    position: absolute;
    top: 20px;
    left: 0;
    width: 60px;
    height: 40px;
    border-radius: 0 20px 20px 0;
    background: rgb(76 103 175 / 80%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 3000;
    cursor: pointer;
    transition: all 0.3s ease;
    touch-action: manipulation;
    opacity: 1;
    pointer-events: auto;
}

.back-button.hidden {
    opacity: 0;
    pointer-events: none;
}

.back-button:hover,
.back-button:active {
    background: rgb(94, 126, 213);
    transform: scale(1.08);
}

.back-button svg {
    pointer-events: none;
}

/* Game Over Screen */
.game-over-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 2500;
    color: white;
    text-align: center;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
    pointer-events: none;
}

.game-over-screen:not(.hidden) {
    opacity: 1;
    pointer-events: auto;
}

.game-over-screen h1 {
    color: #74CADB;
    text-align: center;
    text-shadow: 0 4px 4px rgba(0, 0, 0, 0.25);
    -webkit-text-stroke-width: 2px;
    -webkit-text-stroke-color: #201F46;
    font-family: "Jersey 20";
    font-size: 72px;
    font-style: normal;
    font-weight: 400;
    line-height: normal;
    margin-bottom: 30px;
}

.play-again-button {
    margin-top: 30px;
    width: 200px;
    height: 65px;
    flex-shrink: 0;
    padding: 16px 40px;
    border-radius: 8px;
    border: 3px solid #192A27;
    background: #FFB450;
    color: #593817;
    text-align: center;
    font-family: 'Jersey 20', sans-serif;
    font-size: 20px;
    font-style: normal;
    font-weight: 400;
    line-height: normal;
    cursor: pointer;
    transition: all 0.1s ease;
    touch-action: manipulation;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0px 4px 4px 0px rgba(0, 0, 0, 0.25), 5px 0 0 #FFCA84 inset, 0 -6px 0 #C26314 inset, 0 5px 0 #FFCA84 inset, -4px 0 0 #C26314 inset;
}

.play-again-button:hover,
.play-again-button:active {
    transform: translateY(-2px);
}

/* Start Screen Styles */
#start-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(26, 26, 46, 0.85);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    color: white;
}

#start-screen h1 {
    color: #74CADB;
    text-align: center;
    text-shadow: 0 4px 4px rgba(0, 0, 0, 0.25);
    -webkit-text-stroke-width: 2px;
    -webkit-text-stroke-color: #201F46;
    font-family: "Jersey 20";
    font-size: 72px;
    font-style: normal;
    font-weight: 400;
    line-height: normal;
    margin-bottom: 2rem;
}

#start-game-btn {
    width: 256px;
    height: 65px;
    flex-shrink: 0;
    padding: 16px 40px;
    border-radius: 8px;
    border: 3px solid #192A27;
    background: #FFB450;
    color: #593817;
    font-family: 'Jersey 20', sans-serif;
    font-size: 28px;
    font-style: normal;
    font-weight: 400;
    line-height: normal;
    cursor: pointer;
    transition: all 0.1s ease;
    touch-action: manipulation;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    box-shadow: 0px 4px 4px 0px rgba(0, 0, 0, 0.25), 5px 0 0 #FFCA84 inset, 0 -6px 0 #C26314 inset, 0 5px 0 #FFCA84 inset, -4px 0 0 #C26314 inset;
}

#start-game-btn:hover,
#start-game-btn:active {
    transform: translateY(-2px);
}

/* Add your custom game styles below this line */

/* Space Invaders Specific Styles */

/* Next Level Screen */
.next-level-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 2500;
    color: white;
    text-align: center;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
    pointer-events: none;
}

.next-level-screen:not(.hidden) {
    opacity: 1;
    pointer-events: auto;
}

.next-level-screen h1 {
    color: #74CADB;
    text-align: center;
    text-shadow: 0 4px 4px rgba(0, 0, 0, 0.25);
    -webkit-text-stroke-width: 2px;
    -webkit-text-stroke-color: #201F46;
    font-family: "Jersey 20";
    font-size: 72px;
    font-style: normal;
    font-weight: 400;
    line-height: normal;
    margin-bottom: 20px;
}

.level-info {
    margin: 20px 0;
    font-size: clamp(16px, 4vw, 24px);
    font-family: 'Jersey 20', sans-serif;
}

.level-info div {
    margin: 10px 0;
    color: #fff;
}

.next-level-button {
    margin-top: 30px;
    width: 200px;
    height: 65px;
    flex-shrink: 0;
    padding: 16px 40px;
    border-radius: 8px;
    border: 3px solid #192A27;
    background: #FFB450;
    color: #593817;
    text-align: center;
    font-family: 'Jersey 20', sans-serif;
    font-size: 20px;
    font-style: normal;
    font-weight: 400;
    line-height: normal;
    cursor: pointer;
    transition: all 0.1s ease;
    touch-action: manipulation;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0px 4px 4px 0px rgba(0, 0, 0, 0.25), 5px 0 0 #FFCA84 inset, 0 -6px 0 #C26314 inset, 0 5px 0 #FFCA84 inset, -4px 0 0 #C26314 inset;
}

.next-level-button:hover,
.next-level-button:active {
    transform: translateY(-2px);
}

/* Enhanced Game Over Screen */
.final-stats {
    margin: 20px 0;
    font-size: clamp(16px, 4vw, 24px);
    font-family: 'Jersey 20', sans-serif;
}

.final-stats div {
    margin: 10px 0;
    color: #fff;
}

/* Enemy Hit Boundary UI */
.enemy-hit-boundary-ui {
    position: absolute;
    left: 0;
    right: 0;
    z-index: 90;
    pointer-events: none;
    opacity: 1;
    transition: opacity 0.3s ease-in-out;
}

.enemy-hit-boundary-ui.hidden {
    opacity: 0;
}

.boundary-line {
    width: 100%;
    height: 6px;
    background: url('https://firebasestorage.googleapis.com/v0/b/sticky-20bca.appspot.com/o/sgm-asset%2F10fee4f8-4971-416c-8cb2-0efda5940b0f%2Fade11f2e-2919-47e9-ad8c-bd3f3082e53c.png?alt=media&token=139c9eb4-65aa-4c9e-8400-e511320052e2') repeat-x center center;
    background-size: auto 100%;
    animation: boundary-pulse 2s ease-in-out infinite;
}

@keyframes boundary-pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.7;
    }
}

.boundary-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 20px;
    margin-top: 2px;
}

.boundary-score {
    color: #fff;
    font-family: 'Jersey 20', sans-serif;
    font-size: 16px;
}

.boundary-lives {
    color: #fff;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    font-family: 'Jersey 20', sans-serif;
    font-size: 16px;
}

.boundary-lives-container {
    display: flex;
    gap: 3px;
    align-items: center;
}

.boundary-heart {
    font-size: 16px;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.boundary-heart.lost {
    opacity: 0.3;
    filter: grayscale(1);
}

/* Mobile responsive adjustments */
@media (max-width: 768px) {
    .title-screen h1 {
        font-size: clamp(20px, 8vw, 40px);
    }

    /* Enemy Hit Boundary UI Mobile */
    .boundary-info {
        padding: 6px 15px;
    }

    .boundary-score,
    .boundary-lives {
        font-size: 14px;
    }

    .boundary-heart {
        font-size: 14px;
    }

    .boundary-line {
        height: 8px;
    }
}

/* Touch area for mobile shooting */
.shoot-area {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60%;
    background: transparent;
    z-index: 50;
    touch-action: manipulation;
}

/* Game UI overlay */
.game-ui {
    position: absolute;
    top: 80px;
    left: 20px;
    font-size: 18px;
    color: #fff;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
    z-index: 100;
    font-family: 'Jersey 20', sans-serif;
    pointer-events: none;
}

/* Title Screen overlay */
.title-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: transparent;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    color: white;
    text-align: center;
    opacity: 1;
    transition: opacity 0.3s ease-in-out;
    pointer-events: auto;
}

.title-screen.hidden {
    opacity: 0;
    pointer-events: none;
}

.title-screen h1 {
    color: #74CADB;
    text-align: center;
    text-shadow: 0 4px 4px rgba(0, 0, 0, 0.25);
    -webkit-text-stroke-width: 2px;
    -webkit-text-stroke-color: #201F46;
    font-family: "Jersey 20";
    font-size: 72px;
    font-style: normal;
    font-weight: 400;
    line-height: normal;
    margin-bottom: 20px;
}

.start-button {
    margin-top: 30px;
    width: 200px;
    height: 65px;
    flex-shrink: 0;
    padding: 16px 40px;
    border-radius: 8px;
    border: 3px solid #192A27;
    background: #FFB450;
    color: #593817;
    text-align: center;
    font-family: 'Jersey 20', sans-serif;
    font-size: 20px;
    font-style: normal;
    font-weight: 400;
    line-height: normal;
    cursor: pointer;
    transition: all 0.1s ease;
    touch-action: manipulation;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0px 4px 4px 0px rgba(0, 0, 0, 0.25), 5px 0 0 #FFCA84 inset, 0 -6px 0 #C26314 inset, 0 5px 0 #FFCA84 inset, -4px 0 0 #C26314 inset;
}

.start-button:hover,
.start-button:active {
    transform: translateY(-2px);
}

.loading {
    color: #FFD700;
    font-size: clamp(12px, 3vw, 16px);
    margin-top: 20px;
    font-family: 'Jersey 20', sans-serif;
}
