/* public/css/style.css - final and responsive version with new background and panda animation */

/* --------------------------------------------
   Font: Vazirmatn (bundled in /assets/fonts)
   -------------------------------------------- */
@font-face {
    font-family: 'Vazirmatn';
    src: url('../assets/fonts/Vazirmatn-Regular.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Vazirmatn';
    src: url('../assets/fonts/Vazirmatn-Medium.woff2') format('woff2');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Vazirmatn';
    src: url('../assets/fonts/Vazirmatn-Bold.woff2') format('woff2');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Vazirmatn';
    src: url('../assets/fonts/Vazirmatn-ExtraBold.woff2') format('woff2');
    font-weight: 800;
    font-style: normal;
    font-display: swap;
}

/* --- Tap to Earn Animations --- */
@keyframes pulse {
    0% {
        opacity: 0.7;
        transform: translateX(-50%) scale(1);
    }
    50% {
        opacity: 1;
        transform: translateX(-50%) scale(1.05);
    }
    100% {
        opacity: 0.7;
        transform: translateX(-50%) scale(1);
    }
}

@keyframes coinFloat {
    0% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
    50% {
        opacity: 1;
        transform: translate(-50%, -100px) scale(1.2);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -150px) scale(0.8);
    }
}

@keyframes pandaTap {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(0.95);
    }
    100% {
        transform: scale(1);
    }
}

/* Futuristic Glow Animations */
@keyframes neonGlow {
    0%, 100% {
        text-shadow: 
            0 0 10px rgba(0, 212, 255, 0.8),
            0 0 20px rgba(0, 212, 255, 0.6),
            0 0 30px rgba(0, 212, 255, 0.4);
    }
    50% {
        text-shadow: 
            0 0 15px rgba(0, 255, 255, 1),
            0 0 30px rgba(0, 255, 255, 0.8),
            0 0 45px rgba(0, 255, 255, 0.6);
    }
}

@keyframes borderGlow {
    0%, 100% {
        box-shadow: 
            0 0 20px rgba(0, 212, 255, 0.3),
            0 0 40px rgba(0, 212, 255, 0.2),
            inset 0 1px 0 rgba(255, 255, 255, 0.1);
        border-color: rgba(0, 212, 255, 0.4);
    }
    50% {
        box-shadow: 
            0 0 30px rgba(0, 255, 255, 0.5),
            0 0 60px rgba(0, 255, 255, 0.3),
            inset 0 1px 0 rgba(255, 255, 255, 0.2);
        border-color: rgba(0, 255, 255, 0.6);
    }
}

@keyframes goldGlow {
    0%, 100% {
        box-shadow: 
            0 0 15px rgba(255, 215, 0, 0.6),
            0 0 30px rgba(255, 215, 0, 0.4);
        text-shadow: 0 0 10px rgba(255, 215, 0, 0.8);
    }
    50% {
        box-shadow: 
            0 0 25px rgba(255, 215, 0, 0.9),
            0 0 50px rgba(255, 215, 0, 0.6);
        text-shadow: 0 0 15px rgba(255, 215, 0, 1);
    }
}
:root {
    --font-family: 'Vazirmatn', system-ui, -apple-system, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    /* Dark Blue Futuristic Theme */
    --bg-gradient-start: #0a0e27;
    --bg-gradient-end: #1a1f3a;
    --surface-color: rgba(30, 40, 70, 0.85);
    --primary-color: #00d4ff;
    --primary-color-dark: #0099cc;
    --accent-color: #ff6b35;
    --neon-blue: #00d4ff;
    --neon-cyan: #00ffff;
    --neon-purple: #9d4edd;
    --text-color: #ffffff;
    --text-secondary-color: #b0c4de;
    --border-color: rgba(0, 212, 255, 0.4);
    --hunger-bar: linear-gradient(90deg, #ff6b35, #ff8c42);
    --happiness-bar: linear-gradient(90deg, #00d4ff, #00ffff);
    --energy-bar: linear-gradient(90deg, #9d4edd, #c77dff);
    --bar-background: rgba(20, 30, 50, 0.8);
    --bar-glow-color: rgba(0, 212, 255, 0.6);
    --shadow-color: rgba(0, 212, 255, 0.3);
    --gold-color: #ffd700;
    --gold-glow: rgba(255, 215, 0, 0.5);
}

/* =========================================================
   Hamster-like theme (warm, bright, soft cards, gold accent)
   Activated by: <body class="theme-hamster">
   ========================================================= */
body.theme-hamster {
    --bg-gradient-start: #fff3d6;
    --bg-gradient-end: #ffe2b0;
    --surface-color: rgba(255, 255, 255, 0.86);
    --primary-color: #2b7a3d;          /* brand green */
    --primary-color-dark: #1f5e2f;
    --accent-color: #f5b301;           /* gold */
    --neon-blue: #2b7a3d;              /* reuse existing tokens */
    --neon-cyan: #1f5e2f;
    --neon-purple: #c06b00;
    --text-color: #1a1a1a;
    --text-secondary-color: rgba(26, 26, 26, 0.65);
    --border-color: rgba(0, 0, 0, 0.06);
    --shadow-color: rgba(0, 0, 0, 0.12);
    --bar-background: rgba(0, 0, 0, 0.06);
    --bar-glow-color: rgba(245, 179, 1, 0.35);
    --gold-color: #f5b301;
    --gold-glow: rgba(245, 179, 1, 0.35);
}

body.theme-hamster {
    /* IMPORTANT:
       Keep background layers count consistent; mismatched background-* lists can
       cause apparent "zoom" and misalignment across WebViews (Telegram/iOS). */
    background-color: #0a0e27;
    background:
        /* Readability overlay */
        linear-gradient(180deg, rgba(0,0,0,0.12) 0%, rgba(0,0,0,0.26) 100%),
        /* Main background image (contains the blue circle) */
        url('../assets/images/new-blue-1-centered.png');
    background-repeat: no-repeat, no-repeat;
    background-size: cover, cover;
    /* Center the circle in the viewport */
    background-position: center, center;
    color: var(--text-color);
    /* Do NOT fix the body; it can cause stacking/overlap in WebViews */
    position: relative;
    min-height: 100dvh;
    overflow: hidden;
}

/* Keep UI cards readable on top of forest */
body.theme-hamster #game-container {
    background: transparent;
}

body.theme-hamster .top-bar {
    /* Glass top bar (lets background show through) */
    background: rgba(10, 20, 35, 0.22);
    border: 1px solid rgba(255, 255, 255, 0.16);
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.22);
    backdrop-filter: blur(18px) saturate(140%);
    -webkit-backdrop-filter: blur(18px) saturate(140%);
}

/* Top bar layout safety: prevent overlap on narrow widths */
body.theme-hamster .top-bar {
    flex-wrap: nowrap;
    align-items: center;
}
body.theme-hamster #level-display,
body.theme-hamster #coins-display {
    flex: 0 0 auto;
}
body.theme-hamster .xp-bar-container {
    flex: 1 1 auto;
    min-width: 0;
}

body.theme-hamster .top-bar-item {
    color: rgba(255, 255, 255, 0.92);
    text-shadow: 0 1px 10px rgba(0, 0, 0, 0.28);
}

body.theme-hamster #coins-display {
    /* Keep gold but less "blocky" */
    background: linear-gradient(135deg, rgba(255, 214, 107, 0.92) 0%, rgba(245, 179, 1, 0.92) 100%);
    border: 1px solid rgba(255, 255, 255, 0.20);
    color: rgba(20, 12, 0, 0.92);
    animation: none;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18);
}

body.theme-hamster #level-display {
    background: rgba(255, 255, 255, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.18);
    box-shadow: none;
    text-shadow: 0 1px 10px rgba(0, 0, 0, 0.25);
}

body.theme-hamster .xp-bar-container {
    background-color: rgba(255, 255, 255, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.16);
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.22);
}

body.theme-hamster .xp-bar-fill {
    background: linear-gradient(90deg, #2b7a3d 0%, #55b06b 55%, #f5b301 100%);
    box-shadow: 0 6px 14px rgba(43, 122, 61, 0.20);
}

body.theme-hamster #xp-text {
    color: rgba(255, 255, 255, 0.92);
    text-shadow: 0 1px 10px rgba(0, 0, 0, 0.35);
}

body.theme-hamster .panda-area {
    /* Remove center "glass panel" so background stays visible */
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

body.theme-hamster #panda-name-display {
    color: rgba(255, 255, 255, 0.95);
    text-shadow: 0 2px 14px rgba(0, 0, 0, 0.45);
    margin: 0 0 6px 0;
    line-height: 1.15;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

body.theme-hamster #panda-image {
    filter: drop-shadow(0 12px 22px rgba(0,0,0,0.18));
}

body.theme-hamster .status-bars {
    background: rgba(10, 20, 35, 0.30);
    border: 1px solid rgba(255, 255, 255, 0.18);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.26);
    backdrop-filter: blur(22px) saturate(145%);
    -webkit-backdrop-filter: blur(22px) saturate(145%);
}

body.theme-hamster .status-item label {
    color: rgba(255, 255, 255, 0.92);
    text-shadow: 0 1px 10px rgba(0, 0, 0, 0.30);
}

body.theme-hamster .bar-container {
    background-color: rgba(255, 255, 255, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.14);
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.22);
}

body.theme-hamster .bar-percentage {
    text-shadow: 0 1px 10px rgba(0, 0, 0, 0.35);
}

body.theme-hamster .nav-bar {
    /* Glass bottom nav (blue/ice style) */
    background: rgba(10, 20, 35, 0.20);
    border: 1px solid rgba(255, 255, 255, 0.18);
    box-shadow: 0 18px 44px rgba(0, 0, 0, 0.26);
    backdrop-filter: blur(18px) saturate(140%);
    -webkit-backdrop-filter: blur(18px) saturate(140%);
}

/* Hide bottom nav whenever any modal/minigame overlay is open */
body.modal-open .nav-bar {
    /* Hard-hide so even iOS "force visible" rules can't win */
    display: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
    transform: translateX(-50%) translateY(30px) translateZ(0) !important;
}
body.modal-open .nav-button {
    pointer-events: none !important;
}

/* (Removed duplicate; defined later in responsive section) */

body.theme-hamster .nav-button {
    color: rgba(255, 255, 255, 0.82) !important;
    text-shadow: 0 1px 10px rgba(0, 0, 0, 0.28);
}

