:root {
    /* Colores Core de la Marca */
    --bg-base: #E8E5D9;
    --bg-surface: #F4F1E1;
    --color-red: #CC3300;
    --color-blue: #336699;
    --color-yellow: #CC9900;
    --text-main: #1A1A1A;
    --text-dim: #666666;
    --border-heavy: #1A1A1A;

    /* Mapeo para la estructura de la App */
    --bg-color: var(--bg-base);
    --text-primary: var(--text-main);
    --text-secondary: var(--text-dim);
    --accent-primary: var(--color-red);
    --error-color: var(--color-red);
    --success-color: var(--color-blue);
    /* Usamos el azul corporativo para los aciertos */
    --radius-md: 12px;
    --border-thickness: 3px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: "dunkel-sans-cond-rounded", sans-serif;
    font-weight: 700; /* Prueba con 400 (normal), 700 (bold) o 900 (black) */
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    width: 100%;
    height: 100dvh;
    position: fixed;
    inset: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

body {
    background-color: var(--bg-base);
    color: var(--text-primary);
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    line-height: 1.2;
    background-image: radial-gradient(circle, rgba(0,0,0,0.25) 1px, transparent 1px);
    background-size: 20px 20px;
}

.screen {
    width: 100%;
    max-width: 480px;
    padding: 20px;
    padding-top: calc(20px + env(safe-area-inset-top));
    text-align: center;
}

.hidden {
    display: none !important;
}

/* Clase para reservar espacio sin afectar la estructura y evitar clics */
.invisible {
    visibility: hidden !important;
    opacity: 0;
    pointer-events: none;
}

.game-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
    font-weight: bold;
    color: var(--text-secondary);
}

.song-metadata {
    font-size: 0.9rem;
    color: var(--text-primary);
    /* Cambiamos a negro oscuro para mejor lectura */
    margin-bottom: 10px;
    font-style: normal;
    /* Adiós a la cursiva */
    font-weight: 900;
    /* Hola al grosor "Cómic" del resto de la app */
    text-transform: uppercase;
    /* Mayúsculas para darle formato de etiqueta oficial */
    letter-spacing: 1px;
    /* Un pequeño respiro entre letras */
}

.translation-text {
    font-size: 1.5rem;
    color: var(--text-primary);
    margin: 10px 0 30px 0;
    min-height: 3em;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    line-height: 1.4;
    font-weight: 700;
}

/* NUEVA CLASE: Resaltado dinámico desde JS */
.highlight-guide {
    color: var(--color-yellow);
    font-weight: 900;
    border-bottom: 2px dashed var(--color-yellow);
    padding: 0 2px;
}

.drop-zone-container,
.tiles-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-content: center;
    align-items: center;
    gap: 10px;
    min-height: 140px;
    max-height: 160px;
    overflow-y: hidden;
    box-sizing: border-box;
    margin: 5px 0;
    padding: 15px;
    background-color: var(--bg-base);
    border: 1px dashed var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    transition: min-height 0.2s ease;
}

/* Compresión progresiva: cuando la letra o la traducción son largas,
   todo el bloque se achica en conjunto para que jamás haga falta scroll. */
.game-board.compact-md .translation-text {
    font-size: 1.25rem;
    margin: 8px 0 18px 0;
    min-height: 2.2em;
}
.game-board.compact-md .word-visible {
    font-size: 1.1rem;
}
.game-board.compact-md .drop-zone {
    font-size: 0.95rem;
    height: 34px;
    min-width: 58px;
}
.game-board.compact-md .tile-btn {
    font-size: 0.95rem;
    padding: 8px 14px;
}
.game-board.compact-md .drop-zone-container,
.game-board.compact-md .tiles-container {
    gap: 6px;
    padding: 10px;
}

.game-board.compact-sm .translation-text {
    font-size: 1.05rem;
    margin: 6px 0 12px 0;
    min-height: 1.8em;
}
.game-board.compact-sm .word-visible {
    font-size: 0.95rem;
}
.game-board.compact-sm .drop-zone {
    font-size: 0.85rem;
    height: 30px;
    min-width: 50px;
}
.game-board.compact-sm .tile-btn {
    font-size: 0.85rem;
    padding: 6px 12px;
}
.game-board.compact-sm .drop-zone-container,
.game-board.compact-sm .tiles-container {
    gap: 5px;
    padding: 8px;
}

