.message .rite-reveal{margin:.35rem 0 .5rem;color:var(--mist-soft,#d8cbb9);font:13px/1.65 var(--serif,serif)}
.message .rite-reveal summary{width:fit-content;cursor:pointer;color:#e3c58c}
.message .rite-reveal p{margin:.35rem 0 0;padding:.25rem .7rem;background:transparent;border:0;border-inline-start:1px solid #99845f;border-radius:0;font:inherit;overflow-wrap:anywhere}

/* src/commercial-ui.css — 灰雾典藏 · 商业剧场级维多利亚神秘学视觉系统 */
:root {
  --lux-obsidian: #111115;
  --lux-surface: #19181d;
  --lux-elevated: #222026;
  --lux-vellum: #ece4d7;
  --lux-dialogue: #f9f0e1;
  --lux-muted: #b6aaa0;
  --lux-faint: #8e8279;
  --lux-brass: #cfa974;
  --lux-brass-hi: #ebd0a5;
  --lux-brass-dim: #735e46;
  --lux-crimson: #942933;
  --lux-crimson-hi: #c64852;
  --lux-border: rgba(207, 169, 116, .24);
  --lux-border-soft: rgba(196, 174, 148, .14);
}

.reader-span-full { grid-column: 1 / -1; }
.gate-import-pill { padding: 4px 11px; font-size: 12.5px; }
.folio-import-pill { align-self: end; }
.dialog-head-glyph { width: 19px; height: 19px; flex: none; stroke: var(--lux-brass); fill: none; stroke-width: 1.55; stroke-linecap: round; stroke-linejoin: round; vertical-align: -3px; margin-right: 7px; }
#scene-title { display: inline-flex; align-items: center; gap: 2px; }
#scene-stamp .scene-watch-icon { width: 15px; height: 15px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

/* 全局无损重置：保证切换到朴素旧版或任意配色时，<q> 绝不叠加浏览器双引号、<cite> 绝不斜体 */
.story-text q.story-quote { quotes: none; font: inherit; color: inherit; }
.story-text q.story-quote::before,
.story-text q.story-quote::after { content: none !important; }
.story-text cite.story-term { font-style: normal; font: inherit; color: inherit; }

/* ───── 1. 全局工作台、地图、日历冷色调彻底归宗（统一煤黑黄铜羊皮纸） ───── */
.wm-atlas {
  --wm-ink: #efe7da; --wm-muted: #b8aba0; --wm-line: #5b4d42; --wm-field: #18171b; --wm-gold: #e6c693;
}
.wm-atlas .wm-tab { background: #211e22; color: #c7baad; border-color: #52453c; }
.wm-atlas .wm-tab[aria-pressed=true] { background: #332c29; color: #fff1d4; box-shadow: inset 0 2px var(--wm-gold); }
.wm-stage { background-color: #151418; background-image: repeating-linear-gradient(135deg, transparent, transparent 8px, #cfa9740a 8px, #cfa9740a 9px); border-color: #5f5043; }
.wm-tools { background: #221f23; color: #ded3c6; border: 1px solid #5f5043; border-top: 0; }
.wm-atlas .wm-step, .wm-atlas .wm-fit { border-color: #6b5a4b; color: #efe5d8; }
.wm-atlas .wm-search { border-color: #625347; }
.wm-atlas .wm-result { border-bottom-color: #3a3330; color: #e8dfd3; }
.wm-atlas .wm-result:hover { background: #292427; }
.wm-atlas .wm-result[aria-pressed=true] { background: #352d2a; color: #ffe5b4; }
.wm-caption { background: #1e1b1ff2; border-color: #cfa974; }

.work-calendar {
  --cal-line: #4d423b; --cal-soft: #b8aba0; --cal-ink: #efe7da; --cal-warm: #e8c793; --cal-cool: #d8b48a; --cal-moon: #d99aa2; --cal-local: #9ec4a9;
}
.wcal-table button[aria-pressed=true] { border-color: #cfa974; background: #332b27; }
.wcal-actions .wcal-save { background: #cfa974; border-color: #e4c596; color: #221b17; font-weight: 600; }

/* ───── 2. 弹窗与设置中心商业级框线、毛玻璃遮罩与丝滑入场（:where 零权重污染，避开 #folio 透明外框） ───── */
html:not([data-ui-style=classic]) :where(dialog:not(#main-title, #threshold, #awakening, #portrait-full, #folio, .cover-sheet)) {
  background: linear-gradient(165deg, #211f24f8, #17161af9);
  border: 1px solid #6b5a4b;
  box-shadow: 0 26px 76px #040407cc, inset 0 1px 0 #ffffff12, inset 0 0 0 3px #19181c, inset 0 0 0 4px #453a33;
}
html:not([data-ui-style=classic]) dialog::backdrop,
html:not([data-ui-style=classic]) #folio::backdrop {
  background: rgba(9, 9, 13, .72);
  backdrop-filter: blur(7px) saturate(1.08);
  -webkit-backdrop-filter: blur(7px) saturate(1.08);
}
html:not([data-ui-style=classic]) .dialog-head {
  padding-bottom: 10px; margin-bottom: 10px;
  border-bottom: 1px solid rgba(207, 169, 116, .22);
}
html:not([data-ui-style=classic]) .dialog-head h2 {
  font: 600 1.18rem/1.35 var(--serif, serif);
  letter-spacing: .08em; color: #f3eadc;
}
html:not([data-ui-style=classic]) .dialog-head [data-close],
html:not([data-ui-style=classic]) .work-head [data-close],
html:not([data-ui-style=classic]) .work-head #fielddesk-back {
  min-height: 34px; padding: 4px 11px;
  border: 1px solid rgba(207, 169, 116, .28); border-radius: 999px;
  background: rgba(24, 22, 26, .65); color: #dfd2c2;
  font: 12.5px/1.2 var(--serif, serif); letter-spacing: .04em;
  transition: border-color .18s, background .18s, color .18s;
}
html:not([data-ui-style=classic]) .dialog-head [data-close]:hover,
html:not([data-ui-style=classic]) .work-head [data-close]:hover,
html:not([data-ui-style=classic]) .work-head #fielddesk-back:hover {
  border-color: var(--lux-brass); background: #362d2a; color: #fff4e2;
}
html:not([data-ui-style=classic]) .setting-choices button {
  border-radius: 5px;
  background: linear-gradient(135deg, #262328, #1c1b20);
  border: 1px solid #52463e;
  box-shadow: inset 0 1px 0 #ffffff0a;
  transition: border-color .18s, transform .18s, background .18s;
}
html:not([data-ui-style=classic]) .setting-choices button:hover {
  border-color: var(--lux-brass);
  background: linear-gradient(135deg, #322c2c, #232025);
}
@media (prefers-reduced-motion: no-preference) {
  html:not([data-ui-style=classic]) :where(dialog[open]:not(#main-title, #threshold, #awakening, #portrait-full)) {
    animation: lux-dialog-in .22s cubic-bezier(.18, .82, .24, 1) both;
  }
  @keyframes lux-dialog-in {
    from { opacity: 0; transform: translateY(6px) scale(.988); }
    to { opacity: 1; transform: none; }
  }
}

/* ───── 3. 落笔秘桌与按需展开「调律台」抽屉 (#composer & #composer-drawer) ───── */
.composer-drawer {
  display: grid; gap: 6px;
  margin: 0 0 8px; padding: 8px 10px 9px;
  border: 1px solid rgba(207, 169, 116, .26);
  border-radius: 5px;
  background: linear-gradient(155deg, rgba(36, 31, 33, .95), rgba(23, 21, 26, .96));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06), 0 8px 20px rgba(5, 5, 8, .45);
}
.composer-drawer .drawer-row {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-width: 0;
}
.composer-drawer .drawer-kicker {
  flex: none; font: 600 11px/1.2 var(--serif, serif);
  letter-spacing: .12em; color: #bfa382; margin-right: 2px;
}
.composer-drawer #configure.model {
  flex: 1 1 11rem; max-width: 100%; min-height: 33px; padding: 4px 10px;
  border: 1px solid rgba(207, 169, 116, .34); border-radius: 4px;
  background: rgba(20, 18, 22, .85); color: #f0dab8;
  font: 12.5px/1.3 var(--serif, serif); text-align: left;
}
.composer-drawer #configure.model:hover { border-color: var(--lux-brass-hi); background: #2c2524; }
.composer-drawer button.tool {
  min-height: 32px; padding: 4px 10px;
  border: 1px solid rgba(186, 162, 136, .24); border-radius: 4px;
  background: rgba(28, 26, 31, .76); color: #d8cbc0;
  font: 12.5px/1.25 var(--serif, serif);
}
.composer-drawer button.tool:not(:disabled):hover {
  border-color: var(--lux-brass); color: #fff3df; background: #342c2a;
}
.composer-drawer .direction-tool[data-active=true] {
  border-color: #d49b6a; background: linear-gradient(135deg, #432b29, #2c2224); color: #ffe6c4;
}
#check-queued:not([hidden]) {
  margin: 0 0 7px; padding: 5px 10px;
  border: 1px solid rgba(207, 169, 116, .35); border-left: 2.5px solid var(--lux-brass);
  border-radius: 4px; background: rgba(34, 29, 28, .9); color: #efe0c8;
}

/* 秘典角色卷宗：塔罗词条卡 (.grimoire-card & .grimoire-fold) */
#actor-list { display: grid; gap: 12px; margin-top: 16px; }
#actor-list > li.grimoire-card {
  padding: 14px 16px;
  border: 1px solid rgba(193, 161, 132, .26);
  border-left: 2.5px solid var(--lux-brass);
  border-radius: 6px;
  background: linear-gradient(155deg, rgba(40, 37, 41, .88), rgba(27, 26, 30, .94));
  box-shadow: 0 8px 22px rgba(6, 6, 9, .36), inset 0 1px 0 rgba(255, 255, 255, .05);
}
#actor-list > li.grimoire-card[data-kind=trait] { border-left-color: #c46b73; }
#actor-list > li.grimoire-card[data-kind=asset] { border-left-color: #d8b878; }
#actor-list > li.grimoire-card[data-kind=gear] { border-left-color: #9ab5a3; }
.grimoire-card .grimoire-head {
  grid-template-columns: minmax(0, 1fr) auto auto; gap: 10px;
  padding-bottom: 8px; border-bottom: 1px solid rgba(207, 169, 116, .14);
}
.grimoire-card .grimoire-head strong {
  font: 600 18px/1.35 var(--serif, serif); color: #f6ede0; letter-spacing: .03em;
}
.grimoire-card .grimoire-badge:not(:empty) {
  padding: 2px 8px; border-radius: 999px;
  border: 1px solid rgba(207, 169, 116, .34);
  background: rgba(56, 46, 39, .72); color: #ebd0a5;
  font: 11.5px/1.35 var(--serif, serif);
}
.grimoire-card .grimoire-edit {
  min-height: 30px; padding: 3px 10px; font-size: 12px;
  border: 1px solid rgba(193, 161, 132, .25); border-radius: 4px;
}
.grimoire-card .grimoire-meta { margin: 7px 0 4px; }
.grimoire-card .grimoire-origin {
  display: inline-block; padding: 1px 7px; border-radius: 3px;
  background: rgba(22, 20, 24, .75); border: 1px solid rgba(193, 161, 132, .18);
  color: #cab9a6; font: 11.5px/1.45 var(--serif, serif);
}
.grimoire-card .grimoire-body { margin-top: 6px; }
.grimoire-card .grimoire-prose, .grimoire-card .grimoire-intro {
  margin: 5px 0; color: #ddd3c7; font: 14px/1.75 var(--serif, serif);
}
.grimoire-card .grimoire-fold { border-top: 1px solid rgba(207, 169, 116, .13); }
.grimoire-card .grimoire-fold:first-child { border-top: 0; }
.grimoire-card .grimoire-fold > summary {
  min-height: 38px; padding: 5px 2px; font: 600 14.5px/1.45 var(--serif, serif); color: #ecd6b4;
}
.grimoire-card .grimoire-fold > p, .grimoire-card .grimoire-fold dd {
  font: 13.5px/1.75 var(--serif, serif); color: #d9cfc4; margin: 0 0 8px;
}
.grimoire-card .grimoire-fold dt { color: #e5c290; font-family: var(--serif, serif); }
.grimoire-card .grimoire-proof { margin-top: 6px; border-top: 1px dashed rgba(207, 169, 116, .16); padding-top: 4px; }

/* 人物面板器皿与属性铭牌精修 */
.actor-screen .pc-bars { gap: 10px 12px; }
.actor-screen .pc-bars .resource-meter {
  padding: 9px 12px; border-radius: 5px;
  background: linear-gradient(145deg, #252328, #1b1a1f);
  border: 1px solid rgba(193, 161, 132, .24);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .05);
}
.actor-screen #pc-stats .attr-grid > div, .actor-screen #pc-stats .derived-grid > div {
  border-radius: 5px;
  background: linear-gradient(155deg, #252328, #1b1a1e);
  border: 1px solid rgba(193, 161, 132, .2);
  padding: 9px 10px;
}
.actor-screen #pc-stats .attr-grid dt, .actor-screen #pc-stats .derived-grid dt {
  font: 12px/1.3 var(--serif, serif); color: #c4b5a5;
}
.actor-screen #pc-stats .attr-grid dd, .actor-screen #pc-stats .derived-grid dd {
  color: #f3e6d2;
}
@media (max-width: 760px) {
  .actor-screen .folio-body {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
  }
  .actor-screen .portrait-plate {
    min-height: 230px;
    background: radial-gradient(ellipse at 50% 38%, #474143 0%, #262429 68%, #18171b 100%) !important;
    border-bottom: 1px solid rgba(207, 169, 116, .25);
  }
  .actor-screen #portrait:not(.custom) { mix-blend-mode: normal; filter: drop-shadow(0 8px 20px rgba(0, 0, 0, .55)); }
  .actor-screen #portrait { height: clamp(220px, 32dvh, 320px); padding: 14px 12px 30px; }
  .actor-screen .folio-copy { padding: 18px 18px 10px; }
  #actor-nav {
    overflow-x: auto; gap: 3px; padding: 5px 8px max(6px, env(safe-area-inset-bottom));
    background: linear-gradient(180deg, #1b1a1f, #141317) !important;
    border-top: 1px solid rgba(207, 169, 116, .28) !important;
  }
  #actor-nav button {
    flex: 1 0 44px; height: 50px; border-radius: 6px; font-size: 11px; gap: 2px;
  }
  #actor-nav button[aria-current=true] {
    background: linear-gradient(180deg, #3b312a, #28211f) !important;
    color: #f6dfb8 !important;
    box-shadow: inset 0 2px 0 var(--lux-brass) !important;
  }
}

/* 朴素旧版回退开关：隐藏新增的顶栏双按钮与时计怀表徽记，100% 还原旧版顶栏与浮动音符/星盘 */
html[data-ui-style=classic] #hud-music-btn,
html[data-ui-style=classic] #hud-orb-btn,
html[data-ui-style=classic] #scene-stamp .scene-watch-icon,
html[data-ui-style=classic] #composer-drawer,
html[data-ui-style=classic] #composer-tune-btn { display: none !important; }

/* ═════ 4. 灰雾典藏 · 商业剧场主视觉模式（默认开启） ═════ */
/* 4A. 零遮挡顶栏星盘时计 HUD（桌面端用 Flex order 精密排布，不改动原始 DOM 顺序） */
html:not([data-ui-style=classic]) #music-note { display: none !important; }
html:not([data-ui-style=classic]) .masthead > .bookplate { order: 1; }
html:not([data-ui-style=classic]) .masthead > .mast-rule { order: 2; }
html:not([data-ui-style=classic]) .masthead > #status-hud { order: 3; }
html:not([data-ui-style=classic]) .masthead > #hud-music-btn { order: 4; }
html:not([data-ui-style=classic]) .masthead > #note-dispenser { order: 5; }
html:not([data-ui-style=classic]) .masthead > #quick-screen { order: 6; }
html:not([data-ui-style=classic]) .masthead > #hud-orb-btn { order: 7; }

html:not([data-ui-style=classic]) body > .masthead {
  position: relative; z-index: 6;
  padding: max(8px, env(safe-area-inset-top)) clamp(12px, 2.6vw, 34px) 8px;
  gap: 8px;
  background: linear-gradient(180deg, rgba(14, 14, 18, .94), rgba(20, 19, 24, .88));
  backdrop-filter: blur(14px) saturate(1.12);
  -webkit-backdrop-filter: blur(14px) saturate(1.12);
  border-bottom: 1px solid rgba(207, 169, 116, .28);
  box-shadow: 0 1px 0 rgba(148, 41, 51, .28), 0 10px 28px rgba(4, 4, 7, .68);
}
html:not([data-ui-style=classic]) .masthead .mast-rule {
  height: 1px; border: 0;
  background: linear-gradient(90deg, transparent, rgba(207, 169, 116, .42) 50%, transparent);
}
html:not([data-ui-style=classic]) .masthead .mast-rule::after {
  top: -3px; width: 6px; height: 6px;
  background: #a8323c; outline: 3px solid #16161b;
  box-shadow: 0 0 8px rgba(200, 67, 75, .55);
}
html:not([data-ui-style=classic]) #scene-stamp {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 2px 8px 2px 0; border-radius: 4px;
  color: #dfd2c0; transition: color .18s;
}
html:not([data-ui-style=classic]) #scene-stamp:hover { color: #fff2dc; text-decoration: none; }
html:not([data-ui-style=classic]) #scene-stamp .scene-watch-icon {
  width: 15px; height: 15px; flex: none;
  stroke: var(--lux-brass); fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round;
}
html:not([data-ui-style=classic]) .masthead #status-hud {
  padding: 4px 10px !important; min-height: 36px; gap: 10px !important;
  border-radius: 999px;
  border: 1px solid rgba(207, 169, 116, .24);
  background: linear-gradient(180deg, rgba(28, 26, 31, .86), rgba(18, 17, 21, .92));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06);
}
html:not([data-ui-style=classic]) .masthead #status-hud:hover {
  border-color: var(--lux-brass); background: rgba(38, 33, 36, .92);
}
@media (min-width: 720px) {
  html:not([data-ui-style=classic]) #status-hud .resource-count {
    display: block !important; max-width: 4.5ch;
  }
  html:not([data-ui-style=classic]) .masthead #status-hud .resource-meter { gap: 4px; }
  html:not([data-ui-style=classic]) .masthead #status-hud .resource-sigil { width: 21px !important; height: 21px !important; }
  html:not([data-ui-style=classic]) .masthead #status-hud .resource-count b {
    font: 600 12.5px/1.1 Georgia, serif; color: #efe5d7;
  }
}

html:not([data-ui-style=classic]) .masthead .hud-icon-btn {
  position: relative; flex: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  min-height: 36px; min-width: 36px; padding: 4px 9px;
  border-radius: 5px;
  border: 1px solid rgba(207, 169, 116, .24);
  background: linear-gradient(180deg, rgba(32, 30, 35, .82), rgba(20, 19, 24, .9));
  color: #ded2c3; font: 12.5px/1.2 var(--serif, serif);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .05);
  transition: border-color .18s, color .18s, background .18s, box-shadow .18s;
}
html:not([data-ui-style=classic]) .masthead .hud-icon-btn:hover,
html:not([data-ui-style=classic]) .masthead .hud-icon-btn[aria-expanded=true],
html:not([data-ui-style=classic]) .masthead .hud-icon-btn[aria-pressed=true] {
  border-color: var(--lux-brass); color: #fff3dd;
  background: linear-gradient(180deg, #38302d, #252023);
  box-shadow: 0 0 12px rgba(207, 169, 116, .18);
}
html:not([data-ui-style=classic]) .masthead .hud-glyph {
  width: 17px; height: 17px; flex: none;
  stroke: currentColor; fill: none; stroke-width: 1.55; stroke-linecap: round; stroke-linejoin: round;
}
html:not([data-ui-style=classic]) .masthead .hud-orb-trigger {
  border-color: rgba(207, 169, 116, .45); color: #efd4aa;
}
html:not([data-ui-style=classic]) .masthead .hud-orb-trigger[data-dial=moon] {
  border-color: #c9737c; color: #f6c2c7;
  background: linear-gradient(180deg, #3d242a, #24191d);
}
html:not([data-ui-style=classic]) #hud-music-btn .hud-music-pulse {
  display: none; width: 6px; height: 6px; border-radius: 50%;
  background: #ebd0a5; box-shadow: 0 0 8px #ebd0a5;
}
html:not([data-ui-style=classic]) #hud-music-btn[data-playing=true] {
  border-color: rgba(235, 208, 165, .52); color: #f7dfc0;
}
html:not([data-ui-style=classic]) #hud-music-btn[data-playing=true] .hud-music-pulse {
  display: inline-block;
}
@media (prefers-reduced-motion: no-preference) {
  html:not([data-ui-style=classic]) #hud-music-btn[data-playing=true] .hud-music-pulse {
    animation: lux-pulse 2.2s ease-in-out infinite;
  }
  @keyframes lux-pulse { 0%, 100% { opacity: .45; transform: scale(.85); } 50% { opacity: 1; transform: scale(1.18); } }
}

/* 窄屏与移动端 HUD 单行精密排布 + 收起态星盘完全隐形零遮挡 */
@media (max-width: 999px), (max-width: 1366px) and (pointer: coarse) {
  html:not([data-ui-style=classic]) body > .masthead,
  html:not([data-ui-style=classic])[data-soft-keyboard]:not(.reader-immersive) body > .masthead {
    display: grid !important;
    grid-template-areas: 'title hud music note screen orb' !important;
    grid-template-columns: minmax(0, 1fr) auto 36px 36px 36px 38px !important;
    align-items: center; column-gap: 4px; row-gap: 0;
    padding: max(4px, env(safe-area-inset-top)) 8px 5px !important;
  }
  html:not([data-ui-style=classic]).reader-immersive body > .masthead {
    display: grid !important;
    grid-template-areas: '. hud music screen orb' !important;
    grid-template-columns: minmax(0, 1fr) auto 36px 36px 38px !important;
    padding: max(3px, env(safe-area-inset-top)) 8px 4px !important;
  }
  html:not([data-ui-style=classic]) .masthead > #hud-music-btn { grid-area: music; width: 36px; min-width: 36px; padding: 0; }
  html:not([data-ui-style=classic]) .masthead > #note-dispenser { grid-area: note; width: 36px; min-width: 36px; min-height: 36px; padding: 0; }
  html:not([data-ui-style=classic]) .masthead > #quick-screen { grid-area: screen; width: 36px; min-width: 36px; min-height: 36px; padding: 0; }
  html:not([data-ui-style=classic]) .masthead > #hud-orb-btn { grid-area: orb; width: 38px; min-width: 38px; padding: 0; }
  html:not([data-ui-style=classic]) .masthead .hud-btn-label { display: none; }
  html:not([data-ui-style=classic]) #hud-music-btn .hud-music-pulse {
    position: absolute; top: 4px; right: 4px; width: 5px; height: 5px;
  }
  html:not([data-ui-style=classic]) .masthead #status-hud {
    padding: 3px 7px !important; min-height: 34px; gap: 5px !important;
  }
  html:not([data-ui-style=classic]) .masthead #status-hud .resource-sigil {
    width: 18px !important; height: 18px !important;
  }
  html:not([data-ui-style=classic]) .masthead #scene-stamp {
    display: grid !important;
    grid-template-columns: 16px minmax(0, 1fr);
    grid-template-areas: 'watch place' 'watch clock';
    align-items: center; column-gap: 6px; row-gap: 1px; padding: 0;
  }
  html:not([data-ui-style=classic]) #scene-stamp .scene-watch-icon {
    grid-area: watch; width: 15px; height: 15px;
  }
  html:not([data-ui-style=classic]) #scene-stamp .scene-place { grid-area: place; font-size: .94rem; }
  html:not([data-ui-style=classic]) #scene-stamp .scene-clock { grid-area: clock; color: #bfa98e; font-size: .72rem; }
  @media (max-width: 420px) { html:not([data-ui-style=classic]) #scene-stamp .scene-clock { font-size: .66rem; gap: .25em; } }
}
@media (max-width: 1120px) {
  html:not([data-ui-style=classic]) #folio-nav[data-dial=closed] {
    visibility: hidden; opacity: 0; pointer-events: none;
  }
  html:not([data-ui-style=classic]) #folio-nav:not([data-dial=closed]) {
    z-index: 18; visibility: visible; opacity: 1;
    filter: drop-shadow(0 18px 48px rgba(0, 0, 0, .86));
  }
}

