:root {
    --primary-orange: #e65100;
    --accent-orange: #ff9800;
    --court-lines: rgba(255, 255, 255, 0.8);
    --overlay-bg: rgba(0, 0, 0, 0.85);
    --gold: #ffd700;
}

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

body {
    background-color: #1a1a1a;
    overflow-x: hidden;
    color: white;
    touch-action: pan-y;
    overflow-y: auto;
}

#game-wrapper {
    position: relative;
    width: 480px;
    aspect-ratio: 3 / 5;
    /* replaces fixed height */
    margin: 20px auto;
    max-width: 95vw;
}



#game-canvas {
    display: block;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, #bf360c, #3e2723);
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.5);
    z-index: 1;
    border-radius: 20px;
    touch-action: pan-y;
}

#ui-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
}

#score-container {
    position: absolute;
    top: 80px;
    width: 100%;
    text-align: center;
}


#score {
    font-size: 5rem;
    font-weight: 900;
    text-shadow: 0 5px 15px rgba(0, 0, 0, 0.4);
    opacity: 0.8;
}


#goal-feedback {
    position: absolute;
    top: 40%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 4rem;
    font-weight: 900;
    color: var(--gold);
    text-shadow: 0 0 20px rgba(255, 215, 0, 0.8), 0 0 40px rgba(0, 0, 0, 0.6);
    z-index: 100;
    pointer-events: none;
    white-space: nowrap;
}

.goal-pop {
    animation: goalPop 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes goalPop {
    0% {
        transform: translate(-50%, -50%) scale(0.5);
        opacity: 0;
    }

    50% {
        transform: translate(-50%, -50%) scale(1.2);
        opacity: 1;
    }

    100% {
        transform: translate(-50%, -55%) scale(1);
        opacity: 0;
    }
}

#swipe-guide {
    position: absolute;
    bottom: 12%;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    color: white;
    font-weight: 900;
    pointer-events: none;
    z-index: 50;
    transition: opacity 0.5s;
    text-align: center;
    width: 100%;
}

.swipe-hand {
    font-size: 3rem;
    animation: swipeAnim 1.5s ease-in-out infinite;
    text-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
}

@keyframes swipeAnim {
    0% {
        transform: translateY(20px);
        opacity: 0;
    }

    30% {
        transform: translateY(20px);
        opacity: 1;
    }

    100% {
        transform: translateY(-80px);
        opacity: 0;
    }
}

#swipe-guide.hidden {
    visibility: hidden;
    opacity: 0;
}

.overlay {
    z-index: 200;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--overlay-bg);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    pointer-events: auto;
    transition: opacity 0.3s ease;
}

.overlay.hidden {
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
}

h2 {
    font-size: 2.5rem;
    font-weight: 900;
    margin-bottom: 20px;
    background: linear-gradient(to bottom, #fff, #ccc);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-align: center;
}

button {
    padding: 14px 30px;
    font-size: 1.1rem;
    font-weight: 900;
    border: none;
    border-radius: 50px;
    background: linear-gradient(135deg, var(--accent-orange), var(--primary-orange));
    color: white;
    cursor: pointer;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s, box-shadow 0.2s;
    margin-bottom: 10px;
    min-width: 200px;
    text-transform: uppercase;
}

button:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.4);
}

button:active {
    transform: translateY(1px);
}

#bonus-btn {
    background: linear-gradient(135deg, #ffcc00, #ff8800);
    color: black;
    box-shadow: 0 8px 25px rgba(255, 180, 0, 0.4);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.03);
        box-shadow: 0 12px 30px rgba(255, 180, 0, 0.6);
    }

    100% {
        transform: scale(1);
    }
}

/* Leaderboard */
#side-leaderboard {
    position: fixed;
    top: 60%;
    left: 10px;
    transform: translateY(-50%);
    width: 300px;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 15px;
    z-index: 5;
    font-size: 0.25rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
}