/* --- TABLERO Y HUECOS DE JUEGO (ESTILO CÓMIC) --- */
.drop-zone {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    min-width: 70px;
    max-width: 140px;
    height: 40px;
    border: 2px dashed var(--text-secondary);
    border-radius: 8px;
    margin: 0 4px;
    background: rgba(0, 0, 0, 0.05);
    font-weight: 900;
    font-size: 1.1rem;
    transition: all 0.2s ease;
}

.drop-zone.filled {
    border: var(--border-thickness) solid var(--border-heavy);
    border-bottom: 10px solid var(--border-heavy);
    background-color: var(--color-yellow);
    color: var(--text-primary);
    border-style: solid;
}

.drop-zone.success {
    background-color: var(--color-blue);
    color: white;
    border-color: var(--border-heavy);
}

.drop-zone.error {
    background-color: var(--color-red);
    color: white;
    border-color: var(--border-heavy);
    animation: shake 0.4s ease-in-out;
}

.word-visible {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.5;
}

.game-board.compact-md .word-wheel,
.game-board.compact-md .word-wheel-item {
    font-size: 1.1rem;
}
.game-board.compact-sm .word-wheel,
.game-board.compact-sm .word-wheel-item {
    font-size: 0.95rem;
}

/* --- RUEDA DE SELECCIÓN ESTILO iOS (Modo Clásico - nuevo sistema) --- */
/* --- RUEDA DE SELECCIÓN ESTILO iOS (Modo Clásico - nuevo sistema) --- */
.word-wheel.hint-scrolling {
    scroll-snap-type: none;
}

.word-wheel {
    display: inline-flex;
    flex-direction: column;
    width: auto;
    min-width: 70px;
    max-width: 140px;
    height: 1.4em;
    overflow-y: scroll;
    scroll-snap-type: y mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
    margin: 0 4px;
    vertical-align: middle;
    background: transparent;
    border: none;
}

.word-wheel::-webkit-scrollbar {
    display: none;
}

.word-wheel-item {
    height: 1.4em;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    scroll-snap-align: start;
    scroll-snap-stop: always;
    font-weight: 700;
    font-size: 1.3rem;
    color: var(--text-primary);
    background-color: var(--color-yellow);
    border-radius: 6px;
    padding: 0 4px;
    white-space: nowrap;
}

.word-wheel.success .word-wheel-item {
    background-color: var(--color-blue);
    color: white;
}

.word-wheel.error .word-wheel-item {
    background-color: var(--color-red);
    color: white;
    animation: shake 0.4s ease-in-out;
}

/* --- BOTONES Y FICHAS (ESTILO CÓMIC UNIFICADO) --- */
.btn-auth,
.btn-lang,
.tile-btn,
.guest-start {
    background-color: var(--bg-surface);
    color: var(--text-primary);
    font-weight: 900;
    font-size: 1.1rem;
    padding: 12px 10px;
    border: var(--border-thickness) solid var(--border-heavy);
    border-bottom: 6px solid var(--border-heavy);
    border-radius: 255px 15px 225px 15px / 15px 225px 15px 255px;
    cursor: pointer;
    transition: transform 0.1s, border-width 0.1s;
    text-align: center;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    width: 100%;
    /* Aplica para los de Auth */
}

/* Ajuste específico para que las fichas y langs no ocupen el 100% */
.tile-btn,
.btn-lang {
    width: auto;
}

.btn-auth:active,
.btn-lang:active,
.tile-btn:active,
.guest-start:active {
    transform: translateY(3px);
    border-bottom-width: var(--border-thickness);
}

.btn-lang.selected,
#btn-google {
    background-color: var(--color-red);
    color: white;
}

.guest-start {
    background-color: var(--color-blue);
    color: white;
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    20%,
    60% {
        transform: translateX(-4px);
    }

    40%,
    80% {
        transform: translateX(4px);
    }
}

/* =========================================
   DÍA 10: RESPONSIVIDAD Y AJUSTES MÓVILES
========================================= */

