/* =========================================================
   STANDOFF 2 CASINO — Global Styles
   ========================================================= */

@import url('https://fonts.googleapis.com/css2?family=Rajdhani:wght@400;500;600;700&family=Orbitron:wght@400;700;900&display=swap');

:root {
  --gold-primary:   #ffca91;
  --gold-dark:      #a57624;
  --gold-darker:    #6f4a13;
  --gold-deep:      #51350d;
  --bg-dark:        #0d0e11;
  --bg-card:        #1a1c22;
  --bg-card2:       #22252e;
  --border-gold:    #a57624;
  --text-primary:   #f0e6d3;
  --text-muted:     #7d684a;
  --text-gold:      #ffca91;
  --accent-red:     #af1a1f;
  --accent-blue:    #c2dffc;
  --sidebar-bg:     rgba(0,0,0,0.72);
  --glow-gold:      0 0 18px rgba(165,118,36,0.55), 0 0 40px rgba(255,202,145,0.18);
  --glow-red:       0 0 18px rgba(175,26,31,0.6);
  --radius-sm:      6px;
  --radius-md:      12px;
  --radius-lg:      20px;
  --font-head:      'Orbitron', sans-serif;
  --font-body:      'Rajdhani', sans-serif;
  --transition:     0.25s cubic-bezier(.4,0,.2,1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background-color: var(--bg-dark);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(165,118,36,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(165,118,36,0.04) 1px, transparent 1px);
  background-size: 48px 48px;
  pointer-events: none;
  z-index: 0;
}

a { color: var(--gold-primary); text-decoration: none; }
a:hover { color: #fff; }

/* ── BUTTONS ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-head);
  font-weight: 700;
  letter-spacing: .08em;
  border: none;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: var(--transition);
  text-transform: uppercase;
  position: relative;
  overflow: hidden;
}
.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.12) 0%, transparent 60%);
  opacity: 0;
  transition: var(--transition);
}
.btn:hover::after { opacity: 1; }

.btn-gold {
  background: linear-gradient(135deg, var(--gold-dark) 0%, var(--gold-darker) 100%);
  color: var(--gold-primary);
  box-shadow: var(--glow-gold);
  padding: 14px 36px;
  font-size: 1rem;
}
.btn-gold:hover {
  background: linear-gradient(135deg, #c99030 0%, #8a5c1a 100%);
  box-shadow: 0 0 28px rgba(255,202,145,0.45), 0 0 60px rgba(165,118,36,0.3);
  transform: translateY(-2px);
}
.btn-gold:active { transform: translateY(0); }

.btn-outline {
  background: transparent;
  border: 1.5px solid var(--gold-dark);
  color: var(--gold-primary);
  padding: 10px 24px;
  font-size: .85rem;
}
.btn-outline:hover {
  background: rgba(165,118,36,0.12);
  border-color: var(--gold-primary);
}

.btn-danger {
  background: linear-gradient(135deg, #701214 0%, var(--accent-red) 100%);
  color: #ffb3b3;
  box-shadow: var(--glow-red);
  padding: 10px 24px;
  font-size: .85rem;
}

/* ── CARDS ── */
.card {
  background: var(--bg-card);
  border: 1px solid rgba(165,118,36,0.22);
  border-radius: var(--radius-md);
  padding: 20px;
  position: relative;
  overflow: hidden;
}
.card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold-dark), transparent);
}

/* ── GOLD BADGE ── */
.gold-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, var(--gold-dark), var(--gold-deep));
  border: 1px solid var(--gold-primary);
  color: var(--gold-primary);
  border-radius: 999px;
  padding: 4px 14px;
  font-family: var(--font-head);
  font-size: .82rem;
  font-weight: 700;
  letter-spacing: .05em;
  box-shadow: var(--glow-gold);
}

/* ── NAVBAR ── */
.navbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: 60px;
  min-height: 60px;
  background: linear-gradient(180deg, rgba(13,14,17,0.98) 0%, rgba(13,14,17,0.92) 100%);
  border-bottom: 1px solid rgba(165,118,36,0.3);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  gap: 0;
}

