/* Shared look for the JuegaPop mini-games (menu, HUD, overlays). */
:root {
  --c1: #7c4dff;
  --c2: #ff4fa3;
  --ink: #1d1640;
  /* dark outline for the menu title, from the game's second colour */
  --ol: #2a1650;
  --font: "Baloo 2", ui-rounded, "Trebuchet MS", system-ui, sans-serif;
}
@supports (color: color-mix(in srgb, red, blue)) {
  :root {
    --ol: color-mix(in srgb, var(--c2) 38%, #12062e);
  }
}
* {
  box-sizing: border-box;
}
[hidden] {
  display: none !important;
}
html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  font-family: var(--font);
  color: var(--ink);
  background: linear-gradient(160deg, var(--c1), var(--c2));
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  overscroll-behavior: none;
}
button {
  font: inherit;
  cursor: pointer;
  color: inherit;
}
.pop-screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
}

/* Menu */
.pop-menu {
  overflow-y: auto;
  overflow-x: hidden;
  align-items: center;
  padding: 14px 14px 28px;
  touch-action: pan-y;
  background:
    radial-gradient(120% 50% at 50% 0%, rgba(255, 255, 255, 0.32) 0%, rgba(255, 255, 255, 0) 60%),
    linear-gradient(180deg, rgba(255, 255, 255, 0) 55%, rgba(10, 0, 40, 0.22) 100%);
}
.pop-menu > * {
  position: relative;
  z-index: 1;
}
/* background dressing */
.pop-menu > .pop-deco {
  position: absolute;
  inset: 0 0 auto 0;
  height: 100%;
  min-height: 700px;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}
