/* [project]/next-app/app/globals.css [app-client] (css) */
:root, [data-theme="dark"] {
  --bg: #0b0b0f;
  --bg-elev: #15151d;
  --bg-elev-2: #1e1e29;
  --text: #ececf1;
  --muted: #9a9aae;
  --border: #2a2a38;
  --accent: #e0457b;
  --accent-hover: #f05a8d;
  --on-accent: #fff;
  --danger: #ef4444;
  --shadow: 0 6px 24px #00000073;
}

[data-theme="light"] {
  --bg: #f7f7fb;
  --bg-elev: #fff;
  --bg-elev-2: #f0f0f5;
  --text: #1a1a24;
  --muted: #6b6b7b;
  --border: #e2e2ec;
  --accent: #d63872;
  --accent-hover: #c22e64;
  --on-accent: #fff;
  --danger: #dc2626;
  --shadow: 0 6px 24px #0000001f;
}

* {
  box-sizing: border-box;
}

html, html, body {
  max-width: 100%;
  overflow-x: hidden;
}

body {
  background: var(--bg);
  min-height: 100%;
  color: var(--text);
  margin: 0;
  padding: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.55;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

h1, h2, h3 {
  line-height: 1.2;
}

.container {
  width: 100%;
  max-width: 1140px;
  margin: 0 auto;
  padding: 0 1rem;
}

.container.narrow {
  max-width: 720px;
}

.page {
  min-height: calc(100vh - 124px);
  padding: 1.5rem 0 3rem;
}

.page-title {
  margin: 0 0 1rem;
  font-size: 1.6rem;
}

.brand-accent {
  color: var(--accent);
}

.muted {
  color: var(--muted);
}

.tiny {
  font-size: .78rem;
}

.center {
  text-align: center;
}

.btn {
  border: 1px solid var(--border);
  background: var(--bg-elev-2);
  color: var(--text);
  cursor: pointer;
  border-radius: 9px;
  justify-content: center;
  align-items: center;
  gap: .4rem;
  padding: .6rem 1.1rem;
  font-size: .95rem;
  font-weight: 600;
  text-decoration: none;
  transition: background .15s, border-color .15s, opacity .15s;
  display: inline-flex;
}

.btn:hover {
  background: var(--border);
  text-decoration: none;
}

.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}

.btn.primary:hover {
  background: var(--accent-hover);
}

.btn.ghost {
  background: none;
}

.btn.danger {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}

.btn.danger:hover {
  background: color-mix(in srgb, var(--danger) 85%, black);
}

.btn.danger:disabled {
  background: color-mix(in srgb, var(--danger) 50%, var(--bg));
  border-color: color-mix(in srgb, var(--danger) 50%, var(--bg));
}

.btn.sm {
  padding: .4rem .75rem;
  font-size: .85rem;
}

.btn.block {
  width: 100%;
}

.btn:disabled {
  opacity: .55;
  cursor: not-allowed;
}

.icon-btn {
  padding: .4rem .6rem;
  font-size: 1rem;
}

.topbar {
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
}

.topbar-inner {
  align-items: center;
  gap: .5rem;
  max-width: 1280px;
  height: 56px;
  margin: 0 auto;
  padding: 0 .6rem;
  display: flex;
}

.topbar-btn {
  cursor: pointer;
  width: 40px;
  height: 40px;
  color: var(--text);
  background: none;
  border: none;
  border-radius: 999px;
  flex: none;
  justify-content: center;
  align-items: center;
  padding: 0;
  display: inline-flex;
}

.topbar-btn:hover {
  background: var(--bg-elev-2);
}

.topbar-hamburger {
  font-size: 1.5rem;
  line-height: 1;
}

.topbar-avatar {
  width: 40px;
  height: 40px;
  padding: 3px;
}

.topbar-search {
  flex: auto;
  min-width: 0;
  position: relative;
}

.topbar-search input {
  border: 1px solid var(--border);
  background: var(--bg-elev);
  width: 100%;
  color: var(--text);
  border-radius: 999px;
  outline: none;
  padding: .5rem .95rem;
  font-size: 16px;
}

.topbar-search input:focus {
  border-color: var(--accent);
}

@media (min-width: 880px) {
  .topbar-search input {
    font-size: .92rem;
  }
}

.topbar-right {
  flex: none;
  align-items: center;
  gap: .35rem;
  display: flex;
}

@media (min-width: 880px) {
  .topbar-inner {
    gap: 1rem;
    height: 60px;
    padding: 0 1rem;
  }

  .topbar-search {
    max-width: 520px;
    margin: 0 auto;
  }
}

.search-dropdown {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  z-index: 60;
  border-radius: 12px;
  max-height: calc(100vh - 80px);
  padding: .6rem;
  position: fixed;
  top: 64px;
  left: .5rem;
  right: .5rem;
  overflow-y: auto;
  box-shadow: 0 12px 32px #00000059;
}

@media (min-width: 880px) {
  .search-dropdown {
    width: min(640px, 100vw - 1rem);
    top: 68px;
    left: 50%;
    right: auto;
    transform: translateX(-50%);
  }
}

.search-dropdown-hint {
  color: var(--muted);
  margin: 0;
  padding: .6rem .7rem;
}

.search-dropdown-list {
  flex-direction: column;
  gap: .15rem;
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
}

.search-dropdown-item {
  color: var(--text);
  border-radius: 8px;
  align-items: center;
  gap: .7rem;
  min-width: 0;
  padding: .5rem .6rem;
  text-decoration: none;
  display: flex;
}

.search-dropdown-item:hover {
  background: var(--bg-elev-2);
  text-decoration: none;
}

.search-dropdown-meta {
  flex-direction: column;
  min-width: 0;
  display: flex;
}

.search-dropdown-name {
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
  overflow: hidden;
}

.search-dropdown-sub {
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
}

.search-dropdown-tags {
  border-top: 1px solid var(--border);
  margin-top: .6rem;
  padding-top: .6rem;
}

.search-dropdown-tags-label {
  text-transform: uppercase;
  letter-spacing: .06em;
  padding: 0 .3rem .4rem;
}

.search-dropdown-tag-list {
  flex-wrap: wrap;
  gap: .35rem;
  display: flex;
}

.search-dropdown-close {
  color: var(--muted);
  cursor: pointer;
  background: none;
  border: none;
  border-radius: 6px;
  padding: 4px 6px;
  font-size: .9rem;
  position: absolute;
  top: 6px;
  right: 8px;
}

.search-dropdown-close:hover {
  background: var(--bg-elev-2);
  color: var(--text);
}

.search-dropdown-collapse {
  border: 1px solid var(--border);
  background: var(--bg-elev-2);
  width: 100%;
  color: var(--muted);
  font: inherit;
  cursor: pointer;
  border-radius: 999px;
  justify-content: center;
  align-items: center;
  gap: .4rem;
  margin-top: .6rem;
  padding: .55rem .7rem;
  font-size: .85rem;
  transition: background .15s, color .15s;
  display: flex;
}

.search-dropdown-collapse:hover {
  background: var(--border);
  color: var(--text);
}

.nav-drawer {
  background: var(--bg-elev);
  border-right: 1px solid var(--border);
  z-index: 1000;
  flex-direction: column;
  width: min(320px, 86vw);
  animation: .18s ease-out nav-drawer-in;
  display: flex;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  overflow-y: auto;
  box-shadow: 0 0 32px #0006;
}

.nav-drawer-backdrop {
  z-index: 999;
  background: #00000080;
  animation: .18s ease-out nav-drawer-fade-in;
  position: fixed;
  inset: 0;
}

@keyframes nav-drawer-in {
  from {
    transform: translateX(-100%);
  }

  to {
    transform: translateX(0);
  }
}

@keyframes nav-drawer-fade-in {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.nav-drawer-head {
  border-bottom: 1px solid var(--border);
  grid-template-columns: 36px 1fr 36px;
  align-items: center;
  padding: .6rem .75rem;
  display: grid;
}

.nav-drawer-head .nav-drawer-brand {
  justify-self: center;
}

.nav-drawer-head .nav-drawer-head-spacer {
  display: inline-block;
}

.nav-drawer-head .modal-close {
  justify-self: end;
}

.nav-drawer-brand {
  color: var(--text);
  white-space: nowrap;
  align-items: center;
  gap: .45rem;
  font-size: 1.15rem;
  font-weight: 800;
  text-decoration: none;
  display: inline-flex;
}

.nav-drawer-brand:hover {
  text-decoration: none;
}

.nav-drawer-user {
  border-bottom: 1px solid var(--border);
  color: var(--text);
  align-items: center;
  gap: .7rem;
  padding: .8rem 1rem;
  display: flex;
}

.nav-drawer-user:hover {
  background: var(--bg-elev-2);
  text-decoration: none;
}

.nav-drawer-user-meta {
  flex-direction: column;
  min-width: 0;
  display: flex;
}

.nav-drawer-list {
  flex-direction: column;
  flex: 1 0 auto;
  gap: .1rem;
  padding: .5rem .6rem 1rem;
  display: flex;
}

.nav-drawer-foot {
  border-top: 1px solid var(--border);
  flex-direction: column;
  gap: .6rem;
  margin-top: auto;
  padding: .75rem .9rem 1rem;
  display: flex;
}

.nav-drawer-legal {
  color: var(--muted);
  justify-content: center;
  gap: .4rem;
  font-size: .8rem;
  display: flex;
}

.nav-drawer-legal a {
  color: var(--muted);
}

.nav-drawer-legal a:hover {
  color: var(--text);
}

.btn.discord {
  color: #fff;
  background: #5865f2;
  border: 1px solid #5865f2;
  justify-content: center;
  align-items: center;
  gap: .5rem;
  display: inline-flex;
}

.btn.discord:hover {
  color: #fff;
  background: #4752c4;
  border-color: #4752c4;
  text-decoration: none;
}

.btn.discord .nav-drawer-icon {
  color: #fff;
}

.nav-drawer-item {
  text-align: left;
  color: var(--text);
  font: inherit;
  cursor: pointer;
  background: none;
  border: none;
  border-radius: 8px;
  align-items: center;
  gap: .7rem;
  width: 100%;
  padding: .7rem .85rem;
  text-decoration: none;
  display: flex;
}

.nav-drawer-item:hover {
  background: var(--bg-elev-2);
  text-decoration: none;
}

.nav-drawer-item.danger {
  color: var(--danger);
}

.nav-drawer-icon {
  width: 20px;
  height: 20px;
  color: var(--muted);
  flex-shrink: 0;
}

.nav-drawer-item:hover .nav-drawer-icon {
  color: var(--text);
}

.nav-drawer-item.danger .nav-drawer-icon {
  color: var(--danger);
}

.nav-drawer-rule {
  border: none;
  border-top: 1px solid var(--border);
  margin: .4rem;
}

.nav-drawer-row {
  justify-content: space-between;
  align-items: center;
  gap: .6rem;
  padding: .55rem .85rem;
  display: flex;
}

.dropdown-wrap {
  position: relative;
}

.avatar-btn {
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
}

.avatar {
  object-fit: cover;
  background: var(--bg-elev-2);
  color: var(--text);
  border-radius: 50%;
  justify-content: center;
  align-items: center;
  font-weight: 700;
  display: inline-flex;
}

.avatar-fallback {
  background: var(--accent);
  color: var(--on-accent);
}

.avatar-sm {
  width: 34px;
  height: 34px;
  font-size: .9rem;
}

.avatar-lg {
  width: 88px;
  height: 88px;
  font-size: 2rem;
}

.avatar-xl {
  width: 110px;
  height: 110px;
  font-size: 2.6rem;
}

.dropdown {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  min-width: 200px;
  box-shadow: var(--shadow);
  border-radius: 12px;
  flex-direction: column;
  padding: .4rem;
  display: flex;
  position: absolute;
  top: 46px;
  right: 0;
}

.dropdown-head {
  border-bottom: 1px solid var(--border);
  flex-direction: column;
  margin-bottom: .3rem;
  padding: .5rem .7rem;
  display: flex;
}

.dropdown-item {
  text-align: left;
  color: var(--text);
  font: inherit;
  cursor: pointer;
  background: none;
  border: none;
  border-radius: 8px;
  padding: .55rem .7rem;
}

.dropdown-item:hover {
  background: var(--bg-elev-2);
  text-decoration: none;
}

.dropdown-item.danger {
  color: var(--danger);
}

.hero {
  text-align: center;
  padding: 3rem 1rem 2.5rem;
}

.hero h1 {
  margin: 0 0 .6rem;
  font-size: clamp(1.8rem, 4vw, 2.8rem);
}

.hero p {
  color: var(--muted);
  max-width: 540px;
  margin: 0 auto 1.5rem;
  font-size: 1.05rem;
}

.hero-actions {
  flex-wrap: wrap;
  justify-content: center;
  gap: .75rem;
  display: flex;
}

.section-head {
  justify-content: space-between;
  align-items: baseline;
  margin: 2rem 0 1rem;
  display: flex;
}

.section-title {
  margin: 1.5rem 0 1rem;
  font-size: 1.25rem;
}

.char-grid {
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: .7rem;
  display: grid;
}

@media (min-width: 600px) {
  .char-grid {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1.1rem;
  }
}

.char-card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 14px;
  flex-direction: column;
  transition: transform .12s, border-color .12s;
  display: flex;
  overflow: hidden;
}

