/* vegasslots — Vegas-style 3×3 slot machine */

.app {
  max-width: 560px;
  padding-bottom: 32px;
}

/* ── HUD ───────────────────────────────────────────────── */
.hud {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr;
  gap: 8px;
  margin: 12px 0;
}
.hud-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 8px 10px;
  text-align: center;
  box-shadow: var(--shadow-sm);
}
.hud-box.pool-box {
  background: linear-gradient(180deg, #c0392b, #78281f);
  border-color: #ffd700;
  color: #fff;
}
.hud-box.pool-box .hud-label { color: #ffe88c; }
.hud-box.pool-box .hud-value { color: gold; text-shadow: 0 0 4px rgba(255,215,0,0.6); }
.hud-label {
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}
.hud-value {
  font-size: 20px;
  font-weight: 800;
  color: var(--accent);
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
  transition: color 0.15s, transform 0.15s;
}
.hud-value.pulse {
  animation: hud-pulse 0.5s ease;
}
@keyframes hud-pulse {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.18); color: gold; }
  100% { transform: scale(1); }
}

/* ── Machine ───────────────────────────────────────────── */
.machine {
  background: linear-gradient(180deg, #1a0a2a, #2a1530);
  border: 4px solid #ffd700;
  border-radius: 16px;
  padding: 14px;
  box-shadow:
    0 0 0 2px #b8860b inset,
    0 8px 24px rgba(0,0,0,0.4),
    0 0 30px rgba(255, 215, 0, 0.2);
  transition: box-shadow 0.3s ease;
}
.machine.spinning {
  box-shadow:
    0 0 0 2px #fff5b8 inset,
    0 8px 24px rgba(0,0,0,0.5),
    0 0 50px rgba(255, 215, 0, 0.6),
    0 0 80px rgba(255, 215, 0, 0.3);
  animation: machine-rumble 0.08s ease-in-out infinite alternate;
}
@keyframes machine-rumble {
  0%   { transform: translate(0, 0); }
  100% { transform: translate(0.6px, -0.4px); }
}

/* Anticipation: reel 2 about to complete a payline. Red urgent glow + heavier
   shake to signal tension. The .spinning class is still applied (only reel 2
   is moving by this point) so we stack on top. */
.machine.anticipating {
  border-color: #ff4e4e;
  box-shadow:
    0 0 0 2px #ffaaaa inset,
    0 8px 30px rgba(0,0,0,0.6),
    0 0 60px rgba(255, 80, 60, 0.85),
    0 0 100px rgba(255, 215, 0, 0.45);
  animation: anticip-rumble 0.07s ease-in-out infinite alternate;
}
@keyframes anticip-rumble {
  0%   { transform: translate(-1px, 0.5px); }
  100% { transform: translate(1px, -0.7px); }
}

/* Jackpot screen shake — short violent jolt on body */
body.jackpot-shake { animation: body-shake 0.85s cubic-bezier(.36,.07,.19,.97); }
@keyframes body-shake {
  0%, 100% { transform: translate(0, 0); }
  10% { transform: translate(-9px, 4px); }
  20% { transform: translate(7px, -3px); }
  30% { transform: translate(-6px, 6px); }
  40% { transform: translate(5px, -5px); }
  55% { transform: translate(-4px, 3px); }
  70% { transform: translate(3px, -2px); }
  85% { transform: translate(-2px, 1px); }
}

/* Gold coin shower — falling coins from winning cells */
.coin {
  position: absolute;
  width: 18px;
  height: 18px;
  background: radial-gradient(circle at 30% 30%, #fff5b8, #e0a800 60%, #b8860b);
  border-radius: 50%;
  box-shadow: 0 0 6px rgba(255, 215, 0, 0.85), inset 0 -2px 3px rgba(0,0,0,0.25);
  transform: translate(-50%, -50%);
  animation: coin-fall 1.5s cubic-bezier(.5, .1, .8, 1) forwards;
  pointer-events: none;
  z-index: 6;
  will-change: transform, opacity;
}
@keyframes coin-fall {
  0%   { transform: translate(-50%, -50%) scale(0.4) rotate(0deg); opacity: 0; }
  15%  { transform: translate(-50%, -50%) scale(1.15) rotate(120deg); opacity: 1; }
  100% { transform: translate(calc(-50% + var(--dx, 0px)), calc(-50% + var(--dy, 100px))) scale(0.85) rotate(720deg); opacity: 0; }
}

.reel-window {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 4px;
  background: #0a0510;
  border-radius: 8px;
  padding: 6px;
  height: 240px;
  overflow: hidden;
}
.reel {
  background: #fff;
  border-radius: 6px;
  overflow: hidden;
  position: relative;
}
.reel.just-landed {
  animation: reel-land 0.32s cubic-bezier(.2,1.4,.5,1);
}
@keyframes reel-land {
  0%   { transform: translateY(-4px) scale(1); }
  40%  { transform: translateY(2px)  scale(1.03, 0.96); }
  70%  { transform: translateY(-1px) scale(0.99, 1.02); }
  100% { transform: translateY(0)    scale(1); }
}
.strip {
  display: flex;
  flex-direction: column;
  will-change: transform, filter;
  transition: filter 0.2s ease;
}
.strip.spinning {
  filter: blur(2.2px) saturate(0.8);
}
.strip .cell {
  width: 100%;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  background: #fff;
  border-bottom: 1px solid #f3f3f3;
  flex-shrink: 0;
  line-height: 1;
}
.strip .cell.win {
  background: radial-gradient(circle, #fff8c8, #ffeb88);
  animation: cell-bounce 0.6s ease-in-out infinite alternate;
}
@keyframes cell-bounce {
  0%   { transform: scale(1); }
  100% { transform: scale(1.12); }
}

/* ── Paylines ──────────────────────────────────────────── */
.paylines {
  position: absolute;
  inset: 6px;          /* match reel-window padding */
  width: calc(100% - 12px);
  height: calc(100% - 12px);
  pointer-events: none;
  overflow: visible;
}
.payline {
  fill: none;
  stroke: rgba(255, 215, 0, 0.0);
  stroke-width: 3;
  stroke-linejoin: round;
  stroke-linecap: round;
  transition: stroke 0.2s, opacity 0.2s;
  opacity: 0;
}
.payline.active {
  stroke: rgba(255, 215, 0, 0.55);
  opacity: 0.9;
}
.payline.winning {
  stroke: gold;
  stroke-width: 5;
  opacity: 1;
  filter: drop-shadow(0 0 6px gold) drop-shadow(0 0 12px gold);
  animation: line-pulse 0.7s ease-in-out infinite alternate;
}
@keyframes line-pulse {
  0%   { stroke-width: 5; }
  100% { stroke-width: 7; }
}

/* Floating per-line "+N" markers spawned at winning rows */
.win-float {
  position: absolute;
  font-size: 22px;
  font-weight: 900;
  color: gold;
  text-shadow: 0 2px 4px rgba(0,0,0,0.7), 0 0 8px gold;
  pointer-events: none;
  transform: translate(-50%, -50%);
  animation: win-float 1.4s cubic-bezier(.2,.7,.3,1) forwards;
  font-variant-numeric: tabular-nums;
  letter-spacing: 1px;
  z-index: 5;
}
.win-float.jackpot {
  font-size: 30px;
  color: #fff;
  text-shadow: 0 2px 4px #c0392b, 0 0 12px gold, 0 0 20px gold;
}
@keyframes win-float {
  0%   { opacity: 0; transform: translate(-50%, -50%) scale(0.4); }
  18%  { opacity: 1; transform: translate(-50%, -50%) scale(1.2); }
  35%  { opacity: 1; transform: translate(-50%, -70%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -140%) scale(0.9); }
}

/* Win marker overlay (e.g. "+250" floating text after a win) */
.win-marker {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  font-size: 48px;
  font-weight: 900;
  color: gold;
  text-shadow: 0 2px 6px rgba(0,0,0,0.8), 0 0 12px gold;
  opacity: 0;
  transform: scale(0.6);
  transition: opacity 0.3s, transform 0.3s;
  letter-spacing: 2px;
}
.win-marker.show {
  opacity: 1;
  transform: scale(1);
}
.win-marker.jackpot {
  font-size: 56px;
  color: #fff;
  text-shadow: 0 2px 8px #c0392b, 0 0 16px gold, 0 0 28px gold;
  animation: jackpot-shake 0.5s ease-in-out infinite alternate;
}
@keyframes jackpot-shake {
  0%   { transform: scale(1) rotate(-2deg); }
  100% { transform: scale(1.08) rotate(2deg); }
}

/* ── Machine base (controls) ───────────────────────────── */
.machine-base {
  margin-top: 12px;
  background: rgba(0,0,0,0.25);
  border-radius: 8px;
  padding: 10px 12px;
}
.status-row {
  text-align: center;
  margin-bottom: 8px;
  min-height: 22px;
}
.status {
  font-size: 14px;
  color: #ffe88c;
  font-weight: 600;
  letter-spacing: 0.5px;
}
.status.win  { color: #6bf26b; }
.status.big  { color: gold; font-size: 17px; font-weight: 900; }

.controls {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
}
.control-group { display: flex; flex-direction: column; gap: 4px; align-items: center; }
.control-label {
  font-size: 11px;
  color: rgba(255,255,255,0.65);
  letter-spacing: 0.5px;
}

.chip-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: center;
}
.chip-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 3px dashed #fff;
  background: radial-gradient(circle at 30% 30%, #f39c12, #b9770e);
  color: #fff;
  font-weight: 900;
  font-size: 14px;
  cursor: pointer;
  box-shadow: 0 3px 5px rgba(0,0,0,0.4);
  transition: transform 0.12s ease;
  font-variant-numeric: tabular-nums;
}
.chip-btn[data-chip="50"]   { background: radial-gradient(circle at 30% 30%, #16a085, #0e6655); }
.chip-btn[data-chip="100"]  { background: radial-gradient(circle at 30% 30%, #2980b9, #1b4f72); }
.chip-btn[data-chip="500"]  { background: radial-gradient(circle at 30% 30%, #8e44ad, #5b2c6f); }
.chip-btn[data-chip="1000"] { background: radial-gradient(circle at 30% 30%, #c0392b, #78281f); font-size: 13px; }
.chip-btn.allin {
  background: linear-gradient(135deg, #ffd700, #b8860b);
  color: #1a1a1a;
  font-size: 12px;
  letter-spacing: 1px;
  border-style: solid;
  border-color: #fff5b8;
}
.chip-btn:hover { transform: translateY(-2px); }
.chip-btn.active {
  transform: translateY(-3px) scale(1.06);
  outline: 2px solid gold;
  outline-offset: 2px;
}

.lines-row {
  display: flex;
  align-items: center;
  gap: 6px;
}
.line-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.4);
  background: rgba(255,255,255,0.1);
  color: #fff;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.1s;
}
.line-btn:hover { background: rgba(255,255,255,0.22); }
.lines-display {
  font-size: 22px;
  font-weight: 900;
  color: gold;
  min-width: 32px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.action-row {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  align-items: stretch;
}
.action-row .btn {
  border: none;
}
.paytable-btn {
  background: rgba(255,255,255,0.12);
  color: #fff;
  flex: 0 0 auto;
}
.spin-btn {
  flex: 1;
  background: linear-gradient(180deg, #e74c3c, #922b21);
  color: #fff;
  font-weight: 900;
  font-size: 18px;
  letter-spacing: 3px;
  border-radius: 8px;
  box-shadow: 0 4px 0 #5b1a14, 0 6px 12px rgba(0,0,0,0.3);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 8px;
  transition: transform 0.08s, box-shadow 0.08s;
  animation: spin-idle-glow 1.6s ease-in-out infinite alternate;
}
@keyframes spin-idle-glow {
  0%   { box-shadow: 0 4px 0 #5b1a14, 0 6px 12px rgba(0,0,0,0.3), 0 0 0 0 rgba(255, 215, 0, 0); }
  100% { box-shadow: 0 4px 0 #5b1a14, 0 6px 14px rgba(0,0,0,0.35), 0 0 18px 4px rgba(255, 215, 0, 0.55); }
}
.spin-btn:disabled { animation: none; }
.spin-btn:hover:not(:disabled) {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #5b1a14, 0 4px 8px rgba(0,0,0,0.3);
  animation: none;
}
.spin-btn:disabled {
  background: linear-gradient(180deg, #555, #333);
  color: #999;
  cursor: not-allowed;
  box-shadow: 0 2px 0 #222;
}
.spin-cost {
  font-size: 11px;
  font-weight: 600;
  opacity: 0.85;
  letter-spacing: 0.5px;
  margin-top: 2px;
}

/* ── Paytable modal ────────────────────────────────────── */
.paytable-modal[hidden] { display: none; }
.paytable-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.paytable-card {
  background: var(--surface);
  border: 2px solid gold;
  border-radius: 12px;
  padding: 18px 20px;
  max-width: 420px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 12px 30px rgba(0,0,0,0.5);
  color: var(--text-strong);
}
.paytable-card h3 { margin: 0 0 12px; color: var(--accent); text-align: center; }
.paytable { width: 100%; border-collapse: collapse; font-size: 14px; }
.paytable td { padding: 8px 6px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.paytable td:first-child { font-size: 22px; letter-spacing: 4px; text-align: center; white-space: nowrap; }
.paytable td.pay { font-weight: 800; color: var(--accent); text-align: center; font-size: 13px; white-space: nowrap; }
.paytable td:last-child { font-size: 12px; color: var(--text-muted); }
.paytable tr.wild td { color: #6a4ba0; }
.paytable tr.jackpot td { background: linear-gradient(90deg, rgba(255,215,0,0.12), rgba(255,215,0,0.04)); color: #c0392b; font-weight: 700; }
.paytable tr.scatter td { background: linear-gradient(90deg, rgba(74,144,226,0.12), rgba(74,144,226,0.04)); color: #1b5e8c; }
.paytable-note { margin: 12px 0; font-size: 12px; color: var(--text-muted); line-height: 1.4; }
.close-btn {
  display: block;
  margin: 8px auto 0;
  background: var(--btn-bg);
}

/* ── Mobile ────────────────────────────────────────────── */
@media (max-width: 520px) {
  .hud { grid-template-columns: 1fr 1fr; }
  .reel-window { height: 192px; }
  .strip .cell { height: 64px; font-size: 38px; }
  .controls { grid-template-columns: 1fr; }
  .lines-group { flex-direction: row; gap: 10px; justify-content: center; }
  .lines-group .control-label { margin-right: 6px; }
  .chip-btn { width: 40px; height: 40px; font-size: 13px; }
  .win-marker { font-size: 38px; }
  .win-marker.jackpot { font-size: 44px; }
}
