:root {
  --bg: #f2f5ff;
  --card: #ffffff;
  --ink: #0f1b4c;
  --muted: #6b7599;
  --line: #e3e8fb;
  --blue: #2f66f0;
  --blue-d: #2150c8;
  --violet: #7a5cf0;
  --gold: #f5a30f;
  --green: #17a673;
  --red: #d64545;
  --radius: 26px;
  --shadow: 0 8px 24px rgba(47, 102, 240, .10);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px; line-height: 1.35; min-height: 100dvh;
  -webkit-font-smoothing: antialiased; overscroll-behavior-y: none;
}
#app { max-width: 520px; margin: 0 auto; padding: 14px 14px 120px; }
h1, h2, h3, p { margin: 0; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
button:disabled { cursor: default; }
:focus-visible { outline: 3px solid rgba(47, 102, 240, .45); outline-offset: 2px; }
svg { display: block; }

.muted { color: var(--muted); }
.small { font-size: 14px; }
.card {
  background: var(--card); border-radius: var(--radius); padding: 18px;
  box-shadow: var(--shadow); border: 1px solid rgba(227, 232, 251, .8); margin-top: 14px;
}
.card h2 { font-size: 22px; font-weight: 800; letter-spacing: -.01em; }
.card h3 { font-size: 18px; font-weight: 800; }

/* header */
.head { display: flex; align-items: center; gap: 12px; padding: 4px 2px; }
.avatar {
  width: 52px; height: 52px; border-radius: 50%; flex: none; overflow: hidden;
  background: linear-gradient(135deg, var(--blue), var(--violet)); color: #fff;
  display: grid; place-items: center; font-weight: 800; font-size: 22px; border: 3px solid #fff; box-shadow: var(--shadow);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.head .who { min-width: 0; flex: 1; }
.head .name { font-size: 20px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 999px; background: #e8eeff; color: var(--blue-d); font-weight: 700; font-size: 13px; }
.chip.gold { background: #fff3d6; color: #9a6400; }
.chip.green { background: #dcf6ec; color: #0b7a54; }
.chip.red { background: #fde4e4; color: #a02727; }

/* balance */
.balance {
  display: flex; align-items: center; gap: 14px; padding: 18px 20px;
  background: linear-gradient(120deg, #cfe0ff 0%, #e6dcff 100%); border-color: #d5dcff;
}
.balance .coins { width: 84px; height: 84px; flex: none; }
.balance .amount { font-size: 44px; font-weight: 900; letter-spacing: -.03em; line-height: 1; font-variant-numeric: tabular-nums; }
.balance .unit { display: flex; align-items: center; gap: 6px; margin-top: 6px; color: #3d4a85; font-weight: 600; }
.balance .unit svg { width: 22px; height: 22px; }
.balance .usd { margin-left: auto; text-align: right; color: #3d4a85; font-weight: 700; font-size: 15px; }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 22px;
  border-radius: 999px; font-weight: 800; font-size: 17px; transition: transform .08s ease, opacity .15s;
}
.btn:active:not(:disabled) { transform: scale(.97); }
.btn.primary { background: linear-gradient(180deg, #3b73ff, var(--blue-d)); color: #fff; box-shadow: 0 6px 14px rgba(47, 102, 240, .35); }
.btn.soft { background: #e8eeff; color: var(--blue-d); }
.btn.violet { background: linear-gradient(180deg, #8c6cff, #6a47e6); color: #fff; box-shadow: 0 6px 14px rgba(122, 92, 240, .35); }
.btn:disabled { opacity: .45; box-shadow: none; }
.btn.block { width: 100%; }
.btn svg { width: 22px; height: 22px; }

/* miner */
.miner { display: grid; grid-template-columns: 1fr 150px; gap: 8px; align-items: center; overflow: hidden; }
.miner .title { display: flex; align-items: center; gap: 8px; }
.miner .title svg { width: 30px; height: 30px; color: var(--blue); }
.timer { font-size: 34px; font-weight: 900; letter-spacing: -.02em; color: var(--blue); font-variant-numeric: tabular-nums; margin: 2px 0 8px; }
.bar { height: 10px; border-radius: 99px; background: #e3e8fb; overflow: hidden; }
.bar > i { display: block; height: 100%; width: 0; border-radius: 99px; background: linear-gradient(90deg, #4b82ff, #7a5cf0); transition: width .4s ease; }
.miner .pts { margin: 8px 0 12px; font-weight: 700; color: var(--blue); font-size: 15px; }
.miner .art { width: 150px; height: 150px; }
.miner.big { grid-template-columns: 1fr; text-align: center; }
.miner.big .art { margin: 0 auto; width: 190px; height: 190px; }
.miner.big .title { justify-content: center; }

/* watch ad */
.watch {
  width: 100%; margin-top: 16px; display: flex; align-items: center; gap: 14px; padding: 14px 16px 14px 14px; border-radius: 999px;
  background: linear-gradient(#f6f9ff, #eee9ff) padding-box, linear-gradient(90deg, #6aa0ff, #a98bff) border-box;
  border: 2.5px solid transparent; box-shadow: var(--shadow); text-align: left; transition: transform .08s;
}
.watch:active:not(:disabled) { transform: scale(.98); }
.watch:disabled { opacity: .55; }
.watch .play { width: 58px; height: 58px; border-radius: 50%; background: linear-gradient(180deg, #3b73ff, var(--blue-d)); display: grid; place-items: center; flex: none; box-shadow: 0 6px 14px rgba(47, 102, 240, .35); }
.watch .play svg { width: 28px; height: 28px; margin-left: 3px; }
.watch .wl { font-size: 26px; font-weight: 900; letter-spacing: -.02em; flex: 1; line-height: 1.1; }
.watch .wl small { display: block; font-size: 13px; font-weight: 600; color: var(--muted); letter-spacing: 0; margin-top: 2px; }
.watch .rw { display: flex; align-items: center; gap: 6px; background: #fff; border-radius: 999px; padding: 8px 14px 8px 8px; font-weight: 900; font-size: 20px; box-shadow: inset 0 0 0 1px var(--line); }
.watch .rw svg { width: 30px; height: 30px; }
.adprog { display: flex; align-items: center; gap: 12px; background: var(--card); border-radius: 999px; padding: 12px 18px; margin-top: 10px; border: 1px solid var(--line); }
.adprog .bar { flex: 1; }
.adprog span { font-size: 14px; color: var(--muted); font-weight: 600; white-space: nowrap; }
.adprog b { color: var(--ink); }

/* streak */
.streak .row { display: flex; align-items: center; gap: 12px; }
.streak .flame { width: 46px; height: 46px; flex: none; }
.dots { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin: 14px 0 12px; }
.dot { text-align: center; font-size: 12px; font-weight: 700; color: var(--muted); }
.dot i { display: grid; place-items: center; width: 100%; aspect-ratio: 1; max-width: 38px; margin: 0 auto 4px; border-radius: 50%; border: 2px solid #cfd6f2; }
.dot.on i { background: var(--blue); border-color: var(--blue); color: #fff; }
.dot.on i svg { width: 18px; height: 18px; }
.dot.next i { border-color: var(--blue); border-style: dashed; }

/* invite */
.invite .row { display: flex; align-items: center; gap: 14px; }
.invite .ico { width: 74px; height: 74px; flex: none; }
.invite h3 b { color: var(--violet); }
.linkrow { display: flex; gap: 8px; margin-top: 12px; }
.linkrow .link { flex: 1; min-width: 0; padding: 0 14px; min-height: 46px; display: flex; align-items: center; background: #f2f5ff; border-radius: 14px; font-size: 14px; color: #44507f; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.linkrow .btn { min-height: 46px; padding: 0 18px; font-size: 16px; border-radius: 14px; }

/* lists */
.list { display: grid; gap: 10px; margin-top: 12px; }
.item { display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: #f7f9ff; border-radius: 18px; }
.item .grow { flex: 1; min-width: 0; }
.item .t { font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .s { font-size: 13px; color: var(--muted); }
.item .btn { min-height: 40px; padding: 0 16px; font-size: 15px; }
.empty { text-align: center; padding: 26px 10px; color: var(--muted); }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.stat { background: var(--card); border-radius: 20px; padding: 14px; border: 1px solid var(--line); }
.stat b { display: block; font-size: 26px; font-weight: 900; letter-spacing: -.02em; }
.stat span { color: var(--muted); font-size: 13px; font-weight: 600; }
.levels { margin-top: 14px; display: grid; gap: 8px; }
.lv { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; border-radius: 14px; background: #f7f9ff; font-weight: 700; font-size: 15px; }
.lv.cur { background: #e8eeff; color: var(--blue-d); }

.item.col { flex-direction: column; align-items: stretch; gap: 10px; }
.row2 { display: flex; gap: 8px; }
.row2 .btn { flex: 1; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; word-break: break-all; color: #44507f; }

/* forms */
label.f { display: block; margin-top: 14px; font-weight: 700; font-size: 14px; color: var(--muted); }
.input {
  width: 100%; margin-top: 6px; min-height: 50px; padding: 0 14px; border-radius: 14px; border: 1.5px solid var(--line);
  background: #fff; font: inherit; color: var(--ink);
}
.input:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(47, 102, 240, .15); }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 6px; }
.seg button { min-height: 46px; border-radius: 14px; border: 1.5px solid var(--line); font-weight: 800; background: #fff; }
.seg button.on { border-color: var(--blue); background: #e8eeff; color: var(--blue-d); }
.hint { font-size: 13px; color: var(--muted); margin-top: 8px; }

/* nav */
.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; max-width: 520px; margin: 0 auto;
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 2px; padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, .94); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-radius: 28px 28px 0 0; box-shadow: 0 -8px 28px rgba(47, 102, 240, .12); border: 1px solid rgba(227, 232, 251, .9); border-bottom: 0;
}
.nav[hidden] { display: none; }
.nav button { display: grid; justify-items: center; gap: 3px; padding: 6px 0 4px; border-radius: 16px; color: #5a6690; font-size: 12px; font-weight: 700; position: relative; }
.nav button svg { width: 28px; height: 28px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.nav button.on { color: var(--blue); }
.nav button.on::after { content: ""; position: absolute; left: 22%; right: 22%; bottom: -2px; height: 3px; border-radius: 3px; background: var(--blue); }

/* toast, overlays, splash */
.toast {
  position: fixed; left: 50%; bottom: 104px; z-index: 40; transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: #0f1b4c; color: #fff; padding: 12px 18px; border-radius: 16px; font-weight: 700; font-size: 15px; max-width: 88vw; text-align: center;
  transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.good { background: #0b7a54; }
.toast.bad { background: #a02727; }
.splash, .outside { min-height: 70dvh; display: grid; place-items: center; text-align: center; padding: 20px; }
.outside .card { max-width: 380px; }
.outside h1 { font-size: 26px; font-weight: 900; margin: 12px 0 8px; }
.spinner { width: 38px; height: 38px; border-radius: 50%; border: 4px solid #d5dcff; border-top-color: var(--blue); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.adsim { position: fixed; inset: 0; z-index: 60; background: rgba(15, 27, 76, .92); color: #fff; display: grid; place-items: center; text-align: center; padding: 24px; }
.adsim b { display: block; font-size: 64px; margin: 10px 0; font-variant-numeric: tabular-nums; }
.pop { animation: pop .35s ease; }
@keyframes pop { 0% { transform: scale(1); } 40% { transform: scale(1.06); } 100% { transform: scale(1); } }
@media (max-width: 360px) {
  .balance .amount { font-size: 36px; }
  .miner { grid-template-columns: 1fr 112px; }
  .miner .art { width: 112px; height: 112px; }
  .watch .wl { font-size: 22px; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