body.theme-hamster .nav-button:hover:not(:disabled) {
    color: rgba(255, 255, 255, 0.95) !important;
    filter: none;
}

body.theme-hamster .nav-button.active {
    color: rgba(255, 255, 255, 0.98) !important;
}

body.theme-hamster .nav-button.active .nav-icon {
    filter: drop-shadow(0 10px 16px rgba(0, 0, 0, 0.35));
    transform: translateY(-2px);
}

body.theme-hamster .nav-button {
    position: relative;
}

body.theme-hamster .nav-button.active::after {
    content: '';
    position: absolute;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    width: 22px;
    height: 4px;
    border-radius: 999px;
    background: linear-gradient(90deg, rgba(106, 227, 255, 1) 0%, rgba(45, 135, 255, 1) 100%);
    opacity: 0.95;
}

/* Floating +coins: make it look like Hamster */
body.theme-hamster .floating-coin-text {
    font-size: 1.35rem;
    font-weight: 900;
    color: #2a1a00;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(0, 0, 0, 0.08);
    padding: 6px 10px;
    border-radius: 14px;
    box-shadow: 0 14px 26px rgba(0, 0, 0, 0.12);
    gap: 6px;
    filter: none;
}

body.theme-hamster .floating-coin-text img {
    width: 22px;
    height: 22px;
}

/* Modals: Hamster-like bottom sheet feel */
body.theme-hamster .modal {
    background-color: rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    /* Always above the nav-bar (especially with iOS visibility fixes) */
    z-index: 2500;
}

body.theme-hamster .modal-content {
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(0, 0, 0, 0.08);
    color: var(--text-color);
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.18);
}

body.theme-hamster .modal-content h2 {
    color: rgba(26, 26, 26, 0.92);
    text-shadow: none;
}

body.theme-hamster .close-button {
    color: rgba(26, 26, 26, 0.65);
    text-shadow: none;
}

body.theme-hamster .close-button:hover {
    color: rgba(26, 26, 26, 0.90);
    filter: none;
}

/* Buttons: warm + solid */
body.theme-hamster .modal-button.confirm {
    background: linear-gradient(135deg, #2b7a3d 0%, #1f5e2f 100%);
    border: 1px solid rgba(0, 0, 0, 0.10);
    box-shadow: 0 10px 22px rgba(43, 122, 61, 0.22);
    text-shadow: none;
}

body.theme-hamster .modal-button.confirm:hover:not(:disabled) {
    background: linear-gradient(135deg, #319047 0%, #2b7a3d 100%);
    box-shadow: 0 12px 26px rgba(43, 122, 61, 0.28);
}

body.theme-hamster .modal-button.cancel {
    background: rgba(0, 0, 0, 0.06);
    color: rgba(26, 26, 26, 0.85);
    border: 1px solid rgba(0, 0, 0, 0.10);
}

body.theme-hamster .modal-button.cancel:hover {
    background: rgba(0, 0, 0, 0.10);
}

/* Cards / shop items: soft white cards */
body.theme-hamster .inventory-item,
body.theme-hamster .shop-item {
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 10px 22px rgba(0, 0, 0, 0.10);
    color: var(--text-color);
}

body.theme-hamster .inventory-item-name,
body.theme-hamster .shop-item-name {
    text-shadow: none;
}

body.theme-hamster .inventory-item-details,
body.theme-hamster .shop-item-details {
    text-shadow: none;
    color: rgba(26, 26, 26, 0.60);
}

body.theme-hamster .buy-button {
    background: linear-gradient(135deg, #ffd66b 0%, #f5b301 100%);
    color: #2a1a00;
    border: 1px solid rgba(0, 0, 0, 0.10);
    box-shadow: 0 10px 22px rgba(245, 179, 1, 0.25);
    text-shadow: none;
}

body.theme-hamster .buy-button:hover {
    background: linear-gradient(135deg, #ffe08c 0%, #ffd66b 100%);
    box-shadow: 0 12px 26px rgba(245, 179, 1, 0.30);
    transform: translateY(-2px);
}

body.theme-hamster .use-button {
    background: linear-gradient(135deg, #2b7a3d 0%, #1f5e2f 100%);
    border: 1px solid rgba(0, 0, 0, 0.10);
    box-shadow: 0 10px 22px rgba(43, 122, 61, 0.22);
    text-shadow: none;
}

/* Tabs: underline + calm */
body.theme-hamster .shop-tabs {
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

body.theme-hamster .tab-button {
    color: rgba(26, 26, 26, 0.55);
    text-shadow: none;
}

body.theme-hamster .tab-button.active {
    color: rgba(26, 26, 26, 0.92);
    border-bottom-color: rgba(26, 26, 26, 0.92);
    text-shadow: none;
}

body.theme-hamster .tab-badge {
    background: linear-gradient(135deg, #2b7a3d 0%, #1f5e2f 100%);
    box-shadow: none;
}

/* Activity card: override inline neon styles */
body.theme-hamster #activity-status-main-card {
    background: rgba(255, 255, 255, 0.86) !important;
    border: 1px solid rgba(0, 0, 0, 0.08) !important;
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.12) !important;
    color: rgba(26, 26, 26, 0.90) !important;
}

body.theme-hamster #activity-status-main-card * {
    text-shadow: none !important;
}

/* SVG icons inside nav */
.nav-icon svg {
    width: 26px;
    height: 26px;
    display: block;
}

/* Unify outline icon look (new inline SVGs use stroke) */
.nav-icon svg[stroke] {
    fill: none;
    vector-effect: non-scaling-stroke;
}

/* Emoji icons */
.nav-emoji {
    display: block;
    font-size: 30px;
    line-height: 1;
    transform: translateZ(0);
}

/* Image icons inside nav (e.g. custom sleep icon) */
.nav-icon-img {
    width: 34px;
    height: 34px;
    display: block;
    object-fit: contain;
    transform: translateZ(0);
    filter: drop-shadow(0 8px 16px rgba(0,0,0,0.28));
}

/* Sleep icon: 2x size */
body.theme-hamster #sleep-btn .nav-icon-img {
    width: 90px;
    height: 90px;
}

/* Play icon: match Sleep icon size */
body.theme-hamster #play-btn .nav-icon-img {
    width: 90px;
    height: 90px;
}

/* Hamster theme: icons-only bottom nav */
/* Hide ONLY the label text span (direct child), not the emoji inside .nav-icon */
body.theme-hamster .nav-button > span {
    display: none !important;
}

/* Ensure nav icon container is centered (don't force emoji visibility) */
body.theme-hamster .nav-button .nav-icon {
    display: flex !important;
    align-items: center;
    justify-content: center;
}

body.theme-hamster .nav-button {
    justify-content: center;
    gap: 0;
    padding: 0;
}

body.theme-hamster .nav-button.active::after {
    bottom: 10px;
}

/* =========================================================
   Telegram Mini App viewport + safe-area compatibility
   - Prefer Telegram-provided CSS vars when available
   - Fall back to dvh/vh + env(safe-area-inset-*)
   ========================================================= */
:root {
    --app-fallback-vh: 100vh;
    --app-safe-top: env(safe-area-inset-top, 0px);
    --app-safe-bottom: env(safe-area-inset-bottom, 0px);
}

@supports (height: 100dvh) {
    :root { --app-fallback-vh: 100dvh; }
}

:root {
    /* Telegram JS SDK sets these dynamically inside WebApp */
    --app-vh: var(--tg-viewport-height, var(--app-fallback-vh));
    --app-vh-stable: var(--tg-viewport-stable-height, var(--app-fallback-vh));
    --app-safe-top: var(--tg-safe-area-inset-top, env(safe-area-inset-top, 0px));
    --app-safe-bottom: var(--tg-safe-area-inset-bottom, env(safe-area-inset-bottom, 0px));
    --app-content-safe-top: var(--tg-content-safe-area-inset-top, var(--app-safe-top));
    --app-content-safe-bottom: var(--tg-content-safe-area-inset-bottom, var(--app-safe-bottom));
}

html {
    height: 100%;
    height: -webkit-fill-available;
}

body {
    font-family: var(--font-family);
    background: linear-gradient(135deg, #0a0e27 0%, #1a1f3a 50%, #0f1419 100%);
    color: var(--text-color);
    margin: 0;
    overflow: hidden;
    direction: ltr;
    /* Telegram WebApp / iOS-safe viewport height */
    height: var(--app-vh);
    min-height: var(--app-vh);
    width: 100vw;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    /* Prevent iOS bounce scrolling */
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: auto;
    /* Futuristic background pattern */
    background-image: 
        radial-gradient(circle at 20% 50%, rgba(0, 212, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(157, 78, 221, 0.1) 0%, transparent 50%),
        linear-gradient(135deg, #0a0e27 0%, #1a1f3a 50%, #0f1419 100%);
}

#game-container {
    width: 100%;
    max-width: 480px;
    /* Telegram WebApp / iOS-safe viewport height */
    height: var(--app-vh);
    min-height: var(--app-vh);
    /* Futuristic dark blue background with cityscape effect */
    background: 
        linear-gradient(180deg, rgba(10, 14, 39, 0.95) 0%, rgba(26, 31, 58, 0.95) 100%),
        radial-gradient(ellipse at bottom, rgba(0, 212, 255, 0.15) 0%, transparent 70%);
    background-size: cover;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    position: relative;
    /* Reserve nav-bar footprint + iOS/Telegram safe-area */
    padding: 12px 12px calc(80px + 15px + var(--app-safe-bottom) + 10px) 12px;
    /* Main game should fit in one screen (no scroll) */
    overflow-y: hidden;
    overflow-x: hidden;
    /* Prevent iOS bounce scrolling */
    -webkit-overflow-scrolling: touch;
    /* Ensure consistent rendering */
    will-change: scroll-position;
    /* Add subtle grid pattern */
    background-image: 
        linear-gradient(rgba(0, 212, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 212, 255, 0.03) 1px, transparent 1px);
    background-size: 50px 50px;
}

/* =========================================================
   One-screen layout (no-scroll) + responsive height tuning
   Goal: Hunger/Happiness/Energy + Activity visible without scrolling
   ========================================================= */

/* Tight vertical layout: minimal gaps, all sections close to nav */
body.theme-hamster #game-container {
    /* Reserve exactly the nav-bar footprint (height + bottom offset + safe-area) */
    /* Extra gap above nav = ~1 icon height */
    padding: 8px 8px calc(80px + 15px + var(--app-safe-bottom) + 32px) 8px !important;
    display: flex;
    flex-direction: column;
    gap: 6px;
    overflow: hidden;
    /* Avoid large artificial gaps between sections */
    justify-content: flex-start;
}

/* Top bar: stays at top */
body.theme-hamster .top-bar {
    flex: 0 0 auto;
    margin: 0;
}

/* Panda area: compact, no excessive height */
body.theme-hamster .panda-area {
    /* Let panda area absorb extra height so status sits near the nav */
    flex: 1 1 auto;
    min-height: 150px;
    max-height: none;
    padding: 8px;
    margin: 0;
    /* Prevent panda name/image from overflowing onto the top bar */
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

/* Ensure panda is centered within the background circle/ring */
body.theme-hamster #panda-wrapper {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}
body.theme-hamster #panda-image {
    margin: 0 auto;
}

/* Status bars: compact */
body.theme-hamster .status-bars {
    flex: 0 0 auto;
    margin: 0;
    padding: 0;
    /* Force the whole bottom stack (status + activity) to sit near the nav */
    margin-top: auto;

    /* Remove the big "status card" panel */
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;

    /* Render as 3 compact items: icon + number */
    display: flex;
    align-items: center;
    justify-content: space-between;
    /* Bigger rings need tighter spacing */
    gap: 8px;
}

/* Status item = icon + number (no bar, no label) */
body.theme-hamster .status-item {
    /* Gauge variables (set by JS) */
    --p: 0;
    --gauge-color: rgba(106, 227, 255, 0.95);
    --status-ring-size: 60px;   /* was 30px */
    --status-ring-inset: 10px;  /* thicker semi-circle */
    /* Pull the number closer to the icon (scales with ring size) */
    --status-number-pull: clamp(2px, calc(var(--status-ring-size) * 0.06), 5px);

    flex: 1 1 0;
    min-width: 0;
    margin: 0 !important;
    padding: 0 !important;
    gap: 2px !important;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

/* Per-stat gauge colors (order in HTML: Hunger, Happiness, Energy) */
body.theme-hamster .status-bars .status-item:nth-child(1) { --gauge-color: rgba(245, 179, 1, 0.95); }     /* Hunger: gold */
body.theme-hamster .status-bars .status-item:nth-child(2) { --gauge-color: rgba(255, 107, 107, 0.95); }   /* Happiness: warm red */
body.theme-hamster .status-bars .status-item:nth-child(3) { --gauge-color: rgba(106, 227, 255, 0.95); }   /* Energy: cyan */
body.theme-hamster .status-item--activity { --gauge-color: rgba(16, 185, 129, 0.95); }                    /* Activity: green */

/* Activity count is wider (e.g. 250/500) */
body.theme-hamster #activity-mini-text { min-width: 0; text-align: center; font-size: 0.86rem; }

body.theme-hamster .status-item label {
    display: none !important;
}

body.theme-hamster .status-icon {
    width: var(--status-ring-size) !important;
    height: var(--status-ring-size) !important;
    border-radius: 999px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    line-height: 1;
    z-index: 0;
    isolation: isolate; /* ensure pseudo-elements never cover the glyph */
}

/* Mini ring gauge around the icon */
body.theme-hamster .status-icon::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 999px;
    /* Semi-circle gauge (top half): 0–100% maps to 0–180deg */
    background: conic-gradient(
        from -90deg,
        var(--gauge-color) 0deg calc(var(--p) * 1.8deg),
        rgba(255, 255, 255, 0.18) calc(var(--p) * 1.8deg) 180deg,
        transparent 180deg 360deg
    );
    opacity: 0.95;
    z-index: 0;
    pointer-events: none;
    /* Keep only the top half (semi-circle) */
    clip-path: inset(0 0 50% 0 round 999px);
    /* Create a ring thickness without covering the icon */
    -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - var(--status-ring-inset)), #000 calc(100% - var(--status-ring-inset) + 1px));
    mask: radial-gradient(farthest-side, transparent calc(100% - var(--status-ring-inset)), #000 calc(100% - var(--status-ring-inset) + 1px));
}

body.theme-hamster .status-icon::after {
    /* No inner fill needed for semi-circle ring (keeps icon clean) */
    display: none;
}

body.theme-hamster .status-icon__glyph {
    position: relative;
    z-index: 2;
}

/* Keep the existing JS-updated percentage text, but remove the visual bar */
body.theme-hamster .bar-container {
    flex: 0 0 auto !important;
    width: auto !important;
    height: auto !important;
    display: flex !important;
    align-items: center;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    overflow: visible !important;
    min-width: 0;
    justify-content: center;
    margin-top: calc(var(--status-number-pull) * -1);
}

body.theme-hamster .bar {
    width: auto !important; /* ignore inline width used for progress */
    height: auto !important;
    display: flex;
    align-items: center;
    background: transparent !important;
    box-shadow: none !important;
}

body.theme-hamster #hunger-bar,
body.theme-hamster #happiness-bar,
body.theme-hamster #energy-bar {
    background: transparent !important;
}

body.theme-hamster .bar-percentage {
    color: rgba(255, 255, 255, 0.95) !important;
    font-weight: 900;
    font-size: 0.92rem;
    line-height: 1.05;
    text-shadow: 0 1px 10px rgba(0, 0, 0, 0.35);
}

/* Never hide the number in hamster theme */
body.theme-hamster .bar.text-hidden .bar-percentage {
    opacity: 1 !important;
}

/* Activity card: compact, pushed to bottom (right above nav) */
body.theme-hamster #activity-status-main-card {
    /* Compact in-flow card (no overlap with status bars / nav) */
    position: static;
    left: auto;
    bottom: auto;
    transform: none;
    width: 100%;
    max-width: none;
    z-index: auto;
    margin: 0 !important;
    padding: 8px 10px !important;
    border-radius: 14px !important;
    box-sizing: border-box;
    overflow: hidden;
    /* Show as: icon + number (no progress bar, no message) */
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}
body.theme-hamster #activity-status-main-card > div:first-child {
    margin: 0 !important;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-width: 0;
    flex: 1 1 auto;
}
body.theme-hamster #activity-status-main-card > div:nth-child(2) {
    /* Hide progress bar container completely */
    display: none !important;
}

