:root {
    --gold: #ffcc00;
    --accent: #00ff88;
    --food: #ff3366;
    --bg: #050505;
    --panel: rgba(15, 15, 15, 0.7);
    --border: rgba(0, 255, 136, 0.2);
    --grass: #0a0a0a;
    --wall: #111;
    --snake-head: #ffffff;
}

body {
    margin: 0;
    background: var(--bg);
    color: #fff;
    font-family: 'Segoe UI', Roboto, sans-serif;
    overflow: hidden;
    touch-action: none;
}

#app {
    display: flex;
    flex-direction: column;
    height: 100vh;
    max-width: 600px;
    margin: 0 auto;
}

.tabs {
    display: flex;
    background: rgba(0,0,0,0.8);
    padding: 10px;
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(10px);
}

.tab-btn {
    flex: 1;
    padding: 12px 2px;
    border: none;
    background: none;
    color: #555;
    font-weight: 800;
    cursor: pointer;
    font-size: 9px;
    letter-spacing: 1px;
    transition: all 0.3s ease;
}

.tab-btn.active {
    color: var(--accent);
    text-shadow: 0 0 10px var(--accent);
}

.tab-content {
    display: none;
    flex-direction: column;
    padding: 15px;
    height: calc(100vh - 70px);
    animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.tab-content.active { display: flex; }

.header { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    gap: 15px;
    padding: 15px;
}

.label { font-size: 9px; color: #666; letter-spacing: 2px; text-transform: uppercase; margin-bottom: 4px; }
.value { font-size: 18px; font-weight: 900; color: var(--accent); }

.progress-bar {
    width: 100%;
    height: 6px;
    background: rgba(255,255,255,0.05);
    border-radius: 10px;
    overflow: hidden;
    margin: 5px 0;
}

#xp-fill, #energy-fill { 
    width: 0%; 
    height: 100%; 
    background: linear-gradient(90deg, var(--accent), #fff); 
    box-shadow: 0 0 10px var(--accent);
    transition: width 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275); 
}

#pause-btn {
    background: rgba(255,255,255,0.1);
    border: 1px solid var(--border);
    color: var(--accent);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    font-weight: bold;
}

.glass-panel {
    background: var(--panel);
    border: 1px solid var(--border);
    backdrop-filter: blur(20px);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 12px;
}

.canvas-container {
    position: relative;
    flex: 1;
    background: var(--wall);
    border: 2px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 10px;
}

canvas { 
    display: block; 
    background: radial-gradient(circle, #1a1a1a 0%, #050505 100%);
    box-shadow: inset 0 0 50px rgba(0,0,0,0.5);
}

.overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.85);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 100;
    backdrop-filter: blur(5px);
}

.choice-box { text-align: center; width: 70%; }
.choice-box button {
    width: 100%;
    margin: 10px 0;
    padding: 15px;
    background: transparent;
    border: 1px solid var(--accent);
    color: var(--accent);
    border-radius: 10px;
    font-weight: bold;
    cursor: pointer;
}

#start-btn {
    padding: 20px 40px;
    background: var(--accent);
    color: #000;
    border: none;
    border-radius: 50px;
    font-weight: 900;
    font-size: 16px;
    letter-spacing: 2px;
    box-shadow: 0 0 30px var(--accent);
    cursor: pointer;
}

.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 10px;
    margin: 20px 0;
}

.dpad-container {
    position: absolute;
    bottom: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    pointer-events: none;
}

.dpad-row { display: flex; gap: 5px; }

.d-btn {
    width: 55px;
    height: 55px;
    background: rgba(255,255,255,0.1);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: #fff;
    font-size: 20px;
    pointer-events: auto;
    display: flex;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(5px);
}

.d-btn:active { background: var(--accent); color: #000; }

.coin-display { font-size: 28px; font-weight: 900; margin-top: 5px; color: var(--gold); }
.coin-display.usdt { color: #fff; font-size: 20px; opacity: 0.8; }

.exchange-btn, .withdraw-btn {
    width: 100%;
    padding: 16px;
    border-radius: 12px;
    font-weight: bold;
    margin-top: 15px;
    cursor: pointer;
    border: none;
    transition: transform 0.1s;
}

.exchange-btn { background: var(--accent); color: #000; }
.withdraw-btn { background: var(--food); color: #fff; }
.exchange-btn:active, .withdraw-btn:active { transform: scale(0.98); }

.modal {
    display: none;
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.9);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: #0a0a0a;
    padding: 30px;
    border-radius: 20px;
    text-align: center;
    border: 1px solid var(--accent);
    width: 80%;
}

.leaderboard-nav { display: flex; gap: 10px; margin-bottom: 15px; }
.l-nav-btn {
    flex: 1;
    padding: 10px;
    background: rgba(255,255,255,0.05);
    border: 1px solid transparent;
    color: #777;
    border-radius: 8px;
}
.l-nav-btn.active { border-color: var(--accent); color: var(--accent); }

.leaderboard-item {
    display: flex;
    justify-content: space-between;
    padding: 12px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

/* Clicker Styles */
.user-info { display: flex; flex-direction: column; gap: 10px; }
.info-row { display: flex; justify-content: space-between; align-items: center; }

.clicker-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

#click-btn-container {
    position: relative;
    margin-bottom: 40px;
}

#click-main-btn {
    width: 180px;
    height: 180px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(145deg, var(--accent), #00cc6a);
    color: #000;
    font-size: 70px;
    font-weight: 900;
    cursor: pointer;
    box-shadow: 
        0 15px 0 #008f4a,
        0 15px 30px rgba(0, 255, 136, 0.4);
    transition: all 0.1s;
    outline: none;
}

#click-main-btn:active {
    transform: translateY(10px);
    box-shadow: 
        0 5px 0 #008f4a,
        0 5px 15px rgba(0, 255, 136, 0.4);
}

.boost-glow {
    animation: boostPulse 1s infinite alternate;
}

@keyframes boostPulse {
    from { box-shadow: 0 0 20px var(--gold); }
    to { box-shadow: 0 0 50px var(--gold), 0 15px 0 #008f4a; }
}

.energy-section {
    width: 80%;
    text-align: center;
    margin-bottom: 20px;
}

.click-anim {
    position: absolute;
    color: var(--accent);
    font-weight: 900;
    pointer-events: none;
    animation: clickUp 1s forwards;
    z-index: 1000;
}

@keyframes clickUp {
    0% { opacity: 1; transform: translateY(0); }
    100% { opacity: 0; transform: translateY(-100px); }
}
