/* ==========================================================================
 * 数字人设置页专属样式
 * 组件本身的样式（悬浮球、舞台、形象、快捷设置框）在 digital-human.css 里
 * ========================================================================== */

.settings-wrap {
    max-width: 1180px;
    margin: 0 auto;
    padding: 2rem 1.5rem 3rem;
}

/* 内容区顶部的小返回链接。顶栏已经和其它页面统一成四段式，
   「返回」就挪到这里；从站内点进来会真的退回来路 */
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.8rem;
    color: #64748b;
    text-decoration: none;
    padding: 0.32rem 0.85rem 0.32rem 0.65rem;
    border-radius: 2rem;
    background: white;
    border: 1px solid rgba(203,213,225,0.5);
    transition: all 0.2s;
    margin-bottom: 1rem;
}

.back-link:hover {
    color: #3b82f6;
    border-color: #3b82f6;
}

.settings-head {
    margin-bottom: 1.5rem;
}

.settings-head h1 {
    font-size: 1.45rem;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 0.55rem;
}

.settings-head h1 i {
    color: #3b82f6;
}

.settings-head p {
    color: #64748b;
    font-size: 0.85rem;
    margin-top: 0.45rem;
    line-height: 1.6;
}

/* 卡片分左右两列。为什么不用纯 CSS：
   - grid 的行高由整行最高的卡片决定，矮卡片下面必然留一大段空白
   - columns（瀑布流）按高度自动平衡，没法保证「形象预览」和「3D 形象」固定并排
   所以两列的分配由 dh-settings.js 的 arrangeCards() 按各卡的 data-col 属性来做。
   这里给的是兜底样式：万一脚本没跑到，卡片会作为弹性项排成可换行的两列，仍然可读 */
.settings-grid {
    display: flex;
    gap: 1.25rem;
    align-items: flex-start;
    flex-wrap: wrap;
}

/* 一列 */
.settings-col {
    flex: 1 1 0;
    min-width: 0;              /* 允许比内容窄，否则长文本会把列撑开 */
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.settings-grid > .settings-card { flex: 1 1 320px; }   /* 只在还没分列时生效 */
.settings-col > .settings-card { width: 100%; }

.settings-card {
    background: white;
    border-radius: 1.5rem;
    border: 1px solid rgba(203,213,225,0.5);
    box-shadow: 0 8px 30px rgba(0,0,0,0.05);
    padding: 1.5rem;
}

.settings-card h2 {
    font-size: 1rem;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 0.45rem;
    margin-bottom: 1.1rem;
}

.settings-card h2 i {
    color: #3b82f6;
    font-size: 0.9rem;
}

/* ======================== 预览区 ======================== */
.dh-preview-frame {
    position: relative;
    height: 340px;
    border-radius: 1rem;
    overflow: hidden;
    background: #0f172a;
    margin-bottom: 1.1rem;
}

/* 调试台要的是稳定，所以关掉进场和呼吸动画 */
.dh-preview-frame .dh-avatar {
    left: 1.5rem;
    height: 88%;
}

.dh-preview-frame .dh-avatar svg {
    animation: none;
}

.dh-preview-frame .dh-subtitle {
    font-size: 0.82rem;
    bottom: 0.85rem;
    max-width: 88%;
}

/* ======================== 调试台 ======================== */
.debug-group {
    margin-bottom: 0.9rem;
}

.debug-label {
    font-size: 0.78rem;
    color: #475569;
    margin-bottom: 0.45rem;
}

.chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.chip {
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    color: #475569;
    font-size: 0.75rem;
    padding: 0.3rem 0.72rem;
    border-radius: 2rem;
    cursor: pointer;
    transition: all 0.2s;
}

.chip:hover {
    border-color: #3b82f6;
    color: #3b82f6;
}

.chip.active {
    background: #3b82f6;
    border-color: #3b82f6;
    color: white;
}

/* ======================== 表单控件 ======================== */
.text-input {
    flex: 1;
    min-width: 0;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 2rem;
    color: #1e293b;
    font-size: 0.78rem;
    padding: 0.4rem 0.85rem;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.text-input:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}

.settings-card .dh-row {
    margin-bottom: 0.85rem;
}

.settings-card .dh-row-label {
    font-size: 0.82rem;
}

.settings-card .dh-select {
    flex: 0 1 auto;
    min-width: 10rem;
    padding: 0.35rem 0.7rem;
    font-size: 0.78rem;
}

.settings-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
    margin-top: 1rem;
}

