@import url("theme.css");

#app-window-container {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  box-sizing: border-box;
  pointer-events: none;
  z-index: 9999; 
}

/* Phase 12E-3 Prompt App: compact structure rows, quiet controls, and a softer glass surface. */
#win-prompt .prompt-app-body { padding: 0; overflow: auto; }
#prompt-app-root { min-height: 100%; }
.prompt-app-shell { display: flex; flex-direction: column; gap: 13px; padding: 15px 15px 20px; color: var(--text-primary); }
.prompt-app-mode-switch { display: inline-flex; align-self: flex-start; width: min(100%, 224px); padding: 3px; border: 1px solid color-mix(in srgb, var(--border) 78%, #fff); border-radius: 999px; background: color-mix(in srgb, var(--surface-soft, #fff) 72%, transparent); box-shadow: inset 0 1px 0 rgba(255,255,255,.76), 0 5px 16px rgba(46, 67, 91, .045); }
.prompt-app-mode-switch button { flex: 1 1 0; border: 0; border-radius: 999px; padding: 7px 14px; background: transparent; color: color-mix(in srgb, var(--text-secondary) 78%, #fff); font-size: 12px; font-weight: 600; letter-spacing: .01em; cursor: pointer; transition: background .18s ease, color .18s ease, box-shadow .18s ease; }
.prompt-app-mode-switch button[aria-selected="true"] { background: rgba(255,255,255,.88); color: color-mix(in srgb, var(--primary) 58%, var(--text-primary)); box-shadow: 0 3px 9px rgba(58, 80, 105, .09); }
.prompt-app-mode-switch button:focus-visible { outline: 2px solid color-mix(in srgb, var(--primary) 42%, transparent); outline-offset: 1px; }
.prompt-app-scope-switch { display: inline-flex; align-self: center; width: min(100%, 248px); padding: 2px; border: 1px solid rgba(141, 158, 177, .2); border-radius: 999px; background: rgba(255,255,255,.3); }
.prompt-app-scope-switch button { flex: 1 1 0; border: 0; border-radius: 999px; padding: 6px 12px; background: transparent; color: rgba(76,94,116,.68); font-size: 11px; font-weight: 650; cursor: pointer; }
.prompt-app-scope-switch button[aria-selected="true"] { background: rgba(255,255,255,.78); color: #526979; box-shadow: 0 2px 7px rgba(64,83,105,.06); }
.prompt-app-heading, .prompt-editor-heading, .prompt-subheading, .prompt-preset-card, .prompt-current-card, .prompt-item-heading, .prompt-item-controls { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.prompt-app-heading { padding: 2px 2px 0; }
.prompt-app-heading h2, .prompt-editor-heading h3, .prompt-subheading h3, .prompt-subheading h4 { margin: 2px 0 0; }
.prompt-app-heading h2 { font-size: 20px; line-height: 1.12; font-weight: 750; letter-spacing: -.025em; }
.prompt-section-kicker, .prompt-preset-card .prompt-current-badge, .prompt-current-badge { font-size: 10px; line-height: 1.25; color: color-mix(in srgb, var(--text-secondary) 82%, #fff); font-weight: 600; letter-spacing: .045em; }
.prompt-current-card, .prompt-preset-section, .prompt-editor-card, .prompt-thinking-card, .prompt-worldbook-card, .prompt-items-card { border: 1px solid color-mix(in srgb, var(--border) 82%, #fff); border-radius: 16px; background: color-mix(in srgb, var(--card-bg, rgba(255,255,255,.7)) 85%, transparent); box-shadow: 0 10px 28px rgba(45, 65, 88, .055); }
.prompt-current-card { justify-content: flex-start; flex-wrap: wrap; padding: 12px 14px; }
.prompt-current-card strong { font-size: 15px; }
.prompt-current-badge { padding: 3px 8px; border-radius: 999px; background: color-mix(in srgb, var(--primary) 12%, transparent); color: var(--primary); }
.prompt-preset-section { padding: 12px; }
.prompt-preset-section > .prompt-subheading, .prompt-items-card > .prompt-subheading { margin-bottom: 9px; }
.prompt-preset-card { padding: 10px; border-radius: 10px; background: rgba(255,255,255,.42); margin-top: 8px; }
.prompt-preset-card.is-current { border-color: color-mix(in srgb, var(--primary) 45%, var(--border)); }
.prompt-preset-card-main { display: flex; align-items: center; gap: 8px; min-width: 0; }
.prompt-preset-card-actions, .prompt-app-actions, .prompt-editor-actions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.prompt-preset-card-actions .btn, .prompt-editor-actions .btn { padding: 5px 9px; font-size: 12px; }
.prompt-editor-card { display: flex; flex-direction: column; gap: 12px; padding: 14px; }
.prompt-editor-note, .prompt-item-hint, .prompt-empty { margin: 0; color: var(--text-secondary); font-size: 12px; line-height: 1.5; }
.prompt-field { display: flex; flex-direction: column; gap: 5px; font-size: 12px; }
.prompt-field input, .prompt-field select, .prompt-item-name, .prompt-item-content, .prompt-thinking-card textarea { width: 100%; box-sizing: border-box; border: 1px solid var(--border); border-radius: 9px; padding: 8px 10px; font: inherit; color: inherit; background: rgba(255,255,255,.7); }
.prompt-thinking-card, .prompt-worldbook-card, .prompt-items-card { padding: 12px; }
.prompt-thinking-card textarea { resize: vertical; margin-top: 8px; }
.prompt-items-list { display: flex; flex-direction: column; gap: 7px; }
.prompt-item-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; min-height: 48px; box-sizing: border-box; padding: 8px 10px; border: 1px solid color-mix(in srgb, var(--border) 78%, #fff); border-radius: 12px; background: rgba(255,255,255,.42); transition: border-color .18s ease, background .18s ease; }
.prompt-item-main { min-width: 120px; flex: 1 1 180px; display: flex; align-items: center; gap: 9px; padding: 4px 0; border: 0; background: transparent; color: inherit; text-align: left; cursor: pointer; }
.prompt-item-main:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 7px; }
.prompt-item-index { width: 22px; flex: 0 0 22px; color: var(--text-secondary); font-size: 11px; text-align: center; }
.prompt-item-heading { min-width: 0; flex: 1; align-items: flex-start; flex-direction: column; gap: 2px; }
.prompt-item-heading strong { overflow: hidden; max-width: 100%; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; font-weight: 650; }
.prompt-item-heading small { color: var(--text-secondary); font-size: 10px; line-height: 1.3; }
.prompt-item-chevron { color: color-mix(in srgb, var(--text-secondary) 78%, #fff); font-size: 21px; line-height: 1; }
.prompt-item-kind { font-size: 10px; color: var(--text-secondary); }
.prompt-item-toggle { position: relative; display: inline-flex; flex: 0 0 38px; align-items: center; width: 38px; height: 22px; color: var(--text-secondary); cursor: pointer; }
.prompt-item-toggle input { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.prompt-toggle-track { position: relative; display: block; width: 38px; height: 22px; border-radius: 999px; background: #dfe6ed; box-shadow: inset 0 0 0 1px rgba(75, 94, 113, .08); transition: background .18s ease, box-shadow .18s ease; }
.prompt-toggle-track::after { content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 2px 5px rgba(41, 57, 75, .18); transition: transform .18s ease; }
.prompt-item-toggle input:checked + .prompt-toggle-track { background: color-mix(in srgb, var(--primary) 58%, #9ab6b0); box-shadow: inset 0 0 0 1px rgba(63, 104, 119, .12); }
.prompt-item-toggle input:checked + .prompt-toggle-track::after { transform: translateX(16px); }
.prompt-item-toggle input:focus-visible + .prompt-toggle-track { outline: 2px solid color-mix(in srgb, var(--primary) 42%, transparent); outline-offset: 2px; }
.prompt-item-controls { flex: 0 0 auto; justify-content: flex-end; flex-wrap: wrap; }
.prompt-item-controls .btn { padding: 4px 8px; font-size: 11px; }
.prompt-detail-card { display: flex; flex-direction: column; gap: 12px; padding: 14px; border: 1px solid color-mix(in srgb, var(--border) 82%, #fff); border-radius: 16px; background: color-mix(in srgb, var(--card-bg, rgba(255,255,255,.7)) 85%, transparent); box-shadow: 0 10px 28px rgba(45, 65, 88, .055); }
.prompt-detail-back { align-self: flex-start; display: inline-flex; align-items: center; gap: 5px; min-height: 28px; padding: 2px 4px; border: 0; border-radius: 8px; background: transparent; color: color-mix(in srgb, var(--text-secondary) 84%, #fff); font-size: 12px; font-weight: 600; cursor: pointer; }
.prompt-detail-back:hover { background: rgba(255,255,255,.46); color: var(--text-primary); }
.prompt-detail-back:focus-visible { outline: 2px solid color-mix(in srgb, var(--primary) 42%, transparent); outline-offset: 1px; }
.prompt-detail-heading h3 { margin: 2px 0 0; font-size: 16px; font-weight: 700; }
.prompt-detail-field { display: flex; flex-direction: column; gap: 6px; color: var(--text-secondary); font-size: 12px; }
.prompt-detail-field input, .prompt-detail-field textarea { width: 100%; box-sizing: border-box; border: 1px solid var(--border); border-radius: 9px; padding: 8px 10px; font: inherit; color: inherit; background: rgba(255,255,255,.7); }
.prompt-detail-field textarea { resize: vertical; line-height: 1.5; }
.prompt-detail-actions { display: flex; justify-content: flex-end; gap: 8px; }
.prompt-detail-note, .prompt-detail-readonly { margin: 0; color: var(--text-secondary); font-size: 12px; line-height: 1.5; }
.prompt-detail-readonly { padding: 10px; border-radius: 9px; background: rgba(255,255,255,.45); }
.prompt-app-header-spacer { width: 36px; }
.prompt-current-entry { width: 100%; display: flex; align-items: center; gap: 10px; padding: 11px 13px; border: 1px solid color-mix(in srgb, var(--border) 82%, #fff); border-radius: 14px; background: color-mix(in srgb, var(--card-bg, rgba(255,255,255,.7)) 85%, transparent); color: inherit; text-align: left; cursor: pointer; box-shadow: 0 8px 22px rgba(45, 65, 88, .045); }
.prompt-current-entry strong { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 15px; font-weight: 650; letter-spacing: .005em; }
.prompt-current-entry:focus-visible, .prompt-preset-select:focus-visible, .prompt-preset-menu-button:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.prompt-preset-card { position: relative; display: flex; align-items: center; gap: 6px; }
.prompt-preset-select { min-width: 0; flex: 1; display: flex; align-items: center; gap: 8px; padding: 4px; border: 0; background: transparent; color: inherit; text-align: left; cursor: pointer; }
.prompt-preset-select strong { min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prompt-preset-menu-button { flex: 0 0 32px; width: 32px; height: 32px; border: 0; border-radius: 8px; background: transparent; color: var(--text-secondary); font-size: 20px; line-height: 1; cursor: pointer; }
.prompt-preset-menu-button:hover { background: var(--surface-hover); color: var(--primary); }
.prompt-preset-menu { position: absolute; z-index: 4; top: calc(100% - 2px); right: 8px; min-width: 120px; display: flex; flex-direction: column; gap: 2px; padding: 6px; border: 1px solid var(--border); border-radius: 10px; background: var(--card-bg, #fff); box-shadow: var(--shadow-md, 0 12px 26px rgba(0,0,0,.12)); }
.prompt-preset-menu button { border: 0; border-radius: 7px; padding: 7px 9px; background: transparent; color: inherit; text-align: left; cursor: pointer; }
.prompt-preset-menu button:hover { background: var(--surface-hover); }
.prompt-item-edit-controls { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 6px; }
.prompt-item-edit-controls .btn, .prompt-editor-actions .btn, .prompt-management-actions .btn { border-width: 1px; border-radius: 10px; padding: 6px 10px; font-size: 11px; }
.prompt-management-backdrop { position: fixed; inset: 0; z-index: 20; background: rgba(20, 29, 43, .22); }
/* Keep the primary Online / Offline navigation usable above the low-frequency management overlay. */
.prompt-app-mode-switch { position: relative; z-index: 22; }
.prompt-management-sheet { position: fixed; z-index: 21; left: 50%; top: 50%; width: min(92%, 520px); max-height: min(82%, 680px); overflow-y: auto; transform: translate(-50%, -50%); display: flex; flex-direction: column; gap: 12px; padding: 16px; border: 1px solid var(--border); border-radius: 18px; background: var(--bg-main, #fff); box-shadow: 0 22px 55px rgba(30, 43, 65, .22); }
.prompt-management-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.prompt-management-heading h3 { margin: 2px 0 0; }
.prompt-management-sheet .prompt-preset-section { padding: 10px; }
.prompt-management-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.prompt-detail-page { display: flex; flex-direction: column; gap: 12px; }
.prompt-detail-page .prompt-detail-card { margin-top: 0; }
@media (max-width: 680px) {
  .prompt-app-shell { padding: 12px; gap: 10px; }
  .prompt-app-heading, .prompt-editor-heading, .prompt-preset-card { align-items: flex-start; flex-direction: column; }
  .prompt-preset-card-actions, .prompt-editor-actions { justify-content: flex-start; }
  .prompt-app-actions { width: 100%; justify-content: flex-start; }
  .prompt-app-mode-switch { align-self: stretch; width: auto; }
  .prompt-item-row { align-items: center; }
  .prompt-item-controls { flex-direction: column; align-items: flex-end; }
  .prompt-item-controls .prompt-item-toggle { white-space: nowrap; }
  .prompt-item-main { min-width: 0; flex-basis: 150px; }
}

/* Phase 12E-3 final polish: one calm content surface with quiet mobile controls. */
#win-prompt .prompt-app-body {
  scrollbar-width: none;
  background: linear-gradient(180deg, rgba(247, 249, 252, .96), rgba(243, 246, 250, .98));
}
#win-prompt .prompt-app-body::-webkit-scrollbar { display: none; }
.prompt-app-shell { gap: 14px; padding: 14px 14px 24px; }
.prompt-app-mode-switch {
  align-self: stretch;
  width: min(100%, 248px);
  padding: 2px;
  border-color: rgba(141, 158, 177, .28);
  background: rgba(255, 255, 255, .42);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.68);
}
.prompt-app-mode-switch button {
  padding: 7px 12px;
  color: rgba(76, 94, 116, .68);
  font-size: 12px;
  font-weight: 650;
}
.prompt-app-mode-switch button[aria-selected="true"] {
  color: #526979;
  background: rgba(255, 255, 255, .86);
  box-shadow: 0 2px 7px rgba(64, 83, 105, .08);
}
.prompt-current-row {
  position: relative;
  display: block;
  min-width: 0;
  padding-bottom: 4px;
  border-bottom: 1px solid rgba(137, 153, 171, .28);
}
.prompt-current-entry {
  min-height: 48px;
  min-width: 0;
  width: 100%;
  padding: 10px 4px 10px 2px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  box-shadow: none;
}
.prompt-current-entry strong { font-size: 17px; font-weight: 700; color: #26384b; }
.prompt-current-menu-trigger { flex: 0 0 auto; color: rgba(91, 109, 128, .65); font-size: 20px; line-height: 1; }
.prompt-current-menu { position: absolute; z-index: 5; top: calc(100% - 1px); right: 0; min-width: 156px; display: flex; flex-direction: column; gap: 2px; padding: 6px; border: 1px solid rgba(141, 158, 177, .28); border-radius: 12px; background: rgba(255,255,255,.94); box-shadow: 0 12px 26px rgba(45,65,88,.12); }
.prompt-current-menu button { border: 0; border-radius: 8px; padding: 8px 10px; background: transparent; color: #44576c; font: inherit; font-size: 12px; text-align: left; cursor: pointer; }
.prompt-current-menu button:hover { background: rgba(229, 236, 242, .62); color: #2d4358; }
.prompt-current-menu button:focus-visible { outline: 2px solid color-mix(in srgb, var(--primary) 42%, transparent); outline-offset: 1px; }
.prompt-app-mode-switch { align-self: center; }
.prompt-editor-card {
  gap: 10px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}
.prompt-editor-toolbar { min-height: 30px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.prompt-editor-toolbar .prompt-editor-actions { margin-left: auto; }
.prompt-items-card { padding: 0; border: 0; border-radius: 0; background: transparent; box-shadow: none; }
.prompt-items-card > .prompt-subheading { margin: 0 2px 7px; }
.prompt-items-card > .prompt-subheading h4 { font-size: 12px; color: rgba(65, 82, 102, .72); font-weight: 650; letter-spacing: .02em; }
.prompt-items-list { gap: 6px; }
.prompt-item-row {
  min-height: 48px;
  padding: 8px 10px;
  border-color: rgba(141, 158, 177, .24);
  border-radius: 12px;
  background: rgba(255, 255, 255, .46);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.5);
}
.prompt-item-row.is-structural {
  border-color: rgba(141, 158, 177, .2);
  background: rgba(255, 255, 255, .24);
}
.prompt-item-structure-mark { display: inline-flex; flex: 0 0 22px; width: 22px; height: 22px; align-items: center; justify-content: center; color: rgba(92, 109, 128, .5); }
.prompt-item-structure-mark svg { width: 14px; height: 14px; fill: currentColor; }
.prompt-item-row--machine { border-color: rgba(141, 158, 177, .16); background: rgba(255, 255, 255, .14); box-shadow: none; }
.prompt-item-machine-mark { display: inline-flex; flex: 0 0 22px; width: 22px; align-items: center; justify-content: center; color: rgba(92, 109, 128, .42); font-size: 14px; }
.prompt-item-fixed-lock { display: inline-flex; flex: 0 0 22px; width: 22px; height: 22px; align-items: center; justify-content: center; color: rgba(92, 109, 128, .56); }
.prompt-item-fixed-lock svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.prompt-item-main { gap: 9px; padding: 3px 0; }
.prompt-item-index { color: rgba(84, 105, 127, .58); font-size: 10px; }
.prompt-item-heading { gap: 3px; }
.prompt-item-heading strong { color: #2d3e51; font-size: 13px; font-weight: 650; }
.prompt-item-token { color: rgba(91, 108, 127, .62); font-size: 10px; font-weight: 500; }
.prompt-item-main > .prompt-item-token { flex: 0 0 auto; align-self: center; margin-right: -4px; white-space: nowrap; }
.prompt-item-chevron { color: rgba(91, 109, 128, .62); font-size: 19px; }
.prompt-item-toggle { flex-basis: 34px; width: 34px; height: 20px; }
.prompt-toggle-track { width: 34px; height: 20px; background: rgba(174, 187, 199, .5); box-shadow: inset 0 0 0 1px rgba(75, 94, 113, .08); }
.prompt-toggle-track::after { top: 3px; left: 3px; width: 14px; height: 14px; box-shadow: 0 1px 4px rgba(41, 57, 75, .15); }
.prompt-item-toggle input:checked + .prompt-toggle-track { background: #86a9b2; box-shadow: inset 0 0 0 1px rgba(63, 104, 119, .1); }
.prompt-item-toggle input:checked + .prompt-toggle-track::after { transform: translateX(14px); }
.prompt-item-edit-controls { gap: 5px; }
.prompt-item-edit-controls .btn { padding: 5px 8px; }
.prompt-detail-card { border-color: rgba(141, 158, 177, .24); background: rgba(255,255,255,.56); box-shadow: 0 8px 22px rgba(45,65,88,.045); }
@media (max-width: 680px) {
  .prompt-app-shell { padding: 12px 12px 22px; gap: 11px; }
  .prompt-app-mode-switch { width: 100%; max-width: none; }
  .prompt-editor-toolbar { min-height: 28px; }
  .prompt-item-main { flex-basis: 130px; }
}


.app-window {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  max-width: 100%;
  max-height: 100%;
  min-width: 0;
  min-height: 0;
  background-color: var(--bg-main);
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.35s cubic-bezier(0.1, 0.9, 0.2, 1), opacity 0.25s linear;
  z-index: 101;
  overflow: hidden;
  box-sizing: border-box;
}

/* App 打开后，窗口底层使用 App 界面底色，不透出桌面壁纸。 */
#phone-container.app-open #app-window-container {
  background: var(--bg-main);
}
#phone-container.app-open::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  /* 只覆盖真实顶部安全区；P1 电脑模拟手机没有安全区时不能凭空遮住标题栏。 */
  height: var(--phone-safe-top, 0px);
  background: var(--app-top-color, var(--bg-main));
  z-index: 100000;
  pointer-events: none;
}
#phone-container.app-open #app-window-container .app-window.active {
  background-color: var(--bg-main);
}

@media (max-width: 480px) {
  #phone-container.app-open::before {
    height: var(--phone-safe-top, 0px);
  }
}
.app-window.active {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.standalone-tool-window {
  background: var(--bg-main);
}

.standalone-tool-mount {
  position: absolute;
  inset: 0;
  min-width: 0;
  min-height: 0;
}

.standalone-tool-locked-state {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--text-secondary);
  background: linear-gradient(180deg, rgba(255,255,255,.5), rgba(238,242,247,.86));
  text-align: center;
  pointer-events: none;
}

.standalone-tool-locked-state strong {
  color: var(--text-primary);
  font-size: 16px;
}

.standalone-tool-locked-state span {
  font-size: 12px;
}

.standalone-tool-locked-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(148,163,184,.32);
  border-radius: 15px;
  color: #94a3b8;
  background: rgba(255,255,255,.62);
  font-size: 24px;
}

.app-icon-locked {
  opacity: .58;
  filter: saturate(.55);
}

.app-icon-locked .icon-wrapper {
  box-shadow: inset 0 1px rgba(255,255,255,.78), 0 6px 12px rgba(100,116,139,.08);
}

/* 聊天美化制作统一放到外观 App 的工坊，聊天详情只保留直接导入入口。 */
#chat-details-panel [onclick="chatBeautifySystem.openPanel()"],
#group-details-panel [onclick="chatBeautifySystem.openPanel()"] {
  display: none !important;
}

.chat-details-header-save { min-width:44px; min-height:36px; padding:0 8px; border:0; background:transparent; color:var(--text-primary); font-size:13px; font-weight:700; cursor:pointer; }
#group-details-panel .chat-details-header-save {
  min-width: 44px;
  min-height: 36px;
  padding: 0 8px;
  border: 0 !important;
  border-radius: 10px;
  background: transparent !important;
  color: var(--text-primary) !important;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
#group-details-panel .group-details-body {
  padding: 14px 12px 28px !important;
  background: linear-gradient(180deg, rgba(244,247,250,.92), rgba(237,241,246,.88));
  scrollbar-width: none;
}
#group-details-panel .group-details-body::-webkit-scrollbar { display: none; }
#group-details-panel .group-details-body > .form-group {
  box-sizing: border-box;
  margin: 0 0 10px !important;
  padding: 15px !important;
  border: 1px solid rgba(255,255,255,.72) !important;
  border-radius: 18px !important;
  background: linear-gradient(145deg,rgba(255,255,255,.52),rgba(255,255,255,.22)) !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.8), 0 9px 26px rgba(45,55,68,.055) !important;
  backdrop-filter: blur(18px) saturate(112%);
  -webkit-backdrop-filter: blur(18px) saturate(112%);
}
#group-details-panel .group-details-body > .form-group > label:first-child,
#group-details-panel .group-details-body > .form-group > .chat-details-control-label {
  margin: 0 0 8px !important;
  color: var(--text-primary) !important;
  font-size: 12px !important;
  font-weight: 650 !important;
  line-height: 1.45;
}
#group-details-panel .group-details-body input[type="text"],
#group-details-panel .group-details-body input[type="number"],
#group-details-panel .group-details-body textarea,
#group-details-panel .group-details-body select {
  min-height: 40px;
  box-sizing: border-box;
  border: 1px solid rgba(105,116,128,.14) !important;
  border-radius: 13px !important;
  background: rgba(255,255,255,.34) !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.7) !important;
  color: var(--text-primary);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
#group-details-panel .group-details-body .btn.btn-outline {
  min-height: 38px;
  border: 1px solid rgba(255,255,255,.78) !important;
  border-radius: 13px !important;
  background: rgba(255,255,255,.28) !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.68) !important;
  color: var(--text-primary) !important;
  font-weight: 650;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
#group-details-panel .group-details-worldbook-section {
  padding: 14px !important;
}
#group-details-panel #group-details-wb-mounted-accordion {
  max-height: 280px;
  overflow-y: auto;
  scrollbar-width: none;
}
#group-details-panel #group-details-wb-mounted-accordion::-webkit-scrollbar { display: none; }
#group-details-panel .group-worldbook-summary {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 9px;
  color: var(--text-primary);
}
#group-details-panel .group-worldbook-summary strong {
  font-size: 13px;
  font-weight: 700;
}
#group-details-panel .group-worldbook-summary span {
  color: var(--text-secondary);
  font-size: 10px;
}
#group-details-panel .group-worldbook-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
}
#group-details-panel .group-worldbook-book {
  min-height: 48px;
  border: 1px solid rgba(105,116,128,.13);
  border-radius: 13px;
  background: rgba(255,255,255,.3);
  color: var(--text-primary);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.58);
}
#group-details-panel .group-worldbook-book-main {
  display: flex;
  min-height: 48px;
  align-items: center;
  gap: 9px;
  padding: 7px 10px;
}
#group-details-panel .group-worldbook-book-label {
  display: flex;
  min-width: 0;
  flex: 1;
  align-items: center;
  gap: 9px;
  cursor: pointer;
}
#group-details-panel .group-worldbook-book input,
#group-details-panel .group-worldbook-entry input {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  accent-color: #596579;
}
#group-details-panel .group-worldbook-book:has(.group-worldbook-book-checkbox:checked),
#group-details-panel .group-worldbook-book:has(.group-worldbook-book-checkbox:indeterminate),
#group-details-panel .group-worldbook-book:has(.group-worldbook-entry input:checked) {
  border-color: rgba(88,101,122,.34);
  background: rgba(236,240,246,.78);
}
#group-details-panel .group-worldbook-book-copy {
  min-width: 0;
  flex: 1;
}
#group-details-panel .group-worldbook-book-copy strong,
#group-details-panel .group-worldbook-book-copy small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#group-details-panel .group-worldbook-book-copy strong {
  font-size: 12px;
  font-weight: 700;
}
#group-details-panel .group-worldbook-book-copy small {
  margin-top: 2px;
  color: var(--text-secondary);
  font-size: 10px;
}
#group-details-panel .group-worldbook-book-state {
  flex: 0 0 auto;
  color: var(--text-secondary);
  font-size: 10px;
}
#group-details-panel .group-worldbook-book-toggle {
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  border: 0;
  border-radius: 9px;
  background: rgba(255,255,255,.48);
  color: var(--text-secondary);
  cursor: pointer;
}
#group-details-panel .group-worldbook-entry-list {
  display: grid;
  gap: 5px;
  margin: 0 10px 9px 35px;
  padding: 8px 9px;
  border-left: 1px solid rgba(105,116,128,.16);
  background: rgba(255,255,255,.18);
  border-radius: 0 10px 10px 0;
}
#group-details-panel .group-worldbook-entry-list[hidden] { display: none; }
#group-details-panel .group-worldbook-entry {
  display: flex;
  min-height: 30px;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
  font-size: 11px;
  cursor: pointer;
}
#group-details-panel .group-worldbook-entry span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#group-details-panel .group-details-wallpaper-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 6px;
}
#group-details-panel .group-details-wallpaper-row input {
  min-width: 0;
}
#group-details-panel .group-details-control-hint {
  display: block;
  margin-top: 7px;
  color: var(--text-secondary);
  font-size: 10px;
  line-height: 1.45;
}
#group-details-panel .group-details-tts-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}
#group-details-panel .group-details-tts-role {
  padding: 10px;
  border: 1px solid rgba(105,116,128,.13);
  border-radius: 13px;
  background: rgba(255,255,255,.28);
}
#group-details-panel .group-details-tts-role-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
#group-details-panel .group-details-tts-role-head strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-primary);
  font-size: 12px;
}
#group-details-panel .group-details-tts-switch {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 5px;
  color: var(--text-secondary);
  font-size: 10px;
  cursor: pointer;
}
#group-details-panel .group-details-tts-role select,
#group-details-panel .group-details-tts-role input[type="text"] {
  width: 100%;
  min-height: 34px;
  margin-top: 6px;
  padding: 6px 9px;
  font-size: 11px;
}
#group-details-panel .group-details-control-empty {
  padding: 9px 2px 2px;
  color: var(--text-secondary);
  font-size: 11px;
  text-align: center;
}
#group-details-panel .group-worldbook-empty {
  padding: 12px 2px;
  color: var(--text-secondary);
  font-size: 11px;
  text-align: center;
}
#group-details-panel .form-actions {
  margin-top: 12px !important;
  padding: 4px 3px 0;
}

#group-details-panel .group-details-context-section {
  padding: 10px !important;
}
#group-details-panel .group-context-row-list {
  display: grid;
  gap: 1px;
  overflow: hidden;
  border: 1px solid rgba(105,116,128,.13);
  border-radius: 14px;
  background: rgba(105,116,128,.1);
}
#group-details-panel .group-context-field + .group-context-field {
  border-top: 1px solid rgba(105,116,128,.1);
}
#group-details-panel .group-context-inline-editor[hidden],
#group-details-panel .group-details-subpage[hidden] {
  display: none !important;
}
#group-details-panel .group-context-inline-editor {
  display: grid;
  gap: 10px;
  padding: 12px 11px 13px;
  border-top: 1px solid rgba(105,116,128,.1);
  background: rgba(248,250,252,.44);
}
#group-details-panel .group-context-inline-editor textarea {
  width: 100%;
  min-height: 132px;
  box-sizing: border-box;
  resize: none !important;
  overflow-y: auto;
  padding: 10px 11px;
  border: 1px solid rgba(105,116,128,.16) !important;
  border-radius: 13px;
  background: rgba(255,255,255,.52) !important;
  color: var(--text-primary);
  font: inherit;
  font-size: 12px;
  line-height: 1.55;
  outline: none;
}
#group-details-panel .group-context-inline-editor textarea:focus {
  border-color: rgba(88,101,122,.38) !important;
  box-shadow: 0 0 0 3px rgba(88,101,122,.08) !important;
}
#group-details-panel .group-context-inline-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
#group-details-panel .group-context-inline-actions-spacer { flex: 1; }
#group-details-panel .group-context-inline-actions .btn {
  min-height: 36px;
  padding: 0 12px;
  font-size: 11px;
}
#group-details-panel .group-context-row {
  display: flex;
  width: 100%;
  min-height: 66px;
  align-items: center;
  gap: 12px;
  padding: 10px 11px;
  border: 0;
  background: rgba(255,255,255,.38);
  color: var(--text-primary);
  text-align: left;
  cursor: pointer;
}
#group-details-panel .group-context-row:active {
  background: rgba(226,232,240,.54);
}
#group-details-panel .group-context-row-copy {
  display: grid;
  min-width: 0;
  flex: 1;
  gap: 2px;
}
#group-details-panel .group-context-row-copy strong {
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
}
#group-details-panel .group-context-row-copy small {
  overflow: hidden;
  color: var(--text-secondary);
  font-size: 10px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#group-details-panel .group-context-row-copy em {
  overflow: hidden;
  color: var(--text-secondary);
  font-size: 10px;
  font-style: normal;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.group-context-row-chevron {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  color: var(--text-secondary);
}
#group-details-panel .group-context-row-chevron {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  color: var(--text-secondary);
}
#group-details-panel .group-details-speaker-section {
  padding: 0 10px 10px !important;
}
#group-details-panel .group-details-speaker-section .group-context-row {
  border: 1px solid rgba(105,116,128,.13);
  border-radius: 14px;
}
.group-speaker-schedule-body {
  overflow-y: auto;
  padding: 14px 16px max(16px, env(safe-area-inset-bottom));
  scrollbar-width: none;
}
.group-speaker-schedule-body::-webkit-scrollbar { display: none; }
.group-speaker-toggle-row {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 42px;
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 750;
  cursor: pointer;
}
.group-speaker-toggle-row input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
  z-index: 1;
}
.group-speaker-toggle {
  position: relative;
  flex: 0 0 auto;
  width: 42px;
  height: 26px;
  border-radius: 999px;
  background: rgba(148,163,184,.35);
  box-shadow: inset 0 0 0 1px rgba(100,116,139,.16);
  transition: background .18s ease, box-shadow .18s ease;
  pointer-events: none;
}
.group-speaker-toggle::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(255,255,255,.96);
  box-shadow: 0 1px 3px rgba(15,23,42,.18);
  transition: transform .18s ease;
}
.group-speaker-toggle-row input:checked + .group-speaker-toggle {
  background: rgba(86,126,151,.72);
  box-shadow: inset 0 0 0 1px rgba(69,101,123,.2);
}
.group-speaker-toggle-row input:checked + .group-speaker-toggle::after {
  transform: translateX(16px);
}
.group-speaker-schedule-help {
  margin: 0;
  color: var(--text-secondary);
  font-size: 11px;
  line-height: 1.5;
}
.group-speaker-counts {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-top: 14px;
}
.group-speaker-counts label,
.group-speaker-probability,
.group-speaker-required {
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 650;
}
.group-speaker-counts input,
.group-speaker-probability input {
  width: 100%;
  box-sizing: border-box;
  margin-top: 6px;
  padding: 8px 9px;
  border: 1px solid rgba(105,116,128,.18);
  border-radius: 10px;
  background: rgba(255,255,255,.62);
  color: var(--text-primary);
  font: inherit;
}
.group-speaker-member-heading {
  margin: 14px 0 6px;
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 750;
}
.group-speaker-member-list {
  display: grid;
  gap: 8px;
  min-width: 0;
  overflow-x: hidden;
}
.group-speaker-member {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(148px, 150px);
  gap: 8px 12px;
  align-items: center;
  min-width: 0;
  box-sizing: border-box;
  padding: 10px 11px;
  border: 1px solid rgba(105,116,128,.13);
  border-radius: 13px;
  background: rgba(255,255,255,.42);
}
.group-speaker-member-name {
  min-width: 0;
  overflow: hidden;
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.group-speaker-probability {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  min-width: 0;
  gap: 4px;
  white-space: nowrap;
}
.group-speaker-probability input {
  margin-top: 0;
  padding: 6px 7px;
  font-size: 12px;
  flex: 0 1 58px;
  width: 58px;
  min-width: 48px;
}
.group-speaker-probability span {
  flex: 0 0 auto;
  font-size: 11px;
}
.group-speaker-required {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 6px;
}
.group-speaker-required input { accent-color: var(--primary); }
.group-speaker-member-settings {
  min-width: 0;
}
.group-speaker-schedule-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 16px;
}
#group-details-panel > .group-details-subpage {
  flex: 1;
  min-height: 0;
  flex-direction: column;
  background: linear-gradient(180deg, rgba(244,247,250,.92), rgba(237,241,246,.88));
}
#group-details-panel > .group-details-subpage:not([hidden]) { display: flex; }
#group-details-panel.group-details-subpage-active > .win-header,
#group-details-panel.group-details-subpage-active > .group-details-body { display: none; }
#group-details-panel .group-details-subpage-header {
  flex: 0 0 auto;
  min-height: 54px;
  padding: 8px 12px;
  border-bottom: 1px solid rgba(109,120,132,.1);
  background: rgba(255,255,255,.38);
}
#group-details-panel .group-details-subpage-header h3 {
  margin: 0;
  color: var(--text-primary);
  font-size: 15px;
  font-weight: 750;
}
#group-details-panel .group-details-subpage-spacer { width: 36px; flex: 0 0 36px; }
#group-details-panel .group-details-subpage-body {
  flex: 1;
  min-height: 0;
  max-height: none;
  overflow-y: auto;
}

