/* ========================================================
   FisNumbers - Premium Telegram Mini App Stylesheet
   Design aesthetic inspired by DavidHDev/rbp-portfolio
   Libre Caslon Condensed + Outfit + JetBrains Mono
   ======================================================== */

@import url('https://fonts.googleapis.com/css2?family=Libre+Caslon+Condensed:ital,wght@0,400;0,700;1,400&family=Outfit:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500;700&display=swap');

:root {
  --bg-primary: #08090C;
  --bg-secondary: #0D1017;
  --bg-card: #121622;
  --bg-card-hover: #181D2C;
  --bg-island: rgba(13, 16, 23, 0.94);
  
  --primary-blue: #2563EB;
  --primary-blue-glow: rgba(37, 99, 235, 0.4);
  --primary-blue-dark: #1D4ED8;
  --accent-cyan: #06B6D4;
  
  --text-main: #FFFFFF;
  --text-muted: #8E9BAE;
  --text-sub: #5E6C84;
  
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-highlight: rgba(255, 255, 255, 0.16);
  
  /* 7 Rarity Color Palette */
  --rarity-0: #8E8E93; /* trash */
  --rarity-1: #E5E7EB; /* common */
  --rarity-2: #10B981; /* uncommon */
  --rarity-3: #3B82F6; /* rare */
  --rarity-4: #A855F7; /* epic */
  --rarity-5: #F59E0B; /* legendary */
  --rarity-6: #EF4444; /* mythic */
  --rarity-7: #06B6D4; /* secret */

  --rarity-trash: #8E8E93;
  --rarity-common: #E5E7EB;
  --rarity-uncommon: #10B981;
  --rarity-rare: #3B82F6;
  --rarity-epic: #A855F7;
  --rarity-legendary: #F59E0B;
  --rarity-mythic: #EF4444;
  --rarity-secret: #06B6D4;

  --safe-bottom: env(safe-area-inset-bottom, 16px);
  --font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-serif: 'Libre Caslon Condensed', Georgia, serif;
  --font-mono: 'JetBrains Mono', Courier, monospace;
}

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

body {
  background-color: var(--bg-primary);
  color: var(--text-main);
  font-family: var(--font-family);
  font-size: 15px;
  line-height: 1.4;
  overflow-x: hidden;
  min-height: 100vh;
  padding-bottom: calc(80px + var(--safe-bottom));
  -webkit-font-smoothing: antialiased;
}

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

/* ================= HEADER ================= */
.top-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-subtle);
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.user-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.avatar-circle {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, #1D4ED8, #3B82F6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  color: #fff;
  border: 1.5px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 2px 10px rgba(37, 99, 235, 0.3);
}

.avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.user-info-text {
  display: flex;
  flex-direction: column;
}

.user-name {
  font-weight: 600;
  font-size: 14px;
  max-width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.level-pill {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--text-muted);
}

.lvl-txt {
  background: rgba(37, 99, 235, 0.18);
  color: #60A5FA;
  padding: 1px 5px;
  border-radius: 6px;
  font-weight: 700;
}

.xp-ratio {
  font-size: 10px;
  color: var(--text-sub);
}

/* Header Mode Badge */
.header-mode-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-main);
  letter-spacing: 0.02em;
}

.mode-icon {
  font-size: 13px;
}

.balance-container {
  display: flex;
  align-items: center;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  padding: 4px 6px 4px 10px;
  gap: 6px;
}

.balance-icon {
  width: 18px;
  height: 18px;
  color: #F59E0B;
  display: flex;
  align-items: center;
}

.balance-amount {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 17px;
  letter-spacing: 0.02em;
  color: #FFFFFF;
}

.btn-quick-transfer {
  background: var(--primary-blue);
  border: none;
  border-radius: 50%;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  cursor: pointer;
  transition: transform 0.15s ease;
}

.btn-quick-transfer:active {
  transform: scale(0.9);
}

/* ================= MAIN VIEWPORT & TABS ================= */
.main-viewport {
  flex: 1;
  padding: 12px 16px;
}

.tab-pane {
  display: none;
}

.tab-pane.active {
  display: block;
}

.section-title-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.section-title-bar h2 {
  font-family: var(--font-serif);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.section-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 1px;
}

