/* FURIA HIPICA — apuestas hípicas */

:root {
  --ps-bg: #070708;
  --ps-card: #111114;
  --ps-border: #2a2418;
  --ps-text: #f3efe6;
  --ps-muted: #9a9388;
  --ps-accent: #d4af37;
  --ps-accent-dim: #b8860b;
  --ps-gold: #f0c94a;
  --ps-silver: #cfd4dc;
  --ps-green: #1a8a4c;
  --ps-red: #c41e3a;
  --ps-error: #e85d5d;
  --ps-font: system-ui, "Segoe UI", Roboto, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--ps-font);
  background: var(--ps-bg);
  color: var(--ps-text);
}

html,
body {
  height: 100%;
}

/* Login */
.ps-login-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background:
    radial-gradient(ellipse at 16% 0%, rgba(26, 138, 76, 0.22) 0%, transparent 48%),
    radial-gradient(ellipse at 84% 0%, rgba(196, 30, 58, 0.22) 0%, transparent 48%),
    radial-gradient(ellipse at top, #1a1510 0%, var(--ps-bg) 55%);
}

.ps-login-card {
  width: 100%;
  max-width: 400px;
  padding: 2rem;
  border: 1px solid var(--ps-border);
  border-radius: 12px;
  background: var(--ps-card);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}

.ps-login-brand {
  text-align: center;
  margin-bottom: 1.75rem;
}

.ps-logo {
  width: 72px;
  height: 72px;
  margin: 0 auto 1rem;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--ps-accent), var(--ps-accent-dim));
  color: #111;
  font-weight: 800;
  font-size: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  letter-spacing: -0.05em;
}

.ps-login-brand-logo {
  display: block;
  width: min(220px, 70vw);
  height: auto;
  margin: 0 auto 1rem;
  filter: drop-shadow(-10px 0 14px rgba(26, 138, 76, 0.4)) drop-shadow(10px 0 14px rgba(196, 30, 58, 0.4));
}

.ps-login-brand h1 {
  margin: 0;
  font-size: 1.5rem;
  letter-spacing: 0.12em;
  font-weight: 700;
}

.ps-tagline {
  margin: 0.35rem 0 0;
  color: var(--ps-muted);
  font-size: 0.95rem;
}

.ps-error {
  color: var(--ps-error);
  font-size: 0.9rem;
  margin: 0 0 1rem;
}

.ps-login-form label {
  display: block;
  margin-bottom: 1rem;
}

.ps-login-form span {
  display: block;
  font-size: 0.8rem;
  color: var(--ps-muted);
  margin-bottom: 0.35rem;
}

.ps-login-form input {
  width: 100%;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--ps-border);
  border-radius: 8px;
  background: #0a0a0c;
  color: var(--ps-text);
  font-size: 1rem;
}

.ps-btn-primary {
  width: 100%;
  margin-top: 0.5rem;
  padding: 0.75rem 1rem;
  border: none;
  border-radius: 8px;
  background: linear-gradient(180deg, var(--ps-accent), var(--ps-accent-dim));
  color: #111;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
}

.ps-btn-primary:hover {
  filter: brightness(1.05);
}

.ps-login-note {
  margin: 1.25rem 0 0;
  font-size: 0.8rem;
  color: var(--ps-muted);
  text-align: center;
}

