/* DinTon.live — Mobile-first Telegram Mini App */
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body {
    width: 100%; height: 100%; overflow: hidden;
    background: linear-gradient(180deg, #0a1428 0%, #1a2540 50%, #0a1428 100%);
    color: #fff;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    user-select: none; -webkit-user-select: none;
    touch-action: manipulation;
}
button { font-family: inherit; cursor: pointer; border: none; outline: none; }
input { font-family: inherit; outline: none; }

/* ============ HUD ============ */
#hud {
    position: fixed; top: 0; left: 0; right: 0; z-index: 10;
    display: flex; justify-content: space-between; align-items: center;
    padding: 12px 16px;
    background: linear-gradient(180deg, rgba(0,0,0,0.6), transparent);
    pointer-events: none;
}
.hud-left, .hud-right { display: flex; gap: 8px; pointer-events: auto; }
.hud-item {
    background: rgba(0,0,0,0.5); backdrop-filter: blur(10px);
    border: 1px solid rgba(124, 192, 255, 0.3);
    padding: 6px 12px; border-radius: 999px;
    font-size: 14px; font-weight: 600;
    display: inline-flex; align-items: center; gap: 4px;
}
.ton-balance { color: #7cc0ff; }
.tier-free { background: rgba(120,120,120,0.4); }
.tier-bronze { background: linear-gradient(135deg, #cd7f32, #8b4513); }
.tier-silver { background: linear-gradient(135deg, #c0c0c0, #808080); color: #000; }
.tier-gold { background: linear-gradient(135deg, #ffd700, #ff8c00); color: #000; }
.tier-diamond { background: linear-gradient(135deg, #b9f2ff, #7cc0ff); color: #0a1428; }

/* ============ SCREENS ============ */
.screen {
    position: fixed; inset: 0; padding: 64px 20px 20px;
    display: none; flex-direction: column; align-items: center;
    overflow-y: auto;
}
.screen.active { display: flex; }

/* ============ MENU ============ */
.logo { text-align: center; margin: 32px 0 40px; }
.logo-dino { font-size: 96px; filter: drop-shadow(0 0 30px rgba(124, 192, 255, 0.6)); animation: float 3s ease-in-out infinite; }
@keyframes float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
.logo h1 {
    font-size: 48px; font-weight: 900; letter-spacing: 2px;
    background: linear-gradient(135deg, #7cc0ff, #b9f2ff, #fff);
    -webkit-background-clip: text; background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 40px rgba(124, 192, 255, 0.4);
    margin: 8px 0;
}
.tagline { font-size: 14px; opacity: 0.7; letter-spacing: 3px; text-transform: uppercase; }

.menu-buttons { width: 100%; max-width: 360px; display: flex; flex-direction: column; gap: 12px; }

/* ============ BUTTONS ============ */
.btn {
    padding: 14px 24px; border-radius: 12px;
    font-size: 16px; font-weight: 600; color: #fff;
    transition: transform 0.1s, box-shadow 0.2s;
    border: 1px solid rgba(255,255,255,0.1);
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-primary {
    background: linear-gradient(135deg, #00a8ff, #7cc0ff);
    box-shadow: 0 4px 20px rgba(0, 168, 255, 0.4);
}
.btn-primary:hover { box-shadow: 0 4px 30px rgba(0, 168, 255, 0.6); }
.btn-secondary { background: rgba(255,255,255,0.08); backdrop-filter: blur(10px); }
.btn-large { padding: 18px; font-size: 20px; }
.btn-icon { background: rgba(255,255,255,0.1); padding: 8px 12px; border-radius: 8px; color: #fff; }

.back-btn {
    position: absolute; top: 64px; left: 16px;
    background: rgba(255,255,255,0.1); padding: 8px 14px;
    border-radius: 999px; color: #fff; font-size: 14px;
}

/* ============ GAME SCREEN ============ */
#gameScreen { padding: 0; }
#gameHud {
    position: fixed; top: 56px; left: 0; right: 0; z-index: 5;
    display: flex; justify-content: space-around;
    padding: 8px 16px;
    background: rgba(0,0,0,0.4);
    backdrop-filter: blur(10px);
    font-size: 13px;
}
.game-stat { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.game-stat b { color: #7cc0ff; font-size: 16px; }
.live-earn b { color: #b9f2ff; }
#gameCanvas {
    position: fixed; inset: 0;
    width: 100% !important; height: 100% !important;
    background: linear-gradient(180deg, #0a1428 0%, #1e2f5a 60%, #2a4070 100%);
    touch-action: none;
}

/* ============ OVERLAYS ============ */
.overlay {
    position: fixed; inset: 0; z-index: 20;
    background: rgba(0,0,0,0.8); backdrop-filter: blur(8px);
    display: flex; align-items: center; justify-content: center;
}
.overlay.hidden { display: none; }
.overlay-card {
    background: linear-gradient(135deg, #1a2540, #0a1428);
    border: 1px solid rgba(124, 192, 255, 0.3);
    border-radius: 20px; padding: 32px;
    max-width: 320px; width: 90%; text-align: center;
}
.overlay-card h2 { margin-bottom: 20px; font-size: 28px; }
.score-result { font-size: 18px; margin-bottom: 24px; line-height: 1.8; }
.score-result b { color: #7cc0ff; font-size: 24px; }
.overlay-card button { width: 100%; margin-top: 8px; }

/* ============ TIER SCREEN ============ */
.screen h2 { font-size: 28px; margin-bottom: 8px; text-align: center; }
.screen-desc { opacity: 0.7; margin-bottom: 24px; text-align: center; font-size: 14px; }
.tier-grid { width: 100%; max-width: 400px; display: flex; flex-direction: column; gap: 12px; }
.tier-card {
    background: rgba(255,255,255,0.05); backdrop-filter: blur(10px);
    border: 1px solid rgba(124, 192, 255, 0.2);
    border-radius: 16px; padding: 20px;
    display: flex; justify-content: space-between; align-items: center;
    transition: all 0.2s;
}
.tier-card.popular { border-color: #ffd700; background: rgba(255, 215, 0, 0.08); }
.tier-card-info h3 { font-size: 18px; margin-bottom: 4px; }
.tier-card-info p { font-size: 12px; opacity: 0.7; }
.tier-card-info .tier-price { color: #7cc0ff; font-size: 16px; font-weight: 700; margin-top: 4px; }
.tier-buy { background: linear-gradient(135deg, #00a8ff, #7cc0ff); color: #fff; padding: 10px 18px; border-radius: 10px; font-weight: 700; }

/* ============ WITHDRAW ============ */
.withdraw-box { width: 100%; max-width: 400px; display: flex; flex-direction: column; gap: 12px; }
.balance-big { font-size: 32px; font-weight: 700; text-align: center; color: #b9f2ff; margin: 16px 0; }
.wallet-status { text-align: center; font-size: 13px; opacity: 0.7; padding: 8px; }
.wallet-status code { color: #7cc0ff; }
#withdrawAmount {
    background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.15);
    color: #fff; padding: 14px; border-radius: 10px; font-size: 18px;
    width: 100%; text-align: center;
}
.history-list { margin-top: 24px; }
.history-item {
    padding: 12px; background: rgba(255,255,255,0.04);
    border-radius: 8px; margin-bottom: 8px;
    display: flex; justify-content: space-between; font-size: 14px;
}

/* ============ INVITE ============ */
.invite-stats { display: flex; gap: 12px; width: 100%; max-width: 400px; margin-bottom: 24px; }
.stat-card {
    flex: 1; background: rgba(255,255,255,0.05); padding: 20px; border-radius: 12px;
    text-align: center;
}
.stat-num { font-size: 32px; font-weight: 700; color: #7cc0ff; }
.stat-label { font-size: 12px; opacity: 0.7; margin-top: 4px; }
.invite-link-box {
    width: 100%; max-width: 400px; margin-top: 16px;
    background: rgba(0,0,0,0.4); padding: 12px; border-radius: 10px;
    display: flex; align-items: center; gap: 8px;
}
.invite-link-box code { flex: 1; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #7cc0ff; }

/* ============ LEADERBOARD ============ */
.leaderboard-tabs { display: flex; gap: 8px; margin-bottom: 16px; }
.lb-tab {
    background: rgba(255,255,255,0.05); color: #fff; padding: 8px 16px;
    border-radius: 8px; font-size: 13px;
}
.lb-tab.active { background: linear-gradient(135deg, #00a8ff, #7cc0ff); }
.leaderboard-list { width: 100%; max-width: 400px; }
.leaderboard-item {
    display: flex; align-items: center; gap: 12px;
    padding: 12px; background: rgba(255,255,255,0.04);
    border-radius: 10px; margin-bottom: 8px;
}
.lb-rank { font-size: 18px; font-weight: 700; min-width: 30px; color: #ffd700; }
.lb-name { flex: 1; }
.lb-score { color: #7cc0ff; font-weight: 700; }

/* ============ BOTTOM AD ============ */
.bottom-ad {
    position: fixed; bottom: 0; left: 0; right: 0;
    height: 60px;
    background: rgba(0,0,0,0.5); backdrop-filter: blur(10px);
    border-top: 1px solid rgba(255,255,255,0.1);
    display: flex; align-items: center; justify-content: center;
    z-index: 9;
    font-size: 12px; opacity: 0.8;
}

/* ============ TOAST ============ */
.toast {
    position: fixed; bottom: 80px; left: 50%; transform: translateX(-50%);
    background: rgba(0,0,0,0.9); padding: 12px 20px; border-radius: 30px;
    z-index: 100; font-size: 14px;
    animation: toastIn 0.3s ease;
}
.toast.hidden { display: none; }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 20px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ============ RESPONSIVE ============ */
@media (max-height: 600px) {
    .logo-dino { font-size: 64px; }
    .logo h1 { font-size: 36px; }
    .logo { margin: 16px 0 24px; }
}
