/* ═══════════════════════════════════════════════════════════════════════════
   main.css — Tragamonedas
   Design System: dark casino aesthetic, gold accents, neon glows.
   Google Fonts: Outfit + Orbitron
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Reset & base ──────────────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  /* Color palette */
  --bg-deep:        #060612;
  --bg-dark:        #0d0d1a;
  --bg-panel:       #12122a;
  --bg-card:        #1a1a35;
  --bg-machine:     #0f0f26;

  --gold:           #f0b840;
  --gold-light:     #ffd870;
  --gold-dark:      #c8922a;
  --neon-blue:      #4fc3f7;
  --neon-purple:    #b39ddb;
  --neon-green:     #69f0ae;
  --neon-red:       #ff5252;
  --neon-pink:      #f48fb1;

  --text-primary:   #f0eaf8;
  --text-secondary: #9e9ec5;
  --text-muted:     #5a5a8a;

  --border-glow:    rgba(240, 184, 64, 0.3);
  --border-subtle:  rgba(255,255,255,0.07);

  /* Sizing */
  --titlebar-h:     38px;
  --reel-size:      120px;
  --reel-width:     110px;
  --radius-sm:      8px;
  --radius-md:      14px;
  --radius-lg:      20px;

  /* Transitions */
  --transition-fast:  150ms ease;
  --transition-med:   300ms ease;
  --transition-slow:  500ms ease;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: 'Outfit', sans-serif;
  background: var(--bg-deep);
  color: var(--text-primary);
  user-select: none;
  -webkit-user-select: none;
}

button {
  font-family: 'Outfit', sans-serif;
  cursor: pointer;
  border: none;
  outline: none;
}

input {
  font-family: 'Outfit', sans-serif;
}

/* ── Scrollbar ──────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--text-muted); border-radius: 4px; }

/* ═══════════════════════════════════════════════════════════════════════════
   TITLEBAR
   ═══════════════════════════════════════════════════════════════════════════ */
