/* CHATI-AI V14 — character voices (ElevenLabs) */
.v14-voice-field {
  display: grid;
  gap: 12px;
}

.v14-current {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.03);
}

.v14-current-icon {
  display: grid;
  flex: 0 0 44px;
  place-items: center;
  width: 44px;
  height: 44px;
  color: #a9a3bd;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.06);
}

.v14-current.has-voice .v14-current-icon {
  color: #fff;
  background: var(--v9-gradient, linear-gradient(135deg, #8b5cf6, #ec4899));
  box-shadow: 0 6px 18px rgba(139, 92, 246, 0.35);
}

.v14-current-icon svg,
.v14-option-icon svg,
.v14-play svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.v14-current-text {
  display: grid;
  flex: 1;
  gap: 2px;
  min-width: 0;
}

.v14-current-text strong {
  overflow: hidden;
  font-size: 15px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.v14-current-text small,
.v14-option small {
  color: #9b95ad;
  font-size: 12.5px;
  line-height: 1.4;
}

.v14-play {
  display: grid;
  flex: 0 0 40px;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  color: #fff;
  border: 0;
  border-radius: 50%;
  background: var(--v9-gradient, linear-gradient(135deg, #8b5cf6, #ec4899));
  cursor: pointer;
}

.v14-play svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
  stroke: none;
  margin-left: 2px;
}

.v14-play.playing,
.v14-play.loading {
  animation: v14-loading 0.9s ease-in-out infinite;
}

.v14-link {
  padding: 6px 4px;
  color: #a9a3bd;
  font: inherit;
  font-size: 13px;
  border: 0;
  background: none;
  cursor: pointer;
}

.v14-link:hover {
  color: #f87171;
}

.v14-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 10px;
}

.v14-option {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px;
  color: inherit;
  font: inherit;
  text-align: left;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.025);
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease;
}

.v14-option:hover {
  border-color: rgba(167, 139, 250, 0.55);
  background: rgba(139, 92, 246, 0.08);
  transform: translateY(-1px);
}

.v14-option > span:last-child {
  display: grid;
  gap: 3px;
}

.v14-option strong {
  font-size: 14px;
}

.v14-option-icon {
  display: grid;
  flex: 0 0 38px;
  place-items: center;
  width: 38px;
  height: 38px;
  color: #c4b5fd;
  border-radius: 12px;
  background: rgba(139, 92, 246, 0.14);
}

@media (max-width: 560px) {
  .v14-options {
    grid-template-columns: 1fr;
  }
}

.v14-sheet button,
.v14-upload {
  padding: 9px 14px;
  color: inherit;
  font: inherit;
  font-size: 13px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  cursor: pointer;
}

.v14-sheet button:hover:not(:disabled),
.v14-upload:hover {
  background: rgba(255, 255, 255, 0.12);
}

.v14-sheet {
  position: fixed;
  inset: 0;
  z-index: 9700;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 16px;
  background: rgba(8, 6, 14, 0.62);
  animation: v10-fade 0.2s ease both;
}

.v14-sheet-panel {
  display: flex;
  flex-direction: column;
  width: min(560px, 100%);
  max-height: min(82vh, 760px);
  overflow: hidden;
  color: #ece9f6;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  background: #1b1826;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
  animation: v10-zoom 0.25s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.v14-sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.v14-sheet-body {
  display: grid;
  gap: 12px;
  overflow-y: auto;
  padding: 14px 16px 18px;
  overscroll-behavior: contain;
}

.v14-voice-search,
.v14-clone-name {
  width: 100%;
  padding: 10px 12px;
  color: inherit;
  font: inherit;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.25);
}

.v14-voice-list {
  display: grid;
  gap: 6px;
}

.v14-voice-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
}

.v14-voice-row > div {
  display: grid;
  flex: 1;
  min-width: 0;
}

.v14-voice-row small {
  overflow: hidden;
  color: #9b95ad;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.v14-muted {
  margin: 0;
  color: #a8a2bb;
  font-size: 14px;
  line-height: 1.5;
}

.v14-record.recording {
  border-color: #ef4444;
  background: rgba(239, 68, 68, 0.18);
}

.v14-samples {
  display: grid;
  gap: 6px;
}

.v14-sample {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
  font-size: 13px;
}

.v14-total {
  margin: 0;
  color: #f59e0b;
  font-size: 13px;
  font-weight: 600;
}

.v14-total.ok {
  color: #22c55e;
}

.v14-clone-label {
  display: grid;
  gap: 6px;
  font-size: 13px;
}

.v14-consent {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid rgba(250, 204, 21, 0.35);
  border-radius: 12px;
  background: rgba(250, 204, 21, 0.06);
  font-size: 13px;
  line-height: 1.45;
}

.v14-consent input {
  margin-top: 3px;
}

.v14-clone-go {
  justify-self: end;
  padding: 10px 18px !important;
  font-weight: 700;
  background: var(--v9-gradient, #8b5cf6) !important;
  border-color: transparent !important;
}

.v14-clone-go:disabled {
  opacity: 0.45;
  cursor: default;
}

.v11-speak.loading {
  animation: v14-loading 0.9s ease-in-out infinite;
}

@keyframes v14-loading {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}

html[data-chati-theme="light"] .v14-sheet-panel {
  color: #24202f;
  background: #fff;
}

html[data-chati-theme="light"] .v14-current,
html[data-chati-theme="light"] .v14-option,
html[data-chati-theme="light"] .v14-sheet button,
html[data-chati-theme="light"] .v14-upload,
html[data-chati-theme="light"] .v14-voice-row,
html[data-chati-theme="light"] .v14-sample {
  border-color: rgba(0, 0, 0, 0.1);
  background: rgba(0, 0, 0, 0.04);
}

html[data-chati-theme="light"] .v14-voice-search,
html[data-chati-theme="light"] .v14-clone-name {
  border-color: rgba(0, 0, 0, 0.12);
  background: #fff;
}

@media (min-width: 761px) {
  .v14-sheet {
    align-items: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  .v11-speak.loading {
    animation: none;
  }
}

/* ---------- Shared controls (icons, no emoji) ---------- */
.v14-sheet svg,
.v14-sheet-close svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: 0 0 auto;
}

.v14-sheet-close {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0 !important;
}

.v14-record,
.v14-upload,
.v14-primary,
.v14-secondary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.v14-record svg {
  fill: #f87171;
  stroke: none;
}

.v14-record.recording svg {
  fill: currentColor;
}

.v14-round {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0 !important;
  border-radius: 50% !important;
}

.v14-voice-row .v14-round svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
  stroke: none;
  margin-left: 2px;
}

.v14-sample .v14-round svg {
  width: 14px;
  height: 14px;
}

/* ---------- Design a voice ---------- */
.v14-textarea {
  width: 100%;
  padding: 11px 13px;
  color: inherit;
  font: inherit;
  font-size: 14px;
  line-height: 1.5;
  resize: vertical;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.25);
}

