/* ============================================================
   反推提示词模块（图片 → 提示词）
   与「灵感模板」同为 module-view；视觉沿用全站的 .card / card-header / card-body，
   颜色走 workspace 的 --ds-* 令牌，深色模式自动跟随。
   ============================================================ */

.desc-wrap {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px 28px 36px;
}

/* ---- 页头 ---- */
.desc-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
}

.desc-title {
    font-size: 21px;
    font-weight: 750;
    color: var(--text-heading);
    letter-spacing: .01em;
}

.desc-subtitle {
    margin-top: 5px;
    font-size: 12.5px;
    color: var(--text-muted);
}

.desc-head-tip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    margin-top: 4px;
    padding: 7px 11px;
    border: 1px solid var(--border-light);
    border-radius: 9px;
    background: var(--ds-surface-muted, var(--bg));
    font-size: 11.5px;
    color: var(--text-muted);
}

/* ---- 两栏：等高 ---- */
.desc-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 16px;
    align-items: stretch;
}

.desc-card {
    display: flex;
    flex-direction: column;
    margin-bottom: 0;
    min-width: 0;
}

.desc-card .card-header svg {
    flex-shrink: 0;
    color: var(--text-muted);
}

.desc-head-hint {
    margin-left: auto;
    font-size: 11.5px;
    font-weight: 500;
    color: var(--text-muted);
}

.desc-card .card-body.desc-body {
    display: flex;
    flex-direction: column;
    gap: 14px;
    flex: 1;
    min-width: 0;
}

/* ---- 选图 ---- */
.desc-drop {
    min-height: 150px;
    gap: 6px;
}

.desc-preview {
    display: flex;
    flex-direction: column;
}

.desc-figure {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 240px;
    border: 1px solid var(--border-light);
    border-radius: 12px;
    background: var(--ds-surface-muted, var(--bg));
    overflow: hidden;
}

.desc-figure img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.desc-preview-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
}

.desc-file {
    flex: 1;
    min-width: 0;
    font-size: 12px;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.desc-ghost-btn {
    flex-shrink: 0;
    padding: 5px 10px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--primary);
    font-family: inherit;
    font-size: 12.5px;
    font-weight: 650;
    cursor: pointer;
}

.desc-ghost-btn:hover {
    background: var(--primary-light);
}

/* ---- 参数 ---- */
.desc-fields {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 12px;
}

.desc-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
}

.desc-field.desc-wide {
    grid-column: 1 / -1;
}

.desc-field select,
.desc-field input[type="text"] {
    width: 100%;
    height: 38px;
    padding: 0 11px;
    border: 1px solid var(--border-light);
    border-radius: 10px;
    background: var(--card-bg);
    color: var(--text);
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
}

.desc-field input[type="text"]::placeholder {
    color: var(--text-muted);
    font-weight: 400;
}

.desc-field select:focus,
.desc-field input[type="text"]:focus,
.desc-text:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

/* ---- 主按钮（与创作页 .btn-generate 同一视觉语言） ---- */
.desc-run {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    min-height: 46px;
    margin-top: auto;
    border: 1px solid var(--primary);
    border-radius: 11px;
    background: var(--primary);
    color: #fff;
    font-family: inherit;
    font-size: 14.5px;
    font-weight: 700;
    letter-spacing: .02em;
    cursor: pointer;
    box-shadow: 0 10px 24px rgba(15, 118, 110, .18);
    transition: background .2s, box-shadow .2s, transform .12s;
}

.desc-run:hover:not(:disabled) {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 12px 28px rgba(15, 118, 110, .22);
}

.desc-run:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 4px 10px rgba(15, 118, 110, .18);
}

.desc-run:disabled {
    cursor: progress;
    opacity: .75;
    transform: none;
}

/* ---- 结果 ---- */
.desc-meta {
    margin-left: auto;
    font-size: 11.5px;
    font-weight: 600;
    color: var(--text-muted);
}

.desc-meta.is-error {
    color: #c0392b;
}

.desc-result {
    position: relative;
    display: flex;
    flex: 1;
    min-height: 300px;
}

.desc-text {
    flex: 1;
    width: 100%;
    min-height: 300px;
    padding: 14px 16px;
    border: 1px solid var(--border-light);
    border-radius: 12px;
    background: var(--card-bg);
    color: var(--text);
    font-family: inherit;
    font-size: 13.5px;
    line-height: 1.95;
    resize: vertical;
}

.desc-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-size: 12.5px;
    line-height: 2;
    color: var(--text-muted);
    pointer-events: none;
}

.desc-result.has-text .desc-placeholder {
    display: none;
}

.desc-actions {
    display: flex;
    gap: 10px;
}

.desc-btn {
    flex: 1;
    min-height: 42px;
    border: 1px solid var(--border-light);
    border-radius: 10px;
    background: transparent;
    color: var(--text);
    font-family: inherit;
    font-size: 13.5px;
    font-weight: 650;
    cursor: pointer;
    transition: border-color .2s, background .2s;
}

.desc-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.desc-btn.is-primary {
    border-color: var(--primary);
    background: var(--primary);
    color: #fff;
}

.desc-btn.is-primary:hover {
    background: var(--primary-hover);
    color: #fff;
}

.desc-note {
    font-size: 11.5px;
    color: var(--text-muted);
}

/* 深色下主色变亮，白字会糊 —— 跟 .btn-generate 一样改深色字 */
[data-theme="dark"] .desc-btn.is-primary,
[data-theme="dark"] .desc-run {
    color: #08120f;
}

/* 反推视图下隐藏移动端底部操作栏（那条「生成」栏属于创作页） */
body.desc-mode .mobile-bottom-bar {
    display: none !important;
}

/* ---- 移动端：单列 ---- */
@media (max-width: 860px) {
    .desc-wrap {
        padding: 16px 14px 26px;
    }

    .desc-head {
        flex-direction: column;
        gap: 10px;
        margin-bottom: 12px;
    }

    .desc-head-tip {
        margin-top: 0;
    }

    .desc-grid {
        grid-template-columns: minmax(0, 1fr);
        gap: 14px;
    }

    .desc-figure {
        height: 180px;
    }

    .desc-fields {
        grid-template-columns: minmax(0, 1fr);
    }

    .desc-result,
    .desc-text {
        min-height: 220px;
    }
}