/* 群功能面板：与单人聊天详情共用同一套轻玻璃材质，不再使用旧的纯白后台弹窗。 */
.group-feature-overlay {
  align-items: flex-end;
  padding: 0 12px max(12px, env(safe-area-inset-bottom));
  box-sizing: border-box;
  background: rgba(26, 35, 48, .24);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.group-feature-modal {
  width: min(100%, 360px);
  max-height: min(82%, 560px);
  box-sizing: border-box;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.78);
  border-radius: 24px;
  background: linear-gradient(145deg, rgba(255,255,255,.86), rgba(243,246,250,.76));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.94), 0 -14px 34px rgba(28,38,50,.14);
  backdrop-filter: blur(22px) saturate(124%);
  -webkit-backdrop-filter: blur(22px) saturate(124%);
}
.group-feature-modal .modal-header {
  min-height: 58px;
  box-sizing: border-box;
  padding: 12px 16px 8px;
  border-bottom: 1px solid rgba(109,120,132,.1);
  background: transparent;
}
.group-feature-modal .modal-header h4 {
  margin: 0;
  color: var(--text-primary);
  font-size: 16px;
  font-weight: 750;
  letter-spacing: .01em;
}
.group-feature-modal .modal-header .btn-icon {
  width: 34px;
  height: 34px;
  color: var(--text-secondary);
  background: rgba(255,255,255,.36);
  border: 1px solid rgba(255,255,255,.54);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.7);
}
.group-feature-body {
  max-height: min(66vh, 460px);
  box-sizing: border-box;
  padding: 14px 16px max(18px, env(safe-area-inset-bottom));
  overflow-y: auto;
  scrollbar-width: none;
}
.group-feature-body::-webkit-scrollbar { display: none; }
.group-feature-body > .form-group { margin: 0 0 12px; }
.group-feature-body > .form-group:last-of-type { margin-bottom: 0; }
.group-feature-body .form-group > label,
.group-feature-body > .form-group > label {
  display: block;
  margin: 0 0 7px;
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.4;
}
.group-feature-body input[type="text"],
.group-feature-body textarea {
  width: 100%;
  box-sizing: border-box;
  min-height: 40px;
  padding: 10px 11px;
  border: 1px solid rgba(105,116,128,.15);
  border-radius: 13px;
  outline: none;
  background: rgba(255,255,255,.42);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.74);
  color: var(--text-primary);
  font: inherit;
  font-size: 12px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.group-feature-body textarea { min-height: 88px; line-height: 1.55; resize: vertical; }
.group-feature-body input:focus,
.group-feature-body textarea:focus {
  border-color: rgba(82,94,108,.42);
  box-shadow: 0 0 0 3px rgba(82,94,108,.08), inset 0 1px 0 rgba(255,255,255,.78);
}
.group-feature-actions,
.group-feature-body > .form-actions {
  display: flex;
  gap: 9px;
  margin-top: 14px !important;
}
.group-feature-submit {
  width: 100%;
  min-height: 42px;
  border: 1px solid rgba(70,80,90,.16) !important;
  border-radius: 13px !important;
  background: rgba(70,80,90,.82) !important;
  color: #fff !important;
  box-shadow: 0 6px 14px rgba(28,38,50,.12), inset 0 1px 0 rgba(255,255,255,.2);
  font-size: 12px;
  font-weight: 750;
}
.group-feature-submit:active { transform: translateY(1px); }

/* 群成员：把旧的卡片式后台列表收束为单聊设置页的玻璃列表。 */
#group-members-panel .group-members-body {
  display: flex;
  min-height: 0;
  box-sizing: border-box;
  padding: 14px 12px max(18px, env(safe-area-inset-bottom));
  flex-direction: column;
  background: linear-gradient(180deg, rgba(244,247,250,.92), rgba(237,241,246,.88));
  scrollbar-width: none;
}
#group-members-panel .group-members-body::-webkit-scrollbar { display: none; }
.group-members-scroll { min-height: 0; flex: 1; overflow-y: auto; scrollbar-width: none; }
.group-members-scroll::-webkit-scrollbar { display: none; }
.group-members-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0 0 11px;
  padding: 11px 13px;
  border: 1px solid rgba(255,255,255,.72);
  border-radius: 15px;
  background: rgba(255,255,255,.38);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.7);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 650;
}
.group-members-summary strong { margin-left: 3px; color: var(--text-primary); font-size: 13px; font-weight: 750; }
.group-members-list { display: grid; gap: 8px; }
.group-member-card {
  display: flex;
  gap: 9px;
  padding: 11px;
  border: 1px solid rgba(255,255,255,.72);
  border-radius: 16px;
  background: linear-gradient(145deg, rgba(255,255,255,.58), rgba(255,255,255,.28));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.76), 0 7px 18px rgba(45,55,68,.045);
  flex-direction: column;
}
.group-member-card-main { display: flex; min-width: 0; align-items: center; gap: 10px; }
.group-member-avatar {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border: 1px solid rgba(255,255,255,.78);
  border-radius: 14px;
  object-fit: cover;
  box-shadow: 0 4px 10px rgba(35,43,52,.08);
}
.group-member-copy { min-width: 0; flex: 1; }
.group-member-type,
.group-member-name,
.group-member-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.group-member-type { color: var(--text-secondary); font-size: 10px; font-weight: 550; }
.group-member-name { margin-top: 3px; color: var(--text-primary); font-size: 13px; font-weight: 750; }
.group-member-title { margin-top: 3px; color: var(--primary); font-size: 10px; font-weight: 700; }
.group-member-badge {
  display: inline-block;
  margin-right: 4px;
  padding: 2px 5px;
  border: 1px solid transparent;
  border-radius: 6px;
  font-size: 9px;
  font-weight: 750;
  vertical-align: 1px;
}
.group-member-badge--owner { border-color: rgba(214,91,91,.18); background: rgba(254,226,226,.78); color: #b4232e; }
.group-member-badge--admin { border-color: rgba(79,117,187,.18); background: rgba(219,234,254,.78); color: #315c99; }
.group-member-badge--muted { border-color: rgba(100,110,120,.15); background: rgba(100,110,120,.12); color: #596579; }
.group-member-actions { display: flex; gap: 6px; flex-wrap: wrap; padding-top: 9px; border-top: 1px dashed rgba(105,116,128,.18); }
.group-member-action { min-height: 30px !important; padding: 0 9px !important; border-radius: 10px !important; font-size: 10px !important; font-weight: 700 !important; }
.group-member-action--danger { border-color: rgba(214,91,91,.28) !important; color: #b4232e !important; }
.group-members-footer { flex: 0 0 auto; margin-top: 12px; padding-top: 12px; border-top: 1px solid rgba(103,112,120,.12); }
.group-members-invite { display: flex; width: 100%; min-height: 42px; align-items: center; justify-content: center; gap: 6px; }

/* 群内卡片和置顶公告也使用同一套轻玻璃语汇。 */
.group-announcement-sticky-bar {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin: 8px 10px 2px;
  padding: 10px 11px;
  border: 1px solid rgba(255,255,255,.72);
  border-radius: 15px;
  background: rgba(255,255,255,.48);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.78), 0 5px 16px rgba(45,55,68,.05);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.group-announcement-content-area { min-width: 0; flex: 1; cursor: pointer; }
.group-announcement-heading { display: flex; align-items: center; gap: 6px; }
.group-announcement-heading svg { width: 14px; height: 14px; flex: 0 0 auto; color: #c75b62; }
.group-announcement-title { overflow: hidden; color: #a8434b; font-size: 11px; font-weight: 750; text-overflow: ellipsis; white-space: nowrap; }
.group-announcement-text { display: block; margin-top: 5px; color: var(--text-secondary); font-size: 11px; line-height: 1.45; word-break: break-word; }
.group-announcement-actions { display: flex; align-items: center; flex: 0 0 auto; gap: 4px; }
.group-announcement-read,
.group-announcement-archive { min-height: 28px; padding: 0 7px; border: 1px solid rgba(105,116,128,.14); border-radius: 9px; background: rgba(255,255,255,.34); color: var(--text-secondary); font-size: 10px; font-weight: 700; cursor: pointer; }
.group-announcement-archive { width: 28px; padding: 0; }
.group-announcement-read.is-done { border-color: transparent; background: transparent; color: #9aa4b2; }

.group-poll-card-wrap { display: flex; width: 100%; box-sizing: border-box; justify-content: center; margin: 12px 0; padding: 0 16px; }
.group-poll-card {
  width: min(100%, 320px);
  padding: 13px;
  border: 1px solid rgba(255,255,255,.78);
  border-radius: 18px;
  background: linear-gradient(145deg, rgba(255,255,255,.72), rgba(244,247,250,.48));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.84), 0 8px 20px rgba(45,55,68,.07);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.group-poll-card-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-bottom: 9px; border-bottom: 1px dashed rgba(105,116,128,.18); color: var(--text-primary); font-size: 12px; font-weight: 750; }
.group-poll-card-title > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.group-poll-archive { width: 28px; height: 28px; flex: 0 0 auto; padding: 0; border: 0; border-radius: 9px; background: rgba(255,255,255,.4); color: #a8434b; cursor: pointer; }
.group-poll-option-row { padding: 9px 0 0; cursor: pointer; }
.group-poll-option-header { display: flex; justify-content: space-between; gap: 8px; color: var(--text-secondary); font-size: 10px; line-height: 1.4; }
.group-poll-option-header > span:first-child { min-width: 0; overflow: hidden; color: var(--text-primary); text-overflow: ellipsis; white-space: nowrap; }
.group-poll-voted { color: #3d8b69; font-weight: 750; }
.group-poll-progressbar { height: 6px; margin-top: 5px; overflow: hidden; border-radius: 99px; background: rgba(130,142,154,.14); }
.group-poll-progressbar-fill { width: var(--poll-progress, 0%); height: 100%; border-radius: inherit; background: var(--poll-fill, #7a8797); transition: width .25s ease; }
.group-poll-error { margin: 4px 0; color: var(--text-secondary); font-size: 11px; text-align: center; }

.group-invite-members-list { display: grid; max-height: 300px; gap: 8px; overflow-y: auto; padding: 2px 0 12px; scrollbar-width: none; }
.group-invite-members-list::-webkit-scrollbar { display: none; }
.group-invite-empty { padding: 18px 0; color: var(--text-secondary); font-size: 11px; line-height: 1.5; text-align: center; }
.group-invite-candidate { display: flex; min-height: 52px; align-items: center; gap: 9px; padding: 8px 10px; border: 1px solid rgba(255,255,255,.72); border-radius: 14px; background: rgba(255,255,255,.34); color: var(--text-primary); cursor: pointer; }
.group-invite-candidate:has(input:checked) { border-color: rgba(82,94,108,.34); background: rgba(235,239,245,.76); }
.group-invite-candidate input { width: 16px; height: 16px; flex: 0 0 auto; accent-color: #596579; }
.group-invite-candidate img { width: 36px; height: 36px; flex: 0 0 36px; border: 1px solid rgba(255,255,255,.78); border-radius: 12px; object-fit: cover; }
.group-invite-candidate-copy { min-width: 0; flex: 1; }
.group-invite-candidate-name { overflow: hidden; font-size: 12px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.group-invite-candidate-note { margin-top: 3px; overflow: hidden; color: var(--text-secondary); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }

@media (max-width: 360px) {
  .group-feature-overlay { padding-right: 8px; padding-left: 8px; }
  .group-feature-modal { border-radius: 21px; }
  .group-feature-body { padding-right: 13px; padding-left: 13px; }
  #group-members-panel .group-members-body { padding-right: 9px; padding-left: 9px; }
  .group-announcement-sticky-bar { margin-right: 7px; margin-left: 7px; }
  .group-poll-card-wrap { padding-right: 9px; padding-left: 9px; }
}

.chat-details-appearance { margin:18px 0; padding:15px; border:1px solid rgba(255,255,255,.66); border-radius:16px; background:rgba(255,255,255,.38); box-shadow:inset 0 1px 0 rgba(255,255,255,.52); backdrop-filter:blur(12px); -webkit-backdrop-filter:blur(12px); }
.chat-details-section-heading { display:flex; align-items:baseline; justify-content:space-between; margin-bottom:13px; }
.chat-details-section-heading strong { font-size:13px; }
.chat-details-section-heading span { color:var(--text-secondary); font-size:10px; }
.chat-details-control-label { display:block; margin-bottom:6px; font-size:11px; font-weight:650; }
.chat-details-wallpaper-row { display:grid; grid-template-columns:minmax(0,1fr) auto auto; gap:6px; }
.chat-details-wallpaper-row .btn { padding:8px 9px; font-size:11px; }
.chat-details-bubble-palette-toggle { display:flex; width:100%; min-height:45px; align-items:center; justify-content:space-between; margin:12px 0 0; padding:0 2px; border:0; border-top:1px solid rgba(96,106,117,.1); background:transparent; color:var(--text-primary); font-size:12px; font-weight:700; cursor:pointer; }
.chat-details-bubble-palette-summary { display:flex; align-items:center; color:var(--text-secondary); font-size:10px; font-weight:600; }
.chat-details-bubble-palette-summary i { width:18px; height:13px; border:1px solid rgba(255,255,255,.68); border-radius:7px; background:var(--summary-char,#fff); box-shadow:0 2px 6px rgba(40,48,58,.08); }
.chat-details-bubble-palette-summary i + i { margin-left:-5px; background:var(--summary-user,#c8cbd0); }
.chat-details-bubble-palette-summary b { margin-left:7px; font-weight:600; }
.chat-details-bubble-palette-summary em { margin-left:7px; font-size:13px; font-style:normal; transition:transform .2s ease; }
.chat-details-bubble-palette-toggle[aria-expanded="true"] .chat-details-bubble-palette-summary em { transform:rotate(180deg); }
.chat-details-bubble-palette-panel { display:grid; grid-template-rows:0fr; opacity:.25; transition:grid-template-rows .22s ease,opacity .18s ease; }
.chat-details-bubble-palette-panel[aria-hidden="false"] { grid-template-rows:1fr; opacity:1; }
.chat-details-bubble-palette-inner { min-height:0; overflow:hidden; }
.chat-details-palette-group { margin-top:10px; }
.chat-details-palette-group-title { display:block; margin:0 2px 6px; color:var(--text-secondary); font-size:9px; font-weight:650; letter-spacing:.08em; }
.chat-details-bubble-palettes { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:7px; }
.chat-details-bubble-palettes button { min-width:0; min-height:48px; padding:6px 5px 5px; border:1px solid rgba(255,255,255,.62); border-radius:12px; background:rgba(255,255,255,.24); box-shadow:inset 0 1px 0 rgba(255,255,255,.68); color:var(--text-secondary); font:600 9px/1.2 inherit; cursor:pointer; backdrop-filter:blur(10px) saturate(112%); -webkit-backdrop-filter:blur(10px) saturate(112%); transition:background-color .16s ease,box-shadow .16s ease,transform .16s ease; }
.chat-details-bubble-palettes button > span { display:flex; justify-content:center; align-items:center; height:20px; margin-bottom:3px; }
.chat-details-bubble-palettes button i { display:block; width:25px; height:16px; border:1px solid rgba(255,255,255,.58); border-radius:8px; background:var(--swatch); box-shadow:0 2px 7px rgba(40,48,58,.08),inset 0 1px 0 rgba(255,255,255,.45); }
.chat-details-bubble-palettes button i + i { margin-left:-6px; }
.chat-details-bubble-palettes button[aria-pressed="true"] { background:rgba(255,255,255,.5); box-shadow:inset 0 1px 0 rgba(255,255,255,.9),0 4px 13px rgba(45,55,68,.09); color:var(--text-primary); transform:translateY(-1px); }
.chat-details-bubble-palettes button:focus-visible { outline:2px solid rgba(82,94,108,.46); outline-offset:2px; }
.chat-details-custom-color-title { margin-top:13px; }
.chat-details-color-grid { display:grid; margin:0 0 12px; grid-template-columns:1fr 1fr; gap:9px; }
@media (prefers-reduced-motion:reduce) { .chat-details-bubble-palette-panel,.chat-details-bubble-palette-summary em { transition:none; } }
.chat-details-color-grid label { display:flex; align-items:center; justify-content:space-between; padding:8px 10px; border:1px solid rgba(106,112,117,.14); border-radius:11px; color:var(--text-secondary); font-size:11px; }
.chat-details-color-grid input[type="color"] { width:30px; height:24px; padding:1px; border:0; border-radius:8px; background:transparent; }
.chat-details-style-preview { min-height:142px; padding:18px 13px; overflow:hidden; border:1px solid rgba(255,255,255,.56); border-radius:14px; background-color:rgba(232,234,234,.72); background-position:center; background-size:cover; box-shadow:inset 0 0 0 999px rgba(255,255,255,.08); }
.chat-details-preview-bubble { display:flex; margin-bottom:11px; align-items:flex-end; gap:7px; }
.chat-details-preview-bubble.self { flex-direction:row-reverse; }
.chat-details-preview-bubble span { color:rgba(51,54,56,.5); font-size:9px; }
.chat-details-preview-bubble p { max-width:72%; margin:0; padding:8px 11px; border-radius:14px; color:#2b2b2b; font-size:11px; line-height:1.45; backdrop-filter:blur(20px) saturate(180%); -webkit-backdrop-filter:blur(20px) saturate(180%); }
.chat-details-preview-bubble.other p { background:rgba(255,255,255,.35); border:1px solid rgba(255,255,255,.2); box-shadow:0 2px 12px rgba(0,0,0,.08),inset 0 1px 0 rgba(255,255,255,.2),inset 0 -1px 0 rgba(0,0,0,.04); text-shadow:0 .5px 1px rgba(0,0,0,.15); }
.chat-details-preview-bubble.self p { background:rgba(255,255,255,.7); border:1px solid rgba(255,255,255,.25); box-shadow:0 2px 12px rgba(255,255,255,.2),inset 0 1px 0 rgba(255,255,255,.22),inset 0 -1px 0 rgba(0,0,0,.06); text-shadow:none; }
.chat-details-worldbook-glass { padding:14px; border:1px solid rgba(255,255,255,.66); border-radius:16px; background:rgba(255,255,255,.34); box-shadow:inset 0 1px 0 rgba(255,255,255,.5); backdrop-filter:blur(12px); -webkit-backdrop-filter:blur(12px); }
.chat-details-worldbook-heading { display:flex; align-items:center; gap:8px; }
#details-wb-toggle { display:flex; min-width:0; flex:1; align-items:center; justify-content:space-between; padding:7px 0; border:0; background:transparent; color:var(--text-primary); font-size:12px; font-weight:700; cursor:pointer; }
.chat-details-worldbook-link { flex-shrink:0; padding:6px 9px; border:1px solid rgba(255,255,255,.72); border-radius:12px; background:rgba(255,255,255,.34); color:var(--text-primary); font-size:10px; font-weight:650; backdrop-filter:blur(9px); -webkit-backdrop-filter:blur(9px); }
.chat-details-worldbook-panel { max-height:280px; margin-top:8px; padding:4px; overflow-y:auto; border-top:1px solid rgba(92,99,104,.1); background:transparent; scrollbar-width:none; }
.chat-details-worldbook-panel::-webkit-scrollbar { display:none; }
.chat-details-clean-toggle { display:flex; align-items:center; justify-content:space-between; padding:12px 3px; border:0; }
.chat-details-clean-toggle > label:first-child { margin:0; color:var(--text-primary); font-size:12px; font-weight:650; }

/* 对话专属设置：统一页面层级与玻璃材质 */
#chat-details-panel .win-body {
  padding: 14px 12px 28px;
  background: linear-gradient(180deg, rgba(244,247,250,.92), rgba(237,241,246,.88));
  scrollbar-width: none;
}
#chat-details-panel .win-body::-webkit-scrollbar { display: none; }
#chat-details-panel .win-body > .form-group,
#chat-details-panel .chat-details-appearance {
  box-sizing: border-box;
  margin: 0 0 10px !important;
  padding: 15px !important;
  border: 1px solid rgba(255,255,255,.72) !important;
  border-radius: 18px !important;
  background: linear-gradient(145deg,rgba(255,255,255,.52),rgba(255,255,255,.22)) !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.8), 0 9px 26px rgba(45,55,68,.055) !important;
  backdrop-filter: blur(18px) saturate(112%);
  -webkit-backdrop-filter: blur(18px) saturate(112%);
}
#chat-details-panel .win-body > .form-group > label:first-child,
#chat-details-panel .chat-details-control-label {
  margin: 0 0 8px !important;
  color: var(--text-primary) !important;
  font-size: 12px !important;
  font-weight: 650 !important;
  line-height: 1.45;
}
#chat-details-panel input[type="text"],
#chat-details-panel input[type="number"],
#chat-details-panel textarea,
#chat-details-panel select {
  min-height: 40px;
  box-sizing: border-box;
  border: 1px solid rgba(105,116,128,.14) !important;
  border-radius: 13px !important;
  background: rgba(255,255,255,.34) !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.7) !important;
  color: var(--text-primary);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
#chat-details-panel textarea { padding: 11px 12px; line-height: 1.55; resize: vertical; }
#chat-details-panel .btn.btn-outline,
#chat-details-panel .chat-details-worldbook-link {
  min-height: 38px;
  border: 1px solid rgba(255,255,255,.78) !important;
  border-radius: 13px !important;
  background: rgba(255,255,255,.28) !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.68) !important;
  color: var(--text-primary) !important;
  font-weight: 650;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
#chat-details-panel .chat-details-section-heading { align-items: center; margin-bottom: 14px; }
#chat-details-panel .chat-details-section-heading strong { font-size: 13px; font-weight: 700; }
#chat-details-panel .chat-details-section-heading span { font-size: 10px; font-weight: 500; }
#chat-details-panel .chat-details-wallpaper-row { gap: 7px; }
#chat-details-panel .chat-details-color-grid label {
  min-height: 44px;
  border-color: rgba(255,255,255,.66);
  border-radius: 13px;
  background: rgba(255,255,255,.22);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.58);
}
#chat-details-panel .chat-details-color-grid input[type="color"] {
  width: 32px;
  height: 28px;
  border: 1px solid rgba(75,82,88,.18);
  border-radius: 9px;
}
#chat-details-panel .chat-details-style-preview {
  min-height: 138px;
  border-color: rgba(255,255,255,.72);
  border-radius: 15px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.6), 0 7px 20px rgba(38,45,52,.06);
}
#chat-details-panel .chat-details-worldbook-heading {
  flex-direction: column;
  align-items: stretch;
  gap: 7px;
}
#chat-details-panel #details-wb-toggle {
  width: 100%;
  min-height: 34px;
  padding: 0 1px;
  font-size: 13px;
}
#chat-details-panel .chat-details-worldbook-link {
  align-self: flex-start;
  min-height: 34px;
  padding: 7px 11px;
  font-size: 10px;
}
#chat-details-panel .chat-details-worldbook-panel {
  max-height: 340px;
  margin-top: 11px;
  padding: 11px 0 0;
  border-top-color: rgba(103,112,120,.1);
}
#chat-details-panel .chat-details-clean-toggle {
  min-height: 60px;
  padding: 14px 15px !important;
}
#chat-details-panel #details-char-nickname-setting > div { display:flex; min-width:0; flex:1; flex-direction:column; gap:3px; }
#chat-details-panel #details-char-nickname-setting small { color:var(--text-secondary); font-size:10px; line-height:1.45; }
#chat-details-panel .switch .slider {
  border: 1px solid rgba(100,110,120,.15);
  background: rgba(125,135,145,.18);
  box-shadow: inset 0 1px 3px rgba(40,48,56,.08), inset 0 1px 0 rgba(255,255,255,.58);
}
#chat-details-panel .switch input:checked + .slider { background: rgba(70,80,90,.7); }
#chat-details-panel #details-tts-voice-container {
  margin-top: -3px !important;
  background: rgba(255,255,255,.28) !important;
}
#chat-details-panel .chat-details-setting-head { display:flex; align-items:center; justify-content:space-between; gap:12px; }
#chat-details-panel .chat-details-setting-head > label:first-child { margin:0 !important; color:var(--text-primary); font-size:12px; font-weight:700; }
#chat-details-panel #details-affection-controls { margin-top:13px; padding-top:12px; border-top:1px solid rgba(100,110,120,.1); }
#chat-details-panel #details-affection-controls[hidden] { display:none; }

/* 创意工坊：聊天美化和小组件制作各自展开原有编辑器。 */
.creative-workshop-section {
  border-bottom: 1px solid rgba(226, 232, 240, 0.9);
  padding: 4px 0;
}
.creative-workshop-section:last-child {
  border-bottom: 0;
}
.creative-workshop-section-toggle {
  width: 100%;
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 2px;
  border: 0;
  background: transparent;
  color: var(--text-primary);
  text-align: left;
  cursor: pointer;
}
.creative-workshop-section-toggle > span:first-child {
  min-width: 0;
  flex: 1;
}
.creative-workshop-section-toggle strong,
.creative-workshop-section-toggle small {
  display: block;
}
.creative-workshop-section-toggle strong {
  margin-bottom: 4px;
  font-size: 13px;
}
.creative-workshop-section-toggle small {
  color: var(--text-secondary);
  font-size: 11px;
  line-height: 1.4;
}
.creative-workshop-section-toggle[aria-expanded="true"] .appearance-entry-arrow {
  transform: rotate(90deg);
}
.creative-workshop-section-body {
  padding: 4px 0 12px;
}
.creative-workshop-section-body[hidden] {
  display: none !important;
}
.creative-workshop-chat-panel {
  position: relative !important;
  inset: auto !important;
  width: 100% !important;
  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;
  transform: none !important;
  visibility: hidden !important;
  opacity: 1 !important;
  transition: none !important;
  display: none !important;
  overflow: visible !important;
  pointer-events: none !important;
  background: transparent !important;
  z-index: auto !important;
}
.creative-workshop-chat-panel.active {
  display: flex !important;
  visibility: visible !important;
  pointer-events: auto !important;
}
.creative-workshop-chat-panel > .win-header {
  flex: 0 0 auto;
  border: 1px solid rgba(226, 232, 240, 0.95);
  border-bottom: 0;
  border-radius: 14px 14px 0 0;
}
.creative-workshop-chat-panel > .win-body {
  height: auto !important;
  max-height: none !important;
  overflow: visible !important;
  padding: 12px !important;
  border: 1px solid rgba(226, 232, 240, 0.95);
  border-top: 0;
  border-radius: 0 0 14px 14px;
}

/* 核心重构：绝对定位居中，并让标题栏两端干净排开 */
.win-header {
  position: relative; /* 建立标题居中基准定位 */
  height: calc(56px + var(--phone-safe-top, 0px));
  background-color: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between; /* 按钮分列两端 */
  padding: var(--phone-safe-top, 0px) 16px 0;
  box-sizing: border-box;
}
.win-header h3 {
  font-size: 16px;
  color: var(--text-primary);
  font-weight: 700;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  pointer-events: none; /* 核心修复：点击穿透，彻底杜绝阻挡按键响应的死区 [1] */
}

.btn-icon {
  background: none; border: none;
  width: 38px; height: 38px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background-color 0.2s;
  z-index: 10; /* 提升按钮层级 */
}
.btn-icon:hover {
  background-color: var(--surface-hover);
  color: var(--primary);
}
.btn-icon svg { width: 22px; height: 22px; }

.win-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

/* 一级主菜单 */
.menu-item {
  background-color: var(--surface);
  padding: 16px;
  border-radius: var(--radius);
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}
.menu-item .chevron { width: 20px; height: 20px; color: var(--text-secondary); }

/* 外观 App：沿用系统设置的轻量列表结构，但把视觉资源集中到一个入口。 */
.appearance-app-body {
  background: linear-gradient(180deg, #f8fafc 0%, var(--bg-main) 100%);
}
.appearance-home {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.appearance-intro {
  padding: 12px 4px 10px;
}
.appearance-eyebrow {
  display: block;
  margin-bottom: 8px;
  color: var(--primary);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.18em;
}
.appearance-intro h2 {
  color: var(--text-primary);
  font-size: 22px;
  line-height: 1.2;
  margin-bottom: 8px;
}
.appearance-intro p {
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.6;
}
.appearance-resource-card,
.appearance-coming-card {
  width: 100%;
  border: 1px solid rgba(226, 232, 240, 0.95);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.05);
  color: var(--text-primary);
  overflow: hidden;
}
.appearance-resource-card {
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}
.appearance-resource-card.is-expanded {
  border-color: rgba(30, 136, 229, 0.38);
  box-shadow: 0 12px 30px rgba(30, 136, 229, 0.1);
}
.appearance-entry-card {
  width: 100%;
  min-height: 76px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--text-primary);
  text-align: left;
}
.appearance-entry-card {
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.appearance-entry-card:active {
  transform: scale(0.985);
}
.appearance-entry-card:hover {
  background: rgba(248, 250, 252, 0.68);
}
.appearance-entry-card > span:not(.appearance-entry-arrow),
.appearance-coming-card > span:first-of-type {
  min-width: 0;
  flex: 1;
}
.appearance-entry-card strong,
.appearance-coming-card strong {
  display: block;
  margin-bottom: 4px;
  font-size: 14px;
}
.appearance-entry-card small,
.appearance-coming-card small {
  display: block;
  color: var(--text-secondary);
  font-size: 11px;
  line-height: 1.4;
}
.appearance-entry-arrow {
  color: var(--text-secondary);
  font-size: 26px;
  line-height: 1;
  transition: transform 0.2s ease;
}
.appearance-resource-card.is-expanded .appearance-entry-arrow {
  transform: rotate(90deg);
}
.appearance-coming-card {
  min-height: 76px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  opacity: 0.7;
}
.appearance-coming-label {
  flex: 0 0 auto;
  color: var(--text-secondary);
  font-size: 10px;
}
.appearance-resource-body {
  border-top: 1px solid rgba(226, 232, 240, 0.9);
  padding: 0 16px 16px;
  background: rgba(248, 250, 252, 0.52);
  animation: appearance-card-reveal 0.2s ease-out;
}
.appearance-resource-body[hidden] {
  display: none !important;
}
.appearance-resource-body .settings-lv2-panel {
  padding: 16px 0 0;
  background: transparent;
}
.appearance-guide-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 14px 0 4px;
  padding: 12px;
  border: 1px solid rgba(147, 197, 253, 0.62);
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(239, 246, 255, 0.82), rgba(248, 250, 252, 0.92));
}
.appearance-guide-card strong {
  display: block;
  margin-bottom: 4px;
  color: var(--text-primary);
  font-size: 12px;
  line-height: 1.4;
}
.appearance-guide-card p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 11px;
  line-height: 1.55;
}
.appearance-guide-download {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  text-decoration: none;
  font-size: 12px;
}
.appearance-resource-body .form-group {
  margin-bottom: 18px;
}
.appearance-resource-body .form-group label {
  font-size: 12px;
  line-height: 1.45;
}
.appearance-resource-body input[type="text"],
.appearance-resource-body input[type="password"],
.appearance-resource-body select,
.appearance-resource-body textarea {
  min-height: 40px;
  font-size: 12px;
}
.appearance-resource-body .btn {
  min-height: 38px;
  border-radius: 12px;
  font-size: 12px;
}
.appearance-resource-body .form-actions {
  padding-top: 4px;
}
.appearance-subsection-toggle {
  width: 100%;
  min-height: 34px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2px;
  border: 0;
  background: transparent;
  color: var(--text-primary);
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  text-align: left;
}
.appearance-subsection-arrow {
  color: var(--text-secondary);
  font-size: 22px;
  font-weight: 400;
  line-height: 1;
  transition: transform 0.2s ease;
}
.appearance-subsection-toggle[aria-expanded="true"] .appearance-subsection-arrow {
  transform: rotate(90deg);
}
.appearance-resource-body .appearance-subsection-body[hidden] {
  display: none !important;
}
.appearance-resource-body .appearance-subsection-body {
  padding-top: 10px;
}
.appearance-resource-body #beautify-icons-list {
  gap: 8px !important;
}
.beautify-global-icon-settings {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: linear-gradient(145deg, color-mix(in srgb, var(--surface) 92%, var(--primary) 8%), var(--surface));
}
.beautify-global-icon-heading {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-bottom: 10px;
}
.beautify-global-icon-heading strong {
  color: var(--text-primary);
  font-size: 13px;
}
.beautify-global-icon-heading small,
.beautify-global-icon-actions small {
  color: var(--text-secondary);
  font-size: 10px;
  line-height: 1.45;
}
.beautify-global-icon-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.beautify-global-icon-grid label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  color: var(--text-secondary);
  font-size: 10px;
  font-weight: 700;
}
.beautify-global-icon-grid output {
  align-self: flex-end;
  margin-top: -17px;
  color: var(--primary);
  font-size: 10px;
}
.beautify-global-icon-grid input[type="color"] {
  width: 100%;
  min-height: 31px;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface);
}
.beautify-global-icon-preview {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  padding: 8px 10px;
  border: 1px dashed var(--border);
  border-radius: 11px;
  background: color-mix(in srgb, var(--surface) 78%, var(--bg-main) 22%);
}
.beautify-global-icon-preview > small {
  color: var(--text-secondary);
  font-size: 10px;
  font-weight: 700;
}
.beautify-global-icon-preview-stage {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  color: var(--preview-label-color);
  font-family: var(--preview-label-font);
}
.beautify-global-icon-preview-stage .preview-icon-wrapper {
  display: grid;
  place-items: center;
  width: var(--preview-icon-size);
  height: var(--preview-icon-size);
  flex: 0 0 var(--preview-icon-size);
  color: var(--preview-icon-color, #8d80b3);
}
.beautify-global-icon-preview-stage .preview-icon-wrapper svg,
.beautify-global-icon-preview-stage .preview-icon-wrapper img {
  width: 100%;
  height: 100%;
}
.beautify-global-icon-preview-stage > span {
  color: var(--preview-label-color);
  font-family: var(--preview-label-font);
  font-size: var(--preview-label-size);
  font-weight: 700;
  white-space: nowrap;
}
.beautify-global-icon-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
}
.beautify-global-icon-actions .btn {
  flex: 0 0 auto;
  min-height: 29px;
  padding: 5px 9px;
  font-size: 10px;
}
.beautify-icon-row-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.appearance-resource-body .beautify-icon-row {
  gap: 8px !important;
  padding: 6px !important;
  border-radius: 9px !important;
}
.appearance-resource-body .beautify-icon-row .icon-preview-box {
  width: 31px !important;
  height: 31px !important;
  border-radius: 9px !important;
}
.appearance-resource-body .beautify-icon-row .icon-preview-box svg {
  width: 82%;
  height: 82%;
}
.appearance-resource-body .beautify-icon-row > div:nth-child(2) > span {
  font-size: 10px !important;
}
.appearance-resource-body .beautify-icon-row input {
  min-height: 29px !important;
  padding: 6px 8px !important;
  border-radius: 10px !important;
  font-size: 10px !important;
}
.appearance-resource-body .beautify-icon-row button {
  min-height: 28px !important;
  padding: 3px 6px !important;
  border-radius: 7px !important;
  font-size: 9px !important;
}
.beautify-icon-row-main {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.beautify-icon-row-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}
.beautify-icon-row-title span {
  overflow: hidden;
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.beautify-icon-row-title small {
  flex: 0 0 auto;
  color: var(--text-secondary);
  font-size: 9px;
}
.beautify-icon-actions {
  display: flex;
  gap: 6px;
}
.beautify-icon-actions .btn {
  flex: 1;
}
.icon-library-panel {
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: color-mix(in srgb, var(--surface) 92%, var(--primary) 8%);
}
.icon-library-heading,
.icon-library-toolbar {
  display: flex;
  align-items: center;
  gap: 7px;
}
.icon-library-heading {
  justify-content: space-between;
  margin-bottom: 9px;
}
.icon-library-heading strong {
  display: block;
  color: var(--text-primary);
  font-size: 12px;
}
.icon-library-heading small {
  display: block;
  margin-top: 2px;
  color: var(--text-secondary);
  font-size: 9px;
}
.icon-library-lock-note {
  max-width: 132px;
  margin-left: auto;
  color: var(--primary) !important;
  font-size: 8px !important;
  line-height: 1.4;
  text-align: right;
}
.icon-library-heading .btn,
.icon-library-toolbar .btn {
  min-height: 28px;
  padding: 4px 8px;
  border-radius: 8px;
  font-size: 9px;
  white-space: nowrap;
}
.icon-library-toolbar select {
  min-width: 0;
  flex: 1;
  min-height: 29px;
  padding: 4px 7px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text-primary);
  font-size: 10px;
}
.icon-library-grid,
.icon-library-picker-grid {
  display: grid;
  grid-auto-flow: column;
  grid-template-rows: repeat(2, minmax(0, 54px));
  grid-auto-columns: minmax(54px, 62px);
  gap: 6px;
  margin-top: 9px;
  padding: 2px 1px 7px;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--primary) 48%, transparent) transparent;
  cursor: grab;
  user-select: none;
}