#side-leaderboard h3 {
    font-size: 0.75rem;
    opacity: 0.5;
    margin-bottom: 10px;
    text-align: center;
    text-transform: uppercase;
}

#side-lb-list {
    list-style: none;
}

.lb-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 0.65rem;
}

.lb-user {
    flex-grow: 1;
    margin: 0 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.lb-flag {
    margin-right: 6px;
    font-size: 1.1rem;
    display: inline-block;
    vertical-align: middle;
}

.lb-score {
    min-width: 40px;
    text-align: right;
    font-weight: 900;
}

.lb-rank {
    min-width: 24px;
    font-weight: 900;
}

#view-full-lb {
    margin-top: 15px;
    font-size: 0.75rem;
    color: var(--accent-orange);
    cursor: pointer;
    text-align: center;
}

/* Cross Promotion */
#cross-promo-container {
    position: fixed;
    top: 70px;
    left: 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    z-index: 10005;
}

.promo-banner {
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    padding: 6px 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: white;
    width: 240px;
    transition: transform 0.2s;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.promo-banner:hover {
    transform: translateX(5px);
}

.promo-icon {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    background-size: cover;
    flex-shrink: 0;
}

.promo-title {
    font-size: 0.75rem;
    font-weight: 900;
}

.promo-btn {
    background: white;
    color: black;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.65rem;
    font-weight: 900;
    text-transform: uppercase;
}

/* Responsive adjustments */
@media (max-width: 1024px) {
    #side-leaderboard {
        display: block;
        width: 130px;
        left: 8px;
        top: auto;
        bottom: 120px;
        transform: none;
        background: rgba(0, 0, 0, 0.3);
        opacity: 0.5;
        z-index: 100;
    }

    #side-leaderboard:hover {
        opacity: 1;
    }

    .promo-banner {
        width: 180px;
    }
}

#bottom-ad {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 320px;
    height: 50px;
    z-index: 9999;
}

.join-tg-btn {
    background: #0088cc !important;
    font-size: 0.9rem !important;
    padding: 10px !important;
}

/* Hidden elements */
.hidden {
    display: none !important;
}

.game-description {
    padding: 180px 20px 40px;
    /* Large top padding to move it below game canvas */
    max-width: 800px;
    margin: 0 auto;
    background: #1a1a1a;
}

#gameover-input-area {
    width: 85%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin: 10px 0;
    pointer-events: auto;
}

#player-name-gameover {
    width: 100%;
    padding: 12px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.1);
    color: white;
    text-align: center;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s;
}

#player-name-gameover:focus {
    border-color: var(--accent-orange);
}

#game-over button {
    width: 85%;
    margin-bottom: 8px;
}

#submit-score-btn {
    background: linear-gradient(135deg, #4d79ff, #3366ff);
    box-shadow: 0 8px 20px rgba(51, 102, 255, 0.3);
}

/* Adsterra Banner - Right Side Center (Desktop Only) */
/* Adsterra Banner - Right Side Bottom (Desktop Only) */
#adsterra-banner {
    position: fixed;
    top: auto;
    bottom: 5px;
    right: 10px;
    transform: none;
    z-index: 9000;
    display: none;
    width: 160px;
    height: 600px;
}

@media (min-width: 1024px) {
    #adsterra-banner {
        display: block;
    }
}

/* 🔽 Add this right here */
@media (max-width: 768px) {
    #game-wrapper {
        margin: 70px auto 5px auto;
        max-height: 85vh;
    }
}

/* ===== FULL LEADERBOARD FONT FIX ===== */

#full-leaderboard {
    font-size: 1rem;
}

#full-leaderboard h2 {
    font-size: 2rem;
}

#full-leaderboard p {
    font-size: 1rem;
    opacity: 0.8;
}

#full-lb-list {
    font-size: 1rem;
}

#full-lb-list .lb-row {
    font-size: 0.95rem;
    padding: 10px 0;
}

