:root{color-scheme:dark;--bg:#100e12;--surface:#1b171d;--ink:#f5f2f7;--muted:#b8b1bd;--quiet:#817987;--line:rgba(189,178,255,.18);--lav:#8fa8ff;--cyan:#88d8e9}*{box-sizing:border-box}body{margin:0;min-width:320px;background:radial-gradient(circle at 85% -10%,rgba(143,168,255,.12),transparent 34%),var(--bg);color:var(--ink);font:14px/1.55 "Space Grotesk",sans-serif}a{text-decoration:none;color:inherit}button,input,textarea{font:inherit}button{cursor:pointer}.character-main{width:min(1080px,calc(100% - 48px));margin:auto;padding:28px 0 80px}.character-back{display:inline-flex;align-items:center;gap:8px;padding:0 13px;min-height:38px;border:1px solid var(--line);border-radius:9px;color:var(--muted);font-size:11px;font-weight:700}.character-back:hover{border-color:var(--lav);color:var(--ink)}.character-back svg{width:15px}.character-hero{margin-top:36px;display:grid;grid-template-columns:minmax(260px,.75fr) 1.25fr;gap:42px;align-items:center}.character-visual{min-height:430px;border:1px solid var(--line);border-radius:20px;background:#18141b center/cover no-repeat}.character-copy h1,.author-hero h1,.works-title{margin:10px 0;font:600 clamp(42px,6vw,76px)/1 "Syne",Georgia,serif}.eyebrow{color:var(--lav);font-size:10px;font-weight:700;letter-spacing:.12em;text-transform:uppercase}.character-role{margin:0;color:var(--cyan);font-size:15px}.character-description,.info-panel p,.demo-note{color:var(--muted);line-height:1.7}.character-tags{display:flex;flex-wrap:wrap;gap:7px;margin:22px 0}.character-tags span{padding:6px 9px;border:1px solid var(--line);border-radius:99px;color:var(--muted);font-size:10px}.primary-button{min-height:44px;padding:0 16px;display:inline-flex;align-items:center;gap:8px;border:1px solid rgba(143,168,255,.56);border-radius:10px;background:#697fce;color:#10142a;font-weight:800}.primary-button:hover{background:var(--lav)}.primary-button svg{width:16px}.character-grid{display:grid;grid-template-columns:1fr 1fr;gap:16px;margin-top:22px}.info-panel{padding:24px;border:1px solid var(--line);border-radius:16px;background:var(--surface)}.info-panel h2{margin:8px 0;font:600 27px/1.1 "Syne",Georgia,serif}.author-link{width:100%;padding:10px 0;display:flex;align-items:center;gap:12px;border:0;background:transparent;color:var(--ink);text-align:left}.author-link>span:nth-child(2){display:grid;text-align:left}.author-link small{color:var(--muted);font-size:11px}.author-link>svg{margin-left:auto;width:17px;color:var(--lav)}.author-avatar{width:42px;height:42px;display:grid;place-items:center;border-radius:50%;background:linear-gradient(145deg,#536aa8,#5d4e83);color:#fff;font-weight:800}.author-avatar-large{width:92px;height:92px;font-size:28px}.author-hero{display:flex;align-items:center;gap:24px;margin-top:48px}.author-hero h1{margin:5px 0;font-size:56px}.author-hero p{margin:0;color:var(--muted)}.author-stats{display:flex;gap:12px;margin:30px 0}.author-stats span{min-width:130px;padding:14px 17px;border:1px solid var(--line);border-radius:12px;background:var(--surface);display:grid}.author-stats b{font-size:20px}.author-stats small{color:var(--quiet);font-size:10px}.works-title{font-size:34px;margin-top:42px}.author-works{display:grid;grid-template-columns:repeat(3,1fr);gap:12px}.author-work{padding:16px;border:1px solid var(--line);border-radius:13px;background:var(--surface)}.author-work:hover{border-color:var(--lav);transform:translateY(-1px)}.author-work h3{margin:0 0 6px;font:600 21px/1.1 "Syne",Georgia,serif}.author-work p{margin:0;color:var(--muted);font-size:11px}.demo-note{padding:13px 0;margin:10px 0 0;color:var(--cyan);font-size:11px}.profile-layout{display:grid;grid-template-columns:minmax(260px,.8fr) minmax(320px,1.2fr);gap:18px;margin-top:42px;align-items:start}.profile-preview,.profile-form{padding:28px;border:1px solid var(--line);border-radius:16px;background:var(--surface)}.profile-preview{text-align:center}.profile-preview h1{margin:18px 0 8px;font:600 35px/1.1 "Syne",Georgia,serif}.profile-preview p{margin:0;color:var(--muted);white-space:pre-wrap}.profile-preview .author-avatar{margin:0 auto}.profile-form h2{margin:9px 0 22px;font:600 29px/1.1 "Syne",Georgia,serif}.profile-form label{display:grid;gap:7px;margin:16px 0;color:var(--muted);font-size:11px}.profile-form input,.profile-form textarea{width:100%;border:1px solid var(--line);border-radius:10px;padding:11px 12px;background:#141116;color:var(--ink);outline:0;resize:vertical}.profile-form input:focus,.profile-form textarea:focus{border-color:var(--lav);box-shadow:0 0 0 3px rgba(143,168,255,.12)}.profile-status{min-height:20px;margin:13px 0 0;color:var(--cyan);font-size:11px}@media(max-width:700px){.character-main{width:calc(100% - 28px);padding-top:18px}.character-hero{grid-template-columns:1fr;gap:22px;margin-top:26px}.character-visual{min-height:300px}.character-copy h1{font-size:48px}.character-grid,.author-works,.profile-layout{grid-template-columns:1fr}.author-hero{margin-top:30px}.author-hero h1{font-size:44px}.author-stats{display:grid;grid-template-columns:repeat(3,1fr);gap:7px}.author-stats span{min-width:0;padding:10px}.author-stats b{font-size:15px}}
.comment-author-link{color:var(--ink);font-size:12px;font-weight:700;text-decoration:none}.comment-author-link:hover{color:var(--lav);text-decoration:underline}
.comments-panel{margin-top:22px;padding:24px;border:1px solid var(--line);border-radius:16px;background:var(--surface)}
.comments-heading{display:flex;align-items:center;justify-content:space-between}.comments-heading h2{margin:8px 0 0;font:600 30px/1.1 "Syne",Georgia,serif}.comments-count{min-width:32px;height:32px;display:grid;place-items:center;border:1px solid var(--line);border-radius:50%;color:var(--lav)}
.comments-list{display:grid;gap:0;margin-top:18px}.comments-empty{padding:18px 0;color:var(--quiet)}.comment-item{display:grid;grid-template-columns:36px minmax(0,1fr) auto;gap:11px;align-items:start;padding:16px 0;border-top:1px solid var(--line)}.comment-avatar{width:36px;height:36px;display:grid;place-items:center;border-radius:50%;background:linear-gradient(145deg,#536aa8,#5d4e83);color:#fff;font-size:12px;font-weight:800}.comment-body{min-width:0}.comment-meta{display:flex;align-items:baseline;gap:9px}.comment-meta time{color:var(--quiet);font-size:10px}.comment-body p{margin:5px 0 0;color:var(--muted);font-size:12px;line-height:1.6;white-space:pre-wrap;overflow-wrap:anywhere}.comment-remove{width:30px;height:30px;display:grid;place-items:center;border:1px solid transparent;border-radius:8px;background:transparent;color:var(--quiet)}.comment-remove:hover{border-color:var(--line);color:var(--lav)}.comment-remove svg{width:15px}
.comment-form{margin-top:12px;padding-top:18px;border-top:1px solid var(--line)}.comment-form label{display:block;margin-bottom:8px;color:var(--ink);font-size:11px;font-weight:700}.comment-form textarea{display:block;width:100%;min-height:86px;padding:12px;border:1px solid var(--line);border-radius:10px;background:#141116;color:var(--ink);outline:0;resize:vertical}.comment-form textarea:focus{border-color:var(--lav);box-shadow:0 0 0 3px rgba(143,168,255,.12)}.comment-form-footer{display:flex;align-items:center;justify-content:space-between;gap:14px;margin-top:10px}.comment-form-footer small{color:var(--quiet);font-size:10px}.comment-form-footer .primary-button{min-height:40px;font-size:11px}.comment-form-footer .primary-button svg{width:14px}@media(max-width:700px){.comments-panel{padding:18px}.comment-item{grid-template-columns:32px minmax(0,1fr) auto}.comment-avatar{width:32px;height:32px}.comment-form-footer{align-items:stretch;flex-direction:column}.comment-form-footer .primary-button{width:100%;justify-content:center}}
.comments-panel{margin-top:22px;padding:24px;border:1px solid var(--line);border-radius:16px;background:var(--surface)}
.comments-heading{display:flex;align-items:center;justify-content:space-between;gap:16px}.comments-heading h2{margin:8px 0 0;font:600 30px/1.1 "Syne",Georgia,serif}.comments-count{min-width:32px;height:32px;display:grid;place-items:center;border:1px solid var(--line);border-radius:50%;color:var(--lav);font-size:11px;font-weight:700}
.comments-list{display:grid;gap:0;margin-top:18px}.comments-empty{margin:0;padding:18px 0;color:var(--quiet);font-size:12px}.comment-item{display:grid;grid-template-columns:36px minmax(0,1fr) auto;gap:11px;align-items:start;padding:16px 0;border-top:1px solid var(--line)}.comment-avatar{width:36px;height:36px;display:grid;place-items:center;border-radius:50%;background:linear-gradient(145deg,#536aa8,#5d4e83);color:#fff;font-size:12px;font-weight:800}.comment-body{min-width:0}.comment-meta{display:flex;align-items:baseline;gap:9px}.comment-meta time{color:var(--quiet);font-size:10px}.comment-body p{margin:5px 0 0;color:var(--muted);font-size:12px;line-height:1.6;white-space:pre-wrap;overflow-wrap:anywhere}.comment-remove{width:30px;height:30px;display:grid;place-items:center;border:1px solid transparent;border-radius:8px;background:transparent;color:var(--quiet)}.comment-remove:hover{border-color:var(--line);color:var(--lav)}.comment-remove svg{width:15px}
.comment-form{margin-top:12px;padding-top:18px;border-top:1px solid var(--line)}.comment-form label{display:block;margin-bottom:8px;color:var(--ink);font-size:11px;font-weight:700}.comment-form textarea{display:block;width:100%;min-height:86px;padding:12px;border:1px solid var(--line);border-radius:10px;background:#141116;color:var(--ink);outline:0;resize:vertical}.comment-form textarea:focus{border-color:var(--lav);box-shadow:0 0 0 3px rgba(143,168,255,.12)}.comment-form-footer{display:flex;align-items:center;justify-content:space-between;gap:14px;margin-top:10px}.comment-form-footer small{color:var(--quiet);font-size:10px}.comment-form-footer .primary-button{min-height:40px;font-size:11px}.comment-form-footer .primary-button svg{width:14px}@media(max-width:700px){.comments-panel{padding:18px}.comment-item{grid-template-columns:32px minmax(0,1fr) auto}.comment-avatar{width:32px;height:32px}.comment-form-footer{align-items:stretch;flex-direction:column}.comment-form-footer .primary-button{width:100%;justify-content:center}}

/* Histories precede metadata; the main action resumes an exact branch. */
.character-chat-actions{display:flex;flex-wrap:wrap;gap:8px;align-items:center}
.character-chat-actions>a,.character-chat-actions>button{min-height:44px;border-radius:999px;justify-content:center}
.character-chat-actions [hidden]{display:none}
.character-hero{margin-top:22px;gap:30px}
.character-visual{min-height:340px}
.character-copy h1{font-size:clamp(34px,4vw,56px)}
.character-entry{margin-top:14px}
.character-tags{margin:12px 0}
.character-stories{margin-top:24px}
.character-stories-heading h2{font-size:22px;margin:0 0 12px}
.character-story{display:flex;align-items:center;justify-content:space-between;gap:14px;min-height:76px;padding:12px 16px;margin-top:8px;border-radius:16px;background:var(--ds-surface)}
.character-story>div{min-width:0}
.character-story strong{font-size:15px}
.character-story p{max-width:65ch;margin:4px 0 0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--ds-secondary);font-size:13px}
.character-story time{flex:none;font-size:12px;color:var(--ds-muted)}
.character-grid:has(.info-panel[hidden]){grid-template-columns:1fr}
.character-grid .info-panel[hidden]{display:none}
.character-grid .info-panel p:empty,.character-role:empty,.character-description:empty{display:none}
.character-page-actions{display:flex;align-items:center;justify-content:space-between;gap:10px}
.character-page-actions :is(a,button),.comment-remove{min-height:44px;border-radius:999px}
.comment-remove{min-width:44px}
@media(max-width:700px){
  .character-main{padding-top:14px}
  .character-hero{grid-template-columns:88px minmax(0,1fr);gap:16px;margin-top:18px;align-items:start}
  .character-visual{grid-row:1/span 2;min-height:116px;aspect-ratio:3/4;border-radius:16px}
  .character-copy h1{font-size:30px;line-height:1.1;margin:6px 0 10px}
  .character-role{font-size:13px;line-height:1.4}
  .character-copy{display:contents}
  .character-copy .eyebrow{display:none}
  .character-copy h1,.character-role{grid-column:2}
  .character-copy h1{grid-row:1;align-self:start}
  .character-role{grid-row:2;align-self:start;margin-bottom:8px}
  .character-description,.character-entry{grid-column:1/-1;margin:0}
  .character-description{font-size:14px;line-height:1.55}
  .character-tags{margin:0 0 12px}
  .character-chat-actions{display:grid;grid-template-columns:1fr 1fr}
  .character-chat-actions:has(a[hidden]){grid-template-columns:1fr}
  .character-stories{margin-top:22px}
  .character-grid{margin-top:22px;gap:12px}
  .info-panel{padding:18px}
  .info-panel h2{font-size:22px}
  .comment-form textarea{font-size:16px}
}

.character-chat-actions>.settings-status{grid-column:1/-1;flex-basis:100%;margin:0;color:var(--ds-secondary)}

/* Character detail tabs mirror the compact segmented navigation used elsewhere. */
.character-tabs{display:flex;gap:6px;width:max-content;max-width:100%;margin:34px 0 0;padding:4px;border:1px solid var(--line);border-radius:999px;background:rgba(255,255,255,.035)}
.character-tab{min-height:40px;padding:0 18px;border:0;border-radius:999px;background:transparent;color:var(--muted);font-size:13px;font-weight:650;white-space:nowrap;transition:background-color .18s ease,color .18s ease}
.character-tab:hover{color:var(--ink)}
.character-tab.is-active{background:var(--ds-raised,#292631);color:var(--ink);box-shadow:0 1px 3px rgba(0,0,0,.16)}
.character-tab:focus-visible{outline:2px solid var(--lav);outline-offset:2px}
.character-tab-panel{margin-top:14px}
.character-history-panel{min-height:190px;padding:24px;border:1px solid var(--line);border-radius:16px;background:var(--surface)}
.character-history-panel[hidden],.character-tab[hidden],.character-tabs[hidden]{display:none}
.character-stories-heading h2{margin:7px 0 4px;font:600 28px/1.15 "Syne",Georgia,serif}
.character-stories-heading p,.character-history-empty p,.stories-empty{margin:0;color:var(--ds-secondary,var(--muted));line-height:1.6}
.character-history-panel .character-story{border:1px solid var(--line);background:var(--ds-surface,var(--surface))}
.character-history-panel .character-story:hover{border-color:rgba(143,168,255,.4);background:var(--ds-raised,var(--surface))}
.character-history-empty{display:flex;align-items:center;justify-content:space-between;gap:18px;margin-top:24px;padding:18px;border:1px dashed var(--line);border-radius:14px}
.character-history-empty .secondary-button{min-height:40px;padding:0 16px;border:1px solid var(--line);border-radius:999px;background:transparent;color:var(--ink);font-weight:650}
@media(max-width:700px){
  .character-tabs{position:sticky;top:calc(var(--workspace-header-height, 0px) + 8px);z-index:4;width:100%;margin-top:24px}
  .character-tab{flex:1;min-width:0;padding:0 10px;font-size:12px}
  .character-history-panel{padding:18px;min-height:160px}
  .character-stories-heading h2{font-size:23px}
  .character-history-empty{align-items:stretch;flex-direction:column}
}
@media(prefers-reduced-motion:reduce){.character-tab{transition:none}}

/* Character profile mirrors a two-column public profile: identity on the left,
   scrollable tabs and panels on the right. */
.character-layout{display:grid;grid-template-columns:minmax(280px,360px) minmax(0,1fr);gap:40px;align-items:start;position:relative}
.character-side{min-width:0;position:relative}
.character-side .character-tabs{margin-top:0}
.character-stats{margin:0;color:var(--quiet);font-size:12px}
.character-stats::before{content:"\25CF\00a0";color:var(--lav);font-size:9px;vertical-align:1px}
.character-entry .character-tags:empty{display:none}
.character-entry .demo-note:empty{display:none}
.character-side .comments-list{max-height:340px;overflow-y:auto;overscroll-behavior:contain;padding-right:8px;scrollbar-width:thin;scrollbar-color:rgba(143,168,255,.35) transparent}
.character-side .comments-list::-webkit-scrollbar{width:6px}
.character-side .comments-list::-webkit-scrollbar-thumb{border-radius:99px;background:rgba(143,168,255,.3)}
.character-side #characterStoriesList{max-height:340px;overflow-y:auto;overscroll-behavior:contain;padding-right:6px;scrollbar-width:thin;scrollbar-color:rgba(143,168,255,.35) transparent}
.character-side #characterStoriesList::-webkit-scrollbar{width:6px}
.character-side #characterStoriesList::-webkit-scrollbar-thumb{border-radius:99px;background:rgba(143,168,255,.3)}
.character-side .character-story{margin-top:0}
@media(max-width:860px){
  .character-layout{grid-template-columns:1fr;gap:26px}
  .character-side .comments-list,.character-side #characterStoriesList{max-height:320px}
}