@media (max-width: 480px) {
.screen {
    padding: 15px 20px; /* Aumentamos el padding lateral para evitar que toque los bordes */
    padding-top: calc(5px + env(safe-area-inset-top));
    padding-bottom: calc(20px + env(safe-area-inset-bottom));
}

    .translation-text {
        font-size: 1.3rem;
        margin: 5px 0 20px 0;
        padding: 0 10px; /* Respiro lateral extra para la frase */
    }

    .drop-zone-container,
    .tiles-container {
        width: 94%; /* Evitamos que ocupe el 100% del espacio */
        min-height: 10px; /* Mantenemos el espacio reservado también en móvil */
        margin: 5px auto; /* Lo centramos automáticamente */
        padding: 12px 5px;
        gap: 6px;
        /* Reducimos el gap para que quepan 5 huecos en móviles */
    }

    .drop-zone {
        min-width: 60px;
        height: 10px;
        font-size: 1rem;
    }

   .word-visible {
        font-size: 1rem;
    }

        .word-wheel,
    .word-wheel-item {
        font-size: 1rem;
        height: 1.4em;
    }

    .tile-btn {
        padding: 10px 16px;
        font-size: 1rem;
        margin-bottom: 2px;
    }
}

/* Ajuste crítico de altura (Evita que el juego se rompa si la pantalla es muy chata) */
@media (max-height: 650px) {
    body {
        align-items: flex-start;
        /* Anula el center vertical para poder scrollear si es necesario */
        padding-top: 15px;
    }

    .translation-text {
        min-height: 2.8em;
        display: flex;
        align-items: center;
        justify-content: center;
        margin-bottom: 10px;
    }
}

/* =========================================
   DÍA 13: TOAST NOTIFICATION Y GAME OVER
========================================= */

.toast {
    position: fixed;
    right: -200px;
    /* Oculto fuera de la pantalla */
    top: 20px;
    background-color: var(--bg-elevated);
    color: var(--text-primary);
    padding: 15px 25px;
    border-left: 4px solid var(--success-color);
    border-radius: var(--radius-md) 0 0 var(--radius-md);
    box-shadow: -4px 4px 12px rgba(0, 0, 0, 0.4);
    font-weight: bold;
    font-size: 1.1rem;
    transition: right 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 1000;
}

.toast.show {
    right: 0;
    /* Desliza hacia adentro */
}

.toast.level-down {
    border-left-color: var(--error-color);
}

.final-streak {
    margin: 30px 0;
    font-size: 1.5rem;
    color: var(--accent-primary);
}

/* =========================================
   DÍA 16: PANTALLA UNIFICADA ONBOARDING
========================================= */
.logo-container h1 {
    font-size: 2.6rem; /* Hacemos el título más imponente para llenar el espacio superior */
}

.onboarding-flow {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 60px;       /* Aumentamos al doble la separación entre los pasos 1 y 2 */
    margin-top: 50px; /* Separamos más las opciones del título principal */
}

.step-title {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Fila de idiomas (Horizontal) */
.lang-row {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.lang-row .btn-lang {
    flex: 1;
    /* Para que midan lo mismo */
    padding: 12px;
    border: 2px solid var(--border-color);
    background-color: var(--bg-surface);
    color: var(--text-muted);
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
}

/* El idioma seleccionado brilla */
.lang-row .btn-lang.selected {
    border-color: var(--accent-primary);
    color: var(--text-primary);
    background-color: rgba(226, 54, 112, 0.1);
}

/* Botones de Acceso */
.auth-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
}

.btn-auth.google {
    background-color: #ffffff;
    color: #333333;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.btn-auth.google .g-icon {
    color: #4285F4;
    font-size: 1.2rem;
}

/* --- Formulario Integrado de Invitado --- */
.guest-input {
    width: 100%;
    padding: 14px;
    border-radius: var(--radius-md);
    border: 2px solid var(--border-color);
    background-color: var(--bg-surface);
    color: var(--text-primary);
    font-size: 1.05rem;
    text-align: center;
    outline: none;
    transition: border-color 0.2s;
}

.guest-input:focus {
    border-color: var(--accent-primary);
}

.btn-auth.guest-start {
    background-color: var(--accent-primary);
    color: white;
}


#btn-next-song {
    background-color: var(--color-yellow);
    color: var(--text-primary);
}

#btn-next-song[data-mode="advance"] {
    background-color: var(--color-blue);
    color: white;
}

/* =========================================
   DÍA 18: LEADERBOARD ITEMS
========================================= */
.lb-item {
    display: flex;
    justify-content: space-between;
    padding: 12px 10px;
    border-bottom: 1px solid var(--border-color);
    font-size: 1.1rem;
    color: var(--text-primary);
}

