:root {
    --bg-dark: #111217;
    --bg-light: #1a1b22;
    --text-primary: #f0f0f5;
    --text-secondary: #a0a0b0;
    --accent-primary: #ffd700; /* Gold */
    --accent-dark: #ffb700;
    --accent-secondary: #c0392b;
    --glow-color: rgba(255, 215, 0, 0.7);
    --border-color: #2c2d3a;
    --font-family: 'Poppins', sans-serif;
}

* {
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    background: var(--bg-dark);
    color: var(--text-primary);
    padding: 100px 20px 20px;
    overflow-x: hidden;
}

body::before, body::after {
    content: '';
    position: fixed;
    width: 50vmax;
    height: 50vmax;
    border-radius: 50%;
    z-index: -1;
    filter: blur(100px);
    opacity: 0.15;
}
body::before { top: -20vmax; right: -20vmax; background: radial-gradient(circle, var(--accent-primary) 0%, transparent 70%); }
body::after { bottom: -20vmax; left: -20vmax; background: radial-gradient(circle, var(--accent-secondary) 0%, transparent 70%); }

nav {
    background-color: rgba(10, 10, 10, 0.6);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 215, 0, 0.2);
    position: fixed;
    width: 100%;
    left: 0;
    top: 0;
    z-index: 1000;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
}

.logo {
    font-size: 1.5rem;
    font-weight: 800;
    background: linear-gradient(45deg, var(--accent-primary), var(--accent-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav-buttons {
    display: flex;
    align-items: center;
    gap: 15px;
}

.balance-container {
    background: rgba(0, 0, 0, 0.4);
    padding: 8px 15px;
    border-radius: 20px;
    border: 1px solid var(--accent-primary);
    color: var(--accent-primary);
    font-weight: bold;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 5px;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.1);
}

.btn-nav {
    color: var(--text-primary);
    text-decoration: none;
    padding: 0.6rem 1.2rem;
    border-radius: 50px;
    background-color: rgba(255, 255, 255, 0.1);
    font-size: 0.9rem;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-nav:hover {
    background-color: var(--accent-primary);
    color: #fff;
    box-shadow: 0 0 15px var(--glow-color);
}
#dailyRewardBtn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    filter: grayscale(1);
}
.nav-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
    margin-right: 5px;
    border: 1px solid var(--accent-primary);
}

.fixed-btn {
    position: fixed;
    padding: 10px 18px;
    font-size: 0.9rem;
    font-weight: bold;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    z-index: 9999;
    transition: all 0.2s ease-in-out;
    background: var(--bg-light);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}
.fixed-btn:hover { transform: translateY(-2px); box-shadow: 0 4px 15px rgba(0,0,0,0.3); border-color: var(--accent-primary); }
#backToTopBtn { bottom: 20px; right: 20px; display: none; }

.header { text-align: center; margin: 20px 0 40px; }
.header h1 {
    font-size: 3rem;
    font-weight: 700;
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 30px rgba(255, 215, 0, 0.3);
}

.random-game-btn {
    padding: 12px 20px;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-dark));
    border: none;
    border-radius: 10px;
    color: white;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}
.random-game-btn:hover { transform: translateY(-2px); box-shadow: 0 5px 15px rgba(255, 215, 0, 0.3); }

