:root {
    --bg: #0b0e11;
    --surface: #151a21;
    --surface-2: #1c232c;
    --border: #262e38;
    --text: #e9edf1;
    --text-muted: #8b96a3;
    --accent: #22c55e;
    --accent-dark: #16a34a;
    --warning: #fbbf24;
    --danger: #ef4444;
    --radius: 14px;
}

* { box-sizing: border-box; }

html, body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Segoe UI', Roboto, -apple-system, BlinkMacSystemFont, sans-serif;
    min-height: 100vh;
    overscroll-behavior-y: contain;
}

a { text-decoration: none; }

.login-logo { width: 72px; height: 72px; border-radius: 20px; }

/* ---------- Topbar ---------- */
.topbar {
    height: 56px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 40;
}

.balance-pill {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 6px 14px;
    font-weight: 600;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 6px;
    font-variant-numeric: tabular-nums;
}

/* ---------- Content ---------- */
.app-content {
    padding: 16px 14px 90px;
    max-width: 560px;
    margin: 0 auto;
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.card-flat {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.hero-balance {
    background: linear-gradient(135deg, #16321f 0%, #0b0e11 100%);
    border: 1px solid #1f3a29;
    border-radius: 18px;
    padding: 22px 18px;
    text-align: center;
}

.hero-balance .amount {
    font-size: 2.1rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.5px;
    color: var(--accent);
    word-break: break-all;
}

.hero-balance .label {
    color: var(--text-muted);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.stat-box {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px;
    text-align: center;
}

.stat-box .value {
    font-weight: 700;
    font-size: 1rem;
    font-variant-numeric: tabular-nums;
}

.stat-box .label {
    color: var(--text-muted);
    font-size: 0.72rem;
}

.task-tile {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: transform .12s ease, border-color .12s ease;
    color: var(--text);
}

.task-tile:active { transform: scale(0.98); }

.task-tile:hover { border-color: var(--accent); color: var(--text); }

.task-icon {
    width: 46px;
    height: 46px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    flex-shrink: 0;
}

.icon-ptc { background: rgba(34,197,94,0.15); color: var(--accent); }
.icon-shortlink { background: rgba(59,130,246,0.15); color: #3b82f6; }
.icon-article { background: rgba(251,191,36,0.15); color: var(--warning); }

.section-title {
    font-size: 0.95rem;
    font-weight: 700;
    margin: 22px 0 10px;
    color: var(--text);
}

.list-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 4px;
    border-bottom: 1px solid var(--border);
}
.list-row:last-child { border-bottom: none; }

.rank-badge {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.8rem;
    background: var(--surface-2);
    border: 1px solid var(--border);
    flex-shrink: 0;
}
.rank-1 { background: linear-gradient(135deg,#fbbf24,#b45309); border-color:#fbbf24; color:#1a1400; }
.rank-2 { background: linear-gradient(135deg,#cbd5e1,#64748b); border-color:#cbd5e1; color:#1a1a1a; }
.rank-3 { background: linear-gradient(135deg,#f59e0b,#7c2d12); border-color:#f59e0b; color:#1a0e00; }

.badge-type {
    font-size: 0.68rem;
    padding: 3px 8px;
    border-radius: 8px;
    font-weight: 600;
}
.badge-ptc { background: rgba(34,197,94,0.15); color: var(--accent); }
.badge-shortlink { background: rgba(59,130,246,0.15); color: #3b82f6; }
.badge-article { background: rgba(251,191,36,0.15); color: var(--warning); }
.badge-referral { background: rgba(168,85,247,0.15); color: #a855f7; }
.badge-spin { background: rgba(236,72,153,0.15); color: #ec4899; }
.badge-faucet { background: rgba(59,130,246,0.15); color: #3b82f6; }
.badge-withdrawal { background: rgba(239,68,68,0.15); color: var(--danger); }

.form-control, .form-select {
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text);
}
.form-control:focus, .form-select:focus {
    background: var(--surface-2);
    color: var(--text);
    border-color: var(--accent);
    box-shadow: 0 0 0 0.2rem rgba(34,197,94,0.15);
}
.form-control::placeholder { color: var(--text-muted); }

.btn-accent {
    background: var(--accent);
    border-color: var(--accent);
    color: #06210f;
    font-weight: 700;
}
.btn-accent:hover { background: var(--accent-dark); border-color: var(--accent-dark); color: #06210f; }

.status-pill {
    font-size: 0.7rem;
    padding: 3px 10px;
    border-radius: 10px;
    font-weight: 600;
    text-transform: capitalize;
}
.status-pending { background: rgba(251,191,36,0.15); color: var(--warning); }
.status-processing { background: rgba(59,130,246,0.15); color: #3b82f6; }
.status-completed { background: rgba(34,197,94,0.15); color: var(--accent); }
.status-rejected { background: rgba(239,68,68,0.15); color: var(--danger); }

/* ---------- Bottom nav ---------- */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--surface);
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-around;
    padding: 8px 0 calc(8px + env(safe-area-inset-bottom));
    z-index: 50;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    color: var(--text-muted);
    font-size: 0.68rem;
    padding: 4px 14px;
    border-radius: 10px;
}

.nav-item i { font-size: 1.15rem; }

.nav-item.active { color: var(--accent); }

/* ---------- Misc ---------- */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}
.empty-state i { font-size: 2.2rem; margin-bottom: 10px; display: block; }

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

/* ---------- Bootstrap component overrides for dark theme ---------- */
.nav-pills .nav-link {
    color: var(--text-muted);
    background: var(--surface-2);
    border: 1px solid var(--border);
    margin: 0 2px;
}
.nav-pills .nav-link.active {
    background: var(--accent);
    color: #06210f;
    font-weight: 700;
}

.pagination .page-link {
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text);
}
.pagination .page-item.active .page-link {
    background: var(--accent);
    border-color: var(--accent);
    color: #06210f;
}

.alert-danger { background: rgba(239,68,68,0.12); border: 1px solid rgba(239,68,68,0.3); color: #fca5a5; }
.alert-success { background: rgba(34,197,94,0.12); border: 1px solid rgba(34,197,94,0.3); color: #86efac; }
.alert-warning { background: rgba(251,191,36,0.12); border: 1px solid rgba(251,191,36,0.3); color: #fde68a; }

/* ---------- Spin Wheel ---------- */
.wheel-wrap {
    position: relative;
    width: 280px;
    max-width: 100%;
    margin: 0 auto;
}

.wheel-svg {
    width: 100%;
    height: auto;
    display: block;
    filter: drop-shadow(0 8px 24px rgba(0,0,0,0.4));
}

.wheel-pointer {
    position: absolute;
    top: -6px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 5;
    font-size: 1.8rem;
    color: var(--warning);
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}