/* Character core: one draft, one scroll surface, one whole-version action. */
#characterPanel [hidden] { display: none !important; }
#characterPanel .character-page { isolation: isolate; }
:root[data-theme="snow"] #characterPanel .character-page::before { background: linear-gradient(180deg, rgba(7,13,25,.22), rgba(7,13,25,.58) 48%, rgba(7,13,25,.74)); }
#characterPanel .character-topbar { flex-shrink: 0; gap: 8px; }
#characterPanel .character-title { flex: 1; }
#characterPanel .pc-top-action { border: 0; background: transparent; color: var(--text); min-height: 44px; padding: 8px; font: inherit; font-size: 14px; }
#characterPanel .character-scroll { display: block; padding: 20px var(--side-pad, 20px) 24px; scroll-padding: 20px; }
#characterPanel .pc-page { max-width: 760px; margin: 0 auto; }
#characterPanel .pc-current-summary { padding: 4px 0 22px; }
#characterPanel .pc-eyebrow, #characterPanel .pc-current-label { display: block; color: var(--text-soft); font-size: 12px; letter-spacing: .08em; margin-bottom: 9px; }
#characterPanel #pcCurrentTitle { font-size: 23px; font-weight: 500; margin: 0 0 8px; overflow-wrap: anywhere; }
#characterPanel #pcCurrentTime, #characterPanel .pc-version-time { font-size: 12px; color: var(--text-soft); }
#characterPanel .pc-draft-status { font-size: 13px; color: var(--text-soft); margin: 15px 0 0; line-height: 1.7; }
#characterPanel .pc-warning { color: #ad5f25; }
:root[data-theme="snow"] #characterPanel .pc-warning { color: #efd0a8; }
#characterPanel .pc-tabs { gap: 0; border-bottom: 1px solid var(--hairline); margin-bottom: 18px; }
#characterPanel .pc-tab { flex: 1; min-height: 48px; background: transparent; border: 0; border-bottom: 2px solid transparent; border-radius: 0; font: inherit; color: var(--text-soft); position: relative; }
#characterPanel .pc-tab.active { border-bottom-color: var(--text); color: var(--text); background: transparent; }
#characterPanel .pc-tab.is-dirty::after { content: ""; display: inline-block; width: 4px; height: 4px; border-radius: 50%; background: currentColor; vertical-align: middle; margin-left: 6px; }
#characterPanel .pc-editor-label { display: block; font-size: 13px; color: var(--text-soft); margin: 0 0 10px; }
#characterPanel .character-core-input { box-sizing: border-box; width: 100%; min-height: 45vh; padding: 18px; resize: vertical; font-size: 16px; line-height: 1.9; color: var(--text); background: var(--card-bg); border: 1px solid var(--card-line); border-radius: 16px; }
#characterPanel .character-editor-meta { margin: 10px 0; font-size: 12px; gap: 12px; line-height: 1.7; }
#characterPanel .pc-button { min-height: 44px; padding: 11px 15px; border: 1px solid var(--card-line); border-radius: 12px; color: var(--text); background: var(--card-bg); font: inherit; font-size: 14px; line-height: 1.5; cursor: pointer; }
#characterPanel button:disabled { opacity: .45; cursor: default; }
#characterPanel button:focus-visible, #characterPanel summary:focus-visible, #characterPanel input:focus-visible, #characterPanel textarea:focus-visible { outline: 2px solid var(--text-soft); outline-offset: 3px; }
#characterPanel .pc-primary { background: var(--text); color: var(--bg, #111820); border-color: transparent; }
#characterPanel .pc-secondary { background: transparent; }
#characterPanel #pcPreviewOpen { width: 100%; margin-top: 9px; }
#characterPanel .pc-avatar-settings { border-top: 1px solid var(--hairline); margin-top: 26px; padding-top: 12px; }
#characterPanel summary { min-height: 44px; padding: 11px 0; cursor: pointer; font-size: 14px; box-sizing: border-box; }
#characterPanel .character-identity { margin-top: 12px; }
#characterPanel .character-avatar { width: 56px; height: 56px; }
#characterPanel .character-name { font-size: 19px; }
#characterPanel .pc-footer { flex-shrink: 0; display: flex; align-items: center; justify-content: center; gap: 12px; padding: 13px var(--side-pad, 20px) calc(13px + env(safe-area-inset-bottom)); border-top: 1px solid var(--hairline); background: var(--card-bg); backdrop-filter: blur(18px); position: relative; z-index: 1; }
#characterPanel .pc-footer > .pc-button { flex: 1; max-width: 370px; }
#characterPanel .pc-footnote { margin: 0; line-height: 1.7; color: var(--text-soft); font-size: 12px; }
#characterPanel .pc-search { width: 100%; box-sizing: border-box; min-height: 46px; border: 1px solid var(--card-line); border-radius: 12px; background: var(--card-bg); color: var(--text); padding: 12px 14px; font: inherit; font-size: 16px; }
#characterPanel #pcHistoryCount { font-size: 12px; color: var(--text-soft); margin: 16px 0 10px; }
#characterPanel .pc-version { display: flex; gap: 8px; align-items: center; border-top: 1px solid var(--hairline); padding: 10px 0; }
#characterPanel .pc-version.pc-current { padding: 10px 12px; border: 1px solid var(--card-line); border-radius: 16px; background: var(--card-bg); margin-bottom: 18px; }
#characterPanel .pc-version-main { min-width: 0; flex: 1; text-align: left; background: transparent; color: var(--text); border: 0; padding: 10px 0; font: inherit; cursor: pointer; }
#characterPanel .pc-version-main > strong { display: block; font-size: 17px; font-weight: 500; line-height: 1.6; overflow-wrap: anywhere; }
#characterPanel .pc-version-main > span { display: block; line-height: 1.7; }
#characterPanel .pc-version-note { font-size: 13px; color: var(--text-soft); margin-top: 6px; white-space: pre-wrap; overflow-wrap: anywhere; }
#characterPanel .pc-version-changes { font-size: 12px; color: var(--text-soft); margin-top: 7px; }
#characterPanel .pc-version-more { min-width: 44px; min-height: 44px; align-self: flex-start; background: transparent; border: 0; color: var(--text); font-size: 17px; }
#characterPanel .pc-check { min-width: 44px; min-height: 44px; display: grid; place-items: center; }
#characterPanel .pc-check input { width: 19px; height: 19px; accent-color: var(--accent); }
#characterPanel .pc-empty { padding: 30px 6px; color: var(--text-soft); font-size: 14px; text-align: center; line-height: 1.8; }
#characterPanel .pc-more { display: block; width: 100%; margin-top: 12px; }
#characterPanel .pc-conflicts { border: 1px solid var(--card-line); background: var(--card-bg); border-radius: 12px; padding: 14px; font-size: 13px; line-height: 1.8; margin-bottom: 16px; }
#characterPanel .pc-conflict-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
#characterPanel .pc-conflict-row strong { margin-right: 5px; }
#characterPanel #pcPreviewSummary { color: var(--text-soft); font-size: 13px; line-height: 1.8; margin: 0 0 16px; overflow-wrap: anywhere; }
#characterPanel .pc-segments { display: flex; gap: 7px; margin-bottom: 12px; }
#characterPanel .pc-segments > button { flex: 1; }
#characterPanel .pc-segments > button.active { background: var(--card-bg); border-color: var(--text-soft); }
#characterPanel .pc-preview-text { white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; font-size: 16px; line-height: 1.95; margin: 24px 0; }
#characterPanel #pcDiff { border-top: 1px solid var(--hairline); margin-top: 24px; }
#characterPanel .pc-diff-note { color: var(--text-soft); font-size: 12px; line-height: 1.8; margin: 4px 0 16px; }
#characterPanel .pc-diff-block { padding: 14px; border-radius: 12px; border: 1px solid var(--card-line); margin: 12px 0; }
#characterPanel .pc-diff-label { display: block; font-size: 12px; margin-bottom: 8px; }
#characterPanel .pc-diff-text, #characterPanel .pc-diff-excerpt { white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; font-size: 15px; line-height: 1.9; margin: 0; }
#characterPanel .pc-diff-delete { background: rgba(183, 64, 77, .09); border-color: rgba(183, 64, 77, .25); }
#characterPanel .pc-diff-insert { background: rgba(40, 132, 95, .09); border-color: rgba(40, 132, 95, .25); }
#characterPanel .pc-diff-delete .pc-diff-label { color: #a82f40; }
#characterPanel .pc-diff-insert .pc-diff-label { color: #247352; }
#characterPanel .pc-diff-delete .pc-word-change { background: rgba(183, 64, 77, .18); text-decoration: line-through; }
#characterPanel .pc-diff-insert .pc-word-change { background: rgba(40, 132, 95, .19); text-decoration: underline; text-underline-offset: 3px; }
:root[data-theme="snow"] #characterPanel .pc-diff-delete .pc-diff-label { color: #f0aeb7; }
:root[data-theme="snow"] #characterPanel .pc-diff-insert .pc-diff-label { color: #99d9be; }
#characterPanel .pc-diff-equal { color: var(--text-soft); }
#characterPanel .pc-dialog { width: min(440px, calc(100% - 32px)); box-sizing: border-box; max-height: calc(100dvh - 48px); overflow: auto; color: var(--text); background: var(--bg, #18212c); border: 1px solid var(--card-line); border-radius: 20px; padding: 22px; box-shadow: 0 18px 70px #0005; }
#characterPanel .pc-dialog::backdrop { background: #080d1680; backdrop-filter: blur(5px); }
#characterPanel .pc-dialog h3 { margin: 0 0 15px; font: inherit; font-size: 21px; overflow-wrap: anywhere; }
#characterPanel .pc-dialog p { font-size: 14px; line-height: 1.8; color: var(--text-soft); }
#characterPanel .pc-dialog .pc-button { display: block; width: 100%; margin-top: 12px; }
#characterPanel .pc-dialog-cancel { background: transparent; }
#characterPanel .pc-field { display: block; font-size: 13px; margin: 18px 0; }
#characterPanel .pc-field input, #characterPanel .pc-field textarea { display: block; box-sizing: border-box; width: 100%; margin-top: 9px; padding: 12px; background: var(--card-bg); color: var(--text); border: 1px solid var(--card-line); border-radius: 10px; font: inherit; font-size: 16px; }
@media (min-width: 800px) { #characterPanel .character-scroll { padding-top: 30px; } #characterPanel .character-core-input { min-height: 48vh; } }
@media (prefers-reduced-motion: reduce) { #characterPanel { transition: none; } }

/* Read-only tool declarations, separate from the editable persona bundle. */
.pc-tools-open { margin-bottom: 16px; }
.pc-tools-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 12px 0; }
.pc-tools-toolbar p { flex: 1; min-width: 0; font-size: 13px; line-height: 1.6; overflow-wrap: anywhere; }
.pc-tools-toolbar button { flex-shrink: 0; }
.pc-tool { border-bottom: 1px solid var(--line, rgba(128,128,128,.25)); padding: 14px 0; }
.pc-tool-name { min-height: 28px; cursor: pointer; font-size: 14px; line-height: 1.7; overflow-wrap: anywhere; }
.pc-tool-description { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.8; font-size: 14px; }
.pc-tool-parameters summary { padding: 10px 0; cursor: pointer; font-size: 13px; }
.pc-tool-schema { margin: 8px 0; padding: 12px; border-radius: 8px; background: rgba(128,128,128,.08); font-size: 12px; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; }
