/*!
 * 雾寻图片工坊 · 插件版页面框架（对齐离线单文件版 · 蓝紫科技风）
 * ------------------------------------------------------------------
 * 设计基准 = 离线版 在线工具/index.html：
 *   · 径向渐变页面底（左上淡蓝紫 / 右上淡粉）+ 冷调蓝灰 --soft
 *   · 没有大 hero 卡片：一行紧凑「页头」（品牌 + 描述 左 / 控件 右）
 *   · 分节标题 + 右侧发丝线
 *   · 白卡片 · hairline 蓝调边框 #e7ebf9 · 16px 圆角 · 极轻阴影
 *   · 唯一强调 = 蓝紫渐变 #4f6bff → #a56bff
 * 只负责：设计变量、顶栏、页头、分节标题、容器、按钮、表单件、图标、底栏。
 * 各页特有样式留在 library.css / ai.css。
 * 注意：不要写无作用域的 main / body 规则，避免污染前台页布局。
 */

:root {
    /* 表面与中性色阶 —— 与离线版 shared/app.css 同值 */
    --fx-bg: #f4f6fd;
    --fx-surface: #ffffff;
    --fx-surface-2: #fbfcff;
    --fx-white: #ffffff;

    --fx-ink: #1b2450;          /* 正文深藏蓝 */
    --fx-ink-2: #2d3a66;        /* 次级标题 */
    --fx-sub: #6b7793;          /* 辅助文字 */
    --fx-mute: #9aa4c0;         /* 更弱注脚 */
    --fx-faint: #c2c9de;        /* 极弱 / 禁用 */

    /* hairline 边框 */
    --fx-line: #e7ebf9;
    --fx-line-2: #dde3f5;

    /* 唯一强调色：雾寻蓝紫 */
    --fx-brand: #4f6bff;
    --fx-brand-strong: #3c53d6;
    --fx-brand-2: #a56bff;
    --fx-brand-soft: #eef2ff;
    --fx-brand-soft-2: #dfe6ff;
    --fx-grad: linear-gradient(120deg, #4f6bff 0%, #a56bff 100%);

    /* 圆角 */
    --fx-r-lg: 16px;
    --fx-r: 13px;
    --fx-r-sm: 10px;

    /* 极轻阴影：靠边框分隔，阴影只做层次暗示 */
    --fx-sh: 0 8px 20px -18px rgba(30, 40, 100, .35);
    --fx-sh-md: 0 18px 38px -22px rgba(40, 60, 160, .5);
    --fx-sh-lg: 0 30px 64px -32px rgba(40, 60, 160, .48);

    --fx-ease: cubic-bezier(.4, 0, .2, 1);
    --fx-mono: ui-monospace, "SF Mono", Consolas, monospace;
}

/* ============ 页面底座 ============ */
body.fxp {
    margin: 0;
    padding: 0;
    min-height: 100vh;
    color: var(--fx-ink);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    font-size: 14px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    background:
        radial-gradient(900px 480px at 12% -8%, #eef2ff 0%, rgba(238, 242, 255, 0) 60%),
        radial-gradient(800px 460px at 92% 4%, #fdf0fb 0%, rgba(253, 240, 251, 0) 60%),
        var(--fx-bg);
    background-repeat: no-repeat;
}

body.fxp * {
    box-sizing: border-box;
}

body.fxp a {
    color: inherit;
    text-decoration: none;
}

body.fxp h1,
body.fxp h2,
body.fxp h3 {
    margin: 0;
    font-weight: 700;
    letter-spacing: -.02em;
}

body.fxp p {
    margin: 0;
}

/* 无障碍：仅供读屏 */
.fxp-sr {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

/* ============ 顶栏（只放导航，品牌由页头承载） ============ */
.fxp-top {
    position: sticky;
    top: 0;
    z-index: 60;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px max(22px, calc((100% - 1180px) / 2));
    background: rgba(255, 255, 255, .84);
    border-bottom: 1px solid var(--fx-line);
    backdrop-filter: saturate(1.7) blur(16px);
    -webkit-backdrop-filter: saturate(1.7) blur(16px);
}

.fxp-nav {
    display: flex;
    align-items: center;
    gap: 3px;
    padding: 4px;
    border-radius: 11px;
    background: rgba(238, 242, 255, .72);
    min-width: 0;
    overflow-x: auto;
    scrollbar-width: none;
}

.fxp-nav::-webkit-scrollbar {
    display: none;
}

.fxp-nav a {
    padding: 7px 15px;
    border-radius: 8px;
    color: var(--fx-sub);
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    flex: 0 0 auto;
    transition: background .16s var(--fx-ease), color .16s var(--fx-ease);
}

.fxp-nav a:hover {
    color: var(--fx-ink);
    background: rgba(255, 255, 255, .72);
}

.fxp-nav a.on {
    color: var(--fx-ink);
    background: var(--fx-surface);
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(50, 60, 140, .10);
}

.fxp-spacer {
    flex: 1 1 auto;
}

.fxp-cta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
}

/* ============ 按钮 ============ */
.fxp-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 20px;
    border: 1px solid transparent;
    border-radius: var(--fx-r-sm);
    background: var(--fx-grad);
    color: #fff;
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    white-space: nowrap;
    box-shadow: 0 10px 22px -12px rgba(110, 90, 255, .75);
    transition: transform .18s var(--fx-ease), box-shadow .18s var(--fx-ease), filter .18s var(--fx-ease);
}

.fxp-btn:hover {
    filter: brightness(1.04);
    transform: translateY(-1px);
    box-shadow: 0 14px 26px -12px rgba(110, 90, 255, .8);
}

.fxp-btn:active {
    transform: translateY(0);
}

.fxp-btn.ghost {
    background: var(--fx-surface);
    border-color: var(--fx-line);
    color: var(--fx-ink);
    font-weight: 600;
    box-shadow: none;
}

.fxp-btn.ghost:hover {
    border-color: #c9d3f2;
    color: var(--fx-brand-strong);
    transform: translateY(-1px);
    box-shadow: 0 8px 18px -14px rgba(40, 60, 160, .4);
}

.fxp-btn.sm {
    padding: 8px 14px;
    font-size: 12px;
}

.fxp-btn[disabled],
.fxp-btn[disabled]:hover {
    opacity: .45;
    transform: none;
    cursor: not-allowed;
    box-shadow: none;
}

/* ============ 容器 ============ */
.fxp-wrap {
    display: block;
    width: 100%;
    max-width: 1180px;
    margin: 0 auto;
    padding: 34px 22px 64px;
}

.fxp-wrap.narrow {
    max-width: 1080px;
}

/* ============ 页头（替代旧的大 hero 卡片） ============ */
.fxp-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 18px;
    flex-wrap: wrap;
    margin-bottom: 6px;
}

.fxp-head-main {
    display: flex;
    align-items: flex-start;
    gap: 13px;
    min-width: 0;
}

.fxp-head-main>img {
    width: 42px;
    height: 42px;
    flex: 0 0 auto;
    margin-top: 2px;
    object-fit: contain;
    border-radius: 11px;
}

.fxp-head-txt {
    min-width: 0;
}

.fxp-head-txt h1 {
    display: block;
    margin: 0;
    font-size: 21px;
    font-weight: 700;
    letter-spacing: 1px;
    line-height: 1.3;
    white-space: nowrap;
}

.fxp-head-txt h1 em {
    margin-left: 9px;
    color: #a3adc7;
    font-size: 11px;
    font-style: normal;
    font-weight: 700;
    letter-spacing: 1.4px;
    vertical-align: 2px;
}

.fxp-head-txt p {
    max-width: 660px;
    margin-top: 8px;
    color: var(--fx-sub);
    font-size: 13px;
    line-height: 1.7;
}

.fxp-head-side {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 0 0 auto;
    min-width: 0;
}

/* ============ 分节标题 + 发丝线 ============ */
.fxp-sect {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 26px 0 12px;
    color: var(--fx-sub);
    font-size: 13px;
    font-weight: 600;
}

.fxp-sect::after {
    content: "";
    flex: 1 1 auto;
    height: 1px;
    background: var(--fx-line);
}

.fxp-sect span {
    color: #a3adc7;
    font-size: 11px;
    font-weight: 600;
}

/* ============ 区块（面板/结果区） ============ */
.fxp-section {
    margin-top: 26px;
}

.fxp-section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.fxp-section-head h2 {
    font-size: 15px;
    letter-spacing: -.01em;
}

.fxp-section-head a {
    color: var(--fx-brand-strong);
    font-size: 12px;
    font-weight: 650;
    white-space: nowrap;
}

/* ============ 卡片底座 ============ */
.fxp-card {
    border: 1px solid var(--fx-line);
    border-radius: var(--fx-r-lg);
    background: var(--fx-surface);
    box-shadow: var(--fx-sh);
}

.fxp-pad {
    padding: 20px;
}

/* ============ 分段控件（胶囊） ============ */
.fxp-seg {
    display: inline-flex;
    gap: 3px;
    padding: 4px;
    border-radius: 11px;
    background: rgba(238, 242, 255, .78);
}

.fxp-seg button {
    padding: 8px 16px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--fx-sub);
    font-family: inherit;
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background .16s var(--fx-ease), color .16s var(--fx-ease), box-shadow .16s var(--fx-ease);
}

