/* ============ AVIATOR — Red & Black theme (Mobile No-Scroll Optimized) ============ */
:root {
  --bg: #0b0b0f;
  --bg-2: #121218;
  --bg-3: #1a1a22;
  --panel: #16161d;
  --border: #262633;
  --red: #e50539;
  --red-2: #ff2d55;
  --red-dark: #8f0224;
  --text: #f2f2f5;
  --muted: #8b8b99;
  --green: #2ecc71;
  --green-dark: #27ae60;
  --gold: #ffb800;
  --purple: #913ef8;
  --blue: #34b4ff;
  --radius: 12px;
  --font-display: 'Rajdhani', 'Inter', sans-serif;
  --font-body: 'Inter', system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font-body);
  background: radial-gradient(ellipse at top, #1c0a10 0%, var(--bg) 55%);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

button { font-family: inherit; cursor: pointer; border: none; }
input, select, textarea { font-family: inherit; }
a { color: inherit; }
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-thumb { background: #33333f; border-radius: 2px; }

#app { min-height: 100vh; display: flex; flex-direction: column; }

/* ---------- top bar ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 14px; gap: 10px;
  background: linear-gradient(180deg, #17171f, #0f0f14);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 30;
}
.brand {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--font-display); font-weight: 700; font-size: 22px;
  letter-spacing: 1.5px; color: var(--red);
  text-shadow: 0 0 16px rgba(229,5,57,.5);
}
.brand i { font-size: 18px; transform: rotate(-20deg); }
.topbar-right { display: flex; align-items: center; gap: 8px; }
.balance-chip {
  display: flex; align-items: center; gap: 4px;
  background: #09090d; border: 1px solid var(--border); border-radius: 999px;
  padding: 4px 12px; font-weight: 700; font-family: var(--font-display); font-size: 16px;
}
.balance-chip .cur { color: var(--green); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 14px; border-radius: 8px; font-weight: 600; font-size: 13px;
  transition: .15s; background: var(--bg-3); color: var(--text); border: 1px solid var(--border);
}
.btn:hover { filter: brightness(1.15); }
.btn:disabled { opacity: .5; cursor: not-allowed; filter: none; }
.btn-red { background: linear-gradient(180deg, var(--red-2), var(--red)); border-color: var(--red); box-shadow: 0 4px 14px rgba(229,5,57,.35); }
.btn-green { background: linear-gradient(180deg, var(--green), var(--green-dark)); border-color: var(--green-dark); color: #fff; font-weight: 700; }
.btn-gold { background: linear-gradient(180deg, #ffd24d, var(--gold)); color: #1a1200; border-color: var(--gold); }
.btn-outline { background: transparent; }
.btn-sm { padding: 5px 9px; font-size: 12px; border-radius: 7px; }
.btn-icon { width: 34px; height: 34px; padding: 0; border-radius: 50%; position: relative; }
.badge-dot {
  position: absolute; top: -2px; right: -2px; min-width: 16px; height: 16px;
  border-radius: 8px; background: var(--red); color: #fff; font-size: 10px;
  font-weight: 700; display: flex; align-items: center; justify-content: center; padding: 0 4px;
}

/* ---------- layout ---------- */
.main {
  flex: 1; display: grid; grid-template-columns: minmax(0, 1fr) 300px;
  gap: 12px; padding: 10px 14px; max-width: 1300px; width: 100%; margin: 0 auto;
}
#game-col { min-width: 0; display: flex; flex-direction: column; }
.panel { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); }
.panel-title {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px; border-bottom: 1px solid var(--border);
  font-family: var(--font-display); font-weight: 700; font-size: 14px;
  letter-spacing: 1px; text-transform: uppercase; color: var(--muted);
}

/* ---------- history strip ---------- */
.history { display: flex; gap: 5px; overflow-x: auto; padding: 6px 8px; scrollbar-width: none; }
.history::-webkit-scrollbar { display: none; }
.hchip {
  flex: 0 0 auto; padding: 3px 8px; border-radius: 999px;
  font-weight: 700; font-size: 12px; font-family: var(--font-display);
  background: #09090d; border: 1px solid #232330;
}
.hchip.low { color: var(--blue); }
.hchip.mid { color: var(--purple); }
.hchip.high { color: var(--red-2); text-shadow: 0 0 8px rgba(255,45,85,.6); }

/* ---------- game canvas ---------- */
.game-wrap {
  position: relative; border-radius: var(--radius); overflow: hidden; border: 1px solid #3a0c17;
  background: radial-gradient(ellipse at bottom left, #2a0611 0%, #0b0b0f 65%);
  box-shadow: inset 0 0 60px rgba(229,5,57,.1), 0 8px 30px rgba(0,0,0,.6);
  margin-top: 6px;
}
.game-canvas { display: block; width: 100%; height: 320px; }
.game-overlay { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; pointer-events: none; }
.mult {
  font-family: var(--font-display); font-weight: 700; font-size: 72px; line-height: 1;
  color: #fff; text-shadow: 0 0 24px rgba(255,255,255,.35); letter-spacing: 1px;
}
.mult.crashed { color: var(--red-2); text-shadow: 0 0 35px rgba(229,5,57,.8); }
.flew { font-family: var(--font-display); font-weight: 600; font-size: 18px; letter-spacing: 2.5px; text-transform: uppercase; color: #ffb3c4; margin-bottom: 4px; }
.waiting { font-family: var(--font-display); font-weight: 600; font-size: 18px; letter-spacing: 2px; text-transform: uppercase; color: #fff; }
.countdown-bar { width: 180px; height: 5px; border-radius: 3px; background: rgba(255,255,255,.12); margin-top: 10px; overflow: hidden; }
.countdown-bar > div { height: 100%; background: linear-gradient(90deg, var(--red-dark), var(--red-2)); transition: width .2s linear; }
.online { position: absolute; top: 8px; left: 10px; font-size: 11px; color: var(--muted); display: flex; align-items: center; gap: 5px; }
.online b { color: var(--green); }
.fair { position: absolute; top: 8px; right: 10px; font-size: 11px; color: var(--muted); display: flex; align-items: center; gap: 5px; pointer-events: auto; cursor: pointer; }
.fair:hover { color: var(--text); }

/* ---------- bet panels (compact 2-column mobile layout) ---------- */
.bets { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 6px; }

.bet-card {
  background: #14141b;
  border: 1px solid #23232e;
  border-radius: 10px;
  padding: 6px 10px 8px;
  position: relative;
}
.bet-card.active { border-color: var(--red); box-shadow: 0 0 14px rgba(229,5,57,.22); }
.bet-card.won { border-color: var(--green); box-shadow: 0 0 14px rgba(46,204,113,.25); }

.bet-head { display: flex; justify-content: center; align-items: center; margin-bottom: 5px; }
.mode-toggle { display: flex; background: #09090d; border-radius: 999px; padding: 2px; }
.mode-toggle button {
  background: transparent; color: var(--muted); border-radius: 999px;
  padding: 3px 18px; font-size: 12px; font-weight: 600;
}
.mode-toggle button.on { background: #262634; color: #fff; }

.bet-body {
  display: flex;
  gap: 8px;
  align-items: stretch;
}
.bet-controls {
  flex: 1.05;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.amount-row { display: flex; width: 100%; }
.amount-box {
  width: 100%;
  background: #09090d;
  border: 1px solid #262636;
  border-radius: 8px;
  display: flex;
  align-items: center;
  padding: 2px 4px;
  height: 32px;
}
.amount-box button {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #1d1d27;
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}
.amount-box button:active { background: #2c2c3b; }
.amount-box input {
  flex: 1;
  background: transparent;
  border: none;
  color: #fff;
  text-align: center;
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  outline: none;
  width: 100%;
}

.quick {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 4px;
}
.quick button {
  background: #0d0d14;
  border: 1px solid #232332;
  color: #b0b0c0;
  border-radius: 6px;
  padding: 3px 0;
  font-size: 12px;
  font-weight: 700;
  font-family: var(--font-display);
}
.quick button:hover, .quick button:active { background: #1c1c28; color: #fff; }

.bet-action-col {
  flex: 1.15;
  display: flex;
}
.bet-btn {
  width: 100%;
  height: 100%;
  min-height: 66px;
  margin-top: 0;
  padding: 4px;
  border-radius: 8px;
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.5px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1.15;
  text-transform: uppercase;
}
.bet-btn small {
  font-size: 12px;
  font-weight: 700;
  opacity: .95;
  letter-spacing: 0;
  text-transform: none;
  font-family: var(--font-body);
  margin-top: 2px;
}
.bet-btn.place {
  background: linear-gradient(180deg, #2ecc71, #27ae60);
  border: 1px solid #2ecc71;
  color: #fff;
  box-shadow: 0 4px 14px rgba(46,204,113,.35);
}
.bet-btn.cancel {
  background: linear-gradient(180deg, #e74c3c, #c0392b);
  border: 1px solid #e74c3c;
  color: #fff;
}
.bet-btn.cash {
  background: linear-gradient(180deg, #f39c12, #d35400);
  border: 1px solid #f39c12;
  color: #fff;
  box-shadow: 0 4px 14px rgba(243,156,18,.4);
  animation: pulse 1s infinite;
}
.bet-btn.wait {
  background: #1c1c26;
  color: var(--muted);
  border: 1px solid var(--border);
}
.bet-btn.won {
  background: linear-gradient(180deg, #27ae60, #1e8449);
  color: #fff;
}
@keyframes pulse { 0%,100% { transform: scale(1);} 50% { transform: scale(1.02);} }

.auto-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 5px;
  font-size: 11px;
  color: var(--muted);
  background: #09090d;
  padding: 3px 8px;
  border-radius: 6px;
}
.auto-row input[type=number] {
  width: 52px;
  background: #14141b;
  border: 1px solid #282836;
  color: #fff;
  border-radius: 5px;
  padding: 2px 4px;
  font-size: 11px;
  font-weight: 700;
  text-align: center;
}
.switch { position: relative; width: 34px; height: 18px; background: #000; border: 1px solid var(--border); border-radius: 9px; cursor: pointer; transition: .2s; }
.switch::after { content: ''; position: absolute; top: 1px; left: 1px; width: 14px; height: 14px; border-radius: 50%; background: var(--muted); transition: .2s; }
.switch.on { background: var(--green-dark); border-color: var(--green); }
.switch.on::after { left: 17px; background: #fff; }

/* ---------- side: live bets ---------- */
.side { display: flex; flex-direction: column; gap: 10px; }
.livebets { max-height: 380px; overflow-y: auto; }
.lb-row { display: grid; grid-template-columns: 1fr auto auto; gap: 6px; padding: 6px 12px; font-size: 12px; border-bottom: 1px solid #1a1a24; align-items: center; }
.lb-row .u { color: var(--muted); }
.lb-row .m { font-weight: 700; color: var(--purple); }
.lb-row .w { color: var(--green); font-weight: 600; }
.lb-row.won { background: rgba(46,204,113,.08); }
.empty { padding: 16px; text-align: center; color: var(--muted); font-size: 12px; }

/* ---------- contact ---------- */
.contact { padding: 10px 12px; font-size: 12px; display: flex; flex-direction: column; gap: 6px; }
.contact a { display: flex; align-items: center; gap: 8px; color: var(--text); text-decoration: none; padding: 6px 8px; border-radius: 8px; background: var(--bg); border: 1px solid var(--border); }
.contact a i { width: 16px; text-align: center; color: var(--red-2); }
.contact .hours { color: var(--muted); font-size: 11px; text-align: center; }

/* ---------- modals ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.78); backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 12px; }
.modal { background: var(--panel); border: 1px solid var(--border); border-radius: 16px; width: 100%; max-width: 460px; max-height: 92vh; overflow-y: auto; box-shadow: 0 20px 80px rgba(0,0,0,.7); }
.modal.wide { max-width: 700px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--border); font-family: var(--font-display); font-size: 18px; font-weight: 700; }
.modal-head .x { background: transparent; color: var(--muted); font-size: 18px; }
.modal-body { padding: 16px; }
.tabs { display: flex; gap: 4px; background: var(--bg); padding: 3px; border-radius: 10px; margin-bottom: 14px; }
.tabs button { flex: 1; background: transparent; color: var(--muted); padding: 8px; border-radius: 7px; font-weight: 600; font-size: 12px; }
.tabs button.on { background: var(--red); color: #fff; }
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 11px; color: var(--muted); margin-bottom: 5px; font-weight: 600; text-transform: uppercase; }
.field input, .field select, .field textarea { width: 100%; background: var(--bg); border: 1px solid var(--border); color: var(--text); border-radius: 8px; padding: 10px; font-size: 14px; outline: none; }
.field input:focus, .field textarea:focus { border-color: var(--red); }
.qr-box { text-align: center; padding: 14px; background: #fff; border-radius: 12px; margin-bottom: 12px; }
.qr-box img { max-width: 200px; width: 100%; border-radius: 6px; }
.qr-box .noqr { color: #666; padding: 24px; font-size: 12px; }
.upi-line { display: flex; align-items: center; justify-content: space-between; background: var(--bg); border: 1px dashed var(--red-dark); border-radius: 8px; padding: 8px 10px; margin-bottom: 10px; font-weight: 600; font-size: 13px; }
.upi-line button { background: var(--bg-3); color: var(--text); padding: 5px 8px; border-radius: 6px; font-size: 11px; }
.note { font-size: 12px; color: var(--muted); line-height: 1.45; margin-bottom: 12px; padding: 8px 10px; background: rgba(229,5,57,.08); border-left: 3px solid var(--red); border-radius: 5px; }
.list { display: flex; flex-direction: column; gap: 6px; }
.row-item { display: flex; justify-content: space-between; align-items: center; gap: 8px; background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; font-size: 12px; }
.row-item .sub { color: var(--muted); font-size: 11px; margin-top: 2px; }
.status { padding: 2px 8px; border-radius: 999px; font-size: 10px; font-weight: 700; text-transform: uppercase; }
.status.pending { background: rgba(255,184,0,.15); color: var(--gold); }
.status.approved { background: rgba(46,204,113,.15); color: var(--green); }
.status.rejected { background: rgba(229,5,57,.15); color: var(--red-2); }
.status.won { background: rgba(46,204,113,.15); color: var(--green); }
.status.lost { background: rgba(229,5,57,.15); color: var(--red-2); }
.status.placed { background: rgba(52,180,255,.15); color: var(--blue); }
.amt-pos { color: var(--green); font-weight: 700; }
.amt-neg { color: var(--red-2); font-weight: 700; }
.error { background: rgba(229,5,57,.12); border: 1px solid var(--red-dark); color: #ffb3c4; padding: 8px 10px; border-radius: 8px; font-size: 12px; margin-bottom: 10px; }
.success { background: rgba(46,204,113,.12); border: 1px solid #1b5e20; color: #a5e6b2; padding: 8px 10px; border-radius: 8px; font-size: 12px; margin-bottom: 10px; }

/* ---------- auth ---------- */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; background: radial-gradient(ellipse at 30% 20%, #3a0713 0%, transparent 50%), radial-gradient(ellipse at 80% 90%, #2a0410 0%, transparent 45%), var(--bg); }
.auth-card { width: 100%; max-width: 400px; background: rgba(22,22,29,.94); border: 1px solid var(--border); border-radius: 18px; padding: 24px; box-shadow: 0 25px 90px rgba(229,5,57,.15); }
.auth-logo { text-align: center; margin-bottom: 16px; }
.auth-logo .brand { justify-content: center; font-size: 34px; }
.auth-logo p { color: var(--muted); font-size: 12px; margin-top: 4px; }
.auth-plane { width: 110px; height: 55px; margin: 0 auto 8px; }

/* ---------- chat ---------- */
.chat-fab { position: fixed; right: 14px; bottom: 14px; width: 50px; height: 50px; border-radius: 50%; background: linear-gradient(180deg, var(--red-2), var(--red)); color: #fff; font-size: 20px; box-shadow: 0 6px 24px rgba(229,5,57,.45); z-index: 50; display: flex; align-items: center; justify-content: center; }
.chat-win { position: fixed; right: 14px; bottom: 74px; width: 340px; max-width: calc(100vw - 28px); height: 460px; max-height: calc(100vh - 90px); background: var(--panel); border: 1px solid var(--border); border-radius: 16px; display: flex; flex-direction: column; overflow: hidden; z-index: 50; box-shadow: 0 16px 50px rgba(0,0,0,.7); }
.chat-head { padding: 10px 12px; background: linear-gradient(180deg, var(--red), var(--red-dark)); font-family: var(--font-display); font-weight: 700; font-size: 15px; display: flex; justify-content: space-between; align-items: center; }
.chat-cats { display: flex; gap: 4px; padding: 6px; border-bottom: 1px solid var(--border); }
.chat-cats button { flex: 1; background: var(--bg); color: var(--muted); border-radius: 6px; padding: 6px 4px; font-size: 11px; font-weight: 600; border: 1px solid var(--border); }
.chat-cats button.on { background: var(--bg-3); color: var(--text); border-color: var(--red); }
.chat-msgs { flex: 1; overflow-y: auto; padding: 10px; display: flex; flex-direction: column; gap: 6px; }
.msg { max-width: 84%; padding: 6px 10px; border-radius: 12px; font-size: 12px; line-height: 1.4; word-wrap: break-word; }
.msg.user { align-self: flex-end; background: var(--red); color: #fff; border-bottom-right-radius: 3px; }
.msg.admin { align-self: flex-start; background: var(--bg-3); border-bottom-left-radius: 3px; }
.msg time { display: block; font-size: 9px; opacity: .6; margin-top: 2px; }
.chat-input { display: flex; gap: 6px; padding: 8px; border-top: 1px solid var(--border); }
.chat-input input { flex: 1; background: var(--bg); border: 1px solid var(--border); color: var(--text); border-radius: 8px; padding: 8px 10px; outline: none; font-size: 13px; }
.chat-input button { background: var(--red); color: #fff; width: 36px; border-radius: 8px; }

/* ---------- toast ---------- */
.toasts { position: fixed; top: 60px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 6px; pointer-events: none; }
.toast { padding: 8px 14px; border-radius: 10px; font-weight: 600; font-size: 13px; box-shadow: 0 8px 24px rgba(0,0,0,.5); animation: toastin .25s ease; }
.toast.ok { background: #1f7a33; color: #fff; }
.toast.err { background: var(--red); color: #fff; }
.toast.win { background: linear-gradient(180deg, #ffd24d, var(--gold)); color: #1a1200; font-family: var(--font-display); font-size: 16px; }
@keyframes toastin { from { opacity: 0; transform: translateY(-8px);} to { opacity: 1; transform: none;} }

.footer { text-align: center; color: var(--muted); font-size: 10px; padding: 10px; border-top: 1px solid var(--border); }
.footer a { color: var(--muted); }

.bonus-banner { background: linear-gradient(90deg, var(--red-dark), var(--red)); color: #fff; border-radius: 10px; padding: 10px 12px; margin-bottom: 10px; font-size: 13px; display: flex; align-items: center; gap: 8px; box-shadow: 0 4px 16px rgba(229,5,57,.3); }
.bonus-banner i { font-size: 18px; color: var(--gold); }
.bonus-banner b { font-family: var(--font-display); font-size: 16px; }

/* ==========================================================================
   MOBILE SPECIFIC RULES: Ensures canvas + both bets fit without scrolling
   ========================================================================== */
@media (max-width: 768px) {
  .main {
    grid-template-columns: 1fr;
    padding: 4px 6px;
    gap: 4px;
  }
  .side {
    order: 2;
    margin-top: 12px;
  }
  .topbar {
    padding: 6px 8px;
  }
  .brand {
    font-size: 20px;
  }
  .balance-chip {
    padding: 3px 10px;
    font-size: 14px;
  }
  .btn-sm {
    padding: 4px 8px;
    font-size: 11px;
  }
  .history {
    padding: 3px 4px;
    gap: 4px;
  }
  .hchip {
    padding: 2px 7px;
    font-size: 11px;
  }
  .game-wrap {
    margin-top: 4px;
  }
  /* Optimal canvas height for mobile viewports */
  .game-canvas {
    height: 180px;
  }
  .mult {
    font-size: 46px;
  }
  .flew {
    font-size: 14px;
  }
  .waiting {
    font-size: 14px;
  }
  .bets {
    grid-template-columns: 1fr;
    gap: 5px;
    margin-top: 4px;
  }
  .bet-card {
    padding: 4px 8px 6px;
  }
  .bet-head {
    margin-bottom: 3px;
  }
  .mode-toggle button {
    padding: 2px 14px;
    font-size: 11px;
  }
  .bet-btn {
    min-height: 64px;
    font-size: 19px;
  }
  .bet-btn small {
    font-size: 11px;
  }
}

@media (max-height: 700px) and (max-width: 600px) {
  /* Smaller screens like iPhone SE */
  .game-canvas {
    height: 155px;
  }
  .bet-btn {
    min-height: 58px;
    font-size: 17px;
  }
}