.char-card:hover {
  border-color: var(--accent);
  text-decoration: none;
  transform: translateY(-3px);
}

.char-card-media {
  aspect-ratio: 4 / 3;
  background: var(--bg-elev-2);
  justify-content: center;
  align-items: center;
  display: flex;
  position: relative;
}

.char-card-media img {
  object-fit: cover;
  width: 100%;
  height: 100%;
}

.char-card-fallback {
  color: var(--accent);
  font-size: 2.6rem;
  font-weight: 800;
}

.nsfw-badge {
  background: var(--danger);
  color: #fff;
  border-radius: 6px;
  padding: .15rem .45rem;
  font-size: .7rem;
  font-weight: 700;
  position: absolute;
  top: 8px;
  left: 8px;
}

.nsfw-badge.lg {
  padding: .25rem .55rem;
  font-size: .85rem;
}

.char-card-body {
  flex-direction: column;
  flex: 1;
  gap: .35rem;
  padding: .65rem .7rem .8rem;
  display: flex;
}

.char-card-title {
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: .98rem;
  font-weight: 700;
  overflow: hidden;
}

@media (min-width: 600px) {
  .char-card-body {
    gap: .4rem;
    padding: .85rem .9rem 1rem;
  }

  .char-card-title {
    font-size: 1.02rem;
  }
}

.char-card-desc {
  color: var(--muted);
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  min-height: 4.05em;
  margin: 0;
  font-size: .85rem;
  line-height: 1.35;
  display: -webkit-box;
  overflow: hidden;
}

@media (min-width: 600px) {
  .char-card-desc {
    -webkit-line-clamp: 3;
    font-size: .88rem;
  }
}

.char-card-metrics {
  color: var(--text);
  gap: .7rem;
  font-size: .8rem;
  display: flex;
}

.char-card-metrics > span {
  white-space: nowrap;
  align-items: center;
  gap: .25rem;
  display: inline-flex;
}

.char-card-metric-icon {
  width: 14px;
  height: 14px;
  color: var(--muted);
  flex-shrink: 0;
}

.char-card-creator {
  align-items: center;
  gap: .4rem;
  min-width: 0;
  display: inline-flex;
}

.char-card-creator-avatar {
  object-fit: cover;
  border-radius: 50%;
  flex-shrink: 0;
  justify-content: center;
  align-items: center;
  width: 18px;
  height: 18px;
  font-size: .65rem;
  font-weight: 700;
  display: inline-flex;
}

.char-card-creator span.muted {
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
}

.char-card-meta {
  justify-content: space-between;
  margin-top: auto;
  font-size: .78rem;
  display: flex;
}

.tag-chip-more {
  color: var(--muted);
  cursor: default;
  border-style: dashed;
}

.tag-row, .tag-filter {
  flex-wrap: wrap;
  gap: .4rem;
  display: flex;
}

.tag-filter {
  margin: .5rem 0 1.25rem;
}

.tag-chip {
  border: 1px solid var(--border);
  background: var(--bg-elev);
  color: var(--text);
  cursor: pointer;
  font-size: .82rem;
  font: inherit;
  border-radius: 999px;
  padding: .3rem .7rem;
  font-size: .82rem;
  display: inline-block;
}

.tag-chip:hover {
  border-color: var(--accent);
  text-decoration: none;
}

.tag-chip-toggle {
  color: var(--muted);
  border-style: dashed;
  font-weight: 500;
}

.tag-chip-toggle:hover {
  color: var(--text);
  border-color: var(--accent);
}

.tag-chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}

.tag-chip.tiny {
  padding: .15rem .5rem;
  font-size: .72rem;
}

.browse-controls {
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: .5rem;
  display: flex;
}

.sort-tabs {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 10px;
  gap: .3rem;
  padding: .25rem;
  display: flex;
}

.sort-tab {
  color: var(--muted);
  font: inherit;
  cursor: pointer;
  background: none;
  border: none;
  border-radius: 7px;
  padding: .4rem .85rem;
  font-weight: 600;
}

.sort-tab.active {
  background: var(--accent);
  color: var(--on-accent);
}

.nsfw-toggle {
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
  color: var(--muted);
  align-items: center;
  gap: .55rem;
  font-size: .9rem;
  font-weight: 600;
  transition: color .18s;
  display: inline-flex;
}

.nsfw-toggle.on {
  color: var(--text);
}

.nsfw-toggle input {
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  position: absolute;
  overflow: hidden;
}

.nsfw-switch {
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  align-items: center;
  width: 46px;
  height: 24px;
  transition: background .2s, border-color .2s;
  display: inline-flex;
  position: relative;
}

.nsfw-switch-thumb {
  background: #fff;
  border-radius: 50%;
  width: 18px;
  height: 18px;
  transition: transform .2s;
  position: absolute;
  top: 50%;
  left: 2px;
  transform: translate(0, -50%);
  box-shadow: 0 1px 2px #0000004d;
}

