/* ============================================================
   casino_games — demo UI  ·  "Bettpro Games" casino theme
   Gold + crimson + green baize, engraved display type, suit motifs.
   Keeps all JS hook classNames; restyles everything.
   ============================================================ */
:root {
  --felt-0: #0a2318;
  --felt-1: #061710;
  --felt-2: #04120c;

  --gold-1: #fbe6a2;
  --gold-2: #d9ad3e;
  --gold-3: #a8791d;
  --gold-line: rgba(217, 173, 62, 0.45);
  --gold-faint: rgba(217, 173, 62, 0.16);

  --crimson: #d8283a;
  --crimson-2: #8f1420;

  --win: #46e58a;
  --lose: #ff5468;
  --cyan: #56d6ff;

  --text: #f5efdd;
  --muted: #b9c3ad;
  --faint: #7f8c78;

  --panel: linear-gradient(180deg, rgba(12, 40, 27, 0.82), rgba(6, 22, 15, 0.9));
  --radius: 16px;
  --radius-sm: 11px;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, sans-serif;
  --display: "Cinzel", Georgia, "Times New Roman", serif;
  --shadow: 0 26px 60px -22px rgba(0, 0, 0, 0.8);
  --gold-grad: linear-gradient(180deg, #fbeaa0 0%, #e6c052 40%, #b9871f 60%, #f3d878 100%);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--sans);
  color: var(--text);
  background:
    radial-gradient(1200px 680px at 50% -8%, rgba(251, 230, 162, 0.10), transparent 60%),
    radial-gradient(1000px 900px at 50% 120%, rgba(0, 0, 0, 0.65), transparent 70%),
    radial-gradient(900px 600px at 100% 0%, rgba(216, 40, 58, 0.10), transparent 55%),
    linear-gradient(180deg, var(--felt-0), var(--felt-1) 55%, var(--felt-2));
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}
/* felt grain */
body::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0;
  opacity: 0.05; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
body > * { position: relative; z-index: 1; }

a { color: inherit; text-decoration: none; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
code {
  font-family: var(--mono);
  background: rgba(0, 0, 0, 0.3); border: 1px solid var(--gold-faint);
  padding: 2px 7px; border-radius: 6px; font-size: .85em; color: var(--gold-1);
}

/* gold engraved text */
.gold {
  background: var(--gold-grad); -webkit-background-clip: text; background-clip: text;
  color: transparent; text-shadow: 0 1px 0 rgba(0, 0, 0, 0.35);
}

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 16px;
  padding: 13px 22px;
  background: linear-gradient(180deg, rgba(4, 16, 11, 0.92), rgba(4, 16, 11, 0.62));
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--gold-line);
  box-shadow: 0 1px 0 rgba(251, 230, 162, 0.08), 0 10px 30px -18px #000;
}
@media (max-width: 820px) {
  .topbar { gap: 8px; padding: 10px 12px; }
  .topbar .brand { font-size: 0.9rem; }
}
.topbar .back {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--muted); font-size: .9rem; padding: 8px 12px;
  border-radius: 10px; transition: .15s;
}
.topbar .back:hover { color: var(--gold-1); background: rgba(217, 173, 62, 0.08); }
.topbar .brand {
  font-family: var(--display); font-weight: 800; letter-spacing: 2px;
  font-size: 1.1rem; text-transform: uppercase;
}
.topbar .brand .suit { color: var(--crimson); -webkit-text-fill-color: var(--crimson); margin: 0 4px; }
.spacer { flex: 1; }

/* balance = poker chip pill */
.balance-pill {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 8px 16px 8px 12px; border-radius: 999px;
  color: var(--gold-1); font-family: var(--mono); font-weight: 700; font-variant-numeric: tabular-nums;
  background: radial-gradient(120% 120% at 50% 0%, rgba(216, 40, 58, 0.35), rgba(6, 22, 15, 0.9));
  border: 1px solid var(--gold-line);
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.35), inset 0 0 14px rgba(251, 230, 162, 0.12),
              0 8px 22px -10px rgba(0, 0, 0, 0.8);
}
.balance-pill .coin {
  width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center;
  font-size: 12px; color: #3a2600;
  background: var(--gold-grad);
  box-shadow: inset 0 0 0 2px #8a6412, 0 0 8px rgba(251, 230, 162, 0.5);
}
.balance-pill.bump { animation: bump .45s ease; }
@keyframes bump { 30% { transform: scale(1.13); } }

