/* Game page shell and per-game stage styles. */
.game-head {
  display: flex;
  align-items: center;
  gap: var(--s4);
  flex-wrap: wrap;
  margin-bottom: var(--s4);
}
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: var(--s2) var(--s3);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  font-weight: 650;
}
.back-link:hover {
  background: var(--surface-3);
}
.game-title {
  display: flex;
  align-items: center;
  gap: var(--s3);
}
.game-title .thumb {
  width: 44px;
  height: 44px;
  border-radius: 10px;
}
.game-title p {
  font-size: var(--fs-sm);
}

.game-cols {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: var(--s4);
  align-items: start;
}
.controls {
  display: flex;
  flex-direction: column;
  gap: var(--s3);
}
.controls .btn-block {
  margin-top: var(--s2);
}
.bet-row {
  display: flex;
  gap: 6px;
}
.mini-btn {
  min-width: 42px;
  padding: 0 10px;
  border-radius: var(--r-sm);
  background: var(--surface-3);
  font-weight: 650;
  font-size: var(--fs-sm);
}
.mini-btn:hover:not(:disabled) {
  background: var(--surface-4);
}

.stage {
  position: relative;
  overflow: hidden;
  min-height: 420px;
  padding: var(--s5);
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: radial-gradient(120% 80% at 50% 0%, rgba(255, 255, 255, 0.045) 0%, transparent 60%), var(--surface-1);
}
.stage-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--s4);
  min-height: 370px;
  text-align: center;
}
.locked-stage .art {
  width: 160px;
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow-2);
}

.history {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 30px;
  margin-top: var(--s3);
}
.chip {
  padding: 5px 10px;
  border-radius: var(--r-pill);
  background: var(--surface-3);
  font-weight: 650;
  font-size: var(--fs-xs);
  font-variant-numeric: tabular-nums;
}
.chip.win {
  background: var(--green-soft);
  color: var(--green);
}
.chip.loss {
  background: var(--red-soft);
  color: var(--red);
}
.chip.red {
  background: #c43246;
}
.chip.black {
  background: #2c3036;
}
.chip.green {
  background: #23a06a;
}

