:root {
    --primary: #ff0055;
    --primary-glow: #ff0055aa;
    --dark: #0f0f0f;
    --light: #ffffff;
    --glass: rgba(15, 15, 15, 0.95);
    --whatsapp: #25D366;
    --error: #ff3333;
    --success: #00ff88;
}

* { box-sizing: border-box; margin: 0; padding: 0; user-select: none; -webkit-tap-highlight-color: transparent; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }

/* HOME / LOBBY STYLE */
.home-body {
    min-height: 100vh; width: 100%; margin: 0; padding: 0;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #0f0c29, #302b63, #24243e) !important;
    background-size: 400% 400%; animation: gradientShift 15s ease infinite; position: relative;
}
@keyframes gradientShift { 0% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } 100% { background-position: 0% 50%; } }

.lobby-card {
    z-index: 10; position: relative; background: rgba(20, 20, 20, 0.6) !important;
    backdrop-filter: blur(20px); border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 40px 30px; border-radius: 24px; width: 90%; max-width: 400px; text-align: center;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5); margin: 20px;
}
.logo-container { margin-bottom: 20px; display: flex; justify-content: center; }
.lobby-logo-img { max-width: 200px; width: 100%; height: auto; object-fit: contain; filter: drop-shadow(0 0 15px rgba(255, 255, 255, 0.15)); transition: transform 0.3s ease; }
.lobby-subtitle { color: #aaa; margin-bottom: 30px; font-size: 0.9rem; }
.input-wrapper { position: relative; margin-bottom: 20px; }
.slug-input { width: 100%; padding: 15px; border-radius: 12px; background: rgba(0,0,0,0.3); border: 2px solid rgba(255,255,255,0.1); color: white; font-size: 1.1rem; text-align: center; letter-spacing: 1px; transition: all 0.3s; }
.slug-input:focus { border-color: var(--primary); outline: none; background: rgba(0,0,0,0.5); }
.divider { display: flex; align-items: center; margin: 25px 0; color: #666; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 1px; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: rgba(255,255,255,0.1); }
.divider span { padding: 0 10px; }

/* BOOTH STYLE */
body, html { width: 100%; height: 100%; background: var(--dark); overflow: hidden; color: var(--light); }
#app { position: relative; width: 100%; height: 100%; display: flex; justify-content: center; align-items: center; }

/* MODALS */
.overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: var(--glass); backdrop-filter: blur(20px); z-index: 50; display: flex; flex-direction: column; justify-content: center; align-items: center; opacity: 0; visibility: hidden; transition: opacity 0.3s, visibility 0.3s; }
.overlay.active { opacity: 1; visibility: visible; }
.hidden { display: none !important; opacity: 0 !important; visibility: hidden !important; pointer-events: none !important; }

/* SCANNER MODAL */
#scanner-modal { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: #000; z-index: 9999; display: flex; flex-direction: column; }
.close-scan { font-size: 2rem; line-height: 1; background: rgba(255,255,255,0.2); width: 50px; height: 50px; display: flex; align-items: center; justify-content: center; border-radius: 50%; }
.scanner-ui { position: absolute; top: 20px; right: 20px; z-index: 101; }

/* TOASTS */
#toast-container { position: fixed; top: 20px; right: 20px; z-index: 10000; display: flex; flex-direction: column; gap: 10px; pointer-events: none; }
.toast { background: rgba(20, 20, 20, 0.95); color: white; padding: 15px 25px; border-radius: 50px; display: flex; align-items: center; gap: 10px; box-shadow: 0 10px 30px rgba(0,0,0,0.5); backdrop-filter: blur(10px); border: 1px solid rgba(255,255,255,0.1); transform: translateX(100%); opacity: 0; transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55); pointer-events: auto; }
.toast.show { transform: translateX(0); opacity: 1; }
.toast.success { border-left: 4px solid var(--success); }
.toast.error { border-left: 4px solid var(--error); }
.toast-icon { font-size: 1.2rem; }

@media print { body * { visibility: hidden; } #printable-area, #printable-area * { visibility: visible; } }


/* --- NUVOL BOOTH ELITE VERTICAL EDITION --- */

/* Forzar Cámara a Pantalla Completa Vertical */
#camera-feed { 
    position: absolute; top: 0; left: 0; 
    width: 100vw; height: 100vh; 
    object-fit: cover; 
    z-index: 1; 
}

