/* CoinTap - Minimal B&W Design v51 */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --bg: #ffffff;
    --bg2: #f8f8f8;
    --card: #ffffff;
    --border: #e8e8e8;
    --black: #000000;
    --gray: #444444;
    --gray2: #666666;
    --accent: #000000;
    --success: #22c55e;
    --danger: #ef4444;
    --gold: #000000;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--black);
    min-height: 100vh;
    padding-bottom: 80px;
    overflow-x: hidden;
    -ms-overflow-style: none;
    scrollbar-width: none;
}

body::-webkit-scrollbar {
    display: none;
}

body.no-scroll {
    overflow: hidden;
}

.app { width: 100%; min-height: 100vh; }
.hidden { display: none !important; }

/* Header */
.header {
    background: var(--black);
    color: #fff;
    padding: 20px;
    border-radius: 24px;
}

.header-content {
    display: flex;
    align-items: center;
    gap: 14px;
}

.avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: #fff;
    color: var(--black);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 600;
    overflow: hidden;
}

.avatar img { width: 100%; height: 100%; object-fit: cover; }

.profile-link {
    display: flex;
    align-items: center;
    gap: 14px;
    flex: 1;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.profile-link:active {
    opacity: 0.7;
}

.user-info { flex: 1; }
.username { display: block; font-size: 18px; font-weight: 600; }
.user-id { display: block; font-size: 12px; opacity: 0.7; margin-top: 2px; }

.faq-btn {
    padding: 8px 14px;
    border-radius: 20px;
    border: 2px solid rgba(255,255,255,0.3);
    background: transparent;
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}

/* Balance Section */
.balance-section {
    background: var(--bg2);
    margin: 16px;
    padding: 20px;
    border-radius: 20px;
    border: 1px solid var(--border);
}

.balance-title {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--gray);
}

.balance-boxes { display: flex; gap: 12px; }

.balance-box {
    flex: 1;
    padding: 16px;
    border-radius: 16px;
    text-align: center;
    background: var(--card);
    border: 1px solid var(--border);
}

.balance-box.main { background: #f0f0f0; }

.box-label {
    display: block;
    font-size: 11px;
    color: var(--gray2);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.box-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--black);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.coin-img {
    width: 28px;
    height: 28px;
    object-fit: contain;
}

.balance-box.pending .box-value { color: var(--gray); }

/* Bottom Navigation */
.nav-tabs {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    background: var(--card);
    padding: 12px 16px 24px;
    border-top: 1px solid var(--border);
    z-index: 100;
}

.nav-tab {
    flex: 1;
    padding: 10px;
    border: none;
    background: transparent;
    font-size: 12px;
    font-weight: 600;
    color: #888888;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    transition: all 0.2s;
}

.nav-tab img {
    width: 24px;
    height: 24px;
    object-fit: contain;
}

.nav-tab.active {
    color: #000000;
}

.nav-tab.admin-tab { flex: 0.5; }

/* Back Button */
.back-btn {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--card);
    border: none;
    border-top: 1px solid var(--border);
    padding: 18px;
    font-size: 16px;
    font-weight: 600;
    color: var(--black);
    cursor: pointer;
    z-index: 100;
    padding-bottom: 32px;
}

.back-btn:active {
    background: var(--bg2);
}

/* Content */
.content { padding: 0 16px 20px; }

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 16px;
    margin-bottom: 16px;
}

.section-header h2 { font-size: 20px; font-weight: 700; }
.reward-info { font-size: 14px; color: var(--gray); font-weight: 600; }

/* Tasks */
.tasks-list { display: flex; flex-direction: column; gap: 12px; }

.task-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.task-card:active { transform: scale(0.98); }
.task-card.completed { 
    opacity: 0.6; 
    background: #f0f0f0;
}
.task-card.completed .task-icon {
    filter: grayscale(100%);
}
.task-card.completed .task-title,
.task-card.completed .task-description {
    color: #999;
}

.task-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: var(--bg2);
    display: flex;
    align-items: center;
    justify-content: center;
}

.task-icon img {
    width: 32px;
    height: 32px;
    object-fit: contain;
}

.coin-small {
    width: 18px;
    height: 18px;
    vertical-align: middle;
    margin-left: 2px;
}