.info-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s3);
  margin-bottom: var(--s4);
}
.info-row > div {
  padding: var(--s2) var(--s3);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  font-size: var(--fs-xs);
  color: var(--text-muted);
  min-width: 110px;
}
.info-row b {
  display: block;
  font-size: var(--fs-lg);
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.info-row b.gold {
  color: var(--gold-2);
}

.big-result {
  min-height: 1.25em;
  font-size: 56px;
  font-weight: 750;
  text-align: center;
  font-variant-numeric: tabular-nums;
  transition: color 0.2s;
}
.big-result.md {
  font-size: 32px;
}
.big-result.win {
  color: var(--green);
}
.big-result.loss {
  color: var(--red);
}
.row-center {
  display: flex;
  gap: var(--s2);
  justify-content: center;
  flex-wrap: wrap;
}
.note {
  font-size: var(--fs-xs);
  color: var(--text-muted);
}

/* ---------- Horizontal reel (roulette, slide, cases, battles, daily case) ---------- */
.reel {
  position: relative;
  overflow: hidden;
  height: 110px;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: var(--surface-0);
}
.reel::before,
.reel::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  width: 60px;
  z-index: 2;
  pointer-events: none;
}
.reel::before {
  left: 0;
  background: linear-gradient(90deg, var(--surface-0), transparent);
}
.reel::after {
  right: 0;
  background: linear-gradient(270deg, var(--surface-0), transparent);
}
.reel-strip {
  display: flex;
  height: 100%;
  will-change: transform;
}
.reel-cell {
  flex: none;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border-right: 2px solid var(--bg);
  font-weight: 750;
  font-variant-numeric: tabular-nums;
}
.reel-cell.red {
  background: linear-gradient(180deg, #e04a5c, #a82638);
}
.reel-cell.black {
  background: linear-gradient(180deg, #363a41, #24272c);
}
.reel-cell.green {
  background: linear-gradient(180deg, #34c486, #1a8a5a);
}
.reel-cell.low {
  background: var(--surface-4);
  color: var(--text);
}
.reel-cell.mid {
  background: #5d6571;
}
.reel-cell.high {
  background: var(--gold);
  color: #1d1505;
}
.reel-marker {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  z-index: 3;
  width: 3px;
  transform: translateX(-50%);
  background: var(--gold-2);
  box-shadow: 0 0 12px var(--gold);
}

/* ---------- Mines / tower tiles ---------- */
.board-5 {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: var(--s2);
  max-width: 440px;
  margin: 0 auto;
}
.tile {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: linear-gradient(180deg, var(--surface-4), var(--surface-3));
  border: 1px solid var(--line-strong);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 2px 6px rgba(0, 0, 0, 0.35);
  transition: transform 0.12s, background 0.15s;
}
.tile:hover:not(:disabled) {
  transform: translateY(-2px);
  background: linear-gradient(180deg, #3a3f47, var(--surface-4));
}
.tile:disabled {
  opacity: 1;
  cursor: default;
}
.tile svg {
  width: 62%;
  height: 62%;
  animation: pop 0.25s;
}
.tile.safe {
  background: linear-gradient(180deg, #227a58, #175a41);
  box-shadow: none;
}
.tile.mine {
  background: linear-gradient(180deg, #a3323f, #74202b);
  box-shadow: none;
}
.tile.dim {
  opacity: 0.5;
}
@keyframes pop {
  from {
    transform: scale(0.4);
    opacity: 0;
  }
}

.tower {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-width: 480px;
  margin: 0 auto;
}
.tower-row {
  display: flex;
  align-items: center;
  gap: 6px;
}
.tower-row .mult {
  width: 70px;
  text-align: right;
  font-size: 11px;
  font-weight: 650;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}
.tower-row.current .mult {
  color: var(--gold-2);
}
.tower-row .tile {
  flex: 1;
  aspect-ratio: auto;
  height: 40px;
  border-radius: var(--r-sm);
}
.tower-row .tile svg {
  width: 26px;
  height: 26px;
}
.tower-row:not(.current) .tile:not(.safe):not(.mine) {
  opacity: 0.45;
}

/* ---------- Playing cards ---------- */
.hand {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: var(--s2);
  min-height: 104px;
}
.playing-card {
  width: 72px;
  height: 104px;
  flex: none;
  filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.45));
  animation: deal 0.3s;
}
.playing-card.lg {
  width: 116px;
  height: 168px;
}
.playing-card.sm {
  width: 44px;
  height: 64px;
  animation: none;
}
.playing-card svg {
  width: 100%;
  height: 100%;
}
@keyframes deal {
  from {
    transform: translateY(-24px) scale(0.9);
    opacity: 0;
  }
}
.hand-label {
  margin: var(--s2) 0;
  text-align: center;
  font-weight: 750;
}
.trail {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px;
  opacity: 0.75;
}

/* ---------- Upgrader ---------- */
.dial {
  position: relative;
  width: 270px;
  height: 270px;
  margin: var(--s2) auto;
  border-radius: 50%;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.45);
}
.dial .inner {
  position: absolute;
  inset: 22px;
  border-radius: 50%;
  background: var(--surface-1);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-weight: 750;
}
.dial .inner .mult {
  font-size: 32px;
}
.dial .needle {
  position: absolute;
  left: 50%;
  top: 0;
  width: 0;
  height: 100%;
  transition: transform 4s cubic-bezier(0.12, 0.6, 0.1, 1);
}
.dial .needle svg {
  position: absolute;
  left: -11px;
  top: -6px;
  width: 22px;
  height: 28px;
  filter: drop-shadow(0 0 6px var(--gold));
}

/* ---------- Crash / Plinko canvases ---------- */
.stage canvas {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--r-md);
  background: var(--surface-0);
}

/* ---------- Chicken Road ---------- */
.road {
  display: flex;
  height: 170px;
  border-radius: var(--r-md);
  overflow: hidden;
  border: 1px solid var(--line);
}
.lane {
  position: relative;
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 10px;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  border-right: 2px dashed #4a4f58;
  background: repeating-linear-gradient(180deg, #24272c 0 18px, #2c3036 18px 20px);
}
.lane.start {
  flex: 0.85;
  background: linear-gradient(#2a6e48, #1d5034);
}
.lane.passed {
  background: repeating-linear-gradient(180deg, #1d5c45 0 18px, #226a50 18px 20px);
}
.lane.hit {
  background: #86283a;
}
.lane .slot {
  width: 100%;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lane .slot svg {
  width: 48px;
  height: 48px;
}
.lane .risk {
  color: #f7a3ac;
}
.hop {
  animation: hop 0.35s;
}
@keyframes hop {
  50% {
    transform: translateY(-14px) scale(1.15);
  }
}

/* ---------- Dice ---------- */
.dice-track {
  position: relative;
  height: 26px;
  margin: 40px 0 var(--s3);
  border-radius: var(--r-pill);
  background: var(--red);
}
.dice-track .win-zone {
  position: absolute;
  top: 0;
  bottom: 0;
  border-radius: var(--r-pill);
  background: var(--green);
}
.dice-track .marker {
  position: absolute;
  top: -40px;
  width: 0;
  transition: left 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.dice-track .marker svg {
  position: absolute;
  left: -20px;
  width: 40px;
  height: 40px;
}
.dice-scale {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-dim);
  font-weight: 700;
}

/* ---------- Coinflip ---------- */
.coin-3d {
  width: 170px;
  height: 170px;
  perspective: 800px;
}
.coin-3d .spinner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 2s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.coin-3d .face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
}
.coin-3d .face svg {
  width: 100%;
  height: 100%;
}
.coin-3d .face.back {
  transform: rotateY(180deg);
}

/* ---------- Keno ---------- */
.keno-board {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 6px;
  max-width: 540px;
  margin: 0 auto;
}
.keno-cell {
  aspect-ratio: 1.15;
  border-radius: var(--r-sm);
  background: var(--surface-3);
  font-weight: 750;
  font-size: var(--fs-md);
  transition: background 0.15s, transform 0.15s;
}
.keno-cell:hover:not(:disabled) {
  background: var(--surface-4);
}
.keno-cell:disabled {
  opacity: 1;
  cursor: default;
}
.keno-cell.picked {
  background: var(--steel-2);
  color: #fff;
}
.keno-cell.drawn {
  background: #4a3a3f;
}
.keno-cell.hit {
  background: var(--green);
  color: #04150d;
  transform: scale(1.06);
}
.paytable {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin-top: var(--s4);
}
.paytable div {
  padding: 6px 10px;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  font-size: var(--fs-xs);
  text-align: center;
  color: var(--text-muted);
}
.paytable div b {
  display: block;
  font-size: var(--fs-md);
  color: var(--text);
}
.paytable div.active {
  background: var(--gold);
  color: #1d1505;
}
.paytable div.active b {
  color: #1d1505;
}

/* ---------- Slots ---------- */
.slot-machine {
  display: flex;
  justify-content: center;
  gap: var(--s2);
  max-width: 560px;
  margin: 0 auto;
  padding: var(--s3);
  border-radius: var(--r-lg);
  border: 1px solid var(--line-strong);
  background: linear-gradient(180deg, #16181c, #0e0f11);
  box-shadow: var(--shadow-1), inset 0 0 24px rgba(0, 0, 0, 0.6);
}
.slot-reel {
  flex: 1;
  max-width: 100px;
  height: 270px;
  overflow: hidden;
  border-radius: var(--r-sm);
  background: linear-gradient(180deg, #22252b, #2b2f35 50%, #22252b);
}
.slot-strip {
  will-change: transform;
}
.slot-sym {
  height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.slot-sym svg {
  width: 64px;
  height: 64px;
}
.slot-sym.win {
  background: var(--gold-soft);
  box-shadow: inset 0 0 16px var(--gold);
}
.paylist {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px var(--s2);
  align-items: center;
  font-size: var(--fs-xs);
  color: var(--text-muted);
}
.paylist svg {
  width: 24px;
  height: 24px;
}

/* ---------- Cases and battles ---------- */
.item-list {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--s2);
  margin-top: var(--s4);
}
.item-card {
  min-width: 92px;
  padding: var(--s2);
  border-radius: var(--r-sm);
  border-bottom: 4px solid var(--rarity, #888);
  background: var(--surface-2);
  text-align: center;
}
.item-card b {
  display: block;
  font-size: var(--fs-sm);
}
.item-card small {
  display: block;
  font-size: 10px;
  color: var(--text-muted);
}
.battle-row {
  padding: var(--s2);
  margin-bottom: var(--s3);
  border-radius: var(--r-md);
  border: 2px solid transparent;
}
.battle-row.winner {
  border-color: var(--gold-2);
  background: rgba(242, 196, 74, 0.06);
}
.battle-row .head {
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
  font-weight: 650;
}
.battle-row .reel {
  height: 96px;
}

@media (max-width: 960px) {
  .game-cols {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 560px) {
  .stage {
    padding: var(--s3);
  }
  .big-result {
    font-size: 42px;
  }
  .dial {
    width: 220px;
    height: 220px;
  }
  .slot-reel {
    height: 210px;
  }
  .slot-sym {
    height: 70px;
  }
  .slot-sym svg {
    width: 48px;
    height: 48px;
  }
  .lane {
    font-size: 8px;
  }
  .lane .slot svg {
    width: 30px;
    height: 30px;
  }
}

/* While a reel spins, nothing inside the strip animates (each animation would repaint the whole strip every frame). */
.reel.spinning .reel-strip * { animation: none !important; transition: none !important; }
