* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  overflow-x: hidden;
}

body {
  font-family: system-ui, sans-serif;
  background: #f5f5f5;
  color: #222;
  overflow-x: hidden;
  width: 100%;
  position: relative;
}

/* =========================
   GENERIC SCREENS
========================= */
.screen {
  min-height: 100vh;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
  padding: 24px;
  text-align: center;
  overflow-x: hidden;
}

.hidden {
  display: none !important;
}

h1,
h2 {
  max-width: 800px;
}

/* =========================
   BUTTONS
========================= */
.primary-btn {
  padding: 12px 28px;
  font-size: 1rem;
  cursor: pointer;
  border: none;
  background: #111;
  color: #fff;
  border-radius: 10px;
  transition: background 150ms ease, transform 100ms ease;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.primary-btn:hover {
  background: #333;
}

.primary-btn:active {
  transform: translateY(1px);
}

/* =========================
   PROGRESS
========================= */
.progress-indicator {
  font-size: 0.9rem;
  color: #666;
  background: #e8e8e8;
  padding: 8px 16px;
  border-radius: 20px;
}

/* =========================
   SLIDERS
========================= */
.slider-block {
  width: 100%;
  max-width: 980px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: hidden;
}

.slider-title {
  font-size: 0.9rem;
  opacity: 0.8;
  padding: 0 16px;
}

.swiper {
  width: 100%;
  padding: 10px 0 20px;
  overflow: visible;
}

.swiper-wrapper {
  display: flex;
  align-items: center;
}

/* =========================
   SLIDE CARD
========================= */
/*
 * Para una experiencia vertical y centrada tanto en escritorio como en móvil,
 * reducimos el ancho de cada tarjeta y la hacemos más alta. De esta forma
 * sólo se ve una tarjeta completa en el centro y las tarjetas laterales
 * quedan parcialmente visibles. La altura de la imagen es ligeramente menor
 * que en la iteración anterior para que no ocupen tanto espacio.
 */
.swiper-slide {
  width: 120px;
  padding: 16px 12px;
  background: #fff;
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  cursor: grab;
  transition: transform 200ms ease, box-shadow 200ms ease;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

/* Ajuste de las imágenes dentro de las tarjetas. Se ocupan todo el ancho de
   la tarjeta y tienen menor altura para que resulten más compactas y se
   vean mejor las tarjetas laterales. */
.swiper-slide img {
  width: 100%;
  height: 150px;
  object-fit: contain;
  user-select: none;
  -webkit-user-select: none;
  pointer-events: none;
  -webkit-user-drag: none;
  -khtml-user-drag: none;
  -moz-user-drag: none;
  -o-user-drag: none;
}

.swiper-slide span {
  font-size: 0.86rem;
  line-height: 1.2;
  text-align: center;
  user-select: none;
  -webkit-user-select: none;
}

/* =========================
   RESULT CARD
========================= */
.result-card {
  background: #fff;
  border-radius: 24px;
  padding: 40px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.12);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  max-width: 420px;
  width: 100%;
}

.result-card h2 {
  font-size: 1.5rem;
  color: #333;
}

/* =========================
   CIRCLE RESULT
========================= */
.result-circle {
  position: relative;
  width: 180px;
  height: 180px;
}

.result-circle svg {
  transform: rotate(-90deg);
  width: 100%;
  height: 100%;
}

.circle-bg {
  fill: none;
  stroke: #e8e8e8;
  stroke-width: 8;
}

.circle-progress {
  fill: none;
  stroke: #111;
  stroke-width: 8;
  stroke-linecap: round;
  stroke-dasharray: 283;
  stroke-dashoffset: 283;
  transition: stroke-dashoffset 1s ease-out;
}

.result-percentage {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 2.4rem;
  font-weight: 800;
}

/* =========================
   RESULT STATS
========================= */
.result-stats {
  display: flex;
  align-items: center;
  gap: 24px;
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.stat-number {
  font-size: 1.8rem;
  font-weight: 700;
}

.stat-label {
  font-size: 0.85rem;
  color: #888;
}

.stat-divider {
  width: 1px;
  height: 40px;
  background: #ddd;
}

/* =========================
   RESULT MESSAGE
========================= */
.result-message {
  font-size: 1rem;
  color: #555;
  padding: 12px 20px;
  background: #f6f6f6;
  border-radius: 12px;
}

.msg-green {
  background: #d4edda;
  color: #155724;
}

.msg-orange {
  background: #fff3cd;
  color: #856404;
}

/* =========================
   RESULT BUTTONS
========================= */
.button-group {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  justify-content: center;
  width: 100%;
}

.share-message {
  font-size: 0.85rem;
  color: #27ae60;
  font-weight: 500;
}

/* =========================
   TIMER
========================= */
.game-timer {
  position: fixed;
  top: 16px;
  right: 16px;
  font-size: 0.85rem;
  color: #555;
  background: rgba(255,255,255,0.9);
  padding: 6px 12px;
  border-radius: 999px;
  backdrop-filter: blur(6px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  z-index: 1000;
  font-variant-numeric: tabular-nums;
}

/* =========================
   GAME HEADER & TIMER OVERRIDE
========================= */
/* Encabezado dentro de la pantalla de juego que muestra el logo y el título */
.game-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.game-header .logo {
  width: 48px;
  height: 48px;
}

.game-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: #111;
}

/* Sobrescribe el temporizador cuando está dentro de la pantalla de juego */
#gameScreen .game-timer {
  position: static;
  top: auto;
  right: auto;
  background: #e8e8e8;
  padding: 6px 12px;
  border-radius: 20px;
  margin-bottom: 16px;
  box-shadow: none;
  backdrop-filter: none;
}

/* Ajustes responsivos para el encabezado */
@media (max-width: 480px) {
  .game-header {
    flex-direction: column;
    gap: 8px;
  }
  .game-header .logo {
    width: 40px;
    height: 40px;
  }
  .game-title {
    font-size: 1.1rem;
    text-align: center;
  }
}

/* =========================
   EMPAREJAMIENTO EFFECT
========================= */
/* Efectos visuales para mostrar si el emparejamiento fue correcto o
   incorrecto. Estos efectos añaden un borde de color y un ligero zoom. */
.match-correct,
.match-wrong {
  transition: box-shadow 0.3s ease, transform 0.3s ease;
}

.match-correct {
  box-shadow: 0 0 0 4px #27ae60;
  transform: scale(1.05);
}

.match-wrong {
  box-shadow: 0 0 0 4px #e74c3c;
  transform: scale(1.05);
}

/* =========================
   LOADING
========================= */
.loading-screen {
  background: #111;
  color: #fff;
}

.loader-bar {
  width: 260px;
  height: 10px;
  background: #333;
  border-radius: 999px;
  overflow: hidden;
}

.loader-bar div {
  height: 100%;
  width: 0%;
  background: #27ae60;
  transition: width 0.2s ease;
}

#loaderText {
  font-size: 0.9rem;
  opacity: 0.7;
}

