@charset "UTF-8";
/* =========================================================
   MEMOTEST BYR — estilos del juego
   Reutiliza los tokens de ../../ui/design-system.css
   ========================================================= */

body {
  font-family: "Baloo 2", system-ui, sans-serif;
  color: var(--byr-text);
  background: var(--byr-bg-page);
}

/* --- Encabezado del sitio (mismas reglas que scratch.css, para que el
       header/logo/nav se vean igual que en la raspadita) --- */
.site-header {
  position: relative;
  z-index: 50;
  min-height: 92px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 30px;
  padding: 12px clamp(24px, 5vw, 82px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(1, 18, 73, 0.96);
  box-shadow: 0 14px 35px rgba(0, 10, 48, 0.28);
}

.brand { flex-shrink: 0; }
.brand img { width: 142px; display: block; }

.site-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(18px, 2.3vw, 40px);
}
.site-nav a {
  position: relative;
  color: #fff;
  font-weight: 800;
  text-decoration: none;
}
.site-nav a::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: -9px;
  left: 0;
  height: 3px;
  border-radius: 99px;
  background: #ffd51f;
  transform: scaleX(0);
  transition: transform 180ms ease;
}
.site-nav a:hover::after,
.site-nav a.is-active::after { transform: scaleX(1); }

.header-button {
  flex-shrink: 0;
  padding: 15px 24px;
  border: 0;
  border-radius: 17px;
  color: #00164d;
  background: #ffd51f;
  box-shadow: 0 7px 0 #d5a900, 0 14px 28px rgba(0, 0, 0, 0.26);
  font-weight: 900;
  text-decoration: none;
  transition: transform 160ms ease, filter 160ms ease;
}
.header-button:hover { transform: translateY(-2px); filter: brightness(1.05); }

@media (max-width: 1050px) {
  .site-nav { display: none; }
}

.memory-page {
  position: relative;
  max-width: 980px;
  margin: 0 auto;
  padding: clamp(18px, 4vw, 40px) clamp(16px, 4vw, 28px) 60px;
  overflow: hidden;
}

/* --- Fondo decorativo --- */
.background-rays {
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    conic-gradient(
      from 200deg at 70% 12%,
      rgba(37, 129, 232, 0.16),
      transparent 25%,
      rgba(239, 45, 117, 0.12) 45%,
      transparent 70%
    );
  pointer-events: none;
}

.background-dots {
  position: fixed;
  inset: 0;
  z-index: -2;
  background-image: radial-gradient(rgba(255, 255, 255, 0.08) 1.4px, transparent 1.5px);
  background-size: 26px 26px;
  opacity: 0.6;
  pointer-events: none;
}

.floating-shape {
  position: absolute;
  z-index: 0;
  font-family: "Lilita One", sans-serif;
  color: rgba(255, 255, 255, 0.12);
  font-size: clamp(30px, 6vw, 64px);
  pointer-events: none;
  animation: floaty 7s ease-in-out infinite;
}

.floating-shape--star { top: 12%; left: 6%; color: rgba(255, 214, 64, 0.22); }
.floating-shape--plus { top: 30%; right: 8%; animation-delay: 1.4s; }
.floating-shape--circle {
  top: 62%;
  left: 4%;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 4px solid rgba(239, 45, 117, 0.28);
  animation-delay: 2.2s;
}
.floating-shape--cross { bottom: 12%; right: 10%; animation-delay: 0.7s; }

@keyframes floaty {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-16px) rotate(8deg); }
}

/* --- Hero --- */
.memory-hero {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 24px;
  align-items: center;
  margin-bottom: clamp(24px, 5vw, 44px);
}

.hero-pill {
  display: inline-block;
  padding: 7px 16px;
  border-radius: var(--byr-radius-pill);
  background: rgba(255, 214, 64, 0.16);
  color: var(--byr-yellow);
  font-weight: 800;
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.hero-copy h1 {
  font-family: "Lilita One", sans-serif;
  font-size: clamp(2.4rem, 7vw, 4rem);
  line-height: 0.95;
  margin: 14px 0 12px;
  display: flex;
  flex-direction: column;
}
.hero-copy h1 strong { color: var(--byr-yellow); }

.hero-copy p {
  color: var(--byr-text-muted);
  font-size: 1.02rem;
  max-width: 42ch;
  margin: 0 0 20px;
}

.hero-action {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 13px 24px;
  border-radius: var(--byr-radius-pill);
  background: var(--byr-yellow);
  color: #071342;
  font-weight: 900;
  text-decoration: none;
  box-shadow: var(--byr-shadow-button);
  transition: transform var(--byr-transition-fast);
}
.hero-action:hover { transform: translateY(-2px); }
.hero-action span { font-size: 1.2rem; }

.hero-character {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 200px;
}
.hero-character .character-image {
  width: min(240px, 70%);
  filter: drop-shadow(0 20px 30px rgba(0, 0, 0, 0.4));
  transition: transform var(--byr-transition-normal);
}
.character-image.is-celebrating { animation: cheer 0.9s ease; }
@keyframes cheer {
  0%, 100% { transform: translateY(0) rotate(0); }
  30% { transform: translateY(-14px) rotate(-5deg); }
  60% { transform: translateY(-6px) rotate(5deg); }
}

.speech-bubble {
  position: absolute;
  top: -6px;
  right: 0;
  background: #fff;
  color: #071342;
  padding: 10px 16px;
  border-radius: 18px 18px 18px 4px;
  font-weight: 700;
  font-size: 0.9rem;
  box-shadow: var(--byr-shadow-button);
  z-index: 2;
}
.speech-bubble strong { color: var(--byr-pink); }

.character-rays {
  position: absolute;
  width: 260px;
  height: 260px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 214, 64, 0.25), transparent 60%);
  animation: pulse 3s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 0.7; }
  50% { transform: scale(1.12); opacity: 1; }
}

