:root {
    --bg-dark: #0f1923;
    --bg-header: #1a2c42;
    --bg-card: #1e3a5a;
    /* Slightly lighter blue for cards */
    --accent-blue: #0d6efd;
    --accent-red: #d63384;
    /* Pinkish red */
    --accent-gold: #ffc107;
    --text-primary: #ffffff;
    --text-secondary: #a0aec0;
    --nav-height: 70px;
    --border-radius: 12px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    overflow-x: hidden;
    padding-bottom: var(--nav-height);
}

/* Header */
.header {
    background-color: var(--bg-header);
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    position: sticky;
    top: 0;
    z-index: 10005;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.header-left,
.header-right {
    display: flex;
    align-items: center;
    gap: 8px;
    /* Reduced gap for mobile */
}

.icon-btn,
.profile-btn {
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.2rem;
    cursor: pointer;
}

.logo {
    display: flex;
    align-items: center;
    padding-left: 5px;
}

.wallet-badge {
    background: rgba(255, 255, 255, 0.1);
    padding: 5px 10px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    white-space: nowrap;
}

.user-badge {
    max-width: 120px;
    overflow: hidden;
}

#user-display {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.wallet-badge i {
    color: var(--accent-blue);
    font-size: 0.9rem;
}

/* Tabs */
.top-tabs {
    display: flex;
    background-color: var(--bg-header);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.tab-btn {
    flex: 1;
    background: none;
    border: none;
    padding: 16px 0;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.9rem;
    position: relative;
    cursor: pointer;
    transition: color 0.3s;
}

.tab-btn.active {
    color: var(--text-primary);
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, var(--accent-blue), #00d4ff);
}

/* Hero Banner */
.hero-banner {
    margin: 16px;
    background: linear-gradient(135deg, #b91d73 0%, #4a0e33 100%);
    border-radius: 16px;
    padding: 20px;
    position: relative;
    overflow: hidden;
    height: 180px;
    display: flex;
    align-items: center;
    box-shadow: 0 8px 20px rgba(185, 29, 115, 0.3);
}

.banner-content {
    position: relative;
    z-index: 2;
    max-width: 65%;
}

.hero-img {
    position: absolute;
    right: -20px;
    bottom: -10px;
    height: 110%;
    z-index: 1;
    transform: rotate(-5deg);
    opacity: 0.9;
}

.promo-tag {
    background: rgba(255, 255, 255, 0.2);
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.hero-banner h2 {
    font-size: 1.4rem;
    line-height: 1.1;
    margin-bottom: 8px;
    text-transform: uppercase;
}

.hero-banner p {
    font-size: 0.75rem;
    opacity: 0.8;
    margin-bottom: 12px;
}

.cta-btn {
    background: linear-gradient(90deg, #ff9900, #ff5e00);
    border: none;
    color: white;
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Dashboard Widgets */
.dashboard-widgets {
    display: flex;
    gap: 12px;
    padding: 0 16px;
    margin-bottom: 24px;
}

.widget {
    background: #253b55;
    border-radius: 12px;
    padding: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.blue-widget {
    flex: 3;
    background: linear-gradient(145deg, #2a405c, #1a293c);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.heart-widget {
    flex: 1;
    justify-content: center;
    background: #253b55;
    cursor: pointer;
}

.heart-widget i {
    font-size: 1.2rem;
    color: #ff3b3b;
}

.blue-widget i {
    font-size: 1.5rem;
    color: #ffd700;
}

.widget-info {
    display: flex;
    flex-direction: column;
}

.widget-info .label {
    font-size: 0.7rem;
    color: var(--text-secondary);
    letter-spacing: 0.5px;
}

.widget-info .value {
    font-size: 1rem;
    font-weight: 700;
}

/* Section Header */
.section-header {
    padding: 0 16px 12px 16px;
}

.section-header h3 {
    font-size: 0.9rem;
    text-transform: uppercase;
    color: var(--text-secondary);
    font-weight: 700;
    letter-spacing: 0.5px;
    background: rgba(255, 255, 255, 0.1);
    display: inline-block;
    padding: 6px 12px;
    border-radius: 6px;
}

/* Games Grid */
.games-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    padding: 0 16px;
}

.game-card {
    background: transparent;
    border-radius: var(--border-radius);
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s;
}

.game-card:active {
    transform: scale(0.97);
}

.game-thumb {
    height: 100px;
    background-size: cover;
    background-position: center;
    border-radius: 12px;
    position: relative;
    overflow: hidden;
    margin-bottom: 8px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.game-thumb .overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s;
}

.game-card:hover .game-thumb .overlay {
    opacity: 1;
}

.play-btn {
    background: var(--accent-red);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    color: white;
    font-size: 1rem;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.game-info h4 {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 2px;
    color: #e2e8f0;
}

.game-info span {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* Bottom Nav */
.bottom-nav {
    position: fixed;
    bottom: 0;
    width: 100%;
    height: var(--nav-height);
    background: #152233;
    display: flex;
    justify-content: space-around;
    align-items: center;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    z-index: 900;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 0.7rem;
    gap: 4px;
    width: 20%;
}

.nav-item i {
    font-size: 1.2rem;
}

.nav-item.active {
    color: var(--accent-blue);
}

.center-fab {
    position: relative;
    top: -20px;
}

.fab-bg {
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 15px rgba(79, 172, 254, 0.5);
    border: 4px solid #152233;
}

.fab-bg i {
    font-size: 1.5rem;
    color: white;
}

/* Modal */
.game-modal {
    position: fixed;
    inset: 0;
    background: var(--bg-dark);
    z-index: 1000;
    display: none;
    flex-direction: column;
}

.game-modal.active {
    display: flex;
}

.modal-header {
    height: 50px;
    background: var(--bg-header);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.close-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 0.9rem;
    cursor: pointer;
}

.modal-body {
    flex: 1;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Game Frame Generic */
iframe.game-frame {
    width: 100%;
    height: 100%;
    border: none;
}

/* Bonus Page/Modal */
/* Premium Bonus Overlay */
.bonus-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.95);
    z-index: 2000;
    display: none;
    flex-direction: column;
    overflow-y: auto;
    backdrop-filter: blur(15px);
    animation: fadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.bonus-overlay.active {
    display: flex;
}

.bonus-header {
    padding: 30px 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    background: transparent;
    position: sticky;
    top: 0;
    z-index: 10;
    /* Removed box-shadow for cleaner look */
}

.bonus-header h2 {
    font-size: 2.2rem;
    font-weight: 900;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 3px;
    background: linear-gradient(to bottom, #fff, #94a3b8);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 0 15px rgba(255, 255, 255, 0.3));
    position: relative;
    padding-bottom: 10px;
    margin-top: 60px;
    /* Increased space for close button */
}

/* Neon underline */
.bonus-header h2::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 4px;
    background: #3b82f6;
    border-radius: 2px;
    box-shadow: 0 0 15px #3b82f6;
}

.bonus-content {
    padding: 20px;
    padding-bottom: 120px;
}

.bonus-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 15px;
    margin-top: 20px;
}

/* Premium Card */
.bonus-card {
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 20px;
    padding: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    position: relative;
    overflow: hidden;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.4);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(10px);
}

.bonus-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 50px rgba(59, 130, 246, 0.2);
    border-color: rgba(59, 130, 246, 0.3);
}

.bonus-card::after {
    /* Shine effect */
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 50%;
    height: 100%;
    background: linear-gradient(to right, transparent, rgba(255, 255, 255, 0.1), transparent);
    transform: skewX(-25deg);
    transition: 0.5s;
    pointer-events: none;
}

.bonus-card:hover::after {
    left: 150%;
    transition: 0.7s;
}

.bonus-card:active {
    transform: scale(0.98);
}

.bonus-thumb {
    width: 100%;
    height: auto;
    object-fit: cover;
    margin: 0;
    border-radius: 0;
    display: block;
    aspect-ratio: 16/9;
    /* Maintain a nice ratio */
}

.bonus-info {
    padding: 15px;
    width: 100%;
}

.bonus-card i {
    font-size: 2.5rem;
    margin: 0;
    color: var(--accent-gold);
    filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.2));
}

.bonus-card h3 {
    font-size: 1rem;
    color: #fff;
    margin-bottom: 5px;
}

.bonus-card p {
    font-size: 0.75rem;
    color: var(--text-secondary);
    line-height: 1.4;
    margin-bottom: 15px;
}

/* Specific Bonus Colors */
.bonus-1 i {
    color: #f59e0b;
}

.bonus-2 i {
    color: #8b5cf6;
}

.bonus-3 i {
    color: #ec4899;
}

.bonus-4 i {
    color: #3b82f6;
}

.bonus-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #fff;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    width: 100%;
    transition: background 0.3s;
    cursor: pointer;
}

/* Bonus Detail Modal */
.bonus-detail-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    /* Darker backdrop */
    backdrop-filter: blur(5px);
    z-index: 3000;
    /* Higher than bonus-overlay */
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.2s ease-out;
}

.bonus-detail-overlay.active {
    display: flex;
}

.bonus-detail-card {
    background: #1a2c42;
    border: 2px solid var(--accent-gold);
    border-radius: 20px;
    width: 100%;
    max-width: 400px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 0 50px rgba(255, 215, 0, 0.15);
}

.detail-img-wrapper {
    width: 100%;
    height: 200px;
    overflow: hidden;
    position: relative;
}

.detail-img-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.detail-content {
    padding: 24px;
    text-align: center;
}

.detail-content h2 {
    font-size: 1.5rem;
    color: #fff;
    margin-bottom: 16px;
    font-weight: 700;
}

.detail-content p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.6;
    margin-bottom: 24px;
    text-align: left;
}

