html {
    width: 100%;
    height: 100%;
}

body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    margin: 0;
    background-image: url('assets/Background3.png');
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
}

/* UI Container */
.ui-container {
    position: absolute;
    top: 0px;
    left: 0px;
    z-index: 10;
    background: transparent;
    padding: 5px;
    color: white;
    font-family: Arial, sans-serif;
    border-radius: 5px;
    max-width: none;
    text-align: center;
    display: block;
}

.ui-container.hidden {
    display: none;
}

/* Video Element */
.video-element {
    display: block;
    width: 320px;
    height: 240px;
    margin-top: 0 auto;
    border: none;
    transform: scaleX(-1);
    text-align: left;
}

/* Responsive video element for mobile */
@media (max-width: 480px) {
    .video-element {
        width: 200px;
        height: 150px;
        margin: 0; /* Remove auto margin */
    }
    
    /* Position UI container to the left on mobile */
    .ui-container {
        left: 0px;
        top: 0px;
        right: auto;
        text-align: left;
    }
}

/* Score Container */
.score-container {
    position: absolute;
    bottom: 5px;
    left: 5px;
    z-index: 10;
    background: rgba(10, 7, 181, 0.7);
    padding: 10px;
    color: white;
    font-family: Arial, sans-serif;
    border-radius: 5px;
    display: block;
    text-align: center;
}

.score-container.hidden {
    display: none;
}

.score-element {
    margin-top: 10px;
    font-weight: bold;
    font-size: clamp(1.2em, 4vw, 1.5em);
}

/* Start Screen - Responsive Design */
.start-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 30;
    background-image: url('assets/Cover.png');
    background-size: cover;
    background-position: center;
    background-color: rgba(0, 0, 0, 0.3);
    background-blend-mode: overlay;
    padding: clamp(20px, 5vw, 40px);
    color: white;
    font-family: Arial, sans-serif;
    border-radius: 0px;
    text-align: left;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    min-height: 100vh;
    min-height: 100dvh; /* Dynamic viewport height for mobile browsers */
}

.start-title {
    font-size: clamp(1.8rem, 6vw, 2.5rem);
    margin: 0 0 clamp(15px, 3vh, 25px) 0;
    line-height: 1.2;
    max-width: 90%;
    word-wrap: break-word;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.7);
}

.start-instructions {
    font-size: clamp(1rem, 3.8vw, 1.3rem);
    margin: clamp(10px, 2vh, 15px) 0;
    text-align: left !important;
    max-width: 90%;
    line-height: 1.4;
    background: rgba(0, 0, 0, 0.5);
    padding: clamp(15px, 3vw, 20px);
    border-radius: 8px;
    backdrop-filter: blur(5px);
}

.start-status {
    font-size: clamp(0.9rem, 3vw, 1.1rem);
    font-style: italic;
    margin: clamp(8px, 2vh, 10px) 0;
    max-width: 90%;
    line-height: 1.3;
}

/* Buttons - Responsive Design */
.game-button {
    padding: clamp(12px, 3vw, 15px) clamp(20px, 6vw, 30px);
    font-size: clamp(1.1rem, 4vw, 1.4rem);
    cursor: pointer;
    margin-top: clamp(15px, 3vh, 20px);
    color: white;
    border: none;
    border-radius: 5px;
    font-weight: bold;
    text-shadow: 2px 2px 0px rgba(0,0,0,0.4);
    box-shadow: inset 0 -4px 0 rgba(0,0,0,0.2), 0 4px 6px rgba(0,0,0,0.3);
    transition: transform 0.1s ease, background-color 0.2s ease, box-shadow 0.1s ease;
    min-width: clamp(150px, 40vw, 200px);
    max-width: 90%;
    box-sizing: border-box;
}

.start-button {
    background-color: #ff4757;
    opacity: 0.5;
}

.start-button:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.start-button:not(:disabled) {
    opacity: 1;
    cursor: pointer;
    background-color: #4cd137;
}