/* 4B. 剧场级叙事画幅、章节铭牌、台词烛光提亮与花体章末印记 */
html:not([data-ui-style=classic]) #reading {
  mask-image: linear-gradient(to bottom, transparent 0, #000 16px, #000 calc(100% - 16px), transparent 100%);
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 16px, #000 calc(100% - 16px), transparent 100%);
}
html:not([data-ui-style=classic])[data-scenery=plain] #reading {
  mask-image: none; -webkit-mask-image: none;
}
html:not([data-ui-style=classic]) .history {
  width: min(100% - 20px, 47.5rem);
  padding-inline: clamp(1.1rem, 3.6vw, 2.75rem);
  padding-block: clamp(18px, 3vh, 34px) 28px;
  gap: 26px;
  background: linear-gradient(90deg, transparent, rgba(13, 13, 17, .82) 5%, rgba(16, 16, 21, .90) 50%, rgba(13, 13, 17, .82) 95%, transparent);
}
@media (min-width: 780px) {
  html:not([data-ui-style=classic]) .history {
    box-shadow: inset 1px 0 0 rgba(207, 169, 116, .08), inset -1px 0 0 rgba(207, 169, 116, .08);
  }
}

/* 故事轮次眉题：两侧渐变金丝横线 */
html:not([data-ui-style=classic]) .message.assistant > span {
  display: flex; align-items: center; gap: 10px;
  margin: 0 0 .75rem;
  font: 600 .76rem/1.3 var(--serif, serif);
  letter-spacing: .2em; color: #bfa482;
}
html:not([data-ui-style=classic]) .message.assistant > span::before,
html:not([data-ui-style=classic]) .message.assistant > span::after {
  content: ''; flex: 1; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(207, 169, 116, .28), transparent);
}