.fxp-seg button:hover {
    color: var(--fx-ink);
}

.fxp-seg button.on {
    background: var(--fx-surface);
    color: var(--fx-ink);
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(50, 60, 140, .12);
}

/* ============ 胶囊标签 / 芯片 ============ */
.fxp-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.fxp-chip {
    padding: 7px 14px;
    border: 1px solid var(--fx-line-2);
    border-radius: 50px;
    background: var(--fx-surface);
    color: var(--fx-sub);
    font-family: inherit;
    font-size: 12px;
    cursor: pointer;
    user-select: none;
    transition: border-color .15s var(--fx-ease), color .15s var(--fx-ease), background .15s var(--fx-ease);
}

.fxp-chip:hover {
    border-color: #9fb0ff;
    color: var(--fx-brand-strong);
}

.fxp-chip.on {
    border-color: transparent;
    background: var(--fx-grad);
    color: #fff;
    font-weight: 700;
    box-shadow: 0 8px 18px -10px rgba(79, 107, 255, .7);
}

/* ============ 表单件 ============ */
.fxp-label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    color: var(--fx-ink-2);
    font-size: 12.5px;
    font-weight: 650;
}

.fxp-label .hint {
    color: var(--fx-mute);
    font-size: 11px;
    font-weight: 400;
}

