/* settings.css — 设置与其它非聊天页（备份、模型、记忆、音色等） */
/* 发起群聊选人 */
.group-create-screen { display: flex; flex-direction: column; min-height: 0; }
.group-pick-list { padding: 0 0 88px; }
.group-pick-row {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--line);
    color: var(--text);
}
.group-pick-row .titles { flex: 1; min-width: 0; }
.group-check {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 1.5px solid var(--check-border);
    flex-shrink: 0;
    box-sizing: border-box;
}
.group-check.on {
    border-color: var(--accent);
    background: var(--accent);
    box-shadow: inset 0 0 0 2px var(--check-ring);
    position: relative;
}
.group-check.on::after {
    content: "";
    position: absolute;
    left: 6px;
    top: 3px;
    width: 5px;
    height: 9px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}
.group-create-bar {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 4;
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px));
    background: var(--bar);
    border-top: 1px solid var(--line);
}
.group-chips {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    align-items: center;
    min-height: 44px;
}
.group-chips-hint { color: var(--sub); font-size: 13px; padding-left: 4px; }
.group-chip { padding: 0; flex-shrink: 0; }
.group-chip-av,
.group-chip .avatar,
.group-chip .avatar-fallback {
    width: 40px;
    height: 40px;
    font-size: 14px;
}
.nav-text-btn.disabled,
.nav-text-btn:disabled {
    opacity: 0.35;
    pointer-events: none;
}

.gear {
    position: absolute; left: 14px; bottom: 18px;
    width: 36px; height: 36px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: var(--icon); z-index: 5; padding: 0;
}
.gear svg { width: 22px; height: 22px; }

.dash-btn {
    margin: 18px 16px 28px;
    border: 1px dashed var(--ghost-border);
    border-radius: 12px;
    padding: 14px;
    color: var(--sub);
    width: calc(100% - 32px);
}

.field { padding: 10px 16px 0; }
.field label { display: block; font-size: 12px; color: var(--sub); margin-bottom: 6px; }
.field input, .field textarea {
    width: 100%;
    background: var(--input);
    border: 1px solid var(--field-border);
    border-radius: 10px;
    padding: 10px 12px;
}
.field textarea { min-height: 88px; line-height: 1.5; }

/* 人设 / 规则编辑：文本框占满导航下方剩余高度 */
.scroll.fill-editor {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding-bottom: 12px;
}
.fill-editor-field {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    padding-bottom: 0;
}
.fill-editor-field textarea {
    flex: 1;
    min-height: 0;
    height: 100%;
    resize: none;
}

.persona-editor .persona-label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 6px;
}
.persona-editor .persona-label-row label {
    margin-bottom: 0;
}
.persona-hint {
    font-size: 12px;
    color: var(--sub);
    line-height: 1.4;
    margin: -2px 0 8px;
}
.persona-ai-btn {
    flex-shrink: 0;
    font-size: 13px;
    color: var(--accent);
    padding: 4px 10px;
    border-radius: 14px;
    background: var(--accent-soft);
}
.persona-ai-btn:disabled {
    opacity: 0.5;
}
.persona-editor #c-basic-persona {
    min-height: 72px;
    width: 100%;
    background: var(--input);
    border-radius: 10px;
    padding: 10px 12px;
    color: var(--text);
    line-height: 1.5;
    resize: vertical;
    box-sizing: border-box;
}

.voice-edit-tune { padding-bottom: 4px; }
.voice-edit-tune label {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.voice-edit-val {
    font-size: 12px;
    color: var(--sub);
    font-variant-numeric: tabular-nums;
}
.voice-edit-tune input[type="range"] {
    width: 100%;
    height: 4px;
    margin: 10px 0 6px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--track);
    border-radius: 2px;
    outline: none;
}
.voice-edit-tune input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--thumb);
    border: none;
    box-shadow: 0 1px 3px rgba(0,0,0,.45);
}
.voice-edit-tune input[type="range"]::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--thumb);
    border: none;
    box-shadow: 0 1px 3px rgba(0,0,0,.45);
}
.voice-edit-tune input[type="range"]::-moz-range-track {
    height: 4px;
    background: var(--track);
    border-radius: 2px;
}
.voice-edit-tune input[type="range"]:active::-webkit-slider-thumb,
.voice-edit-tune input[type="range"]:active::-moz-range-thumb {
    background: var(--accent);
}

.voice-lib-front.selected { background: var(--select); }
.char-name {
    flex: 1;
    min-width: 0;
    text-align: left;
}