.network-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.25);
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 11px;
  color: #10B981;
  font-weight: 600;
}

.pulse-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #10B981;
  box-shadow: 0 0 6px #10B981;
  animation: pulseGreen 1.5s infinite;
}

@keyframes pulseGreen {
  0% { transform: scale(0.9); opacity: 0.7; }
  50% { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(0.9); opacity: 0.7; }
}

/* ================= 1. GAME TAB (UNBOXING STAGE) ================= */
.game-top-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.tier-badge-pill {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  padding: 4px 10px;
  border-radius: 12px;
}

.game-stage-wrapper {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* 7 Rarity Bars & Count-Up */
.rarity-status-container {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.rarity-header-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.rarity-stage-title {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  transition: color 0.3s ease, text-shadow 0.3s ease;
}

.rarity-stage-price {
  font-family: var(--font-serif);
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: var(--text-main);
  transition: color 0.3s ease, text-shadow 0.3s ease;
}

.rarity-bars-track {
  display: flex;
  gap: 6px;
  width: 100%;
  height: 6px;
}

.r-bar {
  flex: 1;
  height: 100%;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.08);
  transition: background-color 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s ease, transform 0.2s ease;
}

.r-bar.active {
  box-shadow: 0 0 10px currentColor;
  transform: scaleY(1.3);
}

/* 8th Secret Bar: Erupts when rarity exceeds 7 */
.r-bar.secret-bar {
  background: #00F5D4 !important;
  box-shadow: 0 0 16px rgba(0, 245, 212, 0.9), 0 0 30px rgba(0, 245, 212, 0.4) !important;
  animation: secretBarAppear 0.45s cubic-bezier(0.16, 1, 0.3, 1), secretBarGlow 1s infinite alternate !important;
}

@keyframes secretBarAppear {
  0% {
    opacity: 0;
    transform: scaleX(0) scaleY(0.4);
    filter: brightness(2.5);
  }
  60% {
    opacity: 1;
    transform: scaleX(1.25) scaleY(1.5);
    filter: brightness(3);
  }
  100% {
    opacity: 1;
    transform: scaleX(1) scaleY(1.3);
    filter: brightness(1);
  }
}

@keyframes secretBarGlow {
  from {
    box-shadow: 0 0 12px #00F5D4, 0 0 20px rgba(0, 245, 212, 0.5);
    filter: hue-rotate(0deg);
  }
  to {
    box-shadow: 0 0 22px #00F5D4, 0 0 35px rgba(0, 245, 212, 0.9);
    filter: hue-rotate(25deg);
  }
}

/* Main Box with Number */
.main-number-box {
  position: relative;
  background: radial-gradient(circle at 50% 25%, rgba(37, 99, 235, 0.12), rgba(13, 16, 23, 0.95));
  border: 1.5px solid var(--border-subtle);
  border-radius: 20px;
  min-height: 180px;
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.6);
  cursor: pointer;
  overflow: hidden;
  transition: border-color 0.3s ease, box-shadow 0.3s ease, transform 0.15s ease;
}

.main-number-box:active {
  transform: scale(0.99);
}

.box-skip-hint {
  position: absolute;
  top: 10px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 20px;
  padding: 3px 10px;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.03em;
  animation: pulseHint 1.5s infinite alternate;
}

@keyframes pulseHint {
  from { opacity: 0.7; }
  to { opacity: 1; }
}

.box-rare-lock {
  position: absolute;
  top: 10px;
  background: rgba(239, 68, 68, 0.18);
  border: 1px solid rgba(239, 68, 68, 0.5);
  border-radius: 20px;
  padding: 3px 12px;
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  font-weight: 800;
  color: #EF4444;
  letter-spacing: 0.05em;
  box-shadow: 0 0 14px rgba(239, 68, 68, 0.35);
  animation: rareGlow 1.2s infinite alternate;
}

@keyframes rareGlow {
  from { box-shadow: 0 0 8px rgba(239, 68, 68, 0.2); }
  to { box-shadow: 0 0 18px rgba(239, 68, 68, 0.6); }
}

.svg-lock {
  width: 12px;
  height: 12px;
}

/* Number Reveal Animations */
.number-display-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 56px;
  width: 100%;
}

