/* ==========================================================================
   「帮我写」提示词助手浮层(js/prompt-assist.js 专用)
   需求:docs/prompt-writing-tool-design-2026-09-13.md §6.2 / §6.5 / §6.7
   配色沿用 Mango Forest 变量(css/style.css :root);chip 视觉参照原型
   .chip / .chip.sel / .chip.cust / .chip.recog-chip(识图项 = 只加粗,不上色)。
   电脑居中弹窗;<600px 自动底部抽屉 ≤82vh、内容区自滚、底栏固定、预览 ≤2 行。
   ========================================================================== */

body.pa-open { overflow: hidden; }
.pa-modal [hidden] { display: none !important; }   /* 类上的 display:flex 不得压过 hidden 属性 */

.pa-backdrop {
    position: fixed; inset: 0;
    background: rgba(28, 24, 20, .45);
    z-index: 9990;                      /* 低于 lightbox(9999)/toast(10002),高于页面其余浮层 */
    display: flex; align-items: center; justify-content: center;
    padding: 20px;
    -webkit-tap-highlight-color: transparent;
}
.pa-modal {
    background: var(--mf-surface, #fff);
    color: var(--mf-text, #1C1814);
    border-radius: 18px;
    width: min(600px, 100%);
    max-height: min(86vh, 820px);
    display: flex; flex-direction: column;
    box-shadow: 0 24px 60px rgba(0, 0, 0, .25);
    overflow: hidden;
    outline: none;
    font-family: var(--font-sans, sans-serif);
    font-size: 14px; line-height: 1.5;
    animation: pa-fade .2s ease-out;
}
@keyframes pa-fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@keyframes pa-spin { to { transform: rotate(360deg); } }

/* ---- 顶栏 ---- */
.pa-head {
    display: flex; align-items: flex-start; justify-content: space-between; gap: 10px;
    padding: 16px 18px 10px;
    border-bottom: 1px solid var(--mf-border, #ECE4D7);
    flex: none;
}
.pa-head-text { min-width: 0; }
.pa-title { display: block; font-size: 16px; font-weight: 700; }
.pa-sub { display: block; font-size: 12px; color: var(--mf-text-muted, #9A8E83); }
.pa-x {
    border: 0; background: none; cursor: pointer;
    font-size: 24px; line-height: 1; padding: 0 2px;
    color: var(--mf-text-muted, #9A8E83);
    flex: none;
}
.pa-x:hover { color: var(--mf-text, #1C1814); }

/* ---- 状态行(四态) ---- */
.pa-status {
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
    padding: 8px 18px 0;
    font-size: 12px; color: var(--mf-text-muted, #9A8E83);
    flex: none;
}
.pa-status .pa-ok { color: var(--mf-accent-hover, #0A5D4D); }
.pa-legend { color: var(--mf-text-muted, #9A8E83); }
.pa-legend::before { content: "●"; font-size: 8px; margin-right: 4px; vertical-align: middle; opacity: .6; }
.pa-spin {
    width: 12px; height: 12px; flex: none;
    border: 2px solid var(--mf-border-strong, #D9CFBE);
    border-top-color: var(--mf-accent, #0F7B66);
    border-radius: 50%;
    animation: pa-spin .8s linear infinite;
    display: inline-block;
}

/* ---- 内容区 ---- */
.pa-body { padding: 12px 18px; overflow: auto; flex: 1 1 auto; min-height: 0; -webkit-overflow-scrolling: touch; }

.pa-notice {
    display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
    font-size: 12px; color: var(--mf-text-secondary, #5C544B);
    background: var(--mf-surface-cool, #E5F2EE);
    border-radius: 8px; padding: 6px 10px; margin: 0 0 12px;
}
.pa-notice.pa-warn { background: var(--mf-highlight-soft, #FDF1D8); color: #7a4f00; }
.pa-notice-btn {
    border: 1px solid var(--mf-border-strong, #D9CFBE); background: #fff;
    border-radius: 6px; padding: 1px 8px; font-size: 12px; cursor: pointer;
    color: var(--mf-accent-hover, #0A5D4D); font-family: inherit;
}
.pa-notice-btn:hover { border-color: var(--mf-accent, #0F7B66); }

.pa-slot { margin-bottom: 14px; }
.pa-slot:last-child { margin-bottom: 0; }
.pa-sl {
    display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap;
    font-size: 12px; font-weight: 700; color: var(--mf-text-secondary, #5C544B);
    margin-bottom: 6px;
}
.pa-sl-hint { font-weight: 400; color: var(--mf-text-muted, #9A8E83); }
.pa-expand {
    margin-left: auto; border: 0; background: none; cursor: pointer;
    color: var(--mf-accent, #0F7B66); font-size: 12px; padding: 0; font-family: inherit;
}
.pa-slot.pa-collapsed { padding: 6px 0; border-top: 1px dashed var(--mf-border, #ECE4D7); }
.pa-slot.pa-collapsed .pa-sl { margin-bottom: 0; }
.pa-slot.pa-collapsed .pa-sl-body { display: none; }

/* ---- chips ---- */
.pa-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 0; }
.pa-presets { margin-top: 6px; }
.pa-chip {
    border: 1px solid var(--mf-border-strong, #D9CFBE);
    background: #fff; color: var(--mf-text, #1C1814);
    border-radius: 999px; padding: 5px 12px;
    font-size: 13px; line-height: 1.3; font-family: inherit; font-weight: 400;
    cursor: pointer; display: inline-flex; align-items: center; gap: 5px;
    max-width: 100%; text-align: left;
    transition: background .15s, border-color .15s, color .15s;
}
.pa-chip-label { min-width: 0; overflow-wrap: anywhere; }
.pa-chip:hover { border-color: var(--mf-accent, #0F7B66); color: var(--mf-accent-hover, #0A5D4D); background: var(--mf-surface-cool, #E5F2EE); }
.pa-chip.pa-sel { background: var(--mf-accent-soft, #CFEEE4); border-color: var(--mf-accent, #0F7B66); color: var(--mf-accent-hover, #0A5D4D); font-weight: 600; }
.pa-chip.pa-detected { font-weight: 600; }   /* 识图项 = 只加粗,不做颜色标记(founder 09-13) */
.pa-chip.pa-cust { border-style: dashed; color: var(--mf-text-secondary, #5C544B); }
.pa-chip.pa-cust.pa-sel { border-style: solid; }
.pa-cust-pen { font-size: 12px; }
.pa-ord {
    font-size: 10px; font-weight: 700; flex: none;
    background: var(--mf-accent, #0F7B66); color: #fff;
    border-radius: 999px; width: 15px; height: 15px;
    display: inline-flex; align-items: center; justify-content: center;
}
.pa-ord[hidden] { display: none; }

/* ---- 输入 ---- */
.pa-cust-wrap { margin-top: 6px; }
.pa-cust-wrap input, .pa-quote, .pa-story {
    border: 1px solid var(--mf-border-strong, #D9CFBE);
    border-radius: 8px; padding: 7px 10px;
    font: 13px/1.5 var(--font-sans, sans-serif); color: var(--mf-text, #1C1814);
    width: 100%; max-width: 360px; background: #fff; box-sizing: border-box;
}
.pa-cust-wrap input { border-color: var(--mf-accent, #0F7B66); }
.pa-cust-wrap input:focus, .pa-quote:focus, .pa-story:focus { outline: none; border-color: var(--mf-accent, #0F7B66); }
.pa-story { max-width: 100%; resize: vertical; min-height: 56px; display: block; }
.pa-story.pa-detected-text { font-weight: 600; }

/* ---- 底栏 ---- */
.pa-foot {
    display: flex; gap: 8px; align-items: center;
    padding: 12px 18px;
    border-top: 1px solid var(--mf-border, #ECE4D7);
    background: var(--mf-surface-warm, #FFF8E8);
    flex: none;
}
.pa-preview { flex: 1 1 auto; min-width: 0; font-size: 12.5px; color: var(--mf-text-secondary, #5C544B); overflow-wrap: anywhere; }
.pa-btn {
    border-radius: 10px; padding: 8px 16px; font-size: 14px; cursor: pointer;
    border: 1px solid var(--mf-border-strong, #D9CFBE); background: #fff;
    color: var(--mf-text, #1C1814); font-family: inherit; flex: none; white-space: nowrap;
}
.pa-go { background: var(--mf-accent, #0F7B66); color: #fff; border-color: var(--mf-accent, #0F7B66); font-weight: 600; }
.pa-go:hover:not(:disabled) { background: var(--mf-accent-hover, #0A5D4D); border-color: var(--mf-accent-hover, #0A5D4D); }
.pa-go:disabled { background: #cfcac2; border-color: #cfcac2; cursor: not-allowed; }

/* ---- 手机:底部抽屉 ---- */
@media (max-width: 599px) {
    .pa-backdrop { padding: 0; align-items: flex-end; }
    .pa-modal {
        position: fixed; left: 0; right: 0; bottom: 0;
        width: 100%; max-width: 100%;
        max-height: 82vh;
        border-radius: 22px 22px 0 0;
        animation: pa-rise .22s ease-out;
    }
    .pa-head { padding: 14px 16px 8px; }
    .pa-status { padding: 6px 16px 0; }
    .pa-body { padding: 10px 16px; }
    .pa-slot { margin-bottom: 10px; }
    .pa-chip { padding: 5px 10px; font-size: 12.5px; }
    .pa-foot { padding: 10px 16px; padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px)); }
    .pa-preview {
        display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
        overflow: hidden;
    }
    .pa-btn { padding: 8px 12px; font-size: 13px; }
    @keyframes pa-rise { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
}
@media (prefers-reduced-motion: reduce) {
    .pa-modal { animation: none; }
}

/* Blocking loader while the drawing is being read (founder 2026-09-13) */
.pa-loading { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; min-height: 200px; padding: 24px 12px; color: var(--mf-text-secondary, #5C544B); text-align: center; }
.pa-loading .pa-spin { width: 28px; height: 28px; border-width: 3px; }
.pa-loading-text { font-size: 14px; font-weight: 600; color: var(--mf-text, #1C1814); }
.pa-loading-sub { font-size: 12px; color: var(--mf-text-muted, #9A8E83); }
