/* ============================================================================
   Rain Hope Games — Play tracking UI
   Popup "¿Quién juega hoy?" (estilo Netflix) + chip del perfil activo.

   Todo va prefijado con .rhgp- para no chocar con el CSS de ningún juego.
   ============================================================================ */

.rhgp-overlay {
  position: fixed;
  inset: 0;
  z-index: 999999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background: radial-gradient(120% 120% at 50% 0%, #22305a 0%, #101828 55%, #070c16 100%);
  font-family: "Fredoka", "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  overflow-y: auto;
  opacity: 0;
  transition: opacity .28s ease;
}
.rhgp-overlay.rhgp-in { opacity: 1; }
.rhgp-overlay[hidden] { display: none !important; }

.rhgp-panel {
  width: 100%;
  max-width: 900px;
  text-align: center;
  margin: auto;
}

.rhgp-kicker {
  display: inline-block;
  font-size: clamp(11px, 2.4vw, 13px);
  font-weight: 600;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: #F9A96A;
  margin-bottom: 10px;
}

.rhgp-title {
  margin: 0 0 8px;
  font-size: clamp(26px, 6vw, 46px);
  font-weight: 700;
  line-height: 1.1;
  color: #fff;
}
.rhgp-title span { color: #F47B25; }

.rhgp-sub {
  margin: 0 auto 30px;
  max-width: 46ch;
  font-size: clamp(13px, 2.8vw, 16px);
  line-height: 1.5;
  color: rgba(255, 255, 255, .62);
}

/* ── Rejilla de perfiles ─────────────────────────────────────────────── */
.rhgp-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(118px, 138px));
  gap: clamp(14px, 3vw, 26px);
  justify-content: center;
  margin-bottom: 28px;
}