.start-button:not(:disabled):hover {
    background-color: #ff7979;
    transform: translateY(-2px);
}

.start-button:not(:disabled):active {
    transform: translateY(1px);
    box-shadow: inset 0 -2px 0 rgba(0,0,0,0.3), 0 2px 3px rgba(0,0,0,0.2);
}

.restart-button {
    background-color: #1e90ff;
    font-size: clamp(1rem, 3.5vw, 1.3rem);
    margin-top: clamp(12px, 2.5vh, 15px);
}

.restart-button:hover {
    background-color: #46a0ff;
    transform: translateY(-2px);
}

.restart-button:active {
    transform: translateY(1px);
    box-shadow: inset 0 -2px 0 rgba(0,0,0,0.3), 0 2px 3px rgba(0,0,0,0.2);
}

/* Game Over Screen - Responsive Design */
.game-over-screen {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 20;
    background: rgba(255, 0, 0, 0.8);
    padding: clamp(20px, 5vw, 30px);
    color: white;
    font-family: Arial, sans-serif;
    border-radius: 10px;
    text-align: center;
    display: none;
    max-width: 90%;
    box-sizing: border-box;
    backdrop-filter: blur(5px);
}

.game-over-screen.visible {
    display: block;
}

.game-over-title {
    margin: 0;
    font-size: clamp(1.5rem, 5vw, 2rem);
    line-height: 1.2;
}

.final-score {
    font-size: clamp(1.2rem, 4vw, 1.5rem);
    margin: clamp(12px, 3vh, 15px) 0;
    line-height: 1.3;
}

/* Mobile-specific optimizations */
@media (max-width: 480px) {
    .start-screen {
        padding: 15px;
        justify-content: flex-start;
        padding-top: clamp(60px, 15vh, 80px);
    }
    
    .start-instructions {
        text-align: center;
        padding: 15px;
    }
    
    .game-button {
        width: 100%;
        max-width: 280px;
        padding: 15px 20px;
    }
}

/* Landscape mobile optimization */
@media (max-height: 500px) and (orientation: landscape) {
    .start-screen {
        padding: 10px;
        justify-content: center;
    }
    
    .start-title {
        margin-bottom: 10px;
    }
    
    .start-instructions {
        margin: 8px 0;
        padding: 10px;
    }
    
    .game-button {
        margin-top: 10px;
        padding: 10px 25px;
    }
}

/* Very small screens */
@media (max-width: 320px) {
    .start-screen {
        padding: 10px;
    }
    
    .start-instructions {
        font-size: 0.9rem;
        padding: 12px;
    }
    
    .game-button {
        font-size: 1rem;
        padding: 12px 18px;
        min-width: 120px;
    }
}

/* Utility Classes */
.hidden {
    display: none !important;
}

.visible {
    display: block !important;
}

.flex-visible {
    display: flex !important;
}

.text-box {
    padding: 8px 15px;
    background-color: rgba(255, 255, 255, 0.5);
    color: black;
    border-radius: 4px;
    font-family: "Arial", "Helvetica Neue", Helvetica, sans-serif;
    border: 2px solid black;
    box-shadow: 3px 3px 0px black;
    font-size: clamp(13px, 2vw, 15px);
    text-align: center;
    z-index: 200;
    opacity: 1;
    transition: opacity 0.3s ease-in-out, bottom 0.3s ease-in-out, box-shadow 0.2s ease;
    max-width: 90%;
    box-sizing: border-box;
}

#instruction-text {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    pointer-events: none;
}

#social-links {
    position: absolute;
    bottom: 5px;
    right: 5px;
    text-align: left;
    max-width: clamp(200px, 50vw, 350px);
}

#logo-container {
    position: absolute;
    bottom: 5px;
    right: 5px;
}

#video-link {
    position: absolute;
    bottom: 10px;
    left: 10px;
}

#logo {
    font-size: clamp(1.5em, 4vw, 2em);
}