:root {
  --bg-deep: #0b0f2a;
  --bg-mid: #1a1440;
  --accent: #ffb547;
  --accent-strong: #ff8a00;
  --win: #4ade80;
  --danger: #ff6b6b;
  --text-primary: #f5f3ff;
  --text-muted: rgba(245, 243, 255, 0.62);
  --glass-bg: rgba(255, 255, 255, 0.07);
  --glass-border: rgba(255, 255, 255, 0.14);
  --glass-shadow: rgba(0, 0, 0, 0.35);
  --nav-height: 72px;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow-x: hidden;
}

body {
  background:
    radial-gradient(circle at 20% -10%, rgba(255, 138, 0, 0.18), transparent 45%),
    radial-gradient(circle at 90% 10%, rgba(120, 87, 255, 0.25), transparent 40%),
    linear-gradient(180deg, var(--bg-deep) 0%, var(--bg-mid) 100%);
  color: var(--text-primary);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  min-height: 100vh;
}

#app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding-bottom: var(--nav-height);
}

/* ---------- Верхняя панель ---------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 16px 8px;
}

.topbar__brand {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.balance-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  font-weight: 600;
  font-size: 15px;
}

.balance-chip__icon {
  font-size: 15px;
}

/* ---------- Общие стили карточек ---------- */

.glass-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 8px 32px var(--glass-shadow);
  padding: 20px;
}

.screens {
  flex: 1;
  padding: 8px 16px 24px;
}

.screen {
  animation: fade-in 0.25s ease;
}

@keyframes fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.hint-text {
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  min-height: 18px;
  margin: 8px 0 0;
}

/* ---------- Слот ---------- */

.slot-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.slot-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: 1fr;
  gap: 8px;
  aspect-ratio: 1 / 1;
  min-height: 0;
  overflow: hidden;
  padding: 12px;
  border-radius: 18px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--glass-border);
  box-shadow: inset 0 4px 18px rgba(0, 0, 0, 0.5), inset 0 0 40px rgba(120, 87, 255, 0.08);
}

.slot-reel {
  position: relative;
  min-width: 0;
  min-height: 0;
  height: 100%;
  border-radius: 14px;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.35), rgba(255, 255, 255, 0.03) 50%, rgba(0, 0, 0, 0.35));
  box-shadow: inset 0 8px 12px -8px rgba(0, 0, 0, 0.8), inset 0 -8px 12px -8px rgba(0, 0, 0, 0.8);
}

.slot-reel__strip {
  display: flex;
  flex-direction: column;
  will-change: transform;
}

.slot-reel__cell {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: clamp(20px, 8vw, 44px);
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.4));
}

.slot-reel.is-spinning .slot-reel__cell {
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.4)) blur(1.5px);
}

.slot-reel__cell.is-winning {
  animation: symbol-pop 0.4s ease;
  background: rgba(255, 181, 71, 0.22);
  box-shadow: inset 0 0 0 2px var(--accent), 0 0 18px rgba(255, 181, 71, 0.55);
  border-radius: 10px;
}

@keyframes symbol-pop {
  0% { transform: scale(1); }
  40% { transform: scale(1.25); }
  100% { transform: scale(1); }
}

.win-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  text-align: center;
  padding: 10px 14px;
  border-radius: 14px;
  background: rgba(74, 222, 128, 0.16);
  border: 1px solid rgba(74, 222, 128, 0.4);
  color: var(--win);
  font-weight: 700;
  font-size: 15px;
  animation: win-pop 0.3s ease;
}

.win-banner[hidden] {
  display: none;
}

.share-win-btn {
  border: 1px solid rgba(74, 222, 128, 0.5);
  background: rgba(74, 222, 128, 0.12);
  color: var(--win);
  border-radius: 999px;
  padding: 5px 14px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.share-win-btn:active {
  transform: scale(0.95);
}

@keyframes win-pop {
  from { transform: scale(0.92); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.bet-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.bet-row__label {
  color: var(--text-muted);
  font-size: 14px;
}

.bet-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

.lines-controls {
  display: flex;
  gap: 8px;
}

.lines-btn {
  min-width: 36px;
  height: 34px;
  padding: 0 10px;
  border-radius: 10px;
  border: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.lines-btn:active {
  transform: scale(0.95);
}

.lines-btn.is-active {
  background: rgba(255, 181, 71, 0.18);
  border-color: var(--accent);
  color: var(--accent);
}

.bet-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.bet-btn:active {
  transform: scale(0.92);
}

.bet-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.bet-value {
  min-width: 40px;
  text-align: center;
  font-weight: 700;
  font-size: 16px;
}

.total-bet-row {
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
}

.spin-btn {
  border: none;
  border-radius: 18px;
  padding: 16px;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: #1a0f00;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-strong) 100%);
  box-shadow: 0 8px 24px rgba(255, 138, 0, 0.35);
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease, opacity 0.2s ease;
}

.spin-btn:active {
  transform: scale(0.97);
}

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

.spin-btn:not(:disabled) {
  animation: spin-btn-glow 2.4s ease-in-out infinite;
}

@keyframes spin-btn-glow {
  0%, 100% { box-shadow: 0 8px 24px rgba(255, 138, 0, 0.35); }
  50% { box-shadow: 0 10px 34px rgba(255, 138, 0, 0.55); }
}

/* ---------- Рулетка ---------- */

.roulette-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.roulette-wheel-wrap {
  position: relative;
  width: min(46vw, 190px);
  height: min(46vw, 190px);
  margin: 4px auto 0;
}

.roulette-wheel {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 5px solid rgba(255, 255, 255, 0.16);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), inset 0 0 24px rgba(0, 0, 0, 0.45);
  transition: transform 2.6s cubic-bezier(0.11, 0.79, 0.15, 1);
}

.roulette-wheel__hub {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 30%;
  height: 30%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ffe0ab, var(--accent) 55%, var(--accent-strong));
  box-shadow: 0 0 14px rgba(255, 138, 0, 0.6), inset 0 2px 4px rgba(255, 255, 255, 0.5);
}

.roulette-wheel__pointer {
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 9px solid transparent;
  border-right: 9px solid transparent;
  border-top: 16px solid var(--accent);
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.45));
  z-index: 2;
}

