:root { --topbar-height: 56px; --chat-shell-top-offset: 56px; --sidebar-width: 0px; --chat-shell-left-offset: 0px; }
body.chatfu-app { margin: 0; height: 100vh; height: 100dvh; overflow: hidden; background: #130b1c; color: #fff9fb; color-scheme: dark; font-family: system-ui, sans-serif; }
.chatfu-app-bar { position: fixed; inset: 0 0 auto; z-index: 110; height: var(--topbar-height); display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 4px 16px; background: #1b1024; border-bottom: 1px solid #4e344f; }
.chatfu-app-brand { display: flex; align-items: center; gap: 7px; color: #fff9fb; font-size: 1.15rem; font-weight: 800; letter-spacing: -.04em; text-decoration: none; }
.chatfu-app-brand img { border-radius: 9px; }
.chatfu-app-actions { display: flex; align-items: center; gap: 8px; }
.chatfu-app-credits { display: flex; align-items: center; min-height: 44px; padding: 0 10px; border: 1px solid #75506a; border-radius: 12px; color: #ffd4e0; font-size: .78rem; font-weight: 700; text-decoration: none; }
.chatfu-app-menu { width: 44px; height: 44px; border: 0; border-radius: 12px; background: #33213d; color: #fff9fb; font-size: 1.5rem; }
.chatfu-app :focus-visible { outline: 2px solid #ffb0c7; outline-offset: 3px; }
.chatfu-app-content { padding-top: var(--topbar-height); height: 100%; }
.chatfu-app .chat-page { height: calc(100vh - var(--topbar-height)); height: calc(100dvh - var(--topbar-height)); min-height: 0; }
.chatfu-app .chat-main { height: 100%; min-height: 0; overflow: hidden; }
.chatfu-app .chat-welcome { min-height: 0; flex: 1; overflow-y: auto; }
.chatfu-app .chat-messages-container { min-height: 0; overflow-y: auto; }
.chatfu-app .chatfu-scene-panel { flex: 0 0 auto; }
.chatfu-app .chat-messages { flex: 0 0 auto; overflow: visible; }
.chatfu-app .chat-input-area { flex: 0 0 auto; padding: 10px 16px max(12px, env(safe-area-inset-bottom)); }
.chatfu-app .chat-input-box { gap: 8px; padding: 10px; }
.chatfu-app .chat-input-area .input-footer:empty { display: none; }
.chatfu-app .chat-input-area .input-actions { display: none; }
.chatfu-app .chatfu-scene-panel { margin: 12px auto 0; font-size: .8rem; }
.chatfu-app .chatfu-scene-panel a { color: #ffc3d1; }
.chatfu-app-navigation { width: min(380px, calc(100% - 24px)); max-height: calc(100dvh - 32px); padding: 18px; border: 1px solid #815875; border-radius: 20px; background: #25182d; color: #fff9fb; }
.chatfu-app-navigation::backdrop { background: rgb(12 7 17 / 75%); }
.chatfu-app-navigation-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.chatfu-app-navigation-heading h2 { margin: 0; font-size: 1.3rem; }
.chatfu-app-navigation-heading button { width: 44px; height: 44px; border: 0; background: transparent; color: #fff9fb; font-size: 1.8rem; }
.chatfu-app-navigation nav { display: grid; gap: 5px; margin-top: 12px; }
.chatfu-app-navigation nav a, .chatfu-app-navigation nav button { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 9px 12px; border: 0; border-radius: 10px; background: #33213d; color: #fff9fb; text-decoration: none; font: inherit; text-align: left; }
.chatfu-app-navigation p { display: flex; gap: 16px; margin: 18px 12px 0; font-size: .8rem; }
.chatfu-app-navigation p a { color: #ffc3d1; }
.chatfu-character-header { flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 16px; border-bottom: 1px solid #4e344f; background: #1b1024; }
.chatfu-character-header[hidden] { display: none; }
.chatfu-character-header-profile { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 0; border: 0; background: transparent; color: #fff9fb; text-align: left; cursor: pointer; }
.chatfu-character-header-profile { flex: 1; }
.chatfu-character-header-avatar { display: grid; place-items: center; width: 54px; height: 64px; flex: 0 0 auto; overflow: hidden; border: 1px solid #815875; border-radius: 14px; background: #3a2644; color: #ffd4e0; font-size: 1.4rem; font-weight: 800; }
.chatfu-character-header-avatar img { width: 100%; height: 100%; object-fit: cover; object-position: center 25%; }
.chatfu-character-header-copy { min-width: 0; }
.chatfu-character-header-copy strong, .chatfu-character-header-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chatfu-character-header-copy strong { font-size: 1rem; line-height: 1.4; }
.chatfu-character-header-copy small { color: #d0bdd2; font-size: .72rem; }
.chatfu-character-header-copy p { max-width: 520px; margin: 3px 0 0; color: #e3d3e6; font-size: .78rem; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chatfu-character-header-settings { width: 44px; height: 44px; flex: 0 0 auto; border: 1px solid #75506a; border-radius: 12px; background: #33213d; color: #ffd4e0; }
.chatfu-character-details { width: min(430px, calc(100% - 24px)); max-height: calc(100dvh - 32px); padding: 22px; border: 1px solid #815875; border-radius: 20px; background: #25182d; color: #fff9fb; }
.chatfu-character-details::backdrop { background: rgb(12 7 17 / 75%); }
.chatfu-character-details .chatfu-character-detail-close { float: right; width: 44px; height: 44px; border: 0; background: transparent; color: #fff9fb; font-size: 1.8rem; }
.chatfu-character-details img { display: block; width: min(100%, 240px); max-height: 310px; object-fit: cover; object-position: top; margin: 0 auto 18px; border-radius: 16px; }
.chatfu-character-header img[hidden], .chatfu-character-details img[hidden] { display: none; }
.chatfu-character-details h2 { margin: 14px 0 8px; font-size: 1.5rem; }
.chatfu-character-details p { color: #e3d3e6; line-height: 1.5; overflow-wrap: anywhere; }
.chatfu-character-details small { color: #d0bdd2; }
@media (max-width: 600px) {
  .chatfu-app-bar { padding-inline: 12px; }
  .chatfu-character-header { padding: 8px 12px; }
  .chatfu-character-header-avatar { width: 46px; height: 56px; }
  .chatfu-character-header-copy p { max-width: 220px; }
  .chatfu-app .chat-input-area { padding-inline: 12px; }
  .chatfu-app .chatfu-next-moves { margin-bottom: 6px; gap: 4px; }
  .chatfu-app .chatfu-reply-idea { padding: 8px 10px; }
}