.nsfw-toggle.on .nsfw-switch {
  background: linear-gradient(135deg, #ff4d6d, #c2185b);
  border-color: #c2185b;
}

.nsfw-toggle.on .nsfw-switch-thumb {
  transform: translate(22px, -50%);
}

.nsfw-toggle input:focus-visible + .nsfw-switch {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.form {
  flex-direction: column;
  gap: 1.1rem;
  margin-top: 1.25rem;
  display: flex;
}

.field {
  flex-direction: column;
  gap: .35rem;
  display: flex;
}

.field label {
  justify-content: space-between;
  align-items: baseline;
  font-size: .9rem;
  font-weight: 600;
  display: flex;
}

.field input, .field textarea, .field select {
  border: 1px solid var(--border);
  background: var(--bg-elev);
  width: 100%;
  color: var(--text);
  font: inherit;
  resize: vertical;
  border-radius: 9px;
  padding: .6rem .75rem;
  font-size: .92rem;
}

.field input:focus, .field textarea:focus {
  border-color: var(--accent);
  outline: none;
}

.char-count {
  color: var(--muted);
  font-size: .75rem;
  font-weight: 400;
}

.checkbox-row {
  flex-wrap: wrap;
  gap: 1.5rem;
  display: flex;
}

.checkbox-row label {
  align-items: center;
  gap: .4rem;
  font-size: .92rem;
  display: flex;
}

.checkbox-row label.disabled {
  color: var(--muted);
}

.avatar-upload {
  align-items: center;
  gap: 1rem;
  display: flex;
}

.file-btn {
  position: relative;
}

.error-text {
  color: var(--danger);
  margin: .4rem 0 0;
  font-size: .85rem;
}

.error-banner {
  background: color-mix(in srgb, var(--danger) 15%, transparent);
  border: 1px solid var(--danger);
  color: var(--danger);
  border-radius: 9px;
  padding: .6rem .85rem;
  font-size: .9rem;
}

.gallery-grid {
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: .6rem;
  display: grid;
}

.gallery-item {
  aspect-ratio: 1;
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  position: relative;
  overflow: hidden;
}

.gallery-item.primary {
  border-color: var(--accent);
  outline: 1px solid var(--accent);
}

.gallery-item img {
  object-fit: cover;
  width: 100%;
  height: 100%;
  display: block;
}

.gallery-item-actions {
  opacity: 0;
  background: linear-gradient(to top, #000000b3, #0000);
  gap: .3rem;
  padding: .35rem;
  transition: opacity .15s;
  display: flex;
  position: absolute;
  inset: auto 0 0;
}

.gallery-item:hover .gallery-item-actions, .gallery-item:focus-within .gallery-item-actions {
  opacity: 1;
}

.gallery-item .badge {
  margin: 0;
  position: absolute;
  top: 6px;
  left: 6px;
}

.gallery-grid .gallery-add {
  aspect-ratio: 1;
  border: 2px dashed var(--border);
  color: var(--muted);
  cursor: pointer;
  text-align: center;
  background: none;
  border-radius: 10px;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: .2rem;
  font-size: .92rem;
  display: flex;
}

.gallery-grid .gallery-add:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.gallery-view {
  flex-direction: column;
  gap: .6rem;
  display: flex;
}

.gallery-hero {
  background: var(--bg-elev-2);
  border-radius: 16px;
  justify-content: center;
  align-items: center;
  width: 220px;
  height: 220px;
  display: flex;
  position: relative;
  overflow: hidden;
}

.gallery-hero-fallback {
  font-size: 4rem;
  font-weight: 800;
}

.gallery-thumbs {
  flex-wrap: wrap;
  gap: .4rem;
  display: flex;
}

.gallery-thumb {
  background: var(--bg-elev-2);
  cursor: pointer;
  border: 2px solid #0000;
  border-radius: 8px;
  width: 46px;
  height: 46px;
  padding: 0;
  overflow: hidden;
}

.gallery-thumb img {
  object-fit: cover;
  width: 100%;
  height: 100%;
  display: block;
}

.gallery-thumb.active {
  border-color: var(--accent);
}

.detail-grid {
  flex-wrap: wrap;
  gap: 1.75rem;
  margin-bottom: 1.5rem;
  display: flex;
}

.detail-media {
  flex-shrink: 0;
  position: relative;
}

.detail-avatar {
  object-fit: cover;
  background: var(--bg-elev-2);
  border-radius: 16px;
  justify-content: center;
  align-items: center;
  width: 220px;
  height: 220px;
  font-size: 4rem;
  font-weight: 800;
  display: inline-flex;
}

.detail-body {
  flex-direction: column;
  flex: 1;
  gap: .75rem;
  min-width: 260px;
  display: flex;
}

.detail-title {
  margin: 0;
  font-size: 2rem;
}

.detail-meta-line {
  color: var(--muted);
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem;
  margin: .25rem 0 .6rem;
  font-size: .92rem;
  display: flex;
}

.detail-creator {
  color: var(--text);
  align-items: center;
  gap: .4rem;
  text-decoration: none;
  display: inline-flex;
}

.detail-creator:hover {
  text-decoration: underline;
}

.detail-creator-avatar {
  object-fit: cover;
  border-radius: 50%;
  flex-shrink: 0;
  justify-content: center;
  align-items: center;
  width: 22px;
  height: 22px;
  font-size: .75rem;
  font-weight: 700;
  display: inline-flex;
}

.detail-meta-sep {
  color: var(--muted);
}

.detail-meta-metric {
  white-space: nowrap;
  align-items: center;
  gap: .3rem;
  display: inline-flex;
}

.detail-meta-icon {
  width: 16px;
  height: 16px;
  color: var(--muted);
  flex-shrink: 0;
}

.detail-desc {
  font-size: 1.02rem;
}

.detail-cta {
  max-width: 280px;
  margin-top: .5rem;
}

.detail-section {
  border-top: 1px solid var(--border);
  padding-top: 1.25rem;
}

.comment-section {
  flex-direction: column;
  gap: .85rem;
  margin-top: 2rem;
  display: flex;
}

.comment-section-head {
  flex-wrap: wrap;
  align-items: center;
  gap: .75rem;
  display: flex;
}

.comment-section-head p {
  margin: 0;
}

.comment-count-pill {
  border: 1px solid var(--border);
  background: var(--bg-elev);
  border-radius: 999px;
  padding: .3rem .75rem;
  font-size: .85rem;
}

.comment-form {
  flex-direction: column;
  gap: .5rem;
  display: flex;
}

.comment-textarea {
  border: 1px solid var(--border);
  background: var(--bg-elev);
  width: 100%;
  color: var(--text);
  font: inherit;
  resize: vertical;
  border-radius: 8px;
  min-height: 60px;
  padding: .65rem .85rem;
  font-size: 16px;
}

.comment-textarea:focus {
  border-color: var(--accent);
  outline: none;
}

.comment-sort-row {
  align-items: center;
  gap: .5rem;
  display: flex;
}

.comment-sort {
  border: 1px solid var(--border);
  background: var(--bg-elev);
  color: var(--text);
  font: inherit;
  border-radius: 6px;
  padding: .3rem .6rem;
  font-size: .85rem;
}

.comment-list {
  flex-direction: column;
  gap: .75rem;
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
}

.comment-row {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 10px;
  gap: .7rem;
  padding: .8rem .9rem;
  display: flex;
}

.comment-row.pinned {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, var(--bg-elev));
}

.comment-avatar-link {
  flex-shrink: 0;
}

.comment-body {
  flex-direction: column;
  flex: 1;
  gap: .4rem;
  min-width: 0;
  display: flex;
}

.comment-head {
  flex-wrap: wrap;
  align-items: center;
  gap: .4rem;
  display: flex;
}

.comment-author {
  color: var(--text);
  font-weight: 600;
  text-decoration: none;
}

.comment-author:hover {
  text-decoration: underline;
}

.comment-pin-badge {
  color: var(--accent);
  align-items: center;
  gap: .2rem;
  font-size: .75rem;
  font-weight: 600;
  display: inline-flex;
}

.comment-pin-icon {
  width: 14px;
  height: 14px;
}

.comment-time {
  margin-left: 0;
}

.comment-text {
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0;
  font-size: .92rem;
  line-height: 1.45;
}

.comment-like-btn {
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  background: none;
  border: none;
  align-self: flex-start;
  align-items: center;
  gap: .3rem;
  padding: 0;
  font-size: .8rem;
  display: inline-flex;
}

.comment-like-btn:hover:not(:disabled) {
  color: var(--text);
}

.comment-like-btn.liked {
  color: var(--danger);
}

.comment-like-btn svg {
  width: 16px;
  height: 16px;
}

.comment-menu-wrap {
  margin-left: auto;
  position: relative;
}

.comment-menu-btn {
  color: var(--muted);
  cursor: pointer;
  background: none;
  border: none;
  border-radius: 4px;
  padding: 4px;
}

.comment-menu-btn:hover {
  color: var(--text);
  background: var(--bg-elev-2);
}

.comment-menu-btn svg {
  width: 18px;
  height: 18px;
}

.comment-menu {
  z-index: 10;
  min-width: 140px;
  position: absolute;
  top: 100%;
  right: 0;
}

.prompt-breakdown {
  flex-direction: column;
  gap: .5rem;
  margin-top: 1.25rem;
  display: flex;
}

.prompt-row {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

.prompt-row-head {
  width: 100%;
  color: var(--text);
  font: inherit;
  letter-spacing: .06em;
  text-transform: uppercase;
  cursor: pointer;
  background: none;
  border: none;
  justify-content: space-between;
  align-items: center;
  padding: .85rem 1rem;
  font-size: .82rem;
  font-weight: 600;
  display: flex;
}

.prompt-row-head:disabled {
  cursor: default;
  opacity: .7;
}

.prompt-row-head:hover:not(:disabled) {
  background: var(--bg-elev-2);
}

.prompt-row-tokens {
  color: var(--muted);
  font-weight: 500;
}

.prompt-row-chev {
  width: 18px;
  height: 18px;
  color: var(--accent);
  transition: transform .18s;
}

.prompt-row-body {
  white-space: pre-wrap;
  word-break: break-word;
  font: inherit;
  color: var(--text);
  border-top: 1px solid var(--border);
  margin: 0;
  padding: .85rem 1rem 1rem;
  font-size: .92rem;
}

.profile-head {
  flex-wrap: wrap;
  align-items: center;
  gap: 1.5rem;
  margin: 1rem 0 2rem;
  display: flex;
}

.profile-meta {
  flex-direction: column;
  gap: .5rem;
  display: flex;
}

.profile-meta h1 {
  margin: 0;
}

.modal-overlay {
  z-index: 100;
  background: #0009;
  justify-content: center;
  align-items: center;
  padding: 1rem;
  display: flex;
  position: fixed;
  inset: 0;
}

.modal {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  width: 100%;
  max-width: 460px;
  max-height: 90vh;
  box-shadow: var(--shadow);
  border-radius: 14px;
  padding: 1.25rem 1.4rem 1.5rem;
  overflow-y: auto;
}

.modal-header {
  justify-content: space-between;
  align-items: center;
  display: flex;
}

.modal-header h2 {
  margin: 0;
  font-size: 1.2rem;
}

.modal-close {
  color: var(--muted);
  cursor: pointer;
  background: none;
  border: none;
  font-size: 1.1rem;
}

.auth-modal {
  max-width: 420px;
}

.auth-modal-body {
  margin-top: 1rem;
}

.auth-tabs {
  background: var(--bg-elev-2);
  border-radius: 999px;
  gap: .25rem;
  padding: .25rem;
  display: flex;
}

.auth-tab {
  color: var(--muted);
  font: inherit;
  cursor: pointer;
  background: none;
  border: none;
  border-radius: 999px;
  flex: auto;
  padding: .4rem .9rem;
  font-weight: 600;
  transition: background .15s, color .15s;
}

.auth-tab:hover {
  color: var(--text);
}

.auth-tab.active {
  background: var(--bg-elev);
  color: var(--text);
  box-shadow: 0 1px 2px #0003;
}

.empty-state {
  background: var(--bg-elev);
  border: 1px dashed var(--border);
  text-align: center;
  color: var(--muted);
  border-radius: 12px;
  padding: 2rem;
}

.footer {
  border-top: 1px solid var(--border);
  padding: 1.25rem 0;
}

.footer .container {
  color: var(--muted);
  justify-content: space-between;
  align-items: center;
  font-size: .85rem;
  display: flex;
}

.auth-page {
  padding-top: 2.5rem;
}

.auth-card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  border-radius: 16px;
  padding: 2rem 1.75rem;
}

.auth-form .btn.block {
  margin-top: .5rem;
}

.auth-divider {
  color: var(--muted);
  align-items: center;
  gap: .6rem;
  margin: 1rem 0;
  font-size: .8rem;
  display: flex;
}

.auth-divider:before, .auth-divider:after {
  content: "";
  background: var(--border);
  flex: 1;
  height: 1px;
}

.success-banner {
  color: #10b981;
  background: #10b9812e;
  border: 1px solid #10b981;
  border-radius: 9px;
  padding: .55rem .85rem;
  font-size: .9rem;
}

.settings-shell {
  grid-template-columns: 220px 1fr;
  gap: 1.5rem;
  margin-top: 1rem;
  display: grid;
}

.settings-nav {
  flex-direction: column;
  align-self: start;
  gap: .25rem;
  display: flex;
  position: sticky;
  top: 76px;
}

.settings-tab {
  text-align: left;
  color: var(--text);
  font: inherit;
  cursor: pointer;
  background: none;
  border: 1px solid #0000;
  border-radius: 9px;
  padding: .55rem .85rem;
  font-weight: 600;
}

.settings-tab:hover {
  background: var(--bg-elev);
}

.settings-tab.active {
  background: var(--bg-elev);
  border-color: var(--border);
  color: var(--accent);
}

.settings-panel {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 14px;
  min-width: 0;
  padding: 1.5rem;
}

.radio-row {
  flex-wrap: wrap;
  gap: 1.5rem;
  display: flex;
}

.radio-row label {
  align-items: center;
  gap: .4rem;
  font-size: .92rem;
  display: flex;
}

.danger-zone {
  border: 1px solid var(--danger);
  background: color-mix(in srgb, var(--danger) 6%, transparent);
  border-radius: 12px;
  flex-direction: column;
  gap: .85rem;
  padding: 1.1rem 1.25rem;
  display: flex;
}

.danger-zone code {
  background: var(--bg-elev-2);
  border-radius: 4px;
  padding: .05rem .4rem;
}

.persona-list {
  flex-direction: column;
  gap: .6rem;
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
}

.persona-item {
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: .85rem 1rem;
}

.persona-item-head {
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: .5rem;
  display: flex;
}

.persona-item-actions {
  gap: .3rem;
  display: flex;
}

.persona-desc {
  white-space: pre-wrap;
  margin: .5rem 0 0;
}

.persona-editor {
  background: var(--bg-elev-2);
  border: 1px solid var(--accent);
  border-radius: 12px;
  flex-direction: column;
  gap: .9rem;
  padding: 1rem 1.1rem;
  display: flex;
}

.persona-editor-actions {
  justify-content: flex-end;
  gap: .4rem;
  display: flex;
}

.badge {
  background: var(--accent);
  color: var(--on-accent);
  text-transform: uppercase;
  letter-spacing: .04em;
  border-radius: 999px;
  margin-left: .4rem;
  padding: .05rem .5rem;
  font-size: .65rem;
  display: inline-block;
}

.persona-select {
  border: 1px solid var(--border);
  background: var(--bg-elev-2);
  width: 100%;
  color: var(--text);
  font: inherit;
  border-radius: 9px;
  padding: .5rem .7rem;
  font-size: .92rem;
}

.persona-select:focus {
  border-color: var(--accent);
  outline: none;
}

.info-panel-rule {
  border: none;
  border-top: 1px solid var(--border);
  width: 100%;
  margin: 1rem 0 .6rem;
}

.picker-list {
  flex-direction: column;
  gap: .3rem;
  max-height: 280px;
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  overflow-y: auto;
}

.picker-row {
  background: var(--bg-elev-2);
  cursor: pointer;
  font: inherit;
  border-radius: 8px;
  align-items: center;
  gap: .7rem;
  padding: .55rem .7rem;
  display: flex;
}

.picker-row:hover {
  background: var(--border);
}

.picker-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
}

.picker-row-meta {
  flex-direction: column;
  display: flex;
}

.picker-create {
  border-top: 1px solid var(--border);
  align-items: stretch;
  gap: .4rem;
  margin-top: 1rem;
  padding-top: .8rem;
  display: flex;
}

.picker-create input {
  border: 1px solid var(--border);
  background: var(--bg-elev-2);
  color: var(--text);
  font: inherit;
  border-radius: 8px;
  flex: 1;
  padding: .5rem .7rem;
  font-size: .92rem;
}

.picker-create input:focus {
  border-color: var(--accent);
  outline: none;
}

.collection-head {
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin: 1rem 0 1.5rem;
  display: flex;
}

.profile-collection-list {
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: .6rem;
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
}

.profile-collection-card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 10px;
  flex-direction: column;
  gap: .25rem;
  padding: .75rem .9rem;
  display: flex;
}

