/* ============================================================================
 * styles.css — Tema EmmaFest (mobile-first, EDM · crypto wallet · gamer)
 * ----------------------------------------------------------------------------
 * Sistema visual:
 *   Fondo    : violeta casi-negro con auras neón
 *   Acentos  : magenta → violeta → cian  (gradiente de marca)
 *   Monedas  : oro cálido
 *   Tipos    : Space Grotesk (display) · Manrope (texto) · números tabulares
 * ========================================================================== */

/* ------------------------------- Tokens ---------------------------------- */
:root {
  --bg-0: #08060f;
  --bg-1: #0d0a1c;
  --bg-2: #14102a;
  --surface: rgba(255, 255, 255, 0.045);
  --surface-2: rgba(255, 255, 255, 0.08);
  --stroke: rgba(255, 255, 255, 0.1);
  --stroke-strong: rgba(255, 255, 255, 0.18);

  --text: #f3f0ff;
  --text-dim: #a79fce;
  --text-faint: #6f6893;

  --magenta: #ff2e97;
  --violet: #8b2fff;
  --cyan: #00e5ff;
  --gold: #ffcf3f;
  --gold-deep: #ff9d2f;
  --green: #2fe6a8;
  --red: #ff5470;

  --brand: linear-gradient(120deg, #ff2e97 0%, #8b2fff 52%, #00e5ff 100%);
  --gold-grad: linear-gradient(135deg, #ffe27a 0%, #ffcf3f 40%, #ff9d2f 100%);

  --radius: 20px;
  --radius-sm: 13px;
  --shadow: 0 18px 50px -20px rgba(0, 0, 0, 0.85);
  --glow-brand: 0 0 40px -6px rgba(139, 47, 255, 0.55);

  --font-display: "Space Grotesk", system-ui, sans-serif;
  --font-body: "Manrope", system-ui, sans-serif;
}

/* ------------------------------- Tema claro ------------------------------ */
html[data-theme="light"] {
  --bg-0: #f4f1fb;
  --bg-1: #ece7f8;
  --bg-2: #ffffff;
  --surface: rgba(24, 16, 48, 0.045);
  --surface-2: rgba(24, 16, 48, 0.08);
  --stroke: rgba(24, 16, 48, 0.12);
  --stroke-strong: rgba(24, 16, 48, 0.2);

  --text: #1c1430;
  --text-dim: #5b5280;
  --text-faint: #8b83a8;

  --gold: #d69200;
  --green: #12a877;

  --shadow: 0 18px 50px -24px rgba(80, 40, 140, 0.4);
  --glow-brand: 0 0 34px -8px rgba(139, 47, 255, 0.35);
}
html[data-theme="light"] body::before {
  background:
    radial-gradient(60% 40% at 15% 8%, rgba(255, 46, 151, 0.12), transparent 70%),
    radial-gradient(55% 45% at 92% 12%, rgba(0, 180, 220, 0.12), transparent 70%),
    radial-gradient(70% 55% at 50% 108%, rgba(139, 47, 255, 0.14), transparent 70%),
    linear-gradient(180deg, var(--bg-1), var(--bg-0));
}
/* En claro, las etiquetas internas de la wallet siguen sobre gradiente oscuro:
   mantenemos su texto claro para contraste. */
html[data-theme="light"] .wallet__label,
html[data-theme="light"] .wallet__unit,
html[data-theme="light"] .wallet__foot,
html[data-theme="light"] .wallet__name,
html[data-theme="light"] .wallet__balance {
  color: rgba(255, 255, 255, 0.92);
}
html[data-theme="light"] .wallet {
  box-shadow: var(--shadow), 0 0 40px -6px rgba(139, 47, 255, 0.4);
}

/* ------------------------------- Reset ----------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}
html,
body {
  height: 100%;
}
body {
  font-family: var(--font-body);
  color: var(--text);
  background: var(--bg-0);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  min-height: 100dvh;
}
/* Auras neón de fondo (ligeras, no animadas → sin costo continuo) */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(60% 40% at 15% 8%, rgba(255, 46, 151, 0.18), transparent 70%),
    radial-gradient(55% 45% at 92% 12%, rgba(0, 229, 255, 0.16), transparent 70%),
    radial-gradient(70% 55% at 50% 108%, rgba(139, 47, 255, 0.22), transparent 70%),
    linear-gradient(180deg, var(--bg-1), var(--bg-0));
}
button,
input {
  font: inherit;
  color: inherit;
}
button {
  cursor: pointer;
  border: none;
  background: none;
}
h1,
h2,
h3,
.display {
  font-family: var(--font-display);
  letter-spacing: -0.02em;
}
.tabnum {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

/* ------------------------------ Layout ----------------------------------- */
.app {
  max-width: 480px;
  margin: 0 auto;
  padding: 18px 16px 120px;
  min-height: 100dvh;
}
.hidden {
  display: none !important;
}

/* ------------------------------ Topbar ----------------------------------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18px;
}
.brand__mark {
  width: 34px;
  height: 34px;
  border-radius: 11px;
  background: var(--brand);
  display: grid;
  place-items: center;
  font-size: 18px;
  box-shadow: var(--glow-brand);
}
.brand__mark--img {
  background: none;
  border-radius: 50%;
}
.brand__mark--img img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  display: block;
  object-fit: cover;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 13px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--stroke);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dim);
}
.chip--rank {
  color: var(--gold);
  border-color: rgba(255, 207, 63, 0.3);
  background: rgba(255, 207, 63, 0.08);
}

/* --------------------------- Wallet card --------------------------------- */
.wallet {
  position: relative;
  border-radius: var(--radius);
  padding: 26px 24px 24px;
  background: linear-gradient(
    120deg,
    rgba(139, 47, 255, 0.34),
    rgba(255, 46, 151, 0.24) 30%,
    rgba(0, 229, 255, 0.2) 60%,
    rgba(139, 47, 255, 0.34) 100%
  );
  background-size: 300% 300%;
  animation: walletFlow 12s ease infinite;
  border: 1px solid var(--stroke-strong);
  box-shadow: var(--shadow), var(--glow-brand);
  overflow: hidden;
  isolation: isolate;
}
@keyframes walletFlow {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}
.wallet::after {
  /* brillo diagonal que recorre la tarjeta en bucle */
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(115deg, transparent 35%, rgba(255, 255, 255, 0.16) 50%, transparent 65%);
  background-size: 250% 100%;
  z-index: -1;
  animation: walletShine 7s ease-in-out infinite;
}
@keyframes walletShine {
  0% {
    background-position: 150% 0;
  }
  55%,
  100% {
    background-position: -150% 0;
  }
}
.wallet__label {
  font-size: 13px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.7);
  font-weight: 700;
}
.wallet__row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-top: 6px;
}
.wallet__balance {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 58px;
  line-height: 1;
  text-shadow: 0 4px 30px rgba(0, 0, 0, 0.4);
}
.wallet__coin {
  font-size: 40px;
  filter: drop-shadow(0 3px 8px rgba(255, 157, 47, 0.6));
}
.wallet__coin img {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  display: block;
  object-fit: cover;
}
.wallet__unit {
  font-size: 15px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.75);
  margin-top: 14px;
  font-weight: 700;
}
.wallet__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 22px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.75);
}
.wallet__name {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  color: #fff;
}
/* Avatar (foto de perfil de Google o inicial) */
.avatar {
  flex: none;
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--surface-2);
  border: 1px solid var(--stroke-strong);
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
  user-select: none;
}
.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.avatar--sm {
  width: 30px;
  height: 30px;
  font-size: 13px;
}
.wallet__name .avatar--sm {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.35);
  color: #fff;
}
.wallet__edit {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.7);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ------------------------------ Sections --------------------------------- */
.section {
  margin-top: 26px;
}
.section__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.section__title {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.section__hint {
  font-size: 12px;
  color: var(--text-faint);
}
/* Indicador "en vivo" */
.live-hint {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 8px 1px var(--green);
  animation: liveDot 1.8s ease-in-out infinite;
}
@keyframes liveDot {
  0%,
  100% {
    box-shadow: 0 0 6px 0 var(--green);
    opacity: 0.85;
  }
  50% {
    box-shadow: 0 0 12px 3px var(--green);
    opacity: 1;
  }
}
@media (prefers-reduced-motion: reduce) {
  .live-dot {
    animation: none;
  }
}

/* --------------------------- Modo TV / Reporte --------------------------- */
.tv {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: radial-gradient(120% 100% at 50% 0%, #140f2b 0%, #08060f 70%);
  color: var(--text);
  padding: 4vh 4vw;
  overflow-y: auto;
}
.tv.hidden {
  display: none;
}
.tv__head {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 3.5vh;
}
.tv__brand {
  display: flex;
  align-items: center;
  gap: 14px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(22px, 3.2vw, 40px);
}
.tv__brand img {
  width: clamp(36px, 4vw, 56px);
  height: clamp(36px, 4vw, 56px);
  border-radius: 50%;
  object-fit: cover;
}
.tv__live {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: clamp(12px, 1.3vw, 17px);
  letter-spacing: 0.14em;
  color: var(--green);
}
.tv__x {
  margin-left: auto;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--stroke);
  color: var(--text);
  font-size: 17px;
}
.tv__grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 3vw;
}
@media (max-width: 820px) {
  .tv__grid {
    grid-template-columns: 1fr;
  }
}
.tv__panel {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--stroke);
  border-radius: 22px;
  padding: 2.4vh 1.8vw;
}
.tv__title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(17px, 1.8vw, 26px);
  margin-bottom: 1.8vh;
  color: var(--text-dim);
}
.tv__list {
  display: flex;
  flex-direction: column;
  gap: 1.2vh;
}
.tv__item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 1.1vh 1vw;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
  font-size: clamp(15px, 1.6vw, 24px);
}
.tv__item:first-child {
  background: linear-gradient(100deg, rgba(255, 207, 63, 0.14), transparent);
}
.tv__medal {
  width: 1.8em;
  text-align: center;
  flex-shrink: 0;
}
.tv__pos {
  font-weight: 800;
  color: var(--text-faint);
}
.tv__name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* Reporte de cierre — RSVP */
.report__rsvp-row {
  display: grid;
  grid-template-columns: 1.4fr 1.2fr auto auto;
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.report__rsvp-who {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.report__rsvp-who small {
  color: var(--text-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.report__rsvp-pass,
.report__rsvp-date {
  color: var(--text-dim);
  white-space: nowrap;
}
@media (max-width: 560px) {
  .report__rsvp-row {
    grid-template-columns: 1fr auto;
  }
}
/* Reporte de cierre */
.report {
  max-width: 860px;
  margin: 0 auto;
}
.report__podium {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 18px;
  margin-bottom: 4vh;
}
.report__place {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 20px 22px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--stroke);
  min-width: 130px;
}
.report__place--1 {
  order: 2;
  border-color: rgba(255, 207, 63, 0.5);
  box-shadow: 0 0 30px -8px rgba(255, 207, 63, 0.5);
  transform: scale(1.1);
}
.report__place--2 {
  order: 1;
}
.report__place--3 {
  order: 3;
}
.report__medal {
  font-size: 34px;
}
.report__name {
  font-weight: 700;
}
.report__stats {
  margin-bottom: 3vh;
}
.report__foot {
  text-align: center;
  color: var(--text-faint);
  font-size: 13px;
}

/* ------------------------------- Feed ------------------------------------ */
.feed {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.feed__item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--stroke);
  animation: slideIn 0.35s ease both;
}
.feed__emoji {
  width: 36px;
  height: 36px;
  flex: none;
  display: grid;
  place-items: center;
  font-size: 19px;
  border-radius: 11px;
  background: var(--surface-2);
}
.feed__text {
  flex: 1;
  min-width: 0;
  font-size: 14px;
  font-weight: 500;
}
.feed__text small {
  display: block;
  color: var(--text-faint);
  font-size: 11px;
  margin-top: 2px;
}
.feed__delta {
  font-weight: 800;
  font-size: 14px;
  white-space: nowrap;
}
.feed__delta--up {
  color: var(--green);
}
.feed__delta--down {
  color: var(--red);
}

/* --------------------------- Empty states -------------------------------- */
.empty {
  text-align: center;
  padding: 34px 18px;
  color: var(--text-faint);
  border: 1px dashed var(--stroke);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.02);
}
.empty__emoji {
  font-size: 30px;
  opacity: 0.7;
}
.empty p {
  margin-top: 8px;
  font-size: 14px;
}

/* ------------------------------ Buttons ---------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 20px;
  border-radius: 14px;
  font-weight: 700;
  font-size: 15px;
  transition: transform 0.12s ease, filter 0.2s ease, opacity 0.2s;
  border: 1px solid transparent;
}
.btn:active {
  transform: scale(0.97);
}
.btn:disabled,
.btn.is-busy {
  opacity: 0.55;
  pointer-events: none;
}
.btn--primary {
  background: var(--brand);
  color: #fff;
  box-shadow: var(--glow-brand);
}
.btn--gold {
  background: var(--gold-grad);
  color: #2a1600;
}
.btn--ghost {
  background: var(--surface);
  border-color: var(--stroke-strong);
  color: var(--text);
}
.btn--danger {
  background: linear-gradient(135deg, #ff5470, #c81e46);
  color: #fff;
}
.btn--block {
  width: 100%;
}

/* ------------------------------- Inputs ---------------------------------- */
.field {
  width: 100%;
  padding: 15px 16px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--stroke-strong);
  color: var(--text);
  font-size: 16px; /* evita zoom en iOS */
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.field:focus {
  border-color: var(--violet);
  box-shadow: 0 0 0 3px rgba(139, 47, 255, 0.25);
}
.field::placeholder {
  color: var(--text-faint);
}

/* --------------------------- Onboarding ---------------------------------- */
.onboard {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 22px;
  max-width: 400px;
  margin: 0 auto;
  padding: 24px;
  text-align: center;
}
.onboard__logo {
  width: 76px;
  height: 76px;
  margin: 0 auto;
  border-radius: 22px;
  background: var(--brand);
  display: grid;
  place-items: center;
  font-size: 40px;
  box-shadow: var(--glow-brand);
  animation: floaty 4s ease-in-out infinite;
}
.onboard__logo--img {
  background: none;
  border-radius: 50%;
}
.onboard__logo--img img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  display: block;
  object-fit: cover;
}
.onboard__title {
  font-size: 30px;
  font-weight: 700;
}
.onboard__title span {
  background: var(--brand);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.onboard__sub {
  color: var(--text-dim);
  font-size: 15px;
  line-height: 1.5;
}
.onboard__gift {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  align-self: center;
  padding: 9px 16px;
  border-radius: 999px;
  background: rgba(255, 207, 63, 0.1);
  border: 1px solid rgba(255, 207, 63, 0.3);
  color: var(--gold);
  font-weight: 700;
  font-size: 14px;
}
.gbtn {
  gap: 12px;
  background: #fff;
  color: #1f2333;
  border-color: #fff;
  font-weight: 700;
}
.gbtn:active {
  filter: brightness(0.95);
}
.gbtn__icon {
  flex: none;
}
.onboard__fine {
  font-size: 12px;
  color: var(--text-faint);
  text-align: center;
}

/* ------------------------------- Toasts ---------------------------------- */
.toast-root {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 22px;
  z-index: 9000;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  padding: 0 16px;
}
.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 440px;
  width: max-content;
  padding: 12px 16px;
  border-radius: 13px;
  background: rgba(20, 16, 42, 0.92);
  border: 1px solid var(--stroke-strong);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
  font-size: 14px;
  font-weight: 600;
  transform: translateY(20px);
  opacity: 0;
  transition: transform 0.3s cubic-bezier(0.2, 0.9, 0.3, 1), opacity 0.3s;
}
.toast--in {
  transform: translateY(0);
  opacity: 1;
}
.toast__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: none;
  background: var(--cyan);
}
.toast--success .toast__dot {
  background: var(--green);
}
.toast--error .toast__dot {
  background: var(--red);
}
.toast--coin .toast__dot {
  background: var(--gold);
}

