#bot {
    --bot-surface: #ffffff;
    --bot-ink: #1f2937;
    --bot-muted: #667085;
    --bot-soft: #f3f5fb;
    --bot-line: #dbe3f2;
    --bot-accent: #1d6fdc;
    --bot-accent-deep: #134d9d;
}

#bot .subtitle {
    color: #2d3644;
    margin-bottom: 1rem;
    font-size: 1.1rem;
    line-height: 1.4;
}

.bot-interface {
    position: relative;
    display: flex;
    flex-direction: column;
    height: clamp(620px, 76vh, 860px);
    border-radius: 28px;
    border: 1px solid var(--bot-line);
    background:
        radial-gradient(circle at 100% -15%, rgba(29, 111, 220, 0.2), transparent 42%),
        radial-gradient(circle at -10% 20%, rgba(56, 189, 248, 0.2), transparent 46%),
        var(--bot-surface);
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.12);
    overflow: hidden;
}

.bot-header-panel {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    padding: 1rem 1.3rem;
    border-bottom: 1px solid var(--bot-line);
    background: linear-gradient(110deg, rgba(29, 111, 220, 0.08), rgba(56, 189, 248, 0.04));
}

.bot-header-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    color: #fff;
    display: grid;
    place-items: center;
    background: linear-gradient(145deg, #7992ac, #5e7c9b);
    box-shadow: 0 10px 18px rgba(121, 146, 172, 0.36);
    flex-shrink: 0;
}

.bot-header-copy h3 {
    margin: 0;
    color: var(--bot-ink);
    font-size: 1rem;
    letter-spacing: 0.01em;
}

.bot-header-copy p {
    margin: 0.1rem 0 0;
    color: var(--bot-muted);
    font-size: 0.9rem;
    line-height: 1.35;
}

.bot-messages {
    flex: 1;
    min-height: 0;
    padding: 1.2rem 1.3rem 1rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.bot-messages::-webkit-scrollbar {
    width: 10px;
}

.bot-messages::-webkit-scrollbar-thumb {
    border-radius: 999px;
    background: #c1cee4;
    border: 2px solid #eef3fb;
}

.msg {
    padding: 0.75rem 0.95rem;
    border-radius: 16px;
    max-width: min(86%, 660px);
    font-size: 0.95rem;
    line-height: 1.45;
    word-break: break-word;
    border: 1px solid transparent;
}

.msg.bot {
    align-self: flex-start;
    color: #334155;
    background: linear-gradient(180deg, #f8fbff 0%, #eff5ff 100%);
    border-color: #d9e7ff;
}

.msg.user {
    align-self: flex-end;
    margin-left: auto;
    color: #fff;
    background: linear-gradient(135deg, var(--bot-accent), var(--bot-accent-deep));
    box-shadow: 0 10px 24px rgba(19, 77, 157, 0.25);
}

.voice-control-area {
    padding: 1.3rem 1.2rem 1.45rem;
    border-top: 1px solid var(--bot-line);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.8rem;
    background: linear-gradient(180deg, rgba(243, 247, 255, 0.55), rgba(255, 255, 255, 0.95));
}

.mic-btn {
    width: 82px;
    height: 82px;
    border-radius: 50%;
    background: linear-gradient(160deg, var(--bot-accent), var(--bot-accent-deep));
    color: white;
    border: 2px solid #cce1ff;
    font-size: 1.7rem;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: transform 0.22s ease, box-shadow 0.22s ease;
    box-shadow: 0 14px 24px rgba(29, 111, 220, 0.34);
}

.mic-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 26px rgba(29, 111, 220, 0.38);
}

.mic-btn.recording {
    background: linear-gradient(160deg, #f43f5e, #dc2626);
    border-color: #fecdd3;
    animation: pulse 1.5s infinite;
}

#recordStatus {
    margin: 0;
    font-size: 0.92rem;
    color: #5a6472;
    font-weight: 500;
}

@keyframes pulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(244, 63, 94, 0.5);
    }
    70% {
        transform: scale(1.07);
        box-shadow: 0 0 0 16px rgba(244, 63, 94, 0);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(244, 63, 94, 0);
    }
}

