/* ============================================================
   style.css — TapMiner Mini App 样式
   移动端优先；适配 Telegram 视口（100dvh）；深色霓虹风
   ============================================================ */

:root {
  --bg: #0e1117;
  --bg-2: #151a24;
  --bg-3: #1c2331;
  --line: #2a3346;
  --ink: #eef2ff;
  --ink-dim: #97a3bd;
  --ink-faint: #5d6b87;

  --accent: #3ddc97;
  --accent-2: #22b8cf;
  --gold: #ffcf5c;
  --gem: #a78bfa;
  --danger: #ff6b6b;

  --radius: 16px;
  --tap: 56px;              /* 底部导航高度 */
  --safe-b: env(safe-area-inset-bottom, 0px);
}

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

html, body {
  margin: 0; padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
               "Helvetica Neue", "PingFang SC", "Microsoft YaHei", sans-serif;
  overscroll-behavior: none;
  user-select: none;
  -webkit-user-select: none;
}

body {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  max-width: 560px;
  margin: 0 auto;
  overflow: hidden;
}

/* ---------------- 顶栏 ---------------- */
.topbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px 8px;
  background: linear-gradient(180deg, rgba(20,26,36,.98), rgba(20,26,36,.86));
  border-bottom: 1px solid var(--line);
}
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--bg-3); border: 1px solid var(--line);
  display: grid; place-items: center;
  font-size: 15px; overflow: hidden; flex: 0 0 auto;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.topbar .who { flex: 1; min-width: 0; }
.topbar .who b { display: block; font-size: 13px; }
.topbar .who span { display: block; font-size: 10px; color: var(--ink-faint); }
.topbar .brand {
  font-size: 12px; font-weight: 800; letter-spacing: .16em;
  color: var(--accent); text-transform: uppercase;
}

/* ---------------- 页面容器 ---------------- */
.pages {
  flex: 1 1 auto;
  position: relative;
  overflow: hidden;
}
.page {
  position: absolute; inset: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 14px;
  display: none;
  animation: fade .18s ease;
}
.page.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(6px);} to {opacity:1; transform:none;} }

