:root {
  --bg-page: #121318;
  --bg-card: #1c1e26;
  --bg-elevated: #252833;
  --tg-blue: #2481cc;
  --tg-blue-hover: #1d70b5;
  --tg-blue-soft: rgba(36, 129, 204, 0.14);
  --tg-blue-text: #4da6ff;
  --emerald: #2ebd85;
  --emerald-soft: rgba(46, 189, 133, 0.14);
  --amber: #f0b90b;
  --amber-soft: rgba(240, 185, 11, 0.14);
  --danger: #f6465d;
  --text-primary: #f5f6f8;
  --text-secondary: #8c93a4;
  --border-subtle: rgba(255, 255, 255, 0.07);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Inter', 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-page);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  padding-bottom: 88px;
  -webkit-font-smoothing: antialiased;
}

body.rtl {
  direction: rtl;
}

.app-container {
  max-width: 440px;
  margin: 0 auto;
  padding: 14px 16px;
}

/* Subtle Native Toast */
.toast-container {
  position: fixed;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 999;
  width: 92%;
  max-width: 400px;
  pointer-events: none;
}

.cyber-toast {
  background: #232631;
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-primary);
  padding: 12px 15px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  animation: fadeSlide 0.2s ease-out;
}

@keyframes fadeSlide {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Header */
.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  gap: 8px;
}

.user-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
}

.badge-unverified {
  background: rgba(255, 255, 255, 0.07);
  color: var(--text-secondary);
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}

.badge-verified {
  background: var(--tg-blue-soft);
  color: var(--tg-blue-text);
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.lang-btn {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  padding: 7px 11px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.wallet-btn {
  background: var(--tg-blue);
  color: #fff;
  border: none;
  padding: 7px 13px;
  border-radius: 10px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}

/* Portfolio / Balance Card (Telegram Wallet Style) */
.balance-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 14px;
}

.balance-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.balance-label {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
  margin-bottom: 3px;
}

.balance-main {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: baseline;
  gap: 5px;
  letter-spacing: -0.4px;
}

.balance-main span.ton-unit {
  font-size: 15px;
  color: var(--text-secondary);
  font-weight: 600;
}

.balance-sub-pills {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  font-size: 12px;
}

.sub-pill {
  background: var(--bg-elevated);
  padding: 7px 10px;
  border-radius: 10px;
  color: var(--text-secondary);
  flex: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.sub-pill b {
  color: var(--text-primary);
  font-weight: 600;
}

.withdraw-btn {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 9px 14px;
  border-radius: 10px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}

.progress-wrap {
  background: var(--bg-elevated);
  height: 6px;
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 7px;
}

.progress-fill {
  height: 100%;
  background: var(--tg-blue);
  border-radius: 999px;
  transition: width 0.35s ease;
}

.progress-caption {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-secondary);
}

.progress-caption b {
  color: var(--text-primary);
  font-weight: 600;
}

/* Cards & Sections */
.mines-card,
.vault-hero,
.bluetick-card,
.feed-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 12px;
}

.vault-hero {
  text-align: center;
}

.vault-tag {
  display: inline-block;
  background: var(--tg-blue-soft);
  color: var(--tg-blue-text);
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 8px;
  margin-bottom: 8px;
}

.vault-pot {
  font-size: 34px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 4px 0;
  letter-spacing: -0.5px;
}

.vault-pot span.unit {
  font-size: 17px;
  color: var(--text-secondary);
  font-weight: 600;
}

.vault-timer-box {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-elevated);
  padding: 6px 14px;
  border-radius: 10px;
  margin: 8px 0;
  font-size: 13px;
  color: var(--text-secondary);
}

.vault-timer-box.urgent {
  background: rgba(246, 70, 93, 0.14);
  color: var(--danger);
}

.timer-digits {
  font-variant-numeric: tabular-nums;
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}

.leader-banner {
  background: var(--bg-elevated);
  border-radius: 10px;
  padding: 10px 12px;
  margin: 10px 0 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12.5px;
}

.leader-banner.is-you {
  background: var(--emerald-soft);
  border: 1px solid rgba(46, 189, 133, 0.35);
}

.leader-name {
  font-weight: 600;
  color: var(--text-primary);
}

