/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg: #050a14;
    --bg2: #090f1e;
    --panel: #0d1728;
    --panel2: #111f38;
    --border: #1a3a6e;
    --accent: #00d4ff;
    --accent2: #0066ff;
    --gold: #f5c518;
    --green: #00ff88;
    --red: #ff3c5a;
    --text: #e0f0ff;
    --text2: #7aacdd;
    --glow: 0 0 20px rgba(0,212,255,0.4);
    --glow2: 0 0 40px rgba(0,212,255,0.2);
    --font-main: 'Rajdhani', sans-serif;
    --font-display: 'Orbitron', sans-serif;
}

html, body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-main);
    min-height: 100vh;
    overflow-x: hidden;
}

body {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0 0 100px 0;
}

/* ===== CANVAS PARTICLES ===== */
#particles {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none;
    z-index: 0;
}

/* ===== SCANLINES ===== */
.scanlines {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none;
    z-index: 1;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0,0,0,0.03) 2px,
        rgba(0,0,0,0.03) 4px
    );
}

/* ===== LOADING SCREEN ===== */
.loading-screen {
    position: fixed;
    inset: 0;
    background: var(--bg);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 30px;
    transition: opacity 0.5s;
}
.loading-screen.hide { opacity: 0; pointer-events: none; }

.loading-logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}
.loading-logo img {
    width: 80px;
    border-radius: 50%;
    filter: drop-shadow(0 0 20px var(--accent));
    animation: pulse-glow 1.5s ease-in-out infinite;
}
.loading-text {
    font-family: var(--font-display);
    font-size: 28px;
    font-weight: 900;
    color: var(--text);
    letter-spacing: 6px;
}
.loading-text span { color: var(--accent); }

.loading-bar-wrap {
    width: 240px;
    height: 4px;
    background: var(--panel2);
    border-radius: 4px;
    overflow: hidden;
}
.loading-bar-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--accent2), var(--accent));
    border-radius: 4px;
    transition: width 0.1s linear;
    box-shadow: 0 0 10px var(--accent);
}
.loading-tip {
    font-size: 13px;
    color: var(--text2);
    letter-spacing: 1px;
}

/* ===== HEADER ===== */
.header {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 480px;
    background: linear-gradient(160deg, #0a1930 0%, #06112a 100%);
    border-bottom: 1px solid var(--border);
    padding: 16px 16px 20px;
    box-shadow: 0 4px 30px rgba(0,20,60,0.8);
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 10px;
}
.logo-img {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 2px solid var(--accent);
    box-shadow: 0 0 12px rgba(0,212,255,0.5);
}
.logo-text {
    font-family: var(--font-display);
    font-size: 18px;
    font-weight: 900;
    color: var(--text);
    letter-spacing: 3px;
}
.logo-text .accent { color: var(--accent); }

.user-info {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--panel2);
    border: 1px solid var(--border);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 13px;
    color: var(--text2);
}
.user-info i { color: var(--accent); }

/* BALANCE */
.balance-section {
    text-align: center;
    margin-bottom: 20px;
}
.balance-label {
    font-size: 11px;
    color: var(--text2);
    letter-spacing: 3px;
    text-transform: uppercase;
    margin-bottom: 8px;
}
.balance-label i { color: var(--gold); margin-right: 5px; }

.balance-display {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 10px;
}
#balance {
    font-family: var(--font-display);
    font-size: 44px;
    font-weight: 900;
    color: #fff;
    text-shadow: 0 0 30px rgba(0,212,255,0.6), 0 0 60px rgba(0,212,255,0.2);
    line-height: 1;
    transition: all 0.2s;
}
.currency-badge {
    font-family: var(--font-display);
    font-size: 14px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent2), var(--accent));
    padding: 3px 10px;
    border-radius: 10px;
    color: #fff;
    letter-spacing: 1px;
}
.balance-usd {
    font-size: 13px;
    color: var(--text2);
    margin-top: 6px;
}
.balance-usd i { color: var(--green); margin-right: 3px; }

