/* ==========================================================================
   Avezz Casino (Roulette & Slots), Jigsaw & Win Modal — Visual Polish
   ========================================================================== */

.arcade-shell {
  max-width: 960px;
  margin: 0 auto;
  padding: 20px 18px 72px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Top Bar: Title, Switcher, Balance */
.arcade-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 18px;
  box-shadow: var(--shadow-card);
}

.arcade-title-group {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.arcade-title-group h1 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  margin: 0;
}

.arcade-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--surface-alt);
  border: 1px solid var(--border);
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease;
}

.arcade-back:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.casino-tabs {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px;
  border-radius: 10px;
  background: var(--segment-bg);
}

.casino-tab {
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.casino-tab:hover {
  color: var(--text);
}

.casino-tab.is-active {
  background: var(--segment-active);
  color: var(--text);
  box-shadow: var(--segment-shadow);
}

.arcade-balance {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.14), rgba(217, 119, 6, 0.08));
  border: 1px solid rgba(245, 158, 11, 0.32);
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text);
}

.arcade-balance-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fde68a, #f59e0b 65%, #b45309);
  box-shadow: 0 0 8px rgba(245, 158, 11, 0.55);
}

.arcade-balance-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

/* Shared Stage Card */
.arcade-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 24px;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}

.arcade-result {
  min-height: 24px;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-secondary);
  text-align: center;
}

/* ==========================================================================
   Roulette
   ========================================================================== */
.roulette-frame {
  position: relative;
  width: 100%;
  max-width: 793px;
  padding: 10px;
  border-radius: 16px;
  background: linear-gradient(180deg, #16181f 0%, #0d0f14 100%);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: inset 0 2px 12px rgba(0, 0, 0, 0.65), 0 12px 28px rgba(0, 0, 0, 0.16);
}

.roulette-container {
  position: relative;
  width: 100%;
  max-width: 793px;
  height: 81px;
  overflow: hidden;
  border-radius: 10px;
  background: #0b0d12;
}

.roulette-container::before,
.roulette-container::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 68px;
  z-index: 6;
  pointer-events: none;
}

.roulette-container::before {
  left: 0;
  background: linear-gradient(90deg, rgba(11, 13, 18, 0.92), transparent);
}

.roulette-container::after {
  right: 0;
  background: linear-gradient(270deg, rgba(11, 13, 18, 0.92), transparent);
}

.roulette-inner {
  background: transparent;
  height: 81px;
  display: flex;
  align-items: center;
  position: absolute;
  top: 0;
  left: 0;
}