.hero-section {
    background: linear-gradient(135deg, rgba(26, 27, 34, 0.9), rgba(44, 45, 58, 0.9));
    border-radius: 20px;
    padding: 40px;
    margin: 0 auto 40px;
    max-width: 1000px;
    text-align: center;
    border: 1px solid var(--border-color);
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    position: relative;
    overflow: hidden;
}
.hero-section::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 215, 0, 0.05) 0%, transparent 60%);
    animation: rotate 20s linear infinite;
    pointer-events: none;
}
@keyframes rotate { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
.hero-content { position: relative; z-index: 1; }
.hero-content h2 { font-size: 2rem; margin-bottom: 10px; color: var(--accent-primary); }
.hero-content p { font-size: 1rem; margin-bottom: 20px; color: var(--text-secondary); }
.cta-btn {
    padding: 12px 30px;
    background: var(--accent-primary);
    color: #000;
    font-weight: bold;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    font-size: 1rem;
    transition: transform 0.2s;
}
.cta-btn:hover { transform: scale(1.05); background: var(--accent-dark); }

.stats-bar {
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap;
    gap: 20px;
    margin: 0 auto 40px;
    max-width: 1000px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 15px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}
.stat-item { text-align: center; }
.stat-label { display: block; font-size: 0.8rem; color: var(--text-secondary); margin-bottom: 5px; text-transform: uppercase; letter-spacing: 1px; }
.stat-value { display: block; font-size: 1.4rem; font-weight: 700; color: var(--accent-primary); text-shadow: 0 0 10px rgba(255, 215, 0, 0.3); }

.game-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 30px;
    margin: 30px auto;
    max-width: 1400px;
}
.game-card {
    position: relative;
    background: var(--bg-light);
    border-radius: 14px;
    overflow: hidden;
    aspect-ratio: 5 / 7;
    cursor: pointer;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    border: 1px solid var(--border-color);
}
.game-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, rgba(0,0,0,0.3), rgba(0,0,0,0.7));
    z-index: 1;
    pointer-events: none;
}
.game-card:hover { transform: translateY(-5px) scale(1.03); box-shadow: 0 0 25px var(--glow-color); border-color: var(--accent-primary); }
.game-card img { width: 100%; height: 100%; object-fit: cover; }
.game-card .title {
    position: absolute;
    bottom: 0;
    width: 100%;
    padding: 12px 10px;
    background: linear-gradient(to top, rgba(0,0,0,0.9), transparent);
    text-align: center;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    z-index: 2;
}

.fav-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0,0,0,0.6);
    border: none;
    color: #fff;
    font-size: 1.2rem;
    cursor: pointer;
    border-radius: 50%;
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    z-index: 2;
}
.fav-btn:hover { background: rgba(255, 0, 0, 0.8); transform: scale(1.1); }
.fav-btn.active { color: #ff4757; background: rgba(255, 255, 255, 0.9); }

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    max-width: 1400px;
    margin: 60px auto;
}
.feature-box {
    background: var(--bg-light);
    padding: 30px;
    border-radius: 15px;
    text-align: center;
    border: 1px solid var(--border-color);
    transition: transform 0.3s;
}
.feature-box:hover { transform: translateY(-5px); border-color: var(--accent-primary); }
.feature-icon { font-size: 2.5rem; margin-bottom: 15px; }
.feature-title { font-size: 1.2rem; font-weight: 600; margin-bottom: 10px; color: var(--text-primary); }
.feature-desc { color: var(--text-secondary); font-size: 0.9rem; line-height: 1.6; }

.footer { margin-top: 80px; padding-top: 40px; border-top: 1px solid var(--border-color); text-align: center; color: var(--text-secondary); }
.footer h2 { font-size: 1.2rem; margin-bottom: 10px; color: var(--text-primary); }
.footer ul { list-style: none; padding: 0; line-height: 1.8; }

