/* =========================================================
   Casino — shared pieces for Baccarat, Roulette and Slots:
   clay chips, bet spots on the felt, the result "road" and
   the gold table markings. Stat boxes and buttons come from
   arcade.css; card faces from styles.css.
   ========================================================= */

.casino-layout {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: clamp(1rem, 2.6vw, 1.8rem);
}

.casino-main {
  flex: 1 1 520px;
  min-width: 0;
}

.casino-aside {
  flex: 0 1 280px;
  display: grid;
  gap: 0.9rem;
  min-width: 0;
}

/* Gold table lettering, like the printing on a real layout. */
.felt-print {
  margin: 0 0 0.6rem;
  font-family: var(--display);
  font-size: clamp(0.8rem, 2.4vw, 1rem);
  letter-spacing: 0.14em;
  text-align: center;
  text-transform: uppercase;
  color: rgba(255, 214, 110, 0.85);
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.6);
}

/* ---------- Chips ---------- */
.chip-rack {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.6rem;
}

.chip {
  --chip: #f2f2f2;
  --chip-ink: #14161c;
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 54px;
  height: 54px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  /* Edge spots, then the inlay ring, then the clay. */
  background:
    radial-gradient(circle closest-side, var(--chip) 0 60%, #fff 61% 66%, var(--chip) 67% 72%, transparent 73%),
    repeating-conic-gradient(var(--chip) 0 22.5deg, #fff 22.5deg 45deg);
  color: var(--chip-ink);
  font-family: var(--display);
  font-size: 0.85rem;
  line-height: 1;
  box-shadow:
    inset 0 0 0 4px var(--chip),
    0 3px 0 rgba(0, 0, 0, 0.45),
    0 6px 12px rgba(0, 0, 0, 0.35);
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.chip:hover {
  transform: translateY(-2px);
}

.chip[aria-pressed="true"] {
  transform: translateY(-4px);
  box-shadow:
    inset 0 0 0 4px var(--chip),
    0 0 0 3px var(--gold),
    0 0 18px rgba(255, 201, 60, 0.8),
    0 6px 12px rgba(0, 0, 0, 0.35);
}

.chip:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

.chip--1 {
  --chip: #e9ecf2;
  --chip-ink: #14161c;
}

.chip--5 {
  --chip: #d4003c;
  --chip-ink: #fff;
}

.chip--10 {
  --chip: #1f6fff;
  --chip-ink: #fff;
}

.chip--25 {
  --chip: #138a3c;
  --chip-ink: #fff;
}

/* The little stack that sits on a bet spot. */
.stack {
  --chip: #d4003c;
  position: absolute;
  z-index: 2;
  display: grid;
  place-items: center;
  min-width: 30px;
  height: 30px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--chip);
  color: #fff;
  font-family: var(--display);
  font-size: 0.68rem;
  line-height: 1;
  box-shadow:
    inset 0 0 0 2px rgba(255, 255, 255, 0.85),
    0 2px 0 rgba(0, 0, 0, 0.5),
    0 4px 8px rgba(0, 0, 0, 0.4);
  pointer-events: none;
  animation: stackDrop 0.18s ease-out;
}

@keyframes stackDrop {
  from {
    transform: translateY(-10px) scale(1.15);
    opacity: 0;
  }
}

/* ---------- Bet spots ---------- */
.bet-spot {
  position: relative;
  display: grid;
  place-items: center;
  gap: 0.15rem;
  min-height: 64px;
  padding: 0.5rem;
  border: 2px solid rgba(255, 214, 110, 0.7);
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.14);
  color: #fff;
  font: inherit;
  cursor: pointer;
  touch-action: manipulation;
  transition: background 0.15s ease, box-shadow 0.15s ease;
}

.bet-spot:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.1);
}

.bet-spot:disabled {
  cursor: default;
}