body.theme-hamster #activity-progress-main-bar,
body.theme-hamster #activity-progress-main-text {
    display: none !important;
}

body.theme-hamster #activity-status-main-card h4 {
    /* Keep only an icon */
    font-size: 0 !important;
    margin: 0 !important;
    white-space: nowrap;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}
body.theme-hamster #activity-status-main-card h4::before {
    content: "✅";
    font-size: 15px;
    line-height: 1;
}
body.theme-hamster #activity-status-main-text { font-size: 12px !important; white-space: nowrap; }
body.theme-hamster #activity-status-main-message { display: none !important; }

/* Activity is now shown as a 4th mini status icon */
body.theme-hamster #activity-status-main-card { display: none !important; }

/* Responsive by HEIGHT (most important on mobile WebViews) */
@media (max-height: 760px) {
    body.theme-hamster #game-container { padding: 10px 10px calc(80px + 15px + var(--app-safe-bottom) + 32px) 10px !important; gap: 8px; }
    body.theme-hamster .top-bar { padding: 10px 12px; margin-bottom: 0; }
    .xp-bar-container { height: 16px; }
    #xp-text { font-size: 0.68rem; }
    body.theme-hamster .panda-area { min-height: clamp(120px, 24vh, 210px); padding: 12px; }
    body.theme-hamster #panda-name-display { font-size: 1.15rem; margin-bottom: 4px; }
    body.theme-hamster #panda-image { max-width: 190px; }
    body.theme-hamster .status-bars { padding: 0; }
    .bar-container { height: 24px; }
    body.theme-hamster #activity-status-main-card { padding: 8px 10px !important; }
}

@media (max-height: 680px) {
    body.theme-hamster #game-container { gap: 7px; padding-bottom: calc(80px + 15px + var(--app-safe-bottom) + 32px) !important; }
    body.theme-hamster .top-bar { gap: 6px; padding: 9px 10px; }
    body.theme-hamster .top-bar-icon { width: 22px; height: 22px; }
    body.theme-hamster #coins-display { padding: 6px 10px; font-size: 1.0rem; }
    body.theme-hamster #coins-display #coins-value { font-size: 1.05rem; }
    body.theme-hamster .panda-area { min-height: clamp(110px, 22vh, 190px); padding: 10px; }
    body.theme-hamster #panda-image { max-width: 170px; }
    body.theme-hamster .status-bars { padding: 0; }
    body.theme-hamster .status-item { gap: 8px; margin-bottom: 10px; }
    body.theme-hamster .status-item label { font-size: 0.90rem; min-width: 70px; }
    .bar-container { height: 22px; }
    .bar-percentage { font-size: 0.82rem; }
    body.theme-hamster #activity-status-main-message { display: none; } /* keep activity visible but compact */
}

@media (max-height: 620px) {
    /* Ultra-compact: keep bars, hide labels to fit all */
    body.theme-hamster .status-item label { display: none; }
    /* Keep the "2x ring" feel even on short screens */
    body.theme-hamster .status-item { --status-ring-size: 52px; --status-ring-inset: 9px; }
    body.theme-hamster .status-icon { width: var(--status-ring-size) !important; height: var(--status-ring-size) !important; font-size: 22px; }
    .bar-container { height: 20px; }
    body.theme-hamster #panda-name-display { display: none; }
    body.theme-hamster .panda-area { min-height: clamp(95px, 20vh, 160px); padding: 8px; }
    body.theme-hamster #panda-image { max-width: 150px; }
    body.theme-hamster #activity-status-main-card { padding: 7px 9px !important; }
    body.theme-hamster #activity-status-main-card h4 { font-size: 13px !important; }
}

.hidden { display: none !important; }
/* ============================================
   SIMPLE LOADING SCREEN - JUST ONE IMAGE (FIXED, NO ANIMATION)
   ============================================ */

