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

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
    -webkit-tap-highlight-color: transparent; /* Quita el recuadro azul al tocar en móviles */
}

body, html {
    width: 100%;
    height: 100%;
    background-color: #fff;
    overflow-x: hidden;
    scroll-behavior: smooth;
}

/* -------------------------------------------
   ESTILOS PARA BLOQUEAR PC
------------------------------------------- */
.desktop-warning {
    display: none;
    height: 100vh;
    width: 100vw;
    background-color: #0f0f13;
    color: white;
    text-align: center;
    padding: 40px;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.desktop-warning h1 {
    font-size: 2.5rem;
    margin-bottom: 20px;
    color: #ff4757;
    font-weight: 800;
}

.desktop-warning p {
    font-size: 1.2rem;
    line-height: 1.6;
    color: #a4b0be;
}

/* -------------------------------------------
   ESTILOS DE LA VISTA MÓVIL
------------------------------------------- */
.mobile-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    width: 100%;
    min-height: 100vh;
    min-height: 100svh;
    position: relative;
    overflow-x: hidden;
    padding: clamp(26px, 5svh, 44px) 22px max(24px, env(safe-area-inset-bottom));
    isolation: isolate;
}

.mobile-container.roulette-active {
    padding-top: clamp(24px, 5vh, 42px);
}

.mobile-container::after {
    content: '';
    position: fixed;
    inset: 0;
    background-image: url('imagen/fondo.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    z-index: 0;
    pointer-events: none;
}

.mobile-container::before {
    display: none;
}

/* Logo */
.logo {
    max-width: 310px;
    width: min(88vw, 310px);
    position: relative;
    margin-top: -10%;
    z-index: 3;
    margin-bottom: 0;
    filter: drop-shadow(0 12px 16px rgba(38, 58, 130, 0.28));
    animation: floating 3s ease-in-out infinite;
    transition: width 0.28s ease, margin-bottom 0.28s ease, opacity 0.28s ease;
}

.roulette-active .logo {
    width: min(60vw, 214px);
    margin-top: 0;
    margin-bottom: clamp(12px, 3vh, 22px);
    animation: none;
}

.home-character {
    width: min(88vw, 390px);
    max-height: 48svh;
    object-fit: contain;
    object-position: center bottom;
    position: absolute;
    left: 50%;
    bottom: clamp(118px, 18svh, 158px);
    transform: translateX(-50%);
    z-index: 2;
    filter: drop-shadow(0 16px 18px rgba(38, 58, 130, 0.22));
    opacity: 1;
    pointer-events: none;
}

.roulette-active .home-character {
    display: none !important;
    visibility: hidden;
    opacity: 0;
}

@keyframes floating {
    0% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
    100% { transform: translateY(0); }
}

/* Contenedor de Botones */
.buttons-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
    max-width: 318px;
    position: relative;
    z-index: 3;
    margin-top: auto;
    margin-bottom: clamp(8px, 2svh, 18px);
    transition: opacity 0.22s ease, transform 0.22s ease;
}

.roulette-active .buttons-container {
    pointer-events: none;
    opacity: 0;
    transform: translateY(18px);
    position: absolute;
    bottom: 42px;
}

/* Diseño del Botón */
.btn {
    display: block;
    width: 100%;
    min-height: 58px;
    padding: 15px 20px 13px;
    font-size: 1.1rem;
    font-weight: 800;
    line-height: 1.25;
    text-align: center;
    text-decoration: none;
    border: 0;
    border-radius: 12px;
    text-transform: uppercase;
    letter-spacing: 0;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    transform: translateY(0);
    transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
    touch-action: manipulation;
}