.task-info { flex: 1; }
.task-title { font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.task-description { font-size: 13px; color: #444444; }
.task-reward { font-size: 15px; font-weight: 700; }

/* Withdraw */
.withdraw-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 20px;
    text-align: center;
    margin-top: 16px;
}

.withdraw-icon { margin-bottom: 10px; }
.withdraw-icon img { width: 48px; height: 48px; object-fit: contain; }
.withdraw-card h2 { font-size: 20px; font-weight: 700; margin-bottom: 4px; }
.withdraw-info { color: var(--gray); margin-bottom: 14px; font-size: 13px; }

.withdraw-balance {
    background: var(--bg2);
    padding: 12px 14px;
    border-radius: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    border: 1px solid var(--border);
}

.withdraw-balance span:first-child { color: var(--gray); font-size: 13px; }
.withdraw-balance span:last-child { font-size: 16px; font-weight: 700; }
.withdraw-balance.pending-info span:last-child { color: var(--gray); }
.withdraw-note { font-size: 11px; color: var(--gray2); margin-top: 12px; }

/* Buttons */
.btn {
    padding: 14px 20px;
    border: none;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    transition: all 0.2s;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn:disabled { opacity: 0.3; cursor: not-allowed; }
.btn:active:not(:disabled) { transform: scale(0.98); }

.btn-primary { background: var(--black); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-small { padding: 10px 16px; font-size: 13px; width: auto; }

/* Referral - no scroll */
#referral-tab {
    overflow: hidden;
    padding-bottom: 80px;
}

/* Referral */
.referral-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 16px;
    padding-bottom: 20px;
    margin-top: 8px;
    margin-bottom: 20px;
    text-align: center;
}

.referral-icon { margin-bottom: 8px; }
.referral-icon img { width: 40px; height: 40px; object-fit: contain; }
.referral-card h2 { font-size: 18px; font-weight: 700; margin-bottom: 2px; }
.referral-info { color: var(--gray); margin-bottom: 12px; font-size: 12px; }

.referral-stats { display: flex; gap: 10px; margin-bottom: 12px; }

.ref-stat {
    flex: 1;
    background: var(--bg2);
    border: 1px solid var(--border);
    padding: 10px;
    border-radius: 10px;
}

.ref-value { display: block; font-size: 22px; font-weight: 700; }
.ref-label { display: block; font-size: 10px; color: var(--gray2); margin-top: 2px; text-transform: uppercase; }

.referral-code-box {
    background: var(--bg2);
    border: 1px solid var(--border);
    padding: 10px 12px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.code-label { font-size: 12px; color: var(--gray); }
.code-value { font-size: 14px; font-weight: 700; letter-spacing: 1px; }

.share-buttons { display: flex; gap: 8px; margin-bottom: 0; }
.share-buttons .btn { flex: 1; padding: 12px 16px; font-size: 13px; }

.referral-input-section {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.referral-input-section p { font-size: 12px; color: var(--gray); margin-bottom: 8px; }
.ref-input-row { display: flex; gap: 8px; }
.ref-input-row .form-input { flex: 1; margin: 0; text-transform: uppercase; padding: 10px 12px; font-size: 14px; }

/* Modal */
.modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: flex-end;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.5);
}

.modal-content {
    position: relative;
    background: var(--card);
    border-radius: 24px 24px 0 0;
    width: 100%;
    padding: 24px;
    padding-bottom: 40px;
    max-height: 80vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; position: sticky; top: -24px; background: var(--card); padding: 10px 0; z-index: 10; }
.modal-header h3 { font-size: 20px; font-weight: 700; }
.modal-close { width: 36px; height: 36px; border: none; background: var(--bg2); border-radius: 50%; font-size: 16px; cursor: pointer; flex-shrink: 0; }

.modal-reward {
    display: inline-block;
    background: var(--bg2);
    padding: 10px 20px;
    border-radius: 10px;
    font-size: 18px;
    font-weight: 700;
    margin: 16px 0;
    border: 1px solid var(--border);
}

.modal-actions { display: flex; gap: 12px; margin-top: 20px; }
.modal-actions .btn { flex: 1; }

/* Toast */
.toast {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--black);
    color: #fff;
    padding: 14px 28px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
    z-index: 2000;
}

.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }

/* States */
.empty-state { text-align: center; padding: 48px 24px; color: var(--gray); }
.empty-icon { font-size: 48px; display: block; margin-bottom: 12px; }

.loading { display: flex; justify-content: center; padding: 40px; }
.spinner { width: 32px; height: 32px; border: 3px solid var(--border); border-top-color: var(--black); border-radius: 50%; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.banned-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 24px;
    z-index: 3000;
}

.banned-overlay h1 { margin: 16px 0 8px; }

