﻿/* ===========================================
   Mobile layout only — hides desktop layout
   =========================================== */
#layout, #bottom-ad {
    display: none;
}

/* --- Safe area fix for notched phones --- */
body {
    padding-top: env(safe-area-inset-top);
    background-color: #000; /* optional */
}

header, #top-bar, .header-bar {
    padding-top: env(safe-area-inset-top);
}

header {
    height: calc(30px + env(safe-area-inset-top));
    top: 0px;
    margin-bottom: 60px;
}

body {
    margin: 0;
    padding: 0;
    background: linear-gradient(135deg, #0b0f1a, #111926);
    color: #e5eefc;
    font-family: 'Poppins', system-ui, sans-serif;
    overflow-x: hidden;
}

/* Restore mobile visibility */
#mobile-main,
#mobile-footer {
    display: flex !important;
    flex-direction: column;
}

/* Let header manage its own layout */
#mobile-header {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    flex-direction: row; /* ✅ row layout */
}


/* Structure */
#mobile-app {
    display: flex;
    flex-direction: column;
    height: 100vh;
    text-align: center;
}

/* Header */
/*#mobile-header {
    flex: 0 0 auto;
    background: linear-gradient(135deg, #2f3d52, #3e4f68);
    color: #7fff00;
    padding: 16px;
    border-bottom: 3px solid #7fff00;
    box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}*/

#mobile-header {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between; /* ✅ logo left, menu right */
    background: linear-gradient(135deg, #2f3d52, #3e4f68);
    color: #7fff00;
    padding: 16px 16px;
    border-bottom: 3px solid #7fff00;
    box-shadow: 0 2px 8px rgba(0,0,0,0.4);
    position: relative;
    text-align: left; /* ✅ ensures no center alignment fallback */
}


.mobile-title {
    margin: 0;
    font-size: 1.6rem;
}

.mobile-logo {
    display: block;
    margin-top: 0px;
    margin-left: 0px;
    max-width: 320px;
    height: auto;
}


/* Main area */
#mobile-main {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 10px;
}

    /* ✅ Extend mobile-main color slightly under the top neon line */
    #mobile-main::before {
        content: "";
        position: absolute;
        top: -10px; /* overlaps just behind the neon line */
        left: 0;
        right: 0;
        height: 10px; /* just enough to hide the black gap */
        background: inherit; /* same color as mobile-main background */
        z-index: -1; /* sit behind everything */
    }

/* ✅ Top strip under neon line (matches main background) */
#mobile-top-strip {
    height: 12px; /* adjust if you want it thicker/thinner */
    width: 100%;
    background: #000; /* default color before user picks one */
    margin: 0;
    padding: 0;
}


#wheel-container-mobile {
    width: 100%;
    max-width: 420px;
}

prize-drum {
    width: 100%;
    height: auto;
}


#wheel-mobile {
    /* Apply an additional external glow */
    filter: drop-shadow(0 0 5px rgba(0, 128, 255, 0.2)) drop-shadow(0 0 10px rgba(0, 128, 255, 0.2)) drop-shadow(0 0 10px rgba(0, 128, 255, 0.4));
}

/* 🟢 Move the entire wheel group upward */
/* 🟢 Raise the mobile prize drum upward */
#wheel-container-mobile {
    display: flex;
    justify-content: center;
    align-items: center;
    transform: translateY(-60px); /* adjust as needed */
    transition: transform 0.3s ease;
}

/* Optional fine-tuning for shorter phones */
@media (max-height: 700px) {
    #wheel-container-mobile {
        transform: translateY(-40px);
    }
}

/* Optional: keep the SPIN button close to the wheel */
#spin-mobile {
    margin-top: 1.5rem; /* adjust as needed */
}


