/*
  Ruleta Ceneris — estilos de kiosk.

  Base tomada de spin-wheel/examples/themes/css/index.css
  (reset, `overscroll-behavior-y: contain`, `position: fixed` anti rubber-band,
  `user-select: none`, `.wheel-wrapper` con visibility oculta durante la carga).
  Todo lo demás (branding, layout responsive, botones táctiles, modal) es nuevo.

  TODO: sustituir los colores por los definitivos de marca Ceneris.
  Los mismos valores viven en js/config.js (BRAND) para el canvas de la rueda.
*/

@import url('https://fonts.googleapis.com/css2?family=Rubik:wght@400;600;800&display=swap');

:root {
  --navy: #0A2540;        /* TODO: azul oscuro de marca real */
  --navy-dark: #061829;
  --navy-light: #123A5E;
  --orange: #FF6B00;      /* TODO: naranja de seguridad de marca real */
  --orange-dark: #CC5500;
  --white: #FFFFFF;

  /* Alto mínimo del botón exigido para dedo grande en tótem. */
  --touch-target: 72px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Rubik', 'Segoe UI', 'Lucida Grande', sans-serif;
  -webkit-tap-highlight-color: transparent;

  /* Kiosk: nada de selección de texto ni menú contextual por toque largo. */
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

html, body {
  height: 100%;
}

body {
  /* Evita el gesto pull-to-refresh. */
  overscroll-behavior-y: contain;

  /* Evita el rebote elástico de iOS. */
  position: fixed;
  width: 100%;

  /* El navegador no gestiona gestos: sin doble-tap-zoom ni paneo. */
  touch-action: manipulation;

  background: radial-gradient(circle at 50% 35%, var(--navy-light) 0%, var(--navy) 45%, var(--navy-dark) 100%);
  color: var(--white);
  overflow: hidden;
}

/* ---------------------------------------------------------------- layout */

.app {
  height: 100%;
  display: grid;
  grid-template-areas:
    'brand'
    'stage'
    'panel';
  grid-template-rows: auto minmax(0, 1fr) auto;
  padding: 2vmin 3vmin;
  gap: 1vmin;
  touch-action: manipulation;
}

.brand {
  grid-area: brand;
  display: flex;
  justify-content: center;
  align-items: center;
}

.brand__logo {
  height: clamp(34px, 7vmin, 72px);
  width: auto;
  max-width: 60vw;
  object-fit: contain;
}

.stage {
  grid-area: stage;
  min-height: 0;
  min-width: 0;
  display: grid;
  place-items: center;
}

/*
  Contenedor de la rueda: 100% del área disponible (unidades relativas, sin px
  fijos). spin-wheel dimensiona su canvas a `clientWidth`/`clientHeight` y ajusta
  el círculo a `min(w, h)`, así que esto se adapta solo a horizontal y vertical.
*/
.wheel-wrapper {
  visibility: hidden; /* Se revela desde JS cuando fuentes e imágenes cargaron. */
  width: 100%;
  height: 100%;
  overflow: hidden;
  touch-action: manipulation;
}

.panel {
  grid-area: panel;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.2vmin;
  text-align: center;
}

.panel__headline {
  font-size: clamp(22px, 4.2vmin, 52px);
  font-weight: 800;
  letter-spacing: 0.01em;
}

.panel__subhead {
  font-size: clamp(13px, 2.2vmin, 24px);
  opacity: 0.78;
  max-width: 34ch;
}

/* --------------------------------------------------------------- botones */

.btn {
  min-height: var(--touch-target); /* >= 64px para dedo grande */
  padding: 0 clamp(28px, 6vmin, 72px);
  border: 0;
  border-radius: 999px;
  background: var(--orange);
  color: var(--white);
  font-size: clamp(18px, 3vmin, 30px);
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 0 8px 0 var(--orange-dark), 0 14px 26px rgba(0, 0, 0, 0.35);
  transition: transform 0.08s ease, box-shadow 0.08s ease, opacity 0.2s ease;
  touch-action: manipulation;
}

.btn:active:not(:disabled) {
  transform: translateY(6px);
  box-shadow: 0 2px 0 var(--orange-dark), 0 6px 14px rgba(0, 0, 0, 0.35);
}

/* Deshabilitado mientras gira la rueda: evita el doble-tap. */
.btn:disabled {
  opacity: 0.45;
  cursor: default;
  transform: translateY(6px);
  box-shadow: 0 2px 0 var(--orange-dark);
}

.btn--spin {
  margin-top: 0.5vmin;
}

/* ----------------------------------------------------------------- modal */

.modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 4vmin;
  background: rgba(6, 24, 41, 0.86);
  backdrop-filter: blur(6px);
  z-index: 10;
  touch-action: manipulation;
  animation: fade-in 0.25s ease both;
}

.modal[hidden] {
  display: none;
}

.modal__card {
  width: min(92vw, 640px);
  padding: clamp(24px, 5vmin, 56px);
  border-radius: 28px;
  border: 3px solid var(--orange);
  background: var(--navy);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.6vmin;
  animation: pop-in 0.3s cubic-bezier(0.2, 0.9, 0.3, 1.3) both;
}

.modal__title {
  font-size: clamp(24px, 4.6vmin, 48px);
  font-weight: 800;
  color: var(--orange);
}

.modal__lead {
  font-size: clamp(14px, 2.4vmin, 24px);
  opacity: 0.78;
}

.modal__prize {
  font-size: clamp(26px, 5.4vmin, 60px);
  font-weight: 800;
  line-height: 1.15;
  margin-bottom: 1vmin;
}

.modal__countdown {
  font-size: clamp(11px, 1.8vmin, 16px);
  opacity: 0.5;
  min-height: 1.4em;
}

@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes pop-in {
  from { opacity: 0; transform: scale(0.9); }
  to   { opacity: 1; transform: scale(1); }
}

/* ------------------------------------------------- horizontal / apaisado */

/*
  En horizontal la rueda va a la izquierda y los textos + botón a la derecha,
  para que la rueda siga siendo lo más grande posible sin recortarse.
*/
@media (orientation: landscape) {
  .app {
    grid-template-areas:
      'brand brand'
      'stage panel';
    grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
    column-gap: 3vmin;
  }

  .panel {
    padding-inline: 2vmin;
  }

  .panel__headline {
    font-size: clamp(24px, 6vmin, 60px);
  }
}

/* Tótem muy estrecho o pantallas bajas: encoge el bloque de texto. */
@media (orientation: landscape) and (max-height: 520px) {
  .panel__subhead { display: none; }
  .brand__logo { height: clamp(26px, 5vmin, 44px); }
}

@media (prefers-reduced-motion: reduce) {
  .modal, .modal__card { animation: none; }
}