/* 1. HUD de Enfoque (Corrección de Altura para el Rostro) */
.hud-overlay { 
    position: absolute; top: 0; left: 0; width: 100vw; height: 100vh; 
    pointer-events: none; z-index: 5; 
    display: flex; flex-direction: column; align-items: center; justify-content: flex-start; /* Subimos el HUD */
    padding-top: 15vh; /* Ajuste para que coincida con la posición natural de la cara */
}
.hud-frame {
    position: relative; width: 60vw; height: 40vh; max-height: 500px;
    transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}
.hud-frame.scanning { transform: scale(0.95); border-color: var(--primary); }
.hud-corner { position: absolute; width: 50px; height: 50px; border: 4px solid rgba(255, 255, 255, 0.4); }
.top-left { top: 0; left: 0; border-right: none; border-bottom: none; border-top-left-radius: 20px;}
.top-right { top: 0; right: 0; border-left: none; border-bottom: none; border-top-right-radius: 20px;}
.bottom-left { bottom: 0; left: 0; border-right: none; border-top: none; border-bottom-left-radius: 20px;}
.bottom-right { bottom: 0; right: 0; border-left: none; border-top: none; border-bottom-right-radius: 20px;}
.hud-instruction { margin-top: 30px; font-size: 1.1rem; color: rgba(255,255,255,0.7); font-weight: bold; text-transform: uppercase; letter-spacing: 2px; text-shadow: 0 2px 10px rgba(0,0,0,0.5); }

/* 2. UI Layers Base */
.ui-layer { position: absolute; top: 0; left: 0; width: 100vw; height: 100vh; z-index: 10; display: flex; flex-direction: column; justify-content: space-between; pointer-events: none; }

/* Barra Superior Limpia */
.top-bar { width: 100%; padding: 40px 30px; display: flex; justify-content: space-between; align-items: flex-start; z-index: 20; position: relative; pointer-events: auto !important; }
.event-pill { background: rgba(0,0,0,0.5); padding: 12px 25px; border-radius: 50px; backdrop-filter: blur(10px); font-size: 1rem; font-weight: bold; letter-spacing: 1px; text-transform: uppercase; border: 1px solid rgba(255,255,255,0.2); display: flex; align-items: center; gap: 10px; color: white;}
.pulse-dot { width: 10px; height: 10px; background: var(--success); border-radius: 50%; box-shadow: 0 0 10px var(--success); animation: pulseOuter 2s infinite; }
.icon-btn { width: 55px; height: 55px; border-radius: 50%; background: rgba(0,0,0,0.4); border: 1px solid rgba(255,255,255,0.3); color: white; display: flex; justify-content: center; align-items: center; backdrop-filter: blur(5px); cursor: pointer; transition: background 0.2s;}
.icon-btn:active { background: var(--primary); border-color: var(--primary); }

/* 3. Barra Inferior */
.bottom-bar { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 30px; padding-bottom: 50px; z-index: 20; position: relative; }

/* 4. Ruleta Magnética (Rediseño Absoluto - Sin cortes) */
#theme-roulette-wrapper { width: 100vw; position: relative; overflow: hidden; height: 100px; display: flex; align-items: center; pointer-events: auto !important; }
#theme-roulette-wrapper::before, #theme-roulette-wrapper::after {
    content: ''; position: absolute; top: 0; width: 25vw; height: 100%; z-index: 10; pointer-events: none;
}
#theme-roulette-wrapper::before { left: 0; background: linear-gradient(to right, rgba(0,0,0,0.9), transparent); }
#theme-roulette-wrapper::after { right: 0; background: linear-gradient(to left, rgba(0,0,0,0.9), transparent); }

/* ELIMINAMOS EL CUADRO FIJO PARA EVITAR QUE EL TEXTO SE DESBORDE */
.roulette-center-marker { display: none !important; }

.roulette-track {
    display: flex; align-items: center; gap: 20px; width: 100%; height: 100%;
    overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; -webkit-overflow-scrolling: touch;
    padding: 0 45vw; /* Asegura que el primero/último lleguen al centro */
}
.roulette-track::-webkit-scrollbar { display: none; }

