:root {
    /* Color Palette */
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --secondary: #ec4899;
    --accent: #8b5cf6;

    /* Backgrounds */
    --bg-dark: #0f172a;
    --bg-card: rgba(30, 41, 59, 0.8);
    --bg-glass: rgba(15, 23, 42, 0.7);

    /* Text */
    --text-main: #f8fafc;
    --text-muted: #94a3b8;

    /* Game Colors */
    --game-red: #ef4444;
    --game-green: #22c55e;
    --game-violet: #a855f7;
    --game-gold: #fbbf24;

    /* Gradients */
    --gradient-primary: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
    --gradient-gold: linear-gradient(135deg, #fbbf24 0%, #d97706 100%);
    --gradient-success: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg-dark);
    background-image:
        radial-gradient(circle at 10% 20%, rgba(99, 102, 241, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 90% 80%, rgba(236, 72, 153, 0.15) 0%, transparent 50%);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
}

html {
    overflow-x: hidden;
}

/* Glassmorphism */
.glass-panel {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

/* Banner Carousel */
.banner-container {
    width: 100%;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.3);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    aspect-ratio: 16/9;
    min-height: 160px;
    max-height: 400px;
    position: relative;
}

@media (min-width: 768px) {
    .banner-container {
        aspect-ratio: 16/5;
        /* Widescreen for desktop */
        max-height: 350px;
    }
}

.banner-track {
    display: flex;
    height: 100%;
    transition: transform 0.5s ease-in-out;
    width: 100%;
}

.banner-item {
    flex: 0 0 100%;
    /* Force each item to take full width */
    width: 100%;
    min-width: 100%;
    height: 100%;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.banner-item img {
    width: 100%;
    height: 100%;
    object-fit: fill;
    object-position: center;
    border-radius: 0;
    display: block;
}

/* Header */
header {
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-glass);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo {
    font-size: 1.8rem;
    font-weight: 800;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav-links {
    display: flex;
    gap: 20px;
    align-items: center;
}

.nav-links a {
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.3s;
    font-weight: 500;
}

.nav-links a:hover {
    color: var(--primary);
}

/* Hero Section */
.hero-section {
    text-align: center;
    padding: 60px 20px;
}

.hero-section h1 {
    font-size: 3rem;
    margin-bottom: 15px;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.2;
}

.hero-section p {
    color: var(--text-muted);
    font-size: 1.2rem;
}

.balance-display {
    background: rgba(0, 0, 0, 0.4);
    padding: 8px 16px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    white-space: nowrap;
    /* Prevent breaking on small screens */
}

.balance-amount {
    font-weight: 700;
    color: var(--game-green);
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 0.9rem;
}

.btn-primary {
    background: var(--gradient-primary);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.4);
}

.btn-success {
    background: var(--gradient-success);
    color: white;
}

.btn-danger {
    background: var(--game-red);
    color: white;
}

/* Game Grid */
.game-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    padding: 30px 20px;
    max-width: 1200px;
    margin: 0 auto;
}

.game-card {
    height: 220px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
}

.game-card:hover {
    transform: translateY(-8px);
    border-color: var(--primary);
}

.game-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transition: left 0.5s;
}

.game-card:hover::before {
    left: 100%;
}

.game-icon {
    font-size: 3.5rem;
    margin-bottom: 15px;
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-muted);
    font-weight: 500;
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: var(--text-main);
    font-size: 1rem;
    transition: border-color 0.3s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
}

/* Timer */
.timer {
    font-size: 2.5rem;
    font-weight: 800;
    text-align: center;
    color: var(--secondary);
    text-shadow: 0 0 20px rgba(236, 72, 153, 0.5);
}

/* Game Buttons */
.btn-game {
    flex: 1;
    padding: 20px;
    border: none;
    border-radius: 12px;
    font-weight: bold;
    color: white;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
}

.btn-game:hover {
    transform: scale(1.05);
    filter: brightness(1.2);
}

.btn-game:active {
    transform: scale(0.95);
}

.btn-green {
    background: var(--game-green);
    box-shadow: 0 4px 15px rgba(34, 197, 94, 0.4);
}

.btn-violet {
    background: var(--game-violet);
    box-shadow: 0 4px 15px rgba(168, 85, 247, 0.4);
}

.btn-red {
    background: var(--game-red);
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.4);
}

/* Number Grid */
.number-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
    margin: 20px 0;
}

.number-btn {
    aspect-ratio: 1;
    background: var(--bg-card);
    border: 2px solid rgba(255, 255, 255, 0.1);
    color: white;
    border-radius: 12px;
    font-weight: bold;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.3s;
}

.number-btn:hover {
    background: var(--primary);
    border-color: var(--primary);
    transform: scale(1.1);
}