/* Daily Reward Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.8);
    backdrop-filter: blur(5px);
    align-items: center;
    justify-content: center;
}
.modal-content {
    background: var(--bg-light);
    padding: 30px;
    border-radius: 20px;
    border: 1px solid var(--accent-primary);
    width: 90%;
    max-width: 800px;
    text-align: center;
    position: relative;
    box-shadow: 0 0 50px rgba(255, 215, 0, 0.2);
    animation: modalPop 0.3s ease-out;
}
@keyframes modalPop {
    from { transform: scale(0.8); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}
.close-modal {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 2rem;
    cursor: pointer;
    color: var(--text-secondary);
    transition: color 0.2s;
}
.close-modal:hover { color: var(--text-primary); }

.wheel-container {
    position: relative;
    width: 300px;
    height: 300px;
    margin: 30px auto;
}
.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: 30px solid var(--accent-primary);
    z-index: 10;
    filter: drop-shadow(0 4px 4px rgba(0,0,0,0.5));
}
.wheel {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 8px solid var(--bg-light);
    box-shadow: 0 0 0 4px var(--accent-primary), 0 0 20px rgba(0,0,0,0.5);
    background: conic-gradient(
        #c0392b 0deg 45deg,
        #1a1b22 45deg 90deg,
        #c0392b 90deg 135deg,
        #1a1b22 135deg 180deg,
        #c0392b 180deg 225deg,
        #1a1b22 225deg 270deg,
        #c0392b 270deg 315deg,
        #1a1b22 315deg 360deg
    );
    transition: transform 5s cubic-bezier(0.25, 0.1, 0.25, 1);
    position: relative;
}
.wheel-number {
    position: absolute;
    top: 50%;
    left: 50%;
    transform-origin: center;
    transform: translate(-50%, -50%) rotate(calc(var(--i) * 45deg + 22.5deg)) translateY(-110px);
    color: #fff;
    font-weight: bold;
    font-size: 1.1rem;
    text-shadow: 0 2px 4px rgba(0,0,0,0.8);
    pointer-events: none;
}

.claim-btn { padding: 12px 40px; background: var(--accent-primary); border: none; border-radius: 50px; font-weight: bold; font-size: 1.1rem; cursor: pointer; transition: all 0.2s; }
.claim-btn:disabled { background: var(--text-secondary); cursor: not-allowed; opacity: 0.5; }
.claim-btn:not(:disabled):hover { transform: scale(1.05); box-shadow: 0 0 20px var(--glow-color); }

/* Account Modal Specifics */
.account-modal-content {
    max-width: 400px;
}
.profile-section {
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}
.profile-avatar {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    margin-bottom: 10px;
    border: 2px solid var(--accent-primary);
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.2);
}
.account-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.account-btn {
    padding: 12px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 1rem;
    transition: all 0.2s;
}
.account-btn:hover { background: var(--bg-light); border-color: var(--accent-primary); transform: translateY(-2px); }
.logout-btn { border-color: rgba(192, 57, 43, 0.5); color: #ff6b6b; }
.logout-btn:hover { background: rgba(192, 57, 43, 0.1); border-color: #ff6b6b; }

/* Transaction History */
.transaction-history {
    max-height: 150px;
    overflow-y: auto;
    margin-bottom: 20px;
    text-align: left;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 10px;
    background: rgba(0,0,0,0.2);
}
.transaction-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}
.transaction-item:last-child { border-bottom: none; }
.t-desc { font-weight: 500; color: var(--text-primary); }
.t-date { font-size: 0.7rem; color: var(--text-secondary); }
.t-amount { font-weight: bold; }
.t-amount.plus { color: #00c853; }
.t-amount.minus { color: #ff4757; }

/* Developer Console */
.dev-console-container {
    margin-top: 20px;
    border-top: 1px solid var(--border-color);
    padding-top: 10px;
    text-align: left;
}
.dev-summary {
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 0.8rem;
    user-select: none;
}
.dev-input {
    width: 100%;
    height: 60px;
    background: rgba(0,0,0,0.3);
    border: 1px solid var(--border-color);
    color: #fff;
    margin-top: 10px;
    border-radius: 5px;
    padding: 5px;
    font-family: monospace;
}
.dev-run-btn {
    margin-top: 5px;
    padding: 5px 10px;
    background: var(--accent-secondary);
    border: none;
    border-radius: 5px;
    color: white;
    cursor: pointer;
    font-size: 0.8rem;
}
.dev-output {
    font-family: monospace;
    font-size: 0.8rem;
    margin-top: 5px;
    word-break: break-all;
    max-height: 150px;
    overflow-y: auto;
    background: rgba(0,0,0,0.2);
    padding: 5px;
    border-radius: 4px;
}
