/* ---- Neon Aces base theme ---- */
:root {
  --bg: #0d1117;
  --bg-raise: #161c26;
  --bg-card: #1a2230;
  --felt: #0e3b2e;
  --felt-edge: #0a2c22;
  --gold: #f5c542;
  --gold-dim: #b8933a;
  --neon: #4de3a2;
  --neon-dim: #2a8f66;
  --red: #ff5c5c;
  --text: #e8edf4;
  --text-dim: #93a0b4;
  --radius: 14px;
  font-size: 16px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  background: radial-gradient(1200px 600px at 50% -100px, #16233a 0%, var(--bg) 60%);
  color: var(--text);
  font-family: "Segoe UI", system-ui, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--neon); }

/* ---- Top bar ---- */
#topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.25rem;
  background: rgba(13, 17, 23, 0.85);
  border-bottom: 1px solid #232c3d;
  backdrop-filter: blur(6px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: 0.06em;
  color: var(--text);
  text-decoration: none;
}
.brand .neon { color: var(--neon); }

.chip-balance {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-card);
  border: 1px solid var(--gold-dim);
  border-radius: 999px;
  padding: 0.4rem 1rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.chip-balance .coin { color: var(--gold); }
.chip-balance.bump { animation: bump 0.35s ease; }
@keyframes bump {
  0% { transform: scale(1); }
  40% { transform: scale(1.12); border-color: var(--gold); }
  100% { transform: scale(1); }
}

/* ---- Lobby ---- */
.lobby { flex: 1; max-width: 1000px; margin: 0 auto; padding: 2.5rem 1.25rem; width: 100%; }

.hero { text-align: center; margin-bottom: 2.5rem; }
.hero h1 { font-size: 3rem; letter-spacing: 0.05em; }
.neon {
  color: var(--neon);
  text-shadow: 0 0 18px rgba(77, 227, 162, 0.55), 0 0 60px rgba(77, 227, 162, 0.25);
}
.tagline { color: var(--text-dim); margin-top: 0.5rem; font-size: 1.1rem; }

.bonus-card {
  margin: 1.5rem auto 0;
  display: inline-flex;
  align-items: center;
  gap: 1rem;
  background: var(--bg-card);
  border: 1px solid #2c3750;
  border-radius: var(--radius);
  padding: 0.9rem 1.4rem;
}
.bonus-card .msg { color: var(--text-dim); }

.game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.25rem;
}

.game-card {
  background: var(--bg-card);
  border: 1px solid #2c3750;
  border-radius: var(--radius);
  padding: 1.5rem;
  text-align: center;
  text-decoration: none;
  color: var(--text);
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  align-items: center;
}
.game-card:hover:not(.soon) {
  transform: translateY(-4px);
  border-color: var(--neon-dim);
  box-shadow: 0 8px 30px rgba(77, 227, 162, 0.12);
}
.game-card.soon { opacity: 0.55; }
.game-card p { color: var(--text-dim); font-size: 0.95rem; }

.game-art {
  font-size: 3rem;
  width: 84px; height: 84px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--bg-raise);
  border: 1px solid #2c3750;
}