.rhgp-card {
  appearance: none;
  border: 0;
  background: none;
  padding: 0;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  font: inherit;
  color: rgba(255, 255, 255, .66);
  transition: color .18s ease, transform .18s ease;
}
.rhgp-card:hover,
.rhgp-card:focus-visible { color: #fff; transform: translateY(-4px); outline: none; }

.rhgp-ava {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  border-radius: 20px;
  overflow: hidden;
  background: #1B2240;
  border: 3px solid transparent;
  box-shadow: 0 12px 28px rgba(0, 0, 0, .38);
  display: grid;
  place-items: center;
  font-size: 40px;
  font-weight: 700;
  color: #fff;
  transition: border-color .18s ease, box-shadow .18s ease;
}
.rhgp-card:hover .rhgp-ava,
.rhgp-card:focus-visible .rhgp-ava {
  border-color: #F47B25;
  box-shadow: 0 16px 34px rgba(244, 123, 37, .35);
}
.rhgp-ava > * { grid-area: 1 / 1; }
.rhgp-ava img { width: 100%; height: 100%; object-fit: cover; display: block; }

.rhgp-name {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.25;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rhgp-age { font-size: 12px; color: rgba(255, 255, 255, .42); margin-top: -6px; }

/* Tarjeta "agregar niño" */
.rhgp-card--add .rhgp-ava {
  background: rgba(255, 255, 255, .06);
  border: 2px dashed rgba(255, 255, 255, .26);
  font-size: 34px;
  color: rgba(255, 255, 255, .55);
}
.rhgp-card--add:hover .rhgp-ava { border-color: #2BB5A3; color: #2BB5A3; }

/* ── Pie del popup ───────────────────────────────────────────────────── */
.rhgp-skip {
  appearance: none;
  border: 1.5px solid rgba(255, 255, 255, .2);
  background: none;
  border-radius: 999px;
  padding: 10px 22px;
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  color: rgba(255, 255, 255, .6);
  cursor: pointer;
  transition: border-color .18s ease, color .18s ease;
}
.rhgp-skip:hover { border-color: rgba(255, 255, 255, .48); color: #fff; }

.rhgp-note { margin-top: 18px; font-size: 12.5px; color: rgba(255, 255, 255, .36); }

/* ── Chip del perfil activo (esquina del juego) ──────────────────────── */
.rhgp-chip {
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 99998;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 5px 13px 5px 5px;
  border: 0;
  border-radius: 999px;
  background: rgba(15, 22, 40, .82);
  backdrop-filter: blur(9px);
  -webkit-backdrop-filter: blur(9px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .28);
  font-family: "Fredoka", "Inter", system-ui, sans-serif;
  font-size: 13.5px;
  font-weight: 600;
  color: #fff;
  cursor: pointer;
  transition: background .18s ease, transform .18s ease;
}
.rhgp-chip:hover { background: rgba(24, 34, 60, .95); transform: translateY(-1px); }
.rhgp-chip[hidden] { display: none !important; }

.rhgp-chip__ava {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  overflow: hidden;
  background: #F47B25;
  display: grid;
  place-items: center;
  font-size: 14px;
  flex: none;
}
.rhgp-chip__ava > * { grid-area: 1 / 1; }
.rhgp-chip__ava img { width: 100%; height: 100%; object-fit: cover; display: block; }
.rhgp-chip__swap { font-size: 11.5px; font-weight: 500; color: rgba(255, 255, 255, .5); }

@media (max-width: 520px) {
  .rhgp-chip { top: auto; bottom: 10px; right: 10px; padding: 4px 11px 4px 4px; font-size: 12.5px; }
  .rhgp-chip__ava { width: 26px; height: 26px; }
  .rhgp-grid { grid-template-columns: repeat(auto-fit, minmax(96px, 110px)); }
}

@media (prefers-reduced-motion: reduce) {
  .rhgp-overlay, .rhgp-card, .rhgp-ava, .rhgp-chip { transition: none; }
}

/* ============================================================================
   Gamificación — marcador en el chip y medalla al ganarla
   ============================================================================ */

/* Racha y monedas junto al nombre del niño */
.rhgp-chip__stat {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .12);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.5;
  white-space: nowrap;
}

/* Medalla recién ganada */
.rhgp-award {
  position: fixed;
  left: 50%;
  bottom: 26px;
  z-index: 999998;
  display: flex;
  align-items: center;
  gap: 13px;
  max-width: min(420px, calc(100vw - 32px));
  padding: 13px 18px;
  border-radius: 18px;
  background: linear-gradient(135deg, #1B2240 0%, #2B2160 100%);
  border: 1.5px solid rgba(244, 123, 37, .55);
  box-shadow: 0 18px 44px rgba(0, 0, 0, .45);
  font-family: "Fredoka", "Inter", system-ui, sans-serif;
  color: #fff;
  transform: translate(-50%, 130%);
  opacity: 0;
  transition: transform .42s cubic-bezier(.34, 1.56, .64, 1), opacity .3s ease;
}
.rhgp-award.rhgp-in { transform: translate(-50%, 0); opacity: 1; }

.rhgp-award__icon {
  font-size: 30px;
  line-height: 1;
  flex: none;
  animation: rhgp-pop .55s cubic-bezier(.34, 1.56, .64, 1);
}
@keyframes rhgp-pop {
  0%   { transform: scale(0) rotate(-25deg); }
  100% { transform: scale(1) rotate(0); }
}

.rhgp-award__body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.rhgp-award__body b { font-size: 15px; font-weight: 600; }
.rhgp-award__body span {
  font-size: 12.5px;
  color: rgba(255, 255, 255, .62);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rhgp-award__coins {
  margin-left: auto;
  flex: none;
  padding: 5px 11px;
  border-radius: 999px;
  background: rgba(244, 123, 37, .2);
  color: #FFC48A;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

@media (max-width: 520px) {
  .rhgp-award { bottom: 68px; padding: 11px 14px; gap: 10px; }
  .rhgp-award__icon { font-size: 25px; }
  .rhgp-chip__stat { font-size: 11px; padding: 2px 5px; }
}

@media (prefers-reduced-motion: reduce) {
  .rhgp-award { transition: opacity .3s ease; transform: translate(-50%, 0); }
  .rhgp-award__icon { animation: none; }
}
