/* Header */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-sm) 10px;
    /* Reduced specific padding */
    background-color: rgba(12, 12, 12, 0.95);
    /* More opaque */
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    position: fixed;
    /* FIXED not sticky */
    top: 0;
    left: 0;
    width: 100%;
    z-index: 100;
    border-bottom: 1px solid rgba(255, 193, 7, 0.2);
    height: 70px;
    /* Explicit height */
}

.logo-area {
    display: flex;
    align-items: center;
}

.logo-img {
    height: 50px;
    width: auto;
    filter: drop-shadow(0 0 8px rgba(255, 193, 7, 0.3));
}

.user-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: var(--spacing-sm);
    min-width: 100px;
    /* Reserve space to prevent layout shift */
    justify-content: flex-end;
    /* Keep align right */
}

/* Unified Auth Morphing Pill */
.auth-morph-pill {
    position: relative;
    height: 40px;
    min-width: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 20px;
    cursor: default;
    background: rgba(255, 193, 7, 0.05);
    border: 1px solid rgba(255, 193, 7, 0.2);
    overflow: hidden;
}

/* State: Login Button */
.auth-morph-pill.state-login {
    background: var(--color-primary);
    padding: 0 16px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    box-shadow: var(--shadow-neon);
    border: none;
}

.auth-morph-pill.state-login:active {
    transform: scale(0.95);
}

/* State: Skeleton (Loading Balance Card) */
.auth-morph-pill.state-skeleton {
    width: 120px;
    background: rgba(255, 255, 255, 0.05);
    pointer-events: none;
}

.auth-morph-pill.state-skeleton::after,
.auth-morph-pill.state-loading::after {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 193, 7, 0.3), transparent);
    animation: shimmer 1.5s infinite;
}

/* State: Balance Pill */
.auth-morph-pill.state-balance {
    background: var(--gold-gradient);
    padding: 0 14px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
}

/* State: Loading/Transition (Shrink to Shimmer Pill) */
.auth-morph-pill.state-loading {
    width: 110px;
    border-radius: 20px;
    background: rgba(255, 193, 7, 0.05);
    border: 1px solid rgba(255, 193, 7, 0.2);
}

.auth-morph-pill .pill-content {
    display: none;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.state-login .content-login,
.state-skeleton .content-loading,
.state-loading .content-loading,
.state-balance .content-balance {
    display: flex;
}

.auth-morph-pill .content-login span {
    color: #000;
    font-weight: 800;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.auth-morph-pill .content-balance .currency {
    font-size: 0.75rem;
    font-weight: 800;
    color: #3e2723 !important;
    opacity: 0.8;
}

.auth-morph-pill .content-balance .amount {
    font-size: 1rem;
    font-weight: 800;
    color: #3e2723 !important;
}

@keyframes shimmer {
    100% {
        left: 100%;
    }
}

@keyframes popIn {
    from {
        transform: scale(0.95);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes header-spin {
    to {
        transform: rotate(360deg);
    }
}

.header-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 193, 7, 0.1);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: header-spin 0.8s linear infinite;
}

.balance-badge-header .currency {
    font-size: 0.75rem;
    font-weight: 800;
    color: #3e2723;
    opacity: 0.8;
}

.balance-badge-header .amount {
    font-size: 1rem;
    font-weight: 800;
    color: #3e2723;
}

/* Main Content */
.app-main {
    padding: var(--spacing-md);
    max-width: 600px;
    margin: 0 auto;
    padding-bottom: 100px;
    padding-top: 85px;
    /* Compensate for fixed header */
}

/* Utility Classes */
.hidden {
    display: none !important;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    font-family: var(--font-main);
    line-height: 1.6;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    /* Prevent horizontal overflow */
    min-height: 100vh;
}

/* Sections */
.section-title {
    font-size: 0.85rem;
    margin-bottom: var(--spacing-md);
    color: var(--text-gold);
    text-transform: uppercase;
    font-weight: 800;
    letter-spacing: 2px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-title::before {
    content: '';
    width: 3px;
    height: 14px;
    background: var(--color-primary);
    border-radius: 2px;
}

/* Hero Section Premium */
.hero-container-premium {
    padding: 2.5px;
    background: var(--gold-gradient);
    border-radius: var(--radius-lg);
    margin-bottom: var(--spacing-xl);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
}

.hero-banner {
    background: linear-gradient(135deg, rgba(255, 193, 7, 0.05) 0%, rgba(255, 152, 0, 0.02) 100%);
    border: 2.5px solid rgba(255, 193, 7, 0.8);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6), 0 0 10px rgba(184, 134, 11, 0.3);
    border-radius: 16px;
    padding: 24px;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.hero-banner::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 193, 7, 0.5), transparent);
}