/* 时地章节铭牌 (.status-line) */
html:not([data-ui-style=classic]) .story-text .status-line {
  display: inline-flex; align-items: center; gap: .65em;
  max-width: 100%; margin: .1rem 0 1.55rem;
  padding: .38rem .92rem;
  border: 1px solid rgba(207, 169, 116, .28);
  border-left: 2.5px solid var(--lux-brass);
  border-radius: 3px;
  background: linear-gradient(90deg, rgba(40, 32, 31, .78), rgba(22, 21, 26, .55));
  font: 500 .83rem/1.45 var(--serif, serif);
  letter-spacing: .06em; color: #e2cfb4;
  box-shadow: 0 4px 14px rgba(5, 5, 8, .35);
}
html:not([data-ui-style=classic]) .story-text .status-line i {
  width: 6px; height: 6px; border: 0; border-radius: 0;
  transform: rotate(45deg);
  background: var(--lux-brass);
  box-shadow: 0 0 6px rgba(207, 169, 116, .6);
}

/* 正文排印、人物台词烛光提亮与神秘学词条黄铜微辉 */
html:not([data-ui-style=classic]):not([data-reading-palette]) .message.assistant .story-text,
html:not([data-ui-style=classic])[data-reading-palette=theme] .message.assistant .story-text {
  color: #e8e0d5;
  letter-spacing: .024em;
}
html:not([data-ui-style=classic]) .story-text q.story-quote {
  quotes: none;
  color: var(--lux-dialogue);
  text-shadow: 0 0 18px rgba(248, 224, 186, .08);
}
html:not([data-ui-style=classic]) .story-text q.story-quote::before,
html:not([data-ui-style=classic]) .story-text q.story-quote::after { content: none; }
html:not([data-ui-style=classic]) .story-text cite.story-term {
  font-style: normal;
  color: #e5c493;
}
html:not([data-ui-style=classic])[data-reading-palette]:not([data-reading-palette=theme]) .story-text q.story-quote,
html:not([data-ui-style=classic])[data-reading-palette]:not([data-reading-palette=theme]) .story-text cite.story-term {
  color: inherit; text-shadow: none;
}
html:not([data-ui-style=classic])[data-reading-palette]:not([data-reading-palette=theme]) .story-text cite.story-term {
  font-weight: 600;
}

