:root {
    --bg-color: #0a0a0c;
    --panel-bg: rgba(20, 20, 25, 0.8);
    --primary: #00ff88;
    --primary-glow: rgba(0, 255, 136, 0.5);
    --food: #ff0055;
    --food-glow: rgba(255, 0, 85, 0.5);
    --text: #e0e0e0;
    --grid-color: rgba(255, 255, 255, 0.15);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

.hidden {
    display: none !important;
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-color);
    color: var(--text);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background-image: 
        radial-gradient(circle at 15% 50%, rgba(0, 255, 136, 0.08), transparent 25%),
        radial-gradient(circle at 85% 30%, rgba(255, 0, 85, 0.08), transparent 25%);
    overflow: hidden;
}

.game-container {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 30px;
    width: 100%;
    max-width: 500px;
    min-height: 620px; /* Made taller to fit profile icon and level boxes */
    background: var(--panel-bg);
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: 0 20px 50px rgba(0,0,0,0.5), inset 0 0 0 1px rgba(255,255,255,0.05);
    backdrop-filter: blur(10px);
}

.game-ui {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.game-ui.hidden {
    display: none;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

h1 {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: 2px;
    color: var(--primary);
    text-shadow: 0 0 10px var(--primary-glow);
}

.scores {
    display: flex;
    gap: 15px;
}

.score-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(0, 0, 0, 0.3);
    padding: 8px 15px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    min-width: 80px;
}

.label {
    font-size: 0.7rem;
    font-weight: 300;
    color: #888;
    letter-spacing: 1px;
}

#score, #high-score {
    font-size: 1.2rem;
    font-weight: 700;
    color: white;
}

.wallet-box {
    border-color: #ffd700;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.2);
    transition: all 0.2s ease;
}

.wallet-box:hover {
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.5);
    transform: translateY(-2px);
}

.wallet-box .label {
    color: #ffd700;
}

.wallet-box #wallet-balance {
    color: #ffd700;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
    font-size: 1.2rem;
    font-weight: 700;
}

/* Prize box glow */
.prize-box {
    border-color: rgba(255, 100, 0, 0.6);
    background: rgba(255, 100, 0, 0.08);
    box-shadow: 0 0 12px rgba(255, 100, 0, 0.3), inset 0 0 10px rgba(255, 100, 0, 0.1);
    animation: prizeGlow 2s ease-in-out infinite alternate;
}

.prize-label {
    color: #ff6400;
}

#the-prize {
    color: #ff8c00;
    text-shadow: 0 0 10px rgba(255, 140, 0, 0.8);
    font-size: 1.2rem;
    font-weight: 700;
}

@keyframes prizeGlow {
    from { box-shadow: 0 0 8px rgba(255, 100, 0, 0.3), inset 0 0 8px rgba(255, 100, 0, 0.1); }
    to   { box-shadow: 0 0 20px rgba(255, 140, 0, 0.7), inset 0 0 15px rgba(255, 140, 0, 0.2); }
}

/* Go Back button */
.go-back-btn {
    border-color: rgba(255, 255, 255, 0.3);
    color: rgba(255, 255, 255, 0.5);
    box-shadow: none;
    font-size: 0.8rem;
    padding: 6px 20px;
    margin-top: 5px;
}

.go-back-btn:hover {
    background: rgba(255,255,255,0.1);
    color: #fff;
    box-shadow: none;
    transform: none;
}

/* Wallet Popup Styles */
.popup-balance-box {
    background: rgba(255, 215, 0, 0.05);
    border: 1px solid rgba(255, 215, 0, 0.2);
    padding: 15px;
    border-radius: 12px;
    margin-bottom: 20px;
    width: 100%;
}

.charge-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.03);
    padding: 10px 15px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.charge-row span {
    font-weight: 700;
    color: #ffd700;
}

.charge-amount-btn {
    padding: 5px 15px;
    font-size: 0.75rem;
    background: var(--primary);
    border: none;
    color: #000;
    font-weight: 700;
    border-radius: 6px;
    cursor: pointer;
    box-shadow: 0 0 10px var(--primary-glow);
}

.charge-amount-btn:hover {
    transform: scale(1.05);
    background: #fff;
}

#paypal-email {
    width: 100%;
}

#paypal-email:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 10px var(--primary-glow);
}

.back-to-wallet-btn {
    opacity: 0.8;
}

.canvas-wrapper {
    position: relative;
    width: 100%;
    max-width: 400px;
    aspect-ratio: 1 / 1;
    height: auto;
    margin: 0 auto;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    background: #000;
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: center;
    align-items: center;
}

canvas {
    display: block;
    width: 100%;
    height: 100%;
    background-image: 
        linear-gradient(var(--grid-color) 1px, transparent 1px),
        linear-gradient(90deg, var(--grid-color) 1px, transparent 1px);
    background-size: 5% 5%;
    background-color: #050507;
}

.level-cards {
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 85%;
}

.level-card {
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 12px 15px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.5);
}

.level-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.gift-text {
    color: #ffd700;
    font-weight: 700;
}

.level-name {
    color: var(--primary);
    font-weight: 700;
    letter-spacing: 1px;
}

.play-btn {
    padding: 8px 0;
}

.overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 10, 12, 0.95);
    backdrop-filter: blur(8px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 15px;
    transition: opacity 0.3s ease;
    z-index: 2000;
}

.overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.hidden {
    display: none !important;
}

.hidden {
    display: none !important;
}

.overlay h2 {
    font-size: 2rem;
    color: white;
    letter-spacing: 2px;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.5);
    text-align: center;
    padding: 0 10px;
    width: 100%;
}

#wallet-screen-title {
    font-size: 1.6rem !important;
    line-height: 1.2;
}

