@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;700;900&display=swap');

:root {
    --primary-color: #f1c40f;
    --primary-dark: #d4ac0d;
    --bg-dark: #121212;
    --text-light: #ffffff;
    --accent-color: #e67e22;
    --success-color: #2ecc71;
    --danger-color: #e74c3c;
}

/* Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

body {
    background-color: var(--bg-dark);
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100dvh;
    overflow: hidden;
    color: var(--text-light);
}

body:not(.immersive-mode) {
    padding-top: 60px; /* Leave space for GlobalHUD */
}

#game-container {
    position: relative;
    width: 100%;
    max-width: 400px;
    height: 100%;
    max-height: 700px;
    background: #000;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.5);
    border: 4px solid #333;
    border-radius: 12px;
    overflow: hidden;
}

@media (max-height: 700px) {
    #game-container {
        height: 100dvh;
        max-height: none;
        border-radius: 0;
        border: none;
    }
}

canvas {
    display: block;
    width: 100%;
    height: 100%;
}

/* UI Layer & HUD */
#ui-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 90px;
    pointer-events: none;
    z-index: 50;
    transition: opacity 0.3s ease;
    overflow: visible; /* Now visible so the +1 can escape upwards! */
    border-bottom: 2px solid #000;
    box-shadow: 0 4px 10px rgba(0,0,0,0.8);
}

.hud-content {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    padding: 5px 10px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    z-index: 10;
}

/* Universal Reward Parallax UI additions */
.ui-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: bottom;
}

.layer-bg {
    background-image: url('../images/games/rpg_background.png');
    z-index: 1;
}


.layer-fg {
    background-image: url('../images/games/rpg_foreground.png');
    background-repeat: repeat-x;
    background-size: auto 100%;
    z-index: 3;
    /* Physics engine completely controls displacement now! No jumping CSS keyframes. */
}

.ui-character {
    position: absolute;
    left: 90px; /* Moved another 10px to the left */
    top: 50%;
    width: 60px;
    height: 60px;
    background-image: url('../images/games/ufo.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    z-index: 5;
    animation: hoverUfo 2s ease-in-out infinite;
    transform: translateY(-50%) rotate(0deg);
    transition: transform 0.3s ease;
}

.ui-character.boosting {
    transform: translateY(-50%) rotate(5deg);
}

.css-coin {
    position: absolute;
    top: 50%;
    right: -40px;
    width: 30px;
    height: 30px;
    background: radial-gradient(circle, #f1c40f 0%, #d4ac0d 100%);
    border: 2px solid #fff;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: 900;
    color: #fff;
    font-size: 18px;
    z-index: 5;
    transform: translateY(-50%) rotateY(0deg);
    animation: spinCoin 1s linear infinite;
    /* transition is applied strictly via JS now */
}

.sat-plus-text {
    position: absolute;
    color: var(--success-color);
    font-weight: 900;
    font-size: 24px;
    z-index: 100;
    text-shadow: 0 2px 4px rgba(0,0,0,0.8);
    animation: floatUpFade 1s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
    pointer-events: none;
}

@keyframes shake {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(2px); }
}

@keyframes hoverUfo {
    0%, 100% { margin-top: 0px; }
    50% { margin-top: -5px; }
}

@keyframes spinCoin {
    0% { transform: translateY(-50%) rotateY(0deg); }
    100% { transform: translateY(-50%) rotateY(360deg); }
}

@keyframes floatUpFade {
    0% { opacity: 1; transform: translateY(0); }
    100% { opacity: 0; transform: translateY(-40px); }
}



.hud-container {
    background: rgba(0, 0, 0, 0.7);
    padding: 5px 10px;
    border-radius: 8px;
    border-left: 4px solid var(--primary-color);
    display: flex;
    flex-direction: column;
    min-width: 80px;
    backdrop-filter: blur(5px);
}

.hud-label {
    font-size: 8px;
    font-weight: 700;
    color: var(--primary-color);
    letter-spacing: 1px;
    text-transform: uppercase;
    margin-bottom: -2px;
}

.hud-value {
    font-size: 20px;
    font-weight: 900;
}

/* Base style for all screens (Start, Game Over, etc) */
.screen-base {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 100;
    text-align: center;
    padding: 20px;
}

/* Background overlay (Optional, added specifically to screens that need it) */
.overlay {
    background: rgba(0, 0, 0, 0.85);
}

#start-screen {
    justify-content: flex-end;
    padding-bottom: 40px;
}

#game-over-screen {
    backdrop-filter: blur(10px);
}

/* Start Screen specific */
.start-content {
    width: 100%;
    max-width: 300px;
}

/* Game Over specific */
.game-over-content {
    width: 100%;
    max-width: 300px;
    animation: fadeInScale 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.8);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

#game-over-screen h1 {
    font-size: 42px;
    font-weight: 900;
    color: var(--danger-color);
    margin-bottom: 25px;
    text-shadow: 0 0 20px rgba(231, 76, 60, 0.5);
    line-height: 1;
}

.stat-block {
    margin-bottom: 20px;
}

.stat-label {
    font-size: 12px;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 5px;
}

.stat-value {
    font-size: 32px;
    font-weight: 900;
    color: var(--text-light);
}

.stat-value.success {
    color: var(--success-color);
}

.sats-info {
    font-size: 16px;
    color: var(--primary-color);
    margin: 15px 0;
    font-weight: 700;
    text-shadow: 0 0 10px rgba(241, 196, 15, 0.3);
}

/* Buttons */
.game-btn {
    background-color: var(--primary-color);
    border: none;
    color: #000;
    font-weight: 900;
    padding: 12px 40px;
    border-radius: 8px;
    font-size: 18px;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 0 var(--primary-dark);
    width: 100%;
    max-width: 220px;
}

.game-btn:hover {
    background-color: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 6px 0 #b7950b;
}

.game-btn:active {
    transform: translateY(2px);
    box-shadow: 0 2px 0 #b7950b;
}