/* Botón principal */
.btn-primary {
    background: linear-gradient(180deg, #314793 0%, #172967 100%);
    color: #fff;
    box-shadow:
        0 12px 0 #0d1b4b,
        0 20px 26px rgba(24, 41, 103, 0.32),
        inset 0 2px 0 rgba(255, 255, 255, 0.28);
    text-shadow: 0 2px 0 rgba(0, 0, 0, 0.26);
}

.btn-secondary {
    background: #fff;
    color: #22377f;
    border: 3px solid #ff7a1a;
    box-shadow:
        0 9px 0 #d95d00,
        0 17px 22px rgba(255, 122, 26, 0.24),
        inset 0 -2px 0 rgba(34, 55, 127, 0.08);
}

.btn::after {
    content: '';
    position: absolute;
    top: 0;
    left: 14px;
    right: 14px;
    height: 2px;
    background: rgba(255, 255, 255, 0.45);
    border-radius: 999px;
}

.btn-secondary::after {
    background: rgba(255, 122, 26, 0.45);
}

.btn:active {
    transform: translateY(6px);
}

.btn-primary:active {
    box-shadow:
        0 6px 0 #0d1b4b,
        0 12px 18px rgba(24, 41, 103, 0.28),
        inset 0 2px 0 rgba(255, 255, 255, 0.22);
}

.btn-secondary:active {
    box-shadow:
        0 4px 0 #d95d00,
        0 10px 16px rgba(255, 122, 26, 0.2),
        inset 0 -2px 0 rgba(34, 55, 127, 0.08);
}

/* -------------------------------------------
   RULETA
------------------------------------------- */
.roulette-panel {
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 26px;
    width: 100%;
    position: relative;
    z-index: 3;
    margin-top: auto;
    margin-bottom: clamp(16px, 5vh, 40px);
}

.roulette-panel.is-visible {
    display: flex;
}

.roulette-stage {
    position: relative;
    width: min(88vw, 430px);
    max-width: 100%;
    aspect-ratio: 1;
    padding-top: 22px;
    filter: drop-shadow(0 18px 22px rgba(24, 41, 103, 0.24));
}

.roulette-wheel {
    position: absolute;
    left: 50%;
    top: calc(50% + 14px);
    width: calc(100% - 28px);
    aspect-ratio: 1;
    transform: translate(-50%, -50%);
}

.wheel-layer {
    position: absolute;
    left: 50%;
    top: 50%;
    display: block;
    user-select: none;
    -webkit-user-drag: none;
    will-change: transform;
}

.wheel-layer-outer {
    width: 100%;
    transform: translate(-50%, -50%) rotate(0deg);
}

.wheel-layer-middle {
    width: 57.43%;
    transform: translate(-50%, -50%) rotate(0deg);
}

.wheel-layer-center {
    width: 25.15%;
    transform: translate(-50%, -50%);
    z-index: 3;
}

.result-arrow {
    position: absolute;
    left: 50%;
    top: 2px;
    width: 0;
    height: 0;
    border-left: 20px solid transparent;
    border-right: 20px solid transparent;
    border-top: 34px solid #e71935;
    transform: translateX(-50%);
    z-index: 5;
    filter: drop-shadow(0 6px 6px rgba(0, 0, 0, 0.26));
}

.download-btn,
.replay-btn {
    max-height: 0;
    min-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(12px);
    transition:
        opacity 0.32s ease,
        transform 0.32s ease,
        max-height 0.32s ease,
        min-height 0.32s ease,
        padding 0.32s ease;
}

.download-btn {
    border-width: 0;
}

.download-btn.is-visible,
.replay-btn.is-visible {
    max-height: 82px;
    min-height: 62px;
    padding: 17px 20px 15px;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0);
}

.download-btn.is-visible {
    border-width: 3px;
}

.roulette-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    max-width: 318px;
}

.roulette-actions .btn {
    min-height: 56px;
    padding-top: 14px;
    padding-bottom: 12px;
}

.roulette-actions .btn-primary {
    box-shadow:
        0 8px 0 #0d1b4b,
        0 14px 20px rgba(24, 41, 103, 0.28),
        inset 0 2px 0 rgba(255, 255, 255, 0.28);
}

.roulette-actions .btn-secondary {
    box-shadow:
        0 7px 0 #d95d00,
        0 12px 18px rgba(255, 122, 26, 0.22),
        inset 0 -2px 0 rgba(34, 55, 127, 0.08);
}

.roulette-actions .download-btn:not(.is-visible),
.roulette-actions .replay-btn:not(.is-visible) {
    min-height: 0;
    padding-top: 0;
    padding-bottom: 0;
}

