/* Reseteo y configuración básica */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
    width: 100%;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    touch-action: manipulation;
    -ms-touch-action: manipulation;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    overflow: hidden;
    -webkit-text-size-adjust: 100%; /* Prevenir ajuste automático de texto */
    -moz-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

/* Contenedor principal */
.app-container {
    display: none; /* Inicialmente oculto */
    flex-direction: column;
    height: 100%;
    width: 100%;
    background: linear-gradient(135deg, #2575fc 0%, #6a11cb 100%); /* Gradiente invertido respecto a la pantalla inicial */
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* Cabecera */
header {
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
    padding: 15px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 600px;
    margin: 0 auto;
    width: 100%;
}

h1 {
    font-size: 1.8rem;
    margin: 0;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.character-button {
    background: white;
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 30px;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    transition: transform 0.3s, box-shadow 0.3s;
}

.character-button:hover,
.character-button:active {
    transform: translateY(-3px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.4);
}

/* Contenido principal */
main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 20px;
}

/* Área del personaje */
#pet-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px 0;
}

#character-container {
    margin-bottom: 20px;
}

#character-circle {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    background-color: white;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.25);
    position: relative;
    transition: transform 0.3s ease;
    animation: float 3s ease-in-out infinite;
    cursor: pointer;
    overflow: visible;
}

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

#character-emoji {
    font-size: 80px;
}

/* Área de estado y transcripción */
#status-area {
    text-align: center;
    margin: 15px 0;
    padding: 0 20px;
    color: white;
}

#status {
    font-weight: bold;
    font-size: 1.2rem;
    margin-bottom: 15px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.transcript {
    background-color: rgba(255, 255, 255, 0.9);
    border-radius: 15px;
    padding: 15px;
    margin: 10px 0;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    color: #333;
    font-size: 1.1rem;
    min-height: 50px;
    max-height: 150px;
    overflow-y: auto;
    word-wrap: break-word;
}

/* Contenedor del micrófono */
#mic-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin-top: auto;
    padding: 20px 0 30px;
}