.icon-library-strip-shell {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) 24px;
  align-items: center;
  gap: 4px;
  margin-top: 9px;
}

.icon-library-strip-shell .icon-library-grid,
.icon-library-strip-shell .icon-library-picker-grid {
  margin-top: 0;
}

.icon-library-strip-nav {
  width: 24px;
  height: 42px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: color-mix(in srgb, var(--surface) 88%, var(--primary) 12%);
  color: var(--primary);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.icon-library-strip-nav:disabled {
  opacity: .32;
  cursor: default;
}

.icon-library-grid.is-dragging,
.icon-library-picker-grid.is-dragging {
  cursor: grabbing;
  scroll-behavior: auto;
}

.icon-library-picker-grid {
  max-height: min(46vh, 390px);
  padding: 2px 16px 12px;
}
.icon-library-tile,
.icon-library-picker-tile {
  display: flex;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 5px 3px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: color-mix(in srgb, var(--surface) 88%, var(--bg-main) 12%);
  color: var(--text-secondary);
  cursor: pointer;
}
.icon-library-tile:hover,
.icon-library-picker-tile:hover {
  border-color: var(--primary);
  color: var(--primary);
}
.icon-library-tile-preview,
.icon-library-picker-tile > span {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  color: var(--primary);
}
.icon-library-tile-preview svg,
.icon-library-picker-tile > span svg {
  width: 100%;
  height: 100%;
}
.icon-library-tile small,
.icon-library-picker-tile small {
  overflow: hidden;
  width: 100%;
  color: inherit;
  font-size: 8px;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.icon-library-empty {
  grid-column: 1 / -1;
  padding: 18px 8px;
  color: var(--text-secondary);
  font-size: 10px;
  text-align: center;
}
.icon-library-modal-overlay {
  position: fixed;
  z-index: 10000;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(15, 23, 42, .42);
}
.icon-library-help-modal,
.icon-library-picker-modal {
  width: min(100%, 340px);
  max-height: min(78vh, 620px);
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--primary) 38%, var(--border));
  border-radius: 18px;
  background: var(--surface);
  box-shadow: 0 18px 50px rgba(15, 23, 42, .24);
}
.icon-library-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--border);
}
.icon-library-modal-kicker {
  color: var(--primary);
  font-size: 8px;
  font-weight: 800;
  letter-spacing: .16em;
}
.icon-library-modal-header h3 {
  margin: 4px 0 0;
  color: var(--text-primary);
  font-size: 16px;
}
.icon-library-modal-close {
  flex: 0 0 auto;
  min-height: 29px;
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface);
  color: var(--text-secondary);
  font-size: 9px;
  cursor: pointer;
}
.icon-library-modal-close:disabled {
  cursor: not-allowed;
  opacity: .52;
}
.icon-library-help-content {
  max-height: calc(min(78vh, 620px) - 78px);
  overflow-y: auto;
  padding: 13px 16px 16px;
}
.icon-library-help-content section + section {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--border);
}
.icon-library-help-content strong {
  color: var(--text-primary);
  font-size: 12px;
}
.icon-library-help-content p {
  margin: 5px 0 0;
  color: var(--text-secondary);
  font-size: 10px;
  line-height: 1.65;
}
.icon-library-help-content code {
  padding: 1px 4px;
  border-radius: 4px;
  background: color-mix(in srgb, var(--primary) 10%, var(--surface));
  color: var(--primary);
  font-size: 9px;
}
.icon-library-help-content a {
  color: var(--primary);
  text-decoration: none;
  line-height: 1.8;
}
.icon-library-picker-modal {
  display: flex;
  flex-direction: column;
}
.icon-library-picker-grid {
  overflow-y: auto;
  padding: 13px 16px 16px;
}
.beautify-icon-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 8px;
  padding-top: 6px;
  border-top: 1px dashed var(--border);
}
.beautify-icon-controls label {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin: 0;
  color: var(--text-secondary);
  font-size: 9px;
  font-weight: 700;
}
.beautify-icon-controls output {
  align-self: flex-end;
  margin-top: -14px;
  color: var(--primary);
  font-size: 9px;
  font-weight: 800;
}
.beautify-icon-controls input[type="range"] {
  width: 100%;
  min-height: 18px;
  padding: 0;
}
.beautify-font-field {
  grid-column: 1 / -1;
}
.beautify-font-select {
  width: 100%;
  min-height: 30px !important;
  padding: 5px 7px !important;
  border-radius: 8px !important;
  font-size: 10px !important;
}
.beautify-icon-controls > .btn {
  align-self: end;
  min-height: 30px !important;
  padding: 5px 7px !important;
  font-size: 10px !important;
}
@media (max-width: 360px) {
  .beautify-icon-controls {
    grid-template-columns: 1fr;
  }
  .beautify-font-field {
    grid-column: auto;
  }
}
@keyframes appearance-card-reveal {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  .appearance-resource-body,
  .appearance-entry-card,
  .appearance-entry-arrow,
  .appearance-subsection-arrow {
    animation: none;
    transition: none;
  }
}

/* 聊天提示词统一编辑器：条目就是实际发送顺序，不再使用独立思维链预设卡片。 */
.prompt-entries-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.prompt-entry-item {
  padding: 12px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.48);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.prompt-entry-item__head {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  align-items: center;
  gap: 7px;
  margin-bottom: 9px;
}

.prompt-entry-item__controls {
  grid-column: 2 / 4;
  justify-self: end;
  display: flex;
  gap: 6px;
}

.prompt-entry-item__index {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 10px;
  background: rgba(219, 229, 241, 0.72);
  color: #61728a;
  font-size: 12px;
  font-weight: 750;
}

.prompt-entry-item__head input,
.prompt-entry-item textarea {
  box-sizing: border-box;
  width: 100%;
  border: 1px solid rgba(148, 163, 184, 0.3);
  color: #263244;
  background: rgba(255, 255, 255, 0.54);
}

.prompt-entry-item__head input {
  min-width: 0;
  height: 36px;
  padding: 0 10px;
  border-radius: 12px;
  font-weight: 700;
}

.prompt-entry-item textarea {
  min-height: 112px;
  padding: 11px 12px;
  border-radius: 14px;
  resize: vertical;
  font: inherit;
  font-size: 13px;
  line-height: 1.65;
}

.prompt-entry-item__head button {
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid rgba(148, 163, 184, 0.3);
  border-radius: 11px;
  color: #66758a;
  background: rgba(255, 255, 255, 0.5);
}

.prompt-entry-item__head button:disabled {
  opacity: 0.32;
}

@media (max-width: 380px) {
  .prompt-entry-item {
    padding: 10px;
  }

  .prompt-entry-item__head {
    grid-template-columns: 26px minmax(0, 1fr) auto;
    gap: 5px;
  }

  .prompt-entry-item__index {
    width: 26px;
    height: 26px;
  }
}

/* 表单组件 */
.form-group { margin-bottom: 14px; }
.form-group label {
  display: block; font-size: 12px; color: var(--text-secondary); margin-bottom: 6px; font-weight: 600;
}
input[type="text"], input[type="password"], input[type="number"], select, textarea {
  width: 100%; padding: 11px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background-color: var(--surface);
  font-size: 13px; color: var(--text-primary);
  outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--primary); }

.btn {
  padding: 10px 18px; border-radius: var(--radius); border: none;
  background-color: var(--primary); color: white;
  font-size: 13px; font-weight: 600; cursor: pointer;
}
.btn-primary { background-color: var(--primary); }
.btn-outline { background-color: transparent; border: 1.5px solid var(--primary); color: var(--primary); }
.btn-danger-outline { background-color: transparent; border: 1.5px solid var(--danger); color: var(--danger); }

/* 红包/转账弹窗操作按钮：用克制的中性玻璃层级，避免粉色和蓝色抢走内容焦点 */
#wallet-tx-overlay .wallet-tx-action {
  min-height: 44px;
  height: 44px;
  padding: 0 14px;
  border-radius: 12px;
  border-width: 1px;
  border-style: solid;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .01em;
  box-sizing: border-box;
  transition: background-color .18s ease, border-color .18s ease, box-shadow .18s ease, transform .12s ease;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .74), 0 4px 14px rgba(15, 23, 42, .08);
}
#wallet-tx-overlay .wallet-tx-action--secondary {
  background: rgba(255, 255, 255, .72);
  border-color: rgb(190, 190, 186);
  color: rgb(88, 88, 84);
}
#wallet-tx-overlay .wallet-tx-action--primary {
  background: rgb(74, 74, 70);
  border-color: rgb(74, 74, 70);
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .16), 0 5px 16px rgba(38, 38, 35, .18);
}
#wallet-tx-overlay .wallet-tx-action:hover {
  transform: translateY(-1px);
}
#wallet-tx-overlay .wallet-tx-action--secondary:hover {
  background: rgba(255, 255, 255, .9);
  border-color: rgb(166, 166, 160);
}
#wallet-tx-overlay .wallet-tx-action--primary:hover {
  background: rgb(90, 90, 85);
  border-color: rgb(90, 90, 85);
}
#wallet-tx-overlay .wallet-tx-action:active {
  transform: translateY(1px) scale(.985);
}
#wallet-tx-overlay .wallet-tx-action:focus-visible {
  outline: 2px solid rgba(74, 74, 70, .36);
  outline-offset: 2px;
}

/* Archive character card foundation */
#win-archive {
  --primary: #7a332b;
  --primary-light: #f1ddd2;
  --text-primary: #6c3029;
  --text-secondary: #8d554c;
  --theme-accent: #7a332b;
  --theme-accent-soft: #f1ddd2;
  --theme-text-primary: #6c3029;
  --theme-text-secondary: #8d554c;
  --theme-text-on-primary: #fff1d1;
  color: #6c3029;
  font-family: "huangkaihuaLawyerfont", "KaiTi", "STKaiti", serif;
}
#win-archive > .archive-header {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  gap: 8px;
  justify-content: initial;
  border-bottom-color: rgba(177, 132, 67, .44);
  background: #efe0bb;
  color: #5f3029;
}
#win-archive > .archive-header h3 {
  position: absolute;
  left: 50%;
  /* Archive header uses grid, so the automatic static position can fall inside the Dynamic Island safe area. */
  top: calc(var(--phone-safe-top, 0px) + 28px);
  min-width: 0;
  max-width: calc(100% - 120px);
  overflow: hidden;
  margin: 0;
  transform: translate(-50%, -50%);
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#win-archive > .win-body {
  background-color: #efe2c3;
  background-image:
    linear-gradient(rgba(250, 239, 208, .12), rgba(222, 192, 139, .08)),
    url('assets/archive/background/archive-bg .png');
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
}
#win-archive[data-archive-theme="night"] {
  --primary: #c8cbd2;
  --primary-light: #2b2d32;
  --text-primary: #e4e5e8;
  --text-secondary: #aeb2bb;
  --theme-accent: #c8cbd2;
  --theme-text-primary: #e4e5e8;
  --theme-text-secondary: #aeb2bb;
  color: #d8dae0;
  background: #15161a;
}
#win-archive[data-archive-theme="night"] > .archive-header,
#win-archive[data-archive-theme="night"] > .archive-tabs {
  background: #1b1d22;
  border-color: rgba(209, 213, 222, .28);
  color: #d9dbe1;
}
#win-archive[data-archive-theme="night"] > .win-body {
  background-color: #1a1c20;
  background-image:
    linear-gradient(rgba(20, 21, 24, .2), rgba(20, 21, 24, .2)),
    url('assets/archive/background/archive-bg-night.png');
  background-size: cover;
}
#win-archive[data-archive-theme="night"] .archive-stamp-wall-toolbar {
  border-bottom-color: rgba(210, 214, 224, .3);
  color: #c5c8d0;
}
#win-archive[data-archive-theme="night"] .archive-display-mode select,
#win-archive[data-archive-theme="night"] #archive-all-roles,
#win-archive[data-archive-theme="night"] .archive-theme-toggle {
  border-color: rgba(214, 217, 225, .42);
  background: rgba(34, 36, 42, .86);
  color: #e1e3e8;
  box-shadow: inset 0 1px rgba(255, 255, 255, .08), 0 2px 7px rgba(0, 0, 0, .22);
}
#win-archive[data-archive-theme="night"] .archive-display-mode select option {
  background: #202329;
  color: #e1e3e8;
}
#win-archive[data-archive-theme="night"] .archive-browse-search input {
  border-color: rgba(214, 217, 225, .38);
  background: #25282e;
  color: #e1e3e8;
}
#win-archive[data-archive-theme="night"] .archive-browse-search input::placeholder {
  color: #9ca3af;
}
#win-archive[data-archive-theme="night"] .archive-manual-picker {
  border-color: rgba(211, 217, 228, .3);
  background: #202329;
  color: #e1e3e8;
}
#win-archive[data-archive-theme="night"] .archive-manual-picker summary,
#win-archive[data-archive-theme="night"] .archive-manual-picker-item {
  color: #dce0e8;
}
#win-archive[data-archive-theme="night"] .archive-manual-picker input {
  accent-color: #cfd5df;
}
#win-archive[data-archive-theme="night"] .archive-single-page,
#win-archive[data-archive-theme="night"] .archive-single-name,
#win-archive[data-archive-theme="night"] .archive-single-title,
#win-archive[data-archive-theme="night"] .archive-single-side-note {
  color: #d9dbe2;
}
#win-archive[data-archive-theme="night"] .archive-single-title::before,
#win-archive[data-archive-theme="night"] .archive-single-title::after {
  color: #d8dbe2;
  background: linear-gradient(90deg, transparent, #bfc4cf 38%, #bfc4cf 62%, transparent);
  text-shadow: 0 0 4px rgba(224, 228, 237, .6);
}
#win-archive[data-archive-theme="night"] .archive-single-side-note {
  text-shadow: 0 1px rgba(255, 255, 255, .16), 0 2px 4px rgba(0, 0, 0, .4);
}
#win-archive[data-archive-theme="night"] .archive-tabs .tab-item,
#win-archive[data-archive-theme="night"] .archive-tabs .tab-item.active {
  color: #c8cbd2;
}
#win-archive[data-archive-theme="night"] > .archive-header .btn-icon,
#win-archive[data-archive-theme="night"] .archive-header-actions .btn-icon,
#win-archive[data-archive-theme="night"] .archive-more-toggle {
  color: #d7dbe4;
  background: #25282e;
  border-color: rgba(214, 219, 229, .4);
}
#win-archive[data-archive-theme="night"] .archive-more-menu {
  border-color: rgba(211, 217, 228, .32);
  background: #202329;
  box-shadow: 0 12px 24px rgba(0, 0, 0, .42);
}
#win-archive[data-archive-theme="night"] .archive-more-menu button {
  color: #dce0e8;
  border-color: rgba(211, 217, 228, .2);
}
#win-archive[data-archive-theme="night"] .archive-more-menu button:hover,
#win-archive[data-archive-theme="night"] .archive-more-menu button:focus-visible {
  background: rgba(218, 224, 235, .12);
}
#win-archive[data-archive-theme="night"] .archive-more-menu button span,
#win-archive[data-archive-theme="night"] #archive-all-roles::before {
  color: #cbd1dc;
}
#win-archive[data-archive-theme="night"] .archive-all-roles-browser .archive-card--collection {
  border-color: rgba(211, 217, 228, .28);
  background: rgba(34, 37, 43, .9);
  box-shadow: 0 7px 16px rgba(0, 0, 0, .28);
}
#win-archive[data-archive-theme="night"] .archive-all-roles-browser .card-name,
#win-archive[data-archive-theme="night"] .archive-all-roles-browser .card-desc {
  color: #dce0e8;
}
#win-archive[data-archive-theme="night"] #archive-profile-panel {
  background: #17191e;
}
#win-archive[data-archive-theme="night"] #archive-profile-panel .archive-profile-header,
#win-archive[data-archive-theme="night"] #archive-profile-panel .archive-profile-section,
#win-archive[data-archive-theme="night"] #archive-profile-panel .archive-profile-advanced {
  background: #24272d;
  border-color: rgba(211, 217, 228, .3);
  color: #e0e3e9;
}
#win-archive[data-archive-theme="night"] #archive-profile-panel .archive-profile-header h3,
#win-archive[data-archive-theme="night"] #archive-profile-panel .archive-profile-name,
#win-archive[data-archive-theme="night"] #archive-profile-panel h4,
#win-archive[data-archive-theme="night"] #archive-profile-panel p,
#win-archive[data-archive-theme="night"] #archive-profile-panel summary {
  color: #e0e3e9;
}
#win-archive[data-archive-theme="night"] #archive-profile-panel .btn-outline,
#win-archive[data-archive-theme="night"] #archive-profile-panel .btn-primary {
  border-color: #cbd1dc;
  background: #2c3037;
  color: #e0e3e9;
}
#win-archive[data-archive-theme="night"] .archive-single-stamp {
  filter: drop-shadow(0 12px 10px rgba(0, 0, 0, .52)) drop-shadow(0 24px 24px rgba(3, 4, 6, .48));
}
#win-archive[data-archive-theme="night"] .archive-single-stamp .archive-stamp-badge-image {
  animation-name: archive-stamp-metal-pulse-night;
}
#win-archive[data-archive-theme="night"] .archive-single-stamp .archive-stamp-badge-slot::before {
  color: rgba(238, 241, 248, .96);
  text-shadow: 0 0 6px rgba(218, 224, 236, .9);
}
#win-archive[data-archive-theme="night"] .archive-single-stamp .archive-stamp-badge-slot::after {
  background: rgba(220, 226, 238, .9);
  box-shadow: 0 0 8px rgba(220, 226, 238, .72);
}
#win-archive[data-archive-theme="night"] .archive-gold-foil i {
  background: #dce1ea;
  box-shadow: 0 0 7px rgba(222, 229, 240, .95), 0 0 14px rgba(180, 190, 207, .58), 0 1px 2px rgba(0, 0, 0, .5);
}
#win-archive[data-archive-theme="night"] .archive-companion-bookmark {
  filter: drop-shadow(5px 11px 10px rgba(0, 0, 0, .5)) drop-shadow(0 0 8px rgba(206, 214, 229, .32));
}
#win-archive[data-archive-theme="night"] .archive-companion-bookmark strong {
  color: #e4e7ed;
  background: rgba(35, 37, 43, .78);
  text-shadow: 1px 2px 0 rgba(12, 13, 16, .8), 0 0 6px rgba(226, 232, 242, .4);
  box-shadow: 0 2px 5px rgba(0, 0, 0, .45);
}
#win-archive[data-archive-theme="night"] .archive-companion-bookmark::after {
  color: rgba(232, 236, 244, .96);
  text-shadow: 0 0 7px rgba(224, 231, 242, .9);
}

html[data-archive-theme="night"] #archive-profile-panel,
html[data-archive-theme="night"] #archive-form-overlay,
html[data-archive-theme="night"] #archive-image-adjust-overlay {
  --archive-night-bg: #17191e;
  --archive-night-panel: #202329;
  --archive-night-border: rgba(210, 216, 228, .3);
  --archive-night-text: #e3e6ec;
  --archive-night-muted: #aeb4c0;
  --archive-night-accent: #cfd5df;
}
html[data-archive-theme="night"] #archive-profile-panel .archive-profile-header,
html[data-archive-theme="night"] #archive-profile-panel .archive-profile-content,
html[data-archive-theme="night"] #archive-profile-panel .archive-profile-section,
html[data-archive-theme="night"] #archive-profile-panel .archive-profile-advanced,
html[data-archive-theme="night"] #archive-image-adjust-overlay .archive-image-adjust-modal,
html[data-archive-theme="night"] #archive-form-overlay .modal {
  background: var(--archive-night-panel);
  color: var(--archive-night-text);
  border-color: var(--archive-night-border);
}
html[data-archive-theme="night"] #archive-profile-panel .archive-profile-name,
html[data-archive-theme="night"] #archive-profile-panel h4,
html[data-archive-theme="night"] #archive-profile-panel p,
html[data-archive-theme="night"] #archive-profile-panel summary,
html[data-archive-theme="night"] #archive-form-overlay .archive-edit-section-heading,
html[data-archive-theme="night"] #archive-form-overlay .archive-edit-section summary {
  color: var(--archive-night-text);
}
html[data-archive-theme="night"] #archive-profile-panel .archive-profile-actions .btn,
html[data-archive-theme="night"] #archive-profile-panel .archive-profile-secondary-actions .btn,
html[data-archive-theme="night"] #archive-form-overlay .btn-outline,
html[data-archive-theme="night"] #archive-form-overlay input,
html[data-archive-theme="night"] #archive-form-overlay textarea {
  border-color: var(--archive-night-border);
  background: #292c33;
  color: var(--archive-night-text);
}
html[data-archive-theme="night"] #archive-profile-panel .archive-profile-expand-label {
  border-color: var(--archive-night-border);
  background: #292c33;
  color: var(--archive-night-text);
  box-shadow: 0 2px 7px rgba(0, 0, 0, .24);
}
html[data-archive-theme="night"] #archive-profile-panel .btn-primary,
html[data-archive-theme="night"] #archive-form-overlay .btn-primary {
  border-color: #cfd5df;
  background: #cfd5df;
  color: #17191e;
}

/* 夜间 Archive 首屏构图：降低重心，让银色装饰与深色背景分开。 */
#win-archive[data-archive-theme="night"] .archive-single-stamp-button.archive-stamp-card {
  margin-top: 34px;
  transform: rotate(5deg);
  filter: drop-shadow(0 16px 12px rgba(0, 0, 0, .42)) drop-shadow(0 30px 28px rgba(0, 0, 0, .28));
}
#win-archive[data-archive-theme="night"] .archive-single-stamp-button.archive-stamp-card:hover {
  transform: translateY(-3px) rotate(5deg);
}
#win-archive[data-archive-theme="night"] .archive-single-stamp-button.archive-stamp-card:active {
  transform: translateY(1px) rotate(5deg) scale(.99);
}
#win-archive[data-archive-theme="night"] .archive-single-stamp {
  filter: none;
  animation: archive-night-stamp-float 4.8s ease-in-out infinite;
}
#win-archive[data-archive-theme="night"] .archive-single-stamp .archive-stamp-badge-slot {
  right: -8%;
  bottom: 3%;
  width: 42%;
  height: 28%;
  transform: rotate(-5deg);
  transform-origin: center;
}
#win-archive[data-archive-theme="night"] .archive-single-ornament {
  transform: translate(-9%, -4px);
}
#win-archive[data-archive-theme="night"] .archive-single-footer {
  margin-top: -12px;
}
#win-archive[data-archive-theme="night"] .archive-single-title {
  font-size: clamp(13px, 3.8vw, 16px);
  animation: archive-single-title-reveal 1.6s ease-out both;
}
#win-archive[data-archive-theme="night"] .archive-single-heading-mark::after {
  color: #d6dbe5;
  text-shadow: 0 2px 5px rgba(7, 9, 13, .78), 0 0 9px rgba(226, 232, 242, .3);
}
#win-archive[data-archive-theme="night"] .archive-single-ornament-image {
  opacity: .82;
  filter: contrast(1.12) saturate(.82) drop-shadow(0 8px 12px rgba(5, 7, 11, .58)) drop-shadow(0 0 7px rgba(215, 223, 236, .3));
  animation: archive-night-watermark-float 5.2s ease-in-out infinite;
}
#win-archive[data-archive-theme="night"] .archive-single-ornament::before,
#win-archive[data-archive-theme="night"] .archive-single-ornament::after {
  color: #cfd5df;
  text-shadow: 0 1px 4px rgba(5, 7, 11, .72), 0 0 7px rgba(219, 226, 238, .46);
}

#win-archive > .archive-header h3 { color: #6f3028; letter-spacing: .06em; }
#win-archive > .archive-header .btn-icon { color: #7a4434; }
#win-archive[data-archive-theme="night"] > .archive-header h3 { color: #d9dbe1; }
#win-archive[data-archive-theme="night"] > .archive-header .btn-icon { color: #d7dbe4; }
.archive-header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  min-width: 80px;
}
.archive-header-actions .btn-icon {
  flex: 0 0 38px;
}
.archive-header-actions .archive-action-proxy { display: none !important; }
.archive-card-browser {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 420px;
  padding: 8px 0;
}
.archive-card-browser-nav {
  flex: 0 0 36px;
  width: 36px;
  height: 48px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--theme-text-secondary);
  font-size: 34px;
  line-height: 1;
  cursor: pointer;
}
.archive-card-browser-nav:focus-visible { outline: 2px solid var(--theme-accent); outline-offset: 2px; }

/* 档案卡与折叠机制 */
.archive-group-wrapper {
  margin-bottom: 0;
}
.archive-group-header {
  background: transparent;
  color: var(--theme-text-primary);
  padding: 0 2px 8px;
  border-radius: 0;
  border-bottom: 1px solid var(--theme-border);
  font-size: 13px;
  font-weight: 700;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  margin-bottom: 12px;
}
.archive-section-heading svg { color: var(--theme-text-secondary); transition: transform .2s ease; }
.archive-group-content {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.archive-group-content.collapsed { display: none; }

.archive-card {
  background-color: var(--surface);
  border-radius: var(--radius);
  padding: 12px;
  display: flex;
  align-items: center;
  border: 1px solid var(--border);
}
.card-avatar {
  width: 44px; height: 44px; border-radius: 50%; object-fit: cover; margin-right: 12px;
}
.card-info { flex: 1; }
.card-name { font-size: 14px; font-weight: 700; color: var(--text-primary); }
.card-desc { font-size: 11px; color: var(--text-secondary); margin-top: 2px; }
.archive-browse-card { cursor: pointer; transition: border-color .15s ease, background-color .15s ease; }
.archive-browse-card:focus-visible { outline: 2px solid var(--theme-accent, var(--primary)); outline-offset: 2px; }
.archive-browse-card:active { background-color: var(--theme-bg-hover, var(--surface)); }
.archive-card--collection {
  min-height: 104px;
  padding: 18px 16px;
  border-color: color-mix(in srgb, var(--theme-border) 82%, transparent);
  border-radius: calc(var(--theme-card-radius) + 2px);
  box-shadow: none;
  transition: border-color .18s ease, background-color .18s ease, transform .18s ease;
}
.archive-card--collection:hover {
  background-color: var(--theme-bg-hover);
  border-color: color-mix(in srgb, var(--theme-accent) 35%, var(--theme-border));
}
.archive-card--collection:active { transform: scale(.995); }
.archive-card--collection .card-avatar {
  width: 72px;
  height: 72px;
  flex: 0 0 72px;
  margin-right: 18px;
  border-radius: 20px;
  box-shadow: 0 4px 12px rgba(15, 23, 42, .08);
}
.archive-card--collection .card-info {
  display: flex;
  min-width: 0;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
}
.archive-card--collection .card-name { font-size: 16px; line-height: 1.3; }
.archive-card--collection .card-desc {
  display: -webkit-box;
  overflow: hidden;
  margin-top: 0;
  font-size: 12px;
  line-height: 1.5;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
.archive-card--collection:focus-visible { outline: 2px solid var(--theme-accent); outline-offset: 3px; }

.archive-character-card {
  position: relative;
  width: min(78vw, 280px);
  aspect-ratio: 4 / 5;
  padding: 0;
  perspective: 1000px;
  border: 0;
  background: transparent;
  cursor: pointer;
}
.archive-character-card:focus-visible { outline: 2px solid var(--theme-accent); outline-offset: 4px; }
.archive-character-card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform .3s ease;
}
.archive-character-card.is-flipped .archive-character-card-inner { transform: rotateY(180deg); }
.archive-character-card-face {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  backface-visibility: hidden;
  border: 1px solid var(--theme-border);
  border-radius: var(--theme-card-radius);
  background: var(--theme-bg-card);
}
.archive-character-card-front { padding: 16px; }
.archive-card-image-frame {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  min-height: 0;
  border: 1px solid var(--theme-border);
  border-radius: calc(var(--theme-card-radius) - 2px);
  background: var(--theme-bg-page);
  overflow: hidden;
}
.archive-card-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.archive-character-card-back {
  transform: rotateY(180deg);
  padding: 16px;
  text-align: left;
}
.archive-card-back-profile { flex: 1; min-height: 0; overflow-y: auto; }
.archive-card-back-name {
  margin: 0 0 12px;
  color: var(--theme-text-primary);
  font-size: var(--theme-font-size-section-title);
}
.archive-card-original-content {
  color: var(--theme-text-secondary);
  font-size: var(--theme-font-size-body);
  line-height: var(--theme-line-height-body);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.archive-card-extension-placeholder {
  flex: 0 0 28px;
  margin-top: 12px;
  border-top: 1px dashed var(--theme-border);
}
.archive-card-operation-placeholder {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding-top: 10px;
  border-top: 1px solid var(--theme-border);
}
.archive-card-operation-placeholder .btn { flex: 1 1 auto; min-width: 0; padding: 8px 10px; font-size: var(--theme-font-size-caption); }

/* 角色邮票墙：只负责浏览图片，不复用管理列表的密集布局 */
.archive-stamp-wall-shell {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  gap: 14px;
}
.archive-stamp-wall-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0;
  flex-wrap: nowrap;
  margin: 0 -17px;
  padding: 8px 0 10px;
  border: 0;
  border-bottom: 1px solid rgba(177, 132, 67, .36);
  border-radius: 0;
  background: transparent;
  color: #73513a;
}
.archive-toolbar-group {
  display: contents;
}
.archive-theme-toggle {
  flex: 0 0 31px;
  width: 31px;
  min-height: 31px;
  padding: 0;
  border: 1px solid rgba(177, 132, 67, .58);
  border-radius: 50%;
  background: rgba(247, 232, 197, .82);
  color: #73372e;
  font: 17px/1 Georgia, serif;
  cursor: pointer;
  box-shadow: inset 0 1px rgba(255, 255, 255, .7), 0 2px 6px rgba(111, 64, 31, .12);
  transition: background-color .25s ease, color .25s ease, border-color .25s ease;
}
.archive-theme-toggle:focus-visible { outline: 2px solid var(--theme-accent); outline-offset: 2px; }
.archive-display-mode {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #806248;
  min-width: 0;
  font-size: 9px;
  white-space: nowrap;
}
.archive-display-mode > span:not(.archive-sr-only) { display: none; }
.archive-display-mode select {
  min-height: 31px;
  padding: 4px 25px 4px 10px;
  border: 1px solid rgba(154, 103, 47, .5);
  border-radius: 999px;
  appearance: none;
  -webkit-appearance: none;
  background-color: rgba(247, 232, 197, .82);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M2 2l4 4 4-4' fill='none' stroke='%23733b30' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-position: right 9px center;
  background-repeat: no-repeat;
  color: #63382d;
  box-shadow: inset 0 1px rgba(255, 251, 234, .9), 0 2px 6px rgba(111, 64, 31, .1);
  font: inherit;
  color-scheme: light;
}
.archive-display-mode select:hover { border-color: rgba(131, 71, 45, .7); background-color: rgba(250, 238, 208, .95); }
.archive-display-mode select:focus-visible { outline: 2px solid rgba(177, 132, 67, .55); outline-offset: 2px; }
.archive-display-mode select option {
  background: #f3dfb5;
  color: #603229;
  font-family: inherit;
}
#archive-display-mode-select { width: 82px; }
#archive-display-count-select { width: 62px; }
.archive-stamp-wall-toolbar #archive-all-roles,
.archive-stamp-wall-toolbar #archive-random-refresh {
  min-height: 31px;
  flex: 0 0 auto;
  min-width: 74px;
  padding: 5px 6px;
  border: 1px solid rgba(177, 132, 67, .66);
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255, 247, 225, .92), rgba(230, 207, 160, .88));
  color: #73372e;
  box-shadow: inset 0 1px rgba(255, 255, 255, .7);
  font-size: 10px;
  letter-spacing: .04em;
}
.archive-stamp-wall-toolbar #archive-all-roles::before { content: '✦'; margin-right: 5px; color: #ae7b34; }
.archive-more-actions { position: relative; flex: 0 0 30px; }
.archive-more-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 31px;
  padding: 0 0 6px;
  border: 1px solid rgba(177, 132, 67, .66);
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255, 247, 225, .92), rgba(230, 207, 160, .88));
  color: #73372e;
  box-shadow: inset 0 1px rgba(255, 255, 255, .7), 0 2px 7px rgba(110, 63, 30, .12);
  font-family: Georgia, serif;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}
