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

:root {
    --bg: #050508;
    --text: #ffffff;
    --accent: #4a00e0;
}

body {
    margin: 0;
    padding: 0;
    background: radial-gradient(circle at 50% -10%, var(--accent) 0%, var(--bg) 70%);
    background-size: cover;
    background-color: var(--bg);
    color: var(--text);
    font-family: 'Outfit', sans-serif;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    overflow: hidden;
    touch-action: none; 
}

h1 { 
    margin-top: 10px; 
    margin-bottom: -5px;
    font-size: 3.5rem; 
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 2px;
    background: linear-gradient(to right, #ffffff, rgba(255,255,255,0.5));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 0 15px var(--accent));
}

p { 
    font-size: 1.1rem;
    color: rgba(255,255,255,0.5); 
    margin-top: 0; 
    margin-bottom: 25px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    font-weight: 700;
}

#game-wrapper {
    position: relative;
    width: 400px;
    height: 600px;
    border-radius: 30px;
    box-shadow: 0 30px 60px rgba(0,0,0,0.8),
                0 0 0 1px rgba(255,255,255,0.15) inset,
                0 0 80px rgba(74, 0, 224, 0.4);
    background: linear-gradient(135deg, rgba(255,255,255,0.06) 0%, rgba(0,0,0,0.4) 100%);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    overflow: hidden;
}

#ui-layer {
    position: absolute;
    top: 25px;
    left: 30px;
    font-size: 30px;
    font-weight: 900;
    pointer-events: none;
    text-shadow: 0 5px 15px rgba(0,0,0,0.8);
    z-index: 150; /* Ensure score stays on top of everything */
    line-height: 1.1;
}

#ui-layer span.target {
    font-size: 20px;
    color: rgba(255,255,255,0.7);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
}

#game-container canvas {
    border-radius: 30px;
    display: block;
}

/* Floating Reward Text (Candy Crush Style) */
.floating-text {
    position: absolute;
    font-size: 45px;
    font-weight: 900;
    color: #fff;
    text-shadow: 0 0 25px var(--accent), 0 0 10px #fff;
    pointer-events: none;
    z-index: 50;
    animation: floatUpFade 1.2s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    text-transform: uppercase;
    text-align: center;
}

@keyframes floatUpFade {
    0% { transform: translate(-50%, 0) scale(0.3); opacity: 0; }
    20% { transform: translate(-50%, -30px) scale(1.2); opacity: 1; }
    80% { transform: translate(-50%, -90px) scale(1); opacity: 1; }
    100% { transform: translate(-50%, -120px) scale(0.8); opacity: 0; }
}

#game-over, #level-complete {
    display: none;
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    color: white;
    text-align: center;
    border-radius: 30px;
    z-index: 100;
    animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popIn {
    0% { opacity: 0; transform: scale(0.9); }
    100% { opacity: 1; transform: scale(1); }
}

#game-over h2 { 
    margin-top: 60%; 
    font-size: 56px; 
    font-weight: 900;
    text-transform: uppercase;
    color: #fff; 
    text-shadow: 0 0 30px var(--accent), 0 0 60px var(--accent);
}

#level-complete h2 {
    margin-top: 55%; 
    font-size: 65px; 
    font-weight: 900;
    text-transform: uppercase;
    color: #fff; 
    text-shadow: 0 0 30px #00ff73, 0 0 60px #00ff73;
    pointer-events: none;
}
#level-complete p {
    font-size: 26px;
    font-weight: bold;
    color: #00ff73;
    text-shadow: 0 2px 10px rgba(0,0,0,0.5);
}

.action-button {
    padding: 18px 50px;
    font-size: 22px;
    background: linear-gradient(45deg, var(--accent), #fff);
    color: #000;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    font-weight: 900;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5), 0 0 30px var(--accent);
    transition: all 0.2s;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-top: 20px;
}

.action-button:hover { 
    transform: scale(1.08) translateY(-3px); 
    box-shadow: 0 15px 35px rgba(0,0,0,0.6), 0 0 50px var(--accent);
}

/* === MONETIZATION ADS === */
#ad-banner {
    position: absolute; bottom: 0; left: 0; width: 100%; height: 50px;
    background: rgba(0,0,0,0.9); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: bold; font-family: sans-serif;
    border-top: 1px solid rgba(255,255,255,0.1); z-index: 200; font-size: 14px;
    border-bottom-left-radius: 30px; border-bottom-right-radius: 30px;
}
.ad-badge {
    background: #f1c40f; color: #000; padding: 2px 8px;
    border-radius: 3px; margin-right: 12px; font-size: 10px; text-transform: uppercase;
    flex-shrink: 0;
}
#interstitial-ad {
    display: none;
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.95); z-index: 300;
    color: white; text-align: center;
    flex-direction: column; align-items: center; justify-content: center;
    border-radius: 30px;
    backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
#interstitial-ad h1 { color: #f1c40f; font-size: 35px; margin-top: 0; text-shadow: 0 0 20px #f1c40f; }
.close-ad { 
    position: absolute; top: 20px; right: 20px; font-size: 20px; font-family: sans-serif;
    cursor: pointer; border: 2px solid rgba(255,255,255,0.5); 
    width: 30px; height: 30px; line-height: 26px; border-radius: 50%; transition: 0.2s;
}
.close-ad:hover { background: rgba(255,255,255,0.2); }