.roulette-item {
    flex: 0 0 auto; /* Se adapta mágicamente al ancho del texto */
    min-width: 150px; max-width: 80vw;
    padding: 15px 30px; border-radius: 50px;
    display: flex; align-items: center; justify-content: center; text-align: center;
    font-size: 1.1rem; font-weight: 800; color: rgba(255,255,255,0.5); 
    text-transform: uppercase; letter-spacing: 1px;
    cursor: pointer; transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    white-space: normal; line-height: 1.3;
    border: 2px solid transparent;
    transform: scale(0.85); /* Pequeños por defecto */
}

/* El elemento ACTIVO es el que adopta el borde y fondo brillante, adaptándose a su contenido */
.roulette-item.active { 
    color: white; 
    transform: scale(1.1); 
    background: rgba(0,0,0,0.6);
    border-color: var(--primary);
    box-shadow: 0 0 25px rgba(255,0,85,0.4);
    backdrop-filter: blur(10px);
    text-shadow: 0 2px 10px rgba(0,0,0,0.8);
    opacity: 1;
}

/* Cuenta Regresiva */
#countdown-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: 100; pointer-events: none; display: flex; justify-content: center; align-items: center; }
.countdown-number { font-size: 15rem; font-weight: 900; color: white; text-shadow: 0 0 50px var(--primary); animation: zoomFade 0.9s cubic-bezier(0.25, 1, 0.5, 1) forwards; opacity: 0; transform: scale(0.5); }
@keyframes zoomFade { 0% { opacity: 0; transform: scale(0.5); } 50% { opacity: 1; transform: scale(1.2); } 100% { opacity: 0; transform: scale(1.5); } }

/* Botón Captura Gigante - ¡BLINDADO PARA CLICS! */
#capture-btn { 
    pointer-events: auto !important; 
    z-index: 100; 
    width: 100px; height: 100px; 
    border: 6px solid white; border-radius: 50%; 
    background: transparent; box-shadow: 0 0 40px rgba(0,0,0,0.5); 
    animation: pulseOuter 2.5s infinite; cursor: pointer; position: relative; 
}
#capture-btn::after { content: ''; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 75px; height: 75px; border-radius: 50%; background: white; transition: all 0.2s; }
#capture-btn:active { transform: scale(0.9); }
#capture-btn:active::after { background: var(--primary); }

@keyframes pulseOuter { 0% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.4); } 70% { box-shadow: 0 0 0 25px rgba(255, 255, 255, 0); } 100% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0); } }

/* 5. Cargador Épico (Pantalla de Espera) */
#loader-overlay { backdrop-filter: blur(30px); background: rgba(0,0,0,0.8); }
.epic-loader { position: relative; width: 300px; height: 300px; display: flex; justify-content: center; align-items: center; margin-bottom: 50px; }
.epic-ring { position: absolute; border-radius: 50%; border: 6px solid transparent; }
.epic-ring-1 { width: 100%; height: 100%; border-top-color: var(--primary); border-bottom-color: var(--primary); animation: spin 2s cubic-bezier(0.68, -0.55, 0.265, 1.55) infinite; box-shadow: 0 0 50px rgba(255,0,85,0.3); }
.epic-ring-2 { width: 75%; height: 75%; border-left-color: #00ffcc; border-right-color: #00ffcc; animation: spin 1.5s linear infinite reverse; }
.epic-ring-3 { width: 50%; height: 50%; border-top-color: white; animation: spin 3s linear infinite; }
.epic-core { width: 20%; height: 20%; background: var(--primary); border-radius: 50%; box-shadow: 0 0 30px var(--primary); animation: pulseOuter 1s alternate infinite; }
.epic-loader-text { font-size: 2rem; font-weight: 900; text-transform: uppercase; letter-spacing: 5px; text-shadow: 0 0 20px var(--primary); }

@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* 6. Resultado Pantalla Completa y Flotante */
.full-screen-result { 
    padding: 0 !important; 
    display: block; 
    background: #000 !important; 
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
    overflow: hidden;
}

#result-image { 
    position: absolute; top: 0; left: 0; width: 100vw; height: 100vh; 
    object-fit: contain !important; /* <--- ESTO MUESTRA LA FOTO COMPLETA */
    object-position: center !important; 
    z-index: 1; border-radius: 0; margin: 0; box-shadow: none; 
}