#loader,
.loader {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: var(--app-vh) !important;
    min-height: var(--app-vh) !important;
    margin: 0 !important;
    padding: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    /* Futuristic dark blue gradient background */
    background: linear-gradient(135deg, #0a0e27 0%, #1a1f3a 50%, #0f1419 100%) !important;
    background-image: 
        radial-gradient(circle at 20% 50%, rgba(0, 212, 255, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(157, 78, 221, 0.15) 0%, transparent 50%) !important;
    z-index: 9999999 !important;
    overflow: hidden !important;
    opacity: 1 !important;
    visibility: visible !important;
    box-sizing: border-box !important;
}

.loader-image {
    max-width: 90% !important;
    max-height: 90% !important;
    width: auto !important;
    height: auto !important;
    object-fit: contain !important;
    object-position: center !important;
    display: block !important;
    margin: auto;
    object-position: center !important;
    display: block !important;
}

/* --- Top Bar Styles (Updated) - Futuristic Dark Theme --- */
.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
    flex-shrink: 0;
    padding: 12px 15px;
    background: linear-gradient(135deg, rgba(20, 30, 60, 0.95) 0%, rgba(30, 40, 70, 0.95) 100%);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 18px;
    border: 1px solid rgba(0, 212, 255, 0.3);
    box-shadow: 
        0 4px 20px rgba(0, 0, 0, 0.4),
        0 0 30px rgba(0, 212, 255, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}
.top-bar-item {
    display: flex;
    align-items: center;
    background: none;
    padding: 0;
    border-radius: 20px;
    border: none;
    font-size: 1rem;
    font-weight: 700;
    gap: 6px;
    min-width: unset;
    justify-content: center;
    box-shadow: none;
    color: var(--text-color);
    text-shadow: 0 0 10px rgba(0, 212, 255, 0.5);
}
.top-bar-icon {
    width: 28px;
    height: 28px;
    filter: drop-shadow(1px 1px 2px rgba(0, 0, 0, 0.2));
}
#coins-display { 
    flex-direction: row;
    background: linear-gradient(135deg, #ffd700 0%, #ffed4e 100%);
    padding: 8px 16px;
    border-radius: 25px;
    box-shadow: 
        0 4px 15px rgba(255, 215, 0, 0.6),
        0 0 20px rgba(255, 215, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
    border: 2px solid rgba(255, 215, 0, 0.8);
    font-size: 1.2rem;
    font-weight: 800;
    color: #1a1a1a;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    animation: goldGlow 3s ease-in-out infinite;
}
#coins-display #coins-value {
    font-size: 1.3rem;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}
#level-display {
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.3) 0%, rgba(0, 255, 255, 0.3) 100%);
    padding: 6px 15px;
    border-radius: 20px;
    box-shadow: 
        0 2px 10px rgba(0, 212, 255, 0.4),
        0 0 15px rgba(0, 212, 255, 0.2);
    border: 1px solid rgba(0, 212, 255, 0.5);
    color: var(--text-color);
    text-shadow: 0 0 10px rgba(0, 212, 255, 0.8);
}
#level-display .top-bar-icon { filter: drop-shadow(1px 1px 2px rgba(255, 255, 255, 0.5)); }

.xp-bar-container {
    flex-grow: 1;
    height: 20px;
    background-color: rgba(20, 30, 50, 0.8);
    border-radius: 10px;
    position: relative;
    border: 1px solid rgba(0, 212, 255, 0.3);
    box-shadow: 
        inset 0 2px 5px rgba(0, 0, 0, 0.3),
        0 0 10px rgba(0, 212, 255, 0.2);
    margin: 0 5px;
}
.xp-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #ff6b35 0%, #ff8c42 50%, #ffd700 100%);
    border-radius: 9px;
    transition: width 0.5s ease-in-out;
    box-shadow: 
        0 0 15px rgba(255, 107, 53, 0.6),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}
#xp-text {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.75rem;
    color: var(--text-color);
    font-weight: 700;
    text-shadow: 0 0 8px rgba(0, 212, 255, 0.8), 0 1px 2px rgba(0, 0, 0, 0.8);
    z-index: 2;
}

/* --- Panda Area Styles (Updated) - Futuristic Theme --- */
.panda-area {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;
    background: radial-gradient(circle at 50% 50%, rgba(0, 212, 255, 0.15) 0%, rgba(157, 78, 221, 0.1) 50%, transparent 80%);
    min-height: 220px;
    border-radius: 30px;
    margin: 10px 0;
    padding: 20px;
    /* Glowing circular frame effect */
    box-shadow: 
        0 0 40px rgba(0, 212, 255, 0.3),
        inset 0 0 60px rgba(0, 212, 255, 0.1);
    border: 2px solid rgba(0, 212, 255, 0.3);
}
#panda-name-display {
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 10px;
    text-shadow: 
        0 0 15px rgba(0, 212, 255, 0.8),
        0 0 30px rgba(0, 212, 255, 0.4),
        0 2px 4px rgba(0, 0, 0, 0.8);
    color: var(--text-color);
    letter-spacing: 1px;
}
#panda-image {
    width: 50vw;
    max-width: 220px;
    min-width: 150px;
    height: auto;
    filter: drop-shadow(0 0 20px rgba(0, 212, 255, 0.6)) drop-shadow(0 10px 30px rgba(0, 0, 0, 0.5));
    animation: breathing 5s ease-in-out infinite;
    transition: transform 0.1s ease;
    position: relative;
    z-index: 2;
}
#panda-wrapper:active #panda-image { 
    transform: scale(0.95); 
    animation-play-state: paused; 
}

/* Tap to earn styles */
#panda-wrapper {
    cursor: pointer;
    user-select: none;
    transition: transform 0.1s ease;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

#panda-wrapper:hover {
    transform: scale(1.02);
}

#panda-wrapper:active {
    transform: scale(0.98);
}

#panda-wrapper.tap-animation #panda-image {
    animation: pandaTap 0.2s ease-out;
}

#tap-hint {
    position: absolute;
    top: -35px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 215, 0, 0.95);
    color: #1B5E20;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
    animation: pulse 2s infinite;
    pointer-events: none;
    z-index: 10;
    border: 2px solid #FFA000;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    opacity: 0.9;
}

/* Daily taps display - HIDDEN */
#daily-taps-display {
    display: none !important;
}
@keyframes breathing {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-10px) scale(1.03); }
}
.hat {
    position: absolute; top: -20px; left: 50%; transform: translateX(-50%);
    width: 100px; height: auto; z-index: 3; pointer-events: none;
    filter: drop-shadow(0 5px 5px rgba(0,0,0,0.2));
}

.sleep-overlay { 
    position: absolute; 
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%; 
    background: linear-gradient(135deg, rgba(10, 14, 39, 0.9) 0%, rgba(26, 31, 58, 0.9) 100%);
    color: var(--neon-blue); 
    font-size: 2.5rem; 
    font-weight: bold; 
    display: flex; 
    justify-content: center; 
    align-items: center; 
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 10; 
    border-radius: 20px;
    text-shadow: 0 0 20px rgba(0, 212, 255, 0.8);
    border: 2px solid rgba(0, 212, 255, 0.3);
    box-shadow: 0 0 40px rgba(0, 212, 255, 0.3);
}
.floating-coin-text { 
    position: absolute; 
    font-size: 2rem; 
    font-weight: 800; 
    color: var(--gold-color); 
    text-shadow: 
        0 0 15px rgba(255, 215, 0, 0.8),
        0 2px 4px rgba(0, 0, 0, 0.8); 
    pointer-events: none; 
    animation: floatUpAndFade 1.5s ease-out forwards; 
    display: flex; 
    align-items: center; 
    gap: 5px; 
    z-index: 20;
    filter: drop-shadow(0 0 10px rgba(255, 215, 0, 0.6));
}
.floating-coin-text img { width: 30px; height: 30px; }
@keyframes floatUpAndFade { 0% { transform: translate(-50%, -50%); opacity: 1; } 100% { transform: translate(-50%, -140px); opacity: 0; } }

/* Hamster-like tap FX (ripple + particles) */
.tap-ripple {
    position: absolute;
    width: 14px;
    height: 14px;
    border-radius: 999px;
    pointer-events: none;
    transform: translate(-50%, -50%) scale(1);
    opacity: 0.9;
    background: rgba(245, 179, 1, 0.25);
    border: 1px solid rgba(245, 179, 1, 0.25);
    animation: tapRipple 450ms ease-out forwards;
    z-index: 30;
}

@keyframes tapRipple {
    to {
        opacity: 0;
        transform: translate(-50%, -50%) scale(18);
    }
}

.tap-particle {
    position: absolute;
    width: 7px;
    height: 7px;
    border-radius: 999px;
    pointer-events: none;
    transform: translate(-50%, -50%) translate(0, 0) scale(1);
    opacity: 1;
    background: rgba(245, 179, 1, 0.95);
    box-shadow: 0 0 10px rgba(245, 179, 1, 0.35);
    animation: tapParticle 620ms cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
    z-index: 31;
}

@keyframes tapParticle {
    to {
        opacity: 0;
        transform: translate(-50%, -50%) translate(var(--dx), var(--dy)) scale(0.6);
    }
}

/* Toast messages (used by window.showGameMessage) */
.game-message {
    position: fixed;
    left: 50%;
    bottom: 90px;
    transform: translateX(-50%);
    z-index: 10000;
    max-width: min(92vw, 520px);
    padding: 10px 14px;
    border-radius: 14px;
    font-weight: 800;
    font-size: 14px;
    line-height: 1.35;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 16px 34px rgba(0,0,0,0.16);
    border: 1px solid rgba(0,0,0,0.08);
    background: rgba(255,255,255,0.92);
    color: rgba(26,26,26,0.92);
    animation: toastIn 180ms ease-out;
}

.game-message--success { border-color: rgba(43, 122, 61, 0.22); }
.game-message--error { border-color: rgba(220, 38, 38, 0.25); }
.game-message--info { border-color: rgba(0, 0, 0, 0.10); }
.game-message--warning { border-color: rgba(245, 179, 1, 0.30); }

@keyframes toastIn {
    from { transform: translateX(-50%) translateY(8px); opacity: 0; }
    to { transform: translateX(-50%) translateY(0); opacity: 1; }
}