/* ---------- layout & panels ---------- */
.shell { max-width: 1080px; margin: 0 auto; padding: 24px 20px 90px; }
.play-grid { display: grid; gap: 20px; grid-template-columns: 1.5fr 1fr; align-items: start; }
@media (max-width: 820px) { .shell { padding: 16px 12px 60px; } .play-grid { display: flex; flex-direction: column; gap: 16px; } }

.card {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--gold-line);
  border-radius: var(--radius);
  box-shadow: var(--shadow), inset 0 0 0 1px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(251, 230, 162, 0.08);
}
/* thin inset gold frame */
.card::after {
  content: ""; position: absolute; inset: 6px; border-radius: calc(var(--radius) - 6px);
  border: 1px solid rgba(251, 230, 162, 0.12); pointer-events: none;
}
.stage { padding: 20px; min-height: 400px; position: relative; overflow: hidden; }
.panel { padding: 20px; }
@media (max-width: 820px) {
  .stage, .panel { padding: 14px; }
  .stage { min-height: auto; }
}
.panel h3 {
  margin: 0 0 12px; font-family: var(--display); font-size: .82rem; letter-spacing: .22em;
  text-transform: uppercase; color: var(--gold-2); font-weight: 700;
}

/* ---------- form controls ---------- */
label { display: block; margin: 13px 0 6px; color: var(--muted); font-size: .8rem; letter-spacing: .03em; }
input, select {
  width: 100%; padding: 12px 14px; color: var(--gold-1);
  background: rgba(0, 0, 0, 0.4); border: 1px solid var(--gold-faint);
  border-radius: var(--radius-sm); font: inherit; font-family: var(--mono);
  transition: border-color .15s, box-shadow .15s; outline: none;
}
input:focus, select:focus {
  border-color: var(--gold-2);
  box-shadow: 0 0 0 3px rgba(217, 173, 62, 0.18), inset 0 0 10px rgba(217, 173, 62, 0.08);
}
.chips { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.chip {
  flex: 1; min-width: 46px; padding: 8px 0; text-align: center; cursor: pointer;
  background: rgba(0, 0, 0, 0.3); border: 1px solid var(--gold-faint);
  border-radius: 999px; font-family: var(--mono); font-size: .82rem; color: var(--muted);
  transition: .12s; user-select: none;
}
.chip:hover { color: var(--gold-1); border-color: var(--gold-line); box-shadow: 0 0 12px -4px rgba(217, 173, 62, 0.5); }
.seg-toggle { display: flex; gap: 6px; background: rgba(0, 0, 0, 0.35); padding: 5px; border-radius: 12px; border: 1px solid var(--gold-faint); }
.seg-toggle button {
  flex: 1; padding: 9px 0; border-radius: 8px; border: none; cursor: pointer;
  background: transparent; color: var(--muted); font: inherit; font-weight: 700; transition: .15s;
}
.seg-toggle button.active {
  color: #3a2600; background: var(--gold-grad);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

/* buttons -- gold primary, crimson danger */
button.btn {
  position: relative; width: 100%; margin-top: 16px; padding: 15px; cursor: pointer;
  border: 1px solid rgba(251, 230, 162, 0.6); border-radius: 13px; overflow: hidden;
  font-family: var(--display); font-weight: 800; font-size: 1rem; letter-spacing: .1em;
  text-transform: uppercase; color: #3a2600;
  background: var(--gold-grad);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.35);
  box-shadow: 0 12px 26px -10px rgba(217, 173, 62, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.6);
  transition: transform .08s, filter .15s, opacity .15s;
}
button.btn::after { /* shimmer sweep */
  content: ""; position: absolute; top: 0; left: -60%; width: 40%; height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.55), transparent);
  transform: skewX(-18deg); animation: shimmer 4.5s ease-in-out infinite;
}
@keyframes shimmer { 0%, 60% { left: -60%; } 85%, 100% { left: 130%; } }
button.btn:hover { filter: brightness(1.06); }
button.btn:active { transform: translateY(1px) scale(.995); }
button.btn:disabled { opacity: .45; cursor: not-allowed; filter: grayscale(.5); }
button.btn:disabled::after { display: none; }
button.btn.danger {
  color: #fff; border-color: rgba(255, 130, 140, 0.6);
  background: linear-gradient(180deg, #e0384a, #a8121f 70%, #7e0e18);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
  box-shadow: 0 12px 26px -10px rgba(216, 40, 58, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}
button.btn.ghost {
  color: var(--gold-1); background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--gold-line); text-shadow: none; box-shadow: none;
}
button.btn.ghost::after { display: none; }
.btn-row { display: flex; gap: 10px; }
.btn-row .btn { flex: 1; }

/* ---------- lobby ---------- */
.hero { text-align: center; padding: 46px 12px 26px; }
.hero .suits { font-size: 1.3rem; letter-spacing: .5rem; margin-bottom: 14px; }
.hero .suits .r { color: var(--crimson); }
.hero .suits .b { color: var(--gold-2); }
.hero h1 {
  margin: 0; font-family: var(--display); font-weight: 800;
  font-size: clamp(2.1rem, 5.5vw, 3.4rem); letter-spacing: 1px; line-height: 1.1;
  filter: drop-shadow(0 6px 20px rgba(217, 173, 62, 0.25));
}
.hero p { color: var(--muted); margin: 14px 0 0; }
.lobby-grid { display: grid; gap: 18px; margin-top: 10px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.game-card {
  position: relative; overflow: hidden; border-radius: var(--radius); padding: 22px; min-height: 172px;
  display: flex; flex-direction: column; justify-content: space-between;
  border: 1px solid var(--gold-line); background: var(--panel);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(251, 230, 162, 0.08);
  transition: transform .18s, box-shadow .18s, border-color .18s;
}
.game-card:hover {
  transform: translateY(-5px); border-color: var(--gold-2);
  box-shadow: var(--shadow), 0 0 0 1px var(--gold-2), 0 20px 50px -20px rgba(217, 173, 62, 0.5);
}
.game-card::before {
  content: ""; position: absolute; inset: 0; opacity: .85; pointer-events: none; mix-blend-mode: screen;
  background: var(--grad, radial-gradient(120% 120% at 100% 0%, rgba(217, 173, 62, .3), transparent 55%));
}
.game-card .suit-bg {
  position: absolute; right: -10px; bottom: -24px; font-size: 6rem; opacity: .06; pointer-events: none;
}
.game-card .ico { font-size: 2.7rem; filter: drop-shadow(0 6px 14px rgba(0, 0, 0, .6)); }
.game-card .name {
  font-family: var(--display); font-size: 1.5rem; font-weight: 800; text-transform: capitalize;
  letter-spacing: .5px;
}
.game-card .tag { color: var(--muted); font-size: .85rem; margin-top: 2px; }
.game-card .go { color: var(--gold-1); font-weight: 700; font-size: .85rem; letter-spacing: .1em; text-transform: uppercase; }

/* ---------- feed / toasts ---------- */
.feed { margin-top: 14px; display: flex; flex-direction: column; gap: 8px; max-height: 220px; overflow: auto; }
.feed-row {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 10px; font-family: var(--mono); font-size: .82rem;
  background: rgba(0, 0, 0, 0.3); border: 1px solid var(--gold-faint);
}
.feed-row .amt.win { color: var(--win); }
.feed-row .amt.lose { color: var(--lose); }
.tag-pill { padding: 2px 9px; border-radius: 999px; font-size: .7rem; text-transform: capitalize; border: 1px solid var(--gold-line); color: var(--gold-2); }

#toasts { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 10px; z-index: 50; }
.toast {
  min-width: 230px; padding: 13px 16px; border-radius: 12px; font-weight: 700;
  background: linear-gradient(180deg, rgba(12, 40, 27, 0.96), rgba(6, 22, 15, 0.98));
  border: 1px solid var(--gold-line); box-shadow: var(--shadow); animation: toastin .25s ease;
}
.toast.win { border-color: rgba(70, 229, 138, .55); box-shadow: 0 12px 30px -10px rgba(70, 229, 138, .45); }
.toast.lose { border-color: rgba(255, 84, 104, .55); box-shadow: 0 12px 30px -10px rgba(255, 84, 104, .45); }
.toast small { display: block; color: var(--muted); font-weight: 500; margin-top: 3px; }
@keyframes toastin { from { opacity: 0; transform: translateY(10px); } }

/* ---------- fairness footer ---------- */
.fairness { margin-top: 14px; font-size: .77rem; color: var(--faint); display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; }
.fairness a { color: var(--gold-2); }

/* ---------- aviator ---------- */
.avi-wrap { position: relative; }
.avi-canvas { width: 100%; height: 340px; display: block; border-radius: var(--radius-sm); border: 1px solid var(--gold-faint); }
@media (max-width: 820px) { .avi-canvas { height: 260px; } }
.avi-mult { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; pointer-events: none; }
.avi-mult .val { font-family: var(--mono); font-weight: 800; font-size: 3.7rem; letter-spacing: -1px; color: var(--gold-1); text-shadow: 0 0 30px rgba(251, 230, 162, .5); }
.avi-mult .val.crashed { color: var(--lose); text-shadow: 0 0 30px rgba(255, 84, 104, .6); }
.avi-mult .status { color: var(--muted); font-family: var(--display); font-weight: 700; margin-top: 6px; letter-spacing: .18em; text-transform: uppercase; font-size: .76rem; }
.history-row { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; }
.h-chip { font-family: var(--mono); font-size: .75rem; padding: 4px 9px; border-radius: 999px; background: rgba(0, 0, 0, .3); border: 1px solid var(--gold-faint); }
.h-chip.hi { color: var(--win); border-color: rgba(70, 229, 138, .35); }
.h-chip.lo { color: var(--lose); border-color: rgba(255, 84, 104, .3); }

.game-canvas { width: 100%; display: block; }

/* ---------- mines ---------- */
.mines-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin: 4px 0; }
.tile {
  aspect-ratio: 1; border-radius: 12px; cursor: pointer; position: relative;
  display: flex; align-items: center; justify-content: center; font-size: 1.7rem;
  background: linear-gradient(180deg, #123125, #0a2016);
  border: 1px solid var(--gold-faint); transition: transform .12s, box-shadow .2s; user-select: none;
  box-shadow: inset 0 1px 0 rgba(251, 230, 162, .08);
}
.tile:hover:not(.done) { transform: translateY(-2px); border-color: var(--gold-line); box-shadow: 0 8px 18px -8px #000, 0 0 14px -4px rgba(217, 173, 62, .5); }
.tile.done { cursor: default; }
.tile.safe { background: radial-gradient(120% 120% at 50% 0%, rgba(70, 229, 138, .35), rgba(10, 40, 25, .9)); border-color: rgba(70, 229, 138, .5); box-shadow: 0 0 22px -6px rgba(70, 229, 138, .5); animation: pop .25s ease; }
.tile.mine { background: radial-gradient(120% 120% at 50% 0%, rgba(216, 40, 58, .45), rgba(45, 10, 14, .92)); border-color: rgba(255, 84, 104, .55); animation: shake .35s ease; }
@keyframes pop { from { transform: scale(.8); } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }

/* ---------- magic balls ---------- */
.ball-pad { display: grid; grid-template-columns: repeat(10, 1fr); gap: 6px; }
@media (max-width: 820px) { .ball-pad { grid-template-columns: repeat(8, 1fr); } }
.ball {
  aspect-ratio: 1; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-family: var(--mono); font-size: .82rem; cursor: pointer; user-select: none;
  background: rgba(0, 0, 0, .3); border: 1px solid var(--gold-faint); color: var(--muted); transition: .12s;
}
.ball:hover { color: var(--gold-1); border-color: var(--gold-line); }
.ball.sel {
  background: var(--gold-grad); color: #3a2600; border-color: transparent; font-weight: 700;
  box-shadow: 0 0 14px -3px rgba(217, 173, 62, .7), inset 0 0 0 2px rgba(138, 100, 18, .5);
}
.drawn-row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; min-height: 60px; align-items: center; }
.drawn-ball {
  width: 52px; height: 52px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-family: var(--mono); font-weight: 800; font-size: 1.1rem;
  background: radial-gradient(120% 120% at 30% 20%, #fff8, transparent 45%), linear-gradient(180deg, #e0384a, #8f1420);
  color: #fff; box-shadow: inset 0 0 0 2px rgba(0, 0, 0, .3); animation: dropin .4s cubic-bezier(.2, 1.3, .5, 1) both;
}
.drawn-ball.match {
  background: radial-gradient(120% 120% at 30% 20%, #fff8, transparent 45%), var(--gold-grad);
  color: #3a2600; box-shadow: 0 0 22px -4px rgba(217, 173, 62, .7), inset 0 0 0 2px rgba(138, 100, 18, .5);
}
@keyframes dropin { from { transform: translateY(-30px); opacity: 0; } }

.big-result { text-align: center; font-family: var(--display); font-weight: 800; font-size: 2.4rem; margin: 10px 0; color: var(--gold-1); }
.big-result.win { color: var(--win); }
.big-result.lose { color: var(--lose); }
.sub-result { text-align: center; color: var(--muted); font-family: var(--mono); }