/* ---------------------------- Loading ------------------------------------ */
.loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 9500;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: rgba(8, 6, 15, 0.72);
  backdrop-filter: blur(6px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.loading-overlay--on {
  opacity: 1;
  pointer-events: auto;
}
.loading-spinner {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.15);
  border-top-color: var(--magenta);
  border-right-color: var(--violet);
  animation: spin 0.8s linear infinite;
}
.loading-label {
  color: var(--text-dim);
  font-size: 14px;
  font-weight: 600;
}

/* ----------------------------- Modal ------------------------------------- */
.modal-back {
  position: fixed;
  inset: 0;
  z-index: 9600;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(8, 6, 15, 0.7);
  backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity 0.2s;
}
.modal-back--in {
  opacity: 1;
}
.modal {
  width: 100%;
  max-width: 380px;
  border-radius: var(--radius);
  padding: 24px;
  background: linear-gradient(160deg, var(--bg-2), var(--bg-1));
  border: 1px solid var(--stroke-strong);
  box-shadow: var(--shadow);
  transform: scale(0.94);
  transition: transform 0.24s cubic-bezier(0.2, 0.9, 0.3, 1);
}
.modal-back--in .modal {
  transform: scale(1);
}
.modal__title {
  font-size: 19px;
  font-weight: 700;
}
.modal__body {
  color: var(--text-dim);
  font-size: 14px;
  line-height: 1.5;
  margin-top: 10px;
}
.modal__actions {
  display: flex;
  gap: 10px;
  margin-top: 22px;
}
.modal__actions .btn {
  flex: 1;
}