/* --- Status Bars (Updated) - Futuristic Theme --- */
.status-bars {
    width: 100%;
    margin-bottom: 20px;
    background: linear-gradient(135deg, rgba(20, 30, 60, 0.95) 0%, rgba(30, 40, 70, 0.95) 100%);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 20px;
    border: 1px solid rgba(0, 212, 255, 0.3);
    box-shadow: 
        0 8px 25px rgba(0, 0, 0, 0.4),
        0 0 30px rgba(0, 212, 255, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    padding: 15px;
    flex-shrink: 0;
    box-sizing: border-box;
}

.status-item {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
    gap: 10px;
}
.status-item:last-child {
    margin-bottom: 0;
}

.status-icon {
    font-size: 1.5rem;
    width: 30px;
    text-align: center;
    flex-shrink: 0;
}

.status-item label {
    min-width: 80px;
    text-align: left;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-color);
    white-space: nowrap;
    text-shadow: 0 0 8px rgba(0, 212, 255, 0.5);
}

.bar-container {
    flex-grow: 1;
    height: 28px;
    background-color: rgba(20, 30, 50, 0.9);
    border-radius: 14px;
    position: relative;
    overflow: hidden;
    box-shadow: 
        inset 0 2px 6px rgba(0, 0, 0, 0.4),
        0 0 10px rgba(0, 212, 255, 0.2);
    border: 1px solid rgba(0, 212, 255, 0.2);
}

.bar {
    height: 100%;
    border-radius: 13px;
    transition: width 0.5s cubic-bezier(0.25, 1, 0.5, 1);
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    box-shadow: 
        0 0 15px rgba(0, 212, 255, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.bar-percentage {
    color: white;
    font-size: 0.9rem;
    font-weight: bold;
    text-shadow: 
        0 0 10px rgba(0, 212, 255, 0.8),
        0 1px 3px rgba(0, 0, 0, 0.8);
    white-space: nowrap;
    opacity: 1;
    transition: opacity 0.3s ease;
    z-index: 2;
}
.bar.text-hidden .bar-percentage {
    opacity: 0;
}

#hunger-bar {
    background: var(--hunger-bar);
}
#happiness-bar {
    background: var(--happiness-bar);
}
#energy-bar {
    background: var(--energy-bar);
}


/* --- Nav Bar Styles (Floating) - Futuristic Theme --- */
.nav-bar {
    position: fixed;
    bottom: calc(15px + var(--app-safe-bottom));
    left: 50%;
    transform: translateX(-50%) translateZ(0);
    width: 95%;
    max-width: 460px;
    display: flex;
    justify-content: space-around;
    align-items: center;
    /* Dark futuristic background */
    background: linear-gradient(135deg, rgba(20, 30, 60, 0.98) 0%, rgba(30, 40, 70, 0.98) 100%);
    /* Fallback for iOS Safari backdrop-filter issues */
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border-radius: 25px;
    border: 1px solid rgba(0, 212, 255, 0.4);
    box-shadow: 
        0 4px 20px rgba(0, 0, 0, 0.5),
        0 0 40px rgba(0, 212, 255, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    height: 80px;
    min-height: 80px;
    max-height: 80px;
    z-index: 100;
    box-sizing: border-box;
    padding: 0 5px;
    /* Force GPU acceleration for better iOS rendering */
    -webkit-transform: translateX(-50%) translateZ(0);
    -webkit-perspective: 1000;
    -webkit-backface-visibility: hidden;
    will-change: transform;
    /* Prevent layout shifts */
    flex-shrink: 0;
    /* Ensure visibility on iOS */
    opacity: 1 !important;
    visibility: visible !important;
}

.nav-button {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    font-family: var(--font-family);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease, color 0.2s ease, filter 0.2s ease;
    flex: 1;
    flex-shrink: 1;
    min-width: 0;
    height: 100%;
    padding: 5px 0;
    gap: 4px;
    box-sizing: border-box;
    color: var(--neon-blue) !important;
    opacity: 1 !important;
    text-shadow: 0 0 8px rgba(0, 212, 255, 0.6);
    /* Force GPU acceleration for iOS */
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    /* Ensure consistent rendering */
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
    /* Ensure visibility on iOS */
    visibility: visible !important;
}

.nav-button .nav-icon {
    font-size: 2.2rem;
    line-height: 1;
    transition: color 0.2s ease, transform 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: inherit !important;
    opacity: 1 !important;
    /* Force visibility on iOS */
    visibility: visible !important;
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
}

.nav-button span {
    color: inherit !important;
    opacity: 1 !important;
    /* Force visibility on iOS */
    visibility: visible !important;
}

.nav-button .nav-icon svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
}

.nav-button:hover:not(:disabled) {
    transform: translateY(-2px);
    color: var(--neon-cyan) !important;
    text-shadow: 0 0 15px rgba(0, 255, 255, 0.8);
    filter: drop-shadow(0 0 8px rgba(0, 212, 255, 0.6));
}

.nav-button:active:not(:disabled) {
    transform: scale(0.92);
    filter: drop-shadow(0 0 12px rgba(0, 212, 255, 0.8));
}

.nav-button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.nav-button.active {
    color: var(--neon-cyan) !important;
    text-shadow: 0 0 15px rgba(0, 255, 255, 1);
}

.nav-button.active .nav-icon {
    color: var(--neon-cyan) !important;
    transform: translateY(-4px);
    filter: drop-shadow(0 0 12px rgba(0, 255, 255, 0.8));
}

.nav-button.active .nav-icon svg {
    fill: var(--primary-color);
}

/* Force hide menu buttons when disabled via data attribute or hidden attribute */
/* DISABLED FOR IOS FIX - Menu control causes invisibility on iOS */
/*
.nav-button[hidden],
.nav-button[data-menu-enabled="false"] {
    display: none !important;
    visibility: hidden !important;
    flex: 0 !important;
}
*/

/* Force show ALL menu buttons ALWAYS (iOS fix) */
.nav-button {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    flex: 1 !important;
}

/* Ensure the game container has padding at the bottom to prevent nav-bar from hiding content */
#game-container {
    padding-bottom: 105px;
}

/* --- Modal Styles --- */
.modal {
    position: fixed;
    z-index: 500;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(10, 14, 39, 0.85);
    display: flex;
    justify-content: center;
    align-items: flex-start;
    overflow-y: auto;
    padding: 5vh 0;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-sizing: border-box;
}
.modal:not(.hidden) {
    opacity: 1;
    visibility: visible;
}
.modal-content {
    background: linear-gradient(135deg, rgba(20, 30, 60, 0.98) 0%, rgba(30, 40, 70, 0.98) 100%);
    border: 2px solid rgba(0, 212, 255, 0.4);
    padding: 25px;
    border-radius: 20px;
    width: 90%;
    max-width: 500px;
    text-align: center;
    position: relative;
    box-shadow: 
        0 10px 40px rgba(0, 0, 0, 0.5),
        0 0 50px rgba(0, 212, 255, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    color: var(--text-color);
    box-sizing: border-box;
    margin-bottom: auto;
}
.modal-content h2 { 
    color: var(--neon-blue); 
    margin-top: 0; 
    margin-bottom: 20px; 
    text-shadow: 0 0 15px rgba(0, 212, 255, 0.8);
}
.close-button { 
    position: absolute; 
    top: 15px; 
    right: 20px; 
    font-size: 2rem; 
    font-weight: bold; 
    color: var(--neon-blue); 
    cursor: pointer; 
    transition: transform 0.2s ease, filter 0.2s ease;
    text-shadow: 0 0 10px rgba(0, 212, 255, 0.6);
}
.close-button:hover { 
    transform: scale(1.1); 
    color: var(--neon-cyan);
    text-shadow: 0 0 15px rgba(0, 255, 255, 0.8);
    filter: drop-shadow(0 0 8px rgba(0, 255, 255, 0.6));
}

/* Ensure modals opened from the back-office appear on top */
#create-ticket-modal, #view-user-ticket-modal, #invite-modal, #lottery-modal, #news-modal, #faq-modal {
    z-index: 501;
}

/* --- Animation for Feeding --- */
@keyframes feed-animation { 0% { transform: translate(-50%, 100%) scale(0.5); opacity: 1; bottom: 0; } 30% { opacity: 1; } 100% { transform: translate(-50%, -50%); opacity: 0; bottom: 50%; } }
.feeding-animation-icon { position: absolute; left: 50%; bottom: 75px; font-size: 2.5rem; z-index: 1001; animation: feed-animation 1s ease-in-out forwards; }
#panda-image.eating { animation: panda-eat-reaction 0.5s ease-in-out; }
@keyframes panda-eat-reaction { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.1); } }