.overlay p {
    color: #aaa;
    font-weight: 300;
}

button {
    background: transparent;
    color: var(--primary);
    border: 2px solid var(--primary);
    padding: 10px 25px;
    font-size: 1rem;
    font-family: 'Outfit', sans-serif;
    font-weight: 500;
    border-radius: 8px;
    cursor: pointer;
    letter-spacing: 1px;
    transition: all 0.2s ease;
    text-transform: uppercase;
    box-shadow: 0 0 10px var(--primary-glow), inset 0 0 10px var(--primary-glow);
}

button:hover {
    background: var(--primary);
    color: #000;
    box-shadow: 0 0 20px var(--primary-glow), inset 0 0 20px var(--primary-glow);
    transform: translateY(-2px);
}

button:active {
    transform: translateY(0);
}

.button-row {
    display: flex;
    gap: 15px;
    margin-top: 10px;
}

.secondary-btn {
    border-color: #ff0055;
    color: #ff0055;
    box-shadow: 0 0 10px rgba(255, 0, 85, 0.5), inset 0 0 10px rgba(255, 0, 85, 0.5);
}

.secondary-btn:hover {
    background: #ff0055;
    color: #000;
    box-shadow: 0 0 20px rgba(255, 0, 85, 0.5), inset 0 0 20px rgba(255, 0, 85, 0.5);
}

.gold-btn {
    border-color: #ffd700;
    color: #ffd700;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.5), inset 0 0 10px rgba(255, 215, 0, 0.2);
}

.gold-btn:hover {
    background: #ffd700;
    color: #000;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.5), inset 0 0 20px rgba(255, 215, 0, 0.5);
}

.bottom-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.icon-btn {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0;
    font-size: 1.2rem;
}

#profile-btn {
    width: 65px;
    height: 65px;
    font-size: 1.8rem;
}


.speed-control-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
}

.action-btn {
    font-size: 0.8rem;
    padding: 8px 15px;
    border-color: #00d4ff;
    color: #00d4ff;
    box-shadow: 0 0 10px rgba(0, 212, 255, 0.5), inset 0 0 10px rgba(0, 212, 255, 0.2);
}

.action-btn:hover {
    background: #00d4ff;
    color: #000;
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.5), inset 0 0 20px rgba(0, 212, 255, 0.5);
}

.hidden {
    display: none !important;
}

.mobile-dpad {
    display: none;
}

@media (max-width: 500px) {
    body {
        align-items: center;
    }
    .game-container {
        padding: 15px 10px;
        width: 100vw;
        height: 100vh;
        max-width: 100%;
        max-height: 100vh;
        overflow-y: auto;
        border-radius: 0;
        border: none;
        gap: 15px;
        box-shadow: none;
        justify-content: center;
    }
    .header {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
        width: 100%;
    }
    .scores {
        display: contents;
    }
    .wallet-container {
        width: 100%;
        margin: 0;
    }
    .score-box {
        width: 100%;
        min-width: unset;
        padding: 6px 4px;
        margin: 0;
    }
    .label {
        font-size: 0.6rem;
    }
    #score, #target-score, #the-prize, #wallet-balance {
        font-size: 0.9rem;
    }
    .canvas-wrapper {
        width: 100%;
        max-width: 100%;
        margin: auto;
    }
    #start-screen {
        justify-content: center;
        padding: 15px 10px;
        overflow-y: auto;
    }
    .overlay h2 {
        font-size: 1.4rem;
        margin-bottom: 5px;
    }
    #wallet-screen-title {
        font-size: 1.2rem !important;
    }
    .overlay p {
        font-size: 0.85rem;
        margin-bottom: 5px;
    }
    .level-cards {
        width: 100%;
        gap: 8px;
    }
    .level-card {
        padding: 8px 10px;
        gap: 5px;
    }
    .level-header {
        font-size: 0.8rem;
    }
    button {
        padding: 6px 15px;
        font-size: 0.8rem;
    }
    .play-btn {
        padding: 5px 0;
    }
    .button-row {
        margin-top: 5px;
        gap: 8px;
    }
    .mobile-dpad {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 10px;
        width: 100%;
        margin-top: 5px;
    }
    .dpad-row {
        display: flex;
        justify-content: center;
        gap: 15px;
    }
    .dpad-btn {
        width: 45px;
        height: 45px;
        border-radius: 8px;
        font-size: 1.2rem;
        display: flex;
        justify-content: center;
        align-items: center;
        padding: 0;
        margin: 0;
    }
}
/* Profile and Auth Styles */
.profile-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 30px;
    width: 100%;
}


#user-email-display {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.5);
    font-weight: 300;
}

#auth-screen {
    z-index: 1000;
}

.pingkly-logo {
    font-size: 3.5rem;
    font-weight: 700;
    color: #ff0055;
    text-shadow: 0 0 20px rgba(255, 0, 85, 0.6), 0 0 40px rgba(255, 0, 85, 0.4);
    letter-spacing: 4px;
    margin-bottom: 10px;
    font-family: 'Outfit', sans-serif;
    text-transform: uppercase;
}

#auth-title {
    margin-bottom: 20px;
    color: #ffd700 !important;
    text-shadow: 0 0 20px rgba(255, 215, 0, 0.5) !important;
}

#auth-error {
    margin: 5px 0;
    font-weight: bold;
}

@media (max-width: 500px) {
    .profile-container {
        margin-bottom: 25px;
    }
    #profile-btn {
        width: 55px;
        height: 55px;
        font-size: 1.5rem;
    }
    .pingkly-logo {
        font-size: 2.5rem;
        margin-bottom: 5px;
    }
}
