/* ============================================
   WinGo Game Page Styles
   ============================================ */

:root {
  --primary: #E8453C;
  --primary-light: #ff6b6b;
  --primary-gradient: linear-gradient(135deg, #E8453C 0%, #f77062 100%);
  --header-gradient: linear-gradient(135deg, #E8453C 0%, #f5876e 100%);
  --green: #4CAF50;
  --green-dark: #2E7D32;
  --green-light: #81C784;
  --violet: #9C27B0;
  --violet-light: #CE93D8;
  --red: #E53935;
  --red-light: #EF9A9A;
  --bg: #f5f5f8;
  --white: #ffffff;
  --text-dark: #1a1a2e;
  --text-gray: #666;
  --text-light: #999;
  --border: #eee;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 4px 20px rgba(0, 0, 0, 0.12);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
}

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

html,
body {
  font-family: 'Seriffi Morgan', serif;
  background: var(--bg);
  color: var(--text-dark);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ============================================
   App Container
   ============================================ */
.app-container {
  max-width: 420px;
  margin: 0 auto;
  background: var(--bg);
  min-height: 100vh;
  position: relative;
}

/* ============================================
   Header
   ============================================ */
.wingo-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--header-gradient);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-left {
  display: flex;
  align-items: center;
}

.back-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  text-decoration: none;
  color: white;
}

.balance-badge {
  font-size: 12px;
  font-weight: 600;
  color: white;
  background: rgba(255, 255, 255, 0.2);
  padding: 2px 8px;
  border-radius: 10px;
}

.header-center {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 6px;
}

.logo-icon-sm {
  width: 30px;
  height: 30px;
  background: rgba(255, 255, 255, 0.25);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.logo-icon-sm span {
  color: white;
  font-weight: 900;
  font-size: 11px;
}

.logo-icon-sm::before {
  content: '';
  position: absolute;
  top: -3px;
  left: 50%;
  transform: translateX(-50%);
  width: 16px;
  height: 6px;
  border: 1.5px solid rgba(255, 255, 255, 0.6);
  border-bottom: none;
  border-radius: 8px 8px 0 0;
}

.logo-text-sm {
  font-size: 18px;
  font-weight: 900;
  color: white;
  letter-spacing: -0.3px;
}

.header-right {
  display: flex;
  gap: 8px;
}

.header-icon-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  opacity: 0.9;
}

.header-icon-btn:active {
  opacity: 0.6;
}

/* ============================================
   Wallet Card
   ============================================ */
.wallet-card {
  margin: 0 16px;
  margin-top: -1px;
  background: var(--white);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  padding: 20px;
  text-align: center;
  box-shadow: var(--shadow);
  position: relative;
  z-index: 50;
}

.wallet-card::before {
  content: '';
  position: absolute;
  top: -20px;
  left: 0;
  right: 0;
  height: 20px;
  background: var(--header-gradient);
}

.wallet-balance-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 4px;
}

.wallet-amount-lg {
  font-size: 28px;
  font-weight: 900;
  color: var(--text-dark);
}

.refresh-btn {
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  transition: transform 0.3s;
}

.refresh-btn:active {
  transform: rotate(180deg);
}

.wallet-label-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-gray);
  margin-bottom: 16px;
}

.wallet-icon {
  font-size: 14px;
  display: inline-flex;
  align-items: center;
}

.wallet-btn-row {
  display: flex;
  gap: 12px;
}

.btn-wd {
  flex: 1;
  padding: 12px 20px;
  border: none;
  border-radius: 25px;
  font-size: 14px;
  font-weight: 700;
  color: white;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}

.btn-wd.withdraw {
  background: linear-gradient(135deg, #E8453C 0%, #f77062 100%);
}

.btn-wd.deposit {
  background: linear-gradient(135deg, #4CAF50 0%, #66BB6A 100%);
}

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

/* ============================================
   Notice Bar
   ============================================ */
.notice-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 12px 16px;
  padding: 10px 12px;
  background: var(--white);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.notice-icon {
  flex-shrink: 0;
}

.notice-text {
  flex: 1;
  font-size: 11px;
  color: var(--text-gray);
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.notice-detail-btn {
  padding: 4px 14px;
  border: 1.5px solid var(--primary);
  border-radius: 20px;
  background: none;
  color: var(--primary);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.2s;
}

.notice-detail-btn:active {
  background: var(--primary);
  color: white;
}

/* ============================================
   Game Mode Tabs
   ============================================ */
.game-mode-tabs {
  display: flex;
  gap: 0;
  padding: 16px 16px 8px;
  justify-content: space-between;
}

.mode-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  padding: 8px 12px;
  border-radius: var(--radius);
  transition: all 0.3s;
  flex: 1;
}

.mode-tab.active {
  background: rgba(232, 69, 60, 0.06);
}

.mode-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #bbb;
  border: none;
  transition: all 0.3s;
}

.mode-icon.active,
.mode-tab.active .mode-icon {
  color: var(--primary);
  background: rgba(232, 69, 60, 0.05);
}

.mode-clock-img {
  width: 50px;
  height: 50px;
  object-fit: contain;
}

.mode-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-gray);
  text-align: center;
}

