/* ============================================================
   voice-services.css — 语音服务（文字转语音 + 语音识别，Phase D 收尾 ASR 刀0 / 刀1，2026-09-26）
   刀0 时叫 asr-services.css，刀1 两段共用后更名；类名沿用 az-asr- 前缀，新增共用件用 az-vs-。
   主题纪律同 info-layer.css：只用 --bg / --text / --card-bg / --accent，
   次级文字用 opacity 弱化；边框一律半透明灰（任何主题都成立）。
   z-index 12500：压过设置浮层（.modal 6000）与通话全屏（10080），
   让位给 azoth-dialog（100001，删除确认要浮在配置页之上）。
   ============================================================ */

.az-asr-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    display: block;
}

/* ---- 设置区列表 ---- */
.az-asr-list {
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(127, 127, 127, 0.22);
    border-radius: 12px;
    overflow: hidden;
    background: var(--card-bg);
    margin-bottom: 8px;
}

.az-asr-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 8px 10px 10px;
    min-height: 56px;
}

.az-asr-row + .az-asr-row {
    border-top: 1px solid rgba(127, 127, 127, 0.16);
}

.az-asr-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: rgba(127, 127, 127, 0.1);
    color: var(--accent);
}

.az-asr-row-text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.az-asr-row-name {
    font-size: 0.88rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.az-asr-row-sub {
    font-size: 0.72rem;
    opacity: 0.6;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.az-asr-row-actions {
    display: flex;
    align-items: center;
    gap: 2px;
    flex-shrink: 0;
}

.az-asr-icon-btn {
    width: 36px;
    height: 36px;
    margin: 0;
    padding: 0;
    border: none;
    border-radius: 10px;
    background: none;
    color: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0.72;
}

.az-asr-icon-btn:active {
    background: rgba(127, 127, 127, 0.14);
}

/* 默认勾：非默认只是淡淡的描边提示可点，默认才是主题色实勾 */
.az-asr-default-btn {
    opacity: 0.22;
}

.az-asr-default-btn[aria-pressed="true"],
.az-asr-default-btn[data-vs-default="true"] {
    opacity: 1;
    color: var(--accent);
}

.az-asr-add {
    width: 100%;
    margin: 0 0 6px;
    padding: 9px 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: 1px dashed rgba(127, 127, 127, 0.4);
    border-radius: 10px;
    background: none;
    color: inherit;
    font-size: 0.82rem;
    cursor: pointer;
    opacity: 0.8;
}

.az-asr-add .az-asr-icon {
    width: 16px;
    height: 16px;
}

.az-asr-link {
    margin: 0;
    padding: 4px 0;
    border: none;
    background: none;
    color: var(--accent);
    font-size: 0.8rem;
    cursor: pointer;
}

.infolayer-row[data-voiceprint-row] {
    gap: 8px;
    font-size: 0.82rem;
    line-height: 1.5;
}

.infolayer-row[data-voiceprint-row] > span,
.infolayer-row[data-voiceprint-row] .az-asr-link {
    font: inherit;
    white-space: nowrap;
}

.infolayer-row[data-voiceprint-row] > span:nth-child(2) {
    margin-right: auto;
    overflow: hidden;
    text-overflow: ellipsis;
}

.infolayer-row[data-voiceprint-row] .az-asr-link {
    flex-shrink: 0;
    align-self: center;
}

.az-asr-lab-btn {
    width: 100%;
    margin: 8px 0 0;
    padding: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: 1px solid rgba(127, 127, 127, 0.28);
    border-radius: 10px;
    background: var(--card-bg);
    color: inherit;
    font-size: 0.84rem;
    cursor: pointer;
}

.az-asr-lab-btn .az-asr-icon {
    width: 16px;
    height: 16px;
}

/* ---- 全屏页 ---- */
.az-asr-page {
    position: fixed;
    inset: 0;
    z-index: 12500;
    display: flex;
    flex-direction: column;
    background: var(--bg);
    color: var(--text);
    padding-top: env(safe-area-inset-top, 0px);
}

.az-asr-page-head {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 8px 8px 6px;
    flex-shrink: 0;
}

.az-asr-page-head .az-asr-icon-btn {
    opacity: 0.9;
}

.az-asr-page-title {
    flex: 1;
    margin: 0;
    font-size: 1.05rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.az-asr-head-spacer {
    width: 36px;
}

.az-asr-page-body {
    flex: 1;
    overflow-y: auto;
    padding: 4px 16px calc(24px + env(safe-area-inset-bottom, 0px));
    -webkit-overflow-scrolling: touch;
}

.az-asr-group-label {
    margin: 14px 4px 6px;
    font-size: 0.78rem;
    opacity: 0.6;
}

.az-asr-group-label[hidden] {
    display: none;
}

.az-asr-card {
    padding: 12px;
    border-radius: 14px;
    background: var(--card-bg);
    border: 1px solid rgba(127, 127, 127, 0.14);
}

.az-asr-sub-label {
    font-size: 0.72rem;
    opacity: 0.55;
    margin: 0 0 8px 2px;
}

.az-asr-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.az-asr-chip {
    margin: 0;
    padding: 8px 14px;
    border-radius: 12px;
    border: 1px solid rgba(127, 127, 127, 0.22);
    background: rgba(127, 127, 127, 0.08);
    color: inherit;
    font-size: 0.84rem;
    cursor: pointer;
}

.az-asr-chip.is-active {
    border-color: var(--accent);
    color: var(--accent);
    background: rgba(var(--accent-rgb, 127, 127, 127), 0.12);
}

.az-asr-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 12px;
}

.az-asr-label {
    font-size: 0.76rem;
    opacity: 0.65;
    margin-left: 2px;
}

.az-asr-field input,
.az-asr-field select,
.az-asr-field textarea {
    width: 100%;
    margin: 0;
    box-sizing: border-box;
}

.az-asr-field textarea {
    font-family: inherit;
    resize: vertical;
    min-height: 180px;
}

.az-asr-input-wrap {
    position: relative;
    display: block;
}

/* 带显隐按钮的输入框（明文显示时也要给眼睛留位置） */
.az-asr-input-wrap input[type="password"],
.az-asr-input-wrap:has(.az-asr-eye) input {
    padding-right: 44px;
}

.az-asr-eye {
    position: absolute;
    right: 2px;
    top: 50%;
    transform: translateY(-50%);
}

.az-asr-hint {
    font-size: 0.72rem;
    line-height: 1.55;
    opacity: 0.55;
    margin-left: 2px;
}

.az-asr-capability {
    font-size: 0.74rem;
    line-height: 1.6;
    opacity: 0.6;
    padding: 2px 2px 0;
}

.az-asr-save {
    width: 100%;
    margin: 16px 0 0;
    padding: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border-radius: 14px;
    border: 1px solid var(--accent);
    background: rgba(var(--accent-rgb, 127, 127, 127), 0.1);
    color: var(--accent);
    font-size: 0.9rem;
    cursor: pointer;
}

.az-asr-save .az-asr-icon {
    width: 18px;
    height: 18px;
}

/* ---- 测试识别 ---- */
.az-asr-lab-top {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 18px 12px 12px;
}

.az-asr-record {
    width: 72px;
    height: 72px;
    margin: 0;
    padding: 0;
    border-radius: 50%;
    border: 1px solid var(--accent);
    background: rgba(var(--accent-rgb, 127, 127, 127), 0.12);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.az-asr-record .az-asr-icon {
    width: 30px;
    height: 30px;
}

.az-asr-record.is-recording {
    background: var(--accent);
    color: var(--card-bg);
    animation: az-asr-pulse 1.4s ease-in-out infinite;
}

@keyframes az-asr-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(var(--accent-rgb, 127, 127, 127), 0.35); }
    50% { box-shadow: 0 0 0 12px rgba(var(--accent-rgb, 127, 127, 127), 0); }
}

@media (prefers-reduced-motion: reduce) {
    .az-asr-record.is-recording { animation: none; }
}

.az-asr-record-hint {
    font-size: 0.78rem;
    opacity: 0.65;
    text-align: center;
}

.az-asr-inline {
    flex-direction: row;
    align-items: center;
    gap: 10px;
    margin: 0;
    width: 100%;
}

.az-asr-inline .az-asr-label {
    flex-shrink: 0;
}

.az-asr-results {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px;
}

.az-asr-result,
.az-asr-diag {
    padding: 11px 12px;
    border-radius: 12px;
    background: var(--card-bg);
    border: 1px solid rgba(127, 127, 127, 0.14);
}

.az-asr-result-head,
.az-asr-diag-head {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
    min-width: 0;
}

.az-asr-result-name {
    font-size: 0.82rem;
    font-weight: 600;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.az-asr-result-ms,
.az-asr-diag-time {
    margin-left: auto;
    font-size: 0.72rem;
    opacity: 0.55;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.az-asr-result-text,
.az-asr-diag-text {
    font-size: 0.86rem;
    line-height: 1.6;
    word-break: break-word;
}

.az-asr-result.is-failed .az-asr-result-text {
    opacity: 0.55;
}

.az-asr-result-hint {
    margin-top: 4px;
    font-size: 0.74rem;
    opacity: 0.62;
}

.az-asr-chip-sm {
    flex-shrink: 0;
    font-size: 0.62rem;
    line-height: 1;
    padding: 3px 7px;
    border-radius: 999px;
    border: 1px solid rgba(127, 127, 127, 0.35);
    opacity: 0.7;
    white-space: nowrap;
}

.az-asr-chip-sm.is-noise,
.az-asr-chip-sm.is-failed {
    border-color: var(--accent);
    color: var(--accent);
    opacity: 1;
}

.az-asr-diag-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.az-asr-diag-actions {
    display: flex;
    justify-content: flex-end;
    gap: 2px;
    margin-top: 4px;
}

/* ---- 刀1：折叠服务列表（两段共用） ---- */
.az-vs-section + .az-vs-section,
.az-vs-section + .infolayer-row {
    margin-top: 12px;
}

.az-vs-section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 0 0 6px 2px;
}

.az-vs-section-title {
    font-size: 0.8rem;
    opacity: 0.65;
    letter-spacing: 0.02em;
}

.az-vs-row-main {
    flex: 1;
    min-width: 0;
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    border: none;
    background: none;
    color: inherit;
    text-align: left;
    cursor: pointer;
}

.az-vs-chevron {
    opacity: 0.55;
}

.az-vs-collapse {
    width: 100%;
    margin: 0;
    padding: 9px;
    border: none;
    border-top: 1px solid rgba(127, 127, 127, 0.16);
    background: none;
    color: inherit;
    font-size: 0.78rem;
    opacity: 0.6;
    cursor: pointer;
}

.az-vs-empty {
    padding: 14px 12px;
    border: 1px dashed rgba(127, 127, 127, 0.35);
    border-radius: 12px;
    font-size: 0.78rem;
    opacity: 0.6;
    text-align: center;
}

/* 高级音频设置：默认收起，技术参数不挡住常改的声音参数 */
.az-vs-advanced {
    margin-top: 14px;
}

.az-vs-advanced > summary {
    margin: 0 4px 6px;
    font-size: 0.78rem;
    opacity: 0.65;
    cursor: pointer;
    list-style: none;
}

.az-vs-advanced > summary::-webkit-details-marker {
    display: none;
}

.az-vs-advanced > summary::after {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    margin-left: 8px;
    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    transform: translateY(-2px) rotate(45deg);
}

.az-vs-advanced[open] > summary::after {
    transform: translateY(1px) rotate(-135deg);
}

.az-vs-text-btn {
    align-self: flex-start;
    margin: 2px 0 0;
    padding: 4px 0;
    border: none;
    background: none;
    color: var(--accent);
    font-size: 0.78rem;
    cursor: pointer;
}

/* ---- AI 设置「声音」（9-26）：每项右上角「跟随服务 / 单独调整」，语速音量音调用滑条 ---- */
.input-group.az-ctts-field { margin-bottom: 14px; }
.az-ctts-field [hidden] { display: none !important; }
.az-ctts-head {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 28px;
    margin-bottom: 6px;
}
.input-group.az-ctts-field .az-ctts-head label { margin: 0; }
.az-ctts-state {
    display: inline-flex;
    align-items: center;
    gap: 2px;
}
/* 信息管理作用域胶囊（AZInfoOverrides.ensureScopePill）直接塞进 .input-group 的 label 文本后，
   没有 TTS 行 .az-ctts-head 的 flex gap 垫着 —— 9-29 塔拉真机：label↔pill ≥8px、pill↔↻ ≥6px，
   对齐「语速 [跟随服务]」那排的呼吸感；带 [data-info-pill] 才生效，不动 TTS 行本身。 */
.az-ctts-state[data-info-pill] {
    margin-left: 8px;
    gap: 4px;
}
.az-ctts-tag {
    padding: 1px 7px;
    border-radius: 999px;
    border: 1px solid rgba(127, 127, 127, 0.25);
    font-size: 0.68rem;
    line-height: 1.5;
    opacity: 0.7;
    white-space: nowrap;
}
.az-ctts-tag.is-own {
    border-color: var(--accent);
    color: var(--accent);
    opacity: 1;
}
.az-ctts-reset {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: none;
    color: var(--accent);
    cursor: pointer;
}
.az-ctts-reset .az-asr-icon { width: 15px; height: 15px; }
.input-group.az-ctts-field input.az-ctts-num {
    width: 76px;
    margin-left: auto;
    padding: 5px 8px;
    text-align: right;
    font-variant-numeric: tabular-nums;
}
/* 滑条自己画：原生 accent-color 在浅色主题上未填充段是近黑的粗条；已填充比例由 tts-services.js 写进 --ctts-fill */
.input-group.az-ctts-field input.az-ctts-range {
    -webkit-appearance: none;
    appearance: none;
    display: block;
    width: 100%;
    height: 24px;
    margin: 0;
    padding: 0;
    border: none;
    background: none;
}
.input-group.az-ctts-field input.az-ctts-range::-webkit-slider-runnable-track {
    height: 4px;
    border: none;
    border-radius: 999px;
    background: linear-gradient(to right, var(--accent) 0 var(--ctts-fill, 50%), rgba(127, 127, 127, 0.22) var(--ctts-fill, 50%) 100%);
}
.input-group.az-ctts-field input.az-ctts-range::-moz-range-track {
    height: 4px;
    border: none;
    border-radius: 999px;
    background: linear-gradient(to right, var(--accent) 0 var(--ctts-fill, 50%), rgba(127, 127, 127, 0.22) var(--ctts-fill, 50%) 100%);
}
.input-group.az-ctts-field input.az-ctts-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    margin-top: -7px;
    border: 2px solid var(--card-bg);
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18);
}
.input-group.az-ctts-field input.az-ctts-range::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border: 2px solid var(--card-bg);
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18);
}
.input-group.az-ctts-field input.az-ctts-mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.8rem;
    text-overflow: ellipsis;
}
.az-ctts-field.is-own input:not(.az-ctts-range),
.az-ctts-field.is-own select {
    border-color: rgba(var(--accent-rgb, 127, 127, 127), 0.55);
}
.az-ctts-group { display: block; }
.az-ctts-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}
.az-ctts-actions .az-asr-lab-btn { margin: 0; }

/* 让 AI 听见（9-26）：信息管理 → 会话与主动性「听你的语音」下的状态行 */
.az-listen-status {
    margin-top: 6px;
    font-size: 0.76rem;
    line-height: 1.5;
    opacity: 0.72;
}
.az-listen-status .az-vs-text-btn {
    margin-left: 6px;
}