.archive-more-toggle[aria-expanded="true"] { background: #7a382e; color: #fff0cd; }
.archive-more-menu {
  position: absolute;
  z-index: 80;
  top: calc(100% + 8px);
  right: 0;
  width: 158px;
  overflow: hidden;
  padding: 5px;
  border: 1px solid rgba(139, 89, 43, .52);
  border-radius: 11px;
  background: linear-gradient(145deg, #f9eccd, #ead1a2);
  box-shadow: 0 12px 26px rgba(91, 49, 27, .25), inset 0 1px rgba(255, 250, 230, .85);
}
.archive-more-menu[hidden] { display: none; }
.archive-more-menu button {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #603229;
  font: inherit;
  font-size: 11px;
  text-align: left;
  cursor: pointer;
}
.archive-more-menu button + button { border-top: 1px solid rgba(150, 101, 49, .2); }
.archive-more-menu button:hover,
.archive-more-menu button:focus-visible { background: rgba(125, 54, 43, .1); outline: none; }
.archive-more-menu button span { width: 15px; color: #a37234; font-size: 15px; text-align: center; }
.archive-browse-search { flex: 1 1 auto; min-width: 0; }
.archive-browse-search input {
  width: min(112px, 100%);
  min-height: 32px;
  padding: 4px 9px;
  border: 1px solid var(--theme-border);
  border-radius: var(--theme-control-radius);
  background: var(--theme-bg-card);
  color: var(--theme-text-primary);
  font: inherit;
}

/* 全部角色页：保留展示、搜索、更多三项，并在同一行完成浏览操作。 */
.archive-all-roles-shell .archive-stamp-wall-toolbar {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  align-items: center;
  padding-top: 9px;
  padding-bottom: 11px;
}
.archive-all-roles-shell .archive-toolbar-filters {
  display: flex;
  align-items: center;
  gap: 9px;
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
}
.archive-all-roles-shell .archive-toolbar-filters .archive-display-mode:first-child {
  flex: 0 0 auto;
}
.archive-all-roles-shell .archive-toolbar-filters .archive-browse-search {
  flex: 1 1 auto;
}
.archive-all-roles-shell .archive-toolbar-filters .archive-browse-search input {
  width: 100%;
  box-sizing: border-box;
}
.archive-all-roles-shell .archive-toolbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex: 0 0 30px;
  gap: 0;
  min-width: 0;
}
.archive-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.archive-stamp-frame {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border: 1px solid var(--theme-border);
  border-radius: var(--theme-card-radius);
  background: var(--theme-bg-card);
}
.archive-stamp-frame::after {
  content: '';
  position: absolute;
  inset: 8px;
  border: 1px dashed color-mix(in srgb, var(--theme-border) 70%, transparent);
  border-radius: calc(var(--theme-card-radius) - 4px);
  pointer-events: none;
}
.archive-stamp-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.archive-stamp-badge {
  position: absolute;
  right: 10px;
  bottom: 10px;
  z-index: 2;
  display: block;
  width: 28px;
  height: 28px;
  border: 1px dashed var(--theme-border);
  border-radius: 50%;
  background: color-mix(in srgb, var(--theme-bg-card) 82%, transparent);
  pointer-events: none;
}
.archive-stamp-badge[data-level="silver"],
.archive-stamp-badge[data-level="gold"],
.archive-stamp-badge[data-level="rainbow"] {
  border-style: solid;
}
.archive-stamp-badge-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.archive-stamp-badge.has-asset {
  border: 0;
  border-radius: 0;
  background: transparent;
}

/* 完整角色邮票：图片在框内，名称在框外，邮戳只保留空插槽。 */
.archive-stamp-card {
  position: relative;
  display: block;
  min-width: 0;
  aspect-ratio: 4 / 5;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  transition: transform .18s ease;
}
.archive-stamp-card:hover { transform: translateY(-2px); }
.archive-stamp-card:focus-visible { outline: 2px solid var(--theme-accent); outline-offset: 4px; }
.archive-stamp-card-content { display: flex; flex-direction: column; width: 100%; height: auto; }
.archive-stamp-card .archive-stamp-frame {
  flex: 1 1 auto;
  min-height: 0;
}
.archive-stamp-image {
  position: relative;
  width: 100%;
  height: 100%;
}
.archive-stamp-image img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.archive-stamp-badge-slot {
  position: absolute;
  right: 10px;
  bottom: 10px;
  width: 32px;
  height: 32px;
  pointer-events: none;
}
.archive-stamp-name {
  flex: 0 0 auto;
  min-height: 22px;
  padding: 8px 2px 0;
  overflow: hidden;
  color: var(--theme-text-primary);
  font-size: var(--theme-font-size-body);
  font-weight: 700;
  line-height: 1.25;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.archive-stamp-card .archive-stamp-frame::after { pointer-events: none; }
.archive-stamp-wall-empty {
  grid-column: 1 / -1;
  margin: 0;
  padding: 48px 12px;
  color: var(--theme-text-secondary);
  text-align: center;
  font-size: var(--theme-font-size-body);
}
.archive-manual-picker {
  border-top: 1px solid var(--theme-border);
  padding: 12px 4px 0;
  color: var(--theme-text-secondary);
  font-size: var(--theme-font-size-caption);
}
.archive-manual-picker summary { cursor: pointer; color: var(--theme-text-primary); font-weight: 700; }
.archive-manual-picker-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 14px;
  padding-top: 10px;
}
.archive-manual-picker-item { display: flex; align-items: center; gap: 6px; min-width: 0; }
.archive-manual-picker-item span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Archive 单页收藏册：首页只展示当前角色，图层按头像、邮票框、关系邮戳排列。 */
.archive-single-shell {
  position: relative;
  min-height: 100%;
  gap: 0;
  padding: 8px clamp(10px, 3vw, 24px) 18px;
}
.archive-single-shell .archive-stamp-wall-toolbar,
.archive-all-roles-shell .archive-stamp-wall-toolbar {
  margin: 0 -10px;
  padding: 7px 4px 11px;
}
.archive-single-stage {
  position: relative;
  width: 100%;
  min-height: 570px;
  touch-action: pan-y;
}
.archive-single-page {
  position: relative;
  isolation: isolate;
  width: 100%;
  min-height: 570px;
  overflow: hidden;
  color: #6f3028;
}
.archive-single-heading {
  position: relative;
  z-index: 5;
  display: grid;
  justify-items: center;
  gap: 3px;
  width: 100%;
  box-sizing: border-box;
  padding: 14px 20px 4px;
  text-align: center;
}
.archive-single-heading-mark {
  color: transparent;
  font-size: 0;
  line-height: 1.2;
  letter-spacing: .28em;
}
.archive-single-heading-mark::after {
  content: 'THE MEMORY ARCHIVE';
  color: #a17148;
  font: 9px/1.2 Georgia, serif;
  letter-spacing: .26em;
  text-shadow: 0 2px 5px rgba(85, 45, 29, .34), 0 0 7px rgba(255, 242, 205, .34);
}
.archive-single-name {
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  margin: 0;
  color: #6d2e28;
  font-family: "huangkaihuaLawyerfont", "KaiTi", "STKaiti", serif;
  font-size: clamp(24px, 7.2vw, 31px);
  font-weight: normal;
  line-height: 1.12;
  letter-spacing: .08em;
  text-overflow: ellipsis;
  text-shadow: 0 1px rgba(255, 244, 212, .9), 0 3px 8px rgba(104, 50, 35, .12);
  white-space: nowrap;
}
.archive-companion-stamp {
  position: absolute;
  top: 71px;
  left: 22px;
  z-index: 6;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: auto;
  height: auto;
  box-sizing: border-box;
  padding: 0;
  transform: rotate(-7deg);
  border: 0;
  border-radius: 0;
  color: #7a332b;
  background: transparent;
  box-shadow: none;
  text-align: center;
  text-transform: uppercase;
}
.archive-companion-stamp::before,
.archive-companion-stamp::after {
  display: none;
}
.archive-companion-stamp strong {
  display: block;
  font: 51px/.86 Georgia, serif;
  font-variant-numeric: lining-nums tabular-nums;
  text-shadow: 2px 3px 0 rgba(117, 48, 39, .16), 4px 7px 9px rgba(102, 45, 34, .25);
}
.archive-companion-stamp span {
  display: block;
  margin-top: 10px;
  font: italic 27px/.9 'Brush Script MT', 'Monotype Corsiva', 'Segoe Script', cursive;
  font-weight: 700;
  letter-spacing: .08em;
  text-shadow: 2px 2px 0 rgba(117, 48, 39, .14), 3px 5px 7px rgba(102, 45, 34, .22);
}
.archive-companion-bookmark {
  position: absolute;
  top: 54px;
  left: -14px;
  z-index: 20;
  width: 122px;
  line-height: 0;
  transform: rotate(-4deg);
  transform-origin: 50% 8%;
  filter: drop-shadow(4px 8px 8px rgba(104, 47, 31, .22));
  animation: archive-bookmark-sway 5.8s ease-in-out infinite;
  pointer-events: none;
}
.archive-companion-bookmark-image {
  display: block;
  width: 100%;
  height: auto;
  animation: archive-bookmark-glow 4.2s ease-in-out infinite;
}
.archive-companion-bookmark strong {
  position: absolute;
  top: 33%;
  left: 50%;
  color: #74352d;
  min-width: 28px;
  padding: 3px 8px 4px;
  border-radius: 999px;
  background: rgba(255, 244, 214, .8);
  font: 25px/.9 Georgia, serif;
  font-variant-numeric: lining-nums tabular-nums;
  text-align: center;
  text-shadow: 1px 2px 0 rgba(255, 243, 207, .95), 2px 4px 6px rgba(101, 43, 31, .34);
  box-shadow: 0 2px 5px rgba(101, 43, 31, .2);
  transform: translateX(-50%);
}
.archive-companion-bookmark::after {
  content: '✦';
  position: absolute;
  top: 17%;
  right: 22%;
  color: rgba(255, 235, 161, .95);
  font-size: 11px;
  line-height: 1;
  text-shadow: 0 0 7px rgba(225, 167, 72, .8);
  animation: archive-bookmark-spark 3.4s ease-in-out infinite;
}
.archive-single-stamp-button.archive-stamp-card {
  position: relative;
  z-index: 3;
  display: block;
  width: min(76%, 240px);
  aspect-ratio: 2 / 3;
  margin: 34px auto 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  transform: rotate(5deg);
  filter: drop-shadow(0 16px 12px rgba(90, 43, 29, .26)) drop-shadow(0 30px 28px rgba(93, 48, 31, .18));
  transition: transform .25s cubic-bezier(.2, .8, .2, 1), filter .25s ease;
  cursor: pointer;
}
.archive-single-stamp-button.archive-stamp-card:hover {
  transform: translateY(-3px) rotate(5deg);
}
.archive-single-stamp-button.archive-stamp-card:active {
  transform: translateY(1px) rotate(5deg) scale(.99);
}
.archive-single-stamp-button.archive-stamp-card:focus-visible {
  outline: 2px solid rgba(122, 51, 43, .72);
  outline-offset: 5px;
}
.archive-single-stamp {
  position: absolute;
  inset: 0;
  display: block;
  filter: none;
  animation: archive-night-stamp-float 4.8s ease-in-out infinite;
  background:
    radial-gradient(circle at 13% 18%, rgba(255, 224, 126, .95) 0 2px, transparent 3px),
    radial-gradient(circle at 87% 24%, rgba(255, 214, 101, .9) 0 2px, transparent 3px),
    radial-gradient(circle at 11% 78%, rgba(255, 224, 126, .88) 0 2px, transparent 3px),
    radial-gradient(circle at 89% 82%, rgba(255, 214, 101, .92) 0 2px, transparent 3px),
    radial-gradient(circle at 50% 9%, rgba(255, 235, 155, .9) 0 1.5px, transparent 2.5px);
}
.archive-single-stamp::before,
.archive-single-stamp::after {
  display: none;
}
.archive-gold-foil {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
}
.archive-gold-foil i {
  position: absolute;
  display: block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #ffe06a;
  box-shadow: 0 0 8px rgba(255, 197, 47, 1), 0 0 14px rgba(255, 224, 106, .72), 0 1px 2px rgba(117, 48, 31, .35);
  opacity: .42;
  animation: archive-gold-foil-fall 5.6s ease-in-out infinite;
}
.archive-gold-foil i:nth-child(1) { top: 13%; left: 18%; animation-delay: 0s; }
.archive-gold-foil i:nth-child(2) { top: 21%; left: 82%; width: 4px; height: 4px; animation-delay: .45s; }
.archive-gold-foil i:nth-child(3) { top: 31%; left: 9%; width: 4px; height: 4px; animation-delay: .9s; }
.archive-gold-foil i:nth-child(4) { top: 36%; left: 11%; width: 4px; height: 4px; animation-delay: 1.35s; }
.archive-gold-foil i:nth-child(5) { top: 43%; left: 89%; animation-delay: 1.8s; }
.archive-gold-foil i:nth-child(6) { top: 52%; left: 8%; width: 4px; height: 4px; animation-delay: 2.25s; }
.archive-gold-foil i:nth-child(7) { top: 58%; left: 16%; width: 4px; height: 4px; animation-delay: 2.7s; }
.archive-gold-foil i:nth-child(8) { top: 66%; left: 84%; animation-delay: 3.15s; }
.archive-gold-foil i:nth-child(9) { top: 72%; left: 91%; width: 4px; height: 4px; animation-delay: 3.6s; }
.archive-gold-foil i:nth-child(10) { top: 79%; left: 23%; width: 4px; height: 4px; animation-delay: 4.05s; }
.archive-gold-foil i:nth-child(11) { top: 84%; left: 13%; width: 4px; height: 4px; animation-delay: 4.5s; }
.archive-gold-foil i:nth-child(12) { top: 86%; left: 76%; width: 4px; height: 4px; animation-delay: 4.95s; }
.archive-single-stamp::before,
.archive-single-stamp::after {
  position: absolute;
  z-index: 4;
  color: rgba(255, 222, 135, .96);
  font-size: 11px;
  line-height: 1;
  pointer-events: none;
  text-shadow: 0 0 5px rgba(246, 181, 56, .86), 0 1px 2px rgba(117, 48, 31, .45);
  animation: none;
}
.archive-single-stamp::before {
  top: 17%;
  left: 17%;
  text-shadow:
    0 0 5px rgba(246, 181, 56, .86),
    1px 1px 2px rgba(117, 48, 31, .45),
    166px 54px 0 rgba(255, 213, 105, .9),
    26px 102px 0 rgba(255, 231, 144, .9),
    158px 148px 0 rgba(255, 226, 124, .92);
}
.archive-single-stamp::after {
  right: 18%;
  bottom: 16%;
  animation-delay: 1.6s;
}
.archive-single-avatar-crop {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: block;
  overflow: hidden;
  clip-path: ellipse(39.5% 40.5% at 50% 48%);
}
.archive-single-avatar {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.archive-single-stamp-frame {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: fill;
  pointer-events: none;
}
.archive-single-stamp .archive-stamp-badge-slot {
  position: absolute;
  right: -8%;
  bottom: 3%;
  z-index: 3;
  display: block;
  width: 42%;
  height: 28%;
  transform: rotate(-5deg);
  transform-origin: center;
  overflow: visible;
  pointer-events: none;
}
.archive-single-stamp .archive-stamp-badge {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: transparent;
}
.archive-single-stamp .archive-stamp-badge-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter:
    drop-shadow(0 3px 4px rgba(86, 42, 24, .3))
    drop-shadow(0 0 5px rgba(214, 163, 54, .34));
  animation: archive-stamp-metal-pulse 3.2s ease-in-out infinite;
}
.archive-single-stamp .archive-stamp-badge-slot::before {
  content: '✦';
  position: absolute;
  top: 19%;
  left: 25%;
  z-index: 4;
  color: rgba(255, 244, 190, .95);
  font-size: 16px;
  animation: archive-star-pulse 2.8s ease-in-out infinite;
}
.archive-single-stamp .archive-stamp-badge-slot::after {
  content: '';
  position: absolute;
  top: 55%;
  left: 66%;
  width: 4px;
  height: 4px;
  z-index: 4;
  opacity: .14;
  border-radius: 50%;
  background: rgba(255, 241, 174, .95);
  box-shadow: 0 0 7px rgba(255, 227, 125, .75);
  animation: archive-star-pulse 2.8s ease-in-out 1.1s infinite;
  pointer-events: none;
}
.archive-single-side-note {
  position: absolute;
  top: 155px;
  right: 0;
  z-index: 5;
  margin: 0;
  max-width: none;
  padding: 0;
  border: 0;
  border-radius: 16px;
  color: #6f3028;
  background: transparent;
  font-family: "huangkaihuaLawyerfont", "KaiTi", "STKaiti", serif !important;
  font-size: 14px;
  font-weight: normal;
  line-height: 1.45;
  letter-spacing: .14em;
  text-shadow: 0 1px rgba(255, 245, 217, .95), 0 2px 4px rgba(104, 50, 35, .2);
  writing-mode: vertical-rl;
  pointer-events: none;
}
.archive-single-ornament {
  position: relative;
  z-index: 4;
  width: min(68%, 230px);
  margin: -4px auto 0;
  transform: translate(-9%, -4px);
  line-height: 0;
  pointer-events: none;
}
.archive-single-ornament::before,
.archive-single-ornament::after {
  content: '✦';
  position: absolute;
  z-index: 2;
  color: rgba(164, 107, 48, .78);
  font-size: 13px;
  line-height: 1;
  pointer-events: none;
  animation: archive-star-pulse 2.8s ease-in-out infinite;
}
.archive-single-ornament::before { top: 22%; left: 8%; }
.archive-single-ornament::after { right: 10%; bottom: 18%; animation-delay: 1.1s; }
.archive-single-ornament-image {
  display: block;
  width: 130%;
  max-width: none;
  margin-left: -7%;
  margin: 0 auto;
  height: auto;
  opacity: .82;
  filter: contrast(1.12) saturate(.82) drop-shadow(0 8px 12px rgba(104, 50, 35, .3)) drop-shadow(0 0 7px rgba(189, 140, 66, .25));
  animation: archive-night-watermark-float 5.2s ease-in-out infinite;
}
.archive-single-footer {
  position: relative;
  z-index: 4;
  min-height: 42px;
  margin-top: -12px;
  padding: 0 8px 5px;
  text-align: center;
}
.archive-single-title {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  max-width: 100%;
  gap: 4px;
  color: #74352d;
  font-family: "huangkaihuaLawyerfont", "KaiTi", "STKaiti", serif !important;
  font-size: clamp(13px, 3.8vw, 16px);
  font-weight: normal;
  letter-spacing: .13em;
  white-space: nowrap;
  text-shadow: 0 1px rgba(255, 245, 217, .9), 0 3px 7px rgba(94, 43, 30, .13);
  animation: archive-single-title-reveal 1.6s ease-out both;
}
.archive-single-title::before,
.archive-single-title::after {
  content: '✦';
  display: inline-flex;
  align-items: center;
  width: 20px;
  height: 1px;
  color: #b27b32;
  background: linear-gradient(90deg, transparent, #b27b32 38%, #b27b32 62%, transparent);
  font-family: Georgia, serif;
  font-size: 9px;
  line-height: 1;
  text-shadow: 0 0 4px rgba(221, 169, 70, .65);
}
.archive-single-title::before { justify-content: flex-end; }
.archive-single-title::after { justify-content: flex-start; }
.archive-all-roles-shell {
  gap: 12px;
  padding: 8px 10px 24px;
}
.archive-all-roles-browser {
  display: grid;
  gap: 10px;
}
.archive-all-roles-browser .archive-card--collection {
  min-height: 86px;
  padding: 12px;
  border-color: rgba(151, 100, 47, .3);
  background: rgba(249, 236, 204, .78);
  box-shadow: 0 7px 16px rgba(104, 57, 29, .1);
}
.archive-all-roles-browser .archive-card--collection .card-avatar {
  width: 58px;
  height: 58px;
  flex-basis: 58px;
  margin-right: 13px;
  border: 1px solid rgba(151, 100, 47, .28);
  border-radius: 50%;
}
.archive-contact-management-bar {
  gap: 8px;
  align-items: center;
}
.archive-contact-management-title {
  min-width: 0;
  color: #713a30;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .04em;
  white-space: nowrap;
}
.archive-contact-management-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
  min-width: 0;
  margin-left: auto;
}
.archive-contact-selection-count {
  color: #806248;
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}
.archive-contact-management-button {
  min-height: 29px;
  padding: 4px 8px;
  border: 1px solid rgba(151, 100, 47, .42);
  border-radius: 999px;
  background: rgba(255, 247, 225, .82);
  color: #713a30;
  font: inherit;
  font-size: 10px;
  font-weight: 750;
  white-space: nowrap;
  cursor: pointer;
}
.archive-contact-management-button:active { transform: scale(.98); }
.archive-contact-management-button:disabled {
  opacity: .45;
  cursor: not-allowed;
}
.archive-contact-management-button.archive-contact-delete:not(:disabled) {
  border-color: rgba(158, 71, 57, .58);
  background: rgba(250, 228, 213, .9);
  color: #8c3d32;
}
.archive-contact-selection-indicator {
  display: inline-grid;
  place-items: center;
  flex: 0 0 23px;
  width: 23px;
  height: 23px;
  margin-right: 10px;
  border: 1px solid rgba(151, 100, 47, .4);
  border-radius: 50%;
  background: rgba(255, 250, 233, .68);
  color: #fff7df;
  font-size: 14px;
  font-weight: 800;
}
.archive-browse-card.is-contact-selected {
  border-color: rgba(122, 51, 43, .72);
  background: rgba(247, 222, 182, .95);
}
.archive-browse-card.is-contact-selected .archive-contact-selection-indicator {
  border-color: #7a332b;
  background: #7a332b;
  box-shadow: 0 2px 6px rgba(104, 57, 29, .16);
}
.archive-all-roles-shell:has(.archive-contact-management-bar) .archive-all-roles-browser .archive-browse-card {
  cursor: pointer;
}
.archive-all-roles-shell:has(.archive-contact-management-bar) .archive-all-roles-browser .archive-browse-card:active {
  transform: scale(.995);
}
.archive-contact-management-bar + .archive-all-roles-browser {
  margin-top: 2px;
}
.archive-manual-picker {
  position: relative;
  z-index: 8;
  margin-top: 4px;
  padding: 10px 5px 0;
  border-top-color: rgba(151, 100, 47, .26);
}
.archive-manual-picker summary { color: #713a30; }
.archive-manual-picker input { accent-color: #7a332b; }

@keyframes archive-star-pulse {
  0%, 100% { opacity: .14; }
  42% { opacity: .14; }
  56% { opacity: 1; }
  72% { opacity: .22; }
}
@keyframes archive-bookmark-sway {
  0%, 100% { transform: rotate(-4deg); }
  50% { transform: rotate(-1.8deg) translateY(1px); }
}
@keyframes archive-bookmark-glow {
  0%, 100% { filter: brightness(.98) drop-shadow(0 0 0 rgba(214, 157, 61, 0)); }
  52% { filter: brightness(1.08) drop-shadow(0 0 7px rgba(214, 157, 61, .26)); }
}
@keyframes archive-bookmark-spark {
  0%, 100% { opacity: .18; transform: scale(.72); }
  52% { opacity: 1; transform: scale(1); }
  72% { opacity: .2; transform: scale(.72); }
}
@keyframes archive-frame-gold-spark {
  0%, 100% { opacity: .18; transform: scale(.72); }
  48% { opacity: .98; transform: scale(1.12); }
  66% { opacity: .28; transform: scale(.82); }
}
@keyframes archive-gold-foil-fall {
  0%, 18% { opacity: .36; }
  36% { opacity: 1; }
  54%, 100% { opacity: .42; }
}
@keyframes archive-single-slide-from-right {
  from { opacity: 0; transform: translate3d(32px, 0, 0); }
  to { opacity: 1; transform: translate3d(0, 0, 0); }
}
@keyframes archive-single-slide-from-left {
  from { opacity: 0; transform: translate3d(-32px, 0, 0); }
  to { opacity: 1; transform: translate3d(0, 0, 0); }
}
@keyframes archive-single-title-reveal {
  from { opacity: 0; transform: translateY(7px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes archive-night-stamp-float {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-2px) scale(1.008); }
}
@keyframes archive-night-watermark-float {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-1px) scale(1.012); }
}
.archive-single-stage--slide-from-right,
.archive-single-stage--slide-from-left {
  animation-duration: .38s;
  animation-timing-function: cubic-bezier(.22, .75, .25, 1);
  animation-fill-mode: both;
  will-change: transform, opacity;
}
.archive-single-stage--slide-from-right { animation-name: archive-single-slide-from-right; }
.archive-single-stage--slide-from-left { animation-name: archive-single-slide-from-left; }
@media (prefers-reduced-motion: reduce) {
  .archive-single-stage--slide-from-right,
  .archive-single-stage--slide-from-left { animation: none; }
  #win-archive[data-archive-theme="night"] .archive-single-title { animation: none; }
  #win-archive[data-archive-theme="night"] .archive-single-stamp,
  #win-archive[data-archive-theme="night"] .archive-single-ornament-image { animation: none; }
}
@keyframes archive-stamp-metal-pulse {
  0%, 100% { filter: brightness(.96) contrast(1) drop-shadow(0 3px 4px rgba(86, 42, 24, .3)) drop-shadow(0 0 5px rgba(214, 163, 54, .34)); }
  42% { filter: brightness(1.08) contrast(1.05) drop-shadow(0 4px 6px rgba(86, 42, 24, .32)) drop-shadow(0 0 8px rgba(255, 207, 75, .54)); }
  62% { filter: brightness(1.16) contrast(1.08) drop-shadow(0 5px 7px rgba(86, 42, 24, .34)) drop-shadow(0 0 10px rgba(255, 222, 112, .62)); }
  78% { filter: brightness(1.04) contrast(1.03) drop-shadow(0 4px 6px rgba(86, 42, 24, .31)) drop-shadow(0 0 7px rgba(220, 171, 57, .46)); }
}
@keyframes archive-stamp-metal-pulse-night {
  0%, 100% { filter: brightness(.94) contrast(1) drop-shadow(0 3px 4px rgba(0, 0, 0, .42)) drop-shadow(0 0 5px rgba(198, 207, 222, .32)); }
  42% { filter: brightness(1.06) contrast(1.04) drop-shadow(0 4px 6px rgba(0, 0, 0, .48)) drop-shadow(0 0 8px rgba(224, 231, 242, .52)); }
  62% { filter: brightness(1.12) contrast(1.07) drop-shadow(0 5px 7px rgba(0, 0, 0, .5)) drop-shadow(0 0 10px rgba(230, 236, 246, .62)); }
  78% { filter: brightness(1.02) contrast(1.03) drop-shadow(0 4px 6px rgba(0, 0, 0, .45)) drop-shadow(0 0 7px rgba(207, 216, 231, .44)); }
}
@media (prefers-reduced-motion: reduce) {
  .archive-single-stamp-button.archive-stamp-card,
  .archive-single-stamp .archive-stamp-badge-image,
  .archive-single-stamp .archive-stamp-badge-slot::before,
  .archive-single-stamp .archive-stamp-badge-slot::after {
    animation: none;
    transition: none;
  }
  .archive-companion-bookmark,
  .archive-companion-bookmark-image,
  .archive-companion-bookmark::after,
  .archive-gold-foil i { animation: none; }
}
@media (max-width: 360px) {
  .archive-single-stage,
  .archive-single-page { min-height: 540px; }
  .archive-single-stamp-button.archive-stamp-card { width: min(74%, 218px); margin-top: 34px; }
  .archive-companion-stamp { top: 66px; transform: rotate(-7deg); transform-origin: left center; }
  .archive-companion-bookmark { top: 52px; left: -12px; width: 108px; }
  .archive-companion-bookmark strong { top: 33%; font-size: 23px; }
  .archive-single-side-note { top: 145px; right: 0; font-size: 12px; }
  .archive-single-ornament { width: min(66%, 205px); }
  .archive-single-footer { margin-top: -12px; }
  .archive-single-title { gap: 3px; font-size: 15px; letter-spacing: .04em; }
  .archive-single-title::before,
  .archive-single-title::after { width: 14px; }
  .archive-manual-picker-list { grid-template-columns: 1fr; }
}
@media (max-width: 360px) {
  #win-archive > .archive-header { gap: 4px; }
  .archive-header-actions { min-width: 76px; gap: 0; }
  .archive-header-actions .btn-icon { width: 36px; height: 36px; flex-basis: 36px; }
  .archive-collection-intro h4 { font-size: 20px; }
  .archive-card--collection { min-height: 96px; padding: 14px 12px; }
  .archive-card--collection .card-avatar { width: 64px; height: 64px; flex-basis: 64px; margin-right: 14px; }
}

/* Archive 角色档案展示页：复用 Theme System，不改变旧列表和编辑表单样式 */
.archive-profile-panel {
  position: absolute;
  inset: 0;
  z-index: 1200;
  display: flex;
  flex-direction: column;
  background: var(--theme-bg-page);
  transform: translateX(100%);
  visibility: hidden;
  pointer-events: none;
  transition: transform 0.3s cubic-bezier(0.1, 0.9, 0.2, 1), visibility 0s linear 0.3s;
}
.archive-profile-panel.active {
  transform: translateX(0);
  visibility: visible;
  pointer-events: auto;
  transition: transform 0.3s cubic-bezier(0.1, 0.9, 0.2, 1), visibility 0s linear 0s;
}
.archive-profile--reading .archive-profile-content {
  padding-top: 24px;
}
.archive-profile-header {
  position: relative;
  height: calc(var(--theme-header-height) + var(--phone-safe-top, 0px));
  min-height: calc(var(--theme-header-height) + var(--phone-safe-top, 0px));
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--phone-safe-top, 0px) var(--theme-page-padding-x) 0;
  box-sizing: border-box;
  background: var(--theme-bg-card);
  border-bottom: 1px solid var(--theme-border);
}
.archive-profile-header h3 {
  position: absolute;
  top: calc(var(--phone-safe-top, 0px) + (var(--theme-header-height) / 2));
  left: 50%;
  transform: translate(-50%, -50%);
  margin: 0;
  color: var(--theme-text-primary);
  font-size: var(--theme-font-size-page-title);
  font-weight: var(--theme-font-weight-bold);
}
.archive-profile-header-spacer { width: 36px; }
.archive-profile-content {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: var(--theme-space-5) var(--theme-page-padding-x) calc(var(--theme-space-6) + env(safe-area-inset-bottom, 0px));
  scrollbar-width: none;
}
.archive-profile-content::-webkit-scrollbar { display: none; }
.archive-profile-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--theme-space-2);
  padding: 0 0 24px;
  text-align: center;
}
.archive-profile-avatar {
  width: 112px;
  height: 112px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--theme-bg-card);
  box-shadow: var(--theme-shadow-sm);
}
.archive-profile-name {
  margin: var(--theme-space-1) 0 0;
  color: var(--theme-text-primary);
  font-size: 22px;
  line-height: 1.25;
  font-weight: var(--theme-font-weight-bold);
}
.archive-profile-remark {
  max-width: 320px;
  color: var(--theme-text-secondary);
  font-size: var(--theme-font-size-secondary);
  line-height: var(--theme-line-height-body);
  white-space: pre-wrap;
}
.archive-profile-actions {
  display: flex;
  flex-direction: column;
  gap: var(--theme-space-2);
  margin-bottom: var(--theme-space-5);
}
.archive-profile-actions .btn { min-width: 0; padding: 10px 14px; font-size: var(--theme-font-size-body); }
.archive-profile-actions--reading > .btn-primary { min-height: 40px; }
.archive-profile-more {
  border: 1px solid var(--theme-border);
  border-radius: var(--theme-button-radius);
  background: var(--theme-bg-card);
}
.archive-profile-more-label {
  padding: 10px 14px;
  color: var(--theme-text-secondary);
  font-size: var(--theme-font-size-secondary);
  text-align: center;
  border-bottom: 1px solid var(--theme-border);
}
.archive-profile-secondary-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--theme-space-2);
  padding: 0 var(--theme-space-2) var(--theme-space-2);
}
.archive-profile-secondary-actions .btn { font-size: var(--theme-font-size-secondary); }
.archive-profile-section {
  margin-bottom: var(--theme-space-3);
  padding: var(--theme-space-4);
  background: var(--theme-bg-card);
  border: 1px solid var(--theme-border);
  border-radius: var(--theme-card-radius);
  box-shadow: var(--theme-shadow-sm);
}
.archive-profile-section h4 {
  margin: 0 0 var(--theme-space-2);
  color: var(--theme-text-primary);
  font-size: var(--theme-font-size-section-title);
  font-weight: var(--theme-font-weight-bold);
}
.archive-profile-section p {
  margin: 0;
  color: var(--theme-text-secondary);
  font-size: var(--theme-font-size-body);
  line-height: 1.7;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.archive-profile-advanced {
  color: var(--theme-text-primary);
  font-size: var(--theme-font-size-secondary);
}
.archive-profile-advanced summary {
  cursor: pointer;
  color: var(--theme-text-primary);
  font-size: var(--theme-font-size-section-title);
  font-weight: var(--theme-font-weight-bold);
}
.archive-profile-advanced dl { margin: var(--theme-space-3) 0 0; }
.archive-profile-advanced dt { margin-top: var(--theme-space-2); color: var(--theme-text-secondary); font-size: var(--theme-font-size-caption); }
.archive-profile-reading-content { margin-top: var(--theme-space-3); }
.archive-profile-reading-section {
  padding: var(--theme-space-3) 0;
  border-top: 1px solid var(--theme-border);
}
.archive-profile-reading-section:first-child { padding-top: 0; border-top: 0; }
.archive-profile-reading-section:last-child { padding-bottom: 0; }
.archive-profile-reading-section h4 {
  margin: 0 0 var(--theme-space-2);
  color: var(--theme-text-primary);
  font-size: var(--theme-font-size-section-title);
  font-weight: var(--theme-font-weight-bold);
}
.archive-profile-reading-section p {
  margin: 0;
  color: var(--theme-text-secondary);
  font-size: var(--theme-font-size-body);
  line-height: 1.7;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* Archive 编辑页分区布局：复用主题变量，不改变表单字段语义。 */
/* 角色卡背面：图片、名称、原始内容，避免把资料拆成数据库字段卡片。 */
.archive-profile-content {
  max-width: 560px;
  margin: 0 auto;
}
.archive-profile-hero {
  gap: var(--theme-space-3);
  padding-bottom: 28px;
}
.archive-profile-avatar {
  width: 148px;
  height: 148px;
  border-radius: 12px;
  border: 2px solid var(--theme-border);
  box-shadow: none;
}
.archive-profile-avatar-frame {
  width: 148px;
  height: 148px;
  overflow: hidden;
  border: 2px solid var(--theme-border);
  border-radius: 12px;
}
.archive-profile-avatar-frame .archive-profile-avatar {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  transition: transform .08s linear;
}
.archive-profile-name { font-size: 24px; letter-spacing: .01em; }
.archive-profile-original {
  margin: 0 0 var(--theme-space-5);
  padding: 22px 2px 0;
  border-top: 1px solid color-mix(in srgb, var(--theme-border) 72%, transparent);
}
.archive-profile-original-label {
  margin-bottom: 10px;
  color: var(--theme-text-secondary);
  font-size: var(--theme-font-size-caption);
  font-weight: var(--theme-font-weight-bold);
  letter-spacing: .08em;
  text-align: center;
}
.archive-profile-original-preview,
.archive-profile-original-full {
  margin: 0;
  color: var(--theme-text-primary);
  font-size: var(--theme-font-size-body);
  line-height: 1.8;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.archive-profile-original-preview {
  display: -webkit-box;
  max-height: 12.6em;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 7;
}
.archive-profile-original-full { padding-top: 14px; }
.archive-profile-advanced {
  margin: 0 0 var(--theme-space-5);
  padding: 0 2px;
  color: var(--theme-text-secondary);
  font-size: var(--theme-font-size-secondary);
}
.archive-profile-advanced summary {
  display: block;
  cursor: pointer;
  list-style: none;
}
.archive-profile-advanced summary::-webkit-details-marker { display: none; }
.archive-profile-original-label {
  display: block;
  margin-bottom: 10px;
  color: var(--theme-text-secondary);
  font-size: var(--theme-font-size-caption);
  font-weight: var(--theme-font-weight-bold);
  letter-spacing: .08em;
  text-align: center;
}
.archive-profile-original-preview {
  display: -webkit-box;
  max-height: 12.6em;
  margin: 0;
  overflow: hidden;
  color: var(--theme-text-primary);
  font-size: var(--theme-font-size-body);
  line-height: 1.8;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 7;
}
.archive-profile-advanced[open] .archive-profile-original-preview { display: none; }
.archive-profile-expand-label {
  display: block;
  width: fit-content;
  margin: 14px auto 0;
  padding: 6px 0;
  color: var(--theme-text-secondary);
  font-size: var(--theme-font-size-secondary);
  font-weight: var(--theme-font-weight-medium);
}
.archive-profile-advanced[open] .archive-profile-expand-label::after { content: '收起'; }
.archive-profile-advanced[open] .archive-profile-expand-label { font-size: 0; }
.archive-profile-advanced[open] .archive-profile-expand-label::after { font-size: var(--theme-font-size-secondary); }
.archive-profile-original-full {
  margin: 14px 0 0;
  padding-top: 14px;
  border-top: 1px solid var(--theme-border);
  color: var(--theme-text-primary);
  font-size: var(--theme-font-size-body);
  line-height: 1.8;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* 详情介绍的展开入口保持在标题行，展开后可直接从顶部收起。 */
.archive-profile-advanced summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px 12px;
  padding: 0;
}
.archive-profile-advanced summary:focus-visible {
  outline: 2px solid var(--theme-accent);
  outline-offset: 4px;
  border-radius: var(--theme-button-radius);
}
.archive-profile-advanced .archive-profile-original-label {
  grid-column: 1;
  grid-row: 1;
  margin: 0;
  text-align: left;
}
.archive-profile-original-label,
.archive-profile-more-label {
  font-size: var(--theme-font-size-section-title);
  font-weight: var(--theme-font-weight-bold);
}
.archive-profile-more-label {
  text-align: left;
}
.archive-profile-advanced .archive-profile-expand-label {
  grid-column: 2;
  grid-row: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  box-sizing: border-box;
  margin: 0;
  padding: 6px 11px;
  border: 1px solid color-mix(in srgb, var(--theme-accent) 48%, var(--theme-border));
  border-radius: 999px;
  background: color-mix(in srgb, var(--theme-accent) 10%, var(--theme-bg-card));
  color: var(--theme-text-primary);
  box-shadow: 0 2px 6px color-mix(in srgb, var(--theme-text-primary) 10%, transparent);
  font-size: var(--theme-font-size-secondary);
  font-weight: var(--theme-font-weight-medium);
  line-height: 1.2;
  white-space: nowrap;
}
.archive-profile-advanced .archive-profile-original-preview {
  grid-column: 1 / -1;
  grid-row: 2;
}
.archive-profile-advanced .archive-profile-expand-label::after { display: none; }
.archive-profile-advanced[open] .archive-profile-expand-label {
  font-size: 0;
}
.archive-profile-advanced[open] .archive-profile-expand-label::after {
  display: block;
  content: '收起';
  font-size: var(--theme-font-size-secondary);
}
.archive-profile-actions .btn {
  min-height: 42px;
  border-radius: var(--theme-button-radius);
  box-shadow: 0 2px 7px color-mix(in srgb, var(--theme-text-primary) 10%, transparent);
}
.archive-profile-secondary-actions .btn {
  min-height: 38px;
  border-radius: var(--theme-button-radius);
}
.archive-profile-actions .btn:focus-visible,
.archive-profile-secondary-actions .btn:focus-visible {
  outline: 2px solid var(--theme-accent);
  outline-offset: 2px;
}
.archive-profile-extension {
  display: none;
  margin: var(--theme-space-6) 0;
  padding: var(--theme-space-5) 0;
  border-top: 1px solid color-mix(in srgb, var(--theme-border) 72%, transparent);
}

.archive-profile-extension:not(:empty) {
  display: block;
}
.archive-profile-more {
  border: 0;
  border-radius: 0;
  background: transparent;
}
.archive-profile-more-label {
  padding: 0 0 10px;
  border-bottom: 1px solid var(--theme-border);
  color: var(--theme-text-secondary);
  font-size: var(--theme-font-size-section-title);
  font-weight: var(--theme-font-weight-bold);
  text-align: left;
}
.archive-profile-secondary-actions {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 10px 0 0;
}
.archive-profile-secondary-actions .btn { padding: 9px 8px; }
.archive-image-adjust-overlay {
  position: absolute;
  inset: 0;
  z-index: 1400;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
  background: rgba(15, 23, 42, .38);
  opacity: 0;
  pointer-events: none;
  transition: opacity .24s ease;
}
.archive-image-adjust-overlay.active { opacity: 1; pointer-events: auto; }
.archive-image-adjust-modal {
  width: 100%;
  max-height: 90%;
  overflow-y: auto;
  border-radius: 24px 24px 0 0;
  background: var(--theme-bg-page);
  transform: translateY(20px);
  transition: transform .26s cubic-bezier(.2, .8, .2, 1);
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--theme-border) 72%, transparent) transparent;
}
.archive-image-adjust-overlay.active .archive-image-adjust-modal { transform: translateY(0); }
.archive-image-adjust-modal::-webkit-scrollbar { width: 5px; }
.archive-image-adjust-modal::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: color-mix(in srgb, var(--theme-border) 72%, transparent);
}
.archive-image-adjust-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--theme-border);
  background: var(--theme-bg-card);
}
.archive-image-adjust-header h4 { margin: 0; color: var(--theme-text-primary); font-size: var(--theme-font-size-section-title); }
.archive-image-adjust-body { padding: 20px 18px; }
.archive-image-adjust-preview {
  width: min(72vw, 260px);
  margin: 0 auto 22px;
}
.archive-image-adjust-stamp-card {
  width: 100%;
  aspect-ratio: auto;
  cursor: default;
  animation: none;
  transform: none;
}
.archive-image-adjust-stamp-card .archive-card-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 2 / 3;
}
.archive-image-adjust-stamp-card .archive-stamp-frame {
  position: absolute;
  inset: 0;
  --archive-stamp-frame-ratio: 2 / 3;
  width: 100%;
  height: auto;
  aspect-ratio: var(--archive-stamp-frame-ratio);
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: transparent;
}
.archive-image-adjust-stamp-card .archive-stamp-frame::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 2;
  background: url('assets/archive/frame/3.png') center / 100% 100% no-repeat;
  pointer-events: none;
}
.archive-image-adjust-stamp-card .archive-stamp-frame::after { display: none; }
.archive-image-adjust-stamp-card .archive-stamp-image {
  position: absolute;
  inset: 0;
  z-index: 1;
  overflow: hidden;
  clip-path: ellipse(39.5% 40.5% at 50% 48%);
}
.archive-image-adjust-stamp-card .archive-stamp-name { font-size: 10px; }
.archive-image-adjust-preview--avatar .archive-profile-avatar-frame {
  width: min(72vw, 260px);
  height: auto;
  aspect-ratio: 1;
  margin: 0 auto;
}
.archive-image-adjust-preview--avatar .archive-profile-avatar {
  width: 100%;
  height: 100%;
}
.archive-image-adjust-preview .archive-stamp-image img { transition: transform .08s linear; }
.archive-image-adjust-preview .archive-profile-avatar { transition: transform .08s linear; }
.archive-image-adjust-control {
  display: block;
  margin-top: 16px;
  color: var(--theme-text-secondary);
  font-size: var(--theme-font-size-secondary);
}
.archive-image-adjust-control span { display: block; margin-bottom: 7px; }
.archive-image-adjust-control input { width: 100%; accent-color: var(--theme-accent); }
.archive-image-adjust-actions {
  display: flex;
  gap: 10px;
  padding: 0 18px 20px;
}
.archive-image-adjust-actions .btn { flex: 1; }
#archive-form-overlay {
  align-items: flex-end;
  transition: opacity .24s ease;
}
#archive-form-overlay .modal {
  max-height: 88%;
  border-top-left-radius: 24px;
  border-top-right-radius: 24px;
  transform: translateY(20px);
  transition: transform .26s cubic-bezier(.2, .8, .2, 1);
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--theme-border) 72%, transparent) transparent;
}
#archive-form-overlay.active .modal { transform: translateY(0); }
#archive-form-overlay .modal::-webkit-scrollbar { width: 5px; }
#archive-form-overlay .modal::-webkit-scrollbar-track { background: transparent; }
#archive-form-overlay .modal::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: color-mix(in srgb, var(--theme-border) 72%, transparent);
}
.archive-profile-panel {
  transform: translateX(100%);
  opacity: 1;
  transition: transform .3s cubic-bezier(.1, .9, .2, 1), visibility 0s linear .3s;
}
.archive-profile-panel.active {
  transform: translateX(0);
  transition: transform .3s cubic-bezier(.1, .9, .2, 1), visibility 0s linear 0s;
}
.archive-profile-content {
  animation: archive-profile-arrive .28s ease both;
}
@keyframes archive-profile-arrive {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
.archive-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 280px;
  gap: 10px;
  padding: 32px 20px;
  color: var(--theme-text-secondary);
  text-align: center;
}
.archive-empty-state strong {
  color: var(--theme-text-primary);
  font-size: var(--theme-font-size-section-title);
}
.archive-empty-state span {
  max-width: 230px;
  font-size: var(--theme-font-size-secondary);
  line-height: 1.6;
}
@media (prefers-reduced-motion: reduce) {
  .archive-profile-panel,
  .archive-profile-panel.active,
  .archive-profile-content { animation: none; transition: none; }
}