/* --------------------------- Coin particles ------------------------------ */
.coin-particle {
  position: fixed;
  z-index: 9800;
  font-size: 22px;
  pointer-events: none;
  animation: coinfly 1s ease-out forwards;
}
@keyframes coinfly {
  0% {
    transform: translate(-50%, -50%) scale(0.6) rotate(0);
    opacity: 0;
  }
  20% {
    opacity: 1;
  }
  100% {
    transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(1.1) rotate(var(--rot));
    opacity: 0;
  }
}

/* ----------------------------- Animations -------------------------------- */
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@keyframes floaty {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-8px);
  }
}
.pulse-up {
  animation: pulseUp 0.6s ease;
}
@keyframes pulseUp {
  0% {
    transform: scale(1);
  }
  40% {
    transform: scale(1.08);
    filter: brightness(1.3);
  }
  100% {
    transform: scale(1);
  }
}

/* ------------------------- Reduce motion --------------------------------- */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
  }
}

/* ========================================================================== */
/* FASE 2 · Navegación por tabs, Leaderboard, Dashboard global, Admin         */
/* ========================================================================== */

/* ------------------------------- Tab pages ------------------------------- */
.page {
  animation: fadeUp 0.3s ease both;
}
.page.hidden {
  display: none !important;
}
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.page__title {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 4px;
}
.page__lead {
  color: var(--text-dim);
  font-size: 14px;
  margin-bottom: 18px;
}

/* ------------------------------ Bottom nav ------------------------------- */
.nav {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 16px;
  z-index: 800;
  display: flex;
  gap: 4px;
  padding: 6px;
  border-radius: 999px;
  background: rgba(16, 12, 34, 0.86);
  border: 1px solid var(--stroke-strong);
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow);
  width: calc(100% - 32px);
  max-width: 448px;
  justify-content: space-between;
}
.nav__btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 8px 4px;
  border-radius: 999px;
  color: var(--text-faint);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
  transition: color 0.2s, background 0.2s;
}
.nav__btn span {
  font-size: 19px;
  line-height: 1;
}
.nav__btn span svg {
  width: 19px;
  height: 19px;
  display: block;
}
/* Íconos de línea (sprite #i-*) */
svg.ic {
  width: 1em;
  height: 1em;
  display: inline-block;
  vertical-align: -0.125em;
  flex-shrink: 0;
}
.tw-fab svg.ic {
  width: 20px;
  height: 20px;
}
.nav__btn.is-active {
  color: #fff;
  background: var(--brand);
  box-shadow: 0 6px 18px -6px rgba(139, 47, 255, 0.7);
}

