:root {
  --bg-main: #1c1c1c;
  --bg-dark: #2c2c2c;
  --bg-med: #404040;
  --bg-light: #525252;
  --text-light: #f5f5f5;
  --text-med: #a3a3a3;
  --text-dark: #737373;
  --primary: #22d3ee;
  --success: #4ade80;
  --warning: #facc15;
  --danger: #f87171;
  --font-family: 'Roboto', sans-serif;
  --border-radius: 8px;
  --shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  --app-height: 100vh;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { 
  font-size: 16px; 
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  touch-action: manipulation; /* Modern zoom prevention */
}

body {
font-family: var(--font-family);
background-color: var(--bg-main);
color: var(--text-light);
display: flex;
justify-content: center;
align-items: center;
height: var(--app-height);
padding: 8px;
overflow: hidden;
/* Fix #7: CSS-based mobile touch handling */
touch-action: manipulation;
user-select: none;
-webkit-user-select: none;
}

.container {
width: 100%;
max-width: 450px;
height: 100%;
max-height: 950px;
background-color: var(--bg-main);
border-radius: 12px;
box-shadow: var(--shadow);
display: flex;
flex-direction: column;
overflow: hidden;
border: 1px solid var(--bg-dark);
position: relative; 
opacity: 1;
}

/* --- GIFT BANNER --- */
.gift-banner {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 10000;
    background: linear-gradient(90deg, #1d4ed8, #3b82f6);
    color: white;
    text-align: center;
    padding: 8px;
    font-size: 0.95rem;
    font-weight: 500;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}
.gift-banner i { color: white; }
.gift-banner span { font-weight: 700; }

/* --- CONNECTING OVERLAY --- */
.connecting-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: var(--bg-main); display: flex; justify-content: center; align-items: center; z-index: 3000; }
.connecting-content { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 16px; }
.connecting-icon { width: 56px; height: 56px; animation: pulse 1.5s ease-in-out infinite; }
.connecting-content h2 { font-size: 1.5rem; font-weight: 500; color: var(--text-light); }
.connecting-spinner { display: flex; justify-content: center; align-items: center; gap: 4px; }
.connecting-error { margin-top: 16px; color: var(--danger); }
.connecting-error p { font-size: 1rem; margin-bottom: 12px; }
.retry-btn { padding: 8px 16px; background: var(--primary); color: var(--bg-main); border: none; border-radius: var(--border-radius); font-weight: 500; cursor: pointer; transition: background-color 0.2s ease; }
.retry-btn:hover { background: var(--success); }
@keyframes pulse { 0%, 100% { transform: scale(1); opacity: 0.8; } 50% { transform: scale(1.2); opacity: 1; } }

/* --- HEADER REDESIGN --- */
header { 
    display: grid;
    grid-template-columns: 100px 1fr 60px; /* Adjusted col widths for gold box */
    align-items: center;
    padding: 10px 16px; 
    flex-shrink: 0;
    background-color: var(--bg-main);
    border-bottom: 1px solid var(--bg-dark);
    position: relative;
    z-index: 100;
}

/* Balance - Top Left - GOLDEN BOX REDESIGN */
.header-left { display: flex; align-items: center; }
.balance-group {
    display: flex;
    flex-direction: column;
    padding: 4px 10px;
    border-radius: 6px;
    justify-content: center;
}

/* Golden Box Style */
.golden-box {
    border: 1px solid #ffd700; /* Gold Border */
    background: linear-gradient(135deg, #2c2c2c, #1a1a1a);
    box-shadow: 0 0 8px rgba(255, 215, 0, 0.2), inset 0 0 5px rgba(255, 215, 0, 0.1);
    position: relative;
    overflow: visible;
}

.balance-row {
    font-size: 0.95rem;
    font-weight: 700;
    color: white;
    display: flex;
    align-items: center;
    gap: 2px;
}
.balance-row .currency {
    color: #ffd700; /* Gold color */
    font-size: 0.85rem;
    margin-right: 2px;
}
.secondary-balance { 
    font-size: 0.65rem; 
    color: var(--text-med); 
    font-weight: 500;
    margin-top: 0px;
}

/* Title - Top Middle */
.header-center { display: flex; justify-content: center; }
.app-title { display: flex; align-items: center; gap: 8px; }
.title-icon { width: 20px; height: 20px; }
.app-title h1 { 
    font-size: 0.95rem; 
    font-weight: 800; 
    color: var(--text-light); 
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

/* Menu - Top Right */
.header-right { display: flex; justify-content: flex-end; position: relative; }
.menu-btn {
    background: transparent;
    border: none;
    color: var(--text-light);
    font-size: 1.3rem;
    padding: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
}
.menu-btn:hover { background-color: rgba(255,255,255,0.05); }

/* --- WALLET DROPDOWN (Now Menu Dropdown) --- */
.wallet-dropdown { position: absolute; top: 110%; right: 0; background-color: var(--bg-dark); border-radius: var(--border-radius); box-shadow: var(--shadow); min-width: 200px; z-index: 1000; opacity: 0; visibility: hidden; transform: translateY(-10px); transition: all 0.2s ease; border: 1px solid var(--bg-med); padding: 8px; }
.wallet-dropdown.show { opacity: 1; visibility: visible; transform: translateY(0); }
.wallet-dropdown-item { padding: 10px 12px; display: flex; align-items: center; justify-content: space-between; gap: 10px; color: var(--text-light); cursor: pointer; transition: background-color 0.2s ease; border-bottom: 1px solid rgba(255,255,255,0.05); }
.wallet-dropdown-item:last-child { border-bottom: none; }
.wallet-dropdown-item:hover { background-color: var(--bg-med); }
.wallet-dropdown-item i { color: var(--primary); width: 16px; margin-right: 8px; }
.wallet-dropdown-item span { font-weight: 500; font-size: 0.9rem; }

/* --- HISTORY --- */
.history-container { padding: 0 16px; position: relative; flex-shrink: 0; border-bottom: 1px solid var(--bg-dark); }
.history-visible { display: flex; gap: 8px; padding: 8px 0; overflow-x: auto; scrollbar-width: none; }
.history-visible::-webkit-scrollbar { display: none; }
.history-item { padding: 5px 10px; font-size: 13px; font-weight: 600; border-radius: 4px; flex-shrink: 0; cursor: pointer; transition: transform 0.2s ease; border: 1px solid transparent; text-align: center; min-width: 55px; }
.history-item.range1 { background-color: #00BFFF; color: white; }
.history-item.range2 { background-color: #800080; color: white; }
.history-item.range3 { background-color: #800000; color: white; }
.history-item.range4 { background-color: #0002FF; color: white; }
.history-item.range5 { background-color: #008000; color: white; }
.history-item.range6 { background-color: #FF7900; color: white; }
.history-item.range7 { background-color: #FF00FF; color: white; }
.history-toggle-btn { position: absolute; right: 0; top: 50%; transform: translateY(-50%); background: var(--bg-dark); border: none; color: var(--text-med); padding: 8px; border-radius: 4px; cursor: pointer; transition: all 0.2s ease; }
.history-toggle-btn:hover { background: var(--bg-med); color: var(--text-light); }
.history-toggle-btn.expanded i { transform: rotate(180deg); }
.history-full { position: absolute; top: 100%; left: 0; right: 0; background: var(--bg-dark); border-radius: 0 0 8px 8px; max-height: 0; overflow: hidden; z-index: 10; transition: max-height 0.3s ease; box-shadow: var(--shadow); }
.history-full.expanded { max-height: 200px; overflow-y: auto; }
.history-full-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(55px, 1fr)); gap: 6px; padding: 12px; }

/* --- GAME AREA --- */
.game-area { flex-grow: 1; position: relative; display: flex; padding: 12px; overflow: hidden; min-height: 0; }

/* TINY RAIN BUTTON REDESIGN */
.rain-promo-tiny {
    position: absolute;
    top: 15px; /* Adjust spacing */
    left: 15px;
    width: 36px; /* Slightly larger for image */
    height: 36px;
    border-radius: 50%;
    background-color: rgba(0,0,0,0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 20;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid rgba(255,255,255,0.1);
    overflow: hidden;
}

.rain-icon-img {
    width: 24px;
    height: 24px;
    object-fit: contain;
}

/* Active State (Glow) */
.rain-promo-tiny.active {
    background-color: rgba(34, 211, 238, 0.1);
    border-color: var(--primary);
    box-shadow: 0 0 10px rgba(34, 211, 238, 0.4);
}

.rain-glow {
    position: absolute;
    top: -2px; left: -2px; right: -2px; bottom: -2px;
    border-radius: 50%;
    border: 2px solid transparent;
    border-top-color: var(--warning);
    border-left-color: var(--warning);
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
}

.rain-promo-tiny.active .rain-glow {
    opacity: 1;
    animation: spin-glow 2s linear infinite;
}

@keyframes spin-glow {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}


.graph-container { width: 100%; height: 100%; background-image: radial-gradient(circle, #2c2c2c 0%, #1c1c1c 70%); border-radius: var(--border-radius); position: relative; overflow: hidden; }
@keyframes planeWobble { 0%, 100% { transform: translateY(0) rotate(0); } 25% { transform: translateY(-5px) rotate(-1deg); } 50% { transform: translateY(0) rotate(0); } 75% { transform: translateY(5px) rotate(1deg); } }
.plane { position: absolute; width: 33%; height: auto; transform-origin: center; transition: all 0.05s linear; filter: drop-shadow(0 0 8px #f87171aa); z-index: 3; animation: planeWobble 0.5s ease-in-out infinite; }
.plane-trail-svg { position: absolute; inset: 0; z-index: 2; pointer-events: none; opacity: 0; }
#planeTrailPath { stroke-width: 5px; stroke-linecap: round; fill: none; stroke: url(#trail-gradient); filter: drop-shadow(0 0 5px rgba(250, 204, 21, 0.7)); }
.multiplier-display { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); font-size: clamp(2rem, 8vw, 3.5rem); font-weight: 700; color: white; transition: color 0.3s ease; text-shadow: 0 0 15px rgba(0, 0, 0, 0.5); z-index: 4; }
.multiplier-display.crashed { color: var(--danger); }
.multiplier-display.betting { opacity: 0; }
.game-status-overlay { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; background: #1c1c1cdd; z-index: 5; opacity: 0; pointer-events: none; transition: opacity 0.3s ease; }
.game-status-overlay.visible { opacity: 1; pointer-events: all; }
.status-message { font-size: 1.1rem; font-weight: 500; color: var(--warning); margin-top: 16px; }

/* Countdown */
.countdown-timer { position: relative; width: 90px; height: 90px; display: none; }
.countdown-svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.countdown-track { fill: none; stroke: var(--bg-med); stroke-width: 8; }
.countdown-progress { fill: none; stroke: var(--warning); stroke-width: 8; stroke-linecap: round; transition: stroke-dashoffset 0.1s linear; }
.countdown-text { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); color: var(--text-light); font-size: 1.8rem; font-weight: 700; font-family: monospace; }

.spinner-ring { width: 8px; height: 8px; border: 2px solid transparent; border-top: 2px solid var(--primary); border-radius: 50%; animation: spin 1s linear infinite; }
.spinner-ring:nth-child(2) { animation-delay: 0.1s; }
.spinner-ring:nth-child(3) { animation-delay: 0.2s; }
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* --- FLOATING MONEY ANIMATION --- */
.floating-text {
    position: fixed;
    font-weight: 800;
    font-size: 1.2rem;
    pointer-events: none;
    z-index: 9999;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
    white-space: nowrap;
}
.floating-text.win { color: #4ade80; } /* Green */
.floating-text.loss { color: #f87171; } /* Red for debit */

/* --- BETTING CONTROLS --- */
.bet-controls-wrapper { display: flex; flex-direction: column; gap: 6px; padding: 6px; background-color: var(--bg-main); flex-shrink: 0; }

/* TABS NAVIGATION */
.tabs-nav {
  display: flex;
  background-color: var(--bg-dark);
  border-radius: var(--border-radius);
  padding: 4px;
  margin-bottom: 4px;
  gap: 4px;
}
.tab-btn {
  flex: 1;
  background: none;
  border: none;
  color: var(--text-med);
  padding: 8px;
  border-radius: 6px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.9rem;
}
.tab-btn.active {
  background-color: var(--bg-light);
  color: var(--text-light);
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}
.tab-btn:hover:not(.active) { color: var(--text-light); }

/* --- BUTTON EFFECTS (Responsive Feel) --- */
/* Applied to buttons to make them feel "real" */
.btn-effect {
    transition: transform 0.05s ease, filter 0.1s ease;
    -webkit-tap-highlight-color: transparent;
}
.btn-effect:active:not(:disabled) {
    transform: scale(0.96);
    filter: brightness(1.1);
}

.bet-panel { display: flex; flex-direction: column; gap: 6px; }

/* Auto Bet Visuals */
.bet-control.auto-bet-active { border: 2px solid var(--primary); background: linear-gradient(135deg, var(--bg-dark), rgba(34, 211, 238, 0.1)); }
.bet-control.auto-bet-ready { border-color: var(--success); background: linear-gradient(135deg, var(--bg-dark), rgba(74, 222, 128, 0.1)); animation: pulse-glow 2s infinite; }
@keyframes pulse-glow { 0%, 100% { box-shadow: 0 0 5px rgba(34, 211, 238, 0.5); } 50% { box-shadow: 0 0 15px rgba(34, 211, 238, 0.8); } }
.auto-option span { transition: color 0.3s ease; }
.bet-control.auto-bet-active .auto-option span { color: var(--primary); font-weight: 600; }
.bet-control.auto-bet-ready .auto-option span { color: var(--success); font-weight: 700; }

.bet-control { background-color: var(--bg-dark); border-radius: var(--border-radius); padding: 8px; display: flex; flex-direction: column; gap: 8px; flex-shrink: 0; transition: all 0.3s ease; }
.bet-grid { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; }
.bet-main { display: flex; flex-direction: column; gap: 6px; }
.amount-control { display: flex; align-items: center; background-color: var(--bg-main); border-radius: 6px; }
.bet-amount-input { flex-grow: 1; background: none; border: none; outline: none; color: var(--text-light); font-size: 16px; font-weight: 700; text-align: center; width: 60px; -moz-appearance: textfield; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
.bet-amount-input[readonly], .auto-cashout-input[readonly] { cursor: pointer; }
.bet-amount-input[readonly]:hover, .auto-cashout-input[readonly]:hover { background-color: rgba(255,255,255,0.05); }
.bet-amount-input::-webkit-outer-spin-button, .bet-amount-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.amount-mod { background: var(--bg-med); color: var(--text-light); border: none; font-size: 1.3rem; width: 36px; height: 36px; cursor: pointer; transition: background-color 0.2s; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
.amount-mod:hover { background-color: var(--bg-light); }
.amount-mod.minus { border-radius: 6px 0 0 6px; }
.amount-mod.plus { border-radius: 0 6px 6px 0; }
.quick-bets { display: flex; justify-content: space-between; gap: 4px; }
.quick-bet-btn { flex-grow: 1; background-color: var(--bg-main); color: var(--text-med); border: 1px solid var(--bg-med); border-radius: 4px; padding: 4px; cursor: pointer; transition: all 0.2s; font-size: 0.75rem; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
.quick-bet-btn:hover { background-color: var(--bg-med); color: var(--text-light); }
.action-btn { padding: 8px; border: none; border-radius: var(--border-radius); font-size: 1.1rem; font-weight: 700; cursor: pointer; transition: all 0.2s ease; height: 100%; display: flex; flex-direction: column; justify-content: center; align-items: center; min-width: 100px; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
.action-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.place-bet-btn { background-color: var(--success); color: white; box-shadow: 0 4px 0 #15803d; } /* Added shadow depth */
.place-bet-btn:active:not(:disabled) { box-shadow: 0 2px 0 #15803d; transform: translateY(2px); }

.cashout-btn { background-color: var(--warning); color: var(--bg-main); box-shadow: 0 4px 0 #b45309; }
.cashout-btn:active:not(:disabled) { box-shadow: 0 2px 0 #b45309; transform: translateY(2px); }

.cancel-btn { background-color: var(--danger); color: white; }
.waiting-btn { background-color: #f59e0b; color: #1c1c1c; opacity: 0.9; }

/* Voucher Action Button State */
.action-btn.place-bet-btn.using-voucher {
  background: linear-gradient(135deg, #ec4899, #db2777); /* Pink for voucher */
  border: 1px solid #f472b6;
  box-shadow: 0 4px 0 #9d174d;
}
.action-btn.place-bet-btn.using-voucher:active:not(:disabled) { box-shadow: 0 2px 0 #9d174d; transform: translateY(2px); }

.action-btn span { font-size: 0.9rem; font-weight: 500; }
.action-btn.place-bet-btn.using-voucher span {
    font-size: 0.75rem;
    opacity: 0.9;
    font-weight: 400;
}

.auto-panel { display: flex; justify-content: space-between; gap: 12px; padding: 2px; }
.auto-option { display: flex; align-items: center; gap: 6px; color: var(--text-med); font-size: 0.85rem; }
.auto-cashout-input { background: var(--bg-main); border: 1px solid var(--bg-med); border-radius: 4px; color: var(--text-light); padding: 3px 6px; width: 60px; text-align: center; font-size: 16px; -moz-appearance: textfield; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
.auto-cashout-input::-webkit-outer-spin-button, .auto-cashout-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.auto-cashout-input:disabled { background-color: transparent; border-color: transparent; }
.switch { position: relative; display: inline-block; width: 40px; height: 22px; }
.switch input { display: none; }
.slider { position: absolute; cursor: pointer; inset: 0; background-color: var(--bg-med); border-radius: 22px; transition: .4s; }
.slider:before { position: absolute; content: ""; height: 16px; width: 16px; left: 3px; bottom: 3px; background-color: var(--bg-dark); border-radius: 50%; transition: .4s; }
input:checked + .slider { background-color: var(--success); }
input:disabled + .slider { opacity: 0.5; cursor: not-allowed; }
input:checked + .slider:before { transform: translateX(18px); }

/* Gift Button Replacement - FIX #5: White Color */
.quick-bet-btn.gift-btn {
    border-color: #f472b6;
    color: white !important; /* Force White */
    background: rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1rem;
}
.quick-bet-btn.gift-btn:hover {
    background: #f472b6;
    color: #fff;
}

/* O/U PANEL STYLES */
.ou-container {
  background-color: #1a1a1a;
  border-radius: var(--border-radius);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 15px;
}
.ou-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.ou-label {
  font-size: 0.8rem;
  color: var(--text-med);
  text-transform: uppercase;
  font-weight: 600;
  text-align: center;
}
.ou-control-group {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background-color: #000;
  padding: 6px 10px;
  border-radius: 30px;
}
.ou-circle-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--bg-light);
  background-color: var(--bg-dark);
  color: var(--text-light);
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}
.ou-circle-btn:active { transform: scale(0.95); background-color: var(--bg-light); }
.ou-input-wrapper {
  flex-grow: 1;
  text-align: center;
  position: relative;
}
#ouBetAmount, #ouCoefInput {
  background: transparent;
  border: none;
  color: white;
  font-size: 1.5rem;
  font-weight: 700;
  width: 100%;
  text-align: center;
  outline: none;
  padding: 0;
}
.ou-x-marker {
  font-size: 1rem;
  color: var(--primary);
  font-weight: 700;
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  opacity: 0.5;
}
.ou-actions {
  display: flex;
  gap: 10px;
  margin-top: 5px;
}
.ou-action-btn {
  flex: 1;
  border: none;
  border-radius: 10px;
  padding: 15px 10px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: transform 0.1s;
  -webkit-tap-highlight-color: transparent;
  box-shadow: 0 4px 0 rgba(0,0,0,0.3);
}
.ou-action-btn:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 2px 0 rgba(0,0,0,0.3); }

.ou-action-btn.over {
  background-color: #f59e0b; /* Yellow/Orange */
  color: #000;
}
.ou-action-btn.under {
  background-color: #0ea5e9; /* Blue */
  color: white;
}
.ou-action-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.ou-act-title {
  font-weight: 800;
  font-size: 1.2rem;
  letter-spacing: 1px;
}
.ou-act-odds {
  font-size: 0.9rem;
  font-weight: 500;
  opacity: 0.9;
}
.ou-quick {
    background: #333;
    border: 1px solid #444;
    color: #aaa;
    border-radius: 20px;
    padding: 6px 0;
}

/* O/U Button States */
.ou-action-btn.waiting {
  background-color: var(--bg-light) !important;
  color: var(--warning) !important;
  border: 1px solid var(--warning);
  animation: pulse-border 1.5s infinite;
}

.ou-action-btn.won {
  background-color: var(--success) !important;
  color: white !important;
  border: 1px solid var(--success);
  transform: scale(1.02);
}

.ou-action-btn.lost {
  background-color: var(--danger) !important;
  color: white !important;
  border: 1px solid var(--danger);
  opacity: 0.8;
}

@keyframes pulse-border {
  0% { box-shadow: 0 0 0 0 rgba(250, 204, 21, 0.4); }
  70% { box-shadow: 0 0 0 10px rgba(250, 204, 21, 0); }
  100% { box-shadow: 0 0 0 0 rgba(250, 204, 21, 0); }
}

/* --- NOTIFICATION --- */
/* FIX: INCREASED Z-INDEX TO 9999 TO APPEAR OVER RAIN MODAL */
#notification { position: fixed; top: 20%; left: 50%; transform: translate(-50%, 0) scale(1); padding: 16px 32px; border-radius: var(--border-radius); font-weight: 600; font-size: 1.2rem; z-index: 9999; transition: transform 0.4s ease-in-out, opacity 0.4s ease-in-out; opacity: 0; max-width: 90%; text-align: center; box-shadow: var(--shadow); cursor: pointer; }
.notification.show { opacity: 1; transform: translate(-50%, 0); }
.notification.success { background-color: var(--success); color: white; }
.notification.error { background-color: var(--danger); color: white; }
.notification.warning { background-color: var(--warning); color: var(--bg-main); }
@media (max-width: 450px) { #notification { top: 10%; font-size: 1.1rem; padding: 12px 24px; } }

/* --- MY BETS FULL-SCREEN MODAL --- */
.my-bets-modal { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.7); z-index: 2000; opacity: 0; visibility: hidden; transition: all 0.3s ease; }
.my-bets-modal.show { opacity: 1; visibility: visible; }
.my-bets-modal-content { background: var(--bg-main); width: 100%; height: 100%; max-width: none; max-height: none; border-radius: 0; box-shadow: none; border: none; display: flex; flex-direction: column; }
.my-bets-modal-header { padding: 12px 16px; border-bottom: 1px solid var(--bg-dark); display: flex; justify-content: space-between; align-items: center; flex-shrink: 0; }
.my-bets-modal-header h2 { font-size: 1.2rem; color: var(--text-light); font-weight: 500; }
.my-bets-modal-close { background: none; border: none; color: var(--text-med); font-size: 1.5rem; cursor: pointer; transition: color 0.2s ease; }
.my-bets-modal-close:hover { color: var(--text-light); }
.my-bets-modal-body { padding: 12px; overflow-y: auto; flex-grow: 1; scrollbar-width: thin; display: flex; flex-direction: column; gap: 8px; }
.my-bets-modal-body::-webkit-scrollbar { width: 6px; }
.my-bets-modal-body::-webkit-scrollbar-track { background: var(--bg-dark); }
.my-bets-modal-body::-webkit-scrollbar-thumb { background: var(--bg-med); border-radius: 3px; }
.my-bets-modal-body::-webkit-scrollbar-thumb:hover { background: var(--bg-light); }
.my-bet-item { display: flex; justify-content: space-between; align-items: center; font-size: 0.85rem; padding: 8px 12px; background-color: var(--bg-dark); border-radius: 4px; border-left: 4px solid var(--text-dark); }
.my-bet-item.win { border-left-color: var(--success); }
.my-bet-item.loss { border-left-color: var(--danger); }
.bet-details, .bet-result { display: flex; flex-direction: column; }
.bet-details { align-items: flex-start; }
.bet-result { align-items: flex-end; }
.timestamp { font-size: 0.7rem; color: var(--text-med); margin-bottom: 4px; }
.amount { font-weight: 600; }
.mult { font-size: 0.8rem; color: var(--text-med); margin-bottom: 4px; }
.my-bet-item span { text-align: right; }
.my-bet-item .profit { font-weight: 700; }
.my-bet-item .profit.win { color: var(--success); }
.my-bet-item .profit.loss { color: var(--danger); }
.bonus-badge { font-size: 0.7rem; background: var(--primary); color: var(--bg-main); padding: 1px 3px; border-radius: 3px; margin-left: 4px; }

@media (max-width: 450px) { .container { padding: 4px; } .bet-controls-wrapper { gap: 4px; padding: 4px; } .action-btn { font-size: 1rem; padding: 6px; } .quick-bet-btn { font-size: 0.7rem; } .history-item { min-width: 50px; font-size: 12px; } }

/* --- BONUS STYLES --- */
.bonus-info-bar { background-color: rgba(34, 211, 238, 0.1); color: var(--primary); text-align: center; padding: 6px; font-size: 0.9rem; font-weight: 500; border-top: 1px solid var(--bg-dark); border-bottom: 1px solid var(--bg-dark); }
.bonus-prompt-modal { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.7); z-index: 2500; display: flex !important; justify-content: center; align-items: center; opacity: 0; visibility: hidden; transition: all 0.3s ease; }
.bonus-prompt-modal.show { opacity: 1; visibility: visible; }
.bonus-prompt-content { background: var(--bg-dark); padding: 24px; border-radius: var(--border-radius); text-align: center; width: 90%; max-width: 320px; box-shadow: var(--shadow); position: relative; border: 1px solid var(--bg-med); }
.bonus-prompt-content h3 { color: var(--text-light); margin-bottom: 8px; font-size: 1.2rem; }
.bonus-prompt-content p { color: var(--text-med); margin-bottom: 20px; font-size: 0.9rem; }
.bonus-prompt-buttons { display: flex; gap: 12px; }
.bonus-choice-btn { flex: 1; padding: 12px; border: none; border-radius: var(--border-radius); font-size: 1rem; font-weight: 700; cursor: pointer; transition: all 0.2s ease; }
.bonus-choice-btn.bonus { background-color: var(--primary); color: var(--bg-main); }
.bonus-choice-btn.bonus:hover { opacity: 0.9; }
.bonus-choice-btn.real { background-color: var(--bg-light); color: var(--text-light); }
.bonus-choice-btn.real:hover { background-color: var(--bg-med); }
.cancel-choice-btn { position: absolute; top: 8px; right: 8px; background: none; border: none; color: var(--text-med); font-size: 1.5rem; cursor: pointer; line-height: 1; }
.cancel-choice-btn:hover { color: var(--text-light); }


/* --- RAIN MODAL STYLES --- */
.rain-modal { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.7); z-index: 2500; display: flex; justify-content: center; align-items: center; opacity: 0; visibility: hidden; transition: all 0.3s ease; backdrop-filter: blur(5px); }
.rain-modal.show { opacity: 1; visibility: visible; }
.rain-modal-content { background: rgba(44, 44, 44, 0.95); border-radius: var(--border-radius); width: 90%; max-width: 400px; box-shadow: var(--shadow); border: 1px solid var(--bg-med); overflow: hidden; backdrop-filter: blur(10px); }
.rain-modal-header { padding: 16px; border-bottom: 1px solid var(--bg-med); display: flex; justify-content: space-between; align-items: center; background: rgba(34, 211, 238, 0.1); }
.rain-modal-header h2 { font-size: 1.2rem; color: var(--text-light); font-weight: 500; display: flex; align-items: center; gap: 8px; }
.rain-modal-close { background: none; border: none; color: var(--text-med); font-size: 1.5rem; cursor: pointer; transition: color 0.2s ease; width: 30px; height: 30px; display: flex; align-items: center; justify-content: center; border-radius: 50%; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
.rain-modal-close:hover { background: var(--bg-med); color: var(--text-light); }
.rain-modal-body { padding: 24px; text-align: center; display: flex; flex-direction: column; gap: 20px; }
.rain-timer { font-size: 1.1rem; font-weight: 700; color: var(--primary); font-family: monospace; background: rgba(34, 211, 238, 0.1); padding: 8px 16px; border-radius: 20px; border: 1px solid var(--primary); }
.rain-gifts-info { justify-content: space-between; align-items: center; background: var(--bg-dark); padding: 12px 16px; border-radius: var(--border-radius); border: 1px solid var(--bg-med); display: none; }
.gifts-left { font-size: 1rem; font-weight: 600; color: var(--text-light); }
.gift-amount { font-size: 0.9rem; color: var(--success); font-weight: 500; }
.rain-claim-circle-btn { background: linear-gradient(135deg, var(--success), #22c55e); color: white; border: none; border-radius: 50%; width: 140px; height: 140px; font-size: 1.1rem; font-weight: 700; cursor: pointer; transition: all 0.3s ease; margin: 0 auto; display: flex; justify-content: center; align-items: center; text-align: center; box-shadow: 0 8px 25px rgba(34, 197, 94, 0.3); position: relative; overflow: hidden; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
.rain-claim-circle-btn:hover:not(:disabled) { transform: scale(1.05); box-shadow: 0 12px 35px rgba(34, 197, 94, 0.4); }
.rain-claim-circle-btn:active:not(:disabled) { transform: scale(0.95); }
.rain-claim-circle-btn:disabled { background: var(--bg-med); color: var(--text-med); cursor: not-allowed; transform: none; box-shadow: none; }
.rain-claim-circle-btn.pulse { animation: pulse 2s infinite; }
.claim-text { display: flex; flex-direction: column; gap: 4px; }
.rain-eligibility-message, .rain-claimed-message { align-items: center; justify-content: center; gap: 8px; padding: 12px; border-radius: var(--border-radius); font-size: 0.9rem; font-weight: 500; display: none; }
.rain-eligibility-message { background: rgba(248, 113, 113, 0.1); color: var(--danger); border: 1px solid var(--danger); }
.rain-claimed-message { background: rgba(34, 197, 94, 0.1); color: var(--success); border: 1px solid var(--success); }

/* --- VOUCHER MODAL & STYLES --- */
.voucher-modal { position: fixed; bottom: 0; left: 0; width: 100%; height: auto; z-index: 2800; opacity: 0; visibility: hidden; transition: all 0.3s ease; display: flex; align-items: flex-end; justify-content: center; }
.voucher-modal.show { opacity: 1; visibility: visible; }

.voucher-modal-content { 
    background: #1e1e1e; 
    width: 100%; 
    max-width: 450px; 
    border-radius: 16px 16px 0 0; 
    box-shadow: 0 -5px 20px rgba(0,0,0,0.5); 
    display: flex; 
    flex-direction: column; 
    overflow: hidden; 
    /* Slightly reducing max-height ensures clear starting point */
    max-height: 75vh; 
}

.voucher-modal-header { padding: 12px 16px; border-bottom: 1px solid #333; display: flex; justify-content: space-between; align-items: center; background: #252525; }
.voucher-modal-header h2 { font-size: 1.1rem; color: #fff; font-weight: 600; }
.voucher-modal-close { background: none; border: none; color: #aaa; font-size: 1.5rem; cursor: pointer; }

/* Voucher List (Updated for Single View + Peek) */
.voucher-list-container { 
    padding: 20px 16px; 
    display: flex; 
    flex-direction: column; 
    gap: 15px; /* Clear separation between cards */
    overflow-y: auto; 
    /* Limit height to enforce scrolling. 
       This height combined with card min-height ensures ~1.2 cards are visible. */
    max-height: 60vh; 
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
    transition: padding-bottom 0.3s ease; /* Fix #2 */
}

/* Fix #2: Add Padding when keyboard is active so items can be scrolled up */
.voucher-list-container.keyboard-active {
    padding-bottom: 250px !important;
}

.voucher-card {
    background-color: #2c2c2c;
    border-radius: 12px;
    overflow: hidden; /* Kept hidden to clip children */
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 10px rgba(0,0,0,0.4);
    
    /* VITAL FIX: Prevent cards from shrinking or overlapping */
    flex-shrink: 0; 
    
    /* Ensure card takes full width and has enough height */
    width: 100%;
    min-height: 220px; 
    margin-bottom: 5px;
}

/* Updated Teal Header */
.v-card-top {
    background: linear-gradient(90deg, #14b8a6, #0d9488); /* Teal gradient */
    padding: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0; /* Header doesn't shrink */
}
.v-header-text {
    font-size: 1.5rem;
    font-weight: 800;
    color: white;
    letter-spacing: 0.5px;
}

.v-card-middle {
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex-grow: 1; /* Takes available space */
}
.v-title {
    color: #22d3ee;
    font-weight: 700;
    font-size: 1.1rem;
}
.v-expiry {
    color: #a3a3a3;
    font-size: 0.95rem;
    font-weight: 500;
}
.v-note {
    font-size: 0.8rem;
    color: #737373;
    margin-top: 4px;
}

.v-card-bottom {
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid #333;
    background-color: #252525;
    flex-shrink: 0; /* Bottom bar doesn't shrink */
}

.v-use-btn {
    background: #6366f1; /* Indigoish */
    color: white;
    border: none;
    border-radius: 6px;
    padding: 10px 28px;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.v-use-btn:active { transform: scale(0.95); }

/* Partial Input in Voucher Card */
.v-partial-section { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.v-partial-label { font-size: 0.85rem; color: rgba(255,255,255,0.8); cursor: pointer; display: flex; align-items: center; gap: 6px; }
.v-partial-circle { width: 14px; height: 14px; border-radius: 50%; background: rgba(0,0,0,0.3); border: 1px solid rgba(255,255,255,0.5); }
.v-partial-label.active .v-partial-circle { background: #4ade80; border-color: #4ade80; }
.v-partial-input {
    background: rgba(0,0,0,0.3);
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 6px;
    color: white;
    padding: 6px 10px;
    width: 120px;
    text-align: right;
    font-weight: 600;
    display: none;
    outline: none;
}
.v-partial-input.show { display: block; }
.v-partial-input::placeholder { color: rgba(255,255,255,0.5); }

/* --- FIX #2: PERSISTENCE UI (Pink Overlay Input) --- */
.voucher-ui-container {
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 100%;
}
.v-ui-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.7rem;
    color: #a3a3a3;
    padding: 0 2px;
}
.v-ui-input-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: #000;
    border: 2px solid #ec4899; /* Pink Border */
    border-radius: 6px;
    padding: 0 10px;
    height: 42px;
    position: relative;
}
.v-ui-icon {
    color: #ec4899;
    font-size: 1.1rem;
}
.v-ui-amount {
    color: white;
    font-size: 1.2rem;
    font-weight: 700;
}
.v-ui-close-btn {
    background: #333;
    color: #aaa;
    border: none;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.v-ui-close-btn:hover { background: #444; color: white; }


/* --- MINI KEYBOARD STYLES --- */
.mini-keyboard { position: fixed; bottom: 0; left: 50%; transform: translate(-50%, 100%); width: 100%; max-width: 450px; background-color: #333; z-index: 3000; display: flex; padding: 8px; gap: 8px; border-top: 1px solid var(--bg-light); transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1); box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3); }
.mini-keyboard.visible { transform: translate(-50%, 0); }
.keyboard-main { flex-grow: 1; display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.keyboard-actions { display: flex; flex-direction: column; gap: 6px; width: 70px; }
.key-btn { background-color: var(--bg-med); border: none; color: var(--text-light); border-radius: var(--border-radius); font-size: 1.2rem; font-weight: 500; cursor: pointer; padding: 12px 0; transition: background-color 0.1s ease, transform 0.05s ease; -webkit-tap-highlight-color: transparent; touch-action: manipulation; min-height: 44px; }
.key-btn.active-key { background-color: var(--bg-light); transform: scale(0.95); }
.keyboard-actions .key-btn { flex-grow: 1; }
.keyboard-actions .key-btn.done { background-color: var(--success); color: white; font-size: 1rem; }
@media (max-width: 450px) { .key-btn { min-height: 44px; } .amount-mod, .quick-bet-btn, .action-btn { min-height: 44px; min-width: 44px; } .bet-control, .wallet-dropdown-item, .history-item { -webkit-user-select: none; user-select: none; } }
.bet-amount-input:focus, .auto-cashout-input:focus { background-color: rgba(255, 255, 255, 0.1); outline: none; }
.bet-control, .wallet-dropdown-item, .history-item, .key-btn, .amount-mod, .quick-bet-btn, .action-btn { -webkit-user-select: none; user-select: none; }