.detail-close-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(0, 0, 0, 0.5);
    border: none;
    color: #fff;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.detail-action-btn {
    background: linear-gradient(90deg, #ffd700, #ffecb3);
    color: #000;
    border: none;
    padding: 14px;
    width: 100%;
    border-radius: 12px;
    font-weight: 800;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 10px;
}

.detail-info-btn {
    background: transparent;
    color: var(--accent-blue);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 10px;
    width: 100%;
    transition: 0.3s;
}

.detail-info-btn:hover {
    background: rgba(13, 110, 253, 0.1);
    border-color: var(--accent-blue);
}


.bonus-card:hover .bonus-btn {
    background: var(--accent-blue);
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Snow Effect */
.snowflake {
    position: fixed;
    top: -10px;
    color: #fff;
    font-size: 1em;
    font-family: Arial, sans-serif;
    text-shadow: 0 0 5px #000;
    user-select: none;
    z-index: 9999;
    pointer-events: none;
    animation-name: fall;
    animation-timing-function: linear;
    animation-iteration-count: infinite;
}

@keyframes fall {
    0% {
        transform: translateY(0);
    }

    100% {
        transform: translateY(110vh);
    }
}

/* Lives Badge Styles */
.lives-badge {
    border-color: rgba(239, 68, 68, 0.5);
    background: rgba(239, 68, 68, 0.1);
    gap: 8px;
}

.add-lives-btn {
    background: #ef4444;
    color: white;
    border: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    font-weight: bold;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 5px;
    box-shadow: 0 2px 5px rgba(239, 68, 68, 0.4);
    transition: transform 0.2s;
}

.add-lives-btn:active {
    transform: scale(0.9);
}

@keyframes heartbeat {
    0% {
        transform: scale(1);
    }

    15% {
        transform: scale(1.3);
    }

    30% {
        transform: scale(1);
    }

    45% {
        transform: scale(1.15);
    }

    60% {
        transform: scale(1);
    }
}

/* Profile Modal */
.profile-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(10px);
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.3s ease-out;
}