.jackpot-info .label {
    font-size: 0.8rem;
    color: #5D4037;
    margin-bottom: var(--spacing-xs);
    letter-spacing: 2px;
    font-weight: 700;
    text-transform: uppercase;
    opacity: 1;
}

.jackpot-info .amount {
    font-size: 2.2rem;
    font-weight: 900;
    color: #5D4037;
    text-shadow: 0 0 15px rgba(93, 64, 55, 0.3);
    font-family: 'Outfit', sans-serif;
}

/* Animal Grid */
.animal-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--spacing-md);
    padding: 0;
    /* Ensuring no side padding */
}

@media (min-width: 480px) {
    .animal-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Bottom Navigation - Floating Pill */
/* Hide sticky elements when keyboard is open on mobile - DISABLED per user request */
/*
.keyboard-open .bottom-nav,
.keyboard-open .app-footer {
    display: none !important;
}
*/

.bottom-nav {
    position: fixed;
    bottom: 24px;
    bottom: max(24px, env(safe-area-inset-bottom));
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 400px;
    background-color: rgba(20, 20, 20, 0.95);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    display: flex !important;
    /* Force visibility */
    justify-content: space-around;
    padding: 8px;
    border: 1px solid rgba(255, 193, 7, 0.2);
    border-radius: 40px;
    z-index: 9999 !important;
    /* Above all content and modals */
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.8), 0 0 15px rgba(184, 134, 11, 0.1);
}

.bottom-nav .nav-item {
    background: transparent;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    color: #888;
    padding: 8px 12px;
    transition: all 0.3s ease;
    border-radius: 30px;
    border: none;
}

.bottom-nav .nav-item .icon {
    font-size: 1.4rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.bottom-nav .nav-item .nav-label {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.bottom-nav .nav-item.active {
    color: var(--color-primary);
    background: rgba(255, 193, 7, 0.1);
    text-shadow: 0 0 10px rgba(255, 193, 7, 0.3);
}

.bottom-nav .nav-item.active .icon {
    transform: translateY(-2px);
}

/* Footer */
.app-footer {
    text-align: center;
    padding: var(--spacing-xl) var(--spacing-md);
    padding-bottom: 90px;
    color: var(--text-muted);
    font-size: 0.8rem;
    border-top: 1px solid var(--border-color);
    margin-top: var(--spacing-xl);
}

/* Game View Specifics */
.game-view-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    padding: 10px 0;
}

.game-view-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-gold);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn-back-icon {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 193, 7, 0.2);
    color: var(--color-primary);
    width: 44px;
    height: 44px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-back-icon:hover {
    background: var(--gold-gradient);
    color: #000;
    transform: translateX(-4px);
    box-shadow: 0 0 15px rgba(255, 193, 7, 0.3);
}

.btn-back-icon svg {
    filter: drop-shadow(0 0 5px rgba(255, 193, 7, 0.3));
}

/* Global Loader */
.app-loader {
    position: fixed;
    top: 70px;
    /* Below Header */
    left: 0;
    width: 100%;
    height: calc(100vh - 70px);
    background: rgba(12, 12, 12, 0.95);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 90;
}

.loader-content {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.spinner-gold {
    position: relative;
    width: 60px;
    height: 60px;
    border: 6px solid rgba(255, 193, 7, 0.1);
    border-top: 6px solid var(--color-primary);
    border-radius: 50%;
    animation: gold-spin 1s cubic-bezier(0.4, 0, 0.2, 1) infinite;
    filter: drop-shadow(0 0 10px rgba(255, 193, 7, 0.4));
}

.spinner-gold::after {
    content: "";
    position: absolute;
    top: -6px;
    left: -6px;
    right: -6px;
    bottom: -6px;
    border: 6px solid transparent;
    border-top: 6px solid #fff;
    border-radius: 50%;
    opacity: 0.2;
    filter: blur(2px);
}

@keyframes gold-spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.loader-content p {
    color: var(--text-gold);
    font-weight: 800;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 4px;
    margin-top: 20px;
    text-shadow: 0 0 10px rgba(255, 193, 7, 0.3);
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: var(--spacing-md);
    margin-top: var(--spacing-sm);
}

.footer-link {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.2s;
}

.footer-link:hover {
    color: var(--color-primary);
}

.admin-only-link {
    opacity: 0.1;
    cursor: default;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
}