/* --- Styles for Inventory & Shop --- */
.inventory-grid, .tab-content { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 15px; }
.shop-items-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 15px;
    padding: 10px;
}
.inventory-item, .shop-item { 
    background: linear-gradient(135deg, rgba(20, 30, 60, 0.95) 0%, rgba(30, 40, 70, 0.95) 100%);
    border: 1px solid rgba(0, 212, 255, 0.3);
    border-radius: 16px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    box-shadow: 
        0 4px 15px rgba(0, 0, 0, 0.4),
        0 0 20px rgba(0, 212, 255, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    color: var(--text-color);
}
.inventory-item-icon, .shop-item-icon { 
    font-size: 2.5rem; 
    margin-bottom: 8px; 
    height: 60px; 
    width: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-radius: 0.5rem;
}
.shop-item-icon img, .inventory-item-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 0.5rem;
}
.inventory-item-name, .shop-item-name { 
    font-weight: 700; 
    color: var(--text-color); 
    margin-bottom: 8px; 
    flex-grow: 1;
    text-shadow: 0 0 8px rgba(0, 212, 255, 0.5);
}
.inventory-item-details, .shop-item-details { 
    display: flex; 
    justify-content: space-around; 
    width: 100%; 
    font-size: 0.85rem; 
    color: var(--text-secondary-color); 
    margin-bottom: 10px; 
    font-weight: 600;
    text-shadow: 0 0 6px rgba(0, 212, 255, 0.4);
}
.inventory-item-quantity { font-size: 0.9rem; font-weight: 500; color: var(--text-secondary-color); margin-bottom: 10px; }
.use-button, .buy-button { width: 100%; border: none; padding: 8px; border-radius: 10px; font-family: var(--font-family); font-weight: 700; cursor: pointer; transition: background-color 0.2s ease; }
.use-button { 
    background: linear-gradient(135deg, #ff6b35 0%, #ff8c42 100%);
    color: white;
    border: 1px solid rgba(255, 107, 53, 0.5);
    box-shadow: 0 2px 10px rgba(255, 107, 53, 0.4);
    text-shadow: 0 0 8px rgba(255, 107, 53, 0.6);
}
.use-button:hover { 
    background: linear-gradient(135deg, #ff8c42 0%, #ffa55c 100%);
    box-shadow: 0 4px 15px rgba(255, 107, 53, 0.6);
    transform: translateY(-2px);
}
.buy-button { 
    background: linear-gradient(135deg, #00d4ff 0%, #0099cc 100%);
    color: white;
    border: 1px solid rgba(0, 212, 255, 0.5);
    box-shadow: 0 2px 10px rgba(0, 212, 255, 0.4);
    text-shadow: 0 0 8px rgba(0, 212, 255, 0.6);
}
.buy-button:hover { 
    background: linear-gradient(135deg, #00ffff 0%, #00d4ff 100%);
    box-shadow: 0 4px 15px rgba(0, 212, 255, 0.6);
    transform: translateY(-2px);
}
.shop-item-footer { width: 100%; margin-top: auto; }
.shop-item-price { 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    gap: 5px; 
    font-size: 1rem; 
    font-weight: 700; 
    color: var(--gold-color); 
    margin-bottom: 10px;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.6);
}
.shop-item-price img { width: 20px; height: 20px; }
.shop-tabs { display: flex; justify-content: center; gap: 10px; border-bottom: 1px solid #e0e0e0; margin-bottom: 20px; }
.tab-button { 
    padding: 10px 20px; 
    font-family: var(--font-family); 
    font-size: 1rem; 
    font-weight: 700; 
    border: none; 
    background: none; 
    cursor: pointer; 
    color: var(--text-secondary-color); 
    border-bottom: 3px solid transparent; 
    transition: color 0.2s ease, border-bottom-color 0.2s ease, text-shadow 0.2s ease; 
    position: relative;
}
.tab-button.active { 
    color: var(--neon-blue); 
    border-bottom-color: var(--neon-blue);
    text-shadow: 0 0 10px rgba(0, 212, 255, 0.8);
}
.tab-badge { 
    display: inline-block; 
    background: linear-gradient(135deg, #00d4ff 0%, #0099cc 100%); 
    color: white; 
    font-size: 0.75rem; 
    font-weight: 700; 
    padding: 2px 8px; 
    border-radius: 12px; 
    margin-left: 5px; 
    min-width: 20px; 
    text-align: center;
    box-shadow: 0 0 10px rgba(0, 212, 255, 0.5);
}
.tab-button.active .tab-badge { 
    background: linear-gradient(135deg, #00ffff 0%, #00d4ff 100%);
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.7);
}
.tab-content { display: none; }
.tab-content.active { display: grid; }

/* --- Purchase Confirmation Modal --- */
.purchase-item-icon { font-size: 3rem; margin: 15px 0; }
.modal-buttons { display: flex; justify-content: center; gap: 15px; margin-top: 20px; }
.modal-button { padding: 10px 20px; border-radius: 12px; border: none; font-family: var(--font-family); font-size: 1rem; font-weight: 700; cursor: pointer; transition: all 0.2s ease; }
.modal-button.confirm { 
    background: linear-gradient(135deg, #00d4ff 0%, #0099cc 100%);
    color: white;
    border: 1px solid rgba(0, 212, 255, 0.5);
    box-shadow: 0 4px 15px rgba(0, 212, 255, 0.4), 0 0 20px rgba(0, 212, 255, 0.2);
    text-shadow: 0 0 10px rgba(0, 212, 255, 0.8);
}
.modal-button.confirm:hover:not(:disabled) { 
    background: linear-gradient(135deg, #00ffff 0%, #00d4ff 100%);
    box-shadow: 0 6px 20px rgba(0, 255, 255, 0.6), 0 0 30px rgba(0, 255, 255, 0.3);
    transform: translateY(-2px);
}
.modal-button.cancel { 
    background: linear-gradient(135deg, rgba(100, 100, 120, 0.8) 0%, rgba(70, 70, 90, 0.8) 100%);
    color: #ffffff;
    border: 1px solid rgba(150, 150, 170, 0.5);
}
.modal-button.cancel:hover { 
    background: linear-gradient(135deg, rgba(120, 120, 140, 0.9) 0%, rgba(90, 90, 110, 0.9) 100%);
    transform: translateY(-2px);
}
.modal-button:disabled { opacity: 0.5; cursor: not-allowed; }
.error-message { color: #D32F2F; font-weight: bold; margin-top: 15px; }

/* --- INVOICE DISPLAY STYLES --- */
#invoice-display {
    max-width: 100%;
    margin: 0 auto;
}

.invoice-header {
    text-align: center;
    margin-bottom: 20px;
}

.invoice-header h3 {
    color: var(--primary-color-dark);
    margin: 0 0 5px 0;
    font-size: 1.4rem;
}

.invoice-header p {
    color: var(--text-secondary-color);
    margin: 0;
    font-size: 0.9rem;
}

.invoice-details {
    background-color: rgba(255, 255, 255, 0.9);
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 20px;
    border: 1px solid var(--border-color);
}

.invoice-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding: 8px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.invoice-row:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.invoice-row .label {
    font-weight: 600;
    color: var(--text-color);
    font-size: 0.95rem;
}

.invoice-row .value {
    font-weight: 500;
    color: var(--text-secondary-color);
    font-size: 0.95rem;
}

.invoice-row .value.status-pending {
    color: #FF9800;
}

.invoice-row .value.status-paid {
    color: #4CAF50;
}

.invoice-row .value.status-expired {
    color: #F44336;
}

.invoice-row .value.status-failed {
    color: #F44336;
}

/* Status Badge Styles for Admin Panel */
.status-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
    text-transform: uppercase;
}

.status-badge.status-pending_payment {
    background-color: #FFF3CD;
    color: #856404;
    border: 1px solid #FFEAA7;
}

.status-badge.status-completed {
    background-color: #D4EDDA;
    color: #155724;
    border: 1px solid #C3E6CB;
}

.status-badge.status-failed {
    background-color: #F8D7DA;
    color: #721C24;
    border: 1px solid #F5C6CB;
}

.status-badge.status-expired {
    background-color: #F8D7DA;
    color: #721C24;
    border: 1px solid #F5C6CB;
}

.status-badge.status-pending {
    background-color: #FFF3CD;
    color: #856404;
    border: 1px solid #FFEAA7;
}

.status-badge.status-active {
    background-color: #D4EDDA;
    color: #155724;
    border: 1px solid #C3E6CB;
}

.status-badge.status-insufficient_amount {
    background-color: #F8D7DA;
    color: #721C24;
    border: 1px solid #F5C6CB;
}

.payment-section {
    text-align: center;
    margin-bottom: 20px;
}

.payment-section h4 {
    color: var(--primary-color-dark);
    margin: 0 0 15px 0;
    font-size: 1.1rem;
}

.qr-code-container {
    display: inline-block;
    background-color: white;
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 15px;
    box-shadow: 0 2px 10px var(--shadow-color);
}

.wallet-address {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 15px;
}

.wallet-address input {
    flex: 1;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-family: var(--font-family);
    font-size: 0.85rem;
    background-color: rgba(255, 255, 255, 0.9);
    color: var(--text-color);
}

.wallet-address button {
    padding: 10px 15px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-family: var(--font-family);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.wallet-address button:hover {
    background-color: var(--primary-color-dark);
}

.invoice-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 15px;
}

.invoice-actions .modal-button {
    flex: 1;
    min-width: 120px;
    padding: 12px;
    font-size: 0.9rem;
}

/* --- TAPPY PANDA ANIMATIONS --- */
@keyframes floatUp {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateY(-100px) scale(1.5);
    }
}

@keyframes spin {
    0% { transform: rotateY(0deg); }
    100% { transform: rotateY(360deg); }
}

@keyframes float {
    0%, 100% { transform: translateY(0px) rotateY(0deg); }
    25% { transform: translateY(-10px) rotateY(90deg); }
    50% { transform: translateY(0px) rotateY(180deg); }
    75% { transform: translateY(-10px) rotateY(270deg); }
}

@keyframes collectCoin {
    0% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 1;
        transform: scale(1.5);
    }
    100% {
        opacity: 0;
        transform: scale(0.5) translateY(-50px);
    }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

@keyframes glow {
    0%, 100% { box-shadow: 0 0 10px rgba(255, 215, 0, 0.5); }
    50% { box-shadow: 0 0 30px rgba(255, 215, 0, 1); }
}

@keyframes bambooSway {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(1deg); }
    75% { transform: rotate(-1deg); }
}

@keyframes floatUpXP {
    0% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -150px) scale(1.2);
    }
}

@keyframes fadeInOut {
    0% {
        opacity: 0;
    }
    20% {
        opacity: 1;
    }
    80% {
        opacity: 1;
    }
    100% {
        opacity: 0;
    }
}

@keyframes scaleUpDown {
    0% {
        transform: scale(0.5);
        opacity: 0;
    }
    50% {
        transform: scale(1.2);
        opacity: 1;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* --- TAPPY PANDA MINIGAME STYLES - MODERN DESIGN --- */

/* Animations */
@keyframes floatUp {
    0% {
        opacity: 1;
        transform: translateY(0);
    }
    100% {
        opacity: 0;
        transform: translateY(-100px);
    }
}

@keyframes floatUpXP {
    0% {
        opacity: 1;
        transform: translate(-50%, 0);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -120px);
    }
}

@-webkit-keyframes spin {
    from { -webkit-transform: rotate(0deg); }
    to { -webkit-transform: rotate(360deg); }
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@-webkit-keyframes float {
    0%, 100% { -webkit-transform: translateY(0px) scale(1); }
    50% { -webkit-transform: translateY(-8px) scale(1.02); }
}

@keyframes float {
    0%, 100% { transform: translateY(0px) scale(1); }
    50% { transform: translateY(-8px) scale(1.02); }
}

@keyframes collectCoin {
    0% { transform: scale(1); opacity: 1; }
    100% { transform: scale(2) translateY(-50px); opacity: 0; }
}

@keyframes glow {
    0%, 100% { filter: drop-shadow(0 0 10px rgba(255, 215, 0, 0.8)); }
    50% { filter: drop-shadow(0 0 25px rgba(255, 215, 0, 1)); }
}

@-webkit-keyframes cloudMove {
    0% { -webkit-transform: translate3d(100vw, 0, 0); }
    100% { -webkit-transform: translate3d(-200px, 0, 0); }
}

@keyframes cloudMove {
    0% { transform: translate3d(100vw, 0, 0); }
    100% { transform: translate3d(-200px, 0, 0); }
}

@keyframes mountainParallax {
    from { transform: translateX(100vw); }
    to { transform: translateX(-500px); }
}

@keyframes pulse-glow {
    0%, 100% { 
        box-shadow: 0 0 20px rgba(255, 215, 0, 0.5), 
                    0 0 40px rgba(255, 215, 0, 0.3),
                    inset 0 0 20px rgba(255, 215, 0, 0.2);
    }
    50% { 
        box-shadow: 0 0 30px rgba(255, 215, 0, 0.8), 
                    0 0 60px rgba(255, 215, 0, 0.5),
                    inset 0 0 30px rgba(255, 215, 0, 0.3);
    }
}

/* Main Container with Beautiful Sky Background */
.minigame-container { 
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: var(--app-vh);
    min-height: var(--app-vh);
    background: linear-gradient(180deg, 
        #4A90E2 0%,      /* Deep sky blue */
        #87CEEB 30%,     /* Sky blue */
        #B4E5F9 60%,     /* Light blue */
        #FFE5B4 85%,     /* Peach (horizon) */
        #8FBC8F 100%     /* Sea green (ground) */
    );
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    z-index: 9999;
    overflow: hidden;
    position: relative;
}

/* Overlay Screens with Glassmorphism */
.minigame-overlay { 
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, 
        rgba(67, 160, 71, 0.92), 
        rgba(46, 125, 50, 0.95)
    );
    backdrop-filter: blur(15px) saturate(150%);
    -webkit-backdrop-filter: blur(15px) saturate(150%);
    color: white;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    z-index: 100;
    padding: 20px 15px;
    box-sizing: border-box;
    animation: fadeIn 0.4s ease-out;
    overflow-y: auto;
    overflow-x: hidden;
}

@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.minigame-overlay h2 { 
    font-size: 2.2rem;
    margin-bottom: 12px;
    margin-top: 5px;
    text-shadow: 
        3px 3px 8px rgba(0,0,0,0.6),
        0 0 30px rgba(255, 215, 0, 0.5),
        0 0 50px rgba(255, 215, 0, 0.3);
    color: #FFD700;
    font-weight: 900;
    letter-spacing: 1.5px;
    animation: pulse-text 2s ease-in-out infinite;
}

@keyframes pulse-text {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.minigame-overlay p { 
    font-size: 1rem;
    margin-bottom: 5px;
    line-height: 1.4;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
    font-weight: 500;
}

.minigame-overlay .modal-button {
    min-width: 170px;
    padding: 12px 25px;
    font-size: 1.1rem;
    margin: 6px;
    border-radius: 50px;
    font-weight: 700;
    letter-spacing: 1.2px;
    background: linear-gradient(135deg, #FFD700, #FFA500);
    border: 3px solid rgba(255, 255, 255, 0.4);
    box-shadow: 
        0 8px 25px rgba(0,0,0,0.3),
        inset 0 2px 5px rgba(255,255,255,0.3);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.minigame-overlay .modal-button::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        45deg,
        transparent,
        rgba(255, 255, 255, 0.3),
        transparent
    );
    transform: rotate(45deg);
    transition: all 0.5s;
}

.minigame-overlay .modal-button:hover::before {
    left: 100%;
}

.minigame-overlay .modal-button:hover {
    transform: translateY(-5px) scale(1.05);
    box-shadow: 
        0 12px 35px rgba(0,0,0,0.4),
        inset 0 2px 8px rgba(255,255,255,0.4),
        0 0 30px rgba(255, 215, 0, 0.6);
}

.minigame-overlay .modal-button.cancel {
    background: linear-gradient(135deg, #78909C, #546E7A);
}

/* Game Area with Dynamic Background */
#tappy-game-area { 
    flex-grow: 1;
    position: relative;
    overflow: hidden;
    background: linear-gradient(180deg, 
        #4A90E2 0%,
        #87CEEB 30%,
        #B4E5F9 60%,
        #FFE5B4 85%,
        #8FBC8F 100%
    );
    width: 100%;
    height: 100%;
}

/* Cloud layers - created via JavaScript */
.cloud-layer {
    position: absolute;
    left: 0;
    width: 100%;
    pointer-events: none;
    white-space: nowrap;
    z-index: 1;
}

/* Ground effect - created via JavaScript */
.ground-effect {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100px;
    background: linear-gradient(to bottom, 
        transparent 0%,
        rgba(76, 175, 80, 0.3) 30%,
        rgba(56, 142, 60, 0.5) 60%,
        rgba(46, 125, 50, 0.7) 100%
    );
    pointer-events: none;
    z-index: 2;
}

/* Modern Panda Design */
#tappy-panda { 
    position: absolute;
    width: 60px;
    height: 60px;
    background-image: url('../assets/images/panda-baby.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    left: 80px;
    z-index: 10;
    filter: drop-shadow(5px 5px 10px rgba(0,0,0,0.4));
    transition: filter 0.3s ease;
    will-change: transform;
}

#tappy-panda.invincible {
    filter: drop-shadow(0 0 25px rgba(255, 215, 0, 1)) brightness(1.3);
    animation: glow 0.5s ease-in-out infinite, float 3s ease-in-out infinite;
}

/* Beautiful 3D Bamboo Obstacles */
.obstacle { 
    position: absolute;
    z-index: 5;
}

.cactus-obstacle {
    /* All styles are now inline for maximum mobile compatibility */
    /* Pseudo-elements (::before, ::after) replaced with real DOM elements */
    overflow: visible;
}

/* Modern Score Display with Glassmorphism */
#tappy-score { 
    position: absolute;
    top: 30px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 4rem;
    font-weight: 900;
    color: #FFD700;
    text-shadow: 
        4px 4px 8px rgba(0,0,0,0.6),
        0 0 20px rgba(255,215,0,0.6),
        0 0 40px rgba(255,215,0,0.4);
    z-index: 50;
    background: rgba(0, 0, 0, 0.25);
    padding: 15px 35px;
    border-radius: 50px;
    border: 3px solid rgba(255, 215, 0, 0.6);
    backdrop-filter: blur(10px) saturate(150%);
    -webkit-backdrop-filter: blur(10px) saturate(150%);
    min-width: 120px;
    text-align: center;
    animation: pulse-glow 2s ease-in-out infinite;
    box-shadow: 
        0 8px 25px rgba(0,0,0,0.3),
        inset 0 2px 10px rgba(255,255,255,0.2);
}

/* Energy Cost Badge - Modern Style */
.minigame-overlay .energy-cost {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: linear-gradient(135deg, rgba(255,193,7,0.3), rgba(255,152,0,0.3));
    padding: 8px 18px;
    border-radius: 25px;
    border: 2px solid rgba(255, 193, 7, 0.8);
    font-size: 1.1rem;
    font-weight: 800;
    margin-bottom: 15px;
    backdrop-filter: blur(10px);
    box-shadow: 
        0 4px 15px rgba(255,193,7,0.4),
        inset 0 2px 5px rgba(255,255,255,0.3);
    text-shadow: 2px 2px 4px rgba(0,0,0,0.4);
}

/* Game Instructions - Modern Card Style */
.game-instruction {
    background: rgba(255, 255, 255, 0.15);
    padding: 12px 18px;
    border-radius: 15px;
    margin: 10px 0;
    border: 2px solid rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(10px);
    box-shadow: 
        0 8px 25px rgba(0,0,0,0.2),
        inset 0 2px 10px rgba(255,255,255,0.2);
    max-width: 95%;
}

.game-instruction p {
    margin: 4px 0;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.game-instruction p strong {
    font-size: 1.4rem;
    color: #FFD700;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.6);
}

/* Combo Display - Premium Style */
#combo-display {
    background: linear-gradient(135deg, rgba(255,107,107,0.9), rgba(255,87,87,0.95));
    padding: 15px 25px;
    border-radius: 20px;
    border: 3px solid rgba(255,255,255,0.5);
    backdrop-filter: blur(10px);
    box-shadow: 
        0 5px 20px rgba(255,107,107,0.6),
        inset 0 2px 10px rgba(255,255,255,0.3);
    animation: pulse-glow 1s ease-in-out infinite;
}

/* Ground Line Animation */
.ground-line {
    position: absolute;
    bottom: 80px;
    left: 0;
    width: 200%;
    height: 4px;
    background: repeating-linear-gradient(
        90deg,
        rgba(76, 175, 80, 0.6) 0px,
        rgba(76, 175, 80, 0.6) 20px,
        transparent 20px,
        transparent 40px
    );
    z-index: 3;
    -webkit-animation: moveGround 2s linear infinite;
    animation: moveGround 2s linear infinite;
    pointer-events: none;
}

@-webkit-keyframes moveGround {
    0% { -webkit-transform: translate3d(0, 0, 0); }
    100% { -webkit-transform: translate3d(-40px, 0, 0); }
}

@keyframes moveGround {
    0% { transform: translate3d(0, 0, 0); }
    100% { transform: translate3d(-40px, 0, 0); }
}

/* Responsive Design for Mobile */
@media (max-width: 768px) {
    .minigame-overlay h2 { 
        font-size: 1.8rem;
        margin-bottom: 10px;
    }
    
    .game-instruction {
        max-width: 95%;
        padding: 10px 15px;
    }
    
    .game-instruction p {
        font-size: 0.9rem;
        margin: 3px 0;
    }
    
    .minigame-overlay p {
        font-size: 0.9rem;
        margin-bottom: 4px;
    }
    
    #tappy-score {
        font-size: 2.5rem;
        padding: 8px 20px;
        top: 15px;
    }
    
    #combo-display {
        font-size: 1.3rem;
        right: 10px;
        top: 70px;
        padding: 8px 15px;
    }
    
    .minigame-overlay .modal-button {
        min-width: 150px;
        padding: 12px 25px;
        font-size: 1rem;
        margin: 5px;
    }
    
    .minigame-overlay .energy-cost {
        font-size: 1rem;
        padding: 6px 15px;
        margin-bottom: 10px;
    }
}