.byr-coin {
  position: absolute;
  bottom: 6px;
  left: 8%;
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: linear-gradient(145deg, #ffe680, #ffb020);
  color: #7a4a00;
  font-family: "Lilita One", sans-serif;
  font-size: 0.85rem;
  box-shadow: inset 0 2px 6px rgba(255, 255, 255, 0.6), 0 8px 16px rgba(0, 0, 0, 0.3);
  animation: floaty 5s ease-in-out infinite;
}

/* --- Bloque de juego --- */
.memory-game {
  position: relative;
  z-index: 1;
  background: var(--byr-bg-card);
  border: 1px solid var(--byr-border-soft);
  border-radius: var(--byr-radius-lg);
  padding: clamp(20px, 4vw, 34px);
  box-shadow: var(--byr-shadow-card);
}

.game-heading { text-align: center; margin-bottom: 22px; }
.game-heading > span {
  color: var(--byr-yellow);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 0.82rem;
}
.game-heading h2 {
  font-family: "Lilita One", sans-serif;
  font-size: clamp(1.5rem, 4vw, 2.2rem);
  margin: 8px 0 10px;
}
.game-heading p {
  color: var(--byr-text-muted);
  max-width: 52ch;
  margin: 0 auto;
}

/* --- Stats --- */
.memory-stats {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 22px;
}
.stat-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 96px;
  padding: 10px 18px;
  border-radius: var(--byr-radius-md);
  background: rgba(4, 19, 39, 0.55);
  border: 1px solid var(--byr-border-soft);
}
.stat-chip span {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--byr-text-muted);
}
.stat-chip strong {
  font-family: "Lilita One", sans-serif;
  font-size: 1.3rem;
  color: var(--byr-white);
}

/* --- Tablero --- */
.memory-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: clamp(8px, 2vw, 14px);
  max-width: 520px;
  margin: 0 auto 26px;
}

.memory-card {
  position: relative;
  aspect-ratio: 3 / 4;
  border: none;
  background: transparent;
  padding: 0;
  cursor: pointer;
  perspective: 800px;
  -webkit-tap-highlight-color: transparent;
}
.memory-card:disabled { cursor: default; }

.card-inner {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  transition: transform 420ms cubic-bezier(0.3, 1.4, 0.5, 1);
}
.memory-card.is-flipped .card-inner,
.memory-card.is-matched .card-inner {
  transform: rotateY(180deg);
}

.card-face {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  border-radius: var(--byr-radius-md);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  box-shadow: var(--byr-shadow-button);
}

.card-face--back {
  background: linear-gradient(150deg, #1764c0, #0a2d61);
  border: 2px solid rgba(255, 255, 255, 0.18);
  color: var(--byr-yellow);
  font-family: "Lilita One", sans-serif;
  font-size: clamp(1rem, 3.4vw, 1.5rem);
}
.card-face--back::after {
  content: "BYR";
  letter-spacing: 0.06em;
}

.card-face--front {
  transform: rotateY(180deg);
  background: linear-gradient(150deg, #fff6d6, #ffe08a);
  border: 2px solid rgba(255, 255, 255, 0.7);
  font-size: clamp(1.6rem, 6vw, 2.6rem);
}

.memory-card.is-matched .card-face--front {
  background: linear-gradient(150deg, #b8f5cf, #33d17a);
  animation: matched-pop 0.5s ease;
}
@keyframes matched-pop {
  0% { transform: rotateY(180deg) scale(1); }
  45% { transform: rotateY(180deg) scale(1.12); }
  100% { transform: rotateY(180deg) scale(1); }
}

.memory-grid.is-locked .memory-card { pointer-events: none; }

/* --- Progreso --- */
.memory-progress {
  display: flex;
  align-items: center;
  gap: 16px;
  max-width: 520px;
  margin: 0 auto 18px;
}
.progress-copy { min-width: 130px; }
.progress-copy strong { display: block; font-size: 1rem; }
.progress-copy span { color: var(--byr-text-muted); font-size: 0.82rem; }
.progress-track {
  flex: 1;
  height: 12px;
  border-radius: var(--byr-radius-pill);
  background: rgba(4, 19, 39, 0.6);
  overflow: hidden;
}
.progress-track span {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--byr-yellow), var(--byr-orange));
  transition: width 320ms ease;
}

.game-status {
  text-align: center;
  color: var(--byr-text-muted);
  margin: 6px 0 4px;
}

/* Reintentar el guardado del premio (solo si falló la red). */
.retry-save-button:not([hidden]) {
  display: block;
  margin: 12px auto 0;
  padding: 10px 24px;
  border-radius: var(--byr-radius-pill);
  border: none;
  background: linear-gradient(180deg, #ffe66c, var(--byr-yellow));
  color: var(--byr-blue-950);
  font-family: inherit;
  font-weight: 800;
  font-size: 1rem;
  cursor: pointer;
}

.test-reset-button:not([hidden]) {
  display: block;
  margin: 14px auto 0;
  padding: 8px 16px;
  border-radius: var(--byr-radius-pill);
  border: 1px dashed rgba(255, 255, 255, 0.35);
  background: transparent;
  color: var(--byr-text-muted);
  font-weight: 700;
  cursor: pointer;
}

/* --- Tira de juegos --- */
.games-strip {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin: 28px 0 20px;
}
.game-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--byr-radius-md);
  background: rgba(4, 19, 39, 0.5);
  border: 1px solid var(--byr-border-soft);
  text-decoration: none;
  color: var(--byr-text);
  transition: transform var(--byr-transition-fast), border-color var(--byr-transition-fast);
}
.game-option:hover { transform: translateY(-2px); border-color: var(--byr-border-strong); }
.game-option.is-active { border-color: var(--byr-yellow); background: rgba(255, 214, 64, 0.12); }
.game-option span { font-size: 1.6rem; }
.game-option strong { display: block; font-size: 0.95rem; }
.game-option small { color: var(--byr-text-muted); font-size: 0.78rem; }