.play-btn {
  margin-top: 0.4rem;
  background: var(--neon);
  color: #08281b;
  font-weight: 700;
  border-radius: 999px;
  padding: 0.45rem 1.6rem;
}
.play-btn.disabled { background: #38445c; color: var(--text-dim); }

/* ---- Buttons & inputs ---- */
button {
  font: inherit;
  font-weight: 700;
  border: none;
  border-radius: 10px;
  padding: 0.6rem 1.3rem;
  cursor: pointer;
  background: var(--bg-raise);
  color: var(--text);
  border: 1px solid #2c3750;
  transition: filter 0.1s ease, transform 0.05s ease;
}
button:hover:not(:disabled) { filter: brightness(1.2); }
button:active:not(:disabled) { transform: scale(0.97); }
button:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-primary { background: var(--neon); color: #08281b; border-color: transparent; }
.btn-gold { background: var(--gold); color: #2b1f04; border-color: transparent; }
.btn-danger { background: var(--red); color: #2d0808; border-color: transparent; }

input[type="number"] {
  font: inherit;
  font-weight: 700;
  background: var(--bg);
  color: var(--text);
  border: 1px solid #2c3750;
  border-radius: 10px;
  padding: 0.55rem 0.8rem;
  width: 110px;
  font-variant-numeric: tabular-nums;
}
input[type="number"]:focus { outline: none; border-color: var(--neon-dim); }

label { color: var(--text-dim); font-size: 0.85rem; font-weight: 600; }

/* ---- Game page layout ---- */
.game-page { flex: 1; max-width: 900px; margin: 0 auto; padding: 1.5rem 1.25rem; width: 100%; }
.game-page h1 { margin-bottom: 1rem; font-size: 1.6rem; }

.panel {
  background: var(--bg-card);
  border: 1px solid #2c3750;
  border-radius: var(--radius);
  padding: 1.25rem;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 1rem;
  margin-top: 1rem;
}
/* display:flex above would otherwise override the hidden attribute */
.controls[hidden] { display: none; }
.field { display: flex; flex-direction: column; gap: 0.3rem; }

/* ---- Crash ---- */
#crash-canvas {
  width: 100%;
  height: 320px;
  background: linear-gradient(180deg, #10192a 0%, #0c1420 100%);
  border-radius: 10px;
  border: 1px solid #232c3d;
  display: block;
}

.crash-readout {
  position: relative;
  height: 0;
}
.crash-mult {
  position: relative;
  top: -230px;
  text-align: center;
  font-size: 3.2rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
  text-shadow: 0 2px 20px rgba(0,0,0,0.6);
}
.crash-mult.busted { color: var(--red); }
.crash-mult.cashed { color: var(--neon); }
.crash-sub {
  position: relative;
  top: -228px;
  text-align: center;
  color: var(--text-dim);
  font-weight: 600;
  pointer-events: none;
}

.history {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-top: 0.9rem;
}
.history .h-chip {
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  background: var(--bg-raise);
  font-variant-numeric: tabular-nums;
}
.h-chip.low { color: var(--red); }
.h-chip.high { color: var(--neon); }

.fairness {
  margin-top: 0.9rem;
  font-size: 0.75rem;
  color: var(--text-dim);
  word-break: break-all;
}

/* ---- Blackjack ---- */
.table-felt {
  background: radial-gradient(ellipse at 50% 0%, var(--felt) 0%, var(--felt-edge) 100%);
  border: 2px solid #1d5c48;
  border-radius: 18px;
  padding: 1.5rem;
  min-height: 380px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 1rem;
}

.hand-area { text-align: center; }

/* multiple player hands (splits) */
.player-hands {
  display: flex;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
  min-height: 120px;
}
.player-hands .hand {
  padding: 0.5rem 0.6rem 0.3rem;
  border-radius: 12px;
  border: 2px solid transparent;
}
.player-hands .hand.active {
  border-color: rgba(245, 197, 66, 0.65);
  background: rgba(0, 0, 0, 0.18);
}
.player-hands .hand.settled { opacity: 0.75; }
.hand-tag {
  margin-top: 0.35rem;
  font-size: 0.8rem;
  font-weight: 700;
  color: rgba(232, 237, 244, 0.75);
  font-variant-numeric: tabular-nums;
}
.hand-label {
  color: rgba(232, 237, 244, 0.7);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
}
.hand-label .score {
  background: rgba(0,0,0,0.35);
  border-radius: 999px;
  padding: 0.1rem 0.6rem;
  margin-left: 0.4rem;
  font-variant-numeric: tabular-nums;
}

.cards {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  min-height: 108px;
  flex-wrap: wrap;
}

.card {
  width: 74px;
  height: 106px;
  border-radius: 8px;
  background: #f4f6f9;
  color: #16202e;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 0.35rem 0.45rem;
  font-weight: 800;
  box-shadow: 0 4px 12px rgba(0,0,0,0.45);
  animation: dealIn 0.28s ease;
  user-select: none;
  overflow: hidden;
}
.card.red { color: #c0263a; }
.card .pip { font-size: 1rem; line-height: 1.1; }
.card .suit-big { font-size: 2.2rem; text-align: center; padding-bottom: 0.5rem; }
.card.back {
  background: repeating-linear-gradient(45deg, #24406e, #24406e 6px, #1c3357 6px, #1c3357 12px);
  border: 4px solid #f4f6f9;
}
@keyframes dealIn {
  from { transform: translateY(-24px) scale(0.9); opacity: 0; }
  to { transform: none; opacity: 1; }
}

.bj-status {
  text-align: center;
  font-size: 1.25rem;
  font-weight: 800;
  min-height: 1.8rem;
}
.bj-status.win { color: var(--gold); }
.bj-status.lose { color: var(--red); }
.bj-status.push { color: var(--text-dim); }

.chip-row { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }
.bet-chip {
  width: 54px; height: 54px;
  border-radius: 50%;
  font-weight: 800;
  border: 4px dashed rgba(255,255,255,0.7);
  color: #fff;
  display: grid; place-items: center;
  font-size: 0.85rem;
}
.bet-chip.c10 { background: #2e77c9; }
.bet-chip.c50 { background: #c92e4a; }
.bet-chip.c100 { background: #2ea35c; }
.bet-chip.c500 { background: #8241c9; }

.current-bet {
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--gold);
  font-size: 1.1rem;
  min-width: 130px;
}

/* ---- Slots ---- */
.slot-cab { max-width: 420px; margin: 0 auto; }

.reels {
  position: relative;
  display: flex;
  gap: 0.6rem;
  justify-content: center;
  background: #0c1420;
  border: 1px solid #232c3d;
  border-radius: 12px;
  padding: 0.75rem;
}

.reel-window {
  width: 108px;
  height: 228px; /* 3 × 76px cells */
  overflow: hidden;
  background: linear-gradient(180deg, #0a111c 0%, #131e30 50%, #0a111c 100%);
  border: 1px solid #2c3750;
  border-radius: 8px;
}

.reel-cell {
  height: 76px;
  display: grid;
  place-items: center;
  font-size: 2.6rem;
  user-select: none;
}
.reel-cell.sym-seven { color: var(--red); font-weight: 900; font-size: 3rem; }
.reel-cell.on-line { animation: lineFlash 0.9s ease infinite; }
@keyframes lineFlash {
  0%, 100% { background: rgba(245, 197, 66, 0.0); }
  50% { background: rgba(245, 197, 66, 0.25); }
}

.payline {
  position: absolute;
  left: 6px; right: 6px;
  top: 50%;
  height: 2px;
  background: rgba(245, 197, 66, 0.45);
  pointer-events: none;
}

.slot-msg {
  text-align: center;
  min-height: 1.8rem;
  margin-top: 0.9rem;
  font-weight: 800;
  font-size: 1.15rem;
  color: var(--text-dim);
}
.slot-msg.win { color: var(--gold); }
.slot-msg.jackpot {
  color: var(--gold);
  font-size: 1.4rem;
  text-shadow: 0 0 16px rgba(245, 197, 66, 0.6);
}

.slot-controls { justify-content: center; }
.slot-controls #spin { min-width: 130px; font-size: 1.05rem; }

.paytable {
  max-width: 420px;
  margin: 1.5rem auto 0;
  border-top: 1px solid #2c3750;
  padding-top: 1rem;
}
.paytable h2 { font-size: 1rem; color: var(--text-dim); margin-bottom: 0.6rem; }
.pay-row {
  display: flex;
  justify-content: space-between;
  padding: 0.3rem 0.2rem;
  font-variant-numeric: tabular-nums;
}
.pay-row .pay-sym.sym-seven { color: var(--red); font-weight: 800; }
.pay-row .pay-mult { color: var(--gold); font-weight: 700; }

/* ---- Topbar account link ---- */
.topbar-right { display: flex; align-items: center; gap: 0.9rem; }
.account-link {
  color: var(--text-dim);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
}
.account-link:hover { color: var(--neon); }

.sound-toggle {
  background: transparent;
  border-color: transparent;
  padding: 0.3rem 0.4rem;
  font-size: 1rem;
  line-height: 1;
}

.bonus-card .streak { color: var(--gold); font-weight: 700; }

/* ---- Account / auth ---- */
.auth-panel { max-width: 480px; }
.auth-panel h2 { margin-bottom: 0.5rem; }
.msg-dim { color: var(--text-dim); line-height: 1.5; margin: 0.4rem 0 0.8rem; }
.msg-dim code { background: var(--bg-raise); padding: 0.1rem 0.4rem; border-radius: 6px; }

.auth-tabs { display: flex; gap: 0.5rem; margin-bottom: 1.1rem; }
.auth-tab { background: transparent; border-color: transparent; color: var(--text-dim); }
.auth-tab.active { background: var(--bg-raise); color: var(--text); border-color: #2c3750; }

.auth-form { display: flex; flex-direction: column; gap: 0.9rem; }
.auth-form input { width: 100%; }
.auth-form input[type="text"],
.auth-form input[type="email"],
.auth-form input[type="password"] {
  font: inherit;
  background: var(--bg);
  color: var(--text);
  border: 1px solid #2c3750;
  border-radius: 10px;
  padding: 0.55rem 0.8rem;
}
.auth-form input:focus { outline: none; border-color: var(--neon-dim); }
.form-error { color: var(--red); font-weight: 600; min-height: 1.2rem; margin: 0; }

.account-stats { display: flex; gap: 1.25rem 2.25rem; margin: 1rem 0; flex-wrap: wrap; }
.account-stats > div { display: flex; flex-direction: column; gap: 0.2rem; }
.stat-label { color: var(--text-dim); font-size: 0.8rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; }
.stat-value { font-size: 1.3rem; font-weight: 800; font-variant-numeric: tabular-nums; }

/* ---- Leaderboard ---- */
.lb-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
}
.lb-title { font-size: 1.05rem; }
.lb-sub { margin-top: 0.2rem; font-size: 0.85rem; }
.lb-list { list-style: none; margin-top: 0.6rem; }
.lb-row {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.45rem 0.5rem;
  border-radius: 8px;
  font-variant-numeric: tabular-nums;
}
.lb-row.top { background: var(--bg-raise); }
.lb-row + .lb-row { margin-top: 0.25rem; }
.lb-rank { width: 2rem; text-align: center; font-weight: 700; color: var(--text-dim); }
.lb-name { flex: 1; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-value { font-weight: 800; color: var(--gold); }
.lb-value.neg { color: var(--red); }
.lb-empty { color: var(--text-dim); padding: 0.5rem; }

/* ---- Mines ---- */
.mines-layout {
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
  flex-wrap: wrap;
  justify-content: center;
}

.mines-grid {
  display: grid;
  grid-template-columns: repeat(5, 64px);
  gap: 8px;
}
.mines-grid.boom { animation: shake 0.4s ease; }
@keyframes shake {
  0%, 100% { transform: none; }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

.tile {
  width: 64px;
  height: 64px;
  border-radius: 10px;
  background: var(--bg-raise);
  border: 1px solid #2c3750;
  font-size: 1.6rem;
  padding: 0;
  transition: transform 0.08s ease, background 0.15s ease;
}
.tile:hover:not(:disabled) { transform: translateY(-2px); border-color: var(--neon-dim); }
.tile.safe { background: rgba(77, 227, 162, 0.16); border-color: var(--neon-dim); }
.tile.mine { background: rgba(255, 92, 92, 0.18); border-color: rgba(255, 92, 92, 0.5); }
.tile.mine.hit { background: var(--red); }
.tile.dud { opacity: 0.35; }
.tile:disabled { cursor: default; opacity: 1; }
.tile.dud:disabled { opacity: 0.35; }

.mines-side { display: flex; flex-direction: column; gap: 1rem; min-width: 220px; }
.mines-readout { text-align: center; }
.mult-now {
  font-size: 2.6rem;
  font-weight: 800;
  color: var(--neon);
  font-variant-numeric: tabular-nums;
}
.mult-next { color: var(--text-dim); font-weight: 600; font-size: 0.9rem; }
.mines-controls { margin-top: 0; }
.mines-msg { color: var(--text-dim); font-weight: 600; min-height: 2.4rem; }

select {
  font: inherit;
  font-weight: 700;
  background: var(--bg);
  color: var(--text);
  border: 1px solid #2c3750;
  border-radius: 10px;
  padding: 0.55rem 0.8rem;
}
select:focus { outline: none; border-color: var(--neon-dim); }

/* ---- Plinko ---- */
#plinko-canvas {
  width: 100%;
  max-width: 640px;
  display: block;
  margin: 0 auto;
  background: linear-gradient(180deg, #10192a 0%, #0c1420 100%);
  border-radius: 10px;
  border: 1px solid #232c3d;
}
.plinko-msg {
  text-align: center;
  font-weight: 700;
  min-height: 1.6rem;
  margin-top: 0.8rem;
  color: var(--gold);
}
.plinko-controls { justify-content: center; }

/* ---- Lobby win ticker ---- */
.win-ticker {
  margin: 1.25rem auto 0;
  max-width: 640px;
  background: var(--bg-card);
  border: 1px solid #2c3750;
  border-radius: var(--radius);
  padding: 0.8rem 1.2rem;
  font-weight: 600;
  font-size: 0.95rem;
}
.win-ticker .top-win { color: var(--gold); font-weight: 800; }
.win-ticker .recent { color: var(--text-dim); font-size: 0.85rem; margin-top: 0.3rem; }

@media (max-width: 560px) {
  .mines-grid { grid-template-columns: repeat(5, 52px); gap: 6px; }
  .tile { width: 52px; height: 52px; font-size: 1.3rem; }
}

/* ---- Chip store + terms ---- */
.chip-balance .buy-link {
  margin-left: 0.15rem;
  width: 1.3rem;
  height: 1.3rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--gold);
  color: #2b1f04;
  font-weight: 800;
  text-decoration: none;
  line-height: 1;
}
.chip-balance .buy-link:hover { filter: brightness(1.12); }

.buy-note p + p { margin-top: 0.6rem; }

.buy-status {
  margin: 1rem 0;
  padding: 0.85rem 1.1rem;
  border-radius: var(--radius);
  background: var(--bg-card);
  border: 1px solid #2c3750;
}
.buy-status.win { border-color: var(--neon-dim); color: var(--neon); }
.buy-status.lose { border-color: var(--red); color: var(--red); }

.pack-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin: 1rem 0;
}
.pack-card { text-align: center; }
.pack-card h2 { font-size: 1.1rem; margin-bottom: 0.5rem; }
.pack-chips {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
}
.pack-price { color: var(--text-dim); margin: 0.35rem 0 0.85rem; }
.pack-buy { width: 100%; }
.pack-buy:disabled { opacity: 0.45; cursor: not-allowed; }

.confirm-panel { margin-bottom: 1rem; }
.confirm-row {
  display: flex;
  gap: 0.65rem;
  align-items: flex-start;
  cursor: pointer;
  font-size: 0.95rem;
}
.confirm-row input {
  margin-top: 0.2rem;
  width: 1.05rem;
  height: 1.05rem;
  accent-color: var(--gold);
  flex-shrink: 0;
}

.terms-panel { max-width: 760px; }
.terms-panel h2 { font-size: 1.05rem; margin: 1.2rem 0 0.4rem; color: var(--gold); }
.terms-panel p { color: var(--text); line-height: 1.55; }
.terms-panel > p:first-child { margin-bottom: 0.5rem; }

/* ---- Footer ---- */
.site-footer {
  padding: 1.25rem;
  text-align: center;
  color: var(--text-dim);
  font-size: 0.8rem;
  border-top: 1px solid #232c3d;
  margin-top: 2rem;
}

.back-link {
  display: inline-block;
  margin-bottom: 0.75rem;
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.9rem;
}
.back-link:hover { color: var(--neon); }

@media (max-width: 560px) {
  .hero h1 { font-size: 2.2rem; }
  .card { width: 58px; height: 84px; }
  .card .suit-big { font-size: 1.5rem; }
  .crash-mult { font-size: 2.4rem; }
  .reel-window { width: 78px; }
  .reel-cell { font-size: 2rem; }
  .player-hands { gap: 0.5rem; }
  .table-felt { padding: 1rem 0.6rem; }
}
