:root {
  color-scheme: dark;
  font: 15px/1.55 system-ui, sans-serif;
  --ink: #f1e4df;
  --muted: #beacb9;
  --lavender: #dec1d5;
  --rose: #edb8d2;
  --gold: #d7ad88;
  --border: #4d384a;
  --surface: #201724;
  --base: #16101b;
  --serif: Georgia, 'Times New Roman', serif;
  color: var(--ink);
  background: var(--base);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  min-width: 0;
  min-height: 100vh;
  background: radial-gradient(ellipse at 54% 200px, #261a2c, var(--base) 65%);
}
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { font-family: var(--serif); font-weight: 400; line-height: 1.12; }
a { color: inherit; text-decoration: none; }
button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .6; }
:focus-visible { outline: 2px solid var(--rose); outline-offset: 4px; }
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.grimoire-top {
  border-bottom: 1px solid #3b293c;
  background: #1b1320;
}
.top-inner {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1.4rem;
  width: min(100% - 4rem, 1390px);
  min-height: 75px;
  margin-inline: auto;
}
.grimoire-brand {
  display: inline-flex;
  align-items: center;
  justify-self: start;
  gap: .68rem;
  white-space: nowrap;
  color: #f3dce6;
  font: 1.58rem/1 var(--serif);
}
.brand-sigil {
  display: grid;
  width: 34px;
  height: 34px;
  place-content: center;
  border: 1px solid #876073;
  border-radius: 50%;
  color: var(--rose);
  font: 1rem/1 system-ui, sans-serif;
}
.brand-beta {
  align-self: center;
  margin-top: .1em;
  padding: .18em .39em;
  border: 1px solid #6b4c63;
  border-radius: 4px;
  color: var(--rose);
  font: 600 .62rem/1.15 system-ui, sans-serif;
  letter-spacing: .05em;
  text-transform: uppercase;
}
.grimoire-nav, .top-actions {
  display: flex;
  align-items: center;
  gap: .45rem;
}
.grimoire-nav > a, .signout-button, .nav-user {
  display: inline-flex;
  align-items: center;
  min-height: 41px;
  padding: .42rem .75rem;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--muted);
  background: none;
  font-size: .88rem;
  white-space: nowrap;
}
.grimoire-nav > a:hover, .signout-button:hover, .nav-user:hover { color: var(--ink); background: #302034; }
.grimoire-nav > [aria-current] {
  border-color: #51354f;
  color: #f1c4dd;
  background: #332036;
}
.top-actions { justify-content: end; min-width: 0; }
.nav-user {
  display: block;
  max-width: 12rem;
  min-height: auto;
  overflow: hidden;
  text-overflow: ellipsis;
}
.signout-button { padding-inline: .45rem; }

.grimoire-main {
  width: min(100% - 4rem, 1260px);
  margin-inline: auto;
  padding: 2.4rem 0 4rem;
}
.grimoire-button {
  display: inline-flex;
  min-height: 43px;
  width: fit-content;
  align-items: center;
  justify-content: center;
  gap: .55em;
  padding: .53rem .95rem;
  border: 1px solid #67475f;
  border-radius: 8px;
  color: #f2dce6;
  background: #2d2031;
  font-size: .9rem;
  font-weight: 600;
}
.grimoire-button:hover { border-color: #9f6d8c; background: #3b2840; }
.button-primary {
  border-color: #e5b2cb;
  color: #291723;
  background: #edbfd5;
  box-shadow: 0 4px 18px #0c06122b;
}
.button-primary:hover { border-color: #f6d2e2; background: #f4d0e0; }
.button-danger { border-color: #8b5363; color: #ffd0d9; }
.button-danger:hover { border-color: #c58090; background: #4a2734; }

.grimoire-hero {
  isolation: isolate;
  position: relative;
  display: grid;
  align-items: center;
  min-height: clamp(375px, 39vw, 460px);
  overflow: hidden;
  border: 1px solid #6b4d65;
  border-radius: 13px;
  background: #221628;
}
.grimoire-hero-art {
  position: absolute;
  z-index: -2;
  inset: 0;
  background:
    radial-gradient(circle at 76% 47%, #b77e9b 0, #b77e9b26 13%, transparent 16%),
    radial-gradient(ellipse at 74% 51%, #874e6d91, transparent 45%),
    radial-gradient(ellipse at 93% 10%, #53405b89, transparent 48%),
    linear-gradient(117deg, #201325 35%, #36223e 100%);
}
.grimoire-hero-art::before {
  position: absolute;
  z-index: -1;
  inset: 0;
  background: url('/grimoire-hero.webp') center right / cover no-repeat;
  content: '';
}
.grimoire-hero-art::after {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, #201426fa 0%, #201426e8 28%, #201426a2 47%, #2014261a 72%),
    linear-gradient(0deg, #190f1b9c, transparent 28%);
  content: '';
}
.grimoire-hero-art, .bot-card-image, .profile-frame, .bot-card-image img, .profile-portrait {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}
.hero-copy {
  padding: clamp(2.35rem, 6vw, 5.1rem);
}
.page-label {
  margin-bottom: .85rem;
  color: #e1b5c8;
  font-size: .78rem;
  font-weight: 650;
  letter-spacing: .11em;
  text-transform: uppercase;
}
.page-label:empty { display: none; }
.grimoire-hero h1 {
  font-size: clamp(3rem, 6.28vw, 5.35rem);
  letter-spacing: -.043em;
  line-height: .98;
  color: #f6e7e0;
}
.grimoire-hero h1 i { color: #e7b9d3; }
.hero-description {
  max-width: 33ch;
  margin-top: 1.3rem;
  color: #e0cadb;
  font-size: 1.02rem;
}
.hero-copy .grimoire-button { margin-top: 1.65rem; }
.hero-corner {
  position: absolute;
  width: 52px;
  height: 52px;
  pointer-events: none;
}
.hero-corner-top {
  top: 14px;
  left: 14px;
  border-top: 1px solid #bc8595a6;
  border-left: 1px solid #bc8595a6;
  border-top-left-radius: 6px;
}
.hero-corner-bottom {
  right: 14px;
  bottom: 14px;
  border-bottom: 1px solid #bc8595a6;
  border-right: 1px solid #bc8595a6;
  border-bottom-right-radius: 6px;
}

.catalog-section {
  margin-top: 2.95rem;
  scroll-margin-top: 1.1rem;
}
.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.05rem;
}
.section-head h2 {
  font-size: clamp(1.62rem, 3.3vw, 2.26rem);
  letter-spacing: -.028em;
}
.section-head p { margin-top: .37rem; color: var(--muted); }
.search-field {
  position: relative;
  display: block;
  width: clamp(15rem, 29vw, 23rem);
  flex: 0 1 auto;
}
.search-field::before, .search-field::after {
  position: absolute;
  display: block;
  content: '';
  pointer-events: none;
}
.search-field::before {
  top: 15px;
  left: 14px;
  width: 11px;
  height: 11px;
  border: 1.5px solid var(--lavender);
  border-radius: 50%;
}
.search-field::after {
  top: 27px;
  left: 24px;
  width: 6px;
  height: 1.5px;
  background: var(--lavender);
  transform: rotate(45deg);
}
.search-field input {
  display: block;
  width: 100%;
  min-height: 46px;
  padding: .55rem .8rem .55rem 2.45rem;
  border: 1px solid #5b4157;
  border-radius: 8px;
  color: var(--ink);
  background: #231828;
}
.search-field input::placeholder { color: #c1abbc; opacity: 1; }

.bot-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 218px), 1fr));
  gap: 1.08rem;
}
.bot-card {
  position: relative;
  display: flex;
  min-width: 0;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid #543a50;
  border-radius: 11px;
  background: var(--surface);
  box-shadow: 0 10px 20px #0d08111c;
}
.bot-card:hover, .bot-card:focus-within {
  border-color: #af7996;
  background: #2b1c31;
}
.bot-card-image {
  position: relative;
  display: grid;
  aspect-ratio: 5 / 5.1;
  place-items: center;
  overflow: hidden;
  border-bottom: 1px solid #493146;
  background: radial-gradient(ellipse at 50% 35%, #5e3c57, #27182f 80%);
}
.bot-card-image img {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 35%;
}
.bot-card-placeholder, .large-placeholder {
  display: grid;
  place-items: center;
  width: min(46%, 6.5rem);
  aspect-ratio: 1;
  border: 1px solid #a37592;
  border-radius: 50%;
  color: #ecc7de;
  background: #38233f;
  font: italic clamp(1.5rem, 5vw, 2.95rem)/1 var(--serif);
  box-shadow: 0 0 0 .55rem #9867812c, 0 0 0 .95rem #98678114;
}
.bot-card-body {
  display: flex;
  min-width: 0;
  flex: 1;
  flex-direction: column;
  gap: .48rem;
  padding: .9rem .92rem 1rem;
}
.bot-card-name {
  color: #f0dce7;
  font: 1.24rem/1.2 var(--serif);
  overflow-wrap: anywhere;
}
.bot-card-description {
  display: -webkit-box;
  overflow: hidden;
  color: var(--muted);
  font-size: .86rem;
  overflow-wrap: anywhere;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}
.bot-card-description:empty { display: none; }
.bot-card-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .45rem;
  margin-top: auto;
  padding-top: .3rem;
}
.bot-card-owner {
  color: var(--lavender);
  font-size: .83rem;
  overflow-wrap: anywhere;
}
.bot-card-status {
  width: fit-content;
  max-width: 100%;
  padding: .15rem .5rem;
  border: 1px solid #79566c;
  border-radius: 6px;
  color: #eec4d9;
  background: #382638;
  font-size: .76rem;
  overflow-wrap: anywhere;
}
.bot-card-status[data-state='published'], .bot-card-status[data-state='approved'] {
  border-color: #617d6a;
  color: #c9e3cf;
  background: #24392f;
}
.bot-card-status[data-state='pending'] {
  border-color: #7c654b;
  color: #edd2aa;
  background: #3d2d24;
}
#legacy-list > article {
  border: 1px solid #543a50;
  border-radius: 11px;
  background: var(--surface);
}

.collection-empty {
  display: grid;
  justify-items: center;
  gap: .65rem;
  padding: clamp(1.5rem, 4vw, 2.65rem) 1.2rem;
  border: 1px dashed #684b64;
  border-radius: 11px;
  background: radial-gradient(ellipse at 50% 0%, #2f2034, #201725 66%);
  text-align: center;
}
.empty-sigil {
  display: grid;
  place-items: center;
  width: 2.6rem;
  height: 2.6rem;
  margin-bottom: .1rem;
  border: 1px solid #8f617b;
  border-radius: 50%;
  color: var(--rose);
  background: #2a1c30;
  font-size: 1.3rem;
}
.collection-empty h3 { font-size: clamp(1.25rem, 2.45vw, 1.65rem); }
.collection-empty p { color: var(--muted); }
.collection-empty .grimoire-button { margin-top: .4rem; }
.collection-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1.8rem;
  padding: clamp(1.65rem, 5.3vw, 3.1rem);
  border: 1px solid #62445e;
  border-radius: 12px;
  background:
    radial-gradient(ellipse at 91% 0%, #59395282, transparent 62%),
    linear-gradient(100deg, #291b30, #211625);
}
.collection-heading h1 {
  margin-bottom: .8rem;
  color: #f3dce7;
  font-size: clamp(2.55rem, 6vw, 4rem);
  letter-spacing: -.04em;
}
.collection-heading p:not(.page-label) { max-width: 61ch; color: var(--muted); }
.collection-heading .grimoire-button { flex: 0 0 auto; }
.collection-catalog { margin-top: 2.1rem; }

.page-notice, .view-status {
  max-width: 100%;
  overflow-wrap: anywhere;
  color: var(--muted);
}
.page-notice {
  width: fit-content;
  padding: .85rem 1.05rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}
.page-notice[role='alert'] { color: #f5c5d5; }
.view-status:not(:empty) { margin-top: .45rem; margin-bottom: .8rem; }

.profile-view { max-width: 1110px; margin-inline: auto; }
.profile-back {
  display: inline-flex;
  gap: .5rem;
  align-items: center;
  padding: .36rem 0;
  color: var(--lavender);
  font-size: .9rem;
}
.profile-back:hover { color: var(--ink); }
.profile-content {
  display: grid;
  grid-template-columns: minmax(0, .76fr) minmax(0, 1.4fr);
  gap: clamp(1.4rem, 5vw, 3.3rem);
  align-items: start;
  margin-top: 1.05rem;
}
.profile-media { min-width: 0; }
.profile-frame {
  position: relative;
  display: grid;
  aspect-ratio: 4 / 4.8;
  place-items: center;
  overflow: hidden;
  padding: 6px;
  border: 1px solid #805772;
  border-radius: 13px 13px 9px 9px;
  background: radial-gradient(ellipse at 50% 35%, #684360, #2d2036 80%);
  box-shadow: 0 11px 26px #0d08113d;
}
.profile-portrait {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  border-radius: 8px 8px 5px 5px;
  object-fit: cover;
  object-position: center 32%;
}
.large-placeholder {
  width: min(44%, 8.5rem);
  font-size: clamp(2.5rem, 6vw, 3.5rem);
}
.profile-chat {
  min-height: 47px;
  width: 100%;
  margin-top: .8rem;
}
.profile-last-chat { margin-top: .45rem; }
.profile-page {
  min-width: 0;
  border: 1px solid #5b3f56;
  border-radius: 11px;
  background: linear-gradient(130deg, #2a1d30, #211725 85%);
}
.profile-heading, .profile-section { padding: clamp(1.1rem, 3.25vw, 2rem); }
.profile-heading h1 {
  color: #f4e1e9;
  font-size: clamp(2rem, 4.7vw, 3.65rem);
  letter-spacing: -.038em;
  overflow-wrap: anywhere;
}
.profile-visibility { display: inline-block; margin-bottom: .75rem; }
.profile-author { margin: .55rem 0 0; color: var(--lavender); overflow-wrap: anywhere; }
.profile-owner-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .55rem;
}
.profile-owner-actions:has(:not([hidden])) { margin-top: 1rem; }
.profile-section { border-top: 1px solid #50374c; }
.profile-gallery-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .65rem;
  margin-bottom: .8rem;
}
.profile-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(106px, 1fr)); gap: .7rem; }
.profile-gallery-photo {
  display: block;
  padding: 0;
  overflow: hidden;
  aspect-ratio: 4 / 5;
  border: 1px solid #78506a;
  border-radius: 7px;
  background: #211725;
}
.profile-gallery-photo img { display: block; width: 100%; height: 100%; object-fit: cover; }
.profile-gallery-photo img, .gallery-viewer img { -webkit-touch-callout: none; user-select: none; }
.gallery-viewer { width: min(680px, calc(100% - 1.5rem)); }
.gallery-viewer img { display: block; width: 100%; max-height: 70dvh; object-fit: contain; }
.profile-section h2 {
  color: #efd3e1;
  font-size: clamp(1.31rem, 2.6vw, 1.65rem);
  margin-bottom: .7rem;
}
.profile-prose, .profile-intros p {
  color: #e5d5de;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.profile-intros > details, .profile-intro {
  margin-top: .5rem;
  padding: .65rem .8rem;
  border: 1px solid #553c54;
  border-radius: 7px;
  background: #2c2030;
}
.profile-intros > details summary { color: #f2cada; cursor: pointer; overflow-wrap: anywhere; }
.profile-intros > details[open] summary { margin-bottom: .6rem; }
.profile-intro-option {
  margin-top: .6rem;
  border: 1px solid #553c54;
  border-radius: 8px;
  background: #2a1e30;
}
.profile-intro-option:has(input:checked) {
  border-color: #a67793;
  background: #38253d;
}
.profile-intro-option > label {
  display: flex;
  align-items: center;
  gap: .65rem;
  min-height: 42px;
  padding: .55rem .8rem;
  cursor: pointer;
  font-weight: 600;
  overflow-wrap: anywhere;
}
.profile-intro-option input[type='radio'] {
  flex-shrink: 0;
  width: 1rem;
  height: 1rem;
  margin: 0;
  accent-color: var(--rose);
}
.profile-intro-option > details {
  padding: .07rem .8rem .65rem;
}
.profile-intro-option summary {
  width: fit-content;
  min-height: 28px;
  color: var(--lavender);
  cursor: pointer;
  font-size: .87rem;
}
.profile-intro-option details p { margin-top: .45rem; }
.profile-intro-actions {
  display: flex;
  justify-content: end;
  margin-top: 1rem;
}

.publish-dialog {
  width: min(100% - 1.65rem, 540px);
  max-height: calc(100dvh - 1.65rem);
  padding: clamp(1.2rem, 4vw, 1.9rem);
  overflow: auto;
  border: 1px solid #855b76;
  border-radius: 12px;
  color: var(--ink);
  background: #271b2e;
  box-shadow: 0 18px 48px #0e0913ab;
}
.publish-dialog::backdrop { background: #130b179c; }
.publish-dialog h2 {
  margin-bottom: .7rem;
  color: #f2dce6;
  font-size: clamp(1.48rem, 3.3vw, 1.9rem);
}
#publish-disclosure { margin-bottom: 1rem; color: var(--muted); }
#publish-review-note { margin-bottom: 1rem; color: var(--muted); font-size: .88rem; }
.publish-field { display: block; margin-bottom: .35rem; font-weight: 600; }
.publish-field span { color: var(--muted); font-weight: 400; }
#publish-description {
  display: block;
  width: 100%;
  min-height: 7rem;
  padding: .65rem .8rem;
  resize: vertical;
  border: 1px solid #70506a;
  border-radius: 8px;
  color: var(--ink);
  background: #1b1320;
  font: inherit;
}
#publish-description-help { margin-top: .4rem; color: var(--muted); font-size: .85rem; }
.publish-actions {
  display: flex;
  justify-content: end;
  flex-wrap: wrap;
  gap: .55rem;
  margin-top: 1rem;
}

@media (max-width: 990px) {
  .top-inner { width: calc(100% - 2.7rem); gap: .7rem; }
  .top-actions, .grimoire-nav { gap: .18rem; }
  .grimoire-nav > a { padding-inline: .56rem; }
  .nav-user { display: none; }
  .grimoire-main { width: calc(100% - 2.7rem); padding-top: 1.65rem; }
}

@media (max-width: 880px) {
  .top-inner {
    grid-template-columns: 1fr auto;
    gap: .25rem .5rem;
    padding-top: .6rem;
    width: calc(100% - 1.65rem);
  }
  .grimoire-brand { font-size: 1.38rem; gap: .4rem; }
  .brand-sigil { width: 28px; height: 28px; font-size: .81rem; }
  .grimoire-nav {
    grid-column: 1 / -1;
    grid-row: 2;
    padding: .15rem 0 .45rem;
    flex-wrap: wrap;
  }
  .grimoire-nav a { min-height: 40px; padding-inline: .75rem; }
  .nav-user { display: none; }
  .nav-create { min-height: 39px; padding-inline: .65rem; }
  .grimoire-main { width: calc(100% - 1.65rem); padding-top: 1.15rem; }
  .grimoire-hero { min-height: 350px; }
  .hero-copy { padding-inline: clamp(1.45rem, 5vw, 2.35rem); }
  .grimoire-hero-art::before { background-position: 68% center; }
  .grimoire-hero-art::after {
    background: linear-gradient(90deg, #201426f5, #201426bc 53%, #20142652 100%);
  }
  .catalog-section { margin-top: 1.9rem; }
  .section-head { align-items: flex-start; flex-direction: column; gap: .75rem; }
  .search-field { width: 100%; }
  .profile-content { gap: 1rem; }
}

@media (max-width: 535px) {
  .bot-list { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .72rem; }
  .bot-card-body { padding: .68rem .7rem .72rem; }
  .bot-card-name { font-size: 1.1rem; }
  .bot-card-description { font-size: .81rem; }
  .collection-heading { align-items: flex-start; flex-direction: column; gap: 1rem; }
  .profile-content { grid-template-columns: minmax(0, 1fr); }
  .profile-media { width: min(100%, 355px); margin-inline: auto; }
  .profile-frame { aspect-ratio: 4 / 4.3; }
  .profile-frame:has(.large-placeholder:not([hidden])) { aspect-ratio: 2 / 1; }
  .profile-intro-actions .grimoire-button { width: 100%; }
}

@media (max-width: 415px) {
  .top-actions:has(#nav-login:not([hidden])) .nav-create { display: none; }
}

@media (max-width: 350px) {
  .brand-sigil { display: none; }
  .grimoire-brand { font-size: 1.2rem; }
  .nav-create { font-size: .8rem; }
  .grimoire-hero h1 { font-size: 2.65rem; }
  .bot-list { grid-template-columns: minmax(0, 1fr); }
}
html.session-closed { visibility: hidden; }

#chats-view {
  max-width: 1100px;
  margin-inline: auto;
}
.collection-heading.chat-journal-heading {
  align-items: center;
  padding: clamp(1.15rem, 3.6vw, 2.35rem);
}
.chat-journal-heading h1 { margin-bottom: .3rem; }
.chat-journal-heading .search-field { width: min(100%, 22rem); }
.chat-journal-list {
  display: grid;
  gap: 1.1rem;
  margin-top: 1.3rem;
}
.chat-chapter {
  min-width: 0;
  padding: clamp(.85rem, 2.6vw, 1.4rem);
  border: 1px solid #5a3e55;
  border-radius: 14px;
  background: linear-gradient(145deg, #2d1e32, #211725 70%);
}
.chat-chapter-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: .8rem;
  margin-bottom: .95rem;
}
.chat-chapter-profile {
  display: flex;
  width: fit-content;
  max-width: 100%;
  min-height: 48px;
  align-items: center;
  gap: .75rem;
  border-radius: 8px;
}
.chat-chapter-profile:hover h2 {
  color: var(--rose);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: .18em;
}
.chat-chapter-portrait {
  position: relative;
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 56px;
  height: 56px;
  isolation: isolate;
  overflow: hidden;
  border: 1px solid #977087;
  border-radius: 18px 18px 8px 8px;
  color: #f4dce8;
  background: #4b2f48;
  font: 1.55rem/1 var(--serif);
}
.chat-chapter-portrait img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.chat-chapter-identity { min-width: 0; overflow-wrap: anywhere; }
.chat-chapter-identity h2 {
  color: #f5e0ea;
  font-size: clamp(1.23rem, 2.8vw, 1.7rem);
}
.chat-chapter-caption {
  margin-top: .2rem;
  color: var(--muted);
  font-size: .83rem;
}
.chat-new { min-height: 44px; white-space: nowrap; }
.chat-scene-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 24rem), 1fr));
  gap: .6rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.chat-scene-list > li { min-width: 0; }
.chat-scene-link {
  display: grid;
  min-height: 60px;
  height: 100%;
  gap: .35rem;
  align-content: start;
  padding: .75rem .85rem;
  border: 1px solid #52394e;
  border-inline-start: 2px solid #986782;
  border-radius: 8px;
  background: #1c1420;
  overflow-wrap: anywhere;
}
.chat-scene-link:hover {
  border-color: #9b6b8a;
  background: #301f33;
}
.chat-scene-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .18rem .7rem;
}
.chat-scene-title { color: #f5dfeb; font-weight: 650; }
.chat-scene-count, .chat-scene-persona {
  color: var(--lavender);
  font-size: .8rem;
}
.chat-scene-count { white-space: nowrap; }
.chat-scene-preview {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  color: var(--muted);
  font-size: .88rem;
}
.chat-journal-empty { margin-top: 1.3rem; }
.chat-empty-actions {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: .55rem;
}

@media (max-width: 650px) {
  .collection-heading.chat-journal-heading { align-items: stretch; flex-direction: column; gap: .8rem; }
  .chat-journal-heading .search-field { width: 100%; }
}
@media (max-width: 415px) {
  .chat-chapter-head { gap: .55rem; }
  .chat-chapter-profile { gap: .5rem; }
  .chat-chapter-portrait { width: 44px; height: 44px; font-size: 1.2rem; }
  .chat-new { padding-inline: .65rem; font-size: .84rem; }
  .chat-scene-link { padding: .65rem .72rem; }
}