/* 章末维多利亚菱形封印符（替代原本突兀的红圆点） */
html:not([data-ui-style=classic]) .message.assistant .story-text::after {
  width: 7px; height: 7px; margin: 2.1rem auto .2rem;
  border-radius: 0; transform: rotate(45deg);
  background: #a9353f;
  border: 1px solid rgba(229, 196, 147, .65);
  box-shadow: 0 0 10px rgba(184, 58, 68, .45);
}

/* 4C. 玩家行动手谕铭牌 (.message.user) —— 右对齐绯红火漆黄铜边卡 */
html:not([data-ui-style=classic]) .message.user {
  align-self: flex-end;
  width: fit-content; max-width: min(90%, 39rem);
}
html:not([data-ui-style=classic]) .message.user > span {
  text-align: right; margin: 0 2px .38rem;
  font: 600 .74rem/1.25 var(--serif, serif);
  letter-spacing: .18em; color: #d8b284;
}
html:not([data-ui-style=classic]) .message.user p {
  position: relative;
  padding: .72rem 1.15rem;
  border: 1px solid rgba(207, 169, 116, .28);
  border-left: 1px solid rgba(207, 169, 116, .22);
  border-right: 3px solid var(--lux-brass);
  border-radius: 5px 2px 2px 5px;
  background: linear-gradient(135deg, rgba(46, 28, 32, .90), rgba(24, 21, 26, .95));
  color: #f3eae0;
  font: 1rem/1.78 var(--serif, serif);
  letter-spacing: .02em;
  box-shadow: 0 10px 26px rgba(4, 4, 7, .52), inset 0 1px 0 rgba(255, 255, 255, .06);
}

/* 4D. 金属蚀刻检定铭牌 (.message .roll & .has-d20) */
html:not([data-ui-style=classic]) .message .roll {
  padding: 3px 11px;
  border-radius: 3px;
  font: 600 12.5px/1.55 var(--serif, serif);
  letter-spacing: .04em;
  box-shadow: 0 4px 12px rgba(4, 4, 7, .45), inset 0 1px 0 rgba(255, 255, 255, .07);
}
html:not([data-ui-style=classic]) .message .roll.ok {
  background: linear-gradient(135deg, rgba(24, 40, 29, .92), rgba(16, 24, 19, .96));
  border-color: rgba(145, 184, 126, .58);
  color: #cae3ba;
}
html:not([data-ui-style=classic]) .message .roll.fail {
  background: linear-gradient(135deg, rgba(48, 23, 25, .92), rgba(27, 16, 18, .96));
  border-color: rgba(204, 106, 94, .62);
  color: #f2b7ae;
}
html:not([data-ui-style=classic]) .message .roll.blind {
  background: linear-gradient(135deg, rgba(39, 30, 54, .92), rgba(22, 18, 32, .96));
  border-color: rgba(178, 152, 224, .55);
  color: #dfd2f7;
}
html:not([data-ui-style=classic]) .message.assistant .round-roll > p {
  border-left: 2px solid rgba(207, 169, 116, .4);
  background: rgba(20, 19, 24, .55);
  padding: 5px 10px; color: #c7bbb0;
}

