/* 语音输入按钮与提示样式，与学生端/后台的深色主题保持一致 */
.voice-field {
    position: relative;
    display: block;
    color: inherit;
    font-size: inherit;
}

.form-field > .voice-field {
    color: inherit;
    font-size: inherit;
}

.voice-field textarea,
.voice-field input {
    padding-right: 44px;
}

.voice-btn {
    position: absolute;
    right: 7px;
    bottom: 7px;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    padding: 0;
    border: 1px solid rgba(114, 224, 188, 0.28);
    border-radius: 9px;
    background: rgba(114, 224, 188, 0.1);
    color: var(--mint, #72e0bc);
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.voice-btn svg {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.voice-btn:hover {
    border-color: rgba(114, 224, 188, 0.55);
    background: rgba(114, 224, 188, 0.2);
}

.voice-btn:focus-visible {
    outline: 2px solid var(--cyan, #63d9df);
    outline-offset: 2px;
}

.voice-btn.is-recording {
    border-color: rgba(255, 159, 159, 0.7);
    background: #d95757;
    color: #fff;
    animation: voice-pulse 1.4s ease-out infinite;
}

.voice-btn.is-loading {
    cursor: wait;
}

.voice-btn.is-loading svg {
    display: none;
}

.voice-btn.is-loading::after {
    content: '';
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: var(--mint, #72e0bc);
    border-radius: 50%;
    animation: voice-spin 0.8s linear infinite;
}

.voice-btn:disabled {
    opacity: 0.6;
}

@keyframes voice-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(217, 87, 87, 0.45); }
    50% { box-shadow: 0 0 0 7px rgba(217, 87, 87, 0); }
}

@keyframes voice-spin {
    to { transform: rotate(360deg); }
}

.voice-toast {
    position: fixed;
    left: 50%;
    bottom: 30px;
    z-index: 80;
    max-width: min(90vw, 420px);
    padding: 10px 16px;
    border: 1px solid rgba(114, 224, 188, 0.35);
    border-radius: 10px;
    background: rgba(8, 28, 28, 0.95);
    color: #eff9f4;
    font-size: 13px;
    line-height: 1.6;
    text-align: center;
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, 12px);
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.voice-toast.is-visible {
    opacity: 1;
    transform: translate(-50%, 0);
}

.voice-toast.is-long {
    max-width: min(92vw, 480px);
    text-align: left;
    white-space: pre-line;
}

@media (max-width: 640px) {
    .voice-btn {
        width: 28px;
        height: 28px;
        right: 6px;
        bottom: 6px;
    }
    .voice-field textarea,
    .voice-field input {
        padding-right: 40px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .voice-btn {
        animation: none !important;
    }
    .voice-toast {
        transition: none;
    }
}