.roulette-result {
  display: flex;
  align-items: center;
  justify-content: center;
}

.roulette-result__pocket {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  font-weight: 800;
  font-size: 20px;
  background: rgba(255, 255, 255, 0.06);
  border: 2px solid var(--glass-border);
  transition: background 0.2s ease, border-color 0.2s ease;
}

.roulette-result__pocket.is-red {
  background: rgba(220, 38, 38, 0.35);
  border-color: #dc2626;
}

.roulette-result__pocket.is-black {
  background: rgba(255, 255, 255, 0.12);
  border-color: #444;
}

.roulette-result__pocket.is-green {
  background: rgba(34, 197, 94, 0.3);
  border-color: #22c55e;
}

.roulette-win-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  text-align: center;
  padding: 10px 14px;
  border-radius: 14px;
  background: rgba(74, 222, 128, 0.16);
  border: 1px solid rgba(74, 222, 128, 0.4);
  color: var(--win);
  font-weight: 700;
  font-size: 15px;
}

.roulette-win-banner[hidden] {
  display: none;
}

.roulette-zero-row {
  display: flex;
  gap: 6px;
  margin-bottom: 6px;
}

.roulette-numbers-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  grid-template-rows: repeat(3, 1fr);
  gap: 4px;
}

.roulette-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  aspect-ratio: 1 / 1;
  border-radius: 8px;
  font-weight: 700;
  font-size: clamp(11px, 3vw, 14px);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.12);
  cursor: pointer;
  transition: transform 0.1s ease, box-shadow 0.15s ease;
  position: relative;
}

.roulette-cell.is-red {
  background: linear-gradient(135deg, #dc2626, #991b1b);
}

.roulette-cell.is-black {
  background: linear-gradient(135deg, #3a3a3a, #161616);
}

.roulette-cell.is-green {
  background: linear-gradient(135deg, #16a34a, #14532d);
}

.roulette-cell:active {
  transform: scale(0.93);
}

.roulette-cell:focus,
.roulette-outside-btn:focus {
  outline: none;
}

.roulette-cell.has-chip::after {
  content: attr(data-chip-count);
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 18px;
  height: 18px;
  padding: 0 3px;
  border-radius: 50%;
  background: var(--accent);
  color: #1a0f00;
  font-size: 10px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 0 2px var(--bg-deep);
}

.roulette-cell.is-winning {
  box-shadow: 0 0 0 3px var(--accent), 0 0 16px rgba(255, 181, 71, 0.6);
}

.roulette-outside {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.roulette-bet-row {
  display: flex;
  gap: 6px;
}

.roulette-outside-btn {
  flex: 1;
  position: relative;
  padding: 10px 4px;
  border-radius: 10px;
  border: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
  font-size: clamp(11px, 3vw, 13px);
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.1s ease;
}

.roulette-outside-btn:active {
  transform: scale(0.95);
}

.roulette-outside-btn.is-red-text {
  color: #ff8080;
}

.roulette-outside-btn.has-chip::after {
  content: attr(data-chip-count);
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 18px;
  height: 18px;
  padding: 0 3px;
  border-radius: 50%;
  background: var(--accent);
  color: #1a0f00;
  font-size: 10px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 0 2px var(--bg-deep);
}

.roulette-active-bets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 20px;
}

.roulette-active-bet-chip {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 181, 71, 0.14);
  border: 1px solid rgba(255, 181, 71, 0.35);
  font-size: 12px;
  color: var(--accent);
}

.roulette-actions {
  display: flex;
  gap: 10px;
}

.roulette-clear-btn {
  flex: 0 0 auto;
  padding: 0 18px;
  border-radius: 18px;
  border: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
  font-weight: 600;
  cursor: pointer;
}

.roulette-actions .spin-btn {
  flex: 1;
}

/* ---------- Бонус ---------- */

.bonus-card {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 32px 20px;
}

.bonus-card__icon {
  font-size: 56px;
}

.bonus-card h2 {
  margin: 0;
}

.bonus-card__streak {
  color: var(--text-muted);
  font-size: 14px;
  margin: 0 0 8px;
}

.bonus-claim-btn {
  border: none;
  border-radius: 16px;
  padding: 14px 32px;
  font-size: 16px;
  font-weight: 700;
  color: #1a0f00;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-strong) 100%);
  cursor: pointer;
}

.bonus-claim-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ---------- История ---------- */

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

.history-card h2 {
  margin: 0;
  font-size: 17px;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 60vh;
  overflow-y: auto;
}

.history-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 4px 12px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--glass-border);
  font-size: 14px;
}