.cta-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.btn-snipe-ton,
.btn-primary-wide {
  background: var(--tg-blue);
  color: #fff;
  border: none;
  padding: 12px 12px;
  border-radius: 12px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
  transition: background 0.15s ease;
}

.btn-snipe-ton:active,
.btn-primary-wide:active {
  background: var(--tg-blue-hover);
}

.btn-snipe-stars {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid rgba(255, 255, 255, 0.09);
  padding: 12px 12px;
  border-radius: 12px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
}

.btn-bundle-wide {
  margin-top: 8px;
  width: 100%;
  background: var(--tg-blue-soft);
  border: none;
  color: var(--tg-blue-text);
  padding: 11px;
  border-radius: 12px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}

.btn-cashout-wide {
  width: 100%;
  background: var(--emerald);
  color: #fff;
  border: none;
  padding: 13px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

/* Segmented Controls (iOS / Telegram style) */
.mode-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  background: var(--bg-page);
  padding: 3px;
  border-radius: 10px;
  margin-bottom: 10px;
}

.mode-btn {
  background: transparent;
  color: var(--text-secondary);
  border: none;
  padding: 8px 8px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}

.mode-btn.active {
  background: var(--bg-elevated);
  color: var(--text-primary);
}

.laser-selector-row {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
}

.laser-chip {
  flex: 1;
  background: var(--bg-elevated);
  border: 1px solid transparent;
  color: var(--text-secondary);
  padding: 7px 6px;
  border-radius: 9px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.laser-chip.active {
  border-color: var(--tg-blue);
  color: var(--tg-blue-text);
  background: var(--tg-blue-soft);
}

/* Multiplier Strip */
.mult-strip {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 4px;
  margin-bottom: 10px;
  scrollbar-width: none;
}

.mult-strip::-webkit-scrollbar {
  display: none;
}

.mult-pill {
  background: var(--bg-page);
  padding: 5px 9px;
  border-radius: 8px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
}

.mult-pill.current {
  background: var(--emerald-soft);
  color: var(--emerald);
}

/* 5x5 Grid */
.mines-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 7px;
  margin: 10px 0 14px;
}

.mine-cell {
  aspect-ratio: 1;
  background: var(--bg-elevated);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  cursor: pointer;
  transition: transform 0.1s ease, background 0.15s ease;
}

.mine-cell:active {
  transform: scale(0.95);
}

.mine-cell.safe {
  background: var(--emerald-soft);
  border-color: rgba(46, 189, 133, 0.45);
}

.mine-cell.laser {
  background: rgba(246, 70, 93, 0.18);
  border-color: rgba(246, 70, 93, 0.45);
}

/* Feed Items */
.feed-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
}

.feed-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 9px 0;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 12.5px;
}

.feed-item:last-child {
  border-bottom: none;
}

.task-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-subtle);
}

.task-row:last-child {
  border-bottom: none;
}

.task-claim-btn {
  background: var(--tg-blue-soft);
  border: none;
  color: var(--tg-blue-text);
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.task-claim-btn.done {
  background: var(--emerald-soft);
  color: var(--emerald);
  cursor: default;
}

/* Bottom Navigation (Native Telegram / iOS Style) */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  max-width: 440px;
  margin: 0 auto;
  background: rgba(24, 26, 33, 0.94);
  backdrop-filter: blur(16px);
  border-top: 1px solid var(--border-subtle);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  padding: 8px 10px 14px;
  z-index: 90;
}

.nav-item {
  background: none;
  border: none;
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}

.nav-item.active {
  color: var(--tg-blue-text);
}

.nav-icon {
  font-size: 19px;
}

/* Modals */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 200;
}

.modal-box {
  background: var(--bg-card);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 18px;
  max-width: 380px;
  width: 100%;
  padding: 20px 18px;
  text-align: center;
}

.lang-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  max-height: 310px;
  overflow-y: auto;
  margin: 10px 0 14px;
}

.lang-option-item {
  background: var(--bg-elevated);
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 8px 10px;
  display: flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
}

.lang-option-item.active {
  border-color: var(--tg-blue);
  background: var(--tg-blue-soft);
}

.hidden {
  display: none !important;
}
