/* ═══════════ RKN.CASINO ═══════════ */
:root {
  --bg: #0b0e16;
  --bg2: #101524;
  --card: #141a2c;
  --card2: #1a2138;
  --line: #232c4a;
  --text: #eef1fa;
  --muted: #8b93ad;
  --accent: #ff3355;
  --accent2: #ff5c77;
  --green: #2ee66b;
  --green2: #19b551;
  --gold: #ffc93c;
  --r-lg: 18px;
  --r-md: 13px;
  --r-sm: 10px;
  --shadow: 0 10px 40px rgba(0,0,0,.45);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(255,51,85,.10), transparent 60%),
    radial-gradient(900px 500px at 10% 110%, rgba(60,90,255,.08), transparent 60%),
    var(--bg);
  color: var(--text);
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  min-height: 100vh;
}
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input { font-family: inherit; color: inherit; }
input[type=number]::-webkit-outer-spin-button,
input[type=number]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
input[type=number] { -moz-appearance: textfield; appearance: textfield; }
.hidden { display: none !important; }

.app { max-width: 1280px; margin: 0 auto; padding: 16px 20px 40px; }
.card {
  background: linear-gradient(180deg, var(--card), var(--bg2));
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
}

/* ═══════════ TOPBAR ═══════════ */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; padding: 10px 0 16px; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 12px; cursor: pointer; user-select: none; }
.brand-logo {
  width: 48px; height: 48px; font-size: 26px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, #ff3355, #90153a);
  border-radius: var(--r-md);
  box-shadow: 0 6px 24px rgba(255,51,85,.35);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name { font-size: 22px; font-weight: 900; letter-spacing: .5px; }
.brand-name .accent { color: var(--accent); }
.brand-sub { font-size: 11px; color: var(--muted); }

.topbar-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.online-pill {
  display: flex; align-items: center; gap: 7px;
  font-size: 13px; color: var(--muted);
  padding: 9px 14px; border: 1px solid var(--line); border-radius: 99px;
}
.online-pill .dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--green);
  box-shadow: 0 0 8px var(--green); animation: pulse 2s infinite;
}
@keyframes pulse { 50% { opacity: .5; } }
.balance-pill {
  display: flex; align-items: center; gap: 10px;
  background: var(--card); border: 1px solid var(--line);
  padding: 8px 16px; border-radius: var(--r-md);
}
.balance-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .8px; }
.balance-value { font-size: 17px; font-weight: 800; font-variant-numeric: tabular-nums; }
.balance-value b { color: var(--gold); font-size: 12px; }
.balance-value.bump { animation: bump .4s; }
@keyframes bump { 30% { transform: scale(1.12); color: var(--green); } }