.mic-button {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(145deg, #ff3a76, #ff7676);
    border: none;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
    -webkit-user-select: none; /* Safari */
    -moz-user-select: none; /* Firefox */
    -ms-user-select: none; /* IE10+/Edge */
    user-select: none; /* Standard */
    touch-action: manipulation; /* Prevenir comportamientos táctiles predeterminados */
}

.mic-button:hover {
    transform: scale(1.05);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

.mic-button.listening {
    animation: pulse-mic 1.5s infinite;
    background: linear-gradient(145deg, #4CAF50, #2E7D32); /* Verde */
}

@keyframes pulse-mic {
    0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(46, 125, 50, 0.7); }
    70% { transform: scale(1.1); box-shadow: 0 0 0 15px rgba(46, 125, 50, 0); }
    100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(46, 125, 50, 0); }
}

.mic-icon {
    font-size: 40px;
    color: white;
    pointer-events: none; /* Evita que el ícono sea seleccionable */
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* Modal de selección de personajes */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 100;
    overflow: auto;
}

.modal-content {
    background-color: white;
    margin: 10% auto;
    padding: 20px;
    border-radius: 10px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    position: relative;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-header h2 {
    margin: 0;
    color: #4a6fa5;
    font-size: 20px;
}

.close-modal {
    font-size: 24px;
    cursor: pointer;
    color: #aaa;
}

.close-modal:hover {
    color: #333;
}

.character-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
}

@media (max-width: 500px) {
    .character-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.character-option {
    width: 100%;
    aspect-ratio: 1/1;
    border-radius: 50%;
    background-color: #f0f8ff;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 30px;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease;
}

.character-option:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.character-option.selected {
    border: 3px solid #4a6fa5;
}

/* Estilos para el tutorial */
.tutorial-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.tutorial-content {
    background-color: white;
    padding: 20px;
    border-radius: 10px;
    max-width: 90%;
    max-height: 90%;
    overflow-y: auto;
}

.tutorial-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.tutorial-header h2 {
    color: #4a6fa5;
    margin: 0;
}

.close-tutorial {
    font-size: 24px;
    cursor: pointer;
    color: #666;
}

.tutorial-section {
    margin-bottom: 20px;
}

.tutorial-section h3 {
    color: #4a6fa5;
    margin-bottom: 10px;
}

.tutorial-buttons {
    display: flex;
    justify-content: space-between;
    margin-top: 20px;
}

.tutorial-button {
    background-color: #4a6fa5;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 5px;
    cursor: pointer;
}

.tutorial-button:hover {
    background-color: #3a5a8a;
}

.tutorial-button.secondary {
    background-color: #ccc;
    color: #333;
}

.tutorial-button.secondary:hover {
    background-color: #bbb;
}

/* Botón de ayuda */
.help-button {
    background: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 20px;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

/* Mensaje inicial */
.initial-message {
    text-align: center;
    background-color: #4a6fa5;
    color: white;
    padding: 10px;
    border-radius: 10px;
    margin: 10px auto;
    max-width: 80%;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* Estilos para la pantalla de selección inicial */
.initial-selection-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    height: 100vh;
    width: 100%;
    background: linear-gradient(135deg, #6a11cb 0%, #2575fc 100%);
    padding: 15px;
    box-sizing: border-box;
    overflow: hidden;
}

.initial-header {
    text-align: center;
    margin-bottom: 15px;
    color: white;
}

.initial-header h1 {
    font-size: 2rem;
    margin-bottom: 5px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.initial-subtitle {
    font-size: 1.1rem;
    color: rgba(255,255,255,0.9);
    margin-top: 5px;
}

/* Contenedor con scroll interno si es necesario */
.initial-character-container {
    width: 100%;
    max-width: 600px;
    flex: 1;
    overflow-y: auto;
    padding: 5px;
    margin-bottom: 10px;
    -webkit-overflow-scrolling: touch;
}

.initial-character-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    width: 100%;
    padding: 5px;
}

.character-option.initial {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background-color: white;
    border-radius: 12px;
    padding: 12px;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    transition: transform 0.3s, box-shadow 0.3s;
    min-height: 100px;
}

.character-option.initial:hover,
.character-option.initial:active {
    transform: translateY(-5px);
    box-shadow: 0 12px 25px rgba(0,0,0,0.25);
}

.character-emoji-large {
    font-size: 2.8rem;
    margin-bottom: 8px;
}

.character-name {
    font-size: 0.9rem;
    font-weight: bold;
    color: #333;
}

/* Ajustes para pantallas muy pequeñas */
@media (max-height: 600px) {
    .initial-character-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .character-emoji-large {
        font-size: 2.2rem;
        margin-bottom: 5px;
    }
    
    .character-name {
        font-size: 0.8rem;
    }
    
    .character-option.initial {
        min-height: 80px;
        padding: 8px;
    }
}

/* Ajustes para pantallas muy anchas */
@media (min-width: 768px) {
    .initial-character-grid {
        grid-template-columns: repeat(5, 1fr);
        max-width: 800px;
    }
}

/* Contenedor para los botones del header */
.header-buttons {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Botón de modo eco */
.echo-button {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 20px;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    color: white;
}

.echo-button:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

.echo-button.active {
    background: #4CAF50;
    color: white;
    animation: pulse-echo 2s infinite;
}

@keyframes pulse-echo {
    0% { box-shadow: 0 0 0 0 rgba(76, 175, 80, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(76, 175, 80, 0); }
    100% { box-shadow: 0 0 0 0 rgba(76, 175, 80, 0); }
}

/* Estilo para el botón del micrófono deshabilitado */
.mic-button.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: linear-gradient(145deg, #cccccc, #999999);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    transform: none;
}

.mic-button.disabled:hover {
    transform: none;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

/* Bocadillo de sugerencias - Ajuste de posición */
.suggestion-bubble {
    position: absolute;
    bottom: 135px; /* Aumentado de 100px a 120px para elevarlo más */
    left: 50%;
    transform: translateX(-50%) scale(0.9);
    background-color: #f7e2a9;
    border-radius: 15px;
    padding: 15px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
    width: 280px;
    max-width: 90%;
    opacity: 0;
    transition: all 0.3s ease;
    pointer-events: none;
    z-index: 100;
}

.suggestion-bubble:after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-top: 10px solid white;
}

.suggestion-bubble.visible {
    opacity: 1;
    transform: translateX(-50%) scale(1);
    pointer-events: auto;
}

.suggestion-title {
    font-weight: bold;
    margin-bottom: 10px;
    color: #4a6fa5;
    text-align: center;
}

.suggestion-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.suggestion-item {
    padding: 8px 12px;
    margin-bottom: 5px;
    background-color: #f0f8ff;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    text-align: center;
}

.suggestion-item:hover {
    background-color: #e0f0ff;
}

.suggestion-item:last-child {
    margin-bottom: 0;
}

/* Instrucción para el micrófono */
.mic-instruction {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.8);
    text-align: center;
    margin-top: 10px;
    font-weight: 500;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* Asegurar que todos los elementos interactivos tengan el comportamiento táctil adecuado */
button, a, input, select, textarea, [role="button"] {
    touch-action: manipulation;
    -ms-touch-action: manipulation;
}

/* Prevenir selección de texto en toda la aplicación */
* {
    -webkit-tap-highlight-color: transparent; /* Eliminar el resaltado al tocar */
}

/* Estilos para los emojis flotantes */
.floating-emoji {
    position: fixed;
    z-index: 50;
    pointer-events: none;
    opacity: 1;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
    will-change: transform, opacity;
}

/* Añadir un efecto sutil al hacer hover sobre el emoji principal */
#character-circle:hover {
    transform: scale(1.05);
}

/* Efecto al hacer clic en el emoji principal */
#character-circle:active {
    transform: scale(0.95);
    transition: transform 0.1s;
} 