.history-item__grid {
  flex-basis: 100%;
  font-size: 15px;
  letter-spacing: 1px;
  white-space: nowrap;
  overflow-x: auto;
}

.history-item__result.is-win {
  color: var(--win);
  font-weight: 700;
}

.history-item__result.is-loss {
  color: var(--text-muted);
}

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

/* ---------- Профиль ---------- */

.profile-card {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 28px 20px;
}

.profile-card__avatar {
  font-size: 48px;
  width: 84px;
  height: 84px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  margin-bottom: 6px;
}

.profile-card h2 {
  margin: 0;
}

.profile-card__username {
  color: var(--text-muted);
  margin: 0 0 12px;
  font-size: 14px;
}

.profile-stat {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.05);
  font-size: 15px;
  margin-bottom: 20px;
}

.topup-section {
  width: 100%;
  text-align: left;
  border-top: 1px solid var(--glass-border);
  padding-top: 14px;
  margin-bottom: 14px;
}

.topup-section h3 {
  margin: 0 0 4px;
  font-size: 15px;
}

.topup-section .hint-text {
  text-align: left;
  margin: 0 0 10px;
}

.topup-packages {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.topup-package-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 12px 8px;
  border-radius: 14px;
  border: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
  cursor: pointer;
  transition: transform 0.12s ease, border-color 0.15s ease;
}

.topup-package-btn:active {
  transform: scale(0.96);
}

.topup-package-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.topup-package-btn__label {
  font-size: 12px;
  color: var(--text-muted);
}

.topup-package-btn__chips {
  font-size: 16px;
  font-weight: 700;
}

.topup-package-btn__stars {
  font-size: 13px;
  color: var(--accent);
  font-weight: 600;
}

.profile-coming-soon {
  width: 100%;
  text-align: left;
  color: var(--text-muted);
  font-size: 13px;
  border-top: 1px solid var(--glass-border);
  padding-top: 14px;
}

.profile-coming-soon ul {
  margin: 6px 0 0;
  padding-left: 18px;
  line-height: 1.7;
}

/* ---------- Нижняя навигация ---------- */

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  display: flex;
  background: rgba(11, 15, 42, 0.75);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-top: 1px solid var(--glass-border);
  padding-bottom: env(safe-area-inset-bottom);
}

.nav-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  margin: 6px 4px;
  border: none;
  border-radius: 14px;
  background: transparent;
  color: var(--text-muted);
  font-size: 11px;
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease, transform 0.1s ease;
}

.nav-btn__icon {
  font-size: 20px;
  transition: transform 0.15s ease;
}

.nav-btn.is-active {
  color: var(--accent);
  background: rgba(255, 181, 71, 0.1);
}

.nav-btn.is-active .nav-btn__icon {
  transform: translateY(-2px) scale(1.08);
}

.nav-btn:active {
  transform: scale(0.93);
}

@media (hover: hover) {
  .nav-btn:hover {
    color: var(--accent);
    background: rgba(255, 181, 71, 0.08);
  }
}

/* ---------- Hover-состояния (десктоп/веб-версия) ---------- */

@media (hover: hover) {
  .spin-btn:not(:disabled):hover {
    filter: brightness(1.08);
    box-shadow: 0 10px 28px rgba(255, 138, 0, 0.45);
  }

  .bonus-claim-btn:not(:disabled):hover {
    filter: brightness(1.08);
  }

  .lines-btn:hover {
    border-color: var(--accent);
    color: var(--text-primary);
  }

  .bet-btn:not(:disabled):hover {
    background: rgba(255, 255, 255, 0.14);
  }

  .roulette-cell:hover {
    filter: brightness(1.2);
  }

  .roulette-outside-btn:hover {
    border-color: var(--accent);
    background: rgba(255, 181, 71, 0.08);
  }

  .roulette-clear-btn:hover {
    border-color: var(--text-muted);
    color: var(--text-primary);
  }

  .share-win-btn:hover {
    background: rgba(74, 222, 128, 0.2);
  }
}

/* ---------- Адаптив под маленькие экраны ---------- */

@media (max-width: 360px) {
  .slot-cell {
    font-size: clamp(22px, 7vw, 34px);
  }
}