.navbar-logo {
  font-family: var(--font-head);
  font-weight: 900;
  font-size: 1rem;
  color: var(--gold-primary);
  letter-spacing: .1em;
  text-shadow: var(--glow-gold);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  white-space: nowrap;
}
.navbar-logo .logo-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}
.navbar-logo .so2-tag {
  font-size: .52rem;
  color: var(--text-muted);
  letter-spacing: .2em;
  font-weight: 400;
}

.navbar-nav {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 2px;
  list-style: none;
  margin: 0;
  padding: 0;
  flex: 1;
  justify-content: center;
}
.navbar-nav li { display: flex; }
.navbar-nav a {
  font-family: var(--font-head);
  font-size: .65rem;
  color: #a0a8b8;
  letter-spacing: .08em;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  text-decoration: none;
}
.navbar-nav a:hover,
.navbar-nav a.active {
  background: rgba(165,118,36,0.15);
  color: var(--gold-primary);
}

.navbar-right {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

/* ── WALLET CHIP ── */
.wallet-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, var(--gold-dark) 0%, var(--gold-deep) 100%);
  border: 1px solid var(--gold-primary);
  border-radius: 999px;
  padding: 5px 14px 5px 10px;
  box-shadow: var(--glow-gold);
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}
.wallet-chip:hover { transform: scale(1.04); }
.wallet-chip .w-icon { font-size: 1rem; }
.wallet-chip .w-amount {
  font-family: var(--font-head);
  font-size: .8rem;
  color: var(--gold-primary);
  font-weight: 700;
}

/* ── AVATAR ── */
.avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  border: 2px solid var(--gold-dark);
  object-fit: cover;
  box-shadow: var(--glow-gold);
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
  background: linear-gradient(135deg, var(--gold-dark), var(--gold-deep));
}
.avatar:hover { border-color: var(--gold-primary); transform: scale(1.08); }

/* ── SECTION TITLE ── */
.section-title {
  font-family: var(--font-head);
  font-size: 1rem;
  letter-spacing: .1em;
  color: var(--gold-primary);
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
}
.section-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, rgba(165,118,36,0.4), transparent);
}

/* ── DIVIDER ── */
.divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(165,118,36,0.3), transparent);
  margin: 20px 0;
}

/* ── TOAST ── */
.toast {
  position: fixed;
  bottom: 28px; right: 28px;
  background: var(--bg-card2);
  border: 1px solid var(--gold-dark);
  border-radius: var(--radius-md);
  padding: 14px 22px;
  font-family: var(--font-head);
  font-size: .82rem;
  color: var(--gold-primary);
  box-shadow: var(--glow-gold);
  z-index: 9999;
  animation: slideInToast .35s ease;
  pointer-events: none;
}
@keyframes slideInToast {
  from { transform: translateX(110%); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-dark); }
::-webkit-scrollbar-thumb { background: var(--gold-darker); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--gold-dark); }

/* ── MODAL ── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.78);
  backdrop-filter: blur(6px);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn .2s ease;
}
.modal-box {
  background: var(--bg-card);
  border: 1px solid rgba(165,118,36,0.35);
  border-radius: var(--radius-lg);
  padding: 32px;
  width: min(460px, 94vw);
  position: relative;
  box-shadow: var(--glow-gold), 0 20px 60px rgba(0,0,0,0.7);
  max-height: 90vh;
  overflow-y: auto;
}
.modal-box::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--gold-dark), var(--gold-primary), var(--gold-dark), transparent);
}
.modal-close {
  position: absolute;
  top: 14px; right: 16px;
  background: none; border: none;
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
  transition: var(--transition);
  z-index: 1;
}
.modal-close:hover { color: var(--gold-primary); transform: rotate(90deg); }

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes cardIn {
  from { opacity: 0; transform: translateY(30px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ── INPUT ── */