.bot-result {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    width: 100%;
    max-width: 100%;
    padding: 0.2rem;
    box-sizing: border-box;
}

.msg.bot.bot-result {
    align-self: stretch;
}

.bot-result-main {
    display: flex;
    align-items: flex-start;
    gap: 0.9rem;
    flex-wrap: wrap;
}

.bot-result-img {
    width: clamp(120px, 22vw, 180px);
    border-radius: 14px;
    object-fit: cover;
    border: 1px solid #d9e7ff;
    box-shadow: 0 8px 16px rgba(15, 23, 42, 0.08);
    flex-shrink: 0;
}

.bot-result-meta {
    flex: 1;
    min-width: 220px;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.bot-result-words {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.bot-word-pair {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.bot-word-en {
    font-weight: 700;
    font-size: 1.35rem;
    color: #12263d;
}

.bot-word-sep {
    font-size: 1.05rem;
    font-weight: 600;
    color: #5f6f84;
}

.bot-word-es {
    font-size: 1.16rem;
    color: #3f5872;
    font-weight: 600;
}

.bot-word-native {
    font-size: 1.18rem;
    font-weight: 800;
    color: var(--bot-accent-deep);
}

.bot-word-missing {
    font-size: 0.95rem;
    color: #64748b;
    font-style: italic;
}

.bot-audio-player {
    margin-top: 0;
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.5rem 0.65rem;
    border-radius: 999px;
    background: #edf4ff;
    border: 1px solid #d2e3ff;
}

.bot-audio-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    color: #ffffff;
    background: linear-gradient(160deg, var(--bot-accent), var(--bot-accent-deep));
    display: grid;
    place-items: center;
    cursor: pointer;
    box-shadow: 0 8px 14px rgba(19, 77, 157, 0.28);
}

.bot-audio-btn i {
    font-size: 0.92rem;
}

.bot-audio-wave {
    display: inline-flex;
    align-items: flex-end;
    gap: 3px;
    height: 24px;
    min-width: 52px;
}

.bot-audio-wave span {
    width: 4px;
    height: 8px;
    border-radius: 999px;
    background: #7fa5d8;
    opacity: 0.45;
}

.bot-audio-player.is-playing .bot-audio-wave span {
    animation: botWave 0.8s ease-in-out infinite;
    opacity: 1;
    background: #2b67ba;
}

.bot-audio-player.is-playing .bot-audio-wave span:nth-child(2) { animation-delay: 0.1s; }
.bot-audio-player.is-playing .bot-audio-wave span:nth-child(3) { animation-delay: 0.22s; }
.bot-audio-player.is-playing .bot-audio-wave span:nth-child(4) { animation-delay: 0.34s; }
.bot-audio-player.is-playing .bot-audio-wave span:nth-child(5) { animation-delay: 0.46s; }

.bot-result-audio {
    display: none;
}

@keyframes botWave {
    0%,
    100% {
        transform: scaleY(0.45);
    }
    50% {
        transform: scaleY(1.35);
    }
}

@media (max-width: 900px) {
    .bot-interface {
        height: clamp(560px, 78vh, 760px);
        border-radius: 22px;
    }

    .msg {
        max-width: 92%;
    }

    .bot-word-en,
    .bot-word-native {
        font-size: 1.2rem;
    }

    .bot-word-es {
        font-size: 1.05rem;
    }

    .bot-result-meta {
        min-width: 180px;
    }
}

@media (max-width: 600px) {
    #bot .subtitle {
        font-size: 1rem;
    }

    .bot-header-panel {
        padding: 0.9rem 1rem;
    }

    .bot-messages {
        padding: 1rem;
    }

    .voice-control-area {
        padding: 1rem 0.9rem 1.15rem;
    }

    .mic-btn {
        width: 76px;
        height: 76px;
        font-size: 1.55rem;
    }

    .bot-result-main {
        gap: 0.65rem;
    }

    .bot-result-img {
        width: clamp(108px, 36vw, 150px);
    }

    .bot-result-meta {
        min-width: 100%;
    }
}