.mode-tab.active .mode-label {
  color: var(--text-dark);
  font-weight: 700;
}

.mode-sub {
  font-size: 10px;
  color: var(--text-light);
  margin-top: -2px;
}

.mode-tab.active .mode-sub {
  color: var(--text-dark);
  font-weight: 600;
}

/* ============================================
   Game Panel
   ============================================ */
.game-panel {
  margin: 8px 16px;
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow);
}

/* Info Row */
.game-info-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.how-to-play {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: #f0f4f8;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-gray);
  cursor: pointer;
}

.htp-icon {
  font-size: 14px;
}

.timer-section {
  text-align: right;
}

.timer-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--primary);
  display: block;
  margin-bottom: 4px;
}

.timer-display {
  display: flex;
  align-items: center;
  gap: 3px;
}

.timer-digit {
  width: 28px;
  height: 34px;
  background: var(--text-dark);
  color: white;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.timer-sep {
  font-size: 20px;
  font-weight: 800;
  color: var(--text-dark);
  margin: 0 1px;
}

/* Game Meta Row */
.game-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 12px;
}

.game-mode-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dark);
}

.last-results {
  display: flex;
  gap: 4px;
}

.small-ball {
  width: 26px;
  height: 26px;
  font-size: 11px;
}

.period-id {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-dark);
  font-variant-numeric: tabular-nums;
}

/* Result Balls */
.result-ball {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 800;
  color: white;
}

.green-ball {
  background: var(--green);
  box-shadow: 0 2px 6px rgba(76, 175, 80, 0.3);
}

.red-ball {
  background: var(--red);
  box-shadow: 0 2px 6px rgba(229, 57, 53, 0.3);
}

.violet-ball {
  background: var(--violet);
  box-shadow: 0 2px 6px rgba(156, 39, 176, 0.3);
}

/* ============================================
   Color Buttons
   ============================================ */
.color-buttons {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}

.color-btn {
  flex: 1;
  padding: 12px;
  border: none;
  border-radius: 25px;
  font-size: 14px;
  font-weight: 700;
  color: white;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  position: relative;
  overflow: hidden;
}

.color-btn::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0);
  transition: background 0.2s;
}

.color-btn:active::after {
  background: rgba(255, 255, 255, 0.2);
}

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

