/* =============================================
   RULETA DE IMÁGENES — Estilos
   Compatibilidad: iOS 9 Safari (iPad 2)
   ============================================= */

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

html, body {
  width: 100%;
  height: 100%;
}

body {
  background-color: #0d0d1a;
  background-image: -webkit-radial-gradient(center ellipse, #1a1a3a 0%, #0d0d1a 70%);
  background-image: radial-gradient(ellipse at center, #1a1a3a 0%, #0d0d1a 70%);
  font-family: Georgia, 'Times New Roman', serif;
  color: #f0d080;
  min-height: 100%;
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-box-orient: vertical;
  -webkit-box-direction: normal;
  -webkit-flex-direction: column;
  flex-direction: column;
  -webkit-box-align: center;
  -webkit-align-items: center;
  align-items: center;
  -webkit-box-pack: center;
  -webkit-justify-content: center;
  justify-content: center;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

/* ---- Contenedor principal ---- */
#app {
  width: 100%;
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-box-orient: vertical;
  -webkit-box-direction: normal;
  -webkit-flex-direction: column;
  flex-direction: column;
  -webkit-box-align: center;
  -webkit-align-items: center;
  align-items: center;
  padding: 20px 0;
}

/* ---- Cabecera ---- */
.cabecera {
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-box-orient: horizontal;
  -webkit-box-direction: normal;
  -webkit-flex-direction: row;
  flex-direction: row;
  -webkit-box-align: center;
  -webkit-align-items: center;
  align-items: center;
  width: 100%;
  max-width: 920px;
  margin-bottom: 28px;
  padding: 0 20px;
}

.linea-deco {
  -webkit-flex: 1;
  flex: 1;
  height: 1px;
  background-color: #c9a227;
  opacity: 0.6;
}

.titulo {
  font-size: 2em;
  letter-spacing: 0.4em;
  color: #ffd700;
  text-align: center;
  text-shadow: 0 0 24px rgba(255, 215, 0, 0.45);
  font-weight: normal;
  padding: 0 24px;
  white-space: nowrap;
}

/* ---- Contenedor de la ruleta ---- */
.ruleta-wrapper {
  position: relative;
  width: 100%;
  max-width: 920px;
}

/* ---- Viewport: la ventana que muestra las tarjetas ---- */
.viewport {
  width: 100%;
  height: 292px;
  overflow: hidden;
  background-color: #0f0f24;
  border-top: 2px solid #c9a227;
  border-bottom: 2px solid #c9a227;
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-box-align: center;
  -webkit-align-items: center;
  align-items: center;
  position: relative;
}

/* ---- Strip: tira horizontal con todas las tarjetas ---- */
.strip {
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-box-orient: horizontal;
  -webkit-box-direction: normal;
  -webkit-flex-direction: row;
  flex-direction: row;
  -webkit-flex-wrap: nowrap;
  flex-wrap: nowrap;
  -webkit-box-align: center;
  -webkit-align-items: center;
  align-items: center;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  position: relative;
}

/* ---- Tarjeta individual ---- */
.card {
  width: 180px;
  height: 252px;
  -webkit-flex-shrink: 0;
  flex-shrink: 0;
  margin-right: 16px;
  border: 6px solid #a07820;
  border-radius: 10px;
  overflow: hidden;
  background-color: #1a1a32;
  -webkit-box-shadow: 0 4px 18px rgba(0, 0, 0, 0.7), inset 0 0 0 1px rgba(201, 162, 39, 0.15);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.7), inset 0 0 0 1px rgba(201, 162, 39, 0.15);
  -webkit-transition: border-color 0.35s ease, -webkit-box-shadow 0.35s ease;
  transition: border-color 0.35s ease, box-shadow 0.35s ease;
}

.card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

/* Estado ganadora: se activa tras el giro */
.card.ganadora {
  border-color: #ffd700;
  -webkit-box-shadow: 0 0 36px rgba(255, 215, 0, 0.9),
                      0 0 70px rgba(255, 215, 0, 0.4),
                      inset 0 0 0 1px rgba(255, 215, 0, 0.5);
  box-shadow: 0 0 36px rgba(255, 215, 0, 0.9),
              0 0 70px rgba(255, 215, 0, 0.4),
              inset 0 0 0 1px rgba(255, 215, 0, 0.5);
}

/* ---- Marco selector: encuadre fijo sobre el carril central ---- */
.selector-marco {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 198px;
  height: 268px;
  -webkit-transform: translate(-50%, -50%);
  transform: translate(-50%, -50%);
  border: 3px solid #ffd700;
  border-radius: 13px;
  -webkit-box-shadow: 0 0 0 1px rgba(255, 215, 0, 0.25),
                      0 0 22px rgba(255, 215, 0, 0.55),
                      inset 0 0 22px rgba(255, 215, 0, 0.06);
  box-shadow: 0 0 0 1px rgba(255, 215, 0, 0.25),
              0 0 22px rgba(255, 215, 0, 0.55),
              inset 0 0 22px rgba(255, 215, 0, 0.06);
  z-index: 10;
  pointer-events: none;
}

/* Triángulos indicadores arriba/abajo del marco */
.selector-marco::before,
.selector-marco::after {
  content: '';
  position: absolute;
  left: 50%;
  width: 0;
  height: 0;
  margin-left: -9px;
  border-left: 9px solid transparent;
  border-right: 9px solid transparent;
}

.selector-marco::before {
  top: -18px;
  border-bottom: 13px solid #ffd700;
}

.selector-marco::after {
  bottom: -18px;
  border-top: 13px solid #ffd700;
}

/* ---- Degradados laterales: oscurecen las tarjetas en los bordes ---- */
.fade-izquierda,
.fade-derecha {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 200px;
  z-index: 20;
  pointer-events: none;
}

.fade-izquierda {
  left: 0;
  background: -webkit-linear-gradient(left, #0d0d1a 0%, rgba(13, 13, 26, 0) 100%);
  background: linear-gradient(to right, #0d0d1a 0%, rgba(13, 13, 26, 0) 100%);
}

.fade-derecha {
  right: 0;
  background: -webkit-linear-gradient(right, #0d0d1a 0%, rgba(13, 13, 26, 0) 100%);
  background: linear-gradient(to left, #0d0d1a 0%, rgba(13, 13, 26, 0) 100%);
}

/* ---- Botón GIRAR ---- */
.controles {
  margin-top: 32px;
  text-align: center;
}

.btn-girar {
  padding: 18px 64px;
  font-size: 1.35em;
  font-family: Georgia, 'Times New Roman', serif;
  letter-spacing: 0.3em;
  font-weight: bold;
  color: #ffd700;
  background-color: #7a0000;
  border: 2px solid #c9a227;
  border-radius: 8px;
  cursor: pointer;
  -webkit-box-shadow: 0 5px 24px rgba(122, 0, 0, 0.7),
                      0 0 0 1px rgba(201, 162, 39, 0.25);
  box-shadow: 0 5px 24px rgba(122, 0, 0, 0.7),
              0 0 0 1px rgba(201, 162, 39, 0.25);
  -webkit-transition: background-color 0.15s ease,
                      -webkit-transform 0.1s ease,
                      -webkit-box-shadow 0.15s ease;
  transition: background-color 0.15s ease,
              transform 0.1s ease,
              box-shadow 0.15s ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  min-width: 260px;
  outline: none;
}

.btn-girar:not(:disabled):active {
  -webkit-transform: scale(0.95);
  transform: scale(0.95);
  background-color: #9a0000;
  -webkit-box-shadow: 0 2px 10px rgba(122, 0, 0, 0.4);
  box-shadow: 0 2px 10px rgba(122, 0, 0, 0.4);
}

.btn-girar:disabled {
  background-color: #252535;
  color: #555565;
  border-color: #3a3a4a;
  cursor: not-allowed;
  -webkit-box-shadow: none;
  box-shadow: none;
}

/* ---- Mensaje de resultado ---- */
.mensaje {
  margin-top: 22px;
  min-height: 48px;
  text-align: center;
  -webkit-transition: opacity 0.4s ease;
  transition: opacity 0.4s ease;
  opacity: 1;
}

.mensaje.oculto {
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
}

.mensaje p {
  font-size: 1.25em;
  letter-spacing: 0.12em;
  color: #ffd700;
  text-shadow: 0 0 14px rgba(255, 215, 0, 0.55);
  text-transform: uppercase;
}

/* ---- Responsivo: pantallas hasta 768 px (iPad 2 portrait) ---- */
@media screen and (max-width: 768px) {
  .titulo {
    font-size: 1.45em;
    letter-spacing: 0.3em;
  }

  .fade-izquierda,
  .fade-derecha {
    width: 100px;
  }

  .btn-girar {
    padding: 16px 48px;
    font-size: 1.15em;
    min-width: 200px;
  }

  .mensaje p {
    font-size: 1.05em;
  }
}

/* ---- Pantallas muy angostas (≤ 480 px) ---- */
@media screen and (max-width: 480px) {
  .titulo {
    font-size: 1.1em;
    letter-spacing: 0.2em;
    padding: 0 12px;
  }

  .fade-izquierda,
  .fade-derecha {
    width: 60px;
  }

  .cabecera {
    margin-bottom: 16px;
  }

  .controles {
    margin-top: 20px;
  }
}