.input-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.input-group label {
  font-family: var(--font-head);
  font-size: .7rem;
  letter-spacing: .1em;
  color: var(--text-muted);
  text-transform: uppercase;
}
.input-field {
  background: rgba(0,0,0,0.45);
  border: 1px solid rgba(165,118,36,0.28);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 1rem;
  padding: 11px 14px;
  outline: none;
  transition: var(--transition);
  width: 100%;
}
.input-field:focus {
  border-color: var(--gold-dark);
  box-shadow: 0 0 0 3px rgba(165,118,36,0.15);
}
.input-field::placeholder { color: rgba(125,104,74,0.5); }

/* ── TABLE ── */
.s2-table { width: 100%; border-collapse: collapse; }
.s2-table th {
  font-family: var(--font-head);
  font-size: .68rem;
  letter-spacing: .12em;
  color: var(--text-muted);
  text-transform: uppercase;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(165,118,36,0.2);
  text-align: left;
}
.s2-table td {
  padding: 11px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  font-size: .9rem;
}
.s2-table tr:hover td { background: rgba(165,118,36,0.06); }

.rank-1 { color: #ffd700; }
.rank-2 { color: #c0c0c0; }
.rank-3 { color: #cd7f32; }

/* ── PULSE ── */
@keyframes pulse-gold {
  0%, 100% { box-shadow: var(--glow-gold); }
  50%       { box-shadow: 0 0 30px rgba(255,202,145,0.5), 0 0 70px rgba(165,118,36,0.3); }
}
.pulse { animation: pulse-gold 2.4s infinite; }

/* ── PROFILE XP ── */
.xp-bar-wrap { margin-top: 8px; }
.xp-bar-lbl {
  display: flex;
  justify-content: space-between;
  font-size: .7rem;
  color: var(--text-muted);
  letter-spacing: .06em;
  margin-bottom: 6px;
}
.xp-bar-bg {
  height: 7px;
  background: rgba(165,118,36,0.12);
  border-radius: 999px;
  overflow: hidden;
}
.xp-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--gold-darker), var(--gold-primary));
  border-radius: 999px;
  box-shadow: 0 0 8px rgba(255,202,145,0.4);
  transition: width .6s ease;
}

/* ── WALLET ── */
.wallet-balance { text-align: center; padding: 20px 0 16px; }
.wb-label {
  font-family: var(--font-head);
  font-size: .65rem;
  letter-spacing: .18em;
  color: var(--text-muted);
  text-transform: uppercase;
}
.wb-value {
  font-family: var(--font-head);
  font-size: 2.6rem;
  font-weight: 900;
  color: var(--gold-primary);
  text-shadow: var(--glow-gold);
  line-height: 1.1;
  margin-top: 6px;
}
.wb-value small { font-size: 1.1rem; }