.profile-collection-card:hover {
  border-color: var(--accent);
  text-decoration: none;
}

.bell-btn {
  color: var(--text);
  cursor: pointer;
  background: none;
  border: none;
  border-radius: 7px;
  padding: .3rem .4rem;
  font-size: 1.15rem;
  position: relative;
}

.bell-btn:hover {
  background: var(--bg-elev-2);
}

.bell-badge {
  background: var(--danger);
  color: #fff;
  border-radius: 999px;
  justify-content: center;
  align-items: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  font-size: .65rem;
  font-weight: 700;
  display: inline-flex;
  position: absolute;
  top: -2px;
  right: -2px;
}

.notifications-dropdown {
  min-width: 320px;
  max-width: 360px;
  max-height: 70vh;
  padding: 0;
  overflow-y: auto;
}

.notifications-dropdown .dropdown-head {
  justify-content: space-between;
  align-items: center;
  padding: .6rem .8rem;
  display: flex;
}

.dropdown-link {
  color: var(--accent);
  font: inherit;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  font-size: .82rem;
}

.dropdown-link:hover {
  text-decoration: underline;
}

.notif-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.notif-item {
  border-top: 1px solid var(--border);
}

.notif-item.unread {
  background: color-mix(in srgb, var(--accent) 8%, transparent);
}

.notif-row {
  width: 100%;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  font: inherit;
  background: none;
  border: none;
  align-items: center;
  gap: .6rem;
  padding: .6rem .8rem;
  display: flex;
}

.notif-row:hover {
  background: var(--bg-elev-2);
}

.notif-meta {
  flex: 1;
  min-width: 0;
}

.notif-text {
  word-break: break-word;
  font-size: .9rem;
  line-height: 1.3;
}

.notif-dot {
  background: var(--accent);
  border-radius: 50%;
  flex-shrink: 0;
  width: 8px;
  height: 8px;
}

:is(body:has(.chat-shell) > .topbar, body:has(.chat-shell) > .footer) {
  display: none;
}

body:has(.chat-shell) > .page {
  min-height: 100vh;
  padding: 0;
}

.chat-shell {
  border-top: none;
  height: 100vh;
  margin: 0;
  display: flex;
  overflow: hidden;
}

.chat-sidebar {
  border-right: 1px solid var(--border);
  background: var(--bg-elev);
  flex-direction: column;
  flex-shrink: 0;
  width: 280px;
  display: flex;
}

.chat-sidebar-top {
  border-bottom: 1px solid var(--border);
  align-items: center;
  gap: .25rem;
  padding: .6rem .75rem;
  display: flex;
}

.chat-sidebar-back {
  color: var(--text);
  cursor: pointer;
  font: inherit;
  background: none;
  border: none;
  border-radius: 6px;
  align-items: center;
  gap: .3rem;
  padding: .4rem .6rem;
  font-size: .92rem;
  display: inline-flex;
}

.chat-sidebar-back:hover {
  background: var(--bg-elev-2);
}

.chat-sidebar-back-icon {
  width: 16px;
  height: 16px;
}

.chat-sidebar-action {
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  width: calc(100% - 1.2rem);
  color: var(--text);
  cursor: pointer;
  font: inherit;
  border-radius: 8px;
  align-items: center;
  gap: .55rem;
  margin: .5rem .6rem 0;
  padding: .55rem .8rem;
  font-size: .92rem;
  font-weight: 600;
  display: flex;
}

.chat-sidebar-action:hover:not(:disabled) {
  background: var(--accent);
  color: var(--on-accent);
  border-color: var(--accent);
}

.chat-sidebar-action:disabled {
  opacity: .5;
  cursor: not-allowed;
}

.chat-sidebar-action-icon {
  width: 16px;
  height: 16px;
}