.v14-textarea:focus,
.v14-clone-name:focus,
.v14-voice-search:focus {
  outline: none;
  border-color: rgba(167, 139, 250, 0.7);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.18);
}

.v14-hint {
  color: #8f89a3;
  font-size: 12px;
}

.v14-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.v14-sheet .v14-preset {
  padding: 7px 12px;
  color: #cfc9e2;
  font-size: 12.5px;
  border-color: rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
}

.v14-sheet .v14-preset.active {
  color: #fff;
  border-color: rgba(167, 139, 250, 0.7);
  background: rgba(139, 92, 246, 0.2);
}

.v14-sheet .v14-primary {
  justify-self: stretch;
  justify-content: center;
  padding: 12px 18px;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  border: 0;
  background: var(--v9-gradient, linear-gradient(135deg, #8b5cf6, #ec4899));
  box-shadow: 0 8px 22px rgba(139, 92, 246, 0.3);
}

.v14-sheet .v14-primary:hover:not(:disabled) {
  background: var(--v9-gradient, linear-gradient(135deg, #8b5cf6, #ec4899));
  filter: brightness(1.08);
}

.v14-sheet .v14-primary:disabled {
  opacity: 0.7;
  cursor: default;
}

.v14-primary.busy svg {
  animation: v14-spin 1.2s linear infinite;
}

@keyframes v14-spin {
  to { transform: rotate(360deg); }
}

.v14-design-results {
  display: grid;
  gap: 8px;
}

.v14-design-results:empty {
  display: none;
}

.v14-results-title {
  margin: 4px 0 0;
  color: #cfc9e2;
  font-size: 13px;
  font-weight: 600;
}

.v14-preview {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.03);
}

.v14-sheet .v14-preview .v14-play {
  flex: 0 0 38px;
  width: 38px;
  height: 38px;
  padding: 0;
  color: #fff;
  border: 0;
  background: var(--v9-gradient, linear-gradient(135deg, #8b5cf6, #ec4899));
  box-shadow: 0 6px 16px rgba(139, 92, 246, 0.3);
}

.v14-sheet .v14-preview .v14-play:hover:not(:disabled) {
  background: var(--v9-gradient, linear-gradient(135deg, #8b5cf6, #ec4899));
  filter: brightness(1.1);
}

.v14-sheet .v14-preview .v14-play svg {
  width: 15px;
  height: 15px;
  fill: currentColor;
  stroke: none;
  margin-left: 2px;
}

.v14-sheet .v14-secondary {
  padding: 8px 14px;
  font-weight: 600;
  border-color: rgba(167, 139, 250, 0.45);
  background: rgba(139, 92, 246, 0.12);
}

html[data-chati-theme="light"] .v14-textarea,
html[data-chati-theme="light"] .v14-preview,
html[data-chati-theme="light"] .v14-sheet .v14-preset {
  color: #24202f;
  border-color: rgba(0, 0, 0, 0.1);
  background: #fff;
}

@media (prefers-reduced-motion: reduce) {
  .v14-primary.busy svg {
    animation: none;
  }
}

/* A sound sent in the chat: a compact play button instead of a player. */
.message-attachment.audio {
  display: flex;
}

.sound-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 150px;
  margin: 0;
  padding: 5px 14px 5px 5px;
  color: inherit;
  font: inherit;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.18s ease, transform 0.12s ease;
}

.sound-chip:active {
  transform: scale(0.97);
}

.message.character .sound-chip {
  border-color: rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.06);
}

html[data-chati-theme="light"] .message.character .sound-chip {
  border-color: rgba(0, 0, 0, 0.08);
  background: rgba(0, 0, 0, 0.04);
}

.sound-chip-icon {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  color: #2a1f2f;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
}

.sound-chip-icon svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

.sound-chip-pause,
.sound-chip.playing .sound-chip-play {
  display: none;
}

.sound-chip.playing .sound-chip-pause {
  display: block;
}

.sound-chip-wave {
  display: inline-flex;
  flex: 1;
  align-items: center;
  gap: 3px;
  height: 22px;
}

.sound-chip-wave i {
  width: 3px;
  height: 40%;
  border-radius: 2px;
  background: currentColor;
  opacity: 0.75;
}

.sound-chip-wave i:nth-child(2),
.sound-chip-wave i:nth-child(6) { height: 70%; }
.sound-chip-wave i:nth-child(3),
.sound-chip-wave i:nth-child(5) { height: 100%; }
.sound-chip-wave i:nth-child(4) { height: 55%; }

.sound-chip.playing .sound-chip-wave i {
  animation: sound-chip-wave 0.9s ease-in-out infinite;
}

.sound-chip.playing .sound-chip-wave i:nth-child(2n) { animation-delay: -0.3s; }
.sound-chip.playing .sound-chip-wave i:nth-child(3n) { animation-delay: -0.6s; }

.sound-chip-time {
  flex: none;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  opacity: 0.85;
}

.sound-chip.unavailable {
  opacity: 0.6;
}

@keyframes sound-chip-wave {
  0%, 100% { transform: scaleY(0.45); }
  50% { transform: scaleY(1); }
}

@media (prefers-reduced-motion: reduce) {
  .sound-chip.playing .sound-chip-wave i {
    animation: none;
  }
}

/* In the composer preview: just the round play button. */
.attachment-preview-visual .sound-chip.compact {
  min-width: 0;
  margin: auto;
  padding: 0;
  border: 0;
  background: none;
}

.attachment-preview-visual .sound-chip.compact .sound-chip-wave,
.attachment-preview-visual .sound-chip.compact .sound-chip-time {
  display: none;
}

.attachment-preview-visual .sound-chip.compact .sound-chip-icon {
  width: 44px;
  height: 44px;
}

.attachment-preview-visual .sound-chip.compact.playing .sound-chip-icon {
  animation: v11-pulse 1s ease-in-out infinite;
}

/* The scene note under a sound or video the user sent. */
.message.user .message-attachment-note {
  color: rgba(255, 255, 255, 0.86);
}