.number-btn.selected {
    background: var(--primary);
    border-color: var(--primary);
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.6);
}

/* Spin Wheel */
.wheel-container {
    position: relative;
    width: 300px;
    height: 300px;
    margin: 30px auto;
}

.wheel {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 5px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 0 40px rgba(99, 102, 241, 0.4);
    transition: transform 4s cubic-bezier(0.17, 0.67, 0.12, 0.99);
    background: conic-gradient(#ef4444 0deg 36deg,
            #22c55e 36deg 72deg,
            #3b82f6 72deg 108deg,
            #fbbf24 108deg 144deg,
            #a855f7 144deg 180deg,
            #ef4444 180deg 216deg,
            #22c55e 216deg 252deg,
            #3b82f6 252deg 288deg,
            #fbbf24 288deg 324deg,
            #a855f7 324deg 360deg);
    display: flex;
    align-items: center;
    justify-content: center;
}

@keyframes spin-infinite {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.wheel.spinning {
    animation: spin-infinite 2s linear infinite;
}

.wheel-pointer {
    position: absolute;
    top: -15px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 20px solid transparent;
    border-right: 20px solid transparent;
    border-top: 40px solid var(--secondary);
    z-index: 10;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.5));
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

th,
td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

th {
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.85rem;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    max-width: 500px;
    width: 90%;
    padding: 30px;
    position: relative;
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
}

@media (max-width: 768px) {
    .game-grid {
        grid-template-columns: 1fr;
    }

    /* Use aspect ratio for banner on mobile too, respecting min/max heights */
    /* .banner-container rule removed as it was empty */

    .logo {
        font-size: 1.3rem;
    }

    .nav-links {
        gap: 15px;
    }

    /* Hide nav text on tablets and mobile to prevent overflow */
    .nav-links a span {
        display: none;
    }

    /* Hide redundant top nav links on mobile since we have bottom nav */
    .nav-links a[href*="profile"],
    .nav-links a[href*="withdraw"],
    .nav-links a[href*="logout"],
    .nav-links a[href*="login"],
    .nav-links a[href*="register"] {
        display: none !important;
    }

    /* Style the Deposit link on mobile to look like a button */
    .nav-links a[href*="deposit"] {
        background: var(--game-green);
        color: white !important;
        padding: 5px 12px;
        border-radius: 20px;
        font-size: 0.8rem;
        display: flex !important;
        align-items: center;
        gap: 5px;
        box-shadow: 0 4px 10px rgba(34, 197, 94, 0.4);
    }

    .nav-links a[href*="deposit"] span {
        display: inline !important;
        /* Force text show for deposit */
    }

    .balance-display {
        padding: 5px 10px;
        font-size: 0.9rem;
    }

    /* Hero adjustments */
    .hero-section h1 {
        font-size: 2rem !important;
    }

    .hero-section p {
        font-size: 1rem !important;
    }

    /* Bottom Navigation Styles */
    .bottom-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        background: rgba(15, 23, 42, 0.95);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        border-top: 1px solid rgba(255, 255, 255, 0.1);
        padding: 10px 0;
        z-index: 1000;
        justify-content: space-around;
        align-items: center;
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
    }

    .bottom-nav-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        color: var(--text-muted);
        text-decoration: none;
        font-size: 0.75rem;
        gap: 4px;
        transition: all 0.3s;
        flex: 1;
    }

    .bottom-nav-item i {
        font-size: 1.2rem;
        margin-bottom: 2px;
    }

    .bottom-nav-item.active {
        color: var(--game-green);
    }

    .bottom-nav-item.active i {
        color: var(--game-green);
        transform: translateY(-2px);
    }

    .bottom-nav-middle {
        background: var(--game-green);
        width: 50px;
        height: 50px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        margin-top: -25px;
        box-shadow: 0 4px 10px rgba(34, 197, 94, 0.4);
        border: 4px solid var(--bg-dark);
    }

    .bottom-nav-middle i {
        color: white;
        font-size: 1.5rem;
        margin: 0;
    }

    body {
        padding-bottom: 80px;
        /* Space for bottom nav */
    }
}

@media (min-width: 769px) {
    .bottom-nav {
        display: none;
    }
}

@media (max-width: 480px) {
    .nav-links {
        gap: 10px;
    }

    /* If nav links don't have icons, we might need smaller text or wrapping */
    .nav-links a {
        font-size: 0.8rem;
    }
}

/* Utility Classes */
.text-center {
    text-align: center;
}

.text-muted {
    color: var(--text-muted);
}

.mt-20 {
    margin-top: 20px;
}

.mb-20 {
    margin-bottom: 20px;
}

.p-20 {
    padding: 20px;
}

/* Mobile App UI Enhancements */

