* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: Arial, sans-serif;
    /* Allow normal scrolling on mobile to avoid freezing on older iOS devices. */
    overflow-y: auto;
    -webkit-overflow-scrolling: touch; /* smoother momentum scrolling for iOS */
    -webkit-text-size-adjust: 100%; /* avoid unexpected text scaling */
    background: linear-gradient(135deg, #b19cd9 0%, #9b7bc7 100%);
    min-height: 100vh;
}

/* Helper to disable scrolling (toggled by JS when menus/modals open). */
.no-scroll {
    overflow: hidden !important;
    touch-action: none !important;
}

/* Reduce heavy effects for older iOS devices to improve performance */
.ios-legacy body, .ios-legacy .video-container, .ios-legacy .content, .ios-legacy .top-nav, .ios-legacy .buttons-container {
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
}

.ios-legacy .external-members-btn,
.ios-legacy .nav-button,
.ios-legacy .oval-button,
.ios-legacy .menu-item {
    box-shadow: none !important;
    transition: none !important;
}

.ios-legacy .menu-overlay,
.ios-legacy .passwordModalOverlay,
.ios-legacy .page-loading {
    background: rgba(0,0,0,0.8) !important; /* slightly less intensive */
}

/* Reduce animation frequency/complex transitions */
.ios-legacy * {
    transition-duration: 0.08s !important;
}

.video-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    z-index: 0; /* Ensure container sits below UI but above page background */
}

.desktop-video,
.mobile-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 0; /* explicit stacking to avoid being covered */
    pointer-events: none; /* allow clicks to pass through the video element */
}

/* Desktop: Show desktop video, hide mobile video */
.desktop-video {
    display: block;
}

.mobile-video {
    display: none;
}

/* Mobile: Show mobile video, hide desktop video */
@media screen and (max-width: 768px) {
    .desktop-video {
        display: none;
    }
    
    .mobile-video {
        display: block;
    }
}

.content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    z-index: 10; /* ensure UI sits above video */
    color: white;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
    width: min(90vw, 32rem);
}

.content h1 {
    font-size: 3rem;
    font-weight: bold;
    margin-bottom: 1rem;
}

/* Styles moved from inline index.html fallback */
/* Immediate fallback to prevent white screen */
body, html { 
    margin: 0; 
    padding: 0; 
    background: linear-gradient(135deg, #b19cd9 0%, #9b7bc7 100%) !important; 
    min-height: 100vh;
    overflow-x: hidden;
}

/* Ensure video container is immediately visible */
.video-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    background: linear-gradient(135deg, #b19cd9 0%, #9b7bc7 100%);
}

/* External Members Button Styles */
.external-members-btn {
    background: rgba(236, 115, 156, 0.9);
    border: none;
    border-radius: 50px;
    padding: 12px 24px;
    cursor: pointer;
    color: white;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    white-space: nowrap;
}

.external-members-btn:hover {
    background: rgba(220, 95, 136, 0.9);
    transform: scale(1.05);
}

/* Improve button responsiveness on touch devices */
button, .external-members-btn, .nav-button, .oval-button {
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation; /* reduce 300ms delays */
    will-change: transform; /* hint for smoother transforms */
}

/* Loading fallback */
.page-loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: linear-gradient(135deg, #b19cd9 0%, #9b7bc7 100%);
    z-index: -1;
}

.footer {
    position: relative;
    left: auto;
    bottom: auto;
    transform: none;
    width: 100%;
    padding: 1.5rem 1rem;
    color: white;
    font-size: 0.8rem;
    line-height: 1.6;
    text-align: center;
    z-index: 10;
    overflow-wrap: anywhere;
}

.footer p {
    margin: 0;
}

.landing-footer {
    position: fixed;
    left: 50%;
    bottom: 20px;
    transform: translateX(-50%);
    width: min(92vw, 44rem);
    padding: 0 1rem;
    z-index: 10;
    background: transparent;
}

.footer a {
    color: white;
    text-decoration: none;
}

.footer a:hover {
    text-decoration: underline;
}

@media screen and (max-width: 768px) {
    .footer {
        padding: 1rem;
        font-size: 0.78rem;
    }

    .landing-footer {
        bottom: 10px;
        width: min(94vw, 36rem);
        padding: 0 0.75rem;
    }
}

/* Additional responsive adjustments */
@media screen and (max-width: 480px) {
    .content h1 {
        font-size: 2rem;
    }
}

@media screen and (max-width: 320px) {
    .content h1 {
        font-size: 1.5rem;
    }
}

/* Admin Button (Top Left) */
.admin-btn {
    position: fixed;
    top: 20px;
    left: 20px;
    display: inline-block;
    background: #89CFF0 !important; /* Baby blue */
    color: #000 !important;
    border: none;
    padding: 10px 20px;
    border-radius: 10px;
    font-weight: 700;
    font-size: 14px;
    font-family: Arial, sans-serif;
    cursor: pointer;
    text-decoration: none !important;
    z-index: 10000;
    box-shadow: 0 4px 12px rgba(137, 207, 240, 0.4);
    transition: all 0.3s ease;
}

.admin-btn:hover {
    background: #7EC8E3;
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(137, 207, 240, 0.6);
}

.admin-btn:active {
    transform: translateY(0);
}

.top-nav {
    position: fixed;
    top: 20px;
    right: 20px;
    display: flex;
    gap: 15px;
    z-index: 10000; /* ensure nav is above video and overlays */
    max-width: calc(100vw - 40px);
    flex-wrap: wrap;
    justify-content: flex-end;
}

/* Home button (top-right) */
.nav-home {
    background: rgba(255,255,255,0.03);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.04);
    padding: 8px 12px;
    border-radius: 10px;
    font-weight: 700;
    cursor: pointer;
    min-width: 56px;
}
.nav-home:hover { background: rgba(255,255,255,0.06); transform: translateY(-1px); box-shadow: 0 6px 18px rgba(0,0,0,0.35); }

