/* ---------- Compact Telegram Mini App viewport ----------
   Keep the game dense without placing content underneath Telegram's chrome.
 */

html,
body {
  min-height: 100%;
  min-height: var(--tg-viewport-stable-height, 100vh);
}

.topbar {
  position: relative;
  z-index: 2;
}

body {
  padding-bottom: calc(78px + env(safe-area-inset-bottom, 0px));
}

.tabbar {
  bottom: env(safe-area-inset-bottom, 0px);
  padding-bottom: 8px;
}

@media (max-width: 600px) and (max-height: 760px) {
  body { padding-bottom: calc(78px + env(safe-area-inset-bottom, 0px)); }
  .topbar { padding: 7px 10px; }
  .balance-chip, .stats-chip { padding: 5px 9px; font-size: 12px; }
  .identity-banner { padding: 5px 10px; font-size: 11px; }
  #panel-game { padding: 7px 12px 6px; }
  .betting-label { font-size: 12px; margin-bottom: 1px; }
  .ring-wrap { width: 166px; height: 166px; margin: 3px auto 2px; }
  .countdown { font-size: 29px; }
  .ring-label { font-size: 10px; margin-top: 1px; }
  .entry-price { font-size: 10px; margin-top: 1px; margin-bottom: 5px; }
  .pools-bar { height: 7px; margin-bottom: 4px; }
  .pools-legend { font-size: 10px; margin-bottom: 7px; }
  .direction-row { gap: 7px; margin-bottom: 2px; }
  .dir-btn { padding: 8px 6px; border-radius: 11px; font-size: 12px; gap: 2px; }
  .dir-btn .dir-icon { font-size: 18px; }
  .amount-row { margin-top: 7px; }
}

@media (max-width: 600px) and (max-height: 640px) {
  #panel-game { padding-top: 4px; }
  .ring-wrap { width: 146px; height: 146px; margin-top: 2px; }
  .countdown { font-size: 26px; }
  .entry-price { margin-bottom: 4px; }
  .pools-legend { margin-bottom: 5px; }
  .dir-btn { padding: 7px 5px; }
}

/* ---------- Wallet deposit UI ---------- */
.deposit-section { margin-bottom: 18px; }
.wallet-section-title { font-family: var(--font-display); font-size: 17px; font-weight: 700; margin-bottom: 4px; }
.wallet-section-subtitle { color: var(--text-secondary); font-size: 12px; margin-bottom: 12px; }
.deposit-connect-card, .manual-deposit-card { background: var(--bg-surface); border: 1px solid var(--border); border-radius: 14px; padding: 14px; }
.deposit-method-title { font-size: 14px; font-weight: 700; margin-bottom: 6px; }
.deposit-method-note { color: var(--text-secondary); font-size: 11px; line-height: 1.7; margin-bottom: 12px; }
.deposit-or { display: flex; align-items: center; gap: 10px; color: var(--text-secondary); font-size: 11px; margin: 14px 0; }
.deposit-or::before, .deposit-or::after { content: ""; flex: 1; border-bottom: 1px solid var(--border); }
.manual-deposit-card { border-color: rgba(240, 180, 41, 0.35); }
.deposit-field-label { color: var(--text-secondary); font-size: 11px; margin-bottom: 6px; }
.copy-field-row { display: flex; align-items: center; gap: 8px; direction: ltr; margin-bottom: 12px; }
.copy-field-row code { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; background: var(--bg-surface-2); border: 1px solid var(--border); border-radius: 9px; padding: 10px; color: var(--text-primary); font-family: var(--font-mono); font-size: 11px; text-align: left; }
.copy-btn { flex: 0 0 auto; border: 1px solid var(--border); border-radius: 9px; background: var(--bg-surface-2); color: var(--text-primary); padding: 9px 10px; font-family: var(--font-body); font-size: 11px; cursor: pointer; }
.copy-btn:active { transform: scale(0.98); }
.deposit-warning { background: rgba(240, 180, 41, 0.08); border: 1px solid rgba(240, 180, 41, 0.35); border-radius: 10px; color: var(--text-secondary); font-size: 11px; line-height: 1.8; padding: 10px; }
.deposit-warning strong { color: var(--gold); }

/* ---------- Referral / Affiliate UI ---------- */
.ref-link-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  margin-top: 14px;
}

.ref-card-title {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 10px;
}

.ref-link-card .cta-btn {
  width: 100%;
  margin-top: 2px;
}

#refHistory .ref-total-box {
  margin-top: 12px;
  line-height: 2;
  text-align: right;
}

@media (max-width: 380px) {
  .copy-field-row { gap: 5px; }
  .copy-btn { padding: 9px 7px; font-size: 10px; }
}