.floating-actions-container {
    position: absolute; bottom: 0; left: 0; width: 100vw; z-index: 10;
    padding: 200px 30px 50px 30px; /* Alto degradado para que se vean bien los botones */
    background: linear-gradient(to top, rgba(0,0,0,0.95) 0%, rgba(0,0,0,0.8) 50%, transparent 100%);
    display: flex; flex-direction: column; align-items: center; gap: 30px;
    pointer-events: auto !important; /* BLINDAJE INTERACTIVIDAD */
}

.qr-floating-box { display: flex; flex-direction: column; align-items: center; gap: 10px; color: white; }
.qr-floating-box img { width: 160px; height: 160px; border: 5px solid white; border-radius: 15px; box-shadow: 0 10px 30px rgba(0,0,0,0.5); }
.qr-floating-box span { font-size: 1.1rem; font-weight: bold; text-transform: uppercase; letter-spacing: 2px; text-shadow: 0 2px 10px black; }

.main-actions-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; width: 100%; max-width: 600px; }
.giant-btn { padding: 25px; font-size: 1.3rem; border-radius: 20px; box-shadow: 0 10px 20px rgba(0,0,0,0.4); display: flex; justify-content: center; align-items: center; gap: 10px; font-weight: bold; border: none; cursor: pointer; color: white; transition: transform 0.1s;}
.giant-btn:active { transform: scale(0.95); }
.wa-btn { background: var(--whatsapp); }
.print-btn { background: rgba(255,255,255,0.2); border: 2px solid white; backdrop-filter: blur(5px); }
.retry-btn { background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.3); backdrop-filter: blur(5px); }

/* 7. Ajustes Numpad WhatsApp (RESTAURADOS AL 100%) */
.numpad-box { background: rgba(20, 20, 20, 0.95); backdrop-filter: blur(20px); padding: 40px; border-radius: 30px; width: 90%; max-width: 500px; text-align: center; border: 1px solid rgba(255,255,255,0.1); box-shadow: 0 30px 60px rgba(0,0,0,0.8); pointer-events: auto !important;}
.phone-display { width: 100%; padding: 25px; background: #000; border: 2px solid #333; border-radius: 20px; color: white; font-size: 2.5rem; text-align: center; letter-spacing: 5px; margin-bottom: 30px; height: 90px; display: flex; align-items: center; justify-content: center; font-weight: bold; overflow: hidden; }
.phone-display .placeholder { color: #555; font-size: 1.5rem; letter-spacing: 2px; }

/* FORZAR LA CUADRÍCULA DEL TECLADO PARA EVITAR QUE SE APLASTEN */
.numpad-grid { 
    display: grid !important; 
    grid-template-columns: repeat(3, 1fr) !important; 
    gap: 15px !important; 
    margin-bottom: 30px; 
    width: 100%;
}
.num-key { background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1); color: white; font-size: 2.2rem; font-weight: bold; padding: 25px 0; border-radius: 20px; cursor: pointer; transition: all 0.1s; display: flex; justify-content: center; align-items: center;}
.num-key:active { background: var(--primary); transform: scale(0.95); }
.del-key { background: rgba(255, 50, 50, 0.2); color: #ff5555; }
.del-key:active { background: #ff5555; color: white; }
.cancel-key { background: rgba(255, 255, 255, 0.1); font-size: 1.5rem; color: #aaa; }

.giant-send-btn { width: 100%; font-size: 1.6rem; padding: 30px; border-radius: 20px; margin-top: 15px; background: var(--whatsapp); color: white; border: none; font-weight: bold; cursor: pointer; transition: opacity 0.3s;}
.giant-send-btn:disabled { opacity: 0.3; pointer-events: none; }


/* --- ADAPTACIONES PARA EL MODO HORIZONTAL (NUEVO) --- */
#app.is-horizontal #camera-feed {
    object-fit: contain; /* Evita que la cámara se corte en la pantalla vertical */
    background: #000;
}

#app.is-horizontal .hud-frame {
    width: 90vw; 
    height: calc(90vw * 9 / 16); /* Calcula exactamente la proporción 16:9 basada en el ancho de la pantalla */
    max-height: none;
    margin-top: 5vh; /* Ajuste visual para centrar */
}