.green-btn {
  background: linear-gradient(135deg, #4CAF50, #66BB6A);
  box-shadow: 0 3px 12px rgba(76, 175, 80, 0.35);
  border-radius: 8px 25px 25px 8px;
}

.violet-btn {
  background: linear-gradient(135deg, #9C27B0, #BA68C8);
  box-shadow: 0 3px 12px rgba(156, 39, 176, 0.35);
}

.red-btn {
  background: linear-gradient(135deg, #E53935, #EF5350);
  box-shadow: 0 3px 12px rgba(229, 57, 53, 0.35);
  border-radius: 25px 8px 8px 25px;
}

/* ============================================
   Number Grid
   ============================================ */
.number-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  margin-bottom: 16px;
  padding: 4px;
}

.num-ball {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s;
  background: none;
  padding: 4px;
}

.num-ball:active {
  transform: scale(0.9);
}

/* Random pick: balls bounce as the pick hops around, winner pops */
.num-ball.rolling {
  transform: scale(1.18);
  z-index: 3;
  transition: transform 0.08s ease;
}

.num-ball.picked {
  z-index: 3;
  animation: ballPick 0.5s ease;
}

@keyframes ballPick {
  0% {
    transform: scale(1.3);
  }

  40% {
    transform: scale(0.85);
  }

  70% {
    transform: scale(1.15);
  }

  100% {
    transform: scale(1);
  }
}

/* Dim the Random button while a pick is in progress */
.btn-random.rolling-active {
  opacity: 0.65;
  pointer-events: none;
}

.num-inner {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 900;
  color: white;
  position: relative;
  z-index: 2;
}

/* Green numbers: 1, 3, 7, 9 */
.num-ball.green {
  background: radial-gradient(circle at 35% 35%, #81C784, #388E3C);
  box-shadow: 0 4px 12px rgba(76, 175, 80, 0.4), inset 0 -3px 6px rgba(0, 0, 0, 0.15);
}

.num-ball.green .num-inner {
  background: radial-gradient(circle at 40% 30%, #66BB6A, #2E7D32);
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* Red numbers: 2, 4, 6, 8 */
.num-ball.red {
  background: radial-gradient(circle at 35% 35%, #EF9A9A, #C62828);
  box-shadow: 0 4px 12px rgba(229, 57, 53, 0.4), inset 0 -3px 6px rgba(0, 0, 0, 0.15);
}

.num-ball.red .num-inner {
  background: radial-gradient(circle at 40% 30%, #EF5350, #B71C1C);
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* Violet-Red (0) - has violet outer ring with red inner */
.num-ball.violet-red {
  background: radial-gradient(circle at 35% 35%, #CE93D8, #7B1FA2);
  box-shadow: 0 4px 12px rgba(156, 39, 176, 0.4), inset 0 -3px 6px rgba(0, 0, 0, 0.15);
  border: 3px solid #EF5350;
}

.num-ball.violet-red .num-inner {
  background: radial-gradient(circle at 40% 30%, #BA68C8, #6A1B9A);
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* Green-Violet (5) - has green outer with violet highlights */
.num-ball.green-violet {
  background: radial-gradient(circle at 35% 35%, #81C784, #388E3C);
  box-shadow: 0 4px 12px rgba(76, 175, 80, 0.4), inset 0 -3px 6px rgba(0, 0, 0, 0.15);
  border: 3px solid #BA68C8;
}

.num-ball.green-violet .num-inner {
  background: radial-gradient(circle at 40% 30%, #66BB6A, #2E7D32);
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* 3D shine effect on all balls */
.num-ball::before {
  content: '';
  position: absolute;
  top: 8%;
  left: 18%;
  width: 30%;
  height: 25%;
  background: radial-gradient(ellipse, rgba(255, 255, 255, 0.5) 0%, transparent 70%);
  border-radius: 50%;
  z-index: 3;
  pointer-events: none;
}

/* ============================================
   Multiplier Row
   ============================================ */
.multiplier-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 12px;
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.multiplier-row::-webkit-scrollbar {
  display: none;
}

.multi-btn {
  padding: 7px 14px;
  border: 1.5px solid var(--border);
  border-radius: 20px;
  background: var(--white);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-gray);
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all 0.2s;
}

.multi-btn.outline {
  border-color: var(--primary);
  color: var(--primary);
}

.multi-btn.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

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

/* ============================================
   Big / Small
   ============================================ */
.bigsmall-row {
  display: flex;
  gap: 0;
  border-radius: 25px;
  overflow: hidden;
  border: 2px solid var(--border);
}

.bs-btn {
  flex: 1;
  padding: 12px;
  border: none;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}

.bs-btn:active {
  opacity: 0.8;
}

.big-btn {
  background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 100%);
  color: var(--primary);
  border-radius: 25px 0 0 25px;
}

.small-btn {
  background: linear-gradient(135deg, #a1c4fd 0%, #c2e9fb 100%);
  color: #2196F3;
  border-radius: 0 25px 25px 0;
}

/* ============================================
   History Tabs
   ============================================ */
.history-tabs {
  display: flex;
  margin: 16px;
  gap: 8px;
  background: transparent;
}

.hist-tab {
  flex: 1;
  padding: 10px 8px;
  border: 1.5px solid #eee;
  border-radius: 8px;
  background: var(--white);
  font-size: 13px;
  font-weight: 600;
  color: #57606f;
  cursor: pointer;
  transition: all 0.3s;
  text-align: center;
}

.hist-tab.active {
  color: white;
  background: #ff6670;
  /* slightly softer red matching image */
  border-color: #ff6670;
}

/* ============================================
   History Table
   ============================================ */
.history-section {
  margin: 16px;
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.history-table-header {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 0.7fr;
  padding: 12px 16px;
  background: linear-gradient(135deg, #E8453C 0%, #f77062 100%);
  font-size: 12px;
  font-weight: 700;
  color: white;
}

.history-row {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 0.7fr;
  padding: 14px 16px;
  font-size: 13px;
  align-items: center;
  border-bottom: 1px solid #f8f8f8;
  transition: background 0.2s;
}

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

.history-row:nth-child(even) {
  background: #fafafa;
}

.history-period {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-gray);
  font-variant-numeric: tabular-nums;
}

.history-number {
  font-size: 20px;
  font-weight: 900;
  text-align: center;
}

.history-number.green-num {
  color: var(--green);
}

.history-number.red-num {
  color: var(--red);
}

.history-number.violet-num {
  color: var(--violet);
}

.history-bs {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-dark);
  text-align: center;
}

.history-color {
  display: flex;
  justify-content: center;
  gap: 4px;
}

.color-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.color-dot.green-dot {
  background: var(--green);
}

.color-dot.red-dot {
  background: var(--red);
}

.color-dot.violet-dot {
  background: var(--violet);
}

/* ============================================
   Pagination
   ============================================ */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 16px;
}

.page-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  background: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-gray);
  transition: all 0.2s;
}

.page-btn.active-page {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

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

.page-info {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-gray);
}

/* ============================================
   Animations
   ============================================ */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.game-panel {
  animation: fadeIn 0.4s ease-out;
}

.wallet-card {
  animation: fadeIn 0.3s ease-out;
}

@keyframes pulseTimer {

  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.05);
  }
}

.timer-digit {
  animation: pulseTimer 1s ease-in-out infinite;
}

/* Number ball hover/active glow */
.num-ball.green:active {
  box-shadow: 0 0 20px rgba(76, 175, 80, 0.6);
}

.num-ball.red:active {
  box-shadow: 0 0 20px rgba(229, 57, 53, 0.6);
}

.num-ball.violet-red:active {
  box-shadow: 0 0 20px rgba(156, 39, 176, 0.6);
}

.num-ball.green-violet:active {
  box-shadow: 0 0 20px rgba(76, 175, 80, 0.6);
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 360px) {
  .num-inner {
    font-size: 18px;
  }

  .timer-digit {
    width: 24px;
    height: 30px;
    font-size: 16px;
  }

  .wallet-amount-lg {
    font-size: 24px;
  }
}

/* ============================================
   Betting Drawer (Bottom Sheet)
   ============================================ */
.bet-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  display: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.bet-overlay.show {
  display: block;
  opacity: 1;
}

.bet-drawer {
  position: fixed;
  bottom: -100%;
  left: 0;
  right: 0;
  background: var(--white);
  border-radius: 20px 20px 0 0;
  z-index: 1001;
  transition: bottom 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
  display: flex;
  flex-direction: column;
  box-shadow: 0 -5px 20px rgba(0, 0, 0, 0.1);
}

.bet-drawer.show {
  bottom: 0;
}

/* Theme Colors for Drawer */
.bet-drawer.theme-orange .drawer-header {
  background: #FF9800;
}

.bet-drawer.theme-orange .drawer-btn-submit {
  background: #FF9800;
  color: white;
  border: none;
}

.bet-drawer.theme-orange .drawer-title::after {
  border-top-color: #FF9800;
}

.bet-drawer.theme-blue .drawer-header {
  background: #64B5F6;
}

.bet-drawer.theme-blue .drawer-btn-submit {
  background: #64B5F6;
  color: white;
  border: none;
}

.bet-drawer.theme-blue .drawer-title::after {
  border-top-color: #64B5F6;
}

.bet-drawer.theme-green .drawer-header {
  background: var(--green);
}

.bet-drawer.theme-green .drawer-btn-submit {
  background: var(--green);
  color: white;
  border: none;
}

.bet-drawer.theme-green .drawer-title::after {
  border-top-color: var(--green);
}

.bet-drawer.theme-red .drawer-header {
  background: var(--red);
}

.bet-drawer.theme-red .drawer-btn-submit {
  background: var(--red);
  color: white;
  border: none;
}

.bet-drawer.theme-red .drawer-title::after {
  border-top-color: var(--red);
}

.bet-drawer.theme-violet .drawer-header {
  background: var(--violet);
}

.bet-drawer.theme-violet .drawer-btn-submit {
  background: var(--violet);
  color: white;
  border: none;
}

.bet-drawer.theme-violet .drawer-title::after {
  border-top-color: var(--violet);
}

/* Drawer Elements */
.drawer-header {
  padding: 15px 0;
  text-align: center;
  border-radius: 20px 20px 0 0;
  color: white;
  position: relative;
}

.drawer-title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 5px;
}

.drawer-subtitle {
  background: white;
  color: var(--text-dark);
  display: inline-block;
  padding: 5px 40px;
  border-radius: 4px;
  font-weight: 700;
  font-size: 16px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  position: relative;
  z-index: 2;
}

/* Downward pointing triangle */
.drawer-title::after {
  content: '';
  position: absolute;
  bottom: -15px;
  left: 50%;
  transform: translateX(-50%);
  border-left: 20px solid transparent;
  border-right: 20px solid transparent;
  border-top: 20px solid transparent;
  /* Colored by theme */
  z-index: 1;
}

.drawer-body {
  padding: 30px 20px 20px;
}

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

.drawer-row.justify-end {
  justify-content: flex-end;
}

.row-label {
  font-size: 15px;
  color: var(--text-dark);
  font-weight: 500;
}

.balance-options,
.multi-options {
  display: flex;
  gap: 8px;
}

.bal-opt,
.multi-opt {
  background: #f5f5f5;
  border: none;
  padding: 8px 12px;
  border-radius: 6px;
  color: var(--text-dark);
  font-weight: 600;
  font-size: 13px;
}

.bal-opt.active,
.multi-opt.active {
  background: #FFA726;
  /* Orange active state by default */
  color: white;
}

.bet-drawer.theme-blue .bal-opt.active,
.bet-drawer.theme-blue .multi-opt.active {
  background: #64B5F6;
}

.bet-drawer.theme-green .bal-opt.active,
.bet-drawer.theme-green .multi-opt.active {
  background: var(--green);
}

.bet-drawer.theme-red .bal-opt.active,
.bet-drawer.theme-red .multi-opt.active {
  background: var(--red);
}

.bet-drawer.theme-violet .bal-opt.active,
.bet-drawer.theme-violet .multi-opt.active {
  background: var(--violet);
}


.quantity-control {
  display: flex;
  align-items: center;
  gap: 2px;
}

.qty-btn {
  background: #FFA726;
  border: none;
  color: white;
  width: 32px;
  height: 32px;
  font-size: 18px;
  font-weight: bold;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.bet-drawer.theme-blue .qty-btn {
  background: #64B5F6;
}

.bet-drawer.theme-green .qty-btn {
  background: var(--green);
}

.bet-drawer.theme-red .qty-btn {
  background: var(--red);
}

.bet-drawer.theme-violet .qty-btn {
  background: var(--violet);
}

.qty-input {
  width: 60px;
  height: 32px;
  text-align: center;
  border: none;
  background: #f5f5f5;
  font-weight: bold;
  font-size: 14px;
}

.qty-input:focus {
  outline: none;
}

.drawer-agree {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-gray);
  margin-top: 10px;
}

.drawer-agree input {
  accent-color: var(--primary);
  width: 16px;
  height: 16px;
}

.rules-link {
  color: var(--primary);
}

.drawer-footer {
  display: flex;
  border-top: 1px solid #eee;
}

.drawer-btn-cancel,
.drawer-btn-submit {
  flex: 1;
  padding: 15px 0;
  font-size: 16px;
  font-weight: 600;
  border: none;
  background: #f5f5f5;
  color: var(--text-gray);
}

.drawer-btn-submit {
  color: white;
}

/* ============================================
   Chart Section
   ============================================ */
.chart-header {
  display: grid;
  grid-template-columns: 1fr 2fr;
  padding: 12px 16px;
  background: linear-gradient(135deg, #FF6670 0%, #FF3E3B 100%);
  font-size: 13px;
  font-weight: 700;
  color: white;
  text-align: center;
}

.chart-header span:first-child {
  text-align: left;
}

.chart-stats {
  padding: 8px 16px;
  border-bottom: 1px solid #f0f0f0;
  background: #fafafa;
}

.chart-stats-row {
  display: grid;
  grid-template-columns: 100px 1fr;
  align-items: center;
  padding: 6px 0;
  font-size: 12px;
  color: #57606f;
}

.chart-stats-row.stats-title {
  font-weight: 700;
  color: #1a1a2e;
  padding-bottom: 12px;
}

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

.chart-num-circle {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 8px;
  color: #a4b0be;
  border: 1px solid #dfe4ea;
  background: white;
}

.chart-num-circle.stat-header {
  border-color: #ff6670;
  color: #ff6670;
}

.chart-row {
  display: grid;
  grid-template-columns: 140px 1fr 24px;
  align-items: center;
  padding: 10px 16px;
  border-bottom: 1px solid #f5f6fa;
  font-size: 12px;
  color: #2f3542;
  font-family: inherit;
}

.chart-row .chart-nums-row {
  padding: 0 4px;
}

.chart-num-circle.active-green {
  background: #2ed573;
  border-color: #2ed573;
  color: white;
  font-weight: 700;
}

.chart-num-circle.active-red {
  background: #ff4757;
  border-color: #ff4757;
  color: white;
  font-weight: 700;
}

.chart-num-circle.active-violet {
  background: #9c88ff;
  border-color: #9c88ff;
  color: white;
  font-weight: 700;
}

.chart-sb-indicator {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  color: white;
}

.chart-sb-indicator.small {
  background: #1e90ff;
}

.chart-sb-indicator.big {
  background: #ffa502;
}


/* ============================================
   Dark Purple Theme Override
   Matches the rest of the app (styles.css):
   dark purple surfaces, gold/purple accents,
   Poppins font. Game colors (green/red/violet)
   are unchanged — they carry bet semantics.
   ============================================ */
:root {
  --primary: #7c5ce0;
  --primary-light: #9b7bf0;
  --primary-gradient: linear-gradient(135deg, #5b2a9e 0%, #7c5ce0 100%);
  --header-gradient: linear-gradient(135deg, #2d1560 0%, #5b2a9e 100%);
  --bg: #1a0533;
  --white: #241040;
  /* card surfaces */
  --text-dark: #ffffff;
  /* primary text */
  --text-gray: #b9b0d6;
  --text-light: #9a92b8;
  --border: rgba(255, 255, 255, 0.1);
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 4px 20px rgba(0, 0, 0, 0.4);
}

html,
body {
  font-family: 'Poppins', sans-serif;
}

.app-container {
  background: linear-gradient(180deg, #2d1560 0%, #1a0533 15%, #0d1b3e 50%, #1a0533 100%);
}

/* Gold accent (matches the app's --gold). Game colors stay untouched. */
:root {
  --gold: #e6a817;
  --gold-gradient: linear-gradient(135deg, #f7d057 0%, #d4a017 100%);
  /* Wallet icon: card body + button (color3) and the pocket accent (color4) */
  --secondary_color3: #fbb03b;
  --secondary_color4: #f7931e;
}

/* Timer digits: white chips, red numbers */
.timer-digit {
  background: #ffffff;
  color: #E8453C;
}

.how-to-play {
  background: rgba(255, 255, 255, 0.85);
  color: #4a2f00;
}

/* Mode tabs — active tab is a glowing gold pill */
.mode-icon {
  color: #7d739e;
  border-color: rgba(255, 255, 255, 0.2);
}

.mode-tab.active {
  background: var(--gold-gradient);
  box-shadow: 0 4px 14px rgba(230, 168, 23, 0.45);
}

.mode-icon.active,
.mode-tab.active .mode-icon {
  color: #d49010;
  border-color: #b57e0d;
  background: #fff6dd;
  box-shadow: 0 0 12px rgba(255, 214, 92, 0.9);
}

.mode-tab.active .mode-label,
.mode-tab.active .mode-sub {
  color: #3a2500;
}

/* History tabs & table — gold accent */
.hist-tab {
  border-color: var(--border);
  color: #b9b0d6;
}

.hist-tab.active {
  background: var(--gold-gradient);
  border-color: #d4a017;
  color: #3a2500;
}

.history-table-header {
  background: var(--gold-gradient);
  color: #3a2500;
}

.history-row:nth-child(even) {
  background: rgba(255, 255, 255, 0.03);
}

/* Chart tab — dark surfaces, gold accent */
.chart-header {
  background: var(--gold-gradient);
  color: #3a2500;
}

.chart-stats {
  background: rgba(255, 255, 255, 0.03);
  border-bottom-color: var(--border);
}

.chart-stats-row {
  color: var(--text-gray);
}

.chart-stats-row.stats-title {
  color: #ffffff;
}

.chart-num-circle {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--border);
  color: var(--text-light);
}

.chart-num-circle.stat-header {
  border-color: var(--gold);
  color: var(--gold);
  background: transparent;
}

.chart-row {
  color: var(--text-gray);
  border-bottom-color: var(--border);
}

/* active-green / active-red / active-violet keep their game colors */

/* ============================================
   My History — card list rows
   ============================================ */
.mybet-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 14px;
  border-bottom: 1px solid var(--border);
}

.mybet-badge {
  flex-shrink: 0;
  width: 52px;
  height: 52px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  text-align: center;
  line-height: 1.05;
}

.mybet-badge.b-big {
  background: linear-gradient(160deg, #ffb64d, #f7931e);
}

.mybet-badge.b-small {
  background: linear-gradient(160deg, #7ab8ff, #4a90e2);
}

.mybet-badge.b-green {
  background: linear-gradient(160deg, #4CAF50, #2E7D32);
}

.mybet-badge.b-red {
  background: linear-gradient(160deg, #ef5350, #c62828);
}

.mybet-badge.b-violet {
  background: linear-gradient(160deg, #ba68c8, #7b1fa2);
}

.mybet-badge.b-num {
  font-size: 24px;
}

.mybet-info {
  flex: 1;
  min-width: 0;
}

.mybet-period {
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.2px;
}

.mybet-time {
  font-size: 12px;
  color: var(--text-light);
  margin-top: 4px;
}

.mybet-right {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.mybet-pill {
  padding: 4px 15px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  border: 1px solid transparent;
  background: transparent;
}

.mybet-pill.win {
  color: #2ecc71;
  border-color: rgba(46, 204, 113, 0.6);
}

.mybet-pill.lose {
  color: #ff6b6b;
  border-color: rgba(255, 107, 107, 0.6);
}

.mybet-pill.pending {
  color: var(--text-light);
  border-color: var(--border);
}

.mybet-amount {
  font-size: 14px;
  font-weight: 700;
}

.mybet-amount.win {
  color: #2ecc71;
}

.mybet-amount.lose {
  color: #ff6b6b;
}

.mybet-amount.muted {
  color: var(--text-light);
}

.mybet-empty {
  padding: 30px 16px;
  text-align: center;
  color: var(--text-light);
  font-size: 13px;
}

/* Bet drawer controls */
.bal-opt,
.multi-opt {
  background: rgba(255, 255, 255, 0.08);
}

.qty-input {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-dark);
  border-color: var(--border);
}

.drawer-btn-cancel {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-gray);
}

/* Drawer subtitle chip stays white — keep its text dark */
.drawer-subtitle {
  color: #1a1a2e;
}

/* Win/loss popup shown after a round settles */
.bet-result-popup {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.brp-card {
  width: 280px;
  border-radius: 16px;
  padding: 28px 24px 20px;
  text-align: center;
  color: #fff;
  animation: brpPop 0.25s ease-out;
}

.brp-card.brp-win {
  background: linear-gradient(160deg, #2e7d32 0%, #145a1e 100%);
  box-shadow: 0 10px 40px rgba(46, 125, 50, 0.4);
}

.brp-card.brp-lose {
  background: linear-gradient(160deg, #5b2a9e 0%, #2d1560 100%);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.brp-title {
  font-size: 22px;
  font-weight: 800;
}

.brp-result {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.75);
  margin-top: 8px;
}

.brp-amount {
  font-size: 30px;
  font-weight: 900;
  margin: 14px 0 4px;
  color: #f5d778;
}

.brp-lose .brp-amount {
  color: #ff8a80;
}

.brp-close {
  margin-top: 14px;
  padding: 8px 32px;
  border: none;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

@keyframes brpPop {
  from {
    transform: scale(0.8);
    opacity: 0;
  }

  to {
    transform: scale(1);
    opacity: 1;
  }
}

/* ============================================
   How To Play modal
   ============================================ */
.htp-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 3000;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}

.htp-overlay.show {
  display: flex;
}

.htp-card {
  width: 100%;
  max-width: 360px;
  max-height: 82vh;
  background: #241040;
  border-radius: 20px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  animation: htpPop 0.25s ease-out;
}

.htp-header {
  background: var(--gold-gradient);
  color: #3a2500;
  font-weight: 800;
  font-size: 16px;
  text-align: center;
  padding: 16px;
  letter-spacing: 0.5px;
}

.htp-body {
  flex: 1;
  min-height: 0;
  padding: 20px 20px 4px;
  overflow-y: auto;
  color: #e4dcf5;
  font-size: 14px;
  line-height: 1.7;
}

.htp-body p {
  margin-bottom: 14px;
}

.htp-body p:last-child {
  margin-bottom: 0;
}

.htp-body b {
  color: #fff;
}

.htp-close {
  flex-shrink: 0;
  margin: 14px 20px 20px;
  padding: 13px;
  border: none;
  border-radius: 24px;
  background: var(--gold-gradient);
  color: #3a2500;
  font-weight: 800;
  font-size: 15px;
  cursor: pointer;
  box-shadow: 0 -8px 12px -8px rgba(0, 0, 0, 0.4);
}

@keyframes htpPop {
  from {
    transform: scale(0.9);
    opacity: 0;
  }

  to {
    transform: scale(1);
    opacity: 1;
  }
}
/* ============================================
   Win celebration popup (assets/popup/win.jpeg
   as the card, live data overlaid by % position)
   ============================================ */
.win-popup {
  position: fixed;
  inset: 0;
  z-index: 3500;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(8, 4, 16, 0.9);
  animation: winFade 0.2s ease-out;
}

.win-card {
  position: relative;
  width: min(86vw, 360px);
}

/* Winning popup is larger than the loss one */
.win-card.win {
  width: min(94vw, 420px);
}

.win-bg {
  width: 100%;
  display: block;
  border-radius: 18px;
}

/* Fade the image's cut bottom edge into the backdrop */
.win-card::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 46px;
  background: linear-gradient(rgba(8, 4, 16, 0), rgba(8, 4, 16, 0.9));
  border-radius: 0 0 18px 18px;
  pointer-events: none;
}

/* Lottery-results pills, right of the printed "Lottery results" label */
.win-results {
  position: absolute;
  top: 53.5%;
  left: 28%;
  right: 15%; /* keep pills inside the orange card (ends ~85.5%) */
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.win-pill {
  padding: 5px 11px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.28);
  color: #fff;
  font-weight: 700;
  font-size: clamp(10px, 2.9vw, 13px);
  white-space: nowrap;
}

.win-color.c-red { background: #e8574e; }
.win-color.c-green { background: #3fb56a; }
.win-color.c-violet { background: #a25fc9; }

.win-num {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.18);
  color: #fff;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(12px, 3.2vw, 14px);
}

.win-bonus {
  position: absolute;
  top: 72%;
  left: 0;
  right: 0;
  transform: translateY(-50%);
  text-align: center;
  color: #e8453c;
  font-weight: 900;
  font-size: clamp(18px, 5.2vw, 24px); /* fit within the receipt (~23%-77%) */
}

.win-period {
  position: absolute;
  top: 77.5%;
  left: 0;
  right: 0;
  transform: translateY(-50%);
  text-align: center;
  color: #c14a3f;
  font-weight: 600;
  font-size: clamp(9px, 2.5vw, 11.5px); /* number must sit inside the receipt (ends ~80.7%) */
  line-height: 1.35;
}

.win-autoclose {
  position: absolute;
  top: 88%;
  left: 12%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  color: #fff;
  font-weight: 600;
  font-size: clamp(11px, 3.3vw, 15px);
}

.win-check {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
}

.win-close {
  position: absolute;
  left: 50%;
  bottom: -28px;
  transform: translateX(-50%);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: transparent;
  border: 2px solid rgba(255, 255, 255, 0.85);
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}

@keyframes winFade {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* -------- Loss variant (assets/popup/loss.jpeg) --------
   Edge-to-edge card image (no crop). Card has a real rounded bottom,
   so no bottom-fade. Blue theme, "Sorry" ticket, no bonus amount. */
.win-card.lose .win-bg {
  border-radius: 0;
}

.win-card.lose::after { display: none; }

.win-card.lose .win-results {
  top: 48%;
  left: 40%;
}

.win-card.lose .win-period {
  top: 70%;
  color: #8087bd;
  font-size: clamp(10px, 2.8vw, 12.5px);
}

.win-card.lose .win-autoclose {
  top: 88%;
  color: #5b6390;
}

.win-card.lose .win-check {
  border-color: #8087bd;
  color: #8087bd;
}

.win-card.lose .win-close {
  border-color: rgba(120, 128, 189, 0.9);
  color: #5b6390;
}