/* 4E. 静默克制的回合底栏（编辑 / 删除 / 重新生成 / 配图 / 核对） */
html:not([data-ui-style=classic]) .turn-revision-tools {
  gap: 4px !important; margin: .95rem 0 0 !important;
  opacity: .56; transition: opacity .22s ease;
}
html:not([data-ui-style=classic]) .message.user .turn-revision-tools {
  justify-content: flex-end !important; margin-top: .35rem !important;
}
html:not([data-ui-style=classic]) .message:hover .turn-revision-tools,
html:not([data-ui-style=classic]) .message:focus-within .turn-revision-tools { opacity: 1; }
@media (pointer: coarse) {
  html:not([data-ui-style=classic]) .turn-revision-tools { opacity: .76; }
}
html:not([data-ui-style=classic]) .turn-revision-tools button {
  min-height: 28px !important; padding: 3px 9px !important; gap: 4px;
  border: 1px solid rgba(193, 161, 132, .16) !important;
  border-radius: 999px !important;
  background: rgba(20, 19, 24, .52) !important;
  color: #b8aba0 !important;
  font: 12px/1.25 var(--serif, serif) !important;
}
html:not([data-ui-style=classic]) .turn-revision-tools button svg { width: 13px; height: 13px; }
html:not([data-ui-style=classic]) .turn-revision-tools button[data-revision=regenerate] {
  border-color: rgba(207, 169, 116, .28) !important; color: #dec19a !important;
}
html:not([data-ui-style=classic]) .turn-revision-tools button:hover,
html:not([data-ui-style=classic]) .turn-revision-tools button:focus-visible {
  border-color: var(--lux-brass) !important;
  background: rgba(48, 38, 35, .88) !important;
  color: #fff3df !important;
}
html:not([data-ui-style=classic]) details.writing-receipt > summary {
  font: 12px/1.4 var(--serif, serif); color: #a99888; padding: 3px 2px;
}
html:not([data-ui-style=classic]) details.writing-receipt > summary:hover { color: var(--lux-brass-hi); }

/* 4F. 落笔秘桌底栏与火漆封印「发送」按钮 */
html:not([data-ui-style=classic]) .bottom {
  width: min(calc(100% - 24px), 44.5rem);
}
html:not([data-ui-style=classic]) #composer {
  padding: 9px 12px 8px;
  border: 1px solid rgba(207, 169, 116, .34);
  border-radius: 7px;
  background: linear-gradient(165deg, rgba(30, 28, 34, .95), rgba(19, 18, 23, .98));
  box-shadow: 0 16px 42px rgba(3, 3, 6, .82), inset 0 1px 0 rgba(255, 255, 255, .07), inset 0 0 0 3px #18171c, inset 0 0 0 4px rgba(122, 99, 78, .32);
  transition: border-color .22s, box-shadow .22s;
}
html:not([data-ui-style=classic]) #composer:focus-within {
  border-color: rgba(226, 188, 134, .65);
  box-shadow: 0 18px 46px rgba(3, 3, 6, .88), 0 0 24px rgba(176, 62, 72, .18), inset 0 0 0 3px #18171c, inset 0 0 0 4px rgba(186, 142, 96, .42);
}
html:not([data-ui-style=classic]) #composer #action {
  padding: 6px 6px 8px;
  color: #f3ebe0;
  font: 1.02rem/1.72 var(--serif, serif);
  letter-spacing: .015em;
}
html:not([data-ui-style=classic]) #composer #action::placeholder {
  color: #8f847c; font-style: italic;
}
html:not([data-ui-style=classic]) #composer .composer-bar {
  padding-top: 6px; gap: 6px;
  border-top: 1px solid rgba(207, 169, 116, .16);
}
html:not([data-ui-style=classic]) .composer-bar .composer-pill {
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  min-height: 36px; padding: 4px 12px;
  border: 1px solid rgba(207, 169, 116, .24);
  border-radius: 999px;
  background: rgba(28, 26, 31, .78);
  color: #ded1c1;
  font: 500 13px/1.2 var(--serif, serif);
  letter-spacing: .04em;
  transition: border-color .18s, background .18s, color .18s;
}
html:not([data-ui-style=classic]) .composer-bar .composer-pill:not(:disabled):hover,
html:not([data-ui-style=classic]) .composer-bar .composer-pill[aria-expanded=true],
html:not([data-ui-style=classic]) .composer-bar .composer-pill[data-active=true] {
  border-color: var(--lux-brass);
  background: linear-gradient(180deg, #372e2b, #262124);
  color: #fff2dc;
}
html:not([data-ui-style=classic]) #quick-open::before { content: '✦'; color: var(--lux-brass); font-size: 11px; }
html:not([data-ui-style=classic]) #dice-open::before { content: '❖'; color: var(--lux-brass); font-size: 11px; }
html:not([data-ui-style=classic]) #composer-tune-btn::before { content: '⚙'; color: var(--lux-brass); font-size: 12px; }
html:not([data-ui-style=classic]) #composer-tune-dot {
  background: #e6a86a; box-shadow: 0 0 6px #e6a86a;
}
html:not([data-ui-style=classic]) #composer #send {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 37px; padding: 5px 18px;
  border: 1px solid #d8ae79;
  border-radius: 999px;
  background: linear-gradient(135deg, #8c2630 0%, #681b23 58%, #4d161d 100%);
  color: #fbf0df;
  font: 600 13.5px/1.2 var(--serif, serif);
  letter-spacing: .12em;
  box-shadow: 0 4px 14px rgba(120, 26, 36, .48), inset 0 1px 0 rgba(255, 228, 196, .28);
  transition: transform .15s, filter .18s, box-shadow .18s;
}
html:not([data-ui-style=classic]) #composer #send::before {
  content: '✒'; font-size: 12.5px; color: #f3d3a2;
}
html:not([data-ui-style=classic]) #composer #send:not(:disabled):hover {
  filter: brightness(1.12);
  box-shadow: 0 6px 18px rgba(156, 38, 50, .62), inset 0 1px 0 rgba(255, 236, 210, .4);
}
html:not([data-ui-style=classic]) #composer #send:not(:disabled):active { transform: translateY(1px); }

@media (max-width: 999px) {
  html:not([data-ui-style=classic]) body > .bottom { width: min(calc(100% - 12px), 44.5rem); }
  html:not([data-ui-style=classic]) #composer { padding: 6px 8px 6px; }
  html:not([data-ui-style=classic]) .composer .composer-bar {
    padding: 5px 0 0 calc(var(--tool-height) + 4px); gap: 5px;
  }
  html:not([data-ui-style=classic]) .composer-bar .composer-tools { gap: 5px; }
  html:not([data-ui-style=classic]) .composer-bar .composer-pill {
    min-height: 38px; padding: 4px 10px; font-size: 12.5px;
  }
  html:not([data-ui-style=classic]) #composer #send {
    min-height: 38px; padding: 4px 15px; font-size: 13px;
  }
}