.voice-preview {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--icon);
    border-radius: 10px;
    margin: -4px 0;
}
.voice-preview svg,
.voice-preview .speaker-ico {
    width: 22px;
    height: 22px;
    display: block;
}
.voice-preview:active { background: rgba(255,255,255,.08); }
.voice-preview .speaker-wave {
    transform-box: fill-box;
    transform-origin: 20% 50%;
    opacity: 1;
    transform: none;
}
.voice-preview:not(.playing) .speaker-wave-1,
.voice-preview:not(.playing) .speaker-wave-2 {
    animation: none;
    opacity: 1;
    transform: none;
}
/* 参考 iOS / 微信：无声 → 内圈 → 双圈 → 外圈 → 循环 */
.voice-preview.playing .speaker-wave-1 {
    animation: spk-wave-1 1.05s cubic-bezier(0.45, 0.05, 0.25, 1) infinite;
}
.voice-preview.playing .speaker-wave-2 {
    animation: spk-wave-2 1.05s cubic-bezier(0.45, 0.05, 0.25, 1) infinite;
}
@keyframes spk-wave-1 {
    0%, 100% { opacity: 0; transform: scale(0.88); }
    18%, 48% { opacity: 1; transform: scale(1); }
    68% { opacity: 0; transform: scale(1.02); }
}
@keyframes spk-wave-2 {
    0%, 18% { opacity: 0; transform: scale(0.88); }
    48%, 78% { opacity: 1; transform: scale(1); }
    100% { opacity: 0; transform: scale(1.02); }
}
@media (prefers-reduced-motion: reduce) {
    .voice-preview.playing .speaker-wave-1,
    .voice-preview.playing .speaker-wave-2 {
        animation: none;
        opacity: 1;
        transform: none;
    }
}

.voice-lib-table { border-bottom: 1px solid var(--line); }
.voice-tune-head {
    display: grid;
    grid-template-columns: 40px 1fr 52px 52px 22px;
    gap: 8px;
    align-items: center;
    padding: 8px 16px;
    border-bottom: 1px solid var(--line);
    color: var(--sub);
    font-size: 12px;
    background: var(--chrome);
    position: sticky;
    top: 0;
    z-index: 2;
}
.voice-head-name { text-align: left; }
.voice-head-num { text-align: center; font-variant-numeric: tabular-nums; }
.voice-head-slot { width: 22px; }

.voice-lib-front {
    min-height: 64px;
    align-items: center;
    display: grid;
    grid-template-columns: 40px 1fr 52px 52px 22px;
    gap: 8px;
    width: 100%;
}
.voice-main {
    min-width: 0;
    text-align: left;
    background: transparent;
    color: inherit;
    padding: 0;
}
.voice-main .t {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.voice-tune-num {
    text-align: center;
    font-size: 13px;
    color: var(--sub);
    font-variant-numeric: tabular-nums;
    padding: 6px 4px;
    border-radius: 8px;
    cursor: ns-resize;
    user-select: none;
    outline: none;
    transition: background .15s ease, color .15s ease, box-shadow .15s ease;
}
.voice-tune-num:hover,
.voice-tune-num:focus {
    color: var(--text);
    background: var(--accent-soft);
    box-shadow: 0 0 0 1px var(--accent-soft);
}
.reply-max-num {
    flex-shrink: 0;
    min-width: 40px;
    text-align: center;
    font-size: 14px;
    color: var(--sub);
    font-variant-numeric: tabular-nums;
    padding: 6px 10px;
    border-radius: 8px;
    cursor: ns-resize;
    user-select: none;
    outline: none;
    transition: background .15s ease, color .15s ease, box-shadow .15s ease;
}
.reply-max-num:hover,
.reply-max-num:focus {
    color: var(--text);
    background: var(--accent-soft);
    box-shadow: 0 0 0 1px var(--accent-soft);
}
#reply-rule-list {
    display: flex;
    flex-direction: column;
}
.reply-rule-row {
    touch-action: pan-y;
    background: var(--bg);
}
.reply-rule-row.is-dragging {
    box-shadow: 0 10px 28px rgba(0,0,0,.55);
    border-radius: 10px;
    background: var(--chrome-2);
    will-change: transform;
}
#reply-rule-list.reply-dragging {
    user-select: none;
    -webkit-user-select: none;
}
#reply-rule-list.reply-dragging .reply-rule-row:not(.is-dragging) {
    will-change: transform;
}
.voice-lib-front .chev,
.voice-pick-mark {
    justify-self: end;
    text-align: right;
    min-width: 18px;
    color: var(--text);
    font-size: 15px;
}
.voice-pick-row {
    background: var(--bg);
}
.voice-pick-front {
    cursor: pointer;
}
.voice-lib-row {
    touch-action: pan-y;
    background: var(--bg);
}
.voice-lib-row.is-dragging {
    box-shadow: 0 10px 28px rgba(0,0,0,.55);
    border-radius: 10px;
    background: var(--chrome-2);
    will-change: transform;
}
.voice-lib-row.is-dragging .swipe-front {
    border-bottom-color: transparent;
}
#voice-lib-list.voice-dragging {
    user-select: none;
    -webkit-user-select: none;
}
#voice-lib-list.voice-dragging .voice-lib-row:not(.is-dragging) {
    will-change: transform;
}