.titlebar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--titlebar-h);
  background: linear-gradient(90deg, #090918 0%, #0f0f25 50%, #090918 100%);
  border-bottom: 1px solid rgba(240,184,64,0.2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px 0 14px;
  z-index: 1000;
  -webkit-app-region: drag;
}

.titlebar-logo {
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo-icon {
  font-size: 18px;
}

.logo-text {
  font-family: 'Orbitron', sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 3px;
  color: var(--gold);
  text-shadow: 0 0 12px rgba(240,184,64,0.6);
}

.titlebar-controls {
  display: flex;
  gap: 6px;
  -webkit-app-region: no-drag;
}

.tb-btn {
  width: 28px;
  height: 22px;
  border-radius: 5px;
  background: rgba(255,255,255,0.06);
  color: var(--text-secondary);
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.tb-btn:hover {
  background: rgba(255,255,255,0.15);
  color: var(--text-primary);
}

.tb-close:hover {
  background: rgba(255, 82, 82, 0.7);
  color: #fff;
}

/* ═══════════════════════════════════════════════════════════════════════════
   BACKGROUND PARTICLES
   ═══════════════════════════════════════════════════════════════════════════ */
.bg-particles {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}

.particle {
  position: absolute;
  width: 2px;
  height: 2px;
  border-radius: 50%;
  background: var(--gold);
  opacity: 0;
  animation: particleFloat var(--dur, 8s) var(--delay, 0s) infinite ease-in-out;
}

.particle:nth-child(1)  { left: 10%; --dur: 9s;  --delay: 0s;   --size: 3px; }
.particle:nth-child(2)  { left: 22%; --dur: 12s; --delay: 1s;   --size: 2px; }
.particle:nth-child(3)  { left: 35%; --dur: 8s;  --delay: 2.5s; --size: 4px; }
.particle:nth-child(4)  { left: 50%; --dur: 10s; --delay: 0.5s; --size: 2px; }
.particle:nth-child(5)  { left: 63%; --dur: 11s; --delay: 3s;   --size: 3px; }
.particle:nth-child(6)  { left: 75%; --dur: 7s;  --delay: 1.5s; --size: 2px; }
.particle:nth-child(7)  { left: 88%; --dur: 13s; --delay: 4s;   --size: 3px; }
.particle:nth-child(8)  { left: 42%; --dur: 9s;  --delay: 2s;   --size: 2px; }
.particle:nth-child(9)  { left: 58%; --dur: 11s; --delay: 0.8s; --size: 4px; }

@keyframes particleFloat {
  0%   { transform: translateY(110vh) scale(0); opacity: 0; }
  10%  { opacity: 0.6; }
  90%  { opacity: 0.3; }
  100% { transform: translateY(-10vh) scale(1); opacity: 0; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   GAME CONTAINER LAYOUT
   ═══════════════════════════════════════════════════════════════════════════ */
.game-container {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 200px 1fr 200px;
  gap: 16px;
  height: calc(100vh - var(--titlebar-h));
  margin-top: var(--titlebar-h);
  padding: 14px 16px 14px;
  align-items: start;
}

/* ═══════════════════════════════════════════════════════════════════════════
   SIDE PANELS
   ═══════════════════════════════════════════════════════════════════════════ */
.side-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  height: 100%;
}

.panel-label {
  font-family: 'Orbitron', sans-serif;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 2.5px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

/* Balance section */
.balance-section {
  background: linear-gradient(135deg, #1a1a3a 0%, #13132b 100%);
  border: 1px solid var(--border-glow);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  box-shadow: 0 0 20px rgba(240,184,64,0.08), inset 0 1px 0 rgba(255,255,255,0.06);
}

.balance-display {
  display: flex;
  align-items: baseline;
  gap: 4px;
}

.balance-currency {
  font-family: 'Orbitron', sans-serif;
  font-size: 20px;
  color: var(--gold);
}

.balance-value {
  font-family: 'Orbitron', sans-serif;
  font-size: 28px;
  font-weight: 700;
  color: var(--gold-light);
  text-shadow: 0 0 20px rgba(255,216,112,0.5);
  transition: color var(--transition-fast);
}

/* History section */
.history-section {
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.history-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px 8px;
  border-radius: 6px;
  font-size: 12px;
  animation: slideIn 300ms ease;
}

.history-win  { background: rgba(105, 240, 174, 0.08); border: 1px solid rgba(105,240,174,0.15); }
.history-loss { background: rgba(255, 82, 82, 0.06); border: 1px solid rgba(255,82,82,0.12); }

.history-symbols { font-size: 14px; letter-spacing: 1px; }

.history-result { font-family: 'Orbitron', sans-serif; font-size: 10px; font-weight: 700; }
.history-result.pos { color: var(--neon-green); }
.history-result.neg { color: var(--neon-red); }

@keyframes slideIn {
  from { opacity: 0; transform: translateX(-8px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* Paytable button */
.paytable-btn {
  background: linear-gradient(135deg, var(--bg-card) 0%, #1e1e40 100%);
  border: 1px solid rgba(179,157,219,0.3);
  border-radius: var(--radius-sm);
  color: var(--neon-purple);
  font-size: 12px;
  font-weight: 600;
  padding: 10px 14px;
  width: 100%;
  transition: all var(--transition-fast);
  letter-spacing: 0.5px;
}

.paytable-btn:hover {
  background: linear-gradient(135deg, #22224a 0%, #25254d 100%);
  border-color: var(--neon-purple);
  box-shadow: 0 0 14px rgba(179,157,219,0.25);
  transform: translateY(-1px);
}

/* RTP section */
.rtp-section {
  background: linear-gradient(135deg, #1a1a3a 0%, #13132b 100%);
  border: 1px solid rgba(79,195,247,0.25);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  text-align: center;
  box-shadow: 0 0 20px rgba(79,195,247,0.06);
}

.rtp-display {
  font-family: 'Orbitron', sans-serif;
  font-size: 26px;
  font-weight: 700;
  color: var(--neon-blue);
  text-shadow: 0 0 16px rgba(79,195,247,0.5);
}

.rtp-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Prizes section */
.prizes-section {
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px;
  flex: 1;
}

.prize-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.prize-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 6px;
  border-radius: 6px;
  font-size: 13px;
  background: rgba(255,255,255,0.03);
}

.prize-item.highlight {
  background: linear-gradient(90deg, rgba(255,82,82,0.08), rgba(240,184,64,0.08));
  border: 1px solid rgba(240,184,64,0.2);
}

.prize-mult {
  font-family: 'Orbitron', sans-serif;
  font-size: 10px;
  font-weight: 700;
  color: var(--gold);
}

.prize-mult.jackpot {
  color: var(--gold-light);
  text-shadow: 0 0 10px rgba(255,216,112,0.7);
  animation: jackpotPulse 2s ease infinite;
}

@keyframes jackpotPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

.prize-divider {
  height: 1px;
  background: var(--border-subtle);
  margin: 3px 0;
}

/* ═══════════════════════════════════════════════════════════════════════════
   MACHINE SECTION
   ═══════════════════════════════════════════════════════════════════════════ */
.machine-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  height: 100%;
  justify-content: center;
}

/* Machine header */
.machine-header {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  justify-content: center;
}

.machine-title {
  font-family: 'Orbitron', sans-serif;
  font-size: 22px;
  font-weight: 900;
  letter-spacing: 4px;
  color: var(--text-primary);
  text-shadow: 0 0 30px rgba(240,184,64,0.4);
  white-space: nowrap;
}

.title-accent {
  color: var(--gold);
  text-shadow: 0 0 20px rgba(240,184,64,0.8);
}

.header-lights {
  display: flex;
  gap: 7px;
  align-items: center;
}

.light {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 8px var(--gold);
  animation: lightBlink 1.5s ease infinite;
}

.light:nth-child(even) { animation-delay: 0.75s; }
.light:nth-child(3) { animation-delay: 0.5s; }

@keyframes lightBlink {
  0%, 100% { opacity: 1; box-shadow: 0 0 8px var(--gold); }
  50% { opacity: 0.3; box-shadow: 0 0 3px var(--gold); }
}

/* Machine body */
.machine-body {
  width: 100%;
  flex-shrink: 0;
}

.machine-frame {
  position: relative;
  background: linear-gradient(180deg, #0a0a20 0%, #060614 100%);
  border: 2px solid rgba(240,184,64,0.4);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow:
    0 0 40px rgba(240,184,64,0.12),
    0 0 80px rgba(240,184,64,0.05),
    inset 0 2px 0 rgba(255,255,255,0.06),
    inset 0 -2px 0 rgba(0,0,0,0.4);
}

/* Payline indicator */
.payline {
  position: absolute;
  left: 20px; right: 20px;
  top: 50%;
  transform: translateY(-50%);
  height: 3px;
  background: linear-gradient(90deg, transparent, rgba(240,184,64,0.6) 20%, var(--gold) 50%, rgba(240,184,64,0.6) 80%, transparent);
  box-shadow: 0 0 10px rgba(240,184,64,0.5);
  pointer-events: none;
  z-index: 2;
  border-radius: 2px;
}

/* Reels container */
.reels-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
}

.reel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.reel-separator {
  width: 2px;
  height: 80px;
  background: linear-gradient(180deg, transparent, rgba(240,184,64,0.3), transparent);
  margin: 0 10px;
}

/* Reel window — visible viewport */
.reel-window {
  width: var(--reel-width);
  height: var(--reel-size);
  overflow: hidden;
  border-radius: 12px;
  background: linear-gradient(180deg, #050510 0%, #080818 50%, #050510 100%);
  border: 1px solid rgba(255,255,255,0.1);
  position: relative;
  box-shadow:
    inset 0 4px 16px rgba(0,0,0,0.8),
    inset 0 -4px 16px rgba(0,0,0,0.8);
  transition: box-shadow var(--transition-med);
}

/* Inner shadow overlays for depth */
.reel-window::before,
.reel-window::after {
  content: '';
  position: absolute;
  left: 0; right: 0;
  height: 40px;
  z-index: 3;
  pointer-events: none;
}

.reel-window::before {
  top: 0;
  background: linear-gradient(to bottom, rgba(5,5,16,0.9) 0%, transparent 100%);
}

.reel-window::after {
  bottom: 0;
  background: linear-gradient(to top, rgba(5,5,16,0.9) 0%, transparent 100%);
}

/* Winning glow states */
.reel-window.win-glow {
  border-color: var(--gold);
  box-shadow:
    inset 0 4px 16px rgba(0,0,0,0.6),
    inset 0 -4px 16px rgba(0,0,0,0.6),
    0 0 20px rgba(240,184,64,0.6),
    0 0 40px rgba(240,184,64,0.3);
  animation: winGlowPulse 0.6s ease infinite alternate;
}

.reel-window.win-glow-pair {
  border-color: var(--neon-blue);
  box-shadow:
    inset 0 4px 16px rgba(0,0,0,0.6),
    inset 0 -4px 16px rgba(0,0,0,0.6),
    0 0 16px rgba(79,195,247,0.5),
    0 0 30px rgba(79,195,247,0.2);
  animation: winGlowPulse 0.8s ease infinite alternate;
}

@keyframes winGlowPulse {
  from { box-shadow: 0 0 20px rgba(240,184,64,0.6), 0 0 40px rgba(240,184,64,0.3), inset 0 4px 16px rgba(0,0,0,0.6), inset 0 -4px 16px rgba(0,0,0,0.6); }
  to   { box-shadow: 0 0 30px rgba(240,184,64,0.9), 0 0 60px rgba(240,184,64,0.5), inset 0 4px 16px rgba(0,0,0,0.3), inset 0 -4px 16px rgba(0,0,0,0.3); }
}

/* Reel strip — tall scroll container */
.reel-strip {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  will-change: transform;
}

/* Individual symbol in reel */
.reel-symbol {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  font-size: 52px;
  position: relative;
}

.symbol-emoji {
  display: block;
  filter: drop-shadow(0 0 6px rgba(255,255,255,0.2));
  transition: filter var(--transition-fast);
}

.symbol-seven {
  display: block;
  font-family: 'Orbitron', sans-serif;
  font-size: 56px;
  font-weight: 900;
  color: #e74c3c;
  text-shadow:
    0 0 10px rgba(231,76,60,0.8),
    0 0 20px rgba(231,76,60,0.4),
    0 2px 0 #8b1a1a;
  letter-spacing: -2px;
}

.reel-label {
  font-family: 'Orbitron', sans-serif;
  font-size: 9px;
  color: var(--text-muted);
  letter-spacing: 2px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   RESULT AREA
   ═══════════════════════════════════════════════════════════════════════════ */
.result-area {
  min-height: 52px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 100%;
}

.result-message {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-align: center;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 300ms ease, transform 300ms ease;
}

.result-message.show {
  opacity: 1;
  transform: translateY(0);
}

.result-message.win-triple {
  font-size: 18px;
  color: var(--gold-light);
  text-shadow: 0 0 20px rgba(255,216,112,0.6);
  animation: resultBounce 0.5s cubic-bezier(0.36,0.07,0.19,0.97);
}

.result-message.win-pair {
  color: var(--neon-blue);
  text-shadow: 0 0 15px rgba(79,195,247,0.5);
}

.result-message.no-win {
  color: var(--text-secondary);
}

.result-message.error {
  color: var(--neon-red);
  font-size: 13px;
}

@keyframes resultBounce {
  0%  { transform: scale(0.8); }
  40% { transform: scale(1.15); }
  70% { transform: scale(0.95); }
  100%{ transform: scale(1); }
}

.payout-message {
  font-family: 'Orbitron', sans-serif;
  font-size: 13px;
  font-weight: 700;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 300ms ease 100ms, transform 300ms ease 100ms;
}

.payout-message.show {
  opacity: 1;
  transform: translateY(0);
}

.payout-message.payout-win  { color: var(--neon-green); text-shadow: 0 0 10px rgba(105,240,174,0.4); }
.payout-message.payout-loss { color: var(--neon-red); }

/* ═══════════════════════════════════════════════════════════════════════════
   CONTROLS SECTION
   ═══════════════════════════════════════════════════════════════════════════ */
.controls-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: 100%;
}

/* Bet control */
.bet-control {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  width: 100%;
  max-width: 340px;
}

.bet-btn {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: linear-gradient(135deg, #22224a, #1a1a36);
  border: 1px solid rgba(255,255,255,0.12);
  color: var(--text-primary);
  font-size: 20px;
  font-weight: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.bet-btn:hover:not(:disabled) {
  background: linear-gradient(135deg, #2a2a5a, #22224a);
  border-color: var(--gold);
  color: var(--gold);
  box-shadow: 0 0 10px rgba(240,184,64,0.2);
}

.bet-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.bet-field {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.bet-label {
  font-family: 'Orbitron', sans-serif;
  font-size: 8px;
  letter-spacing: 2px;
  color: var(--text-muted);
}

.bet-input-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
}

.bet-currency {
  font-family: 'Orbitron', sans-serif;
  font-size: 14px;
  color: var(--gold);
}

.bet-input {
  width: 70px;
  background: transparent;
  border: none;
  color: var(--gold-light);
  font-family: 'Orbitron', sans-serif;
  font-size: 20px;
  font-weight: 700;
  text-align: center;
  -moz-appearance: textfield;
}

.bet-input::-webkit-inner-spin-button,
.bet-input::-webkit-outer-spin-button {
  -webkit-appearance: none;
}

.bet-input:focus {
  outline: none;
  color: var(--gold-light);
}

/* SPIN BUTTON */
.spin-btn {
  width: 100%;
  max-width: 340px;
  height: 58px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #c8922a 0%, #f0b840 40%, #ffd870 60%, #c8922a 100%);
  background-size: 200% 100%;
  color: #1a0f00;
  font-family: 'Orbitron', sans-serif;
  font-size: 18px;
  font-weight: 900;
  letter-spacing: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: none;
  box-shadow:
    0 4px 20px rgba(240,184,64,0.4),
    0 2px 0 rgba(0,0,0,0.3),
    inset 0 1px 0 rgba(255,255,255,0.3);
  transition: all var(--transition-fast);
  position: relative;
  overflow: hidden;
  animation: spinBtnShimmer 3s ease infinite;
}

@keyframes spinBtnShimmer {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.spin-btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.15) 50%, transparent 100%);
  transform: translateX(-100%);
  transition: transform 0.6s ease;
}

.spin-btn:hover:not(:disabled)::after {
  transform: translateX(100%);
}

.spin-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow:
    0 6px 28px rgba(240,184,64,0.55),
    0 2px 0 rgba(0,0,0,0.3),
    inset 0 1px 0 rgba(255,255,255,0.4);
}

.spin-btn:active:not(:disabled) {
  transform: translateY(1px);
  box-shadow:
    0 2px 10px rgba(240,184,64,0.3),
    0 1px 0 rgba(0,0,0,0.3);
}

.spin-btn:disabled {
  background: linear-gradient(135deg, #3a3a3a, #2a2a2a);
  color: var(--text-muted);
  box-shadow: none;
  cursor: not-allowed;
  animation: none;
}

.spin-btn.spinning {
  background: linear-gradient(135deg, #1a1a3a, #22224a);
  color: var(--neon-blue);
  animation: none;
}

.spin-icon {
  font-size: 16px;
}

.spin-btn.spinning .spin-icon {
  display: inline-block;
  animation: spinIcon 0.8s linear infinite;
}

@keyframes spinIcon {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

.keyboard-hint {
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

.keyboard-hint kbd {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 10px;
  font-family: 'Outfit', sans-serif;
  color: var(--text-secondary);
}

/* ═══════════════════════════════════════════════════════════════════════════
   WIN OVERLAY
   ═══════════════════════════════════════════════════════════════════════════ */
.win-overlay {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-slow);
}

.win-overlay.visible {
  opacity: 1;
  pointer-events: none; /* auto-dismiss, no interaction needed */
}

.win-overlay-content {
  text-align: center;
  animation: winPop 0.5s cubic-bezier(0.36, 0.07, 0.19, 0.97);
}

@keyframes winPop {
  0%  { transform: scale(0.3) rotate(-10deg); opacity: 0; }
  60% { transform: scale(1.1) rotate(2deg); }
  100%{ transform: scale(1) rotate(0deg); opacity: 1; }
}

.win-confetti {
  font-size: 64px;
  animation: spin3d 1s ease infinite;
}

@keyframes spin3d {
  0%   { transform: rotateY(0deg); }
  100% { transform: rotateY(360deg); }
}

.win-title {
  font-family: 'Orbitron', sans-serif;
  font-size: 36px;
  font-weight: 900;
  color: var(--gold-light);
  text-shadow: 0 0 40px rgba(255,216,112,0.9);
  letter-spacing: 4px;
  margin: 10px 0;
}

.win-amount {
  font-family: 'Orbitron', sans-serif;
  font-size: 28px;
  font-weight: 700;
  color: var(--neon-green);
  text-shadow: 0 0 20px rgba(105,240,174,0.7);
}

.win-sub {
  font-size: 16px;
  color: var(--text-secondary);
  margin-top: 6px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   GAME OVER SCREEN
   ═══════════════════════════════════════════════════════════════════════════ */
.game-over-screen {
  position: fixed;
  inset: 0;
  z-index: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.92);
  backdrop-filter: blur(8px);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-slow);
}

.game-over-screen.visible {
  opacity: 1;
  pointer-events: all;
}

.game-over-content {
  text-align: center;
  animation: fadeUp 0.5s ease;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

.game-over-icon {
  font-size: 72px;
  margin-bottom: 16px;
  animation: wobble 2s ease infinite;
}

@keyframes wobble {
  0%, 100% { transform: rotate(-5deg); }
  50% { transform: rotate(5deg); }
}

.game-over-title {
  font-family: 'Orbitron', sans-serif;
  font-size: 32px;
  font-weight: 900;
  color: var(--neon-red);
  text-shadow: 0 0 30px rgba(255,82,82,0.6);
  letter-spacing: 3px;
}

.game-over-sub {
  color: var(--text-secondary);
  font-size: 14px;
  margin: 10px 0 24px;
}

.restart-btn {
  background: linear-gradient(135deg, #c8922a, #f0b840);
  color: #1a0f00;
  font-family: 'Orbitron', sans-serif;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 2px;
  padding: 14px 28px;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(240,184,64,0.4);
  transition: all var(--transition-fast);
}

.restart-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 28px rgba(240,184,64,0.6);
}

/* ═══════════════════════════════════════════════════════════════════════════
   PAYTABLE MODAL
   ═══════════════════════════════════════════════════════════════════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.8);
  backdrop-filter: blur(6px);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-med);
}

.modal-overlay.visible {
  opacity: 1;
  pointer-events: all;
}

.modal-content {
  background: linear-gradient(160deg, #15152e 0%, #0e0e20 100%);
  border: 1px solid rgba(240,184,64,0.3);
  border-radius: var(--radius-lg);
  width: min(640px, 92vw);
  max-height: 85vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,0.8), 0 0 40px rgba(240,184,64,0.08);
  animation: modalSlideIn var(--transition-med) ease;
}

@keyframes modalSlideIn {
  from { opacity: 0; transform: scale(0.92) translateY(20px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(240,184,64,0.04);
}

.modal-title {
  font-family: 'Orbitron', sans-serif;
  font-size: 15px;
  font-weight: 700;
  color: var(--gold);
  letter-spacing: 2px;
}

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(255,255,255,0.06);
  color: var(--text-secondary);
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.modal-close:hover {
  background: rgba(255,82,82,0.2);
  color: var(--neon-red);
}

.modal-body {
  padding: 20px 22px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.rtp-info-box {
  background: rgba(79,195,247,0.06);
  border: 1px solid rgba(79,195,247,0.2);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 13px;
  color: var(--neon-blue);
  line-height: 1.6;
}

.rtp-info-box small {
  color: var(--text-secondary);
  font-size: 11px;
}

.paytable {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.paytable th {
  font-family: 'Orbitron', sans-serif;
  font-size: 9px;
  letter-spacing: 1.5px;
  color: var(--text-muted);
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border-subtle);
}

.paytable td {
  padding: 10px 10px;
  border-bottom: 1px solid rgba(255,255,255,0.03);
  color: var(--text-primary);
  vertical-align: middle;
}

.paytable tr:hover td {
  background: rgba(255,255,255,0.02);
}

.pt-symbol {
  font-size: 20px;
  margin-right: 6px;
  vertical-align: middle;
}

.pt-symbol.seven {
  font-family: 'Orbitron', sans-serif;
  font-size: 16px;
  font-weight: 900;
  color: #e74c3c;
  text-shadow: 0 0 6px rgba(231,76,60,0.5);
}

.modal-rules {
  background: var(--bg-panel);
  border-radius: var(--radius-sm);
  padding: 16px;
}

.modal-rules h3 {
  font-size: 12px;
  font-weight: 700;
  color: var(--gold);
  letter-spacing: 1px;
  margin-bottom: 10px;
  text-transform: uppercase;
}

.modal-rules ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}

.modal-rules li {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.modal-rules li strong {
  color: var(--text-primary);
}

.modal-rtp-calc {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.6;
  border-top: 1px solid var(--border-subtle);
  padding-top: 10px;
}

.modal-rtp-calc code {
  background: rgba(255,255,255,0.08);
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 10px;
  color: var(--neon-green);
}
/* ─── Sistema de pantallas (router) ────────────────────────────────────── */
.screen { display: none; }
.screen.active-screen { display: block; }

/* ─── Lobby ─────────────────────────────────────────────────────────────── */
.lobby-container {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; height: 100vh; gap: 2rem;
}
.lobby-title { font-family: 'Orbitron', sans-serif; font-size: 2.5rem; color: #ffffff; }
.lobby-cards { display: flex; gap: 1.5rem; }
.game-card {
  display: flex; flex-direction: column; align-items: center; gap: 0.5rem;
  padding: 2rem; min-width: 180px; background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.1); border-radius: 12px;
  cursor: pointer; transition: transform 0.2s, border-color 0.2s;
  /* Reset de estilos nativos del <button> */
  font-family: inherit;
  color: #ffffff;
}
.game-card:hover { transform: translateY(-4px); border-color: #f1c40f; }
.game-card-icon { font-size: 3rem; }
.game-card-title { font-weight: 700; color: #ffffff; }
.game-card-sub { font-size: 0.85rem; color: rgba(255,255,255,0.6); }
.game-card-balance {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.85rem;
  font-weight: 700;
  color: #ffd870;
  background: rgba(240,184,64,0.12);
  border: 1px solid rgba(240,184,64,0.3);
  border-radius: 999px;
  padding: 3px 10px;
  margin-top: 0.3rem;
}
.back-to-lobby {
  position: absolute; top: 60px; left: 20px; z-index: 10;
  background: none; border: 1px solid rgba(255,255,255,0.2);
  color: #fff; padding: 0.4rem 0.8rem; border-radius: 6px; cursor: pointer;
}

/* En tragamonedas el panel izquierdo empieza muy cerca del top: un botón
   absoluto ahí se superpone con el panel de fichas/historial. En vez de
   flotar, se vuelve el primer elemento del panel (en flujo normal). */
.back-to-lobby-inline {
  position: static;
  align-self: flex-start;
  width: auto;
  flex-shrink: 0;
}
/* ─── Blackjack ─────────────────────────────────────────────────────────── */
.hidden { display: none !important; }

.bj-container { max-width: 900px; margin: 80px auto 0; padding: 0 20px; color: #fff; }
.bj-setup { display: flex; flex-direction: column; align-items: center; gap: 1rem; }
.bj-dealer-cards { display: flex; gap: 1rem; margin-bottom: 1rem; }
.bj-dealer-card {
  padding: 1rem 1.2rem; border: 2px solid rgba(255,255,255,0.15); border-radius: 10px;
  cursor: pointer; text-align: center; min-width: 140px; color: #fff;
  background: rgba(255,255,255,0.03);
}
.bj-dealer-card.selected { border-color: #f1c40f; background: rgba(241,196,15,0.1); }
.bj-dealer-card .bj-dealer-title { font-weight: 700; margin-bottom: 0.3rem; }
.bj-dealer-card .bj-dealer-flavor { font-size: 0.75rem; opacity: 0.7; }
.bj-dealer-card .bj-dealer-stats { font-size: 0.7rem; color: #f1c40f; margin-top: 0.4rem; }

.bj-table { display: flex; flex-direction: column; gap: 1.5rem; align-items: center; }
.bj-dealer-area { text-align: center; }
.bj-hand { display: flex; gap: 0.4rem; justify-content: center; margin: 0.5rem 0; flex-wrap: wrap; }
.bj-card {
  width: 46px; height: 64px; border-radius: 6px; background: #fff; color: #111;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-weight: 700; font-size: 1rem; box-shadow: 0 2px 6px rgba(0,0,0,0.4);
}
.bj-card.red-suit { color: #e74c3c; }
.bj-card.back { background: linear-gradient(135deg,#2c3e50,#34495e); color: transparent; }
.bj-total { font-size: 0.85rem; opacity: 0.8; }

.bj-players-area { display: flex; gap: 1.5rem; flex-wrap: wrap; justify-content: center; }
.bj-player-box {
  border: 2px solid rgba(255,255,255,0.1); border-radius: 10px; padding: 0.8rem 1rem;
  min-width: 160px; text-align: center;
}
.bj-player-box.active-turn { border-color: #f1c40f; }
.bj-player-box.player-result-win { border-color: #2ecc71; }
.bj-player-box.player-result-lose { border-color: #e74c3c; }
.bj-player-box .bj-player-title { font-weight: 700; margin-bottom: 0.3rem; }
.bj-player-box .bj-player-result { font-size: 0.8rem; margin-top: 0.3rem; }

.bj-controls { display: flex; flex-direction: column; align-items: center; gap: 0.8rem; }
.bj-action-buttons { display: flex; gap: 0.6rem; }
.bj-action-btn {
  padding: 0.6rem 1rem; border-radius: 8px; border: 1px solid rgba(255,255,255,0.2);
  background: rgba(255,255,255,0.05); color: #fff; cursor: pointer; font-weight: 600;
}
.bj-action-btn:hover { background: rgba(241,196,15,0.15); border-color: #f1c40f; }
.bj-action-btn:disabled { opacity: 0.3; cursor: not-allowed; }

/* ─── Roulette ──────────────────────────────────────────────────────────── */
.rl-container { max-width: 700px; margin: 42px auto 0; padding: 0 20px; color: #fff; text-align: center; }
.rl-board { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.5rem; margin: 1rem 0; }
.rl-bet-btn {
  padding: 0.7rem; border-radius: 8px; border: 1px solid rgba(255,255,255,0.2);
  background: rgba(255,255,255,0.05); color: #fff; cursor: pointer; font-weight: 600;
}
.rl-bet-btn:hover { border-color: #f1c40f; }
.rl-bet-btn.rl-red { background: rgba(231,76,60,0.25); }
.rl-bet-btn.rl-black { background: rgba(0,0,0,0.4); }
.rl-straight { display: flex; gap: 0.5rem; justify-content: center; margin-bottom: 1rem; }
.rl-straight input {
  width: 140px; padding: 0.5rem; border-radius: 6px; border: 1px solid rgba(255,255,255,0.2);
  background: rgba(255,255,255,0.05); color: #fff;
}
.rl-placed-bets { margin: 1rem 0; min-height: 30px; font-size: 0.85rem; opacity: 0.85; }
.rl-placed-bets .rl-chip {
  display: inline-block; margin: 0.2rem; padding: 0.3rem 0.6rem; border-radius: 20px;
  background: rgba(241,196,15,0.15); border: 1px solid #f1c40f; cursor: pointer;
}
@keyframes dealCard {
  from { opacity: 0; transform: translateY(-40px) rotate(-8deg) scale(0.7); }
  to   { opacity: 1; transform: translateY(0) rotate(0) scale(1); }
}
.bj-card {
  animation: dealCard 0.35s ease-out backwards;
}

.rl-wheel-display { display: flex; gap: 1.2rem; justify-content: center; align-items: center; margin: 0.8rem 0; }
.rl-ball {
  width: 90px; height: 90px; border-radius: 50%; display: flex; align-items: center;
  justify-content: center; font-size: 2rem; font-weight: 800; color: #fff;
  background: radial-gradient(circle at 35% 30%, #2c3e50, #0d0d1a);
  border: 3px solid rgba(255,255,255,0.15); transition: border-color 0.3s;
}
.rl-ball.spinning { animation: ballSpin 0.15s linear infinite; }
.rl-ball.result-red    { border-color: #e74c3c; background: radial-gradient(circle at 35% 30%, #e74c3c, #7b241c); }
.rl-ball.result-black  { border-color: #444; background: radial-gradient(circle at 35% 30%, #333, #000); }
.rl-ball.result-green  { border-color: #2ecc71; background: radial-gradient(circle at 35% 30%, #2ecc71, #145a32); }
.rl-ball.settled { animation: ballSettle 0.4s ease-out; }

@keyframes ballSpin {
  0% { transform: rotate(0deg) scale(1); }
  50% { transform: rotate(180deg) scale(0.92); }
  100% { transform: rotate(360deg) scale(1); }
}
@keyframes ballSettle {
  0% { transform: scale(1.3); }
  60% { transform: scale(0.95); }
  100% { transform: scale(1); }
}

/* ═══════════════════════════════════════════════════════════════════════════
   FICHAS — control de apuesta a base de fichas clicables (los 3 juegos)
   ═══════════════════════════════════════════════════════════════════════════ */
.chip-control {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px;
  width: 100%;
  max-width: 340px;
}

.bet-amount-display {
  font-family: 'Orbitron', sans-serif;
  font-size: 20px;
  font-weight: 700;
  color: var(--gold-light);
  text-shadow: 0 0 12px rgba(255,216,112,0.4);
}

.chip-row {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

.chip-row.disabled {
  opacity: 0.45;
  pointer-events: none;
}

.chip-btn {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  font-family: 'Orbitron', sans-serif;
  font-weight: 700;
  font-size: 12px;
  color: #fff;
  border: 3px dashed rgba(255,255,255,0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 3px 0 rgba(0,0,0,0.35), 0 5px 12px rgba(0,0,0,0.45);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.chip-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 5px 0 rgba(0,0,0,0.35), 0 8px 16px rgba(0,0,0,0.5);
}

.chip-btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 0 rgba(0,0,0,0.35), 0 3px 8px rgba(0,0,0,0.4);
}

.chip-500  { background: radial-gradient(circle at 32% 28%, #5b9bff, #1c4e9e); }
.chip-1000 { background: radial-gradient(circle at 32% 28%, #4fe0a0, #1c7a52); }
.chip-1500 { background: radial-gradient(circle at 32% 28%, #c48bff, #6a3aa8); }
.chip-2000 { background: radial-gradient(circle at 32% 28%, #ff6b74, #a11d28); }

.chip-clear-btn {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.15);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1px;
  padding: 6px 16px;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.chip-clear-btn:hover {
  border-color: var(--neon-red);
  color: var(--neon-red);
}

/* Insignia de fichas para blackjack/ruleta (tragamonedas ya tiene su propio panel) —
   siempre visible, tanto en la pantalla de configuración como en la mesa de juego. */
.fichas-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  width: fit-content;
  margin: 0 auto 0.8rem;
  background: rgba(240,184,64,0.1);
  border: 1px solid rgba(240,184,64,0.3);
  border-radius: var(--radius-sm);
  padding: 8px 20px;
  box-shadow: 0 0 16px rgba(240,184,64,0.08);
}

.fichas-badge-label {
  font-family: 'Orbitron', sans-serif;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--text-muted);
}

.fichas-badge-value {
  font-family: 'Orbitron', sans-serif;
  font-size: 18px;
  font-weight: 700;
  color: var(--gold-light);
  text-shadow: 0 0 10px rgba(255,216,112,0.4);
}

/* ─── Blackjack: terminar partida / cambiar dealer ─────────────────────── */
.bj-end-btn {
  margin-top: 0.2rem;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  border: 1px solid rgba(255,82,82,0.35);
  background: rgba(255,82,82,0.08);
  color: #ff8080;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.85rem;
  transition: all var(--transition-fast);
}

.bj-end-btn:hover {
  background: rgba(255,82,82,0.18);
  border-color: var(--neon-red);
}

/* ─── Ruleta: rueda animada (una sola bola) ─────────────────────────────── */
.rl-wheel {
  position: relative;
  width: 190px;
  height: 190px;
  flex-shrink: 0;
}

.rl-wheel-disc {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 4px solid var(--gold);
  box-shadow: 0 0 20px rgba(240,184,64,0.3), inset 0 0 24px rgba(0,0,0,0.7);
  transition: transform 4.5s cubic-bezier(0.12, 0.7, 0.15, 1);
}

.rl-wheel-number {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  pointer-events: none;
}

/* Centrado sobre el punto exacto (rotar + empujar al radio) en vez de
   quedar "pegado" desde una esquina — así no se monta con el número vecino. */
.rl-wheel-number-text {
  position: absolute;
  top: 0;
  left: 0;
  transform: translate(-50%, -50%);
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  line-height: 1;
  color: #fff;
  white-space: nowrap;
  text-shadow: 0 1px 2px rgba(0,0,0,0.95), 0 0 4px rgba(0,0,0,0.9);
}

.rl-wheel-ball-orbit {
  position: absolute;
  inset: 0;
  transition: transform 4.5s cubic-bezier(0.12, 0.7, 0.15, 1);
}

.rl-wheel-ball {
  position: absolute;
  top: 7px;
  left: 50%;
  width: 11px;
  height: 11px;
  margin-left: -5.5px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff, #ccc);
  box-shadow: 0 0 6px rgba(255,255,255,0.9);
}

.rl-wheel-pointer {
  position: absolute;
  top: -7px;
  left: 50%;
  margin-left: -7px;
  width: 0;
  height: 0;
  border-left: 7px solid transparent;
  border-right: 7px solid transparent;
  border-top: 12px solid var(--gold);
  z-index: 5;
}

/* Overlay de pantalla completa: la rueda se agranda acá mientras gira,
   con una transición suave de opacidad para "aparecer" en grande. */
.rl-wheel-fullscreen-overlay {
  position: fixed;
  inset: 0;
  z-index: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.88);
  backdrop-filter: blur(6px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 500ms ease;
}

.rl-wheel-fullscreen-overlay.visible {
  opacity: 1;
}

.rl-wheel-overlay-slot {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Modificador aplicado a #rl-wheel mientras vive dentro del overlay */
.rl-wheel.rl-wheel--big {
  width: min(62vmin, 480px);
  height: min(62vmin, 480px);
}

.rl-wheel--big .rl-wheel-number-text { font-size: 19px; }

.rl-wheel--big .rl-wheel-ball {
  top: 16px;
  width: 22px;
  height: 22px;
  margin-left: -11px;
}

.rl-wheel--big .rl-wheel-pointer {
  top: -16px;
  margin-left: -16px;
  border-left-width: 16px;
  border-right-width: 16px;
  border-top-width: 26px;
}