.lb-item:last-child {
    border-bottom: none;
}

.lb-item.top-1 {
    color: #FFD700;
    font-weight: 900;
    transform: scale(1.05);
}

/* Oro */
.lb-item.top-2 {
    color: #C0C0C0;
    font-weight: bold;
}

/* Plata */
.lb-item.top-3 {
    color: #CD7F32;
    font-weight: bold;
}

/* Bronce */

/* =========================================
   DÍA 20: MODO OFFLINE
========================================= */
.offline-banner {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background-color: var(--color-red);
    color: white;
    text-align: center;
    padding: 8px;
    font-size: 0.9rem;
    font-weight: bold;
    z-index: 3000;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    transform: translateY(0);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

.offline-banner.hidden-offline {
    transform: translateY(-150%);
}

/* --- BOTÓN LEADERBOARD SUPERIOR --- */
.btn-lb-top {
    display: flex;
    align-items: center;
    gap: 6px;
    background-color: var(--color-yellow);
    color: var(--text-primary);
    font-weight: 900;
    font-size: 0.85rem;
    padding: 6px 12px;
    border: var(--border-thickness) solid var(--border-heavy);
    border-bottom: 4px solid var(--border-heavy);
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.1s, border-width 0.1s;
    text-transform: uppercase;
}

.btn-lb-top:active {
    transform: translateY(2px);
    border-bottom-width: var(--border-thickness);
}

.trophy-icon {
    width: 16px;
    height: 16px;
}

/* =========================================
   DÍA 23: BOTÓN DE AUDIO (AYUDA)
========================================= */
.btn-audio-clue {
    background-color: var(--color-blue);
    width: 38px;
    /* <-- Reducido a dieta */
    height: 38px;
    /* <-- Reducido a dieta */
    border-radius: 50%;
    border: 2px solid var(--border-heavy);
    /* <-- Borde más fino proporcional al tamaño */
    border-bottom: 4px solid var(--border-heavy);
    /* <-- Sombra inferior reducida */
    cursor: pointer;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    transition: transform 0.1s, border-width 0.1s, background-color 0.3s;
    -webkit-tap-highlight-color: transparent;
}

.btn-audio-clue:active:not(:disabled) {
    transform: translateY(3px);
    border-bottom-width: var(--border-thickness);
}

/* Estado bloqueado temporalmente (Cargando o Reproduciendo) */
.btn-audio-clue:disabled {
    cursor: wait;
    opacity: 0.9;
}

/* NUEVO: Forzar reducción de los íconos SVG y textos internos */
.btn-audio-clue svg {
    width: 18px !important;
    height: 18px !important;
}

#audio-icon-load {
    font-size: 1rem !important;
    letter-spacing: 1px !important;
}

#audio-error-text {
    font-size: 0.7rem !important;
}

/* Animación sutil para los puntos de carga */
@keyframes pulse-load {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.4;
    }
}

#audio-icon-load {
    animation: pulse-load 1s infinite ease-in-out;
}

/* Estado del botón cuando el audio falla (Día 1) */
.btn-audio-unavailable {
    display: inline-flex;
    align-items: center;
    background-color: var(--color-blue) !important;
    /* Mantener color de audio */
    color: white !important;
    font-weight: 900;
    font-size: 0.75rem !important;
    padding: 0 15px !important;
    border: var(--border-thickness) solid var(--border-heavy) !important;
    border-bottom: 4px solid var(--border-heavy) !important;
    border-radius: 8px !important;
    /* Forma rectangular como el Premium */
    text-transform: uppercase;
    cursor: default;
    width: auto !important;
    height: 38px !important;
    box-sizing: border-box !important;}

/* Animación de vibración (Shake) */
@keyframes shake {
    0% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-8px);
    }

    50% {
        transform: translateX(8px);
    }

    75% {
        transform: translateX(-8px);
    }

    100% {
        transform: translateX(0);
    }
}

/* Clase que aplicaremos cuando haya error */
.input-error {
    border: 2px solid #CC3300 !important;
    animation: shake 0.4s ease-in-out;
}

/* Estilo del mensajito debajo del input */
.error-helper {
    color: #CC3300;
    font-size: 0.8rem;
    font-weight: bold;
    margin-top: 5px;
    display: block;
}

/* =========================================
   MÓDULO DE ESTUDIO (FLASHCARDS 3D)
========================================= */