.chat-sidebar-action.danger {
  color: color-mix(in srgb, var(--danger, #ef4444) 80%, var(--text));
}

.chat-sidebar-action.danger:hover:not(:disabled) {
  background: var(--danger, #ef4444);
  color: #fff;
  border-color: var(--danger, #ef4444);
}

.chat-list-row {
  align-items: stretch;
  gap: .2rem;
  display: flex;
}

.chat-list-row .chat-list-item {
  flex: 1;
  min-width: 0;
}

.chat-list-row .chat-row-delete {
  flex-shrink: 0;
  align-self: center;
}

.chat-sidebar-head {
  border-bottom: 1px solid var(--border);
  justify-content: space-between;
  align-items: center;
  margin-top: .5rem;
  padding: .85rem 1rem;
  display: flex;
}

.chat-sidebar-head h2 {
  margin: 0;
  font-size: 1rem;
}

.chat-list {
  margin: 0;
  padding: .4rem;
  list-style: none;
  overflow-y: auto;
}

.chat-list-item {
  color: var(--text);
  border-radius: 9px;
  align-items: center;
  gap: .6rem;
  padding: .55rem .6rem;
  text-decoration: none;
  display: flex;
}

.chat-list-item:hover {
  background: var(--bg-elev-2);
  text-decoration: none;
}

.chat-list-item.active {
  background: var(--bg-elev-2);
  outline: 1px solid var(--accent);
}

.chat-list-meta {
  flex: 1;
  min-width: 0;
}

.chat-list-title-row {
  align-items: baseline;
  gap: .5rem;
  min-width: 0;
  display: flex;
}

.chat-list-title {
  white-space: nowrap;
  text-overflow: ellipsis;
  flex: 1;
  font-size: .9rem;
  font-weight: 600;
  overflow: hidden;
}

.chat-list-time {
  flex-shrink: 0;
}

.chat-list-preview {
  color: var(--muted);
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: .78rem;
  overflow: hidden;
}

.chat-sidebar-backdrop {
  z-index: 30;
  background: #00000080;
  border: none;
  display: none;
  position: fixed;
  inset: 60px 0 0;
}

.chat-main {
  flex-direction: column;
  flex: 1;
  min-width: 0;
  display: flex;
}

.chat-header {
  border-bottom: 1px solid var(--border);
  align-items: center;
  gap: .6rem;
  padding: .6rem 1rem;
  display: flex;
}

.chat-header-title {
  flex: 1;
  min-width: 0;
}

.chat-title {
  color: var(--text);
  font: inherit;
  cursor: pointer;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
  background: none;
  border: none;
  max-width: 100%;
  padding: 0;
  font-size: 1rem;
  font-weight: 700;
  display: block;
  overflow: hidden;
}

.chat-title:hover {
  color: var(--accent);
}

.chat-title-input {
  width: 100%;
  font: inherit;
  background: var(--bg-elev);
  color: var(--text);
  border: 1px solid var(--accent);
  border-radius: 6px;
  padding: .2rem .4rem;
  font-size: 1rem;
  font-weight: 700;
}

.chat-header-btn {
  width: 36px;
  height: 36px;
  color: var(--text);
  cursor: pointer;
  background: none;
  border: none;
  border-radius: 50%;
  justify-content: center;
  align-items: center;
  padding: 0;
  font-size: 1.05rem;
  line-height: 1;
  transition: background .12s, color .12s;
  display: inline-flex;
}

.chat-header-btn:hover {
  background: var(--bg-elev-2);
}

.chat-header-actions {
  align-items: center;
  gap: .3rem;
  display: flex;
}

.chat-sidebar-toggle {
  display: none;
}

.chat-messages {
  scroll-behavior: smooth;
  flex: 1;
  padding: .75rem .5rem;
  overflow-y: auto;
}

@media (min-width: 720px) {
  .chat-messages {
    padding: 1.25rem 1rem;
  }
}

.message {
  align-items: flex-start;
  gap: .4rem;
  margin-bottom: .9rem;
  display: flex;
}

@media (min-width: 720px) {
  .message {
    gap: .6rem;
    margin-bottom: 1.1rem;
  }
}

.message.user {
  flex-direction: row-reverse;
}

.message-body-wrap {
  flex-direction: column;
  flex: 0 auto;
  gap: .3rem;
  min-width: 0;
  max-width: 100%;
  display: flex;
}

.msg-actions {
  flex-wrap: wrap;
  align-items: center;
  gap: .2rem;
  padding: 0 .15rem;
  display: flex;
}

.message.user .msg-actions {
  justify-content: flex-end;
}

.msg-action {
  width: 30px;
  height: 30px;
  color: var(--muted);
  cursor: pointer;
  background: none;
  border: none;
  border-radius: 6px;
  justify-content: center;
  align-items: center;
  padding: 0;
  transition: background .12s, color .12s;
  display: inline-flex;
}

.msg-action:hover {
  background: var(--bg-elev-2);
  color: var(--text);
}

.msg-action.active {
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 14%, transparent);
}

.msg-action svg {
  width: 16px;
  height: 16px;
}

.msg-action-toast {
  color: var(--muted);
  letter-spacing: .04em;
  text-transform: uppercase;
  margin-left: .3rem;
  font-size: .72rem;
}

.variant-arrows {
  color: var(--muted);
  align-self: flex-start;
  align-items: center;
  gap: .25rem;
  margin-top: .1rem;
  padding: 0 .15rem;
  font-size: .78rem;
  display: inline-flex;
}

.message.user .variant-arrows {
  align-self: flex-end;
}

.variant-arrow {
  width: 24px;
  height: 24px;
  color: var(--muted);
  cursor: pointer;
  background: none;
  border: none;
  border-radius: 6px;
  padding: 0;
  font-size: 1rem;
  line-height: 1;
  transition: background .12s, color .12s;
}

.variant-arrow:hover:not(:disabled) {
  background: var(--bg-elev-2);
  color: var(--text);
}

.variant-arrow:disabled {
  opacity: .35;
  cursor: not-allowed;
}

.variant-arrow-count {
  text-align: center;
  font-variant-numeric: tabular-nums;
  min-width: 28px;
}

.message-bubble {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  word-wrap: break-word;
  border-radius: 14px;
  max-width: 100%;
  padding: .65rem .85rem;
}

@media (min-width: 720px) {
  .message-bubble {
    max-width: 78%;
    padding: .65rem .95rem;
  }
}

.message.user .message-bubble {
  background: color-mix(in srgb, var(--accent) 18%, var(--bg-elev));
  color: var(--text);
  border-color: color-mix(in srgb, var(--accent) 40%, var(--border));
}

.message-bubble.editing {
  width: min(440px, 100%);
}

.message.user .message-bubble.editing {
  max-width: 100%;
}

.message-bubble.error {
  border-color: var(--danger);
}

.message-bubble p {
  margin: 0 0 .6rem;
}

.message-bubble p:last-child {
  margin-bottom: 0;
}

.message-bubble pre {
  background: var(--bg-elev-2);
  border-radius: 8px;
  padding: .5rem .7rem;
  font-size: .85rem;
  overflow-x: auto;
}

.message-bubble code {
  background: var(--bg-elev-2);
  border-radius: 4px;
  padding: .1rem .35rem;
  font-size: .9em;
}

.message-bubble pre code {
  background: none;
  padding: 0;
}

.message-text {
  white-space: pre-wrap;
}

.message-bubble {
  position: relative;
}

.message-rich {
  color: var(--muted);
  white-space: pre-wrap;
  margin: 0 0 .6rem;
}

.message-rich:last-child {
  margin-bottom: 0;
}

.message-rich .msg-dialogue {
  color: var(--text);
  font-weight: 500;
}

.message-rich .msg-narration {
  color: var(--muted);
  font-style: italic;
}

.message-bubble.ooc {
  color: var(--muted);
  border-style: dashed;
  font-style: italic;
  background: none !important;
}

.message.user .message-bubble.ooc {
  color: var(--muted);
  border-color: var(--muted);
}

.ooc-tag {
  letter-spacing: .05em;
  text-transform: uppercase;
  opacity: .7;
  border: 1px solid;
  border-radius: 4px;
  margin-right: .4rem;
  padding: .05rem .45rem;
  font-size: .65rem;
  font-style: normal;
  font-weight: 700;
  display: inline-block;
}

.tag-chip.blocked {
  background: color-mix(in srgb, var(--danger) 12%, transparent);
  border-color: var(--danger);
  color: var(--danger);
}

.new-tag-row {
  align-items: center;
  gap: .5rem;
  margin-top: .6rem;
  display: flex;
}

.new-tag-row input[type="text"], .new-tag-row input:not([type]) {
  border: 1px solid var(--border);
  background: var(--bg-elev);
  color: var(--text);
  font: inherit;
  border-radius: 8px;
  flex: 1;
  padding: .45rem .7rem;
  font-size: .88rem;
}

.new-tag-row input:focus {
  border-color: var(--accent);
  outline: none;
}

.usage-view {
  flex-direction: column;
  gap: 1.25rem;
  display: flex;
}

.usage-card-grid {
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: .7rem;
  display: grid;
}

.usage-card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 12px;
  flex-direction: column;
  gap: .15rem;
  padding: .85rem 1rem;
  display: flex;
}

.usage-card-label {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  font-size: .78rem;
}

.usage-card-value {
  font-size: 1.4rem;
  font-weight: 700;
}

.usage-card-sub {
  color: var(--muted);
  font-size: .74rem;
}

.usage-card.tone-accent {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, var(--bg-elev));
}

.usage-card.tone-accent .usage-card-value {
  color: var(--accent);
}

.usage-card.tone-danger {
  border-color: var(--danger);
}

.usage-card.tone-danger .usage-card-value {
  color: var(--danger);
}

.usage-card.tone-warn {
  border-color: #d97706;
}

.usage-card.tone-warn .usage-card-value {
  color: #d97706;
}

.usage-table-wrap {
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow-x: auto;
}

.usage-table {
  border-collapse: collapse;
  width: 100%;
  font-size: .88rem;
}

.usage-table th, .usage-table td {
  text-align: right;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  padding: .55rem .8rem;
}

.usage-table th:first-child, .usage-table td:first-child {
  text-align: left;
}

.usage-table thead th {
  background: var(--bg-elev-2);
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
  font-size: .74rem;
}

.usage-table tbody tr:last-child td {
  border-bottom: none;
}

.usage-controls {
  flex-direction: column;
  gap: .4rem;
  margin-bottom: 1rem;
  display: flex;
}

.usage-filter {
  flex-wrap: wrap;
  align-items: center;
  gap: .4rem;
  display: flex;
}

.msg-edit-btn {
  color: #fff;
  cursor: pointer;
  opacity: 0;
  background: #0003;
  border: none;
  border-radius: 50%;
  justify-content: center;
  align-items: center;
  width: 22px;
  height: 22px;
  font-size: .72rem;
  transition: opacity .15s;
  display: inline-flex;
  position: absolute;
  top: 4px;
  right: 6px;
}

.message-bubble:hover .msg-edit-btn, .message-bubble:focus-within .msg-edit-btn {
  opacity: .9;
}

.msg-edit {
  flex-direction: column;
  gap: .5rem;
  width: 100%;
  display: flex;
}

.msg-edit textarea {
  resize: none;
  width: 100%;
  color: inherit;
  font: inherit;
  background: none;
  border: none;
  outline: none;
  padding: 0;
}

.message.user .msg-edit textarea::selection {
  background: color-mix(in srgb, var(--accent) 35%, transparent);
}

.msg-edit-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: .4rem;
  display: flex;
}

.msg-edit-actions .btn {
  white-space: nowrap;
}

.msg-edit-actions .btn.ghost {
  color: var(--text);
  background: #ffffff1a;
  border-color: #fff3;
}

.msg-edit-actions .btn.ghost:hover {
  background: #ffffff2e;
  border-color: #ffffff52;
}

.typing-dot {
  opacity: .6;
  background: currentColor;
  border-radius: 50%;
  width: 6px;
  height: 6px;
  margin-left: 4px;
  animation: 1s ease-in-out infinite typing-pulse;
  display: inline-block;
}

@keyframes typing-pulse {
  0%, 100% {
    opacity: .3;
    transform: translateY(0);
  }

  50% {
    opacity: 1;
    transform: translateY(-2px);
  }
}

.composer {
  border-top: 1px solid var(--border);
  background: var(--bg);
  padding: .6rem .75rem .75rem;
}

.composer-row {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 999px;
  align-items: center;
  gap: .3rem;
  padding: .2rem .3rem;
  transition: border-color .15s;
  display: flex;
}

.composer-row:focus-within {
  border-color: var(--accent);
}

.composer.ooc .composer-row {
  border-color: var(--accent);
  border-style: dashed;
}

.composer-actions-wrap {
  flex-shrink: 0;
  position: relative;
}

.composer-action-btn, .composer-send-btn {
  cursor: pointer;
  border: none;
  border-radius: 50%;
  flex-shrink: 0;
  justify-content: center;
  align-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  transition: background .15s, color .15s;
  display: inline-flex;
}

.composer-action-btn {
  color: var(--muted);
  background: none;
}

.composer-action-btn:hover:not(:disabled), .composer-action-btn[aria-expanded="true"] {
  background: var(--bg-elev-2);
  color: var(--text);
}

.composer-action-btn:disabled, .composer-send-btn:disabled {
  opacity: .45;
  cursor: not-allowed;
}

.composer-send-btn {
  background: var(--accent);
  color: var(--on-accent);
}

.composer-send-btn:hover:not(:disabled) {
  background: var(--accent-hover);
}

.composer-send-btn svg {
  transform: translate(-1px, 1px);
}

.composer-textarea {
  resize: none;
  min-width: 0;
  min-height: 24px;
  max-height: 200px;
  color: var(--text);
  font: inherit;
  background: none;
  border: none;
  outline: none;
  flex: 1;
  padding: .15rem .35rem;
  font-size: 16px;
  line-height: 1.35;
}

.composer-textarea::placeholder {
  color: var(--muted);
}

.composer-menu {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  z-index: 50;
  border-radius: 10px;
  min-width: 240px;
  padding: .3rem;
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  box-shadow: 0 12px 32px #00000059;
}

.composer-menu-item {
  width: 100%;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  background: none;
  border: none;
  border-radius: 6px;
  align-items: flex-start;
  gap: .5rem;
  padding: .55rem .6rem;
  display: flex;
}

.composer-menu-item:hover {
  background: var(--bg-elev-2);
}

.composer-menu-item.active {
  background: color-mix(in srgb, var(--accent) 14%, transparent);
}

.composer-menu-check {
  width: 18px;
  color: var(--accent);
  justify-content: center;
  align-items: center;
  margin-top: .05rem;
  font-size: .95rem;
  font-weight: 800;
  display: inline-flex;
}