/* --- V14 Custom & Specialist Pathway Interactive Mechanics Hub --- */
.custom-mech-hub {
  display: flex; flex-direction: column; gap: 12px;
  margin: 10px 0 14px;
}
.custom-mech-hub[hidden] { display: none !important; }
.mech-card {
  border: 1px solid rgba(120, 92, 52, .32);
  border-radius: 9px;
  padding: 12px 14px;
  background: rgba(120, 92, 52, .06);
  display: flex; flex-direction: column; gap: 8px;
}
html:not([data-ui-style=classic]) .mech-card {
  border-color: rgba(207, 169, 116, .34);
  background: linear-gradient(160deg, rgba(34, 28, 33, .92), rgba(20, 17, 22, .95));
  box-shadow: 0 6px 18px rgba(0, 0, 0, .28), inset 0 1px 0 rgba(255, 232, 198, .06);
}
.mech-head {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px;
}
.mech-title-wrap {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px;
}
.mech-title {
  margin: 0; font: 600 15px/1.3 var(--serif, serif);
}
html:not([data-ui-style=classic]) .mech-title { color: #f3dca8; }
.mech-sub { font-size: 12px; opacity: .76; }
.mech-badge {
  display: inline-flex; align-items: center; padding: 2px 10px;
  border-radius: 999px; font-size: 12.5px; font-weight: 600;
  border: 1px solid rgba(140, 96, 38, .45);
  background: rgba(168, 118, 48, .14);
}
html:not([data-ui-style=classic]) .mech-badge {
  border-color: rgba(216, 174, 121, .52);
  background: rgba(140, 38, 48, .35);
  color: #ffe9c4;
}
.mech-rule {
  margin: 0; font-size: 12.5px; line-height: 1.55; opacity: .86;
}
.mech-meter {
  width: 100%; height: 9px; border-radius: 999px; overflow: hidden;
  appearance: none; -webkit-appearance: none; border: none;
  background: rgba(120, 100, 75, .22);
}
.mech-meter::-webkit-progress-bar { background: rgba(120, 100, 75, .22); border-radius: 999px; }
.mech-meter::-webkit-progress-value {
  background: linear-gradient(90deg, #8c2630, #cfa974); border-radius: 999px;
}
.mech-meter::-moz-progress-bar {
  background: linear-gradient(90deg, #8c2630, #cfa974); border-radius: 999px;
}
.mech-readout {
  font-size: 12px; opacity: .88; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px;
}
.mech-pip-row {
  display: flex; flex-wrap: wrap; gap: 5px;
}
.mech-pip {
  padding: 2px 8px; border-radius: 999px; font-size: 11.5px;
  border: 1px solid rgba(120, 100, 75, .28); opacity: .52;
}
.mech-pip.is-done {
  opacity: .88; border-color: rgba(180, 138, 76, .5);
  background: rgba(180, 138, 76, .12);
}
.mech-pip.is-current {
  opacity: 1; font-weight: 700;
  border-color: #cfa974; background: rgba(140, 38, 48, .25);
}
html:not([data-ui-style=classic]) .mech-pip.is-current { color: #fff1d6; box-shadow: 0 0 8px rgba(207, 169, 116, .25); }
.mech-actions {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
}
.mech-btn {
  padding: 4px 10px; border-radius: 6px; font-size: 12px; cursor: pointer;
  border: 1px solid rgba(130, 105, 72, .38); background: rgba(130, 105, 72, .08); color: inherit;
}
html:not([data-ui-style=classic]) .mech-btn {
  border-color: rgba(207, 169, 116, .28); background: rgba(38, 33, 40, .82); color: #e8dccb;
}
.mech-btn:hover { border-color: #cfa974; }
.mech-btn-invoke {
  font-weight: 600; border-color: rgba(158, 51, 64, .65);
  background: rgba(158, 51, 64, .14);
}
html:not([data-ui-style=classic]) .mech-btn-invoke {
  border-color: #d8ae79;
  background: linear-gradient(135deg, #7c222b, #51171e);
  color: #fff0da;
}
.mech-tier-list, .mech-slot-list {
  display: flex; flex-direction: column; gap: 6px; margin-top: 2px;
}
.mech-tier-item, .mech-slot-item {
  padding: 7px 10px; border-radius: 6px;
  border: 1px solid rgba(120, 100, 75, .22);
  background: rgba(120, 100, 75, .04);
  font-size: 12.5px; line-height: 1.5;
}
html:not([data-ui-style=classic]) .mech-tier-item,
html:not([data-ui-style=classic]) .mech-slot-item {
  border-color: rgba(207, 169, 116, .18);
  background: rgba(15, 13, 17, .52);
}
.mech-tier-item.is-locked { opacity: .52; }
.mech-tier-item.is-current { border-color: rgba(207, 169, 116, .58); }
.mech-tier-head, .mech-slot-head {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px;
  margin-bottom: 3px;
}
.mech-slot-meta { font-size: 11.5px; opacity: .78; }
.mech-slot-form {
  display: flex; flex-direction: column; gap: 6px;
  padding: 9px 10px; border-radius: 7px;
  border: 1px dashed rgba(180, 138, 76, .45);
}
.mech-slot-form-row {
  display: grid; grid-template-columns: 1.2fr 1fr 0.7fr; gap: 6px;
}
@media (max-width: 640px) {
  .mech-slot-form-row { grid-template-columns: 1fr; }
}
.mech-slot-form input, .mech-slot-form textarea {
  width: 100%; padding: 5px 8px; border-radius: 5px; font: inherit; font-size: 12.5px;
  border: 1px solid rgba(130, 105, 72, .38); background: rgba(0, 0, 0, .12); color: inherit;
}
.mech-stance-grid {
  display: flex; flex-wrap: wrap; gap: 6px;
}
.mech-stance-pill[aria-pressed=true] {
  font-weight: 600; border-color: #cfa974;
  background: rgba(158, 51, 64, .22);
}
html:not([data-ui-style=classic]) .mech-stance-pill[aria-pressed=true] {
  color: #fff2dc; background: linear-gradient(135deg, #6d2028, #3d1820);
}
.mech-book-preview {
  margin-top: 10px; padding-top: 8px;
  border-top: 1px dashed rgba(180, 138, 76, .32);
}

/* --- V15 Offline Plugin Marketplace & Compatibility Sandbox UI --- */
#plugin-market-ui {
  width: min(1040px, 95vw);
  max-height: min(88vh, 860px);
}
#plugin-market-ui .pm-shell {
  display: flex; flex-direction: column; gap: 12px;
  padding: 14px 18px 18px;
  overflow-y: auto; max-height: calc(88vh - 64px);
}
.pm-top-bar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px;
  padding-bottom: 10px; border-bottom: 1px solid rgba(180, 142, 88, .28);
}
.pm-tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.pm-tab {
  padding: 6px 13px; border-radius: 999px; font-size: 13px; cursor: pointer;
  border: 1px solid rgba(140, 110, 68, .35); background: transparent; color: inherit;
}
.pm-tab[aria-selected=true] {
  font-weight: 600; border-color: #cfa974;
  background: rgba(158, 51, 64, .2);
}
html:not([data-ui-style=classic]) .pm-tab[aria-selected=true] {
  background: linear-gradient(135deg, #742029, #44161d); color: #fff2dc;
}
.pm-safe-pill {
  padding: 5px 12px; border-radius: 999px; font-size: 12px; cursor: pointer;
  border: 1px solid rgba(140, 110, 68, .4); background: rgba(140, 110, 68, .08); color: inherit;
}
.pm-safe-pill[aria-pressed=true] {
  border-color: #e0a64b; background: rgba(224, 166, 75, .22); font-weight: 600;
}
.pm-filter-bar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px;
}
.pm-cats { display: flex; flex-wrap: wrap; gap: 5px; }
.pm-cat {
  padding: 3px 10px; border-radius: 999px; font-size: 12px; cursor: pointer;
  border: 1px solid rgba(140, 110, 68, .28); background: transparent; color: inherit; opacity: .82;
}
.pm-cat[aria-pressed=true] {
  opacity: 1; font-weight: 600; border-color: #cfa974; background: rgba(207, 169, 116, .16);
}
.pm-search {
  min-width: 210px; padding: 5px 10px; border-radius: 6px; font: inherit; font-size: 12.5px;
  border: 1px solid rgba(140, 110, 68, .36); background: rgba(0, 0, 0, .12); color: inherit;
}
.pm-grid {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px;
}
@media (max-width: 780px) {
  .pm-grid { grid-template-columns: 1fr; }
}
.pm-card {
  border: 1px solid rgba(130, 100, 60, .32); border-radius: 9px; padding: 12px 14px;
  background: rgba(120, 92, 52, .05);
  display: flex; flex-direction: column; justify-content: space-between; gap: 9px;
}
html:not([data-ui-style=classic]) .pm-card {
  border-color: rgba(207, 169, 116, .28);
  background: linear-gradient(160deg, rgba(31, 26, 31, .94), rgba(19, 16, 21, .96));
}
.pm-card.is-enabled { border-color: rgba(207, 169, 116, .68); }
.pm-card-head {
  display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 6px;
}
.pm-card-title { margin: 0; font: 600 15px/1.3 var(--serif, serif); }
html:not([data-ui-style=classic]) .pm-card-title { color: #f3dca8; }
.pm-meta { font-size: 11.5px; opacity: .76; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.pm-desc { margin: 4px 0 0; font-size: 12.5px; line-height: 1.55; opacity: .9; }
.pm-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.pm-tag {
  padding: 1px 7px; border-radius: 4px; font-size: 11px;
  border: 1px solid rgba(140, 110, 68, .32); opacity: .88;
}
.pm-load-low { border-color: rgba(91, 185, 140, .5); color: #5bb98c; }
.pm-load-mid { border-color: rgba(224, 166, 75, .55); color: #e0a64b; }
.pm-load-high { border-color: rgba(223, 100, 110, .6); color: #df646e; }
html[data-ui-style=classic] .pm-load-low { color: #266c4b; }
html[data-ui-style=classic] .pm-load-mid { color: #8c5d12; }
html[data-ui-style=classic] .pm-load-high { color: #9c2430; }
.pm-warn {
  margin: 4px 0 0; padding: 5px 8px; border-radius: 5px; font-size: 11.5px;
  border: 1px solid rgba(224, 166, 75, .48); background: rgba(224, 166, 75, .1);
}
.pm-card-foot {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px;
  padding-top: 7px; border-top: 1px dashed rgba(140, 110, 68, .22);
}
.pm-dropzone {
  border: 1px dashed rgba(207, 169, 116, .5); border-radius: 9px; padding: 14px;
  text-align: center; background: rgba(120, 92, 52, .05);
  display: flex; flex-direction: column; align-items: center; gap: 7px;
}
.pm-dropzone[data-drag=true] { border-color: #f3dca8; background: rgba(207, 169, 116, .14); }
.pm-report {
  padding: 10px 12px; border-radius: 8px; font-size: 12.5px; line-height: 1.58;
  border: 1px solid rgba(207, 169, 116, .42); background: rgba(120, 92, 52, .08);
}
.pm-pack-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
}
@media (max-width: 700px) {
  .pm-pack-grid { grid-template-columns: 1fr; }
}
.pm-field { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; }
.pm-field input, .pm-field select, .pm-field textarea {
  width: 100%; padding: 6px 9px; border-radius: 6px; font: inherit;
  border: 1px solid rgba(140, 110, 68, .36); background: rgba(0, 0, 0, .12); color: inherit;
}
.pm-check-list {
  display: flex; flex-direction: column; gap: 5px; max-height: 150px; overflow-y: auto;
  padding: 7px 9px; border-radius: 6px; border: 1px solid rgba(140, 110, 68, .25);
}
.pm-check-row { display: flex; align-items: center; gap: 6px; font-size: 12.5px; cursor: pointer; }
.pm-check-row input { width: auto; }

/* --- V16 Sandboxed Executable Plugin Host & Minimalist Status Badges --- */
#plugin-apps-ui {
  width: min(980px, 95vw);
  max-height: min(88vh, 840px);
}
#plugin-apps-ui .pa-shell {
  display: flex; flex-direction: column; gap: 10px;
  padding: 12px 16px 16px;
}
.pa-tabs {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding-bottom: 8px; border-bottom: 1px solid rgba(180, 142, 88, .28);
}
.pa-tab {
  padding: 5px 13px; border-radius: 999px; font-size: 12.5px; cursor: pointer;
  border: 1px solid rgba(140, 110, 68, .35); background: transparent; color: inherit;
}
.pa-tab[aria-selected=true] {
  font-weight: 600; border-color: #cfa974; background: rgba(158, 51, 64, .24);
}
html:not([data-ui-style=classic]) .pa-tab[aria-selected=true] {
  background: linear-gradient(135deg, #742029, #44161d); color: #fff2dc;
}
.pa-stage {
  width: 100%; min-height: 420px;
}
.pa-frame {
  width: 100%; height: min(68vh, 580px);
  border: 1px solid rgba(207, 169, 116, .3); border-radius: 8px;
  background: #10131c; display: block;
}
.pa-frame[hidden] { display: none !important; }
.mod-badges-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  padding: 2px 4px 4px;
}
.mod-badges-bar[hidden] { display: none !important; }
.mod-badge-pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 10px; border-radius: 999px; font-size: 11.5px; cursor: pointer;
  border: 1px solid rgba(207, 169, 116, .42);
  background: rgba(22, 18, 24, .86); color: #f3dca8;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .28);
  transition: border-color .15s, transform .12s;
}
html[data-ui-style=classic] .mod-badge-pill {
  background: rgba(245, 236, 219, .94); color: #3a2a16; border-color: rgba(140, 105, 56, .48);
}
.mod-badge-pill:hover { border-color: #f3dca8; transform: translateY(-1px); }
.mod-badge-pill[data-tone=ok] { border-color: rgba(91, 185, 140, .55); }
.mod-badge-pill[data-tone=warn] { border-color: rgba(224, 166, 75, .62); }
.mod-badge-pill[data-tone=crimson] { border-color: rgba(196, 68, 82, .68); }
.mod-badge-pill.mod-quick-pill {
  border-style: dashed; border-color: rgba(216, 181, 124, .65);
  background: rgba(46, 35, 22, .85); color: #ffe7b8;
}
html[data-ui-style=classic] .mod-badge-pill.mod-quick-pill {
  background: rgba(235, 220, 192, .95); color: #4a3314;
}
.pa-api-bar {
  flex: none;
  border: 1px solid rgba(207, 169, 116, .32);
  border-radius: 7px;
  background: rgba(18, 22, 32, .78);
  font-size: 12.5px;
}
html[data-ui-style=classic] .pa-api-bar {
  background: rgba(244, 235, 218, .9);
  border-color: rgba(140, 105, 56, .38);
}
.pa-api-bar[hidden] { display: none !important; }
.pa-api-summary {
  cursor: pointer;
  padding: 6px 11px;
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 6px;
  user-select: none;
}
.pa-api-sum-title { font-weight: 600; color: #f3dca8; }
html[data-ui-style=classic] .pa-api-sum-title { color: #5b3d16; }
.pa-api-sum-hint { opacity: .76; font-size: 11.5px; }
.pa-api-body {
  border-top: 1px solid rgba(207, 169, 116, .22);
  padding: 9px 11px 11px;
  display: flex; flex-direction: column; gap: 8px;
}
.pa-slot-card {
  display: flex; flex-direction: column; gap: 6px;
  padding: 7px 9px; border-radius: 6px;
  background: rgba(10, 13, 20, .48);
  border: 1px solid rgba(207, 169, 116, .18);
}
html[data-ui-style=classic] .pa-slot-card { background: rgba(255, 250, 240, .72); }
.pa-slot-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px; align-items: baseline; }
.pa-slot-controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.pa-slot-select, .pa-slot-input {
  padding: 5px 8px; border-radius: 5px; font: inherit; font-size: 12.5px;
  border: 1px solid rgba(180, 142, 88, .38);
  background: rgba(12, 16, 24, .88); color: inherit;
}
html[data-ui-style=classic] .pa-slot-select,
html[data-ui-style=classic] .pa-slot-input {
  background: #fffdf8; color: #2b2116;
}
.pa-slot-select { min-width: min(300px, 100%); }
.pa-slot-custom { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 2px; }
.pa-slot-custom[hidden] { display: none !important; }
.pa-slot-model-row { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.pa-slot-model-row .pa-slot-input { flex: 1 1 180px; }
.pa-slot-feedback { color: #d8b57c; font-size: 11.5px; }
html[data-ui-style=classic] .pa-slot-feedback { color: #6c4a1b; }
@media (max-width: 680px) {
  .pa-slot-custom { grid-template-columns: 1fr; }
  .pa-api-sum-hint { display: none; }
}
.pm-perm-box {
  margin-top: 7px;
  border: 1px dashed rgba(207, 169, 116, .32);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 11.5px;
}
.pm-perm-summary { cursor: pointer; opacity: .9; font-weight: 600; }
.pm-perm-list {
  display: flex; flex-wrap: wrap; gap: 5px 10px;
  padding-top: 5px; margin-top: 4px;
  border-top: 1px solid rgba(207, 169, 116, .16);
}
.pm-perm-item { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; }

/* Built-in Theme Skins for Theme Plugins */
html[data-mod-theme=abyssal-sea]:not([data-ui-style=classic]) {
  --lux-bg: #0a101a;
  --lux-paper: #101928;
  --lux-brass: #86bedf;
  --lux-brass-soft: rgba(134, 190, 223, .3);
  --lux-crimson: #1f507a;
}
html[data-mod-theme=abyssal-sea]:not([data-ui-style=classic]) #composer #send {
  border-color: #86bedf;
  background: linear-gradient(135deg, #1d5582 0%, #143b5c 58%, #0e2840 100%);
  box-shadow: 0 4px 14px rgba(20, 68, 110, .48);
}
html[data-mod-theme=crimson-moon]:not([data-ui-style=classic]) {
  --lux-bg: #150b10;
  --lux-paper: #211118;
  --lux-brass: #e6b0a6;
  --lux-brass-soft: rgba(230, 176, 166, .32);
  --lux-crimson: #a8243b;
}

/* --- V17 Mobile Fullscreen, Safe-Area Edge-to-Edge, Workbench & Composer Adaptation --- */
.mod-apps-label-short { display: none; }

/* Ensure plugin market & sandbox app host workbenches flex cleanly across desktop & mobile fullscreen */
#plugin-market-ui[open],
#plugin-apps-ui[open] {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
#plugin-market-ui .work-head,
#plugin-apps-ui .work-head {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
#plugin-market-ui .work-head > div:first-child,
#plugin-apps-ui .work-head > div:first-child {
  min-width: 0;
  flex: 1 1 auto;
}
#plugin-market-ui .work-head h2,
#plugin-apps-ui .work-head h2 {
  font-size: clamp(.96rem, 2.8vw, 1.15rem);
  line-height: 1.3;
}
#plugin-market-ui .work-head button,
#plugin-apps-ui .work-head button,
#plugin-apps-ui .work-head .mech-actions {
  flex: none;
  white-space: nowrap;
}
#plugin-market-ui .pm-shell {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  overflow-y: auto;
  overscroll-behavior: contain;
}
#plugin-apps-ui .pa-shell {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overscroll-behavior: contain;
}
#plugin-apps-ui .pa-tabs {
  flex: none;
}
#plugin-apps-ui .pa-stage {
  flex: 1 1 auto;
  min-height: 220px;
  display: flex;
  flex-direction: column;
}
#plugin-apps-ui .pa-frame:not([hidden]) {
  flex: 1 1 auto;
  width: 100%;
  height: 100%;
  min-height: 220px;
}

@media (min-width: 761px) {
  html:not([data-mobile-viewport]) #plugin-market-ui[open],
  html:not([data-mobile-viewport]) #plugin-apps-ui[open] {
    inset: 0;
    margin: auto;
    height: min(88dvh, 850px);
    border-radius: 10px;
  }
}

/* Mobile & Fullscreen safe-area single-application (no top gap, no double inset) */
html[data-mobile-viewport] body > .masthead,
html[data-mobile-viewport]:not([data-ui-style=classic]) body > .masthead {
  padding-top: max(4px, var(--play-safe-top)) !important;
}
html[data-mobile-viewport] body > .bottom {
  padding-bottom: max(6px, var(--play-safe-bottom));
}
html[data-mobile-viewport] #plugin-market-ui[open],
html[data-mobile-viewport] #plugin-apps-ui[open] {
  width: var(--play-view-width);
  height: var(--play-view-height);
  max-width: var(--play-view-width);
  max-height: var(--play-view-height);
  margin: 0;
  border: 0;
  border-radius: 0;
}
html[data-mobile-viewport] dialog.workbench .work-head {
  padding: max(7px, var(--play-safe-top)) max(12px, var(--play-safe-right)) 7px max(12px, var(--play-safe-left));
}
html[data-mobile-viewport] #plugin-market-ui .pm-shell,
html[data-mobile-viewport] #plugin-apps-ui .pa-shell {
  padding: 10px max(12px, var(--play-safe-right)) max(14px, var(--play-safe-bottom)) max(12px, var(--play-safe-left));
}

@media (max-width: 760px) {
  html[data-mobile-viewport] :is(#folio.actor-screen, #folio:has(#folio-bag:not([hidden])), #folio:has(#item-form:not([hidden])))[open] {
    inset: var(--play-view-top) var(--play-view-right) var(--play-view-bottom) var(--play-view-left);
    width: var(--play-view-width);
    height: var(--play-view-height);
    max-width: var(--play-view-width);
    max-height: var(--play-view-height);
    margin: 0;
  }
  html[data-mobile-viewport] .actor-screen .folio-top {
    padding-top: max(6px, var(--play-safe-top));
  }
  html[data-mobile-viewport] #actor-nav {
    padding-bottom: max(6px, var(--play-safe-bottom)) !important;
  }
}

/* Narrow mobile composer bar: fit all 4 pills + hat toggle + send cleanly without clipping */
@media (max-width: 600px) {
  .mod-apps-label-full { display: none; }
  .mod-apps-label-short { display: inline; }
  .pm-search { min-width: 0; width: 100%; }
  #plugin-apps-ui .pa-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    overscroll-behavior-x: contain;
  }
  #plugin-apps-ui .pa-tab { white-space: nowrap; flex: none; }

  html:not([data-ui-style=classic]) #corner-figure .figure-bar {
    left: 4px; bottom: 7px;
  }
  html:not([data-ui-style=classic]) #corner-figure #figure-toggle {
    width: 36px; min-width: 36px; min-height: 34px;
  }
  html:not([data-ui-style=classic]) #composer .composer-bar {
    padding: 4px 0 0 39px;
    gap: 4px;
  }
  html:not([data-ui-style=classic]) #composer .composer-bar .composer-tools {
    gap: 3px;
  }
  html:not([data-ui-style=classic]) #composer .composer-bar .composer-pill {
    min-width: 0;
    min-height: 34px;
    padding: 3px 7px;
    font-size: 11.75px;
    letter-spacing: 0;
    gap: 2px;
  }
  html:not([data-ui-style=classic]) #composer #send {
    min-width: 0;
    min-height: 34px;
    padding: 3px 10px;
    font-size: 12.25px;
    letter-spacing: .04em;
    gap: 3px;
  }
}
@media (max-width: 440px) {
  html:not([data-ui-style=classic]) #composer :is(#quick-open, #dice-open, #composer-tune-btn, #send)::before {
    content: none;
  }
}