/* New Header Layout */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background: var(--bg-dark);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.app-logo {
    font-size: 1.5rem;
    color: var(--game-green);
    font-weight: 800;
}

.header-balance-box {
    background: #1e293b;
    border-radius: 20px;
    padding: 4px 10px;
    display: flex;
    align-items: center;
    gap: 5px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.header-balance-box img {
    width: 16px;
    height: 16px;
    border-radius: 50%;
}

.header-balance-amount {
    font-size: 0.9rem;
    font-weight: 700;
    color: white;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-deposit-header {
    background: linear-gradient(to right, #22c55e, #16a34a);
    color: #000;
    font-weight: 800;
    font-size: 0.8rem;
    padding: 6px 12px;
    border-radius: 20px;
    text-decoration: none;
    box-shadow: 0 0 10px rgba(34, 197, 94, 0.4);
    display: block;
}

.header-icon-btn {
    color: #ffd700;
    font-size: 1.2rem;
    position: relative;
}

.header-icon-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: red;
    color: white;
    font-size: 0.6rem;
    border-radius: 50%;
    width: 14px;
    height: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Quick Actions Grid */
.quick-actions-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    /* 4 columns for Invite, Mission, VIP, Promo */
    gap: 15px;
    padding: 20px 15px;
    margin-bottom: 0;
}

/* In the reference image, "More" is separate or part of a 5-col grid? 
   Reference: Invite, Mission, VIP, Promo Code, More. Use 5 columns if fitting, or scrollable. 
   User image shows 5 items in a row roughly. Let's use flex space-between. */
.quick-actions-bar {
    display: flex;
    justify-content: space-between;
    padding: 20px 15px;
}

.quick-action-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: var(--text-muted);
    font-size: 0.8rem;
}

.quick-action-icon {
    width: 45px;
    height: 45px;
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: white;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

.quick-action-icon.green {
    background: linear-gradient(135deg, #22c55e, #16a34a);
}

.quick-action-icon.gold {
    background: linear-gradient(135deg, #fbbf24, #d97706);
}

.quick-action-icon.purple {
    background: linear-gradient(135deg, #a855f7, #7c3aed);
}

/* Search Bar */
.search-container {
    padding: 0 15px;
    margin-bottom: 15px;
}

.search-bar {
    background: #1e293b;
    border-radius: 8px;
    padding: 10px 15px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-muted);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.search-bar input {
    background: transparent;
    border: none;
    color: white;
    width: 100%;
    outline: none;
}

/* Categories Tabs */
.category-tabs {
    display: flex;
    gap: 20px;
    padding: 10px 15px;
    overflow-x: auto;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    scrollbar-width: none;
}

.category-tab {
    color: var(--text-muted);
    font-weight: 600;
    white-space: nowrap;
    position: relative;
    padding-bottom: 5px;
    cursor: pointer;
}

.category-tab.active {
    color: white;
    font-weight: 800;
}

.category-tab.active::after {
    content: '';
    position: absolute;
    bottom: -11px;
    left: 0;
    width: 100%;
    height: 3px;
    background: var(--game-green);
    border-radius: 3px 3px 0 0;
}

/* Game Grid Redesign */
.compact-game-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    padding: 15px;
}

.compact-game-card {
    background: #1e293b;
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    aspect-ratio: 1;
}

.compact-game-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.compact-game-tag {
    position: absolute;
    top: 5px;
    right: 5px;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    font-size: 0.6rem;
    padding: 2px 4px;
    border-radius: 4px;
}

/* Updated Bottom Nav */
.bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: #0f172a;
    /* Darker background */
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding: 8px 0;
    z-index: 1000;
    justify-content: space-around;
    align-items: center;
}

.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #64748b;
    /* Muted gray */
    text-decoration: none;
    font-size: 0.7rem;
    gap: 5px;
}

.bottom-nav-item i {
    font-size: 1.3rem;
    margin-bottom: 0;
}

.bottom-nav-item.active {
    color: var(--game-green);
}

/* Override existing responsive layout for mobile-first approach on header */
@media (max-width: 768px) {
    header {
        display: none !important;
        /* Hide old header */
    }

    .app-header {
        display: flex !important;
    }
}

@media (min-width: 769px) {
    .app-header {
        display: none !important;
        /* Hide mobile header on desktop */
    }

    header {
        display: flex !important;
    }

    /* Allow bottom nav on desktop if desired, or keep hidden. User says UI not showing, likely means styles are broken. */
    /* But standard logic is bottom nav only for mobile. */
    /* The screenshot shows a wide screen but mobile view layout. */
    /* Let's ensure BODY has padding. */
}

body {
    padding-bottom: 80px;
    /* Always reserve space for bottom nav */
}