* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: #a7c7e7;
    min-height: 100vh;
    font-family: 'Segoe UI', Arial, sans-serif;
}

h1 {
    margin-bottom: 20px;
}

#message {
    width: 80%;
    max-width: 600px;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 5px;
    background-color: #fff;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

#talkButton {
    padding: 15px 30px;
    font-size: 18px;
    color: #fff;
    background-color: #007bff;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.2s;
}

#talkButton:active {
    transform: scale(0.95);
}

.listening {
    background-color: #28a745;
}

.not-listening {
    background-color: #dc3545;
}

.container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
    gap: 2rem;
}

/* Contenedor principal de la ventana estilo ilustración */
.window-illustration {
    position: relative;
    width: 650px;
    height: 520px;
}

/* Marco de la ventana */
.window-frame-border {
    position: relative;
    width: 520px;
    height: 520px;
    margin: 0 auto;
    background: #D4A574;
    border: 12px solid #8B6F47;
    border-radius: 12px 12px 8px 8px;
    box-shadow: 
        0 20px 50px rgba(0,0,0,0.3),
        inset 0 3px 8px rgba(255,255,255,0.3),
        inset 0 -3px 8px rgba(0,0,0,0.2);
    padding: 15px;
}

/* Área de visualización interior */
.window-view {
    position: relative;
    width: 100%;
    height: 100%;
    background: linear-gradient(180deg, #A8D8EA 0%, #E8F6F8 100%);
    border: 5px solid #8B6F47;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 
        inset 0 0 30px rgba(0,0,0,0.1),
        0 5px 15px rgba(0,0,0,0.2);
}

/* Hojas de la ventana abiertas */
.window-shutter {
    position: absolute;
    width: 150px;
    height: 500px;
    top: 10px;
    background: linear-gradient(135deg, #B8956A 0%, #D4A574 50%, #B8956A 100%);
    border: 8px solid #8B6F47;
    border-radius: 8px;
    box-shadow: 0 15px 40px rgba(0,0,0,0.4);
    z-index: 10;
}

.left-open {
    left: -160px;
}

.right-open {
    right: -160px;
}

/* Cuadrícula de la persiana */
.shutter-grid {
    position: relative;
    width: 100%;
    height: 100%;
    padding: 20px 15px;
}

/* Líneas horizontales de la persiana */
.shutter-grid::before {
    content: '';
    position: absolute;
    top: 20px;
    left: 15px;
    right: 15px;
    bottom: 20px;
    background-image: 
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 35px,
            rgba(139, 111, 71, 0.4) 35px,
            rgba(139, 111, 71, 0.4) 38px
        );
}

/* Marco divisor horizontal en la mitad */
.shutter-grid::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 10px;
    right: 10px;
    height: 12px;
    transform: translateY(-50%);
    background: linear-gradient(180deg, #8B6F47 0%, #6B5537 50%, #8B6F47 100%);
    border-radius: 3px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

/* Pequeñas bisagras decorativas */
.left-open::before,
.right-open::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 45px;
    background: #4A4A4A;
    border: 2px solid #2A2A2A;
    border-radius: 4px;
    top: 100px;
    box-shadow: 
        0 150px 0 #4A4A4A,
        0 300px 0 #4A4A4A;
}

.left-open::before {
    right: -10px;
    border-left: 2px solid #1A1A1A;
}

.right-open::before {
    left: -10px;
    border-right: 2px solid #1A1A1A;
}

/* Manija de la ventana */
.left-open::after,
.right-open::after {
    content: '';
    position: absolute;
    width: 25px;
    height: 80px;
    background: linear-gradient(90deg, #C9B037 0%, #E6D78C 50%, #C9B037 100%);
    border: 3px solid #8B7500;
    border-radius: 12px;
    top: 50%;
    transform: translateY(-50%);
    box-shadow: 
        0 4px 10px rgba(0,0,0,0.5),
        inset 0 2px 4px rgba(255,255,255,0.4);
}

.left-open::after {
    right: 20px;
}

.right-open::after {
    left: 20px;
}

#avatar-container {
    width: 100%;
    height: 100%;
    margin: 0;
    border-radius: 0;
    overflow: hidden;
    background: linear-gradient(135deg, #e0e8ff 0%, #b8d0ff 100%);
    box-shadow: none;
}

#start-button {
    width: 80px;
    height: 80px;
    font-size: 32px;
    border: none;
    border-radius: 50%;
    background-color: #8eda92; /* Verde claro */
    color: #ffffff;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

#start-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
    background-color: #7ac97e;
}

#start-button.listening {
    background-color: #e74c3c;
    animation: pulse 1.5s infinite;
}

#output-area {
    margin-top: 20px;
    padding: 25px;
    min-width: 300px;
    min-height: 100px;
    border-radius: 15px;
    background-color: rgba(255, 255, 255, 0.95);
    text-align: center;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
    font-size: 18px;
    line-height: 1.5;
    color: #2c3e50;
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    transform: translateY(0);
    transition: all 0.3s ease;
}

#output-area:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.25);
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { 
        transform: scale(1.1);
        box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
    }
    100% { transform: scale(1); }
}

/* Estilo para mensajes de error */
.error-message {
    color: #e74c3c;
    font-weight: 500;
}

/* Mejoras de accesibilidad */
#start-button:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(142, 218, 146, 0.5),
                0 4px 15px rgba(0, 0, 0, 0.2);
}

/* Responsive design */
@media (max-width: 480px) {
    #output-area {
        min-width: 90%;
        margin: 10px;
        font-size: 16px;
    }

    #start-button {
        width: 65px;
        height: 65px;
        font-size: 28px;
    }
}