/* CRITICAL: width 61px & height 71px match roulette.js & slot.js math */
.square {
  box-sizing: border-box;
  width: 61px;
  min-width: 61px;
  height: 71px;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -0.02em;
  border: 3px solid #0b0d12;
  border-radius: 11px;
  color: #ffffff;
  background: #1f2430;
  overflow: hidden;
  user-select: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

.square.green {
  background: linear-gradient(180deg, #10b981 0%, #047857 100%);
}

.square.red {
  background: linear-gradient(180deg, #ef4444 0%, #b91c1c 100%);
}

.square.black {
  background: linear-gradient(180deg, #2b303c 0%, #14171f 100%);
}

.selector {
  position: absolute;
  left: 50%;
  top: 0;
  transform: translateX(-50%);
  width: 3px;
  height: 100%;
  background: #fbbf24;
  box-shadow: 0 0 12px rgba(251, 191, 36, 0.85);
  z-index: 10;
  pointer-events: none;
}

.selector::before,
.selector::after {
  content: "";
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
}

.selector::before {
  top: 0;
  border-top: 8px solid #fbbf24;
}

.selector::after {
  bottom: 0;
  border-bottom: 8px solid #fbbf24;
}

.roulette-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

.casino-spin-btn {
  height: 42px;
  padding: 0 28px;
  border-radius: 12px;
  border: 0;
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  color: #ffffff;
  font-size: 14.5px;
  font-weight: 700;
  letter-spacing: 0.01em;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(0, 113, 227, 0.28);
  transition: transform 0.14s ease, box-shadow 0.14s ease, opacity 0.14s ease;
}

.casino-spin-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(0, 113, 227, 0.36);
}

.casino-spin-btn:active {
  transform: translateY(0);
}

/* Roulette Bet Grid */
.bet-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  width: 100%;
}

.bet-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.bet-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.bet-color-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.bet-color-swatch {
  width: 14px;
  height: 14px;
  border-radius: 4px;
}

.bet-panel--black .bet-color-swatch { background: #1f2430; border: 1px solid rgba(255, 255, 255, 0.2); }
.bet-panel--red .bet-color-swatch   { background: #dc2626; }
.bet-panel--green .bet-color-swatch { background: #059669; }

.bet-mult {
  font-size: 11.5px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--surface-alt);
  color: var(--text-secondary);
}

.bet-input-wrap {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.bet-input-wrap label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-secondary);
}

.bet-input-wrap input[type="number"] {
  width: 100%;
  height: 38px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: var(--surface-alt);
  color: var(--text);
  font-size: 15px;
  font-weight: 700;
  outline: none;
}

.bet-input-wrap input[type="number"]:focus {
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 3px var(--accent-ring);
}

.btGroup {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.btGroup button {
  height: 30px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-alt);
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.14s ease, border-color 0.14s ease, transform 0.1s ease;
}

.btGroup button:hover {
  background: var(--surface-hover);
  border-color: var(--accent);
}

.btGroup button:active {
  transform: scale(0.96);
}

/* ==========================================================================
   Slot Machine
   ========================================================================== */
.slot-cabinet {
  padding: 20px 26px;
  border-radius: 20px;
  background: linear-gradient(180deg, #1b1f2a 0%, #10131a 100%);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 16px 36px rgba(0, 0, 0, 0.24);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.slot-marquee {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #fbbf24;
  text-shadow: 0 0 10px rgba(251, 191, 36, 0.45);
}

.machine {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: 14px;
  background: #090b10;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 4px 16px rgba(0, 0, 0, 0.75);
}

.reelContainer {
  position: relative;
  width: 68px;
  height: 213px;
  overflow: hidden;
  border-radius: 10px;
  background: #141822;
}

.reelContainer::before,
.reelContainer::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 52px;
  z-index: 6;
  pointer-events: none;
}

.reelContainer::before {
  top: 0;
  background: linear-gradient(180deg, rgba(9, 11, 16, 0.88), transparent);
}

.reelContainer::after {
  bottom: 0;
  background: linear-gradient(0deg, rgba(9, 11, 16, 0.88), transparent);
}

.reelInner {
  background: transparent;
  width: 100%;
  position: absolute;
  top: 0;
  left: 0;
}

.reelInner .square {
  width: 68px;
  min-width: 68px;
  height: 71px;
  font-size: 28px;
  border: 2px solid #090b10;
  background: linear-gradient(180deg, #232836 0%, #171b24 100%);
}

.slotSelector {
  position: absolute;
  top: 50%;
  left: 0;
  transform: translateY(-50%);
  width: 100%;
  height: 3px;
  background: rgba(251, 191, 36, 0.9);
  box-shadow: 0 0 10px rgba(251, 191, 36, 0.8);
  z-index: 10;
  pointer-events: none;
}

.slot-bet-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

.slot-bet-btn {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 96px;
  padding: 10px 18px;
  border-radius: 14px;
  border: 1px solid var(--border-strong);
  background: var(--surface-alt);
  color: var(--text);
  cursor: pointer;
  transition: transform 0.14s ease, border-color 0.14s ease, background 0.14s ease;
}

.slot-bet-btn:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  transform: translateY(-2px);
}

.slot-bet-btn strong {
  font-size: 18px;
  font-weight: 800;
}

.slot-bet-btn span {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ==========================================================================
   Jigsaw Puzzle Stage
   ========================================================================== */
.jigsaw-canvas-wrap {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 8px;
  border-radius: var(--radius-lg);
  background: var(--surface-alt);
  border: 1px solid var(--border);
}

#jigsawCanvas {
  display: block;
  width: min(100%, 720px);
  height: auto;
  border-radius: var(--radius);
  cursor: grab;
  touch-action: none;
  box-shadow: var(--shadow-card);
}

#jigsawCanvas.is-dragging {
  cursor: grabbing;
}

.jigsaw-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

.jigsaw-hint {
  font-size: 13px;
  color: var(--text-secondary);
  margin: 0;
  text-align: center;
}

/* ==========================================================================
   Win Celebration Modal (games.js CoinModal)
   ========================================================================== */
.modal-overlay {
  position: fixed;
  z-index: var(--z-modal, 60);
  inset: 0;
  background: rgba(9, 11, 16, 0.72);
  display: flex;
  justify-content: center;
  align-items: center;
  backdrop-filter: blur(8px);
}

.modal-content.games {
  margin: 0;
  padding: 36px 32px;
  width: min(92vw, 380px);
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(28, 31, 42, 0.96), rgba(16, 18, 24, 0.98));
  border: 1px solid rgba(251, 191, 36, 0.35);
  box-shadow: 0 28px 64px rgba(0, 0, 0, 0.55);
  text-align: center;
  position: relative;
  overflow: visible;
  animation: arcadePopIn 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

.modal-overlay h1 {
  color: #ffffff;
  font-size: 22px;
  font-weight: 800;
  margin: 0 0 18px;
}

.modal-content .main {
  display: flex;
  justify-content: center;
}

.round {
  width: 112px;
  height: 112px;
  margin: 0 auto 14px;
  border-radius: 50%;
  background: radial-gradient(circle at 32% 30%, #fef08a, #f59e0b 65%, #b45309);
  box-shadow: 0 12px 30px rgba(245, 158, 11, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
}

.round::after {
  content: "★";
  font-size: 46px;
  color: #ffffff;
  text-shadow: 0 2px 8px rgba(180, 83, 9, 0.45);
}

.modal-overlay h2 {
  color: #ffffff;
  font-size: 38px;
  font-weight: 800;
  line-height: 1.1;
  margin: 0 0 4px;
}

.modal-overlay h3 {
  color: #fbbf24;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin: 0;
}

.modal-content.games .claim {
  margin-top: 22px;
  height: 42px;
  padding: 0 32px;
  border-radius: 12px;
  border: 0;
  background: linear-gradient(135deg, #fbbf24, #d97706);
  color: #111827;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.14s ease, filter 0.14s ease;
}

.modal-content.games .claim:hover {
  transform: translateY(-1px);
  filter: brightness(1.06);
}

.confetti-container {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 1px;
  height: 1px;
  pointer-events: none;
}

.confetti-piece {
  position: absolute;
  opacity: 0;
  border-radius: 50%;
  animation: confetti-fall-radial var(--duration) ease-out forwards;
}

@keyframes arcadePopIn {
  from { transform: scale(0.92) translateY(12px); opacity: 0; }
  to   { transform: scale(1) translateY(0); opacity: 1; }
}

@keyframes confetti-fall-radial {
  0%   { transform: translate(0, 0) scale(1) rotate(0deg); opacity: 1; }
  100% { transform: translate(var(--end-x), var(--end-y)) scale(0.3) rotate(720deg); opacity: 0; }
}

@media (max-width: 820px) {
  .bet-grid {
    grid-template-columns: 1fr;
  }

  .arcade-card {
    padding: 16px;
  }
}