/* Spin button */
#spin-mobile {
    background: linear-gradient(135deg, #7fff00, #3affb8);
    color: #0b0f1a;
    border: none;
    padding: 14px 30px;
    border-radius: 40px;
    font-size: 1.2rem;
    font-weight: 600;
    margin-top: -40px;
    cursor: pointer;
    box-shadow: 0 0 10px #7fff00;
    transition: transform 0.1s ease, box-shadow 0.1s ease;
}

    #spin-mobile:active {
        transform: scale(0.95);
        box-shadow: 0 0 5px #7fff00;
    }

/* Footer */
#mobile-footer {
    flex: 0 0 auto;
    background: #101520;
    padding: 10px 0;
    border-top: 2px solid #7fff00;
}

#mobile-ad-space {
    width: 100%;
    min-height: 70px;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Desktop visible again above 900px */
@media (min-width: 901px) {
    #mobile-app {
        display: none;
    }

    #layout, #bottom-ad {
        display: block;
    }
}

/* Popup overlay */
.popup-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

    .popup-overlay.show {
        display: flex;
    }

.popup-card {
    background: #1c2638;
    border: 2px solid #7fff00;
    border-radius: 12px;
    padding: 20px 30px;
    text-align: center;
    box-shadow: 0 0 20px rgba(127,255,0,0.3);
}

.popup-result {
    font-size: 1.4rem;
    color: #fff;
    margin-bottom: 20px;
}

#mobile-popup-overlay .popup-card {
    background: #1c2638;
    border: 2px solid #00ff88;
    border-radius: 16px;
    padding: 1.8rem 2.2rem;
    text-align: center;
    box-shadow: 0 0 20px rgba(0, 255, 136, 0.4);
    max-width: 80%;
    color: #fff;
    font-family: 'Poppins', system-ui, sans-serif;
}

#mobile-popup-text {
    font-size: 1.2rem;
    font-weight: 600;
    line-height: 1.6;
    color: #e6fdf5;
    margin-bottom: 1.4rem;
    white-space: pre-line; /* enables two lines if \n used */
}


#mobile-popup-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 3000;
    transition: opacity 0.3s ease;
}

    #mobile-popup-overlay.active {
        display: flex;
        opacity: 1;
    }

#mobile-popup-text {
    font-size: 1.3rem;
    color: white;
    text-align: center;
    margin-bottom: 1rem;
}


#mobile-popup-ok {
    background: linear-gradient(135deg, #00ff88, #3affb8);
    color: #0b0f1a;
    border: none;
    padding: 10px 26px;
    border-radius: 30px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 0 10px #00ff88;
    transition: all 0.2s ease;
}

    #mobile-popup-ok:hover {
        transform: scale(1.05);
        box-shadow: 0 0 14px #00ff88;
    }

    #mobile-popup-ok:active {
        transform: scale(0.95);
        box-shadow: 0 0 6px #00ff88;
    }

/* ==========================
   Top Dropdown (slides down + up smoothly)
   ========================== */
#mobile-menu-top {
    position: fixed;
    top: 70px; /* match bottom of header */
    left: 0;
    right: 0;
    background: #141c29;
    border-bottom: 2px solid #00ff88;
    box-shadow: 0 6px 18px rgba(0,255,136,0.25);
    transform: translateY(-100%); /* start hidden above */
    opacity: 0; /* transparent */
    visibility: hidden; /* non-interactive */
    transition: transform 0.35s ease-in-out, opacity 0.35s ease-in-out, visibility 0s linear 0.35s; /* waits to hide after animation */
    z-index: 2600;
}

    /* When visible */
    #mobile-menu-top.show {
        transform: translateY(0); /* slide down */
        opacity: 1;
        visibility: visible;
        transition: transform 0.35s ease-in-out, opacity 0.35s ease-in-out, visibility 0s linear 0s; /* visible immediately */
    }

/* Header inside dropdown */
.menu-top-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    border-bottom: 1px solid rgba(0,255,136,0.3);
    color: #00ff88;
}

.menu-title {
    font-weight: 600;
    font-size: 1rem;
}

