/* ============================================================
   Gram Drop — Telegram Mini App
   ============================================================ */
:root {
  /* Telegram theme vars with dark fallbacks — remapped by JS from tg.themeParams */
  --bg: var(--tg-theme-bg-color, #0e1621);
  --bg-2: var(--tg-theme-secondary-bg-color, #17212b);
  --card: var(--tg-theme-section-bg-color, #1c2733);
  --card-2: #232f3d;
  --border: rgba(255, 255, 255, 0.07);
  --text: var(--tg-theme-text-color, #f2f6fa);
  --hint: var(--tg-theme-hint-color, #7d8b99);
  --accent: var(--tg-theme-button-color, #0098ea);
  --accent-2: #00c2ff;
  --accent-text: var(--tg-theme-button-text-color, #ffffff);
  --green: #31d158;
  --amber: #f5a623;
  --violet: #8774e1;
  --red: #ff5c5c;
  --header-bg: rgba(14, 22, 33, 0.85);
  --nav-bg: rgba(23, 33, 43, 0.92);
  --nav-h: 62px;
  --radius: 18px;
  --shadow: 0 6px 24px rgba(0, 0, 0, 0.28);
}

html[data-theme="light"] {
  --bg: var(--tg-theme-bg-color, #ffffff);
  --bg-2: var(--tg-theme-secondary-bg-color, #f0f2f5);
  --card: var(--tg-theme-section-bg-color, #ffffff);
  --card-2: #eef1f5;
  --border: rgba(0, 0, 0, 0.08);
  --text: var(--tg-theme-text-color, #101418);
  --hint: var(--tg-theme-hint-color, #8494a5);
  --header-bg: rgba(255, 255, 255, 0.85);
  --nav-bg: rgba(255, 255, 255, 0.92);
  --shadow: 0 6px 24px rgba(16, 40, 60, 0.12);
}
html[data-theme="light"] body { background: var(--bg-2); }
html[data-theme="light"] .card,
html[data-theme="light"] .stat,
html[data-theme="light"] .task,
html[data-theme="light"] .friend,
html[data-theme="light"] .history-item,
html[data-theme="light"] .empty-state,
html[data-theme="light"] .seg { background: var(--card); box-shadow: 0 1px 4px rgba(16, 40, 60, 0.06); }
html[data-theme="light"] .ticker { background: var(--card); }
html[data-theme="light"] .field-box { background: var(--bg-2); }
html[data-theme="light"] .progress { background: rgba(0, 0, 0, 0.08); }
html[data-theme="light"] .toast { background: #ffffff; }
html[data-theme="light"] .ref-box { background: var(--bg-2); }
html[data-theme="light"] .seg-btn.active { color: var(--accent-text); }

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

html, body { height: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.4;
  overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
}

/* display face for headline numbers & titles */
.brand-name, .page-head h1, .bc-amount, .stat-val, .wc-amount,
.reward-title, .invite-headline, .sheet-title {
  font-family: "Unbounded", "Manrope", sans-serif;
}

#app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* ambient colour glow behind everything */
#app::before, #app::after {
  content: "";
  position: fixed;
  width: 320px; height: 320px;
  border-radius: 50%;
  filter: blur(95px);
  opacity: 0.14;
  pointer-events: none;
  z-index: 0;
}
#app::before { background: #0098ea; top: -110px; right: -90px; animation: drift 16s ease-in-out infinite alternate; }
#app::after { background: #8774e1; bottom: -130px; left: -110px; animation: drift 19s ease-in-out 2s infinite alternate-reverse; }
@keyframes drift {
  from { transform: translate(0, 0) scale(1); }
  to { transform: translate(-40px, 30px) scale(1.15); }
}
html[data-theme="light"] #app::before,
html[data-theme="light"] #app::after { opacity: 0.1; }

.app-header, .ticker, .pages, .bottom-nav { position: relative; z-index: 1; }

button { font-family: inherit; border: none; background: none; color: inherit; cursor: pointer; }
svg { display: block; }

/* ============ HEADER ============ */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--header-bg);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.brand { display: flex; align-items: center; gap: 9px; }
.brand-logo { width: 30px; height: 30px; animation: logoFloat 4s ease-in-out infinite; }
.brand-logo svg { width: 100%; height: 100%; }
@keyframes logoFloat { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }
.brand-name { font-size: 17px; font-weight: 800; letter-spacing: -0.2px; }
.brand-name span {
  background: linear-gradient(90deg, var(--accent), #00e0ff);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.balance-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--card);
  border: 1px solid var(--border);
  padding: 7px 13px;
  border-radius: 100px;
  font-weight: 700;
  font-size: 14px;
  transition: transform 0.15s ease, background 0.2s;
}
.balance-pill:active { transform: scale(0.94); }

.ton-ic { width: 16px; height: 16px; flex-shrink: 0; }
.ton-ic.big {
  width: 34px; height: 34px;
  /* white ring so the blue coin separates from the blue balance card */
  border-radius: 50%;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.9), 0 3px 10px rgba(0, 0, 0, 0.18);
}

/* ============ TICKER ============ */
.ticker {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 2px 16px 4px;
  padding: 7px 10px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

.ticker-badge {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.8px;
  color: var(--red);
  flex-shrink: 0;
}
.live-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--red);
  animation: livePulse 1.4s ease-in-out infinite;
}
@keyframes livePulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 92, 92, 0.55); }
  55% { box-shadow: 0 0 0 5px rgba(255, 92, 92, 0); }
}

.ticker-viewport { overflow: hidden; flex: 1; mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent); -webkit-mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent); }
.ticker-track { display: flex; gap: 22px; width: max-content; animation: tickerScroll 40s linear infinite; }
@keyframes tickerScroll { to { transform: translateX(-50%); } }

.ticker-item { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--hint); white-space: nowrap; }
.ticker-item b { color: var(--text); font-weight: 600; }
.ticker-item .t-amount {
  color: var(--green);
  font-weight: 800;
  background: rgba(49, 209, 88, 0.12);
  padding: 1px 7px;
  border-radius: 100px;
}
.ticker-item svg { width: 13px; height: 13px; flex-shrink: 0; }

/* ============ PAGES ============ */
.pages { flex: 1; position: relative; padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 14px); }

.page {
  display: none;
  padding: 8px 16px 10px;
  flex-direction: column;
  gap: 12px;
}
.page.active { display: flex; animation: pageIn 0.28s cubic-bezier(0.22, 1, 0.36, 1); }
@keyframes pageIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.page-head h1 { font-size: 22px; font-weight: 800; letter-spacing: -0.2px; }
.page-head p { color: var(--hint); font-size: 14px; margin-top: 2px; font-weight: 500; }

.section-title {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; font-weight: 800;
  text-transform: uppercase; letter-spacing: 0.8px;
  color: var(--hint);
  margin: 6px 2px -4px;
}
.section-title::before {
  content: "";
  width: 16px; height: 3px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}

/* ============ CARDS ============ */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
}

.card-row { display: flex; align-items: center; gap: 12px; }
.card-info { flex: 1; min-width: 0; }
.card-title { font-weight: 800; font-size: 15.5px; }
.card-sub { font-size: 12.5px; color: var(--hint); margin-top: 1px; }

.row-card { display: flex; align-items: center; gap: 12px; }

.icon-tile {
  width: 42px; height: 42px;
  border-radius: 13px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.icon-tile svg { width: 22px; height: 22px; }
.icon-tile.sm { width: 34px; height: 34px; border-radius: 10px; }
.icon-tile.sm svg { width: 18px; height: 18px; }
.icon-tile.blue { background: linear-gradient(135deg, #0088d4, #00c2ff); color: #fff; box-shadow: 0 4px 12px rgba(0, 152, 234, 0.35); }
.icon-tile.green { background: linear-gradient(135deg, #1fb14c, #4ade80); color: #fff; box-shadow: 0 4px 12px rgba(49, 209, 88, 0.35); }
.icon-tile.amber { background: linear-gradient(135deg, #f08c00, #fbbf24); color: #fff; box-shadow: 0 4px 12px rgba(245, 166, 35, 0.35); }
.icon-tile.violet { background: linear-gradient(135deg, #7255e0, #a78bfa); color: #fff; box-shadow: 0 4px 12px rgba(135, 116, 225, 0.4); }

/* ============ BALANCE CARD ============ */
.balance-card {
  position: relative;
  overflow: hidden;
  border-radius: 20px;
  padding: 20px 18px 16px;
  background: linear-gradient(135deg, #0075c4 0%, #0098ea 55%, #00b4f0 100%);
  box-shadow: 0 10px 30px rgba(0, 152, 234, 0.25);
}
.bc-shine {
  position: absolute;
  top: 0; left: -80%;
  width: 55%; height: 100%;
  background: linear-gradient(105deg, transparent, rgba(255, 255, 255, 0.14), transparent);
  transform: skewX(-18deg);
  animation: shine 5.5s ease-in-out infinite;
  pointer-events: none;
}
@keyframes shine { 0%, 55% { left: -80%; } 90%, 100% { left: 150%; } }

.bc-label { font-size: 12.5px; font-weight: 600; color: rgba(255, 255, 255, 0.75); text-transform: uppercase; letter-spacing: 0.8px; }
.bc-amount { display: flex; align-items: center; gap: 10px; margin-top: 8px; font-size: 31px; font-weight: 700; letter-spacing: 0; color: #fff; }
.bc-amount em { font-style: normal; font-size: 13px; font-weight: 700; opacity: 0.8; align-self: flex-end; margin-bottom: 6px; font-family: "Manrope", sans-serif; }
.bc-usd { font-size: 13px; color: rgba(255, 255, 255, 0.72); margin-top: 2px; font-weight: 600; }

.bc-actions { display: flex; gap: 10px; margin-top: 16px; }
.bc-btn {
  flex: 1;
  display: flex; align-items: center; justify-content: center; gap: 7px;
  background: rgba(255, 255, 255, 0.92);
  color: #0075c4;
  font-weight: 700; font-size: 14px;
  padding: 11px;
  border-radius: 12px;
  transition: transform 0.15s ease;
}
.bc-btn.ghost { background: rgba(255, 255, 255, 0.16); color: #fff; }
.bc-btn:active { transform: scale(0.96); }
.bc-btn svg { width: 17px; height: 17px; }

/* ============ BUTTONS ============ */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  font-weight: 800; font-size: 15px;
  padding: 14px 18px;
  border-radius: 14px;
  background: var(--card-2);
  transition: transform 0.15s ease, opacity 0.2s, background 0.2s;
  user-select: none;
}
.btn svg { width: 18px; height: 18px; }
.btn:active { transform: scale(0.965); }
.btn.primary {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  color: var(--accent-text);
  box-shadow: 0 5px 16px rgba(0, 152, 234, 0.3);
}
.btn.ghost { background: transparent; color: var(--hint); }
.btn.full { width: 100%; }
.btn.small { padding: 9px 16px; font-size: 13px; border-radius: 11px; background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: var(--accent-text); flex-shrink: 0; }
.btn.small.done { background: rgba(49, 209, 88, 0.13); color: var(--green); box-shadow: none; }
.btn:disabled { opacity: 0.45; pointer-events: none; }

/* ============ AD CARD / PROGRESS ============ */
.ad-card { display: flex; flex-direction: column; gap: 12px; }
.ad-card .btn.primary { animation: btnGlow 2.8s ease-in-out infinite; }
@keyframes btnGlow {
  0%, 100% { box-shadow: 0 5px 16px rgba(0, 152, 234, 0.3); }
  50% { box-shadow: 0 5px 28px rgba(0, 194, 255, 0.55); }
}
.ad-counter { font-size: 13px; color: var(--hint); font-weight: 600; }
.ad-counter b { color: var(--accent-2); font-size: 16px; }

.progress { height: 7px; background: var(--bg); border-radius: 100px; overflow: hidden; }
.progress-fill {
  height: 100%;
  width: 0%;
  border-radius: 100px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

/* ============ STATS ============ */
.stats-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stats-row.two { grid-template-columns: repeat(2, 1fr); }
.stat {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 10px;
  display: flex; flex-direction: column; align-items: center;
  text-align: center;
  gap: 4px;
}
.stat-ic { width: 32px; height: 32px; border-radius: 10px; display: flex; align-items: center; justify-content: center; margin-bottom: 2px; }
.stat-ic svg { width: 17px; height: 17px; }
.stat-ic.blue { background: linear-gradient(135deg, #0088d4, #00c2ff); color: #fff; box-shadow: 0 3px 10px rgba(0, 152, 234, 0.35); }
.stat-ic.green { background: linear-gradient(135deg, #1fb14c, #4ade80); color: #fff; box-shadow: 0 3px 10px rgba(49, 209, 88, 0.35); }
.stat-ic.violet { background: linear-gradient(135deg, #7255e0, #a78bfa); color: #fff; box-shadow: 0 3px 10px rgba(135, 116, 225, 0.4); }
/* full-color TON coin needs no tinted plate behind it */
.stat-ic.plain { background: none; }
.stat-ic.plain svg { width: 26px; height: 26px; }
.stat-val { font-size: 14px; font-weight: 700; letter-spacing: 0; }
.stat-label { font-size: 11px; color: var(--hint); font-weight: 600; }

/* ============ STEPS ============ */
.steps-card { display: flex; flex-direction: column; gap: 14px; }
.step { display: flex; gap: 12px; align-items: flex-start; }
.step-num {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: rgba(0, 152, 234, 0.14);
  color: var(--accent-2);
  font-size: 13px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.step b { display: block; font-size: 14px; }
.step span { font-size: 12.5px; color: var(--hint); }

/* ============ SEGMENTED CONTROL ============ */
.seg {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 13px;
  padding: 4px;
}
.seg-btn {
  position: relative; z-index: 1;
  display: flex; align-items: center; justify-content: center; gap: 7px;
  padding: 10px;
  font-weight: 700; font-size: 13.5px;
  color: var(--hint);
  border-radius: 10px;
  transition: color 0.25s;
}
.seg-btn svg { width: 16px; height: 16px; }
.seg-btn.active { color: #fff; }
.seg-glider {
  position: absolute;
  top: 4px; left: 4px;
  width: calc(50% - 4px); height: calc(100% - 8px);
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}
.seg-glider.right { transform: translateX(100%); }

/* ============ TASKS ============ */
.task-list { display: flex; flex-direction: column; gap: 10px; }
.task-list.hidden { display: none; }

.task {
  display: flex; align-items: center; gap: 12px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 13px 14px;
  animation: pageIn 0.3s cubic-bezier(0.22, 1, 0.36, 1) backwards;
}
.task:nth-child(1) { animation-delay: 0.02s; }
.task:nth-child(2) { animation-delay: 0.06s; }
.task:nth-child(3) { animation-delay: 0.1s; }
.task:nth-child(4) { animation-delay: 0.14s; }
.task:nth-child(5) { animation-delay: 0.18s; }

.task-info { flex: 1; min-width: 0; }
.task-title { font-weight: 700; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.task-reward { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; color: var(--green); font-weight: 700; margin-top: 2px; }
.task-reward svg { width: 13px; height: 13px; }

.task .btn.small.checking { background: var(--card-2); color: var(--hint); pointer-events: none; }

.spinner {
  width: 14px; height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-top-color: var(--accent-2);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============ INVITE ============ */
.invite-hero { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 22px 16px 16px; gap: 4px; }

.invite-art { position: relative; width: 92px; height: 92px; margin-bottom: 8px; }
.invite-people {
  width: 60px; height: 60px;
  color: var(--accent-2);
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
}
.invite-coin {
  position: absolute;
  width: 28px; height: 28px;
  border-radius: 50%;
  box-shadow: 0 4px 12px rgba(0, 152, 234, 0.4);
}
.invite-coin svg { width: 100%; height: 100%; }
.invite-coin.c1 { top: 0; right: 2px; animation: coinFloat 3s ease-in-out infinite; }
.invite-coin.c2 { bottom: 4px; left: 0; width: 22px; height: 22px; animation: coinFloat 3s ease-in-out 0.8s infinite; }
@keyframes coinFloat { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }

.invite-headline { font-size: 15.5px; font-weight: 700; letter-spacing: 0; }
.invite-headline b { color: var(--accent-2); }
.invite-subline { font-size: 13px; color: var(--hint); }

.ref-box {
  display: flex; align-items: center; gap: 8px;
  width: 100%;
  background: var(--bg);
  border: 1px dashed rgba(0, 152, 234, 0.4);
  border-radius: 12px;
  padding: 10px 8px 10px 14px;
  margin: 14px 0 10px;
}
.ref-link { flex: 1; font-size: 13px; font-weight: 600; color: var(--accent-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: left; }
.ref-copy {
  width: 34px; height: 34px;
  border-radius: 9px;
  background: rgba(0, 152, 234, 0.14);
  color: var(--accent-2);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: transform 0.15s ease, background 0.2s, color 0.2s;
}
.ref-copy:active { transform: scale(0.9); }
.ref-copy.copied { background: rgba(49, 209, 88, 0.15); color: var(--green); }
.ref-copy svg { width: 16px; height: 16px; }

.friend {
  display: flex; align-items: center; gap: 12px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 11px 13px;
  margin-bottom: 8px;
}
.friend-ava {
  width: 38px; height: 38px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 14px; color: #fff;
  flex-shrink: 0;
}
.friend-name { font-weight: 700; font-size: 14px; }
.friend-date { font-size: 11.5px; color: var(--hint); }
.friend-earn { margin-left: auto; font-size: 13px; font-weight: 700; color: var(--green); }

/* ============ EMPTY STATE ============ */
.empty-state {
  display: flex; flex-direction: column; align-items: center;
  text-align: center;
  gap: 4px;
  padding: 26px 16px;
  background: var(--card);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  color: var(--hint);
}
.empty-state svg { width: 34px; height: 34px; margin-bottom: 6px; opacity: 0.6; }
.empty-state b { color: var(--text); font-size: 14px; }
.empty-state span { font-size: 12.5px; }

/* ============ PROFILE ============ */
.profile-head { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 10px 0 2px; gap: 3px; }
.avatar {
  width: 74px; height: 74px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--violet));
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; font-weight: 800; color: #fff;
  margin-bottom: 6px;
  box-shadow: 0 8px 24px rgba(0, 152, 234, 0.3);
}
.profile-name { font-size: 19px; font-weight: 800; }
.profile-id { font-size: 12.5px; color: var(--hint); font-weight: 600; }

.wallet-card { padding: 0; overflow: hidden; }
.wc-top { padding: 16px; background: linear-gradient(135deg, rgba(0, 152, 234, 0.12), rgba(0, 194, 255, 0.05)); border-bottom: 1px solid var(--border); }
.wc-label { font-size: 12px; color: var(--hint); font-weight: 600; text-transform: uppercase; letter-spacing: 0.6px; }
.wc-amount { font-size: 21px; font-weight: 700; letter-spacing: 0; margin-top: 4px; }
.wc-usd { font-size: 12.5px; color: var(--hint); font-weight: 600; }
.wc-form { padding: 14px; display: flex; flex-direction: column; gap: 12px; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-size: 12.5px; font-weight: 700; color: var(--hint); }
.field-label em { font-style: normal; font-weight: 500; opacity: 0.8; }
.field-box {
  display: flex; align-items: center; gap: 9px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0 12px;
  transition: border-color 0.2s;
}
.field-box:focus-within { border-color: var(--accent); }
.field-box svg { width: 16px; height: 16px; color: var(--hint); flex-shrink: 0; }
.field-box input {
  flex: 1; min-width: 0;
  background: none; border: none; outline: none;
  color: var(--text);
  font-size: 14px; font-weight: 600;
  padding: 12px 0;
  font-family: inherit;
}
.field-box input::placeholder { color: rgba(125, 139, 153, 0.6); }
.max-btn {
  font-size: 11px; font-weight: 800;
  color: var(--accent-2);
  background: rgba(0, 152, 234, 0.14);
  padding: 5px 9px;
  border-radius: 7px;
  flex-shrink: 0;
  transition: transform 0.15s ease;
}
.max-btn:active { transform: scale(0.92); }

.fee-note { font-size: 11.5px; color: var(--hint); text-align: center; }

.history-item {
  display: flex; align-items: center; gap: 12px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 13px;
  margin-bottom: 8px;
}
.history-item .icon-tile { width: 36px; height: 36px; border-radius: 11px; }
.history-item .icon-tile svg { width: 18px; height: 18px; }
.h-info { flex: 1; min-width: 0; }
.h-addr { font-weight: 700; font-size: 13.5px; }
.h-date { font-size: 11.5px; color: var(--hint); }
.h-right { text-align: right; }
.h-amount { font-weight: 800; font-size: 14px; }
.h-status { font-size: 11px; font-weight: 700; }
.h-status.pending { color: var(--amber); }
.h-status.done { color: var(--green); }

.links-card { padding: 4px; }
.link-row {
  display: flex; align-items: center; gap: 12px;
  width: 100%;
  padding: 11px 10px;
  border-radius: 12px;
  font-size: 14.5px; font-weight: 600;
  text-align: left;
  transition: background 0.2s;
}
.link-row:active { background: var(--card-2); }
.link-row span { flex: 1; }
.link-row .chev { width: 16px; height: 16px; color: var(--hint); }

.version-tag { text-align: center; font-size: 11.5px; color: var(--hint); opacity: 0.7; padding: 4px 0 8px; }

/* ============ BOTTOM NAV ============ */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: var(--nav-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--border);
  z-index: 50;
}

.nav-btn {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px;
  color: var(--hint);
  font-size: 11px; font-weight: 800;
  transition: color 0.25s;
  position: relative;
}
.nav-btn svg { width: 23px; height: 23px; transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1); }
/* each tab gets its own colour */
.nav-btn[data-page="home"].active { color: #00c2ff; }
.nav-btn[data-page="earn"].active { color: #4ade80; }
.nav-btn[data-page="invite"].active { color: #a78bfa; }
.nav-btn[data-page="profile"].active { color: #fbbf24; }
.nav-btn.active svg { transform: translateY(-2px) scale(1.12); filter: drop-shadow(0 3px 7px currentColor); }
.nav-btn.active::before {
  content: "";
  position: absolute;
  top: 0; left: 50%;
  transform: translateX(-50%);
  width: 26px; height: 3px;
  border-radius: 0 0 4px 4px;
  background: currentColor;
  animation: navGlow 0.3s ease;
}
@keyframes navGlow { from { width: 0; opacity: 0; } to { width: 26px; opacity: 1; } }

/* ============ MODALS ============ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(5, 10, 16, 0.7);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  animation: fadeIn 0.22s ease;
}
.modal-backdrop.hidden { display: none; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
  width: 100%; max-width: 360px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 22px;
  overflow: hidden;
  animation: popIn 0.3s cubic-bezier(0.22, 1.4, 0.36, 1);
  box-shadow: var(--shadow);
}
@keyframes popIn { from { opacity: 0; transform: scale(0.88); } to { opacity: 1; transform: scale(1); } }

/* ad modal */
.ad-screen { position: relative; background: linear-gradient(160deg, #101c29, #182a3d); padding: 34px 20px 22px; display: flex; flex-direction: column; align-items: center; gap: 18px; }
.ad-tag {
  position: absolute; top: 12px; left: 12px;
  font-size: 10px; font-weight: 800; letter-spacing: 1px;
  color: var(--hint);
  border: 1px solid var(--border);
  padding: 3px 8px;
  border-radius: 6px;
  text-transform: uppercase;
}
.ad-fake-content { display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; }
.ad-logo-pulse {
  width: 62px; height: 62px;
  border-radius: 18px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 8px;
  animation: adPulse 1.6s ease-in-out infinite;
}
.ad-logo-pulse svg { width: 30px; height: 30px; }
@keyframes adPulse { 0%,100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(0,152,234,0.4); } 50% { transform: scale(1.05); box-shadow: 0 0 0 14px rgba(0,152,234,0); } }
.ad-fake-title { font-weight: 800; font-size: 16px; }
.ad-fake-sub { font-size: 12.5px; color: var(--hint); }

.ad-timer { position: relative; width: 44px; height: 44px; }
.ad-timer svg { width: 44px; height: 44px; transform: rotate(-90deg); }
.ad-timer span { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 800; }
.ring-bg { fill: none; stroke: rgba(255, 255, 255, 0.08); stroke-width: 3.5; }
.ring-fg {
  fill: none;
  stroke: var(--accent-2);
  stroke-width: 3.5;
  stroke-linecap: round;
  stroke-dasharray: 119.4;
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 1s linear;
}

.ad-reward { padding: 26px 20px 20px; display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; }
.ad-reward.hidden { display: none; }
.reward-burst {
  width: 66px; height: 66px;
  border-radius: 50%;
  background: rgba(48, 161, 245, 0.13);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 10px;
  animation: rewardPop 0.5s cubic-bezier(0.22, 1.6, 0.36, 1);
}
.reward-burst svg { width: 46px; height: 46px; filter: drop-shadow(0 3px 8px rgba(48, 161, 245, 0.45)); }
@keyframes rewardPop { from { transform: scale(0); } to { transform: scale(1); } }
.reward-title { font-size: 21px; font-weight: 700; color: var(--green); letter-spacing: 0; }
.reward-sub { font-size: 13px; color: var(--hint); margin-bottom: 14px; }

/* sheet */
.modal-backdrop:has(.sheet) { align-items: flex-end; padding: 0; }
.sheet {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  background: var(--card);
  border-radius: 22px 22px 0 0;
  padding: 10px 18px calc(18px + env(safe-area-inset-bottom));
  animation: sheetUp 0.32s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes sheetUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
.sheet-grip { width: 38px; height: 4px; border-radius: 100px; background: var(--border); margin: 0 auto 14px; }
.sheet-title { font-size: 15px; font-weight: 700; text-align: center; margin-bottom: 14px; }

.confirm-rows { display: flex; flex-direction: column; gap: 2px; margin-bottom: 16px; }
.c-row { display: flex; justify-content: space-between; align-items: center; padding: 9px 2px; font-size: 14px; color: var(--hint); }
.c-row b { color: var(--text); font-weight: 700; max-width: 60%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.c-row.total { border-top: 1px solid var(--border); margin-top: 4px; padding-top: 12px; }
.c-row.total b { color: var(--green); font-size: 16px; }
.sheet .btn.ghost { margin-top: 6px; }

/* ============ TOASTS ============ */
.toast-wrap {
  position: fixed;
  top: calc(58px + env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  display: flex; flex-direction: column; align-items: center;
  gap: 8px;
  width: max-content;
  max-width: 92vw;
  pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 8px;
  background: var(--card-2);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 13.5px; font-weight: 600;
  padding: 10px 16px;
  border-radius: 100px;
  box-shadow: var(--shadow);
  animation: toastIn 0.35s cubic-bezier(0.22, 1.4, 0.36, 1);
}
.toast.out { animation: toastOut 0.3s ease forwards; }
.toast svg { width: 16px; height: 16px; flex-shrink: 0; }
.toast.success svg { color: var(--green); }
.toast.error svg { color: var(--red); }
@keyframes toastIn { from { opacity: 0; transform: translateY(-14px) scale(0.9); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(-10px) scale(0.92); } }

/* floating reward */
.float-reward {
  position: fixed;
  z-index: 300;
  font-size: 15px; font-weight: 800;
  color: var(--green);
  pointer-events: none;
  animation: floatUp 1.1s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}
@keyframes floatUp { from { opacity: 1; transform: translateY(0); } to { opacity: 0; transform: translateY(-46px); } }

/* reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
  .ticker-track { animation: none; }
}