.composer-menu-meta {
  flex-direction: column;
  min-width: 0;
  display: flex;
}

.composer-suggest {
  border: 1px solid var(--border);
  background: var(--bg-elev);
  border-radius: 12px;
  flex-direction: column;
  gap: .4rem;
  margin-top: .5rem;
  padding: .6rem .75rem;
  display: flex;
}

.composer-suggest-input {
  border: 1px solid var(--border);
  background: var(--bg);
  width: 100%;
  color: var(--text);
  font: inherit;
  resize: none;
  border-radius: 8px;
  outline: none;
  padding: .5rem .7rem;
  font-size: 15px;
}

.composer-suggest-input:focus {
  border-color: var(--accent);
}

.composer-suggest-actions {
  justify-content: flex-end;
  gap: .4rem;
  display: flex;
}

.share-link-block {
  margin-top: .75rem;
}

.share-link-row {
  align-items: stretch;
  gap: .4rem;
  margin-top: .3rem;
  display: flex;
}

.share-link-row input {
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  border-radius: 8px;
  flex: 1;
  padding: .5rem .7rem;
  font-family: ui-monospace, SF Mono, Menlo, monospace;
  font-size: .88rem;
}

.danger-text {
  color: var(--danger);
}

.shared-chat {
  padding: 2rem 0;
}

.shared-chat-head {
  margin-bottom: 1rem;
}

.shared-chat-char {
  color: inherit;
  align-items: center;
  gap: .8rem;
  text-decoration: none;
  display: inline-flex;
}

.shared-chat-meta {
  flex-direction: column;
  gap: .15rem;
  display: flex;
}

.shared-banner {
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 40%, var(--border));
  border-radius: 10px;
  margin-bottom: 1.5rem;
  padding: .65rem .9rem;
  font-size: .92rem;
}

.shared-chat-messages {
  flex-direction: column;
  gap: .9rem;
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
}

.shared-msg {
  flex-direction: column;
  gap: .25rem;
  display: flex;
}

.shared-msg.user {
  align-items: flex-end;
}

.shared-msg-author {
  padding: 0 .2rem;
}

.shared-msg-bubble {
  border: 1px solid var(--border);
  background: var(--bg-elev);
  white-space: pre-wrap;
  border-radius: 14px;
  max-width: 85%;
  padding: .65rem .85rem;
}

.shared-msg.user .shared-msg-bubble {
  background: color-mix(in srgb, var(--accent) 18%, var(--bg-elev));
  border-color: color-mix(in srgb, var(--accent) 40%, var(--border));
}

.shared-chat-foot {
  text-align: center;
  margin-top: 2rem;
}

.composer-ooc-banner {
  color: var(--accent);
  text-align: center;
  letter-spacing: .05em;
  text-transform: uppercase;
  margin-top: .4rem;
  font-size: .75rem;
  font-weight: 700;
}

.info-panel {
  background: var(--bg-elev);
  border-left: 1px solid var(--border);
  z-index: 40;
  width: 320px;
  box-shadow: var(--shadow);
  flex-direction: column;
  padding: 1rem;
  display: flex;
  position: absolute;
  top: 0;
  bottom: 0;
  right: 0;
  overflow-y: auto;
}

.info-panel-head {
  justify-content: space-between;
  align-items: center;
  margin-bottom: .75rem;
  display: flex;
}

.info-panel-head h3 {
  margin: 0;
}

.info-panel-body {
  flex-direction: column;
  align-items: flex-start;
  gap: .4rem;
  display: flex;
}