.wallet-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 16px;
}
.wh-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  font-size: .88rem;
}
.wh-item:last-child { border-bottom: none; }
.wh-plus { color: #4cff8f; font-family: var(--font-head); font-size: .88rem; }
.wh-minus { color: #ff6b6b; font-family: var(--font-head); font-size: .88rem; }
.wh-date { font-size: .68rem; color: var(--text-muted); }

/* ── WITHDRAW ── */
.withdraw-info {
  background: rgba(165,118,36,0.06);
  border: 1px solid rgba(165,118,36,0.18);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-bottom: 18px;
  font-size: .82rem;
  color: rgba(240,230,211,0.7);
  line-height: 1.6;
}
.amount-presets {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.preset-btn {
  flex: 1;
  min-width: 56px;
  padding: 8px;
  border-radius: var(--radius-sm);
  background: rgba(165,118,36,0.1);
  border: 1px solid rgba(165,118,36,0.25);
  color: var(--gold-primary);
  font-family: var(--font-head);
  font-size: .75rem;
  cursor: pointer;
  transition: var(--transition);
  letter-spacing: .06em;
}
.preset-btn:hover,
.preset-btn.active {
  background: rgba(165,118,36,0.25);
  border-color: var(--gold-primary);
}

/* ── GAME PAGES ── */
.game-wrap {
  max-width: 860px;
  margin: 0 auto;
  padding: 80px 20px 60px;
  position: relative;
  z-index: 1;
}
.game-panel {
  background: var(--bg-card);
  border: 1px solid rgba(165,118,36,0.22);
  border-radius: var(--radius-lg);
  padding: 28px;
  position: relative;
  overflow: hidden;
}
.game-panel::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--gold-dark), var(--gold-primary), var(--gold-dark), transparent);
}
.bet-row {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  margin-top: 20px;
  flex-wrap: wrap;
}
.bet-input-wrap { flex: 1; min-width: 140px; }
.result-box {
  min-height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  margin-top: 20px;
  font-family: var(--font-head);
  font-size: 1.6rem;
  font-weight: 900;
  letter-spacing: .06em;
  background: rgba(0,0,0,0.35);
  border: 1px solid rgba(165,118,36,0.15);
}
.result-win  { color: #4cff8f; border-color: rgba(76,255,143,0.3); background: rgba(76,255,143,0.06); }
.result-lose { color: #ff6b6b; border-color: rgba(255,107,107,0.3); background: rgba(255,107,107,0.06); }
.result-wait { color: var(--text-muted); }

/* ── BACK BUTTON ── */
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-head);
  font-size: .72rem;
  letter-spacing: .1em;
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  margin-bottom: 20px;
  transition: var(--transition);
}
.back-btn:hover { color: var(--gold-primary); }

/* =========================================================
   MOBILE OPTIMIZATIONS — добавить в конец styles.css
   ========================================================= */

/* ── Telegram WebApp убирает bounce scroll ── */
html { height: 100%; }
body { height: 100%; overscroll-behavior: none; }

/* ── NAVBAR mobile ── */
@media (max-width: 600px) {
  .navbar {
    padding: 0 12px;
    height: 52px;
    min-height: 52px;
  }
  body { padding-top: 52px; }

  .navbar-logo {
    font-size: .78rem;
    gap: 6px;
  }
  .navbar-logo .so2-tag { display: none; }

  /* Прячем текст у nav-ссылок, оставляем только иконки */
  .navbar-nav a {
    font-size: 0;        /* текст скрыт */
    padding: 6px 7px;
    gap: 0;
  }
  .navbar-nav a::first-letter { font-size: .9rem; } /* эмодзи остаётся */

  .wallet-chip { padding: 5px 10px 5px 8px; }
  .wallet-chip .w-amount { font-size: .72rem; }
  .avatar { width: 30px; height: 30px; font-size: .85rem; }

  /* ── MODALS ── */
  .modal-box {
    padding: 24px 18px;
    border-radius: var(--radius-md);
    max-height: 88vh;
  }

  /* ── GAME WRAP ── */
  .game-wrap {
    padding: 68px 12px 40px;
  }
  .game-panel { padding: 18px 14px; }
  .section-title { font-size: .82rem; }

  /* ── BET ROW ── */
  .bet-row { flex-direction: column; gap: 8px; }
  .bet-input-wrap { min-width: unset; width: 100%; }

  /* ── RESULT BOX ── */
  .result-box { font-size: 1rem; min-height: 64px; padding: 12px; }

  /* ── PRESET BUTTONS ── */
  .preset-btn { padding: 7px 4px; font-size: .68rem; min-width: 44px; }

  /* ── PROFILE STATS ── */
  .profile-stats { grid-template-columns: 1fr 1fr 1fr; gap: 7px; }
  .pstat { padding: 9px 6px; }
  .pstat-val { font-size: .85rem; }

  /* ── WALLET ── */
  .wb-value { font-size: 2rem; }
  .wallet-actions { grid-template-columns: 1fr; }

  /* ── TABLE ── */
  .s2-table th, .s2-table td { padding: 8px 8px; font-size: .8rem; }
}