/* Short / landscape fullscreen adaptation for sandbox apps & immersive mode */
@media (max-height: 480px) {
  #plugin-apps-ui .work-head,
  #plugin-market-ui .work-head { padding-block: 5px; }
  #plugin-apps-ui .pa-shell { gap: 6px; padding-block: 6px 8px; }
  #plugin-apps-ui .pa-tabs { padding-bottom: 4px; flex-wrap: nowrap; overflow-x: auto; }
  #plugin-apps-ui .pa-tab { white-space: nowrap; padding: 3px 10px; font-size: 12px; }
  #plugin-apps-ui .pa-stage,
  #plugin-apps-ui .pa-frame:not([hidden]) { min-height: 165px; }
}

/* Make Web Immersive Mode (iOS Safari / WeChat / QQ WebView fallback) genuinely expand story reading area */
@media (max-width: 999px) {
  html.reader-immersive:not([data-soft-keyboard]) body > .bottom:not(:focus-within) #composer {
    min-height: 0;
    padding-block: 4px;
  }
  html.reader-immersive:not([data-soft-keyboard]) body > .bottom:not(:focus-within) #composer #action {
    height: 32px;
    padding-block: 4px;
    font-size: 15px;
  }
}

/* === V21 Integrated v0.1.5 Modules & Luxury Composer Icon Bridge === */
#fan-path-record h5{font-size:15px;margin:16px 0 4px;color:var(--brass)}
#profile-path-note{color:var(--faint);line-height:1.6}