.archive-edit-form-body { padding: var(--theme-space-4); background: var(--theme-bg-page); }
.archive-edit-section,
.archive-danger-section { margin: 0 0 var(--theme-space-4); padding: var(--theme-space-4); border: 1px solid var(--theme-border); border-radius: var(--theme-card-radius); background: var(--theme-bg-card); }
.archive-edit-section-heading { color: var(--theme-text-primary); font-size: var(--theme-font-size-section-title); font-weight: var(--theme-font-weight-bold); }
.archive-edit-section-content { margin-top: var(--theme-space-3); }
.archive-edit-section .form-group { margin-bottom: var(--theme-space-3); }
.archive-edit-section .form-group:last-child { margin-bottom: 0; }
.archive-edit-section label { color: var(--theme-text-secondary); font-size: var(--theme-font-size-secondary); font-weight: var(--theme-font-weight-medium); }
.archive-edit-section input,
.archive-edit-section textarea { box-sizing: border-box; width: 100%; font-family: var(--theme-font-family); }
.archive-edit-section textarea { min-height: 92px; resize: vertical; line-height: var(--theme-line-height-body); }
.archive-edit-section summary { cursor: pointer; color: var(--theme-text-primary); font-size: var(--theme-font-size-section-title); font-weight: var(--theme-font-weight-bold); list-style: none; }
.archive-edit-section summary::-webkit-details-marker { display: none; }
.archive-edit-section summary::after { content: "＋"; float: right; color: var(--theme-text-secondary); font-weight: var(--theme-font-weight-regular); }
.archive-edit-section[open] summary::after { content: "－"; }
.archive-edit-help { margin: var(--theme-space-2) 0 var(--theme-space-2); color: var(--theme-text-secondary); font-size: var(--theme-font-size-caption); }
.archive-edit-button-row { display: flex; gap: var(--theme-space-2); }
.archive-edit-button-row .btn { flex: 1; }
.archive-lockface-preview { display: flex; flex-wrap: wrap; gap: var(--theme-space-2); min-height: 48px; margin-bottom: var(--theme-space-2); }
.archive-edit-link-row { display: flex; align-items: center; justify-content: space-between; gap: var(--theme-space-3); padding-top: var(--theme-space-3); border-top: 1px solid var(--theme-border); }
.archive-edit-link-row div { display: grid; gap: 2px; }
.archive-edit-link-row span { color: var(--theme-text-secondary); font-size: var(--theme-font-size-caption); }
.archive-import-info { display: grid; gap: var(--theme-space-2); margin-top: var(--theme-space-3); }
.archive-import-info-row { display: flex; justify-content: space-between; gap: var(--theme-space-3); color: var(--theme-text-secondary); font-size: var(--theme-font-size-secondary); }
.archive-import-info-row strong { max-width: 68%; color: var(--theme-text-primary); font-weight: var(--theme-font-weight-medium); text-align: right; overflow-wrap: anywhere; }
.archive-danger-section { border-color: color-mix(in srgb, var(--theme-danger) 30%, var(--theme-border)); }
.archive-danger-section .archive-edit-section-heading { margin-bottom: var(--theme-space-3); color: var(--theme-danger); }
.archive-danger-section .btn-danger-outline { display: none; }
.archive-profile-advanced dd { margin: 2px 0 0; color: var(--theme-text-primary); line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.archive-profile-empty { color: var(--theme-text-secondary); font-size: var(--theme-font-size-body); text-align: center; padding: var(--theme-space-6) 0; }

/* Archive 编辑空间：延续收藏卡的复古红、羊皮纸与金色线条。 */
#archive-form-overlay {
  --archive-edit-red: #762f29;
  --archive-edit-red-dark: #4d211e;
  --archive-edit-parchment: #f1e1bd;
  --archive-edit-paper: #fff5dc;
  --archive-edit-gold: #bd8c42;
  --archive-edit-ink: #4d3026;
  background: var(--archive-edit-red-dark);
  transition: opacity .38s ease;
}
#archive-form-overlay .modal {
  max-height: 92%;
  padding-bottom: 0;
  overflow: hidden auto;
  border: 1px solid var(--archive-edit-gold);
  border-bottom: 0;
  border-radius: 26px 26px 0 0;
  background: var(--archive-edit-parchment);
  color: var(--archive-edit-ink);
  box-shadow: none;
  transform: translateY(42px) scale(.985);
  transform-origin: center bottom;
  transition: transform .48s cubic-bezier(.16, 1, .3, 1);
}
#archive-form-overlay.active .modal { transform: translateY(0) scale(1); }
#archive-form-overlay .modal-header {
  position: sticky;
  top: 0;
  z-index: 3;
  min-height: 58px;
  box-sizing: border-box;
  border-bottom: 1px solid var(--archive-edit-gold);
  background: var(--archive-edit-red);
  color: #fff3d4;
}
#archive-form-overlay .modal-header h4 {
  position: absolute;
  left: 50%;
  top: 50%;
  max-width: calc(100% - 112px);
  margin: 0;
  color: #fff3d4;
  letter-spacing: .08em;
  text-align: center;
  transform: translate(-50%, -50%);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#archive-form-overlay .modal-header .btn-icon { color: #fff3d4; }
#archive-form-overlay .archive-edit-form-body {
  background:
    linear-gradient(rgba(255, 248, 226, .58), rgba(241, 225, 189, .82)),
    url('assets/archive/background/archive-bg .png') center / cover fixed;
}
#archive-form-overlay .archive-edit-section,
#archive-form-overlay .archive-danger-section {
  border-color: color-mix(in srgb, var(--archive-edit-gold) 72%, #fff0cd);
  background: rgba(255, 245, 220, .94);
  box-shadow: inset 0 0 0 1px rgba(118, 47, 41, .08);
}
#archive-form-overlay .archive-edit-section-heading,
#archive-form-overlay .archive-edit-section summary { color: var(--archive-edit-red); }
#archive-form-overlay .archive-edit-section label,
#archive-form-overlay .archive-edit-help,
#archive-form-overlay .archive-edit-link-row span { color: #785b45; }
#archive-form-overlay .archive-edit-section input,
#archive-form-overlay .archive-edit-section textarea {
  border-color: rgba(151, 101, 49, .48);
  background: var(--archive-edit-paper);
  color: var(--archive-edit-ink);
}
#archive-form-overlay .archive-edit-section input:focus,
#archive-form-overlay .archive-edit-section textarea:focus {
  border-color: var(--archive-edit-red);
  outline: 2px solid rgba(189, 140, 66, .22);
}
#archive-form-overlay .avatar-preview-circle {
  border-color: var(--archive-edit-gold);
  background: var(--archive-edit-paper);
}
#archive-form-overlay .avatar-preview-circle svg { color: var(--archive-edit-red); }
#archive-form-overlay .archive-edit-link-row { border-top-color: rgba(189, 140, 66, .42); }
#archive-form-overlay .form-actions {
  position: sticky;
  bottom: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 12px 16px max(12px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--archive-edit-gold);
  background: #ead5a8;
}
#archive-form-overlay .form-actions .btn { min-width: 76px; }
#archive-form-overlay .btn-primary {
  border-color: var(--archive-edit-red);
  background: var(--archive-edit-red);
  color: #fff4d8;
}
#archive-form-overlay .btn-outline {
  border-color: var(--archive-edit-gold);
  background: var(--archive-edit-paper);
  color: var(--archive-edit-red);
}
#archive-form-overlay .archive-danger-section { border-color: rgba(118, 47, 41, .4); }
#archive-form-overlay .archive-danger-section .archive-edit-section-heading { color: var(--archive-edit-red); }

#archive-form-overlay .archive-voice-choice-group {
  display: grid;
  gap: 10px;
  margin-top: 8px;
}
#archive-form-overlay .archive-voice-choice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 56px;
  padding: 11px 13px;
  border: 1px solid rgba(151, 101, 49, .34);
  border-radius: 14px;
  background: rgba(255, 245, 220, .54);
  color: #785b45;
  text-align: left;
  cursor: pointer;
  transition: border-color .18s ease, background-color .18s ease, opacity .18s ease, transform .18s ease;
}
#archive-form-overlay .archive-voice-choice:not(.is-active) { opacity: .62; }
#archive-form-overlay .archive-voice-choice.is-active {
  border-color: var(--archive-edit-red);
  background: var(--archive-edit-paper);
  box-shadow: 0 3px 10px rgba(118, 47, 41, .08);
  opacity: 1;
}
#archive-form-overlay .archive-voice-choice:active { transform: scale(.99); }
#archive-form-overlay .archive-voice-choice-copy { display: grid; gap: 4px; min-width: 0; }
#archive-form-overlay .archive-voice-choice-copy strong { font-size: 13px; line-height: 1.35; }
#archive-form-overlay .archive-voice-choice-copy small { color: #785b45; font-size: 11px; line-height: 1.45; }
#archive-form-overlay .archive-voice-choice-mark {
  flex: 0 0 22px;
  width: 22px;
  height: 22px;
  border: 1px solid currentColor;
  border-radius: 50%;
  color: transparent;
  font-size: 14px;
  line-height: 20px;
  text-align: center;
}
#archive-form-overlay .archive-voice-choice.is-active .archive-voice-choice-mark {
  color: var(--archive-edit-red);
  background: #fff5dc;
}
#archive-form-overlay .archive-voice-choice-panel { padding: 0 4px; }
#archive-form-overlay .archive-voice-choice-panel[hidden] { display: none; }
#archive-form-overlay .archive-voice-choice-panel select,
#archive-form-overlay .archive-voice-choice-panel input { margin: 0; }
#archive-form-overlay .archive-voice-choice-panel select[hidden] { display: none; }
#archive-form-overlay .archive-voice-empty {
  display: grid;
  gap: 5px;
  padding: 12px;
  border: 1px dashed rgba(151, 101, 49, .42);
  border-radius: 12px;
  background: rgba(255, 245, 220, .46);
  color: #785b45;
  font-size: 11px;
  line-height: 1.45;
}
#archive-form-overlay .archive-voice-empty strong { color: var(--archive-edit-red); font-size: 12px; }
#archive-form-overlay .archive-voice-empty .btn { justify-self: start; margin-top: 4px; padding: 8px 12px; font-size: 11px; }
#archive-form-overlay .archive-voice-empty[hidden] { display: none; }

/* Archive 编辑表单的夜间模式：整张表单一起切换，避免内容区仍停留在白天羊皮纸。 */
html[data-archive-theme="night"] #archive-form-overlay {
  --archive-edit-red: #343942;
  --archive-edit-red-dark: #17191e;
  --archive-edit-parchment: #202329;
  --archive-edit-paper: #292c33;
  --archive-edit-gold: rgba(210, 216, 228, .34);
  --archive-edit-ink: #e3e6ec;
  background: var(--archive-edit-red-dark);
}
html[data-archive-theme="night"] #archive-form-overlay .modal {
  background: var(--archive-edit-parchment);
  color: var(--archive-edit-ink);
  border-color: var(--archive-edit-gold);
}
html[data-archive-theme="night"] #archive-form-overlay .modal-header {
  background: #2a2d34;
  border-bottom-color: var(--archive-edit-gold);
  color: var(--archive-edit-ink);
}
html[data-archive-theme="night"] #archive-form-overlay .modal-header h4,
html[data-archive-theme="night"] #archive-form-overlay .modal-header .btn-icon {
  color: #eef1f6;
}
html[data-archive-theme="night"] #archive-form-overlay .archive-edit-form-body {
  background:
    linear-gradient(rgba(23, 25, 30, .94), rgba(23, 25, 30, .98)),
    url('assets/archive/background/archive-bg .png') center / cover fixed;
}
html[data-archive-theme="night"] #archive-form-overlay .archive-edit-section,
html[data-archive-theme="night"] #archive-form-overlay .archive-danger-section {
  border-color: rgba(210, 216, 228, .26);
  background: #24272d;
  box-shadow: inset 0 0 0 1px rgba(210, 216, 228, .04);
}
html[data-archive-theme="night"] #archive-form-overlay .archive-edit-section-heading,
html[data-archive-theme="night"] #archive-form-overlay .archive-edit-section summary,
html[data-archive-theme="night"] #archive-form-overlay .archive-edit-section label,
html[data-archive-theme="night"] #archive-form-overlay .archive-edit-help,
html[data-archive-theme="night"] #archive-form-overlay .archive-edit-link-row span,
html[data-archive-theme="night"] #archive-form-overlay .archive-import-info,
html[data-archive-theme="night"] #archive-form-overlay .archive-import-info-row {
  color: #e3e6ec;
}
html[data-archive-theme="night"] #archive-form-overlay .archive-edit-section input,
html[data-archive-theme="night"] #archive-form-overlay .archive-edit-section textarea,
html[data-archive-theme="night"] #archive-form-overlay .archive-edit-section select,
html[data-archive-theme="night"] #archive-form-overlay #npc-parent-selector-cards {
  border-color: rgba(210, 216, 228, .3);
  background: #292c33;
  color: #e3e6ec;
}
html[data-archive-theme="night"] #archive-form-overlay .archive-edit-section input::placeholder,
html[data-archive-theme="night"] #archive-form-overlay .archive-edit-section textarea::placeholder {
  color: #8f96a3;
}
html[data-archive-theme="night"] #archive-form-overlay .archive-edit-section input:focus,
html[data-archive-theme="night"] #archive-form-overlay .archive-edit-section textarea:focus,
html[data-archive-theme="night"] #archive-form-overlay .archive-edit-section select:focus {
  border-color: #cfd5df;
  outline-color: rgba(207, 213, 223, .22);
}
html[data-archive-theme="night"] #archive-form-overlay .avatar-preview-circle {
  border-color: rgba(210, 216, 228, .46);
  background: #292c33;
}
html[data-archive-theme="night"] #archive-form-overlay .avatar-preview-circle svg,
html[data-archive-theme="night"] #archive-form-overlay .upload-tip {
  color: #b9c0cc;
}
html[data-archive-theme="night"] #archive-form-overlay .archive-edit-link-row {
  border-top-color: rgba(210, 216, 228, .24);
}
html[data-archive-theme="night"] #archive-form-overlay .archive-voice-choice {
  border-color: rgba(210, 216, 228, .26);
  background: rgba(41, 44, 51, .46);
  color: #aeb4c0;
}
html[data-archive-theme="night"] #archive-form-overlay .archive-voice-choice-copy small {
  color: #aeb4c0;
}
html[data-archive-theme="night"] #archive-form-overlay .archive-voice-choice.is-active {
  border-color: #cfd5df;
  background: #292c33;
  color: #e3e6ec;
  box-shadow: 0 3px 10px rgba(0, 0, 0, .2);
  opacity: 1;
}
html[data-archive-theme="night"] #archive-form-overlay .archive-voice-choice.is-active .archive-voice-choice-mark {
  color: #17191e;
  background: #cfd5df;
}
html[data-archive-theme="night"] #archive-form-overlay .archive-voice-empty {
  border-color: rgba(210, 216, 228, .28);
  background: rgba(41, 44, 51, .54);
  color: #aeb4c0;
}
html[data-archive-theme="night"] #archive-form-overlay .archive-voice-empty strong {
  color: #e3e6ec;
}
html[data-archive-theme="night"] #archive-form-overlay .form-actions {
  border-top-color: rgba(210, 216, 228, .28);
  background: #23262c;
}
html[data-archive-theme="night"] #archive-form-overlay .btn-primary,
html[data-archive-theme="night"] #archive-form-overlay .btn-outline {
  border-color: #cfd5df;
  background: #cfd5df;
  color: #17191e;
}
html[data-archive-theme="night"] #archive-form-overlay .btn-danger-outline {
  border-color: rgba(239, 154, 154, .65);
  color: #f0b0b0;
}
html[data-archive-theme="night"] #archive-form-overlay .archive-danger-section .archive-edit-section-heading {
  color: #f0b0b0;
}

/* World Book browsing UI */
#win-world_book .win-header {
  padding-top: var(--phone-safe-top, 0px);
  height: calc(56px + var(--phone-safe-top, 0px));
  min-height: calc(56px + var(--phone-safe-top, 0px));
  box-sizing: border-box;
}
#win-world_book .win-header h3 {
  position: absolute;
  left: 50%;
  min-width: 0;
  max-width: calc(100% - 120px);
  margin: 0;
  transform: translateX(-50%);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#win-world_book .world-book-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  padding-top: 2px;
  z-index: 1;
}
#win-world_book .world-book-action-btn {
  min-height: 34px;
  padding: 7px 10px;
  border-radius: var(--radius);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  font-size: 11px;
  line-height: 1;
  white-space: nowrap;
}
#win-world_book .world-book-action-btn svg { width: 16px; height: 16px; flex-shrink: 0; }
@media (max-width: 430px) {
  #win-world_book .world-book-action-btn {
    width: 36px;
    min-width: 36px;
    padding: 7px;
  }
  #win-world_book .world-book-action-btn span { display: none; }
}
#win-world_book .win-body { padding-top: 12px; }
#win-world_book .win-body { scrollbar-width: none; }
#win-world_book .win-body::-webkit-scrollbar { display: none; }
#world_book-form-overlay .modal {
  max-height: 90%;
  overflow-y: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  overscroll-behavior: contain;
}
#world_book-form-overlay .modal::-webkit-scrollbar,
#world_book-form-overlay textarea::-webkit-scrollbar { display: none; }
#world_book-form-overlay .modal-header { padding-left: 20px; padding-right: 20px; }
#world_book-form {
  box-sizing: border-box;
  padding: 16px 16px 8px;
}
#world_book-form input,
#world_book-form select,
#world_book-form textarea {
  box-sizing: border-box;
}
#world_book-form textarea {
  scrollbar-width: none;
  -ms-overflow-style: none;
}
#world_book-form .form-actions {
  padding: 4px 0 8px;
}
.world-book-body-actions { display: flex !important; justify-content: flex-end; gap: 4px; margin: 0 0 12px; padding-top: 2px; }
.world-book-back { margin-bottom: 12px; }
.world-book-card {
  width: 100%;
  position: relative;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 5px;
  margin-bottom: 10px;
  padding: 12px 96px 12px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text-primary);
  text-align: left;
  cursor: pointer;
}
.world-book-card:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.world-book-card-owner { font-size: 12px; color: var(--text-secondary); }
.world-book-card-name { font-size: 15px; font-weight: 700; }
.world-book-status { position: absolute; top: 12px; right: 12px; border: 0; border-radius: 999px; padding: 4px 8px; font-size: 11px; cursor: pointer; }
.world-book-status.is-enabled { background: #dcfce7; color: #15803d; }
.world-book-status.is-disabled { background: #f1f5f9; color: var(--text-secondary); }
.world-book-detail-header { display: flex; align-items: center; gap: 8px; margin: 0 4px 12px; padding: 4px 0; }
.world-book-detail-header strong { flex: 1; font-size: 16px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.world-book-enable { display: flex; align-items: center; gap: 4px; font-size: 11px; color: var(--text-secondary); white-space: nowrap; }
.world-book-entry-card { position: relative; gap: 8px; margin-bottom: 8px; overflow: hidden; touch-action: pan-y; }
.world-book-entry-card { cursor: pointer; }
.world-book-entry-card.world-book-entry-expanded { border-color: var(--primary); background: var(--surface); }
.world-book-entry-card.swipe-delete-open { border-color: #fca5a5; }
.world-book-entry-title { display: flex; align-items: center; gap: 6px; padding: 2px 0 8px; border-bottom: 1px solid var(--border); }
.world-book-entry-content { white-space: pre-wrap; line-height: 1.5; max-width: none; }
.world-book-entry-content-panel { display: none; margin-top: 10px; padding: 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg-main); }
.world-book-entry-expanded .world-book-entry-content-panel { display: block; }
.world-book-entry-content-label { margin-bottom: 6px; color: var(--text-secondary); font-size: 10px; font-weight: 700; letter-spacing: 0.04em; }
.world-book-entry-expanded .world-book-entry-content { color: var(--text-primary); font-size: 12px; line-height: 1.65; }
.world-book-entry-meta { padding: 3px 6px; border-radius: 999px; background: var(--primary-light); color: var(--primary); font-size: 10px; font-weight: 600; white-space: nowrap; }
.world-book-entry-actions { display: flex; gap: 2px; }
.world-book-entry-actions .world-book-entry-action { min-height: 28px; padding: 5px 8px; font-size: 11px; }
.world-book-entry-toggle.is-enabled { border-color: #86efac; color: #15803d; background: #f0fdf4; }
.world-book-entry-toggle.is-disabled { border-color: var(--theme-border); color: var(--theme-text-secondary); background: var(--theme-bg-page); }
.world-book-delete-action { display: none; }
.world-book-entry-card.swipe-delete-open .world-book-delete-action {
  display: inline-flex;
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
}
.world-book-entry-card.swipe-delete-open .world-book-entry-actions .world-book-entry-action:not(.world-book-delete-action) { visibility: hidden; }
.world-book-empty { text-align: center; color: var(--text-secondary); font-size: 13px; padding: 40px 0; }

/* 世界书首页：收藏册式的中性玻璃界面 */
#win-world_book .win-body {
  background:
    radial-gradient(circle at 92% 0%, rgba(255, 255, 255, .92), transparent 34%),
    linear-gradient(180deg, #f5f7fa 0%, #edf1f5 100%);
  padding: 14px 14px 24px;
}
#win-world_book .world-book-app-header {
  padding-left: 12px;
  padding-right: 12px;
}
#win-world_book .world-book-app-header h3 {
  max-width: calc(100% - 160px);
  z-index: 0;
}
#win-world_book .world-book-header-actions {
  flex-shrink: 0;
  gap: 6px;
}
#win-world_book .world-book-action-btn,
#win-world_book .world-book-action-btn.btn-primary,
#win-world_book .world-book-action-btn.btn-outline {
  width: 58px;
  min-width: 58px;
  height: 36px;
  min-height: 36px;
  padding: 0 7px;
  border: 1px solid rgba(255, 255, 255, .94);
  border-radius: 13px;
  background: rgba(255, 255, 255, .72);
  color: #27313d;
  box-shadow: 0 4px 12px rgba(31, 41, 55, .08), inset 0 1px 0 rgba(255, 255, 255, .8);
}
#win-world_book .world-book-action-btn span { display: inline; }
#win-world_book .world-book-action-btn.btn-primary:hover,
#win-world_book .world-book-action-btn.btn-outline:hover {
  background: rgba(255, 255, 255, .94);
  color: #111827;
}
#win-world_book .world-book-action-btn:active {
  transform: translateY(1px);
  box-shadow: 0 2px 6px rgba(31, 41, 55, .08), inset 0 1px 0 rgba(255, 255, 255, .8);
}

#win-world_book .world-book-guide {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 20px;
  margin: 0 4px 16px;
  padding: 0 2px 12px;
  border-bottom: 1px solid rgba(100, 116, 139, .16);
  background: transparent;
  color: #647181;
  font-size: 11px;
  line-height: 1.5;
  text-align: left;
  white-space: normal;
}
#win-world_book .world-book-guide::before {
  content: "";
  flex: 0 0 4px;
  width: 4px;
  height: 16px;
  border-radius: 999px;
  background: #6b7280;
}
#win-world_book .world-book-guide-text { display: inline-block; transition: opacity .18s ease, transform .18s ease; }
#win-world_book .world-book-guide-text.is-changing { opacity: 0; transform: translateY(-3px); }

#win-world_book .world-book-home { padding-bottom: 8px; }
#win-world_book .world-book-home-section { margin: 0 0 22px; }
#win-world_book .world-book-home-section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin: 0 2px 10px;
}
#win-world_book .world-book-home-section-heading h2 {
  margin: 0;
  color: #1f2937;
  font-size: 15px;
  line-height: 1.3;
  letter-spacing: -.01em;
}
#win-world_book .world-book-home-section-heading span {
  flex-shrink: 0;
  color: #8a95a2;
  font-size: 10px;
}
#win-world_book .world-book-home-category-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 9px;
}
#win-world_book .world-book-nav-item {
  width: 100%;
  box-sizing: border-box;
  margin: 0;
  border: 1px solid rgba(255, 255, 255, .92);
  color: #27313d;
  text-align: left;
  cursor: pointer;
  transition: transform .18s ease, background .18s ease, box-shadow .18s ease;
}
#win-world_book .world-book-nav-item:hover {
  background: rgba(255, 255, 255, .9);
  box-shadow: 0 8px 18px rgba(51, 65, 85, .1), inset 0 1px 0 rgba(255, 255, 255, .9);
  transform: translateY(-1px);
}
#win-world_book .world-book-nav-item:active { transform: translateY(0); }
#win-world_book .world-book-category-card {
  min-height: 76px;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) 14px;
  align-items: center;
  gap: 9px;
  padding: 11px 14px;
  border-radius: 17px;
  background: linear-gradient(145deg, rgba(255, 255, 255, .84), rgba(238, 242, 246, .58));
  box-shadow: 0 8px 18px rgba(51, 65, 85, .065), inset 0 1px 0 rgba(255, 255, 255, .84);
}
#win-world_book .world-book-nav-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid rgba(255, 255, 255, .82);
  border-radius: 12px;
  background: rgba(71, 85, 105, .1);
  color: #4b5563;
}
#win-world_book .world-book-nav-icon svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
#win-world_book .world-book-nav-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
#win-world_book .world-book-nav-copy strong {
  overflow: hidden;
  color: #27313d;
  font-size: 13px;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#win-world_book .world-book-nav-copy small {
  overflow: hidden;
  color: #7a8693;
  font-size: 10px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#win-world_book .world-book-nav-arrow {
  color: #9aa3ad;
  font-size: 20px;
  font-weight: 400;
  line-height: 1;
  text-align: right;
}
#win-world_book .world-book-home-group-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
#win-world_book .world-book-group-card {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) 12px;
  align-items: center;
  gap: 9px;
  min-height: 66px;
  padding: 10px 12px;
  border-radius: 17px;
  background: linear-gradient(145deg, rgba(255, 255, 255, .78), rgba(232, 237, 242, .54));
  box-shadow: 0 7px 16px rgba(51, 65, 85, .055), inset 0 1px 0 rgba(255, 255, 255, .82);
}
#win-world_book .world-book-home-group-empty {
  margin: 0;
  padding: 14px 4px 12px;
  color: #8994a0;
  font-size: 11px;
  line-height: 1.6;
}
#win-world_book .world-book-create-group {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 52px;
  margin-top: 10px;
  border: 1px dashed rgba(100, 116, 139, .42);
  border-radius: 17px;
  background: rgba(255, 255, 255, .28);
  color: #4b5563;
  font-size: 12px;
  box-shadow: none;
}
#win-world_book .world-book-create-group:hover {
  background: rgba(255, 255, 255, .66);
  color: #1f2937;
}
#win-world_book .world-book-create-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 21px;
  height: 21px;
  border: 1px solid currentColor;
  border-radius: 50%;
  font-size: 17px;
  font-weight: 400;
  line-height: 1;
}
@media (max-width: 360px) {
  #win-world_book .world-book-action-btn {
    width: 36px;
    min-width: 36px;
    padding: 0;
  }
  #win-world_book .world-book-action-btn span { display: none; }
}

/* 档案添加上方头像 */
.avatar-uploader-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 20px;
}
.avatar-preview-circle {
  width: 80px; height: 80px;
  border-radius: 50%;
  background-color: var(--primary-light);
  border: 2px dashed var(--primary);
  display: flex;
  justify-content: center; align-items: center;
  overflow: hidden; cursor: pointer;
  position: relative;
}
.avatar-preview-circle img { width: 100%; height: 100%; object-fit: cover; }
.avatar-preview-circle svg { width: 32px; height: 32px; color: var(--primary); }
.upload-tip { font-size: 11px; color: var(--text-secondary); margin-top: 8px; }

/* 模态框与过渡 */
.modal-overlay {
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  background-color: rgba(15,23,42,0.4);
  display: flex; align-items: flex-end; justify-content: center;
  z-index: 200; opacity: 0; pointer-events: none;
  transition: opacity 0.25s ease;
}
.modal-overlay.active { opacity: 1; pointer-events: auto; }

.modal {
  background-color: var(--bg-main);
  border-top-left-radius: 24px; border-top-right-radius: 24px;
  width: 100%; max-height: 85%; overflow-y: auto;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.1, 0.9, 0.2, 1);
  padding-bottom: 30px;
}
.modal-overlay.active .modal { transform: translateY(0); }
.modal-header {
  padding: 16px; background-color: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
}

/* .modal 的通用规则位于本文件后方，这里用更具体的选择器锁定群功能的玻璃层级。 */
.group-feature-overlay {
  padding: 0 12px max(12px, env(safe-area-inset-bottom));
  background: rgba(26, 35, 48, .24);
}
.group-feature-overlay .group-feature-modal {
  width: min(100%, 360px);
  max-height: min(82%, 560px);
  padding-bottom: 0;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.78);
  border-radius: 24px;
  background: linear-gradient(145deg, rgba(255,255,255,.86), rgba(243,246,250,.76));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.94), 0 -14px 34px rgba(28,38,50,.14);
  backdrop-filter: blur(22px) saturate(124%);
  -webkit-backdrop-filter: blur(22px) saturate(124%);
}
.group-feature-overlay .group-feature-modal .modal-header {
  min-height: 58px;
  padding: 12px 16px 8px;
  background: transparent;
  border-bottom: 1px solid rgba(109,120,132,.1);
}
.group-feature-overlay .group-feature-modal .group-feature-body {
  max-height: min(66vh, 460px);
  padding: 14px 16px max(18px, env(safe-area-inset-bottom));
  overflow-y: auto;
}
.group-context-help {
  color: var(--text-secondary);
  font-size: 10px;
  line-height: 1.5;
}
.group-context-help summary {
  cursor: pointer;
  font-weight: 650;
}
.group-context-help p {
  margin: 6px 0 0;
}
/* 线下模式入口：与聊天页保持同一套中性玻璃层级，不再使用旧蓝白按钮。 */
#offline-select-overlay {
  align-items: center;
  justify-content: center;
  padding: 16px;
  box-sizing: border-box;
  background: rgba(15, 23, 42, 0.24);
}