@media (max-height: 700px) {
    .minigame-overlay {
        padding: 15px 10px;
    }
    
    .minigame-overlay h2 { 
        font-size: 1.6rem;
        margin-bottom: 8px;
        margin-top: 0;
    }
    
    .game-instruction {
        padding: 8px 12px;
        margin: 8px 0;
    }
    
    .game-instruction p {
        font-size: 0.85rem;
        margin: 2px 0;
        line-height: 1.3;
    }
    
    .minigame-overlay p {
        font-size: 0.85rem;
        margin-bottom: 3px;
    }
    
    .minigame-overlay .modal-button {
        padding: 10px 20px;
        font-size: 0.95rem;
        margin: 5px;
        min-width: 140px;
    }
    
    .minigame-overlay .energy-cost {
        font-size: 0.95rem;
        padding: 6px 12px;
        margin-bottom: 8px;
    }
}

/* --- Platform-specific fixes --- */
/* iOS Safari specific fixes */
@supports (-webkit-touch-callout: none) {
    body {
        height: var(--app-vh);
        min-height: var(--app-vh);
    }
    
    #game-container {
        height: var(--app-vh);
        min-height: var(--app-vh);
    }
    
    .nav-bar {
        /* Ensure nav-bar stays at bottom on iOS */
        position: fixed;
        bottom: calc(15px + var(--app-safe-bottom));
        /* iOS safe glass: keep it translucent (avoid blur bugs) */
        background: rgba(10, 20, 35, 0.38) !important;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        border: 1px solid rgba(255, 255, 255, 0.16);
        box-shadow: 0 -2px 18px rgba(0, 0, 0, 0.28), 0 10px 28px rgba(0, 0, 0, 0.22);
        /* Force hardware acceleration */
        -webkit-transform: translate3d(-50%, 0, 0);
        transform: translate3d(-50%, 0, 0);
    }
    
    .nav-button {
        /* Force visibility on iOS */
        -webkit-transform: translate3d(0, 0, 0);
        transform: translate3d(0, 0, 0);
    }
}