#full-lb-list .lb-user {
    font-size: 1rem;
}

#full-lb-list .lb-score {
    font-size: 1rem;
    font-weight: 900;
}

.lb-header {
    margin-bottom: 30px;
    text-align: center;
}

#full-leaderboard .close-btn {
    margin-top: 20px;
}

#home-btn {
    background: linear-gradient(135deg, #00ff88, #00ccff);
    color: #000;
    font-weight: 800;
    border-radius: 12px;
    padding: 6px 10px;
    /* Slightly larger hit area */
    font-size: 12px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    text-decoration: none;
    display: inline-block;
    bottom: 60px;
}

#bottom-bar {
    position: fixed;
    bottom: 60px;
    /* Moved up to clear bottom ad */
    left: 12px;
    right: auto;
    /* Don't stretch */
    display: flex;
    flex-direction: column;
    /* Stack vertically */
    align-items: flex-start;
    /* Align to left */
    gap: 4px;
    /* Reduced space between buttons */
    z-index: 9999;
    pointer-events: none;
}

#bottom-bar a {
    pointer-events: auto;
}


/* Benefit popup overlay */
#benefit-box {
    position: fixed;

    /* Place ABOVE leaderboard */
    top: 50px;
    left: 20px;

    width: 300px;
    background: linear-gradient(135deg, #ffcc00, #ff6600);
    color: #000;
    padding: 10px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 700;
    box-shadow: 0 0 15px rgba(255, 150, 0, 0.5);
    z-index: 6;

}

#benefit-box .benefit-title {
    font-weight: 900;
    margin-bottom: 5px;
}

#benefit-box ul {
    margin: 0;
    padding-left: 16px;
}

#benefit-box li {
    margin-bottom: 2px;
}

/* Mobile */
@media (max-width: 768px) {

    #benefit-box,
    #side-leaderboard,
    #tutorial-overlay {
        display: none !important;
    }
}


#tutorial-overlay {
    position: fixed;
    left: 10px;
    top: 160px;
    z-index: 9999;
    pointer-events: none;
    /* game remains playable */
}

#tutorial-dialog {
    width: 260px;
    height: 260px;
    border-radius: 16px;
    padding: 3px;

    background: linear-gradient(135deg, #4d79ff, #9c27ff, #00e5ff);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);

    overflow: hidden;

    pointer-events: auto;
    /* allow skip button click */
}



#tutorial-dialog {
    position: fixed;

    /* SAME LEFT as benefit box */
    left: 10px;

    /* BELOW benefit box */
    top: 10px;

    width: 500px;
    height: 500px;

    border-radius: 18px;
    padding: 3px;

    background: linear-gradient(135deg, #4d79ff, #9c27ff, #00e5ff);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);

    overflow: hidden;
    pointer-events: auto;
}


#tutorial-dialog {
    width: 300px;
    height: 475px;
    border-radius: 18px;
    padding: 3px;

    background: linear-gradient(135deg, #4d79ff, #9c27ff, #00e5ff);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);

    overflow: hidden;
}

/* Inner container fixes corner cutting */
#tutorial-inner {
    width: 100%;
    height: 100%;
    background: black;
    border-radius: 15px;

    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Video section (top 65%) */
#tutorial-video-container {
    flex: 0 0 60%;
}


#tutorial-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Text section (bottom area) */

#tutorial-text {
    flex: 1;
    color: white;
    text-align: center;
    padding: 10px;
    font-weight: bold;
}

#tutorial-text {
    margin-top: -1px;
}


#tutorial-text h3 {
    font-size: 14px;
}

#tutorial-text p {
    font-size: 12px;
}


/* Skip button */
#skip-tutorial {
    margin: 6px auto 10px;
    padding: 8px 14px;
    font-size: 14px;
    border: none;
    border-radius: 10px;
    cursor: pointer;

    background: rgba(255, 255, 255, 0.15);
    color: white;
    backdrop-filter: blur(6px);
    transition: 0.2s;
}