/* ---------------- 余额卡 ---------------- */
.balance {
  background: radial-gradient(120% 120% at 50% 0%, #1b2a3a 0%, var(--bg-2) 70%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
  margin-bottom: 14px;
}
.balance .lbl { font-size: 10px; letter-spacing: .18em; color: var(--ink-faint); text-transform: uppercase; }
.balance .amt {
  font-size: 34px; font-weight: 800; line-height: 1.15; margin: 6px 0 2px;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 26px rgba(61,220,151,.28);
}
.balance .sub { font-size: 11px; color: var(--ink-dim); }
.balance .cph { color: var(--accent); }

.pills { display: flex; gap: 8px; justify-content: center; margin-top: 10px; flex-wrap: wrap; }
.pill {
  font-size: 11px; padding: 4px 10px; border-radius: 999px;
  background: var(--bg-3); border: 1px solid var(--line); color: var(--ink-dim);
}
.pill b { color: var(--ink); }
.pill.gem { color: var(--gem); border-color: rgba(167,139,250,.4); }
.pill.boost { color: var(--gold); border-color: rgba(255,207,92,.45); }

/* ---------------- 点击区 ---------------- */
.tapzone {
  position: relative;
  display: grid;
  place-items: center;
  margin: 8px 0 14px;
  min-height: 260px;
}
.tapcoin {
  width: 210px; height: 210px; border-radius: 50%;
  background:
    radial-gradient(circle at 34% 30%, #5ff5b0 0%, #2fbf83 42%, #17805a 72%, #0d4a35 100%);
  border: 3px solid rgba(255,255,255,.14);
  box-shadow:
    0 0 0 8px rgba(61,220,151,.07),
    0 18px 50px rgba(0,0,0,.55),
    inset 0 -12px 30px rgba(0,0,0,.35),
    inset 0 10px 26px rgba(255,255,255,.14);
  display: grid; place-items: center;
  cursor: pointer;
  transition: transform .08s ease;
  position: relative;
}
.tapcoin:active { transform: scale(.955); }
.tapcoin .face {
  font-size: 78px; line-height: 1;
  filter: drop-shadow(0 6px 12px rgba(0,0,0,.4));
  pointer-events: none;
}
.tapcoin .ring {
  position: absolute; inset: -8px; border-radius: 50%;
  border: 2px solid rgba(61,220,151,.35);
  animation: pulse 2.4s ease-out infinite;
  pointer-events: none;
}
@keyframes pulse {
  0% { transform: scale(.94); opacity: .8; }
  70% { transform: scale(1.16); opacity: 0; }
  100% { opacity: 0; }
}

/* 点击飘字 */
.float {
  position: fixed;
  font-weight: 800; font-size: 18px; color: var(--accent);
  pointer-events: none; z-index: 60;
  text-shadow: 0 2px 10px rgba(0,0,0,.7);
  animation: floatUp .9s ease-out forwards;
}
@keyframes floatUp {
  0% { transform: translate(-50%, 0) scale(.9); opacity: 1; }
  100% { transform: translate(-50%, -70px) scale(1.15); opacity: 0; }
}

/* 能量条 */
.energy {
  margin: 0 auto 12px;
  width: min(100%, 340px);
}
.energy .lbl {
  display: flex; justify-content: space-between;
  font-size: 10px; color: var(--ink-faint); margin-bottom: 5px;
  letter-spacing: .06em;
}
.energy .bar {
  height: 8px; border-radius: 999px; background: var(--bg-3);
  border: 1px solid var(--line); overflow: hidden;
}
.energy .bar i {
  display: block; height: 100%; width: 100%;
  background: linear-gradient(90deg, var(--accent-2), var(--accent));
  transition: width .2s ease;
}

/* ---------------- 通用按钮 ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%;
  padding: 13px 16px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--bg-3);
  color: var(--ink);
  font-size: 14px; font-weight: 700;
  cursor: pointer;
  transition: transform .08s, filter .15s;
}
.btn:active { transform: scale(.98); }
.btn.primary {
  background: linear-gradient(135deg, var(--accent), #22a06b);
  border-color: transparent; color: #052a1c;
  box-shadow: 0 8px 24px rgba(61,220,151,.22);
}
.btn.gold {
  background: linear-gradient(135deg, var(--gold), #e8a93a);
  border-color: transparent; color: #2a1d00;
}
.btn.ghost { background: transparent; }
.btn[disabled] { opacity: .45; pointer-events: none; filter: grayscale(.3); }
.btn .badge {
  font-size: 10px; font-weight: 800; padding: 2px 7px; border-radius: 999px;
  background: rgba(0,0,0,.35); color: var(--ink);
}

/* ---------------- 区块标题 ---------------- */
.sect {
  display: flex; align-items: baseline; justify-content: space-between;
  margin: 18px 0 10px;
}
.sect h2 {
  margin: 0; font-size: 13px; letter-spacing: .12em;
  text-transform: uppercase; color: var(--ink-dim);
}
.sect .hint { font-size: 10px; color: var(--ink-faint); }

/* ---------------- 卡片（商店）---------------- */
.cards { display: grid; gap: 10px; }
.card {
  display: flex; align-items: center; gap: 12px;
  padding: 12px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 14px;
}
.card .ico {
  width: 46px; height: 46px; border-radius: 12px;
  background: var(--bg-3); display: grid; place-items: center;
  font-size: 22px; flex: 0 0 auto;
}
.card .meta { flex: 1; min-width: 0; }
.card .meta b { font-size: 13px; display: block; }
.card .meta span { font-size: 10px; color: var(--ink-dim); display: block; margin-top: 2px; }
.card .meta em { font-style: normal; color: var(--accent); font-size: 10px; }
.card .own {
  font-size: 10px; color: var(--gold); padding: 2px 7px;
  border: 1px solid rgba(255,207,92,.4); border-radius: 999px;
  margin-right: 6px;
}
.card .buy {
  flex: 0 0 auto; width: auto; padding: 9px 13px; font-size: 12px;
}

/* ---------------- 任务列表 ---------------- */
.tasks { display: grid; gap: 9px; }
.task {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 12px;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 12px;
}
.task .ico { font-size: 20px; width: 30px; text-align: center; flex: 0 0 auto; }
.task .meta { flex: 1; min-width: 0; }
.task .meta b { font-size: 12px; display: block; }
.task .meta .prog { font-size: 10px; color: var(--ink-faint); margin-top: 3px; }
.task .meta .bar {
  height: 4px; border-radius: 999px; background: var(--bg-3);
  margin-top: 5px; overflow: hidden;
}
.task .meta .bar i {
  display: block; height: 100%;
  background: linear-gradient(90deg, var(--accent-2), var(--accent));
}
.task .act {
  flex: 0 0 auto; padding: 8px 12px; font-size: 11px; width: auto;
}
.task.done { opacity: .55; }

/* ---------------- 钱包 ---------------- */
.wbox {
  background: var(--bg-2); border: 1px solid var(--line);
  border-radius: 14px; padding: 14px; margin-bottom: 12px;
}
.wbox .row {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 12px; padding: 7px 0;
}
.wbox .row + .row { border-top: 1px dashed var(--line); }
.wbox .row b { color: var(--ink); }
.wbox .row span { color: var(--ink-dim); }

.field { margin: 10px 0; }
.field label {
  display: block; font-size: 10px; letter-spacing: .1em;
  color: var(--ink-faint); text-transform: uppercase; margin-bottom: 6px;
}
.field input, .field select {
  width: 100%; padding: 11px 12px;
  background: var(--bg-3); border: 1px solid var(--line);
  border-radius: 10px; color: var(--ink); font-size: 13px;
  outline: none; font-family: inherit;
}
.field input:focus, .field select:focus { border-color: var(--accent); }
.field .tip { font-size: 10px; color: var(--ink-faint); margin-top: 5px; }

.cur-tabs { display: flex; gap: 8px; margin-bottom: 10px; }
.cur-tabs button {
  flex: 1; padding: 10px; border-radius: 10px;
  background: var(--bg-3); border: 1px solid var(--line);
  color: var(--ink-dim); font-size: 12px; font-weight: 700; cursor: pointer;
}
.cur-tabs button.on {
  background: rgba(61,220,151,.14); border-color: var(--accent); color: var(--accent);
}

/* ---------------- 提币解锁门槛（累计看广告）---------------- */
.wbox.gate {
  background: linear-gradient(135deg, rgba(255,207,92,.08), var(--bg-2));
  border-color: rgba(255,207,92,.32);
}
.wbox.gate.unlocked {
  background: linear-gradient(135deg, rgba(61,220,151,.08), var(--bg-2));
  border-color: rgba(61,220,151,.32);
}
.gate-head { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.gate-head span { font-size: 18px; }
.gate-desc { font-size: 11px; color: var(--ink-dim); margin: 6px 0 8px; line-height: 1.5; }
.gate-bar {
  height: 6px; border-radius: 999px; background: var(--bg-3);
  border: 1px solid var(--line); overflow: hidden;
}
.gate-bar i {
  display: block; height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--gold), #ffb03a);
  transition: width .3s ease;
}
.gate-num { font-size: 10px; color: var(--ink-faint); margin-top: 6px; text-align: right; }


.hist { display: grid; gap: 8px; }
.hist .h {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 11px; padding: 10px 12px;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px;
}
.hist .h .st {
  font-size: 10px; padding: 2px 8px; border-radius: 999px;
  background: rgba(255,207,92,.14); color: var(--gold);
}
.hist .h .st.sent { background: rgba(61,220,151,.14); color: var(--accent); }
.hist .h .st.rejected { background: rgba(255,107,107,.14); color: var(--danger); }

/* ---------------- 邀请 ---------------- */
.ref-hero {
  background: radial-gradient(120% 120% at 50% 0%, #2a2140 0%, var(--bg-2) 70%);
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; text-align: center; margin-bottom: 12px;
}
.ref-hero .big { font-size: 26px; font-weight: 800; color: var(--gold); }
.ref-hero .lbl { font-size: 10px; color: var(--ink-faint); letter-spacing: .16em; text-transform: uppercase; }

.linkbox {
  display: flex; gap: 8px; margin: 10px 0;
}
.linkbox input {
  flex: 1; padding: 11px 12px; font-size: 11px;
  background: var(--bg-3); border: 1px solid var(--line);
  border-radius: 10px; color: var(--accent); outline: none;
  font-family: ui-monospace, Menlo, Consolas, monospace;
}
.linkbox .btn { width: auto; padding: 11px 14px; font-size: 12px; }

.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* ---------------- 底部导航 ---------------- */
.tabbar {
  flex: 0 0 auto;
  display: flex;
  background: rgba(20,26,36,.98);
  border-top: 1px solid var(--line);
  padding-bottom: var(--safe-b);
  z-index: 30;
}
.tabbar button {
  flex: 1 1 0;
  min-width: 0;
  background: none; border: 0; padding: 9px 2px 8px;
  color: var(--ink-faint); font-size: 10px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  transition: color .15s;
  position: relative;
}
.tabbar button .ti { font-size: 19px; line-height: 1; }
.tabbar button.on { color: var(--accent); }
.tabbar button.on::after {
  content: ""; position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: 26px; height: 2px; border-radius: 2px; background: var(--accent);
}
.tabbar button .dot {
  position: absolute; top: 6px; right: 18%;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--danger);
}

/* ---------------- 弹层 ---------------- */
.sheet {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(4,6,10,.72);
  backdrop-filter: blur(3px);
  display: none; align-items: flex-end; justify-content: center;
}
.sheet.show { display: flex; }
.sheet .panel {
  width: 100%; max-width: 560px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 20px 20px 0 0;
  padding: 18px 16px calc(18px + var(--safe-b));
  animation: up .2s ease;
}
@keyframes up { from { transform: translateY(24px); opacity: .8;} to { transform:none; opacity:1;} }
.sheet h3 { margin: 0 0 4px; font-size: 16px; }
.sheet p { margin: 0 0 14px; font-size: 12px; color: var(--ink-dim); line-height: 1.6; }
.sheet .acts { display: flex; gap: 10px; }

/* toast */
.toast {
  position: fixed; left: 50%; bottom: calc(96px + var(--safe-b));
  transform: translateX(-50%) translateY(10px);
  background: rgba(28,35,49,.97); color: var(--ink);
  border: 1px solid var(--line);
  box-shadow: 0 8px 28px rgba(0,0,0,.5);
  padding: 10px 16px; border-radius: 999px;
  font-size: 12px; z-index: 210; opacity: 0;
  transition: opacity .2s, transform .2s;
  pointer-events: none; max-width: 88vw; text-align: center;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* 调试面板 */
.debug {
  position: fixed; right: 8px; bottom: calc(80px + var(--safe-b));
  font-size: 10px; background: rgba(0,0,0,.8); color: #9ef;
  padding: 8px; border-radius: 8px; max-width: 46vw; z-index: 150;
  white-space: pre-wrap; display: none;
}
.debug.show { display: block; }

/* 空状态 */
.empty {
  text-align: center; padding: 28px 10px; color: var(--ink-faint); font-size: 12px;
}
.empty .e { font-size: 32px; display: block; margin-bottom: 8px; opacity: .6; }

/* 滚动条 */
.page::-webkit-scrollbar { width: 0; }