/* Android specific fixes */
@supports not (-webkit-touch-callout: none) {
    body {
        height: var(--app-vh);
        min-height: var(--app-vh);
    }
    
    #game-container {
        height: var(--app-vh);
        min-height: var(--app-vh);
    }
}

/* Ensure consistent top-bar rendering */
.top-bar {
    /* Prevent layout shifts */
    flex-shrink: 0;
    min-height: 60px;
    /* Ensure consistent rendering across platforms */
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    will-change: contents;
}

/* Ensure panda area has consistent sizing */
.panda-area {
    /* Prevent layout shifts */
    flex-shrink: 0;
    /* Ensure consistent rendering */
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
}

/* Ensure status bars have consistent sizing */
.status-bars {
    /* Prevent layout shifts */
    flex-shrink: 0;
    /* Ensure consistent rendering */
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
}

/* --- Media Queries --- */
/* Extra small screens and short heights */
@media (max-height: 650px) {
    .panda-area { min-height: 180px; }
    #panda-image { max-width: 180px; }
    .status-bars { padding: 8px; margin-bottom: 8px; }
    .bar-container { height: 20px; }
    .nav-bar { height: 65px; }
    .nav-button .nav-icon { font-size: 1.6rem; }
    #game-container { padding-bottom: 75px; }
    
    /* Minigame overlay adjustments for very small screens */
    .minigame-overlay {
        padding: 10px 8px;
        justify-content: flex-start;
        padding-top: 20px;
    }
    
    .minigame-overlay h2 {
        font-size: 1.4rem;
        margin-bottom: 6px;
        margin-top: 0;
    }
    
    .game-instruction {
        padding: 6px 10px;
        margin: 6px 0;
    }
    
    .game-instruction p {
        font-size: 0.75rem;
        margin: 2px 0;
        line-height: 1.2;
    }
    
    .minigame-overlay p {
        font-size: 0.8rem;
        margin-bottom: 3px;
    }
    
    .minigame-overlay .modal-button {
        padding: 8px 16px;
        font-size: 0.9rem;
        margin: 4px;
        min-width: 130px;
    }
    
    .minigame-overlay .energy-cost {
        font-size: 0.85rem;
        padding: 5px 10px;
        margin-bottom: 6px;
        gap: 6px;
    }
}

/* Very short mobile screens */
@media (max-height: 600px) and (max-width: 768px) {
    .minigame-overlay {
        padding: 8px 5px;
        padding-top: 15px;
    }
    
    .minigame-overlay h2 {
        font-size: 1.3rem;
        margin-bottom: 5px;
    }
    
    .game-instruction {
        padding: 5px 8px;
        margin: 5px 0;
    }
    
    .game-instruction p {
        font-size: 0.7rem;
        margin: 1px 0;
    }
    
    .minigame-overlay .modal-button {
        padding: 7px 14px;
        font-size: 0.85rem;
        margin: 3px;
        min-width: 120px;
    }
    
    .minigame-overlay .energy-cost {
        font-size: 0.8rem;
        padding: 4px 8px;
    }
}

/* --- DEV RUNNER GAME STYLES --- */
#devrunner-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: var(--app-vh);
    min-height: var(--app-vh);
    background: linear-gradient(180deg, #1a1a2e 0%, #0f3460 50%, #16213e 100%);
    display: flex;
    flex-direction: column;
    z-index: 9999;
    overflow: hidden;
}

#devrunner-game-area {
    flex-grow: 1;
    position: relative;
    overflow: hidden;
    background: linear-gradient(180deg, #2a2a3e 0%, #1a1a2e 100%);
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
    min-height: var(--app-vh);
}

#devrunner-player {
    position: absolute !important;
    bottom: 20px !important;
    left: 160px !important;
    width: 50px !important;
    height: 50px !important;
    font-size: 3rem !important;
    z-index: 999 !important;
    transform: translateX(-50%) !important;
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.5)) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: left 0.2s ease-out !important;
    background: rgba(0, 255, 136, 0.8) !important;
    border: 3px solid #00ff88 !important;
    border-radius: 10px !important;
    visibility: visible !important;
    opacity: 1 !important;
}

#devrunner-score {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 3rem;
    font-weight: 900;
    color: #00ff88;
    text-shadow: 0 0 20px rgba(0, 255, 136, 0.8), 3px 3px 6px rgba(0,0,0,0.8);
    z-index: 50;
    background: rgba(0,0,0,0.3);
    padding: 10px 25px;
    border-radius: 30px;
    min-width: 80px;
    text-align: center;
}

.road-line {
    animation: none !important;
}

/* --- Broadcast Modal --- */
.broadcast-content-container {
    max-height: 60vh;
    overflow-y: auto;
    padding: 15px;
    text-align: center;
    line-height: 1.8;
    font-size: 1.1rem;
    white-space: pre-wrap;
}

/* --- FAQ Modal Styles --- */
.faq-content-container {
    max-height: 70vh;
    overflow-y: auto;
    text-align: left;
    padding: 5px;
}

.faq-item {
    margin-bottom: 10px;
    border-bottom: 1px solid #dcedc8;
    position: relative;
}

.faq-question {
    padding: 15px;
    font-weight: 700;
    cursor: pointer;
    position: relative;
    color: var(--primary-color-dark);
}

.faq-question::after {
    content: '▼';
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    transition: transform 0.3s ease;
    font-size: 0.8em;
}

.faq-item.active .faq-question::after {
    transform: translateY(-50%) rotate(180deg);
}

.faq-answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out, padding 0.3s ease-out;
    background-color: #ffffff;
    padding: 0 15px;
    line-height: 1.7;
    white-space: pre-wrap;
    word-wrap: break-word;
    box-sizing: border-box;
}

.faq-item.active .faq-answer {
    padding: 15px;
    transition: max-height 0.4s ease-in, padding 0.4s ease-in;
    -webkit-overflow-scrolling: touch;
    box-sizing: border-box;
}

/* Ensure Web3Modal appears above other modals */
#w3m-modal,
.web3modal,
.w3m-modal-overlay,
.w3m-modal-card,
.w3m-overlay {
  z-index: 99999 !important;
}


/* Loading Screen Animations */
@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-20px); }
}

/* Hybrid Referral Styles */
.hybrid-referral-section {
    margin: 20px 0;
    padding: 15px;
    background: #e8f4fd;
    border-radius: 10px;
    border: 2px solid #2196f3;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    width: 100%;
    box-sizing: border-box;
}

.search-container {
    position: relative;
    width: min(100%, 320px);
    margin: 0 auto 15px;
    box-sizing: border-box;
}

#pandaNameSearch {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid rgba(33, 150, 243, 0.45);
    border-radius: 18px;
    font-size: 15px;
    background: #ffffff;
    box-shadow: 0 8px 18px rgba(33, 150, 243, 0.12);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    box-sizing: border-box;
    display: block;
}

#pandaNameSearch:focus {
    border-color: #2196f3;
    box-shadow: 0 10px 24px rgba(33, 150, 243, 0.18);
    outline: none;
}

.hybrid-referral-section .panda-results-dropdown {
    left: 0;
    right: 0;
    width: 100%;
    max-width: 320px;
    margin: 0 auto;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.12);
}

.panda-results-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #ccc;
    border-top: none;
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
}

.panda-result-item {
    padding: 10px;
    cursor: pointer;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.panda-result-item:hover {
    background-color: #f5f5f5;
}

.panda-name {
    font-weight: bold;
    color: #333;
}

.referral-code {
    font-size: 0.9em;
    color: #666;
}

#generateButton {
    width: 100%;
    padding: 12px;
    background-color: #2196f3;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
}

#generateButton:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
}

.generated-link-container {
    margin-top: 15px;
    padding: 15px;
    background-color: #f0f8ff;
    border-radius: 4px;
    display: none;
}

.generated-link {
    display: block;
    word-break: break-all;
    margin: 10px 0;
    padding: 10px;
    background-color: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    color: #007bff;
    text-decoration: none;
}

.generated-link:hover {
    text-decoration: underline;
}

/* --- Invite Modal: Fix overflow of link input on mobile --- */
#invite-link-input {
    width: 100%;
    max-width: 100%;
    display: block;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-family: var(--font-family);
    font-size: 0.9rem;
    box-sizing: border-box;
    direction: ltr;           /* links should render left-to-right */
    overflow: hidden;         /* avoid horizontal scroll */
    text-overflow: ellipsis;  /* show ellipsis if too long */
}