.pop-rays {
  position: absolute;
  left: 50%;
  top: 62px;
  width: 760px;
  height: 760px;
  margin: -380px 0 0 -380px;
  background: repeating-conic-gradient(rgba(255, 255, 255, 0.13) 0 9deg, rgba(255, 255, 255, 0) 9deg 22deg);
  -webkit-mask: radial-gradient(circle, #000 0, #000 16%, transparent 58%);
  mask: radial-gradient(circle, #000 0, #000 16%, transparent 58%);
  animation: pop-spin 60s linear infinite;
}
.pop-cloud {
  position: absolute;
  width: 220px;
  height: 90px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  filter: blur(2px);
}
.pop-cloud::before,
.pop-cloud::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  background: inherit;
}
.pop-cloud::before {
  width: 110px;
  height: 110px;
  left: 30px;
  top: -50px;
}
.pop-cloud::after {
  width: 80px;
  height: 80px;
  left: 115px;
  top: -30px;
}
.pop-cloud.a {
  left: -120px;
  top: 150px;
}
.pop-cloud.b {
  right: -130px;
  top: 40px;
  transform: scale(0.8);
}
.pop-cloud.c {
  right: -100px;
  top: 560px;
  transform: scale(1.2);
  opacity: 0.8;
}
.pop-ghost {
  position: absolute;
  font-size: 120px;
  line-height: 1;
  opacity: 0.13;
  filter: grayscale(0.3);
}
.pop-ghost.a {
  left: -26px;
  top: 30px;
  transform: rotate(-16deg);
}
.pop-ghost.b {
  right: -30px;
  top: 250px;
  font-size: 150px;
  transform: rotate(14deg);
}
.pop-ghost.c {
  left: -40px;
  top: 520px;
  font-size: 170px;
  transform: rotate(-8deg);
  opacity: 0.1;
}

.pop-logo {
  display: grid;
  place-items: center;
  width: 112px;
  height: 104px;
  font-size: 72px;
  line-height: 1;
  background: radial-gradient(circle, rgba(255, 250, 210, 0.75) 0%, rgba(255, 250, 210, 0) 65%);
}
.pop-logo > span {
  filter: drop-shadow(0 8px 10px rgba(20, 0, 60, 0.35));
  animation: pop-bob 2.4s ease-in-out infinite;
}
.pop-title {
  margin: -6px 0 0;
  font-size: clamp(36px, 10.5vw, 56px);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.3px;
  color: #fffaf0;
  text-align: center;
  text-shadow:
    3px 0 0 var(--ol),
    -3px 0 0 var(--ol),
    0 3px 0 var(--ol),
    0 -3px 0 var(--ol),
    2px 2px 0 var(--ol),
    -2px 2px 0 var(--ol),
    2px -2px 0 var(--ol),
    -2px -2px 0 var(--ol),
    0 6px 0 var(--ol),
    3px 6px 0 var(--ol),
    -3px 6px 0 var(--ol),
    0 11px 14px rgba(20, 0, 50, 0.35);
}
.pop-how {
  max-width: 460px;
  margin: 10px 0 6px;
  text-align: center;
  color: #fff;
  font-weight: 600;
  font-size: 16px;
  line-height: 1.3;
  text-shadow: 0 1px 2px rgba(20, 0, 50, 0.35);
}
.pop-total {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 4px 0 14px;
  padding: 4px 22px;
  border-radius: 999px;
  background: rgba(20, 8, 70, 0.32);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18);
  color: #fff;
  font-weight: 800;
  font-size: 20px;
}
.pop-levels {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  width: 100%;
  max-width: 480px;
}
.pop-level {
  position: relative;
  overflow: hidden;
  min-height: 104px;
  border: 0;
  border-radius: 22px;
  background: linear-gradient(180deg, #ffffff 0%, #fff6ee 60%, #f6e3d8 100%);
  box-shadow:
    inset 0 -3px 0 rgba(200, 150, 160, 0.3),
    0 5px 0 rgba(30, 10, 80, 0.3),
    0 9px 16px rgba(20, 0, 60, 0.2);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 10px 4px;
  color: #1b2257;
  font-weight: 800;
  font-size: 38px;
  line-height: 1;
  transition: transform 0.12s;
}
.pop-level > * {
  position: relative;
}
.pop-level:not([disabled]):active {
  transform: translateY(3px);
  box-shadow:
    inset 0 -3px 0 rgba(200, 150, 160, 0.3),
    0 2px 0 rgba(30, 10, 80, 0.3);
}
.pop-level .pop-wm {
  position: absolute;
  right: -10px;
  bottom: -12px;
  font-size: 58px;
  line-height: 1;
  opacity: 0.1;
  transform: rotate(-12deg);
  pointer-events: none;
}
.pop-level .pop-head {
  display: flex;
  align-items: center;
  gap: 4px;
}
.pop-level .pop-num {
  font-weight: 800;
}
.pop-level .pop-ic {
  font-size: 26px;
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.2));
}
.pop-level small {
  margin-top: 3px;
  font-size: 12.5px;
  font-weight: 700;
  color: #2a4fae;
  max-width: 100%;
  /* Long names wrap to two lines instead of being cut; the taller line
     height keeps accents on capitals («Órganos») visible. */
  line-height: 1.3;
  text-align: center;
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
}
.pop-level .pop-s {
  display: flex;
  gap: 2px;
  margin-top: 4px;
  font-size: 14px;
}
.pop-level .pop-s i {
  width: 19px;
  height: 19px;
  font-size: 0;
  font-style: normal;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 1.8l3 6.4 7 .8-5.2 4.8 1.4 6.9L12 17.3l-6.2 3.4 1.4-6.9L2 9l7-.8z' fill='%23ffc61a' stroke='%23e89400' stroke-width='1.4' stroke-linejoin='round'/%3E%3Cpath d='M12 4.5l2.1 4.6 4.6.5' fill='none' stroke='%23fff6b0' stroke-width='1.4' stroke-linecap='round'/%3E%3C/svg%3E")
    center / contain no-repeat;
}
.pop-level .pop-s i.off {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 1.8l3 6.4 7 .8-5.2 4.8 1.4 6.9L12 17.3l-6.2 3.4 1.4-6.9L2 9l7-.8z' fill='%23d3cdd9' stroke='%23aaa3b4' stroke-width='1.4' stroke-linejoin='round'/%3E%3C/svg%3E");
}
.pop-level[disabled] {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.26), rgba(255, 255, 255, 0.12));
  border: 1.5px solid rgba(255, 255, 255, 0.38);
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.25),
    0 6px 14px rgba(20, 0, 60, 0.12);
  color: #fff;
  cursor: default;
}
.pop-level[disabled] .pop-wm {
  right: 50%;
  bottom: -18px;
  margin-right: -45px;
  font-size: 90px;
  opacity: 0.22;
  filter: grayscale(1) brightness(2.2);
  transform: none;
}
.pop-level .pop-lock {
  font-size: 34px;
  filter: drop-shadow(0 3px 3px rgba(20, 0, 60, 0.35));
}
.pop-level[disabled] small {
  margin-top: 4px;
  font-size: 13px;
  color: #fff;
  text-shadow: 0 1px 2px rgba(20, 0, 60, 0.4);
}
.pop-level.next {
  animation: pop-glow 1.6s ease-in-out infinite;
}
/* World tabs (games with `worlds`): one button per world above its levels. */
.pop-worlds {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  width: 100%;
  max-width: 480px;
  margin: 2px 0 14px;
}
.pop-worlds[hidden] {
  display: none;
}
.pop-world {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  min-width: 0;
  padding: 7px 3px 6px;
  border: 0;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.16);
  box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, 0.3);
  color: #fff;
  font: inherit;
  cursor: pointer;
  transition: transform 0.12s;
}
.pop-world:active {
  transform: translateY(2px);
}
.pop-world .pop-wi {
  font-size: 26px;
  line-height: 1.1;
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.25));
}
.pop-world b {
  font-size: 13.5px;
  font-weight: 800;
  line-height: 1.1;
  text-align: center;
}
.pop-world small {
  font-size: 11px;
  font-weight: 700;
  line-height: 1.15;
  text-align: center;
  opacity: 0.9;
}
.pop-world.on {
  background: linear-gradient(180deg, #fff 0%, #fff4dc 100%);
  box-shadow:
    0 0 0 3px #ffd23f,
    0 5px 0 rgba(0, 0, 0, 0.25);
  color: #1b2257;
}
.pop-world.locked:not(.on) {
  opacity: 0.75;
}

.pop-row {
  display: flex;
  gap: 10px;
  margin-top: 18px;
  flex-wrap: wrap;
  justify-content: center;
}
.pop-btn {
  border: 0;
  border-radius: 999px;
  padding: 8px 20px;
  min-height: 48px;
  background: linear-gradient(180deg, #fff27a 0%, #ffd23a 45%, #ffb300 100%);
  font-weight: 800;
  font-size: 18px;
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.7),
    0 4px 0 #c97800,
    0 7px 14px rgba(20, 0, 60, 0.22);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
  color: var(--ink);
}
.pop-btn:active {
  transform: translateY(3px);
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.7),
    0 1px 0 #c97800;
}
.pop-btn.ghost {
  background: linear-gradient(180deg, #ffffff, #f1eefa);
  box-shadow:
    inset 0 2px 0 #fff,
    0 4px 0 rgba(30, 10, 80, 0.28),
    0 7px 14px rgba(20, 0, 60, 0.18);
}
.pop-btn.ghost:active {
  box-shadow: 0 1px 0 rgba(30, 10, 80, 0.28);
}
.pop-menu > .pop-row:not(.pop-reto-row) .pop-btn {
  min-width: 150px;
  min-height: 52px;
  font-size: 20px;
}
.pop-foot {
  margin-top: 18px;
  padding: 3px 20px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.85);
  color: var(--ol);
  font-weight: 800;
  font-size: 15px;
}