/* Form */
.form-input {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: 12px;
    margin-bottom: 10px;
    font-size: 15px;
    background: var(--bg2);
    color: var(--black);
    font-family: inherit;
}

.form-input:focus { outline: none; border-color: var(--black); }

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    font-size: 14px;
    cursor: pointer;
}

.checkbox-row input { width: 18px; height: 18px; accent-color: var(--black); }

/* Admin */
.admin-stats { display: flex; gap: 10px; margin-bottom: 16px; }

.stat-card {
    flex: 1;
    background: var(--card);
    border: 1px solid var(--border);
    padding: 16px;
    border-radius: 16px;
    text-align: center;
}

.stat-card span { display: block; font-size: 28px; font-weight: 700; }
.stat-card small { color: var(--gray2); font-size: 11px; text-transform: uppercase; }

.admin-section {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 14px;
}

.admin-section h3 { 
    font-size: 16px; 
    font-weight: 600; 
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-icon {
    width: 20px;
    height: 20px;
    object-fit: contain;
}

.admin-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

.admin-item:last-child { border: none; }
.admin-item-info { flex: 1; }
.admin-item-info strong { display: block; font-size: 14px; margin-bottom: 2px; }
.admin-item-info span { font-size: 12px; color: var(--gray); }
.admin-item-actions { display: flex; gap: 8px; }

/* Terms & FAQ */
.terms-content { max-height: 85vh; display: flex; flex-direction: column; }
.terms-content h2 { text-align: center; margin-bottom: 20px; }

.terms-text {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: var(--bg2);
    border-radius: 12px;
    margin-bottom: 20px;
    max-height: 300px;
    font-size: 13px;
    line-height: 1.7;
}

.terms-text p { margin-bottom: 12px; color: var(--gray); }
.terms-text strong { color: var(--black); }

.terms-checkbox {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    font-size: 14px;
    cursor: pointer;
}

.terms-checkbox input { width: 22px; height: 22px; accent-color: var(--black); }
.modal-backdrop.no-close { pointer-events: none; }

.faq-list { display: flex; flex-direction: column; gap: 12px; }

.faq-item {
    background: var(--bg2);
    border-radius: 12px;
    padding: 16px;
}

.faq-q { font-weight: 600; margin-bottom: 8px; }
.faq-a { font-size: 13px; color: var(--gray); line-height: 1.6; }


/* Profile */
.profile-card {
    text-align: center;
    padding: 20px 0;
}

.profile-avatar {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    margin: 0 auto 16px;
    overflow: hidden;
    border: 3px solid var(--border);
}

.profile-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-card h2 {
    font-size: 24px;
    margin-bottom: 4px;
}

.profile-id {
    color: var(--gray);
    font-size: 14px;
    margin-bottom: 24px;
}

.balance-section-profile {
    background: var(--bg2);
    padding: 20px;
    border-radius: 20px;
    border: 1px solid var(--border);
    text-align: left;
}

/* Leaderboard & Withdrawals */
.section-divider {
    margin-top: 20px;
    padding: 16px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 16px;
}

.section-divider h3 {
    font-size: 16px;
    margin-bottom: 12px;
}

.leaderboard-list, .withdrawals-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.lb-item, .withdraw-item {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    background: var(--bg2);
    border-radius: 10px;
}

.lb-rank {
    width: 24px;
    font-weight: 700;
    color: var(--gray);
}

.lb-name, .wi-name {
    flex: 1;
    font-weight: 500;
}

.lb-score {
    font-weight: 700;
}

.wi-amount {
    font-weight: 700;
    color: var(--success);
}

.empty-text {
    color: var(--gray);
    font-size: 13px;
    text-align: center;
    padding: 16px;
}

/* User Modal */
.user-modal-info {
    background: var(--bg2);
    padding: 12px;
    border-radius: 10px;
    margin-bottom: 16px;
    font-size: 13px;
}

.user-modal-info p { margin-bottom: 6px; }
.user-modal-info p:last-child { margin-bottom: 0; }

.user-modal-section {
    margin-bottom: 16px;
}

.user-modal-section h4 {
    font-size: 14px;
    margin-bottom: 8px;
}

.um-list {
    max-height: 150px;
    overflow-y: auto;
    background: var(--bg2);
    border-radius: 10px;
    padding: 8px;
}

.um-item {
    display: flex;
    justify-content: space-between;
    padding: 8px;
    border-bottom: 1px solid var(--border);
    font-size: 12px;
}

.um-item:last-child { border-bottom: none; }
.um-item-positive { color: var(--success); }
.um-item-negative { color: var(--danger); }