/* App */
.ps-app-body {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.ps-hidden-iframe {
  position: absolute;
  width: 0;
  height: 0;
  border: 0;
  opacity: 0;
  pointer-events: none;
}

.ps-app-header {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.45rem 0.85rem;
  padding-left: max(0.7rem, env(safe-area-inset-left, 0px));
  padding-right: max(0.7rem, env(safe-area-inset-right, 0px));
  border-bottom: 1px solid #3a3118;
  background: #050505;
  box-shadow:
    0 1px 0 rgba(26, 138, 76, 0.35),
    0 2px 0 rgba(196, 30, 58, 0.22);
  flex-shrink: 0;
  width: 100%;
  overflow: visible;
}

.ps-app-nav,
.ps-app-header nav {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-end;
  gap: 0.65rem;
  flex: 0 0 auto;
}

.ps-app-brand {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.5rem;
  font-weight: 800;
  min-width: 0;
  flex: 1 1 auto;
  overflow: visible;
}

.ps-app-brand-logo {
  height: 42px;
  width: auto;
  max-width: 72px;
  object-fit: contain;
  display: block;
  flex: 0 0 auto;
  filter: drop-shadow(-4px 0 6px rgba(26, 138, 76, 0.35)) drop-shadow(4px 0 6px rgba(196, 30, 58, 0.35));
}

/* Una sola línea: no flex-column. Los hijos son inline para que no puedan apilarse. */
.ps-app-brand-text {
  display: block !important;
  flex: 1 1 auto;
  min-width: 0;
  max-width: none;
  white-space: nowrap !important;
  overflow: visible;
  font-style: italic;
  line-height: 1.1;
  font-size: clamp(1rem, 3.2vw, 1.35rem);
}

.ps-app-brand-furia,
.ps-app-brand-hipica,
.ps-app-brand-horse {
  display: inline !important;
  white-space: nowrap !important;
}

.ps-app-brand-furia {
  color: var(--ps-gold);
  letter-spacing: 0.12em;
  margin-right: 0.4em;
  text-shadow:
    0 1px 0 #6b4e0a,
    0 0 10px rgba(212, 175, 55, 0.55);
}

.ps-app-brand-hipica {
  color: var(--ps-silver);
  letter-spacing: 0.1em;
  margin-right: 0.28em;
  text-shadow:
    0 1px 0 #3a3e44,
    0 0 8px rgba(207, 212, 220, 0.35);
}

.ps-app-brand-horse {
  font-style: normal;
  font-size: 1.12em;
}

.ps-app-brand-admin {
  display: inline !important;
  color: var(--ps-muted);
  font-style: normal;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  font-weight: 700;
  margin-left: 0.35em;
}

.ps-logout {
  color: var(--ps-muted);
  text-decoration: none;
  font-size: 0.9rem;
  white-space: nowrap;
}

.ps-logout:hover {
  color: var(--ps-accent);
}

.ps-support-whatsapp {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.42rem 0.8rem;
  border-radius: 999px;
  border: 1px solid #1fae52;
  background: #25d366;
  color: #ffffff;
  text-decoration: none;
  font-size: 0.86rem;
  font-weight: 700;
  line-height: 1;
  flex-shrink: 0;
  white-space: nowrap;
}

@media (max-width: 768px) {
  .ps-app-header {
    padding-top: 0.4rem;
    padding-bottom: 0.4rem;
  }

  .ps-app-brand {
    gap: 0.4rem;
  }

  .ps-app-brand-logo {
    height: 36px;
    max-width: 56px;
  }

  .ps-app-brand-text {
    font-size: clamp(0.95rem, 5.2vw, 1.2rem);
  }

  .ps-app-brand-admin {
    display: none !important;
  }

  .ps-support-whatsapp {
    padding: 0.36rem 0.62rem;
    font-size: 0.78rem;
    gap: 0.28rem;
  }

  .ps-app-header nav {
    gap: 0.45rem;
  }

  .ps-logout {
    font-size: 0.78rem;
  }
}

@media (max-width: 520px) {
  .ps-app-brand-logo {
    height: 34px;
    max-width: 50px;
  }

  .ps-app-brand-text {
    font-size: clamp(0.9rem, 4.8vw, 1.1rem);
  }

  .ps-support-whatsapp {
    padding: 0.34rem 0.55rem;
  }

  .ps-app-header:not(:has(.ps-support-whatsapp)) {
    flex-wrap: wrap;
  }

  .ps-app-header:not(:has(.ps-support-whatsapp)) nav {
    width: 100%;
    justify-content: flex-end;
  }
}

@media (max-width: 360px) {
  .ps-support-whatsapp-label {
    display: none;
  }

  .ps-support-whatsapp {
    padding: 0.4rem;
    border-radius: 50%;
  }

  .ps-app-brand-logo {
    height: 32px;
    max-width: 44px;
  }

  .ps-app-brand-text {
    font-size: 0.88rem;
  }
}

.ps-whatsapp-icon {
  width: 16px;
  height: 16px;
  display: block;
  fill: #ffffff;
  flex-shrink: 0;
}

.ps-support-whatsapp:hover {
  filter: brightness(1.06);
}

/* CTA invitados: mismo enlace que Soporte (WhatsApp), visible solo sin login en el embed */
.ps-guest-whatsapp-cta {
  position: fixed;
  left: 50%;
  bottom: max(1rem, env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  z-index: 48;
  display: inline-flex;
  align-items: center;
  gap: 0.85rem;
  max-width: calc(100vw - 1.25rem);
  padding: 0.85rem 1.45rem;
  border-radius: 999px;
  text-decoration: none;
  color: #1f1408;
  font-weight: 800;
  font-size: 0.95rem;
  line-height: 1.28;
  text-align: left;
  letter-spacing: 0.03em;
  border: 2px solid rgba(92, 58, 12, 0.55);
  background: linear-gradient(145deg, #f0d78c 0%, #e6b84a 38%, #c9972d 72%, #a67c1a 100%);
  box-shadow:
    0 6px 22px rgba(0, 0, 0, 0.38),
    0 0 28px rgba(255, 200, 90, 0.45),
    0 0 48px rgba(201, 151, 45, 0.35),
    inset 0 1px 0 rgba(255, 248, 220, 0.65);
  isolation: isolate;
  animation: ps-guest-cta-float 2.6s ease-in-out infinite;
}

/* Aureola difusa detrás del botón */
.ps-guest-whatsapp-cta::before {
  content: "";
  position: absolute;
  z-index: -2;
  left: 50%;
  top: 50%;
  width: 118%;
  height: 200%;
  transform: translate(-50%, -50%);
  border-radius: 999px;
  background: radial-gradient(
    ellipse 85% 75% at 50% 50%,
    rgba(255, 228, 150, 0.7) 0%,
    rgba(230, 184, 74, 0.35) 42%,
    rgba(201, 151, 45, 0.12) 65%,
    transparent 78%
  );
  filter: blur(14px);
  pointer-events: none;
  animation: ps-guest-cta-aura 2.6s ease-in-out infinite;
}

/* Anillo luminoso nítido */
.ps-guest-whatsapp-cta::after {
  content: "";
  position: absolute;
  z-index: -1;
  inset: -5px;
  border-radius: 999px;
  border: 2px solid rgba(255, 220, 130, 0.55);
  box-shadow:
    0 0 12px rgba(255, 210, 100, 0.65),
    0 0 28px rgba(201, 151, 45, 0.5),
    inset 0 0 16px rgba(255, 248, 200, 0.25);
  pointer-events: none;
  animation: ps-guest-cta-ring 2.6s ease-in-out infinite;
}

.ps-guest-whatsapp-cta:hover {
  filter: brightness(1.08) saturate(1.05);
}

.ps-guest-whatsapp-cta[hidden] {
  display: none !important;
}

.ps-guest-whatsapp-cta[hidden]::before,
.ps-guest-whatsapp-cta[hidden]::after {
  display: none;
}

.ps-guest-whatsapp-cta-icon {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  fill: #2a1810;
  filter: drop-shadow(0 1px 0 rgba(255, 255, 255, 0.35));
  animation: ps-guest-cta-icon-nudge 2.6s ease-in-out infinite;
}

.ps-guest-whatsapp-cta-text {
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
  min-width: 0;
}

.ps-guest-whatsapp-cta-line {
  display: block;
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  opacity: 0.92;
}

.ps-guest-whatsapp-cta-line--strong {
  font-size: 0.98rem;
  font-weight: 900;
  text-transform: none;
  opacity: 1;
}

@keyframes ps-guest-cta-float {
  0%,
  100% {
    transform: translateX(-50%) translateY(0) scale(1);
    box-shadow:
      0 6px 22px rgba(0, 0, 0, 0.38),
      0 0 28px rgba(255, 200, 90, 0.45),
      0 0 48px rgba(201, 151, 45, 0.35),
      inset 0 1px 0 rgba(255, 248, 220, 0.65);
  }
  40% {
    transform: translateX(-50%) translateY(-6px) scale(1.035);
    box-shadow:
      0 10px 28px rgba(0, 0, 0, 0.4),
      0 0 36px rgba(255, 210, 110, 0.6),
      0 0 64px rgba(201, 151, 45, 0.45),
      inset 0 1px 0 rgba(255, 248, 220, 0.72);
  }
  55% {
    transform: translateX(-50%) translateY(-2px) scale(1.02);
  }
}

@keyframes ps-guest-cta-aura {
  0%,
  100% {
    opacity: 0.75;
    transform: translate(-50%, -50%) scale(0.96);
  }
  50% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.12);
  }
}

@keyframes ps-guest-cta-ring {
  0%,
  100% {
    opacity: 0.65;
    transform: scale(1);
  }
  50% {
    opacity: 1;
    transform: scale(1.04);
  }
}

@keyframes ps-guest-cta-icon-nudge {
  0%,
  100% {
    transform: rotate(0deg) scale(1);
  }
  25% {
    transform: rotate(-8deg) scale(1.05);
  }
  75% {
    transform: rotate(8deg) scale(1.05);
  }
}

/* CTA invitados: más compacto en móvil / vista responsiva (escritorio sin cambios) */
@media (max-width: 768px) {
  .ps-guest-whatsapp-cta {
    gap: 0.55rem;
    max-width: calc(100vw - 1rem);
    padding: 0.58rem 0.95rem;
    font-size: 0.8rem;
    letter-spacing: 0.02em;
    animation: ps-guest-cta-float-sm 2.6s ease-in-out infinite;
  }

  .ps-guest-whatsapp-cta::before {
    width: 112%;
    height: 185%;
    filter: blur(11px);
  }

  .ps-guest-whatsapp-cta::after {
    inset: -3px;
    border-width: 1.5px;
    box-shadow:
      0 0 8px rgba(255, 210, 100, 0.55),
      0 0 20px rgba(201, 151, 45, 0.42),
      inset 0 0 12px rgba(255, 248, 200, 0.22);
  }

  .ps-guest-whatsapp-cta-icon {
    width: 26px;
    height: 26px;
    animation: ps-guest-cta-icon-nudge-sm 2.6s ease-in-out infinite;
  }

  .ps-guest-whatsapp-cta-text {
    gap: 0.06rem;
  }

  .ps-guest-whatsapp-cta-line {
    font-size: 0.68rem;
  }

  .ps-guest-whatsapp-cta-line--strong {
    font-size: 0.8rem;
  }

  @keyframes ps-guest-cta-float-sm {
    0%,
    100% {
      transform: translateX(-50%) translateY(0) scale(1);
      box-shadow:
        0 5px 16px rgba(0, 0, 0, 0.36),
        0 0 20px rgba(255, 200, 90, 0.4),
        0 0 36px rgba(201, 151, 45, 0.3),
        inset 0 1px 0 rgba(255, 248, 220, 0.65);
    }
    40% {
      transform: translateX(-50%) translateY(-4px) scale(1.022);
      box-shadow:
        0 7px 20px rgba(0, 0, 0, 0.38),
        0 0 28px rgba(255, 210, 110, 0.52),
        0 0 48px rgba(201, 151, 45, 0.38),
        inset 0 1px 0 rgba(255, 248, 220, 0.7);
    }
    55% {
      transform: translateX(-50%) translateY(-1px) scale(1.012);
    }
  }

  @keyframes ps-guest-cta-icon-nudge-sm {
    0%,
    100% {
      transform: rotate(0deg) scale(1);
    }
    25% {
      transform: rotate(-6deg) scale(1.03);
    }
    75% {
      transform: rotate(6deg) scale(1.03);
    }
  }
}

.ps-app-body.ps-overlay-open .ps-guest-whatsapp-cta {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.ps-embed-wrap {
  flex: 1 1 auto;
  /* Evita colapso a 0 px en flex (iframe height:100% sin altura del padre = negro). */
  min-height: min(72vh, calc(100dvh - 3.5rem));
  position: relative;
  display: flex;
}

.ps-main-iframe {
  display: block;
  width: 100%;
  height: 100%;
  min-height: min(65vh, 520px);
  border: 0;
  /* Si el documento aún no pinta, algo visible distinto al negro puro ayuda a diagnosticar */
  background: #050505;
  isolation: isolate;
}

/* Overlay de carga sobre el embed (solo visual). Sin pointer-events:none el overlay capta los clics
   y el iframe no recibe el submit → Red vacía y login imposible. */
.ps-embed-loading {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  text-align: center;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 18% 42%, rgba(26, 138, 76, 0.28) 0%, transparent 52%),
    radial-gradient(ellipse at 82% 42%, rgba(196, 30, 58, 0.28) 0%, transparent 52%),
    radial-gradient(ellipse at 50% 20%, #1a1510 0%, rgba(5, 5, 5, 0.98) 55%, #050505 100%);
  pointer-events: none;
}

body.ps-has-login-bg .ps-embed-wrap,
body.ps-has-login-bg .ps-main-iframe {
  background-color: #050505;
  background-image:
    linear-gradient(rgba(5, 5, 5, 0.42), rgba(5, 5, 5, 0.55)),
    var(--ps-login-bg);
  background-size: cover;
  background-position: center;
}

body.ps-has-login-bg .ps-embed-loading,
body.ps-has-login-bg .ps-video-load-overlay {
  background:
    linear-gradient(rgba(5, 5, 5, 0.48), rgba(8, 6, 6, 0.62)),
    var(--ps-login-bg);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

body.ps-has-login-bg .ps-embed-loading::before,
body.ps-has-login-bg .ps-video-load-overlay::before {
  content: "";
  position: absolute;
  inset: -6%;
  z-index: 0;
  background-image: var(--ps-login-bg);
  background-size: cover;
  background-position: center;
  opacity: 0.85;
  transform: scale(1.04);
  animation: ps-login-bg-drift 22s ease-in-out infinite alternate;
  pointer-events: none;
}

body.ps-has-login-bg .ps-embed-loading::after,
body.ps-has-login-bg .ps-video-load-overlay::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    radial-gradient(ellipse at 18% 42%, rgba(26, 138, 76, 0.18) 0%, transparent 52%),
    radial-gradient(ellipse at 82% 42%, rgba(196, 30, 58, 0.18) 0%, transparent 52%),
    linear-gradient(rgba(5, 5, 5, 0.38), rgba(5, 5, 5, 0.55));
  pointer-events: none;
}

@keyframes ps-login-bg-drift {
  from {
    transform: scale(1.04) translate3d(0, 0, 0);
  }
  to {
    transform: scale(1.12) translate3d(-1.5%, 1%, 0);
  }
}

@media (prefers-reduced-motion: reduce) {
  body.ps-has-login-bg .ps-embed-loading::before,
  body.ps-has-login-bg .ps-video-load-overlay::before {
    animation: none;
  }
}

.ps-embed-loading[hidden] {
  display: none !important;
}

.ps-embed-loading-inner {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  max-width: min(86vw, 320px);
}

.ps-embed-loading-logo,
.ps-video-load-logo {
  width: min(72vw, 260px);
  max-width: 100%;
  height: auto;
  display: block;
  object-fit: contain;
  animation: ps-logo-pulse 1.8s ease-in-out infinite;
}

@keyframes ps-logo-pulse {
  0%,
  100% {
    filter: drop-shadow(-12px 0 16px rgba(26, 138, 76, 0.45)) drop-shadow(12px 0 16px rgba(196, 30, 58, 0.45));
    transform: scale(1);
  }
  50% {
    filter: drop-shadow(-16px 0 22px rgba(26, 138, 76, 0.7)) drop-shadow(16px 0 22px rgba(196, 30, 58, 0.7));
    transform: scale(1.03);
  }
}

.ps-embed-spinner {
  width: 48px;
  height: 48px;
  border: 3px solid var(--ps-border);
  border-top-color: var(--ps-accent);
  border-radius: 50%;
  animation: ps-embed-spin 0.85s linear infinite;
}

@keyframes ps-embed-spin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .ps-embed-spinner,
  .ps-embed-loading-logo,
  .ps-video-load-logo {
    animation: none;
    border-top-color: var(--ps-accent);
    opacity: 0.9;
  }
}

.ps-embed-loading-msg {
  margin: 0;
  font-size: 0.95rem;
  color: var(--ps-silver);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* Aviso visible fuera del embed (Plan B): no depende del pintado del iframe. */
.ps-embed-flash-error {
  position: fixed;
  left: 50%;
  top: 4.1rem;
  transform: translateX(-50%);
  z-index: 140;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 0.6rem 0.9rem;
  width: min(94vw, 680px);
  text-align: center;
  background: rgba(93, 15, 15, 0.97);
  border: 1px solid #d95c5c;
  border-radius: 10px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
}

.ps-embed-flash-error[hidden] {
  display: none !important;
}

@media (max-width: 768px) {
  .ps-embed-flash-error {
    top: 3.35rem;
    width: calc(100vw - 1rem);
    padding: 0.5rem 0.7rem;
  }
}

.ps-embed-flash-error-inner {
  max-width: 100%;
}

.ps-embed-flash-error-title {
  margin: 0;
  font-size: clamp(1rem, 2.8vw, 1.2rem);
  font-weight: 800;
  line-height: 1.2;
  color: #f0f6fc;
  letter-spacing: 0.02em;
}

.ps-embed-flash-error-sub {
  margin: 0.45rem 0 0;
  font-size: 0.9rem;
  color: #f7d9d9;
  line-height: 1.4;
}

/*
 * Móvil: la altura útil del embed la fija app.js (layoutEmbedHeight) — Android Chrome suele ignorar solo CSS.
 * El iframe en absolute rellena el rectángulo que marca JS.
 *
 * Zoom visual ~10% “hacia afuera” (equivalente a alejar un poco con el dedo): scale + tamaño compensado.
 * Para desactivar: .ps-embed-wrap { --ps-embed-mzoom: 1; } en este mismo media (o quitar la regla del iframe).
 */
@media (max-width: 768px) {
  html,
  body.ps-app-body {
    overflow-x: hidden;
    max-width: 100%;
  }

  .ps-embed-wrap {
    --ps-embed-mzoom: 0.9;
    flex: 1 1 auto;
    position: relative;
    width: 100%;
    min-height: 50vh;
    overflow: hidden;
  }

  /* Ajuste fino: Android casi al 100%; iOS suele necesitar un poco más de “alejar”. */
  body.ps-client-android.ps-app-body .ps-embed-wrap {
    --ps-embed-mzoom: 0.88;
  }

  body.ps-client-ios.ps-app-body .ps-embed-wrap {
    --ps-embed-mzoom: 0.82;
  }

  .ps-main-iframe {
    position: absolute;
    top: 0;
    left: 50%;
    right: auto;
    bottom: auto;
    width: calc(100% / var(--ps-embed-mzoom));
    height: calc(100% / var(--ps-embed-mzoom));
    min-height: calc(100% / var(--ps-embed-mzoom));
    margin-left: calc(-50% / var(--ps-embed-mzoom));
    transform: translateZ(0) scale(var(--ps-embed-mzoom));
    transform-origin: top center;
    -webkit-transform: translateZ(0) scale(var(--ps-embed-mzoom));
  }

  .ps-embed-loading-inner,
  .ps-video-load-inner {
    max-width: min(88vw, 240px);
    gap: 0.55rem;
  }

  .ps-embed-loading-logo,
  .ps-video-load-logo {
    width: min(52vw, 180px);
    max-height: 28vh;
    object-fit: contain;
  }

  .ps-embed-spinner,
  .ps-video-load-spinner {
    width: 36px;
    height: 36px;
  }

  .ps-login-card {
    padding: 1.25rem 1rem;
  }

  .ps-login-brand-logo {
    width: min(160px, 58vw);
  }
}

@media (max-width: 768px) and (max-height: 480px) {
  .ps-embed-loading-logo,
  .ps-video-load-logo {
    width: min(22vh, 130px);
    max-height: 38vh;
  }

  .ps-embed-spinner,
  .ps-video-load-spinner {
    width: 28px;
    height: 28px;
  }

  .ps-embed-loading-msg,
  .ps-video-load-msg {
    font-size: 0.8rem;
  }
}

/* El iframe del embed suele capturar clics por encima del modal; sin esto, «Ver» no responde. */
.ps-app-body.ps-overlay-open #ps-main-embed {
  pointer-events: none;
}

/* FAB */
.ps-fab {
  position: fixed;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  z-index: 50;
  width: 36px;
  height: 72px;
  border: 1px solid var(--ps-border);
  border-left: none;
  border-radius: 0 10px 10px 0;
  background: var(--ps-card);
  color: var(--ps-accent);
  cursor: pointer;
  padding: 0;
  box-shadow: 2px 0 12px rgba(0, 0, 0, 0.35);
}

.ps-fab-pulse {
  animation: ps-pulse 1.4s ease-in-out infinite;
}

@keyframes ps-pulse {
  0%,
  100% {
    box-shadow: 2px 0 12px rgba(201, 162, 39, 0.35);
  }
  50% {
    box-shadow: 2px 0 20px rgba(201, 162, 39, 0.85);
  }
}

.ps-fab-icon {
  display: block;
  font-size: 1.75rem;
  line-height: 1;
  transform: rotate(0deg);
  transition: transform 0.2s ease;
}

.ps-fab[aria-expanded="true"] .ps-fab-icon {
  transform: rotate(180deg);
}

.ps-fab-panel {
  position: fixed;
  left: 44px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 51;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.ps-fab-panel[hidden] {
  display: none !important;
}

.ps-fab-action {
  padding: 0.6rem 1rem;
  border: 1px solid var(--ps-border);
  border-radius: 8px;
  background: var(--ps-card);
  color: var(--ps-text);
  font-size: 0.9rem;
  cursor: pointer;
  white-space: nowrap;
  text-align: left;
}

.ps-fab-action:hover {
  border-color: var(--ps-accent);
  color: var(--ps-accent);
}

/* Overlays */
.ps-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0, 0, 0, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.ps-overlay[hidden] {
  display: none !important;
}

.ps-overlay-mag-pdf {
  z-index: 120;
}

.ps-modal {
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow: auto;
  background: var(--ps-card);
  border: 1px solid var(--ps-border);
  border-radius: 12px;
  padding: 0;
}

.ps-modal-video {
  max-width: min(960px, 100%);
  display: flex;
  flex-direction: column;
  max-height: 92vh;
  max-height: 92dvh;
  overflow: hidden;
}

.ps-modal-mag-pdf {
  max-width: min(960px, 100%);
  width: 100%;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
}

.ps-mag-pdf-frame-wrap {
  flex: 1;
  min-height: 0;
  padding: 0 1rem 1rem;
}

.ps-mag-pdf-frame {
  width: 100%;
  min-height: min(75vh, 720px);
  height: 70vh;
  border: 0;
  border-radius: 8px;
  background: #1a1a1a;
}

.ps-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--ps-border);
}