.fxp-field {
    width: 100%;
    padding: 10px 13px;
    border: 1px solid var(--fx-line);
    border-radius: var(--fx-r-sm);
    background: var(--fx-surface);
    color: var(--fx-ink);
    font-family: inherit;
    font-size: 16px; /* 16px 起步可避免 iOS Safari 聚焦时自动放大页面 */
    line-height: 1.6;
    outline: none;
    transition: border-color .16s var(--fx-ease), box-shadow .16s var(--fx-ease);
}

@media (min-width: 761px) {
    .fxp-field {
        font-size: 13.5px;
    }
}

.fxp-field::placeholder {
    color: var(--fx-mute);
}

.fxp-field:focus {
    border-color: #9fb0ff;
    box-shadow: 0 0 0 3px rgba(79, 107, 255, .10);
}

textarea.fxp-field {
    resize: vertical;
    min-height: 92px;
}

select.fxp-field {
    appearance: none;
    -webkit-appearance: none;
    padding-right: 30px;
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%239aa4c0' stroke-width='1.8' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 11px center;
    cursor: pointer;
}

/* ============ 空状态 / 提示条 ============ */
.fxp-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 46px 20px;
    border: 1.5px dashed var(--fx-line-2);
    border-radius: var(--fx-r-lg);
    background: var(--fx-surface);
    color: var(--fx-mute);
    font-size: 13px;
    text-align: center;
}

.fxp-empty .ico {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--fx-brand-soft);
    color: var(--fx-brand);
}

.fxp-note {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 11px 14px;
    border: 1px solid var(--fx-line);
    border-radius: var(--fx-r-sm);
    background: var(--fx-surface);
    color: var(--fx-ink-2);
    font-size: 12px;
    line-height: 1.7;
}

.fxp-note.info {
    background: var(--fx-brand-soft);
    border-color: var(--fx-brand-soft-2);
    color: var(--fx-brand-strong);
}

/* ============ SVG 图标（替代 emoji） ============ */
.fxp-ico {
    display: inline-block;
    width: 18px;
    height: 18px;
    background: currentColor;
    -webkit-mask-size: contain;
    mask-size: contain;
    -webkit-mask-position: center;
    mask-position: center;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    vertical-align: -4px;
}

.fxp-ico[data-key],
.fxp-tabbar a i[data-key] {
    -webkit-mask-image: var(--fx-mask, none);
    mask-image: var(--fx-mask, none);
}

/* 作图工坊（画板） */
[data-key="studio"] {
    --fx-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23000' d='M5 3h14a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2zm3.6 4.4a1.6 1.6 0 1 0 0-3.2 1.6 1.6 0 0 0 0 3.2zM6.4 18 11 13.4l3.1 3.1 3.5-3.5V19H6.4z'/%3E%3C/svg%3E");
}

