.iht-voice-wrap {
    --voice-bg:      #0d0d12;
    --voice-card:    #16161f;
    --voice-input:   #1e1e2a;
    --voice-border:  #2a2a38;
    --voice-text:    #f0f0f5;
    --voice-muted:   #8888a0;
    --voice-accent:  #3b82f6; 
    --voice-accent2: #06b6d4;
    --voice-radius:  24px;
    font-family: 'Inter', sans-serif;
}

.iht-voice-wrap {
    background: var(--voice-bg); border-radius: var(--voice-radius); max-width: 800px; margin: 32px auto;
    color: var(--voice-text); box-shadow: 0 0 0 1px var(--voice-border), 0 32px 80px rgba(0,0,0,0.6);
    overflow: hidden; position: relative;
}

.iht-voice-wrap::before {
    content: ''; position: absolute; top: -100px; right: -100px; width: 300px; height: 300px;
    background: radial-gradient(circle, rgba(59,130,246,0.15) 0%, transparent 70%); pointer-events: none;
}

.iht-voice-header {
    display: flex; align-items: center; gap: 16px; padding: 20px 24px;
    border-bottom: 1px solid var(--voice-border); background: var(--voice-card); position: relative; z-index: 2;
}

.iht-voice-icon {
    width: 46px; height: 46px; border-radius: 14px;
    background: linear-gradient(135deg, var(--voice-accent), var(--voice-accent2));
    display: flex; align-items: center; justify-content: center; font-size: 20px; color: #fff; flex-shrink: 0;
    box-shadow: 0 4px 16px rgba(59,130,246,0.4);
}

.iht-voice-header-text { flex: 1; }
.iht-voice-title { font-size: 16px; font-weight: 700; margin: 0; }
.iht-voice-subtitle { font-size: 12px; color: var(--voice-muted); margin-top: 4px; line-height: 1.4; }