.ps-modal-head h2 {
  margin: 0;
  font-size: 1.1rem;
  flex: 1 1 auto;
  min-width: 0;
}

.ps-modal-head-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  flex-shrink: 0;
}

.ps-video-reload-btn {
  padding: 0.4rem 0.62rem;
  border-radius: 8px;
  border: 1px solid #ffb347;
  background: linear-gradient(180deg, #ffb347, #e0670a);
  color: #1a0f00;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  cursor: pointer;
  line-height: 1.2;
  white-space: nowrap;
  box-shadow: 0 2px 10px rgba(224, 103, 10, 0.45);
}

.ps-video-reload-btn:hover,
.ps-video-reload-btn:focus-visible {
  filter: brightness(1.08);
  outline: 2px solid rgba(255, 179, 71, 0.55);
  outline-offset: 2px;
}

.ps-close {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  flex-shrink: 0;
}

.ps-close-inner {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: linear-gradient(180deg, #c53030, #8b1a1a);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 8px;
  padding: 0.4rem 0.65rem;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
}

.ps-close-x {
  font-size: 1.35rem;
  line-height: 1;
  font-weight: 700;
}

.ps-close-text {
  text-transform: uppercase;
}

.ps-close:hover .ps-close-inner,
.ps-close:focus-visible .ps-close-inner {
  filter: brightness(1.1);
  outline: 2px solid rgba(255, 255, 255, 0.35);
  outline-offset: 2px;
}

.ps-video-list-wrap {
  position: relative;
  min-height: 0;
}

#ps-overlay-video:not([hidden]) .ps-video-content:not(.ps-video-stage-open) .ps-video-list {
  max-height: min(52vh, 440px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.ps-video-content.ps-video-stage-open .ps-video-list-wrap {
  flex: 0 0 auto;
}

.ps-video-list {
  padding: 0.75rem 1rem 0.5rem;
  padding-right: 0.55rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  scrollbar-width: auto;
  scrollbar-color: #d4af37 rgba(255, 255, 255, 0.1);
}

.ps-video-list::-webkit-scrollbar {
  width: 11px;
}

.ps-video-list::-webkit-scrollbar-track {
  margin: 0.35rem 0;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  border: 1px solid rgba(201, 162, 39, 0.22);
}

.ps-video-list::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #f0c94a, #d4af37);
  border-radius: 999px;
  border: 2px solid rgba(13, 17, 23, 0.55);
  min-height: 2.5rem;
}

.ps-video-list::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, #ffe9a8, #e6b84a);
}

.ps-video-list-hint {
  margin: 0;
  padding: 0.35rem 1rem 0.55rem;
  text-align: center;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #e6b84a;
  text-shadow: 0 0 8px rgba(201, 162, 39, 0.35);
}

.ps-video-list-hint[hidden] {
  display: none !important;
}

.ps-video-item {
  text-align: left;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--ps-border);
  border-radius: 8px;
  background: #0d1117;
  color: var(--ps-text);
  cursor: pointer;
  font-size: 0.95rem;
}