/* STATS ROW */
.stats-row {
    display: flex;
    gap: 10px;
}
.stat-box {
    flex: 1;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 10px 8px;
    text-align: center;
    position: relative;
    overflow: hidden;
}
.stat-box::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--accent), transparent);
}
.stat-box i {
    font-size: 16px;
    color: var(--accent);
    display: block;
    margin-bottom: 4px;
}
.stat-val {
    font-family: var(--font-display);
    font-size: 13px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 2px;
}
.stat-lbl {
    font-size: 10px;
    color: var(--text2);
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

/* ===== MINING AREA ===== */
.mining-area {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 30px 16px 10px;
    width: 100%;
    max-width: 480px;
}

.coin-wrapper {
    position: relative;
    width: 130px;
    height: 130px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.coin-spin {
    width: 110px;
    height: 110px;
    border-radius: 50%;
    animation: coinRotate 4s linear infinite;
    filter: drop-shadow(0 0 20px rgba(245,197,24,0.7));
    cursor: pointer;
    position: relative;
    z-index: 2;
}
.coin-spin:active { transform: scale(0.92); }

.coin-glow {
    position: absolute;
    inset: -10px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(245,197,24,0.15) 0%, transparent 70%);
    animation: pulse-glow 2s ease-in-out infinite;
    z-index: 1;
}

/* Mining rings */
.mining-ring {
    position: absolute;
    border-radius: 50%;
    border: 1px solid var(--accent);
    opacity: 0;
    animation: ringPulse 3s ease-out infinite;
}
.ring-1 { width: 140px; height: 140px; animation-delay: 0s; }
.ring-2 { width: 180px; height: 180px; animation-delay: 1s; }
.ring-3 { width: 220px; height: 220px; animation-delay: 2s; }

@keyframes ringPulse {
    0% { opacity: 0.6; transform: scale(0.7); }
    100% { opacity: 0; transform: scale(1.3); }
}

@keyframes coinRotate {
    0% { filter: drop-shadow(0 0 20px rgba(245,197,24,0.7)) brightness(1); }
    50% { filter: drop-shadow(0 0 30px rgba(245,197,24,1)) brightness(1.2); }
    100% { filter: drop-shadow(0 0 20px rgba(245,197,24,0.7)) brightness(1); }
}

@keyframes pulse-glow {
    0%, 100% { opacity: 0.6; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.05); }
}

.mining-status {
    font-family: var(--font-display);
    font-size: 11px;
    color: var(--green);
    letter-spacing: 3px;
    margin-top: 16px;
    margin-bottom: 12px;
    text-shadow: 0 0 10px var(--green);
}
.mining-status.paused { color: var(--red); text-shadow: 0 0 10px var(--red); }

.progress-container {
    width: 100%;
    max-width: 300px;
}
.progress-bar {
    height: 6px;
    background: var(--panel2);
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 6px;
    border: 1px solid var(--border);
}
.progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--accent2), var(--accent), var(--green));
    border-radius: 6px;
    transition: width 0.3s ease;
    box-shadow: 0 0 8px var(--accent);
    animation: progressGlow 2s ease infinite;
}
@keyframes progressGlow {
    0%, 100% { box-shadow: 0 0 6px var(--accent); }
    50% { box-shadow: 0 0 14px var(--accent), 0 0 25px rgba(0,212,255,0.3); }
}
.progress-label {
    font-size: 11px;
    color: var(--text2);
    text-align: center;
    letter-spacing: 0.5px;
}

