:root {
  --felt-deep: #0b3d2e;
  --felt-dark: #082b21;
  --gold: #d4af37;
  --gold-soft: #e8cf7a;
  --cream: #f2e9d8;
  --burgundy: #7a1f2b;
  --card-bg: #12261d;
  --text-dim: #9db8ab;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: radial-gradient(circle at 50% -10%, var(--felt-deep), var(--felt-dark) 65%);
  color: var(--cream);
  font-family: 'Inter', sans-serif;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

.mono { font-family: 'JetBrains Mono', monospace; }

/* ---------- Topbar ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 10px;
  border-bottom: 1px solid rgba(212, 175, 55, 0.25);
}

.brand { display: flex; align-items: center; gap: 8px; }
.brand-suit { color: var(--gold); font-size: 22px; }
.brand-name {
  font-family: 'Fraunces', serif;
  font-weight: 700;
  font-size: 19px;
  letter-spacing: 0.2px;
}

.balance-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(212, 175, 55, 0.12);
  border: 1px solid rgba(212, 175, 55, 0.4);
  border-radius: 999px;
  padding: 6px 12px;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  font-size: 14px;
  color: var(--gold-soft);
}
.chip-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 6px var(--gold);
}

/* ---------- Layout ---------- */
main {
  padding: 18px 16px 100px;
  max-width: 480px;
  margin: 0 auto;
}
.view.hidden { display: none; }
.view-title {
  font-family: 'Fraunces', serif;
  font-weight: 700;
  font-size: 22px;
  margin: 4px 0 18px;
  text-align: center;
}

/* ---------- Ledger card (profile) ---------- */
.ledger-card {
  background: var(--card-bg);
  border: 1px solid rgba(212, 175, 55, 0.3);
  border-radius: 14px;
  padding: 18px 20px;
  margin-bottom: 18px;
}
.ledger-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  font-size: 14px;
  color: var(--text-dim);
}
.ledger-row.big {
  font-size: 20px;
  color: var(--cream);
  font-weight: 600;
}
.ledger-row.big .mono { color: var(--gold-soft); font-size: 24px; }
.ledger-divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(212,175,55,0.4), transparent);
  margin: 4px 0;
}

.hint {
  text-align: center;
  color: var(--text-dim);
  font-size: 13px;
  margin: 8px 0 20px;
}

/* ---------- Buttons ---------- */
.gold-btn {
  width: 100%;
  padding: 15px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(180deg, var(--gold-soft), var(--gold));
  color: #1a1204;
  font-weight: 700;
  font-size: 16px;
  font-family: 'Inter', sans-serif;
  margin-bottom: 12px;
  box-shadow: 0 4px 14px rgba(212, 175, 55, 0.25);
  transition: transform 0.08s ease;
}
.gold-btn:active { transform: scale(0.97); }
.gold-btn.cashout { background: linear-gradient(180deg, #e88a8f, var(--burgundy)); color: #fff; }
.gold-btn:disabled { opacity: 0.4; }

.ghost-btn {
  width: 100%;
  padding: 13px;
  border-radius: 12px;
  background: transparent;
  border: 1px solid rgba(212, 175, 55, 0.4);
  color: var(--gold-soft);
  font-weight: 600;
  font-size: 14px;
}

.hidden { display: none !important; }

/* ---------- Bet row ---------- */
.bet-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin: 16px 0;
}
.bet-adjust {
  width: 42px; height: 42px;
  border-radius: 50%;
  border: 1px solid rgba(212,175,55,0.4);
  background: var(--card-bg);
  color: var(--gold-soft);
  font-weight: 700;
  font-size: 15px;
}
.bet-display {
  font-family: 'JetBrains Mono', monospace;
  font-size: 22px;
  font-weight: 700;
  min-width: 90px;
  text-align: center;
  color: var(--cream);
}

.result-line {
  text-align: center;
  min-height: 24px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--gold-soft);
}

/* ---------- Slots ---------- */
.reels {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 10px;
}
.reel {
  width: 78px; height: 78px;
  background: var(--card-bg);
  border: 1px solid rgba(212,175,55,0.35);
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 38px;
}
.reel.spinning { animation: spin-blur 0.15s infinite; }
@keyframes spin-blur { 0%,100% { filter: blur(0); } 50% { filter: blur(2px); } }

/* ---------- Crash ---------- */
.crash-stage {
  height: 180px;
  background: var(--card-bg);
  border: 1px solid rgba(212,175,55,0.3);
  border-radius: 14px;
  position: relative;
  overflow: hidden;
  margin-bottom: 8px;
}
.crash-multiplier {
  position: absolute;
  top: 16px; left: 50%;
  transform: translateX(-50%);
  font-family: 'JetBrains Mono', monospace;
  font-size: 32px;
  font-weight: 700;
  color: var(--gold-soft);
}
.crash-rocket {
  position: absolute;
  bottom: 14px; left: 14px;
  font-size: 34px;
  transition: transform 0.1s linear;
}