.btn-back {
    background: rgba(255, 255, 255, 0.9);
    color: #22377f;
    border: 2px solid rgba(34, 55, 127, 0.18);
    box-shadow:
        0 5px 0 rgba(34, 55, 127, 0.18),
        0 10px 16px rgba(24, 41, 103, 0.12);
}

.btn-back::after {
    background: rgba(34, 55, 127, 0.16);
}

.btn-back:active {
    box-shadow:
        0 3px 0 rgba(34, 55, 127, 0.18),
        0 8px 14px rgba(24, 41, 103, 0.1);
}

/* -------------------------------------------
   POPUP GUIA PRACTICA
------------------------------------------- */
.guide-popup {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 200;
    padding: max(18px, env(safe-area-inset-top)) 16px max(18px, env(safe-area-inset-bottom));
    background: rgba(13, 27, 75, 0.72);
    backdrop-filter: blur(7px);
    -webkit-backdrop-filter: blur(7px);
}

.guide-popup.is-visible {
    display: flex;
}

.guide-dialog {
    position: relative;
    width: min(100%, 420px);
    height: min(84svh, 760px);
    background: #fff;
    border: 3px solid #ff7a1a;
    border-radius: 12px;
    box-shadow: 0 22px 42px rgba(13, 27, 75, 0.34);
    overflow: hidden;
}

.guide-frame {
    width: 100%;
    height: calc(100% - 58px);
    border: 0;
    background: #fff;
}

.guide-close {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 42px;
    height: 42px;
    border: 0;
    border-radius: 50%;
    background: #e71935;
    color: #fff;
    font-size: 30px;
    line-height: 38px;
    font-weight: 700;
    z-index: 2;
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.22);
}

.guide-open-link {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 58px;
    color: #22377f;
    font-size: 0.98rem;
    font-weight: 800;
    text-decoration: none;
    text-transform: uppercase;
    background: #fff;
    border-top: 2px solid rgba(34, 55, 127, 0.12);
}

@keyframes popIn {
    from { opacity: 0; transform: translateY(8px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* -------------------------------------------
   MODAL DE INSTRUCCIONES
------------------------------------------- */
.modal {
    display: none;
    position: fixed;
    z-index: 100;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.85);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    justify-content: center;
    align-items: center;
    padding: 20px;
    animation: fadeIn 0.3s ease-out forwards;
}

@keyframes fadeIn {
    from { opacity: 0; transform: scale(1.05); }
    to { opacity: 1; transform: scale(1); }
}

.modal-image-container {
    position: relative;
    max-width: 100%;
    max-height: 85vh;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
    background: #fff;
}

.modal-content {
    display: block;
    max-width: 100%;
    max-height: 85vh;
    object-fit: contain;
}

.close-btn {
    position: absolute;
    top: 20px;
    right: 25px;
    color: #fff;
    font-size: 40px;
    font-weight: 400;
    cursor: pointer;
    z-index: 101;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
    padding: 10px;
}

/* -------------------------------------------
   MEDIA QUERIES (RESTRICCIÓN DE PC)
------------------------------------------- */
/* Si el ancho de la pantalla es mayor a 768px (tablets grandes y PC) */
@media screen and (min-width: 768px) {
    .mobile-container {
        display: none !important;
    }
    .desktop-warning {
        display: flex !important;
    }
}

@media screen and (max-height: 700px) {
    .mobile-container {
        padding-top: 20px;
        padding-bottom: 24px;
    }

    .logo {
        width: min(82vw, 270px);
        margin-bottom: 8px;
    }

    .home-character {
        width: min(74vw, 292px);
        max-height: 39svh;
        bottom: 112px;
    }

    .buttons-container {
        gap: 8px;
        margin-bottom: 8px;
    }

    .btn {
        min-height: 50px;
        padding-top: 14px;
        padding-bottom: 11px;
        font-size: 0.98rem;
    }

    .roulette-active .logo {
        width: min(52vw, 176px);
        margin-bottom: 10px;
    }

    .roulette-panel {
        gap: 18px;
        margin-bottom: 16px;
    }

    .roulette-stage {
        width: min(78vw, 330px);
    }
}