/* Play */
.pop-hud {
  position: relative;
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  padding-top: calc(8px + env(safe-area-inset-top, 0px));
  min-height: 58px;
}
.pop-icon {
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.94);
  font-size: 19px;
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.18);
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  padding: 0;
}
.pop-lvl {
  color: #fff;
  font-weight: 800;
  font-size: 17px;
  line-height: 1.1;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.2);
  white-space: nowrap;
  flex: 0 0 auto;
}
.pop-chips {
  min-width: 0;
  display: flex;
  gap: 6px;
  margin-left: auto;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.pop-chip {
  background: rgba(255, 255, 255, 0.94);
  border-radius: 999px;
  padding: 2px 11px;
  font-weight: 800;
  font-size: 16px;
  white-space: nowrap;
}
.pop-stage {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
.pop-stage canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}
.pop-stage .pop-fx {
  pointer-events: none;
  z-index: 3;
}
.pop-dom {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 10px 12px calc(14px + env(safe-area-inset-bottom, 0px));
}

/* Overlays */
.pop-overlay {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(20, 10, 50, 0.45);
  padding: 16px;
  animation: pop-fade 0.2s;
}
.pop-card {
  background: #fff;
  border-radius: 28px;
  padding: 20px 22px 22px;
  text-align: center;
  max-width: 350px;
  width: 100%;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
  animation: pop-in 0.4s cubic-bezier(0.2, 1.6, 0.4, 1);
}
.pop-card h2 {
  margin: 0;
  font-size: 32px;
  line-height: 1.1;
}
.pop-card p {
  margin: 6px 0 4px;
  font-weight: 600;
  color: #4d4670;
}
.pop-card .pop-row {
  margin-top: 12px;
}
.pop-bigstars {
  font-size: 46px;
  letter-spacing: 4px;
}
.pop-bigstars span {
  display: inline-block;
  animation: pop-in 0.5s cubic-bezier(0.2, 1.6, 0.4, 1) backwards;
}
.pop-bigstars span:nth-child(2) {
  animation-delay: 0.15s;
}
.pop-bigstars span:nth-child(3) {
  animation-delay: 0.3s;
}
.pop-bigstars .off {
  filter: grayscale(1);
  opacity: 0.25;
}
.pop-toast {
  position: absolute;
  left: 50%;
  top: 30%;
  z-index: 5;
  transform: translateX(-50%);
  padding: 8px 22px;
  border-radius: 999px;
  background: #fff;
  font-weight: 800;
  font-size: 24px;
  white-space: nowrap;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
  pointer-events: none;
  animation: pop-toast 1.4s ease forwards;
}

@keyframes pop-bob {
  50% {
    transform: translateY(-8px) rotate(-4deg);
  }
}
@keyframes pop-in {
  from {
    transform: scale(0.5);
    opacity: 0;
  }
}
@keyframes pop-fade {
  from {
    opacity: 0;
  }
}
@keyframes pop-glow {
  50% {
    box-shadow:
      0 0 0 4px #ffe14d,
      0 0 22px 6px rgba(255, 230, 80, 0.9),
      0 5px 0 rgba(30, 10, 80, 0.3);
  }
}
@keyframes pop-spin {
  to {
    transform: rotate(360deg);
  }
}
@keyframes pop-toast {
  0% {
    opacity: 0;
    transform: translate(-50%, 20px) scale(0.7);
  }
  15%,
  70% {
    opacity: 1;
    transform: translate(-50%, 0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -30px);
  }
}
@media (prefers-reduced-motion: reduce) {
  .pop-logo > span,
  .pop-rays,
  .pop-level.next {
    animation: none;
  }
}
.pop-lvl small {
  display: block;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 13px;
  font-weight: 700;
  opacity: 0.92;
}

/* Modo Reto (leaderboard runs) */
.pop-reto-row {
  width: 100%;
  max-width: 460px;
  gap: 12px;
  margin: 12px 0 0;
}
/* two buttons share a row; a game that adds a third one wraps */
.pop-reto-row .pop-btn {
  flex: 1 1 140px;
  min-width: 0;
  min-height: 56px;
  padding: 8px 12px;
  font-size: 20px;
  white-space: nowrap;
}
.pop-btn.pop-reto {
  flex-grow: 1.25;
  font-size: 21px;
}
.pop-reto-how {
  max-width: 420px;
  margin: 8px 0 12px;
  text-align: center;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  text-shadow: 0 1px 2px rgba(20, 0, 50, 0.35);
}
@media (max-width: 360px) {
  .pop-reto-row .pop-btn {
    font-size: 17px;
  }
  .pop-level {
    font-size: 32px;
  }
}
.pop-reto-sum {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: 16px;
  background: #fff6d6;
  font-weight: 700;
  color: #4d4670;
}
.pop-reto-sum b {
  font-size: 26px;
  color: var(--ink);
}