.bet-spot .spot-name {
  font-family: var(--display);
  font-size: 1rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.bet-spot .spot-pays {
  font-family: var(--pixel);
  font-size: 0.5rem;
  color: rgba(255, 214, 110, 0.9);
}

.bet-spot .stack {
  right: 6px;
  top: -12px;
}

.bet-spot.is-win {
  background: rgba(196, 222, 0, 0.22);
  box-shadow: 0 0 0 3px var(--lime), 0 0 26px rgba(196, 222, 0, 0.6);
}

/* ---------- Messages, road, bank ---------- */
.casino-msg {
  min-height: 1.6rem;
  margin: 0.9rem 0 0;
  color: #eef5da;
  font-weight: 600;
  text-align: center;
}

.casino-actions {
  justify-content: center;
  margin-top: 0.9rem;
}

.casino-actions .btn {
  flex: 0 1 auto;
  min-width: 96px;
}

.road {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  min-height: 30px;
  padding: 0.5rem;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(0, 0, 0, 0.28);
}

.bead {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  color: #fff;
  font-family: var(--display);
  font-size: 0.62rem;
  line-height: 1;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.35);
}

.bead--red {
  background: #d4003c;
}

.bead--black {
  background: #16121c;
}

.bead--green {
  background: #138a3c;
}

.bead--blue {
  background: #1f6fff;
}

.road-label {
  display: block;
  margin-bottom: 0.35rem;
}

/* =========================================================
   Baccarat
   ========================================================= */
.bc-hands {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(0.6rem, 2vw, 1.2rem);
}

.bc-hand {
  --cw: clamp(44px, 8.5vw, 92px);
  padding: 0.7rem;
  border-radius: 16px;
  border: 2px solid rgba(31, 111, 255, 0.6);
  background: rgba(0, 0, 0, 0.18);
}

.bc-hand--banker {
  border-color: rgba(212, 0, 60, 0.65);
}

.bc-hand-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.bc-hand-name {
  font-family: var(--display);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #9fc0ff;
}

.bc-hand--banker .bc-hand-name {
  color: #ff9ab4;
}

.bc-total {
  min-width: 2ch;
  font-family: var(--display);
  font-size: 1.7rem;
  line-height: 1;
  text-align: right;
  color: var(--gold);
  text-shadow: 0 0 14px rgba(255, 201, 60, 0.6);
}

.bc-cards {
  display: flex;
  align-items: flex-start;
  min-height: calc(var(--cw) * 1.6);
}

/* The third card is dealt sideways, as at a real table. */
.bc-cards .card.is-third {
  rotate: 90deg;
  margin-left: calc(var(--cw) * 0.05);
  translate: 0 calc(var(--cw) * 0.3);
}

.bc-bets {
  display: grid;
  grid-template-columns: 1fr 0.8fr 1fr;
  gap: 0.6rem;
  margin: 1.1rem 0 1rem;
}

.bet-spot--player {
  border-color: rgba(120, 165, 255, 0.85);
}

.bet-spot--banker {
  border-color: rgba(255, 120, 150, 0.85);
}

.bet-spot--tie {
  border-color: rgba(94, 224, 122, 0.85);
}

/* =========================================================
   Roulette
   ========================================================= */
.rl-top {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: center;
  gap: clamp(1rem, 3vw, 2rem);
  margin-bottom: 1.2rem;
}

.rl-wheel-wrap {
  flex: 0 1 320px;
  max-width: 320px;
  width: 100%;
}

.rl-wheel-wrap canvas {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 50%;
  cursor: pointer;
  touch-action: manipulation;
  box-shadow: 0 0 0 4px rgba(26, 12, 0, 0.6), 0 18px 40px rgba(0, 0, 0, 0.55), 0 0 40px rgba(255, 201, 60, 0.2);
}

.rl-side {
  display: grid;
  gap: 0.8rem;
  flex: 1 1 300px;
  max-width: 460px;
  min-width: 0;
}

.rl-last--red {
  color: #ff6b8a;
}

.rl-last--black {
  color: #e8eaf0;
}

.rl-last--green {
  color: #5ee07a;
}

/* The layout: rows across on wide screens, rows down on phones (see roulette.js). */
.rl-board {
  display: grid;
  grid-template-columns: 0.9fr repeat(12, minmax(0, 1fr)) 0.9fr;
  grid-template-rows: repeat(3, 54px) 46px 46px;
  gap: 3px;
  padding: 6px;
  border: 2px solid rgba(255, 214, 110, 0.75);
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.12);
}