.reveal-digits-row {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 1px;
  font-family: var(--font-serif);
  font-size: 38px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #FFFFFF;
}

.placeholder-code {
  font-family: var(--font-serif);
  font-size: 34px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.22);
  letter-spacing: 0.05em;
}

.anim-char {
  display: inline-block;
  opacity: 0;
  transform: translateY(24px);
  filter: blur(8px);
  transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1), filter 0.22s ease-out, opacity 0.22s ease-out;
  will-change: transform, filter, opacity;
}

.anim-char.revealed {
  opacity: 1;
  transform: translateY(0);
  filter: blur(0);
}

.anim-char.space {
  width: 9px;
  opacity: 1;
  transform: none;
  filter: none;
}

.anim-char.scrambling {
  color: #60A5FA;
}

/* Realistic Russian Plate Display inside Main Box */
.box-plate-plate {
  display: flex;
  align-items: center;
  background: #FFFFFF;
  color: #000000;
  border: 3px solid #000000;
  border-radius: 8px;
  padding: 4px 14px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
}

.box-plate-main {
  font-family: var(--font-serif);
  font-size: 32px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.box-plate-reg {
  display: flex;
  flex-direction: column;
  align-items: center;
  border-left: 2px solid #000000;
  padding-left: 8px;
  margin-left: 10px;
  line-height: 1;
}

.box-plate-reg-num {
  font-family: var(--font-serif);
  font-size: 22px;
  font-weight: 700;
}

.box-plate-reg-ru {
  font-family: var(--font-family);
  font-size: 9px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 3px;
  margin-top: 2px;
}

/* Pattern Tag */
.box-pattern-row {
  display: flex;
  justify-content: center;
}

.pattern-badge {
  background: rgba(37, 99, 235, 0.12);
  color: #93C5FD;
  border: 1px solid rgba(37, 99, 235, 0.25);
  padding: 4px 12px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

/* Action Buttons (Buy & Dual Sell/Keep) */
.game-action-buttons-wrap {
  width: 100%;
}

.btn-main-buy {
  width: 100%;
  height: 56px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: linear-gradient(135deg, #1D4ED8 0%, #2563EB 50%, #3B82F6 100%);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.04em;
  box-shadow: 0 8px 24px rgba(37, 99, 235, 0.4);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.2s ease;
}

.btn-main-buy:active {
  transform: scale(0.98);
}

.btn-buy-price {
  font-family: var(--font-serif);
  font-size: 20px;
  font-weight: 700;
  background: rgba(0, 0, 0, 0.25);
  padding: 4px 12px;
  border-radius: 10px;
}

.revealed-dual-actions {
  display: flex;
  gap: 10px;
  width: 100%;
}

.btn-dual-action {
  flex: 1;
  height: 56px;
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.12);
  transition: transform 0.15s ease;
}

.btn-dual-action:active {
  transform: scale(0.98);
}

.btn-dual-action.sell {
  background: linear-gradient(135deg, #B91C1C 0%, #DC2626 50%, #EF4444 100%);
  color: #FFFFFF;
  box-shadow: 0 8px 24px rgba(220, 38, 38, 0.35);
}

.btn-dual-action.keep {
  background: linear-gradient(135deg, #059669 0%, #10B981 50%, #34D399 100%);
  color: #FFFFFF;
  box-shadow: 0 8px 24px rgba(16, 185, 129, 0.35);
}

.dual-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  opacity: 0.9;
}

.dual-value {
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 700;
}

/* Tier Selector Pills Track */
.tier-selector-container {
  width: 100%;
}

.tier-selector-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--text-sub);
  margin-bottom: 6px;
  text-transform: uppercase;
}

.tier-pills-track {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
}

.tier-pills-track::-webkit-scrollbar {
  display: none;
}

.tier-pill-btn {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  min-width: 82px;
}

.tier-pill-btn.active {
  background: rgba(37, 99, 235, 0.15);
  border-color: var(--primary-blue);
  color: #FFFFFF;
  box-shadow: 0 0 16px rgba(37, 99, 235, 0.25);
}

.tier-pill-btn.locked {
  opacity: 0.5;
  cursor: not-allowed;
}

.tier-pill-name {
  font-size: 12px;
  font-weight: 600;
}

.tier-pill-price {
  font-family: var(--font-serif);
  font-size: 14px;
  font-weight: 700;
  color: #60A5FA;
  margin-top: 2px;
}

/* ================= 2. INVENTORY TAB ================= */
.inventory-quick-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.btn-inv-bulk {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  padding: 7px 12px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.inventory-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.inv-item-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease;
  position: relative;
}

.inv-item-card:active {
  transform: scale(0.97);
}

.inv-item-card.rarity-trash { border-color: rgba(142, 142, 147, 0.4); }
.inv-item-card.rarity-common { border-color: rgba(229, 231, 235, 0.4); }
.inv-item-card.rarity-uncommon { border-color: rgba(16, 185, 129, 0.5); }
.inv-item-card.rarity-rare { border-color: rgba(59, 130, 246, 0.5); }
.inv-item-card.rarity-epic { border-color: rgba(168, 85, 247, 0.5); }
.inv-item-card.rarity-legendary { border-color: rgba(245, 158, 11, 0.6); }
.inv-item-card.rarity-mythic { border-color: rgba(239, 68, 68, 0.7); }
.inv-item-card.rarity-secret { border-color: var(--accent-cyan); box-shadow: 0 0 10px rgba(6, 182, 212, 0.25); }

/* Realistic Car Plate Visual */
.plate-box {
  background: #FFFFFF;
  color: #000000;
  border: 2px solid #000000;
  border-radius: 6px;
  padding: 4px 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--font-serif);
  font-weight: 700;
  letter-spacing: 0.5px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.plate-main {
  font-size: 15px;
  letter-spacing: 1px;
}

.plate-right {
  display: flex;
  flex-direction: column;
  align-items: center;
  border-left: 1.5px solid #000000;
  padding-left: 5px;
  margin-left: 4px;
  line-height: 1;
}

.plate-region {
  font-size: 12px;
  font-weight: 900;
}

.plate-country-tag {
  font-size: 8px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 2px;
}

.flag-ru {
  width: 9px;
  height: 6px;
  display: inline-block;
  background: linear-gradient(to bottom, #FFFFFF 33.3%, #0039A6 33.3%, #0039A6 66.6%, #D52B1E 66.6%);
  border: 0.5px solid #888;
}

/* SIM Card Visual */
.sim-box {
  background: linear-gradient(135deg, #161B26, #10141E);
  border: 1px solid var(--border-highlight);
  border-radius: 8px;
  padding: 6px 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: relative;
  overflow: hidden;
}

.sim-carrier-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 10px;
  color: var(--text-muted);
}

.sim-number-text {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 14px;
  color: #FFFFFF;
  letter-spacing: 0.02em;
  word-break: break-all;
}

.inv-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
}

.inv-rarity-badge {
  font-weight: 700;
  font-size: 10px;
  text-transform: uppercase;
}

.inv-item-price {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 14px;
  color: #F59E0B;
}

/* ================= 3. MINIGAMES SUBNAV & FEATURES ================= */
.minigames-subnav {
  display: flex;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 3px;
  gap: 4px;
  margin-bottom: 12px;
}

.subnav-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: transparent;
  border: none;
  padding: 8px 4px;
  border-radius: 9px;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.subnav-btn.active {
  background: var(--primary-blue);
  color: #FFFFFF;
  box-shadow: 0 2px 8px var(--primary-blue-glow);
}

.svg-sub {
  width: 16px;
  height: 16px;
}

.subtab-content {
  display: none;
}

.subtab-content.active {
  display: block;
}

/* Upgrader */
.upgrader-layout {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.upgrader-item-box {
  background: var(--bg-card);
  border: 1px dashed var(--border-highlight);
  border-radius: 16px;
  padding: 12px;
  min-height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.upgrader-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
}

.placeholder-icon {
  font-size: 24px;
}

.btn-select-upgrader-item {
  background: var(--primary-blue);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

/* Wheel Stage */
.wheel-stage-container {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 10px 0;
}

.wheel-outer-ring {
  width: 230px;
  height: 230px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.wheel-svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.wheel-bg-circle {
  fill: #111520;
  stroke: var(--border-subtle);
  stroke-width: 4px;
}

.wheel-win-arc {
  fill: rgba(16, 185, 129, 0.4);
  stroke: #10B981;
  stroke-width: 4px;
}

.wheel-inner-circle {
  fill: #0B0E16;
}

.wheel-ticker {
  position: absolute;
  top: 4px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-top: 18px solid #EF4444;
  z-index: 10;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
}

.wheel-center-info {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: none;
}

.wheel-chance-val {
  font-family: var(--font-serif);
  font-size: 30px;
  font-weight: 700;
  color: #FFFFFF;
}

.wheel-chance-lbl {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-sub);
  letter-spacing: 0.5px;
}

.wheel-target-val {
  font-family: var(--font-serif);
  font-size: 16px;
  font-weight: 700;
  color: #10B981;
  margin-top: 2px;
}

/* Upgrader Controls */
.upgrader-controls-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.slider-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.slider-mode-toggles {
  display: flex;
  background: var(--bg-secondary);
  border-radius: 8px;
  padding: 2px;
}

.mode-toggle-btn {
  background: transparent;
  border: none;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  border-radius: 6px;
  cursor: pointer;
}

.mode-toggle-btn.active {
  background: var(--primary-blue);
  color: #fff;
}

.target-price-badge {
  text-align: right;
}

.target-lbl {
  font-size: 10px;
  color: var(--text-muted);
  display: block;
}

.target-sum {
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 700;
  color: #60A5FA;
}

.slider-wrapper {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.neon-slider {
  width: 100%;
  accent-color: var(--primary-blue);
  cursor: pointer;
}

.slider-marks {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--text-sub);
}

.insurance-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(37, 99, 235, 0.08);
  border: 1px solid rgba(37, 99, 235, 0.2);
  border-radius: 12px;
  padding: 10px 12px;
}

.insurance-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.insurance-title-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: #60A5FA;
}

.svg-shield {
  width: 16px;
  height: 16px;
}

.insurance-desc {
  font-size: 10px;
  color: var(--text-muted);
}

.insurance-price-tag {
  font-family: var(--font-serif);
  font-size: 12px;
  font-weight: 700;
  color: #F59E0B;
}

/* Switch toggle */
.switch-toggle {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.switch-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider-round {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #232B3D;
  transition: .3s;
  border-radius: 24px;
}

.slider-round:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
}

input:checked + .slider-round {
  background-color: var(--primary-blue);
}

input:checked + .slider-round:before {
  transform: translateX(20px);
}

.btn-spin-upgrader {
  width: 100%;
  height: 48px;
  border-radius: 14px;
  background: linear-gradient(135deg, #1D4ED8, #3B82F6);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.04em;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(37, 99, 235, 0.4);
}

.btn-spin-upgrader:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
}

/* Market */
.market-header-row {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.market-search-box {
  flex: 1;
}

.market-search-box input {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 10px 14px;
  color: #fff;
  font-size: 13px;
  outline: none;
}

.btn-market-create {
  background: var(--bg-card);
  border: 1px solid var(--border-highlight);
  color: #fff;
  border-radius: 12px;
  padding: 0 14px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.market-listings-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.market-item-row {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.market-item-left {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.market-seller-txt {
  font-size: 10px;
  color: var(--text-muted);
}

.market-buy-btn {
  background: var(--primary-blue);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 8px 14px;
  font-family: var(--font-serif);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
}

/* Contracts */
.contract-card-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.contract-desc-box {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 12px;
}

.contract-desc-box h3 {
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 4px;
}

.contract-desc-box p {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
}

.contract-stats-banner {
  display: flex;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 10px;
}

.c-stat {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.c-stat-lbl {
  font-size: 10px;
  color: var(--text-sub);
}

.c-stat-val {
  font-family: var(--font-serif);
  font-size: 16px;
  font-weight: 700;
}

.c-stat-val.bonus {
  color: #10B981;
}

.contract-selection-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  max-height: 280px;
  overflow-y: auto;
}

.contract-pick-item {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.contract-pick-item.selected {
  border-color: #10B981;
  background: rgba(16, 185, 129, 0.1);
}

.btn-sign-contract {
  width: 100%;
  height: 48px;
  border-radius: 14px;
  background: linear-gradient(135deg, #059669, #10B981);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.04em;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(16, 185, 129, 0.4);
}

.btn-sign-contract:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
}

/* ================= 4. PROFILE & SETTINGS TAB ================= */
.profile-hero-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 18px;
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 14px;
}

.profile-avatar-large {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1D4ED8, #3B82F6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 700;
  color: #fff;
  position: relative;
  overflow: hidden;
  border: 2px solid var(--primary-blue);
  box-shadow: 0 4px 16px rgba(37, 99, 235, 0.35);
  flex-shrink: 0;
}

.avatar-img-hero {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.profile-meta {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.profile-meta h2 {
  font-family: var(--font-serif);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.profile-subinfo {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
}

.meta-dot {
  color: var(--text-sub);
}

.profile-level-prog {
  margin-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.prog-labels {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
}

.prog-track {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 3px;
  overflow: hidden;
}

.prog-fill {
  height: 100%;
  background: linear-gradient(90deg, #2563EB, #60A5FA);
  border-radius: 3px;
  transition: width 0.3s ease;
}

.stats-cards-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}

.stat-box {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 10px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  text-align: center;
}

.stat-number {
  font-family: var(--font-serif);
  font-size: 17px;
  font-weight: 700;
  color: #FFFFFF;
}

.stat-label {
  font-size: 10px;
  color: var(--text-muted);
  line-height: 1.2;
}

.action-card-row {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.action-card-row:active {
  background: var(--bg-card-hover);
}

.card-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-icon.blue { background: rgba(37, 99, 235, 0.15); color: #60A5FA; }
.card-icon.purple { background: rgba(168, 85, 247, 0.15); color: #C084FC; }
.card-icon.cyan { background: rgba(6, 182, 212, 0.15); color: #22D3EE; }

.card-info {
  flex: 1;
}

.card-info h4 {
  font-size: 14px;
  font-weight: 600;
}

.card-info p {
  font-size: 11px;
  color: var(--text-muted);
}

.svg-arrow {
  width: 18px;
  height: 18px;
  color: var(--text-sub);
}

/* Admin Panel */
.admin-panel-container {
  background: var(--bg-card);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 16px;
  padding: 14px;
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.admin-panel-header {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #EF4444;
}

.svg-admin-shield {
  width: 20px;
  height: 20px;
}

.admin-search-wrap {
  display: flex;
  gap: 6px;
}

.admin-search-wrap input {
  flex: 1;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 8px 10px;
  color: #fff;
  font-size: 12px;
}

.btn-admin-search {
  background: #EF4444;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.admin-user-result-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.aur-header {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
}

.aur-stats {
  display: flex;
  gap: 12px;
  font-size: 11px;
  color: var(--text-muted);
}

.aur-action-group label {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.aur-input-btn-row, .aur-custom-item-row {
  display: flex;
  gap: 6px;
}

.aur-input-btn-row input, .aur-custom-item-row input, .aur-custom-item-row select {
  flex: 1;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 6px 10px;
  color: #fff;
  font-size: 12px;
}

.aur-luck-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.aur-luck-row input {
  flex: 1;
}

.btn-aur-exec {
  background: var(--primary-blue);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

/* ================= iOS TELEGRAM BOTTOM DOCK NAV ================= */
.bottom-dock-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  padding-bottom: var(--safe-bottom);
  padding-top: 6px;
  z-index: 100;
  pointer-events: none;
}

.dock-island {
  pointer-events: auto;
  background: var(--bg-island);
  border: 1px solid var(--border-highlight);
  border-radius: 28px;
  padding: 5px;
  display: flex;
  gap: 4px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.dock-btn {
  background: transparent;
  border: none;
  border-radius: 22px;
  padding: 6px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.25, 1, 0.5, 1);
}

.dock-btn.active {
  background: var(--primary-blue);
  color: #FFFFFF;
  box-shadow: 0 4px 12px var(--primary-blue-glow);
}

.dock-icon-wrap {
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.svg-dock {
  width: 20px;
  height: 20px;
}

/* ================= MODALS & POPUPS ================= */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.85);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 16px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.modal-overlay.active {
  display: flex;
}

.modal-dialog-box {
  background: var(--bg-card);
  border: 1px solid var(--border-highlight);
  border-radius: 20px;
  padding: 20px;
  width: 100%;
  max-width: 360px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-align: center;
}

.modal-input {
  width: 100%;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 10px 14px;
  color: #fff;
  font-size: 14px;
  outline: none;
}

.modal-btn-row {
  display: flex;
  gap: 10px;
}

.modal-btn {
  flex: 1;
  border: none;
  border-radius: 12px;
  padding: 12px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.modal-btn.cancel {
  background: var(--bg-secondary);
  color: var(--text-muted);
}

.modal-btn.confirm {
  background: var(--primary-blue);
  color: #fff;
}

/* First-Visit Onboarding Modal */
.onboarding-card {
  max-width: 380px;
  padding: 24px 20px;
}

.onboarding-avatar-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 8px;
}

.avatar-circle-lg {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, #1D4ED8, #3B82F6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 700;
  color: #fff;
  border: 2px solid var(--primary-blue);
  box-shadow: 0 4px 20px rgba(37, 99, 235, 0.4);
}

.avatar-img-lg {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.onboarding-title {
  font-family: var(--font-serif);
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.onboarding-desc {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.onboarding-field {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  width: 100%;
}

.onboarding-field label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.04em;
}

.onboarding-readonly-user {
  width: 100%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 13px;
  color: #93C5FD;
  text-align: left;
  font-family: var(--font-mono);
}

.onboarding-bonus-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: 14px;
  padding: 12px;
  text-align: left;
  width: 100%;
}

.onboarding-bonus-card .bonus-icon {
  font-size: 24px;
}

.onboarding-bonus-card .bonus-info strong {
  display: block;
  font-size: 13px;
  color: #FBBF24;
}

.onboarding-bonus-card .bonus-info span {
  font-size: 11px;
  color: #FDE68A;
}

.btn-start-game {
  width: 100%;
  height: 50px;
  background: linear-gradient(135deg, #1D4ED8, #3B82F6);
  border-radius: 14px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.04em;
  box-shadow: 0 4px 20px rgba(37, 99, 235, 0.4);
}

/* Bottom Sheet Modal */
.modal-sheet-dialog {
  position: fixed;
  bottom: 0;
  left: 0; right: 0;
  max-width: 480px;
  margin: 0 auto;
  background: var(--bg-card);
  border-top-left-radius: 24px;
  border-top-right-radius: 24px;
  border-top: 1px solid var(--border-highlight);
  padding: 12px 16px calc(24px + var(--safe-bottom)) 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  animation: slideUp 0.25s cubic-bezier(0.25, 1, 0.5, 1);
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.sheet-drag-handle {
  width: 36px;
  height: 4px;
  background: #3A4760;
  border-radius: 2px;
  align-self: center;
}

.sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sheet-header h3 {
  font-family: var(--font-serif);
  font-size: 20px;
  font-weight: 700;
}

.btn-sheet-close {
  background: var(--bg-secondary);
  border: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
}

.item-actions-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.action-btn {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  color: #fff;
  text-align: left;
}

.action-btn.sell { border-color: rgba(245, 158, 11, 0.3); }
.action-btn.upgrade { border-color: rgba(37, 99, 235, 0.3); }
.action-btn.market { border-color: rgba(16, 185, 129, 0.3); }

.svg-act {
  width: 22px;
  height: 22px;
  color: var(--primary-blue);
}

.act-text strong {
  display: block;
  font-size: 14px;
}

.act-text span {
  font-size: 11px;
  color: var(--text-muted);
}

/* ================= TOAST NOTIFICATIONS ================= */
#toast-container {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast-msg {
  background: var(--bg-card);
  border: 1px solid var(--border-highlight);
  color: #fff;
  padding: 10px 16px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6);
  animation: fadeInDown 0.2s ease;
}

.toast-msg.success { border-color: #10B981; }
.toast-msg.error { border-color: #EF4444; }

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

/* SVG helpers */
.svg-icon { width: 100%; height: 100%; }
.svg-icon-sm { width: 16px; height: 16px; }
.svg-btn-icon { width: 16px; height: 16px; }
.svg-card { width: 20px; height: 20px; }

/* Empty state */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 20px;
  gap: 10px;
}

.empty-icon {
  font-size: 40px;
}

.btn-primary-action {
  background: var(--primary-blue);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 10px 20px;
  font-weight: 700;
  margin-top: 10px;
  cursor: pointer;
}