/* ------------------------------ Leaderboard ------------------------------ */
.lb {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.lb__row {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 13px 15px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--stroke);
  transition: transform 0.5s cubic-bezier(0.2, 0.9, 0.3, 1), background 0.3s, border-color 0.3s;
  cursor: pointer;
}
/* Badges inline en el nombre (racha / logros) */
.lb__streak,
.lb__ach {
  font-size: 11px;
  font-weight: 800;
  margin-left: 6px;
  white-space: nowrap;
}
.lb__streak {
  color: var(--gold-deep, #ff9d2f);
}
.lb__ach {
  color: var(--text-faint);
}
/* Detalle expandible al tocar una fila */
.lb__detail {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  padding: 10px 15px 12px 58px;
  margin-top: -6px;
  border: 1px solid var(--stroke);
  border-top: none;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  background: var(--surface);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-faint);
}
.lb__pos {
  width: 30px;
  flex: none;
  text-align: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 17px;
  color: var(--text-faint);
}
.lb__medal {
  font-size: 22px;
}
.lb__name {
  flex: 1;
  min-width: 0;
  font-weight: 700;
  font-size: 15px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lb__name small {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-faint);
}
.lb__coins {
  font-weight: 800;
  font-size: 15px;
  color: var(--gold);
  white-space: nowrap;
}
.lb__coins small {
  color: var(--text-faint);
  font-weight: 600;
}
/* Podio — glow animado por lugar (oro, plata, bronce) */
.lb__row--1 {
  background: linear-gradient(100deg, rgba(255, 207, 63, 0.18), rgba(255, 157, 47, 0.06));
  border-color: rgba(255, 207, 63, 0.4);
  animation: goldGlow 2.4s ease-in-out infinite;
}
@keyframes goldGlow {
  0%,
  100% {
    box-shadow: 0 0 22px -8px rgba(255, 207, 63, 0.55);
  }
  50% {
    box-shadow: 0 0 34px -4px rgba(255, 207, 63, 0.9);
  }
}
.lb__row--2 {
  background: linear-gradient(100deg, rgba(210, 220, 255, 0.14), transparent);
  border-color: rgba(210, 220, 255, 0.3);
  animation: silverGlow 3s ease-in-out infinite;
}
@keyframes silverGlow {
  0%,
  100% {
    box-shadow: 0 0 16px -8px rgba(210, 220, 255, 0.4);
  }
  50% {
    box-shadow: 0 0 26px -5px rgba(210, 220, 255, 0.7);
  }
}
.lb__row--3 {
  background: linear-gradient(100deg, rgba(255, 157, 47, 0.14), transparent);
  border-color: rgba(255, 157, 47, 0.28);
  animation: bronzeGlow 3.6s ease-in-out infinite;
}
@keyframes bronzeGlow {
  0%,
  100% {
    box-shadow: 0 0 12px -8px rgba(255, 157, 47, 0.35);
  }
  50% {
    box-shadow: 0 0 22px -5px rgba(255, 157, 47, 0.6);
  }
}
@media (prefers-reduced-motion: reduce) {
  .lb__row--1,
  .lb__row--2,
  .lb__row--3 {
    animation: none;
  }
}
.lb__row--me {
  outline: 2px solid var(--violet);
  outline-offset: 1px;
}
/* Glow al ser nuevo líder */
.lb__row--newleader {
  animation: leaderGlow 1.6s ease, goldGlow 2.4s ease-in-out 1.6s infinite;
}
@keyframes leaderGlow {
  0%,
  100% {
    box-shadow: 0 0 30px -10px rgba(255, 207, 63, 0.55);
  }
  40% {
    box-shadow: 0 0 46px 2px rgba(255, 207, 63, 0.9);
    transform: scale(1.02);
  }
}
/* Variación reciente */
.lb__var {
  font-size: 11px;
  font-weight: 800;
  margin-left: 8px;
}
.lb__var--up {
  color: var(--green);
}
.lb__var--down {
  color: var(--red);
}

/* --------------------------- Stat cards (dashboard) ---------------------- */
.stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
.stat {
  padding: 16px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--stroke);
}
.stat--wide {
  grid-column: 1 / -1;
}
.stat__label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.stat__value {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 30px;
  margin-top: 8px;
  line-height: 1;
}
.stat__value small {
  font-size: 13px;
  color: var(--text-faint);
  font-weight: 600;
}
.stat__sub {
  font-size: 13px;
  color: var(--text-dim);
  margin-top: 6px;
  font-weight: 600;
}
/* Barra de supply */
.supply-bar {
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
  margin-top: 12px;
}
.supply-bar__fill {
  height: 100%;
  border-radius: 999px;
  background: var(--gold-grad);
  transition: width 0.6s cubic-bezier(0.2, 0.9, 0.3, 1);
}
.supply-legend {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-faint);
  margin-top: 6px;
  font-weight: 600;
}

/* ------------------------------- Admin ----------------------------------- */
.admin-card {
  padding: 18px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--stroke);
  margin-bottom: 16px;
}
.admin-card__title {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.admin-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 340px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.admin-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 13px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--stroke);
}
.admin-user__name {
  flex: 1;
  min-width: 0;
  font-weight: 700;
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.admin-user__name small {
  display: block;
  color: var(--gold);
  font-size: 12px;
  font-weight: 700;
}
.admin-user__badge {
  font-size: 10px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--brand);
  color: #fff;
}
.icon-btn {
  width: 34px;
  height: 34px;
  flex: none;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: 15px;
  background: var(--surface-2);
  border: 1px solid var(--stroke);
  transition: transform 0.12s, background 0.2s;
}
.icon-btn:active {
  transform: scale(0.9);
}
.icon-btn--danger {
  color: var(--red);
}

/* Segmented control */
.seg {
  display: flex;
  gap: 4px;
  padding: 4px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--stroke);
  margin-bottom: 12px;
}
.seg button {
  flex: 1;
  padding: 9px;
  border-radius: 9px;
  font-weight: 700;
  font-size: 13px;
  color: var(--text-dim);
  transition: background 0.2s, color 0.2s;
}
.seg button.is-active {
  background: var(--brand);
  color: #fff;
}
.form-row {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}
.form-row .field {
  flex: 1;
}
.label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-dim);
  margin: 12px 0 6px;
  display: block;
}

/* Scroll suave y estable en listas largas */
.admin-list::-webkit-scrollbar {
  width: 6px;
}
.admin-list::-webkit-scrollbar-thumb {
  background: var(--stroke-strong);
  border-radius: 3px;
}

/* ========================================================================== */
/* FASE 3 · Juegos, EmmaShop, Apuestas                                        */
/* ========================================================================== */

/* Sub-tabs (dentro de una página) */
.subtabs {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
}
.subtabs button {
  flex: 1;
  padding: 11px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 14px;
  color: var(--text-dim);
  background: var(--surface);
  border: 1px solid var(--stroke);
  transition: background 0.2s, color 0.2s;
}
.subtabs button.is-active {
  background: var(--brand);
  color: #fff;
  border-color: transparent;
}