.profile-overlay.active {
    display: flex;
}

.profile-card {
    background: linear-gradient(145deg, #1A1F2C, #131620);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 20px;
    width: 100%;
    max-width: 400px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.5);
    padding-bottom: 20px;
}

.profile-close-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #fff;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 10;
}

.profile-header-section {
    padding: 30px 20px 20px;
    text-align: center;
    background: linear-gradient(180deg, rgba(59, 130, 246, 0.1), transparent);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.profile-photo-lg {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    border: 3px solid var(--accent-blue);
    margin: 0 auto 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: var(--accent-blue);
    overflow: hidden;
}

.profile-header-section h3 {
    margin: 0 0 5px;
    font-size: 1.2rem;
    color: #fff;
}

.join-date {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.profile-stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    padding: 20px;
}

.stat-box {
    background: rgba(255, 255, 255, 0.03);
    padding: 15px;
    border-radius: 12px;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.stat-box i {
    color: var(--accent-gold);
    font-size: 1.2rem;
    margin-bottom: 5px;
    display: block;
}

.stat-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 800;
    color: #fff;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.profile-section {
    padding: 0 20px;
    margin-bottom: 20px;
}

.profile-section h4 {
    color: var(--text-primary);
    font-size: 0.9rem;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    opacity: 0.8;
}

.history-list,
.rewards-list {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    overflow: hidden;
}

.history-item {
    padding: 12px 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.history-item:last-child {
    border-bottom: none;
}

.history-info {
    display: flex;
    flex-direction: column;
}

.game-name {
    font-size: 0.9rem;
    color: #fff;
    font-weight: 500;
}

.game-date {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.history-score {
    color: var(--accent-gold);
    font-weight: bold;
}

.empty-msg {
    padding: 20px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.85rem;
}