.ps-video-item:hover {
  border-color: var(--ps-accent);
}

.ps-video-item--active {
  border-color: var(--ps-accent);
  background: rgba(201, 162, 39, 0.14);
  box-shadow: inset 0 0 0 1px rgba(201, 162, 39, 0.35);
}

.ps-video-gate {
  padding: 0.75rem 1rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

#ps-video-gate[hidden] {
  display: none !important;
}

/* Solo formulario O solo éxito: se controla con .ps-video-gate--success en el padre. */
#ps-video-gate.ps-video-gate--success .ps-video-gate-form {
  display: none !important;
}

#ps-video-gate:not(.ps-video-gate--success) .ps-video-gate-success {
  display: none !important;
}

.ps-video-gate-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
}

.ps-video-gate-hint {
  margin: 0;
  font-size: 0.85rem;
}

.ps-video-gate-label {
  font-size: 0.85rem;
  color: var(--ps-muted);
}

.ps-video-gate-input {
  width: 100%;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--ps-border);
  border-radius: 8px;
  background: #0d1117;
  color: var(--ps-text);
  font-size: 1rem;
}

.ps-video-gate-btn {
  max-width: 220px;
  margin-top: 0.25rem;
}

.ps-video-gate-err {
  margin: 0.25rem 0 0;
  color: var(--ps-error);
  font-size: 0.9rem;
}