/* --------------------------- Cards juego --------------------------------- */
.cards {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.gcard {
  border-radius: var(--radius);
  border: 1px solid var(--stroke);
  background: linear-gradient(155deg, rgba(139, 47, 255, 0.12), rgba(255, 46, 151, 0.06));
  overflow: hidden;
}
.gcard__head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  cursor: pointer;
}
.gcard__emoji {
  width: 48px;
  height: 48px;
  flex: none;
  display: grid;
  place-items: center;
  font-size: 26px;
  border-radius: 14px;
  background: var(--surface-2);
}
.gcard__title {
  flex: 1;
  min-width: 0;
}
.gcard__name {
  font-weight: 700;
  font-size: 16px;
}
.gcard__reward {
  font-size: 13px;
  font-weight: 700;
  color: var(--gold);
  margin-top: 2px;
}
.gcard__chev {
  color: var(--text-faint);
  transition: transform 0.3s;
  font-size: 14px;
}
.gcard.is-open .gcard__chev {
  transform: rotate(180deg);
}
.gcard__body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s ease;
}
.gcard.is-open .gcard__body {
  max-height: 320px;
}
.gcard__inner {
  padding: 0 16px 16px;
  border-top: 1px solid var(--stroke);
  margin-top: 0;
  padding-top: 14px;
}
.gcard__desc {
  font-size: 14px;
  color: var(--text-dim);
  line-height: 1.5;
}
.gcard__rules {
  margin-top: 10px;
  font-size: 13px;
  color: var(--text-faint);
  line-height: 1.5;
}
.gcard__rules b {
  color: var(--text-dim);
}

/* --------------------------- Cards tienda -------------------------------- */
.shop {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
.item {
  display: flex;
  flex-direction: column;
  border-radius: var(--radius);
  border: 1px solid var(--stroke);
  background: var(--surface);
  padding: 16px;
  position: relative;
  overflow: hidden;
}
.item--sold {
  opacity: 0.55;
}
/* No te alcanza: atenuado pero visible */
.item--short {
  opacity: 0.75;
}
.item--short .item__buy {
  background: transparent;
  border: 1px solid var(--stroke);
  color: var(--text-faint);
}
.item__emoji {
  font-size: 34px;
  line-height: 1;
}
.item__name {
  font-weight: 700;
  font-size: 15px;
  margin-top: 10px;
}
.item__desc {
  font-size: 12px;
  color: var(--text-faint);
  margin-top: 3px;
  line-height: 1.4;
  flex: 1;
}
.item__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
  gap: 8px;
}
.item__price {
  font-weight: 800;
  font-size: 16px;
  color: var(--gold);
  white-space: nowrap;
}
/* Stock bajo */
.item__stock--low {
  color: var(--red);
  font-weight: 800;
}
/* Cupón de canje */
.feed__item--coupon {
  cursor: pointer;
}
.feed__item--coupon.is-redeemed {
  opacity: 0.55;
}
.coupon {
  text-align: center;
}
.coupon__emoji {
  font-size: 74px;
  line-height: 1.2;
}
.coupon__name {
  font-family: var(--font-display);
  font-size: 24px;
  margin: 6px 0 2px;
}
.coupon__meta {
  font-size: 13px;
  color: var(--text-faint);
  margin-bottom: 14px;
}
.coupon__state {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
  margin-bottom: 14px;
  background: rgba(255, 207, 63, 0.12);
  border: 1px solid rgba(255, 207, 63, 0.35);
  color: var(--gold);
}
.coupon__state--done {
  background: rgba(47, 230, 168, 0.12);
  border-color: rgba(47, 230, 168, 0.35);
  color: var(--green);
}
.item__stock {
  font-size: 11px;
  color: var(--text-faint);
  font-weight: 600;
}
.item__buy {
  width: 100%;
  margin-top: 12px;
  padding: 11px;
  border-radius: 12px;
  font-weight: 800;
  font-size: 14px;
  background: var(--gold-grad);
  color: #2a1600;
  transition: transform 0.12s, opacity 0.2s;
}
.item__buy:active {
  transform: scale(0.96);
}
.item__buy:disabled {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-faint);
  cursor: not-allowed;
}
.item__sold {
  position: absolute;
  top: 12px;
  right: -30px;
  transform: rotate(38deg);
  background: var(--red);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  padding: 3px 34px;
}