.rl-cell {
  position: relative;
  grid-row: var(--r) / span var(--rs);
  grid-column: var(--c) / span var(--cs);
  display: grid;
  place-items: center;
  min-width: 0;
  padding: 0;
  border: 1px solid rgba(255, 214, 110, 0.55);
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.08);
  color: #fff;
  font-family: var(--display);
  font-size: clamp(0.72rem, 1.6vw, 1rem);
  line-height: 1;
  cursor: pointer;
  touch-action: manipulation;
  transition: background 0.15s ease, box-shadow 0.15s ease;
}

.rl-cell:hover:not(:disabled) {
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.6);
}

.rl-cell:disabled {
  cursor: default;
}

.rl-red {
  background: #b8002f;
}

.rl-black {
  background: #16121c;
}

.rl-zero {
  background: #138a3c;
  font-size: 1.2rem;
}

.rl-out {
  font-size: clamp(0.62rem, 1.3vw, 0.85rem);
  letter-spacing: 0.04em;
}

.rl-cell .stack {
  top: -6px;
  right: -4px;
  min-width: 24px;
  height: 24px;
  font-size: 0.6rem;
}

.rl-cell.is-win {
  z-index: 1;
  box-shadow: 0 0 0 3px var(--lime), 0 0 22px rgba(196, 222, 0, 0.8);
  animation: rlWin 0.6s ease 3;
}

@keyframes rlWin {
  50% {
    filter: brightness(1.6);
  }
}

@media (max-width: 700px) {
  .rl-board {
    grid-template-columns: 0.95fr 0.95fr repeat(3, minmax(0, 1.2fr));
    grid-template-rows: 46px repeat(12, 40px) 42px;
  }

  .rl-cell {
    grid-row: var(--mr) / span var(--mrs);
    grid-column: var(--mc) / span var(--mcs);
    font-size: 0.9rem;
  }

  .rl-out {
    font-size: 0.72rem;
  }
}

/* =========================================================
   Slots
   ========================================================= */
.sl-cabinet {
  max-width: 560px;
  margin: 0 auto;
  padding: 0.8rem clamp(0.7rem, 2.4vw, 1.4rem) 1.2rem;
  border: 3px solid var(--gold);
  border-radius: 28px 28px 18px 18px;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(255, 0, 149, 0.35), transparent 60%),
    linear-gradient(180deg, #2a0b4a, #14061f 70%, #0b0414);
  box-shadow:
    inset 0 0 0 3px rgba(26, 12, 0, 0.6),
    inset 0 0 40px rgba(123, 44, 255, 0.35),
    0 0 30px rgba(255, 0, 149, 0.35),
    0 18px 40px rgba(0, 0, 0, 0.55);
}

.sl-marquee {
  margin: 0.2rem 0 0.7rem;
  font-family: var(--neon);
  font-size: clamp(1.8rem, 6vw, 2.8rem);
  line-height: 1.1;
  text-align: center;
  color: #fff0f8;
  text-shadow:
    0 0 4px #fff,
    0 0 12px var(--accent),
    0 0 28px var(--accent);
  animation: neonFlicker 8s infinite;
}

.sl-window canvas {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 12px;
  cursor: pointer;
  touch-action: manipulation;
  box-shadow: inset 0 0 0 2px #000, 0 0 0 3px rgba(255, 201, 60, 0.6);
}

.sl-lines {
  margin-top: 0.9rem;
}

.sl-spin {
  min-width: 160px;
  font-family: var(--display);
  font-size: 1.1rem;
  letter-spacing: 0.1em;
}

@media (max-width: 620px) {
  .felt:has(.casino-layout),
  .felt:has(.rl-board) {
    padding-inline: 0.6rem;
  }

  .casino-aside {
    flex: 1 1 100%;
  }

  .chip {
    width: 50px;
    height: 50px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .stack,
  .sl-marquee,
  .rl-cell.is-win {
    animation: none;
  }
}