.ps-video-gate-success {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  padding: 1.25rem 1rem 1rem;
  text-align: center;
  animation: ps-video-gate-fade 0.35s ease-out;
}

@keyframes ps-video-gate-fade {
  from {
    opacity: 0;
    transform: scale(0.96);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  .ps-video-gate-success {
    animation: none;
  }
}

.ps-video-gate-check {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  background: linear-gradient(180deg, #2ea043, #196c2e);
  color: #fff;
  font-size: 1.75rem;
  font-weight: 800;
  line-height: 1;
  box-shadow: 0 4px 14px rgba(46, 160, 67, 0.35);
}

.ps-video-gate-success-msg {
  margin: 0;
  font-weight: 600;
  font-size: 1rem;
  color: var(--ps-text);
}

.ps-video-logout-wrap {
  margin: 0;
  padding: 0.75rem 1rem 1rem;
  text-align: center;
  border-top: 1px solid var(--ps-border);
}

.ps-video-logout-link {
  background: none;
  border: none;
  padding: 0;
  font-size: 0.78rem;
  color: var(--ps-muted);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.ps-video-logout-link:hover,
.ps-video-logout-link:focus-visible {
  color: var(--ps-accent);
}

.ps-video-stage {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 0 1rem 1rem;
}

.ps-video-fs-wrap {
  position: relative;
  width: 100%;
  min-height: min(52vh, 420px);
  background: #000;
  border-radius: 8px;
  overflow: hidden;
}

.ps-video-content {
  min-height: 0;
}

.ps-video-content.ps-video-stage-open {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.ps-video-content.ps-video-stage-open .ps-video-list {
  flex: 0 0 auto;
  max-height: min(24vh, 9rem);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.ps-video-content.ps-video-stage-open .ps-video-logout-wrap {
  flex: 0 0 auto;
  flex-shrink: 0;
}

.ps-video-content.ps-video-stage-open .ps-video-stage:not([hidden]) {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.ps-video-content.ps-video-stage-open .ps-video-fs-wrap {
  flex: 1 1 auto;
  min-height: min(40vh, 300px);
}

.ps-video-content.ps-video-stage-open .ps-video-player {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.ps-video-content.ps-video-stage-open .ps-video-player iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  min-height: 0 !important;
}

/* iOS: refuerzo anti-scroll doble en el modal de videos. */
body.ps-client-ios #ps-overlay-video:not([hidden]) .ps-modal-video {
  overflow: hidden;
}

body.ps-client-ios #ps-overlay-video .ps-video-content {
  flex: 1 1 auto;
}

body.ps-client-ios #ps-overlay-video .ps-video-fs-wrap {
  min-height: min(42vh, 320px);
}

.ps-video-load-overlay {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  text-align: center;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 18% 42%, rgba(26, 138, 76, 0.28) 0%, transparent 52%),
    radial-gradient(ellipse at 82% 42%, rgba(196, 30, 58, 0.28) 0%, transparent 52%),
    radial-gradient(ellipse at 50% 20%, #1a1510 0%, rgba(5, 5, 5, 0.98) 55%, #050505 100%);
  pointer-events: none;
}

.ps-video-load-overlay[hidden] {
  display: none !important;
}

.ps-video-load-overlay.ps-video-load-overlay--error {
  pointer-events: auto;
}

.ps-video-load-overlay.ps-video-load-overlay--error .ps-video-load-spinner {
  display: none;
}

.ps-video-load-inner {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  max-width: min(86vw, 320px);
}

.ps-video-load-spinner {
  width: 48px;
  height: 48px;
  border: 3px solid var(--ps-border);
  border-top-color: var(--ps-accent);
  border-radius: 50%;
  animation: ps-embed-spin 0.85s linear infinite;
}

.ps-video-load-msg {
  margin: 0;
  font-size: 0.95rem;
  color: var(--ps-silver);
  letter-spacing: 0.08em;
  line-height: 1.4;
  text-transform: uppercase;
}

.ps-video-load-overlay.ps-video-load-overlay--error .ps-video-load-msg {
  color: #f7d9d9;
}

.ps-video-load-overlay.ps-video-load-overlay--empty .ps-video-load-spinner,
.ps-video-load-overlay.ps-video-load-overlay--error .ps-video-load-logo,
.ps-video-load-overlay.ps-video-load-overlay--empty .ps-video-load-logo {
  display: none;
}

.ps-video-load-overlay.ps-video-load-overlay--empty .ps-video-load-msg {
  color: var(--ps-muted);
}

.ps-video-load-overlay.ps-video-load-overlay--empty {
  pointer-events: none;
}

body.ps-video-ios-fs .ps-video-load-overlay {
  z-index: 10002;
}

.ps-video-fs-wrap:fullscreen,
.ps-video-fs-wrap:-webkit-full-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  border-radius: 0;
  background: #000;
}

.ps-video-fs-wrap:fullscreen .ps-video-player,
.ps-video-fs-wrap:-webkit-full-screen .ps-video-player {
  width: 100%;
  height: 100%;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ps-video-fs-wrap:fullscreen .ps-video-player iframe,
.ps-video-fs-wrap:-webkit-full-screen .ps-video-player iframe {
  width: 100%;
  height: 100%;
  min-height: 100%;
  border-radius: 0;
}

.ps-video-player {
  padding: 0;
}

.ps-video-player iframe {
  width: 100%;
  min-height: 240px;
  border: 0;
  border-radius: 8px;
  background: #000;
  display: block;
}

.ps-video-fullscreen-btn {
  width: 100%;
  box-sizing: border-box;
  padding: 0.65rem 0.85rem;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #0d1117;
  border: 1px solid var(--ps-accent-dim);
  border-radius: 8px;
  cursor: pointer;
  background: linear-gradient(180deg, var(--ps-accent), var(--ps-accent-dim));
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

.ps-video-fullscreen-btn:hover,
.ps-video-fullscreen-btn:focus-visible {
  filter: brightness(1.08);
  outline: none;
}

.ps-video-fullscreen-btn:focus-visible {
  box-shadow: 0 0 0 2px var(--ps-bg), 0 0 0 4px var(--ps-accent);
}

/*
 * iOS Safari: Fullscreen API no aplica bien a un div con iframe (YouTube).
 * Modo “casi pantalla completa”: overlay fijo + ocultar cabecera/lista del modal.
 */
body.ps-video-ios-fs {
  overflow: hidden !important;
}

body.ps-video-ios-fs #ps-overlay-video {
  position: fixed !important;
  inset: 0 !important;
  z-index: 10000 !important;
  padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px)
    env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px) !important;
  align-items: stretch !important;
  justify-content: stretch !important;
  background: #000 !important;
}

body.ps-video-ios-fs #ps-overlay-video .ps-modal-video {
  max-width: 100% !important;
  width: 100% !important;
  height: 100% !important;
  min-height: 100vh !important;
  min-height: 100dvh !important;
  min-height: -webkit-fill-available !important;
  max-height: none !important;
  border-radius: 0 !important;
  border: none !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
}