/* --------------------------- Apuestas ------------------------------------ */
.bet {
  border-radius: var(--radius-sm);
  border: 1px solid var(--stroke);
  background: var(--surface);
  padding: 14px;
}
.bet__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.bet__vs {
  font-weight: 700;
  font-size: 14px;
}
.bet__vs b {
  color: var(--text);
}
.bet__amount {
  font-weight: 800;
  color: var(--gold);
  white-space: nowrap;
  font-size: 15px;
}
.bet__status {
  display: inline-block;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: 999px;
  margin-top: 8px;
}
.bet__status--pending {
  background: rgba(255, 207, 63, 0.14);
  color: var(--gold);
}
.bet__status--accepted {
  background: rgba(0, 229, 255, 0.14);
  color: var(--cyan);
}
.bet__status--resolved {
  background: rgba(47, 230, 168, 0.14);
  color: var(--green);
}
.bet__status--cancelled {
  background: rgba(255, 84, 112, 0.14);
  color: var(--red);
}
.badge {
  position: absolute;
  top: 2px;
  right: 8px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: linear-gradient(135deg, #ff5470, #c81e46);
  box-shadow: 0 0 6px rgba(255, 84, 112, 0.5);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
  pointer-events: none;
}
.nav__btn,
.subtabs button {
  position: relative;
}
.nav__btn .badge,
.subtabs button .badge {
  font-size: 10px;
  line-height: 16px;
}
.badge--up {
  background: linear-gradient(135deg, #2fe6a8, #0a9e6b);
  box-shadow: 0 0 6px rgba(47, 230, 168, 0.5);
}
.badge--down {
  background: linear-gradient(135deg, #ff5470, #c81e46);
  box-shadow: 0 0 6px rgba(255, 84, 112, 0.5);
}
.subtabs button .badge {
  top: -4px;
  right: -4px;
}
.bet__concept {
  margin-top: 8px;
  font-size: 13px;
  color: var(--text-dim);
  font-style: italic;
}
.bet-ideas {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
  margin-bottom: 4px;
}
/* Chips de monto rápido bajo el input de apuesta */
.bet-quick {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}
.bet-quick .chip {
  cursor: pointer;
  user-select: none;
  font-weight: 800;
}
.bet-ideas .chip {
  cursor: pointer;
  user-select: none;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.bet-ideas .chip--on {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
}
.bet__actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}
.bet__actions .btn {
  flex: 1;
  padding: 10px;
  font-size: 13px;
}
.bet__resolve {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}
.bet__resolve button {
  flex: 1;
  padding: 10px;
  border-radius: 11px;
  font-weight: 700;
  font-size: 13px;
  background: var(--surface-2);
  border: 1px solid var(--stroke-strong);
  color: var(--text);
}
.bet__resolve button:active {
  transform: scale(0.96);
}

/* ========================================================================== */
/* FASE 4 · Logros / Achievements                                             */
/* ========================================================================== */

.ach-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
.ach {
  position: relative;
  border-radius: var(--radius);
  border: 1px solid var(--stroke);
  background: var(--surface);
  padding: 16px 14px;
  text-align: center;
  overflow: hidden;
  transition: transform 0.2s, border-color 0.3s;
}
.ach--locked {
  opacity: 0.72;
}
.ach--unlocked {
  border-color: var(--rar, var(--violet));
  box-shadow: 0 0 26px -12px var(--rar, var(--violet));
}
.ach__badge {
  width: 62px;
  height: 62px;
  margin: 0 auto 10px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 30px;
  background: rgba(255, 255, 255, 0.05);
  border: 2px solid var(--rar, var(--stroke-strong));
}
.ach--locked .ach__badge {
  filter: grayscale(1) brightness(0.6);
  border-color: var(--stroke);
}
.ach__name {
  font-weight: 700;
  font-size: 14px;
}
.ach__cond {
  font-size: 11.5px;
  color: var(--text-dim, var(--text-faint));
  margin-top: 8px;
  line-height: 1.4;
  text-align: left;
}
.ach__cond-label {
  display: block;
  font-size: 8.5px;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--rar, var(--text-faint));
  margin-bottom: 2px;
}
.ach__cond--secret {
  text-align: center;
  color: var(--text-faint);
  font-style: italic;
  margin-top: 8px;
}
.ach__flavor {
  font-size: 11px;
  color: var(--text-faint);
  margin-top: 8px;
  line-height: 1.45;
  font-style: italic;
  text-align: left;
  padding-top: 8px;
  border-top: 1px dashed var(--stroke);
}
.ach--locked .ach__flavor {
  opacity: 0.75;
}
.ach__rar {
  display: inline-block;
  margin-top: 8px;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: 999px;
  color: var(--rar, var(--text-faint));
  background: color-mix(in srgb, var(--rar, #888) 14%, transparent);
}
.ach__done {
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: 14px;
  color: var(--green);
}

/* Filtros de logros */
.ach-filters {
  display: flex;
  flex-direction: column;
  gap: 9px;
  margin-bottom: 16px;
}
.ach-filters__row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.ach-filters .chip {
  cursor: pointer;
  user-select: none;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.ach-filters .chip--on {
  background: var(--brand);
  color: #fff;
  border-color: transparent;
}
/* Punto de color de rareza en los chips del filtro */
.ach-filters .chip__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--rar, var(--text-dim));
  flex: none;
}
.ach-filters [data-rar].chip--on {
  background: var(--rar, var(--brand));
  color: #0c0e1a;
}
.ach-filters [data-rar].chip--on .chip__dot {
  background: #0c0e1a;
}

/* ------------------------- Minijuegos (volado + dado) -------------------- */
.minigames {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.minigames .coinflip {
  min-width: 0;
}
.minigames .coinflip__coin,
.minigames .dice {
  width: 96px;
  height: 96px;
}
.minigames .dice {
  font-size: 92px;
}
.dice {
  width: 128px;
  height: 128px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 118px;
  line-height: 1;
  color: var(--text);
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.15s;
}
.dice--rolling {
  animation: dice-shake 0.22s linear infinite;
}
@keyframes dice-shake {
  0% { transform: rotate(-14deg) scale(1.05); }
  50% { transform: rotate(12deg) scale(0.95); }
  100% { transform: rotate(-14deg) scale(1.05); }
}
/* ------------------------- El Volado (coin flip) ------------------------- */
.coinflip {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  margin-bottom: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.coinflip__head {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.coinflip__title {
  font-weight: 700;
}
.coinflip__hint {
  color: var(--text-dim);
  font-size: 13px;
}
.coinflip__stage {
  display: flex;
  justify-content: center;
  padding: 8px 0;
  perspective: 700px;
}
.coinflip__coin {
  position: relative;
  width: 128px;
  height: 128px;
  cursor: pointer;
  transform-style: preserve-3d;
  transition: transform 2.2s cubic-bezier(0.16, 0.7, 0.22, 1);
  -webkit-tap-highlight-color: transparent;
}
.coinflip__face {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.coinflip__face--front img,
.coinflip__face--back img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.coinflip__face--back {
  transform: rotateY(180deg);
}
.coinflip__result {
  text-align: center;
  color: var(--text-dim);
  font-size: 14px;
  min-height: 20px;
  transition: color 0.2s;
}
.coinflip__result--on {
  color: var(--text);
  font-weight: 700;
  font-size: 16px;
}

/* Boletos y puntos hacia los premios */
.ach-prizes {
  display: flex;
  gap: 18px;
  margin: -6px 0 14px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-faint);
}
/* Progreso hacia un logro contable */
.ach__prog {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}
.ach__prog-bar {
  flex: 1;
  height: 5px;
  border-radius: 999px;
  background: var(--stroke);
  overflow: hidden;
}
.ach__prog-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--rar, var(--gold));
}
.ach__prog-num {
  font-size: 11px;
  font-weight: 800;
  color: var(--text-faint);
  white-space: nowrap;
}
.ach-prizes b {
  color: var(--gold);
}
/* Resumen de progreso */
.ach-progress {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--stroke);
  margin-bottom: 16px;
}
.ach-progress__num {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 26px;
}
.ach-progress__bar {
  flex: 1;
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}
.ach-progress__fill {
  height: 100%;
  background: var(--brand);
  border-radius: 999px;
  transition: width 0.6s ease;
}

/* ---------------- Overlay de desbloqueo (móvil) ------------------------- */
.ach-overlay {
  position: fixed;
  inset: 0;
  z-index: 9700;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(8, 6, 15, 0.82);
  backdrop-filter: blur(10px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}
.ach-overlay--on {
  opacity: 1;
  pointer-events: auto;
}
.ach-pop {
  text-align: center;
  transform: scale(0.7);
  transition: transform 0.5s cubic-bezier(0.2, 1.4, 0.4, 1);
  max-width: 340px;
}
.ach-overlay--on .ach-pop {
  transform: scale(1);
}
.ach-pop__kicker {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gold);
}
.ach-pop__badge {
  width: 130px;
  height: 130px;
  margin: 20px auto;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 66px;
  background: radial-gradient(circle at 50% 40%, rgba(255, 255, 255, 0.12), transparent 70%);
  border: 3px solid var(--rar, var(--gold));
  box-shadow: 0 0 60px -6px var(--rar, var(--gold));
  animation: achSpin 0.8s ease, achFloat 3s ease-in-out infinite 0.8s;
}
.ach-pop__name {
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 700;
}
.ach-pop__rar {
  display: inline-block;
  margin-top: 8px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 4px 12px;
  border-radius: 999px;
  color: var(--rar, var(--gold));
  background: color-mix(in srgb, var(--rar, #ffcf3f) 16%, transparent);
}
.ach-pop__msg {
  margin-top: 14px;
  font-size: 15px;
  color: var(--text-dim);
  font-style: italic;
}
@keyframes achSpin {
  from {
    transform: rotate(-25deg) scale(0.4);
    opacity: 0;
  }
  to {
    transform: rotate(0) scale(1);
    opacity: 1;
  }
}
@keyframes achFloat {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

/* Confeti / partículas ligeras reutilizables */
.spark {
  position: fixed;
  z-index: 9750;
  pointer-events: none;
  font-size: 18px;
  animation: sparkfly 1.2s ease-out forwards;
}
@keyframes sparkfly {
  0% {
    transform: translate(-50%, -50%) scale(0.5);
    opacity: 0;
  }
  15% {
    opacity: 1;
  }
  100% {
    transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(1) rotate(var(--rot));
    opacity: 0;
  }
}

/* ========================================================================== */
/* TWEAKS · Controles expresivos (Paleta · Intensidad · Densidad)             */
/* ========================================================================== */

/* ---------------------------- 1) PALETA ---------------------------------- */
/* Cada paleta redefine el gradiente de marca y los acentos → cambia wallet,
   botones, nav activa, glows, partículas y acentos en toda la app. */
html[data-palette="sunset"] {
  --magenta: #ff5e3a;
  --violet: #ff2e97;
  --cyan: #ffbe3d;
  --brand: linear-gradient(120deg, #ff5e3a 0%, #ff2e97 52%, #ffbe3d 100%);
  --glow-brand: 0 0 40px -6px rgba(255, 94, 58, 0.55);
}
html[data-palette="aurora"] {
  --magenta: #2fe6a8;
  --violet: #00e5ff;
  --cyan: #8b2fff;
  --brand: linear-gradient(120deg, #2fe6a8 0%, #00e5ff 50%, #8b2fff 100%);
  --glow-brand: 0 0 40px -6px rgba(0, 229, 255, 0.55);
}
html[data-palette="gold"] {
  --magenta: #ff9d2f;
  --violet: #ffcf3f;
  --cyan: #ffe27a;
  --brand: linear-gradient(120deg, #ff9d2f 0%, #ffcf3f 52%, #ffe27a 100%);
  --glow-brand: 0 0 40px -6px rgba(255, 207, 63, 0.6);
}
/* La wallet usa un gradiente propio; lo derivamos de los acentos de la paleta
   para que también cambie de vibe (default queda como estaba). */
html[data-palette="sunset"] .wallet,
html[data-palette="aurora"] .wallet,
html[data-palette="gold"] .wallet {
  background: linear-gradient(
    120deg,
    color-mix(in srgb, var(--magenta) 42%, transparent),
    color-mix(in srgb, var(--violet) 32%, transparent) 40%,
    color-mix(in srgb, var(--cyan) 28%, transparent) 70%,
    color-mix(in srgb, var(--magenta) 42%, transparent) 100%
  );
  background-size: 300% 300%;
}
/* Fallback sin color-mix (WebViews viejos de Android): gradientes sólidos. */
@supports not (background: color-mix(in srgb, red, blue)) {
  html[data-palette="sunset"] .wallet {
    background: linear-gradient(120deg, rgba(255, 94, 58, 0.42), rgba(255, 46, 151, 0.3) 45%, rgba(255, 190, 61, 0.28));
    background-size: 300% 300%;
  }
  html[data-palette="aurora"] .wallet {
    background: linear-gradient(120deg, rgba(47, 230, 168, 0.4), rgba(0, 229, 255, 0.3) 45%, rgba(139, 47, 255, 0.32));
    background-size: 300% 300%;
  }
  html[data-palette="gold"] .wallet {
    background: linear-gradient(120deg, rgba(255, 157, 47, 0.42), rgba(255, 207, 63, 0.34) 45%, rgba(255, 226, 122, 0.3));
    background-size: 300% 300%;
  }
}

/* -------------------------- 2) INTENSIDAD -------------------------------- */
/* Chill: todo respira lento y el glow baja. Rave: gradiente veloz + pulso. */
html[data-intensity="chill"] .wallet {
  animation: walletFlow 26s ease infinite;
  box-shadow: var(--shadow), 0 0 20px -10px var(--violet);
}
html[data-intensity="chill"] .wallet::after {
  animation-duration: 14s;
}
html[data-intensity="chill"] body::before {
  opacity: 0.7;
}

html[data-intensity="rave"] .wallet {
  animation: walletFlow 5s ease infinite, ravePulse 1.5s ease-in-out infinite;
}
html[data-intensity="rave"] .wallet::after {
  animation-duration: 3.2s;
}
html[data-intensity="rave"] .nav__btn.is-active,
html[data-intensity="rave"] .brand__mark {
  animation: ravePulse 1.5s ease-in-out infinite;
}
@keyframes ravePulse {
  0%, 100% {
    box-shadow: var(--shadow), 0 0 26px -8px var(--magenta);
    filter: saturate(1);
  }
  50% {
    box-shadow: var(--shadow), 0 0 60px 2px var(--magenta), 0 0 90px 0 var(--violet);
    filter: saturate(1.35) brightness(1.08);
  }
}

/* --------------------------- 3) DENSIDAD --------------------------------- */
html[data-density="compact"] .app {
  padding: 12px 12px 104px;
}
html[data-density="compact"] .wallet {
  padding: 18px 18px 16px;
}
html[data-density="compact"] .wallet__balance {
  font-size: 46px;
}
html[data-density="compact"] .wallet__coin {
  font-size: 32px;
}
html[data-density="compact"] .wallet__coin img {
  width: 36px;
  height: 36px;
}
html[data-density="compact"] .section,
html[data-density="compact"] .page__lead {
  margin-top: 16px;
}
html[data-density="compact"] .feed__item {
  padding: 9px 12px;
}
html[data-density="compact"] .feed__emoji {
  width: 30px;
  height: 30px;
  font-size: 16px;
}
html[data-density="compact"] .stats,
html[data-density="compact"] .shop {
  gap: 8px;
}
html[data-density="compact"] .page__title {
  font-size: 21px;
}

/* --------------------------- Panel de Tweaks ----------------------------- */
.tw-fab {
  position: fixed;
  right: 16px;
  bottom: 90px;
  z-index: 850;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 21px;
  background: rgba(16, 12, 34, 0.86);
  border: 1px solid var(--stroke-strong);
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow);
  transition: transform 0.15s ease;
}
.tw-fab:active {
  transform: scale(0.9) rotate(30deg);
}

.tw-sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9400;
  max-width: 480px;
  margin: 0 auto;
  padding: 22px 20px calc(24px + env(safe-area-inset-bottom, 0px));
  border-radius: 24px 24px 0 0;
  background: linear-gradient(180deg, var(--bg-2), var(--bg-1));
  border: 1px solid var(--stroke-strong);
  border-bottom: none;
  box-shadow: 0 -20px 60px -20px rgba(0, 0, 0, 0.7);
  transform: translateY(110%);
  transition: transform 0.36s cubic-bezier(0.2, 0.9, 0.3, 1);
}
.tw-sheet--on {
  transform: translateY(0);
}
.tw-sheet__grip {
  width: 44px;
  height: 5px;
  border-radius: 999px;
  background: var(--stroke-strong);
  margin: 0 auto 16px;
}
.tw-sheet__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}
.tw-sheet__title {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 700;
}
.tw-sheet__x {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--stroke);
  color: var(--text-dim);
  font-size: 16px;
}
.tw-group {
  margin-bottom: 20px;
}
.tw-group__label {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 10px;
}
/* Swatches de paleta */
.tw-swatches {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
.tw-swatch {
  aspect-ratio: 1;
  border-radius: 14px;
  border: 2px solid transparent;
  position: relative;
  transition: transform 0.12s, border-color 0.2s;
}
.tw-swatch:active {
  transform: scale(0.93);
}
.tw-swatch.is-active {
  border-color: #fff;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.15);
}
.tw-swatch span {
  position: absolute;
  bottom: 6px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
}
/* Segmented control */
.tw-seg {
  display: flex;
  gap: 6px;
  padding: 5px;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--stroke);
}
.tw-seg button {
  flex: 1;
  padding: 11px 6px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 13px;
  color: var(--text-dim);
  transition: background 0.2s, color 0.2s;
}
.tw-seg button.is-active {
  background: var(--brand);
  color: #fff;
}

/* ------------------------------- RSVP ------------------------------------ */
.rsvp {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.rsvp__opt {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  padding: 13px 15px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--stroke);
  color: var(--text);
  transition: border-color 0.2s, background 0.2s, transform 0.12s;
}
.rsvp__opt:active {
  transform: scale(0.98);
}
.rsvp__opt.is-active {
  border-color: var(--violet);
  background: color-mix(in srgb, var(--violet) 12%, transparent);
  box-shadow: 0 0 22px -10px var(--violet);
}
.rsvp__emoji {
  font-size: 22px;
}
.rsvp__label {
  flex: 1;
  font-weight: 700;
  font-size: 14px;
}
.rsvp__label small {
  display: block;
  font-weight: 600;
  font-size: 11px;
  color: var(--text-faint);
}
.rsvp__price {
  font-weight: 800;
  color: var(--gold);
  white-space: nowrap;
}
.rsvp__status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 700;
}
.rsvp__status--reserved {
  background: rgba(255, 207, 63, 0.1);
  border: 1px solid rgba(255, 207, 63, 0.3);
  color: var(--gold);
}
.rsvp__status--paid {
  background: rgba(47, 230, 168, 0.1);
  border: 1px solid rgba(47, 230, 168, 0.3);
  color: var(--green);
}
.rsvp__cancel {
  font-size: 12px;
  color: var(--text-faint);
  text-decoration: underline;
  text-underline-offset: 3px;
}
/* --------------------------- Premios EmmaFest ---------------------------- */
.prizes {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.prize {
  display: flex;
  gap: 14px;
  padding: 15px 16px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--stroke);
}
.prize--gold {
  background: linear-gradient(110deg, rgba(255, 207, 63, 0.14), transparent 70%);
  border-color: rgba(255, 207, 63, 0.35);
}
.prize--violet {
  background: linear-gradient(110deg, rgba(139, 47, 255, 0.16), transparent 70%);
  border-color: rgba(139, 47, 255, 0.35);
}
.prize--cyan {
  background: linear-gradient(110deg, rgba(0, 229, 255, 0.12), transparent 70%);
  border-color: rgba(0, 229, 255, 0.3);
}
.prize__medal {
  font-size: 30px;
  line-height: 1;
  margin-top: 2px;
}
.prize__body {
  flex: 1;
  min-width: 0;
}
.prize__name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15px;
}
.prize__how {
  margin-top: 3px;
  font-size: 12.5px;
  color: var(--text-dim);
  line-height: 1.45;
}
.prize__how b {
  color: var(--text);
}
.prize__lead {
  margin-top: 8px;
  font-size: 12px;
  font-weight: 800;
  color: var(--gold);
}

/* Pase confirmado dentro de la tarjeta wallet */
.wallet__pass {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 18px;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.28);
  backdrop-filter: blur(6px);
  font-size: 13px;
  font-weight: 800;
  color: #fff;
  letter-spacing: 0.02em;
}
.wallet__pass-check {
  color: var(--green);
  font-weight: 900;
}
.wallet__pass-chev {
  opacity: 0.7;
  font-size: 15px;
  margin-left: 2px;
}
button.wallet__pass,
.wallet__pass {
  cursor: pointer;
}
/* Posición + distancia al de arriba, bajo el saldo */
.wallet__rank {
  margin-top: 10px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-faint);
}
.wallet__rank b {
  color: var(--gold);
}
/* Tarjeta "te retaron" en Wallet */
.wallet-challenges {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 13px 15px;
  margin-top: 14px;
  border-radius: var(--radius-sm);
  background: rgba(255, 84, 112, 0.08);
  border: 1px solid rgba(255, 84, 112, 0.3);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
  transition: transform 0.12s;
}
.wallet-challenges:active {
  transform: scale(0.98);
}
.wallet-challenges__icon {
  font-size: 20px;
}
.wallet-challenges__text {
  flex: 1;
}
.wallet-challenges__go {
  font-size: 20px;
  opacity: 0.6;
}
/* Detalles del evento (modal del pase) */
.pass-detail {
  margin-top: 14px;
  padding: 14px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--stroke);
}
.pass-detail__title {
  font-weight: 800;
  font-size: 14px;
}
.pass-detail__venue {
  margin-top: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dim);
  line-height: 1.45;
}
.pass-detail__addr {
  margin-top: 3px;
  font-size: 12px;
  color: var(--text-faint);
}
/* Horario del evento en el modal del pase */
.pass-detail__sched {
  margin-top: 10px;
  padding: 9px 12px;
  border-radius: 11px;
  background: rgba(255, 207, 63, 0.09);
  border: 1px solid rgba(255, 207, 63, 0.28);
  color: var(--gold);
  font-size: 13px;
  font-weight: 800;
}
.pass-detail__sched small {
  display: block;
  margin-top: 3px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim);
}
.pass-detail__sub {
  margin-top: 12px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.pass-detail__lineup {
  margin: 8px 0 0;
  padding-left: 22px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 13px;
  font-weight: 600;
}
.pass-detail__lineup li::marker {
  color: var(--violet);
  font-weight: 800;
}
.pass-detail__tips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.pass-detail__tips span {
  padding: 5px 11px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--stroke);
  font-size: 12px;
  font-weight: 700;
  color: var(--text-dim);
}
/* El modal del pase puede ser largo (Full Experience): scroll interno */
.modal {
  max-height: min(84dvh, 640px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
/* Tabs bloqueadas hasta confirmar el pase */
.nav__btn.is-locked {
  opacity: 0.38;
  filter: grayscale(0.8);
}
.nav__btn.is-locked::after {
  content: "🔒";
  position: absolute;
  top: 2px;
  right: 8px;
  font-size: 10px;
}
.nav__btn {
  position: relative;
}