#offline-select-overlay .offline-mode-modal {
  width: min(100%, 360px);
  max-height: min(82%, 520px);
  padding: 0;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: 24px;
  background: rgba(247, 247, 247, 0.88);
  color: #343434;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.92), 0 18px 44px rgba(15, 23, 42, 0.18);
  backdrop-filter: blur(22px) saturate(125%);
  -webkit-backdrop-filter: blur(22px) saturate(125%);
  transform: translateY(18px) scale(0.98);
  transition: transform 0.26s cubic-bezier(0.2, 0.8, 0.2, 1);
}

#offline-select-overlay.active .offline-mode-modal {
  transform: translateY(0) scale(1);
}

#offline-select-overlay .offline-mode-header {
  min-height: 68px;
  padding: 14px 16px 12px 20px;
  background: rgba(255, 255, 255, 0.24);
  border-bottom: 1px solid rgba(0, 0, 0, 0.07);
}

#offline-select-overlay .offline-mode-header h4 {
  margin: 0;
  color: #343434;
  font-size: 17px;
  line-height: 1.3;
  font-weight: 750;
}

#offline-select-overlay .offline-mode-header .btn-icon {
  width: 36px;
  height: 36px;
  color: #666;
  border: 1px solid rgba(255, 255, 255, 0.54);
  background: rgba(255, 255, 255, 0.18);
}

#offline-select-overlay .offline-mode-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
}

#offline-select-overlay .offline-mode-lead {
  margin: 0 2px 2px;
  color: rgba(64, 64, 64, 0.62);
  font-size: 12px;
  line-height: 1.5;
}

#offline-select-overlay .offline-mode-option {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  min-height: 72px;
  padding: 12px 13px;
  box-sizing: border-box;
  border: 1px solid rgba(203, 203, 198, 0.84);
  border-radius: 18px;
  background: rgba(248, 250, 252, 0.62);
  color: rgb(76, 83, 91);
  text-align: left;
  font: inherit;
  cursor: pointer;
  transition: background-color 0.18s ease, border-color 0.18s ease, transform 0.12s ease, box-shadow 0.18s ease;
}

#offline-select-overlay .offline-mode-option:hover,
#offline-select-overlay .offline-mode-option:focus-visible {
  background: rgba(255, 255, 255, 0.82);
  border-color: rgba(166, 166, 160, 0.9);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.82), 0 5px 14px rgba(38, 38, 35, 0.08);
  outline: none;
}

#offline-select-overlay .offline-mode-option:active {
  transform: scale(0.985);
}

#offline-select-overlay .offline-mode-option-icon {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  border: 1px solid rgba(110, 110, 104, 0.24);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.42);
  color: rgba(76, 76, 72, 0.76);
  font-size: 16px;
  line-height: 1;
}

#offline-select-overlay .offline-mode-option-copy {
  display: flex;
  min-width: 0;
  flex: 1;
  flex-direction: column;
  gap: 3px;
}

#offline-select-overlay .offline-mode-option-copy strong {
  color: #343434;
  font-size: 14px;
  line-height: 1.35;
}

#offline-select-overlay .offline-mode-option-copy small {
  color: rgba(64, 64, 64, 0.58);
  font-size: 11px;
  line-height: 1.4;
}

#offline-select-overlay .offline-mode-option-arrow {
  flex: 0 0 auto;
  color: rgba(90, 90, 86, 0.52);
  font-size: 24px;
  font-weight: 300;
  line-height: 1;
}

@media (prefers-reduced-motion: reduce) {
  #offline-select-overlay .offline-mode-modal,
  #offline-select-overlay .offline-mode-option {
    transition: none;
  }
}

.archive-tabs {
  height: 68px;
  border-top: 1px solid rgba(177, 132, 67, .42);
  background: #efe0bb;
  display: flex; justify-content: space-around; align-items: center;
}
.archive-tabs .tab-item { color: #81664e; }
.archive-tabs .tab-item.active { color: #7a332b; }
.archive-tabs .tab-item {
  width: 25%;
  height: 100%;
  overflow: visible;
}
.archive-tabs .tab-item span { display: none; }
.archive-tabs .archive-tab-icon { display: none; }
.archive-tabs .tab-item span {
  display: block;
  color: #7a332b;
  font-family: var(--theme-font-family);
  font-size: 13px;
  letter-spacing: .08em;
}
#win-archive[data-archive-theme="night"] .archive-tabs .tab-item span,
#win-archive[data-archive-theme="night"] .archive-tabs .tab-item.active span {
  color: #d4d9e2;
}

/* 详情页正文与功能控件保持默认字体，装饰字体只留给档案氛围文字。 */
.archive-profile-panel,
.archive-profile-panel button,
.archive-profile-panel input,
.archive-profile-panel textarea,
.archive-profile-panel select,
.archive-form-overlay,
.archive-form-overlay button,
.archive-form-overlay input,
.archive-form-overlay textarea,
.archive-form-overlay select {
  font-family: var(--theme-font-family);
}
.archive-tab-icon {
  --archive-tab-scale: 1;
  --archive-tab-active-scale: 1.04;
  display: block;
  width: 60px;
  height: 60px;
  margin: 0;
  object-fit: cover;
  object-position: center;
  filter: drop-shadow(0 3px 3px rgba(107, 57, 28, .14));
  transform: scale(var(--archive-tab-scale));
  transition: transform .2s ease, filter .2s ease;
}
.archive-tab-role-icon { --archive-tab-scale: .9; --archive-tab-active-scale: .94; width: 60px; height: 60px; }
.archive-tab-user-icon { --archive-tab-scale: 1.03; --archive-tab-active-scale: 1.07; }
.archive-tab-npc-icon { --archive-tab-scale: .9; --archive-tab-active-scale: .94; }
.archive-tab-relationship-icon { --archive-tab-scale: 1.08; --archive-tab-active-scale: 1.12; }
.archive-tabs .tab-item.active .archive-tab-icon {
  transform: translateY(-2px) scale(var(--archive-tab-active-scale));
  filter: drop-shadow(0 5px 5px rgba(107, 57, 28, .25));
}
.tab-item {
  background: none; border: none;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: var(--text-secondary); cursor: pointer; width: 60px;
}
.tab-item svg { width: 22px; height: 22px; margin-bottom: 2px; }
.tab-item span { font-size: 10px; font-weight: 600; }
.tab-item.active { color: var(--primary); }

/* 世界书滑动开关样式 */
.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}
.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #cbd5e1;
  transition: .3s;
  border-radius: 24px;
}
.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
}
input:checked + .slider {
  background-color: #596b73;
}
input:checked + .slider:before {
  transform: translateX(20px);
}

/* Chat 用户身份：资料卡与轻量编辑器，不复用 Archive 收藏视觉 */
#chat-tab-me .me-active-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease;
}

#chat-tab-me .me-active-card:active {
  transform: scale(.99);
}

#chat-tab-me .me-active-avatar {
  width: 50px;
  height: 50px;
  flex: 0 0 50px;
  border-radius: 15px;
  object-fit: cover;
  background: var(--bg-main);
}

#chat-tab-me .me-active-copy {
  min-width: 0;
  flex: 1;
  text-align: left;
}

#chat-tab-me .me-active-group,
#chat-tab-me .candidate-persona-group {
  overflow: hidden;
  color: var(--text-secondary);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .02em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#chat-tab-me .me-active-name {
  margin: 3px 0 2px;
  overflow: hidden;
  color: var(--text-primary);
  font-size: 16px;
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#chat-tab-me .me-active-remark,
#chat-tab-me .candidate-persona-remark {
  overflow: hidden;
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

  #chat-tab-me .me-active-hint {
    margin: 7px 3px 0;
    color: var(--text-secondary);
    font-size: 10px;
    line-height: 1.4;
    text-align: left;
  }
  
  #chat-tab-me .me-identity-actions {
    position: fixed;
    inset: 0;
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(28, 36, 46, .16);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
  }
  
  #chat-tab-me .me-identity-actions[hidden] {
    display: none;
  }

  #chat-tab-me .me-identity-action-dialog {
    width: min(270px, calc(100% - 48px));
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px;
    border: 1px solid rgba(255, 255, 255, .78);
    border-radius: 18px;
    background: rgba(255, 255, 255, .72);
    box-shadow: 0 18px 55px rgba(35, 43, 53, .18);
    backdrop-filter: blur(22px) saturate(110%);
    -webkit-backdrop-filter: blur(22px) saturate(110%);
  }
  
  #chat-tab-me .me-identity-action-btn {
    width: 100%;
    min-height: 42px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: rgba(255, 255, 255, .44);
    color: var(--text-primary);
    cursor: pointer;
    font: inherit;
    font-size: 14px;
    font-weight: 700;
  }
  
  #chat-tab-me .me-identity-action-btn:active {
    background: rgba(255, 255, 255, .78);
  }

#chat-tab-me .me-identity-action-btn:disabled {
  cursor: not-allowed;
  opacity: .45;
}

#chat-tab-me .chat-user-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
  margin-top: 10px;
}

#chat-tab-me .chat-user-action-btn {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  transition: border-color .2s ease, background-color .2s ease, opacity .2s ease;
}

#chat-tab-me .chat-user-action-btn-primary {
  border-color: color-mix(in srgb, var(--primary) 45%, var(--border));
  background: color-mix(in srgb, var(--primary) 9%, var(--surface));
  color: var(--primary);
}

#chat-tab-me .chat-user-action-btn:active:not(:disabled) {
  background: var(--bg-main);
}

#chat-tab-me .chat-user-action-btn:disabled {
  cursor: not-allowed;
  opacity: .45;
}

#chat-tab-me .me-selector-container {
  padding-top: 2px;
}

#chat-tab-me .me-user-add-row {
  margin-top: 10px;
}

#chat-tab-me .chat-user-add-btn {
  display: inline-flex;
  width: 100%;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 8px 10px;
  border: 1px dashed color-mix(in srgb, var(--text-secondary) 35%, var(--border));
  border-radius: 10px;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
}

#chat-tab-me .me-candidate-cards {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 260px;
  overflow-y: auto;
  padding: 2px;
}

#chat-tab-me .chat-user-group-section {
  padding: 9px;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: color-mix(in srgb, var(--surface) 88%, var(--bg-main));
}

#chat-tab-me .chat-user-group-section.is-collapsed {
  padding-bottom: 8px;
}

#chat-tab-me .chat-user-group-header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 1px 2px 8px;
  border: 0;
  background: transparent;
  color: var(--text-primary);
  cursor: pointer;
  font: inherit;
  text-align: left;
}

#chat-tab-me .chat-user-group-section.is-collapsed .chat-user-group-header {
  padding-bottom: 0;
}

#chat-tab-me .chat-user-group-title {
  overflow: hidden;
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#chat-tab-me .chat-user-group-meta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  color: var(--text-secondary);
  font-size: 10px;
  font-weight: 700;
}

#chat-tab-me .chat-user-group-chevron {
  display: inline-grid;
  width: 18px;
  height: 18px;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 50%;
  font-size: 14px;
  line-height: 1;
  transform: translateY(-1px);
  transition: transform .2s ease;
}

#chat-tab-me .chat-user-group-section.is-collapsed .chat-user-group-chevron {
  transform: rotate(-90deg) translateX(1px);
}

#chat-tab-me .chat-user-group-cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

#chat-tab-me .chat-user-group-cards[hidden] {
  display: none;
}

#chat-tab-me .candidate-persona-card {
  position: relative;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text-primary);
  cursor: pointer;
  font: inherit;
  text-align: left;
  transition: border-color .2s ease, background-color .2s ease, box-shadow .2s ease, transform .2s ease;
}

#chat-tab-me .candidate-persona-card:hover,
#chat-tab-me .candidate-persona-card.is-active {
  border-color: color-mix(in srgb, var(--primary) 62%, var(--border));
  background: color-mix(in srgb, var(--primary) 6%, var(--surface));
  box-shadow: 0 4px 12px rgba(15, 23, 42, .08);
}

#chat-tab-me .candidate-persona-card:active {
  transform: scale(.98);
}

#chat-tab-me .candidate-persona-avatar {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  border-radius: 12px;
  object-fit: cover;
  background: var(--bg-main);
}

#chat-tab-me .candidate-persona-copy {
  min-width: 0;
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 2px;
}

#chat-tab-me .candidate-persona-name {
  overflow: hidden;
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#chat-tab-me .candidate-persona-check {
  display: grid;
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 50%;
  color: transparent;
  font-size: 11px;
  font-weight: 800;
}

#chat-tab-me .candidate-persona-card.is-active .candidate-persona-check {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}

#chat-tab-me .chat-user-empty {
  grid-column: 1 / -1;
  margin: 0;
  padding: 18px 10px;
  border: 1px dashed var(--border);
  border-radius: 12px;
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.5;
  text-align: center;
}

.chat-user-editor-overlay {
  z-index: 1250;
}

.chat-user-editor-modal {
  max-height: 91%;
  overflow-y: auto;
}

.chat-user-editor-header {
  position: sticky;
  top: 0;
  z-index: 1;
  align-items: flex-start;
  padding: 15px 16px 13px;
}

.chat-user-editor-header h4 {
  margin: 2px 0 0;
  color: var(--text-primary);
  font-size: 18px;
  font-weight: 800;
}

.chat-user-editor-kicker {
  color: var(--primary);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .14em;
}

.chat-user-editor-form {
  padding: 16px 16px 24px;
}

.chat-user-editor-section {
  padding: 15px 0 17px;
  border-bottom: 1px solid var(--border);
}

.chat-user-editor-section:first-of-type {
  padding-top: 2px;
}

.chat-user-editor-section-title {
  margin-bottom: 12px;
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 800;
}

.chat-user-editor-profile {
  display: flex;
  align-items: center;
  gap: 13px;
  margin-bottom: 15px;
}

.chat-user-avatar-preview-wrap {
  position: relative;
  width: 64px;
  height: 64px;
  flex: 0 0 64px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--bg-main);
}

.chat-user-avatar-preview,
.chat-user-avatar-placeholder {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.chat-user-avatar-placeholder {
  align-items: center;
  justify-content: center;
  color: var(--primary);
  font-size: 20px;
  font-weight: 800;
}

.chat-user-avatar-tools {
  min-width: 0;
  flex: 1;
}

.chat-user-avatar-caption {
  margin-bottom: 6px;
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 750;
}

.chat-user-avatar-actions {
  display: flex;
  gap: 7px;
  margin-bottom: 8px;
}

.chat-user-avatar-actions .btn {
  min-height: 30px;
  padding: 5px 9px;
  font-size: 11px;
}

.chat-user-avatar-tools > input {
  width: 100%;
  box-sizing: border-box;
  min-height: 34px;
}

.chat-user-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 11px;
}

.chat-user-field {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0 0 12px;
}

.chat-user-field-wide {
  grid-column: 1 / -1;
}

.chat-user-field > span {
  color: var(--text-primary);
  font-size: 11px;
  font-weight: 750;
}

.chat-user-field em {
  color: var(--primary);
  font-style: normal;
}

.chat-user-field input,
.chat-user-field textarea {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface);
  color: var(--text-primary);
  font: inherit;
  font-size: 12px;
  line-height: 1.5;
  outline: none;
  transition: border-color .2s ease, box-shadow .2s ease;
}

.chat-user-field input {
  min-height: 36px;
  padding: 7px 10px;
}

.chat-user-field textarea {
  min-height: 70px;
  padding: 8px 10px;
  resize: vertical;
}

.chat-user-field input:focus,
.chat-user-field textarea:focus,
.chat-user-avatar-tools > input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 12%, transparent);
}

.chat-user-advanced {
  margin-top: 2px;
  border-top: 1px solid var(--border);
}

.chat-user-advanced summary {
  padding: 12px 0 2px;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 11px;
  font-weight: 750;
}

.chat-user-advanced-body {
  padding-top: 12px;
}

.chat-user-editor-actions {
  display: grid;
  grid-template-columns: 1fr 1.35fr;
  gap: 9px;
  padding-top: 17px;
}

.chat-user-editor-actions .btn {
  min-height: 40px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 750;
}

@media (max-width: 360px) {
  #chat-tab-me .chat-user-group-cards,
  .chat-user-form-grid {
    grid-template-columns: 1fr;
  }

  .chat-user-field-wide {
    grid-column: auto;
  }
}
/* 对话世界书：清透玻璃书册层级 */
.chat-wb-section { margin: 0 0 16px; }
.chat-wb-section-title { margin: 0 2px 6px; color: var(--text-primary); font-size: 13px; font-weight: 700; }
.chat-wb-section-note { margin: 0 2px 9px; color: var(--text-secondary); font-size: 10.5px; line-height: 1.5; }
.chat-wb-section-body { display: flex; flex-direction: column; gap: 8px; }
.chat-wb-empty { padding: 12px; border: 1px solid rgba(255,255,255,.58); border-radius: 13px; background: rgba(255,255,255,.22); color: var(--text-secondary); font-size: 11px; backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.chat-wb-book { overflow: hidden; border: 1px solid rgba(255,255,255,.68); border-radius: 15px; background: linear-gradient(145deg,rgba(255,255,255,.48),rgba(255,255,255,.18)); box-shadow: inset 0 1px 0 rgba(255,255,255,.72),0 8px 22px rgba(32,42,54,.06); backdrop-filter: blur(16px) saturate(115%); -webkit-backdrop-filter: blur(16px) saturate(115%); }
.chat-wb-book-head { display: flex; align-items: center; min-height: 48px; padding: 0 10px 0 12px; }
.chat-wb-book-toggle,.chat-wb-entry-row { display: flex; align-items: center; gap: 10px; min-width: 0; cursor: pointer; }
.chat-wb-book-toggle { flex: 1; }
.chat-wb-book-toggle input,.chat-wb-entry-row input { flex: 0 0 auto; width: 16px; height: 16px; accent-color: #66717c; }
.chat-wb-book-toggle span,.chat-wb-entry-copy { display: flex; flex: 1; flex-direction: column; min-width: 0; text-align: left; }
.chat-wb-book-toggle strong,.chat-wb-entry-copy strong { overflow: hidden; color: var(--text-primary); font-size: 12px; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.chat-wb-book-toggle small,.chat-wb-entry-copy small { margin-top: 2px; color: var(--text-secondary); font-size: 9.5px; font-weight: 400; }
.chat-wb-expand { width: 34px; height: 34px; border: 0; background: transparent; color: var(--text-secondary); font-size: 18px; line-height: 1; transition: transform .2s ease; }
.chat-wb-expand[aria-expanded="true"] { transform: rotate(180deg); }
.chat-wb-book-entries { display: flex; flex-direction: column; gap: 3px; padding: 5px 9px 9px; border-top: 1px solid rgba(255,255,255,.5); }
.chat-wb-book-entries[hidden] { display: none; }
.chat-wb-entry-row { min-height: 39px; padding: 5px 8px; border-radius: 10px; background: rgba(255,255,255,.2); }
.chat-wb-section > .chat-wb-section-body > .chat-wb-entry-row { border: 1px solid rgba(255,255,255,.62); background: rgba(255,255,255,.28); box-shadow: inset 0 1px 0 rgba(255,255,255,.62); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
@media (prefers-reduced-motion: reduce) { .chat-wb-expand { transition: none; } }

/* 生图设置：全局设置与会话设置使用同一套清透玻璃层级 */
.imagegen-settings-shell,
#imagegen-session-panel .imagegen-session-body {
  box-sizing: border-box;
  background: linear-gradient(180deg, rgba(244,247,250,.94), rgba(237,241,246,.9));
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.imagegen-settings-shell { padding: 14px 12px 28px; overflow-y: auto; }
.imagegen-settings-shell::-webkit-scrollbar,
#imagegen-session-panel .imagegen-session-body::-webkit-scrollbar { display: none; }

#settings-lv2-imagegen .imagegen-settings-card,
#imagegen-session-panel .imagegen-settings-card {
  box-sizing: border-box;
  margin: 0 0 10px !important;
  padding: 15px !important;
  border: 1px solid rgba(255,255,255,.72) !important;
  border-radius: 18px !important;
  background: linear-gradient(145deg, rgba(255,255,255,.54), rgba(255,255,255,.25)) !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.82), 0 9px 26px rgba(45,55,68,.055) !important;
  backdrop-filter: blur(18px) saturate(112%);
  -webkit-backdrop-filter: blur(18px) saturate(112%);
}

#settings-lv2-imagegen .imagegen-section-heading,
#imagegen-session-panel .imagegen-section-heading {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0 0 13px !important;
  color: var(--text-primary) !important;
  font-size: 13px !important;
  font-weight: 720 !important;
  line-height: 1.35;
}

.imagegen-section-icon { flex: 0 0 auto; color: rgba(82,92,102,.72); }

#settings-lv2-imagegen .imagegen-settings-card .form-group,
#imagegen-session-panel .imagegen-settings-card .form-group { margin-bottom: 11px; }

#settings-lv2-imagegen .imagegen-settings-card label,
#imagegen-session-panel .imagegen-settings-card label {
  display: block;
  margin: 0 0 7px !important;
  color: var(--text-secondary) !important;
  font-size: 11px !important;
  font-weight: 700 !important;
  line-height: 1.4;
}

#settings-lv2-imagegen .imagegen-settings-card input,
#settings-lv2-imagegen .imagegen-settings-card select,
#settings-lv2-imagegen .imagegen-settings-card textarea,
#imagegen-session-panel .imagegen-settings-card input,
#imagegen-session-panel .imagegen-settings-card select,
#imagegen-session-panel .imagegen-settings-card textarea {
  box-sizing: border-box;
  min-width: 0;
  border: 1px solid rgba(105,116,128,.14) !important;
  border-radius: 13px !important;
  background: rgba(255,255,255,.34) !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.72) !important;
  color: var(--text-primary);
  font: inherit;
  font-size: 12px !important;
  outline: none;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

#settings-lv2-imagegen .imagegen-settings-card input,
#settings-lv2-imagegen .imagegen-settings-card select,
#imagegen-session-panel .imagegen-settings-card select { width: 100%; min-height: 40px; padding: 0 11px !important; }

#settings-lv2-imagegen .imagegen-settings-card textarea,
#imagegen-session-panel .imagegen-settings-card textarea {
  width: 100%;
  min-height: 92px;
  padding: 11px 12px !important;
  line-height: 1.55 !important;
  resize: vertical;
}

#settings-lv2-imagegen .imagegen-settings-card input:focus,
#settings-lv2-imagegen .imagegen-settings-card select:focus,
#settings-lv2-imagegen .imagegen-settings-card textarea:focus,
#imagegen-session-panel .imagegen-settings-card input:focus,
#imagegen-session-panel .imagegen-settings-card select:focus,
#imagegen-session-panel .imagegen-settings-card textarea:focus {
  border-color: rgba(86,98,110,.38) !important;
  box-shadow: 0 0 0 3px rgba(86,98,110,.08), inset 0 1px 0 rgba(255,255,255,.72) !important;
}

.imagegen-select-row,
.imagegen-key-row,
.imagegen-action-row { display: flex; min-width: 0; align-items: center; gap: 7px; }
.imagegen-select-row > select,
.imagegen-key-row > input { min-width: 0; flex: 1 1 auto; }
.imagegen-select-row > button { flex: 0 0 auto; }
.imagegen-key-row > input { width: auto !important; }

.imagegen-copy-key { display: inline-flex !important; width: 36px !important; height: 36px !important; flex: 0 0 36px; align-items: center; justify-content: center; padding: 0 !important; border: 1px solid rgba(255,255,255,.76) !important; border-radius: 11px !important; background: rgba(255,255,255,.3) !important; color: var(--text-secondary) !important; cursor: pointer; }
.imagegen-copy-key svg { color: currentColor; }
.imagegen-action-row { margin-top: 4px; }
.imagegen-action-row > button { min-width: 0; min-height: 39px; flex: 1 1 0; padding: 8px 10px !important; border-radius: 13px !important; font-size: 11px; font-weight: 700; }
.imagegen-select-row > button { min-height: 40px; padding: 0 11px !important; border-radius: 12px !important; font-size: 11px; }
.imagegen-full-action { width: 100%; min-height: 39px; margin-top: 8px; padding: 8px 10px !important; border-radius: 13px !important; font-size: 11px; font-weight: 700; }
.imagegen-secondary-action { border: 1px solid rgba(255,255,255,.78) !important; background: rgba(255,255,255,.28) !important; box-shadow: inset 0 1px 0 rgba(255,255,255,.7) !important; color: var(--text-primary) !important; }
.imagegen-primary-action { border: 1px solid rgba(61,70,79,.72) !important; background: rgba(61,70,79,.84) !important; box-shadow: inset 0 1px 0 rgba(255,255,255,.12), 0 7px 16px rgba(45,55,68,.12) !important; color: #fff !important; }
.imagegen-danger-action { min-height: 40px; padding: 0 11px !important; border: 1px solid rgba(115,105,105,.22) !important; border-radius: 12px !important; background: rgba(255,255,255,.22) !important; color: rgba(100,85,85,.84) !important; font-size: 11px; font-weight: 700; }
.imagegen-feedback { min-height: 16px; margin-top: 8px; color: var(--text-secondary); font-size: 10px; line-height: 1.45; }

#imagegen-session-panel .imagegen-session-body { padding: 14px 12px 28px !important; overflow-y: auto; }
#imagegen-session-panel .imagegen-description { margin: -3px 0 10px; color: var(--text-secondary); font-size: 10.5px; line-height: 1.5; }
#imagegen-session-panel .imagegen-lockface-preview { display: flex; min-height: 66px; flex-wrap: wrap; gap: 7px; align-items: center; margin: 0 0 10px; padding: 8px; border: 1px dashed rgba(104,114,124,.22); border-radius: 13px; background: rgba(255,255,255,.2); }
#imagegen-session-panel .imagegen-toggle-card { padding-bottom: 10px !important; }
#imagegen-session-panel .imagegen-toggle-card .imagegen-section-heading { margin-bottom: 5px !important; }
#imagegen-session-panel .imagegen-toggle-row { display: flex; align-items: center; justify-content: space-between; min-height: 42px; margin: 0 !important; padding: 5px 0; border-bottom: 1px dashed rgba(104,114,124,.16); }
#imagegen-session-panel .imagegen-toggle-row:last-child { border-bottom: 0; }
#imagegen-session-panel .imagegen-toggle-row > label:first-child { margin: 0 !important; color: var(--text-primary) !important; }
#imagegen-session-panel .imagegen-toggle-row .switch { flex: 0 0 auto; }
#imagegen-session-panel .switch .slider { border: 1px solid rgba(100,110,120,.15); background: rgba(125,135,145,.18); box-shadow: inset 0 1px 3px rgba(40,48,56,.08), inset 0 1px 0 rgba(255,255,255,.58); }
#imagegen-session-panel .switch input:checked + .slider { background: rgba(70,80,90,.7); }
#imagegen-session-panel .imagegen-save-action { display: block; width: 100%; min-height: 44px; margin-top: 2px; padding: 11px 12px !important; border-radius: 14px !important; font-size: 13px; }

@media (max-width: 390px) {
  .imagegen-settings-shell { padding-left: 10px; padding-right: 10px; }
  #settings-lv2-imagegen .imagegen-settings-card,
  #imagegen-session-panel .imagegen-settings-card { padding: 13px !important; }
  .imagegen-select-row > button { padding-left: 9px !important; padding-right: 9px !important; }
}

@media (prefers-reduced-motion: reduce) {
  #settings-lv2-imagegen .imagegen-settings-card,
  #imagegen-session-panel .imagegen-settings-card { scroll-behavior: auto; }
}

/* 生图入口与会话生图设置保持同一套中性玻璃质感。 */
#win-model_config [data-model-center-card="image"] .model-center-card-icon {
  border: 1px solid rgba(255,255,255,.76);
  background: linear-gradient(145deg, rgba(255,255,255,.82), rgba(214,220,226,.72));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.88);
  color: rgba(78,88,98,.78);
}

#win-model_config [data-model-center-card="image"].is-expanded {
  border-color: rgba(110,120,130,.28);
  box-shadow: 0 10px 28px rgba(45,55,68,.08);
}

#win-model_config [data-model-center-card="image"] .model-center-actions .btn-primary {
  border-color: rgba(61,70,79,.72);
  background: rgba(61,70,79,.84);
  color: #fff;
}

#win-model_config [data-model-center-card="image"] .model-center-add-profile,
#win-model_config [data-model-center-card="image"] .model-center-fetch-row .btn,
#win-model_config [data-model-center-card="image"] .model-center-actions .btn-outline {
  border-color: rgba(255,255,255,.78);
  background: rgba(255,255,255,.28);
  color: var(--text-primary);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.7);
}

/* 系统设置：主菜单、二级表单与模型中心统一为中性玻璃层级。 */
#win-settings > .win-body {
  padding: 14px 12px 28px;
  background: linear-gradient(180deg, rgba(244,247,250,.94), rgba(237,241,246,.9));
  scrollbar-width: none;
}
#win-settings > .win-body::-webkit-scrollbar { display: none; }
#win-settings #settings-lv1 .menu-item {
  min-height: 56px;
  margin-bottom: 10px;
  padding: 14px 15px;
  border: 1px solid rgba(255,255,255,.72);
  border-radius: 18px;
  background: linear-gradient(145deg, rgba(255,255,255,.54), rgba(255,255,255,.25));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.82), 0 9px 26px rgba(45,55,68,.055);
  backdrop-filter: blur(18px) saturate(112%);
  -webkit-backdrop-filter: blur(18px) saturate(112%);
}
#win-settings #settings-lv1 .menu-item:hover,
#win-settings #settings-lv1 .menu-item:active { background: linear-gradient(145deg, rgba(255,255,255,.68), rgba(255,255,255,.34)); }
#win-settings #settings-lv1 .menu-item .chevron { color: var(--text-secondary); }
#win-settings .settings-lv2-panel:not(.imagegen-settings-shell) { background: transparent; }
#win-settings .settings-lv2-panel:not(.imagegen-settings-shell) > .form-group {
  box-sizing: border-box;
  margin: 0 0 10px !important;
  padding: 15px !important;
  border: 1px solid rgba(255,255,255,.72) !important;
  border-radius: 18px !important;
  background: linear-gradient(145deg, rgba(255,255,255,.54), rgba(255,255,255,.25)) !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.82), 0 9px 26px rgba(45,55,68,.055) !important;
  backdrop-filter: blur(18px) saturate(112%);
  -webkit-backdrop-filter: blur(18px) saturate(112%);
}
#win-settings .settings-lv2-panel:not(.imagegen-settings-shell) .form-actions { padding-top: 4px; }
#win-settings .settings-lv2-panel:not(.imagegen-settings-shell) .btn-primary {
  border: 1px solid rgba(61,70,79,.72) !important;
  background: rgba(61,70,79,.84) !important;
  color: #fff !important;
}
#win-settings .settings-lv2-panel:not(.imagegen-settings-shell) .btn-outline,
#win-settings .settings-lv2-panel:not(.imagegen-settings-shell) .btn:not(.btn-primary):not(.btn-danger-outline) {
  border: 1px solid rgba(255,255,255,.78) !important;
  background: rgba(255,255,255,.28) !important;
  color: var(--text-primary) !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.7) !important;
}

/* 对话专属设置：普通开关是轻量行，完整表单保留更高一级的玻璃卡片。 */
#chat-details-panel .chat-details-settings-section-label {
  margin: 16px 3px 8px;
  color: var(--text-secondary);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .12em;
  line-height: 1.3;
}
#chat-details-panel .chat-details-online-behavior {
  margin: 0 0 8px;
  padding: 10px 13px 5px;
  border: 1px solid rgba(255,255,255,.62);
  border-radius: 15px;
  background: linear-gradient(145deg, rgba(255,255,255,.42), rgba(255,255,255,.2));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.7), 0 5px 16px rgba(45,55,68,.035);
}
#chat-details-panel .chat-details-online-behavior-title {
  margin: 0 0 2px;
  color: var(--text-secondary);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .08em;
}
#chat-details-panel .chat-details-online-behavior .form-group {
  min-height: 50px;
  margin: 0 !important;
  padding: 9px 0 !important;
  border: 0 !important;
  border-top: 1px solid rgba(103,112,120,.1) !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}
#chat-details-panel .chat-details-online-behavior .form-group:first-of-type { border-top: 0 !important; }
#chat-details-panel .chat-details-online-behavior .form-group > div:first-child { display: flex; min-width: 0; flex: 1; flex-direction: column; gap: 3px; }
#chat-details-panel .chat-details-online-behavior .form-group small { color: var(--text-secondary); font-size: 10px; line-height: 1.4; }
#chat-details-panel .chat-details-online-behavior .chat-details-clean-select { align-items: center; flex-direction: row; gap: 12px; }
#chat-details-panel .chat-details-online-behavior .chat-details-clean-select select { flex: 0 0 auto; min-width: 82px; min-height: 34px; padding: 6px 26px 6px 9px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); color: var(--text-primary); font-size: 12px; }
#chat-details-panel .win-body > .form-group:has(.switch):not(#details-affection-settings) {
  margin: 0 0 8px !important;
  padding: 12px 13px !important;
  border: 1px solid rgba(255,255,255,.62) !important;
  border-radius: 15px !important;
  background: linear-gradient(145deg, rgba(255,255,255,.42), rgba(255,255,255,.2)) !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.7), 0 5px 16px rgba(45,55,68,.035) !important;
}
#chat-details-panel .chat-details-entry-row {
  margin: 0 0 8px !important;
  padding: 12px 13px !important;
  border: 1px solid rgba(255,255,255,.62) !important;
  border-radius: 15px !important;
  background: linear-gradient(145deg, rgba(255,255,255,.42), rgba(255,255,255,.2)) !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.7), 0 5px 16px rgba(45,55,68,.035) !important;
}
#chat-details-panel .chat-details-entry-icon { color: var(--text-secondary) !important; }
#chat-details-panel .win-body > .form-group:has(> .switch) > label:first-child,
#chat-details-panel .win-body > .form-group:has(> .switch) > div:first-child > label:first-child,
#chat-details-panel .win-body > .form-group:has(> div > .switch) > div:first-child > label:first-child,
#chat-details-panel #details-affection-settings .chat-details-setting-head > label:first-child {
  color: var(--text-secondary) !important;
  transition: color .18s ease, font-weight .18s ease;
}
#chat-details-panel .win-body > .form-group:has(> .switch input:checked) > label:first-child,
#chat-details-panel .win-body > .form-group:has(> .switch input:checked) > div:first-child > label:first-child,
#chat-details-panel .win-body > .form-group:has(> div > .switch input:checked) > div:first-child > label:first-child,
#chat-details-panel #details-affection-settings:has(input:checked) .chat-details-setting-head > label:first-child {
  color: var(--text-primary) !important;
  font-weight: 700 !important;
}
#chat-details-panel #details-char-nickname-setting:has(#details-char-nickname-toggle:checked) > div > label,
#chat-details-panel .win-body > .form-group:has(#details-long-distance-toggle:checked) > div:first-child > label:first-child {
  color: var(--text-primary) !important;
  font-weight: 700 !important;
}
#chat-details-panel .win-body > .form-group.is-enabled > label:first-child,
#chat-details-panel .win-body > .form-group.is-enabled > div:first-child > label:first-child,
#chat-details-panel #details-affection-settings.is-enabled .chat-details-setting-head > label:first-child {
  color: var(--text-primary) !important;
  font-weight: 700 !important;
}

