/* 极简扁平风格（默认黑白灰，跟随用户主题变色） */

/*
 * common.css：html,body { overflow:hidden }。无 .main-content 内滚时，必须由带 overflow 的祖先承担纵向滚动。
 * 仅用 body{overflow-y:auto} 在部分 WebView/iOS 下仍无法滑动；给 html 增类名并由 html 承担滚动更稳。
 */
html.paint-studio-html-scroll {
    overflow-x: hidden !important;
    overflow-y: auto !important;
    height: 100% !important;
    -webkit-overflow-scrolling: touch;
}

html.paint-studio-html-scroll body.detail-page.paint-studio-page {
    height: auto !important;
    min-height: 100% !important;
    max-height: none !important;
    overflow: visible !important;
    touch-action: manipulation;
    overscroll-behavior-y: contain;
}

body.detail-page.paint-studio-page .app-container {
    height: auto !important;
    overflow: visible !important;
    min-height: 100vh;
}

.paint-studio-page {
    /* 极简扁平：默认 indigo 品牌色，跟随用户主题时用 --as-blue / --as-primary */
    --ps-accent: var(--as-blue, #4F46E5);
    --ps-accent-bright: var(--as-blue, #6366F1);
    --ps-accent-deep: var(--as-blue, #4338CA);
    --ps-accent-navy: var(--as-primary, #312e81);
    --ps-accent2: var(--ps-accent);
    --ps-accent-ring: rgba(79, 70, 229, 0.35);
    --ps-accent-glow: rgba(79, 70, 229, 0.25);
    --ps-accent-soft: #EEF2FF;
    --ps-accent-muted: #E0E7FF;
    --ps-text-strong: var(--as-primary, #1A1A1A);
    --ps-text-mid: #64748B;
    --ps-border: #EEF0F5;
    --ps-bg: #F7F8FA;
    background: var(--ps-bg);
    min-height: 100vh;
}

.paint-studio-page .ps-hero {
    margin: 0 16px 12px;
    padding: 16px 16px 14px;
    border-radius: 16px;
    background:
        radial-gradient(120% 80% at 100% 0%, rgba(79, 70, 229, 0.12), transparent 55%),
        linear-gradient(155deg, #EEF2FF 0%, #F5F3FF 100%);
    color: #1A1A1A;
    box-shadow: 0 6px 24px rgba(15, 23, 42, 0.06);
}
.paint-studio-page .ps-hero__title {
    margin: 0 0 6px;
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.25;
    color: #1A1A1A;
}
.paint-studio-page .ps-hero__desc {
    margin: 0;
    font-size: 13px;
    line-height: 1.5;
    color: #64748B;
    opacity: 1;
}

.ps-audience {
    display: flex;
    gap: 6px;
    padding: 4px;
    background: #f1f5f9;
    border-radius: 12px;
}
.ps-audience__btn {
    flex: 1 1 0;
    min-width: 0;
    border: 0;
    background: transparent;
    color: #64748b;
    font-size: 13px;
    font-weight: 700;
    padding: 10px 6px;
    border-radius: 10px;
    cursor: pointer;
    white-space: nowrap;
}
.ps-audience__btn.active {
    background: linear-gradient(135deg, #4F46E5 0%, #7C3AED 100%);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 4px 14px rgba(79, 70, 229, 0.22);
}
.ps-tpl-group { display: none; }
.ps-tpl-group.is-on { display: block; }
.ps-tpl-group__tip {
    margin: 0 0 10px;
    font-size: 12px;
    line-height: 1.45;
    color: #64748b;
}
/* 手机：两行横滑；电脑：自动换行点选（不必拖） */
.ps-tpl-grid {
    display: grid;
    grid-auto-flow: column;
    grid-template-rows: repeat(2, auto);
    grid-auto-columns: max-content;
    gap: 8px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding: 2px 2px 8px;
    margin: 0 -4px;
    scrollbar-width: thin;
    cursor: grab;
}
.ps-tpl-grid.is-xscroll-drag { cursor: grabbing; }
.ps-tpl-grid::-webkit-scrollbar {
    height: 5px;
}
.ps-tpl-grid::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 999px;
}
@media (hover: hover) and (pointer: fine) {
    .ps-tpl-grid {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        grid-auto-flow: row;
        gap: 10px;
        overflow-x: visible;
        margin: 0;
        cursor: default;
        padding-bottom: 2px;
    }
}
.ps-tpl {
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    text-align: left;
    border: 1px solid #e2e8f0;
    background: #fff;
    border-radius: 12px;
    padding: 11px 14px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    white-space: nowrap;
    min-height: 46px;
    box-sizing: border-box;
    transition: border-color .18s, background .18s, box-shadow .18s, transform .12s;
}
@supports (grid-template-columns: repeat(3, 1fr)) {
    @media (hover: hover) and (pointer: fine) {
        .ps-tpl { width: 100%; }
    }
}
.ps-tpl:hover {
    border-color: #c7d2fe;
    background: #f8faff;
}
.ps-tpl strong {
    display: inline;
    font-size: 13px;
    font-weight: 700;
    color: #334155;
    margin: 0;
    line-height: 1.2;
}
.ps-tpl span {
    display: none;
}
.ps-tpl:active,
.ps-tpl.is-on {
    border-color: transparent;
    background: linear-gradient(135deg, #4F46E5 0%, #7C3AED 100%);
}
.ps-tpl:active strong,
.ps-tpl.is-on strong { color: #fff; }

.paint-studio-page .nav-header {
    background: #FFFFFF;
    border-bottom: 1px solid var(--ps-border);
    position: sticky;
    top: 0;
    z-index: 300;
}

.paint-studio-page .nav-back {
    color: var(--ps-text-strong, #0f172a);
}

.paint-studio-page .nav-title {
    font-weight: 600;
    color: var(--ps-text-strong);
}

.paint-studio-page .ps-nav-title {
    display: inline-flex;
    align-items: baseline;
    flex-wrap: nowrap;
    gap: 6px;
    max-width: calc(100% - 8px);
    overflow: hidden;
}

.paint-studio-page .ps-nav-title__sub {
    flex-shrink: 1;
    min-width: 0;
    font-size: 11px;
    font-weight: 500;
    color: #94a3b8;
    letter-spacing: 0.02em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.paint-studio-page #psToast.toast {
    z-index: 100650;
    pointer-events: none;
    bottom: auto;
    top: 50%;
    transform: translate3d(-50%, -50%, 0);
    max-width: min(340px, calc(100vw - 32px));
    padding: 14px 20px;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.55;
    background: rgba(0, 0, 0, 0.85);
    color: #fff;
    box-shadow: none;
}

.paint-studio-page #psToast.toast.show {
    transform: translate3d(-50%, -50%, 0);
}

.ps-main-tabs {
    display: flex;
    gap: 10px;
    padding: 14px 16px 13px;
    background: #FFFFFF;
    backdrop-filter: none;
    border-bottom: 1px solid var(--ps-border);
}

.ps-tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 8px;
    border: 1px solid transparent;
    border-radius: 999px;
    background: #F1F5F9;
    color: #334155;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.ps-tab.active {
    background: linear-gradient(135deg, #4F46E5 0%, #7C3AED 100%);
    color: #fff;
    border-color: transparent;
    font-weight: 600;
    box-shadow: 0 4px 14px rgba(79, 70, 229, 0.25);
}

.ps-create-panels {
    padding-top: 6px;
    padding-bottom: 2px;
}

.ps-card {
    background: #FFFFFF;
    border-radius: 16px;
    padding: 18px 18px 20px;
    margin: 0 16px 20px;
    box-shadow: 0 6px 24px rgba(15, 23, 42, 0.06);
    border: 1px solid #EEF0F5;
}

.ps-card--primary {
    margin-top: 6px;
}

/* 产品：主输入为「商品简介」；风格/构图由扣子工作流处理，H5 不再展示快速选择 */
.ps-card--quick {
    display: none !important;
    box-shadow: none;
}

.ps-section-heading {
    margin: 0 0 12px;
}

.ps-section-heading--tight {
    margin-bottom: 14px;
}

.ps-section-heading__row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.ps-section-heading__title {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    color: var(--ps-text-strong);
    display: flex;
    align-items: center;
    gap: 8px;
    line-height: 1.3;
    letter-spacing: -0.01em;
}

.ps-section-heading__ico {
    font-size: 13px;
    color: #4f46e5;
    opacity: 0.95;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    flex: 0 0 auto;
    border-radius: 9px;
    background: linear-gradient(135deg, #EEF2FF 0%, #F5F3FF 100%);
    border: 1px solid rgba(79, 70, 229, 0.16);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.ps-card--sizes .ps-section-heading__ico {
    color: var(--ps-accent-deep);
}

.ps-card--media .ps-section-heading__ico {
    color: #64748b;
}

.ps-badge-req {
    flex-shrink: 0;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.03em;
    color: #dc2626;
    background: #fef2f2;
    padding: 5px 11px;
    border-radius: 999px;
    border: 1px solid rgba(220, 38, 38, 0.2);
}
.ps-badge-opt {
    flex-shrink: 0;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.03em;
    color: #64748b;
    background: #f8fafc;
    padding: 5px 11px;
    border-radius: 999px;
    border: 1px solid #e2e8f0;
}
.ps-card--styles .ps-style-scroll {
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding: 2px 2px 6px;
    scrollbar-width: thin;
    cursor: grab;
}
.ps-card--styles .ps-style-scroll.is-xscroll-drag { cursor: grabbing; }
.ps-card--styles .ps-style-scroll::-webkit-scrollbar { height: 5px; }
.ps-card--styles .ps-style-scroll::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 999px;
}
@media (hover: hover) and (pointer: fine) {
    .ps-card--styles .ps-style-scroll {
        flex-wrap: wrap;
        overflow-x: visible;
        cursor: default;
    }
}
.ps-style-chip {
    flex: 0 0 auto;
    border: 1px solid #e2e8f0;
    background: #fff;
    color: #334155;
    font-size: 12px;
    font-weight: 650;
    padding: 8px 12px;
    border-radius: 999px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    white-space: nowrap;
}
.ps-style-chip.is-on {
    border-color: #c7d2fe;
    background: #eef2ff;
    color: #312e81;
}

.ps-section-heading__kicker {
    margin: 8px 0 0;
    font-size: 12px;
    font-weight: 500;
    color: #64748b;
    letter-spacing: 0.06em;
}

.ps-section-heading__kicker--muted {
    color: #94a3b8;
    letter-spacing: 0.02em;
}

.ps-hint {
    font-size: 12px;
    color: #64748b;
    font-weight: 500;
}

.ps-field-hint {
    margin: 10px 0 0;
    font-size: 12px;
    line-height: 1.6;
    color: #94a3b8;
}

.ps-textarea {
    width: 100%;
    min-height: 112px;
    border: 1.5px solid #e6e8ee;
    border-radius: 14px;
    padding: 14px;
    font-size: 15px;
    line-height: 1.62;
    resize: vertical;
    background: #ffffff;
    color: #1A1A1A;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.ps-textarea::placeholder {
    color: #9ca3af;
}

.ps-textarea:focus {
    outline: none;
    border-color: var(--ps-accent);
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.14);
}

.ps-prompt-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.ps-prompt-chip {
    border: 1px solid #e5e7eb;
    background: #f8fafc;
    color: #475569;
    font-size: 12px;
    line-height: 1.3;
    padding: 6px 10px;
    border-radius: 999px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.ps-prompt-chip:active {
    background: #eef2ff;
    border-color: #c7d2fe;
    color: #4338ca;
}

.ps-actions-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 14px;
    align-items: center;
    justify-content: space-between;
}
.ps-actions-row .ps-btn-ai { margin-right: auto; }

.ps-raw-toggle {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin: 0 0 14px;
    padding: 14px 16px;
    border-radius: 14px;
    border: 1px solid rgba(15, 23, 42, 0.08);
    background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

.ps-raw-toggle__input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.ps-raw-toggle__ui {
    flex: 0 0 auto;
    width: 44px;
    height: 26px;
    margin-top: 2px;
    border-radius: 999px;
    background: #cbd5e1;
    position: relative;
    transition: background 0.2s ease;
}

.ps-raw-toggle__ui::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.2);
    transition: transform 0.2s ease;
}

.ps-raw-toggle__input:checked + .ps-raw-toggle__ui {
    background: var(--ps-accent, #4f46e5);
}

.ps-raw-toggle__input:checked + .ps-raw-toggle__ui::after {
    transform: translateX(18px);
}

.ps-raw-toggle__input:focus-visible + .ps-raw-toggle__ui {
    outline: 2px solid var(--ps-accent, #4f46e5);
    outline-offset: 2px;
}

.ps-raw-toggle__text {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.ps-raw-toggle__title {
    font-size: 14px;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.3;
}

.ps-raw-toggle__hint {
    font-size: 12px;
    color: #64748b;
    line-height: 1.45;
}

.ps-raw-toggle:has(.ps-raw-toggle__input:checked) {
    border-color: rgba(79, 70, 229, 0.28);
    background: linear-gradient(180deg, #eef2ff 0%, #e0e7ff 100%);
}

.ps-btn-ai {
    padding: 11px 20px;
    border-radius: 13px;
    border: none;
    background: linear-gradient(135deg, #4F46E5 0%, #7C3AED 100%);
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 6px 18px rgba(79, 70, 229, 0.22);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: transform .12s ease, box-shadow .2s ease, opacity .2s;
}
.ps-btn-ai:active {
    transform: translateY(1px);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.2);
}

.ps-btn-ai:disabled {
    opacity: 0.5;
    cursor: wait;
    box-shadow: none;
}

.ps-btn-ai.ps-btn-ai--loading:disabled {
    opacity: 0.8;
    cursor: wait;
    box-shadow: none;
}

.ps-btn-primary {
    padding: 8px 14px;
    border-radius: 8px;
    border: none;
    background: var(--ps-accent);
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.ps-btn-ghost {
    padding: 10px 15px;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    color: #475569;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: border-color .18s, background .18s, color .18s;
}
.ps-btn-ghost:hover {
    border-color: #c7d2fe;
    background: #f8faff;
    color: #4338ca;
}

.ps-char-count {
    text-align: right;
    font-size: 12px;
    color: #94a3b8;
    margin-top: 8px;
}

.ps-cat-scroll {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 6px;
    margin-bottom: 10px;
    -webkit-overflow-scrolling: touch;
}

.ps-cat-chip {
    flex-shrink: 0;
    padding: 6px 14px;
    border-radius: 8px;
    border: 1px solid #E5E5E5;
    background: #FFFFFF;
    font-size: 13px;
    color: #666666;
    cursor: pointer;
}

.ps-cat-chip.active {
    background: #FFFFFF;
    color: var(--ps-accent);
    border-color: var(--ps-accent);
    font-weight: 600;
    box-shadow: none;
}

.ps-tag-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.ps-tag {
    padding: 6px 12px;
    border-radius: 8px;
    background: #FFFFFF;
    border: 1px solid #E5E5E5;
    font-size: 13px;
    color: #666666;
    cursor: pointer;
}

.ps-tag.on {
    background: #FFFFFF;
    border-color: var(--ps-accent);
    color: var(--ps-accent);
    font-weight: 600;
}

.ps-size-row {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding: 4px 16px 8px;
    margin: 0 -16px;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
    scrollbar-width: thin;
    cursor: grab;
}
.ps-size-row.is-xscroll-drag { cursor: grabbing; }

.ps-size-row::-webkit-scrollbar {
    height: 5px;
}
.ps-size-row::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 999px;
}

.ps-size-card {
    flex: 0 0 auto;
    min-width: 72px;
    padding: 12px 10px;
    border-radius: 12px;
    border: 1.5px solid #eaecef;
    background: #fafbfc;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    scroll-snap-align: start;
    font: inherit;
    font-family: inherit;
    color: inherit;
    appearance: none;
    -webkit-appearance: none;
    display: block;
    box-sizing: border-box;
}

.ps-size-card.active {
    border-color: var(--ps-accent);
    background: #fff;
}

.ps-size-card .t1 {
    display: block;
    font-size: 13px;
    font-weight: 700;
    color: var(--ps-text-strong);
}

.ps-size-card .t2 {
    display: block;
    font-size: 11px;
    color: #64748b;
    margin-top: 4px;
}

.ps-submit-bar {
    padding: 4px 16px calc(24px + env(safe-area-inset-bottom, 0px));
}

.ps-tags-summary {
    margin: 0 0 10px;
    padding: 8px 12px;
    border-radius: 10px;
    background: #EEF2FF;
    color: #4338CA;
    font-size: 12px;
    line-height: 1.6;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.ps-submit-btn {
    width: 100%;
    padding: 15px 16px;
    border: none;
    border-radius: 13px;
    font-size: 16px;
    font-weight: 600;
    color: #fff;
    background: linear-gradient(135deg, #4F46E5 0%, #7C3AED 100%);
    cursor: pointer;
    box-shadow: 0 6px 18px rgba(79, 70, 229, 0.22);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.ps-submit-btn:active:not(:disabled) {
    transform: scale(0.99);
}

.ps-submit-btn:disabled {
    background: #E2E8F0;
    color: #94A3B8;
    cursor: not-allowed;
    box-shadow: none;
}

.ps-foot-note {
    font-size: 13px;
    color: #7a8494;
    text-align: center;
    margin: 14px 0 0;
    padding: 0 8px;
    line-height: 1.68;
}

/* 合规区块：与其它页共用组件，在此收紧与主按钮的间距 */
.paint-studio-page .lh-tool-ai-legal {
    margin-top: 2px !important;
    margin-bottom: calc(16px + env(safe-area-inset-bottom, 0px)) !important;
}

.paint-studio-page .lh-tool-ai-legal__before {
    margin-bottom: 10px !important;
}

.ps-foot-note a {
    color: var(--ps-accent);
    font-weight: 500;
    text-decoration: none;
}

.ps-legal {
    margin: 14px 14px 28px;
    padding: 14px 14px 16px;
    border-radius: 10px;
    background: #FFFBEB;
    border: 1px solid #FEF3C7;
    font-size: 13px;
    color: #92400E;
    line-height: 1.6;
}

/* 预览加载失败软提示：不把「已完成」改成失败 */
.lh-history-fail-hint--soft {
    color: #92400e;
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 10px;
    padding: 8px 10px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.45;
    margin-top: 8px;
}

/* 提交成功全屏庆祝：避免长时间卡在「正在提交」模态 */
.ps-submit-celebration {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 100700;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
    flex-direction: column;
}

.ps-submit-celebration__backdrop {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 80% 60% at 50% 40%, color-mix(in srgb, var(--ps-accent) 35%, transparent) 0%, transparent 55%),
        radial-gradient(ellipse 70% 50% at 70% 70%, color-mix(in srgb, var(--ps-accent) 22%, #8b5cf6) 0%, transparent 50%),
        linear-gradient(165deg, #0f172a 0%, #1e293b 45%, #0f172a 100%);
    animation: psCeleBackdropShift 2.8s ease-in-out infinite;
}

.ps-submit-celebration__burst {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        radial-gradient(circle at 50% 45%, rgba(255, 255, 255, 0.14) 0%, transparent 42%);
    animation: psCeleBurstPulse 1.4s ease-in-out infinite;
}

.ps-submit-celebration__card {
    position: relative;
    z-index: 2;
    width: min(88vw, 320px);
    padding: 28px 22px 26px;
    border-radius: 22px;
    text-align: center;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.97) 0%, rgba(248, 250, 252, 0.94) 100%);
    box-shadow:
        0 24px 64px rgba(15, 23, 42, 0.35),
        0 0 0 1px rgba(255, 255, 255, 0.6) inset,
        0 0 80px color-mix(in srgb, var(--ps-accent) 15%, transparent);
    transform: scale(0.88) translateY(16px);
    opacity: 0;
    filter: blur(2px);
    transition:
        opacity 0.45s cubic-bezier(0.22, 1, 0.36, 1),
        transform 0.55s cubic-bezier(0.22, 1, 0.36, 1),
        filter 0.45s ease;
}

.ps-submit-celebration.ps-submit-celebration--show .ps-submit-celebration__card {
    opacity: 1;
    transform: scale(1) translateY(0);
    filter: blur(0);
}

.ps-submit-celebration.ps-submit-celebration--hide .ps-submit-celebration__card {
    opacity: 0;
    transform: scale(0.94) translateY(-12px);
    filter: blur(4px);
    transition-duration: 0.38s;
}

.ps-submit-celebration__rings {
    position: absolute;
    left: 50%;
    top: 42%;
    width: 120px;
    height: 120px;
    transform: translate(-50%, -50%);
    pointer-events: none;
}

.ps-submit-celebration__rings span {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 2px solid color-mix(in srgb, var(--ps-accent) 35%, transparent);
    animation: psCeleRing 2s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

.ps-submit-celebration__rings span:nth-child(2) {
    animation-delay: 0.45s;
    border-color: color-mix(in srgb, var(--ps-accent) 28%, #8b5cf6);
}

.ps-submit-celebration__rings span:nth-child(3) {
    animation-delay: 0.9s;
    border-color: color-mix(in srgb, var(--ps-accent) 32%, #0ea5e9);
}

.ps-submit-celebration__icon {
    position: relative;
    z-index: 1;
    font-size: 42px;
    line-height: 1;
    margin-bottom: 14px;
    background: linear-gradient(125deg, var(--ps-accent-bright) 0%, var(--ps-accent) 45%, var(--ps-accent-deep) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    animation: psCeleIconPop 1.2s ease-in-out infinite;
    filter: drop-shadow(0 4px 16px color-mix(in srgb, var(--ps-accent) 45%, transparent));
}

.ps-submit-celebration__title {
    font-size: 20px;
    font-weight: 900;
    letter-spacing: 0.04em;
    color: var(--ps-text-strong);
    margin-bottom: 8px;
}

.ps-submit-celebration__sub {
    font-size: 14px;
    font-weight: 600;
    color: var(--ps-text-mid);
    line-height: 1.55;
}

@keyframes psCeleBackdropShift {
    0%,
    100% {
        filter: hue-rotate(0deg) brightness(1);
    }
    50% {
        filter: hue-rotate(18deg) brightness(1.06);
    }
}

@keyframes psCeleBurstPulse {
    0%,
    100% {
        opacity: 0.55;
        transform: scale(1);
    }
    50% {
        opacity: 1;
        transform: scale(1.06);
    }
}

@keyframes psCeleRing {
    0% {
        transform: scale(0.65);
        opacity: 0.85;
    }
    100% {
        transform: scale(1.35);
        opacity: 0;
    }
}

@keyframes psCeleIconPop {
    0%,
    100% {
        transform: translateY(0) rotate(-4deg) scale(1);
    }
    50% {
        transform: translateY(-4px) rotate(4deg) scale(1.06);
    }
}

/* 跳转「生成历史」后的顶部提示：异步生成等待 */
.ps-history-panel {
    padding-top: 8px;
    padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    min-height: 50vh;
}

/* 面板切换：淡入上滑 */
@keyframes psPanelIn {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: none; }
}
.ps-panel-enter {
    animation: psPanelIn .42s cubic-bezier(.22, .61, .36, 1) both;
}

/* 历史卡片错落入场 */
@keyframes psHistCardIn {
    from { opacity: 0; transform: translateY(18px) scale(.985); }
    to   { opacity: 1; transform: none; }
}
.ps-hist-card.ps-card-enter {
    animation: psHistCardIn .5s cubic-bezier(.22, .61, .36, 1) both;
}
.ps-history-list > .ps-hist-card:nth-child(1) { animation-delay: .04s; }
.ps-history-list > .ps-hist-card:nth-child(2) { animation-delay: .09s; }
.ps-history-list > .ps-hist-card:nth-child(3) { animation-delay: .14s; }
.ps-history-list > .ps-hist-card:nth-child(4) { animation-delay: .19s; }
.ps-history-list > .ps-hist-card:nth-child(5) { animation-delay: .24s; }
.ps-history-list > .ps-hist-card:nth-child(6) { animation-delay: .29s; }
.ps-history-list > .ps-hist-card:nth-child(7) { animation-delay: .34s; }
.ps-history-list > .ps-hist-card:nth-child(8) { animation-delay: .39s; }

/* 历史加载骨架 */
@keyframes psSkeletonShine {
    0%   { background-position: -180px 0; }
    100% { background-position: 180px 0; }
}
.ps-hist-skeleton {
    border-radius: 14px;
    padding: 14px;
    margin: 0 16px 14px;
    background: #fff;
    box-shadow: 0 6px 24px rgba(15, 23, 42, 0.06);
    border: 1px solid #EEF0F5;
}
.ps-hist-skeleton__row {
    display: flex;
    gap: 12px;
    align-items: center;
}
.ps-hist-skeleton__thumb {
    width: 64px;
    height: 64px;
    border-radius: 12px;
    flex: 0 0 auto;
}
.ps-hist-skeleton__lines {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.ps-hist-skeleton__lines span {
    height: 12px;
    border-radius: 6px;
}
.ps-hist-skeleton__lines span:nth-child(1) { width: 60%; }
.ps-hist-skeleton__lines span:nth-child(2) { width: 90%; }
.ps-hist-skeleton__lines span:nth-child(3) { width: 40%; }
.ps-hist-skeleton__thumb,
.ps-hist-skeleton__lines span {
    background: linear-gradient(90deg, #eef1f6 0%, #f6f8fc 40%, #eef1f6 80%);
    background-size: 360px 100%;
    animation: psSkeletonShine 1.2s ease-in-out infinite;
}

.ps-hist-boot-loading {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 48px 16px;
    font-size: 14px;
    font-weight: 600;
    color: var(--ps-text-mid, #64748b);
}

.ps-hist-pending-tip {
    margin: 0 16px 14px;
}

.ps-hist-pending-tip__inner {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    border-radius: 14px;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.55;
    color: var(--ps-text-mid);
    background: linear-gradient(
        135deg,
        color-mix(in srgb, var(--ps-accent) 10%, #ffffff) 0%,
        color-mix(in srgb, var(--ps-accent) 8%, #f1f5f9) 100%
    );
    border: 1px solid color-mix(in srgb, var(--ps-accent) 35%, transparent);
    box-shadow: 0 8px 24px color-mix(in srgb, var(--ps-accent) 12%, transparent);
}

.ps-hist-pending-tip__inner i {
    margin-top: 2px;
    color: var(--ps-accent-deep);
    flex-shrink: 0;
}

/* 参考图：独立上传区，避免 label 嵌套与点击穿透问题 */
.ps-upload-shell {
    position: relative;
    border-radius: 12px;
    border: 1.5px dashed #C7D2FE;
    background: #F8FAFF;
    min-height: 180px;
    overflow: hidden;
}

.ps-upload-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
    min-height: 120px;
}

.ps-upload-ico {
    font-size: 28px;
    color: #6366F1;
    margin-bottom: 8px;
}

.ps-upload-lead {
    margin: 0;
    font-size: 14px;
    font-weight: 500;
    color: #666666;
}

.ps-upload-sub {
    margin: 6px 0 0;
    font-size: 12px;
    color: #999999;
}

.ps-upload-browse {
    margin-top: 14px;
    padding: 10px 22px;
    border-radius: 8px;
    border: none;
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    cursor: pointer;
    background: var(--ps-accent);
    box-shadow: none;
}

.ps-upload-filled {
    position: relative;
    background: #F5F5F5;
}

.ps-upload-filled img {
    display: block;
    width: 100%;
    max-height: 240px;
    object-fit: contain;
}

.ps-upload-repick {
    display: block;
    width: calc(100% - 24px);
    margin: 12px;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid #E5E5E5;
    background: #fff;
    color: #666666;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
}

.ps-history-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    margin: 8px 16px 0;
    background: #fff;
    border-radius: 16px;
    border: 1px solid rgba(15, 23, 42, 0.08);
    box-shadow: 0 2px 12px rgba(15, 23, 42, 0.04);
}

.ps-history-stats {
    display: flex;
    gap: 18px;
    font-size: 13px;
}

.ps-history-stats span strong {
    display: block;
    font-size: 18px;
    text-align: center;
    color: var(--ps-text-strong);
}

.ps-history-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 8px;
    padding: 4px 16px 36px;
    align-items: stretch;
    touch-action: manipulation;
}

.ps-hist-card {
    position: relative;
    width: 100%;
    min-width: 0;
    border-radius: 14px;
    border: 1px solid rgba(0, 0, 0, 0.05);
    box-shadow: 0 2px 10px rgba(15, 23, 42, 0.06);
    background: #fff;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    cursor: pointer;
    transition: transform 0.18s ease;
}

.ps-hist-card--link {
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    flex: 1;
    -webkit-tap-highlight-color: rgba(24, 24, 27, 0.08);
    touch-action: manipulation;
}

.ps-hist-card--link:focus-visible {
    outline: 2px solid rgba(24, 24, 27, 0.45);
    outline-offset: 2px;
}

.ps-hist-card:active {
    transform: scale(0.98);
}

.ps-hist-card__inner {
    position: relative;
    aspect-ratio: 3 / 4;
    overflow: hidden;
    background: linear-gradient(145deg, #f4f4f5 0%, #e4e4e7 100%);
}

.ps-hist-card__inner img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.ps-hist-card--busy .ps-hist-card__inner {
    background: linear-gradient(145deg, #fffbeb 0%, #fef3c7 100%);
}

.ps-hist-gen-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: rgba(255, 251, 235, 0.72);
    pointer-events: none;
}

.ps-hist-gen-overlay.hide {
    display: none;
}

.ps-hist-pending-dots {
    display: flex;
    gap: 4px;
}

.ps-hist-pending-dots span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #d97706;
    animation: psHistCardDot 1.1s ease-in-out infinite;
}

.ps-hist-pending-dots span:nth-child(2) { animation-delay: 0.15s; }
.ps-hist-pending-dots span:nth-child(3) { animation-delay: 0.3s; }

@keyframes psHistCardDot {
    0%, 100% { opacity: 0.35; transform: translateY(0); }
    50% { opacity: 1; transform: translateY(-2px); }
}

.ps-hist-gen-line {
    padding: 5px 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(217, 119, 6, 0.25);
    font-size: 11px;
    font-weight: 700;
    color: #b45309;
}

.ps-hist-status-tag {
    position: absolute;
    top: 7px;
    right: 7px;
    z-index: 3;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 10px;
    font-weight: 700;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.ps-hist-status-tag--run {
    background: rgba(245, 158, 11, 0.92);
    color: #fff;
}

.ps-hist-status-tag--ok {
    background: rgba(16, 185, 129, 0.9);
    color: #fff;
}

.ps-hist-status-tag--fail {
    background: rgba(239, 68, 68, 0.9);
    color: #fff;
}

.ps-hist-status-tag--sync {
    background: rgba(99, 102, 241, 0.88);
    color: #fff;
}

.ps-hist-card__info {
    padding: 9px 10px 11px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.ps-hist-card__title {
    font-size: 13px;
    font-weight: 800;
    color: #18181b;
    letter-spacing: -0.01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ps-hist-card__subrow {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    min-width: 0;
}

.ps-hist-platform-pill {
    display: inline-block;
    max-width: 58%;
    padding: 2px 7px;
    border-radius: 6px;
    font-size: 10px;
    font-weight: 700;
    color: #52525b;
    background: #f4f4f5;
    border: 1px solid #e4e4e7;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ps-hist-card__time {
    flex-shrink: 0;
    font-size: 10px;
    color: #a1a1aa;
    font-weight: 600;
}

.ps-hist-card__meta {
    font-size: 10px;
    color: #a1a1aa;
    line-height: 1.4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ps-hist-card__deliver {
    font-size: 10px;
    font-weight: 600;
    color: #059669;
    line-height: 1.35;
}

.ps-hist-card__deliver--fail { color: #dc2626; }
.ps-hist-card__deliver--warn { color: #d97706; }

.ps-hist-delete {
    position: absolute;
    top: 7px;
    left: 7px;
    width: 26px;
    height: 26px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.48);
    color: #fff;
    font-size: 11px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s, background 0.2s;
    z-index: 10;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.ps-hist-card:hover .ps-hist-delete,
.ps-hist-card:focus-within .ps-hist-delete { opacity: 1; }
.ps-hist-delete:active { background: rgba(239, 68, 68, 0.9); }

@media (hover: none) and (pointer: coarse) {
    .ps-hist-delete { opacity: 0.82; }
}

.ps-notice-strip {
    margin: 10px 16px;
    padding: 10px 14px;
    border-radius: 12px;
    background: var(--ps-accent-soft);
    font-size: 12px;
    color: var(--ps-text-mid);
}

.ps-empty {
    text-align: center;
    padding: 40px 20px;
    color: #94a3b8;
}

/* —— 生成结果页 paint_studio_result.php —— */
.ps-result-page {
    padding: 12px 14px calc(32px + env(safe-area-inset-bottom, 0px));
}

.ps-result-section {
    background: #fff;
    border-radius: 16px;
    padding: 14px 14px 16px;
    margin-bottom: 12px;
    border: 1px solid var(--ps-border);
    box-shadow: 0 4px 18px rgba(15, 23, 42, 0.06);
}

.ps-result-section__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px;
}

.ps-result-section__title {
    margin: 0;
    font-size: 16px;
    font-weight: 800;
    color: var(--ps-text-strong);
    letter-spacing: 0.02em;
}

.ps-result-badge {
    flex-shrink: 0;
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(125deg, #ec4899 0%, #a855f7 100%);
}

.ps-result-badge--txt {
    background: linear-gradient(125deg, var(--ps-accent) 0%, #6366f1 100%);
}

.ps-result-thumb {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    background: #f1f5f9;
}

.ps-result-thumb img.ps-result-zoomable {
    width: 100%;
    display: block;
    vertical-align: middle;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.ps-result-zoom-hint {
    position: absolute;
    right: 10px;
    bottom: 10px;
    z-index: 2;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    color: #fff;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(6px);
    pointer-events: none;
}

.ps-result-prompt-body {
    margin: 0;
    font-size: 14px;
    line-height: 1.65;
    color: #334155;
    white-space: pre-wrap;
    word-break: break-word;
}

.ps-result-prompt-body--empty {
    color: #94a3b8;
    font-style: italic;
}

.ps-result-video {
    width: 100%;
    max-height: min(56vh, 420px);
    border-radius: 12px;
    background: #0f172a;
}

.ps-result-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.ps-result-actions a,
.ps-result-actions button {
    flex: 1 1 auto;
    min-width: 120px;
    text-align: center;
    padding: 11px 14px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 700;
    border: none;
    cursor: pointer;
    text-decoration: none;
}

.ps-result-actions .ps-result-btn-primary {
    background: #6d28d9;
    color: #ffffff !important;
    box-shadow: 0 8px 20px rgba(109, 40, 217, 0.28);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    line-height: 1.25;
    -webkit-text-fill-color: #ffffff;
}

.ps-result-actions .ps-result-btn-primary i {
    font-size: 14px;
    color: #ffffff !important;
}

.ps-result-actions .ps-result-btn-ghost {
    background: #f1f5f9;
    color: var(--ps-text-mid);
}

.ps-result-meta-line {
    font-size: 13px;
    color: #64748b;
    margin: 6px 0 0;
    line-height: 1.5;
}

.ps-result-meta-line code {
    font-size: 12px;
    background: #f1f5f9;
    padding: 2px 6px;
    border-radius: 6px;
    word-break: break-all;
}

/* 全屏看图 */
.ps-lightbox {
    display: none !important;
    position: fixed;
    inset: 0;
    z-index: 100800;
    background: rgba(15, 23, 42, 0.92);
    align-items: center;
    justify-content: center;
    padding: 16px;
    box-sizing: border-box;
}

.ps-lightbox.ps-lightbox--open {
    display: flex !important;
}

.ps-lightbox img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 8px;
}

.ps-lightbox-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    z-index: 2;
}

.ps-lightbox-caption {
    position: absolute;
    bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    left: 50%;
    transform: translateX(-50%);
    font-size: 13px;
    color: rgba(255, 255, 255, 0.85);
    text-align: center;
    max-width: 90vw;
}

/*
 * Appended overrides (indigo CTA + indigo active tab): selectors scoped to body classes
 * so they sort after earlier rules in this file and win where specificity allows.
 */
html body.detail-page.paint-studio-page .ps-submit-btn:not(:disabled),
html body.hec-page .ps-submit-btn:not(:disabled) {
    background: linear-gradient(135deg, #4F46E5 0%, #7C3AED 100%) !important;
    color: #ffffff !important;
    box-shadow: 0 6px 18px rgba(79, 70, 229, .22) !important;
}

html body.detail-page.paint-studio-page .ps-btn-primary:not(:disabled),
html body.hec-page .ps-btn-primary:not(:disabled),
html body.detail-page.paint-studio-page .ps-btn-ai:not(:disabled),
html body.hec-page .ps-btn-ai:not(:disabled) {
    background: linear-gradient(135deg, #4F46E5 0%, #7C3AED 100%) !important;
    color: #ffffff !important;
}

html body.detail-page.paint-studio-page .ps-main-tabs .ps-tab,
html body.hec-page .ps-main-tabs .ps-tab {
    background: #F1F5F9 !important;
    border: 1px solid transparent !important;
    border-radius: 999px !important;
    color: #334155 !important;
    font-weight: 500 !important;
    box-shadow: none !important;
}

html body.detail-page.paint-studio-page .ps-main-tabs .ps-tab.active,
html body.hec-page .ps-main-tabs .ps-tab.active {
    background: linear-gradient(135deg, #4F46E5 0%, #7C3AED 100%) !important;
    border-color: transparent !important;
    color: #fff !important;
    font-weight: 600 !important;
    box-shadow: 0 4px 14px rgba(79, 70, 229, 0.25) !important;
}

/* 灵涵AI换装比例 pill 选中态：indigo */
html body.detail-page.paint-studio-page.aot-page .hec-ratio-pill.is-on {
    background: linear-gradient(135deg, #4F46E5 0%, #7C3AED 100%) !important;
    border-color: rgba(79, 70, 229, 0.45) !important;
    color: #fff !important;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3) !important;
    font-weight: 700 !important;
}
