/* ===== МОДАЛКА «ГОЛОС ВАРВАРЫ» + страница voice-settings.html ===== */

.voice-modal-overlay {
  display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,0.65); z-index: 2150; justify-content: center; align-items: center;
  backdrop-filter: blur(6px); animation: fadeIn 0.3s ease;
}
.voice-modal-overlay.active { display: flex; }
.voice-modal-window {
  background: var(--bg-dark, #0a0b17); border: 1px solid var(--input-border, rgba(255,255,255,0.08));
  border-radius: 20px; width: 100%; max-width: 520px; padding: 28px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.5);
  position: relative; animation: slideUp 0.4s ease; max-height: 90vh; overflow-y: auto;
  color: var(--text-main, #fff); font-family: 'Inter', -apple-system, sans-serif;
}
.voice-modal-close {
  position: absolute; top: 16px; right: 16px; background: transparent; border: none;
  color: var(--text-muted, #8e8ea0); cursor: pointer; transition: color 0.2s; display: flex; padding: 4px;
}
.voice-modal-close:hover { color: var(--text-main, #fff); }
.voice-modal-close svg { width: 20px; height: 20px; fill: none; stroke: currentColor;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.voice-modal-window h3 {
  font-family: 'Russo One', sans-serif; font-size: 1.15rem;
  margin: 0 0 8px 0; color: var(--text-main, #fff); font-weight: 400; padding-right: 36px;
}
.voice-hint { color: var(--text-muted, #8e8ea0); font-size: 0.88rem; margin: 0 0 20px 0; line-height: 1.5; }

.voice-field { margin-bottom: 18px; }
.voice-field label {
  display: block; font-weight: 500; color: var(--text-main, #fff);
  font-size: 0.9rem; margin-bottom: 6px;
}
.voice-field select,
.voice-field input[type="text"] {
  width: 100%; background: var(--input-bg, #161722); border: 1px solid var(--input-border, rgba(255,255,255,0.08));
  border-radius: 10px; padding: 11px 14px; color: var(--text-main, #fff);
  font-size: 0.95rem; font-family: inherit; transition: border-color 0.2s; box-sizing: border-box;
}
.voice-field select:focus,
.voice-field input[type="text"]:focus { outline: none; border-color: var(--varvara-cyan, #00E5FF); }

.voice-field input[type="range"] {
  width: 100%; height: 6px; -webkit-appearance: none; appearance: none;
  background: rgba(255,255,255,0.08); border: none; cursor: pointer; border-radius: 3px;
}
.voice-field input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--varvara-cyan, #00E5FF); cursor: pointer;
  box-shadow: 0 0 10px rgba(0,229,255,0.5);
}
.voice-field input[type="range"]::-moz-range-thumb {
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--varvara-cyan, #00E5FF); cursor: pointer; border: none;
}

.voice-speed-row { display: flex; align-items: center; gap: 12px; }
.voice-speed-row input[type="range"] { flex: 1; }
.voice-speed-value {
  min-width: 48px; text-align: right;
  font-size: 0.9rem; color: var(--varvara-cyan, #00E5FF); font-weight: 600;
}

.voice-roles { display: flex; gap: 8px; flex-wrap: wrap; }
.voice-role-chip {
  background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1);
  border-radius: 20px; padding: 7px 14px; cursor: pointer;
  color: var(--text-muted, #8e8ea0); font-size: 0.88rem; font-family: inherit;
  transition: all 0.2s;
}
.voice-role-chip:hover { color: var(--text-main, #fff); border-color: rgba(255,255,255,0.2); }
.voice-role-chip.active {
  background: rgba(0,229,255,0.12); border-color: var(--varvara-cyan, #00E5FF);
  color: var(--varvara-cyan, #00E5FF);
}
.voice-role-chip:disabled {
  opacity: 0.3; cursor: not-allowed; text-decoration: line-through;
}

.voice-actions {
  display: flex; gap: 10px; justify-content: space-between;
  margin-top: 22px; padding-top: 18px; border-top: 1px solid rgba(255,255,255,0.06);
  flex-wrap: wrap;
}
.voice-actions-left { display: flex; gap: 8px; flex-wrap: wrap; }
.voice-btn {
  padding: 11px 22px; border-radius: 12px; border: none;
  font-family: inherit; font-size: 0.95rem; font-weight: 500;
  cursor: pointer; transition: all 0.2s;
}
.voice-btn-test {
  background: rgba(0,229,255,0.12); color: var(--varvara-cyan, #00E5FF);
  border: 1px solid rgba(0,229,255,0.35);
  display: inline-flex; align-items: center; gap: 8px;
}
.voice-btn-test:hover { background: rgba(0,229,255,0.2); }
.voice-btn-test svg {
  width: 16px; height: 16px; stroke: currentColor;
  fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
.voice-btn-test:disabled { opacity: 0.5; cursor: not-allowed; }
.voice-btn-save { background: var(--varvara-cyan, #00E5FF); color: #0a0b17; }
.voice-btn-save:hover { background: var(--varvara-blue, #4dabf7); }
.voice-btn-reset { background: rgba(255,255,255,0.06); color: var(--text-muted, #8e8ea0); }
.voice-btn-reset:hover { color: var(--text-main, #fff); }

/* ===== Отдельная страница voice-settings.html ===== */
body.voice-page {
  min-height: 100vh; background: #0a0b17; color: #fff;
  font-family: 'Inter', -apple-system, sans-serif;
  display: flex; align-items: center; justify-content: center; padding: 30px 20px;
}
body.voice-page .voice-modal-window {
  max-width: 560px; animation: none; position: relative;
}
body.voice-page .voice-page-header {
  display: flex; align-items: center; gap: 14px; margin-bottom: 8px;
}
body.voice-page .voice-page-header img {
  width: 44px; height: 44px; border-radius: 50%; object-fit: cover;
  border: 2px solid rgba(0,229,255,0.35); box-shadow: 0 0 12px rgba(0,229,255,0.25);
}
body.voice-page .voice-page-title { font-family: 'Russo One', sans-serif; font-size: 1.35rem; margin: 0; font-weight: 400; }
body.voice-page .voice-page-sub  { color: #8e8ea0; font-size: 0.9rem; margin: 0; }
body.voice-page .voice-back-link {
  position: absolute; top: 16px; right: 56px; color: #8e8ea0;
  text-decoration: none; font-size: 0.9rem; display: inline-flex; align-items: center; gap: 6px;
  transition: color 0.2s;
}
body.voice-page .voice-back-link:hover { color: #00E5FF; }
body.voice-page .voice-back-link svg { width: 14px; height: 14px; stroke: currentColor;
  fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ===== Анимация спиннера для кнопки «Озвучить» ===== */
@keyframes vSpin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}
.speaker-btn.loading {
  color: var(--varvara-cyan, #00E5FF);
  pointer-events: auto;
  cursor: pointer;
}
.speaker-btn.loading svg {
  animation: vSpin 1s linear infinite;
}

@media (max-width: 520px) {
  body.voice-page { padding: 16px 12px; }
  .voice-modal-window { padding: 22px; }
  .voice-actions { flex-direction: column-reverse; }
  .voice-actions .voice-btn-save { width: 100%; }
}