/* ─── Reset & Base ─────────────────────────────────────── */
*{box-sizing:border-box;margin:0;padding:0;-webkit-tap-highlight-color:transparent}
html,body{height:100%;overflow:hidden;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif;background:var(--tg-theme-bg-color,#efeff3);color:var(--tg-theme-text-color,#000)}

/* ─── Screens ──────────────────────────────────────────── */
.screen{position:fixed;inset:0;display:none;flex-direction:column;background:var(--tg-theme-bg-color,#efeff3)}
.screen.active{display:flex}

/* ─── Login ────────────────────────────────────────────── */
.tg-header{background:#007aff;padding:52px 24px 36px;text-align:center;color:#fff;flex-shrink:0}
.tg-logo{width:80px;height:80px;margin:0 auto 18px;background:#fff;border-radius:50%;display:flex;align-items:center;justify-content:center}
.tg-title{font-size:26px;font-weight:700;margin-bottom:6px}
.tg-sub{font-size:14px;opacity:.85;line-height:1.5}
.form-area{flex:1;padding:28px 16px 20px;display:flex;flex-direction:column;overflow-y:auto}
.form-label{font-size:12px;color:#8e8e93;text-transform:uppercase;letter-spacing:.5px;padding:0 4px;margin-bottom:8px}
.input-group{background:#fff;border-radius:14px;overflow:hidden;margin-bottom:8px}
.input-row{display:flex;align-items:center;padding:0 14px}
.input-icon{width:28px;flex-shrink:0;display:flex;align-items:center;justify-content:center}
.input-field{flex:1;padding:15px 0 15px 10px;font-size:15px;color:#000;border:none;outline:none;background:transparent;font-family:monospace}
.input-field::placeholder{color:#c7c7cc;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif;font-size:14px}
.input-hint{font-size:12px;color:#8e8e93;padding:2px 4px;margin-bottom:20px;line-height:1.6}
.footer-note{text-align:center;font-size:11px;color:#c7c7cc;margin-top:auto;padding-top:16px;line-height:1.8}

/* ─── Loading ───────────────────────────────────────────── */
.loading-center{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:16px}
.spinner{width:36px;height:36px;border:3px solid #e5e5ea;border-top-color:#007aff;border-radius:50%;animation:spin .8s linear infinite}
@keyframes spin{to{transform:rotate(360deg)}}
.loading-text{font-size:14px;color:#8e8e93}

/* ─── App shell ─────────────────────────────────────────── */
#s-app{display:none;flex-direction:column}
#s-app.active{display:flex}
.tab-content{display:none;flex-direction:column;flex:1;overflow:hidden}
.tab-content.active{display:flex}
.scroll-area{flex:1;overflow-y:auto;padding:12px 16px 16px;-webkit-overflow-scrolling:touch}
.scroll-area::-webkit-scrollbar{display:none}

/* ─── Navbar ─────────────────────────────────────────────── */
.navbar{background:#fff;border-bottom:.5px solid #e5e5ea;padding:14px 16px;flex-shrink:0}
.navbar-title{font-size:17px;font-weight:600;color:#000}

/* ─── Balance hero ──────────────────────────────────────── */
.balance-hero{background:#007aff;border-radius:16px;padding:24px 20px;text-align:center;color:#fff;margin-bottom:12px}
.bal-label{font-size:12px;opacity:.75;margin-bottom:6px;text-transform:uppercase;letter-spacing:.5px}
.bal-amount{font-size:42px;font-weight:700;font-family:monospace;line-height:1;display:flex;justify-content:center;align-items:baseline;gap:1px}
.bal-dec{font-size:28px;opacity:.8}
.bal-currency{font-size:16px;opacity:.85;margin-top:4px;font-weight:500}
.mining-badge{display:inline-flex;align-items:center;gap:6px;background:rgba(255,255,255,.18);border-radius:20px;padding:5px 14px;margin-top:12px;font-size:12px}
.mining-dot{width:6px;height:6px;border-radius:50%;background:#4ade80;animation:pulse 1.5s infinite}
@keyframes pulse{0%,100%{opacity:1}50%{opacity:.4}}

/* ─── Action grid ───────────────────────────────────────── */
.action-grid{display:grid;grid-template-columns:1fr 1fr;gap:8px;margin-bottom:12px}
.action-btn{background:#fff;border-radius:14px;padding:16px 12px;text-align:center;cursor:pointer;transition:background .12s}
.action-btn:active{background:#f0f0f5}
.action-icon{width:40px;height:40px;border-radius:50%;margin:0 auto 8px;display:flex;align-items:center;justify-content:center}
.action-label{font-size:13px;font-weight:600;color:#000}
.action-sub{font-size:10px;color:#8e8e93;margin-top:2px}

/* ─── Plans ─────────────────────────────────────────────── */
.section-label{font-size:12px;color:#8e8e93;text-transform:uppercase;letter-spacing:.4px;margin-bottom:8px;margin-top:4px}
.plan-card{background:#fff;border-radius:14px;padding:14px;border-left:3px solid #007aff;margin-bottom:10px}
.plan-card.expired{border-left-color:#c7c7cc;opacity:.7}
.plan-top{display:flex;justify-content:space-between;align-items:flex-start;margin-bottom:10px}
.plan-amount{font-size:18px;font-weight:700;color:#000}
.plan-date{font-size:11px;color:#8e8e93;margin-top:2px}
.plan-badge{background:#e8f4ff;border-radius:6px;padding:3px 10px;font-size:11px;font-weight:700;color:#007aff}
.plan-progress-wrap{background:#f2f2f7;border-radius:4px;height:4px;margin-bottom:10px}
.plan-progress-fill{background:#007aff;border-radius:4px;height:4px;transition:width .5s}
.plan-stats{display:flex;justify-content:space-between}
.plan-stat-val{font-size:12px;font-weight:600;color:#000}
.plan-stat-lbl{font-size:10px;color:#8e8e93;margin-top:2px}
.empty-state{text-align:center;padding:32px 20px;font-size:13px;color:#8e8e93;line-height:1.7}

/* ─── Cards ─────────────────────────────────────────────── */
.card{background:#fff;border-radius:14px;padding:18px;margin-bottom:12px}
.info-box{background:#e8f4ff;border-radius:14px;padding:14px;margin-bottom:12px}
.info-box-title{font-size:13px;font-weight:600;color:#007aff;margin-bottom:6px}
.info-box-text{font-size:12px;color:#555;line-height:1.7}
.warning-box{background:#fff8e1;border-radius:10px;padding:10px 12px;font-size:11px;color:#795548;line-height:1.6;margin-top:8px}

/* ─── Deposit ───────────────────────────────────────────── */
.dep-step{display:flex;align-items:flex-start;gap:12px;margin-bottom:16px}
.dep-step-num{width:26px;height:26px;border-radius:50%;background:#007aff;color:#fff;font-size:12px;font-weight:700;display:flex;align-items:center;justify-content:center;flex-shrink:0;margin-top:1px}
.dep-step-title{font-size:13px;font-weight:600;color:#000;margin-bottom:2px}
.dep-step-sub{font-size:11px;color:#8e8e93;line-height:1.5}
.dep-addr-label{font-size:13px;font-weight:600;color:#000;text-align:center;margin-bottom:4px}
.dep-addr-sub{font-size:11px;color:#8e8e93;text-align:center;margin-bottom:12px}
.qr-wrap{text-align:center;margin-bottom:12px}
.qr-wrap img{width:160px;height:160px;border-radius:10px;border:1px solid #e5e5ea}
.addr-box{background:#f2f2f7;border-radius:10px;padding:12px 14px;font-family:monospace;font-size:12px;color:#000;word-break:break-all;line-height:1.6;margin-bottom:8px;text-align:center}
.btn-copy{width:100%;background:#f2f2f7;color:#007aff;border:none;border-radius:10px;padding:11px;font-size:13px;font-weight:600;cursor:pointer;margin-bottom:0}
.btn-copy:active{background:#e5e5ea}

/* ─── Withdraw ──────────────────────────────────────────── */
.wbal-label{font-size:12px;color:#8e8e93;margin-bottom:4px}
.wbal-amount{font-size:30px;font-weight:700;color:#000;margin-bottom:4px;font-family:monospace}
.wbal-usdt{font-size:16px;color:#8e8e93;font-weight:400}
.wbal-wallet-label{font-size:11px;color:#8e8e93;margin-top:12px;margin-bottom:4px}
.wbal-wallet{background:#f2f2f7;border-radius:8px;padding:8px 12px;font-family:monospace;font-size:11px;color:#555;margin-bottom:14px;word-break:break-all}
.field-label{font-size:12px;color:#8e8e93;margin-bottom:6px}
.seg-control{display:flex;background:#f2f2f7;border-radius:10px;padding:2px;gap:2px}
.seg-btn{flex:1;text-align:center;padding:8px;font-size:12px;font-weight:500;color:#8e8e93;border-radius:8px;cursor:pointer;transition:all .15s}
.seg-btn.active{background:#fff;color:#000;box-shadow:0 1px 3px rgba(0,0,0,.1)}
.input-field-plain{width:100%;background:#f2f2f7;border:none;border-radius:10px;padding:12px 14px;font-size:16px;color:#000;outline:none;margin-top:8px;margin-bottom:8px;font-family:monospace}
.input-field-plain:focus{background:#e8f0fe}
.fee-row{display:flex;justify-content:space-between;padding:3px 2px;font-size:12px;color:#8e8e93}

/* ─── Referral ──────────────────────────────────────────── */
.ref-hero{background:#007aff;border-radius:16px;padding:20px;color:#fff;margin-bottom:12px}
.ref-stat-row{display:flex;justify-content:space-between;margin-bottom:16px}
.ref-stat{flex:1;text-align:center}
.ref-stat-val{font-size:22px;font-weight:700;font-family:monospace}
.ref-stat-lbl{font-size:10px;opacity:.75;margin-top:3px}
.ref-stat-divider{width:1px;background:rgba(255,255,255,.25);margin:4px 0}
.ref-link-label{font-size:11px;opacity:.75;margin-bottom:6px}
.ref-link-box{background:rgba(255,255,255,.18);border-radius:10px;padding:10px 12px;font-size:11px;font-family:monospace;word-break:break-all;line-height:1.5;margin-bottom:10px}
.btn-white{width:100%;background:#fff;color:#007aff;border:none;border-radius:10px;padding:11px;font-size:13px;font-weight:600;cursor:pointer}
.btn-white:active{background:#f0f5ff}

/* ─── List items ─────────────────────────────────────────── */
.list-wrap{background:#fff;border-radius:14px;overflow:hidden;margin-bottom:12px}
.list-item{display:flex;align-items:center;gap:12px;padding:12px 14px;border-bottom:.5px solid #f2f2f7}
.list-item:last-child{border-bottom:none}
.list-icon{width:36px;height:36px;border-radius:50%;flex-shrink:0;display:flex;align-items:center;justify-content:center;font-size:14px}
.list-main{flex:1;min-width:0}
.list-title{font-size:14px;color:#000;font-weight:500;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.list-sub{font-size:11px;color:#8e8e93;margin-top:2px}
.list-right{text-align:right;flex-shrink:0}
.list-val{font-size:13px;font-weight:600;font-family:monospace}
.list-val.green{color:#34c759}
.list-val.red{color:#ff3b30}
.list-val.blue{color:#007aff}
.list-val2{font-size:10px;color:#8e8e93;margin-top:2px}

/* ─── Tab bar ───────────────────────────────────────────── */
.tabbar{display:flex;background:#fff;border-top:.5px solid #e5e5ea;flex-shrink:0;padding-bottom:env(safe-area-inset-bottom)}
.tab{flex:1;padding:8px 0 10px;text-align:center;cursor:pointer;display:flex;flex-direction:column;align-items:center;gap:3px;color:#8e8e93;font-size:10px;transition:color .15s}
.tab.active{color:#007aff}
.tab svg{width:22px;height:22px}

/* ─── Buttons ───────────────────────────────────────────── */
.btn-primary{width:100%;background:#007aff;color:#fff;border:none;border-radius:14px;padding:15px;font-size:16px;font-weight:600;cursor:pointer;transition:background .15s;margin-top:4px}
.btn-primary:active{background:#0069d9}
.btn-primary:disabled{background:#c7c7cc;cursor:default}

/* ─── Error / Success ──────────────────────────────────── */
.error-box{background:#fff2f2;border-radius:10px;padding:10px 14px;font-size:12px;color:#ff3b30;line-height:1.5;display:none}
.error-box.show{display:block}
.success-box{background:#f0fff4;border-radius:10px;padding:10px 14px;font-size:12px;color:#16a34a;line-height:1.5;display:none}
.success-box.show{display:block}

/* ─── Free plan card ────────────────────────────────────── */
.plan-card-free{border-left-color:#34c759}
.plan-badge-free{background:#f0fff4;color:#16a34a}
.plan-progress-free{background:#34c759}
