:root {
    --bg: #0f0f13;
    --card: #1a1a24;
    --primary: #6c5ce7;
    --primary-dark: #5a4bd1;
    --accent: #00cec9;
    --text: #ffffff;
    --text-muted: #a0a0b0;
    --success: #00b894;
    --danger: #ff6b6b;
    --radius: 16px;
    --nav-height: 70px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Inter', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    overflow: hidden;
    height: 100vh;
    height: 100dvh;
    user-select: none;
}

.screen, .page {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
}

.hidden { display: none !important; }

/* Loading */
#loading {
    justify-content: center;
    align-items: center;
    gap: 16px;
    background: var(--bg);
}
.loader {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(108,92,231,0.2);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Header */
.header {
    padding: 12px 16px;
    padding-top: max(12px, env(safe-area-inset-top));
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(180deg, rgba(26,26,36,0.95), transparent);
    z-index: 10;
}
.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}
.avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: 2px solid var(--primary);
    object-fit: cover;
    background: #333;
}
.name {
    font-weight: 600;
    font-size: 14px;
}
.balance-wrap {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 16px;
    font-weight: 700;
    color: #ffd700;
}
.energy-bar-wrap {
    text-align: right;
    min-width: 120px;
}
.energy-label {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 4px;
}
.energy-bar {
    height: 8px;
    background: rgba(255,255,255,0.1);
    border-radius: 4px;
    overflow: hidden;
}
.energy-fill {
    height: 100%;
    background: linear-gradient(90deg, #00cec9, #6c5ce7);
    border-radius: 4px;
    transition: width 0.3s;
}

/* Tap Area */
.tap-area {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    padding-bottom: var(--nav-height);
}
.tap-circle {
    width: min(72vw, 300px);
    height: min(72vw, 300px);
    border-radius: 50%;
    background: transparent;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: transform 0.08s;
    position: relative;
    z-index: 5;
    overflow: visible;
}
.tap-circle:active {
    transform: scale(0.93);
}
.tap-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 50%;
    filter: drop-shadow(0 0 25px rgba(0, 150, 255, 0.55));
    pointer-events: none;
    user-select: none;
}
.tap-power {
    position: absolute;
    bottom: 18px;
    font-size: 18px;
    font-weight: 800;
    color: #ffd700;
    text-shadow: 0 2px 8px rgba(0,0,0,0.7);
    background: rgba(0,0,0,0.45);
    padding: 4px 14px;
    border-radius: 20px;
    pointer-events: none;
}

/* Floating numbers */
.float-num {
    position: absolute;
    font-weight: 800;
    font-size: 22px;
    color: #ffd700;
    pointer-events: none;
    animation: floatUp 0.8s ease-out forwards;
    text-shadow: 0 2px 8px rgba(0,0,0,0.5);
    z-index: 20;
}
@keyframes floatUp {
    0% { opacity: 1; transform: translateY(0) scale(1); }
    100% { opacity: 0; transform: translateY(-80px) scale(1.3); }
}

/* Bottom Nav */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--nav-height);
    background: rgba(26,26,36,0.95);
    backdrop-filter: blur(12px);
    display: flex;
    justify-content: space-around;
    align-items: center;
    border-top: 1px solid rgba(255,255,255,0.06);
    padding-bottom: env(safe-area-inset-bottom);
    z-index: 50;
}
.nav-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    font-size: 20px;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 12px;
    transition: 0.2s;
}
.nav-btn small {
    font-size: 10px;
    font-weight: 500;
}
.nav-btn.active {
    color: var(--primary);
    background: rgba(108,92,231,0.15);
}

/* Pages */
.page {
    background: var(--bg);
    z-index: 40;
    overflow-y: auto;
    padding-bottom: 30px;
}
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    padding-top: max(16px, env(safe-area-inset-top));
    position: sticky;
    top: 0;
    background: var(--bg);
    z-index: 10;
}
.page-header h2 {
    font-size: 20px;
}
.close-page, .close-modal {
    background: rgba(255,255,255,0.1);
    border: none;
    color: #fff;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 18px;
    cursor: pointer;
}
.page-content {
    padding: 0 16px 20px;
}

/* Cards */
.card {
    background: var(--card);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 12px;
}
.card h3 {
    font-size: 16px;
    margin-bottom: 12px;
}
.section-title {
    font-size: 15px;
    color: var(--text-muted);
    margin: 20px 0 10px;
}

/* Boost item */
.boost-item, .task-item, .method-item {
    background: var(--card);
    border-radius: var(--radius);
    padding: 14px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 12px;
}
.boost-item img, .task-item img, .method-item img {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    object-fit: cover;
    background: #2a2a3a;
}
.boost-info, .task-info, .method-info {
    flex: 1;
}
.boost-info h4, .task-info h4, .method-info h4 {
    font-size: 15px;
    margin-bottom: 2px;
}
.boost-info p, .task-info p, .method-info p {
    font-size: 12px;
    color: var(--text-muted);
}
.btn-buy, .btn-claim, .btn-primary {
    background: var(--primary);
    color: #fff;
    border: none;
    padding: 10px 16px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    white-space: nowrap;
}
.btn-buy:disabled, .btn-claim:disabled, .btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.btn-primary {
    width: 100%;
    padding: 14px;
    font-size: 15px;
    margin-top: 8px;
}

/* Forms */
.promo-form, .ref-link-box {
    display: flex;
    gap: 8px;
}
.promo-form input, .ref-link-box input, .form-group input {
    flex: 1;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 12px;
    padding: 12px 14px;
    color: #fff;
    font-size: 14px;
    outline: none;
}
.promo-form button, .ref-link-box button {
    background: var(--primary);
    color: #fff;
    border: none;
    padding: 0 16px;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
}
.form-group {
    margin-bottom: 14px;
}
.form-group label {
    display: block;
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 6px;
}
.form-group small {
    font-size: 12px;
    color: var(--text-muted);
}

/* Modal */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    z-index: 100;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    padding: 16px;
}
.modal-content {
    background: var(--card);
    border-radius: 20px 20px 0 0;
    padding: 24px 20px;
    width: 100%;
    max-width: 480px;
    max-height: 85vh;
    overflow-y: auto;
    position: relative;
}
.close-modal {
    position: absolute;
    top: 16px;
    right: 16px;
}

/* Status badges */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
}
.badge-pending { background: rgba(255,193,7,0.2); color: #ffc107; }
.badge-approved { background: rgba(0,184,148,0.2); color: #00b894; }
.badge-rejected { background: rgba(255,107,107,0.2); color: #ff6b6b; }

/* Request item */
.request-item {
    background: var(--card);
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 8px;
    font-size: 13px;
}
.request-item .row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 4px;
}