/* ---------- Apples ---------- */
.apples-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin-bottom: 8px;
}
.apple-cell {
  aspect-ratio: 1;
  background: var(--card-bg);
  border: 1px solid rgba(212,175,55,0.3);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
}
.apple-cell.safe { background: rgba(212,175,55,0.18); }
.apple-cell.bomb { background: rgba(122,31,43,0.5); }
.apple-cell:disabled { opacity: 0.85; }

/* ---------- Poker ---------- */
.poker-hand {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-bottom: 8px;
}
.poker-card {
  width: 58px; height: 82px;
  background: var(--cream);
  color: #1a1204;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: 15px;
  border: 3px solid transparent;
  font-family: 'JetBrains Mono', monospace;
}
.poker-card.red { color: var(--burgundy); }
.poker-card.held { border-color: var(--gold); }

/* ---------- Секции профиля ---------- */
.section-title {
  font-family: 'Fraunces', serif;
  font-weight: 700;
  font-size: 16px;
  margin: 24px 0 10px;
  color: var(--gold-soft);
}

.gold-btn.small { padding: 11px; font-size: 14px; }

/* Квесты */
.quest-list { display: flex; flex-direction: column; gap: 8px; }
.quest-item {
  background: var(--card-bg);
  border: 1px solid rgba(212,175,55,0.25);
  border-radius: 12px;
  padding: 12px 14px;
}
.quest-top { display: flex; justify-content: space-between; align-items: center; font-size: 13px; }
.quest-reward { color: var(--gold-soft); font-weight: 700; font-family: 'JetBrains Mono', monospace; }
.quest-bar-track {
  height: 6px; border-radius: 3px; background: rgba(255,255,255,0.08);
  margin-top: 8px; overflow: hidden;
}
.quest-bar-fill { height: 100%; background: var(--gold); border-radius: 3px; }
.quest-claim-btn {
  margin-top: 8px; width: 100%; padding: 8px; border-radius: 8px; border: none;
  background: var(--gold); color: #1a1204; font-weight: 700; font-size: 13px;
}
.quest-claim-btn:disabled { opacity: 0.35; }

/* Промокод */
.promo-row { display: flex; gap: 8px; }
#promo-input {
  flex: 1;
  background: var(--card-bg);
  border: 1px solid rgba(212,175,55,0.3);
  border-radius: 10px;
  padding: 0 12px;
  color: var(--cream);
  font-family: 'JetBrains Mono', monospace;
  text-transform: uppercase;
}

/* Лидерборд */
.leaderboard-list { display: flex; flex-direction: column; gap: 6px; }
.lb-row {
  display: flex; align-items: center; gap: 10px;
  background: var(--card-bg);
  border: 1px solid rgba(212,175,55,0.2);
  border-radius: 10px;
  padding: 9px 12px;
  font-size: 13px;
}
.lb-rank { width: 22px; color: var(--gold-soft); font-weight: 700; font-family: 'JetBrains Mono', monospace; }
.lb-name { flex: 1; color: var(--cream); }
.lb-balance { font-family: 'JetBrains Mono', monospace; color: var(--gold-soft); }

/* История */
.history-list { display: flex; flex-direction: column; gap: 5px; margin-bottom: 10px; }
.hist-row {
  display: flex; justify-content: space-between;
  font-size: 12.5px; color: var(--text-dim);
  padding: 7px 10px;
  background: var(--card-bg);
  border-radius: 8px;
}
.hist-delta.pos { color: #7fd99a; }
.hist-delta.neg { color: #e88a8f; }

/* Дабл-ап (покер) */
.gamble-amount { text-align: center; font-size: 15px; margin-bottom: 10px; color: var(--cream); }
.gamble-card {
  width: 80px; height: 110px;
  margin: 0 auto 16px;
  background: var(--card-bg);
  border: 2px solid var(--gold);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 40px;
}
.gamble-choices { display: flex; gap: 10px; margin-bottom: 10px; }
.gold-btn.red { background: linear-gradient(180deg, #e88a8f, var(--burgundy)); color: #fff; }
.gold-btn.black { background: linear-gradient(180deg, #4a4a4a, #1a1a1a); color: #fff; }

/* Вспышка при выигрыше */
.win-flash { animation: flash 0.6s ease; }
@keyframes flash {
  0% { box-shadow: 0 0 0 rgba(212,175,55,0); }
  30% { box-shadow: 0 0 24px rgba(212,175,55,0.9); }
  100% { box-shadow: 0 0 0 rgba(212,175,55,0); }
}

/* ---------- Tabbar ---------- */
.tabbar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  display: flex;
  background: var(--felt-dark);
  border-top: 1px solid rgba(212, 175, 55, 0.25);
  padding: 8px 4px calc(8px + env(safe-area-inset-bottom));
}
.tab {
  flex: 1;
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 11px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 0;
}
.tab span { font-size: 19px; }
.tab.active { color: var(--gold-soft); }