.toast {
    position: absolute; left: 50%; bottom: calc(80px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%);
    background: rgba(30,30,32,.94); color: #fff;
    padding: 10px 16px; border-radius: 10px; font-size: 13px;
    max-width: 80%; z-index: 20; pointer-events: none;
}
.mask {
    position: absolute; inset: 0; background: rgba(0,0,0,.55);
    display: flex; align-items: flex-end; z-index: 15;
    box-sizing: border-box;
    padding:
        env(safe-area-inset-top, 0px)
        env(safe-area-inset-right, 0px)
        env(safe-area-inset-bottom, 0px)
        env(safe-area-inset-left, 0px);
}
.mask:has(.dialog) {
    align-items: center;
    justify-content: center;
}
.sheet {
    width: 100%; background: var(--sheet); border-radius: 16px 16px 0 0;
    padding: 8px 0 20px;
}
.sheet-item { width: 100%; padding: 14px 18px; text-align: left; font-size: 16px; }
.sheet-item.danger { color: var(--red); }
.dialog {
    margin: 0 24px; background: var(--dialog); border-radius: 14px; padding: 18px;
    width: 100%; max-width: 320px;
}
.dialog h3 { font-size: 16px; margin-bottom: 8px; }
.dialog p { font-size: 13px; color: var(--sub); margin-bottom: 16px; }
.dialog .acts { display: flex; justify-content: flex-end; gap: 8px; }
.dialog .acts-three { flex-wrap: wrap; justify-content: stretch; }
.dialog .acts-three button { flex: 1 1 auto; min-width: 0; padding: 8px 10px; }
.dialog .ok { color: var(--red); padding: 6px 8px; }

.placeholder-note {
    margin: 20px 16px; color: var(--sub); font-size: 13px; line-height: 1.6;
}

.star { color: var(--weak); width: 28px; flex-shrink: 0; }
.star.on { color: var(--accent); }
.star svg { width: 22px; height: 22px; }

.mem-item { padding: 12px 16px; border-bottom: 1px solid var(--line); }
.mem-item .mem-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}
.mem-item .when {
    flex: 1;
    min-width: 0;
    color: var(--sub);
    font-size: 11px;
    line-height: 1.3;
}
.mem-item .mem-del {
    appearance: none;
    border: 0;
    background: transparent;
    color: var(--sub);
    width: 22px;
    height: 22px;
    padding: 0;
    margin: 0;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0.9;
}
.mem-item .mem-del svg {
    width: 16px;
    height: 16px;
    display: block;
}
.mem-item .mem-del:active { opacity: 0.55; }
.mem-item .tx {
    font-size: 14px;
    line-height: 1.45;
    white-space: pre-wrap;
    cursor: text;
    border-radius: 6px;
    outline: none;
}
.mem-item .tx:focus {
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.12);
}
.mem-item textarea.mem-edit {
    width: 100%;
    box-sizing: border-box;
    margin: 0;
    padding: 6px 8px;
    font: inherit;
    font-size: 14px;
    line-height: 1.45;
    color: inherit;
    background: rgba(255,255,255,.06);
    border: 1px solid rgba(255,255,255,.14);
    border-radius: 6px;
    resize: vertical;
    outline: none;
}