/* 模型中心的三类入口统一为同一套中性图标与操作按钮。 */
#win-model_config [data-model-center-card] .model-center-card-icon {
  border: 1px solid rgba(255,255,255,.76) !important;
  background: linear-gradient(145deg, rgba(255,255,255,.82), rgba(214,220,226,.72)) !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.88) !important;
  color: var(--text-secondary) !important;
}
#win-model_config [data-model-center-card] .model-center-actions .btn-primary {
  border-color: rgba(61,70,79,.72) !important;
  background: rgba(61,70,79,.84) !important;
  color: #fff !important;
}
#win-model_config [data-model-center-card] .model-center-actions .btn-outline,
#win-model_config [data-model-center-card] .model-center-add-profile,
#win-model_config [data-model-center-card] .model-center-fetch-row .btn,
#win-model_config .model-center-slot-switch button.is-active {
  border-color: rgba(255,255,255,.78) !important;
  background: rgba(255,255,255,.28) !important;
  color: var(--text-primary) !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.7) !important;
}

/* 模型中心的模型列表是明确操作，不使用淡化文字链接表现。 */
#win-model_config [data-model-center-card] .model-center-fetch-row .btn {
  min-height: 38px !important;
  padding: 8px 15px !important;
  border: 1px solid rgba(77,86,95,.7) !important;
  border-radius: 12px !important;
  background: #606870 !important;
  color: #fff !important;
  font-weight: 750 !important;
  box-shadow: 0 5px 12px rgba(55,64,73,.14), inset 0 1px 0 rgba(255,255,255,.2) !important;
}

#win-model_config [data-model-center-card] .model-center-fetch-row .btn:hover,
#win-model_config [data-model-center-card] .model-center-fetch-row .btn:active {
  background: #515a63 !important;
}

#win-model_config [data-model-center-card] .model-center-fetch-button {
  border: 1px solid rgba(77,86,95,.7) !important;
  background: #606870 !important;
  color: #fff !important;
  box-shadow: 0 5px 12px rgba(55,64,73,.14), inset 0 1px 0 rgba(255,255,255,.2) !important;
}

#win-model_config [data-model-center-card] .model-center-fetch-button:hover,
#win-model_config [data-model-center-card] .model-center-fetch-button:active {
  background: #515a63 !important;
}

/* 设置一级菜单不再展示已由桌面 App / 聊天详情承载的旧入口。 */
#settings-lv1 .menu-item[onclick="openApp('model_config')"],
#settings-lv1 .menu-item[onclick="openSettingsLv2('tts')"],
#settings-lv1 .menu-item[onclick="openSettingsLv2('imagegen')"] {
  display: none !important;
}

/* 场景分享弹窗：让图片说明成为一张轻盈的“场景卡”，而不是普通表单。 */
#image-input-overlay.scene-compose-overlay {
  align-items: flex-end;
  padding: 0 10px max(10px, env(safe-area-inset-bottom, 0px));
  background: rgba(15, 23, 42, .3);
  backdrop-filter: blur(10px) saturate(112%);
  -webkit-backdrop-filter: blur(10px) saturate(112%);
}
#image-input-overlay.scene-compose-overlay .scene-compose-card {
  width: min(100%, 360px) !important;
  max-height: min(88%, 540px) !important;
  margin: 0 auto;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.82) !important;
  border-radius: 26px !important;
  background: linear-gradient(145deg, rgba(255,255,255,.96), rgba(246,249,252,.9)) !important;
  box-shadow: 0 18px 42px rgba(15,23,42,.18), inset 0 1px 0 rgba(255,255,255,.92);
  backdrop-filter: blur(22px) saturate(118%);
  -webkit-backdrop-filter: blur(22px) saturate(118%);
}
#image-input-overlay.scene-compose-overlay .scene-compose-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 22px 20px 12px;
  border-bottom: 0;
  background: transparent;
}
#image-input-overlay.scene-compose-overlay .scene-compose-kicker {
  margin-bottom: 5px;
  color: #8793a4;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .16em;
}
#image-input-overlay.scene-compose-overlay .scene-compose-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: #202b3b;
  font-size: 18px;
  font-weight: 760;
  letter-spacing: -.02em;
}
#image-input-overlay.scene-compose-overlay .scene-compose-title svg { color: #64748b; }
#image-input-overlay.scene-compose-overlay .scene-compose-header > .btn-icon {
  width: 34px;
  height: 34px;
  border: 1px solid rgba(148,163,184,.2);
  border-radius: 12px;
  color: #64748b;
  background: rgba(255,255,255,.44);
}
#image-input-overlay.scene-compose-overlay .scene-compose-body { padding: 0 20px 20px; }
#image-input-overlay.scene-compose-overlay .scene-compose-field { margin: 0 0 17px; }
#image-input-overlay.scene-compose-overlay .scene-compose-label {
  display: block;
  margin-bottom: 8px;
  color: #68778c;
  font-size: 12px;
  font-weight: 760;
  letter-spacing: .02em;
}
#image-input-overlay.scene-compose-overlay .scene-upload-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 7px;
  border: 1px solid rgba(148,163,184,.22);
  border-radius: 16px;
  background: rgba(255,255,255,.48);
}
#image-input-overlay.scene-compose-overlay .scene-file-button {
  flex: 0 0 auto;
  height: 34px;
  padding: 0 13px;
  border: 1px solid rgba(100,116,139,.26) !important;
  border-radius: 11px;
  color: #42536a !important;
  background: rgba(255,255,255,.72) !important;
  font-size: 12px;
  font-weight: 700;
}
#image-input-overlay.scene-compose-overlay .scene-file-name {
  min-width: 0;
  overflow: hidden;
  color: #8a96a6;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#image-input-overlay.scene-compose-overlay .scene-compose-hint {
  margin: 7px 2px 0;
  color: #9aa5b4;
  font-size: 10px;
  line-height: 1.45;
}
#image-input-overlay.scene-compose-overlay .scene-compose-story-field { margin-bottom: 20px; }
#image-input-overlay.scene-compose-overlay .scene-compose-textarea {
  display: block;
  width: 100%;
  box-sizing: border-box;
  min-height: 104px;
  padding: 13px 14px;
  resize: none;
  border: 1px solid rgba(148,163,184,.28);
  border-radius: 16px;
  outline: none;
  color: #334155;
  background: rgba(255,255,255,.54);
  font-size: 13px;
  line-height: 1.6;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.72);
}
#image-input-overlay.scene-compose-overlay .scene-compose-textarea:focus {
  border-color: rgba(71,85,105,.36);
  background: rgba(255,255,255,.72);
  box-shadow: 0 0 0 3px rgba(100,116,139,.08), inset 0 1px 0 rgba(255,255,255,.84);
}
#image-input-overlay.scene-compose-overlay .scene-compose-textarea::placeholder { color: #a4adba; }
#image-input-overlay.scene-compose-overlay .scene-compose-actions { display: flex; gap: 10px; }
#image-input-overlay.scene-compose-overlay .scene-compose-actions button {
  flex: 1;
  height: 44px;
  border-radius: 14px;
  font-size: 13px;
  font-weight: 760;
}
#image-input-overlay.scene-compose-overlay .scene-secondary-action {
  border: 1px solid rgba(100,116,139,.24) !important;
  color: #64748b !important;
  background: rgba(255,255,255,.48) !important;
}
#image-input-overlay.scene-compose-overlay .scene-primary-action {
  border: 1px solid rgba(51,65,85,.84) !important;
  color: #fff !important;
  background: #334155 !important;
  box-shadow: 0 6px 14px rgba(51,65,85,.18);
}

@media (max-width: 420px) {
  #image-input-overlay.scene-compose-overlay { padding-inline: 8px; }
  #image-input-overlay.scene-compose-overlay .scene-compose-header { padding: 20px 18px 10px; }
  #image-input-overlay.scene-compose-overlay .scene-compose-body { padding: 0 18px 18px; }
}

/* Online chat preset manager: system core stays quiet; the replaceable preset is the focus. */
#chat-prompt-panel .prompt-manager-body {
  padding: 16px;
  overflow-y: auto;
  scrollbar-width: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background:
    radial-gradient(circle at 92% 4%, rgba(143, 171, 215, 0.14), transparent 34%),
    linear-gradient(180deg, rgba(247, 249, 253, 0.96), rgba(241, 245, 251, 0.92));
}

#chat-prompt-panel .prompt-manager-body::-webkit-scrollbar {
  display: none;
}

#chat-prompt-panel .prompt-core-note,
#chat-prompt-panel .prompt-manager-card {
  border: 1px solid rgba(164, 181, 207, 0.34);
  background: rgba(255, 255, 255, 0.66);
  box-shadow: 0 14px 32px rgba(54, 72, 102, 0.08);
  backdrop-filter: blur(18px) saturate(135%);
  -webkit-backdrop-filter: blur(18px) saturate(135%);
}

#chat-prompt-panel .prompt-core-note {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 13px 14px;
  border-radius: 18px;
}

#chat-prompt-panel .prompt-core-note__icon {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  color: #667995;
  background: rgba(225, 233, 245, 0.78);
}

#chat-prompt-panel .prompt-core-note__icon svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

#chat-prompt-panel .prompt-core-note__copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

#chat-prompt-panel .prompt-core-note__copy strong,
#chat-prompt-panel .prompt-manager-heading h4,
#chat-prompt-panel .prompt-name-field label,
#chat-prompt-panel .prompt-editor-heading span {
  color: var(--text-primary);
  font-weight: 700;
}

#chat-prompt-panel .prompt-manager-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

#chat-prompt-panel .prompt-core-note__copy strong {
  font-size: 13px;
}

#chat-prompt-panel .prompt-core-note__copy small,
#chat-prompt-panel .prompt-manager-heading p,
#chat-prompt-panel .prompt-editor-heading small {
  color: var(--text-secondary);
  font-size: 11px;
  line-height: 1.55;
}

#chat-prompt-panel .prompt-new-btn,
#chat-prompt-panel .prompt-add-btn,
#chat-prompt-panel .prompt-reset-btn {
  min-height: 34px;
  padding: 0 11px;
  border: 1px solid rgba(116, 143, 181, 0.3);
  border-radius: 11px;
  background: rgba(249, 251, 255, 0.72);
  color: #536985;
  font-size: 11px;
  font-weight: 700;
}

#chat-prompt-panel .prompt-new-btn {
  color: #fff;
  border-color: transparent;
  background: #405a78;
}

#chat-prompt-panel .prompt-file-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 10px;
}

#chat-prompt-panel .prompt-file-actions button {
  min-height: 38px;
  border: 1px solid rgba(116, 143, 181, 0.28);
  border-radius: 12px;
  background: rgba(250, 252, 255, 0.68);
  color: #5b6f89;
  font-size: 11px;
  font-weight: 700;
}

#chat-prompt-panel .prompt-preset-menu-wrap {
  position: relative;
  flex: 0 0 auto;
}

#chat-prompt-panel .prompt-preset-menu-btn {
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid rgba(159, 177, 204, 0.38);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.64);
  color: #687b94;
  font-size: 14px;
  letter-spacing: 1px;
}

#chat-prompt-panel .prompt-preset-menu {
  position: absolute;
  top: 48px;
  right: 0;
  z-index: 5;
  width: 116px;
  padding: 5px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  border: 1px solid rgba(154, 174, 202, 0.3);
  border-radius: 14px;
  background: rgba(252, 253, 255, 0.94);
  box-shadow: 0 14px 32px rgba(48, 65, 91, 0.16);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
}

#chat-prompt-panel .prompt-preset-menu[hidden] { display: none; }

#chat-prompt-panel .prompt-preset-menu button {
  min-height: 38px;
  padding: 0 11px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #42546d;
  font-size: 12px;
  text-align: left;
}

#chat-prompt-panel .prompt-preset-menu button:active {
  background: rgba(225, 232, 242, 0.7);
}

#chat-prompt-panel .prompt-preset-menu button.danger { color: #b45d66; }

#chat-prompt-panel .prompt-editor-actions {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 6px;
  min-width: auto;
}

#chat-prompt-panel .prompt-editor-heading .prompt-add-btn {
  width: 34px;
  min-width: 34px;
  padding: 0;
  border-radius: 11px;
  font-size: 19px;
  line-height: 1;
}

#chat-prompt-panel .prompt-entry-item__delete {
  color: #b85f68;
}

#chat-prompt-panel .prompt-entry-item__delete svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

#chat-prompt-panel .prompt-bottom-actions {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: 9px;
}

#chat-prompt-panel .prompt-save-preset-btn,
#chat-prompt-panel .prompt-apply-btn {
  min-height: 46px;
  border-radius: 15px;
  font-size: 13px;
  font-weight: 750;
}

#chat-prompt-panel .prompt-save-preset-btn {
  border: 1px solid rgba(74, 99, 130, 0.28);
  background: rgba(255, 255, 255, 0.72);
  color: #405a78;
}

#chat-prompt-panel .prompt-create-sheet {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: flex-end;
  visibility: hidden;
  pointer-events: none;
}

#chat-prompt-panel .prompt-create-sheet.active {
  visibility: visible;
  pointer-events: auto;
}

#chat-prompt-panel .prompt-create-sheet__backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(31, 41, 55, 0.22);
  opacity: 0;
  transition: opacity 180ms ease;
}

#chat-prompt-panel .prompt-create-sheet.active .prompt-create-sheet__backdrop {
  opacity: 1;
}

#chat-prompt-panel .prompt-create-sheet__card {
  position: relative;
  width: 100%;
  padding: 8px 15px calc(18px + env(safe-area-inset-bottom));
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 24px 24px 0 0;
  background: rgba(248, 250, 253, 0.94);
  box-shadow: 0 -18px 45px rgba(39, 53, 73, 0.16);
  backdrop-filter: blur(24px) saturate(145%);
  -webkit-backdrop-filter: blur(24px) saturate(145%);
  transform: translateY(105%);
  transition: transform 220ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

#chat-prompt-panel .prompt-create-sheet.active .prompt-create-sheet__card {
  transform: translateY(0);
}

/* 线上单聊默认预设 V2：固定骨架、动态引用与模块内编辑 */
#chat-prompt-panel .prompt-v2-skeleton,
#chat-prompt-panel .prompt-v2-module {
  border: 1px solid rgba(150, 166, 185, 0.28);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.58);
  box-shadow: 0 12px 28px rgba(55, 72, 94, 0.07);
}

#chat-prompt-panel .prompt-v2-skeleton {
  padding: 14px;
  margin-bottom: 12px;
}

#chat-prompt-panel .prompt-v2-section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  color: #26364b;
  font-size: 13px;
  font-weight: 800;
}

#chat-prompt-panel .prompt-v2-section-heading small,
#chat-prompt-panel .prompt-v2-module__head small,
#chat-prompt-panel .prompt-v2-locked-row small,
#chat-prompt-panel .prompt-v2-reference-row small {
  display: block;
  margin-top: 3px;
  color: #718198;
  font-size: 10px;
  line-height: 1.45;
  font-weight: 600;
}

#chat-prompt-panel .prompt-v2-section-heading--dynamic {
  margin-top: 15px;
  padding-top: 14px;
  border-top: 1px solid rgba(139, 157, 181, 0.2);
}

#chat-prompt-panel .prompt-v2-locked-list,
#chat-prompt-panel .prompt-v2-reference-list,
#chat-prompt-panel .prompt-v2-entry-list,
#chat-prompt-panel .prompt-v2-module-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

#chat-prompt-panel .prompt-v2-locked-list,
#chat-prompt-panel .prompt-v2-reference-list {
  margin-top: 9px;
}

#chat-prompt-panel .prompt-v2-locked-row,
#chat-prompt-panel .prompt-v2-reference-row {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid rgba(154, 170, 190, 0.2);
  border-radius: 14px;
  background: rgba(243, 246, 250, 0.68);
}

#chat-prompt-panel .prompt-v2-locked-row > span:nth-child(2),
#chat-prompt-panel .prompt-v2-reference-row > span:nth-child(2) {
  min-width: 0;
  flex: 1;
}

#chat-prompt-panel .prompt-v2-locked-row strong,
#chat-prompt-panel .prompt-v2-reference-row strong {
  color: #3c4b5e;
  font-size: 11px;
  font-weight: 800;
}

#chat-prompt-panel .prompt-v2-lock-icon {
  display: grid;
  place-items: center;
  width: 25px;
  height: 25px;
  flex: 0 0 25px;
  border-radius: 9px;
  color: #596b80;
  background: rgba(211, 220, 231, 0.78);
}

#chat-prompt-panel .prompt-v2-lock-icon svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

#chat-prompt-panel .prompt-v2-reference-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 8px;
  border-radius: 50%;
  background: #8a99aa;
  box-shadow: 0 0 0 4px rgba(138, 153, 170, 0.12);
}

#chat-prompt-panel .prompt-v2-reference-lock {
  flex: 0 0 auto;
  padding: 4px 7px;
  border-radius: 999px;
  color: #64758a;
  background: rgba(218, 225, 234, 0.72);
  font-size: 9px;
  font-weight: 800;
}

#chat-prompt-panel .prompt-v2-module-list {
  gap: 12px;
}

#chat-prompt-panel .prompt-v2-module {
  padding: 12px;
}

#chat-prompt-panel .prompt-v2-module__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

#chat-prompt-panel .prompt-v2-module__head > div {
  min-width: 0;
}

#chat-prompt-panel .prompt-v2-module__head strong {
  color: #26364b;
  font-size: 13px;
  font-weight: 850;
}

#chat-prompt-panel .prompt-v2-module__order {
  display: inline-grid;
  place-items: center;
  width: 27px;
  height: 22px;
  margin-right: 6px;
  border-radius: 7px;
  color: #637389;
  background: rgba(220, 227, 235, 0.82);
  font-size: 10px;
  font-weight: 850;
  vertical-align: 1px;
}

#chat-prompt-panel .prompt-v2-add {
  flex: 0 0 auto;
  min-height: 30px;
  padding: 0 9px;
  border: 1px solid rgba(107, 128, 151, 0.25);
  border-radius: 10px;
  color: #4d6077;
  background: rgba(248, 250, 253, 0.76);
  font-size: 10px;
  font-weight: 800;
}

#chat-prompt-panel .prompt-v2-entry {
  padding: 9px;
  border: 1px solid rgba(158, 174, 193, 0.24);
  border-radius: 14px;
  background: rgba(247, 249, 252, 0.62);
}

#chat-prompt-panel .prompt-v2-entry__head {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 6px;
  margin-bottom: 7px;
}

#chat-prompt-panel .prompt-v2-entry__index {
  color: #8996a6;
  font-size: 10px;
  font-weight: 850;
  text-align: center;
}

#chat-prompt-panel .prompt-v2-entry-name {
  min-width: 0;
  color: #3e4e63;
  font-size: 11px;
  font-weight: 800;
}

#chat-prompt-panel .prompt-v2-entry-name--builtin {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#chat-prompt-panel input.prompt-v2-entry-name {
  width: 100%;
  min-height: 29px;
  padding: 0 8px;
  border: 1px solid rgba(145, 163, 184, 0.32);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.72);
}

#chat-prompt-panel .prompt-v2-entry__switch {
  margin: 0;
  transform: scale(.72);
}

#chat-prompt-panel .prompt-v2-entry__actions {
  display: flex;
  align-items: center;
  gap: 3px;
}

#chat-prompt-panel .prompt-v2-entry__actions button {
  min-width: 26px;
  height: 27px;
  padding: 0 5px;
  border: 1px solid rgba(130, 148, 169, 0.25);
  border-radius: 8px;
  color: #65768b;
  background: rgba(255, 255, 255, 0.72);
  font-size: 11px;
  font-weight: 800;
}

#chat-prompt-panel .prompt-v2-entry__actions button:disabled {
  opacity: .28;
  cursor: default;
}

#chat-prompt-panel .prompt-v2-entry-delete:not(:disabled) {
  color: #9a6269;
}

#chat-prompt-panel .prompt-v2-entry-content {
  width: 100%;
  min-height: 74px;
  padding: 9px 10px;
  border: 1px solid rgba(145, 163, 184, 0.28);
  border-radius: 11px;
  color: #46576b;
  background: rgba(255, 255, 255, 0.74);
  font-size: 11px;
  line-height: 1.55;
  resize: vertical;
}

#chat-prompt-panel .prompt-v2-entry-content:focus,
#chat-prompt-panel input.prompt-v2-entry-name:focus {
  border-color: rgba(92, 119, 149, 0.52);
  box-shadow: 0 0 0 3px rgba(104, 133, 165, 0.1);
  outline: 0;
}

#chat-prompt-panel .prompt-v2-entry-lock-note {
  display: block;
  margin-top: 5px;
  color: #78879a;
  font-size: 9px;
  line-height: 1.4;
  font-weight: 600;
}

@media (max-width: 390px) {
  #chat-prompt-panel .prompt-v2-entry__head {
    grid-template-columns: 20px minmax(0, 1fr) auto;
  }

  #chat-prompt-panel .prompt-v2-entry__actions {
    grid-column: 2 / -1;
    justify-content: flex-end;
  }
}

/* V2 管理器按最终发送顺序呈现；权限徽标只描述性质，不参与排序。 */
#chat-prompt-panel .prompt-v2-order-intro {
  margin: 0 0 12px;
  padding: 13px 14px;
  border: 1px solid rgba(133, 148, 166, 0.25);
  border-radius: 16px;
  background: rgba(246, 248, 251, 0.68);
  color: #26364b;
}

#chat-prompt-panel .prompt-v2-order-intro strong,
#chat-prompt-panel .prompt-v2-order-intro small {
  display: block;
}

#chat-prompt-panel .prompt-v2-order-intro strong {
  font-size: 13px;
  font-weight: 850;
}

#chat-prompt-panel .prompt-v2-order-intro small {
  margin-top: 4px;
  color: #718198;
  font-size: 10px;
  line-height: 1.5;
  font-weight: 600;
}

#chat-prompt-panel .prompt-v2-sequence {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

#chat-prompt-panel .prompt-v2-sequence-node {
  padding: 11px 12px;
  border: 1px solid rgba(150, 166, 185, 0.28);
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.56);
  box-shadow: 0 8px 18px rgba(55, 72, 94, 0.045);
}

#chat-prompt-panel .prompt-v2-sequence-node__head {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

#chat-prompt-panel .prompt-v2-sequence-node__head strong {
  min-width: 0;
  color: #334357;
  font-size: 11px;
  font-weight: 850;
}

#chat-prompt-panel .prompt-v2-sequence-node > small {
  display: block;
  margin: 5px 0 0 74px;
  color: #78879a;
  font-size: 10px;
  line-height: 1.45;
  font-weight: 600;
}

#chat-prompt-panel .prompt-v2-sequence-node code {
  display: inline-block;
  margin: 8px 0 0 74px;
  padding: 4px 8px;
  border-radius: 7px;
  color: #26364b;
  background: rgba(218, 225, 234, 0.72);
  font: 800 10px/1.2 ui-monospace, SFMono-Regular, Consolas, monospace;
}

#chat-prompt-panel .prompt-v2-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 58px;
  min-height: 19px;
  padding: 0 6px;
  border-radius: 999px;
  color: #536275;
  background: rgba(222, 228, 236, 0.78);
  font-size: 8px;
  line-height: 1;
  letter-spacing: .04em;
  font-weight: 900;
  white-space: nowrap;
}

#chat-prompt-panel .prompt-v2-badge--locked {
  color: #f5f7fa;
  background: #5c6876;
}

#chat-prompt-panel .prompt-v2-badge--dynamic {
  color: #536275;
  background: rgba(217, 225, 234, 0.84);
}

#chat-prompt-panel .prompt-v2-badge--editable {
  color: #334357;
  background: rgba(236, 240, 244, 0.94);
}

#chat-prompt-panel .prompt-v2-badge--conditional {
  color: #606c79;
  background: rgba(205, 212, 221, 0.82);
}

#chat-prompt-panel .prompt-v2-module--ordered {
  padding: 12px;
  border: 1px solid rgba(143, 158, 177, 0.3);
  border-radius: 18px;
  background: rgba(248, 250, 252, 0.58);
  box-shadow: 0 10px 22px rgba(55, 72, 94, 0.055);
}

#chat-prompt-panel .prompt-v2-module--ordered .prompt-v2-module__head {
  margin-bottom: 9px;
}

#chat-prompt-panel .prompt-v2-module--ordered .prompt-v2-module__head small {
  max-width: 210px;
}

#chat-prompt-panel .prompt-v2-entry-state,
#chat-prompt-panel .prompt-v2-stage-status {
  flex: 0 0 auto;
  color: #647386;
  font-size: 8px;
  line-height: 1.2;
  font-weight: 850;
  white-space: nowrap;
}

#chat-prompt-panel .prompt-v2-entry-state.is-conditional,
#chat-prompt-panel .prompt-v2-stage-status.is-current {
  color: #3f4e60;
}

#chat-prompt-panel .prompt-v2-stage-status.is-current {
  padding: 4px 6px;
  border-radius: 999px;
  background: rgba(209, 216, 225, 0.8);
}

#chat-prompt-panel .prompt-v2-module--ordered .prompt-v2-add {
  color: #3f4e60;
  background: rgba(255, 255, 255, 0.82);
}

#chat-prompt-panel .prompt-v2-module--ordered .prompt-v2-entry__head {
  grid-template-columns: 22px minmax(0, 1fr) auto auto auto;
}

@media (max-width: 390px) {
  #chat-prompt-panel .prompt-v2-module--ordered .prompt-v2-entry__head {
    grid-template-columns: 20px minmax(0, 1fr) auto;
  }

  #chat-prompt-panel .prompt-v2-entry-state,
  #chat-prompt-panel .prompt-v2-stage-status,
  #chat-prompt-panel .prompt-v2-module--ordered .prompt-v2-entry__switch {
    grid-column: 2 / -1;
    justify-self: start;
  }

  #chat-prompt-panel .prompt-v2-module--ordered .prompt-v2-entry__actions {
    grid-column: 2 / -1;
  }

  #chat-prompt-panel .prompt-v2-sequence-node > small,
  #chat-prompt-panel .prompt-v2-sequence-node code {
    margin-left: 0;
  }
}

#chat-prompt-panel .prompt-create-sheet__handle {
  width: 34px;
  height: 4px;
  margin: 0 auto 13px;
  border-radius: 999px;
  background: rgba(91, 111, 137, 0.25);
}

#chat-prompt-panel .prompt-create-sheet__card h4 {
  margin: 0 4px 10px;
  color: var(--text-primary);
  font-size: 15px;
}

#chat-prompt-panel .prompt-create-sheet__name {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin: 0 4px 12px;
  color: #33445a;
  font-size: 12px;
  font-weight: 700;
}

#chat-prompt-panel .prompt-create-sheet__name input {
  box-sizing: border-box;
  width: 100%;
  height: 44px;
  padding: 0 12px;
  border: 1px solid rgba(145, 166, 194, 0.34);
  border-radius: 13px;
  outline: none;
  background: rgba(255, 255, 255, 0.75);
  color: var(--text-primary);
  font: inherit;
  font-weight: 500;
}

#chat-prompt-panel .prompt-create-sheet__name input:focus {
  border-color: rgba(81, 111, 151, 0.54);
  box-shadow: 0 0 0 3px rgba(88, 120, 164, 0.1);
}

#chat-prompt-panel .prompt-create-sheet__card > button {
  width: 100%;
  min-height: 64px;
  margin-top: 8px;
  padding: 11px 14px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 3px;
  border: 1px solid rgba(142, 163, 191, 0.24);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.68);
  color: var(--text-primary);
  text-align: left;
}

#chat-prompt-panel .prompt-create-sheet__card > button small {
  color: var(--text-secondary);
  font-size: 11px;
}

@media (prefers-reduced-motion: reduce) {
  #chat-prompt-panel .prompt-create-sheet__backdrop,
  #chat-prompt-panel .prompt-create-sheet__card {
    transition: none;
  }
}

#chat-prompt-panel .prompt-manager-card {
  padding: 14px;
  border-radius: 20px;
  display: flex;
  flex-direction: column;
  gap: 11px;
}

#chat-prompt-panel .prompt-manager-heading h4,
#chat-prompt-panel .prompt-manager-heading p {
  margin: 0;
}

#chat-prompt-panel .prompt-manager-heading h4 {
  font-size: 14px;
}

#chat-prompt-panel .prompt-manager-heading p {
  margin-top: 3px;
}

#chat-prompt-panel .prompt-preset-row,
#chat-prompt-panel .prompt-secondary-actions {
  display: flex;
  gap: 8px;
}

#chat-prompt-panel #prompt-preset-select,
#chat-prompt-panel #prompt-preset-name-input,
#chat-prompt-panel #prompt-editor-textarea {
  box-sizing: border-box;
  color: var(--text-primary);
  border: 1px solid rgba(159, 177, 204, 0.38);
  background: rgba(255, 255, 255, 0.72);
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

#chat-prompt-panel #prompt-preset-select,
#chat-prompt-panel #prompt-preset-name-input {
  height: 42px;
  border-radius: 13px;
  padding: 0 12px;
  font-size: 12px;
}

#chat-prompt-panel #prompt-preset-select {
  flex: 1;
  min-width: 0;
}

#chat-prompt-panel #prompt-preset-name-input,
#chat-prompt-panel #prompt-editor-textarea {
  width: 100%;
}

#chat-prompt-panel #prompt-editor-textarea {
  min-height: 230px;
  padding: 13px;
  border-radius: 15px;
  resize: vertical;
  font: 12px/1.65 inherit;
}

#chat-prompt-panel #prompt-preset-select:focus,
#chat-prompt-panel #prompt-preset-name-input:focus,
#chat-prompt-panel #prompt-editor-textarea:focus {
  border-color: rgba(94, 128, 176, 0.58);
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 0 0 3px rgba(112, 146, 194, 0.12);
}

#chat-prompt-panel .prompt-delete-btn,
#chat-prompt-panel .prompt-reset-btn {
  border: 0;
  background: transparent;
  font: inherit;
  cursor: pointer;
}

#chat-prompt-panel .prompt-delete-btn {
  min-width: 54px;
  border-radius: 13px;
  color: #b26066;
  background: rgba(242, 225, 228, 0.72);
  font-size: 12px;
  font-weight: 650;
}

#chat-prompt-panel .prompt-secondary-actions .btn {
  flex: 1;
  min-height: 38px;
  border-radius: 12px;
  font-size: 11px;
  background: rgba(255, 255, 255, 0.46);
  border-color: rgba(128, 153, 189, 0.42);
}

#chat-prompt-panel .prompt-name-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

#chat-prompt-panel .prompt-name-field label,
#chat-prompt-panel .prompt-editor-heading span {
  font-size: 12px;
}

#chat-prompt-panel .prompt-editor-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 2px;
}

#chat-prompt-panel .prompt-editor-heading > div:first-child {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

#chat-prompt-panel .prompt-reset-btn {
  flex: 0 0 auto;
  padding: 4px 0;
  color: #617694;
  font-size: 11px;
  font-weight: 650;
}

#chat-prompt-panel .prompt-apply-btn {
  width: 100%;
  min-height: 46px;
  border: 1px solid rgba(89, 121, 166, 0.26);
  border-radius: 16px;
  color: #fff;
  background: linear-gradient(135deg, #6f87a8, #526c91);
  box-shadow: 0 12px 24px rgba(65, 87, 122, 0.22);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

@media (max-width: 380px) {
  #chat-prompt-panel .prompt-manager-body {
    padding: 13px;
  }

  #chat-prompt-panel .prompt-manager-card {
    padding: 12px;
  }

  #chat-prompt-panel .prompt-preset-row {
    align-items: stretch;
  }
}

/* Thinking settings: prompt-first layout with quiet glass hierarchy. */
#chat-cot-panel .cot-settings-body {
  padding: 14px;
  overflow-y: auto;
  scrollbar-width: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background:
    radial-gradient(circle at 92% 2%, rgba(140, 166, 205, 0.14), transparent 32%),
    linear-gradient(180deg, rgba(247, 249, 253, 0.97), rgba(241, 245, 250, 0.94));
}

#chat-cot-panel .cot-settings-body::-webkit-scrollbar { display: none; }

#chat-cot-panel .cot-link-row,
#chat-cot-panel .cot-toggle-card,
#chat-cot-panel .cot-settings-card {
  box-sizing: border-box;
  width: 100%;
  border: 1px solid rgba(159, 177, 202, 0.34);
  background: rgba(255, 255, 255, 0.67);
  box-shadow: 0 13px 30px rgba(55, 72, 99, 0.075);
  backdrop-filter: blur(18px) saturate(132%);
  -webkit-backdrop-filter: blur(18px) saturate(132%);
}

#chat-cot-panel .cot-link-row {
  min-height: 66px;
  padding: 11px 13px;
  border-radius: 18px;
  display: flex;
  align-items: center;
  gap: 11px;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

#chat-cot-panel .cot-link-row[hidden] { display: none !important; }

#chat-cot-panel .cot-link-row__icon {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  color: #63758f;
  background: rgba(224, 232, 244, 0.82);
}

#chat-cot-panel .cot-link-row__icon svg { width: 17px; height: 17px; }
#chat-cot-panel .cot-link-row__text { min-width: 0; display: flex; flex: 1; flex-direction: column; gap: 2px; }
#chat-cot-panel .cot-link-row__text strong,
#chat-cot-panel .cot-toggle-card__copy strong,
#chat-cot-panel .cot-section-heading h4 { color: var(--text-primary); font-weight: 700; }
#chat-cot-panel .cot-link-row__text strong { font-size: 13px; }
#chat-cot-panel .cot-link-row__text small,
#chat-cot-panel .cot-toggle-card__copy small,
#chat-cot-panel .cot-section-heading small { color: var(--text-secondary); font-size: 11px; line-height: 1.45; }
#chat-cot-panel .cot-link-row__arrow { width: 17px; height: 17px; flex: 0 0 17px; color: #8794a7; }

#chat-cot-panel .cot-toggle-card {
  min-height: 76px;
  padding: 13px 14px;
  border-radius: 19px;
  display: flex;
  align-items: center;
  gap: 14px;
}

#chat-cot-panel .cot-toggle-card__copy { min-width: 0; display: flex; flex: 1; flex-direction: column; gap: 3px; }
#chat-cot-panel .cot-toggle-card__copy strong { font-size: 14px; }

#chat-cot-panel .cot-settings-card { padding: 14px; border-radius: 20px; }
#chat-cot-panel .cot-section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
#chat-cot-panel .cot-section-heading h4 { margin: 0; font-size: 13px; line-height: 1.35; }
#chat-cot-panel .cot-section-heading > div { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
#chat-cot-panel .cot-section-heading--actions { align-items: center; margin-bottom: 11px; }

#chat-cot-panel .cot-preset-row { position: relative; display: flex; gap: 8px; margin-top: 11px; }
#chat-cot-panel #cot-preset-select {
  min-width: 0;
  height: 42px;
  flex: 1;
  padding: 0 12px;
  border: 1px solid rgba(154, 173, 199, 0.4);
  border-radius: 13px;
  outline: none;
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.74);
  font: 12px/1 inherit;
}

#chat-cot-panel .cot-preset-menu { position: relative; flex: 0 0 44px; }
#chat-cot-panel .cot-preset-menu summary {
  width: 44px;
  height: 42px;
  box-sizing: border-box;
  display: grid;
  place-items: center;
  border: 1px solid rgba(154, 173, 199, 0.4);
  border-radius: 13px;
  color: #66758b;
  background: rgba(255, 255, 255, 0.62);
  cursor: pointer;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 1px;
  list-style: none;
}
#chat-cot-panel .cot-preset-menu summary::-webkit-details-marker { display: none; }
#chat-cot-panel .cot-preset-menu__popover {
  position: absolute;
  top: 48px;
  right: 0;
  z-index: 5;
  width: 142px;
  padding: 6px;
  border: 1px solid rgba(151, 169, 195, 0.36);
  border-radius: 15px;
  background: rgba(250, 252, 255, 0.96);
  box-shadow: 0 16px 34px rgba(41, 57, 80, 0.16);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}
