/* 小說館加值功能（讀者端）— 角色圖鑑 / 角色對話 / 前情提要 / 語言選單
   沿用閱讀頁的 --bg / --text / --accent / --border 等變數，深淺色自動跟隨。 */

/* ═══ 語言選單（掛在工具列的 🌐 底下）═══ */
#lang-menu {
    position: absolute; top: calc(100% + 8px); right: 0; z-index: 200;
    background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px;
    box-shadow: var(--shadow-lg); padding: 5px; min-width: 148px;
}
#lang-menu[hidden] { display: none; }
#lang-menu a {
    display: block; padding: 8px 13px; border-radius: 8px; font-size: 13px;
    color: var(--text); text-decoration: none; white-space: nowrap;
}
#lang-menu a:hover { background: var(--accent-light); color: var(--accent); }
#lang-menu a.on { background: var(--accent); color: #fff; font-weight: 700; }

/* ═══ 角色圖鑑 ═══ */
.chardex { margin: 34px 0 10px; }
.dex-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.dex-head h3 { font-size: 1.05rem; font-weight: 800; color: var(--text); }
.dex-sub { font-size: .78rem; color: var(--text-muted); }
.dex-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(258px, 1fr)); gap: 12px; }
.dex-card {
    display: flex; gap: 12px; padding: 13px; border-radius: 15px;
    background: var(--bg-card); border: 1px solid var(--border); transition: border-color .16s, transform .16s;
}
.dex-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.dex-avatar {
    position: relative; width: 62px; height: 62px; border-radius: 14px; flex-shrink: 0;
    overflow: hidden; display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #7c5cff, #007AFF); color: #fff; font-size: 25px; font-weight: 900;
}
.dex-avatar img { width: 100%; height: 100%; object-fit: cover; }
.dex-rank { position: absolute; top: -2px; left: -2px; font-size: 15px; line-height: 1; }
.dex-body { flex: 1; min-width: 0; }
.dex-name { font-size: .92rem; font-weight: 800; color: var(--text); display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.dex-name em { font-style: normal; font-size: .68rem; font-weight: 700; color: var(--accent); background: var(--accent-light); padding: 1px 7px; border-radius: 5px; }
.dex-desc { font-size: .74rem; color: var(--text-muted); line-height: 1.65; margin-top: 3px;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.dex-bar { height: 5px; border-radius: 3px; background: rgba(127,127,127,.16); overflow: hidden; margin: 7px 0 4px; }
.dex-bar i { display: block; height: 100%; background: linear-gradient(90deg, #7c5cff, #007AFF); transition: width .3s; }
.dex-meta { font-size: .72rem; color: var(--text-muted); }
.dex-meta b { color: var(--text); font-size: .82rem; }
.dex-acts { display: flex; gap: 6px; margin-top: 8px; }
.dex-btn {
    flex: 1; padding: 6px 10px; border-radius: 9px; border: 1px solid var(--border);
    background: transparent; color: var(--text); font-size: .74rem; font-weight: 700;
    cursor: pointer; font-family: inherit; min-height: 32px; transition: all .15s;
}
.dex-btn.vote:hover:not(:disabled) { border-color: #f43f5e; color: #f43f5e; }
.dex-btn.vote.voted { border-color: #f43f5e; color: #f43f5e; background: rgba(244,63,94,.08); }
.dex-btn.chat { background: linear-gradient(135deg, #7c5cff, #007AFF); color: #fff; border-color: transparent; }
.dex-btn.chat:hover { opacity: .9; }
.dex-btn:disabled { opacity: .55; cursor: default; }
.dex-note { font-size: .72rem; color: var(--text-muted); margin-top: 11px; line-height: 1.8; }
@media (max-width: 640px) {
    .dex-grid { grid-template-columns: 1fr; }
    .dex-btn { min-height: 38px; font-size: .78rem; }
}

/* ═══ 加值彈窗 ═══ */
#va-modal {
    position: fixed; inset: 0; z-index: 9500; background: rgba(0,0,0,.55);
    backdrop-filter: blur(4px); display: none; align-items: center; justify-content: center; padding: 16px;
}
#va-modal.show { display: flex; }
.va-box {
    width: 100%; max-height: 88vh; background: var(--bg-card, #fff); color: var(--text);
    border: 1px solid var(--border); border-radius: 18px; display: flex; flex-direction: column;
    overflow: hidden; box-shadow: 0 22px 60px rgba(0,0,0,.34);
}
.va-head { display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 15px 19px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.va-head h3 { font-size: 1rem; font-weight: 800; }
.va-x { border: none; background: var(--comment-bg); color: var(--text-muted);
    width: 30px; height: 30px; border-radius: 50%; cursor: pointer; font-size: 14px; line-height: 1; }
.va-body { padding: 16px 19px; overflow-y: auto; }
.va-foot:empty { display: none; }
.va-loading { padding: 44px 0; text-align: center; color: var(--text-muted); font-size: .85rem; line-height: 1.9; }
.va-err { padding: 26px 0; text-align: center; color: #ef4444; font-size: .85rem; line-height: 1.9; }
.va-err a, .va-msg.sys a { color: var(--accent); font-weight: 700; }

/* ── 角色對話 ── */
.va-charbar { display: flex; align-items: center; gap: 10px; padding-bottom: 12px;
    border-bottom: 1px solid var(--border); margin-bottom: 12px; }
.va-charbar img, .va-cav { width: 42px; height: 42px; border-radius: 12px; object-fit: cover; flex-shrink: 0; }
.va-cav { display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #7c5cff, #007AFF); color: #fff; font-weight: 900; font-size: 18px; }
.va-charbar b { display: block; font-size: .9rem; }
.va-charbar small { display: block; font-size: .7rem; color: var(--text-muted); margin-top: 1px; }
.va-clear { margin-left: auto; border: none; background: transparent; color: var(--text-muted);
    cursor: pointer; font-size: 15px; padding: 6px; border-radius: 8px; }
.va-clear:hover { color: #ef4444; }

.va-chat { min-height: 190px; max-height: 44vh; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding-right: 2px; }
.va-hint { text-align: center; color: var(--text-muted); font-size: .8rem; line-height: 1.95; padding: 34px 10px; }
.va-msg { display: flex; flex-direction: column; max-width: 84%; }
.va-msg.me { align-self: flex-end; align-items: flex-end; }
.va-msg.them { align-self: flex-start; }
.va-msg.sys { align-self: center; max-width: 100%; font-size: .76rem; color: #ef4444; text-align: center; line-height: 1.8; }
.va-who { font-size: .68rem; color: var(--text-muted); margin-bottom: 3px; padding-left: 3px; }
.va-bubble { padding: 9px 13px; border-radius: 14px; font-size: .86rem; line-height: 1.8; word-break: break-word; }
.va-msg.them .va-bubble { background: var(--comment-bg); border-bottom-left-radius: 4px; }
.va-msg.me .va-bubble { background: linear-gradient(135deg, #7c5cff, #007AFF); color: #fff; border-bottom-right-radius: 4px; }
.va-dots { display: inline-flex; gap: 4px; align-items: center; height: 15px; }
.va-dots b { width: 6px; height: 6px; border-radius: 50%; background: var(--text-muted); animation: va-blink 1.3s infinite; }
.va-dots b:nth-child(2) { animation-delay: .18s; }
.va-dots b:nth-child(3) { animation-delay: .36s; }
@keyframes va-blink { 0%,60%,100% { opacity: .25; } 30% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .va-dots b { animation: none; opacity: .55; } }

.va-inputbar { display: flex; gap: 8px; align-items: flex-end; margin-top: 12px;
    padding-top: 12px; border-top: 1px solid var(--border); }
/* 字級固定 16px：小於 16px 時 iOS Safari 聚焦輸入框會自動放大整頁 */
.va-inputbar textarea {
    flex: 1; resize: none; padding: 10px 13px; border-radius: 12px; border: 1px solid var(--border);
    background: var(--bg); color: var(--text); font-size: 16px; font-family: inherit; line-height: 1.6; outline: none;
}
.va-inputbar textarea:focus { border-color: var(--accent); }
.va-send { padding: 10px 18px; border-radius: 12px; border: none; cursor: pointer; font-family: inherit;
    font-size: .85rem; font-weight: 800; min-height: 42px; flex-shrink: 0;
    background: linear-gradient(135deg, #7c5cff, #007AFF); color: #fff; }
.va-send:disabled { opacity: .5; cursor: not-allowed; }
.va-costnote { font-size: .7rem; color: var(--text-muted); text-align: center; margin-top: 7px; }

/* ── 前情提要 ── */
.va-recap-top { display: flex; align-items: center; justify-content: space-between; gap: 10px;
    flex-wrap: wrap; font-size: .78rem; font-weight: 800; color: var(--accent); margin-bottom: 10px; }
.va-recap-top span { font-size: .68rem; font-weight: 700; color: var(--text-muted);
    background: var(--comment-bg); padding: 2px 9px; border-radius: 6px; }
/* 作者親寫的摘要：綠色，和 AI 轉述一眼分得開 */
.va-recap-top span.va-src-author { color: #2aa44a; background: rgba(52, 199, 89, .12); }
.va-recap-body { font-size: .9rem; line-height: 2; color: var(--text); }
.va-recap-body p { margin-bottom: 11px; }
.va-fine { font-size: .68rem; color: var(--text-muted); line-height: 1.8; margin-top: 14px; }

/* ═══ 聽書模式（TTS 面板擴充）═══ */
.tts-adv { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; font-size: 11.5px; color: var(--text-muted); }
.tts-adv label { display: inline-flex; align-items: center; gap: 5px; cursor: pointer; }
.tts-adv input[type="checkbox"] { width: 15px; height: 15px; accent-color: var(--accent); }
.tts-adv select { padding: 4px 8px; border-radius: 7px; border: 1px solid var(--border);
    background: var(--bg); color: var(--text); font-size: 11.5px; font-family: inherit; }
#tts-sleep-left { font-weight: 800; color: var(--accent); }


/* ═══ 同人接寫 / 平行結局 ═══ */
.fanfic-box {
    max-width: 780px; margin: 26px auto 0; padding: 20px 22px;
    border-radius: 16px;
    background: var(--bg-card, #fff);
    border: 1px solid rgba(52, 199, 89, .28);
    box-shadow: 0 2px 14px rgba(0, 0, 0, .05);
}
.ff-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.ff-head h3 { margin: 0; font-size: 16px; font-weight: 800; }
.ff-cnt {
    font-size: 11px; font-weight: 800; color: #34C759;
    background: rgba(52, 199, 89, .12); padding: 3px 9px; border-radius: 6px;
}
.ff-lead { margin: 0 0 8px; font-size: 13.5px; line-height: 1.9; color: var(--text, #222); }
.ff-note {
    margin: 0 0 10px; padding: 9px 12px; border-radius: 9px; font-size: 12.5px; line-height: 1.8;
    background: rgba(52, 199, 89, .07); border-left: 3px solid #34C759; color: var(--text, #222);
}
.ff-list { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 5px; }
.ff-list li { font-size: 12.5px; line-height: 1.8; color: var(--text-muted, #666); }
.ff-list li.ff-x { color: #ff3b30; font-weight: 600; }
.ff-foot { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.ff-price { font-size: 13px; color: var(--text, #222); }
.ff-price b { color: #34C759; font-size: 15px; }
.ff-state { font-size: 12.5px; color: var(--text-muted, #888); }
.ff-state.ok { color: #34C759; font-weight: 700; }
.ff-btn {
    margin-left: auto; padding: 9px 18px; border: 0; border-radius: 10px; cursor: pointer;
    font-size: 13px; font-weight: 700; color: #fff;
    background: linear-gradient(135deg, #34C759, #2aa44a);
    box-shadow: 0 3px 12px rgba(52, 199, 89, .3);
    transition: transform .15s, box-shadow .15s;
}
.ff-btn:hover { transform: translateY(-1px); box-shadow: 0 5px 16px rgba(52, 199, 89, .4); }
.ff-btn:disabled { opacity: .55; cursor: default; transform: none; }
@media (max-width: 560px) {
    .fanfic-box { padding: 16px 15px; border-radius: 13px; }
    .ff-btn { margin-left: 0; width: 100%; }
}


/* ═══ 同人資料包彈窗 ═══ */
.ffp-origin {
    font-size: 12.5px; color: var(--text-muted, #888); margin-bottom: 12px;
    padding-bottom: 10px; border-bottom: 1px solid var(--border, #eee);
}
.ffp-sec { margin-bottom: 16px; }
.ffp-sec h4 {
    margin: 0 0 7px; font-size: 13px; font-weight: 800; color: var(--text, #222);
}
.ffp-sec p { margin: 0 0 5px; font-size: 12.5px; line-height: 1.85; color: var(--text-muted, #666); }
.ffp-sec p b { color: var(--text, #333); }
.ffp-chars { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 8px; }
.ffp-char {
    padding: 9px 11px; border-radius: 9px;
    background: var(--chip, rgba(0, 0, 0, .04)); border: 1px solid var(--border, #eee);
}
.ffp-char b { font-size: 12.5px; }
.ffp-char em {
    font-style: normal; font-size: 10px; font-weight: 800; margin-left: 5px;
    color: #7c5cff; background: rgba(124, 92, 255, .12); padding: 1px 6px; border-radius: 5px;
}
.ffp-char p { margin: 4px 0 0; font-size: 11.5px; line-height: 1.7; color: var(--text-muted, #888); }
.ffp-chs { margin: 0; padding-left: 20px; display: grid; gap: 6px; }
.ffp-chs li { font-size: 12.5px; line-height: 1.75; color: var(--text, #333); }
.ffp-chs li span { display: block; font-size: 11.5px; color: var(--text-muted, #888); margin-top: 2px; }
.ffp-note { font-size: 11px; color: var(--text-muted, #999); line-height: 1.8; margin: 0; }
.va-ok {
    padding: 9px 12px; border-radius: 9px; margin-bottom: 12px; font-size: 12.5px; font-weight: 700;
    color: #2aa44a; background: rgba(52, 199, 89, .1); border: 1px solid rgba(52, 199, 89, .25);
}

/* 彈窗底部按鈕（.va-foot 只在有內容時顯示） */
.va-btn {
    padding: 9px 17px; border: 0; border-radius: 11px; cursor: pointer; font-family: inherit;
    font-size: 13px; font-weight: 700; color: #fff;
    background: linear-gradient(135deg, #7c5cff, #6a4ae0);
}
.va-btn:hover { filter: brightness(1.06); }
.va-btn.ghost {
    color: var(--text, #333); background: var(--chip, rgba(0, 0, 0, .05));
    border: 1px solid var(--border, #e2e2e2);
}
/* padding 不能省：少了它按鈕會直接貼著圓角邊界；上緣加分隔線，捲動內容不會「撞」到按鈕列 */
.va-foot { display: flex; gap: 9px; justify-content: flex-end; flex-wrap: wrap;
    padding: 13px 19px 15px; border-top: 1px solid var(--border, #e2e2e2); flex-shrink: 0; }
@media (max-width: 480px) { .va-btn { flex: 1; } }


/* ※ 同人作品的改編來源標註 */
.origin-tag {
    display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap;
    margin-top: 9px; padding: 5px 12px; border-radius: 999px;
    font-size: 12px; line-height: 1.7;
    color: #2aa44a; background: rgba(52, 199, 89, .1);
    border: 1px solid rgba(52, 199, 89, .25);
}
.origin-tag a { color: #2aa44a; font-weight: 800; text-decoration: none; }
.origin-tag a:hover { text-decoration: underline; }
.origin-tag span { color: var(--text-muted, #888); font-size: 11.5px; }

/* ═══════════════════════════════════════════════
   角色對話 —— 訊息軟體介面（95vw × 95vh）
   ═══════════════════════════════════════════════ */
#va-modal.va-messenger .va-box {
    width: 95vw; max-width: 95vw !important; height: 95vh; max-height: 95vh;
    display: flex; flex-direction: column; overflow: hidden;
}
#va-modal.va-messenger .va-head { padding: 0; border: 0; min-height: 0; }
#va-modal.va-messenger .va-head h3 { display: none; }
#va-modal.va-messenger .va-head .va-x {
    position: absolute; top: 10px; right: 12px; z-index: 6;
}
#va-modal.va-messenger .va-body { padding: 0; flex: 1; min-height: 0; overflow: hidden; }
#va-modal.va-messenger .va-foot { display: none; }

.vam { display: grid; grid-template-columns: 292px 1fr; height: 100%; min-height: 0; }

/* ── 左側：作品 + 角色清單 ── */
.vam-side {
    display: flex; flex-direction: column; min-height: 0;
    border-right: 1px solid var(--border, #e6e6e6);
    background: var(--chip, rgba(0, 0, 0, .025));
}
.vam-side-head {
    display: flex; align-items: center; gap: 10px; padding: 14px 14px 12px;
    border-bottom: 1px solid var(--border, #e6e6e6);
}
.vam-side-head img, .vam-nocover {
    width: 42px; height: 56px; border-radius: 7px; object-fit: cover; flex-shrink: 0;
    background: var(--comment-bg, rgba(0, 0, 0, .06));
    display: flex; align-items: center; justify-content: center; font-size: 20px;
}
.vam-side-head div { min-width: 0; }
.vam-side-head b { display: block; font-size: 13.5px; font-weight: 800; line-height: 1.4;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vam-side-head small { font-size: 11.5px; color: var(--text-muted, #888); }

.vam-list { flex: 1; overflow-y: auto; padding: 6px; }
.vam-none { padding: 20px 14px; font-size: 12.5px; color: var(--text-muted, #999); }
.vam-row {
    display: flex; align-items: center; gap: 10px; padding: 9px 10px;
    border-radius: 11px; cursor: pointer; transition: background .12s;
}
.vam-row:hover { background: var(--comment-bg, rgba(0, 0, 0, .05)); }
.vam-row.on { background: var(--accent, #7c5cff); }
.vam-row.on b, .vam-row.on .vam-row-sub, .vam-row.on i, .vam-row.on em { color: #fff !important; }
.vam-av {
    width: 44px; height: 44px; border-radius: 50%; object-fit: cover; flex-shrink: 0;
    background: linear-gradient(135deg, #7c5cff, #b06cff);
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-weight: 800; font-size: 16px;
}
.vam-av.lg { width: 40px; height: 40px; cursor: pointer; }
.vam-av.lg:hover { filter: brightness(1.08); }
.vam-row-txt { min-width: 0; flex: 1; }
.vam-row-top { display: flex; align-items: baseline; gap: 6px; }
.vam-row-top b { font-size: 13.5px; font-weight: 700; flex: 1;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vam-row-top i { font-style: normal; font-size: 10.5px; color: var(--text-muted, #aaa); flex-shrink: 0; }
.vam-row-sub {
    font-size: 12px; color: var(--text-muted, #888); margin-top: 2px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.vam-row-sub em { font-style: normal; opacity: .75; }

/* ── 右側：對話串 ── */
.vam-main { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.vam-empty { margin: auto; font-size: 13px; color: var(--text-muted, #999); }
.vam-head {
    display: flex; align-items: center; gap: 10px; padding: 11px 52px 11px 14px;
    border-bottom: 1px solid var(--border, #e6e6e6); flex-shrink: 0;
}
.vam-back {
    display: none; border: 0; background: transparent; cursor: pointer;
    font-size: 19px; color: var(--text, #333); padding: 2px 4px;
}
.vam-head-txt { min-width: 0; flex: 1; }
.vam-head-txt b { display: block; font-size: 14.5px; font-weight: 800; line-height: 1.35;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vam-head-txt small { font-size: 11.5px; color: var(--text-muted, #888); }
.vam-chsel { display: flex; align-items: center; gap: 5px; flex-shrink: 0; }
.vam-chsel span { font-size: 11px; color: var(--text-muted, #999); }
.vam-chsel select {
    max-width: 190px; padding: 5px 8px; border-radius: 8px; font-size: 11.5px; font-family: inherit;
    border: 1px solid var(--border, #ddd); background: var(--bg, #fff); color: var(--text, #333);
}
.vam-ico {
    border: 0; background: transparent; cursor: pointer; font-size: 16px;
    padding: 5px 7px; border-radius: 8px; color: var(--text-muted, #888); flex-shrink: 0;
}
.vam-ico:hover { background: var(--comment-bg, rgba(0, 0, 0, .06)); color: var(--text, #333); }

.vam-body { flex: 1; overflow-y: auto; padding: 16px 18px; display: flex; flex-direction: column; gap: 12px; }
#va-modal.va-messenger .va-msg { max-width: min(640px, 78%); }
.va-bubble.img { padding: 5px; background: var(--comment-bg, rgba(0, 0, 0, .05)); }
.va-bubble.img img {
    display: block; max-width: 100%; max-height: 46vh; border-radius: 10px; cursor: zoom-in;
}
.va-imgcap { display: block; font-size: 10.5px; color: var(--text-muted, #999); padding: 4px 4px 1px; }

.vam-foot {
    display: flex; align-items: flex-end; gap: 8px; padding: 11px 14px 6px;
    border-top: 1px solid var(--border, #e6e6e6); flex-shrink: 0;
}
.vam-foot textarea {
    flex: 1; resize: none; padding: 10px 13px; border-radius: 13px; font-family: inherit;
    font-size: 13.5px; line-height: 1.6; max-height: 120px;
    border: 1px solid var(--border, #ddd); background: var(--bg, #fff); color: var(--text, #222);
}
.vam-selfie {
    display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0;
    padding: 10px 14px; border: 0; border-radius: 13px; cursor: pointer;
    font-family: inherit; font-size: 13px; font-weight: 700; color: #fff;
    background: linear-gradient(135deg, #ff8a3d, #ff5f6d);
    box-shadow: 0 3px 12px rgba(255, 95, 109, .28);
}
.vam-selfie:hover { filter: brightness(1.06); }
.vam-selfie:disabled { opacity: .6; cursor: default; box-shadow: none; }
.vam-selfie i { font-style: normal; font-size: 10.5px; font-weight: 800;
    background: rgba(255, 255, 255, .24); padding: 2px 6px; border-radius: 6px; }
#va-modal.va-messenger .va-costnote { padding: 0 14px 11px; margin: 0; }

/* ── 原圖燈箱 ── */
#va-lightbox {
    position: fixed; inset: 0; z-index: 12000; display: none;
    align-items: center; justify-content: center; padding: 24px;
    background: rgba(0, 0, 0, .88); backdrop-filter: blur(3px);
}
#va-lightbox.show { display: flex; }
#va-lightbox img { max-width: 100%; max-height: 100%; border-radius: 10px;
    box-shadow: 0 18px 60px rgba(0, 0, 0, .6); }
.va-lb-x {
    position: absolute; top: 18px; right: 20px; width: 38px; height: 38px; border: 0;
    border-radius: 50%; cursor: pointer; font-size: 17px; color: #fff;
    background: rgba(255, 255, 255, .16);
}
.va-lb-x:hover { background: rgba(255, 255, 255, .28); }

/* ── 圖片生成設定 ── */
#va-imgset {
    position: fixed; inset: 0; z-index: 12001; display: none;
    align-items: center; justify-content: center; padding: 20px;
    background: rgba(0, 0, 0, .5);
}
#va-imgset.show { display: flex; }
.vam-set-box {
    width: 100%; max-width: 440px; max-height: 88vh; overflow-y: auto; border-radius: 16px;
    background: var(--bg-card, #fff); box-shadow: 0 20px 60px rgba(0, 0, 0, .3);
}
.vam-set-head {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 15px 18px; border-bottom: 1px solid var(--border, #eee);
}
.vam-set-head h3 { margin: 0; font-size: 15px; font-weight: 800; }
.vam-set-body { padding: 16px 18px 18px; }
.vam-set-label { display: block; font-size: 12px; font-weight: 800; margin: 0 0 8px;
    color: var(--text-muted, #888); }
.vam-opts { display: flex; gap: 8px; margin-bottom: 16px; }
.vam-opts.wrap { flex-wrap: wrap; }
.vam-opt {
    display: flex; flex-direction: column; align-items: center; gap: 3px; cursor: pointer;
    min-width: 62px; padding: 9px 12px; border-radius: 11px; font-family: inherit;
    border: 1.5px solid var(--border, #e2e2e2); background: var(--bg, #fff); color: var(--text, #333);
    transition: border-color .12s, background .12s;
}
.vam-opt:hover { border-color: var(--accent, #7c5cff); }
.vam-opt.on { border-color: var(--accent, #7c5cff); background: rgba(124, 92, 255, .1); }
.vam-opt b { font-size: 12.5px; font-weight: 800; }
.vam-opt i { font-style: normal; font-size: 10.5px; color: var(--text-muted, #888); }
.vam-opt.on i { color: var(--accent, #7c5cff); }
.vam-ratio {
    width: 26px; background: var(--comment-bg, rgba(0, 0, 0, .12));
    border-radius: 3px; display: block; max-height: 30px;
}
.vam-opt.on .vam-ratio { background: var(--accent, #7c5cff); }
.vam-set-fine { font-size: 11px; color: var(--text-muted, #999); line-height: 1.9; margin: 0; }

/* ── 手機：左側清單抽屜化 ── */
@media (max-width: 760px) {
    #va-modal.va-messenger .va-box { width: 100vw; max-width: 100vw !important; height: 100vh;
        max-height: 100vh; border-radius: 0; }
    .vam { grid-template-columns: 1fr; }
    .vam-side {
        position: absolute; inset: 0 auto 0 0; width: 82%; max-width: 320px; z-index: 5;
        transform: translateX(-101%); transition: transform .22s ease;
        background: var(--bg-card, #fff); box-shadow: 4px 0 24px rgba(0, 0, 0, .18);
    }
    .vam-side.open { transform: none; }
    .vam-back { display: block; }
    .vam-head { padding-right: 46px; flex-wrap: wrap; }
    .vam-chsel { order: 9; width: 100%; }
    .vam-chsel select { max-width: none; flex: 1; }
    #va-modal.va-messenger .va-msg { max-width: 88%; }
    .vam-selfie i { display: none; }
}


/* 視覺風格 chips（與創作台角色生成器同一份清單） */
.vam-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.vam-chip {
    padding: 7px 13px; border-radius: 999px; cursor: pointer; font-family: inherit;
    font-size: 12.5px; font-weight: 700; white-space: nowrap;
    border: 1.5px solid var(--border, #e2e2e2); background: var(--bg, #fff); color: var(--text, #333);
    transition: border-color .12s, background .12s, color .12s;
}
.vam-chip:hover { border-color: var(--accent, #7c5cff); }
.vam-chip.on { border-color: transparent; color: #fff;
    background: linear-gradient(135deg, #7c5cff, #b06cff); }