body.ps-video-ios-fs #ps-overlay-video .ps-modal-head,
body.ps-video-ios-fs #ps-overlay-video .ps-video-gate,
body.ps-video-ios-fs #ps-overlay-video .ps-video-logout-wrap,
body.ps-video-ios-fs #ps-overlay-video .ps-video-list {
  display: none !important;
}

body.ps-video-ios-fs #ps-overlay-video .ps-video-content {
  flex: 1 1 auto;
  min-height: 0;
  display: flex !important;
  flex-direction: column;
}

body.ps-video-ios-fs .ps-video-stage {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0 0 calc(0.35rem + env(safe-area-inset-bottom, 0px));
}

body.ps-video-ios-fs .ps-video-fs-wrap {
  flex: 1 1 auto;
  min-height: 0;
  height: auto;
  aspect-ratio: auto;
  border-radius: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

body.ps-video-ios-fs .ps-video-player {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

body.ps-video-ios-fs .ps-video-player iframe {
  position: absolute;
  inset: 0;
  flex: none;
  width: 100% !important;
  height: 100% !important;
  min-height: 100% !important;
  border-radius: 0;
}

body.ps-video-ios-fs .ps-video-fullscreen-btn {
  position: relative;
  z-index: 2;
  flex-shrink: 0;
  margin: 0 0.65rem;
}

.ps-mag-list {
  list-style: none;
  margin: 0;
  padding: 0.75rem 1rem 1rem;
}

.ps-mag-list li {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 0.5rem;
  align-items: center;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--ps-border);
  font-size: 0.9rem;
}

.ps-mag-list li:last-child {
  border-bottom: none;
}

.ps-mag-name {
  word-break: break-word;
}

.ps-mag-link {
  color: var(--ps-accent);
  text-decoration: none;
  font-size: 0.85rem;
}

.ps-mag-link:hover {
  text-decoration: underline;
}

a.ps-mag-view-btn {
  display: inline;
}

.ps-mag-view-btn {
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  font: inherit;
  cursor: pointer;
  color: var(--ps-accent);
  text-decoration: none;
  font-size: 0.85rem;
  text-align: left;
}

.ps-mag-view-btn:hover {
  text-decoration: underline;
}

.ps-empty {
  color: var(--ps-muted);
  margin: 0;
  font-size: 0.9rem;
}

@media (max-width: 520px) {
  .ps-mag-list li {
    grid-template-columns: 1fr;
    gap: 0.35rem;
  }
}