.btn-primary,
.btn-ghost {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    border: none;
    border-radius: 2rem;
    font-size: 0.8rem;
    padding: 0.5rem 1.1rem;
    cursor: pointer;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.btn-primary {
    background: #3b82f6;
    color: white;
}

.btn-primary:hover {
    background: #2563eb;
}

.btn-ghost {
    background: white;
    color: #475569;
    border: 1px solid #e2e8f0;
}

.btn-ghost:hover {
    border-color: #3b82f6;
    color: #3b82f6;
}

.hint {
    font-size: 0.75rem;
    color: #94a3b8;
    line-height: 1.65;
    margin-top: 0.7rem;
}

/* 3D 形象卡：换模型失败时状态行变红 */
.hint.is-error {
    color: #dc2626;
}

/* 署名行 —— 模型的许可标注是 creditNotation: required，这一行不能删 */
.hint.credit {
    margin-top: 1rem;
    padding-top: 0.7rem;
    border-top: 1px dashed #e2e8f0;
    color: #64748b;
}

.hint code {
    background: #f1f5f9;
    color: #475569;
    font-size: 0.72rem;
    padding: 0.1rem 0.35rem;
    border-radius: 0.35rem;
}

/* 课时还没写正式台词时的提示条 */
.hint.fallback-note {
    color: #b45309;
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 0.7rem;
    padding: 0.55rem 0.8rem;
    margin: 0 0 0.7rem;
}

/* ======================== 驱动自检列表 ======================== */
.report-list {
    display: flex;
    flex-direction: column;
}

.report-item {
    display: flex;
    gap: 0.6rem;
    padding: 0.7rem 0;
    border-bottom: 1px solid #eef2ff;
}

.report-item:last-child {
    border-bottom: none;
}

.report-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-top: 0.35rem;
    flex: none;
}

.report-dot.ok {
    background: #10b981;
}

.report-dot.no {
    background: #cbd5e1;
}

.report-name {
    font-size: 0.82rem;
    font-weight: 600;
    color: #1e293b;
}

.report-name .badge {
    font-size: 0.68rem;
    font-weight: 400;
    color: #10b981;
    margin-left: 0.4rem;
}

.report-name .badge.off {
    color: #94a3b8;
}

.report-detail {
    font-size: 0.74rem;
    color: #64748b;
    margin-top: 0.2rem;
    line-height: 1.55;
}

.report-result {
    font-size: 0.78rem;
    line-height: 1.6;
    margin-top: 0.75rem;
    color: #475569;
    min-height: 1.2rem;
    word-break: break-all;
}

/* ======================== 接口约定 ======================== */
.api-spec {
    margin-top: 0.9rem;
    border-top: 1px solid #eef2ff;
    padding-top: 0.8rem;
}

.api-spec summary {
    font-size: 0.78rem;
    color: #3b82f6;
    cursor: pointer;
    outline: none;
}

.api-spec pre {
    margin-top: 0.6rem;
    background: #f8fafc;
    border: 1px solid #eef2ff;
    border-radius: 0.7rem;
    padding: 0.8rem;
    font-size: 0.72rem;
    line-height: 1.65;
    color: #475569;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-all;
}

/* ======================== 脚本列表 ======================== */
.script-list {
    margin-top: 0.9rem;
}

.script-item {
    display: flex;
    align-items: flex-start;
    gap: 0.8rem;
    padding: 0.75rem 0.9rem;
    border: 1px solid #eef2ff;
    border-radius: 0.9rem;
    margin-bottom: 0.55rem;
    transition: border-color 0.2s;
}

.script-item:hover {
    border-color: #dbeafe;
}

.script-item.playing {
    border-color: #3b82f6;
    background: #f8fbff;
}

.script-idx {
    flex: none;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #eef2ff;
    color: #3b82f6;
    font-size: 0.7rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 0.1rem;
}

.script-text {
    flex: 1;
    min-width: 0;
    font-size: 0.82rem;
    color: #334155;
    line-height: 1.6;
}

.script-meta {
    font-size: 0.7rem;
    color: #94a3b8;
    margin-top: 0.3rem;
}

.script-meta span {
    margin-right: 0.7rem;
}

.script-play {
    flex: none;
    border: 1px solid #e2e8f0;
    background: white;
    color: #475569;
    font-size: 0.72rem;
    padding: 0.28rem 0.7rem;
    border-radius: 2rem;
    cursor: pointer;
    transition: all 0.2s;
}

.script-play:hover {
    border-color: #3b82f6;
    color: #3b82f6;
}

/* ======================== 响应式 ======================== */
@media (max-width: 900px) {
    /* 窄屏回到单列：把两列容器也变成纵向排列 */
    .settings-grid {
        flex-direction: column;
    }
    .settings-col {
        width: 100%;
    }
}

@media (max-width: 640px) {
    .settings-wrap {
        padding: 1.5rem 1rem 2.5rem;
    }
    .settings-card {
        padding: 1.15rem;
        border-radius: 1.2rem;
    }
    .dh-preview-frame {
        height: 260px;
    }
    .settings-card .dh-select {
        min-width: 0;
        flex: 1;
    }
}