/* Ensure placeholder gifs show correctly in the assets grid */
.placeholder-gif {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    border-radius: 8px !important;
}

.nav-button {
    background: #ec739c;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 25px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 80px;
    text-align: center;
    line-height: 1.2;
}

.nav-button:hover {
    background: #d65a8a;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(236, 115, 156, 0.3);
}

.nav-button:active {
    transform: translateY(0);
}

/* Daily Spin special styling on the home page: gold background with black text */
.nav-button.daily-spin-home {
    background: linear-gradient(180deg,#FFD700 0%, #D4AF37 100%);
    color: #000;
    border: 1px solid rgba(0,0,0,0.12);
    box-shadow: 0 8px 20px rgba(212,175,55,0.18);
}
.nav-button.daily-spin-home:hover { filter: brightness(0.98); transform: translateY(-1px); box-shadow: 0 10px 30px rgba(212,175,55,0.22); }

.buttons-container {
    position: absolute;
    bottom: 15%;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    z-index: 100; /* ensure buttons are above video and clickable */
}

.oval-button {
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 15px 40px;
    border-radius: 50px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    min-width: 200px;
    text-align: center;
}

.oval-button:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.oval-button:active {
    transform: translateY(0);
}

/* Prevent iOS auto-zoom on focus by ensuring interactive controls have at least 16px font size on small screens. */
@media screen and (max-width: 768px) {
    button, input, select, textarea, .external-members-btn, .nav-button, .oval-button {
        font-size: 16px; /* iOS auto-zooms when font-size < 16px */
        touch-action: manipulation; /* reduce double-tap/300ms issues */
        -webkit-text-size-adjust: 100%;
    }

    /* Ensure body uses momentum scrolling on older iOS */
    html, body {
        -webkit-overflow-scrolling: touch;
    }
}

/* Mobile adjustments for buttons */
@media screen and (max-width: 768px) {
    .admin-btn {
        top: 10px;
        left: 10px;
        padding: 6px 12px;
        font-size: 12px !important;
        display: inline-block !important;
        background: #89CFF0 !important;
        color: #000 !important;
        text-decoration: none !important;
        border-radius: 8px;
        box-shadow: 0 2px 8px rgba(137, 207, 240, 0.4);
    }

    .top-nav {
        top: 10px;
        right: 10px;
        gap: 6px;
        max-width: calc(100vw - 20px);
    }
    
    .external-members-btn,
    .nav-button {
        padding: 6px 10px !important;
        font-size: 11px !important;
        min-width: auto !important;
        white-space: normal !important;
        text-align: center;
    }
    
    .nav-button {
        padding: 6px 10px;
        font-size: 11px;
        min-width: auto;
    }
    
    .buttons-container {
        bottom: 10%;
        gap: 15px;
        width: min(90vw, 22rem);
    }
    
    .oval-button {
        padding: 12px 30px;
        font-size: 1rem;
        min-width: 180px;
        width: 100%;
    }
}

@media screen and (max-width: 480px) {
    .oval-button {
        padding: 10px 25px;
        font-size: 0.9rem;
        min-width: 160px;
    }
}