#chat-cot-panel .cot-preset-menu__popover button {
  width: 100%;
  min-height: 38px;
  padding: 0 10px;
  border: 0;
  border-radius: 10px;
  color: var(--text-primary);
  background: transparent;
  font: 12px/1 inherit;
  text-align: left;
  cursor: pointer;
}
#chat-cot-panel .cot-preset-menu__popover button:active { background: rgba(224, 232, 243, 0.72); }
#chat-cot-panel .cot-preset-menu__popover .danger { color: #b45f67; }

#chat-cot-panel .cot-mode-tabs {
  padding: 4px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  border: 1px solid rgba(157, 176, 202, 0.3);
  border-radius: 16px;
  background: rgba(224, 231, 242, 0.58);
}
#chat-cot-panel .cot-mode-tabs button {
  min-height: 38px;
  border: 0;
  border-radius: 12px;
  color: #718097;
  background: transparent;
  font: 700 12px/1 inherit;
  cursor: pointer;
  transition: color .18s ease, background .18s ease, box-shadow .18s ease;
}
#chat-cot-panel .cot-mode-tabs button.active {
  color: #34455d;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 5px 14px rgba(62, 81, 108, 0.1);
}

#chat-cot-panel .cot-add-prompt-btn {
  min-height: 36px;
  padding: 0 11px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 1px solid rgba(111, 139, 177, 0.42);
  border-radius: 12px;
  color: #506985;
  background: rgba(246, 249, 253, 0.7);
  font: 700 11px/1 inherit;
  cursor: pointer;
}
#chat-cot-panel .cot-add-prompt-btn svg { width: 14px; height: 14px; }
#chat-cot-panel .cot-prompts-list { display: flex; flex-direction: column; gap: 10px; }
#chat-cot-panel .cot-prompt-empty { padding: 26px 8px; color: var(--text-secondary); font-size: 12px; text-align: center; }

#chat-cot-panel .cot-prompt-item {
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  border: 1px solid rgba(162, 180, 204, 0.32);
  border-radius: 16px;
  background: rgba(246, 249, 253, 0.64);
}
#chat-cot-panel .cot-prompt-item__top { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 8px; }
#chat-cot-panel .cot-prompt-item__title { min-width: 0; display: flex; align-items: center; gap: 7px; }
#chat-cot-panel .cot-prompt-item__index {
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: #65758c;
  background: rgba(221, 229, 241, 0.84);
  font-size: 10px;
  font-weight: 800;
}
#chat-cot-panel .cot-prompt-item input[type="text"],
#chat-cot-panel .cot-prompt-item textarea {
  box-sizing: border-box;
  border: 1px solid rgba(157, 175, 199, 0.34);
  outline: none;
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.72);
  font-family: inherit;
}
#chat-cot-panel .cot-prompt-item input[type="text"] { min-width: 0; width: 100%; height: 34px; padding: 0 9px; border-radius: 10px; font-size: 12px; font-weight: 700; }
#chat-cot-panel .cot-prompt-item textarea { width: 100%; min-height: 62px; padding: 9px 10px; resize: vertical; border-radius: 12px; font-size: 11px; line-height: 1.55; }
#chat-cot-panel .cot-prompt-item input[type="text"]:focus,
#chat-cot-panel .cot-prompt-item textarea:focus { border-color: rgba(95, 125, 164, 0.56); box-shadow: 0 0 0 3px rgba(104, 135, 176, 0.1); }
#chat-cot-panel .cot-prompt-item__actions { display: flex; align-items: center; gap: 4px; }
#chat-cot-panel .cot-prompt-switch { margin: 0 -3px; transform: scale(.76); }
#chat-cot-panel .cot-icon-btn {
  width: 30px;
  height: 30px;
  padding: 0;
  display: grid;
  place-items: center;
  border: 1px solid rgba(148, 168, 195, 0.36);
  border-radius: 9px;
  color: #687990;
  background: rgba(255, 255, 255, 0.58);
  cursor: pointer;
}
#chat-cot-panel .cot-icon-btn svg { width: 13px; height: 13px; }
#chat-cot-panel .cot-icon-btn:disabled { opacity: .28; cursor: default; }
#chat-cot-panel .cot-icon-btn--danger { color: #b86c73; }

/* Online Prompt V3 Prompt Manager. Scoped to the nested panel; the mobile
   page shell remains in its normal document flow. */
#chat-prompt-v3-panel .opv3-body { padding: 0; overflow-y: auto; background: linear-gradient(180deg, #f7f9fc 0%, #eef2f7 100%); scrollbar-width: none; }
#chat-prompt-v3-panel .opv3-body::-webkit-scrollbar { display: none; }
#chat-prompt-v3-panel #online-prompt-v3-root { min-height: 100%; padding: 14px; box-sizing: border-box; }
#chat-prompt-v3-panel .opv3-stack { display: flex; flex-direction: column; gap: 12px; max-width: 640px; margin: 0 auto; padding-bottom: 24px; }
#chat-prompt-v3-panel .opv3-card,
#chat-prompt-v3-panel .opv3-routed-card { background: rgba(255, 255, 255, .9); border: 1px solid rgba(208, 218, 231, .9); border-radius: 20px; box-shadow: 0 8px 24px rgba(49, 67, 91, .06); padding: 15px; }
#chat-prompt-v3-panel .opv3-editor-card { background: linear-gradient(145deg, rgba(255, 255, 255, .97), rgba(237, 243, 250, .94)); }
#chat-prompt-v3-panel .opv3-eyebrow { color: #8a98aa; font-size: 10px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
#chat-prompt-v3-panel .opv3-editor-label { display: block; margin: 7px 0 6px; color: #243247; font-size: 12px; font-weight: 800; }
#chat-prompt-v3-panel select,
#chat-prompt-v3-panel input,
#chat-prompt-v3-panel textarea { box-sizing: border-box; width: 100%; border: 1px solid #d5dfeb; border-radius: 12px; background: #fff; color: #26364b; font: inherit; outline: none; }
#chat-prompt-v3-panel select,
#chat-prompt-v3-panel input { min-height: 38px; padding: 0 11px; font-size: 12px; }
#chat-prompt-v3-panel textarea { padding: 10px 11px; font-size: 12px; line-height: 1.55; resize: vertical; }
#chat-prompt-v3-panel select:focus,
#chat-prompt-v3-panel input:focus,
#chat-prompt-v3-panel textarea:focus { border-color: #94acc8; box-shadow: 0 0 0 3px rgba(113, 145, 181, .13); }
#chat-prompt-v3-panel .opv3-binding-state { display: flex; flex-wrap: wrap; align-items: center; gap: 5px 10px; min-height: 28px; margin-top: 9px; color: #64748b; font-size: 11px; line-height: 1.45; }
#chat-prompt-v3-panel .opv3-binding-state strong { color: #324863; font-weight: 800; }
#chat-prompt-v3-panel .opv3-status-ok { color: #5f806e; }
#chat-prompt-v3-panel .opv3-link-button,
#chat-prompt-v3-panel .opv3-routed-link,
#chat-prompt-v3-panel .opv3-back-link { border: 0; padding: 0; background: transparent; color: #6986a8; cursor: pointer; font: inherit; font-size: 11px; font-weight: 800; }
#chat-prompt-v3-panel .opv3-link-button:hover,
#chat-prompt-v3-panel .opv3-routed-link:hover,
#chat-prompt-v3-panel .opv3-back-link:hover { color: #3f638c; }
#chat-prompt-v3-panel .opv3-action-row { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; margin-top: 12px; }
#chat-prompt-v3-panel .opv3-button { min-height: 32px; border: 1px solid #d3deeb; border-radius: 10px; padding: 0 11px; background: #fff; color: #53677f; cursor: pointer; font-size: 11px; font-weight: 800; }
#chat-prompt-v3-panel .opv3-button:active { transform: translateY(1px); }
#chat-prompt-v3-panel .opv3-button--primary { border-color: #87a3c1; background: #6f8eae; color: #fff; box-shadow: 0 5px 12px rgba(93, 122, 155, .18); }
#chat-prompt-v3-panel .opv3-button--quiet { border-color: transparent; background: transparent; color: #ae7075; }
#chat-prompt-v3-panel .opv3-section-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
#chat-prompt-v3-panel .opv3-section-head h4 { margin: 4px 0 4px; color: #26364b; font-size: 14px; line-height: 1.3; }
#chat-prompt-v3-panel .opv3-section-head p,
#chat-prompt-v3-panel .opv3-detail-description,
#chat-prompt-v3-panel .opv3-note { margin: 0; color: #8693a4; font-size: 11px; line-height: 1.55; }
#chat-prompt-v3-panel .opv3-kind,
#chat-prompt-v3-panel .opv3-lock { flex: none; border: 1px solid #d9e2ec; border-radius: 999px; padding: 4px 8px; color: #8291a4; font-size: 10px; font-weight: 800; }
#chat-prompt-v3-panel .opv3-name-edit { margin-top: 11px; }
#chat-prompt-v3-panel .opv3-name-edit label,
#chat-prompt-v3-panel .opv3-form-grid label,
#chat-prompt-v3-panel .opv3-textarea-label { display: flex; flex-direction: column; gap: 5px; color: #66768a; font-size: 11px; font-weight: 800; }
#chat-prompt-v3-panel .opv3-name-edit > div { display: flex; gap: 7px; }
#chat-prompt-v3-panel .opv3-name-edit input { flex: 1; }
#chat-prompt-v3-panel .opv3-name-edit .opv3-button { flex: none; }
#chat-prompt-v3-panel .opv3-entries-card { padding-bottom: 10px; }
#chat-prompt-v3-panel .opv3-entry-list { display: flex; flex-direction: column; gap: 7px; margin-top: 13px; }
#chat-prompt-v3-panel .opv3-entry { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 5px; border: 1px solid #e0e7ef; border-radius: 14px; background: rgba(250, 252, 254, .88); transition: opacity .16s ease, background .16s ease; }
#chat-prompt-v3-panel .opv3-entry.is-disabled { opacity: .58; }
#chat-prompt-v3-panel .opv3-entry.is-boundary { border-style: dashed; background: #f2f5f8; }
#chat-prompt-v3-panel .opv3-entry-main { display: flex; min-width: 0; align-items: center; gap: 9px; border: 0; padding: 10px 5px 10px 10px; background: transparent; color: inherit; cursor: pointer; text-align: left; }
#chat-prompt-v3-panel .opv3-entry-index { display: grid; width: 22px; height: 22px; flex: none; place-items: center; border-radius: 8px; background: #eaf0f6; color: #7890aa; font-size: 10px; font-weight: 900; }
#chat-prompt-v3-panel .opv3-entry-copy { display: flex; min-width: 0; flex: 1; flex-direction: column; gap: 3px; }
#chat-prompt-v3-panel .opv3-entry-copy strong { overflow: hidden; color: #33465d; font-size: 12px; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
#chat-prompt-v3-panel .opv3-entry-copy small { overflow: hidden; color: #97a3b2; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
#chat-prompt-v3-panel .opv3-entry-chevron { color: #aab6c3; font-size: 20px; line-height: 1; }
#chat-prompt-v3-panel .opv3-entry-tools { display: flex; align-items: center; gap: 3px; padding-right: 7px; }
#chat-prompt-v3-panel .opv3-sort-actions { display: flex; gap: 3px; }
#chat-prompt-v3-panel .opv3-sort-actions button { width: 25px; height: 25px; border: 1px solid #dbe4ed; border-radius: 8px; background: #fff; color: #637b96; cursor: pointer; font-size: 13px; font-weight: 800; }
#chat-prompt-v3-panel .opv3-sort-actions button:disabled { opacity: .3; cursor: default; }
#chat-prompt-v3-panel .opv3-switch { position: relative; width: 30px; height: 18px; flex: none; border: 0; border-radius: 99px; padding: 0; background: #dce4ec; cursor: pointer; }
#chat-prompt-v3-panel .opv3-switch span { position: absolute; top: 3px; left: 3px; width: 12px; height: 12px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(40, 59, 82, .2); transition: transform .15s ease; }
#chat-prompt-v3-panel .opv3-switch.is-on { background: #8eae9d; }
#chat-prompt-v3-panel .opv3-switch.is-on span { transform: translateX(12px); }
#chat-prompt-v3-panel .opv3-add-entry { width: 100%; margin-top: 10px; border: 1px dashed #b6c8da; border-radius: 12px; padding: 9px; background: transparent; color: #738da9; cursor: pointer; font-size: 11px; font-weight: 800; }
#chat-prompt-v3-panel .opv3-routed-card { border-color: #d8d0c3; background: linear-gradient(145deg, rgba(255, 253, 249, .96), rgba(248, 245, 238, .92)); }
#chat-prompt-v3-panel .opv3-routed-card h4 { margin-bottom: 3px; }
#chat-prompt-v3-panel .opv3-routed-link { display: block; margin-top: 12px; }
#chat-prompt-v3-panel .opv3-detail-card h4 { margin: 8px 0 6px; color: #2e4057; font-size: 16px; }
#chat-prompt-v3-panel .opv3-back-link { display: inline-block; margin-bottom: 8px; }
#chat-prompt-v3-panel .opv3-preview-box,
#chat-prompt-v3-panel .opv3-readonly-box { margin: 13px 0; border: 1px solid #dce5ee; border-radius: 14px; padding: 12px; background: #f8fafc; color: #718095; font-size: 11px; line-height: 1.6; }
#chat-prompt-v3-panel .opv3-preview-box pre { max-height: 300px; margin: 0; overflow: auto; color: #3f536b; font: 11px/1.6 ui-monospace, SFMono-Regular, Consolas, monospace; white-space: pre-wrap; user-select: text; }
#chat-prompt-v3-panel .opv3-preview-box small { display: block; margin-top: 8px; color: #a0aab6; font-size: 10px; }
#chat-prompt-v3-panel .opv3-preview-empty { color: #98a4b2; }
#chat-prompt-v3-panel .opv3-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
#chat-prompt-v3-panel .opv3-textarea-label { margin-top: 10px; }
#chat-prompt-v3-panel .opv3-inline-empty,
#chat-prompt-v3-panel .opv3-empty { padding: 18px 8px; color: #8997a8; font-size: 12px; text-align: center; }
#chat-prompt-v3-panel .opv3-empty { display: flex; min-height: 160px; align-items: center; justify-content: center; flex-direction: column; gap: 6px; }
#chat-prompt-v3-panel .opv3-empty strong { color: #53677e; font-size: 13px; }
#chat-prompt-v3-panel .opv3-empty small { color: #99a5b3; font-size: 11px; }
#chat-prompt-v3-panel .opv3-empty button { margin-top: 8px; border: 1px solid #cfdae6; border-radius: 9px; padding: 7px 12px; background: #fff; color: #6883a0; cursor: pointer; font-size: 11px; font-weight: 800; }
#chat-prompt-v3-panel .opv3-thinking-manager { display: flex; flex-direction: column; gap: 8px; }
#chat-prompt-v3-panel .opv3-thinking-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; border-top: 1px solid #e8edf2; padding-top: 9px; }
#chat-prompt-v3-panel .opv3-thinking-fields { display: flex; min-width: 0; flex: 1; flex-direction: column; gap: 6px; }
#chat-prompt-v3-panel .opv3-thinking-fields input { min-height: 32px; font-size: 11px; }
#chat-prompt-v3-panel .opv3-thinking-fields textarea { min-height: 54px; font-size: 11px; }
#chat-prompt-v3-panel .opv3-thinking-fields small { color: #9aa6b4; font-size: 10px; }
#chat-prompt-v3-panel [hidden] { display: none !important; }
@media (max-width: 380px) {
  #chat-prompt-v3-panel #online-prompt-v3-root { padding: 10px; }
  #chat-prompt-v3-panel .opv3-card,
  #chat-prompt-v3-panel .opv3-routed-card { border-radius: 17px; padding: 12px; }
  #chat-prompt-v3-panel .opv3-form-grid { grid-template-columns: 1fr; }
}

#chat-cot-panel .cot-save-btn {
  position: sticky;
  bottom: 0;
  z-index: 3;
  width: 100%;
  min-height: 46px;
  flex: 0 0 46px;
  border: 0;
  border-radius: 15px;
  color: #fff;
  background: #3d5069;
  box-shadow: 0 10px 22px rgba(50, 68, 93, 0.2);
  font: 700 13px/1 inherit;
  cursor: pointer;
}

@media (max-width: 380px) {
  #chat-cot-panel .cot-settings-body { padding: 12px; }
  #chat-cot-panel .cot-settings-card { padding: 12px; }
  #chat-cot-panel .cot-prompt-item { padding: 9px; }
  #chat-cot-panel .cot-prompt-item__top { gap: 5px; }
  #chat-cot-panel .cot-prompt-item__actions { gap: 3px; }
  #chat-cot-panel .cot-icon-btn { width: 28px; height: 28px; }
  #chat-cot-panel .cot-prompt-switch { margin: 0 -5px; transform: scale(.7); }
}

/* 对话专属设置：扁平连续的设置行，仅保留大分组级容器。 */
#chat-details-panel .win-body > .form-group:not(.chat-details-appearance):not(.chat-details-worldbook-glass) {
  box-sizing: border-box;
  margin: 0 !important;
  padding: 0 3px !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}
#chat-details-panel .chat-details-settings-section-label {
  margin: 18px 3px 7px;
  padding: 0;
  color: var(--text-secondary);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .12em;
  line-height: 1.3;
}
#chat-details-panel #details-online-behavior-section {
  margin: 0 0 4px;
  padding: 0 13px;
  border: 1px solid rgba(255,255,255,.62);
  border-radius: 14px;
  background: linear-gradient(145deg, rgba(255,255,255,.42), rgba(255,255,255,.2));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.7), 0 5px 16px rgba(45,55,68,.035);
}
#chat-details-panel #details-online-behavior-title {
  display: none;
}
#chat-details-panel #details-online-behavior-section .form-group,
#chat-details-panel .win-body > .form-group:has(> .switch),
#chat-details-panel .win-body > .form-group:has(> div > .switch) {
  display: flex;
  min-height: 48px;
  box-sizing: border-box;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 !important;
  padding: 9px 3px !important;
  border: 0 !important;
  border-top: 1px solid rgba(103,112,120,.1) !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}
#chat-details-panel #details-online-behavior-section .form-group:first-of-type {
  border-top: 0 !important;
}
#chat-details-panel #details-online-behavior-section .form-group > div:first-child {
  display: flex;
  min-width: 0;
  flex: 1;
  flex-direction: column;
  gap: 3px;
}
#chat-details-panel #details-online-behavior-section .form-group > label:first-child,
#chat-details-panel #details-online-behavior-section .form-group > div:first-child > label:first-child,
#chat-details-panel .win-body > .form-group:has(> .switch) > label:first-child,
#chat-details-panel .win-body > .form-group:has(> div > .switch) > div:first-child > label:first-child {
  margin: 0 !important;
  color: var(--text-primary) !important;
  font-size: 12px !important;
  font-weight: 650 !important;
  line-height: 1.4;
}
#chat-details-panel #details-online-behavior-section .form-group small {
  color: var(--text-secondary);
  font-size: 10px;
  line-height: 1.4;
}
#chat-details-panel #details-online-behavior-section .chat-details-clean-select {
  flex-direction: row;
}
#chat-details-panel #details-online-behavior-section .chat-details-clean-select select {
  width: auto !important;
  min-width: 68px;
  max-width: 88px;
  min-height: 30px;
  padding: 4px 2px 4px 4px !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  color: var(--text-primary);
  font-size: 12px;
  text-align: right;
}
#chat-details-panel #details-online-behavior-section + .form-group,
#chat-details-panel #details-online-behavior-section + .form-group + .form-group {
  border-top: 1px solid rgba(103,112,120,.1) !important;
}
#chat-details-panel .win-body > .form-group:has(.switch):not(#details-affection-settings) {
  display: flex;
  min-height: 48px;
  box-sizing: border-box;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 !important;
  padding: 9px 3px !important;
  border: 0 !important;
  border-top: 1px solid rgba(103,112,120,.1) !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}
#chat-details-panel #details-affection-settings {
  display: block !important;
  padding: 6px 3px 1px !important;
  border-top: 1px solid rgba(103,112,120,.1) !important;
}
#chat-details-panel #details-affection-settings .chat-details-setting-head {
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
#chat-details-panel #details-affection-settings .chat-details-setting-head > label:first-child {
  margin: 0 !important;
  color: var(--text-primary) !important;
  font-size: 12px !important;
  font-weight: 650 !important;
}
#chat-details-panel #details-affection-controls {
  margin-top: 3px;
  padding: 5px 0 0;
  border-top: 1px solid rgba(103,112,120,.1);
}
#chat-details-panel #details-affection-controls > div:first-child {
  display: flex !important;
  flex-direction: column;
  gap: 0 !important;
}
#chat-details-panel #details-affection-controls > div:first-child > label {
  min-height: 35px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 !important;
  color: var(--text-secondary) !important;
  font-size: 11px !important;
}
#chat-details-panel #details-affection-controls input,
#chat-details-panel #details-affection-controls select {
  width: 92px !important;
  min-height: 30px !important;
  box-sizing: border-box;
  margin: 0 !important;
  padding: 5px 8px !important;
  border: 1px solid rgba(105,116,128,.14) !important;
  border-radius: 8px !important;
  background: rgba(255,255,255,.34) !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.7) !important;
  font-size: 11px;
}
#chat-details-panel #details-affection-stage {
  margin: 0 !important;
  padding: 5px 0 0;
  border-top: 1px solid rgba(103,112,120,.1);
  color: var(--text-secondary) !important;
  font-size: 10px !important;
  line-height: 1.4;
}
#chat-details-panel #details-context-settings {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 3px 12px;
  min-height: 48px;
  padding: 8px 3px !important;
  border-top: 1px solid rgba(103,112,120,.1) !important;
}
#chat-details-panel #details-context-settings > label:first-child {
  margin: 0 !important;
  color: var(--text-primary) !important;
  font-size: 12px !important;
  font-weight: 650 !important;
}
#chat-details-panel #details-context-message-limit {
  width: 62px !important;
  min-height: 30px !important;
  padding: 5px 7px !important;
  border-radius: 8px !important;
  font-size: 11px;
}
#chat-details-panel #details-context-settings [data-context-message-count-hint] {
  grid-column: 1 / -1;
  margin: 0 !important;
  color: var(--text-secondary);
  font-size: 10px;
  line-height: 1.4;
}

/* 对话专属设置：统一四级信息层级与自定义频率选择器。 */
#chat-details-panel .chat-details-settings-section-label {
  margin: 18px 3px 7px !important;
  color: var(--text-secondary) !important;
  font-size: 10px !important;
  font-weight: 600 !important;
  letter-spacing: .1em;
  line-height: 1.3;
}
#chat-details-panel .win-body > .form-group:has(.switch) label:first-child,
#chat-details-panel #details-online-behavior-section .form-group > div:first-child > label:first-child,
#chat-details-panel #details-context-settings > label:first-child,
#chat-details-panel #details-affection-settings .chat-details-setting-head > label:first-child {
  color: var(--text-primary) !important;
  font-size: 12px !important;
  font-weight: 650 !important;
  line-height: 1.4;
}
#chat-details-panel label[for="details-natural-reply-toggle"],
#chat-details-panel label[for="details-status-auto"],
#chat-details-panel label[for="details-allow-char-create-group"],
#chat-details-panel label[for="details-affection-toggle"],
#chat-details-panel label[for="details-cot-toggle"] {
  color: var(--text-primary) !important;
  font-size: 12px !important;
  font-weight: 650 !important;
  line-height: 1.4;
}
#chat-details-panel .win-body > .form-group.is-enabled > label:first-child,
#chat-details-panel .win-body > .form-group.is-enabled > div:first-child > label:first-child,
#chat-details-panel #details-affection-settings.is-enabled .chat-details-setting-head > label:first-child {
  font-weight: 650 !important;
}
#chat-details-panel .win-body > .form-group:has(> .switch input:checked) > label:first-child,
#chat-details-panel .win-body > .form-group:has(> .switch input:checked) > div:first-child > label:first-child,
#chat-details-panel .win-body > .form-group:has(> div > .switch input:checked) > div:first-child > label:first-child,
#chat-details-panel #details-affection-settings:has(input:checked) .chat-details-setting-head > label:first-child {
  font-weight: 650 !important;
}
#chat-details-panel #details-online-behavior-section .form-group small,
#chat-details-panel #details-char-nickname-setting small,
#chat-details-panel #details-context-settings [data-context-message-count-hint] {
  color: var(--text-secondary) !important;
  font-size: 10px !important;
  font-weight: 450 !important;
  line-height: 1.4;
}
#chat-details-panel #details-online-behavior-section .chat-details-clean-select select.chat-details-native-select {
  display: none !important;
}
#chat-details-panel #details-online-behavior-section .chat-details-clean-select {
  position: relative;
}
#chat-details-panel .chat-details-choice-trigger {
  display: inline-flex;
  min-width: 68px;
  min-height: 30px;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 4px 0 4px 4px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--text-primary);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
#chat-details-panel .chat-details-choice-value {
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 600;
}
#chat-details-panel .chat-details-choice-chevron {
  color: var(--text-secondary);
  font-size: 17px;
  line-height: 1;
}
#chat-details-panel .chat-details-choice-sheet-overlay {
  position: absolute;
  inset: 0;
  z-index: 900;
  display: flex;
  align-items: flex-end;
  justify-content: stretch;
  padding: 0;
  background: rgba(25, 31, 35, .38);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .18s ease, visibility .18s ease;
}
#chat-details-panel .chat-details-choice-sheet-overlay.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}
#chat-details-panel .chat-details-choice-sheet {
  width: 100%;
  max-height: 52%;
  min-height: 220px;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  padding: 16px 16px 12px;
  border: 1px solid rgba(255,255,255,.7);
  border-bottom: 0;
  border-radius: 20px 20px 0 0;
  background: rgba(248,250,247,.96);
  box-shadow: 0 -16px 44px rgba(32,40,45,.18);
  transform: translateY(12px);
  transition: transform .18s ease;
}
#chat-details-panel .chat-details-choice-sheet-overlay.active .chat-details-choice-sheet {
  transform: translateY(0);
}
#chat-details-panel .chat-details-choice-sheet-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 11px;
  border-bottom: 1px solid rgba(103,112,120,.12);
}
#chat-details-panel .chat-details-choice-sheet-head > div {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
#chat-details-panel .chat-details-choice-sheet-head strong {
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 700;
}
#chat-details-panel .chat-details-choice-sheet-head small {
  color: var(--text-secondary);
  font-size: 10px;
  line-height: 1.4;
}
#chat-details-panel .chat-details-choice-sheet-close {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text-secondary);
  font-size: 19px;
  line-height: 1;
  cursor: pointer;
}
#chat-details-panel .chat-details-choice-options {
  min-height: 0;
  flex: 1;
  overflow-y: auto;
  padding-top: 5px;
}
#chat-details-panel .chat-details-choice-option {
  width: 100%;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 3px;
  border: 0;
  border-bottom: 1px solid rgba(103,112,120,.1);
  border-radius: 0;
  background: transparent;
  color: var(--text-primary);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}
#chat-details-panel .chat-details-choice-option[aria-selected="true"] {
  color: var(--text-primary);
  font-weight: 700;
}
#chat-details-panel .chat-details-choice-option-check {
  color: var(--text-secondary);
  opacity: 0;
  font-size: 14px;
  font-weight: 700;
}
#chat-details-panel .chat-details-choice-option[aria-selected="true"] .chat-details-choice-option-check {
  opacity: 1;
}
#chat-details-panel #details-affection-settings::before {
  content: "关系";
  display: block;
  margin: 0 3px 4px 0;
  color: var(--text-secondary);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .1em;
  line-height: 1.3;
}
#chat-details-panel #details-affection-settings {
  padding: 5px 3px 0 !important;
}
#chat-details-panel #details-affection-settings .chat-details-setting-head {
  min-height: 38px;
}
#chat-details-panel #details-affection-controls {
  margin-left: 10px;
  margin-top: 0;
  padding-left: 10px !important;
  border-left: 1px solid rgba(103,112,120,.12);
}
#chat-details-panel #details-affection-controls > div:first-child > label {
  min-height: 30px;
  color: var(--text-secondary) !important;
  font-size: 10px !important;
  font-weight: 500 !important;
}
#chat-details-panel #details-affection-controls input,
#chat-details-panel #details-affection-controls select {
  width: auto !important;
  min-height: 24px !important;
  min-width: 0 !important;
  margin: 0 !important;
  padding: 0 0 0 8px !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  color: var(--text-primary) !important;
  font-size: 10px !important;
  font-weight: 600 !important;
  text-align: right;
  appearance: none;
  -webkit-appearance: none;
}
#chat-details-panel #details-affection-value {
  width: 48px !important;
}
#chat-details-panel #details-affection-mode {
  width: 108px !important;
  min-height: 28px !important;
  padding: 3px 10px !important;
  border: 1px solid rgba(105,116,128,.2) !important;
  border-radius: 999px !important;
  background: rgba(255,255,255,.42) !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.56), 0 1px 3px rgba(45,55,68,.05) !important;
  text-align-last: right;
}
#chat-details-panel #details-affection-controls #details-affection-mode {
  width: 108px !important;
  min-height: 28px !important;
  padding: 3px 10px !important;
  border: 1px solid rgba(105,116,128,.2) !important;
  border-radius: 999px !important;
  background: rgba(255,255,255,.42) !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.56), 0 1px 3px rgba(45,55,68,.05) !important;
}
#chat-details-panel #details-affection-controls #details-affection-mode {
  padding-right: 28px !important;
}
#chat-details-panel #details-affection-controls > div:first-child > label:nth-child(2),
#chat-details-panel #details-affection-mode {
  cursor: pointer;
}
#chat-details-panel #details-affection-controls > div:first-child > label:nth-child(2) {
  position: relative;
}
#chat-details-panel #details-affection-controls > div:first-child > label:nth-child(2)::after {
  content: "›";
  position: absolute;
  top: 50%;
  right: 10px;
  z-index: 1;
  margin-left: 0;
  color: var(--text-secondary);
  font-size: 16px;
  font-weight: 500;
  line-height: 1;
  pointer-events: none;
  transform: translateY(-50%);
}
#chat-details-panel .win-body > .form-group:has(#details-long-distance-toggle) {
  display: block !important;
  min-height: 0;
  padding: 10px 3px !important;
}
#chat-details-panel .win-body > .form-group:has(#details-long-distance-toggle) > div:first-child {
  display: flex;
  width: 100%;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
}
#chat-details-panel .win-body > .form-group:has(#details-long-distance-toggle) > div:last-child {
  width: 100%;
  box-sizing: border-box;
  margin-top: 6px;
}
#chat-details-panel #details-affection-stage {
  padding-top: 3px !important;
  color: var(--text-secondary) !important;
  font-size: 10px !important;
  font-weight: 500 !important;
}
#chat-details-panel .switch {
  width: 42px;
  height: 22px;
}
#chat-details-panel .switch .slider:before {
  width: 16px;
  height: 16px;
}
#chat-details-panel .switch input:checked + .slider:before {
  transform: translateX(20px);
}
/* Memory v1.1 settings / scoped manager */
.memory-manager-overlay {
  position: fixed;
  inset: 0;
  z-index: 2400;
  display: block;
  background: var(--background, #f7f8fb);
}
.memory-manager-panel {
  width: 100%;
  height: 100%;
  max-height: none;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border: 0;
  border-radius: 0;
  background: var(--background, #f7f8fb);
  color: var(--text-primary, #222);
  box-shadow: none;
}
.memory-manager-header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  min-height: 54px;
  padding: max(10px, env(safe-area-inset-top)) 16px 10px;
  border-bottom: 1px solid var(--border, #e5e7eb);
  background: var(--surface, #fff);
}
.memory-manager-header h3 { margin: 0; font-size: 16px; text-align: center; }
.memory-manager-header-spacer { min-width: 1px; }
.memory-settings-back {
  justify-self: start;
  border: 0;
  background: transparent;
  color: var(--primary, #64748b);
  padding: 7px 0;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}
.memory-manager-body {
  width: min(100%, 520px);
  box-sizing: border-box;
  align-self: center;
  overflow-y: auto;
  padding: 18px 16px max(24px, env(safe-area-inset-bottom));
  scrollbar-width: none;
}
.memory-manager-body::-webkit-scrollbar { display: none; }
.memory-manager-panel [hidden] { display: none !important; }
.memory-manager-section { padding: 0 0 18px; border-bottom: 1px solid var(--border, #e5e7eb); }
.memory-manager-section + .memory-manager-section { padding-top: 18px; }
.memory-manager-section-title { margin: 0 0 10px; font-size: 15px; font-weight: 750; color: var(--text-primary, #222); }
.memory-settings-toggle, .memory-settings-field {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: 42px; font-size: 12px; color: var(--text-secondary, #5f6672);
}
.memory-settings-toggle + .memory-settings-toggle { margin-top: 4px; }
.memory-settings-toggle input { accent-color: var(--primary, #64748b); }
.memory-manager-trigger { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border, #e5e7eb); }
.memory-settings-field { align-items: center; margin-top: 8px; }
.memory-settings-field > span { flex: 0 0 112px; }
.memory-settings-field input, .memory-settings-field select, .memory-settings-field textarea {
  flex: 1; min-width: 0; box-sizing: border-box; border: 1px solid var(--border, #d9dde5);
  min-height: 36px; border-radius: 9px; padding: 7px 10px; background: var(--surface, #fff); color: inherit; font: inherit;
}
.memory-settings-field textarea { resize: vertical; line-height: 1.45; }
.memory-manager-hint, .memory-manager-status, .memory-manager-empty {
  margin: 8px 0 0; font-size: 10px; line-height: 1.5; color: var(--text-secondary, #77808e);
}
.memory-manager-status[data-tone="error"] { color: #9d5d68; }
.memory-manager-status[data-tone="success"] { color: #527a69; }
.memory-manager-actions, .memory-manager-card-actions { display: flex; gap: 8px; margin-top: 12px; }
.memory-settings-button {
  flex: 1; min-height: 38px; border: 1px solid var(--border, #d9dde5); border-radius: 10px;
  padding: 7px 10px; background: transparent; color: var(--text-primary, #303743); font: inherit; font-size: 11px; cursor: pointer;
}
.memory-settings-button.memory-settings-primary { border-color: transparent; background: var(--primary, #64748b); color: #fff; }
.memory-settings-button.memory-settings-danger { color: #985f6b; border-color: rgba(152,95,107,.3); }
.memory-manager-settings-actions { margin-top: 14px; }
.memory-manager-card { margin-top: 9px; padding: 12px; border: 1px solid var(--border, #e1e5ec); border-radius: 13px; background: var(--surface, #fff); }
.memory-manager-card.is-history { opacity: .76; }
.memory-manager-card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 11px; }
.memory-manager-card-marker { color: var(--text-secondary, #77808e); font-size: 10px; }
.memory-manager-card-preview { margin: 8px 0 0; color: var(--text-secondary, #626b79); font-size: 11px; line-height: 1.5; }
.memory-manager-card-lines { margin-top: 8px; color: var(--text-secondary, #626b79); font-size: 10px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
.memory-manager-current-section { padding-top: 18px; }
.memory-manager-subsection-title { margin: 0 0 8px; font-size: 12px; font-weight: 700; color: var(--text-primary, #222); }
.memory-manager-history { padding: 18px 0 0; font-size: 12px; }
.memory-manager-history summary { color: var(--text-secondary, #626b79); cursor: pointer; }
.memory-manager-editor { padding: 14px 0 0; }
.memory-manager-editor[hidden] { display: none; }
@media (max-width: 420px) {
  .memory-manager-body { padding-left: 14px; padding-right: 14px; }
  .memory-settings-field > span { flex-basis: 104px; }
}

/* Mobile shell continuity: let the active app own the safe-area surface and
   keep the shared header on the same visual plane as its page body. */
@media (max-width: 480px) {
  #phone-container.app-open::before {
    z-index: 0;
  }

  #phone-container.app-open #app-window-container .app-window > .win-header {
    background-color: var(--app-top-color, var(--bg-main));
    border-bottom-color: color-mix(
      in srgb,
      var(--app-top-color, var(--bg-main)) 90%,
      var(--border)
    );
    box-shadow: none;
  }
}
