/* assets/css/ruleta.css — Estilos responsivos de la ruleta (tablet-first) */

:root {
    /* Variables inyectadas dinámicamente desde el tema del admin */
    --tema-fondo: #222d32;
    --tema-gajo-alt: #f4f4f4;
    --tema-texto: #ffffff;
    --tema-borde: #ffc107;
    --tema-boton: #dd4b39;
    --tema-puntero: #ffc107;
    --tema-boton-texto: #ffffff;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    overflow: hidden; /* Bloquear scroll accidental durante el juego */
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--tema-fondo);
    /* Imagen de fondo administrable (sube el admin; cubre toda la página) */
    background-image: var(--tema-fondo-imagen, none);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    touch-action: manipulation;
    -webkit-user-select: none;
    user-select: none;
}

#app {
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-evenly;
}

/* Cabecera con branding */
#cabecera {
    text-align: center;
    padding: 6px 16px;
    max-height: 20vh;
}
#cabecera .logo {
    max-height: 13vh;
    max-width: 60vw;
    object-fit: contain;
}
/* Subtítulo bajo el logo de la empresa */
#cabecera #subtitulo {
    margin: 4px 0 0;
    font-size: clamp(1rem, 3vw, 1.6rem);
    font-weight: 600;
    color: var(--tema-centro-texto-color, #111);
    text-shadow: 0 1px 4px rgba(255,255,255,.35);
}

/* Contenedor de la ruleta */
#ruleta-wrap {
    position: relative;
    width: min(88vw, 54vh, 500px);
    aspect-ratio: 1;
    flex: 0 1 auto;
}
#ruleta {
    width: 100%;
    height: 100%;
    display: block;
}

/* Puntero/aguja: triángulo de color sobre la muesca blanca del aro (maqueta) */
#puntero {
    position: absolute;
    top: -2px;
    left: 50%;
    transform: translateX(-50%);
    width: 9%;
    max-width: 42px;
    aspect-ratio: 40 / 46;
    filter: drop-shadow(0 2px 3px rgba(0,0,0,.35));
    z-index: 6;
    pointer-events: none;
    transform-origin: 50% 0;
    transition: transform .08s ease-out; /* Rebote de la aguja */
}
#puntero svg { display: block; width: 100%; height: 100%; }
#puntero.rebote { transform: translateX(-50%) rotate(14deg); }

/* Centro de la ruleta: botón de giro con texto editable */
#centro {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 24%;
    height: 24%;
    border-radius: 50%;
    background: var(--tema-centro-fondo, #fff);
    color: var(--tema-centro-texto-color, #111);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    z-index: 4;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(0,0,0,.35);
    transition: transform .15s, opacity .3s;
    -webkit-tap-highlight-color: transparent;
}
#centro span {
    font-weight: 800;
    font-size: clamp(1rem, 3.2vw, 1.6rem);
    letter-spacing: 1px;
    text-transform: uppercase;
    text-align: center;
    line-height: 1.1;
    padding: 4px;
}
#centro:active { transform: translate(-50%, -50%) scale(.94); }
#centro.girando {
    pointer-events: none;
    cursor: wait;
    animation: pulso-centro 1s ease-in-out infinite;
}
@keyframes pulso-centro {
    50% { transform: translate(-50%, -50%) scale(.93); }
}

/* Pie con logo del auspiciador */
#auspiciador {
    text-align: center;
    color: rgba(255,255,255,.85);
    padding-bottom: 8px;
}
#auspiciador small {
    display: block;
    font-size: .75rem;
    opacity: .75;
    letter-spacing: 1px;
    text-transform: uppercase;
}
#auspiciador img {
    max-height: 7vh;
    max-width: 40vw;
    object-fit: contain;
    margin-top: 4px;
}

/* Confeti overlay */
#confeti {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 50;
}

/* Modal de premio ganado */
.modal-fondo {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.75);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: opacity .3s;
}
.modal-fondo.visible { opacity: 1; pointer-events: auto; }
.modal-caja {
    background: #fff;
    border-radius: 20px;
    padding: 32px 40px;
    text-align: center;
    max-width: 86vw;
    box-shadow: 0 20px 60px rgba(0,0,0,.6);
    transform: scale(.7);
    transition: transform .35s cubic-bezier(.18,.89,.32,1.28);
}
.modal-fondo.visible .modal-caja { transform: scale(1); }
.modal-caja .emoji { font-size: 4rem; }
.modal-caja h2 { margin: 10px 0 4px; color: #333; }
.modal-caja .premio { font-size: 1.6rem; font-weight: 800; color: var(--tema-boton); }
.modal-caja button {
    margin-top: 20px;
    padding: 10px 34px;
    font-size: 1rem;
    font-weight: 700;
    border: none;
    border-radius: 30px;
    background: var(--tema-boton);
    color: #fff;
    cursor: pointer;
}

/* Pantalla campaña finalizada */
#finalizada {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    color: #fff;
    padding: 24px;
}
#finalizada .emoji { font-size: 5rem; }
#finalizada h1 { font-size: clamp(1.6rem, 5vw, 2.6rem); color: var(--tema-borde); }
#finalizada p  { font-size: 1.1rem; opacity: .85; }

/* Responsivo horizontal (tablet apaisada) */
@media (orientation: landscape) and (max-height: 600px) {
    #app { flex-direction: row; justify-content: space-around; padding: 0 4vw; }
    #cabecera { max-height: none; }
    #cabecera .logo { max-height: 14vh; }
    #ruleta-wrap { width: min(80vh, 60vw); }
}