/* Wheel options */
#mobile-wheel-list {
    list-style: none;
    margin: 0;
    padding: 6px 0 10px;
}

    #mobile-wheel-list li {
        padding: 10px 18px;
        text-align: left;
        color: #e6eefc;
        font-size: 0.95rem;
        font-weight: 500;
        border-bottom: 1px solid rgba(0,255,136,0.1);
        cursor: pointer;
        transition: background 0.2s ease;
    }

        #mobile-wheel-list li:hover {
            background: rgba(0,255,136,0.08);
        }

/* Hamburger button inside header */
#mobile-menu-toggle {
    position: absolute;
    right: 14px;
    top: 12px;
    background: none;
    border: 2px solid #00ff88;
    border-radius: 6px;
    color: #00ff88;
    font-size: 1.2rem;
    padding: 4px 8px;
    cursor: pointer;
    z-index: 2700;
}

/* =============== 2-Level Dropdown =============== */

/* Main list (first level) */
.mobile-main-menu {
    list-style: none;
    margin: 0;
    padding: 0;
}

    .mobile-main-menu .menu-item {
        border-bottom: 1px solid rgba(0,255,136,0.15);
        color: #e6eefc;
        font-weight: 600;
        font-size: 1rem;
        padding: 12px 18px;
        text-align: left;
        cursor: pointer;
        background: #141c29;
        transition: background 0.2s ease;
    }

        .mobile-main-menu .menu-item:hover {
            background: rgba(0,255,136,0.08);
        }

/* Submenu (second level) */
.submenu {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 0; /* 🔹 Hidden by default */
    overflow: hidden;
    background: #1a2233;
    transition: max-height 0.3s ease;
    border-top: 1px solid rgba(0,255,136,0.1);
}

    .submenu.show {
        max-height: 300px; /* enough to reveal all items */
    }

/* Allow deeper Settings section to open fully */
#mobile-settings-submenu.show {
    max-height: 600px; /* enough for Spin + Confetti + Save button */
    transition: max-height 0.3s ease;
}

#mobile-settings-submenu .submenu.show {
    max-height: 400px; /* inner Spin or Confetti dropdowns */
}

.submenu li {
    padding: 10px 28px; /* indented for hierarchy */
    border-bottom: 1px solid rgba(0,255,136,0.1);
    font-weight: 500;
    font-size: 0.95rem;
    color: #cfe7ff;
}

    .submenu li:hover {
        background: rgba(0,255,136,0.08);
    }

#mobile-settings-submenu {
    position: relative;
    overflow-y: auto;
    max-height: 70vh;
    padding-bottom: 10px;
}



#mobile-popup-text img {
    max-width: 160px;
    max-height: 160px;
    border-radius: 12px;
    margin: 0.5rem auto;
    display: block;
}

.popup-img {
    max-width: 150px;
    max-height: 150px;
    border-radius: 12px;
    margin: 0.5rem auto;
    display: block;
}



#login-popup {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.75);
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

    #login-popup.show {
        display: flex;
    }

    #login-popup .popup-card {
        background: #0b0f1a;
        border: 2px solid #00ff80;
        border-radius: 10px;
        padding: 1.5rem 2rem;
        text-align: center;
        color: #fff;
        width: 280px;
        box-shadow: 0 0 20px #00ff80;
    }

    #login-popup input {
        width: 100%;
        margin: 0.4rem 0;
        padding: 0.6rem;
        border: none;
        border-radius: 6px;
        font-size: 1rem;
    }

    #login-popup .login-buttons {
        display: flex;
        justify-content: space-between;
        margin-top: 1rem;
    }

    #login-popup button {
        background: #00ff80;
        border: none;
        border-radius: 6px;
        padding: 0.5rem 1rem;
        font-weight: 600;
        cursor: pointer;
    }

    #login-popup #login-close {
        margin-top: 1rem;
        background: #333;
        color: #aaa;
    }