.mode-switch-wrap { margin-left: auto; display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.mode-label { font-size: 12px; font-weight: 700; color: var(--voice-muted); transition: 0.3s; text-transform: uppercase; letter-spacing: 0.5px; opacity: 0.5; white-space: nowrap; }
.mode-label.active { background: linear-gradient(135deg, var(--voice-accent), var(--voice-accent2)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; opacity: 1; }
.mode-label.pro-label.active { background: linear-gradient(135deg, #a855f7, #ec4899); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }

.iht-toggle { position: relative; display: inline-block; width: 42px; height: 24px; margin: 0; }
.iht-toggle input { opacity: 0; width: 0; height: 0; }
.iht-slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: var(--voice-input); border: 1px solid var(--voice-border); transition: .4s; border-radius: 24px; }
.iht-slider:before { position: absolute; content: ""; height: 16px; width: 16px; left: 3px; bottom: 3px; background-color: var(--voice-muted); transition: .4s; border-radius: 50%; }

.main-switch input:checked ~ .iht-slider { background: linear-gradient(135deg, var(--voice-accent), var(--voice-accent2)); border-color: transparent; }
.small-switch input:checked ~ .iht-slider { background: linear-gradient(135deg, #a855f7, #ec4899); border-color: transparent; }
.iht-toggle input:checked ~ .iht-slider:before { transform: translateX(18px); background-color: #fff; }

.iht-voice-body { padding: 24px; position: relative; z-index: 2; }
.voice-section { display: flex; flex-direction: column; gap: 20px; animation: v-fade 0.3s ease; }
@keyframes v-fade { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }

.tts-pro-panel { display: flex; align-items: center; justify-content: space-between; background: var(--voice-card); padding: 12px 16px; border-radius: 12px; border: 1px solid var(--voice-border); }
.tts-voice-select select { 
    background: var(--voice-input) !important; color: var(--voice-text) !important;
    border: 1px solid var(--voice-border) !important; border-radius: 8px !important;
    padding: 8px 30px 8px 12px !important; font-size: 13px !important;
    outline: none !important; cursor: pointer; font-family: inherit;
    -webkit-appearance: none !important; -moz-appearance: none !important; appearance: none !important;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238888a0' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e") !important;
    background-repeat: no-repeat !important; background-position: right 10px center !important;
    background-size: 14px !important;
    width: 100% !important; height: auto !important; min-height: 0 !important;
    line-height: normal !important; box-sizing: border-box !important;
    box-shadow: none !important; margin: 0 !important;
}
.tts-voice-select select option { background: #1e1e2a; color: #f0f0f5; }
.tts-voice-select select:disabled { opacity: 0.4; cursor: not-allowed; }
.tts-voice-select select:focus { border-color: #a855f7 !important; }

.iht-voice-dropzone { border: 2px dashed var(--voice-border); border-radius: 16px; padding: 40px 20px; text-align: center; cursor: pointer; transition: 0.3s; background: var(--voice-card); }
.iht-voice-dropzone:hover { border-color: var(--voice-accent); background: rgba(59,130,246,0.05); }
.iht-voice-dropzone i { font-size: 36px; color: var(--voice-muted); margin-bottom: 12px; display: block; }
.iht-voice-dropzone p { margin: 0; font-size: 14px; color: var(--voice-text); }
.iht-voice-link { color: var(--voice-accent); font-weight: 600; text-decoration: underline; }
.stt-file-name { margin-top: 10px; font-size: 13px; color: var(--voice-accent2); font-weight: 600; }

.iht-voice-textarea { width: 100%; min-height: 180px; background: var(--voice-card); border: 1px solid var(--voice-border); border-radius: 16px; padding: 16px; color: var(--voice-text); font-size: 14px; line-height: 1.6; outline: none; resize: vertical; font-family: inherit; box-sizing: border-box; transition: 0.2s; }
.iht-voice-textarea.input-mode { background: var(--voice-input); min-height: 160px; }
.iht-voice-textarea:focus { border-color: var(--voice-accent); }

.iht-voice-btn { background: linear-gradient(135deg, var(--voice-accent), var(--voice-accent2)); border: none; border-radius: 12px; color: #fff; font-size: 14px; font-weight: 700; padding: 14px; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px; transition: 0.3s; box-shadow: 0 4px 12px rgba(59,130,246,0.3); }
.iht-voice-btn.pro-btn { background: linear-gradient(135deg, #a855f7, #ec4899); box-shadow: 0 4px 12px rgba(168,85,247,0.3); }
.iht-voice-btn:hover:not(:disabled) { opacity: 0.9; transform: translateY(-1px); }
.iht-voice-btn:disabled { opacity: 0.4; cursor: not-allowed; box-shadow: none; }
.iht-voice-btn.is-processing { opacity: 1 !important; cursor: wait !important; background: linear-gradient(135deg, #2563eb, #0891b2) !important; }

.iht-voice-result-btns { display: flex; gap: 12px; }
.iht-voice-result-btns .iht-voice-btn-secondary { flex: 1; }

.iht-voice-btn-secondary { background: var(--voice-card); border: 1px solid var(--voice-border); border-radius: 12px; color: var(--voice-text); font-size: 13px; font-weight: 600; padding: 10px 16px; cursor: pointer; transition: 0.2s; align-items: center; justify-content: center; gap: 8px; display: flex;}
.iht-voice-btn-secondary:hover { border-color: var(--voice-accent); color: var(--voice-accent); }

.tts-player-box { background: var(--voice-input); border: 1px solid var(--voice-border); border-radius: 16px; padding: 20px; text-align: center; }
.tts-ready-text { color: var(--voice-green, #10b981); font-weight: 700; margin: 0 0 10px 0; }

/* =========================================
   АДАПТИВНОСТЬ (МОБИЛЬНАЯ ВЕРСИЯ)
   ========================================= */
@media (max-width: 600px) {
    .iht-voice-wrap { margin: 16px; border-radius: 16px; }
    
    /* Шапка: Иконка и текст остаются вместе, переключатель уходит вниз */
    .iht-voice-header { flex-wrap: wrap; padding: 16px; }
    .iht-voice-header-text { min-width: 150px; }
    .mode-switch-wrap.main-switch { margin-left: 0; width: 100%; justify-content: center; margin-top: 10px; }
    
    .iht-voice-body { padding: 16px; }
    
    /* PRO-панель: Выбор голоса и переключатель встают друг над другом */
    .tts-pro-panel { flex-direction: column; gap: 16px; align-items: stretch; padding: 16px; }
    .tts-voice-select select { width: 100%; }
    .mode-switch-wrap.small-switch { margin-left: 0; justify-content: center; width: 100%; }
    
    /* Кнопки результата STT встают в столбик */
    .iht-voice-result-btns { flex-direction: column; }
}
/* Кнопка в состоянии обработки — жёлтая */
.iht-voice-btn.is-processing {
    background: linear-gradient(135deg, #d97706, #f59e0b) !important;
    box-shadow: 0 4px 12px rgba(245,158,11,0.4) !important;
    opacity: 1 !important;
    cursor: wait !important;
}