.chat-list-content,
.thread-messages {
  flex: 1;
  min-height: 0;
}

.chat-list-content { padding: 4px 0 var(--tab-space); }
.chat-list-content.is-empty { display: grid; place-items: center; }
.chat-list-content.is-empty .chat-list-rows { display: none; }
.chat-list-empty { display: grid; justify-items: center; gap: 20px; padding: 16px; text-align: center; }
.chat-list-empty p { margin: 0; color: #999b9c; font: 600 italic 1.25rem/1.2 var(--heading); }
.chat-list-rows { display: grid; }
.chat-list-row {
  display: grid;
  width: 100%;
  grid-template-columns: 50px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  min-height: 72px;
  padding: 10px 16px;
  background: transparent;
  text-align: start;
}
.chat-list-row:is(:focus-visible, :hover) { background: #ffffff0b; }
.chat-list-row .picture { border-radius: 50%; }
.chat-list-row .picture { width: 50px; height: 50px; }
.chat-list-copy { display: grid; min-width: 0; gap: 4px; }
.chat-list-meta, .chat-list-summary { display: flex; align-items: center; gap: 12px; min-width: 0; }
.chat-list-name, .chat-list-preview { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-list-time, .chat-list-preview { color: var(--muted); font-size: .8rem; }
.chat-unread { width: 8px; height: 8px; border-radius: 50%; background: #ff4d50; }
.chat-list-more { margin: 12px auto; display: block; }

.thread-page { isolation: isolate; }
.thread-art { position: absolute; z-index: -1; inset: 0; pointer-events: none; }
.thread-art .picture { width: 100%; height: 100%; }
.thread-title { display: flex; align-items: center; gap: 8px; min-width: 0; }
.thread-title span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thread-messages { --thread-bottom-padding: 16px; }
.thread-messages > .chat-scroll-content { padding: 12px 16px var(--thread-bottom-padding); }
.thread-messages > .chat-scroll-content > .button { display: block; margin: 0 auto 12px; }
.thread-transcript { --thread-message-gap: 30px; display: flex; flex-direction: column; gap: var(--thread-message-gap); }
.thread-message {
  --chat-reply-fill: rgb(33 28 39 / 85%);
  --narration-color: #818385;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  align-self: flex-start;
  gap: 16px;
  width: fit-content;
  max-width: 100%;
  padding: 20px;
  border-radius: 16px;
  border-end-start-radius: 0;
  background: var(--chat-reply-fill);
  -webkit-backdrop-filter: blur(24px);
  backdrop-filter: blur(24px);
  color: #fff;
  font-family: Manrope, system-ui, sans-serif;
  font-size: var(--chat-message-size, 16px);
  font-weight: 400;
  line-height: calc(var(--chat-message-size, 16px) + 12px);
  letter-spacing: 0;
}
.thread-message.from-user {
  --narration-color: #735b65;
  align-self: flex-end;
  border-end-start-radius: 16px;
  border-end-end-radius: 0;
  margin-inline-start: auto;
  background: linear-gradient(#e6e6e633, #e6e6e633) #f0cedc;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  color: #3a1927;
}
.thread-page[data-scrolling] .chat-inspiration-option,
.thread-page[data-scrolling] .chat-composer-dock::before {
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}
.chat-new-reply {
  position: absolute;
  inset-inline-end: 8px;
  inset-block-end: 100%;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: transparent;
}
.chat-new-reply span {
  width: 28px;
  height: 31px;
  padding-block-start: 5px;
  background: url('/icons/chat-new-message-bubble.svg') center / contain no-repeat;
  color: #111;
  font-size: 12px;
  font-weight: 500;
  line-height: 16px;
  text-align: center;
}
@media (prefers-reduced-motion: no-preference) {
  .chat-new-reply:not([hidden]) { animation: chat-new-reply-in 160ms ease-out both; }
}
@keyframes chat-new-reply-in {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}
.thread-message.pending { min-width: min(64px, 100%); }
.thread-message.pending:not([data-waiting]) {
  position: relative;
  isolation: isolate;
  background: none;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}
.thread-message.pending:not([data-waiting])::before {
  position: absolute;
  z-index: -1;
  inset: 0;
  inset-block-end: calc(-1 * (var(--thread-bottom-padding) + var(--chat-dock-height, 0px)));
  border-radius: inherit;
  background: var(--chat-reply-fill);
  -webkit-backdrop-filter: blur(24px);
  backdrop-filter: blur(24px);
  pointer-events: none;
  content: '';
}
@media (prefers-reduced-motion: no-preference) {
  .chat-stream-fade { animation: chat-stream-reveal 320ms linear both; }
}
@keyframes chat-stream-reveal {
  from { opacity: 0; }
  to { opacity: 1; }
}
.thread-waiting-dots {
  display: flex;
  align-items: center;
  gap: 3px;
  height: calc(var(--chat-message-size, 16px) + 12px);
}
.thread-waiting-dots i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: .55;
}
@media (prefers-reduced-motion: no-preference) {
  .thread-waiting-dots i { animation: thread-waiting-pulse 1.2s infinite; }
  .thread-waiting-dots i:nth-child(2) { animation-delay: .2s; }
  .thread-waiting-dots i:nth-child(3) { animation-delay: .4s; }
}
@keyframes thread-waiting-pulse {
  0%, 50%, 100% { opacity: .25; }
  25% { opacity: 1; }
}
.thread-outgoing-retry { display: flex; align-items: center; justify-content: flex-end; }
.thread-outgoing-retry .icon-button { color: #ff6678; }
.thread-outgoing-retry .thread-message { margin-inline-start: 0; }
.thread-outgoing-retry > .thread-message { max-width: calc(100% - 44px); }
.thread-reply-feedback { display: grid; gap: 8px; color: var(--body); }
.thread-reply-feedback .button { justify-self: start; }
.chat-message-text, .chat-opening-blocks { min-width: 0; max-width: 100%; }
.chat-message-text p {
  margin: 0;
  min-block-size: 1lh;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}
.chat-message-text p + p { margin-block-start: 16px; }
.chat-message-text em { color: var(--narration-color); font-style: normal; }
.chat-message-text strong { font-weight: 700; }
.chat-opening-blocks { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.thread-message .opening-video { margin-block-start: 0; }
.chat-opening-blocks > .picture { display: block; width: 104px; max-width: 100%; height: 176px; border-radius: 12px; }
.thread-message-media {
  max-width: min(90%, 440px);
  padding: 10px 13px;
  border: 1px solid #ffffff21;
  border-radius: 15px 15px 15px 5px;
  background: #201b24f0;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}
.thread-message-media .picture { display: block; width: min(64vw, 300px); max-width: 100%; border-radius: 10px; aspect-ratio: 1; }
.thread-image-button { display: block; max-width: 100%; padding: 0; background: transparent; }
.thread-generated-image {
  position: relative;
  display: grid;
  place-items: stretch;
  flex: none;
  width: min(100%, 312px);
  aspect-ratio: 3 / 4;
  overflow: hidden;
  border-radius: 16px;
}
.thread-generated-image:disabled { opacity: 1; }
.thread-generated-image[data-photo-ready] {
  border: .5px solid transparent;
  border-radius: 24px;
  background: linear-gradient(135deg, #6e4721, #e4b967, #9c6f36) border-box;
  box-shadow: 0 4px 12px #0006;
}
.thread-generated-image > img { width: 100%; height: 100%; min-height: 0; object-fit: cover; border-radius: inherit; }
.chat-image-placeholder {
  position: absolute;
  display: grid;
  place-items: center;
  inset: 0;
  overflow: hidden;
  border: 1px solid #eac7ef59;
  border-radius: inherit;
  background: radial-gradient(ellipse at center, #5c3570d9, #4b3058d9 50%, #392b40d9);
  color: #cbcccc;
  font-size: .8125rem;
  line-height: 18px;
  text-align: center;
}
.chat-image-placeholder::after {
  position: absolute;
  inset: 7px;
  border: 1px solid #fff4fc26;
  border-radius: 12px;
  pointer-events: none;
  content: '';
}
.chat-image-rise {
  position: absolute;
  inset: 0;
  background: linear-gradient(transparent, #c996bf21 12%, #c996bf4d 20%, #c996bf7d 28%, #c996bfab 44%);
  animation: chat-image-rise 30s linear both;
}
[data-image-downloading] .chat-image-rise { animation: none; }
.chat-image-placeholder-content { position: relative; display: grid; justify-items: center; gap: 8px; padding: 8px; }
.chat-image-stars {
  display: block;
  width: 48px;
  height: 48px;
  background: url('/icons/chat-image-generating-stars.png') left center / 1200px 48px no-repeat;
  animation: chat-image-stars 1667ms steps(25) infinite;
}
.chat-image-phase-clock { position: absolute; animation: chat-image-phase 11527ms linear; }
@keyframes chat-image-rise { from { transform: translateY(100%); } to { transform: translateY(5%); } }
@keyframes chat-image-stars { to { background-position-x: -1200px; } }
@keyframes chat-image-phase { from { visibility: hidden; } to { visibility: hidden; } }
.sheet.chat-image-confirm { background: #231c2a; }
.sheet.chat-image-confirm::backdrop, .sheet.chat-auto-image-guide::backdrop { background: #000c; }
.chat-image-confirm [data-payment='free'] .confirm-dialog-details { gap: 4px; }
.chat-image-confirm [data-payment='free'] .confirm-dialog-actions .button { min-height: 48px; }
.chat-image-confirm [data-payment='gems'] { gap: 8px; }
.chat-image-confirm-once {
  display: grid;
  min-height: 48px;
  place-items: center;
  margin: 0;
  color: #999b9c;
  font-size: .75rem;
}
.chat-image-quota { display: grid; grid-template-columns: minmax(90px, auto) minmax(50px, auto); justify-content: center; gap: 24px; padding: 4px 0; color: #c6bbcb; font-size: .875rem; text-align: center; }
.chat-image-quota > span { display: flex; align-items: center; justify-content: center; gap: 4px; }
.chat-image-quota > strong { color: white; font-weight: 500; }
.chat-image-quota-premium, .chat-image-quota-premium > strong { color: #f5cd80; }
.chat-image-guide { position: relative; display: grid; flex: none; padding: 0; text-align: start; color: white; }
.chat-image-guide-copy { font-size: 1rem; line-height: 28px; }
.chat-image-guide-entrance {
  justify-items: start;
  align-content: center;
  gap: 8px;
  width: min(100%, 382px);
  min-height: 104px;
  padding: 14px 64px 12px 20px;
  background: url('/icons/chat-action-entrance-bubble.svg') center / 100% 100% no-repeat;
  animation: chat-image-guide-enter .2s ease-out;
}
.thread-reply-actions + .chat-image-guide-entrance { margin-block-start: calc(8px - var(--thread-message-gap)); }
.chat-image-guide-entrance .chat-image-guide-copy { color: #ffffffb3; }
.chat-image-guide-entrance > img { position: absolute; inset-block-end: 12px; inset-inline-end: 12px; height: 48px; }
.chat-image-guide-cta { display: inline-flex; align-items: center; gap: 6px; }
.chat-image-guide-price { display: inline-flex; align-items: center; gap: 2px; font-size: .75rem; }
.chat-image-guide-entrance .chat-image-guide-cta { padding: 4px 16px; border-radius: 40px; background: #fff3; font-size: .875rem; }
.chat-image-guide-entrance .chat-image-guide-price { padding-inline: 6px; border-radius: 20px; background: #fff3; }
.chat-image-guide-message {
  justify-items: center;
  width: min(100%, 312px);
  min-height: 416px;
  align-content: center;
  padding: 36px 20px;
  border: 1px solid #eac7ef59;
  border-radius: 24px;
  background: linear-gradient(140deg, #694e66a8, #35283eef 41%, #563d61de 68%, #694e66a8);
  text-align: center;
}
.chat-image-guide-message > img { width: 140px; height: 128px; filter: drop-shadow(0 0 10px #e8bff14d); }
.chat-image-guide-message .chat-image-guide-copy { max-width: 234px; margin: 8px auto 32px; }
.chat-image-guide-message .chat-image-guide-cta { position: relative; justify-content: center; width: 100%; min-height: 52px; overflow: hidden; border: 1px solid #ffffffa6; border-radius: 16px; background: #ffffff26; font-weight: 700; }
.chat-image-guide-message .chat-image-guide-price { position: absolute; inset-block-start: 0; inset-inline-end: 0; padding: 2px 10px; border-radius: 6px; background: #d47eff66; color: #f0cedc; font-weight: 400; }
.chat-image-guide-corners { position: absolute; inset: 8px; border: 1px solid #eac7ef26; border-radius: 12px; pointer-events: none; }
.chat-image-guide-corners img { position: absolute; width: 24px; height: 24px; opacity: .5; }
.chat-image-guide-corners img:nth-child(1) { inset: 2px auto auto 2px; }
.chat-image-guide-corners img:nth-child(2) { inset: 2px 2px auto auto; transform: rotate(90deg); }
.chat-image-guide-corners img:nth-child(3) { inset: auto 2px 2px auto; transform: rotate(180deg); }
.chat-image-guide-corners img:nth-child(4) { inset: auto auto 2px 2px; transform: rotate(270deg); }
.chat-gallery-visual, .thread-reply-actions .icon-button { position: relative; }
.chat-image-free-badge { position: absolute; inset: -3px -4px auto auto; padding: 1px 3px; border-radius: 5px; background: #edd6e8; color: #271d2b; font-size: 8px; line-height: 10px; pointer-events: none; }
.sheet.chat-auto-image-guide { overflow-y: auto; background: #231c2a; }
.chat-auto-image-content { display: grid; justify-items: center; gap: 8px; padding: 12px 16px calc(32px + var(--safe-bottom)); text-align: center; }
.chat-auto-image-content .chat-options-handle { touch-action: none; }
.chat-auto-image-content > img { height: 160px; margin-top: 4px; }
.chat-auto-image-content > h2 { color: white; }
.chat-auto-image-content > p { margin: 0; color: #999b9c; font-size: 13px; line-height: 20px; }
.chat-auto-image-content .form-status { color: #ff8080; }
.chat-auto-image-content .form-status:empty { display: none; }
.chat-auto-image-actions { display: grid; width: 100%; margin-top: 40px; }
.chat-auto-image-actions > button { min-height: 52px; border-radius: 16px; }
.chat-auto-image-actions > .text-button { color: #999b9c; }
@keyframes chat-image-guide-enter { from { opacity: 0; transform: translateY(-4px); } }
@media (prefers-reduced-motion: reduce) {
  .chat-image-stars, .chat-image-guide-entrance { animation: none; }
  .chat-image-rise { animation: none; transform: translateY(65%); }
  [data-image-downloading] .chat-image-rise { transform: none; }
}
.thread-status { display: flex; align-items: center; gap: 8px; padding: 0 12px 8px; color: var(--muted); font-size: .8rem; }
.thread-status > span { flex: 1; }

.opening-actions {
  display: block;
  margin-block-start: 10px;
  padding: 8px 0;
  background: transparent;
  color: var(--muted);
  font-size: .75rem;
}

.sheet.chat-settings {
  inset: 0;
  width: 100%;
  height: var(--viewport-height);
  max-height: none;
  border: 0;
  border-radius: 0;
  background: var(--background);
}

.sheet.chat-settings { max-width: var(--app-max-width); }
.sheet.chat-settings::backdrop { background: transparent; }

.chat-settings-layout, .chat-photo-layout {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: var(--safe-top) var(--safe-right) var(--safe-bottom) var(--safe-left);
}

.chat-surface-heading {
  display: flex;
  flex: none;
  align-items: center;
  min-height: 52px;
  padding-inline: 4px 12px;
  gap: 4px;
}

.chat-surface-heading h2 {
  flex: 1;
  margin: 0;
  font: 600 italic 1.5rem/1.2 var(--heading);
}

.chat-settings-scroll {
  overflow: auto;
  overscroll-behavior: contain;
  padding: 14px 16px 24px;
}

.chat-settings-group + .chat-settings-group { margin-block-start: 24px; }
.chat-settings-group h3 {
  margin: 0 0 12px;
  color: #999b9c;
  font: 600 italic 1.25rem/1.2 var(--heading);
}
.chat-settings-rows { overflow: hidden; border: 1px solid #57445f4d; border-radius: 16px; background: var(--panel); }
.settings-row {
  display: flex;
  width: 100%;
  align-items: center;
  min-height: 71px;
  gap: 12px;
  padding: 12px 16px;
  background: transparent;
  color: var(--body);
  text-align: start;
  font-size: .875rem;
}
.settings-row + .settings-row { border-block-start: 1px solid #57445f4d; }
.settings-row :is(img, .chat-switch-track) { flex-shrink: 0; }
.settings-value { margin-inline-start: auto; color: #999b9c; }
.settings-row.settings-warning { color: #f26a73; }
.chat-switch-track {
  position: relative;
  display: block;
  width: 40px;
  height: 20px;
  margin-inline-start: auto;
  border-radius: 999px;
  background: #bfb2cd32;
}
.chat-switch-track::after {
  position: absolute;
  inset-block: 2px;
  inset-inline-start: 2px;
  width: 16px;
  border-radius: 50%;
  background: #776e80;
  content: '';
}

.sheet.chat-album {
  height: min(calc(var(--viewport-height) * .83), 780px);
  max-height: none;
  overflow: hidden;
  border: 0;
  border-radius: 20px 20px 0 0;
  background: #231c2a;
}
.chat-album::backdrop { background: #000c; }
.chat-gallery-sheet::backdrop { background: transparent; }
.sheet.chat-gallery-sheet[open] { animation: none; }
.chat-album-layout { display: flex; flex-direction: column; height: 100%; padding-block-end: var(--safe-bottom); }
.chat-album-handle {
  display: grid;
  flex: none;
  place-items: center;
  width: 100%;
  height: 32px;
  background: transparent;
}
.chat-album-handle::after { width: 40px; height: 4px; border-radius: 2px; background: #746a7b; content: ''; }
.chat-images-sheet .chat-surface-heading { padding-inline: 16px 12px; }
.chat-album-auto { display: flex; align-items: center; gap: 6px; color: #b3aab9; font-size: .69rem; }
.album-switch { display: grid; flex: none; place-items: center; height: 44px; padding: 0; background: transparent; }
.chat-album-content, .chat-gallery-scroll { flex: 1; min-height: 0; overscroll-behavior: contain; }
.chat-album-content { display: flex; flex-direction: column; gap: 16px; padding: 8px 16px 24px; overflow: hidden; }
.chat-album-stage { position: relative; flex: 1; min-height: 0; }
.chat-album-stage > .chat-album-status { position: absolute; inset: auto 0 0; color: white; text-align: center; }
.chat-album-stage > .chat-album-status:not(:empty) {
  width: fit-content;
  margin-inline: auto;
  padding: 4px;
  border-radius: 12px;
  background: #231c2a;
}
.chat-album-stage .state { min-height: 0; padding: 4px; }
.chat-album-status:empty { display: none; }
.chat-album-photo, .chat-gallery-photo {
  display: block;
  flex: none;
  width: 100%;
  aspect-ratio: 3 / 4;
  overflow: hidden;
  padding: 0;
  background: var(--background);
}
.chat-album-photo { border-radius: 20px; }
.chat-album-photos {
  display: flex;
  height: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior: contain;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}
.chat-album-photos::-webkit-scrollbar { display: none; }
.chat-album-slide {
  display: grid;
  flex: 0 0 100%;
  min-width: 0;
  place-items: center;
  container-type: size;
  scroll-snap-align: start;
}
.chat-album-loading { position: absolute; inset: 0; }
.chat-album-slide > :is(.chat-album-photo, .skeleton-chat-album) {
  width: min(100%, 420px);
  width: min(100%, 75cqh);
  max-height: 100%;
}
.chat-gallery-photos { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 2px; }
.chat-gallery-photos[data-count='1'] { flex: 1; min-height: 0; grid-template: minmax(0, 1fr) / minmax(0, 1fr); }
.chat-gallery-photos[data-count='1'] > .chat-gallery-photo { height: 100%; aspect-ratio: auto; }
.chat-gallery-photos[data-count='2'] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.chat-gallery-photos[data-count='3'] { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.chat-gallery-photos[data-count='3'] .chat-gallery-photo:first-child { grid-row: span 2; height: 100%; }
.chat-album-photo .picture, .chat-gallery-photo .picture { width: 100%; height: 100%; }
.chat-album-indicators { display: flex; justify-content: center; gap: 8px; min-height: 6px; flex: none; }
.chat-album-indicators > span { width: 6px; height: 6px; border-radius: 3px; background: #746a7b; }
.chat-album-indicators > [data-current] { width: 20px; background: #f3ccdc; }
.chat-album-actions { display: flex; flex: none; gap: 16px; }
.chat-album-action {
  display: flex;
  min-height: 52px;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid #57445f4d;
  border-radius: 16px;
  background: #392b40;
  color: var(--body);
  text-align: start;
  font-size: .83rem;
}
.chat-album-action img { flex-shrink: 0; }
.chat-album-action img:last-child { margin-inline-start: auto; }
.chat-album-action.album-roles { flex: 1; min-width: 0; }
.chat-album-role-avatar { flex: none; width: 32px; height: 32px; }
.chat-album-role-avatar .picture { width: 100%; height: 100%; border-radius: 50%; }
.album-roles > span:nth-child(2) { min-width: 0; }
.album-roles :is(strong, small) { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.album-roles small { display: block; margin-block-start: 2px; color: #b3aab9; }
.chat-gallery-scroll { padding-block-start: 12px; overflow: auto; }
.chat-gallery-scroll:has(> .chat-gallery-photos[data-count='1']) { display: flex; flex-direction: column; overflow: clip; }
.chat-photo-layout { background: var(--background); }
.chat-photo-layout .chat-surface-heading { justify-content: space-between; }
.chat-photo-character {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 8px;
  min-width: 0;
  min-height: 48px;
  padding: 0;
  background: transparent;
  color: white;
  text-align: start;
  font-size: 1rem;
  font-weight: 700;
}
.chat-photo-character .picture {
  width: 30px;
  height: 30px;
  flex: none;
  border: 1px solid #ffffff1a;
  border-radius: 50%;
  background: #ffffff1a;
}
.chat-photo-character > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-photo-viewport {
  display: block;
  flex: 1;
  width: 100%;
  min-height: 0;
  padding: 0;
  overflow: hidden;
  background: transparent;
  touch-action: none;
  user-select: none;
}
.chat-photo-track {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  transform: translate3d(var(--photo-drag, 0px), 0, 0);
  pointer-events: none;
}
.chat-photo-viewport[data-sliding] .chat-photo-track { transition: transform .16s ease-out; }
.chat-photo-page { position: absolute; inset-block: 0; width: 100%; overflow: hidden; }
.chat-photo-art, .chat-photo-page .picture { position: absolute; inset: 0; }
.chat-photo-page .picture { background: transparent; }
.chat-photo-page img { object-fit: contain; -webkit-user-drag: none; }
.chat-image-tools { display: flex; flex: none; justify-content: center; gap: clamp(24px, 10vw, 40px); padding: 12px 16px 24px; }
.chat-image-tools .icon-button { width: 48px; height: 48px; border-radius: 16px; background: #ffffff1a; }
.chat-image-status { margin: 0; color: var(--muted); text-align: center; font-size: .875rem; }
.chat-image-status:empty { display: none; }
.chat-image-action-form { display: grid; gap: 16px; }
.chat-image-reasons { display: grid; margin: 0; padding: 0; border: 0; }
.chat-image-reasons label { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 8px; cursor: pointer; }
.chat-image-reasons input { accent-color: #f0cedc; }
.chat-image-confirm-actions { display: flex; justify-content: end; gap: 8px; }
.chat-image-confirm-actions .button { flex: 1; }
.chat-album-handle { touch-action: none; }
@media (max-height: 500px) {
  .chat-album-handle { height: 24px; }
  .chat-album-content { gap: 8px; padding-block: 4px 8px; }
}
:is(.chat-settings-layout, .chat-album-layout, .chat-photo-layout):focus { outline: none; }

.thread-page > .chat-header { background: transparent; }
.thread-title .picture { width: 28px; height: 28px; flex: 0 0 28px; border-radius: 50%; }
.thread-composer .composer-send:disabled { opacity: 1; }
.thread-composer .composer-send:disabled::before { background: #ffffff1a; }
.thread-reply-actions { display: flex; align-self: flex-start; margin-block: -26px -12px; margin-inline-start: -16px; }
.thread-reply-actions .icon-button {
  --reply-action-offset: 4px;
  position: relative;
  width: 48px;
  height: 48px;
  background: transparent;
}
.thread-reply-actions .icon-button:nth-child(2) { --reply-action-offset: -4px; }
.thread-reply-actions .icon-button:nth-child(3) { --reply-action-offset: -12px; }
.thread-reply-actions .icon-button::before {
  position: absolute;
  inset-block-start: 12px;
  inset-inline-start: calc(12px + var(--reply-action-offset));
  width: 24px;
  height: 24px;
  border: 1px solid #ffffff33;
  border-radius: 50%;
  background: #000b;
  content: '';
}
.thread-reply-actions .icon-button img { position: relative; inset-inline-start: var(--reply-action-offset); }
.thread-reply-actions .icon-button:enabled:active::before { background: #453a4b; }
.chat-inspiration-panel { position: relative; margin-inline: 16px; color: #fff; }
.chat-inspiration-panel[data-state='options'] {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-block-end: 8px;
}
.chat-inspiration-option {
  min-height: 48px;
  padding: 10px 16px;
  border-radius: 16px;
  background: #bb6ce333;
  -webkit-backdrop-filter: blur(24px);
  backdrop-filter: blur(24px);
  color: inherit;
  font-size: 12px;
  line-height: 16px;
  overflow-wrap: anywhere;
  text-align: start;
}
.chat-inspiration-option[aria-pressed='true'] { background: #d47eff66; }
.chat-inspiration-panel[data-state='loading'] {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-block-end: 32px;
  color: #ffffff80;
  font-size: 12px;
  line-height: 16px;
}
.inspiration-dots { display: flex; align-items: center; gap: 6px; height: 12px; }
.inspiration-dots > span {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: linear-gradient(#e8c5f7, #986bb9);
  animation: inspiration-dot 1.2s ease-in-out infinite;
}
.inspiration-dots > span:nth-child(2) { animation-delay: .18s; }
.inspiration-dots > span:nth-child(3) { animation-delay: .36s; }
@keyframes inspiration-dot { 25% { transform: translateY(-4px); } 50% { transform: translateY(0); } }
@media (prefers-reduced-motion: reduce) { .inspiration-dots > span { animation: none; } }
.chat-inspiration-panel[data-state='guide'] { margin-block-end: 16px; }
.chat-inspiration-guide {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 88px;
  padding: 15px;
  border: 1px solid #f9d888;
  border-radius: 16px;
  background: linear-gradient(90deg, #ecb3431a, #f5cd801a), #0006;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  color: inherit;
  font-size: 14px;
  line-height: 20px;
  text-align: start;
}
.chat-inspiration-guide img { flex: none; object-fit: contain; }
.chat-inspiration-guide-copy { display: grid; flex: 1; gap: 4px; }
.chat-inspiration-guide strong { color: #f5cd80; font-weight: 600; }
.chat-inspiration-panel[data-state='retry'] { margin-block-end: 8px; text-align: center; }
.thread-page[data-text-size='small'] { --chat-message-size: 14px; }
.thread-page[data-text-size='large'] { --chat-message-size: 18px; }
.thread-page[data-appearance='light'] { --composer-fill: #f8f1f6; background: #f8f1f6; color: #241e29; color-scheme: light; }
.thread-page[data-appearance='light'] .thread-message:not(.from-user, .thread-message-media) {
  --chat-reply-fill: rgb(255 255 255 / 80%);
  --narration-color: #3e3f40;
  color: #060606;
}
.thread-page[data-appearance='light'] .thread-message-media { background: #fff9; }
.chat-context-fields { display: grid; min-width: 0; gap: 12px; margin: 0; padding: 0; border: 0; }
.chat-context-fields textarea { min-height: 135px; resize: vertical; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); font: inherit; font-size: 16px; }

.sheet.chat-mode-sheet {
  max-width: var(--app-max-width);
  border: 0;
  border-radius: 20px 20px 0 0;
  overflow: hidden;
  background: #231c2a;
  color: #fff;
}
.sheet.chat-mode-sheet::backdrop { background: #000c; }
.sheet.chat-mode-context {
  height: calc(var(--app-height, var(--viewport-height)) * .866);
}
.chat-mode-panel {
  --mode-gradient: linear-gradient(90deg, #f3ccdc, #fbeff4 53%, #dedeea);
  display: flex;
  flex-direction: column;
  max-height: inherit;
  padding-block-end: var(--safe-bottom);
  outline: 0;
}
.chat-mode-context .chat-mode-panel { height: 100%; }
.chat-mode-handle {
  display: grid;
  place-items: center;
  flex: none;
  height: 28px;
}
.chat-mode-sheet:not(.chat-mode-context) .chat-mode-handle { touch-action: none; }
.chat-mode-handle::after {
  width: 40px;
  height: 4px;
  border-radius: 4px;
  background: #786c7f;
  content: '';
}
.chat-mode-legacy-header { position: relative; padding: 0 56px 16px 16px; }
.chat-mode-legacy-header .icon-button { position: absolute; inset: 0 12px auto auto; }
.chat-mode-legacy-header p { margin: 8px 0 0; color: #b1b3b4; font-size: .875rem; }
.chat-mode-scroll {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 0 16px;
}
.chat-mode-scroll > * { flex: none; }
.chat-mode-section { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.chat-mode-section h3 { margin: 0; font: 600 italic 1.5rem/1.2 var(--heading); }
.chat-mode-details-button {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 2px;
  min-height: 48px;
  padding: 0 0 0 8px;
  background: transparent;
  color: #818385;
  font: inherit;
  font-size: .75rem;
}
.chat-mode-memory {
  border: 1px solid #57445f4d;
  border-radius: 16px;
  background: #302735;
  color: #b1b3b4;
  font-size: .875rem;
  line-height: 20px;
}
.chat-mode-memory-inner { display: grid; gap: 12px; padding: 16px; }
.chat-mode-memory-usage { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.chat-mode-memory-usage strong { color: #fff; font-size: 1.25rem; font-weight: 600; }
.chat-mode-meter { display: flex; gap: 3px; margin-block-start: 4px; }
.chat-mode-meter span { flex: 1; height: 12px; border-radius: 8px; background: #fff3; }
.chat-mode-meter [data-filled] { background: var(--mode-gradient); }
.chat-mode-meter[data-fill='near'] [data-filled] { background: #eecc91; }
.chat-mode-meter[data-fill='full'] [data-filled] { background: #ec4144; }
.chat-mode-limit { padding-block-start: 8px; }
.chat-mode-slider { position: relative; padding-block-start: 24px; }
.chat-mode-limit-value {
  position: absolute;
  inset-block-start: 4px;
  inset-inline-start: calc(6px + (100% - 12px) * var(--position, 0));
  transform: translateX(-50%);
  border-radius: 4px;
  background: var(--mode-gradient);
  padding: 2px 6px;
  color: #111;
  font-size: .75rem;
  line-height: 13px;
  white-space: nowrap;
}
.chat-mode-limit-value:dir(rtl) { transform: translateX(50%); }
.chat-mode-limit-value::after {
  position: absolute;
  inset: 100% 0 auto;
  width: 0;
  height: 0;
  margin: auto;
  border: 4px solid transparent;
  border-top: 3px solid #fbeff4;
  content: '';
}
.chat-mode-slider input {
  --track: linear-gradient(to right, #f3ccdc 0%, #fbeff4 calc(100% * var(--position, 0)), #ffffff1a 0);
  appearance: none;
  -webkit-appearance: none;
  display: block;
  width: 100%;
  height: 36px;
  margin: 0;
  background: transparent;
}
.chat-mode-slider input:dir(rtl) {
  --track: linear-gradient(to left, #f3ccdc 0%, #fbeff4 calc(100% * var(--position, 0)), #ffffff1a 0);
}
.chat-mode-slider input::-webkit-slider-runnable-track { height: 6px; border-radius: 999px; background: var(--track); }
.chat-mode-slider input::-moz-range-track { height: 6px; border-radius: 999px; background: var(--track); }
.chat-mode-slider input::-webkit-slider-thumb {
  appearance: none;
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  margin-block-start: -3px;
  border-radius: 50%;
  background: var(--mode-gradient);
}
.chat-mode-slider input::-moz-range-thumb { width: 12px; height: 12px; border: 0; border-radius: 50%; background: var(--mode-gradient); }
.chat-mode-range-bounds { display: flex; justify-content: space-between; color: #818385; font-size: .75rem; line-height: 18px; }
.chat-mode-fixed-limit { color: #fff; }
.chat-mode-scope {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 60px;
  padding: 0 12px 0 16px;
  border-top: 1px solid #57445f4d;
  color: #fff;
}
.chat-mode-switch { display: grid; flex: none; place-items: center; width: 48px; height: 48px; padding: 0; background: transparent; }
.chat-mode-switch > span {
  display: flex;
  align-items: center;
  width: 40px;
  height: 20px;
  padding-inline: 2px;
  border-radius: 999px;
  background: #ffffff1a;
}
.chat-mode-switch > span::after { width: 16px; height: 16px; border-radius: 50%; background: #ffffff39; content: ''; }
.chat-mode-switch[aria-checked='true'] > span { justify-content: flex-end; background: #fff3; }
.chat-mode-switch[aria-checked='true'] > span::after { background: var(--mode-gradient); }
.chat-mode-warning, .chat-mode-error { margin: 0; color: #eecc91; font-size: .875rem; line-height: 20px; }
.chat-mode-warning:not(:empty) { margin-block-start: 12px; }
.chat-mode-warning:empty, .chat-mode-error:empty { display: none; }

.chat-mode-options { display: grid; gap: 12px; }
.chat-mode-option {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  min-height: 108px;
  padding: 15px;
  border: 1px solid #57445f4d;
  border-radius: 16px;
  background: transparent;
  color: #fff;
  text-align: start;
  font: inherit;
}
.chat-mode-context .chat-mode-option { background: #302735; }
.chat-mode-sheet .chat-mode-option[aria-pressed='true'] { border-color: #cdb6d5cc; background: #392b40; }
.chat-mode-copy { display: grid; align-content: start; justify-items: start; gap: 6px; min-width: 0; }
.chat-mode-copy strong { display: flex; align-items: center; gap: 4px; font-size: 1rem; font-weight: 600; line-height: 24px; }
.chat-mode-option-side { display: flex; flex-direction: column; align-items: flex-end; justify-content: space-between; flex: none; min-width: 40px; }
.chat-mode-description { color: #c6bbcb; font-size: .75rem; line-height: 20px; overflow-wrap: anywhere; }
.chat-mode-cost, .chat-mode-fixed-price { display: inline-flex; align-items: center; gap: 2px; font-size: .75rem; }
.chat-mode-cost { padding: 3px 10px; border-radius: 20px; background: #ffffff1a; color: #cbcccc; line-height: 20px; }
.chat-mode-fixed-price { font-weight: 600; font-size: 1rem; }
.chat-mode-price-range { color: #818385; font-size: .6875rem; line-height: 16px; }
.chat-mode-actions { display: flex; flex: none; gap: 16px; padding: 16px; }
.chat-mode-sheet:not(.chat-mode-context) .chat-mode-actions { padding-block-start: 24px; }
.chat-mode-actions .button { flex: 1 1 0; min-width: 0; min-height: 52px; border-radius: 16px; }
.chat-mode-actions .chat-mode-cancel { background: #392b40; color: #fff; }
.chat-mode-actions .chat-mode-save { background: var(--mode-gradient); color: #060606; }
.chat-mode-actions .chat-mode-save:disabled { opacity: .5; }
.chat-mode-actions .chat-mode-save[aria-busy='true'] {
  background: linear-gradient(#0005, #0005), var(--mode-gradient);
  color: #cbcccc;
  opacity: 1;
}
.chat-mode-retry { justify-self: start; align-self: flex-start; min-height: 44px; }
.chat-mode-memory-placeholder { width: 100%; height: 236px; border-radius: 16px; }
.chat-mode-price-placeholder { display: grid; gap: 6px; }
.chat-mode-price-placeholder .skeleton-line:first-child { width: 112px; height: 26px; border-radius: 20px; }
.chat-mode-price-placeholder .skeleton-line:last-child { width: 92px; height: 16px; border-radius: 4px; }

.chat-context-details-scroll {
  flex: 1;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 20px 16px 28px;
  color: #b1b3b4;
  font-size: .875rem;
  line-height: 22px;
}
.chat-context-details-scroll h2,
.chat-context-details-scroll h3 { margin: 0; color: #fff; font: 600 1rem/1.5 var(--body-font, Manrope, sans-serif); }
.chat-context-details-scroll h2 { font-size: 1.25rem; }
.chat-context-details-scroll > h2 { margin-block: 28px 18px; }
.chat-context-details-scroll h3 span { margin-inline-end: 4px; }
.chat-context-details-scroll section + section { margin-block-start: 20px; }
.chat-context-details-scroll p { margin: 10px 0 0; }
.chat-context-details-scroll ul { display: grid; gap: 12px; margin: 12px 0 0; padding-inline-start: 19px; }
.chat-context-details-scroll li::marker { color: #fff; content: '✦  '; }
.chat-context-pricing { margin-block-start: 16px; }
.chat-context-pricing .chat-mode-memory-placeholder { height: 180px; }
.chat-context-pricing section { margin-block-start: 24px; }
.chat-pricing-panel { position: relative; overflow: hidden; border-radius: 16px; background: #1c1a1e; }
.chat-pricing-table { overflow-x: auto; }
.chat-pricing-table table { width: 100%; border-collapse: collapse; color: #fff; text-align: center; font-size: .75rem; line-height: 18px; }
.chat-pricing-table :is(th, td) { padding: 8px 12px; border-bottom: 1px solid #302e32; font-weight: 400; }
.chat-pricing-table thead th { height: 60px; background: #272629; color: #b1b3b4; }
.chat-pricing-table tbody th { min-width: 136px; }
.chat-pricing-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 100%;
  min-height: 36px;
  background: transparent;
  color: #cbcccc;
  font-size: .75rem;
}
.chat-pricing-toggle img { transform: rotate(-90deg); }
.chat-pricing-panel[data-preview] .chat-pricing-toggle {
  position: absolute;
  inset: auto 0 0;
  background: linear-gradient(#100e12a6, #100e12);
}
.chat-pricing-panel[data-preview] .chat-pricing-toggle img { transform: rotate(90deg); }

[aria-checked='true'] .chat-switch-track { background: #e8bdd8; }
[aria-checked='true'] .chat-switch-track::after { inset-inline: auto 2px; background: #39283c; }

.chat-settings-layout .settings-row { min-height: 66px; }
.chat-settings-layout .chat-settings-group + .chat-settings-group { margin-block-start: 20px; }

/* Chat settings subpages and bottom sheets */
.sheet.chat-settings { height: var(--app-height, var(--viewport-height)); }
.chat-settings-layout > .secondary-header {
  grid-template-columns: 48px minmax(0, 1fr) auto;
  gap: 0;
  min-height: 48px;
  padding: 0 16px 0 0;
}
.chat-settings-layout > .secondary-header h1 { text-align: start; }
.chat-settings-layout > .secondary-header .icon-button { width: 48px; height: 48px; }
.sheet.chat-options-sheet, .sheet.chat-role-sheet {
  border: 0;
  border-radius: 20px 20px 0 0;
  overflow: hidden;
}
.sheet.chat-options-sheet::backdrop, .sheet.chat-role-sheet::backdrop { background: #000c; }
body:has(.chat-role-sheet[open]) > :is(.chat-settings[open]:has(.chat-settings-group), .chat-images-sheet[open]) { visibility: hidden; }

.chat-options, .chat-role-sheet-body {
  display: flex;
  flex-direction: column;
  max-height: calc(var(--app-height, var(--viewport-height)) * .9 - var(--safe-top));
  outline: 0;
}
.chat-options-header {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 20px var(--sheet-content-padding) var(--sheet-title-gap);
}
.chat-options-header::before, .chat-options-handle {
  content: '';
  width: 40px;
  height: 4px;
  border-radius: 4px;
  background: #746a7b;
}
.chat-options-header::before { position: absolute; inset: 12px 0 auto; margin: auto; }
.chat-options-handle { margin: 12px auto 8px; }
.chat-options-header h2, .chat-role-sheet-body .chat-surface-heading h2 { margin: 0; text-align: start; }
.chat-options-header h2 { min-width: 0; overflow-wrap: anywhere; }
.chat-options-header .icon-button { flex: none; }
.chat-options-scroll { overflow: auto; padding: 0 var(--sheet-content-padding) 4px; }
.chat-options-list { display: grid; gap: 16px; }
.chat-options-list.chat-appearance-options { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.chat-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 52px;
  padding: 12px 16px;
  text-align: start;
  border: 1px solid transparent;
  border-radius: 16px;
  background: #302735;
}
.chat-option[aria-checked='true'] { background: #392b40; border-color: #cdb6d5cc; }
.chat-option-copy { display: grid; gap: 8px; min-width: 0; }
.chat-option strong { font-size: .875rem; line-height: 1.5; font-weight: 400; }
.chat-option-bubble {
  display: block;
  width: fit-content;
  padding: 8px 12px;
  border: 1px solid #fff3;
  border-radius: 12px 12px 12px 0;
  background: #0008;
  color: white;
  font-size: var(--sample-size);
  line-height: calc(var(--sample-size) + 12px);
}
.chat-option-bubble[data-appearance='light'] { background: #fff8; color: #060606; }
.chat-appearance-options .chat-option {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  justify-items: center;
  gap: 16px;
  padding: 0 0 4px;
  background: transparent;
  border: 0;
  text-align: center;
}
.chat-appearance-preview {
  position: relative;
  display: flex;
  flex-direction: column;
  align-self: stretch;
  justify-content: space-between;
  min-height: 108px;
  width: 100%;
  gap: 8px;
  padding: 12px;
  border: 1px solid transparent;
  border-radius: 16px;
  background: #302735;
  text-align: start;
}
.chat-appearance-preview .chat-option-bubble + .chat-option-bubble { align-self: end; }
.chat-appearance-options .chat-option[aria-checked='true'] .chat-appearance-preview {
  background: #392b40;
  border-color: #cdb6d5cc;
}
.chat-selection-mark {
  display: grid;
  flex: none;
  place-items: center;
  width: 20px;
  height: 20px;
  border: 1px solid #b3a9b7;
  border-radius: 50%;
}
.chat-appearance-preview .chat-selection-mark { position: absolute; inset: auto 0 -10px; margin: auto; }
.chat-appearance-options [aria-checked='false'] .chat-selection-mark, .chat-background-tile[aria-pressed='false'] .chat-selection-mark {
  visibility: hidden;
}
[aria-checked='true'] .chat-selection-mark, [aria-pressed='true'] .chat-selection-mark {
  color: #1c1420;
  background: linear-gradient(#e9aff9, #d8eaff);
  border-color: transparent;
}
[aria-checked='true'] .chat-selection-mark::after, [aria-pressed='true'] .chat-selection-mark::after {
  content: '';
  width: 8px;
  height: 5px;
  border: solid currentColor;
  border-width: 0 0 2px 2px;
  transform: translateY(-1px) rotate(-45deg);
}
.chat-settings-footer { flex: none; padding: 12px var(--sheet-content-padding) 16px; }
:is(.chat-options, .chat-role-sheet-body) > :last-child { margin-bottom: var(--safe-bottom); }
.chat-settings-primary { min-height: 52px; width: 100%; font-size: .9375rem; }
.chat-settings-primary:disabled { background: #fff1; color: #b1a5b0; opacity: 1; }
.chat-settings-caption { margin: 0; color: #a7a1a8; font-size: .75rem; line-height: 1.5; }
:is(.chat-options, .chat-role-sheet-body, .chat-memory-page, .chat-role-form, .chat-background-scroll) .form-status:empty { display: none; }

.chat-memory-page { display: flex; flex-direction: column; gap: 20px; }
.chat-memory-field {
  display: flex;
  flex-direction: column;
  flex: none;
  height: 240px;
  padding: 12px;
  border-radius: 12px;
  background: var(--panel);
}
.chat-memory-field textarea {
  flex: 1;
  min-height: 0;
  padding: 0;
  resize: none;
  border: 0;
  background: transparent;
  color: white;
  font: inherit;
  font-size: 16px;
  line-height: 1.5;
}
.chat-memory-field output { align-self: end; color: var(--muted); font-size: .75rem; }
.chat-memory-field output.over-limit { color: #ff8e9c; }
.chat-settings-toggle-status { padding-inline: 16px; }

.chat-settings-toast {
  position: fixed;
  z-index: 10;
  inset: 45% auto auto 50%;
  transform: translate(-50%, -50%);
  width: max-content;
  max-width: calc(100vw - 40px);
  padding: 12px 18px;
  border: 1px solid #ffffff33;
  border-radius: 16px;
  background: #302735f5;
  color: white;
  font-size: .875rem;
  pointer-events: none;
}

.chat-role-sheet-body .chat-surface-heading { padding-inline-end: 16px; margin-bottom: 8px; }
.chat-role-sheet-body .chat-role-add {
  flex: none;
  width: 36px;
  height: 36px;
  min-width: 36px;
  min-height: 36px;
  border: 1px solid #ffffff4d;
  background: #0005;
}
.chat-role-carousel {
  position: relative;
  display: flex;
  flex: none;
  align-items: center;
  gap: 16px;
  padding-inline: 16px;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  scroll-padding-inline: 16px;
}
.chat-role-card {
  position: relative;
  display: flex;
  flex: 0 0 min(320px, calc(100% - 24px));
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  height: 272px;
  padding: 16px;
  background: #302735;
  border: 1px solid transparent;
  border-radius: 16px;
  scroll-snap-align: center;
}
.chat-role-card[data-current='true'] { background: #392b40; border-color: #cdb6d5cc; }
.chat-role-avatar { width: 100px; height: 100px; padding: 0; overflow: hidden; border-radius: 50%; }
.chat-role-avatar .picture { width: 100%; height: 100%; background: center / cover no-repeat url('/icons/chat-role-empty.svg'); }
.chat-role-edit { position: absolute; inset: 4px 4px auto auto; }
.chat-role-name {
  width: 100%;
  text-align: center;
  font: 600 italic 1.5rem/1.25 var(--heading);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-role-badges { display: flex; gap: 8px; min-height: 22px; }
.chat-role-badges span {
  max-width: 120px;
  padding: 2px 8px;
  border-radius: 20px;
  background: #ffffff1a;
  font-size: .75rem;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.chat-role-badges .chat-role-default { color: #eecc91; background: #ecb34326; }
.chat-role-sheet-body > .chat-settings-caption { padding: 20px 16px 24px; }
.chat-role-sheet-body > .form-status { padding-inline: 16px; }

.chat-role-editor, .chat-role-editor-page { background: var(--background); }
:is(.chat-role-editor-page, .chat-role-editor > .chat-settings-layout) {
  position: relative;
  isolation: isolate;
  overflow: hidden;
}
:is(.chat-role-editor-page, .chat-role-editor > .chat-settings-layout)::before {
  position: absolute;
  z-index: -1;
  inset: 0 0 auto;
  aspect-ratio: 414 / 355;
  background: url('/icons/user-role-header.png') center / cover no-repeat;
  -webkit-mask: url('/icons/user-role-header-mask.svg') center / 100% 100% no-repeat;
  mask: url('/icons/user-role-header-mask.svg') center / 100% 100% no-repeat;
  opacity: .3;
  transform: translateY(var(--role-editor-art-offset, 0px));
  pointer-events: none;
  content: '';
}
.chat-role-editor-page > .secondary-header,
.chat-role-editor .chat-settings-layout > .secondary-header { background: transparent; }
.chat-role-editor-page > .secondary-header { grid-template-columns: 48px 1fr auto; }
.chat-role-editor-page > .secondary-header h1 { text-align: start; }
.chat-role-editor-body { --sheet-content-padding: 16px; }
.chat-role-editor-body > .chat-settings-footer .button { min-height: 56px; }
.chat-role-editor-body, .chat-background-page { display: flex; flex: 1; flex-direction: column; min-height: 0; }
.chat-role-form {
  flex: 1;
  display: grid;
  align-content: start;
  gap: 24px;
  padding: 16px var(--sheet-content-padding);
}
.chat-role-image-area { display: grid; gap: 12px; justify-items: center; text-align: center; }
.chat-role-image-area .chat-settings-caption { max-width: 331px; }
.chat-role-image-frame { position: relative; width: 132px; }
.chat-role-upload {
  width: 132px;
  height: 203px;
  display: grid;
  place-items: center;
  padding: 0;
  overflow: hidden;
  border: 1px dashed #57445fa0;
  border-radius: 16px;
  background: var(--panel);
}
.chat-role-upload > span { display: grid; gap: 8px; justify-items: center; max-width: 94px; color: var(--muted); font-size: .75rem; }
.chat-role-upload > img { width: 100%; height: 100%; object-fit: cover; }
.chat-role-upload > .chat-role-default-avatar { transform: scale(1.25); }
.chat-role-remove { position: absolute; inset: auto -3px -3px auto; }
.chat-role-form label, .chat-role-form fieldset { position: relative; display: block; margin: 0; padding: 0; border: 0; }
.chat-role-form :is(label, legend) { font-weight: 700; font-size: .875rem; }
.chat-role-label { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.chat-role-form label :is(input, textarea) {
  display: block;
  width: 100%;
  margin-top: 12px;
  padding: 12px;
  border: 1px solid #57445f5e;
  border-radius: 16px;
  min-height: 56px;
  background: var(--panel);
  color: white;
  font: 400 16px/1.5 Manrope, sans-serif;
}
.chat-role-form textarea { min-height: 140px; resize: vertical; }
.chat-role-count { color: var(--muted); font-size: .75rem; font-weight: 400; white-space: nowrap; }
.chat-required { color: #efb0bd; }

.chat-background-scroll {
  display: flex;
  flex: 1;
  min-height: 0;
  flex-direction: column;
  gap: 20px;
  padding-top: 20px;
  overflow: auto;
}
.chat-background-hero {
  position: relative;
  flex: 1 0 160px;
  min-height: 160px;
  margin-inline: 16px;
  overflow: hidden;
  border: 1px solid #57445f4d;
  border-radius: 16px;
  background: var(--panel);
}
.chat-background-art { position: absolute; inset: 0; }
.chat-background-art .picture, .chat-background-tile .picture { width: 100%; height: 100%; }
.chat-background-samples {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: end;
  gap: clamp(8px, 4vh, 30px);
  padding: 8px 8px 12px;
  overflow: auto;
}
.chat-background-samples .thread-message { padding: clamp(10px, 2vh, 20px); font-size: var(--chat-message-size, 16px); }
.chat-background-choices {
  display: flex;
  flex: none;
  gap: 8px;
  overflow: auto hidden;
  overscroll-behavior-y: contain;
  touch-action: pan-x;
  scrollbar-width: none;
  padding-inline: 16px;
  scroll-padding-inline: 16px;
}
.chat-background-choices::-webkit-scrollbar { display: none; }
.chat-background-card { position: relative; flex: 0 0 120px; height: 160px; }
.chat-background-tile, .chat-background-upload {
  width: 100%;
  height: 100%;
  padding: 0;
  overflow: hidden;
  border: 1px solid #57445f4d;
  border-radius: 16px;
  background: var(--panel);
}
.chat-background-tile { display: block; }
.chat-background-tile[aria-pressed='true'] { border-color: #cdb6d5cc; }
.chat-background-tile .chat-selection-mark { position: absolute; inset: auto 8px 8px auto; }
.chat-background-delete { position: absolute; inset: 0 0 auto auto; }
.chat-background-upload { display: flex; flex-direction: column; gap: 8px; align-items: center; justify-content: center; color: var(--muted); font-size: .75rem; }
.chat-background-scroll > :is(.chat-settings-caption, .form-status) { padding-inline: 16px; }