/* ── LOBBY mobile ── */
@media (max-width: 600px) {
  .lobby-wrap { padding: 20px 12px 48px; }

  .hero-banner {
    flex-direction: column;
    align-items: flex-start;
    padding: 24px 20px;
    gap: 16px;
  }
  .hero-banner-bg { font-size: 100px; }
  .hero-banner h1 { font-size: 1.3rem; }
  .hero-banner p  { font-size: .82rem; }
  .banner-jackpot { width: 100%; text-align: left; min-width: unset; }
  .banner-jackpot .jval { font-size: 1.4rem; }

  .games-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
  .game-thumb { height: 100px; font-size: 2.8rem; }
  .game-info  { padding: 10px; }
  .game-name  { font-size: .78rem; }
}

/* ── CRASH game mobile ── */
@media (max-width: 600px) {
  .crash-display { height: 180px; }
  .crash-mult-overlay { font-size: 3rem; }
  .crash-bets-list { max-height: 100px; }
}

/* ── ROULETTE mobile ── */
@media (max-width: 600px) {
  .wheel-outer  { width: 190px; height: 190px; }
  .wheel-canvas { width: 190px; height: 190px; }

  .num-grid { grid-template-columns: repeat(9, 1fr); gap: 3px; }
  .num-cell { font-size: .5rem; border-radius: 3px; }

  .bet-table-row { gap: 4px; }
  .bet-cell { padding: 8px 4px; font-size: .58rem; }

  .chip { width: 40px; height: 40px; font-size: .6rem; }
  .chip-selector { gap: 6px; }
}

/* ── SLOTS mobile ── */
@media (max-width: 600px) {
  .slots-machine { padding: 18px 14px 16px; }

  .reels-wrap { gap: 5px; padding: 8px; }
  .reel         { width: 52px; height: 52px; }
  .reel-symbol  { width: 52px; height: 52px; font-size: 1.6rem; }

  .btn-spin-big { padding: 15px; font-size: .9rem; }

  .paytable { padding: 10px; }
  .pt-row   { font-size: .75rem; }
  .pt-symbols { font-size: .85rem; }
}

/* ── MINES mobile ── */
@media (max-width: 600px) {
  .mines-grid { gap: 5px; }
  .mine-cell  { font-size: 1.2rem; border-radius: 4px; }

  .mult-display { padding: 11px 14px; }
  .mult-val     { font-size: 1.4rem; }

  .mine-count-btns { gap: 4px; }
  .mc-btn { font-size: .65rem; padding: 7px 4px; }
}

/* ── COIN mobile ── */
@media (max-width: 600px) {
  .coin-display { height: 120px; margin: 14px 0; }
  .coin { width: 90px; height: 90px; font-size: 2.6rem; }
  .side-pick { gap: 8px; }
  .side-btn { padding: 13px 8px; font-size: .75rem; }
  .side-btn .sb-icon { font-size: 1.5rem; }
}

/* ── DICE mobile ── */
@media (max-width: 600px) {
  .dice-display { gap: 14px; padding: 20px 0; }
  .die { width: 62px; height: 62px; font-size: 1.8rem; border-radius: 12px; }
  .dice-faces { gap: 4px; }
  .face-btn { width: 36px; height: 36px; font-size: .85rem; }
}

/* ── Very small phones (< 380px) ── */
@media (max-width: 380px) {
  .navbar-nav { gap: 0; }
  .navbar-nav a { padding: 6px 5px; }

  .games-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .game-thumb { height: 84px; font-size: 2.4rem; }

  .reel { width: 44px; height: 44px; }
  .reel-symbol { width: 44px; height: 44px; font-size: 1.3rem; }

  .die { width: 54px; height: 54px; font-size: 1.5rem; }

  .profile-stats { grid-template-columns: 1fr 1fr; }
}

/* ── Telegram WebApp safe areas (для iPhone с чёлкой) ── */
@supports (padding-top: env(safe-area-inset-top)) {
  .navbar {
    padding-top: env(safe-area-inset-top);
    height: calc(52px + env(safe-area-inset-top));
  }
  body { padding-top: calc(52px + env(safe-area-inset-top)); }
  .toast { bottom: calc(20px + env(safe-area-inset-bottom)); }
}