* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

body {
    background: #050510;
    background-image: 
        radial-gradient(circle at 10% 20%, rgba(138, 43, 226, 0.15) 0%, transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(255, 20, 147, 0.15) 0%, transparent 40%),
        radial-gradient(circle at 50% 50%, rgba(0, 210, 255, 0.1) 0%, transparent 60%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #e0e0e0;
}

.container {
    max-width: 1000px;
    width: 90%;
    background: rgba(15, 15, 30, 0.6);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.5), 0 0 20px rgba(138, 43, 226, 0.1);
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

header {
    text-align: center;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

header h1 {
    font-size: 2.2rem;
    background: linear-gradient(135deg, #00d2ff, #8a2be2, #ff1493);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    filter: drop-shadow(0 0 10px rgba(138, 43, 226, 0.3));
}

header p {
    color: #a0a0b0;
    margin-top: 8px;
    font-weight: 500;
}

.translator-ui {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    align-items: center;
}

.interaction-area {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.speech-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.text-box {
    background: rgba(0, 0, 0, 0.4);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.05);
    min-height: 120px;
    transition: all 0.3s ease;
}

.text-box:hover {
    border-color: rgba(138, 43, 226, 0.4);
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.3), 0 0 15px rgba(138, 43, 226, 0.1);
}

.text-box h3 {
    font-size: 1.05rem;
    color: #00d2ff;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

.text-box p {
    font-size: 1.15rem;
    line-height: 1.6;
    word-wrap: break-word;
    color: #fff;
}

.placeholder-text {
    color: #666 !important;
    font-style: italic;
}

.controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
}

.mic-btn {
    width: 85px;
    height: 85px;
    border-radius: 50%;
    background: linear-gradient(135deg, #8a2be2, #ff1493);
    border: none;
    color: white;
    font-size: 2.2rem;
    cursor: pointer;
    box-shadow: 0 0 20px rgba(255, 20, 147, 0.5), inset 0 0 10px rgba(255,255,255,0.3);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    justify-content: center;
    align-items: center;
}

.mic-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 0 30px rgba(255, 20, 147, 0.7), inset 0 0 15px rgba(255,255,255,0.4);
}

.mic-btn.listening {
    background: linear-gradient(135deg, #ff1493, #ff4500);
    box-shadow: 0 0 0 0 rgba(255, 20, 147, 0.7);
    animation: pulseNeonMic 1.5s infinite;
}

@keyframes pulseNeonMic {
    0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255, 20, 147, 0.7); }
    70% { transform: scale(1.1); box-shadow: 0 0 0 20px rgba(255, 20, 147, 0); }
    100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255, 20, 147, 0); }
}

.reset-btn {
    padding: 12px 24px;
    border-radius: 30px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #e0e0e0;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.reset-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    box-shadow: 0 0 15px rgba(255,255,255,0.1);
}

/* Assistant Area */
.assistant-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    padding-top: 2rem;
}

.speech-bubble {
    background: rgba(20, 20, 35, 0.8);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(0, 210, 255, 0.4);
    border-radius: 20px;
    padding: 1.2rem 1.8rem;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4), 0 0 15px rgba(0, 210, 255, 0.2);
    position: relative;
    margin-bottom: 25px;
    max-width: 85%;
    text-align: center;
    font-weight: 500;
    color: #e0e0e0;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.speech-bubble.active {
    opacity: 1;
    transform: translateY(0);
}

.speech-bubble::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    border-width: 10px 10px 0;
    border-style: solid;
    border-color: rgba(20, 20, 35, 0.8) transparent transparent transparent;
}

.speech-bubble::before {
    content: '';
    position: absolute;
    bottom: -12px;
    left: 50%;
    transform: translateX(-50%);
    border-width: 11px 11px 0;
    border-style: solid;
    border-color: rgba(0, 210, 255, 0.4) transparent transparent transparent;
    z-index: -1;
}

.anime-character {
    width: 250px;
    height: 350px;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    /* Default idle animation: float with small smile implied */
    animation: floatIdle 4s ease-in-out infinite;
    transform-origin: bottom center;
}

.anime-avatar {
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 10px 20px rgba(0,0,0,0.4));
    animation: floatIdle 4s ease-in-out infinite;
    transform-origin: bottom center;
}

/* Eye Blinking */
.anime-character.avatar-blink .eyes ellipse, 
.anime-character.avatar-blink .eyes circle {
    opacity: 0;
}
.anime-character.avatar-blink .eyelid {
    opacity: 1;
}

/* Talking Head Movement */
.anime-character.avatar-talking {
    animation: headBobTalk 2s infinite alternate ease-in-out;
}

/* Mouth States */
.mouth-state {
    transition: opacity 0.05s ease-in-out;
}
.mouth-state.closed { opacity: 1; }
.mouth-state.half { opacity: 0; }
.mouth-state.open { opacity: 0; }

.anime-character.avatar-mouth-half .mouth-state.closed { opacity: 0; }
.anime-character.avatar-mouth-half .mouth-state.half { opacity: 1; }
.anime-character.avatar-mouth-half .mouth-state.open { opacity: 0; }

.anime-character.avatar-mouth-open .mouth-state.closed { opacity: 0; }
.anime-character.avatar-mouth-open .mouth-state.half { opacity: 0; }
.anime-character.avatar-mouth-open .mouth-state.open { opacity: 1; }

/* Thinking state while translating */
.anime-character.avatar-thinking .anime-avatar {
    transform: rotate(3deg) scale(0.98);
}

@keyframes floatIdle {
    0% { transform: translateY(0px) rotate(0deg); }
    33% { transform: translateY(-5px) rotate(1deg); }
    66% { transform: translateY(-8px) rotate(-1deg); }
    100% { transform: translateY(0px) rotate(0deg); }
}

@keyframes headBobTalk {
    0% { transform: rotate(-2deg) translateY(0); }
    50% { transform: rotate(1deg) translateY(-3px); }
    100% { transform: rotate(3deg) translateY(2px); }
}

/* Loading Indicator */
.loading-indicator {
    display: none;
    align-items: center;
    gap: 5px;
    margin-top: 5px;
}

.loading-indicator.active {
    display: flex;
}

.dot {
    width: 8px;
    height: 8px;
    background-color: #ff1493;
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
    box-shadow: 0 0 8px rgba(255, 20, 147, 0.6);
}

.dot:nth-child(1) { animation-delay: -0.32s; }
.dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* Responsive */
@media (max-width: 768px) {
    .translator-ui {
        grid-template-columns: 1fr;
    }
    
    .assistant-area {
        order: -1;
        padding-top: 0;
    }
    
    .anime-character {
        width: 180px;
        height: 250px;
    }
}