#skip-tutorial:hover {
    background: rgba(255, 255, 255, 0.3);
}

#party-welcome {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 9999;
}

#party-text {
    position: absolute;
    top: 5%;
    left: 50%;
    transform: translateX(-50%);

    font-size: 28px;
    font-weight: 900;
    color: white;

    text-shadow: 0 5px 20px rgba(0, 0, 0, 0.6);

    animation: partyPop 0.6s ease-out;
}

@keyframes partyPop {
    0% {
        transform: translateX(-50%) scale(0.5);
        opacity: 0;
    }

    100% {
        transform: translateX(-50%) scale(1);
        opacity: 1;
    }
}

#confetti-canvas {
    width: 100%;
    height: 100%;
}

/* Challenge Message Styles */
#challenge-message {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(135deg, rgba(255, 152, 0, 0.95), rgba(230, 81, 0, 0.95));
    backdrop-filter: blur(10px);
    border-radius: 24px;
    padding: 40px 30px;
    text-align: center;
    z-index: 1500;
    box-shadow: 0 15px 50px rgba(255, 152, 0, 0.4), inset 0 0 30px rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.3);
    pointer-events: none;
    animation: challengeSlideIn 0.5s ease-out;
    max-width: 90%;
}

#challenge-message.hidden {
    animation: challengeFadeOut 0.6s ease-in forwards;
}

.challenge-emoji {
    font-size: 4rem;
    line-height: 1;
    margin-bottom: 15px;
    animation: emojiPulse 0.8s ease-in-out;
}

.challenge-text {
    font-size: 1.4rem;
    font-weight: 900;
    color: white;
    margin-bottom: 10px;
    text-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    line-height: 1.4;
}

.challenge-subtext {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.95);
    font-weight: 600;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

@keyframes challengeSlideIn {
    0% {
        transform: translate(-50%, -70%);
        opacity: 0;
        scale: 0.8;
    }

    100% {
        transform: translate(-50%, -50%);
        opacity: 1;
        scale: 1;
    }
}

@keyframes challengeFadeOut {
    0% {
        opacity: 1;
        transform: translate(-50%, -50%);
    }

    100% {
        opacity: 0;
        transform: translate(-50%, -30%);
    }
}

@keyframes emojiPulse {

    0%,
    100% {
        transform: scale(1) rotate(0deg);
    }

    25% {
        transform: scale(1.15) rotate(-5deg);
    }

    75% {
        transform: scale(1.15) rotate(5deg);
    }
}

/* COOKIE CONSENT BANNER */
.cookie-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(26, 26, 46, 0.95);
    border-top: 1px solid rgba(255, 152, 0, 0.3);
    padding: 8px 12px;
    z-index: 10000;
    font-size: 11px;
    animation: slideUp 0.3s ease-out;
    backdrop-filter: blur(5px);
}

.cookie-banner.hidden {
    display: none;
}

.cookie-content {
    max-width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
}

.cookie-text {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
    min-width: 150px;
    color: rgba(255, 255, 255, 0.8);
    line-height: 1.3;
}

.cookie-icon {
    font-size: 14px;
}

.cookie-buttons {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.cookie-btn {
    padding: 5px 10px;
    border: none;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.cookie-btn-accept {
    background: linear-gradient(135deg, #ff9800, #f57c00);
    color: white;
}

.cookie-btn-accept:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(255, 152, 0, 0.4);
}

.cookie-btn-decline {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.cookie-btn-decline:hover {
    background: rgba(255, 255, 255, 0.15);
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@media (max-width: 480px) {
    .cookie-banner {
        padding: 6px 8px;
    }

    .cookie-content {
        gap: 6px;
    }

    .cookie-text {
        font-size: 10px;
        gap: 4px;
    }

    .cookie-btn {
        padding: 4px 8px;
        font-size: 9px;
    }

    .cookie-icon {
        font-size: 12px;
    }
}