/* =========================
   MOBILE
========================= */
@media (max-width: 480px) {
  .screen {
    padding: 16px;
    gap: 16px;
  }

  .slider-block {
    max-width: 100vw;
  }

  .slider-title {
    padding: 0 8px;
  }

  .swiper-slide {
    /* En móviles, la tarjeta ocupa la mayor parte del ancho de la pantalla
       para que solo se vea una carta completa y las laterales se corten. */
    width: 70vw;
    max-width: 260px;
    padding: 14px 12px;
  }

  .swiper-slide img {
    width: 100%;
    height: 190px;
    object-fit: contain;
  }

  .swiper-slide span {
    font-size: 0.85rem;
  }

  .result-card {
    padding: 24px 16px;
    max-width: calc(100vw - 32px);
  }

  .result-circle {
    width: 140px;
    height: 140px;
  }

  .result-percentage {
    font-size: 1.8rem;
  }

  .result-stats {
    gap: 16px;
  }

  .stat-number {
    font-size: 1.5rem;
  }

  .button-group {
    flex-direction: column;
    width: 100%;
  }

  .primary-btn {
    width: 100%;
  }

  .game-timer {
    top: 12px;
    right: 12px;
    font-size: 0.8rem;
    padding: 5px 10px;
  }
}

@media (max-width: 360px) {
  .swiper-slide {
    /* En pantallas muy pequeñas, la tarjeta sigue ocupando la mayor parte del
       ancho para favorecer la lectura y la experiencia vertical */
    width: 75vw;
    max-width: 220px;
    padding: 12px 10px;
  }

  .swiper-slide img {
    width: 100%;
    height: 170px;
    object-fit: contain;
  }
}