/* Ajuste del nuevo Header en 3 columnas */
.header-col {
    flex: 1;
}
.header-col.center {
    text-align: center;
}
.header-col.right {
    text-align: right;
}

/* Contenedor principal de la tarjeta */
.flashcard {
    background-color: transparent;
    width: 140px; 
    height: 48px; /* Altura unificada solicitada */
    perspective: 1000px; 
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

/* Capa interna que gira */
.flashcard-inner {
    position: relative;
    width: 100%;
    height: 100%;
    text-align: center;
    transition: transform 0.5s cubic-bezier(0.4, 0.2, 0.2, 1);
    transform-style: preserve-3d;
}

/* Rotación al agregar la clase 'flipped' desde JS */
.flashcard.flipped .flashcard-inner {
    transform: rotateY(180deg);
}

/* Caras de la tarjeta (Frente y Dorso) */
.flashcard-front, .flashcard-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden; 
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 8px;
    font-weight: 900;
    font-size: 1rem;
    border: 3px solid var(--text-main);
    border-bottom: 6px solid var(--text-main); 
    transition: border-color 0.3s, color 0.3s;
}

/* Diseño del Frente (Beige y Negro) */
.flashcard-front {
    background-color: var(--bg-base);
    color: var(--text-main);
}

/* Diseño del Dorso (Beige y Negro, inicia girado) */
.flashcard-back {
    background-color: var(--bg-base);
    color: var(--text-main);
    transform: rotateY(180deg); 
}

/* --- ESTADOS DE VALIDACIÓN --- */
.flashcard.correct .flashcard-front,
.flashcard.correct .flashcard-back {
    border-color: var(--color-blue);
    border-bottom-color: var(--color-blue);
    color: var(--color-blue);
}

.flashcard.incorrect .flashcard-front,
.flashcard.incorrect .flashcard-back {
    border-color: var(--color-red);
    border-bottom-color: var(--color-red);
    color: var(--color-red);
}

.flashcard.processing .flashcard-front,
.flashcard.processing .flashcard-back {
    border-color: var(--color-yellow);
    border-bottom-color: var(--color-yellow);
}

/* --- ANIMACIÓN AL GUARDAR UNA PALABRA --- */
@keyframes pop-save {
    0% { transform: scale(1); }
    50% { transform: scale(1.15); color: var(--color-yellow); border-color: var(--color-yellow); }
    100% { transform: scale(1); }
}

.word-saved {
    animation: pop-save 0.4s ease-out forwards;
    pointer-events: none; 
}

/* Altura unificada de fichas según Mapa de Ruta */
.tile-btn, .drop-zone {
    height: 48px !important; 
}

/* =========================================================
   PANTALLA DE CARGA (SPLASH SCREEN)
   ========================================================= */
#splash-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: var(--bg-base, #F3EFE6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.5s ease-in-out;
}

#splash-screen svg {
    width: 200px;
    height: auto;
}

/* Animación inyectada a la caja principal */
.logo-vector {
    color: #cc9900; /* Inicia en el Amarillo oficial */
    fill-rule: evenodd;
    animation: cicloColores 1s ease-in-out forwards;
}