/* 记忆库：顶部工具栏 + 折叠分类 */
.mem-screen .mem-scroll {
    padding-bottom: 24px;
}
.mem-toolbar {
    display: flex;
    gap: 10px;
    padding: 14px 16px 10px;
    justify-content: space-between;
}
.mem-tool-btn {
    flex: 1;
    min-width: 0;
    min-height: 68px;
    padding: 8px 4px 6px;
    border: 1px solid var(--panel-border);
    border-radius: 12px;
    background: var(--panel-bg);
    color: var(--panel-ink);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    transition: border-color .18s, background .18s;
}
.mem-tool-ico {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.mem-tool-btn svg {
    width: 20px;
    height: 20px;
    display: block;
}
.mem-tool-label {
    font-size: 10px;
    line-height: 1.2;
    color: var(--panel-ink-sub);
    letter-spacing: 0.02em;
    white-space: nowrap;
}
.mem-tool-btn.on .mem-tool-label {
    color: var(--accent);
}
.mem-tool-btn:active {
    opacity: 0.72;
}
.mem-tool-btn.on {
    border-color: var(--accent);
    background: var(--accent-soft);
    box-shadow: inset 0 0 0 1px var(--accent-soft);
}
.mem-write-panel {
    padding: 0 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.mem-write-panel textarea {
    width: 100%;
    box-sizing: border-box;
    min-height: 72px;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid var(--field-border);
    background: var(--field);
    color: inherit;
    font-size: 14px;
    line-height: 1.45;
    resize: vertical;
    outline: none;
}
.mem-write-panel textarea:focus {
    border-color: var(--accent);
    box-shadow: inset 0 0 0 1px var(--accent-soft);
}
.mem-write-submit {
    align-self: flex-end;
    padding: 6px 14px;
    border-radius: 8px;
    border: 1px solid var(--accent);
    background: var(--accent);
    color: var(--on-accent);
    font-size: 13px;
}
.mem-sections {
    border-top: 1px solid var(--line);
}
.mem-section {
    border-bottom: 1px solid var(--line);
}
.mem-section-hd {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 16px;
    background: rgba(255,255,255,.025);
    border: 0;
    color: var(--text);
    font-size: 14px;
    text-align: left;
}
/* 与设置主列表 .row .t 同字号、字重、颜色，不要加粗 */
.model-groups .mem-section-hd {
    font-size: 16px;
    font-weight: 400;
    color: var(--text);
}
.model-groups .mem-section-title {
    font-weight: inherit;
}
.mem-section-title {
    flex: 1;
    min-width: 0;
    font-weight: 500;
}
.mem-section-count {
    color: var(--sub);
    font-size: 12px;
    font-variant-numeric: tabular-nums;
}
.mem-section-chev {
    width: 18px;
    height: 18px;
    color: var(--sub);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform .2s ease;
}
.mem-section-chev svg {
    width: 16px;
    height: 16px;
    display: block;
}
.mem-section.open .mem-section-chev {
    transform: rotate(90deg);
}
.mem-section-body {
    display: none;
}
.mem-section.open .mem-section-body {
    display: block;
}
.mem-empty {
    padding: 14px 16px 16px;
    color: var(--sub);
    font-size: 13px;
}

.export-check {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    min-height: 48px;
    border-bottom: 1px solid var(--line);
    font-size: 16px;
    cursor: pointer;
}
.export-check input {
    appearance: none;
    width: 20px;
    height: 20px;
    margin: 0;
    border: 2px solid var(--sub);
    border-radius: 4px;
    background: transparent;
    display: grid;
    place-content: center;
    flex-shrink: 0;
}
.export-check input:checked {
    background: var(--accent);
    border-color: var(--accent);
}
.export-check input:checked::after {
    content: "";
    width: 5px;
    height: 9px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg) translate(-1px, -1px);
}
[data-theme="light"] .export-check input:checked::after {
    border-color: #fff;
}
.export-check input:focus-visible,
.export-btn:focus-visible,
.export-again:focus-visible {
    outline: 2px solid var(--text);
    outline-offset: 3px;
}
.export-hint { padding-top: 8px; padding-bottom: 4px; }
.export-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 8px 16px 4px;
}
.export-btn {
    width: 100%;
    min-height: 44px;
    border-radius: 12px;
    padding: 12px 14px;
    font-size: 16px;
    border: 1px solid transparent;
}
.export-btn:disabled { opacity: 0.55; cursor: default; }
.export-btn-primary { background: var(--accent); color: var(--on-accent); }
.export-btn-secondary {
    background: transparent;
    color: var(--text);
    border-color: var(--ghost-border);
}
.export-status {
    padding: 4px 16px 12px;
    font-size: 13px;
    line-height: 1.45;
    min-height: 1.2em;
    color: var(--sub);
}
.export-status.is-success { color: var(--green); }
.export-status.is-error { color: var(--red); }
.export-status.is-info { color: var(--text); }
.export-again { color: var(--link); text-decoration: underline; }
.export-status.is-partial { color: var(--warn); }
.export-status.is-progress { color: var(--text); }
.import-key-note {
    padding: 0 16px 8px;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text);
}
.import-file-input {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    clip-path: inset(50%);
    border: 0;
    white-space: nowrap;
}
#reembed-memories-btn:focus-visible,
#import-keep-keys:focus-visible {
    outline: 2px solid var(--text);
    outline-offset: 3px;
}

/* 亮色：列表区用 --bg2。头像框、角色卡、哄睡走卡片令牌，不在这里改结构 */
[data-theme="light"] .row,
[data-theme="light"] .swipe-front,
[data-theme="light"] .friend-row,
[data-theme="light"] .group-pick-row,
[data-theme="light"] .export-check,
[data-theme="light"] .search-msg-row,
[data-theme="light"] .me-profile-sec-row,
[data-theme="light"] .voice-pick-row,
[data-theme="light"] .reply-rule-row,
[data-theme="light"] .voice-lib-row,
[data-theme="light"] .mem-section-hd {
    background: var(--bg2);
}