.btn {
  border-radius: var(--r-md); font-weight: 800; font-size: 14px;
  padding: 11px 18px; transition: transform .08s, filter .15s, opacity .15s;
  user-select: none;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-accent {
  background: linear-gradient(135deg, var(--accent), #c2184a);
  color: #fff; box-shadow: 0 6px 20px rgba(255,51,85,.35);
}
.btn-accent:hover { filter: brightness(1.12); }
.btn-ghost { border: 1px solid var(--line); color: var(--muted); }
.btn-ghost:hover { color: var(--text); border-color: #35406b; }
.btn-fair { font-size: 17px; padding: 9px 13px; }
.btn-big { font-size: 16px; padding: 15px 26px; width: 100%; }

.auth-zone { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.auth-err {
  background: rgba(255,51,85,.12); border: 1px solid rgba(255,51,85,.4);
  color: var(--accent2); padding: 10px 14px; border-radius: var(--r-sm);
  font-size: 13px; font-weight: 600;
}
.auth-note { font-size: 12px; color: var(--muted); text-align: center; }
.bet-input-row input[type=text], .bet-input-row input[type=password] { text-align: left; }

/* ═══════════ NAV ═══════════ */
.gamenav {
  display: flex; gap: 8px; padding: 6px; margin-bottom: 18px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r-lg); overflow-x: auto; scrollbar-width: none;
}
.gamenav::-webkit-scrollbar { display: none; }
.gnav-item {
  flex: 1; min-width: 108px;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 16px; border-radius: var(--r-md);
  font-weight: 700; font-size: 14px; color: var(--muted);
  transition: all .15s; white-space: nowrap;
}
.gnav-ico { font-size: 17px; }
.gnav-item:hover { color: var(--text); background: rgba(255,255,255,.04); }
.gnav-item.active {
  color: #fff; background: linear-gradient(135deg, var(--accent), #b0173f);
  box-shadow: 0 6px 18px rgba(255,51,85,.3);
}

.game { display: none; }
.game.active { display: block; animation: fadein .25s; }
@keyframes fadein { from { opacity: 0; transform: translateY(6px); } }

/* ═══════════ SHARED CONTROLS ═══════════ */
.bet-box { display: flex; flex-direction: column; gap: 8px; }
.bet-box > label { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .6px; }
.bet-box > label b { color: var(--gold); }
.bet-input-row {
  display: flex; gap: 6px; align-items: stretch;
}
.bet-input-row input {
  flex: 1; width: 100%; min-width: 0;
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--r-sm);
  padding: 11px 13px; font-size: 16px; font-weight: 700; text-align: center;
  outline: none; transition: border-color .15s;
}
.bet-input-row input:focus { border-color: var(--accent); }
.chip-btn {
  background: var(--card2); border: 1px solid var(--line); border-radius: var(--r-sm);
  padding: 8px 12px; font-size: 13px; font-weight: 700; color: var(--muted);
  transition: all .12s; min-width: 40px;
}
.chip-btn:hover { color: var(--text); border-color: #35406b; }
.quick-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.quick-chips .chip-btn { flex: 1; }

.slider {
  -webkit-appearance: none; appearance: none; width: 100%; height: 8px;
  background: var(--bg); border-radius: 99px; outline: none; border: 1px solid var(--line);
}
.slider::-webkit-slider-thumb {
  -webkit-appearance: none; width: 22px; height: 22px; border-radius: 50%;
  background: var(--accent); cursor: pointer; box-shadow: 0 2px 10px rgba(255,51,85,.5);
  border: 3px solid #fff;
}
.slider::-moz-range-thumb {
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--accent); cursor: pointer; border: 3px solid #fff;
}
.range-hints { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); }

.btn-bet {
  background: linear-gradient(135deg, var(--green), var(--green2));
  color: #05270f; font-size: 16px; padding: 15px 20px; border-radius: var(--r-md);
  box-shadow: 0 8px 24px rgba(46,230,107,.25); letter-spacing: .5px;
}
.btn-bet:hover:not(:disabled) { filter: brightness(1.08); }
.btn-bet.cashing {
  background: linear-gradient(135deg, var(--gold), #e09a00); color: #2b1d00;
  box-shadow: 0 8px 24px rgba(255,201,60,.3);
  animation: glowpulse 1s infinite;
}
.btn-bet.waiting { background: var(--card2); color: var(--muted); box-shadow: none; }
@keyframes glowpulse { 50% { filter: brightness(1.15); } }
.btn-cashout {
  background: linear-gradient(135deg, var(--gold), #e09a00); color: #2b1d00;
  font-size: 16px; padding: 15px 20px; width: 100%;
}

.mode-btn {
  flex: 1; padding: 10px; border-radius: var(--r-sm);
  border: 1px solid var(--line); color: var(--muted); font-weight: 700; font-size: 13px;
  transition: all .12s;
}
.mode-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }

.mines-stats { display: flex; gap: 8px; }
.mstat {
  flex: 1; background: var(--bg); border: 1px solid var(--line); border-radius: var(--r-sm);
  padding: 9px 10px; display: flex; flex-direction: column; gap: 3px; min-width: 0;
}
.mstat span { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.mstat b { font-size: 15px; font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; }

.mini-history { display: flex; gap: 6px; flex-wrap: wrap; min-height: 28px; }
.mini-history .h-chip {
  padding: 4px 10px; border-radius: 99px; font-size: 12px; font-weight: 800;
  background: var(--card2); font-variant-numeric: tabular-nums;
}
.h-chip.win { color: var(--green); }
.h-chip.lose { color: var(--accent2); }

/* ═══════════ AVIATOR ═══════════ */
.aviator-layout { display: grid; grid-template-columns: 1fr 280px; gap: 16px; }
.aviator-main { padding: 14px; display: flex; flex-direction: column; gap: 12px; }

.crash-history {
  display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; min-height: 30px;
}
.crash-history::-webkit-scrollbar { display: none; }
.crash-chip {
  padding: 5px 12px; border-radius: 99px; font-size: 12.5px; font-weight: 800;
  background: var(--bg); border: 1px solid var(--line); white-space: nowrap;
  font-variant-numeric: tabular-nums; flex-shrink: 0;
}
.crash-chip.low { color: #7f8db0; }
.crash-chip.mid { color: var(--gold); }
.crash-chip.high { color: var(--green); border-color: rgba(46,230,107,.3); }

.aviator-canvas-wrap {
  position: relative; border-radius: var(--r-md); overflow: hidden;
  background: linear-gradient(180deg, #0a0d18, #121a30);
  border: 1px solid var(--line);
  aspect-ratio: 16 / 8.5;
  min-height: 260px;
}
#aviatorCanvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.aviator-overlay {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; pointer-events: none; gap: 4px;
}
.av-mult {
  font-size: clamp(44px, 8vw, 76px); font-weight: 900; font-variant-numeric: tabular-nums;
  text-shadow: 0 4px 30px rgba(0,0,0,.6); letter-spacing: -1px; line-height: 1;
  transition: color .2s;
}
.av-mult span { font-size: .55em; opacity: .8; }
.av-mult.crashed { color: var(--accent); animation: shake .4s; }
.av-mult.won { color: var(--green); }
@keyframes shake {
  20% { transform: translateX(-6px); } 40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); } 80% { transform: translateX(4px); }
}
.av-status {
  font-size: 15px; font-weight: 700; color: var(--muted);
  text-shadow: 0 2px 12px rgba(0,0,0,.8);
}
.av-status.crashed { color: var(--accent2); font-size: 18px; }

.aviator-controls {
  display: grid; grid-template-columns: 1fr 1fr 1.2fr; gap: 12px; align-items: stretch;
}
.aviator-controls .btn-bet { align-self: stretch; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; }
.aviator-controls .btn-bet small { font-size: 12px; font-weight: 700; opacity: .8; }

.aviator-side { padding: 14px; display: flex; flex-direction: column; gap: 10px; max-height: 640px; }
.side-title { font-size: 13px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .8px; }
.live-bets { display: flex; flex-direction: column; gap: 5px; overflow-y: auto; scrollbar-width: thin; }
.lbet {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  background: var(--bg); border-radius: var(--r-sm); padding: 8px 11px; font-size: 12.5px;
  border: 1px solid transparent;
}
.lbet .lname { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lbet .lamt { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.lbet.me { border-color: rgba(255,201,60,.4); }
.lbet.me .lname { color: var(--gold); font-weight: 800; }
.lbet.cashed { background: rgba(46,230,107,.08); }
.lbet.cashed .lamt { color: var(--green); }
.lbet.lost { opacity: .45; }
.lbet.lost .lamt { color: var(--accent2); }

/* ═══════════ MINES ═══════════ */
.mines-layout { display: grid; grid-template-columns: 300px 1fr; gap: 16px; }
.mines-panel { padding: 18px; display: flex; flex-direction: column; gap: 16px; height: fit-content; }
.mines-board { padding: 18px; display: grid; place-items: center; }
.mines-grid {
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 9px;
  width: min(100%, 480px);
}
.mcell {
  aspect-ratio: 1; border-radius: var(--r-md);
  background: linear-gradient(180deg, var(--card2), #161d33);
  border: 1px solid var(--line);
  font-size: clamp(18px, 4vw, 30px); font-weight: 800;
  display: grid; place-items: center;
  transition: transform .1s, background .15s, border-color .15s;
  color: transparent;
}
.mcell.playable:hover { transform: translateY(-2px); border-color: #3a4675; background: #1e2745; }
.mcell.open-safe {
  background: linear-gradient(180deg, rgba(46,230,107,.18), rgba(46,230,107,.06));
  border-color: rgba(46,230,107,.45); color: var(--green);
  animation: cellpop .25s;
}
.mcell.open-mine {
  background: linear-gradient(180deg, rgba(255,51,85,.25), rgba(255,51,85,.08));
  border-color: rgba(255,51,85,.6); color: #fff;
  animation: cellboom .35s;
}
.mcell.reveal-mine { background: rgba(255,51,85,.07); border-color: rgba(255,51,85,.25); color: rgba(255,92,119,.6); }
.mcell.reveal-safe { color: rgba(46,230,107,.35); }
@keyframes cellpop { 40% { transform: scale(1.12); } }
@keyframes cellboom { 30% { transform: scale(1.25) rotate(6deg); } 60% { transform: scale(.95) rotate(-4deg); } }

/* ═══════════ DICE ═══════════ */
.dice-layout { display: grid; grid-template-columns: 1.4fr 1fr; gap: 24px; padding: 24px; }
.dice-visual { display: flex; flex-direction: column; justify-content: center; gap: 24px; }
.dice-bar-wrap { display: flex; flex-direction: column; gap: 8px; }
.dice-bar {
  position: relative; height: 46px; border-radius: 99px;
  background: var(--bg); border: 1px solid var(--line); overflow: visible;
}
.dice-zone {
  position: absolute; top: 4px; bottom: 4px; border-radius: 99px;
  background: linear-gradient(90deg, rgba(46,230,107,.55), rgba(46,230,107,.25));
  left: 4px; width: 50%;
  transition: all .15s;
}
.dice-marker {
  position: absolute; top: -14px; bottom: -6px; width: 4px; margin-left: -2px;
  background: #fff; border-radius: 4px; box-shadow: 0 0 12px rgba(255,255,255,.6);
  transition: left .5s cubic-bezier(.22,1.4,.36,1);
}
.dice-marker span {
  position: absolute; top: -26px; left: 50%; transform: translateX(-50%);
  font-size: 13px; font-weight: 800; font-variant-numeric: tabular-nums;
  background: var(--card2); padding: 3px 9px; border-radius: 99px; border: 1px solid var(--line);
  white-space: nowrap;
}
.dice-marker.win span { color: var(--green); border-color: rgba(46,230,107,.5); }
.dice-marker.lose span { color: var(--accent2); border-color: rgba(255,51,85,.5); }
.dice-scale { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); padding: 12px 6px 0; }
.dice-result { text-align: center; font-size: 15px; font-weight: 700; color: var(--muted); min-height: 24px; }
.dice-result.win { color: var(--green); }
.dice-result.lose { color: var(--accent2); }
.dice-controls { display: flex; flex-direction: column; gap: 16px; }
.dice-mode-row { display: flex; gap: 8px; }

/* ═══════════ WHEEL ═══════════ */
.wheel-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; padding: 24px; align-items: center; }
.wheel-visual { position: relative; display: grid; place-items: center; }
#wheelCanvas { max-width: min(100%, 420px); height: auto; }
.wheel-pointer {
  position: absolute; top: -6px; left: 50%; transform: translateX(-50%);
  font-size: 30px; color: var(--gold); z-index: 2;
  text-shadow: 0 4px 12px rgba(0,0,0,.6);
}
.wheel-center {
  position: absolute; font-size: 42px; pointer-events: none;
  filter: drop-shadow(0 4px 10px rgba(0,0,0,.5));
}
.wheel-controls { display: flex; flex-direction: column; gap: 16px; }
.wheel-mults { display: flex; gap: 6px; flex-wrap: wrap; }
.wm-chip {
  padding: 5px 12px; border-radius: 99px; font-size: 12.5px; font-weight: 800;
  border: 1px solid var(--line); font-variant-numeric: tabular-nums;
}

/* ═══════════ COIN ═══════════ */
.coin-layout { display: grid; grid-template-columns: 1.2fr 1fr; gap: 24px; padding: 24px; }
.coin-visual { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; }
.coin-scene { perspective: 900px; width: 160px; height: 160px; }
.coin {
  width: 100%; height: 100%; position: relative;
  transform-style: preserve-3d; transition: transform 1.6s cubic-bezier(.3,1.2,.3,1);
}
.coin-face {
  position: absolute; inset: 0; border-radius: 50%;
  display: grid; place-items: center; font-size: 64px;
  backface-visibility: hidden;
  border: 4px solid rgba(255,255,255,.15);
  box-shadow: inset 0 0 30px rgba(0,0,0,.4), 0 10px 30px rgba(0,0,0,.5);
}
.coin-heads { background: radial-gradient(circle at 35% 30%, #ffd766, #b8860b); }
.coin-tails { background: radial-gradient(circle at 35% 30%, #9fb6ff, #2c3e8f); transform: rotateY(180deg); }
.coin-streak { display: flex; gap: 6px; min-height: 30px; flex-wrap: wrap; justify-content: center; }
.coin-streak .s-chip {
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  font-size: 15px; background: var(--card2); border: 1px solid rgba(46,230,107,.4);
}
.coin-controls { display: flex; flex-direction: column; gap: 16px; justify-content: center; }
.coin-btns { display: flex; gap: 10px; }
.coin-choice { flex: 1; }

/* ═══════════ MODALS / TOASTS ═══════════ */
.modal-back {
  position: fixed; inset: 0; background: rgba(5,7,13,.75); backdrop-filter: blur(6px);
  display: grid; place-items: center; z-index: 100; padding: 20px;
}
.modal { width: min(560px, 100%); padding: 0; animation: fadein .2s; }
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px; border-bottom: 1px solid var(--line);
  font-weight: 800; font-size: 16px;
}
.modal-x { color: var(--muted); font-size: 16px; padding: 4px 8px; border-radius: 8px; }
.modal-x:hover { color: var(--text); background: rgba(255,255,255,.06); }
.modal-body { padding: 22px; display: flex; flex-direction: column; gap: 14px; font-size: 14px; line-height: 1.55; }
.modal-body code {
  background: var(--bg); padding: 3px 8px; border-radius: 7px; font-size: 12px;
  word-break: break-all; border: 1px solid var(--line);
}
.fair-row { display: flex; flex-direction: column; gap: 5px; }
.fair-row > span { font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .6px; }
.topup-body { align-items: center; text-align: center; }
.topup-art { font-size: 56px; }

.toasts {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; gap: 8px; z-index: 200; align-items: center;
  pointer-events: none; width: min(440px, calc(100vw - 32px));
}
.toast {
  background: var(--card2); border: 1px solid var(--line);
  padding: 12px 20px; border-radius: var(--r-md); font-size: 14px; font-weight: 700;
  box-shadow: var(--shadow); animation: toastin .25s; text-align: center; width: 100%;
}
@keyframes toastin { from { opacity: 0; transform: translateY(12px); } }
.toast.win { border-color: rgba(46,230,107,.5); color: var(--green); }
.toast.lose { border-color: rgba(255,51,85,.5); color: var(--accent2); }
.toast.info { color: var(--text); }

/* ═══════════ FOOTER ═══════════ */
.footer {
  margin-top: 28px; padding: 20px 4px 0; border-top: 1px solid var(--line);
  color: var(--muted); font-size: 12.5px; line-height: 1.6; text-align: center;
}
.footer-sub { margin-top: 6px; font-size: 11.5px; opacity: .7; }

/* ═══════════ RESPONSIVE ═══════════ */
@media (max-width: 1020px) {
  .aviator-layout { grid-template-columns: 1fr; }
  .aviator-side { max-height: 300px; }
  .mines-layout { grid-template-columns: 1fr; }
  .dice-layout, .wheel-layout, .coin-layout { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .app { padding: 10px 12px 30px; }
  .aviator-controls { grid-template-columns: 1fr; }
  .topbar { justify-content: center; }
  .brand-sub { display: none; }
  .gnav-item { min-width: 92px; font-size: 13px; padding: 10px 10px; }
  .aviator-canvas-wrap { aspect-ratio: 4 / 3.4; }
}
