/* Estilos comunes: tema, barra de navegación, botones, avisos y efectos. */
:root {
  --bg: #15110c;
  --bg-2: #1e1811;
  --panel: #2a2117;
  --panel-2: #33281b;
  --slot: #3b2f22;
  --slot-border: #5a4630;
  --slot-hover: #c9a45c;
  --text: #eadcc0;
  --muted: #a8977a;
  --accent: #e0b35a;
  --accent-2: #ffd98a;
  --good: #8fcf6a;
  --bad: #e07a5a;
  --even: #2f6fc4;
  --odd: #b8322f;
  --discord: #5865f2;
  --nav-h: 60px;
  --display: "Cinzel", Georgia, serif;
}

* { box-sizing: border-box; }
/* Las sacudidas de pantalla no deben provocar desplazamiento horizontal */
html { overflow-x: clip; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(ellipse at 50% -10%, #3a2a16 0%, transparent 60%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font: 14px/1.5 system-ui, "Segoe UI", sans-serif;
}

a { color: var(--accent); }
h1, h2, h3 { font-family: var(--display); }

/* ---------- Barra de navegación ---------- */
#topnav {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 0 20px;
  background: linear-gradient(#2b2015, #1d160e);
  border-bottom: 2px solid var(--slot-border);
  box-shadow: 0 4px 16px #0008;
}
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--display);
  font-weight: 700;
  font-size: 19px;
  color: var(--accent);
  text-decoration: none;
  white-space: nowrap;
}
.brand img { width: 38px; height: 38px; border-radius: 8px; border: 1px solid #d9a44188; }
.nav-links { display: flex; gap: 4px; flex: 1; overflow-x: auto; }
.nav-links a {
  padding: 6px 12px;
  border-radius: 6px;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
}
.nav-links a:hover { background: #ffffff10; }
.nav-links a.active { background: #e0b35a22; color: var(--accent-2); }
.nav-user { display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.nav-user .avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--slot); object-fit: cover; }

.balance {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px 4px 6px;
  border-radius: 20px;
  background: #00000055;
  border: 1px solid var(--slot-border);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #e6e9ee;
}
.balance.bump { animation: bump .5s; }
@keyframes bump { 40% { transform: scale(1.15); box-shadow: 0 0 14px var(--accent); } }

/* Moneda de plata dibujada con CSS */
.coin {
  display: inline-block;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff, #c9ced6 40%, #7d8591 100%);
  border: 1px solid #5d636c;
  box-shadow: inset 0 0 0 2px #ffffff40;
  flex: none;
}

/* ---------- Botones ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  border: 1px solid var(--slot-border);
  border-radius: 8px;
  background: var(--slot);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: transform .1s, filter .15s;
}
.btn:hover { filter: brightness(1.2); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: not-allowed; filter: none; transform: none; }
.btn-gold {
  background: linear-gradient(#f3cd7a, #c08a2e);
  border-color: #f7dc9c;
  color: #2a1a05;
  text-shadow: 0 1px 0 #fff6;
}
.btn-discord { background: var(--discord); border-color: #7983f5; color: #fff; }
.btn-ghost { background: transparent; }
.btn-lg { padding: 14px 28px; font-size: 17px; border-radius: 10px; }

/* ---------- Paneles y avisos ---------- */
.panel {
  background: linear-gradient(var(--panel), var(--bg-2));
  border: 1px solid var(--slot-border);
  border-radius: 12px;
  padding: 20px;
}
.disclaimer {
  margin: 32px auto 24px;
  max-width: 900px;
  padding: 12px 16px;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  border-top: 1px solid var(--slot-border);
}
.disclaimer strong { color: var(--accent); }

.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 100; display: flex; flex-direction: column; gap: 8px; }
.toast {
  padding: 10px 16px;
  border-radius: 8px;
  background: var(--panel);
  border: 1px solid var(--slot-border);
  box-shadow: 0 6px 20px #000a;
  animation: toast-in .25s ease-out;
}
.toast.error { border-color: var(--bad); color: #ffc9b8; }
.toast.win { border-color: var(--good); color: #d8ffc4; }
@keyframes toast-in { from { transform: translateY(20px); opacity: 0; } }

.pos { color: var(--good); }
.neg { color: var(--bad); }
.muted { color: var(--muted); }

/* ---------- Efectos de celebración ---------- */
.fx-layer { position: fixed; inset: 0; pointer-events: none; z-index: 90; overflow: hidden; }
.confetti {
  position: absolute;
  top: -20px;
  width: 10px;
  height: 14px;
  border-radius: 2px;
  animation: fall linear forwards;
}
.fx-coin {
  position: absolute;
  top: -40px;
  width: 30px;
  height: 30px;
  animation: fall linear forwards;
}
.fx-coin.gold {
  width: var(--size, 28px);
  height: var(--size, 28px);
  background: radial-gradient(circle at 35% 30%, #fffbe0, #ffd84a 35%, #e0a21c 70%, #9a6408 100%);
  border: 1px solid #8a5a06;
  box-shadow: inset 0 0 0 3px #f6c33a, inset 0 0 0 4px #b07a10, 0 0 8px #ffcf4a88;
}
.fx-coin.fountain { top: auto; bottom: -36px; animation: none; filter: drop-shadow(0 0 6px #ffcf4acc); }
.fx-spark {
  position: absolute; bottom: -8px; width: 6px; height: 6px; border-radius: 50%;
  background: #fffbe0; box-shadow: 0 0 8px 3px #ffd84a, 0 0 16px 6px #ff9f1c88;
}
.fx-burst {
  position: absolute; bottom: 0; width: var(--burst, 400px); height: var(--burst, 400px);
  margin-left: calc(var(--burst, 400px) / -2); transform: translateY(50%) scale(.1);
  border-radius: 50%;
  background: radial-gradient(circle, #fffbe0 0%, #ffd84aee 20%, #ff9f1c88 45%, transparent 70%);
  animation: burst .7s ease-out forwards;
}
@keyframes burst {
  25% { opacity: 1; }
  to { transform: translateY(50%) scale(1); opacity: 0; }
}
@keyframes fall {
  to { transform: translate(var(--dx, 0), 110vh) rotate(var(--rot, 720deg)); }
}
.shake { animation: shake .5s; }
@keyframes shake {
  20%, 60% { transform: translateX(-8px); }
  40%, 80% { transform: translateX(8px); }
}

@media (max-width: 760px) {
  #topnav { gap: 10px; padding: 0 10px; }
  .brand span { display: none; }
  .nav-user .name { display: none; }
}

/* ---------- Aviso de primera visita y cookies ---------- */
body.modal-open { overflow: hidden; }
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 16px;
  background: #000b;
  backdrop-filter: blur(4px);
  animation: fade-in .25s ease-out;
}
.modal {
  width: min(480px, 100%);
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  padding: 24px;
  text-align: center;
  border-radius: 16px;
  border: 2px solid #d9a441;
  background: linear-gradient(var(--panel), var(--bg-2));
  box-shadow: 0 0 60px #e0b35a44, 0 20px 50px #000;
  animation: modal-in .35s cubic-bezier(.3, 1.4, .5, 1);
}
.modal-logo { width: 96px; height: 96px; border-radius: 16px; }
.modal h2 { margin: 10px 0; color: var(--accent); }
.modal p { margin: 0 0 10px; }
.modal ul { margin: 0 0 18px; padding-left: 20px; text-align: left; color: #d8c8a8; display: grid; gap: 6px; }
.modal b { color: var(--accent-2); }
@keyframes fade-in { from { opacity: 0; } }
@keyframes modal-in { from { opacity: 0; transform: translateY(20px) scale(.95); } }

.cookie-banner {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: 16px;
  z-index: 150;
  max-width: 760px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid var(--slot-border);
  background: var(--panel);
  box-shadow: 0 10px 30px #000c;
  animation: toast-in .3s ease-out;
}
.cookie-banner p { margin: 0; flex: 1; font-size: 13px; }
@media (max-width: 560px) { .cookie-banner { flex-direction: column; align-items: stretch; text-align: center; } }
.sound-btn { padding: 4px 10px; font-size: 18px; }
/* Recarga de saldo del entorno de pruebas */
.topup { position: relative; }
.topup-btn { padding: 4px 10px; color: #7ee787; border-color: rgba(126, 231, 135, 0.45); }
.topup-menu { display: none; position: absolute; right: 0; top: calc(100% + 6px); z-index: 60; flex-direction: column; gap: 4px;
  padding: 6px; background: var(--panel, #1d1712); border: 1px solid rgba(126, 231, 135, 0.4); border-radius: 10px; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5); }
.topup.open .topup-menu { display: flex; }
.topup-menu button { background: rgba(126, 231, 135, 0.12); color: #c6f6cb; border: 0; border-radius: 6px; padding: 6px 14px; font-weight: 700; cursor: pointer; }
.topup-menu button:hover { background: rgba(126, 231, 135, 0.25); }