/* AI 作图（星芒） */
[data-key="ai"] {
    --fx-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23000' d='M12 2l2.1 6.4L20.5 10l-6.4 2.1L12 18.5l-2.1-6.4L3.5 10l6.4-1.6z'/%3E%3C/svg%3E");
}


/* 内联 SVG 图标（颜色随 currentColor） */
.fx-svg {
    width: 14px;
    height: 14px;
    fill: currentColor;
    display: inline-block;
    vertical-align: -2px;
}

/* ============ 移动端底部导航 ============ */
.fxp-tabbar {
    display: none;
}

/* ============ 页脚 ============ */
.fxp-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 34px;
    padding-top: 18px;
    border-top: 1px dashed var(--fx-line);
    color: var(--fx-mute);
    font-size: 11.5px;
    line-height: 1.9;
}

.fxp-foot a {
    color: var(--fx-brand-strong);
    font-weight: 650;
}

/* ============ 响应式：平板 ============ */
@media (max-width: 1080px) {
    .fxp-head {
        align-items: flex-start;
    }
}

/* ============ 响应式：手机 ============ */
@media (max-width: 760px) {
    body.fxp {
        padding-bottom: calc(62px + env(safe-area-inset-bottom, 0px));
    }

    .fxp-top {
        gap: 10px;
        padding: 8px 14px;
    }

    /* 手机上导航交给底部标签栏，顶栏导航隐藏，避免两处重复 */
    .fxp-nav {
        display: none;
    }

    /* 场景库首页没有顶部操作按钮，手机端整条顶栏收起，交给底部标签栏 */
    .fxp-index .fxp-top {
        display: none;
    }

    .fxp-cta .fxp-btn {
        padding: 8px 13px;
        font-size: 12px;
    }

    .fxp-wrap {
        padding: 22px 14px 48px;
    }

    .fxp-head {
        gap: 14px;
        margin-bottom: 2px;
    }

    .fxp-head-main {
        gap: 10px;
    }

    .fxp-head-main>img {
        width: 34px;
        height: 34px;
        margin-top: 1px;
        border-radius: 9px;
    }

    .fxp-head-txt h1 {
        font-size: 17px;
        letter-spacing: .5px;
    }

    .fxp-head-txt h1 em {
        display: none;
    }

    .fxp-head-txt p {
        margin-top: 6px;
        font-size: 12px;
        line-height: 1.65;
    }

    .fxp-head-side {
        width: 100%;
    }

    .fxp-sect {
        margin: 20px 0 10px;
        font-size: 12.5px;
    }

    .fxp-pad {
        padding: 15px;
    }

    .fxp-seg {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .fxp-seg::-webkit-scrollbar {
        display: none;
    }

    .fxp-seg button {
        flex: 0 0 auto;
        padding: 8px 14px;
    }

    .fxp-section-head h2 {
        font-size: 14px;
    }

    /* 底部标签栏 */
    .fxp-tabbar {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 70;
        display: flex;
        align-items: stretch;
        padding-bottom: env(safe-area-inset-bottom, 0px);
        background: rgba(255, 255, 255, .94);
        border-top: 1px solid var(--fx-line);
        backdrop-filter: saturate(1.7) blur(16px);
        -webkit-backdrop-filter: saturate(1.7) blur(16px);
    }

    .fxp-tabbar a {
        flex: 1 1 0;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 4px;
        padding: 8px 2px 7px;
        min-width: 0;
        color: var(--fx-mute);
        font-size: 10px;
        font-weight: 600;
        transition: color .15s var(--fx-ease);
    }

    .fxp-tabbar a i {
        width: 22px;
        height: 22px;
        background: currentColor;
        -webkit-mask-size: contain;
        mask-size: contain;
        -webkit-mask-position: center;
        mask-position: center;
        -webkit-mask-repeat: no-repeat;
        mask-repeat: no-repeat;
    }

    .fxp-tabbar a.on {
        color: var(--fx-brand);
    }

    .fxp-tabbar a span {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 100%;
    }

    .fxp-foot {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
        margin-top: 24px;
        text-align: left;
    }
}

/* 尊重「减少动态效果」偏好 */
@media (prefers-reduced-motion: reduce) {
    .fxp-btn,
    .fxp-chip,
    .fxp-seg button,
    .fxp-nav a,
    .fxp-tabbar a {
        transition: none;
    }

    .fxp-btn:hover {
        transform: none;
    }
}