/* Transición con los colores exactos */
@keyframes cicloColores {
    0%   { color: #cc9900; } 
    50%  { color: #cc3300; } 
    100% { color: #336699; } 
}

/* Clase de apoyo para ocultar la app al inicio */
.oculto {
    display: none !important;
}

/* =========================================
   HUB: MENÚ PRINCIPAL Y LOOP DE COLORES
========================================= */
.menu-logo-container {
    width: 180px;
    margin: 40px auto 50px auto; /* 40px arriba para bajarlo, 50px abajo para separarlo del saludo */
    display: flex;
    justify-content: center;
}

.logo-vector-infinite {
    width: 100%;
    height: auto;
    fill: currentColor; /* Hereda el color de la animación */
    animation: colorLoop 4s infinite alternate ease-in-out;
}

/* Loop infinito entre Amarillo Dorado, Rojo Oscuro y Azul Profundo */
@keyframes colorLoop {
    0% { color: #CC9900; }   
    50% { color: #cc3300; }  
    100% { color: #336699; } 
}

@keyframes strokeLoop {
    0% { stroke: #000000; }
    50% { stroke: #ffffff; }
    100% { stroke: #ffffff; }
}

.menu-grid {
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 100%;
}

.menu-section-box {
    background: var(--bg-surface);
    padding: 20px 15px;
    border-radius: var(--radius-md);
    border: 2px dashed var(--border-heavy);
    box-shadow: 4px 4px 0px rgba(0,0,0,0.1);
    text-align: center;
}

/* Ajuste para los subtítulos de los botones de estudio */
#btn-menu-flashcards small,
#btn-menu-glossary small {
    display: block;
    font-size: 0.75rem;
    font-weight: 700;
    margin-top: 4px;
    opacity: 0.8;
}

/* --- ALERTA VISUAL: SELECCIÓN DE IDIOMA --- */
@keyframes shake-yellow {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-6px); }
    40%, 80% { transform: translateX(6px); }
}

.lang-alert-yellow {
    animation: shake-yellow 0.4s ease-in-out;
    border-color: var(--color-yellow) !important;
    color: var(--color-yellow) !important;
    background-color: rgba(204, 153, 0, 0.1) !important;
}

/* Iconos de Vida */
.life-icon {
    transition: filter 0.3s ease, transform 0.3s ease;
    filter: drop-shadow(2px 2px 0px rgba(0,0,0,0.1));
}

/* Efecto para vida perdida */
.life-icon.lost {
    filter: grayscale(100%) opacity(0.3);
    transform: scale(0.8);
}

/* --- PANTALLA DE CONNECT --- */
#screen-connect {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    height: 100%;
}

/* Tablero disperso de palabras (posiciones calculadas en JS: grid + jitter) */
.connect-board {
    position: relative;
    flex: 1;
    width: 100%;
    max-width: 350px;
    margin: 10px auto 0;
    min-height: 200px;
    overflow: hidden;
}

/* Líneas SVG dibujadas por el motor de gestos */
.connect-linea-viva,
.connect-linea-ok,
.connect-linea-error {
    stroke-linecap: round;
    stroke-width: 3;
}

.connect-linea-viva {
    stroke: var(--color-blue);
    opacity: 0.6;
}

.connect-linea-ok {
    stroke: var(--color-blue);
}

.connect-linea-error {
    stroke: var(--color-yellow);
}

/* Palabras dispersas — left/top son el CENTRO de cada palabra (calculado en JS) */
.connect-word {
    position: absolute;
    transform: translate(-50%, -50%);
    z-index: 2;
    background-color: var(--bg-surface);
    color: var(--text-primary);
    border: 2px solid var(--border-heavy);
    border-radius: 8px;
    padding: 6px 12px;
    font-weight: 900;
    font-size: 0.95rem;
    cursor: pointer;
    touch-action: none;
    user-select: none;
    white-space: nowrap;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.connect-word-hecha.connect-word-ok {
    background-color: var(--color-blue);
    color: white;
    border-color: var(--color-blue);
}

.connect-word-error {
    background-color: var(--color-yellow);
    color: white;
    border-color: var(--color-yellow);
    animation: connect-flash-error 0.4s;
}

@keyframes connect-flash-error {
    0%, 100% { transform: translate(-50%, -50%) scale(1); }
    50% { transform: translate(-50%, -50%) scale(1.1); }
}

/* Paleta de Colores Fija (Grid) */
.palette-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    padding: 15px;
    background-color: var(--bg-surface);
    border: var(--border-thickness) solid var(--border-heavy);
    border-radius: var(--radius-md);
    box-shadow: inset 0px 4px 0px rgba(0,0,0,0.1);
}

.color-swatch {
    width: 45px; /* Tamaño ajustado para caber mejor */
    height: 45px;
    border-radius: 50%;
    border: var(--border-thickness) solid var(--border-heavy);
    box-shadow: 0px 3px 0px var(--border-heavy);
    cursor: pointer;
    transition: transform 0.1s, box-shadow 0.1s;
    -webkit-tap-highlight-color: transparent;
}

.color-swatch:active {
    transform: translateY(3px);
    box-shadow: 0px 0px 0px var(--border-heavy);
}

/* Iconos Minimalistas en Pestañas */
.layers-row button.tab-layer {
    background: none;
    border: none;
    padding: 10px;
    opacity: 0.5;
    transition: all 0.2s ease;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.layers-row button.tab-layer.selected {
    opacity: 1;
    transform: scale(1.15);
}

.layers-row button.tab-layer .icon-ui {
    width: 32px;
    height: 32px;
    fill: var(--text-primary);
}

/* =========================================
   MINIJUEGO BACHATAMAN (WORD CLOCK)
========================================= */
.bachataman-board {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    padding: 10px 0;
    touch-action: none; /* Vital para evitar el scroll al arrastrar */
}

.circle-area {
    position: relative;
    width: 300px;
    height: 300px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.b-word-bubble {
    position: absolute;
    background: transparent;
    border: none;
    border-radius: 0;
    box-shadow: none;
    font-weight: 900;
    font-size: 1.1rem; 
    color: var(--color-blue);
    user-select: none;
    white-space: nowrap;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.bachataman-sprite {
    position: absolute;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: 3px solid var(--color-blue);
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: var(--bg-surface);
    z-index: 10;
    cursor: grab;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}

.bachataman-sprite:active {
    cursor: grabbing;
}

/* Efecto suave para cuando el jugador suelta al personaje */
.bachataman-sprite.returning {
    transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* --- ESTADOS DE VALIDACIÓN BACHATAMAN --- */
.b-word-bubble {
    transition: transform 0.3s ease, opacity 0.3s ease;
}

/* Cuando una palabra es recolectada con éxito */
.b-word-bubble.collected {
    transform: scale(0) !important;
    opacity: 0;
    pointer-events: none;
}

/* Cuando el hueco de la frase se llena */
.b-slot.filled {
    color: var(--color-blue);
    border-bottom-color: var(--color-blue);
}

/* Temblor de error al chocar con la palabra equivocada */
.bachataman-sprite.error-shake {
    animation: b-shake-error 0.4s ease-in-out;
    border-color: var(--color-red) !important;
    background-color: rgba(204, 51, 0, 0.1);
}

@keyframes b-shake-error {
    0%, 100% { transform: translate(0, 0); }
    20%, 60% { transform: translate(-8px, 0); }
    40%, 80% { transform: translate(8px, 0); }
}

/* --- SISTEMA DE CONSTRUCCIÓN DINÁMICA (SIN GUIONES) --- */
.b-slot-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    animation: b-pop-in 0.4s cubic-bezier(0.34, 1.56, 0.64, 1); /* Efecto de rebote al aparecer */
}

.b-slot {
    font-weight: 900;
    font-size: 1.2rem;
    color: var(--color-blue);
    padding: 0 4px;
    /* Adiós a los bordes y anchos mínimos */
}

.b-slot-translation {
    font-size: 0.85rem;
    color: var(--color-red);
    font-weight: 900;
}

@keyframes b-pop-in {
    0% { transform: scale(0.5); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

/* --- ANIMACIÓN ICONOS MATERIAL SYMBOLS --- */
.animated-back-icon {
    font-size: 1.2rem;
    vertical-align: middle;
    animation: colorLoop 4s infinite alternate ease-in-out;
}

/* --- ANIMACIÓN ICONOS GENÉRICA --- */
.animated-icon {
    font-size: 1.2rem;
    vertical-align: text-bottom;
    animation: colorLoop 4s infinite alternate ease-in-out;
}

/* --- INFO DE CANCIÓN Y FRASE EN CONNECT --- */
.connect-song-title {
    font-size: 1rem;
    font-weight: 900;
    color: var(--text-primary);
    margin: 0;
}

.connect-song-artist {
    font-size: 0.8rem;
    color: var(--text-dim);
    margin: 2px 0 0;
}

.connect-phrase-container {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--color-red);
    text-align: center;
    margin: 8px 0 4px;
    padding: 0 10px;
}

/* Animación de Batería Vacía para Bachataman */
@keyframes pulse-battery {
    0% { box-shadow: 0 0 0 0 rgba(204, 51, 0, 0.4); }
    70% { box-shadow: 0 0 0 15px rgba(204, 51, 0, 0); }
    100% { box-shadow: 0 0 0 0 rgba(204, 51, 0, 0); }
}

/* --- ANIMACIÓN DE CARGA BACHATAMAN --- */
.loading-b-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    height: 100%;
}

.loading-b-icon {
    width: 24px;
    height: 24px;
    opacity: 0;
    animation: b-loader-bounce 1.5s infinite ease-in-out, colorLoop 4s infinite alternate ease-in-out;
}

.loading-b-icon:nth-child(1) { animation-delay: 0s, 0s; }
.loading-b-icon:nth-child(2) { animation-delay: 0.2s, 0s; }
.loading-b-icon:nth-child(3) { animation-delay: 0.4s, 0s; }

@keyframes b-loader-bounce {
    0%, 100% { transform: scale(0.6); opacity: 0.3; }
    50% { transform: scale(1.1); opacity: 1; }
}

/* Clase para hacer el botón transparente durante la animación de carga */
.btn-transparent-loading {
    background-color: transparent !important;
    border-color: transparent !important;
    box-shadow: none !important;
}

/* --- TABLA COMPARATIVA PREMIUM --- */
.premium-comparison-table {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 15px;
}

.comp-col {
    flex: 1;
    background: var(--bg-surface);
    border: 2px solid var(--border-heavy);
    border-radius: var(--radius-md);
    padding: 15px 10px;
    text-align: left;
}

.comp-col.pro-col {
    border-color: var(--color-yellow);
    border-bottom: 5px solid var(--color-yellow);
    background: rgba(204, 153, 0, 0.05);
}

.tier-title {
    text-align: center;
    font-weight: 900;
    margin-bottom: 10px;
    color: var(--text-dim);
}

.tier-features {
    list-style: none;
    padding: 0;
    font-size: 0.85rem;
    font-weight: bold;
    color: var(--text-primary);
}

.tier-features li {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-bottom: 8px;
    line-height: 1.2;
}

.premium-footnote {
    font-size: 0.7rem;
    color: var(--text-dim);
    font-weight: bold;
    margin-bottom: 10px;
    text-align: left;
    line-height: 1.3;
}

/* --- FORZAR RENDERIZADO DE MATERIAL SYMBOLS --- */
.material-symbols-outlined {
    font-family: 'Material Symbols Outlined' !important;
    font-weight: normal !important;
    font-style: normal !important;
    font-size: 24px;
    line-height: 1;
    letter-spacing: normal;
    text-transform: none !important;
    display: inline-block;
    white-space: nowrap;
    word-wrap: normal;
    direction: ltr;
    font-feature-settings: 'liga' !important;
    -webkit-font-feature-settings: 'liga' !important;
    -webkit-font-smoothing: antialiased;
}

.legal-consent-text {
    font-size: 0.65rem;
    text-align: center;
    color: var(--text-dim);
    margin-top: 12px;
    padding: 0 10px;
    line-height: 1.4;
}

.legal-consent-text a {
    color: var(--color-blue);
    text-decoration: underline;
    font-weight: bold;
}

.legal-consent-text a:hover {
    color: var(--color-red);
}

/* =========================================================
   BLOQUEO DE SEGURIDAD PARA COMPUTADORAS DE ESCRITORIO
   ========================================================= */

/* 1. Por defecto (en celulares y tablets táctiles), la cortina está oculta */
#desktop-blocker {
    display: none;
}

/* 2. Si es una computadora (pantalla ancha + uso con ratón/trackpad) */
@media (min-width: 1025px) and (pointer: fine) {
    /* Mostramos la cortina de bloqueo cubriendo toda la pantalla */
    #desktop-blocker {
        display: flex;
        justify-content: center;
        align-items: center;
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        background-color: var(--bg-surface, #E8E5D9);
        z-index: 9999999; 
    }
    
    /* Ocultamos todo el contenido de la app para evitar interacciones */
    #app-content, 
    #splash-screen, 
    #pwa-custom-modal {
        display: none !important;
    }
    
    /* Desactivamos el scroll para que la pantalla quede estática */
    body {
        overflow: hidden !important;
    }
}

/* =========================================================
   BLOQUEO DE ORIENTACIÓN HORIZONTAL (SOLO TÁCTIL)
   ========================================================= */

/* 1. Por defecto, la cortina está oculta */
#rotate-blocker {
    display: none;
}

/* 2. Si es un dispositivo táctil en landscape (celular o tablet rotado) */
@media (orientation: landscape) and (pointer: coarse) {
    #rotate-blocker {
        display: flex;
        justify-content: center;
        align-items: center;
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        background-color: var(--bg-surface, #E8E5D9);
        z-index: 9999999;
    }

    /* Ocultamos todo el contenido de la app para evitar interacciones */
    #app-content,
    #splash-screen,
    #pwa-custom-modal {
        display: none !important;
    }

    /* Desactivamos el scroll */
    body {
        overflow: hidden !important;
    }
}