/* ===== CLAIM BUTTON ===== */
.claim-btn {
    position: relative;
    z-index: 2;
    width: calc(100% - 32px);
    max-width: 448px;
    margin: 16px 0;
    padding: 0;
    border: none;
    background: none;
    cursor: pointer;
    border-radius: 16px;
    overflow: hidden;
}
.claim-inner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 18px;
    background: linear-gradient(135deg, #0044cc, #0077ff, #00aaff);
    border-radius: 16px;
    font-family: var(--font-display);
    font-size: 16px;
    font-weight: 700;
    color: #fff;
    letter-spacing: 3px;
    position: relative;
    z-index: 1;
    border: 1px solid rgba(255,255,255,0.15);
    transition: all 0.15s;
}
.claim-inner i { font-size: 20px; }
.btn-glow {
    position: absolute;
    inset: -2px;
    background: linear-gradient(135deg, #0044cc, #00d4ff);
    border-radius: 18px;
    filter: blur(12px);
    opacity: 0.5;
    z-index: 0;
    transition: opacity 0.15s;
}
.claim-btn:active .claim-inner { transform: scale(0.97); }
.claim-btn:active .btn-glow { opacity: 0.8; }

.claim-btn.claimed .claim-inner {
    background: linear-gradient(135deg, #1a4a1a, #1f7a1f, #26a826);
}
.claim-btn.claimed .btn-glow {
    background: linear-gradient(135deg, #00ff88, #00cc66);
}

/* ===== TABS ===== */
.tabs {
    position: relative;
    z-index: 2;
    display: flex;
    width: calc(100% - 32px);
    max-width: 448px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 4px;
    gap: 4px;
    margin-bottom: 16px;
}
.tab {
    flex: 1;
    background: none;
    border: none;
    color: var(--text2);
    font-family: var(--font-main);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 1px;
    padding: 10px 4px;
    cursor: pointer;
    border-radius: 9px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}
.tab i { font-size: 12px; }
.tab.active {
    background: linear-gradient(135deg, var(--accent2), var(--accent));
    color: #fff;
    box-shadow: 0 0 15px rgba(0,100,255,0.4);
}

/* ===== TAB CONTENT ===== */
.tab-content {
    display: none;
    width: calc(100% - 32px);
    max-width: 448px;
    position: relative;
    z-index: 2;
    animation: fadeIn 0.3s ease;
}
.tab-content.active { display: block; }

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

.section-header {
    font-family: var(--font-display);
    font-size: 13px;
    font-weight: 700;
    color: var(--text2);
    letter-spacing: 2px;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    text-transform: uppercase;
}
.section-header i { color: var(--accent); }
.section-badge {
    margin-left: auto;
    background: var(--panel2);
    border: 1px solid var(--border);
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 10px;
    color: var(--text2);
    font-family: var(--font-main);
    letter-spacing: 0;
    font-weight: 400;
}

/* ===== PACKAGES ===== */
.packages-list { display: flex; flex-direction: column; gap: 12px; }

.package-card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 14px;
    position: relative;
    overflow: hidden;
    transition: all 0.2s;
}
.package-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 4px; height: 100%;
    border-radius: 4px 0 0 4px;
}
.package-card.tier-1::before { background: linear-gradient(180deg, #4488ff, #0044cc); }
.package-card.tier-2::before { background: linear-gradient(180deg, var(--accent), #0077cc); }
.package-card.tier-3::before { background: linear-gradient(180deg, var(--gold), #ff8800); }

.package-card:active { transform: scale(0.98); }

.pkg-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    flex-shrink: 0;
    position: relative;
}
.tier-1 .pkg-icon { background: rgba(68,136,255,0.15); border: 1px solid rgba(68,136,255,0.3); color: #4488ff; }
.tier-2 .pkg-icon { background: rgba(0,212,255,0.15); border: 1px solid rgba(0,212,255,0.3); color: var(--accent); }
.tier-3 .pkg-icon { background: rgba(245,197,24,0.15); border: 1px solid rgba(245,197,24,0.3); color: var(--gold); }

.pkg-info { flex: 1; }
.pkg-info h3 {
    font-family: var(--font-display);
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 4px;
    letter-spacing: 0.5px;
}
.pkg-badge {
    font-size: 10px;
    padding: 1px 7px;
    border-radius: 8px;
    margin-left: 6px;
    font-family: var(--font-main);
    font-weight: 600;
}
.pkg-badge.owned { background: rgba(0,255,136,0.15); color: var(--green); border: 1px solid rgba(0,255,136,0.3); }

.pkg-stats {
    display: flex;
    gap: 12px;
    margin-top: 5px;
}
.pkg-stat {
    font-size: 11px;
    color: var(--text2);
    display: flex;
    align-items: center;
    gap: 4px;
}
.pkg-stat i { font-size: 10px; }
.pkg-stat b { color: var(--text); }

.buy-btn {
    flex-shrink: 0;
    background: linear-gradient(135deg, var(--accent2), var(--accent));
    border: none;
    color: #fff;
    font-family: var(--font-display);
    font-size: 11px;
    font-weight: 700;
    padding: 10px 14px;
    border-radius: 10px;
    cursor: pointer;
    letter-spacing: 1px;
    transition: all 0.15s;
    text-align: center;
    min-width: 72px;
    box-shadow: 0 4px 14px rgba(0,100,255,0.3);
}
.buy-btn.free {
    background: linear-gradient(135deg, #006633, var(--green));
    box-shadow: 0 4px 14px rgba(0,255,136,0.2);
}
.buy-btn.owned-btn {
    background: var(--panel2);
    border: 1px solid var(--border);
    color: var(--text2);
    cursor: default;
    box-shadow: none;
}
.buy-btn:active:not(.owned-btn) { transform: scale(0.93); }

/* ===== REFERRAL ===== */
.referral-card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 24px 20px;
    text-align: center;
}
.ref-icon {
    font-size: 36px;
    color: var(--gold);
    margin-bottom: 12px;
    text-shadow: 0 0 20px rgba(245,197,24,0.5);
}
.ref-title {
    font-family: var(--font-display);
    font-size: 16px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 8px;
}
.ref-desc {
    font-size: 13px;
    color: var(--text2);
    margin-bottom: 18px;
    line-height: 1.5;
}
.ref-desc b { color: var(--accent); }
.ref-link-box {
    display: flex;
    align-items: center;
    background: var(--panel2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px 12px;
    margin-bottom: 20px;
    gap: 8px;
}
#ref-link {
    flex: 1;
    font-size: 12px;
    color: var(--accent);
    word-break: break-all;
    text-align: left;
}
.ref-link-box button {
    background: var(--accent2);
    border: none;
    color: #fff;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    flex-shrink: 0;
    font-size: 14px;
    transition: all 0.15s;
}
.ref-link-box button:active { transform: scale(0.9); }
.ref-stats {
    display: flex;
    gap: 16px;
    justify-content: center;
}
.ref-stat {
    text-align: center;
    background: var(--panel2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px 24px;
}
.ref-stat-val {
    font-family: var(--font-display);
    font-size: 22px;
    font-weight: 700;
    color: var(--accent);
}
.ref-stat-lbl {
    font-size: 11px;
    color: var(--text2);
    margin-top: 2px;
    letter-spacing: 0.5px;
}

/* ===== LEADERBOARD ===== */
.leaderboard-list { display: flex; flex-direction: column; gap: 8px; }
.lb-item {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px 14px;
    transition: all 0.2s;
}
.lb-item.top-1 { border-color: var(--gold); background: rgba(245,197,24,0.06); }
.lb-item.top-2 { border-color: #aaa; background: rgba(170,170,170,0.05); }
.lb-item.top-3 { border-color: #cd7f32; background: rgba(205,127,50,0.05); }

.lb-rank {
    font-family: var(--font-display);
    font-size: 18px;
    font-weight: 900;
    width: 30px;
    text-align: center;
    flex-shrink: 0;
}
.top-1 .lb-rank { color: var(--gold); text-shadow: 0 0 10px rgba(245,197,24,0.5); }
.top-2 .lb-rank { color: #ccc; }
.top-3 .lb-rank { color: #cd7f32; }

.lb-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--panel2);
    border: 2px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
    color: var(--accent);
}
.lb-name {
    flex: 1;
    font-weight: 600;
    font-size: 14px;
    color: #fff;
}
.lb-name small {
    display: block;
    font-size: 10px;
    color: var(--text2);
    font-weight: 400;
    margin-top: 1px;
}
.lb-balance {
    font-family: var(--font-display);
    font-size: 13px;
    font-weight: 700;
    color: var(--accent);
    text-align: right;
}
.lb-balance small {
    display: block;
    font-size: 10px;
    color: var(--text2);
    font-weight: 400;
}

/* ===== TOAST ===== */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: linear-gradient(135deg, #0a2a0a, #0d3d0d);
    border: 1px solid var(--green);
    color: var(--green);
    padding: 12px 20px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 9999;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 4px 20px rgba(0,255,136,0.2);
    white-space: nowrap;
}
.toast.show { transform: translateX(-50%) translateY(0); }
.toast.error { background: linear-gradient(135deg, #2a0a0a, #3d0d0d); border-color: var(--red); color: var(--red); }