.nsfw-overlay {
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

@media (max-width: 720px) {
  .chat-sidebar {
    z-index: 40;
    transition: transform .2s ease-out;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    transform: translateX(-100%);
  }

  .chat-sidebar.open {
    transform: translateX(0);
  }

  .chat-sidebar-backdrop {
    display: block;
  }

  .chat-sidebar-toggle {
    display: inline-flex;
  }

  .info-panel {
    width: min(320px, 90vw);
  }

  .settings-shell {
    grid-template-columns: 1fr;
  }

  .settings-nav {
    flex-direction: row;
    padding-bottom: .25rem;
    position: static;
    overflow-x: auto;
  }

  .settings-tab {
    white-space: nowrap;
  }
}

.rt-wrap {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 8px;
  flex-direction: column;
  display: flex;
}

.rt-toolbar {
  border-bottom: 1px solid var(--border);
  background: var(--surface-2, #ffffff08);
  flex-wrap: wrap;
  gap: .15rem;
  padding: .3rem;
  display: flex;
}

.rt-btn {
  color: var(--text);
  cursor: pointer;
  background: none;
  border: 1px solid #0000;
  border-radius: 5px;
  justify-content: center;
  align-items: center;
  min-width: 30px;
  height: 30px;
  padding: .3rem .4rem;
  font-size: .82rem;
  display: inline-flex;
}

.rt-btn svg {
  display: block;
}

.rt-btn:hover:not(:disabled) {
  background: #ffffff0d;
}

.rt-btn.is-active {
  color: var(--accent, #7aa8ff);
  background: #78a0ff2e;
  border-color: #78a0ff66;
}

.rt-btn:disabled {
  opacity: .4;
  cursor: not-allowed;
}

.rt-dd {
  display: inline-flex;
  position: relative;
}

.rt-dd-menu {
  z-index: 20;
  background: var(--bg-elev, var(--surface));
  border: 1px solid var(--border);
  border-radius: 8px;
  flex-direction: column;
  min-width: 110px;
  padding: .25rem;
  display: flex;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  box-shadow: 0 8px 24px #00000059;
}

.rt-dd-item {
  color: var(--text);
  text-align: left;
  cursor: pointer;
  background: none;
  border: 0;
  border-radius: 5px;
  align-items: center;
  padding: .35rem .55rem;
  line-height: 1.1;
  display: flex;
}

.rt-dd-item:hover {
  background: #ffffff0f;
}

.rt-btn-sep {
  background: var(--border);
  width: 1px;
  margin: 4px;
}

.rt-editor {
  min-height: 120px;
  padding: .6rem .75rem;
  font-size: .95rem;
  line-height: 1.5;
}

.rt-editor:focus, .rt-editor:focus-visible, .rt-editor .ProseMirror:focus, .rt-editor .ProseMirror:focus-visible {
  outline: none;
}

.rt-editor .ProseMirror p.is-editor-empty:first-child:before {
  content: attr(data-placeholder);
  float: left;
  color: var(--muted);
  pointer-events: none;
  height: 0;
}

.rt-editor p {
  margin: 0 0 .6rem;
}

.rt-editor p:last-child {
  margin-bottom: 0;
}

.rt-editor h1, .rt-editor h2, .rt-editor h3, .rt-editor h4 {
  margin: .8rem 0 .4rem;
}

.rt-editor ul, .rt-editor ol {
  margin: 0 0 .6rem;
  padding-left: 1.4rem;
}

.rt-editor blockquote {
  border-left: 3px solid var(--border);
  color: var(--muted);
  margin: 0 0 .6rem;
  padding-left: .75rem;
}

.rt-editor code {
  background: #ffffff0f;
  border-radius: 4px;
  padding: .05rem .3rem;
  font-size: .88em;
}

.rt-editor a {
  color: var(--accent, #7aa8ff);
  text-decoration: underline;
}

.rt-token-count {
  border-top: 1px solid var(--border);
  color: var(--muted);
  text-align: right;
  padding: .25rem .6rem;
  font-size: .78rem;
}

.rich-text p {
  margin: 0 0 .6rem;
}

.rich-text p:last-child {
  margin-bottom: 0;
}

.rich-text ul, .rich-text ol {
  margin: 0 0 .6rem;
  padding-left: 1.4rem;
}

.rich-text blockquote {
  border-left: 3px solid var(--border);
  color: var(--muted);
  margin: 0 0 .6rem;
  padding-left: .75rem;
}

.rich-text code {
  background: #ffffff0f;
  border-radius: 4px;
  padding: .05rem .3rem;
  font-size: .88em;
}

.rich-text a {
  color: var(--accent, #7aa8ff);
  text-decoration: underline;
}

.rich-text h1, .rich-text h2, .rich-text h3, .rich-text h4 {
  margin: .8rem 0 .4rem;
}

.rt-toolbar-sep {
  background: var(--border);
  align-self: stretch;
  width: 1px;
  margin: 2px 3px;
}

.rt-toolbar-spacer {
  flex: auto;
}

.rt-color {
  position: relative;
}

.rt-color input {
  opacity: 0;
  cursor: pointer;
  position: absolute;
  inset: 0;
}

.rt-select {
  color: var(--text);
  border: 1px solid var(--border);
  cursor: pointer;
  background: none;
  border-radius: 4px;
  padding: .2rem .3rem;
  font-size: .8rem;
}

.rt-source {
  box-sizing: border-box;
  resize: vertical;
  background: var(--surface);
  width: 100%;
  color: var(--text);
  border: 0;
  padding: .6rem .75rem;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: .82rem;
  line-height: 1.5;
}

.rt-source:focus {
  outline: none;
}

.rt-source-btn {
  padding: 0 .6rem;
  font-size: .78rem;
  font-weight: 600;
}

.rich-text img, .rt-editor img {
  border-radius: 8px;
  max-width: 100%;
  height: auto;
  margin: .4rem 0;
}

.rt-editor img.ProseMirror-selectednode {
  outline: 2px solid var(--accent, #7aa8ff);
}

.rich-text figure, .rt-editor figure {
  margin: .6rem 0;
}

.rich-text figcaption, .rt-editor figcaption {
  color: var(--muted);
  text-align: center;
  margin-top: .25rem;
  font-size: .82rem;
}

.rich-text mark, .rt-editor mark {
  color: #1a1a1a;
  background: #ffe066;
  border-radius: 3px;
  padding: 0 .15em;
}

.rich-text hr, .rt-editor hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 1rem 0;
}

.rich-text .rt-callout, .rt-editor .rt-callout {
  border-left: 4px solid var(--accent, #7aa8ff);
  background: #78a0ff1a;
  border-radius: 6px;
  margin: .6rem 0;
  padding: .6rem .9rem;
}

.rich-text .rt-callout > :last-child, .rt-editor .rt-callout > :last-child {
  margin-bottom: 0;
}

.rich-text .rt-spoiler, .rt-editor .rt-spoiler {
  border: 1px solid var(--border);
  background: #ffffff05;
  border-radius: 6px;
  margin: .6rem 0;
  padding: .4rem .7rem;
}

.rich-text .rt-spoiler > summary, .rt-editor .rt-spoiler > summary {
  cursor: pointer;
  font-weight: 600;
}

.rich-text table, .rt-editor table {
  border-collapse: collapse;
  max-width: 100%;
  margin: .6rem 0;
}

.rich-text th, .rich-text td, .rt-editor th, .rt-editor td {
  border: 1px solid var(--border);
  text-align: left;
  padding: .3rem .55rem;
}

.rich-text th, .rt-editor th {
  background: #ffffff0a;
  font-weight: 600;
}

.rt-removable {
  position: relative;
}

.rt-editor .rt-callout.rt-removable, .rt-editor .rt-spoiler.rt-removable {
  padding-right: 1.8rem;
}

.rt-node-remove {
  width: 19px;
  height: 19px;
  color: var(--muted);
  cursor: pointer;
  opacity: .65;
  z-index: 2;
  background: #00000047;
  border: none;
  border-radius: 50%;
  justify-content: center;
  align-items: center;
  font-size: 11px;
  line-height: 1;
  transition: opacity .12s, background .12s, color .12s;
  display: inline-flex;
  position: absolute;
  top: 5px;
  right: 5px;
}

.rt-node-remove:hover {
  background: var(--accent, #e0457b);
  color: #fff;
  opacity: 1;
}

.ai-assist {
  border: 1px solid var(--border);
  background: linear-gradient(135deg, #e0457b0f, #7aa8ff0f);
  border-radius: 10px;
  flex-direction: column;
  gap: .5rem;
  margin-bottom: .6rem;
  padding: .7rem;
  display: flex;
}

.ai-assist-input {
  box-sizing: border-box;
  resize: vertical;
  border: 1px solid var(--border);
  background: var(--bg, var(--surface));
  width: 100%;
  color: var(--text);
  border-radius: 8px;
  padding: .5rem .6rem;
  font-size: .9rem;
  line-height: 1.4;
}

.ai-assist-input:focus {
  border-color: var(--accent, #e0457b);
  outline: none;
}

.ai-assist-row {
  flex-wrap: wrap;
  align-items: center;
  gap: .6rem;
  display: flex;
}

.ai-assist-pending {
  border-top: 1px solid var(--border);
  flex-direction: column;
  gap: .35rem;
  padding-top: .5rem;
  display: flex;
}

.ai-assist-actions {
  flex-wrap: wrap;
  gap: .4rem;
  display: flex;
}

.detail-profile {
  flex-direction: column;
  gap: .85rem;
  max-width: 600px;
  margin: 0 auto;
  display: flex;
}

.gallery-hero {
  aspect-ratio: 1;
  width: 100%;
  height: auto;
}

.gallery-hero-img {
  object-fit: cover;
  width: 100%;
  height: 100%;
}

.detail-profile .detail-title {
  text-align: center;
  margin: .2rem 0 0;
  font-size: 2rem;
}

.detail-stat-line {
  color: var(--muted);
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: .5rem;
  font-size: .9rem;
  display: flex;
}

.detail-tags {
  justify-content: center;
}

.creator-card {
  border: 1px solid var(--border);
  background: var(--bg-elev, var(--surface));
  border-radius: 12px;
  overflow: hidden;
}

.creator-card-head {
  width: 100%;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  background: none;
  border: 0;
  align-items: center;
  gap: .6rem;
  padding: .6rem .8rem;
  display: flex;
}

.creator-card-head:hover {
  background: #ffffff08;
}

.creator-card-avatar {
  object-fit: cover;
  text-transform: uppercase;
  border-radius: 50%;
  flex-shrink: 0;
  justify-content: center;
  align-items: center;
  width: 38px;
  height: 38px;
  font-size: .95rem;
  font-weight: 700;
  line-height: 1;
  display: inline-flex;
}

.creator-card-meta {
  flex-direction: column;
  flex: 1;
  min-width: 0;
  line-height: 1.25;
  display: flex;
}

.creator-card-name {
  font-size: .95rem;
  font-weight: 700;
}

.creator-card-sub {
  font-size: .78rem;
}

.creator-card-chevron {
  color: var(--muted);
  flex-shrink: 0;
  transition: transform .18s;
}

.creator-card.open .creator-card-chevron {
  transform: rotate(180deg);
}

.creator-card-body {
  border-top: 1px solid var(--border);
  flex-direction: column;
  gap: .55rem;
  padding: .7rem .8rem .75rem;
  display: flex;
}

.creator-card-bio {
  color: var(--text);
  margin: 0;
  font-size: .9rem;
}

.creator-card-stats {
  color: var(--muted);
  flex-wrap: wrap;
  gap: 1rem;
  font-size: .85rem;
  display: flex;
}

.creator-card-stat {
  align-items: center;
  gap: .35rem;
  display: inline-flex;
}

.creator-card-stat-icon {
  width: 16px;
  height: 16px;
  color: var(--muted);
}

.creator-card-link {
  color: var(--accent, #e0457b);
  font-size: .85rem;
  font-weight: 600;
  text-decoration: none;
}

.creator-card-link:hover {
  text-decoration: underline;
}

.detail-profile .detail-cta {
  align-items: stretch;
  gap: .5rem;
  max-width: none;
  margin-top: .1rem;
  display: flex;
}

.detail-cta .start-chat-wrap {
  flex: 1;
}

.save-icon-btn {
  border: 1px solid var(--border);
  background: var(--bg-elev-2, #ffffff0a);
  width: 52px;
  color: var(--text);
  cursor: pointer;
  border-radius: 10px;
  flex-shrink: 0;
  justify-content: center;
  align-items: center;
  transition: background .15s, border-color .15s, color .15s;
  display: inline-flex;
}

.save-icon-btn:hover:not(:disabled) {
  border-color: var(--accent, #e0457b);
  color: var(--accent, #e0457b);
}

.save-icon-btn:disabled {
  opacity: .5;
  cursor: not-allowed;
}

.toggle-row {
  flex-direction: column;
  gap: .65rem;
  margin: .4rem 0 .2rem;
  display: flex;
}

.toggle {
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
  align-items: center;
  gap: .7rem;
  display: flex;
}

.toggle > input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.toggle-switch {
  background: var(--bg-elev-2, #2a2a38);
  border: 1px solid var(--border);
  border-radius: 999px;
  flex-shrink: 0;
  width: 44px;
  height: 26px;
  transition: background .18s, border-color .18s;
  position: relative;
}

.toggle-switch:after {
  content: "";
  background: #fff;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  transition: transform .18s;
  position: absolute;
  top: 2px;
  left: 2px;
  box-shadow: 0 1px 3px #0006;
}

.toggle > input:checked + .toggle-switch {
  background: var(--accent, #e0457b);
  border-color: var(--accent, #e0457b);
}

.toggle > input:checked + .toggle-switch:after {
  transform: translateX(18px);
}

.toggle > input:checked + .toggle-switch-nsfw {
  background: #d9434e;
  border-color: #d9434e;
}

.toggle > input:focus-visible + .toggle-switch {
  outline: 2px solid var(--accent, #e0457b);
  outline-offset: 2px;
}

.toggle-label {
  flex-direction: column;
  line-height: 1.25;
  display: flex;
}

.toggle-title {
  align-items: center;
  gap: .4rem;
  font-size: .92rem;
  font-weight: 600;
  display: flex;
}

.toggle-sub {
  color: var(--muted);
  font-size: .78rem;
}

.toggle-sub.warn {
  color: #e0a040;
}

.badge-18 {
  color: #fff;
  letter-spacing: .5px;
  background: #d9434e;
  border-radius: 4px;
  padding: 1px 5px;
  font-size: .62rem;
  font-weight: 700;
}

.create-layout {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: start;
  gap: 1.5rem;
  display: grid;
}

.create-preview {
  border: 1px solid var(--border);
  background: var(--bg-elev, var(--surface));
  border-radius: 12px;
  align-self: start;
  max-height: calc(100vh - 2rem);
  padding: 1rem;
  position: sticky;
  top: 1rem;
  overflow-y: auto;
}

@media (max-width: 900px) {
  .create-layout {
    grid-template-columns: 1fr;
  }

  .create-preview {
    max-height: none;
    position: static;
    overflow: visible;
  }
}

.char-preview {
  flex-direction: column;
  gap: 1.5rem;
  display: flex;
}

.preview-section {
  flex-direction: column;
  gap: .6rem;
  display: flex;
}

.preview-section-label {
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  padding-bottom: .35rem;
  font-size: .72rem;
  font-weight: 700;
}

.preview-card-frame {
  pointer-events: none;
  max-width: 240px;
  margin: 0 auto;
}

.create-preview .detail-grid {
  flex-direction: column;
  gap: 1rem;
}

.create-preview .detail-cta {
  max-width: none;
}

.star-rating {
  flex-direction: column;
  gap: .25rem;
  margin: .75rem 0;
  display: flex;
}

.star-row {
  gap: .1rem;
  display: inline-flex;
}

.star {
  cursor: pointer;
  color: var(--border);
  background: none;
  border: none;
  padding: .1rem .15rem;
  font-size: 1.4rem;
  line-height: 1;
  transition: color .1s;
}

.star.filled {
  color: #f5b400;
}

.star:disabled {
  cursor: wait;
  opacity: .6;
}

.star-meta {
  color: var(--text);
  align-items: center;
  gap: .5rem;
  font-size: .9rem;
  display: flex;
}

.stat-grid {
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: .75rem;
  margin: 1rem 0 1.5rem;
  display: grid;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: .75rem 1rem;
}

.stat-label {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  font-size: .78rem;
}

.stat-value {
  margin-top: .2rem;
  font-size: 1.5rem;
  font-weight: 600;
}

.table-wrap {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 8px;
  overflow-x: auto;
}

.creator-analytics-table {
  border-collapse: collapse;
  width: 100%;
  font-size: .92rem;
}

.creator-analytics-table th, .creator-analytics-table td {
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  padding: .6rem .75rem;
}

.creator-analytics-table thead th {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  background: var(--surface-2, #ffffff05);
  font-size: .78rem;
  font-weight: 600;
}

.creator-analytics-table tbody tr:last-child td {
  border-bottom: none;
}

.ca-name {
  color: inherit;
  align-items: center;
  gap: .5rem;
  text-decoration: none;
  display: inline-flex;
}

.ca-name:hover {
  text-decoration: underline;
}

.ca-thumb {
  object-fit: cover;
  border-radius: 6px;
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  display: inline-block;
}

.ca-thumb-fallback {
  background: var(--surface-2, #ffffff0d);
  color: var(--muted);
  justify-content: center;
  align-items: center;
  font-size: .9rem;
  font-weight: 600;
  display: inline-flex;
}

.detail-meta-row {
  flex-wrap: wrap;
  gap: .5rem;
  margin-top: .75rem;
  display: flex;
}

.report-reason-list {
  flex-direction: column;
  gap: .4rem;
  display: flex;
}

.report-reason {
  border: 1px solid var(--border);
  cursor: pointer;
  border-radius: 6px;
  align-items: flex-start;
  gap: .5rem;
  padding: .5rem .75rem;
  display: flex;
}

.report-reason:hover {
  background: #ffffff08;
}

.report-reason input[type="radio"] {
  margin-top: .25rem;
}

.report-status {
  text-transform: capitalize;
  background: var(--surface-2, #ffffff0d);
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: .1rem .5rem;
  font-size: .78rem;
  font-weight: 600;
  display: inline-block;
}

.report-status-pending {
  color: #f5b400;
  background: #f5b40014;
  border-color: #f5b40066;
}

.report-status-resolved_actioned, .report-status-banned, .report-status-suspended {
  color: #ff6e6e;
  background: #ff6e6e14;
  border-color: #ff6e6e66;
}

.report-status-resolved_no_action, .report-status-dismissed, .report-status-active {
  color: #69d985;
  background: #69d98514;
  border-color: #69d98566;
}

.report-details {
  white-space: pre-wrap;
  word-break: break-word;
  background: var(--surface-2, #ffffff08);
  border: 1px solid var(--border);
  font: inherit;
  border-radius: 6px;
  padding: .6rem .75rem;
  font-size: .92rem;
}

.card {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 8px;
  margin: 1rem 0;
  padding: 1rem 1.25rem;
}

.section-subtitle {
  color: var(--muted);
  margin: 1rem 0 .4rem;
  font-size: 1rem;
}

.kv {
  grid-template-columns: max-content 1fr;
  gap: .35rem .9rem;
  margin: 0;
  display: grid;
}

.kv dt {
  color: var(--muted);
  font-size: .88rem;
}

.kv dd {
  margin: 0;
  font-size: .95rem;
}

.action-log {
  flex-direction: column;
  gap: .6rem;
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
}

.action-log li {
  border: 1px solid var(--border);
  background: var(--surface-2, #ffffff05);
  border-radius: 6px;
  padding: .5rem .75rem;
}

.participants-bar {
  border-bottom: 1px solid var(--border);
  background: var(--surface-2, #ffffff05);
  flex-wrap: wrap;
  align-items: center;
  gap: .4rem;
  padding: .4rem .75rem;
  display: flex;
}

.participant-chip {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  align-items: center;
  gap: .35rem;
  padding: .2rem .4rem .2rem .2rem;
  display: inline-flex;
}

.participant-name {
  font-size: .85rem;
}

.participant-remove {
  width: 18px;
  height: 18px;
  color: var(--muted);
  cursor: pointer;
  background: none;
  border: none;
  border-radius: 50%;
  padding: 0;
  font-size: 1rem;
  line-height: 1;
}

.participant-remove:hover:not(:disabled) {
  color: #ff6e6e;
  background: #ff6e6e33;
}

.participant-invite {
  border: 1px dashed var(--border);
  color: var(--muted);
  cursor: pointer;
  background: none;
  border-radius: 999px;
  padding: .25rem .7rem;
  font-size: .85rem;
}

.participant-invite:hover:not(:disabled) {
  color: var(--text);
  border-color: var(--accent, #7aa8ff);
}

.speaker-selector {
  flex-wrap: wrap;
  align-items: center;
  gap: .4rem;
  padding: .4rem .75rem 0;
  display: flex;
}

.speaker-pick {
  background: var(--surface);
  border: 1px solid var(--border);
  cursor: pointer;
  color: var(--text);
  border-radius: 999px;
  align-items: center;
  gap: .3rem;
  padding: .2rem .45rem;
  font-size: .82rem;
  display: inline-flex;
}

.speaker-pick.active {
  border-color: var(--accent, #7aa8ff);
  background: #78a0ff1f;
}

.speaker-pick:hover:not(:disabled):not(.active) {
  background: #ffffff0a;
}

.avatar-xs {
  object-fit: cover;
  border-radius: 50%;
  width: 18px;
  height: 18px;
  display: inline-block;
}

.avatar-xs.avatar-fallback {
  background: var(--surface-2, #ffffff0d);
  color: var(--muted);
  justify-content: center;
  align-items: center;
  font-size: .65rem;
  font-weight: 600;
  display: inline-flex;
}

.message-system {
  justify-content: center;
  margin: .5rem 0;
  display: flex;
}

.message-system span {
  background: var(--surface-2, #ffffff0a);
  color: var(--muted);
  border-radius: 999px;
  padding: .25rem .7rem;
  font-size: .78rem;
  display: inline-block;
}

.message-speaker {
  margin-bottom: .2rem;
  font-weight: 600;
}

.message-bubble.absent {
  opacity: .65;
}

.message-bubble.user-as-character {
  border-left: 2px solid var(--accent, #7aa8ff);
}

.user-as-tag {
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--accent, #7aa8ff);
  margin-left: .4rem;
  font-size: .68rem;
}

.speakas-selector {
  flex-wrap: wrap;
  align-items: center;
  gap: .4rem;
  padding: .4rem .75rem 0;
  display: flex;
}

.memory-notes, .memory-summary {
  border: 1px solid var(--border);
  background: var(--surface);
  width: 100%;
  color: var(--text);
  resize: vertical;
  border-radius: 6px;
  padding: .5rem .6rem;
  font-family: inherit;
  font-size: .85rem;
}

.memory-summary-readonly pre {
  white-space: pre-wrap;
  word-break: break-word;
  background: var(--surface-2, #ffffff08);
  border: 1px solid var(--border);
  font: inherit;
  border-radius: 6px;
  max-height: 240px;
  margin: 0;
  padding: .5rem .6rem;
  font-size: .85rem;
  overflow-y: auto;
}

.chats-groups {
  flex-direction: column;
  gap: .4rem;
  margin: 1rem 0 0;
  padding: 0;
  list-style: none;
  display: flex;
}

.chats-group {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 8px;
  overflow: hidden;
}

.chats-group[open] {
  background: var(--bg-elev);
}

.chats-group-head {
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
  align-items: center;
  gap: .7rem;
  padding: .6rem .75rem;
  list-style: none;
  display: flex;
}

.chats-group-head::-webkit-details-marker {
  display: none;
}

.chats-group-head::marker {
  content: "";
  display: none;
}

.chats-group-head:hover {
  background: var(--bg-elev-2);
}

.chats-group-meta {
  flex-direction: column;
  flex: 1;
  gap: .1rem;
  min-width: 0;
  display: flex;
}

.chats-group-title-row {
  align-items: baseline;
  gap: .5rem;
  min-width: 0;
  display: flex;
}

.chats-group-title {
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  font-weight: 600;
  overflow: hidden;
}

.chats-group-count {
  flex-shrink: 0;
}

.chats-group-recent {
  white-space: nowrap;
}

.chats-group-chev {
  flex-shrink: 0;
  font-size: 1rem;
  transition: transform .18s;
}

.chats-group[open] .chats-group-chev {
  transform: rotate(180deg);
}

.chats-group-list {
  border-top: 1px solid var(--border);
  flex-direction: column;
  gap: .25rem;
  margin: 0;
  padding: .15rem .5rem .5rem;
  list-style: none;
  display: flex;
}

.chats-index-item.compact {
  gap: 0;
  padding: .5rem .6rem;
}

.chats-index-row {
  align-items: stretch;
  gap: .25rem;
  display: flex;
}

.chats-index-row .chats-index-item {
  flex: 1;
  min-width: 0;
}

.chat-row-delete {
  color: var(--muted);
  cursor: pointer;
  background: none;
  border: 1px solid #0000;
  border-radius: 8px;
  align-items: center;
  gap: .35rem;
  padding: .35rem .55rem;
  font-size: .78rem;
  transition: color .15s, background .15s, border-color .15s;
  display: inline-flex;
}

.chat-row-delete:hover:not(:disabled) {
  color: var(--danger, #ef4444);
  background: color-mix(in srgb, var(--danger, #ef4444) 10%, transparent);
  border-color: color-mix(in srgb, var(--danger, #ef4444) 28%, transparent);
}

.chat-row-delete:disabled {
  opacity: .5;
  cursor: progress;
}

.chat-row-delete.icon-only {
  padding: .35rem;
}

.chats-group-recent-row {
  justify-content: space-between;
  align-items: center;
  gap: .5rem;
  display: flex;
}

.chats-group-delete-all {
  color: var(--muted);
  cursor: pointer;
  background: none;
  border: 1px solid #0000;
  border-radius: 6px;
  align-items: center;
  gap: .3rem;
  padding: .2rem .45rem;
  font-size: .72rem;
  transition: color .15s, background .15s, border-color .15s;
  display: inline-flex;
}

.chats-group-delete-all:hover:not(:disabled) {
  color: var(--danger, #ef4444);
  background: color-mix(in srgb, var(--danger, #ef4444) 10%, transparent);
  border-color: color-mix(in srgb, var(--danger, #ef4444) 28%, transparent);
}

.chats-group-delete-all:disabled {
  opacity: .5;
  cursor: progress;
}

.chats-index, .notifs-index {
  flex-direction: column;
  gap: .4rem;
  margin: 1rem 0 0;
  padding: 0;
  list-style: none;
  display: flex;
}

.chats-index-item {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 8px;
  align-items: center;
  gap: .7rem;
  padding: .6rem .75rem;
  text-decoration: none;
  display: flex;
}

.chats-index-item:hover {
  background: var(--bg-elev-2);
  text-decoration: none;
}

.chats-index-meta {
  flex: 1;
  min-width: 0;
}

.chats-index-title-row {
  align-items: baseline;
  gap: .5rem;
  min-width: 0;
  display: flex;
}

.chats-index-title {
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  font-weight: 600;
  overflow: hidden;
}

.chats-index-time {
  flex-shrink: 0;
}

.chats-index-preview {
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: .85rem;
  overflow: hidden;
}

.notifs-index-item {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 8px;
}

.notifs-index-item.unread {
  border-left: 3px solid var(--accent, #7aa8ff);
}

.notifs-index-link {
  color: var(--text);
  padding: .7rem .85rem;
  text-decoration: none;
  display: block;
}

.notifs-index-link:hover {
  background: var(--bg-elev-2);
  text-decoration: none;
}

.notif-text {
  margin-bottom: .2rem;
}

.invite-results {
  flex-direction: column;
  gap: .4rem;
  max-height: 50vh;
  margin: .6rem 0 0;
  padding: 0;
  list-style: none;
  display: flex;
  overflow-y: auto;
}

.invite-result {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 6px;
  align-items: center;
  gap: .6rem;
  padding: .4rem .5rem;
  display: flex;
}

.invite-result-meta {
  flex-direction: column;
  flex: 1;
  display: flex;
}

.search-input {
  border: 1px solid var(--border);
  background: var(--surface);
  width: 100%;
  color: var(--text);
  border-radius: 6px;
  padding: .5rem .75rem;
}

/*# sourceMappingURL=next-app_app_globals_0l071fc.css.map*/