.back-to-games {
  display: inline-block;
  color: var(--byr-text-muted);
  text-decoration: none;
  font-weight: 700;
  padding: 8px 4px;
}
.back-to-games:hover { color: var(--byr-white); }

/* --- Overlay de victoria --- */
.win-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(4, 19, 39, 0.82);
  backdrop-filter: blur(6px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 260ms ease, visibility 260ms ease;
}
.win-overlay.is-visible { opacity: 1; visibility: visible; }

.win-card {
  position: relative;
  width: min(420px, 100%);
  text-align: center;
  padding: 36px 28px 30px;
  border-radius: var(--byr-radius-lg);
  background: linear-gradient(160deg, #10336b, #071d3c);
  border: 1px solid var(--byr-border-strong);
  box-shadow: var(--byr-shadow-card);
  transform: scale(0.9);
  transition: transform 320ms cubic-bezier(0.3, 1.4, 0.5, 1);
}
.win-overlay.is-visible .win-card { transform: scale(1); }

.win-close {
  position: absolute;
  top: 12px;
  right: 14px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 1.3rem;
  cursor: pointer;
}

.win-kicker {
  color: var(--byr-yellow);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 0.82rem;
}
.win-icon { font-size: 3.4rem; margin: 8px 0; }
.win-card h2 {
  font-family: "Lilita One", sans-serif;
  font-size: 1.8rem;
  margin: 4px 0 8px;
}
.win-card > p { color: var(--byr-text-muted); margin: 0 0 18px; }

.win-rewards {
  display: flex;
  justify-content: center;
  gap: 14px;
  margin-bottom: 22px;
}
.win-reward-chip {
  min-width: 96px;
  padding: 12px 16px;
  border-radius: var(--byr-radius-md);
  background: rgba(4, 19, 39, 0.6);
  border: 1px solid var(--byr-border-soft);
}
.win-reward-chip span {
  display: block;
  font-size: 0.72rem;
  text-transform: uppercase;
  color: var(--byr-text-muted);
}
.win-reward-chip strong {
  font-family: "Lilita One", sans-serif;
  font-size: 1.5rem;
  color: var(--byr-yellow);
}

.win-button {
  display: inline-block;
  padding: 13px 26px;
  border-radius: var(--byr-radius-pill);
  background: var(--byr-yellow);
  color: #071342;
  font-weight: 900;
  text-decoration: none;
  box-shadow: var(--byr-shadow-button);
}

/* --- Confeti --- */
.confetti {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}
.confetti-piece {
  position: absolute;
  top: -20px;
  width: 10px;
  height: 16px;
  border-radius: 2px;
  animation: confetti-fall var(--duration, 3s) linear forwards;
}
@keyframes confetti-fall {
  0% { transform: translateY(0) translateX(0) rotate(0); opacity: 1; }
  100% { transform: translateY(105vh) translateX(var(--drift, 0)) rotate(var(--rotation, 720deg)); opacity: 0.9; }
}

/* --- Responsive --- */
@media (max-width: 720px) {
  .site-header { min-height: 76px; padding: 10px 18px; }
  .brand img { width: 112px; }
  .header-button { padding: 12px 15px; font-size: 0.78rem; }
  .memory-hero { grid-template-columns: 1fr; }
  .hero-character { order: -1; min-height: 160px; }
  .speech-bubble { right: 12%; }
}