/* ✅ Ensure login popup always appears on top */
#login-popup {
    z-index: 12000 !important;
    position: fixed !important;
    inset: 0 !important;
}


/* ✅ Ensure global popups appear above mobile app */
#authPopup.popup-overlay {
    z-index: 99999 !important; /* way above #mobile-app and ads */
    position: fixed;
    inset: 0;
    display: none;
    justify-content: center;
    align-items: center;
}

#authPopup.show {
    display: flex !important;
}

/* ============================================================
   🔹 Nested submenu support for Settings (mobile)
   ============================================================ */
#mobile-menu-top .submenu .has-submenu > span {
    display: block;
    padding: 10px 36px; /* more indent than parent level */
    font-weight: 600;
    color: #00ff88;
    cursor: pointer;
}

#mobile-menu-top .submenu .submenu {
    background: #202a3d;
    border-left: 2px solid rgba(0,255,136,0.2);
    padding-left: 10px;
}

    #mobile-menu-top .submenu .submenu li {
        padding: 8px 42px;
        font-size: 0.9rem;
    }

        #mobile-menu-top .submenu .submenu li label {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 6px;
        }

    #mobile-menu-top .submenu .submenu input[type="number"],
    #mobile-menu-top .submenu .submenu input[type="color"] {
        width: 70px;
        border: 1px solid rgba(0,255,136,0.2);
        border-radius: 6px;
        background: #0b1220;
        color: #fff;
        padding: 3px 4px;
        font-size: 0.9rem;
    }

    #mobile-menu-top .submenu .submenu button.neon-btn.small {
        margin: 8px 0 4px 0;
        padding: 6px 12px;
        font-size: 0.85rem;
    }

/* ===== Sole Survivor (mobile override) ===== */
#mobile-popup-overlay .popup-card.sole-survivor {
    width: 85%;
    max-width: 300px;
    width: auto;
    padding: 1.2rem 1rem;
    border-radius: 12px;
    border: 3px solid #39ff14;
    background: radial-gradient(circle at top, #101820, #0a0f14);
    box-shadow: 0 0 10px #39ff14, 0 0 20px #39ff14, 0 0 30px #00ff66;
    color: #fff;
    text-align: center;
    font-size: clamp(1.2rem, 4vw, 2rem);
}

    #mobile-popup-overlay .popup-card.sole-survivor img {
        max-width: 70%;
        height: auto;
        margin: 0.5rem auto;
        display: block;
    }

    #mobile-popup-overlay .popup-card.sole-survivor button {
        margin-top: 1rem;
        background: #39ff14;
        color: #000;
        font-weight: 700;
        border: none;
        border-radius: 8px;
        padding: 0.6rem 1.2rem;
        box-shadow: 0 0 6px #39ff14, 0 0 12px #00ff66;
    }

#mobile-popup-overlay.active {
    background: rgba(0, 0, 0, 0.8);
}

/* Ensure emojis don't misalign text */
#mobile-popup-overlay .popup-card .emoji {
    display: inline-block;
    font-size: 1.6em; /* slightly smaller to align better */
    vertical-align: middle; /* keeps them centered vertically with the text */
    line-height: 1;
    margin: 0 0.15em; /* small spacing between emoji and text */
}

/* Ensure the text block centers perfectly */
#mobile-popup-overlay .popup-card .msg-text {
    display: inline-block;
    text-align: center;
    vertical-align: middle;
}

@media (max-width: 500px) {
    #mobile-popup-overlay .popup-card .emoji {
        font-size: 1.3em;
    }
}

.popup {
    z-index: 9999;
    position: fixed;
}

#mobile-menu-top {
    z-index: 1000; /* lower than popup */
}

/* ✅ Keep collapsed by default but allow .show to work */
#mobile-settings-submenu,
#mobile-settings-submenu .submenu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

    #mobile-settings-submenu.show {
        max-height: 600px; /* or 70vh if you prefer */
    }

    #mobile-settings-submenu .submenu.show {
        max-height: 400px;
    }
