*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html,
button,
a,
[role="button"],
.bot-card,
.recent-chat-card,
.recent-item,
.your-character-card,
.detail-full-image-link {
  -webkit-tap-highlight-color: transparent;
}

:root {
  --bg:       #0d0d10;
  --surface:  #14141a;
  --card:     #1a1a22;
  --card-h:   #202029;
  --border:   #26262f;
  --border2:  #32323e;
  --text:     #e2e2ee;
  --muted:    #7070888;
  --sub:      #70708a;
  --accent:   #8b7cf6;
  --accent-d: #6b5cd6;
  --danger:   #e05555;
  --bot-bubble-bg: #28272f;
  --bot-bubble-text: #ffffff;
  --bot-bubble-border: rgba(255,255,255,0.12);
  --chat-bubble-bg: #28272f;
  --chat-bubble-text: #ffffff;
  --chat-bubble-border: rgba(255,255,255,0.12);
  --rp-action-color: #b9b8c2;
  --rp-action-alpha: 1;
  --rp-speech-color: #ffffff;
  --rp-speech-alpha: 1;
  --rp-whisper-color: #c0bec8;
  --rp-whisper-alpha: 0.92;
  --rp-emphasis-color: #ffffff;
  --rp-emphasis-alpha: 1;
  --rp-loud-color: #ff6b6b;
  --rp-loud-alpha: 1;
  --rp-ooc-color: #9ca3af;
  --rp-ooc-alpha: 0.88;
  --rp-quote-color: #b7c4ff;
  --rp-quote-alpha: 0.92;
  --rp-scene-color: #a78bfa;
  --rp-scene-alpha: 0.9;
  --rp-transition-color: #f5d48f;
  --rp-transition-alpha: 0.92;
  --rp-divider-color: #ffffff;
  --rp-divider-alpha: 0.32;
  --rp-divider-thickness-px: 1px;
  --font-ui: 'Sora', sans-serif;
  --font-chat: 'Sora', sans-serif;
  --font-display: 'Sora', sans-serif;
  --chat-text-size: 14px;
  --app-height: 100vh;
  --keyboard-inset: 0px;
  --r:        12px;
  --r-sm:     8px;
}

.discovery-tag-tutorial {
  position: fixed;
  inset: 0;
  z-index: 6200;
  pointer-events: none;
}

.discovery-tag-tutorial.hidden {
  display: none;
}

.discovery-tag-tutorial-dim {
  position: absolute;
  inset: 0;
  background: rgba(7, 7, 12, 0.38);
  pointer-events: auto;
}

.discovery-tag-tutorial-outline {
  position: fixed;
  z-index: 1;
  border: 3px solid #ffffff;
  border-radius: 8px;
  box-shadow: 0 0 0 9999px rgba(0,0,0,0.08), 0 0 28px rgba(139,124,246,0.72);
  pointer-events: none;
  transition: left .18s ease, top .18s ease, width .18s ease, height .18s ease;
}

.discovery-tag-tutorial-card {
  position: fixed;
  width: min(700px, calc(100vw - 40px));
  min-height: 218px;
  display: grid;
  gap: 0;
  padding: 22px 24px 18px;
  border: 1px solid rgba(255,255,255,0.16);
  border-radius: 14px;
  background: rgba(16, 16, 24, 0.97);
  box-shadow: 0 26px 80px rgba(0,0,0,0.58), inset 0 1px 0 rgba(255,255,255,0.08);
  color: var(--text);
  pointer-events: auto;
  z-index: 3;
  overflow: hidden;
}

.discovery-tag-tutorial-guide {
  position: fixed;
  width: min(430px, 50vw);
  max-height: 430px;
  object-fit: contain;
  object-position: bottom center;
  filter: drop-shadow(0 24px 28px rgba(0,0,0,0.48));
  pointer-events: none;
  z-index: 2;
}

.discovery-tag-tutorial-copy {
  min-width: 0;
  color: #f7f5ff;
}

.discovery-tag-tutorial-kicker {
  color: #c9bfff;
  font-size: 13px;
  font-weight: 800;
  text-transform: none;
  letter-spacing: 0;
}

.discovery-tag-tutorial-title {
  margin-top: 8px;
  font-size: 24px;
  font-weight: 900;
  color: #ffffff;
}

.discovery-tag-tutorial-copy p,
.discovery-tag-tutorial-confirm p {
  margin: 12px 0 0;
  color: #d8d5e8;
  font-size: 17px;
  font-weight: 650;
  line-height: 1.48;
  min-height: 78px;
}

.discovery-tag-tutorial-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 16px;
}

.discovery-tag-tutorial-actions .mini-btn {
  min-height: 42px;
  min-width: 132px;
  border-radius: 8px;
}

.discovery-tag-tutorial-actions .mini-btn.ghost {
  color: #d8d5e8;
  background: rgba(255,255,255,0.055);
  border-color: rgba(255,255,255,0.18);
}

.discovery-tag-tutorial-actions .mini-btn:not(.ghost) {
  color: #ffffff;
  background: linear-gradient(135deg, #7c66ff, #2dd4bf);
  border-color: rgba(255,255,255,0.22);
}

.discovery-tag-tutorial-confirm {
  position: fixed;
  left: 50%;
  top: 50%;
  width: min(360px, calc(100vw - 28px));
  transform: translate(-50%, -50%);
  padding: 18px;
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 14px;
  background: rgba(18, 18, 26, 0.98);
  box-shadow: 0 24px 70px rgba(0,0,0,0.55);
  color: var(--text);
  pointer-events: auto;
  z-index: 4;
}

.discovery-tag-tutorial-confirm.hidden {
  display: none;
}

body.discovery-tag-tutorial-open {
  overflow: hidden;
}

@media (max-width: 720px) {
  .discovery-tag-tutorial-card {
    width: calc(100vw - 22px);
    min-height: 210px;
    padding: 18px 16px 14px;
    border-radius: 12px;
  }

  .discovery-tag-tutorial-guide {
    width: min(300px, 72vw);
    max-height: 300px;
  }

  .discovery-tag-tutorial-title {
    font-size: 20px;
  }

  .discovery-tag-tutorial-copy p {
    font-size: 14px;
    min-height: 76px;
  }

  .discovery-tag-tutorial-actions {
    justify-content: stretch;
    padding-top: 14px;
  }

  .discovery-tag-tutorial-actions > * {
    flex: 1 1 0;
  }
}

@supports (height: 100dvh) {
  :root {
    --app-height: 100dvh;
  }
}

.search-field .search-submit-btn,
.model-picker-topbar .model-picker-search-btn {
  appearance: none;
  -webkit-appearance: none;
  border: 1px solid rgba(255,255,255,0.16);
  border-radius: 14px;
  min-height: 34px;
  padding: 0 16px;
  background:
    linear-gradient(135deg, rgba(255,255,255,0.18), rgba(255,255,255,0.04)),
    linear-gradient(135deg, #1f2937, #060606);
  color: #fff;
  font-family: inherit;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0.02em;
  box-shadow: 0 10px 24px rgba(0,0,0,0.32), inset 0 1px 0 rgba(255,255,255,0.14);
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.search-field .search-submit-btn:hover,
.model-picker-topbar .model-picker-search-btn:hover {
  border-color: rgba(255,255,255,0.28);
  transform: translateY(-1px);
  box-shadow: 0 14px 30px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.18);
}

.bot-appearance-grid {
  display: grid;
  grid-template-columns: minmax(0, 260px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.appearance-panel {
  padding: 16px;
  border-radius: 22px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.03);
}

.appearance-panel-wide {
  grid-column: 1 / -1;
}

.appearance-title {
  margin-bottom: 12px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #fff;
}

.appearance-subtitle {
  margin-bottom: 10px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.78);
}

.bot-media-preview-frame {
  border-radius: 22px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.08);
  background: linear-gradient(180deg, rgba(255,255,255,0.06), rgba(255,255,255,0.02));
}

.bot-media-preview {
  position: relative;
  width: 100%;
  min-height: 180px;
  background: rgba(255,255,255,0.04);
  overflow: hidden;
}

.bot-media-preview::before {
  content: 'No image yet';
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(232,233,241,0.45);
}

.bot-media-preview.has-image::before {
  content: none;
}

.bot-media-preview img,
.bot-card-image-preview img,
.bot-card-media img,
.detail-full-image-preview,
.detail-gallery-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.bot-full-preview {
  aspect-ratio: 4 / 5;
}

.bot-full-preview img {
  object-fit: contain;
  background: rgba(0,0,0,0.18);
}

.bot-card-image-crop-target {
  cursor: grab;
}

.bot-card-image-crop-target:active {
  cursor: grabbing;
}

.appearance-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.settings-guide-card {
  display: grid;
  gap: 6px;
  padding: 14px;
}

.settings-guide-title,
.form-section-heading,
.profile-section-title {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.settings-guide-card p {
  margin: 0;
  color: var(--sub);
  font-size: 12px;
  line-height: 1.55;
}

.media-combined-panel {
  display: grid;
  gap: 16px;
  padding: 16px 0 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.media-workspace {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.media-workspace-split {
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.media-sidebar {
  display: grid;
  gap: 0;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.02);
}

.media-nav-btn {
  min-height: 44px;
  padding: 0 14px;
  text-align: left;
  border: 0;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  background: transparent;
  color: rgba(255,255,255,0.72);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.media-nav-btn:last-child {
  border-bottom: 0;
}

.media-nav-btn.active {
  background: rgba(255,255,255,0.05);
  color: var(--text);
}

.media-content-panel {
  min-width: 0;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.02);
  padding: 16px;
}

.media-pane {
  display: grid;
  gap: 12px;
}

.media-pane-body {
  display: grid;
  gap: 14px;
}

.media-pane-body-avatar {
  justify-items: start;
}

.profile-avatar-row-flat {
  align-items: center;
  gap: 16px;
  padding: 0 0 8px;
}

.profile-avatar-copy {
  display: grid;
  gap: 10px;
  min-width: 0;
  flex: 1 1 0;
  width: 100%;
}

.appearance-slider-grid {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.appearance-slider {
  display: grid;
  gap: 6px;
  font-size: 12px;
  color: var(--sub);
}

.appearance-slider input[type="range"] {
  width: 100%;
}

.bot-card-image-list {
  display: grid;
  gap: 12px;
}

.bot-card-image-item {
  display: grid;
  grid-template-columns: minmax(0, 180px) minmax(0, 1fr);
  gap: 14px;
  padding: 14px;
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(10,12,20,0.48);
}

.bot-card-image-preview {
  position: relative;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.04);
}

.bot-card-image-preview::before {
  content: 'No image';
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(232,233,241,0.4);
}

.bot-card-image-preview.has-image::before {
  content: none;
}

.bot-card-image-body {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.your-characters-page {
  display: grid;
  gap: 18px;
}

.your-characters-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 22px;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 24px;
  background:
    radial-gradient(circle at top left, rgba(255,255,255,0.10), transparent 34%),
    linear-gradient(135deg, rgba(255,255,255,0.05), rgba(255,255,255,0.02));
}

.your-characters-hero h1 {
  margin: 0 0 6px;
  font-size: clamp(1.7rem, 4vw, 2.6rem);
}

.your-characters-hero p {
  margin: 0;
  color: var(--sub);
  max-width: 680px;
}

.your-characters-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.your-characters-toolbar .search-field {
  flex: 1 1 260px;
}

.your-characters-toolbar-actions,
.your-characters-bulk-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.your-characters-tool-btn {
  flex: 0 0 38px;
  width: 38px;
  height: 38px;
  min-width: 38px;
  min-height: 38px;
}

.your-characters-tool-btn svg {
  width: 18px;
  height: 18px;
}

.your-characters-tool-btn.danger {
  color: #ffb5b5;
  border-color: rgba(255,107,107,0.26);
}

.your-characters-tool-btn.danger:hover:not(:disabled) {
  background: rgba(255,107,107,0.12);
  border-color: rgba(255,107,107,0.46);
}

.your-characters-bulk-panel {
  gap: 18px;
  padding: 18px;
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 14px;
  background:
    radial-gradient(circle at 100% 0%, rgba(139,124,246,0.10), transparent 34%),
    linear-gradient(180deg, rgba(255,255,255,0.055), rgba(255,255,255,0.018)),
    rgba(12,13,19,0.94);
  box-shadow: 0 20px 50px rgba(0,0,0,0.28);
  overflow: visible;
}

.your-characters-bulk-panel:not(.hidden) {
  position: fixed;
  left: var(--bulk-panel-left, 24px);
  top: var(--bulk-panel-top, 120px);
  z-index: 950;
  display: grid;
  width: var(--bulk-panel-width, min(720px, calc(100vw - 48px)));
  max-height: var(--bulk-panel-max-height, calc(100dvh - 140px));
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.your-characters-bulk-panel.hidden {
  display: none;
}

.your-characters-bulk-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.your-characters-bulk-head > div {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.your-characters-bulk-head .section-title,
.your-characters-bulk-head .section-subtitle {
  margin-top: 0;
}

.your-characters-bulk-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  align-items: start;
  overflow: visible;
}

.your-characters-bulk-grid .full {
  grid-column: auto;
}

.bulk-control-row {
  position: relative;
  display: grid;
  gap: 10px;
  min-width: 0;
  padding: 12px;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  background: rgba(255,255,255,0.025);
  overflow: visible;
}

.bulk-control-row:focus-within,
.bulk-control-row:has(.model-picker.open),
.bulk-control-row:has(.visibility-picker.open) {
  z-index: 35;
  border-color: rgba(139,124,246,0.30);
  background: rgba(255,255,255,0.04);
}

.bulk-control-row.model-row,
.bulk-control-row.effect-row {
  grid-column: 1 / -1;
}

.bulk-control-row.compact-row {
  grid-template-columns: minmax(0, 1fr) minmax(104px, 148px);
  align-items: center;
}

.bulk-setting-card {
  min-height: 58px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--text);
}

.bulk-setting-card input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.bulk-setting-card strong {
  display: block;
  font-size: 13px;
  line-height: 1.2;
}

.bulk-setting-card small {
  display: block;
  margin-top: 3px;
  color: var(--sub);
  font-size: 11px;
  line-height: 1.3;
}

.your-characters-bulk-grid .form-group {
  margin: 0;
  min-width: 0;
}

.your-characters-bulk-grid .form-group.compact input,
.bulk-effect-row .visibility-trigger {
  min-height: 46px;
  border-radius: 10px;
}

.bulk-effect-row {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(180px, 0.72fr);
  gap: 10px;
  align-items: stretch;
  overflow: visible;
}

#yourCharactersView .model-picker {
  position: relative;
  z-index: 1;
}

#yourCharactersView .model-picker.open {
  z-index: 80;
}

#yourCharactersView .model-picker-popover {
  z-index: 90;
}

#yourCharactersView .premium-effect-picker {
  min-width: 0;
}

#yourCharactersView .premium-effect-picker .visibility-menu {
  width: min(320px, calc(100vw - 40px));
}

#yourCharactersView .premium-effect-picker .visibility-trigger-main {
  min-width: 0;
  align-items: center;
}

#yourCharactersView .premium-effect-picker .visibility-trigger-main strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.premium-portrait-toggle.compact {
  min-height: 46px;
  margin: 0;
  padding: 10px 12px;
}

.premium-portrait-toggle.compact small {
  display: block;
  margin-top: 2px;
}

.your-character-card.is-selected {
  border-color: rgba(139,124,246,0.55);
  box-shadow: 0 0 0 1px rgba(139,124,246,0.22), 0 14px 32px rgba(0,0,0,0.22);
}

.your-character-card {
  position: relative;
}

.your-character-card,
.your-character-header,
.your-character-copy,
.your-character-chips,
.your-character-stats,
.your-character-actions {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

.your-character-card input,
.your-character-card textarea,
.your-character-card select {
  -webkit-touch-callout: default;
  -webkit-user-select: auto;
  user-select: auto;
}

.your-character-select {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  width: 20px;
  height: 20px;
  accent-color: var(--accent);
}

.your-character-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 16px 16px;
}

.mini-btn.danger {
  border-color: rgba(255,107,107,0.35);
  color: #ffb3b3;
}

.bot-card-image-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.bot-card-image-title {
  font-weight: 700;
}

.bot-card-image-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.icon-tool-btn {
  appearance: none;
  width: 36px;
  height: 36px;
  display: inline-grid;
  place-items: center;
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 10px;
  background: rgba(255,255,255,0.03);
  color: var(--text);
  cursor: pointer;
  transition: background 150ms ease, border-color 150ms ease, transform 150ms ease, opacity 150ms ease;
}

.icon-tool-btn svg {
  width: 17px;
  height: 17px;
}

.icon-tool-btn:hover:not(:disabled) {
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.28);
  transform: translateY(-1px);
}

.icon-tool-btn:disabled {
  cursor: not-allowed;
  opacity: 0.38;
}

.icon-tool-btn.danger {
  color: #ffb5b5;
  border-color: rgba(255,107,107,0.24);
}

.bot-card-image-meta {
  font-size: 12px;
  line-height: 1.5;
  color: var(--sub);
}

.bot-card {
  overflow: hidden;
  padding: 0;
}

.bot-card-media {
  position: relative;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  background: #101014;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

@media (min-width: 961px) {
  #settingsView #dangerZonePanel {
    display: flex !important;
    flex-direction: column !important;
    gap: 16px !important;
    height: auto !important;
    min-height: auto !important;
    max-height: none !important;
    padding: 20px !important;
    overflow: visible !important;
    border: 1px solid rgba(224,85,85,0.28) !important;
    border-radius: 18px !important;
    background:
      radial-gradient(circle at 0% 0%, rgba(224,85,85,0.12), transparent 42%),
      linear-gradient(180deg, rgba(224,85,85,0.055), rgba(255,255,255,0.015)),
      rgba(20,18,23,0.94) !important;
  }

  #settingsView #dangerZonePanel::before {
    display: none !important;
  }

  #settingsView #dangerZonePanel .danger-zone-head {
    display: flex !important;
    align-items: flex-start !important;
    justify-content: space-between !important;
    gap: 18px !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
  }

  #settingsView #dangerZonePanel .danger-zone-head .panel-title {
    color: #ffe7e7 !important;
    font-size: 13px !important;
    line-height: 1.2 !important;
  }

  #settingsView #dangerZonePanel .danger-zone-head .setting-help {
    display: block !important;
    margin-top: 6px !important;
    color: rgba(255,210,210,0.72) !important;
  }

  #settingsView #dangerZonePanel .danger-zone-badge {
    flex: 0 0 auto !important;
    align-self: flex-start !important;
    margin: 0 !important;
    padding: 7px 11px !important;
    border-radius: 999px !important;
    border: 1px solid rgba(224,85,85,0.34) !important;
    background: rgba(224,85,85,0.11) !important;
    color: #ffcaca !important;
    font-size: 10px !important;
    line-height: 1 !important;
    white-space: nowrap !important;
  }

  #settingsView #dangerZonePanel > .danger-zone-card {
    display: grid !important;
    grid-template-columns: 46px minmax(0, 1fr) auto !important;
    gap: 16px !important;
    align-items: center !important;
    margin: 0 !important;
    padding: 16px !important;
    border: 1px solid rgba(224,85,85,0.2) !important;
    border-radius: 16px !important;
    background:
      linear-gradient(135deg, rgba(224,85,85,0.095), rgba(255,255,255,0.018)),
      rgba(0,0,0,0.16) !important;
  }

  #settingsView #dangerZonePanel .danger-zone-mobile-card {
    display: none !important;
  }

  #settingsView #dangerZonePanel .danger-zone-actions {
    display: flex !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    justify-content: flex-end !important;
    gap: 10px !important;
    grid-column: auto !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  #settingsView #dangerZonePanel .danger-zone-details-link,
  #settingsView #dangerZonePanel .btn-delete {
    min-height: 40px !important;
    white-space: nowrap !important;
  }
}

/* Last-mile fixes for settings overlay and compact creator cards. */
.settings-overview-card,
.settings-overview-card:visited {
  color: inherit;
  text-decoration: none;
}

@media (min-width: 721px) {
  body[data-current-view="settings"] #settingsView.active {
    position: fixed;
    inset: 0;
    z-index: 2100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 28px;
    background: rgba(8,8,12,0.74);
    backdrop-filter: blur(16px);
    overflow: hidden;
  }

  body[data-current-view="settings"] #settingsView .create-topbar,
  body[data-current-view="settings"] #settingsView .create-body {
    width: min(960px, calc(100vw - 56px));
    max-width: 960px;
    align-self: auto;
    box-sizing: border-box;
  }

  body[data-current-view="settings"] #settingsView .create-topbar {
    border: 1px solid rgba(255,255,255,0.1);
    border-bottom: 0;
    border-radius: 22px 22px 0 0;
  }

  body[data-current-view="settings"] #settingsView .create-body {
    max-height: min(820px, calc(100dvh - 112px));
    flex: 0 1 auto;
    overflow-y: auto;
    border: 1px solid rgba(255,255,255,0.1);
    border-top: 0;
    border-radius: 0 0 22px 22px;
  }
}

@media (min-width: 961px) {
  #yourCharactersView .your-characters-grid {
    grid-template-columns: 1fr;
    gap: 12px;
    align-items: stretch;
  }

  #yourCharactersView .your-character-card {
    display: grid;
    grid-template-columns: minmax(360px, 1.15fr) minmax(230px, .75fr) auto;
    align-items: center;
    gap: 18px;
    min-height: 118px;
    padding: 18px 56px 18px 18px;
    border-radius: 18px;
    align-content: center;
  }

  #yourCharactersView .your-character-copy p {
    max-width: 640px;
    -webkit-line-clamp: 2;
  }

  #yourCharactersView .your-character-chips {
    justify-content: flex-start;
    max-height: 56px;
    overflow: hidden;
  }

  #yourCharactersView .your-character-actions {
    display: flex;
    flex-wrap: nowrap;
    justify-content: flex-end;
    gap: 8px;
  }

  #yourCharactersView .your-character-action-btn {
    flex: 0 0 42px;
    width: 42px;
    min-width: 42px;
    min-height: 42px;
    padding: 0;
    border-radius: 13px;
    font-size: 0;
    gap: 0;
  }

  #yourCharactersView .your-character-action-btn svg {
    width: 17px;
    height: 17px;
  }

  #yourCharactersView .your-character-action-btn span {
    display: none;
  }

  #yourCharactersView .your-character-select {
    top: 18px;
    right: 18px;
  }
}

@media (max-width: 760px) {
  .your-characters-toolbar {
    align-items: stretch;
  }

  .your-characters-toolbar .search-field {
    flex-basis: 100%;
  }

  .your-characters-toolbar-actions {
    width: 100%;
    justify-content: flex-end;
  }

  .your-characters-bulk-panel {
    padding: 12px;
    border-radius: 16px;
  }

  .your-characters-bulk-head {
    align-items: center;
  }

  .your-characters-bulk-grid,
  .bulk-effect-row,
  .bulk-control-row.compact-row {
    grid-template-columns: 1fr;
  }

  .bulk-setting-card {
    min-height: 54px;
  }

  .bulk-control-row {
    padding: 11px;
  }
}

@media (min-width: 721px) {
  #settingsView #dangerZonePanel .danger-zone-mobile-card {
    display: none !important;
  }

  #settingsView #dangerZonePanel > .danger-zone-card {
    display: grid !important;
  }
}

.developer-bulk-panel {
  display: grid;
  gap: 12px;
  margin-top: 14px;
  padding: 14px;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 14px;
  background: rgba(255,255,255,0.025);
}

.bulk-image-picker {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
  align-items: start;
  gap: 12px;
  max-height: 420px;
  padding: 4px;
  overflow: auto;
  scrollbar-gutter: stable;
}

.bulk-image-card {
  position: relative;
  display: grid;
  grid-template-rows: auto 118px auto;
  gap: 7px;
  min-width: 0;
  min-height: 0;
  padding: 8px;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  background: rgba(0,0,0,0.18);
  overflow: hidden;
}

.bulk-image-card img {
  width: 100%;
  height: 118px;
  object-fit: cover;
  border-radius: 9px;
  background: rgba(255,255,255,0.04);
  color: transparent;
  overflow: hidden;
}

.bulk-image-card span {
  display: block;
  min-width: 0;
  overflow: hidden;
  color: var(--sub);
  font-size: 10px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bulk-image-card.is-broken img {
  object-fit: contain;
  padding: 18px;
  opacity: 0.55;
}

.bot-card-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,0.05) 0%, rgba(5,6,10,0.14) 42%, rgba(7,8,12,0.78) 100%);
  pointer-events: none;
}

.bot-card-media.is-explicit-blurred img.bot-card-current-img,
.bot-card-media.is-explicit-blurred img.bot-card-transition-img {
  filter: blur(22px) saturate(0.92) brightness(0.82);
  transform: scale(1.06);
}

.nsfw-blur-wrap,
.recent-avatar-blur-wrap,
.nsfw-image-blurred {
  position: relative;
  overflow: hidden;
}

.recent-avatar-blur-wrap {
  display: inline-grid;
  place-items: center;
  border-radius: inherit;
  flex: 0 0 auto;
}

.nsfw-image-blurred img,
img.nsfw-image-blurred {
  filter: blur(20px) saturate(0.88) brightness(0.82);
  transform: scale(1.04);
}

.detail-full-image-preview.nsfw-image-blurred,
.detail-image-modal-img.nsfw-image-blurred {
  filter: blur(26px) saturate(0.88) brightness(0.78);
  transform: scale(1.02);
}

.nsfw-blur-badge {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 8;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.42);
  background: rgba(8,10,18,0.76);
  color: #fff;
  box-shadow: 0 10px 28px rgba(0,0,0,0.38);
  backdrop-filter: blur(10px);
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.nsfw-image-blurred::after {
  display: none;
  content: "";
}

.nsfw-image-blurred:has(.nsfw-blur-badge)::after,
.bot-card-media.is-explicit-blurred::after {
  display: none;
}

.nsfw-blur-badge svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.bot-card-moderation-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: none;
  place-items: center;
  color: #f6f7fb;
  pointer-events: none;
}

.bot-card-media.is-explicit-blurred .bot-card-moderation-overlay {
  display: grid;
}

.bot-card-moderation-badge {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.bot-card-moderation-copy {
  font-size: 12px;
  color: rgba(246,247,251,0.82);
}

.bot-card-top,
.bot-card-meta,
.bot-card-footer,
.bot-actions-row {
  padding-inline: 16px;
}

.bot-card-top {
  margin-top: -38px;
  position: relative;
  z-index: 1;
}

.bot-card-meta,
.bot-card-footer,
.bot-actions-row {
  padding-bottom: 14px;
}

.bot-card-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.bot-actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 6px;
}

.detail-avatar-wrap.hidden {
  display: none;
}

.detail-full-image-block {
  display: grid;
  gap: 12px;
}

.detail-full-image-link {
  display: block;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
}

.detail-full-image-preview {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 5;
  border-radius: 24px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.04);
}

.detail-gallery-strip {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.detail-gallery-thumb {
  position: relative;
  width: 72px;
  height: 96px;
  flex: 0 0 auto;
  padding: 0;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.04);
  cursor: pointer;
}

.detail-gallery-thumb.active {
  border-color: rgba(139,124,246,0.65);
  box-shadow: 0 0 0 1px rgba(139,124,246,0.35);
}

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

  .bot-card-image-item {
    grid-template-columns: 1fr;
  }
}

html, body { height: var(--app-height); min-height: var(--app-height); overflow: hidden; background: var(--bg); }
body { min-height: 0; }
body {
  font-family: var(--font-ui);
  background: var(--bg);
  color: var(--text);
  display: flex;
  font-size: 14px;
}

/* ── SIDEBAR ── */
#sidebar {
  width: 220px;
  min-width: 230px;
  height: var(--app-height);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 20px 12px;
  gap: 8px;
  position: relative;
  overflow: visible;
  transition: width 0.2s ease, min-width 0.2s ease, padding 0.2s ease, border-color 0.2s ease;
}
.sidebar-collapse-btn {
  position: absolute;
  top: 18px;
  right: 14px;
  left: auto;
  z-index: 1900;
  width: 34px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px;
  background: rgba(255,255,255,0.035);
  color: var(--text);
  font: inherit;
  font-size: 17px;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.sidebar-collapse-btn:hover {
  background: rgba(32,32,38,0.98);
  border-color: rgba(255,255,255,0.18);
}
body.sidebar-collapsed #sidebar {
  width: 0;
  min-width: 0;
  padding-left: 0;
  padding-right: 0;
  border-right-color: transparent;
}
body.sidebar-collapsed #sidebar > :not(.sidebar-collapse-btn) {
  opacity: 0;
  pointer-events: none;
  width: 0;
  min-width: 0;
  overflow: hidden;
}
body.sidebar-collapsed .sidebar-collapse-btn {
  position: fixed;
  left: 0;
  right: auto;
  border-radius: 0 10px 10px 0;
}

body.sidebar-collapsed:has(#chatView.active) .sidebar-collapse-btn {
  top: 72px;
}
.sidebar-top { display: flex; flex-direction: column; gap: 16px; margin-bottom: 8px; }
.logo { font-size: 16px; font-weight: 600; color: var(--text); padding: 4px 8px; letter-spacing: -0.3px; }
.brand-text,
.logo,
.home-header h1,
.create-title,
.panel-title,
.bot-card-name,
.chat-name,
.detail-name,
.splash-title {
  font-family: var(--font-display);
}

.bot-card-name,
.chat-name,
.detail-name,
.recent-chat-card-title,
.history-card-title {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.create-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--r-sm);
  padding: 10px 14px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
  text-align: left;
}
.create-btn:hover { background: var(--accent-d); }

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  padding: 0 12px;
  border-radius: 10px;
  color: var(--sub);
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  transition: background 0.12s, color 0.12s;
  text-decoration: none;
  user-select: none;
}
.nav-item svg {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  fill: currentColor;
  display: block;
  opacity: 0.9;
}
.nav-item:hover { background: var(--card); color: var(--text); }
.nav-item.active { background: var(--card); color: var(--text); }

.recents-section { margin-top: 16px; flex: 1; overflow-y: auto; }
.recents-label { font-size: 11px; font-weight: 600; color: var(--sub); text-transform: uppercase; letter-spacing: 0.8px; padding: 0 10px 8px; }
.sidebar-socials {
  display: none;
  margin-top: 14px;
  padding: 14px 10px 0;
  border-top: 1px solid var(--border);
  gap: 10px;
}
.sidebar-socials-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--sub);
  text-transform: uppercase;
  letter-spacing: 0.8px;
}
.sidebar-socials-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.sidebar-social-link {
  min-width: 0;
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 10px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.04);
  color: var(--text);
  text-decoration: none;
  font-size: 12px;
  font-weight: 700;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}
.sidebar-social-link:hover {
  transform: translateY(-1px);
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.16);
}
.sidebar-social-link img {
  width: 18px;
  height: 18px;
  object-fit: contain;
  display: block;
}
.sidebar-legal { margin-top: 16px; padding: 16px 10px 0; border-top: 1px solid var(--border); display: grid; gap: 10px; }
.sidebar-legal-label { font-size: 11px; font-weight: 600; color: var(--sub); text-transform: uppercase; letter-spacing: 0.8px; }
.sidebar-legal-links { display: flex; flex-wrap: wrap; gap: 8px 12px; }
.sidebar-legal-links a { color: var(--sub); text-decoration: none; font-size: 13px; transition: color 0.12s ease; }
.sidebar-legal-links a:hover { color: var(--text); }

.recent-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: var(--r-sm);
  cursor: pointer; color: var(--sub); font-size: 13px;
  transition: background 0.12s, color 0.12s;
  overflow: hidden; white-space: nowrap;
}
.recent-item:hover { background: var(--card); color: var(--text); }
.recent-item.active { background: var(--card); color: var(--text); }
.recent-emoji { font-size: 16px; flex-shrink: 0; }
.recent-name { overflow: hidden; text-overflow: ellipsis; }

.recent-sidebar-status {
  min-height: 38px;
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0 6px 8px;
  padding: 8px 10px;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px;
  background: rgba(255,255,255,0.035);
  color: var(--sub);
  font-size: 12px;
  font-weight: 700;
}

.recent-sidebar-status.saving {
  color: #c9c2ff;
  border-color: rgba(139,124,246,0.18);
  background: rgba(139,124,246,0.07);
}

.recent-sidebar-spinner {
  width: 14px;
  height: 14px;
  flex: 0 0 14px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.14);
  border-top-color: currentColor;
  animation: spin 0.9s linear infinite;
}

.recent-sidebar-skeleton {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
}

.recent-sidebar-skeleton span,
.recent-sidebar-skeleton i {
  display: block;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(255,255,255,0.055), rgba(255,255,255,0.12), rgba(255,255,255,0.055));
  background-size: 220% 100%;
  animation: skeleton-shimmer 1.2s ease-in-out infinite;
}

.recent-sidebar-skeleton span {
  width: 26px;
  height: 26px;
}

.recent-sidebar-skeleton div {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.recent-sidebar-skeleton i {
  height: 8px;
}

.recent-sidebar-skeleton i:first-child {
  width: 74%;
}

.recent-sidebar-skeleton i:last-child {
  width: 48%;
  opacity: 0.7;
}

.mobile-bottom-nav { display: none; }
.mobile-profile-logout-btn { display: none; }
.mobile-floating-create-btn,
.mobile-recent-your-characters-btn { display: none; }

/* ── MAIN ── */
#main { flex: 1; height: var(--app-height); overflow: hidden; position: relative; background: var(--bg); }
.view { position: absolute; inset: 0; height: 100%; overflow-y: auto; display: none; flex-direction: column; min-height: 0; background: var(--bg); }
.view.active { display: flex; }

/* ── HOME ── */
#homeView { padding: 40px 40px 60px; gap: 32px; }
.home-header h1 { font-size: 28px; font-weight: 600; letter-spacing: -0.5px; }
.home-header p { color: var(--sub); font-size: 14px; margin-top: 4px; }
.bot-section { display: flex; flex-direction: column; gap: 16px; }
.section-title { font-size: 13px; font-weight: 600; color: var(--sub); text-transform: uppercase; letter-spacing: 0.8px; }
.bots-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.hidden { display: none !important; }

.marketplace-empty-state {
  grid-column: 1 / -1;
  min-height: 96px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px dashed var(--border);
  border-radius: var(--r);
  color: var(--sub);
  background: rgba(255,255,255,0.025);
  font-size: 13px;
  text-align: center;
  padding: 18px;
}

.bot-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 20px 18px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.15s;
  display: flex; flex-direction: column; gap: 10px;
}
.bot-card:hover { background: var(--card-h); border-color: var(--border2); transform: translateY(-1px); }
.bot-card-emoji { font-size: 32px; line-height: 1; }
.bot-card-name { font-size: 15px; font-weight: 600; color: var(--text); }
.bot-card-desc { font-size: 12px; color: var(--sub); line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.bot-card-meta { font-size: 11px; color: var(--sub); margin-top: 2px; }

/* ── CHAT ── */
#chatView { display: none; flex-direction: column; overflow: hidden; min-height: 0; }
#chatView.active { display: flex; }

.chat-topbar {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
  position: relative;
  z-index: 25;
  overflow: visible;
}
.chat-bot-info { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; }
.chat-avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--card); display: flex; align-items: center; justify-content: center; font-size: 18px; flex-shrink: 0; }
.chat-name {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  min-width: 0;
  gap: 6px;
  font-size: 15px;
  font-weight: 600;
}
.chat-name-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chat-premium-verify-badge.premium-verify-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  min-width: 23px;
  height: 18px;
  padding: 0 5px;
  border: 1px solid rgba(255, 212, 71, .45);
  border-radius: 999px;
  background: rgba(255, 212, 71, .14);
  color: #ffe38a;
  font-size: 10px;
  font-weight: 900;
  line-height: 1;
  letter-spacing: 0;
  vertical-align: 0;
  text-transform: none;
}
.chat-desc { font-size: 12px; color: var(--sub); }

.messages {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: scroll;
  overflow-x: hidden;
  padding: 24px 20px 28px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overscroll-behavior: contain;
  scroll-behavior: smooth;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: var(--border2) transparent;
}
.messages::-webkit-scrollbar { width: 10px; }
.messages::-webkit-scrollbar-track { background: transparent; }
.messages::-webkit-scrollbar-thumb { background: rgba(50, 50, 62, 0.92); border-radius: 999px; border: 2px solid transparent; background-clip: content-box; }

.msg { display: flex; gap: 12px; max-width: 75%; min-width: 0; overflow: visible; }
.msg.user { align-self: flex-end; flex-direction: row-reverse; }
.msg.assistant { align-self: flex-start; }

.msg-avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--card); display: flex; align-items: center; justify-content: center; font-size: 14px; flex-shrink: 0; margin-top: 2px; }

.bubble {
  padding: 12px 16px; border-radius: 16px;
  font-family: var(--font-chat);
  font-size: var(--chat-text-size); line-height: 1.68; color: var(--text);
  font-weight: 560;
  box-sizing: border-box;
  max-width: 100%;
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.msg.user .bubble { background: var(--chat-bubble-bg); color: var(--chat-bubble-text); border: 1px solid var(--chat-bubble-border); border-bottom-right-radius: 4px; }
.msg.assistant .bubble { background: var(--bot-bubble-bg); color: var(--bot-bubble-text); border: 1px solid var(--bot-bubble-border); border-bottom-left-radius: 4px; }

.typing-dots { display: flex; gap: 4px; align-items: center; padding: 4px 0; }
.typing-dots span {
  width: 6px; height: 6px; border-radius: 50%; background: var(--sub);
  animation: bounce 1.2s infinite;
}
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes bounce { 0%,60%,100% { transform: translateY(0); } 30% { transform: translateY(-5px); } }

.input-bar {
  display: flex; align-items: flex-end; gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
}
#msgInput {
  flex: 0 0 auto; background: var(--card); border: 1px solid var(--border);
  border-radius: 10px; color: var(--text); font-family: inherit;
  font-size: 14px; padding: 10px 14px; resize: none; outline: none;
  min-height: 52px; max-height: 220px; line-height: 1.5; transition: border-color 0.15s;
  white-space: pre-wrap;
  overflow-wrap: break-word;
  word-break: break-word;
  overflow-y: hidden;
}
#msgInput:focus { border-color: var(--border2); }
#msgInput::placeholder { color: var(--sub); }
#sendBtn {
  width: 38px; height: 38px; border-radius: 10px;
  background: var(--accent); border: none; color: #fff;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: background 0.15s;
}
#sendBtn:hover { background: var(--accent-d); }
#sendBtn:disabled { background: var(--border2); cursor: not-allowed; }
#sendBtn.is-stop { background: #ff4d4f; }
#sendBtn.is-stop:hover { background: #ff6768; }
#sendBtn svg { display: block; pointer-events: none; }

/* ── CREATE / EDIT ── */
#createView { display: none; flex-direction: column; }
#createView.active { display: flex; }

.create-topbar {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 20px; border-bottom: 1px solid var(--border);
  background: var(--surface); flex-shrink: 0;
}
.create-title { font-size: 16px; font-weight: 600; }

.create-body {
  flex: 1; overflow-y: auto;
  overflow-x: hidden;
  padding: 28px 40px 60px;
  display: flex; flex-direction: column; gap: 20px;
  max-width: 760px; width: 100%;
  box-sizing: border-box;
}

#createView .create-body {
  width: min(100%, 620px);
  max-width: 620px;
  margin: 0 auto;
  align-items: stretch;
}

#createView .create-body > .panel:first-child {
  order: 1;
}

#createView .create-body > .create-character-panel {
  order: 2;
}

#createView .panel {
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 0;
  gap: 18px;
}

#createView .create-body > .panel:first-child {
  gap: 10px;
}

#createView .create-body > .panel:first-child > .panel-title,
#createView .media-combined-panel > .appearance-title,
#createView .media-combined-panel > .setting-help,
#createView .media-pane[data-media-pane-content="profile"] > .appearance-subtitle,
#createView .media-pane[data-media-pane-content="profile"] > .setting-help {
  display: none;
}

#createView .panel-title {
  color: var(--text);
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: none;
}

#createView .form-grid.two-col {
  grid-template-columns: 1fr;
}

#createView .form-group label,
#createView .form-label {
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: none;
}

#createView .form-group input,
#createView .form-group textarea,
#createView .form-group select {
  background: #15161b;
  border-color: rgba(255,255,255,0.18);
  border-radius: 10px;
  font-size: 14px;
  min-height: 42px;
}

#createView .form-group textarea {
  min-height: 96px;
}

#createView .form-group input:focus,
#createView .form-group textarea:focus,
#createView .form-group select:focus {
  border-color: rgba(255,255,255,0.42);
}

#createView .setting-help {
  color: #a2abc8;
  font-size: 11px;
}

#createView .char-counter {
  align-self: flex-end;
  color: #7f89aa;
  font-size: 11px;
  line-height: 1;
}

#createView .create-advanced-options {
  border-top: 1px solid rgba(255,255,255,0.08);
  padding-top: 8px;
}

#createView .create-advanced-options summary {
  color: var(--text);
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
  list-style-position: outside;
  padding: 8px 0;
}

#createView .create-advanced-options[open] {
  display: grid;
  gap: 16px;
}

#createView .appearance-panel,
#createView .media-content-panel,
#createView .media-sidebar,
#createView .premium-portrait-toggle {
  background: transparent;
}

#createView .bot-appearance-grid > .appearance-panel:not(.media-combined-panel) {
  display: none;
}

#createView .bot-appearance-grid {
  gap: 18px;
}

#createView .appearance-title {
  color: var(--text);
  font-size: 14px;
  letter-spacing: 0;
  text-transform: none;
}

#createView .media-workspace-split {
  grid-template-columns: 1fr;
  gap: 12px;
}

#createView .media-sidebar {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  border: 0;
  padding: 0 24px 4px 0;
  max-width: 100%;
  scrollbar-width: none;
}

#createView .media-sidebar::-webkit-scrollbar {
  display: none;
}

#createView .media-nav-btn {
  border-radius: 999px;
  flex: 0 0 auto;
  padding: 9px 12px;
}

#createView .media-content-panel {
  border: 0;
  padding: 0;
}

#createView .media-pane-body-avatar {
  align-items: center;
  display: flex;
  flex-direction: row;
  gap: 14px;
}

#createView .big-avatar {
  width: 72px;
  height: 72px;
  flex: 0 0 72px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.2);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.32);
}

#createView .big-avatar img,
#createView .big-avatar .avatar-image {
  border-radius: 50%;
}

#createView .bot-media-preview-frame,
#createView .bot-card-image-preview {
  border-color: rgba(255,255,255,0.2);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.28);
}

#createView .bot-card-image-item {
  border-color: rgba(255,255,255,0.14);
}

#createView .avatar-controls {
  align-items: center;
  flex-wrap: wrap;
}

#createView .form-actions {
  align-items: center;
  justify-content: flex-end;
}

.create-publish-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

#createView .native-visibility-select {
  display: none;
}

#createView .native-rating-toggle {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

#createView .native-premium-effect-select {
  display: none;
}

.visibility-picker,
.rating-picker {
  position: relative;
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

.rating-picker {
  max-width: 232px;
}

.visibility-trigger,
.visibility-option,
.rating-trigger {
  appearance: none;
  border: 1px solid rgba(255,255,255,0.14);
  color: var(--text);
  font: inherit;
}

.visibility-trigger,
.rating-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 42px;
  width: 100%;
  padding: 0 12px;
  border-radius: 10px;
  background: #15161b;
  cursor: pointer;
}

.visibility-trigger-main,
.visibility-option,
.rating-trigger {
  display: flex;
  align-items: flex-start;
  gap: 9px;
}

.rating-trigger {
  align-items: center;
  justify-content: flex-start;
}

.visibility-trigger svg,
.visibility-option svg,
.rating-trigger svg {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  margin-top: 1px;
}

.rating-trigger svg {
  align-self: center;
  margin-top: 0;
}

.rating-trigger span {
  display: grid;
  gap: 2px;
  justify-items: start;
  text-align: left;
}

.rating-trigger small {
  color: #a2abc8;
  font-size: 11px;
  line-height: 1.25;
}

.rating-trigger.mature {
  border-color: rgba(255,181,115,0.32);
  background: rgba(255,181,115,0.08);
}

.visibility-trigger > svg:last-child {
  transition: transform 160ms ease;
}

.visibility-picker.open .visibility-trigger > svg:last-child {
  transform: rotate(180deg);
}

.visibility-picker {
  position: relative;
  z-index: 1;
}

.visibility-picker.open {
  z-index: 1200;
}

.visibility-menu {
  position: absolute;
  z-index: 1201;
  left: 0;
  top: calc(100% + 8px);
  width: min(280px, calc(100vw - 40px));
  padding: 6px;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 14px;
  background: #202127;
  box-shadow: 0 18px 44px rgba(0,0,0,0.42);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-8px) scale(0.98);
  transform-origin: top left;
  transition: opacity 150ms ease, transform 150ms ease;
}

.visibility-picker.open .visibility-menu {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.visibility-picker.closing .visibility-menu {
  opacity: 0;
  transform: translateY(-8px) scale(0.98);
}

.visibility-option {
  width: 100%;
  padding: 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.visibility-option.active,
.visibility-option:hover {
  background: rgba(255,255,255,0.07);
}

.visibility-option span {
  display: grid;
  gap: 3px;
}

.visibility-option small {
  color: #a2abc8;
  font-size: 12px;
  line-height: 1.35;
}

.custom-picker-native {
  display: none !important;
}

.custom-select-picker {
  min-width: 180px;
}

.custom-select-trigger {
  min-width: 0;
}

.custom-select-trigger .visibility-trigger-main {
  min-width: 0;
  align-items: center;
}

.custom-select-trigger strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.custom-select-menu {
  width: min(300px, calc(100vw - 40px));
}

.custom-select-menu.fixed-custom-select-menu {
  position: fixed;
  z-index: 20000;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
}

.custom-select-picker.align-right .custom-select-menu {
  left: auto;
  right: 0;
  transform-origin: top right;
}

.custom-select-menu .visibility-option {
  align-items: center;
}

#createView .premium-portrait-create-panel {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 12px;
  background: #15161b;
}

.create-premium-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.create-premium-head span {
  flex: 0 0 auto;
  padding: 4px 8px;
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 999px;
  color: var(--sub);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.04em;
}

#createView .premium-portrait-toggle {
  align-items: center;
  border-color: rgba(255,255,255,0.14);
  border-radius: 10px;
  background: #15161b;
}

#createView .premium-portrait-toggle strong {
  color: var(--text);
}

#createView .premium-portrait-effect-field {
  gap: 7px;
}

#createView .premium-effect-picker {
  max-width: 100%;
}

#createView .premium-effect-trigger {
  justify-content: space-between;
}

#createView .premium-effect-trigger .visibility-trigger-main {
  align-items: center;
}

#createView .premium-effect-picker .visibility-menu {
  width: min(320px, calc(100vw - 40px));
}

.create-persona-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  border-top: 1px solid rgba(255,255,255,0.08);
  padding-top: 14px;
}

.persona-action-card {
  appearance: none;
  min-height: 72px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 12px;
  background: rgba(255,255,255,0.03);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background 150ms ease, border-color 150ms ease, transform 150ms ease;
}

.persona-action-card:hover {
  background: rgba(255,255,255,0.07);
  border-color: rgba(255,255,255,0.24);
  transform: translateY(-1px);
}

.persona-action-icon {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: rgba(255,255,255,0.08);
  font-size: 18px;
  font-weight: 900;
}

.persona-action-icon svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.persona-action-card span:last-child {
  display: grid;
  gap: 4px;
}

.persona-action-card small {
  color: #a2abc8;
  font-size: 11px;
  line-height: 1.3;
}

.create-save-actions {
  border-top: 0;
  padding-top: 0;
}

.settings-body {
  max-width: 760px;
  scroll-behavior: smooth;
}

.settings-overview {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.settings-overview-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  padding: 14px;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 14px;
  background:
    linear-gradient(135deg, rgba(139,124,246,0.12), rgba(26,195,189,0.06)),
    rgba(255,255,255,0.025);
  box-shadow: 0 16px 38px rgba(0,0,0,0.18);
  animation: settingsPanelEnter 0.44s ease both;
}

.settings-overview-card:nth-child(2) { animation-delay: 0.04s; }
.settings-overview-card:nth-child(3) { animation-delay: 0.08s; }

.settings-overview-kicker {
  color: #72e0dc;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.settings-overview-card strong {
  color: var(--text);
  font-size: 14px;
  line-height: 1.25;
}

.settings-overview-card p {
  margin: 0;
  color: var(--sub);
  font-size: 12px;
  line-height: 1.45;
}

#settingsView .panel {
  animation: settingsPanelEnter 0.42s ease both;
  transform-origin: top center;
}

#settingsView .panel:nth-of-type(2) { animation-delay: 0.05s; }
#settingsView .panel:nth-of-type(3) { animation-delay: 0.08s; }
#settingsView .panel:nth-of-type(4) { animation-delay: 0.11s; }
#settingsView .panel:nth-of-type(5) { animation-delay: 0.14s; }
#settingsView .panel:nth-of-type(6) { animation-delay: 0.17s; }
#settingsView .panel:nth-of-type(7) { animation-delay: 0.2s; }
#settingsView .panel:nth-of-type(8) { animation-delay: 0.23s; }

@media (hover: hover) and (pointer: fine) {
  #settingsView .panel {
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
  }

  #settingsView .panel:hover {
    border-color: rgba(255,255,255,0.12);
    box-shadow: 0 18px 44px rgba(0,0,0,0.18);
  }

  #settingsView .account-danger-panel:hover {
    border-color: rgba(224,85,85,0.48);
  }
}

@keyframes settingsPanelEnter {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.avatar-row { display: flex; align-items: center; gap: 20px; }
.big-avatar {
  width: 72px; height: 72px; border-radius: 50%;
  background: var(--card); border: 2px solid var(--border);
  font-size: 36px; display: flex; align-items: center;
  justify-content: center; flex-shrink: 0;
}
.avatar-edit-target {
  position: relative;
  cursor: pointer;
}
.avatar-edit-target::after {
  content: 'Crop';
  position: absolute;
  right: 8px;
  bottom: 8px;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(0,0,0,0.62);
  border: 1px solid rgba(255,255,255,0.12);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  pointer-events: none;
}
.emoji-grid { display: flex; flex-wrap: wrap; gap: 6px; }
.emoji-opt {
  width: 36px; height: 36px; border-radius: 8px;
  background: var(--card); border: 1px solid var(--border);
  font-size: 18px; cursor: pointer; display: flex;
  align-items: center; justify-content: center;
  transition: background 0.1s, border-color 0.1s;
}
.emoji-opt:hover { background: var(--card-h); border-color: var(--border2); }
.emoji-opt.selected { border-color: var(--accent); background: rgba(139,124,246,0.15); }

.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label { font-size: 12px; font-weight: 600; color: var(--sub); text-transform: uppercase; letter-spacing: 0.6px; }
.form-group input, .form-group textarea, .form-group select {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--r-sm); color: var(--text);
  font-family: inherit; font-size: 14px;
  padding: 10px 12px; outline: none; resize: vertical;
  transition: border-color 0.15s;
  scrollbar-width: thin;
  scrollbar-color: rgba(126, 132, 168, 0.82) transparent;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}
.form-group input:focus, .form-group textarea:focus { border-color: var(--border2); }
.form-group input::placeholder, .form-group textarea::placeholder { color: var(--sub); }
.form-group select { appearance: none; }
.birthdate-select-picker {
  display: grid;
  grid-template-columns: 1.15fr .75fr .85fr;
  gap: 8px;
}
.birthdate-select-picker select {
  min-width: 0;
}
.custom-birthdate-picker {
  display: grid;
  grid-template-columns: 1.2fr .8fr .9fr;
  gap: 8px;
  width: 100%;
}
.custom-picker-field {
  position: relative;
  min-width: 0;
}
.custom-picker-trigger {
  width: 100%;
  min-width: 0;
  padding: 12px 12px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background: var(--panel2);
  color: var(--text);
  outline: none;
  font: inherit;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  cursor: pointer;
}
.custom-picker-trigger:hover,
.custom-picker-trigger[aria-expanded="true"] {
  border-color: var(--border2);
}
.custom-picker-trigger:focus-visible {
  border-color: var(--border2);
  box-shadow: 0 0 0 3px rgba(139,124,246,.16);
}
.custom-picker-chevron {
  opacity: .7;
  font-weight: 900;
}
.custom-picker-menu {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 7px);
  z-index: 40;
  max-height: 220px;
  overflow-y: auto;
  display: grid;
  gap: 4px;
  padding: 8px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background: rgba(18,18,27,.98);
  box-shadow: var(--shadow);
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.custom-picker-menu::-webkit-scrollbar { display: none; }
.custom-picker-menu.hidden { display: none; }
.custom-picker-option {
  width: 100%;
  min-height: 38px;
  border: 0;
  border-radius: 8px;
  padding: 9px 10px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}
.custom-picker-option:hover,
.custom-picker-option.selected {
  background: linear-gradient(135deg, rgba(123,104,238,.92), rgba(168,85,247,.78));
  color: #fff;
}
@media (max-width: 520px) {
  .birthdate-select-picker,
  .custom-birthdate-picker {
    grid-template-columns: 1fr;
  }
}
.form-group textarea::-webkit-scrollbar,
.form-group select::-webkit-scrollbar,
#conversationSummaryInput::-webkit-scrollbar,
#msgInput::-webkit-scrollbar,
#detailReviewComment::-webkit-scrollbar,
#messageEditorInput::-webkit-scrollbar {
  width: 10px;
}
.form-group textarea::-webkit-scrollbar-track,
.form-group select::-webkit-scrollbar-track,
#conversationSummaryInput::-webkit-scrollbar-track,
#msgInput::-webkit-scrollbar-track,
#detailReviewComment::-webkit-scrollbar-track,
#messageEditorInput::-webkit-scrollbar-track {
  background: transparent;
}
.form-group textarea::-webkit-scrollbar-thumb,
.form-group select::-webkit-scrollbar-thumb,
#conversationSummaryInput::-webkit-scrollbar-thumb,
#msgInput::-webkit-scrollbar-thumb,
#detailReviewComment::-webkit-scrollbar-thumb,
#messageEditorInput::-webkit-scrollbar-thumb {
  background: rgba(50, 50, 62, 0.92);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: content-box;
}

.form-row {
  display: flex; align-items: center;
  justify-content: space-between;
  padding: 12px 0; border-top: 1px solid var(--border);
}
.form-label { font-size: 14px; font-weight: 500; }

.toggle { cursor: pointer; }
.toggle input { display: none; }
.toggle-track {
  display: block; width: 42px; height: 24px;
  background: var(--border2); border-radius: 12px;
  position: relative; transition: background 0.2s;
}
.toggle-track::after {
  content: ''; position: absolute;
  top: 3px; left: 3px; width: 18px; height: 18px;
  border-radius: 50%; background: #fff; transition: left 0.2s;
}
.toggle input:checked + .toggle-track { background: var(--accent); }
.toggle input:checked + .toggle-track::after { left: 21px; }

.form-actions { display: flex; justify-content: flex-end; gap: 10px; padding-top: 8px; }
.btn-save {
  background: var(--accent); color: #fff; border: none;
  border-radius: var(--r-sm); padding: 10px 22px;
  font-family: inherit; font-size: 14px; font-weight: 500;
  cursor: pointer; transition: background 0.15s;
}
.btn-save:hover { background: var(--accent-d); }
.btn-delete {
  background: transparent; color: var(--danger);
  border: 1px solid var(--danger); border-radius: var(--r-sm);
  padding: 10px 18px; font-family: inherit; font-size: 14px;
  cursor: pointer; transition: background 0.15s;
}
.btn-delete:hover { background: rgba(224,85,85,0.1); }
.account-danger-panel {
  position: relative;
  overflow: hidden;
  border-color: rgba(224,85,85,0.36);
  background:
    linear-gradient(135deg, rgba(224,85,85,0.1), rgba(255,255,255,0.018) 48%, rgba(26,195,189,0.035)),
    rgba(224,85,85,0.035);
}
.account-danger-panel::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  border: 1px solid rgba(224,85,85,0.16);
  opacity: 0.8;
  animation: dangerZonePulse 3.4s ease-in-out infinite;
}
.danger-zone-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  position: relative;
  z-index: 1;
}
.danger-zone-badge {
  flex: 0 0 auto;
  padding: 5px 9px;
  border: 1px solid rgba(224,85,85,0.45);
  border-radius: 999px;
  background: rgba(224,85,85,0.1);
  color: #ffb1b1;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.danger-zone-card {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  margin-top: 14px;
  padding: 16px;
  border: 1px solid rgba(224,85,85,0.24);
  border-radius: 18px;
  background:
    radial-gradient(circle at 0% 0%, rgba(224,85,85,0.12), transparent 52%),
    rgba(0,0,0,0.18);
}
.danger-zone-icon {
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 15px;
  border: 1px solid rgba(224,85,85,0.42);
  background: rgba(224,85,85,0.14);
  color: #ffd0d0;
  font-weight: 950;
  font-size: 22px;
  box-shadow: 0 0 34px rgba(224,85,85,0.16);
}
.danger-zone-card strong {
  display: block;
  margin-bottom: 4px;
  color: var(--text);
  font-size: 15px;
}
.danger-zone-card p {
  margin: 0;
  color: rgba(255,205,205,0.78);
  font-size: 13px;
  line-height: 1.5;
}
.danger-zone-actions {
  padding-top: 0;
  align-items: center;
}
.danger-zone-details-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  background: rgba(255,255,255,0.045);
  color: rgba(255,225,225,0.86);
  font-size: 13px;
  font-weight: 750;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.16s ease, border-color 0.16s ease, transform 0.16s ease;
}
.danger-zone-details-link:hover {
  border-color: rgba(255,255,255,0.18);
  background: rgba(255,255,255,0.075);
  transform: translateY(-1px);
}
.danger-zone-mobile-card {
  display: none;
}
@keyframes dangerZonePulse {
  0%, 100% { opacity: 0.35; }
  50% { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  #settingsView .panel,
  .settings-overview-card,
  .account-danger-panel::before,
  .delete-account-warning-card,
  .delete-account-warning-mark {
    animation: none !important;
  }

  #settingsView .panel {
    transition: none !important;
  }
}

/* ── SHARED BUTTONS ── */
.icon-btn {
  width: 34px; height: 34px; border-radius: var(--r-sm);
  background: transparent; border: none; color: var(--sub);
  cursor: pointer; display: flex; align-items: center;
  justify-content: center; transition: background 0.12s, color 0.12s;
  flex-shrink: 0;
}
.icon-btn:hover { background: var(--card); color: var(--text); }
.text-btn { width: auto; padding: 0 10px; font-family: inherit; font-size: 13px; font-weight: 500; }

/* ── NEW IMAGE / ROLEPLAY FEATURES ── */
.avatar-column {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex-shrink: 0;
  min-width: 0;
}

.avatar-controls {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  width: 100%;
}

.avatar-crop-modal {
  position: fixed;
  inset: 0;
  z-index: 7200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(4, 8, 18, 0.78);
  backdrop-filter: blur(10px);
}
.avatar-crop-modal.hidden { display: none; }
.avatar-crop-card {
  width: min(92vw, 760px);
  max-height: min(92vh, 860px);
  overflow: auto;
  background: #0c1730;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 28px;
  box-shadow: 0 30px 80px rgba(0,0,0,0.48);
  padding: 22px;
}
.avatar-crop-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}
.avatar-crop-title {
  font-size: 20px;
  font-weight: 700;
}
.avatar-crop-subtitle {
  margin-top: 6px;
  color: rgba(255,255,255,0.74);
  line-height: 1.5;
}
.avatar-crop-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 180px;
  gap: 22px;
  margin-top: 18px;
}
.avatar-crop-stage {
  position: relative;
  aspect-ratio: 1 / 1;
  min-height: 280px;
  background:
    linear-gradient(rgba(255,255,255,0.14) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.14) 1px, transparent 1px),
    #050505;
  background-size: 33.333% 33.333%;
  border-radius: 20px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.12);
  touch-action: none;
  user-select: none;
}
.avatar-crop-image {
  position: absolute;
  top: 50%;
  left: 50%;
  transform-origin: center center;
  max-width: none;
  max-height: none;
  will-change: transform;
  pointer-events: none;
}
.avatar-crop-frame {
  position: absolute;
  border-radius: 0;
  border: 2px solid rgba(255,255,255,0.74);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.22);
  pointer-events: none;
  z-index: 2;
}
.avatar-crop-preview {
  display: grid;
  gap: 12px;
  align-content: start;
}
.avatar-crop-preview-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.72);
}
.avatar-crop-preview-box {
  width: 160px;
  aspect-ratio: 1 / 1;
  border-radius: 26px;
  overflow: hidden;
  position: relative;
  border: 1px solid rgba(255,255,255,0.12);
  background:
    linear-gradient(rgba(255,255,255,0.14) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.14) 1px, transparent 1px),
    #050505;
  background-size: 33.333% 33.333%;
}
.avatar-crop-preview-box img {
  position: absolute;
  top: 50%;
  left: 50%;
  transform-origin: center center;
  max-width: none;
  max-height: none;
}
.avatar-crop-controls {
  margin-top: 18px;
  display: grid;
  gap: 12px;
}
.avatar-crop-slider-row {
  display: grid;
  gap: 8px;
}
.avatar-crop-slider-row label {
  font-size: 13px;
  font-weight: 600;
  color: rgba(255,255,255,0.82);
}
.avatar-crop-actions {
  margin-top: 18px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.mini-btn {
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  border-radius: var(--r-sm);
  padding: 8px 12px;
  font-family: inherit;
  font-size: 12px;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}

.mini-btn:hover {
  background: var(--card-h);
  border-color: var(--border2);
}

.mini-btn.ghost {
  background: transparent;
  color: var(--sub);
}

.mini-btn.tiny {
  padding: 6px 10px;
  font-size: 11px;
}

.avatar-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: inherit;
}

.big-avatar,
.chat-avatar,
.bot-card-avatar,
.msg-avatar {
  overflow: hidden;
}

.bot-card-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--card);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.bot-card-top {
  display: flex;
  align-items: center;
  gap: 12px;
}

.emoji-picker-wrap {
  flex: 1;
  min-width: 230px;
}

.input-stack {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  align-self: stretch;
}

.attachment-preview {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--card);
  max-width: 100%;
}

.attachment-preview img {
  width: 54px;
  height: 54px;
  object-fit: cover;
  border-radius: 10px;
  flex-shrink: 0;
}

.attachment-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

#attachmentName {
  font-size: 12px;
  color: var(--sub);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attach-btn {
  margin-left: 2px;
}

.msg {
  overflow: visible;
}

.bubble {
  overflow-wrap: anywhere;
}

.msg-image {
  display: block;
  width: 100%;
  max-width: 360px;
  max-height: 320px;
  object-fit: cover;
  border-radius: 12px;
  margin-top: 10px;
  border: 1px solid var(--border2);
}

.rich-strong {
  color: #355b9f;
  font-weight: 700;
}

.rich-speech {
  color: var(--rp-speech-color);
  font-weight: 600;
  opacity: var(--rp-speech-alpha);
}

.rich-whisper {
  color: var(--rp-whisper-color);
  font-style: italic;
  opacity: var(--rp-whisper-alpha);
}

.rich-action {
  color: var(--rp-action-color);
  font-style: italic;
  font-weight: 500;
  opacity: var(--rp-action-alpha);
}

.rich-divider {
  display: block;
  width: 100%;
  height: var(--rp-divider-thickness-px);
  margin: 14px 0;
  border: 0;
  background: var(--rp-divider-color);
  opacity: var(--rp-divider-alpha);
}

.rich-emphasis {
  color: var(--rp-emphasis-color);
  font-weight: 700;
  opacity: var(--rp-emphasis-alpha);
  text-decoration: underline;
  text-underline-offset: 0.12em;
  text-decoration-thickness: 0.08em;
}

.rich-loud {
  color: var(--rp-loud-color);
  opacity: var(--rp-loud-alpha);
  font-weight: 800;
  text-transform: uppercase;
}

.rich-ooc {
  display: inline-block;
  color: var(--rp-ooc-color);
  opacity: var(--rp-ooc-alpha);
  font-size: 0.92em;
  font-style: italic;
}

.rich-quote {
  display: block;
  margin: 8px 0;
  padding-left: 12px;
  border-left: 3px solid var(--rp-quote-color);
  color: var(--rp-quote-color);
  opacity: var(--rp-quote-alpha);
  font-style: italic;
}

.rich-scene-command {
  display: inline-block;
  max-width: 100%;
  margin: 4px 0;
  padding: 3px 8px;
  border: 1px solid var(--rp-scene-color);
  color: var(--rp-scene-color);
  opacity: var(--rp-scene-alpha);
  border-radius: 999px;
  font-size: 0.82em;
  line-height: 1.3;
  font-weight: 700;
  overflow-wrap: anywhere;
  vertical-align: baseline;
}

.rich-scene-heading {
  display: block;
  margin: 10px 0 6px;
  color: var(--rp-scene-color);
  opacity: var(--rp-scene-alpha);
  font-size: 1.05em;
  font-weight: 900;
  letter-spacing: 0.03em;
}

.rich-phone-text {
  display: inline-block;
  margin: 4px 0;
  padding: 6px 10px;
  border: 1px solid var(--rp-quote-color);
  border-radius: 12px;
  color: var(--rp-quote-color);
  opacity: var(--rp-quote-alpha);
  font-family: var(--font-chat);
  font-size: 0.94em;
}

.rich-transition {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 10px;
  margin: 14px 0;
  color: var(--rp-transition-color);
  opacity: var(--rp-transition-alpha);
  font-size: 0.78em;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.rich-transition::before,
.rich-transition::after {
  content: '';
  height: var(--rp-divider-thickness-px);
  background: currentColor;
  opacity: 0.55;
}


/* ── UPDATED PROFILE + SETTINGS ── */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
  overflow-x: clip;
}

.panel-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--sub);
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.panel-subtitle {
  font-size: 12px;
  font-weight: 600;
  color: var(--sub);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-top: 4px;
}

.first-message-variants {
  display: grid;
  gap: 10px;
}

.first-message-variant-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
}

.first-message-variant-field {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.first-message-actions {
  justify-content: flex-start;
  margin-top: 0;
}

.detail-first-message-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.detail-greeting-controls {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--sub);
  font-size: 12px;
  font-weight: 700;
}

.detail-greeting-controls .icon-btn {
  width: 30px;
  height: 30px;
  min-height: 30px;
}

.detail-greeting-controls.hidden {
  display: none;
}

.form-grid {
  display: grid;
  gap: 12px;
}

.form-grid.two-col {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.form-grid .full {
  grid-column: 1 / -1;
}

.ai-provider-fields {
  display: grid;
  gap: 10px;
}

.ai-provider-inner-grid {
  width: 100%;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.roleplay-style-panel {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  padding: 12px;
  border: 1px solid rgba(255,255,255,0.07);
  background: rgba(255,255,255,0.02);
  border-radius: 14px;
}

.roleplay-style-panel.hidden {
  display: none;
}

.roleplay-style-nav {
  display: grid;
  gap: 6px;
  padding: 8px;
  border: 1px solid rgba(255,255,255,0.07);
  background: rgba(0,0,0,0.14);
  border-radius: 12px;
}

.roleplay-style-nav-btn {
  min-height: 36px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--sub);
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  text-align: left;
  cursor: pointer;
}

.roleplay-style-nav-btn.active,
.roleplay-style-nav-btn:hover {
  border-color: rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.06);
  color: var(--text);
}

.roleplay-style-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 0.85fr);
  gap: 14px;
  min-width: 0;
}

.roleplay-style-grid {
  display: grid;
  gap: 8px;
}

.roleplay-style-row {
  display: none;
  grid-template-columns: minmax(0, 1fr) 42px minmax(90px, 150px);
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid rgba(255,255,255,0.07);
  background: rgba(255,255,255,0.025);
  border-radius: 12px;
}

.roleplay-style-row.active {
  display: grid;
}

.roleplay-style-row strong,
.roleplay-style-row small {
  display: block;
}

.roleplay-style-row strong {
  font-size: 12px;
}

.roleplay-style-row small {
  margin-top: 2px;
  color: var(--sub);
  font-size: 11px;
}

.roleplay-style-row input[type="color"] {
  width: 38px;
  height: 30px;
  padding: 0;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px;
  background: transparent;
}

.roleplay-style-row input[type="range"] {
  width: 100%;
}

.roleplay-divider-thickness {
  grid-template-columns: minmax(0, 1fr) minmax(120px, 1fr);
}

.roleplay-divider-thickness input {
  grid-column: 2;
}

.roleplay-preview-wrap {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid rgba(255,255,255,0.07);
  background: rgba(255,255,255,0.025);
  border-radius: 14px;
}

.roleplay-style-note {
  grid-column: 2 / 4;
  color: var(--sub);
  font-size: 12px;
  font-weight: 700;
}

.roleplay-preview-label {
  color: var(--sub);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.roleplay-preview-bubble {
  background: var(--bot-bubble-bg);
  border: 1px solid var(--bot-bubble-border);
  color: var(--bot-bubble-text);
}

.developer-tools-bar {
  display: flex;
  gap: 10px;
  align-items: center;
  margin: 12px 0;
}

.developer-tools-bar .search-field {
  flex: 1;
  min-width: 0;
}

.developer-bots-list {
  display: grid;
  gap: 10px;
}

.developer-bot-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.03);
  border-radius: 8px;
}

.developer-bot-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.developer-bot-meta {
  margin-top: 4px;
  color: var(--sub);
  font-size: 12px;
  line-height: 1.4;
}

.developer-bot-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.profile-actions {
  justify-content: flex-end;
  padding-top: 0;
}

.btn-save.secondary {
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-save.secondary:hover {
  background: var(--card-h);
  border-color: var(--border2);
}

#chatView, #createView, #homeView {
  min-height: 0;
}

#homeView,
#createView,
.create-body,
.credits-page,
#historyView,
#chatStyleView,
#conversationMemoryView,
.history-body {
  overflow-y: auto;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: var(--border2) transparent;
}

#homeView::-webkit-scrollbar,
#createView::-webkit-scrollbar,
.create-body::-webkit-scrollbar,
.credits-page::-webkit-scrollbar,
#historyView::-webkit-scrollbar,
#chatStyleView::-webkit-scrollbar,
#conversationMemoryView::-webkit-scrollbar,
.history-body::-webkit-scrollbar {
  width: 10px;
}

#homeView {
  scrollbar-width: none;
}

#homeView::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}

#homeView::-webkit-scrollbar-track,
#createView::-webkit-scrollbar-track,
.create-body::-webkit-scrollbar-track,
.credits-page::-webkit-scrollbar-track,
#historyView::-webkit-scrollbar-track,
.history-body::-webkit-scrollbar-track {
  background: transparent;
}

#homeView::-webkit-scrollbar-thumb,
#createView::-webkit-scrollbar-thumb,
.create-body::-webkit-scrollbar-thumb,
.credits-page::-webkit-scrollbar-thumb,
#historyView::-webkit-scrollbar-thumb,
.history-body::-webkit-scrollbar-thumb {
  background: rgba(50, 50, 62, 0.92);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: content-box;
}

#chatView {
  overflow: hidden;
}

#chatView .messages {
  overscroll-behavior: contain;
  padding-right: 14px;
}

.chat-desc {
  font-size: 12px;
  color: var(--sub);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bubble {
  word-break: break-word;
}

.rich-strong {
  color: #5d7fbf;
  font-weight: 700;
}

.rich-speech {
  color: var(--rp-speech-color);
  font-weight: 600;
  opacity: var(--rp-speech-alpha);
}

.rich-whisper {
  color: var(--rp-whisper-color);
  font-style: italic;
  opacity: var(--rp-whisper-alpha);
}

.rich-action {
  color: var(--rp-action-color);
  font-style: italic;
  font-weight: 500;
  opacity: var(--rp-action-alpha);
}


/* ── Updated layout and message controls ───────────────── */
.profile-avatar-row {
  display: flex;
  align-items: center;
  gap: 20px;
}

.profile-settings-guide {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.settings-guide-card {
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 0;
  background: rgba(255,255,255,0.015);
}

.form-section-heading {
  margin-top: 4px;
  color: rgba(255,255,255,0.86);
}

.chat-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.chat-action-btn {
  padding: 0 10px;
  height: 30px;
  border-radius: 999px;
  font-size: 12px;
  white-space: nowrap;
}

.stop-generating-btn {
  border-color: var(--danger);
  color: var(--danger);
}

.stop-generating-btn:hover {
  background: rgba(224, 85, 85, 0.12);
  border-color: var(--danger);
  color: var(--danger);
}

.msg-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  flex: 1;
  position: relative;
  isolation: isolate;
  max-width: 100%;
}

.msg-meta {
  font-size: 11px;
  line-height: 1.2;
  color: var(--sub);
  opacity: 0.92;
  padding-left: 2px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.msg-pin-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  color: var(--text);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}


.msg-controls {
  position: static;
  z-index: 35;
  left: auto;
  top: auto;
  display: flex;
  gap: 7px;
  width: max-content;
  max-width: 100%;
  flex-wrap: wrap;
  align-self: flex-start;
  padding: 0 5px;
  border: 1px solid transparent;
  border-radius: 14px;
  background: rgba(21,21,27,0);
  box-shadow: none;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  overflow: hidden;
  max-height: 0;
  min-height: 0;
  transition: opacity 0.12s ease, visibility 0.12s ease, max-height 0.14s ease, padding 0.14s ease, border-color 0.12s ease, background 0.12s ease;
  transform: none;
}

.msg.user .msg-controls {
  left: auto;
  right: 2px;
  align-self: flex-end;
}

.msg-controls.is-anchored {
  position: fixed;
  left: var(--msg-actions-x, 50vw);
  top: var(--msg-actions-y, 50vh);
  right: auto;
  transform: translate(-50%, calc(-100% - 12px));
  z-index: 5000;
}

.msg.actions-visible .msg-controls,
.msg:focus-within .msg-controls,
.msg-controls:focus-within {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: none;
  max-height: 96px;
  padding: 5px;
  border-color: rgba(255,255,255,0.08);
  background: rgba(21,21,27,0.94);
  box-shadow: 0 14px 28px rgba(0,0,0,0.22);
}

@media (hover: hover) and (pointer: fine) {
  .msg:hover .msg-controls {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: none;
    max-height: 96px;
    padding: 5px;
    border-color: rgba(255,255,255,0.08);
    background: rgba(21,21,27,0.94);
    box-shadow: 0 14px 28px rgba(0,0,0,0.22);
  }
}

.msg-action-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255,255,255,0.16);
  background: rgba(255,255,255,0.055);
  color: rgba(255,255,255,0.88);
  font-family: inherit;
  font-size: 11px;
  border-radius: 10px;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  padding: 0;
  cursor: pointer;
  transition: transform .18s ease, border-color .18s ease, background .18s ease, color .18s ease;
  box-shadow: none;
}

.msg-action-btn svg {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.msg.actions-visible .msg-controls.is-anchored,
.msg:focus-within .msg-controls.is-anchored,
.msg-controls.is-anchored:focus-within {
  transform: translate(-50%, calc(-100% - 12px));
}

@media (hover: hover) and (pointer: fine) {
  .msg:hover .msg-controls.is-anchored {
    transform: translate(-50%, calc(-100% - 12px));
  }
}

.msg-action-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 34px;
  padding: 0 8px;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 999px;
  color: var(--sub);
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
}

.msg-action-btn:hover {
  background: rgba(159,140,255,0.20);
  color: #fff;
  border-color: rgba(159,140,255,0.50);
  transform: translateY(-1px);
}

.msg-action-btn.danger {
  color: rgba(255,222,222,0.9);
}

.msg-action-btn.danger:hover {
  color: #fff;
  border-color: rgba(224,85,85,0.48);
  background: rgba(224,85,85,0.18);
}

.msg-reaction-btn.selected {
  color: #f6d66f;
  border-color: rgba(246,214,111,0.42);
  background: rgba(246,214,111,0.12);
}

.msg-reaction-summary {
  display: inline-flex;
  align-self: flex-start;
  margin-top: -2px;
  padding: 3px 8px;
  border: 1px solid rgba(246,214,111,0.32);
  border-radius: 999px;
  background: rgba(18,18,24,0.92);
  color: #f6d66f;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
}

.msg.user .msg-reaction-summary {
  align-self: flex-end;
}

body.chat-subview-open #chatView .chat-menu,
body.chat-subview-open #chatView .chat-menu-btn {
  pointer-events: auto;
}

body.chat-subview-open #chatView .chat-menu button {
  pointer-events: none;
  opacity: 0.54;
}

.msg-highlighted .bubble {
  box-shadow: 0 0 0 2px rgba(255,255,255,0.18), 0 0 0 6px rgba(139,124,246,0.14);
}

.pinned-messages-panel {
  align-self: stretch;
  display: grid;
  gap: 10px;
  padding: 14px;
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.035);
}

.pinned-messages-heading {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--sub);
}

.pinned-messages-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.pinned-message-chip {
  display: grid;
  gap: 4px;
  min-width: min(280px, 100%);
  max-width: 100%;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.04);
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.pinned-message-chip:hover {
  background: rgba(255,255,255,0.07);
  border-color: rgba(255,255,255,0.14);
}

.pinned-message-speaker {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--sub);
}

.pinned-message-copy {
  font-size: 13px;
  line-height: 1.45;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pinned-memory-panel {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(139,124,246,0.22);
  border-radius: 12px;
  background: rgba(139,124,246,0.07);
}

.pinned-memory-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.pinned-memory-head > div:first-child {
  flex: 1 1 auto;
  min-width: 0;
}

.pinned-memory-toggle svg {
  transition: transform 0.16s ease;
}

.pinned-memory-panel.is-collapsed .pinned-memory-toggle svg {
  transform: rotate(-90deg);
}

.pinned-memory-title {
  color: var(--text);
  font-size: 13px;
  font-weight: 850;
}

.pinned-memory-subtitle {
  color: var(--sub);
  font-size: 11px;
  line-height: 1.35;
}

.pinned-memory-list {
  display: grid;
  gap: 8px;
}

.pinned-memory-panel.is-collapsed .pinned-memory-list {
  display: none;
}

.pinned-memory-chip {
  appearance: none;
  width: 100%;
  min-height: 38px;
  padding: 9px 10px;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px;
  background: rgba(255,255,255,0.04);
  color: var(--text);
  font: inherit;
  font-size: 12px;
  line-height: 1.35;
  text-align: left;
  cursor: pointer;
}

.pinned-memory-chip:hover {
  border-color: rgba(139,124,246,0.36);
  background: rgba(255,255,255,0.07);
}

.msg-variant-nav {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  padding: 2px 4px;
  margin-top: 2px;
  border-radius: 999px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
}

.msg-variant-btn {
  border: none;
  background: transparent;
  color: var(--sub);
  font: inherit;
  font-size: 12px;
  line-height: 1;
  padding: 2px 4px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease, opacity 0.12s ease;
}

.msg-variant-btn:hover:not(:disabled) {
  background: rgba(255,255,255,0.08);
  color: var(--text);
}

.msg-variant-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.msg-variant-count {
  min-width: 34px;
  text-align: center;
  font-size: 11px;
  color: var(--sub);
}

.bubble {
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
  max-width: 100%;
}

.scene-divider {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 4px 0;
  padding: 6px 10px;
  color: var(--sub);
  font-size: 11px;
  letter-spacing: 0.4px;
}

.scene-divider span {
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--border);
}

.roleplay-break-message {
  width: min(100%, 680px);
  align-self: center;
  margin: 8px auto;
  padding: 0 10px;
}

.roleplay-break-message .rich-divider {
  margin: 10px 0;
}

.roleplay-break-message .rich-transition {
  margin: 10px 0;
}

.form-group input[type="color"] {
  width: 100%;
  min-height: 42px;
  padding: 4px;
}

.messages {
  scroll-behavior: smooth;
}

.range-wrap {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

.message-modal {
  position: fixed;
  inset: 0;
  background: rgba(6, 6, 10, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.message-modal.hidden {
  display: none;
}

.message-modal-card {
  width: min(640px, 100%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.message-modal-title {
  font-size: 16px;
  font-weight: 600;
}

#messageEditorInput {
  width: 100%;
  min-height: 160px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  padding: 12px;
  resize: vertical;
}

.message-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.credit-modal-copy {
  color: var(--sub);
  line-height: 1.55;
}

.install-reward-card {
  border: 1px solid rgba(255, 200, 88, 0.28);
  background:
    radial-gradient(circle at top left, rgba(255,197,77,0.18), transparent 42%),
    linear-gradient(180deg, rgba(255,255,255,0.03), rgba(255,255,255,0.01)),
    var(--surface);
}

.install-reward-art {
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: 220px;
  overflow: hidden;
  border-radius: 20px;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.04);
}

.install-reward-art img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: center 24%;
}

.install-reward-kicker {
  display: inline-flex;
  align-self: flex-start;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255,210,120,0.34);
  background: rgba(255,210,120,0.12);
  color: #ffe39a;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.credit-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.msg.user .msg-meta {
  justify-content: flex-end;
  text-align: right;
}

.chayt-plus-upsell-modal {
  z-index: 12500;
  background:
    linear-gradient(180deg, rgba(4,6,12,.78), rgba(4,6,12,.86));
  backdrop-filter: blur(10px);
}

.chayt-plus-upsell-card {
  width: min(520px, 100%);
  position: relative;
  padding: 24px;
  border-radius: 22px;
  border-color: rgba(255,212,91,.28);
  background:
    linear-gradient(145deg, rgba(255,212,91,.14), rgba(120,198,255,.08) 46%, rgba(255,255,255,.035)),
    var(--surface);
  box-shadow: 0 28px 80px rgba(0,0,0,.52);
  overflow: hidden;
  animation: chaytPlusModalIn .26s ease both;
}

.chayt-plus-upsell-card::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(110deg, transparent 0%, rgba(255,255,255,.13) 44%, transparent 58%);
  transform: translateX(-130%);
  animation: generatorLightSweep 5.8s ease-in-out infinite;
}

.chayt-plus-upsell-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 999px;
  background: rgba(255,255,255,.04);
  color: rgba(255,255,255,.72);
  cursor: pointer;
  transition: background .16s ease, color .16s ease, transform .16s ease;
}

.chayt-plus-upsell-close:hover {
  background: rgba(255,255,255,.1);
  color: #fff;
  transform: rotate(90deg);
}

.chayt-plus-upsell-kicker {
  display: inline-flex;
  width: fit-content;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255,212,91,.34);
  background: rgba(255,212,91,.12);
  color: #ffe79c;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.chayt-plus-upsell-title {
  margin-top: 4px;
  font-size: 26px;
  line-height: 1.1;
  font-weight: 900;
  letter-spacing: 0;
}

.chayt-plus-upsell-benefits {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.chayt-plus-upsell-benefits span {
  min-height: 48px;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 9px;
  border: 1px solid rgba(255,255,255,.09);
  border-radius: 13px;
  background: rgba(255,255,255,.04);
  color: rgba(244,244,251,.88);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.25;
  animation: chaytPlusBenefitIn .34s ease both;
}

.chayt-plus-upsell-benefits span:nth-child(2) {
  animation-delay: .05s;
}

.chayt-plus-upsell-benefits span:nth-child(3) {
  animation-delay: .1s;
}

.chayt-plus-upsell-card .credit-modal-actions .mini-btn {
  min-height: 40px;
}

.generator-loading-modal {
  z-index: 12600;
  background:
    radial-gradient(circle at 50% 18%, rgba(120,198,255,.18), transparent 34%),
    rgba(4,6,12,.84);
  backdrop-filter: blur(12px);
}

.generator-loading-card {
  width: min(500px, 100%);
  position: relative;
  padding: 26px;
  overflow: hidden;
  border-radius: 24px;
  border-color: rgba(120,198,255,.28);
  background:
    linear-gradient(145deg, rgba(120,198,255,.12), rgba(139,111,246,.12) 48%, rgba(255,255,255,.035)),
    var(--surface);
  box-shadow: 0 30px 90px rgba(0,0,0,.56);
  animation: generatorModalIn .28s ease both;
}

.generator-loading-card::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(110deg, transparent 0%, rgba(255,255,255,.14) 44%, transparent 58%);
  transform: translateX(-130%);
  animation: generatorLightSweep 4.8s ease-in-out infinite;
}

.generator-loading-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 999px;
  background: rgba(255,255,255,.045);
  color: rgba(255,255,255,.72);
  cursor: pointer;
  transition: background .16s ease, color .16s ease, transform .16s ease;
}

.generator-loading-close:hover {
  background: rgba(255,255,255,.1);
  color: #fff;
  transform: rotate(90deg);
}

.generator-loading-orbit {
  width: 86px;
  height: 86px;
  margin: 0 auto 16px;
  position: relative;
  border-radius: 999px;
  border: 1px solid rgba(120,198,255,.2);
  background:
    radial-gradient(circle at center, rgba(120,198,255,.22), transparent 36%),
    rgba(255,255,255,.035);
  animation: generatorOrbitPulse 1.8s ease-in-out infinite;
}

.generator-loading-orbit span {
  position: absolute;
  inset: 12px;
  border-radius: 999px;
  border: 2px solid transparent;
  border-top-color: rgba(120,198,255,.96);
  animation: spin 1.05s linear infinite;
}

.generator-loading-orbit span:nth-child(2) {
  inset: 22px;
  border-top-color: rgba(255,212,91,.92);
  animation-duration: 1.45s;
  animation-direction: reverse;
}

.generator-loading-orbit span:nth-child(3) {
  inset: 32px;
  border-top-color: rgba(174,143,255,.92);
  animation-duration: .86s;
}

.generator-loading-kicker {
  display: block;
  text-align: center;
  color: rgba(120,198,255,.95);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.generator-loading-title {
  margin-top: 6px;
  text-align: center;
  font-size: 25px;
  line-height: 1.12;
}

.generator-loading-copy {
  margin: 10px auto 0;
  max-width: 36ch;
  text-align: center;
}

.generator-loading-progress {
  height: 9px;
  margin-top: 20px;
  border-radius: 999px;
  background: rgba(255,255,255,.08);
  overflow: hidden;
}

.generator-loading-progress span {
  display: block;
  width: 28%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #78c6ff, #8b6ff6, #ffd45b);
  box-shadow: 0 0 24px rgba(120,198,255,.42);
  transition: width .36s ease;
}

.generator-loading-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.generator-loading-steps span {
  min-height: 36px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.08);
  color: rgba(232,233,241,.58);
  font-size: 12px;
  font-weight: 800;
  transition: background .18s ease, color .18s ease, border-color .18s ease, transform .18s ease;
}

.generator-loading-steps span.active,
.generator-loading-steps span.complete {
  border-color: rgba(120,198,255,.32);
  background: rgba(120,198,255,.11);
  color: #fff;
}

.generator-loading-steps span.active {
  transform: translateY(-1px);
}

.generator-loading-card.is-done {
  border-color: rgba(74,222,128,.34);
}

.generator-loading-card.is-done .generator-loading-progress span {
  background: linear-gradient(90deg, #78c6ff, #4ade80);
}

.generator-loading-card.is-error {
  border-color: rgba(255,107,107,.42);
}

.generator-loading-card.is-error .generator-loading-progress span {
  background: linear-gradient(90deg, #ff6b6b, #ffd45b);
}

.generator-loading-actions {
  margin-top: 18px;
}

@keyframes chaytPlusModalIn {
  from { opacity: 0; transform: translateY(18px) scale(.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes chaytPlusBenefitIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes generatorModalIn {
  from { opacity: 0; transform: translateY(18px) scale(.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes generatorOrbitPulse {
  0%, 100% { transform: scale(.98); box-shadow: 0 0 0 rgba(120,198,255,0); }
  50% { transform: scale(1.02); box-shadow: 0 0 34px rgba(120,198,255,.2); }
}

@media (max-width: 960px) {
  .chat-actions {
    display: flex;
  }
  .msg-controls {
    position: absolute;
    top: 20px;
    left: 0;
    z-index: 30;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(-100%) scale(0.96);
    flex-wrap: wrap;
    max-width: min(calc(100vw - 24px - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px)), 300px);
    justify-content: center;
    background: rgba(33,33,40,0.62);
    border-color: rgba(255,255,255,0.16);
    backdrop-filter: blur(18px) saturate(1.5);
    -webkit-backdrop-filter: blur(18px) saturate(1.5);
    box-shadow: 0 16px 34px rgba(0,0,0,0.34);
  }

  .msg-controls.is-anchored {
    position: fixed;
    left: var(--msg-actions-x, 50vw);
    top: var(--msg-actions-y, 50vh);
    right: auto;
    z-index: 5000;
    width: max-content;
    max-width: min(calc(100vw - 24px - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px)), 360px);
    transform: translate(-50%, calc(-100% - 12px));
  }

  .msg.actions-visible .msg-body::before {
    content: "";
    position: absolute;
    inset: 16px -10px -8px -10px;
    z-index: 0;
    border-radius: 24px;
    background: rgba(255,255,255,0.045);
    backdrop-filter: blur(16px) saturate(1.35);
    -webkit-backdrop-filter: blur(16px) saturate(1.35);
    box-shadow: 0 18px 44px rgba(0,0,0,0.24);
    pointer-events: none;
  }

  .msg .msg-meta,
  .msg .bubble,
  .msg .msg-reaction-summary {
    position: relative;
    z-index: 1;
  }

  .msg.actions-visible .msg-controls,
  .msg:focus-within .msg-controls,
  .msg-controls:focus-within {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(-100%) scale(1);
  }

  .msg.actions-visible .msg-controls.is-anchored,
  .msg:focus-within .msg-controls.is-anchored,
  .msg-controls.is-anchored:focus-within {
    transform: translate(-50%, calc(-100% - 12px));
  }

  .msg.user .msg-controls {
    left: auto;
    right: 0;
  }

  .msg:hover .msg-controls {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(-100%) scale(0.96);
  }

  .msg.actions-visible:hover .msg-controls,
  .msg:focus-within:hover .msg-controls {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(-100%) scale(1);
  }

  .msg.actions-visible:hover .msg-controls.is-anchored,
  .msg:focus-within:hover .msg-controls.is-anchored {
    transform: translate(-50%, calc(-100% - 12px));
  }

  .msg .bubble {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
    touch-action: manipulation;
  }

  .profile-avatar-row,
  .avatar-row {
    flex-direction: column;
    align-items: flex-start;
  }
  .media-explainer,
  .media-workspace,
  .profile-settings-guide,
  .roleplay-style-panel,
  .premium-portrait-modal-grid {
    grid-template-columns: 1fr;
  }
  .roleplay-style-nav {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 10px;
  }
  .roleplay-style-nav-btn {
    flex: 0 0 auto;
    text-align: center;
    white-space: nowrap;
  }
  .roleplay-style-main {
    grid-template-columns: 1fr;
  }
  .roleplay-style-row {
    grid-template-columns: minmax(0, 1fr) 38px minmax(84px, 1fr);
  }
  .media-workspace-split {
    grid-template-columns: 1fr;
  }
  .media-sidebar {
    grid-template-columns: 1fr;
  }
  .form-grid.two-col,
  .settings-grid {
    grid-template-columns: 1fr;
  }
  .create-body,
  .settings-body {
    max-width: 100%;
    padding: 20px 18px 36px;
  }
  .panel {
    width: 100%;
    box-sizing: border-box;
  }
  .bot-card-image-item {
    grid-template-columns: 1fr;
  }
  .bot-card-image-actions {
    flex-wrap: wrap;
  }
  .bot-card-image-actions .mini-btn {
    flex: 1 1 130px;
  }
  .media-content-panel,
  .media-combined-panel {
    padding: 14px;
  }
  .premium-portrait-modal-card {
    padding: 18px;
    border-radius: 24px;
  }
  .premium-portrait-modal-title {
    font-size: 21px;
  }
}

.delete-account-warning-modal {
  position: fixed;
  inset: 0;
  z-index: 7600;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(3, 4, 10, 0.76);
  backdrop-filter: blur(14px);
}
.delete-account-warning-modal.hidden { display: none; }
.delete-account-warning-card {
  position: relative;
  width: min(94vw, 520px);
  max-height: min(92vh, 760px);
  overflow: auto;
  box-sizing: border-box;
  padding: 28px;
  border: 1px solid rgba(224,85,85,0.36);
  border-radius: 24px;
  background:
    radial-gradient(circle at 18% 0%, rgba(224,85,85,0.2), transparent 34%),
    radial-gradient(circle at 88% 18%, rgba(26,195,189,0.12), transparent 32%),
    rgba(18,18,24,0.98);
  box-shadow: 0 30px 90px rgba(0,0,0,0.48);
  animation: deleteWarningEnter 0.24s ease both;
}
.delete-account-warning-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 36px;
  height: 36px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.04);
  color: var(--text);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}
.delete-account-warning-mark {
  width: 54px;
  height: 54px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 18px;
  margin-bottom: 14px;
  border: 1px solid rgba(224,85,85,0.4);
  background: rgba(224,85,85,0.14);
  color: #ffb1b1;
  font-size: 28px;
  font-weight: 900;
  animation: deleteWarningBeat 1.8s ease-in-out infinite;
}
.delete-account-warning-kicker {
  color: #ffb1b1;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.delete-account-warning-card h2 {
  margin: 8px 0 8px;
  color: var(--text);
  font-size: 26px;
  line-height: 1.1;
}
.delete-account-warning-card p {
  margin: 0;
  color: var(--sub);
  line-height: 1.55;
}
.delete-account-warning-list {
  display: grid;
  gap: 8px;
  margin: 18px 0;
  padding: 14px 14px 14px 32px;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 14px;
  background: rgba(0,0,0,0.18);
  color: var(--sub);
  font-size: 13px;
  line-height: 1.45;
}
.delete-account-confirm-field {
  display: grid;
  gap: 8px;
  color: var(--sub);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.delete-account-confirm-field input {
  width: 100%;
  box-sizing: border-box;
  padding: 12px 14px;
  border: 1px solid rgba(224,85,85,0.36);
  border-radius: 14px;
  background: rgba(0,0,0,0.2);
  color: var(--text);
  font: inherit;
  outline: none;
  text-transform: uppercase;
}
.delete-account-confirm-field input:focus {
  border-color: rgba(224,85,85,0.72);
  box-shadow: 0 0 0 3px rgba(224,85,85,0.12);
}
.delete-account-warning-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}
.delete-account-warning-actions .btn-delete:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

@keyframes deleteWarningEnter {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes deleteWarningBeat {
  0%, 100% { transform: scale(1); }
  45% { transform: scale(1.06); }
}

.memory-panel {
  margin: 12px 0 10px;
  padding: 14px;
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 18px;
  background: rgba(255,255,255,0.04);
  backdrop-filter: blur(12px);
  display: grid;
  gap: 10px;
}

.memory-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  overflow: visible;
}

.memory-title {
  font-size: 0.98rem;
  font-weight: 600;
}

.memory-subtitle {
  margin-top: 4px;
  font-size: 0.82rem;
  opacity: 0.72;
}

.memory-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
  overflow: visible;
}

.memory-actions .mini-btn {
  min-width: 0;
}

.memory-icon-btn {
  position: relative;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255,255,255,0.16);
  border-radius: 10px;
  background: rgba(159,140,255,0.20);
  color: rgba(255,255,255,0.95);
  cursor: pointer;
  transition: transform .18s ease, border-color .18s ease, background .18s ease;
}

.memory-icon-btn::after {
  content: attr(aria-label);
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 40;
  width: max-content;
  max-width: min(220px, calc(100vw - 32px));
  padding: 7px 9px;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px;
  background: rgba(14,14,20,0.96);
  color: rgba(255,255,255,0.92);
  box-shadow: 0 12px 26px rgba(0,0,0,0.34);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.25;
  white-space: normal;
  pointer-events: none;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity .16s ease, transform .16s ease;
}

.memory-icon-btn:hover::after,
.memory-icon-btn:focus-visible::after,
.memory-icon-btn:active::after {
  opacity: 1;
  transform: translateY(0);
}

.memory-icon-btn.ghost {
  background: rgba(255,255,255,0.055);
}

.memory-icon-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  border-color: rgba(159,140,255,0.55);
  background: rgba(159,140,255,0.26);
}

.memory-icon-btn:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.memory-icon-btn svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.memory-model-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 14px 0 12px;
}

.memory-model-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 0.82rem;
  color: rgba(255,255,255,0.78);
}

.memory-model-field select {
  width: 100%;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(8,10,18,0.68);
  color: inherit;
  padding: 11px 12px;
  outline: none;
}

.memory-model-field select:focus {
  border-color: rgba(255,255,255,0.22);
}

.memory-model-help {
  min-height: 2.4em;
  font-size: 0.78rem;
  line-height: 1.45;
  color: rgba(255,255,255,0.62);
}

.model-help-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 6px;
}

.model-help-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 0.68rem;
  line-height: 1;
  font-weight: 700;
  letter-spacing: 0.02em;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.88);
}

.model-help-badge.badge-recommended {
  background: rgba(70, 192, 140, 0.18);
  border-color: rgba(70, 192, 140, 0.36);
  color: #aef3cf;
}

.model-help-badge.badge-fast {
  background: rgba(255, 184, 77, 0.16);
  border-color: rgba(255, 184, 77, 0.34);
  color: #ffd89a;
}

.model-help-badge.badge-provider-groq {
  background: rgba(58, 163, 255, 0.16);
  border-color: rgba(58, 163, 255, 0.34);
  color: #a8d5ff;
}

.model-help-badge.badge-provider-ollama {
  background: rgba(196, 156, 255, 0.14);
  border-color: rgba(196, 156, 255, 0.28);
  color: #dec4ff;
}

.model-help-badge.badge-provider-openai {
  background: rgba(102, 226, 195, 0.14);
  border-color: rgba(102, 226, 195, 0.28);
  color: #bff9ea;
}

.model-help-badge.badge-provider-gemini {
  background: rgba(255, 202, 110, 0.14);
  border-color: rgba(255, 202, 110, 0.28);
  color: #ffe3aa;
}

.model-help-badge.badge-provider-deepseek {
  background: rgba(94, 177, 255, 0.14);
  border-color: rgba(94, 177, 255, 0.28);
  color: #c1e2ff;
}

.model-help-badge.badge-provider-openrouter {
  background: rgba(255, 133, 196, 0.14);
  border-color: rgba(255, 133, 196, 0.28);
  color: #ffc3e2;
}

.model-help-badge.badge-provider-claude {
  background: rgba(255, 160, 112, 0.14);
  border-color: rgba(255, 160, 112, 0.28);
  color: #ffd3b4;
}

.model-help-badge.badge-provider-custom {
  background: rgba(166, 174, 255, 0.14);
  border-color: rgba(166, 174, 255, 0.28);
  color: #d5d9ff;
}

.model-help-badge.badge-sfw {
  background: rgba(97, 214, 140, 0.14);
  border-color: rgba(97, 214, 140, 0.28);
  color: #b6f4c7;
}

.model-help-badge.badge-nsfw {
  background: rgba(255, 99, 132, 0.14);
  border-color: rgba(255, 99, 132, 0.28);
  color: #ffb7c8;
}

.model-help-copy {
  color: inherit;
}

.model-picker {
  position: relative;
}

.model-picker-trigger {
  width: 100%;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  text-align: left;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.10);
  background:
    linear-gradient(180deg, rgba(255,255,255,0.05), rgba(255,255,255,0.02)),
    rgba(8,10,18,0.72);
  color: inherit;
  padding: 12px 14px;
}

.model-picker-trigger-copy {
  min-width: 0;
  flex: 1;
}

.model-picker-trigger-title {
  font-size: 14px;
  font-weight: 700;
  color: rgba(255,255,255,0.96);
}

.model-picker-trigger-sub {
  margin-top: 4px;
  font-size: 12px;
  line-height: 1.45;
  color: rgba(255,255,255,0.62);
}

.model-picker-trigger-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.model-picker-trigger-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.model-picker-trigger-caret {
  font-size: 16px;
  color: rgba(255,255,255,0.72);
}

.model-picker-popover {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  right: 0;
  z-index: 80;
  display: none;
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,0.10);
  background:
    radial-gradient(circle at top right, rgba(58,163,255,0.10), transparent 34%),
    linear-gradient(180deg, rgba(19,22,35,0.98), rgba(10,12,20,0.98));
  box-shadow: 0 18px 40px rgba(0,0,0,0.36);
  padding: 12px;
}

.model-picker.open .model-picker-popover {
  display: block;
}

.model-picker-topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.model-picker-search {
  flex: 1;
  min-width: 0;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.04);
  color: inherit;
  padding: 10px 12px;
  outline: none;
}

.model-picker-search-btn,
.search-submit-btn {
  flex: 0 0 auto;
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(255,255,255,0.96), rgba(218,229,255,0.92));
  color: #111827;
  font-weight: 800;
  padding: 9px 15px;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(0,0,0,0.18);
  transition: transform .18s ease, box-shadow .18s ease;
}

.model-picker-search-btn:hover,
.search-submit-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 30px rgba(0,0,0,0.24);
}

.model-picker-rating-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.92);
  text-decoration: none;
  padding: 9px 12px;
  font-size: 12px;
  font-weight: 700;
}

.model-picker-current-rating {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: rgba(255,255,255,0.72);
  margin-bottom: 10px;
}

.model-picker-list {
  max-height: 320px;
  overflow: auto;
  padding-right: 4px;
}

.model-picker-list::-webkit-scrollbar,
.ai-model-rating-list::-webkit-scrollbar,
#aiModelRatingComments::-webkit-scrollbar {
  width: 8px;
}

.model-picker-list::-webkit-scrollbar-thumb,
.ai-model-rating-list::-webkit-scrollbar-thumb,
#aiModelRatingComments::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(255,255,255,0.18);
}

.model-picker-option {
  width: 100%;
  text-align: left;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.03);
  color: inherit;
  padding: 12px;
  margin-bottom: 8px;
}

.model-picker-option.selected {
  border-color: rgba(58,163,255,0.44);
  background: rgba(58,163,255,0.10);
}

.model-picker-option-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.model-picker-option-title {
  font-size: 14px;
  font-weight: 700;
  color: rgba(255,255,255,0.96);
}

.model-picker-selected-mark {
  font-size: 11px;
  font-weight: 700;
  color: #a8d5ff;
}

.model-picker-option-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.model-picker-option-desc {
  margin-top: 8px;
  font-size: 12px;
  line-height: 1.45;
  color: rgba(255,255,255,0.66);
}

.model-picker-rating {
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #ffd46b;
}

.model-picker-empty {
  border-radius: 14px;
  border: 1px dashed rgba(255,255,255,0.12);
  padding: 18px 14px;
  text-align: center;
  color: rgba(255,255,255,0.62);
  font-size: 13px;
}

.ai-model-rating-page {
  max-width: 1200px;
}

.ai-model-rating-shell {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding-bottom: 28px;
}

.ai-model-rating-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: end;
  padding: 24px;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 28px;
  background:
    radial-gradient(circle at 0% 0%, rgba(255,212,107,0.14), transparent 34%),
    radial-gradient(circle at 100% 100%, rgba(74,153,255,0.1), transparent 32%),
    linear-gradient(180deg, rgba(255,255,255,0.05), rgba(255,255,255,0.02));
}

.ai-model-rating-toolbar-copy h2 {
  margin: 6px 0 0;
  font-size: clamp(26px, 4vw, 38px);
  line-height: 1.02;
  letter-spacing: -0.05em;
}

.ai-model-rating-kicker {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #ffd46b;
}

.ai-model-rating-actions {
  width: min(360px, 100%);
}

.ai-model-rating-actions input {
  width: 100%;
  min-height: 48px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(13,16,27,0.78);
  color: var(--text);
  padding: 12px 14px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.03);
}

.ai-model-rating-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.ai-model-card {
  position: relative;
  overflow: hidden;
  border-radius: 22px;
  border: 1px solid rgba(255,255,255,0.10);
  background:
    radial-gradient(circle at 100% 0%, rgba(255,212,107,0.08), transparent 34%),
    linear-gradient(180deg, rgba(255,255,255,0.055), rgba(255,255,255,0.018)),
    rgba(11,13,21,0.92);
  box-shadow: 0 20px 44px rgba(0,0,0,0.22);
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}

.ai-model-card:hover {
  transform: translateY(-2px);
  border-color: rgba(255,212,107,0.28);
  box-shadow: 0 26px 52px rgba(0,0,0,0.28);
}

.ai-model-card.featured {
  border-color: rgba(255,212,107,0.28);
}

.ai-model-card-link {
  display: block;
  color: inherit;
  text-decoration: none;
  padding: 18px;
}

.ai-model-card-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
}

.ai-model-card-title {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.ai-model-card-id {
  margin-top: 4px;
  font-size: 12px;
  color: var(--sub);
  word-break: break-word;
}

.ai-model-card-score {
  display: grid;
  justify-items: end;
  gap: 2px;
  font-size: 13px;
  color: rgba(255,255,255,0.52);
}

.ai-model-card-score strong {
  font-size: 30px;
  font-weight: 800;
  color: #ffd46b;
  line-height: 1;
}

.ai-model-card-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.ai-model-card-stars {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  font-size: 13px;
  color: #ffd46b;
}

.ai-model-card-desc {
  margin-top: 10px;
  color: rgba(255,255,255,0.72);
  line-height: 1.55;
  font-size: 13px;
}

.ai-model-rating-detail-head {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 24px;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 28px;
  background:
    radial-gradient(circle at 0% 0%, rgba(58,163,255,0.14), transparent 34%),
    radial-gradient(circle at 100% 0%, rgba(255,212,107,0.08), transparent 28%),
    rgba(255,255,255,0.025);
}

.ai-model-rating-detail-head-top {
  display: flex;
  justify-content: flex-start;
}

.ai-model-rating-detail-hero {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: end;
}

.ai-model-rating-detail-meta h2 {
  margin: 0 0 8px;
  font-size: clamp(24px, 4vw, 34px);
}

.ai-model-rating-hero-score {
  display: grid;
  gap: 6px;
  min-width: 150px;
  justify-items: end;
  text-align: right;
}

.ai-model-rating-hero-score span {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.58);
}

.ai-model-rating-hero-score strong {
  font-size: clamp(42px, 5vw, 58px);
  line-height: 0.95;
  color: #ffd46b;
}

.ai-model-rating-detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
  gap: 16px;
}

.ai-model-rating-summary-card,
.ai-model-rating-form-card,
.ai-model-comments-card {
  border-radius: 22px;
  border: 1px solid rgba(255,255,255,0.10);
  background:
    linear-gradient(180deg, rgba(255,255,255,0.048), rgba(255,255,255,0.018)),
    rgba(12,14,22,0.92);
  padding: 20px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.2);
}

.ai-model-rating-score-line {
  display: flex;
  gap: 10px;
  align-items: center;
}

.ai-model-rating-stars-display,
.ai-model-star-picker {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.ai-model-star {
  border: 0;
  background: transparent;
  color: rgba(255,255,255,0.24);
  font-size: 28px;
  line-height: 1;
  padding: 0;
}

.ai-model-star.active {
  color: #ffd46b;
}

.ai-model-rating-form-card textarea {
  width: 100%;
  margin-top: 14px;
  margin-bottom: 14px;
  min-height: 112px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(8,10,18,0.82);
  color: inherit;
  padding: 12px 14px;
  resize: vertical;
}

.ai-model-comments-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: end;
  margin-bottom: 14px;
}

#aiModelRatingComments {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 460px;
  overflow: auto;
}

.ai-model-comment {
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,0.08);
  background:
    linear-gradient(180deg, rgba(255,255,255,0.038), rgba(255,255,255,0.02)),
    rgba(8,10,17,0.78);
  padding: 16px;
}

.ai-model-comment-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  margin-bottom: 8px;
}

.ai-model-comment-user {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.ai-model-comment-avatar {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  object-fit: cover;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.05);
  flex: 0 0 auto;
}

.ai-model-comment-user strong {
  display: block;
  line-height: 1.2;
}

.ai-model-comment-user span {
  display: block;
  margin-top: 3px;
  color: rgba(168,173,203,0.72);
  font-size: 12px;
}

.ai-model-comment-stars {
  color: #ffd46b;
  white-space: nowrap;
}

.ai-model-comment-copy {
  line-height: 1.55;
  color: rgba(255,255,255,0.82);
}

.ai-model-comment-date {
  margin-top: 10px;
  font-size: 12px;
  color: rgba(255,255,255,0.52);
}

.ai-model-comments-pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 4px;
}

.ai-model-comments-pagination-left,
.ai-model-comments-pagination-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.ai-model-comments-pagination-label,
.ai-model-comments-page-info {
  color: rgba(241,239,255,.76);
  font-size: 12px;
}

.ai-model-comments-page-size,
.ai-model-comments-page-btn {
  min-height: 34px;
  padding: 0 12px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.045);
  color: var(--text);
  font: inherit;
  font-size: 12px;
}

.ai-model-comments-page-btn {
  cursor: pointer;
}

.ai-model-comments-page-btn:disabled {
  opacity: 0.42;
  cursor: default;
}

@media (max-width: 780px) {
  .memory-model-grid {
    grid-template-columns: 1fr;
  }

  .model-picker-topbar,
  .ai-model-rating-score-line {
    flex-direction: column;
    align-items: stretch;
  }

  .ai-model-rating-toolbar,
  .ai-model-rating-detail-hero {
    flex-direction: column;
    align-items: stretch;
  }

  .ai-model-rating-detail-grid {
    grid-template-columns: 1fr;
  }

  .model-picker-trigger {
    flex-direction: column;
  }

  .model-picker-trigger-meta {
    align-items: flex-start;
  }

  .model-picker-popover {
    padding: 10px;
  }

  .ai-model-rating-grid {
    grid-template-columns: 1fr;
  }

  .ai-model-card-link,
  .ai-model-rating-summary-card,
  .ai-model-rating-form-card,
  .ai-model-comments-card {
    padding: 14px;
  }

  .ai-model-rating-detail-head,
  .ai-model-rating-toolbar {
    padding: 18px;
  }

  .ai-model-rating-hero-score {
    justify-items: start;
    text-align: left;
  }
}

#conversationSummaryInput {
  width: 100%;
  min-height: 110px;
  max-height: 190px;
  resize: vertical;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(8,10,18,0.60);
  color: inherit;
  padding: 12px 14px;
  line-height: 1.45;
  outline: none;
}

#conversationSummaryInput:focus {
  border-color: rgba(255,255,255,0.22);
}

#conversationSummaryInput:disabled {
  opacity: 0.7;
}


/* ── CLEANER REDESIGN OVERRIDES ───────────────────────── */
#sidebar {
  width: 260px;
  min-width: 260px;
  padding: 18px 14px 20px;
  background: linear-gradient(180deg, #121218 0%, #0f0f14 100%);
  border-right-color: rgba(255,255,255,0.08);
  overflow: hidden;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border: 0;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  text-align: left;
}

.brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: block;
}

.brand-text {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.4px;
}

.sidebar-top {
  gap: 14px;
}

#sidebar .brand {
  padding-right: 42px;
}

.create-btn {
  min-height: 38px;
  border-radius: 12px;
  box-shadow: 0 0 0 1px rgba(139,124,246,0.15) inset;
}

#sidebar nav {
  display: grid;
  gap: 6px;
  margin-top: 2px;
}

#sidebar .nav-item {
  background: transparent;
}

#sidebar .nav-item:hover {
  background: rgba(255,255,255,0.055);
}

#sidebar .nav-item.active {
  background: rgba(255,255,255,0.08);
  color: #fff;
}

.recents-section,
.recent-chats-page {
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: rgba(68, 72, 88, 0.92) transparent;
}

.recents-section::-webkit-scrollbar,
.recent-chats-page::-webkit-scrollbar {
  width: 10px;
}

.recents-section::-webkit-scrollbar-track,
.recent-chats-page::-webkit-scrollbar-track {
  background: transparent;
}

.recents-section::-webkit-scrollbar-thumb,
.recent-chats-page::-webkit-scrollbar-thumb {
  background: rgba(50, 50, 62, 0.92);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: content-box;
}

#main {
  background:
    radial-gradient(1200px 700px at 50% 0%, rgba(139,124,246,0.08), transparent 40%),
    var(--bg);
}

.view {
  scrollbar-gutter: stable;
}

#homeView {
  padding: 28px 28px 56px;
  gap: 14px;
}

.home-hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  padding: 4px 2px 2px;
}

.home-hero h1 {
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.8px;
}

.home-hero p {
  margin-top: 6px;
  color: var(--sub);
}

.discovery-title-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.discovery-search-open-btn,
.discovery-socials {
  display: inline-flex;
}

.discovery-search-open-btn {
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.045);
  color: var(--text);
  cursor: pointer;
  transition: background 0.16s ease, border-color 0.16s ease, transform 0.16s ease;
}

.discovery-search-open-btn:hover {
  background: rgba(255,255,255,0.085);
  border-color: rgba(255,255,255,0.16);
  transform: translateY(-1px);
}

.discovery-socials {
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 8px;
}

.discovery-social-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.045);
  color: var(--text);
  text-decoration: none;
  font-size: 13px;
  font-weight: 700;
  transition: background 0.16s ease, border-color 0.16s ease, transform 0.16s ease;
}

.discovery-social-link:hover {
  background: rgba(255,255,255,0.085);
  border-color: rgba(255,255,255,0.16);
  transform: translateY(-1px);
}

.discovery-social-link img {
  width: 19px;
  height: 19px;
  object-fit: contain;
  display: block;
}

.discovery-tabs {
  display: flex;
  align-items: center;
  gap: 22px;
  flex: 0 0 auto;
  min-width: 0;
  overflow-x: auto;
  min-height: 42px;
  padding: 4px 0 0;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.18) transparent;
}

.discovery-tabs::-webkit-scrollbar {
  display: none;
}

.discovery-tab {
  appearance: none;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--sub);
  height: 38px;
  padding: 0 0 9px;
  font: inherit;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
  cursor: pointer;
  position: relative;
  transition: color .18s ease, border-color .18s ease;
}

.discovery-tab.active {
  color: var(--text);
  border-bottom-color: currentColor;
  animation: discoveryTabLift .34s cubic-bezier(.2,.8,.2,1);
}

.discovery-tab.active::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 2px;
  width: 24px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  opacity: .55;
  transform: translateX(-50%);
  animation: discoveryTabPulse 1.8s ease-in-out infinite;
}

@media (min-width: 761px) {
  .discovery-tab.active::after {
    content: none;
  }
}

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

.discovery-tab:focus:not(:focus-visible) {
  outline: none;
}

.discovery-tab:focus-visible {
  outline: 2px solid rgba(139,124,246,0.7);
  outline-offset: 3px;
  border-radius: 4px;
}

.discovery-quick-tags {
  display: none !important;
  align-items: center;
  gap: 10px;
  min-width: 0;
  min-height: 48px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 6px 0 8px;
  scroll-padding-inline: 6px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  touch-action: pan-x;
}

.discovery-quick-tags::-webkit-scrollbar {
  height: 4px;
}

.discovery-quick-tags::-webkit-scrollbar-track {
  background: transparent;
}

.discovery-quick-tags::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(255,255,255,0.18);
}

.discovery-quick-tag {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  box-sizing: border-box;
  border: 1px solid rgba(255,255,255,0.11);
  border-radius: 999px;
  background: rgba(255,255,255,0.045);
  color: var(--sub);
  height: 34px;
  min-width: max-content;
  padding: 0 13px;
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  line-height: 34px;
  white-space: nowrap;
  cursor: pointer;
  opacity: 0;
  transform: translateY(4px);
  animation: discoveryQuickTagIn .42s cubic-bezier(.2,.8,.2,1) forwards;
  animation-delay: calc(var(--tag-index, 0) * 34ms);
  transition: color .18s ease, background .18s ease, border-color .18s ease, box-shadow .18s ease;
}

.discovery-quick-tag:hover {
  color: var(--text);
  border-color: rgba(255,255,255,0.2);
  background: rgba(255,255,255,0.075);
}

.discovery-quick-tag.active {
  color: #fff;
  border-color: rgba(139,124,246,0.65);
  background: linear-gradient(135deg, rgba(139,124,246,0.98), rgba(236,72,153,0.9));
  box-shadow: 0 10px 28px rgba(139,124,246,0.2);
  animation-name: discoveryQuickTagIn, discoveryActiveTagGlow;
  animation-duration: .42s, 2.2s;
  animation-timing-function: cubic-bezier(.2,.8,.2,1), ease-in-out;
  animation-delay: calc(var(--tag-index, 0) * 34ms), .45s;
  animation-fill-mode: forwards, none;
  animation-iteration-count: 1, infinite;
}

.discovery-filter-loader {
  position: relative;
  display: none;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 0;
  height: 0;
  opacity: 0;
  overflow: hidden;
  color: rgba(255,255,255,0.78);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  pointer-events: none;
  transform: translateY(-4px);
  transition: height .18s ease, opacity .18s ease, transform .18s ease, margin .18s ease;
}

.discovery-filter-loader-bar {
  position: relative;
  height: 3px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
}

.discovery-filter-loader-bar::before {
  content: "";
  position: absolute;
  inset: 0;
  width: 42%;
  border-radius: inherit;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.92), transparent);
  transform: translateX(-120%);
}

body.is-discovery-filtering .discovery-filter-loader {
  display: grid;
  height: 26px;
  margin: 0 0 4px;
  opacity: 1;
  transform: translateY(0);
}

body.is-discovery-filtering .discovery-filter-loader-bar::before {
  animation: discoveryWhiteBarSweep .72s cubic-bezier(.4,0,.2,1) infinite;
}

body.is-discovery-filtering #featuredGrid {
  opacity: .58;
  filter: saturate(.86);
  transition: opacity .18s ease, filter .18s ease;
}

body.is-discovery-filtering .discovery-tab.active::after {
  width: 38px;
  opacity: .95;
  animation: discoveryTabWhiteBar .72s cubic-bezier(.4,0,.2,1) infinite;
}

@keyframes discoveryTabLift {
  0% { transform: translateY(4px); opacity: .72; }
  100% { transform: translateY(0); opacity: 1; }
}

@keyframes discoveryTabPulse {
  0%, 100% { opacity: .38; transform: translateX(-50%) scaleX(.72); }
  50% { opacity: .9; transform: translateX(-50%) scaleX(1.1); }
}

@keyframes discoveryQuickTagIn {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes discoveryActiveTagGlow {
  0%, 100% { box-shadow: 0 10px 28px rgba(139,124,246,0.2); }
  50% { box-shadow: 0 12px 34px rgba(236,72,153,0.28); }
}

@keyframes discoveryWhiteBarSweep {
  0% { transform: translateX(-120%); }
  100% { transform: translateX(260%); }
}

@keyframes discoveryTabWhiteBar {
  0% { transform: translateX(-50%) scaleX(.45); opacity: .35; }
  50% { transform: translateX(-50%) scaleX(1.25); opacity: 1; }
  100% { transform: translateX(-50%) scaleX(.45); opacity: .35; }
}

@media (prefers-reduced-motion: reduce) {
  .discovery-tab,
  .discovery-tab.active,
  .discovery-tab.active::after,
  .discovery-quick-tag,
  .discovery-quick-tag.active,
  .discovery-filter-loader,
  .discovery-filter-loader-bar::before {
    animation: none !important;
    transition: none !important;
  }

  .discovery-quick-tag {
    opacity: 1;
    transform: none;
  }
}

.discovery-search-overlay {
  position: fixed;
  inset: 0;
  z-index: 2050;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 24px;
  background: rgba(8,8,12,0.72);
  backdrop-filter: blur(14px);
  overflow-y: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  opacity: 0;
  transform: scale(0.985);
  transition: opacity 190ms ease, transform 190ms ease;
}

.discovery-search-overlay::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}

#homeView #userSection.hidden + .bot-section .section-title,
#homeView #userSection.hidden + .bot-section .section-subtitle {
  display: none;
}

#homeView .public-marketplace-title,
#homeView .public-marketplace-subtitle {
  display: none !important;
}

.discovery-search-overlay.hidden {
  display: none;
}

.discovery-search-overlay.is-open {
  opacity: 1;
  transform: scale(1);
}

.discovery-search-overlay.is-closing {
  opacity: 0;
  transform: scale(0.985);
}

.discovery-search-page {
  width: min(920px, 100%);
  margin-top: 44px;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 18px;
  background: rgba(18,18,24,0.98);
  box-shadow: 0 24px 80px rgba(0,0,0,0.42);
  overflow: hidden;
  min-height: min(760px, calc(100dvh - 88px));
  scrollbar-width: none;
  -ms-overflow-style: none;
  transform: translateY(14px) scale(0.98);
  opacity: 0;
  transition: transform 210ms cubic-bezier(.2,.8,.2,1), opacity 180ms ease;
}

.discovery-search-overlay.is-open .discovery-search-page {
  transform: translateY(0) scale(1);
  opacity: 1;
}

.discovery-search-overlay.is-closing .discovery-search-page {
  transform: translateY(10px) scale(0.985);
  opacity: 0;
}

.discovery-search-page::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}

.discovery-search-head {
  min-height: 70px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.discovery-search-body {
  display: grid;
  align-content: start;
  gap: 14px;
  padding: 16px;
}

.discovery-search-field {
  min-width: 0;
  width: 100%;
  flex: 1 1 auto;
  border-radius: 999px;
  min-height: 50px;
}

.discovery-search-cancel-btn {
  flex: 0 0 auto;
  appearance: none;
  border: 0;
  background: transparent;
  color: rgba(232,233,241,0.72);
  font: inherit;
  font-size: 17px;
  padding: 0;
  cursor: pointer;
}

.discovery-search-cancel-btn:hover {
  color: var(--text);
}

.discovery-search-filters {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.discovery-search-filters select {
  appearance: none;
  -webkit-appearance: none;
  height: 42px;
  min-width: 0;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.12);
  background:
    linear-gradient(135deg, rgba(139,124,246,0.14), rgba(255,255,255,0.035)),
    linear-gradient(180deg, #181821, #101016);
  color: var(--text);
  padding: 0 38px 0 13px;
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  outline: none;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.06), 0 10px 22px rgba(0,0,0,0.18);
  cursor: pointer;
  background-image:
    linear-gradient(45deg, transparent 50%, rgba(232,233,241,0.82) 50%),
    linear-gradient(135deg, rgba(232,233,241,0.82) 50%, transparent 50%),
    linear-gradient(135deg, rgba(139,124,246,0.14), rgba(255,255,255,0.035)),
    linear-gradient(180deg, #181821, #101016);
  background-position:
    calc(100% - 20px) 50%,
    calc(100% - 14px) 50%,
    0 0,
    0 0;
  background-size:
    6px 6px,
    6px 6px,
    100% 100%,
    100% 100%;
  background-repeat: no-repeat;
}

.discovery-search-filters select:hover,
.discovery-search-filters select:focus {
  border-color: rgba(139,124,246,0.52);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.08), 0 0 0 3px rgba(139,124,246,0.12), 0 14px 28px rgba(0,0,0,0.24);
}

.discovery-search-filters select option,
.home-toolbar select option {
  background: #111119;
  color: #e8e9f1;
}

.discovery-search-filters select option:checked,
.home-toolbar select option:checked {
  background: #27213f;
  color: #ffffff;
}

.discovery-search-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.discovery-search-results {
  display: grid;
  align-content: start;
  grid-auto-rows: min-content;
  gap: 0;
  min-height: 0;
}

.discovery-search-empty {
  padding: 24px 4px;
  color: var(--sub);
  font-size: 14px;
  text-align: center;
}

.discovery-search-loading-card {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  min-height: 82px;
  padding: 14px;
  border: 1px solid rgba(139,124,246,0.2);
  border-radius: 16px;
  background:
    linear-gradient(135deg, rgba(139,124,246,0.16), rgba(34,211,238,0.06)),
    rgba(255,255,255,0.035);
  box-shadow: 0 18px 34px rgba(0,0,0,0.18);
}

.discovery-search-loading-logo {
  width: 42px;
  height: 42px;
  border-radius: 13px;
  object-fit: cover;
  animation: discoverySearchLogoPulse 1.25s ease-in-out infinite;
}

.discovery-search-loading-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.discovery-search-loading-copy strong {
  color: var(--text);
  font-size: 14px;
}

.discovery-search-loading-copy span {
  color: var(--sub);
  font-size: 12px;
  line-height: 1.4;
}

.discovery-search-loading-bars {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.discovery-search-loading-bars span {
  width: 5px;
  height: 18px;
  border-radius: 999px;
  background: linear-gradient(180deg, #a78bfa, #22d3ee);
  animation: discoverySearchBarPulse .72s ease-in-out infinite;
}

.discovery-search-loading-bars span:nth-child(2) { animation-delay: .1s; }
.discovery-search-loading-bars span:nth-child(3) { animation-delay: .2s; }

@keyframes discoverySearchLogoPulse {
  0%, 100% { transform: scale(1); filter: brightness(1); }
  50% { transform: scale(1.08); filter: brightness(1.22); }
}

@keyframes discoverySearchBarPulse {
  0%, 100% { transform: scaleY(.55); opacity: .55; }
  50% { transform: scaleY(1); opacity: 1; }
}

.discovery-search-skeleton-list {
  display: grid;
  gap: 12px;
}

.discovery-search-skeleton-card {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) 54px;
  align-items: center;
  gap: 12px;
  min-height: 82px;
  padding: 12px;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 16px;
  background: rgba(255,255,255,0.035);
  overflow: hidden;
}

.discovery-search-skeleton-avatar,
.discovery-search-skeleton-copy i,
.discovery-search-skeleton-copy b,
.discovery-search-skeleton-copy em,
.discovery-search-skeleton-stat {
  display: block;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(255,255,255,0.06), rgba(255,255,255,0.15), rgba(255,255,255,0.06));
  background-size: 220% 100%;
  animation: discoverySearchSkeletonSweep 1.05s ease-in-out infinite;
}

.discovery-search-skeleton-avatar {
  width: 58px;
  height: 58px;
  border-radius: 14px;
}

.discovery-search-skeleton-copy {
  display: grid;
  gap: 9px;
  min-width: 0;
}

.discovery-search-skeleton-copy i {
  width: min(190px, 78%);
  height: 14px;
}

.discovery-search-skeleton-copy b {
  width: min(260px, 94%);
  height: 10px;
  opacity: .8;
}

.discovery-search-skeleton-copy em {
  width: min(150px, 54%);
  height: 9px;
  opacity: .68;
}

.discovery-search-skeleton-stat {
  width: 48px;
  height: 18px;
  justify-self: end;
  opacity: .72;
}

@keyframes discoverySearchSkeletonSweep {
  0% { background-position: 110% 0; }
  100% { background-position: -110% 0; }
}

@media (max-width: 760px) {
  .discovery-search-skeleton-card {
    grid-template-columns: 52px minmax(0, 1fr);
    min-height: 76px;
  }

  .discovery-search-skeleton-avatar {
    width: 52px;
    height: 52px;
  }

  .discovery-search-skeleton-stat {
    display: none;
  }
}

.discovery-search-result-card {
  position: relative;
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr) auto;
  gap: 16px;
  align-items: stretch;
  border-radius: 0;
  border: 0;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  background: transparent;
  box-shadow: none;
  padding: 14px 0;
}

.discovery-search-result-card .bot-card-media {
  width: 112px;
  min-width: 112px;
  height: 148px;
  aspect-ratio: auto;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
}

.discovery-search-result-card .bot-card-body {
  display: grid;
  align-content: center;
  gap: 7px;
  min-height: 0;
  padding: 0;
}

.discovery-search-result-card:hover {
  background: rgba(255,255,255,0.025);
  border-color: rgba(255,255,255,0.08);
  transform: none;
}

.discovery-search-result-card .bot-card-top {
  display: block;
  margin-top: 0;
  min-height: 0;
  padding-inline: 0;
}

.discovery-search-result-card .bot-card-copy {
  gap: 5px;
}

.discovery-search-result-card .bot-card-name {
  font-size: 18px;
  line-height: 1.25;
}

.discovery-search-result-card .bot-card-desc {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-top: 5px;
  font-size: 13px;
  line-height: 1.45;
}

.discovery-search-result-card .bot-card-badges {
  margin-top: 7px;
}

.discovery-search-result-card .bot-card-footer {
  display: flex;
  max-height: 56px;
  overflow: hidden;
  padding: 0;
}

.discovery-search-result-card .bot-card-meta {
  display: none;
}

.discovery-search-result-card .bot-actions-row,
.discovery-search-result-card .bot-card-meta::after,
.discovery-search-result-card .bot-card-created {
  display: none;
}

.discovery-search-simple-card {
  cursor: pointer;
}

.discovery-search-simple-image {
  width: 112px;
  min-width: 112px;
  height: 100%;
  min-height: 148px;
  align-self: stretch;
  border-radius: 12px;
  overflow: hidden;
  background: #101014;
  border: 1px solid rgba(255,255,255,0.08);
}

.discovery-search-simple-copy {
  min-width: 0;
  align-self: start;
  display: grid;
  gap: 7px;
  padding-top: 2px;
}

.discovery-search-simple-name {
  color: var(--text);
  font-size: 19px;
  font-weight: 900;
  line-height: 1.22;
}

.discovery-search-simple-desc {
  display: -webkit-box;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.discovery-search-simple-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-height: 26px;
  overflow: hidden;
}

.discovery-search-simple-count {
  align-self: center;
  justify-self: end;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  background: rgba(255,255,255,0.06);
  color: var(--text);
  font-size: 13px;
  font-weight: 900;
}

.discovery-search-simple-count svg {
  width: 15px;
  height: 15px;
  fill: currentColor;
}

.profile-interest-panel {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: rgba(255,255,255,0.025);
}

.profile-interest-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--sub);
  text-transform: uppercase;
  letter-spacing: .4px;
}

.profile-interest-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.profile-interest-search {
  width: min(220px, 44vw);
  height: 34px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255,255,255,0.035);
  color: var(--text);
  padding: 0 10px;
  font: inherit;
  font-size: 12px;
  outline: none;
}

.profile-interest-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.profile-interest-chip {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 999px;
  background: rgba(255,255,255,0.045);
  color: var(--text);
  padding: 6px 10px;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

.profile-interest-chip span::before {
  content: "#";
  color: var(--sub);
}

.profile-interest-chip strong {
  color: var(--sub);
  font-size: 11px;
  font-weight: 700;
}

.profile-interest-chip.active {
  border-color: rgba(139,124,246,0.58);
  background: rgba(139,124,246,0.18);
  color: #fff;
}

.profile-interest-chip.active::after {
  content: "selected";
  color: var(--accent);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .3px;
}

.install-promo {
  margin-top: 18px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  align-items: center;
  padding: 18px 20px;
  border-radius: 24px;
  border: 1px solid rgba(255,200,88,0.32);
  background:
    radial-gradient(circle at top left, rgba(255,197,77,0.3), transparent 44%),
    radial-gradient(circle at bottom right, rgba(120,198,255,0.18), transparent 40%),
    linear-gradient(135deg, rgba(255,255,255,0.08), rgba(255,255,255,0.03));
  box-shadow: 0 18px 42px rgba(0,0,0,0.22), 0 0 0 1px rgba(255,200,88,0.08) inset;
}

.install-promo-art {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 22px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.04);
  box-shadow: 0 16px 32px rgba(0,0,0,0.26);
}

.install-promo-art img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: center 36%;
}

.install-promo-copy {
  min-width: 0;
}

.install-promo-kicker {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #ffd36f;
}

.install-promo-bonus {
  display: inline-flex;
  align-items: center;
  margin-top: 10px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255,210,120,0.42);
  background: linear-gradient(135deg, rgba(255,210,120,0.24), rgba(255,164,86,0.14));
  color: #fff4c7;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.03em;
  box-shadow: 0 10px 24px rgba(255,164,86,0.16);
}

.install-promo h2 {
  margin-top: 8px;
  font-size: clamp(20px, 3vw, 28px);
  line-height: 1.05;
  letter-spacing: -0.04em;
}

.install-promo p {
  margin-top: 8px;
  max-width: 52ch;
  line-height: 1.6;
  color: rgba(226,226,238,0.82);
}

.install-promo p a {
  color: #73e0a9;
  font-weight: 700;
  text-decoration: none;
}

.install-promo p a:hover {
  text-decoration: underline;
}

.install-promo-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-start;
}

.install-promo-actions .btn-save,
.install-promo-actions .mini-btn {
  min-height: 44px;
}

.install-promo-actions .btn-save {
  font-weight: 800;
  box-shadow: 0 14px 28px rgba(255,176,64,0.18);
}

.mobile-hero-create-btn {
  display: none;
  margin-top: 14px;
  min-height: 46px;
  padding: 0 16px;
  border: 1px solid var(--border2);
  border-radius: 14px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  box-shadow: 0 10px 24px rgba(139,124,246,.28);
  cursor: pointer;
}

.home-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.search-field {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: min(520px, 54vw);
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255,255,255,0.02);
}

.search-field svg { color: var(--sub); flex-shrink: 0; }

.search-field input {
  flex: 1;
  min-width: 0;
  width: 100%;
  height: 42px;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  outline: none;
}

.search-field input::placeholder {
  color: var(--sub);
}

.home-toolbar select {
  height: 42px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.02);
  color: var(--text);
  padding: 0 12px;
  font: inherit;
  outline: none;
}

.discovery-ad-slot {
  display: none !important;
  width: 100%;
  min-height: 0;
  overflow: hidden;
  border-radius: 14px;
  background: transparent;
}

.discovery-ad-slot .adsbygoogle {
  min-height: 90px;
}

.discovery-support-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border: 1px solid rgba(139, 124, 246, 0.28);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(139, 124, 246, 0.16), rgba(34, 197, 94, 0.08));
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.18);
}

.discovery-support-copy {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.discovery-support-kicker {
  color: #a7f3d0;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.discovery-support-title {
  color: var(--text);
  font-size: 15px;
  font-weight: 800;
}

.discovery-support-copy p {
  margin: 0;
  color: var(--sub);
  font-size: 13px;
  line-height: 1.45;
}

.discovery-support-mobile-copy {
  display: none;
}

.discovery-support-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.discovery-support-btn {
  min-width: 108px;
  justify-content: center;
}

@media (max-width: 700px) {
  .discovery-support-banner {
    align-items: stretch;
    flex-direction: column;
    gap: 12px;
    padding: 13px;
    min-height: auto;
    overflow: visible;
  }

  .discovery-support-title {
    font-size: 14px;
  }

  .discovery-support-copy p {
    font-size: 12px;
  }

  .discovery-support-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .discovery-support-btn {
    min-width: 0;
    width: 100%;
  }
}

.bot-section {
  gap: 12px;
}

.bots-grid {
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
}

.bot-card {
  padding: 16px;
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0.01));
  border-color: rgba(255,255,255,0.06);
  box-shadow: 0 1px 0 rgba(255,255,255,0.03) inset;
}

.bot-card-top {
  align-items: flex-start;
}

.bot-card-avatar {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  font-size: 22px;
  background: rgba(255,255,255,0.04);
}

.bot-card-name {
  font-size: 16px;
}

.bot-card-desc {
  margin-top: 2px;
}

.bot-card-meta {
  margin-top: 4px;
  padding-top: 12px;
  border-top: 1px solid rgba(255,255,255,0.06);
}

@media (min-width: 961px) {
  #homeView {
    padding: 30px 34px 64px;
    gap: 14px;
  }

  #homeView .home-hero {
    display: grid;
    grid-template-columns: minmax(320px, 0.78fr) minmax(620px, 1.22fr);
    align-items: start;
    gap: 28px;
    padding: 0 6px;
  }

  #homeView .mobile-home-topbar {
    display: block;
  }

  #homeView .discovery-title-row {
    gap: 10px;
    align-items: center;
  }

  #homeView .discovery-search-open-btn {
    display: none;
  }

  #homeView .discovery-socials {
    display: inline-flex;
    gap: 8px;
    flex-wrap: nowrap;
  }

  #homeView .discovery-social-link {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
  }

  #homeView .home-toolbar {
    display: grid;
    grid-template-columns: minmax(360px, 1fr) repeat(4, max-content);
    align-items: start;
    gap: 10px;
    justify-content: end;
    justify-self: stretch;
    padding-top: 18px;
  }

  #homeView .search-field {
    min-width: 0;
    width: 100%;
    max-width: 560px;
    justify-self: end;
  }

  #homeView .home-toolbar select {
    min-width: 136px;
    max-width: 220px;
  }

  #homeView #homeSort {
    min-width: 220px;
  }

  #homeView .bot-section {
    gap: 14px;
    padding-inline: 6px;
  }

  #homeView .bots-grid {
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    gap: 20px;
  }

  #homeView .bot-card {
    border-radius: 8px;
  }
}

@media (min-width: 961px) and (max-width: 1499px) {
  #homeView .home-hero {
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
  }

  #homeView .home-toolbar {
    display: flex;
    justify-content: flex-start;
    padding-top: 0;
  }

  #homeView .search-field {
    flex: 1 1 420px;
    max-width: none;
  }

  #homeView .bots-grid {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  }
}

@media (min-width: 1500px) and (max-width: 1720px) {
  #homeView .home-hero {
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
  }

  #homeView .home-toolbar {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
    padding-top: 0;
  }

  #homeView .search-field {
    flex: 1 1 420px;
    max-width: none;
  }
}

.discovery-skeleton-grid {
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 12px;
}
.discovery-skeleton-card {
  min-height: clamp(360px, 48vh, 520px);
  position: relative;
  overflow: hidden;
  border-radius: 12px;
  background: #1b1b1c;
  border: 1px solid rgba(255,255,255,0.025);
}
.discovery-skeleton-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, transparent, rgba(255,255,255,0.035), transparent),
    radial-gradient(circle at 28% 16%, rgba(255,255,255,0.03), transparent 34%);
  transform: translateX(-100%);
  animation: discoverySkeletonSweep 1.45s ease-in-out infinite;
}
.discovery-skeleton-lines {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 14px;
  display: grid;
  gap: 8px;
}
.discovery-skeleton-lines span {
  width: 100%;
  height: 12px;
  border-radius: 4px;
  background: #2a2a2c;
}
.discovery-skeleton-lines span.wide {
  width: 66%;
}
@keyframes discoverySkeletonSweep {
  0% { transform: translateX(-100%); opacity: 0; }
  20% { opacity: 1; }
  100% { transform: translateX(100%); opacity: 0; }
}

#chatView {
  background: linear-gradient(180deg, rgba(255,255,255,0.02), transparent 26%), var(--bg);
}

.chat-topbar {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto auto;
  align-items: center;
  padding: 12px 18px;
  background: rgba(18,18,24,0.86);
  backdrop-filter: blur(16px);
}

.chat-bot-info {
  justify-self: center;
  width: min(560px, 100%);
  min-width: 0;
}

.chat-meta {
  min-width: 0;
  text-align: left;
}

.chat-name {
  font-size: 16px;
}

.chat-desc {
  max-width: 60ch;
}

.chat-actions {
  gap: 8px;
}

.chat-action-btn {
  height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
}

.messages {
  padding: 26px 22px 30px;
  gap: 18px;
}

.chat-fiction-disclaimer {
  align-self: center;
  max-width: 680px;
  margin: 2px auto 8px;
  padding: 0 12px;
  color: rgba(226, 226, 238, .72);
  font-size: 14px;
  font-weight: 560;
  line-height: 1.55;
  text-align: center;
}

.msg {
  max-width: 74%;
  gap: 10px;
}

.msg.user {
  margin-left: auto;
}

.msg-avatar {
  width: 34px;
  height: 34px;
  border-radius: 12px;
  background: rgba(255,255,255,0.04);
}

.bubble {
  border-radius: 18px;
  padding: 15px 17px;
}

.msg.user .bubble {
  border-bottom-right-radius: 6px;
  background: var(--chat-bubble-bg);
  color: var(--chat-bubble-text);
  border: 1px solid var(--chat-bubble-border);
  box-shadow: 0 0 0 1px rgba(255,255,255,0.05) inset;
}

.msg.assistant .bubble {
  border-bottom-left-radius: 6px;
  background: var(--bot-bubble-bg);
  color: var(--bot-bubble-text);
  border: 1px solid var(--bot-bubble-border);
}

.input-bar {
  padding: 14px 18px 18px;
  background: rgba(18,18,24,0.86);
  backdrop-filter: blur(16px);
}

#msgInput {
  min-height: 52px;
  max-height: 220px;
  border-radius: 14px;
  background: rgba(255,255,255,0.03);
}

#sendBtn {
  border-radius: 14px;
}

.create-topbar {
  background: rgba(18,18,24,0.86);
  backdrop-filter: blur(16px);
}

.create-body {
  max-width: 1080px;
}

.panel {
  border-radius: 18px;
  background: rgba(255,255,255,0.03);
}

.big-avatar {
  width: 84px;
  height: 84px;
  border-radius: 22px;
}

.avatar-row,
.profile-avatar-row {
  align-items: flex-start;
}

.emoji-grid {
  max-width: 520px;
}

.splash-screen {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #0a0a0d;
}

.splash-screen.hidden {
  display: none;
}

.splash-card {
  display: grid;
  justify-items: center;
  align-content: center;
  min-height: 44vh;
  gap: 12px;
  padding: 0;
  border: 0;
  background: transparent;
}

.splash-logo {
  width: clamp(68px, 18vw, 92px);
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 10px 22px rgba(0,0,0,.34));
  animation: splashLogoSettle 1.7s ease-out both;
}

.splash-title {
  color: #fff;
  font-size: clamp(26px, 6vw, 36px);
  font-weight: 850;
  letter-spacing: 0.02em;
  text-transform: none;
  animation: splashTextSettle 1.7s ease-out both;
}

.splash-trace {
  position: relative;
  width: min(96px, 28vw);
  height: 2px;
  margin-top: 2px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255,255,255,0.075);
  animation: splashTraceFade 1.7s ease-out both;
}

.splash-trace span {
  position: absolute;
  inset: 0 auto 0 0;
  width: 30%;
  border-radius: inherit;
  background: rgba(255,255,255,0.72);
  animation: splashTrace 1.18s ease-in-out infinite;
}

@keyframes splashLogoSettle {
  0% { opacity: 0; transform: translateY(8px) scale(.97); }
  55% { opacity: 1; transform: translateY(0) scale(1.015); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes splashTextSettle {
  0% { opacity: 0; transform: translateY(6px); }
  45% { opacity: 1; transform: translateY(0); }
  100% { opacity: 1; transform: translateY(0); }
}

@keyframes splashTraceFade {
  0%, 38% { opacity: 0; }
  100% { opacity: 1; }
}

@keyframes splashTrace {
  0% { transform: translateX(-120%); opacity: .25; }
  45% { opacity: 1; }
  100% { transform: translateX(300%); opacity: .25; }
}

@media (max-width: 1100px) {
  #sidebar {
    width: 230px;
    min-width: 230px;
  }

  .search-field {
    min-width: min(380px, 52vw);
  }
}

@media (max-width: 960px) {
  body {
    flex-direction: column;
  }

  #sidebar {
    display: none;
  }

  .sidebar-collapse-btn {
    display: none;
  }

  #main {
    width: 100%;
    height: var(--app-height);
  }

  #userSection {
    display: none !important;
  }

  .mobile-bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1800;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    min-height: calc(66px + env(safe-area-inset-bottom, 0px));
    padding: 8px max(8px, env(safe-area-inset-left, 0px)) calc(8px + env(safe-area-inset-bottom, 0px)) max(8px, env(safe-area-inset-right, 0px));
    border-top: 1px solid rgba(255,255,255,0.1);
    background: rgba(13,13,16,0.96);
    backdrop-filter: blur(18px);
    box-shadow: 0 -14px 38px rgba(0,0,0,0.42);
  }

  .mobile-bottom-nav-item {
    min-width: 0;
    min-height: 50px;
    display: grid;
    justify-items: center;
    align-content: center;
    gap: 4px;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: rgba(226,226,238,0.64);
    font: inherit;
    font-size: 9px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
  }

  .mobile-bottom-nav-item svg {
    width: 21px;
    height: 21px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    display: block;
  }

  .mobile-bottom-nav-item.active {
    color: #f4f4fb;
  }

  .mobile-bottom-nav-item.active::after {
    content: "";
    width: 22px;
    height: 3px;
    border-radius: 999px;
    background: currentColor;
  }

  .view {
    padding-bottom: calc(78px + env(safe-area-inset-bottom, 0px));
  }

  #chatView.active {
    padding-bottom: 0;
  }

  #homeView .bots-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }

  #homeView .bots-grid.discovery-skeleton-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

  #homeView .discovery-skeleton-card {
    min-height: min(400px, 48vh);
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.025);
    background: #1b1b1c;
  }

  #homeView .bot-card {
    min-height: 0;
    border-radius: 0;
    border: 0;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    background: transparent;
    box-shadow: none;
    padding: 16px 0;
  }

  #homeView .bot-card:hover {
    background: transparent;
    border-color: rgba(255,255,255,0.06);
    transform: none;
  }

  #homeView .bot-card:last-child {
    border-bottom: 0;
  }

  #homeView .bot-card-top,
  #homeView .bot-card-meta,
  #homeView .bot-card-footer,
  #homeView .bot-actions-row {
    padding-inline: 0;
  }

  #homeView .bot-card-top {
    margin-top: 0;
    gap: 12px;
  }

  #homeView .bot-card-name {
    font-size: 18px;
  }

  #homeView .bot-card-desc,
  #homeView .bot-card-badges,
  #homeView .bot-card-meta-text {
    display: block;
  }

  #homeView .bot-card-desc {
    margin-top: 2px;
    -webkit-line-clamp: 2;
    font-size: 13px;
    line-height: 1.5;
  }

  #homeView .bot-card-badges {
    margin-top: 4px;
  }

  #homeView .bot-card-meta {
    margin-top: 10px;
    align-items: flex-start;
  }

  #homeView .bot-card-meta::after {
    display: none;
  }

  #homeView .bot-card-actions {
    gap: 6px;
  }

  #homeView .bot-card-share-btn {
    min-height: 34px;
    padding: 0 12px;
    font-size: 11px;
  }

  .mobile-profile-logout-btn {
    display: inline-flex;
  }

  #homeView {
    padding: 20px 16px calc(92px + env(safe-area-inset-bottom, 0px));
    gap: 24px;
  }

  .home-hero {
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
  }

  .install-promo {
    width: 100%;
    grid-template-columns: minmax(0, 1fr);
  }

  .install-promo-art {
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
  }

  .install-promo-actions {
    justify-content: flex-start;
  }

  .bot-card-avatar {
    width: 54px;
    height: 54px;
    border-radius: 16px;
    font-size: 22px;
  }

  .mobile-hero-create-btn {
    display: none !important;
    align-items: center;
    justify-content: center;
    width: 100%;
  }

  .home-toolbar {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .search-field {
    min-width: 0;
    flex: 1 1 100%;
  }

  #homeSort {
    flex: 1 1 48%;
    min-width: 0;
  }

  .mobile-create-btn {
    display: none !important;
    align-items: center;
    justify-content: center;
    order: -1;
    flex: 1 1 100%;
    min-width: 0;
    height: 46px;
    border: 1px solid var(--border2);
    border-radius: 14px;
    background: var(--accent);
    color: #fff;
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 10px 24px rgba(139,124,246,.28);
  }

  .mobile-floating-create-btn {
    position: fixed;
    left: 50%;
    bottom: calc(74px + env(safe-area-inset-bottom, 0px));
    transform: translateX(-50%);
    z-index: 1810;
    display: none;
    width: min(260px, calc(100vw - 104px));
    min-height: 44px;
    padding: 0 18px;
    border: 1px solid rgba(185,175,255,0.45);
    border-radius: 12px;
    background: linear-gradient(135deg, #9b8cff, #7f6df1);
    color: #fff;
    font: inherit;
    font-size: 14px;
    font-weight: 800;
    box-shadow: 0 0 22px rgba(139,124,246,0.5), 0 14px 34px rgba(0,0,0,0.42);
    cursor: pointer;
  }

  body:has(#homeView.active) .mobile-floating-create-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  body.is-chat-open .mobile-bottom-nav,
  body.is-chat-open .mobile-floating-create-btn,
  body.is-chat-open #profileDock,
  body:has(#chatView.active) .mobile-bottom-nav,
  body:has(#chatView.active) .mobile-floating-create-btn,
  body:has(#chatView.active) #profileDock,
  body:has(#historyView.active) .mobile-bottom-nav,
  body:has(#chatStyleView.active) .mobile-bottom-nav,
  body:has(#conversationMemoryView.active) .mobile-bottom-nav,
  body:has(#historyView.active) .mobile-floating-create-btn,
  body:has(#chatStyleView.active) .mobile-floating-create-btn,
  body:has(#conversationMemoryView.active) .mobile-floating-create-btn,
  body.is-bot-detail-open .mobile-bottom-nav,
  body.is-bot-detail-open .mobile-floating-create-btn,
  body:has(#botDetailView.active) .mobile-bottom-nav,
  body:has(#botDetailView.active) .mobile-floating-create-btn {
    display: none;
  }

  #botDetailView {
    padding-bottom: calc(28px + env(safe-area-inset-bottom, 0px));
  }

  .chat-actions {
    flex-wrap: wrap;
  }

  .messages {
    padding-left: max(16px, calc(16px + env(safe-area-inset-left, 0px)));
    padding-right: max(16px, calc(16px + env(safe-area-inset-right, 0px)));
    overflow-x: hidden;
  }

  .msg {
    max-width: min(88%, calc(100vw - 48px));
    min-width: 0;
  }

  .bubble {
    font-size: var(--chat-text-size);
    line-height: 1.68;
    font-weight: 560;
    max-width: 100%;
  }

  .chat-fiction-disclaimer {
    max-width: 92%;
    margin-top: 4px;
    font-size: 13px;
  }
}

.mobile-create-btn {
  display: none;
}


.chat-actions {
  position: relative;
  margin-left: auto;
  z-index: 30;
  isolation: isolate;
}

.chat-menu-btn {
  position: relative;
  z-index: 2;
  border-radius: 12px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.07);
}

.chat-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 12px);
  min-width: 230px;
  padding: 8px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(13,13,18,0.98);
  backdrop-filter: blur(18px);
  box-shadow: 0 18px 48px rgba(0,0,0,0.35);
  z-index: 220;
  display: grid;
  gap: 4px;
  pointer-events: auto;
  opacity: 0;
  transform: translateY(-6px) scale(0.98);
  transform-origin: top right;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

body.native-app-shell.keyboard-open {
  background: var(--bg);
}

body.native-app-shell.keyboard-open #main,
body.native-app-shell.keyboard-open .view,
body.native-app-shell.keyboard-open #chatView {
  height: var(--app-height);
  max-height: var(--app-height);
}

body.native-app-shell.keyboard-open #chatView .messages {
  scroll-padding-bottom: calc(88px + env(safe-area-inset-bottom, 0px));
}

body.native-app-shell.keyboard-open .chat-topbar,
body.native-app-shell.keyboard-open .input-bar,
body.native-app-shell.keyboard-open .create-topbar,
body.native-app-shell.keyboard-open .mobile-bottom-nav {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

@keyframes chatMenuBackdropIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes mobileSlideFromLeft {
  from { opacity: 0.92; transform: translateX(-18%); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes mobileSlideFromRight {
  from { opacity: 0.96; transform: translateX(100%); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes mobileSlideToRight {
  from { opacity: 1; transform: translateX(0); }
  to { opacity: 0.96; transform: translateX(100%); }
}

.chat-menu.hidden { display: none; }
.chat-menu.is-open {
  opacity: 1;
  transform: translateY(0) scale(1);
}
.chat-menu.is-closing {
  opacity: 0;
  transform: translateY(-6px) scale(0.98);
}

.chat-menu button {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: flex-start;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
}

.chat-menu button:hover {
  background: rgba(255,255,255,0.06);
}

.mobile-home-topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.mobile-home-copy {
  min-width: 0;
}

.discovery-value-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.discovery-value-pills span {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.045);
  color: rgba(238,238,248,0.86);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.mobile-discovery-links {
  display: none;
}

.mobile-discovery-links-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--sub);
}

.mobile-discovery-links-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.mobile-discovery-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 14px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.04);
  color: var(--text);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
}
.mobile-discovery-social-link {
  gap: 0;
  padding: 0;
}
.mobile-discovery-social-link img {
  width: 20px;
  height: 20px;
  object-fit: contain;
  display: block;
}

#sidebarPatchNotesLink,
#mobilePatchNotesLink {
  position: relative;
}

#sidebarPatchNotesLink.has-update-dot::after,
#mobilePatchNotesLink.has-update-dot::after {
  content: '';
  position: absolute;
  top: 7px;
  right: 9px;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #ff4d5f;
  box-shadow: 0 0 0 2px rgba(13, 13, 16, 0.92);
}

.patch-notes-page {
  max-width: 980px;
}

.patch-notes-hero {
  display: grid;
  gap: 10px;
  padding: 22px;
  border-radius: 26px;
  border: 1px solid rgba(255,255,255,0.08);
  background:
    radial-gradient(circle at top left, rgba(139,124,246,0.16), transparent 34%),
    radial-gradient(circle at right center, rgba(120,198,255,0.10), transparent 36%),
    rgba(255,255,255,0.025);
}

.patch-notes-kicker {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #d7cdfd;
}

.patch-notes-hero h1 {
  margin: 0;
  font-size: clamp(30px, 5vw, 48px);
  line-height: 0.96;
}

.patch-notes-hero p,
.patch-notes-note {
  color: rgba(232,233,241,.8);
  line-height: 1.6;
}

.patch-notes-card {
  display: grid;
  gap: 14px;
  padding: 18px;
  border-radius: 22px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.03);
}

.patch-notes-list {
  display: grid;
  gap: 12px;
}

.patch-note-item {
  display: grid;
  gap: 6px;
  padding: 14px 0;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.patch-note-item:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.patch-note-item h2 {
  margin: 0;
  font-size: 18px;
}

.patch-note-item p {
  margin: 0;
  color: rgba(232,233,241,.8);
  line-height: 1.6;
}

.patch-syntax-grid {
  display: grid;
  grid-template-columns: minmax(110px, 0.42fr) minmax(0, 1fr);
  gap: 8px 12px;
  padding: 12px;
  border: 1px solid rgba(255,255,255,0.07);
  background: rgba(0,0,0,0.14);
  border-radius: 14px;
}

.patch-syntax-grid code {
  align-self: start;
  color: #d7cdfd;
  white-space: nowrap;
}

.patch-syntax-grid span {
  color: rgba(232,233,241,.78);
  font-size: 13px;
  line-height: 1.45;
}

.patch-syntax-list {
  display: grid;
  gap: 8px;
}

.patch-syntax-item {
  border: 1px solid rgba(255,255,255,0.07);
  background: rgba(0,0,0,0.14);
  border-radius: 14px;
  overflow: hidden;
}

.patch-syntax-item summary {
  display: grid;
  grid-template-columns: minmax(108px, 0.32fr) minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-height: 44px;
  padding: 10px 12px;
  cursor: pointer;
  list-style: none;
}

.patch-syntax-item summary::-webkit-details-marker {
  display: none;
}

.patch-syntax-item summary::after {
  content: '+';
  grid-column: 2;
  justify-self: end;
  color: var(--sub);
  font-weight: 900;
}

.patch-syntax-item[open] summary::after {
  content: '-';
}

.patch-syntax-item summary code {
  color: #d7cdfd;
  white-space: nowrap;
}

.patch-syntax-item summary span {
  padding-right: 22px;
  color: rgba(232,233,241,.78);
  font-size: 13px;
  line-height: 1.45;
}

.patch-syntax-example {
  display: grid;
  gap: 8px;
  padding: 0 12px 12px;
}

.patch-syntax-example > code {
  display: block;
  padding: 8px 10px;
  border: 1px solid rgba(255,255,255,0.07);
  background: rgba(255,255,255,0.035);
  border-radius: 10px;
  color: #d7cdfd;
  white-space: normal;
}

.patch-chat-example {
  display: grid;
  gap: 8px;
  margin-top: 6px;
  padding: 12px;
  border: 1px solid rgba(255,255,255,0.07);
  background: rgba(255,255,255,0.025);
  border-radius: 14px;
}

.patch-chat-label {
  color: var(--sub);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.patch-showcase-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.patch-showcase-card {
  display: grid;
  gap: 12px;
  align-content: start;
  padding: 14px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(0,0,0,0.14);
}

.patch-showcase-label {
  color: #d7cdfd;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.patch-showcase-card p {
  margin: 0;
  color: rgba(232,233,241,.78);
  line-height: 1.5;
  font-size: 13px;
}

.patch-plus-mini {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.patch-plus-mini div {
  display: grid;
  gap: 4px;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.09);
  background: rgba(255,255,255,.035);
}

.patch-plus-mini div.featured {
  border-color: rgba(248,178,93,.34);
  background: rgba(248,178,93,.10);
}

.patch-plus-mini strong {
  font-size: 13px;
}

.patch-plus-mini span {
  font-size: 20px;
  font-weight: 900;
}

.patch-plus-mini small,
.patch-review-demo small {
  color: rgba(168,173,203,.82);
}

.patch-review-demo {
  display: grid;
  gap: 12px;
}

.patch-review-row,
.patch-reply-demo {
  display: flex;
  gap: 9px;
  align-items: flex-start;
}

.patch-reply-demo {
  margin-left: 24px;
  padding-left: 16px;
  border-left: 1px solid rgba(255,255,255,.1);
}

.patch-avatar-dot {
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.12);
  background: linear-gradient(135deg, #42d392, #8b7cf6 55%, #f05aa6);
}

.patch-avatar-dot.small {
  width: 24px;
  height: 24px;
}

.patch-review-demo p {
  margin: 4px 0 0;
  color: rgba(232,233,241,.92);
  font-size: 13px;
  line-height: 1.4;
}

.patch-review-actions,
.patch-reply-like {
  display: flex;
  gap: 12px;
  margin-top: 6px;
  color: rgba(232,233,241,.72);
  font-size: 12px;
}

.patch-discovery-demo {
  display: grid;
  gap: 10px;
}

.patch-tabs,
.patch-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.patch-tabs span {
  padding-bottom: 5px;
  color: rgba(232,233,241,.62);
  font-weight: 800;
}

.patch-tabs span.active {
  color: #fff;
  border-bottom: 2px solid #fff;
}

.patch-tags span {
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.1);
  background: rgba(255,255,255,.04);
  color: rgba(232,233,241,.82);
  font-size: 12px;
  font-weight: 700;
}

.mobile-home-shortcuts {
  display: none;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  margin-left: auto;
}

.mobile-home-shortcut {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.04);
  color: var(--text);
  border-radius: 14px;
  padding: 10px 14px;
  min-height: 40px;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background .16s ease, border-color .16s ease, transform .16s ease;
}

.mobile-home-shortcut:hover {
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.14);
}

.mobile-home-shortcut.ghost {
  background: transparent;
  color: var(--sub);
}

.recent-item {
  gap: 8px;
}

.recent-avatar-image {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.history-topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  background: rgba(18,18,24,0.86);
  backdrop-filter: blur(16px);
}

.history-title {
  font-size: 16px;
  font-weight: 700;
}

.history-subtitle {
  margin-top: 3px;
  color: var(--sub);
  font-size: 12px;
}

.history-body {
  padding: 20px 22px 28px;
  display: grid;
  gap: 16px;
}

#historyView,
#chatStyleView,
#conversationMemoryView,
.credit-history-list,
.archive-modal-body {
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: var(--border2) transparent;
}

#historyView::-webkit-scrollbar,
#chatStyleView::-webkit-scrollbar,
#conversationMemoryView::-webkit-scrollbar,
.credit-history-list::-webkit-scrollbar,
.archive-modal-body::-webkit-scrollbar {
  width: 10px;
}

#historyView::-webkit-scrollbar-track,
#chatStyleView::-webkit-scrollbar-track,
#conversationMemoryView::-webkit-scrollbar-track,
.credit-history-list::-webkit-scrollbar-track,
.archive-modal-body::-webkit-scrollbar-track {
  background: transparent;
}

#historyView::-webkit-scrollbar-thumb,
#chatStyleView::-webkit-scrollbar-thumb,
#conversationMemoryView::-webkit-scrollbar-thumb,
.credit-history-list::-webkit-scrollbar-thumb,
.archive-modal-body::-webkit-scrollbar-thumb {
  background: rgba(50, 50, 62, 0.92);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: content-box;
}

.history-list {
  display: grid;
  gap: 12px;
}

.history-actions {
  justify-content: flex-start;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.history-card {
  border: 1px solid rgba(255,255,255,0.06);
  background: rgba(255,255,255,0.03);
  border-radius: 18px;
  padding: 16px;
  display: grid;
  gap: 12px;
}

.history-card-head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.history-card-avatar {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  background: rgba(255,255,255,0.04);
  display: grid;
  place-items: center;
  overflow: hidden;
  flex-shrink: 0;
}

.history-card-avatar .recent-emoji {
  font-size: 22px;
}

.history-card-avatar .recent-avatar-image {
  width: 100%;
  height: 100%;
}

.history-card-main {
  min-width: 0;
  flex: 1;
}

.history-card-title {
  font-size: 15px;
  font-weight: 700;
}

.history-card-subtitle {
  margin-top: 3px;
  color: var(--sub);
  font-size: 12px;
}

.history-card-sessions {
  display: grid;
  gap: 8px;
}

.history-session {
  text-align: left;
  width: 100%;
  border: 1px solid rgba(255,255,255,0.05);
  background: rgba(255,255,255,0.02);
  color: var(--text);
  padding: 12px;
  border-radius: 14px;
  cursor: pointer;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) minmax(0, 1.2fr) auto;
  align-items: center;
  gap: 8px;
}

.history-session:hover {
  background: rgba(255,255,255,0.05);
}

.history-session-select {
  display: flex;
  align-items: center;
  justify-content: center;
}

.history-session-select input {
  width: 16px;
  height: 16px;
}

.history-open-btn {
  white-space: nowrap;
}

.history-session-title {
  font-weight: 600;
  font-size: 13px;
}

.history-session-meta,
.history-session-preview {
  color: var(--sub);
  font-size: 12px;
  line-height: 1.4;
}

.history-empty {
  color: var(--sub);
  padding: 22px 4px;
}

#yourCharactersView {
  padding: 0;
  scrollbar-gutter: stable;
  overflow-anchor: none;
  scrollbar-width: thin;
  scrollbar-color: rgba(80, 83, 98, 0.9) rgba(255,255,255,0.02);
}

#yourCharactersView::-webkit-scrollbar {
  width: 10px;
}

#yourCharactersView::-webkit-scrollbar-track {
  background: rgba(255,255,255,0.02);
  border-radius: 999px;
}

#yourCharactersView::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(110,113,132,0.95), rgba(47,49,61,0.95));
  border: 2px solid rgba(10,10,15,0.98);
  border-radius: 999px;
  background-clip: padding-box;
}

#yourCharactersView .create-topbar {
  position: sticky;
  top: 0;
  z-index: 6;
  margin: 0;
  padding: 14px 20px;
  background: rgba(18,18,24,0.86);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(18px);
}

#yourCharactersView .your-characters-page {
  gap: 16px;
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
  padding: 28px;
}

#yourCharactersView .your-characters-hero {
  position: relative;
  overflow: hidden;
  align-items: center;
  padding: 24px;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 20px;
  background: rgba(255,255,255,0.04);
  box-shadow: 0 18px 48px rgba(0,0,0,0.18);
}

#yourCharactersView .your-characters-hero::after {
  content: none;
}

#yourCharactersView .your-characters-hero h1 {
  font-size: clamp(28px, 4.6vw, 54px);
  line-height: 0.96;
  letter-spacing: -0.06em;
}

#yourCharactersView .your-characters-hero p {
  margin-top: 10px;
  max-width: 560px;
  line-height: 1.55;
}

#yourCharactersView .your-characters-hero .btn-save {
  position: relative;
  z-index: 1;
  min-height: 44px;
  border-radius: 14px;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
  box-shadow: 0 12px 26px rgba(139,124,246,0.24);
}

#yourCharactersView .your-characters-toolbar {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 22px;
  background: rgba(255,255,255,0.035);
}

#yourCharactersView .search-field {
  min-width: 0;
  width: 100%;
  height: 48px;
  padding: 0 14px;
  border-radius: 16px;
  border-color: rgba(255,255,255,0.08);
  background: rgba(3,4,8,0.42);
}

#yourCharactersView .search-field input {
  height: 46px;
  font-size: 14px;
}

#yourCharactersView .mini-btn {
  min-height: 42px;
  border-radius: 14px;
  background: rgba(255,255,255,0.045);
  border-color: rgba(255,255,255,0.08);
}

#yourCharactersView .mini-btn.danger {
  color: #ffd0d0;
  background: rgba(255,87,87,0.09);
  border-color: rgba(255,107,107,0.28);
}

#yourCharactersView .mini-btn:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

#yourCharactersStatus {
  margin: 0;
  padding: 0 4px;
  font-size: 12px;
}

.your-characters-grid {
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 16px;
}

.your-characters-grid .history-empty {
  grid-column: 1 / -1;
  padding: 28px;
  border: 1px dashed rgba(255,255,255,0.12);
  border-radius: 22px;
  background: rgba(255,255,255,0.025);
  text-align: center;
}

.your-character-card {
  position: relative;
  display: grid;
  gap: 14px;
  padding: 16px;
  border-radius: 22px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.055), rgba(255,255,255,0.018)),
    #111118;
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: 0 14px 36px rgba(0,0,0,0.2);
  cursor: pointer;
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}

.your-character-card:hover {
  transform: translateY(-2px);
  border-color: rgba(255,255,255,0.16);
}

.your-character-header {
  display: grid;
  grid-template-columns: 62px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding-right: 28px;
}

.your-character-avatar {
  width: 62px;
  height: 62px;
  border-radius: 18px;
  overflow: hidden;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: 0 12px 28px rgba(0,0,0,0.24);
}

.your-character-avatar .avatar-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.your-character-copy {
  min-width: 0;
}

.your-character-copy h3 {
  margin: 0;
  font-size: 16px;
  line-height: 1.15;
  letter-spacing: -0.02em;
  display: -webkit-box;
  overflow: hidden;
  overflow-wrap: anywhere;
  word-break: break-word;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.your-character-copy p {
  margin: 7px 0 0;
  color: var(--sub);
  font-size: 12px;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.your-character-stats {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.your-character-stat {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 24px;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.045);
  color: rgba(221,226,255,0.86);
  font-size: 11px;
  font-weight: 800;
}

.your-character-stat svg {
  width: 13px;
  height: 13px;
  color: rgba(154,170,255,0.95);
}

.your-character-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  align-content: flex-start;
  gap: 6px;
}

.your-character-chip {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: flex-start;
  max-width: 100%;
  min-height: 22px;
  height: auto;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.09);
  background: rgba(255,255,255,0.055);
  color: rgba(235,238,255,0.84);
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}

.your-character-chip.danger {
  border-color: rgba(255,107,107,0.36);
  background: rgba(255,82,82,0.14);
  color: #ffc2c2;
}

.your-character-select {
  top: 14px;
  right: 14px;
  width: 22px;
  height: 22px;
  border-radius: 7px;
  box-shadow: 0 8px 18px rgba(0,0,0,0.32);
}

.your-character-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0;
}

.your-character-action-btn {
  flex: 1 1 42px;
  min-width: 42px;
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 10px;
  border: 1px solid rgba(255,255,255,0.09);
  border-radius: 13px;
  background: rgba(255,255,255,0.045);
  color: rgba(235,238,255,0.88);
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.your-character-action-btn svg {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
  display: block;
}

.your-character-action-btn.danger {
  color: #ffd0d0;
  background: rgba(255,87,87,0.09);
  border-color: rgba(255,107,107,0.28);
}

.brand-confirm-modal {
  position: fixed;
  inset: 0;
  z-index: 2600;
  display: grid;
  place-items: center;
  padding: 18px;
  background:
    radial-gradient(circle at 50% 18%, rgba(139,124,246,0.16), transparent 34%),
    rgba(4,5,8,0.76);
  backdrop-filter: blur(14px);
}

.brand-confirm-modal.hidden {
  display: none;
}

.brand-confirm-card {
  width: min(420px, 100%);
  padding: 22px;
  border-radius: 26px;
  border: 1px solid rgba(255,255,255,0.1);
  background:
    linear-gradient(180deg, rgba(255,255,255,0.075), rgba(255,255,255,0.03)),
    #101018;
  box-shadow: 0 28px 90px rgba(0,0,0,0.48);
}

.brand-confirm-logo {
  width: 54px;
  height: 54px;
  border-radius: 16px;
  object-fit: cover;
  margin-bottom: 14px;
  box-shadow: 0 16px 34px rgba(0,0,0,0.34);
}

#aimodelratingView .ai-model-rating-toolbar,
#aimodelratingView .ai-model-rating-detail-head,
#aimodelratingView .ai-model-rating-summary-card,
#aimodelratingView .ai-model-rating-form-card,
#aimodelratingView .ai-model-comments-card,
#aimodelratingView .ai-model-card,
#aimodelratingView .ai-model-comment,
#settingsView .profile-avatar-row-flat,
#settingsView .profile-settings-guide .settings-guide-card {
  border-radius: 0;
  box-shadow: none;
}

#aimodelratingView .ai-model-rating-toolbar,
#aimodelratingView .ai-model-rating-detail-head,
#aimodelratingView .ai-model-rating-summary-card,
#aimodelratingView .ai-model-rating-form-card,
#aimodelratingView .ai-model-comments-card,
#aimodelratingView .ai-model-card,
#aimodelratingView .ai-model-comment {
  background: rgba(255,255,255,0.02);
}

.brand-confirm-title {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.brand-confirm-copy {
  margin-top: 8px;
  color: var(--sub);
  line-height: 1.55;
}

.brand-confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

.brand-confirm-actions .mini-btn {
  min-height: 42px;
  border-radius: 14px;
}

.brand-confirm-actions .danger {
  background: linear-gradient(135deg, #ffeded, #ff7777);
  border-color: rgba(255,255,255,0.16);
  color: #220506;
  font-weight: 800;
}

.premium-portrait-modal {
  position: fixed;
  inset: 0;
  z-index: 2800;
  display: grid;
  place-items: center;
  padding: 18px;
  background:
    radial-gradient(circle at 50% 0%, rgba(255,211,110,0.18), transparent 36%),
    rgba(4,5,8,0.8);
  backdrop-filter: blur(16px);
}

.premium-portrait-modal.hidden {
  display: none;
}

.premium-portrait-modal-card {
  width: min(560px, 100%);
  display: grid;
  gap: 16px;
  padding: 22px;
  border-radius: 28px;
  border: 1px solid rgba(255,215,126,0.2);
  background:
    radial-gradient(circle at top left, rgba(255,217,120,0.16), transparent 34%),
    linear-gradient(180deg, rgba(255,255,255,0.06), rgba(255,255,255,0.025)),
    #0d1019;
  box-shadow: 0 34px 90px rgba(0,0,0,0.52);
}

.premium-portrait-modal-kicker {
  display: inline-flex;
  align-self: flex-start;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255,215,126,0.24);
  background: rgba(255,215,126,0.12);
  color: #ffe4a2;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.premium-portrait-modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.premium-portrait-modal-title {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.premium-portrait-modal-copy {
  color: var(--sub);
  line-height: 1.6;
}

.premium-portrait-modal-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.premium-portrait-modal-note {
  padding: 14px;
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.04);
}

.premium-portrait-modal-note strong {
  display: block;
  margin-bottom: 4px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.premium-portrait-modal-note span {
  color: var(--sub);
  font-size: 12px;
  line-height: 1.55;
}

.premium-portrait-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.premium-portrait-modal-actions .mini-btn {
  min-height: 44px;
  border-radius: 14px;
}

.premium-portrait-modal-actions .premium-portrait-confirm {
  background: linear-gradient(135deg, #ffe4a3, #ffb84d);
  color: #221200;
  border-color: rgba(255,255,255,0.18);
  font-weight: 800;
}

.premium-portrait-create-panel {
  border-color: rgba(255, 215, 126, .22);
  background:
    radial-gradient(circle at 22% 0%, rgba(255, 218, 130, .14), transparent 30%),
    rgba(255,255,255,.035);
}

.premium-portrait-toggle {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 10px 12px;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 8px;
  background: rgba(0,0,0,.14);
  cursor: pointer;
}

.premium-portrait-toggle input {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  accent-color: #ffd36e;
}

.premium-portrait-toggle span {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.premium-portrait-toggle strong {
  color: #ffe3a3;
  font-size: 13px;
}

.premium-portrait-toggle small {
  color: rgba(255,255,255,.68);
  line-height: 1.35;
}

.premium-portrait-create-panel select:disabled {
  opacity: .58;
  cursor: not-allowed;
}

.floating-tooltip {
  position: fixed;
  z-index: 2147483000;
  width: max-content;
  max-width: min(300px, calc(100vw - 20px));
  padding: 9px 11px;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 10px;
  background: rgba(12,14,22,0.97);
  color: rgba(246,248,255,0.94);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
  white-space: normal;
  box-shadow: 0 14px 34px rgba(0,0,0,0.42);
  opacity: 0;
  pointer-events: none;
  transform: translateY(4px);
  transition: opacity .14s ease, transform .14s ease;
}

.floating-tooltip.visible {
  opacity: 1;
  transform: translateY(0);
}

.detail-icon-only {
  width: 42px;
  min-width: 42px;
  height: 42px;
  padding: 0;
  display: inline-grid;
  place-items: center;
}

.detail-icon-only svg {
  width: 18px;
  height: 18px;
}

.persona-modal-form {
  gap: 16px;
}

.persona-tutorial-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 16px;
  background: rgba(255,255,255,0.035);
}

.persona-tutorial-step {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 8px 10px;
  align-items: center;
  min-width: 0;
}

.persona-tutorial-icon,
.persona-export-card-icon {
  display: grid;
  place-items: center;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.055);
  color: rgba(176,190,255,0.95);
}

.persona-tutorial-icon {
  grid-row: span 2;
  width: 38px;
  height: 38px;
  border-radius: 12px;
}

.persona-tutorial-icon svg,
.persona-export-card-icon svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.persona-tutorial-step strong {
  min-width: 0;
  font-size: 13px;
  line-height: 1.15;
}

.persona-tutorial-step small {
  grid-column: 2;
  min-width: 0;
  color: var(--sub);
  font-size: 12px;
  line-height: 1.35;
}

.persona-export-card {
  align-content: start;
}

.persona-export-card-icon {
  width: 42px;
  height: 42px;
  margin-bottom: 10px;
  border-radius: 14px;
}

.persona-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.persona-icon-btn svg,
.persona-export-card .mini-btn svg {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
}

[data-tooltip]::before,
[data-tooltip]::after {
  content: none !important;
  display: none !important;
}

@media (max-width: 760px) {
  #yourCharactersView {
    padding: 0;
  }

  #yourCharactersView .create-topbar {
    padding: 12px 14px;
  }

  #yourCharactersView .your-characters-page {
    gap: 12px;
    padding: 14px;
  }

  #yourCharactersView .your-characters-hero {
    display: grid;
    gap: 16px;
    padding: 18px;
    border-radius: 22px;
  }

  #yourCharactersView .your-characters-hero h1 {
    font-size: 34px;
  }

  #yourCharactersView .your-characters-hero p {
    font-size: 13px;
  }

  #yourCharactersView .your-characters-hero .btn-save {
    width: 100%;
  }

  #yourCharactersView .your-characters-toolbar {
    grid-template-columns: 1fr;
    padding: 10px;
    border-radius: 18px;
  }

  #yourCharactersView .search-field {
    flex: none;
    height: 46px;
  }

  #yourCharactersView .search-field input {
    height: 44px;
    font-size: 13px;
  }

  #yourCharactersView .your-characters-toolbar > .mini-btn {
    width: 100%;
  }

  .your-characters-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .your-character-card {
    gap: 12px;
    padding: 14px;
    border-radius: 20px;
  }

  .your-character-header {
    grid-template-columns: 54px minmax(0, 1fr);
    gap: 10px;
  }

  .your-character-avatar {
    width: 54px;
    height: 54px;
    border-radius: 16px;
  }

  .your-character-actions {
    gap: 6px;
  }

  .your-character-action-btn {
    flex: 1 1 40px;
    min-height: 36px;
    padding: 7px;
    font-size: 0;
    gap: 0;
  }

  .your-character-action-btn svg {
    width: 17px;
    height: 17px;
  }

  .your-character-action-btn span {
    display: none;
  }

  .brand-confirm-card {
    padding: 18px;
    border-radius: 22px;
  }

  .brand-confirm-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .persona-tutorial-strip {
    grid-template-columns: 1fr;
    padding: 10px;
  }

  .persona-tutorial-step {
    grid-template-columns: 34px minmax(0, 1fr);
  }

  .persona-tutorial-icon {
    width: 34px;
    height: 34px;
    border-radius: 11px;
  }
}

.recent-chats-page {
  max-width: 980px;
}

.recent-chats-panel {
  display: grid;
  gap: 16px;
}

#recentChatsView .mobile-recent-your-characters-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  width: min(260px, 100%);
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  background: rgba(255,255,255,0.045);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  font-weight: 800;
  box-shadow: none;
  cursor: pointer;
}

#recentChatsView .mobile-recent-your-characters-btn svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: .9;
}

#recentChatsView .mobile-recent-your-characters-btn:active {
  transform: scale(.99);
  background: rgba(255,255,255,0.07);
}

.recent-chats-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.recent-chats-search {
  min-width: min(320px, 100%);
  flex: 1 1 280px;
}

.recent-chats-list {
  display: grid;
  gap: 2px;
}

.recent-chats-selection-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
}

.recent-chats-selection-bar:not(.is-active) .recent-clear-selection-btn,
.recent-chats-selection-bar:not(.is-active) .recent-delete-selected-btn {
  display: none;
}

.recent-chats-selection-bar .icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
}

.recent-chats-selection-bar .icon-btn svg,
.recent-chat-select-indicator svg,
.pinned-memory-head .icon-btn svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.recent-selection-count {
  color: var(--sub);
  font-size: 12px;
  font-weight: 700;
}

.recent-chats-loading {
  min-height: 140px;
  display: grid;
  place-items: center;
  gap: 12px;
  color: var(--sub);
  font-size: 14px;
  text-align: center;
}

.recent-chats-loading-spinner {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 3px solid rgba(255,255,255,0.12);
  border-top-color: rgba(255,255,255,0.82);
  animation: spin 0.9s linear infinite;
}

.recent-chat-card {
  width: 100%;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  text-align: left;
  border: 0;
  background: transparent;
  color: var(--text);
  border-radius: 0;
  padding: 12px 4px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.recent-chats-list.selection-mode .recent-chat-card {
  grid-template-columns: auto auto minmax(0, 1fr);
}

.recent-chat-card:hover {
  background: rgba(255,255,255,0.04);
}

.recent-chat-card.selected {
  background: rgba(139,124,246,0.12);
}

.recent-chat-select-indicator {
  width: 24px;
  height: 24px;
  display: none;
  place-items: center;
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 999px;
  color: transparent;
  background: rgba(255,255,255,0.035);
}

.recent-chats-list.selection-mode .recent-chat-select-indicator {
  display: inline-grid;
}

.recent-chat-card.selected .recent-chat-select-indicator {
  color: #fff;
  border-color: rgba(139,124,246,0.78);
  background: rgba(139,124,246,0.78);
}

.recent-chat-card:active,
.recent-chat-card:focus:not(:focus-visible),
.bot-card:active,
.bot-card:focus:not(:focus-visible),
.recent-item:active,
.recent-item:focus:not(:focus-visible),
.your-character-card:active,
.your-character-card:focus:not(:focus-visible),
.detail-full-image-link:active,
.detail-full-image-link:focus:not(:focus-visible) {
  outline: none;
  background-color: transparent;
}

.recent-chat-card:focus-visible,
.bot-card:focus-visible,
.recent-item:focus-visible,
.your-character-card:focus-visible,
.detail-full-image-link:focus-visible {
  outline: 2px solid rgba(139,124,246,0.72);
  outline-offset: 3px;
}

.recent-chat-card-avatar {
  width: 58px;
  height: 58px;
  border-radius: 999px;
  background: rgba(255,255,255,0.04);
  display: grid;
  place-items: center;
  overflow: hidden;
  flex-shrink: 0;
}

.recent-chat-card-avatar .recent-avatar-image {
  width: 100%;
  height: 100%;
}

.recent-chat-card-copy {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.recent-chat-card-top {
  display: flex;
  align-items: baseline;
  justify-content: flex-start;
  gap: 8px;
}

.recent-chat-card-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 18px;
  line-height: 1.15;
  font-weight: 800;
  color: rgba(246,246,255,0.96);
}

.recent-chat-card-date,
.recent-chat-card-subtitle,
.recent-chat-card-preview {
  color: var(--sub);
  font-size: 13px;
  line-height: 1.45;
}

.recent-chat-card-date {
  white-space: nowrap;
  font-size: 12px;
  opacity: 0.82;
  order: 2;
}

.recent-chat-card-preview {
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.recent-chat-card-subtitle {
  color: rgba(232,232,238,0.82);
  font-weight: 700;
}

.loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 7100;
  display: grid;
  place-items: center;
  background: rgba(6, 6, 10, 0.72);
  backdrop-filter: blur(12px);
}

.loading-overlay.hidden {
  display: none;
}

.loading-card {
  min-width: 260px;
  padding: 26px 28px;
  border-radius: 24px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(15,15,20,0.92);
  display: grid;
  justify-items: center;
  gap: 12px;
}

.loading-logo {
  width: 64px;
  height: 64px;
}

.loading-title {
  font-size: 20px;
  font-weight: 700;
}

.loading-subtitle {
  color: var(--sub);
  font-size: 13px;
  text-align: center;
}

.loading-spinner {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 3px solid rgba(255,255,255,0.14);
  border-top-color: rgba(255,255,255,0.8);
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes skeleton-shimmer {
  0% { background-position: 180% 0; }
  100% { background-position: -40% 0; }
}

.mobile-pull-refresh {
  position: fixed;
  top: max(12px, env(safe-area-inset-top));
  left: 50%;
  z-index: 7200;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -18px) scale(0.96);
  transition: opacity 160ms ease, transform 160ms ease;
}

.mobile-pull-refresh.is-visible {
  opacity: 1;
}

.mobile-pull-refresh.is-ready {
  transform: translate(-50%, 8px) scale(1);
}

.mobile-pull-refresh.is-loading {
  opacity: 1;
  transform: translate(-50%, 8px) scale(1);
}

.mobile-pull-refresh-pill {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px 0 12px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(18,18,24,0.92);
  color: rgba(248,248,255,0.94);
  box-shadow: 0 16px 42px rgba(0,0,0,0.36);
  backdrop-filter: blur(14px);
  font-size: 12px;
  font-weight: 800;
}

.mobile-pull-refresh-spinner {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.16);
  border-top-color: rgba(255,255,255,0.9);
  transform: rotate(var(--pull-rotation, 0deg));
}

.mobile-pull-refresh.is-loading .mobile-pull-refresh-spinner,
.app-loading-dots span {
  animation: spin 0.78s linear infinite;
}

.app-loading-modal {
  position: fixed;
  inset: 0;
  z-index: 7300;
  display: grid;
  place-items: center;
  padding: 22px;
}

.app-loading-modal.hidden {
  display: none;
}

.app-loading-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(6,6,10,0.68);
  backdrop-filter: blur(14px);
}

.app-loading-card {
  position: relative;
  width: min(310px, 100%);
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 24px 22px;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 24px;
  background:
    radial-gradient(circle at 50% 0%, rgba(139,124,246,0.2), transparent 48%),
    rgba(16,16,22,0.94);
  box-shadow: 0 24px 70px rgba(0,0,0,0.42);
  text-align: center;
  animation: appLoadingCardIn 220ms ease-out both;
}

.app-loading-logo {
  width: 58px;
  height: 58px;
  border-radius: 18px;
  object-fit: cover;
  box-shadow: 0 12px 30px rgba(0,0,0,0.3);
}

.app-loading-title {
  font-size: 18px;
  font-weight: 900;
}

.app-loading-copy {
  color: var(--sub);
  font-size: 13px;
  line-height: 1.45;
}

.app-loading-dots {
  display: inline-flex;
  gap: 7px;
  margin-top: 4px;
}

.app-loading-dots span {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: rgba(255,255,255,0.86);
  animation-name: appLoadingDot;
  animation-duration: 0.9s;
  animation-timing-function: ease-in-out;
  animation-iteration-count: infinite;
}

.app-loading-dots span:nth-child(2) { animation-delay: 0.12s; }
.app-loading-dots span:nth-child(3) { animation-delay: 0.24s; }

@keyframes appLoadingCardIn {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes appLoadingDot {
  0%,
  100% {
    opacity: 0.38;
    transform: translateY(0);
  }
  50% {
    opacity: 1;
    transform: translateY(-5px);
  }
}

.archive-modal {
  position: fixed;
  inset: 0;
  z-index: 2400;
  display: grid;
  place-items: center;
  background: rgba(6, 6, 10, 0.72);
  padding: 20px;
}

.archive-modal.hidden { display: none; }

.archive-modal-card {
  width: min(780px, 100%);
  max-height: min(84vh, 900px);
  overflow: hidden;
  border-radius: 22px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(14,14,18,0.98);
  display: grid;
  grid-template-rows: auto 1fr;
}

.archive-modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.archive-modal-title {
  font-size: 16px;
  font-weight: 700;
}

.archive-modal-subtitle {
  margin-top: 3px;
  color: var(--sub);
  font-size: 12px;
}

.archive-modal-body {
  overflow-y: auto;
  padding: 18px;
  display: grid;
  gap: 12px;
}

.archive-msg {
  display: grid;
  gap: 6px;
}

.archive-msg.user .archive-msg-bubble {
  justify-self: end;
}

.archive-msg.assistant .archive-msg-bubble {
  justify-self: start;
}

.archive-msg-meta {
  color: var(--sub);
  font-size: 11px;
}

.archive-msg-bubble {
  max-width: 85%;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.06);
  background: rgba(255,255,255,0.04);
  color: var(--text);
  white-space: pre-wrap;
  line-height: 1.5;
}

.memory-panel.hidden { display: none; }

#historyView,
#chatStyleView,
#conversationMemoryView {
  display: none;
}

#historyView.active,
#chatStyleView.active,
#conversationMemoryView.active {
  display: flex;
  flex-direction: column;
}

.chat-style-body {
  gap: 16px;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding-bottom: calc(92px + env(safe-area-inset-bottom, 0px));
  scroll-padding-bottom: calc(92px + env(safe-area-inset-bottom, 0px));
}

.chat-style-panel {
  width: min(760px, 100%);
  display: grid;
  gap: 12px;
}

.chat-style-model-field {
  display: grid;
  gap: 10px;
}

.chat-style-model-browser {
  display: grid;
  gap: 28px;
}

.chat-style-model-section {
  display: grid;
  gap: 14px;
}

.chat-style-section-head {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding-bottom: 4px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
}

.chat-style-section-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0;
  border-radius: 0;
  color: #f4f1ff;
  font-size: 18px;
  font-weight: 850;
  line-height: 1;
  letter-spacing: 0;
}

.chat-style-section-pill::before {
  content: "";
  width: 8px;
  height: 24px;
  margin-right: 10px;
  border-radius: 999px;
  background: #75f0a0;
  box-shadow: 0 0 18px rgba(117,240,160,0.3);
}

.chat-style-section-pill.custom::before {
  background: #9f8cff;
  box-shadow: 0 0 18px rgba(159,140,255,0.34);
}

.chat-style-section-pill.advanced::before {
  background: #66d9ef;
  box-shadow: 0 0 18px rgba(102,217,239,0.28);
}

.chat-style-section-note {
  min-width: 0;
  color: rgba(235,235,246,0.58);
  font-size: 12px;
  line-height: 1.35;
}

.chat-style-model-row {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(240px, 280px);
  gap: 14px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  padding: 1px 2px 12px;
  scrollbar-width: thin;
  scrollbar-color: rgba(159,140,255,0.42) rgba(255,255,255,0.06);
}

.chat-style-model-row::-webkit-scrollbar {
  height: 7px;
}

.chat-style-model-row::-webkit-scrollbar-track {
  border-radius: 999px;
  background: rgba(255,255,255,0.06);
}

.chat-style-model-row::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(159,140,255,0.48);
}

.chat-style-model-card {
  position: relative;
  min-height: 210px;
  display: grid;
  grid-template-rows: auto minmax(78px, 1fr) auto;
  gap: 16px;
  padding: 24px;
  border: 1px solid rgba(255,255,255,0.055);
  border-radius: 12px;
  background: #242427;
  color: #fff;
  text-align: left;
  font: inherit;
  cursor: pointer;
}

.chat-style-model-card.selected {
  border-color: rgba(137,112,255,0.72);
  box-shadow: 0 0 0 1px rgba(137,112,255,0.34), 0 16px 36px rgba(0,0,0,0.28);
}

.chat-style-model-card.chayt-mode-card {
  min-height: 280px;
  grid-template-rows: auto minmax(58px, auto) minmax(58px, 1fr) auto;
  align-content: stretch;
  background: linear-gradient(180deg, rgba(48,46,58,0.98), rgba(35,35,39,0.98));
  border-color: rgba(117,240,160,0.12);
}

.chat-style-model-card.chayt-mode-card.selected {
  border-color: rgba(117,240,160,0.62);
  box-shadow: 0 0 0 1px rgba(117,240,160,0.24), 0 16px 36px rgba(0,0,0,0.28);
}

.chat-style-model-title {
  display: block;
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(255,255,255,0.055);
  font-size: 20px;
  font-weight: 900;
  line-height: 1.18;
  letter-spacing: 0;
}

.chat-style-model-desc {
  display: block;
  color: rgba(245,245,250,0.66);
  font-size: 14px;
  line-height: 1.45;
}

.chat-style-model-includes {
  display: grid;
  align-self: start;
  gap: 5px;
  color: rgba(245,245,250,0.54);
  font-size: 11px;
  line-height: 1.35;
}

.chat-style-model-includes span {
  color: rgba(245,245,250,0.78);
  font-size: 10px;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.chat-style-model-foot {
  display: flex;
  align-self: end;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
  color: rgba(245,245,250,0.5);
  font-size: 11px;
  line-height: 1.2;
}

.chat-style-safety-pill {
  flex: 0 0 auto;
  color: rgba(255,255,255,0.74);
  font-size: 12px;
  font-weight: 800;
}

.chat-style-energy-note {
  max-width: 118px;
  text-align: right;
}

.setting-help { margin-top: 6px; font-size: 11px; line-height: 1.45; color: var(--sub); }
.setting-help.full-line { margin-top: 10px; }
#chatView.menu-open .chat-topbar { z-index: 40; }
body.is-chat-open #profileDock,
body[data-current-view="chat"] #profileDock,
body:has(#chatView.active) #profileDock {
  display: none !important;
  pointer-events: none !important;
}


/* ── Added discovery / auth styles ─────────────────── */
.sidebar-top { gap: 12px; }
.auth-box {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--card);
}
.auth-title { font-size: 12px; font-weight: 700; color: var(--sub); text-transform: uppercase; letter-spacing: .8px; }
.auth-status { font-size: 12px; line-height: 1.4; color: var(--text); }
.auth-box input {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text);
  font: inherit;
  padding: 9px 10px;
  outline: none;
}
.auth-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.auth-actions .mini-btn { padding-inline: 10px; }
.section-subtitle { color: var(--sub); font-size: 12px; margin-top: -10px; }
.home-toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.home-toolbar select {
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 9px 10px;
  font: inherit;
}
.bot-card-top { align-items: flex-start; }
.bot-card-avatar { width: 48px; height: 48px; border-radius: 14px; overflow: hidden; background: var(--surface); flex-shrink: 0; border: 1px solid var(--border); }
.bot-card-copy { display: grid; gap: 6px; }
.bot-card-created { font-size: 11px; color: var(--sub); line-height: 1.35; }
.bot-card-badges { font-size: 11px; color: var(--sub); line-height: 1.4; }
.bot-card-meta { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.bot-card-meta-text { flex: 1; min-width: 0; }
.bot-card-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.bot-card-share-btn {
  appearance: none;
  border: 1px solid rgba(139,124,246,.35);
  background: rgba(139,124,246,.12);
  color: var(--accent);
  border-radius: 999px;
  padding: 6px 10px;
  font: inherit;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.bot-card-share-btn:hover {
  background: rgba(139,124,246,.2);
  border-color: rgba(139,124,246,.5);
  color: #fff;
}
.bot-card-share-btn.ghost {
  background: rgba(255,255,255,.04);
  border-color: rgba(255,255,255,.08);
  color: var(--text);
}
.bot-card-share-btn.ghost:hover {
  background: rgba(255,255,255,.08);
  border-color: rgba(255,255,255,.14);
}
.developer-card-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
  margin-top: 8px;
}
.bot-card-share-btn.danger {
  border-color: rgba(255,91,91,.35);
  color: #ffb4b4;
}
.bot-card-share-btn.danger:hover {
  background: rgba(255,91,91,.12);
  border-color: rgba(255,91,91,.55);
}
.bot-card-icon-btn {
  width: 34px;
  height: 34px;
  display: inline-grid;
  place-items: center;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.04);
  color: rgba(232,233,241,.82);
  cursor: pointer;
  transition: background .16s ease, border-color .16s ease, color .16s ease;
}
.bot-card-icon-btn:hover {
  background: rgba(255,255,255,.08);
  border-color: rgba(255,255,255,.18);
  color: #fff;
}
.bot-card-icon-btn svg {
  width: 17px;
  height: 17px;
  display: block;
  pointer-events: none;
}

.detail-share-icon-btn {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  display: inline-grid;
  place-items: center;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(255,255,255,.045);
  color: rgba(244,244,251,.9);
  cursor: pointer;
}

.detail-share-icon-btn:hover {
  background: rgba(255,255,255,.08);
  border-color: rgba(255,255,255,.22);
  color: #fff;
}

.detail-share-icon-btn svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.bot-card-meta::after {
  content: 'Open';
  font-size: 11px;
  color: var(--accent);
  border: 1px solid rgba(139,124,246,.35);
  padding: 4px 8px;
  border-radius: 999px;
}
.recent-avatar-image { width: 22px; height: 22px; border-radius: 999px; object-fit: cover; }
.msg-image { max-width: 100%; border-radius: 14px; margin-top: 10px; display: block; border: 1px solid var(--border); }
.chat-desc { max-width: 100%; line-height: 1.45; }
.chat-menu button[data-action="rate"] { color: var(--accent); }
.chat-credit-pill {
  display: none !important;
}
.chat-topbar .chat-actions {
  flex: 0 0 auto;
  margin-left: 0;
}

@media (min-width: 961px) {
  body.chat-layout-center #chatView .messages {
    width: min(700px, calc(100% - 96px));
    align-self: center;
    padding-left: 0;
    padding-right: 0;
  }

  body.chat-layout-center #chatView .chat-fiction-disclaimer {
    width: min(700px, 100%);
    max-width: 100%;
  }

  body.chat-layout-center #chatView .msg {
    width: fit-content;
    inline-size: fit-content;
    max-width: 100%;
  }

  body.chat-layout-center #chatView .msg.assistant {
    align-self: flex-start;
    max-width: min(92%, 640px);
  }

  body.chat-layout-center #chatView .msg-body {
    flex: 0 1 auto;
    width: fit-content;
    inline-size: fit-content;
    max-width: 100%;
  }

  body.chat-layout-center #chatView .msg.assistant .msg-body {
    align-items: flex-start;
  }

  body.chat-layout-center #chatView .msg.user .msg-body {
    align-items: flex-end;
  }

  body.chat-layout-center #chatView .bubble {
    display: inline-block;
    width: fit-content;
    inline-size: fit-content;
    min-width: 0;
    max-width: 100%;
    overflow-wrap: anywhere;
  }

  body.chat-layout-center #chatView .scene-divider {
    align-self: center;
    width: 100%;
  }

  body.chat-layout-center #chatView .msg.user {
    align-self: flex-end;
    max-width: min(82%, 520px);
  }

  body.chat-layout-center #chatView .input-bar {
    width: min(700px, calc(100% - 96px));
    align-self: center;
    border-top: 0;
    background: transparent;
    padding-left: 0;
    padding-right: 0;
  }
}
.credits-page {
  padding: 28px;
  display: grid;
  gap: 20px;
  min-width: 0;
  max-width: 100%;
  overflow-x: hidden;
  position: relative;
}
.generator-page {
  padding: 28px;
  display: grid;
  gap: 20px;
  min-width: 0;
  width: min(1220px, 100%);
  margin: 0 auto;
  animation: generatorFadeUp .42s ease both;
}
.generator-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 380px);
  gap: 18px;
  align-items: stretch;
}
.generator-hero > div:first-child,
.generator-quota-card,
.generator-panel {
  border: 1px solid var(--border);
  background: var(--card);
  border-radius: 24px;
  box-shadow: var(--shadow);
  min-width: 0;
}
.generator-hero > div:first-child {
  padding: 30px;
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(120,198,255,.12), rgba(255,255,255,.035) 42%, rgba(248,178,93,.08)),
    rgba(255,255,255,.018);
}
.generator-hero > div:first-child::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(110deg, transparent 0%, rgba(255,255,255,.12) 42%, transparent 58%);
  transform: translateX(-130%);
  animation: generatorLightSweep 6s ease-in-out infinite;
}
.generator-kicker {
  display: inline-flex;
  margin-bottom: 12px;
  padding: 7px 11px;
  border-radius: 999px;
  border: 1px solid rgba(120,198,255,.24);
  background: rgba(120,198,255,.08);
  color: #a9dcff;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.generator-hero h1 {
  margin: 0;
  font-size: 52px;
  line-height: 1;
}
.generator-hero p {
  margin: 14px 0 0;
  max-width: 66ch;
  color: rgba(232,233,241,.8);
  line-height: 1.62;
}
.generator-quota-card {
  padding: 22px;
  display: grid;
  align-content: center;
  gap: 12px;
}
.generator-quota-value {
  color: var(--text);
  font-size: 20px;
  line-height: 1.3;
  font-weight: 800;
}
.generator-quota-note {
  color: rgba(232,233,241,.68);
  line-height: 1.45;
  font-size: 13px;
}
.generator-layout {
  display: grid;
  grid-template-columns: minmax(340px, .9fr) minmax(0, 1.1fr);
  gap: 20px;
  align-items: start;
}
.generator-panel {
  padding: 20px;
  animation: generatorFadeUp .46s ease both;
}
.generator-layout .generator-panel:nth-child(2) {
  animation-delay: .06s;
}
.generator-recents-panel {
  animation-delay: .1s;
}
.generator-panel .section-title,
.generator-panel .section-subtitle {
  display: block;
  overflow-wrap: anywhere;
  min-width: 0;
}
.generator-panel .section-title {
  line-height: 1.25;
}
.generator-panel .section-subtitle {
  margin-top: 8px;
  line-height: 1.5;
  color: var(--sub);
}
.generator-settings-panel {
  display: grid;
  gap: 16px;
  background:
    linear-gradient(180deg, rgba(255,255,255,.035), rgba(255,255,255,.015)),
    var(--card);
}
.generator-label {
  display: block;
  margin-bottom: 8px;
  color: rgba(232,233,241,.86);
  font-size: 13px;
  font-weight: 800;
}
.generator-prompt {
  width: 100%;
  min-height: 150px;
  resize: vertical;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 16px;
  background: rgba(9,12,20,.52);
  color: var(--text);
  padding: 14px;
  line-height: 1.5;
  outline: none;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.03);
  transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
}
.generator-prompt:focus {
  border-color: rgba(120,198,255,.55);
  box-shadow: 0 0 0 3px rgba(120,198,255,.12);
  background: rgba(9,12,20,.68);
}
.generator-row-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}
.generator-chip-list,
.generator-format-list,
.generator-model-list,
.generator-backend-list,
.generator-source-list {
  display: grid;
  gap: 10px;
}
.generator-chip-list {
  grid-template-columns: repeat(auto-fit, minmax(116px, 1fr));
}
.generator-chip,
.generator-format-btn,
.generator-model-btn,
.generator-backend-btn {
  border: 1px solid rgba(255,255,255,.1);
  background: rgba(255,255,255,.035);
  color: rgba(232,233,241,.86);
  min-height: 44px;
  border-radius: 12px;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  transition: border-color .16s ease, background .16s ease;
}
.generator-chip:hover,
.generator-format-btn:hover,
.generator-model-btn:hover,
.generator-backend-btn:hover {
  border-color: rgba(120,198,255,.34);
  background: rgba(120,198,255,.08);
}
.generator-chip.active,
.generator-format-btn.active,
.generator-model-btn.active,
.generator-backend-btn.active {
  color: #eaf7ff;
  border-color: rgba(120,198,255,.6);
  background: rgba(25,126,184,.28);
  box-shadow: 0 12px 28px rgba(25,126,184,.18), inset 0 0 0 1px rgba(255,255,255,.05);
  animation: generatorActivePop .22s ease both;
}
.generator-format-list {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.generator-model-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.generator-backend-list {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.generator-source-list {
  grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
}
.generator-format-btn {
  display: grid;
  place-items: center;
  gap: 3px;
  padding: 10px 8px;
}
.generator-model-btn,
.generator-backend-btn {
  min-height: 68px;
  display: grid;
  align-content: center;
  justify-items: start;
  text-align: left;
  gap: 4px;
  padding: 10px 12px;
}
.generator-source-btn {
  min-height: 76px;
  display: grid;
  align-content: center;
  justify-items: start;
  gap: 4px;
  text-align: left;
  padding: 11px 12px;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 12px;
  background: rgba(255,255,255,.025);
  color: rgba(232,233,241,.88);
  font: inherit;
  cursor: pointer;
  transition: border-color .16s ease, background .16s ease, transform .16s ease;
}
.generator-source-btn:hover {
  transform: translateY(-1px);
  border-color: rgba(120,198,255,.28);
  background: rgba(120,198,255,.06);
}
.generator-source-btn span {
  font-weight: 900;
}
.generator-source-btn small {
  color: var(--sub);
  font-size: 11px;
  line-height: 1.35;
  font-weight: 700;
}
.generator-format-btn small,
.generator-model-btn small,
.generator-backend-btn small {
  color: var(--sub);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.3;
}
.generator-local-backend-panel {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid rgba(120,198,255,.18);
  border-radius: 16px;
  background: rgba(120,198,255,.045);
}
.generator-local-backend-panel label {
  display: grid;
  gap: 6px;
}
.generator-local-backend-panel label > span {
  color: var(--sub);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}
.generator-backend-input {
  width: 100%;
  min-height: 42px;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 12px;
  background: rgba(6,8,14,.56);
  color: var(--text);
  padding: 10px 12px;
  font: inherit;
  font-weight: 700;
  outline: none;
}
.generator-backend-input:focus {
  border-color: rgba(120,198,255,.55);
  box-shadow: 0 0 0 3px rgba(120,198,255,.12);
}
.generator-negative-prompt {
  min-height: 82px;
}
.generator-backend-controls {
  display: grid;
  grid-template-columns: .72fr .72fr 1.3fr;
  gap: 10px;
}
.generator-backend-controls label {
  display: grid;
  gap: 6px;
  color: var(--sub);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .04em;
}
@media (max-width: 720px) {
  .generator-backend-list,
  .generator-backend-controls {
    grid-template-columns: 1fr;
  }
}
.generator-adult-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 16px;
  background: rgba(255,255,255,.03);
}
.generator-adult-toggle {
  width: 82px;
  height: 40px;
  flex: 0 0 auto;
  border-radius: 999px;
  border: 1px solid rgba(120,198,255,.26);
  background: rgba(120,198,255,.1);
  color: #dff3ff;
  font: inherit;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
  transition: background .16s ease, border-color .16s ease, transform .16s ease;
}
.generator-adult-toggle:hover {
  transform: translateY(-1px);
}
.generator-adult-toggle.active {
  border-color: rgba(255,107,107,.46);
  background: rgba(255,107,107,.16);
  color: #ffd2d2;
}
.generator-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  flex-wrap: wrap;
}
.generator-actions .btn-save {
  min-width: 180px;
  justify-content: center;
  position: relative;
  overflow: hidden;
}
.generator-actions .btn-save::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent, rgba(255,255,255,.18), transparent);
  transform: translateX(-140%);
}
.generator-actions .btn-save:not(:disabled):hover::after {
  animation: generatorButtonShine .7s ease;
}
.generator-output-panel {
  display: grid;
  gap: 12px;
  background:
    linear-gradient(180deg, rgba(255,255,255,.032), rgba(255,255,255,.012)),
    var(--card);
}
.generator-output {
  min-height: 560px;
  border-radius: 18px;
  background:
    linear-gradient(135deg, rgba(120,198,255,.06), transparent 34%),
    rgba(9,12,20,.58);
  border: 1px solid rgba(255,255,255,.06);
  display: grid;
  place-items: center;
  overflow: hidden;
  position: relative;
}
.generator-output::before {
  content: "";
  position: absolute;
  inset: 18px;
  border-radius: 18px;
  border: 1px solid rgba(120,198,255,.12);
  opacity: .8;
  pointer-events: none;
  animation: generatorOutputBreathe 3.6s ease-in-out infinite;
}
.generator-placeholder {
  display: grid;
  place-items: center;
  gap: 12px;
  color: var(--sub);
  text-align: center;
  padding: 20px;
  animation: generatorPlaceholderFloat 3.2s ease-in-out infinite;
}
.generator-placeholder svg {
  width: 48px;
  height: 48px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  opacity: .72;
}
.generator-spinner {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 3px solid rgba(255,255,255,.14);
  border-top-color: rgba(120,198,255,.95);
  animation: spin 0.8s linear infinite;
}
.generator-output-img {
  width: 100%;
  height: 100%;
  max-height: 68vh;
  object-fit: contain;
  background: rgba(0,0,0,.18);
  animation: generatorImageReveal .32s ease both;
}
.generator-output-actions {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 12px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  padding: 10px;
  border-radius: 16px;
  background: linear-gradient(90deg, transparent, rgba(4,6,12,.74) 26%, rgba(4,6,12,.86));
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,.08);
}
.generator-publish-panel {
  display: grid;
  gap: 10px;
  padding: 14px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,.08);
  background: rgba(255,255,255,.025);
}
.generator-publish-textarea {
  width: 100%;
  min-height: 72px;
  resize: vertical;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 12px;
  background: rgba(9,12,20,.52);
  color: var(--text);
  padding: 12px;
  line-height: 1.45;
  outline: none;
}
.generator-publish-textarea:focus {
  border-color: rgba(120,198,255,.5);
  box-shadow: 0 0 0 3px rgba(120,198,255,.11);
}
.generator-open-image-link {
  color: #04101c;
  background: linear-gradient(135deg, #78c6ff, #b8e4ff);
  border-color: rgba(120,198,255,.5);
  box-shadow: 0 10px 28px rgba(120,198,255,.24);
  text-decoration: none;
}
.generator-open-image-link:hover {
  color: #020811;
  transform: translateY(-1px);
  box-shadow: 0 14px 34px rgba(120,198,255,.32);
}
.generator-recent-list {
  margin-top: 16px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}
.generator-section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  min-width: 0;
}
.generator-recents-panel {
  background:
    linear-gradient(180deg, rgba(255,255,255,.03), rgba(255,255,255,.012)),
    var(--card);
}
.generator-recent-card {
  display: grid;
  gap: 8px;
  text-align: left;
  border: 1px solid rgba(255,255,255,.08);
  background: rgba(255,255,255,.025);
  border-radius: 16px;
  padding: 10px;
  color: var(--text);
  cursor: pointer;
  position: relative;
  min-width: 0;
  transition: transform .16s ease, border-color .16s ease, background .16s ease;
}
.generator-recent-card:hover {
  transform: translateY(-2px);
  border-color: rgba(120,198,255,.28);
  background: rgba(120,198,255,.06);
}

@keyframes generatorFadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes generatorLightSweep {
  0%, 48% { transform: translateX(-130%); opacity: 0; }
  56% { opacity: .9; }
  68%, 100% { transform: translateX(130%); opacity: 0; }
}

@keyframes generatorActivePop {
  from { transform: scale(.98); }
  to { transform: scale(1); }
}

@keyframes generatorButtonShine {
  from { transform: translateX(-140%); }
  to { transform: translateX(140%); }
}

@keyframes generatorOutputBreathe {
  0%, 100% { opacity: .34; transform: scale(.99); }
  50% { opacity: .9; transform: scale(1); }
}

@keyframes generatorPlaceholderFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

@keyframes generatorImageReveal {
  from { opacity: 0; transform: scale(.985); }
  to { opacity: 1; transform: scale(1); }
}
.generator-recent-card img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 12px;
  background: rgba(0,0,0,.2);
}
.generator-recent-card.is-broken img {
  opacity: .18;
}
.generator-recent-card.is-broken::after {
  content: "Image failed";
  position: absolute;
  left: 18px;
  right: 18px;
  top: 56px;
  min-height: 34px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  border: 1px solid rgba(255,107,107,.28);
  background: rgba(255,107,107,.12);
  color: #ffd0d0;
  font-size: 12px;
  font-weight: 800;
}
.generator-recent-card span {
  color: rgba(232,233,241,.76);
  font-size: 12px;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.generator-recent-card small {
  color: #a9dcff;
  font-size: 11px;
  font-weight: 800;
}
.explore-image-grid {
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  align-items: start;
}
.explore-image-card {
  display: grid;
  align-self: start;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 18px;
  background: rgba(255,255,255,.025);
  box-shadow: var(--shadow);
}
.explore-image-media {
  display: grid;
  place-items: center;
  min-height: 300px;
  background: rgba(0,0,0,.28);
}
.explore-image-media img {
  width: 100%;
  height: auto;
  max-height: 520px;
  object-fit: contain;
  display: block;
}
.explore-image-body {
  display: grid;
  gap: 10px;
  padding: 14px;
  min-width: 0;
}
.explore-image-top,
.explore-image-meta,
.explore-image-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}
.explore-image-top strong,
.explore-image-top span,
.explore-image-meta span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.explore-image-top span,
.explore-image-meta {
  color: var(--sub);
  font-size: 12px;
  font-weight: 700;
}
.explore-image-description,
.explore-image-review,
.explore-image-prompt {
  margin: 0;
  color: rgba(232,233,241,.78);
  font-size: 13px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}
.explore-image-prompt {
  display: grid;
  gap: 4px;
  padding: 10px;
  border-radius: 12px;
  background: rgba(9,12,20,.42);
  max-height: 112px;
  overflow: auto;
}
.explore-image-prompt summary {
  color: #a9dcff;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .08em;
  cursor: pointer;
  list-style: none;
}
.explore-image-prompt summary::-webkit-details-marker {
  display: none;
}
.explore-image-prompt:not([open]) div {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.explore-image-prompt[open] {
  max-height: 260px;
}
.explore-image-review {
  padding-left: 10px;
  border-left: 2px solid rgba(120,198,255,.36);
}
.explore-image-actions {
  justify-content: flex-end;
  flex-wrap: wrap;
}
.generator-topbar {
  display: none;
}
.credits-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(300px, 420px);
  gap: 18px;
  align-items: stretch;
}
.credits-hero > div:first-child {
  min-width: 0;
  padding: 26px;
  border: 1px solid rgba(255,255,255,.06);
  border-radius: 28px;
  background:
    radial-gradient(circle at top left, rgba(249,176,90,.18), transparent 38%),
    radial-gradient(circle at bottom right, rgba(79,162,255,.12), transparent 42%),
    rgba(255,255,255,.025);
  box-shadow: var(--shadow);
}
.credits-hero h1,
.credits-hero p {
  overflow-wrap: anywhere;
}
.credits-hero h1 {
  margin: 0;
  font-size: clamp(34px, 5vw, 52px);
  line-height: 0.95;
}
.credits-hero p {
  margin-top: 14px;
  max-width: 50ch;
  color: rgba(232,233,241,.8);
  line-height: 1.65;
}
.credits-balance-card,
.credits-panel {
  border: 1px solid var(--border);
  background: var(--card);
  border-radius: 24px;
  padding: 18px;
  box-shadow: var(--shadow);
  min-width: 0;
}
.credits-panel .section-title,
.credits-panel .section-subtitle {
  display: block;
  overflow-wrap: anywhere;
}
.credits-panel .section-title {
  line-height: 1.35;
}
.credits-panel .section-subtitle {
  margin-top: 8px;
  line-height: 1.5;
}
.credits-balance-card {
  min-width: 0;
  display: grid;
  gap: 10px;
  padding: 22px;
  background:
    linear-gradient(165deg, rgba(248,178,93,.16), rgba(255,255,255,.04) 42%, rgba(120,198,255,.08)),
    var(--card);
}
.credits-mini-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 6px;
}
.credits-mini-stat {
  display: grid;
  gap: 4px;
  padding: 12px;
  border-radius: 16px;
  background: rgba(12,15,24,.26);
  border: 1px solid rgba(255,255,255,.06);
}
.credits-mini-stat span {
  font-size: 11px;
  color: var(--sub);
  text-transform: uppercase;
  letter-spacing: .08em;
}
.credits-mini-stat strong {
  font-size: 18px;
  line-height: 1;
}
.credits-mini-stat-accent {
  background: rgba(248,178,93,.14);
  border-color: rgba(248,178,93,.24);
}
.credits-daily-card {
  margin-top: 12px;
  display: grid;
  gap: 10px;
  padding: 14px;
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.03);
}
.credits-daily-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text);
}

.mobile-menu-link {
  display: none !important;
}

.credits-topbar {
  display: none;
}
.credits-daily-copy {
  color: var(--sub);
  line-height: 1.5;
}
.credits-daily-card .btn-save {
  width: 100%;
  justify-content: center;
}
.credits-daily-card .btn-save[disabled] {
  cursor: not-allowed;
  opacity: 0.7;
}

.credits-icon-concepts-panel {
  display: grid;
  gap: 16px;
}

.credits-icon-concept-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.credits-icon-concept-card {
  min-width: 0;
  display: grid;
  gap: 9px;
  align-content: start;
  padding: 14px;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 16px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.045), rgba(255,255,255,0.018)),
    rgba(9,12,20,0.22);
}

.credits-icon-concept-mark {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,0.12);
  background:
    radial-gradient(circle at 32% 22%, rgba(255,255,255,0.20), transparent 32%),
    linear-gradient(135deg, rgba(248,178,93,0.18), rgba(139,124,246,0.14));
  color: rgba(255,235,192,0.98);
}

.credits-icon-concept-mark svg {
  width: 38px;
  height: 38px;
  fill: none;
  stroke: currentColor;
  stroke-width: 3.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.credits-icon-concept-card strong {
  color: var(--text);
  font-size: 13px;
  line-height: 1.2;
}

.credits-icon-concept-card span {
  color: var(--sub);
  font-size: 11px;
  line-height: 1.35;
}

.credits-balance-label,
.credits-balance-sub,
.credits-inline-note,
.credit-history-meta {
  color: var(--sub);
}
.credits-balance-value {
  font-size: 42px;
  font-weight: 700;
  line-height: 1;
}
.credits-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  align-items: start;
}
.credits-panel-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  flex-wrap: wrap;
}
.credits-referral-panel {
  display: grid;
  gap: 16px;
  background:
    radial-gradient(circle at top right, rgba(248,178,93,.16), transparent 35%),
    linear-gradient(180deg, rgba(255,255,255,.02), rgba(255,255,255,.01));
}
.credits-referral-badge {
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid rgba(248,178,93,.28);
  background: rgba(248,178,93,.12);
  color: #ffd89e;
  font-size: 12px;
  font-weight: 700;
}
.credits-invite-panel {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  padding: 16px;
  border: 1px solid rgba(120,198,255,.22);
  border-radius: 22px;
  background:
    radial-gradient(circle at 8% 20%, rgba(120,198,255,.2), transparent 28%),
    radial-gradient(circle at 100% 0%, rgba(248,178,93,.18), transparent 34%),
    linear-gradient(135deg, rgba(255,255,255,.07), rgba(255,255,255,.025));
  box-shadow: 0 18px 42px rgba(0,0,0,.22);
}
.credits-invite-orb {
  width: 48px;
  height: 48px;
  border-radius: 17px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #78c6ff, #f8b25d);
  color: #080912;
  font-weight: 900;
  box-shadow: 0 14px 32px rgba(120,198,255,.18);
}
.credits-invite-copy {
  min-width: 0;
}
.credits-invite-kicker {
  color: #8fd0ff;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.credits-invite-title {
  margin-top: 3px;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -.02em;
}
.credits-invite-text {
  margin-top: 5px;
  color: rgba(232,233,241,.78);
  font-size: 13px;
  line-height: 1.45;
}
.credits-invite-code-wrap {
  display: grid;
  gap: 8px;
  justify-items: end;
}
.credits-invite-code {
  min-width: 150px;
  padding: 10px 14px;
  border-radius: 16px;
  border: 1px solid rgba(248,178,93,.26);
  background: rgba(8,9,18,.52);
  color: #ffe0a8;
  font-size: 18px;
  font-weight: 900;
  letter-spacing: .12em;
  text-align: center;
}
.credits-invite-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}
.credits-referral-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.credits-referral-card {
  display: grid;
  gap: 12px;
  padding: 16px;
  border-radius: 20px;
  border: 1px solid rgba(255,255,255,.08);
  background: rgba(255,255,255,.03);
}
.credits-referral-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--sub);
}
.credits-referral-code-row,
.credits-redeem-row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.credits-referral-code {
  flex: 1 1 220px;
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 16px;
  border-radius: 18px;
  border: 1px solid rgba(248,178,93,.22);
  background: rgba(12,15,24,.4);
  font-size: clamp(22px, 3vw, 30px);
  font-weight: 800;
  letter-spacing: .16em;
  text-transform: uppercase;
}
.credits-referral-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}
.credits-icon-btn {
  width: 46px;
  height: 46px;
  min-width: 46px;
  padding: 0;
  display: inline-grid;
  place-items: center;
}
.credits-icon-btn svg {
  width: 19px;
  height: 19px;
  display: block;
}
#creditsView .credits-icon-btn,
#creditsView .credits-referral-actions .credits-icon-btn,
.credits-referral-actions .credits-icon-btn {
  border-color: rgba(255,255,255,.12);
  background: rgba(28,31,48,.78);
  color: rgba(238,241,255,.9);
}
.credits-referral-actions .credits-icon-btn:hover {
  background: rgba(43,47,70,.92);
  border-color: rgba(255,255,255,.18);
}
.credits-redeem-row input {
  flex: 1 1 220px;
  min-width: 0;
  min-height: 50px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: rgba(12,15,24,.42);
  color: var(--text);
  padding: 0 14px;
  font: inherit;
  text-transform: uppercase;
  letter-spacing: .08em;
}
.credits-referral-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.credits-referral-stat-card {
  display: grid;
  gap: 8px;
  padding: 14px;
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,.08);
  background: rgba(12,15,24,.24);
}
.credits-referral-stat-card span {
  color: var(--sub);
  font-size: 12px;
  line-height: 1.45;
}
.credits-referral-stat-card strong {
  font-size: 28px;
  line-height: 1;
}
.credits-referral-history {
  max-height: min(36vh, 320px);
}
.credit-offers,
.credit-history-list {
  display: grid;
  gap: 12px;
  margin-top: 14px;
  min-width: 0;
}
.credit-history-list {
  max-height: min(52vh, 520px);
  overflow-y: auto;
  padding-right: 4px;
}
.credit-offer-card,
.credit-history-item {
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 14px;
  background: rgba(255,255,255,.03);
  min-width: 0;
}
.credit-offer-card.muted {
  opacity: .82;
}
.credit-offer-top,
.credit-history-item {
  display: flex;
  gap: 12px;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
}
.credit-offer-top > div:first-child,
.credit-history-item > div:first-child {
  flex: 1 1 220px;
  min-width: 0;
}
.credit-offer-title,
.credit-history-title {
  font-weight: 700;
  overflow-wrap: anywhere;
}
.credit-offer-badge {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(100, 214, 154, .14);
  border: 1px solid rgba(100, 214, 154, .32);
  color: #8ff0b9;
  font-size: 11px;
  font-weight: 800;
  vertical-align: middle;
}
.credit-offer-copy {
  color: var(--sub);
  font-size: 12px;
  margin-top: 4px;
  overflow-wrap: anywhere;
}
.credit-offer-amount,
.credit-offer-price,
.credit-history-delta {
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
}
.credit-offer-price {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.credit-offer-old-price {
  color: var(--sub);
  font-size: 12px;
  font-weight: 600;
  text-decoration: line-through;
}
.credit-offer-card .btn-save,
.credit-offer-card .btn-save.secondary {
  width: 100%;
  margin-top: 14px;
  justify-content: center;
}
.custom-credit-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
}
.custom-credit-label {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 42px;
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--sub);
  background: rgba(255,255,255,.04);
}
.custom-credit-input {
  width: 100%;
  height: 42px;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0 12px;
  background: rgba(255,255,255,.04);
  color: var(--text);
  font: inherit;
}
.paypal-button-slot {
  width: 100%;
  min-height: 42px;
  margin-top: 14px;
}
.google-pay-button-slot {
  width: 100%;
  min-height: 42px;
  margin-top: 10px;
}
.google-pay-button-slot.hidden {
  display: none !important;
  min-height: 0;
  margin-top: 0;
}
.google-pay-button-slot > div,
.google-pay-button-slot button {
  width: 100%;
}
.credit-history-meta {
  margin-top: 4px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}
.credit-history-delta.positive {
  color: #64d69a;
}
.credit-history-delta.negative {
  color: #ff8f8f;
}
.credit-history-empty {
  color: var(--sub);
  padding: 18px;
  border: 1px dashed var(--border);
  border-radius: 18px;
}
.chayt-plus-credit-panel,
.chayt-plus-hero,
.chayt-plus-plan-card.featured {
  background:
    radial-gradient(circle at top right, rgba(120,198,255,.18), transparent 36%),
    linear-gradient(135deg, rgba(248,178,93,.12), rgba(255,255,255,.035));
}
.chayt-plus-feature-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}
.chayt-plus-feature-row span,
.chayt-plus-kicker,
.chayt-plus-plan-kicker,
.premium-review-badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  border-radius: 999px;
  border: 1px solid rgba(248,178,93,.28);
  background: rgba(248,178,93,.12);
  color: #ffe0a8;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.review-premium-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(248,178,93,.16);
  border: 1px solid rgba(248,178,93,.34);
  color: #ffe0a8;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.premium-verify-badge {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  vertical-align: -3px;
  border-radius: 4px;
  color: #f6c947;
  cursor: help;
  filter: drop-shadow(0 0 5px rgba(255, 212, 71, .36));
  animation: chaytPlusMarkGlow 2.6s ease-in-out infinite;
}
.premium-verify-badge svg {
  width: 18px;
  height: 18px;
  display: block;
}
.premium-verify-badge::before,
.premium-verify-badge::after {
  content: none !important;
  display: none !important;
}
.premium-verify-badge:hover {
  animation-duration: 1.35s;
  filter: drop-shadow(0 0 9px rgba(255, 216, 77, .56));
}
@keyframes chaytPlusMarkGlow {
  0%, 100% { transform: translateY(0) scale(1); filter: drop-shadow(0 0 4px rgba(255, 212, 71, .30)); }
  48% { transform: translateY(-.5px) scale(1.07); filter: drop-shadow(0 0 10px rgba(255, 216, 77, .56)); }
  62% { transform: translateY(0) scale(1); }
}
.review-social-btn.has-user-reaction svg .thumb-body,
.review-reply-reaction-btn.has-user-reaction svg .thumb-body,
.review-vote-choice.is-selected svg .thumb-body,
.review-vote-choice.is-touch-target svg .thumb-body {
  fill: currentColor;
  fill-opacity: .95;
}
.review-social-btn.has-user-reaction svg .thumb-cuff,
.review-reply-reaction-btn.has-user-reaction svg .thumb-cuff,
.review-vote-choice.is-selected svg .thumb-cuff,
.review-vote-choice.is-touch-target svg .thumb-cuff {
  fill: transparent;
}
.review-premium-badge.premium-verify-badge {
  padding: 0;
  border: 0;
  background: transparent;
  letter-spacing: 0;
}
.bot-owner-premium-badge {
  margin-left: 3px;
}
.detail-badges .bot-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  line-height: 1;
  padding-top: 3px;
  padding-bottom: 3px;
}
.review-reply-head .premium-verify-badge,
.review-user-copy .premium-verify-badge,
.bot-card-badges .premium-verify-badge,
.detail-badges .premium-verify-badge {
  color: #f6c947;
}
.chayt-plus-feature-row span,
.premium-review-badge {
  min-height: 24px;
  padding: 3px 9px;
}
.chayt-plus-mini-plans,
.chayt-plus-plans {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 16px;
}
.chayt-plus-mini-plan,
.chayt-plus-plan-card {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid rgba(255,255,255,.09);
  border-radius: 18px;
  background: rgba(12,15,24,.34);
}
.chayt-plus-plan-title,
.chayt-plus-plan-card h2 {
  margin: 0;
  font-weight: 900;
  letter-spacing: 0;
}
.chayt-plus-plan-copy,
.chayt-plus-status {
  color: var(--sub);
  line-height: 1.5;
}
.chayt-plus-plan-price {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  font-size: 24px;
  font-weight: 900;
}
.chayt-plus-plan-price.large {
  font-size: 34px;
}
.chayt-plus-plan-price span {
  color: var(--sub);
  font-size: 13px;
  font-weight: 700;
  text-decoration: line-through;
}
.chayt-plus-page {
  max-width: 1120px;
  margin: 0 auto;
  padding: 28px;
  display: grid;
  gap: 18px;
}
.chayt-plus-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 360px);
  gap: 24px;
  align-items: center;
  border: 1px solid rgba(255,255,255,.09);
  border-radius: 26px;
  padding: 28px;
}
.chayt-plus-hero h1 {
  margin: 10px 0 0;
  max-width: 720px;
  font-size: clamp(34px, 5vw, 64px);
  line-height: .98;
  letter-spacing: 0;
}
.chayt-plus-hero p {
  max-width: 650px;
  margin: 14px 0 0;
  color: rgba(232,233,241,.82);
  line-height: 1.55;
}
.chayt-plus-kicker,
.chayt-plus-plan-kicker {
  padding: 5px 10px;
}
.chayt-plus-status {
  margin-top: 18px;
}
.chayt-plus-proof {
  display: grid;
  gap: 8px;
  padding: 20px;
  border-radius: 22px;
  border: 1px solid rgba(120,198,255,.24);
  background: rgba(120,198,255,.08);
  box-shadow: 0 24px 60px rgba(0,0,0,.24);
}
.chayt-plus-proof.review-item {
  width: 100%;
  justify-self: stretch;
}
.chayt-plus-proof-tag {
  width: fit-content;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(248,178,93,.18);
  border: 1px solid rgba(248,178,93,.32);
  color: #ffe0a8;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}
.chayt-plus-proof-name {
  font-size: 24px;
  font-weight: 900;
}
.chayt-plus-proof-copy {
  color: rgba(232,233,241,.78);
  line-height: 1.45;
}
.chayt-plus-benefits {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
.chayt-plus-benefits article {
  display: grid;
  gap: 8px;
  padding: 16px;
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,.08);
  background: rgba(255,255,255,.03);
}
.chayt-plus-benefits strong {
  font-size: 16px;
}
.chayt-plus-benefits span,
.chayt-plus-benefit-list {
  color: var(--sub);
  line-height: 1.5;
}
.chayt-plus-plan-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}
.chayt-plus-benefit-list {
  margin: 0;
  padding-left: 18px;
}
.review-item.is-premium-review {
  border-color: rgba(248,178,93,.3);
  background:
    linear-gradient(135deg, rgba(248,178,93,.12), rgba(120,198,255,.07)),
    rgba(255,255,255,.04);
}
.review-item.is-premium-review .review-user-copy strong {
  color: #ffe7b8;
}
.credits-warning {
  margin-top: 12px;
  border: 1px solid rgba(255, 184, 77, .35);
  background: rgba(255, 184, 77, .1);
  color: #ffd08a;
  padding: 12px 14px;
  border-radius: 16px;
  line-height: 1.5;
}
.credit-burst-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  display: grid;
  place-items: center;
  z-index: 120;
}
.credit-burst {
  display: grid;
  gap: 6px;
  justify-items: center;
  padding: 18px 24px;
  border-radius: 22px;
  border: 1px solid rgba(248,178,93,.28);
  background: rgba(13,16,24,.86);
  box-shadow: 0 30px 80px rgba(0,0,0,.4);
  opacity: 0;
  transform: translateY(24px) scale(.9);
}
.credit-burst.show {
  animation: creditBurstPop 1.7s ease forwards;
}
.credit-burst strong {
  font-size: clamp(34px, 7vw, 56px);
  line-height: .95;
  color: #ffd89e;
}
.credit-burst span {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: rgba(255,255,255,.72);
}
@keyframes creditBurstPop {
  0% { opacity: 0; transform: translateY(28px) scale(.88); }
  14% { opacity: 1; transform: translateY(0) scale(1); }
  72% { opacity: 1; transform: translateY(-8px) scale(1.04); }
  100% { opacity: 0; transform: translateY(-30px) scale(.98); }
}

@media (max-width: 920px) {
  #sidebar { width: 260px; min-width: 260px; }
  #homeView { padding: 24px 18px calc(92px + env(safe-area-inset-bottom, 0px)); }
  .home-toolbar { flex-direction: column; align-items: stretch; }
  .home-toolbar > * { width: 100%; }
  .mobile-create-btn {
    position: sticky;
    top: 0;
    z-index: 3;
  }
  .credits-page { padding: 20px 16px 32px; }
  .credits-topbar,
  .generator-topbar { display: flex; }
  .generator-page { padding: 20px 16px 32px; }
  .generator-hero,
  .generator-layout {
    grid-template-columns: 1fr;
  }
  .generator-hero > div:first-child {
    padding: 22px 18px;
  }
  .generator-format-list {
    grid-template-columns: 1fr;
  }
  .generator-output {
    min-height: min(520px, 68vh);
  }
  .generator-section-head {
    display: grid;
    gap: 10px;
  }
  .credits-grid { grid-template-columns: 1fr; }
  .credits-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
  }
   .credits-hero > div:first-child {
    padding: 22px 18px;
   }
  .credits-balance-card {
    width: 100%;
    max-width: none;
    min-width: 0;
  }
  .credits-mini-stats,
  .credits-icon-concept-grid,
  .credits-referral-grid,
  .credits-referral-stats {
    grid-template-columns: 1fr;
  }
  .credits-invite-panel {
    grid-template-columns: 1fr;
    align-items: stretch;
    gap: 12px;
  }
  .credits-invite-orb {
    width: 42px;
    height: 42px;
    border-radius: 15px;
  }
  .credits-invite-code-wrap {
    justify-items: stretch;
  }
  .credits-invite-code {
    min-width: 0;
    width: 100%;
  }
  .credits-invite-actions {
    justify-content: stretch;
  }
  .credits-invite-actions .mini-btn {
    flex: 1 1 120px;
  }
  .chat-topbar {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas:
      "back info actions";
    align-items: center;
    column-gap: 10px;
    row-gap: 10px;
  }
  #backBtn { grid-area: back; }
  .chat-bot-info { grid-area: info; min-width: 0; }
  .chat-actions {
    grid-area: actions;
    margin-left: 0;
    justify-self: end;
    flex-wrap: nowrap;
  }
  .chat-meta { min-width: 0; }
  .chat-name,
  .chat-desc {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .chat-menu {
    right: 0;
    left: auto;
    top: calc(100% + 10px);
    max-width: min(86vw, 260px);
  }
  .avatar-crop-layout {
    grid-template-columns: minmax(0, 1fr);
  }
  .avatar-crop-preview {
    grid-template-columns: auto 1fr;
    align-items: center;
  }
  .mobile-menu-link {
    display: flex !important;
  }
  .mobile-home-topbar {
    display: grid;
    gap: 14px;
    align-items: stretch;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    background: rgba(18,18,24,0.86);
    backdrop-filter: blur(16px);
    margin: -24px -18px 16px;
  }
  .mobile-home-shortcuts {
    display: flex;
    justify-content: flex-start;
    margin-left: 0;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: none;
  }
  .mobile-home-shortcuts::-webkit-scrollbar {
    display: none;
  }
  .mobile-home-shortcut {
    flex: 0 0 auto;
  }

  .install-promo {
    margin-top: 0;
    border-radius: 20px;
  }

  .mobile-discovery-links {
    display: grid;
    gap: 10px;
  }

  .discovery-socials {
    justify-content: flex-start;
  }
}

@media (max-width: 960px) {
  #main .view,
  #main .create-body,
  #main .settings-body,
  #main .credits-page,
  #main .recent-chats-page,
  #main .history-body,
  #main #yourCharactersView,
  #main #aimodelratingView {
    scrollbar-gutter: auto !important;
    scrollbar-width: none !important;
    -ms-overflow-style: none !important;
  }

  #main .view::-webkit-scrollbar,
  #main .create-body::-webkit-scrollbar,
  #main .settings-body::-webkit-scrollbar,
  #main .credits-page::-webkit-scrollbar,
  #main .recent-chats-page::-webkit-scrollbar,
  #main .history-body::-webkit-scrollbar,
  #main #yourCharactersView::-webkit-scrollbar,
  #main #aimodelratingView::-webkit-scrollbar {
    width: 0 !important;
    height: 0 !important;
    display: none !important;
  }

  #homeView {
    padding: 0 16px calc(140px + env(safe-area-inset-bottom, 0px)) !important;
    gap: 8px;
  }

  #homeView .home-hero {
    display: contents;
    padding: 0;
    margin: 0;
  }

  #homeView .home-hero > div:first-child {
    display: contents;
  }

  .mobile-home-topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-width: 100vw;
    box-sizing: border-box;
    z-index: 30;
    display: flex;
    align-items: flex-start;
    min-height: 68px;
    margin: 0 !important;
    padding: calc(12px + env(safe-area-inset-top, 0px)) 0 12px !important;
    border-bottom: 0;
    background: rgba(18,18,24,0.97);
    backdrop-filter: blur(16px);
  }

  .discovery-title-row {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    gap: 9px;
  }

  .mobile-home-copy {
    min-width: 0;
    width: 100%;
    max-width: 100%;
  }

  .discovery-search-open-btn,
  .discovery-social-link {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    box-sizing: border-box;
  }

  .discovery-socials {
    flex-direction: row;
    align-items: center;
    gap: 7px;
    min-width: 0;
  }

  .discovery-social-link {
    padding: 0;
  }

  .mobile-home-copy h1 {
    font-size: 18px;
    line-height: 1.2;
    letter-spacing: 0;
  }

  .mobile-home-copy p {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    line-height: 1.35;
    color: rgba(232,233,241,0.72);
  }

  .discovery-value-pills {
    display: flex;
    width: 100%;
    max-width: 100%;
    gap: 6px;
    margin-top: 9px;
    padding: 0 2px 2px;
    overflow: visible;
    flex-wrap: wrap;
    scrollbar-width: none;
  }

  .discovery-value-pills::-webkit-scrollbar {
    display: none;
  }

  .discovery-value-pills span {
    flex: 0 1 auto;
    min-height: 26px;
    padding: 0 9px;
    font-size: 11px;
  }

  #homeView .discovery-tabs {
    position: static;
    top: auto;
    z-index: auto;
    min-height: 46px;
    margin: calc(68px + env(safe-area-inset-top, 0px)) -16px 0 !important;
    padding: 8px 16px 0 !important;
    border-bottom: 0;
    background: #121218;
    backdrop-filter: blur(16px);
  }

  #homeView .discovery-tab {
    border-bottom: 0;
    height: 38px;
    font-size: 17px;
    padding-bottom: 8px;
  }

  #homeView .discovery-tab.active::after {
    bottom: 0;
    width: 42px;
    background: rgba(255,255,255,0.92);
    box-shadow: none;
  }

  #homeView #installPromoCard {
    display: none !important;
  }

  #homeView .discovery-quick-tags {
    position: static;
    top: auto;
    z-index: auto;
    margin: 0 -16px 12px;
    min-height: 50px;
    padding: 8px 16px 9px;
    background: rgba(18,18,24,0.94);
    backdrop-filter: blur(16px);
  }

  #homeView .discovery-quick-tag {
    height: 32px;
    padding: 0 12px;
    font-size: 12px;
    line-height: 32px;
  }

  #homeView .discovery-filter-loader {
    margin-left: -16px;
    margin-right: -16px;
    padding: 0 16px;
  }

  #homeView .discovery-support-banner {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    align-items: stretch !important;
    margin: 0 0 18px !important;
    padding: 12px !important;
    gap: 10px !important;
    height: auto !important;
    min-height: 136px !important;
    max-height: none;
    overflow: visible !important;
    position: relative !important;
    top: 112px !important;
    box-sizing: border-box !important;
    border: 1px solid rgba(139, 124, 246, 0.28) !important;
    border-radius: 8px !important;
    background: linear-gradient(135deg, rgba(139, 124, 246, 0.18), rgba(34, 197, 94, 0.08)) !important;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.18) !important;
  }

  #homeView .discovery-support-copy {
    display: grid !important;
    gap: 3px;
    visibility: visible !important;
  }

  #homeView .discovery-support-mobile-copy {
    display: none;
  }

  #homeView .discovery-support-kicker {
    font-size: 10px;
    display: block !important;
  }

  #homeView .discovery-support-title {
    font-size: 13px;
    line-height: 1.2;
    display: block !important;
  }

  #homeView .discovery-support-copy p {
    font-size: 12px;
    line-height: 1.35;
    display: block !important;
  }

  #homeView .discovery-support-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  #homeView .discovery-support-btn {
    width: 100%;
    min-width: 0;
    min-height: 38px;
    padding-inline: 10px;
    font-size: 12px;
  }

  #homeView .home-toolbar {
    display: none !important;
  }

  .discovery-search-overlay {
    padding: 0;
    align-items: stretch;
    background: #050505;
    backdrop-filter: none;
  }

  .discovery-search-page {
    width: 100%;
    min-height: 100dvh;
    height: 100dvh;
    margin-top: 0;
    border: 0;
    border-radius: 0;
    background: #050505;
    overflow-y: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    box-shadow: none;
    display: flex;
    flex-direction: column;
    transform: translateY(18px);
  }

  .discovery-search-page::-webkit-scrollbar {
    width: 0 !important;
    height: 0 !important;
    display: none !important;
  }

  .discovery-search-head {
    position: sticky;
    top: 0;
    z-index: 2;
    min-height: calc(76px + env(safe-area-inset-top, 0px));
    padding:
      calc(14px + env(safe-area-inset-top, 0px))
      max(16px, env(safe-area-inset-right, 0px))
      12px
      max(16px, env(safe-area-inset-left, 0px));
    border-bottom: 0;
    background: #050505;
    box-sizing: border-box;
    width: 100%;
    overflow: hidden;
    gap: 10px;
  }

  .discovery-search-field {
    flex: 1 1 0 !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    min-height: 54px;
    background: #171717;
    border-color: transparent;
    padding-inline: 12px;
  }

  .discovery-search-field input {
    font-size: 18px;
  }

  .discovery-search-cancel-btn {
    font-size: 18px;
    min-height: 44px;
  }

  .discovery-search-body {
    flex: 1 1 auto;
    min-height: 0;
    align-content: start;
    padding: 4px 16px calc(96px + env(safe-area-inset-bottom, 0px));
    gap: 12px;
    background: #050505;
  }

  .discovery-search-filters {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }

  .discovery-search-filters select {
    min-height: 42px;
    border-radius: 13px;
    font-size: 12px;
  }

  .discovery-search-actions {
    position: sticky;
    bottom: 0;
    padding-top: 4px;
    background: rgba(18,18,24,0.98);
  }

  .discovery-search-results {
    gap: 12px;
  }

  .discovery-search-result-card {
    display: grid;
    grid-template-columns: 118px minmax(0, 1fr);
    gap: 12px;
    align-items: stretch;
    min-height: 0;
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: 8px;
    background: #111116;
    box-shadow: none;
    padding: 0;
    overflow: hidden;
  }

  .discovery-search-simple-card {
    min-height: 0;
  }

  .discovery-search-simple-image {
    width: 118px;
    min-width: 118px;
    height: 100%;
    min-height: 158px;
    border: 0;
    border-right: 1px solid rgba(255,255,255,0.07);
    border-radius: 0;
  }

  .discovery-search-simple-copy {
    align-self: start;
    padding: 14px 0;
  }

  .discovery-search-simple-name {
    font-size: 18px;
  }

  .discovery-search-simple-desc {
    font-size: 13px;
    -webkit-line-clamp: 3;
  }

  .discovery-search-simple-tags {
    max-height: 26px;
  }

  .discovery-search-simple-count {
    position: absolute;
    left: 10px;
    top: 10px;
    min-height: 26px;
    padding: 0 8px;
    font-size: 12px;
    background: rgba(9,10,16,0.72);
    backdrop-filter: blur(10px);
  }

  .discovery-search-simple-count svg {
    width: 13px;
    height: 13px;
  }

  .discovery-search-result-card .bot-card-media {
    width: 118px;
    min-width: 118px;
    height: 158px;
    aspect-ratio: auto;
    margin: 0;
    border: 0;
    border-right: 1px solid rgba(255,255,255,0.07);
    border-radius: 0;
  }

  .discovery-search-result-card .bot-card-body {
    display: grid;
    align-content: center;
    gap: 7px;
    min-height: 0;
    padding: 10px 10px 10px 0;
  }

  .discovery-search-result-card:hover {
    background: #15151b;
    border-color: rgba(255,255,255,0.1);
    transform: none;
  }

  .discovery-search-result-card .bot-card-top,
  .discovery-search-result-card .bot-card-meta,
  .discovery-search-result-card .bot-card-footer,
  .discovery-search-result-card .bot-actions-row {
    padding-inline: 0;
  }

  .discovery-search-result-card .bot-card-top {
    margin-top: 0;
    min-height: 0;
    display: block;
  }

  .discovery-search-result-card .bot-card-name {
    font-size: 18px;
    line-height: 1.25;
    margin-top: 2px;
  }

  .discovery-search-result-card .bot-card-desc {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-size: 14px;
    line-height: 1.45;
  }

  .discovery-search-result-card .bot-card-badges {
    display: block;
    margin-top: 5px;
  }

  .discovery-search-result-card .bot-card-meta {
    display: none;
  }

  .discovery-search-result-card .bot-actions-row,
  .discovery-search-result-card .bot-card-created,
  .discovery-search-result-card .bot-card-meta::after {
    display: none;
  }

  .recent-chats-page {
    padding-bottom: calc(92px + env(safe-area-inset-bottom, 0px));
  }

  .recent-chats-panel {
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }

  .mobile-recent-your-characters-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    width: 100%;
    min-height: 44px;
    margin-bottom: 2px;
    padding: 0 14px;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 12px;
    background: rgba(255,255,255,0.045);
    color: var(--text);
    font: inherit;
    font-size: 14px;
    font-weight: 800;
    box-shadow: none;
    cursor: pointer;
  }

  .mobile-recent-your-characters-btn svg {
    width: 17px;
    height: 17px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    opacity: .9;
  }

  .mobile-recent-your-characters-btn:active {
    transform: scale(.99);
    background: rgba(255,255,255,0.07);
  }

  #patchNotesView .create-body {
    padding-left: 16px;
    padding-right: 16px;
    padding-bottom: calc(110px + env(safe-area-inset-bottom, 0px));
  }

  #patchNotesView .patch-notes-hero,
  #patchNotesView .patch-notes-card {
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }

  #patchNotesView .patch-notes-hero {
    gap: 8px;
    padding-bottom: 18px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
  }

  #patchNotesView .patch-notes-card {
    gap: 12px;
    padding-bottom: 18px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
  }

  #patchNotesView .patch-notes-card:last-child {
    border-bottom: 0;
    padding-bottom: 0;
  }

  .patch-syntax-grid {
    grid-template-columns: 1fr;
  }

  .patch-showcase-grid {
    grid-template-columns: 1fr;
  }

  .patch-syntax-item summary {
    grid-template-columns: 1fr;
  }

  .patch-syntax-item summary::after {
    grid-column: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .generator-page,
  .generator-panel,
  .generator-placeholder,
  .generator-output::before,
  .generator-chip.active,
  .generator-format-btn.active,
  .generator-output-img,
  .chayt-plus-upsell-card,
  .chayt-plus-upsell-benefits span,
  .generator-loading-card,
  .generator-loading-card::before,
  .generator-loading-orbit,
  .generator-loading-orbit span,
  .generator-hero > div:first-child::after,
  .chayt-plus-upsell-card::before {
    animation: none !important;
    transition: none !important;
  }
}

@media (max-width: 560px) {
  .msg .rich-scene-command,
  .roleplay-preview-bubble .rich-scene-command {
    padding: 2px 7px;
    border-radius: 12px;
    font-size: 11px;
    line-height: 1.22;
  }

  .msg .rich-scene-heading {
    font-size: 0.96em;
    line-height: 1.25;
  }

  .create-topbar {
    padding: 12px 14px;
  }
  .create-body,
  .settings-body {
    padding: 14px 12px 28px;
    gap: 14px;
    overflow-x: hidden;
  }
  .ai-provider-grid,
  .ai-provider-inner-grid {
    grid-template-columns: 1fr !important;
    gap: 10px;
  }
  .ai-provider-flat,
  .ai-provider-grid .full,
  .ai-provider-inner-grid .full {
    grid-column: 1 / -1;
  }
  .ai-provider-fields {
    padding-top: 2px;
  }
  .recent-chat-card {
    grid-template-columns: auto minmax(0, 1fr);
    padding: 12px 0;
  }
  .mobile-home-topbar {
    margin-left: -14px;
    margin-right: -14px;
  }
  .install-promo {
    padding: 16px;
  }
  .install-promo-actions > * {
    flex: 1 1 160px;
    justify-content: center;
  }
  .recent-chat-card-avatar {
    width: 44px;
    height: 44px;
  }
  .recent-chat-card-top {
    flex-direction: row;
    align-items: baseline;
  }
  .panel {
    padding: 14px;
  }
  .avatar-column,
  .profile-avatar-row,
  .avatar-row,
  .form-grid,
  .settings-grid,
  .form-group {
    width: 100%;
    min-width: 0;
  }
  .big-avatar {
    margin-inline: auto;
  }
  .profile-avatar-row {
    flex-direction: column;
    align-items: stretch;
  }
  .profile-avatar-copy {
    width: 100%;
  }
  .avatar-controls {
    display: grid;
    grid-template-columns: 1fr;
  }
  .avatar-controls > * {
    width: 100%;
    flex: 1 1 auto;
    min-width: 0;
  }
  .media-slot-card,
  .media-gallery-panel,
  .profile-avatar-panel {
    padding: 14px;
  }
  .form-actions {
    flex-direction: column;
    align-items: stretch;
  }
  .form-actions > * {
    width: 100%;
  }
  .create-persona-actions {
    grid-template-columns: 1fr;
  }
  #createView .create-publish-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .chat-topbar {
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas:
      "back info actions";
    padding: 12px 14px;
    column-gap: 8px;
  }
  #chatView.memory-open {
    overflow-y: auto;
  }
  #chatView.memory-open .messages {
    flex: 0 0 auto;
    min-height: auto;
    overflow: visible;
  }
  #chatView.memory-open .input-bar {
    margin-top: auto;
  }
  .chat-bot-info {
    gap: 10px;
  }
  .chat-avatar {
    width: 34px;
    height: 34px;
  }
  .input-bar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 44px 44px;
    align-items: end;
    gap: 8px;
    min-width: 0;
    padding:
      12px
      calc(12px + env(safe-area-inset-right, 0px))
      calc(12px + env(safe-area-inset-bottom, 0px))
      calc(12px + env(safe-area-inset-left, 0px));
  }
  .input-stack {
    flex: initial;
    min-width: 0;
    width: 100%;
  }
  #msgInput {
    width: 100%;
    min-width: 0;
  }
  .attach-btn,
  #sendBtn {
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    padding: 0;
    margin: 0;
    justify-self: stretch;
    align-self: end;
  }
  .credits-page {
    padding: 16px 12px 28px;
    gap: 14px;
  }
  .generator-page {
    padding: 16px 12px 28px;
    gap: 14px;
  }
  .credits-balance-card,
  .credits-panel,
  .generator-panel,
  .generator-quota-card,
  .credit-offer-card,
  .credit-history-item {
    padding: 14px;
    border-radius: 18px;
  }
  .generator-hero h1 {
    font-size: 32px;
  }
  .generator-chip-list,
  .generator-recent-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .generator-actions {
    display: grid;
    grid-template-columns: 1fr;
  }
  .generator-actions .btn-save,
  .generator-actions .mini-btn {
    width: 100%;
  }
  .chayt-plus-upsell-card {
    padding: 20px;
  }
  .generator-loading-card {
    padding: 22px 18px;
  }
  .generator-loading-steps {
    grid-template-columns: 1fr;
  }
  .chayt-plus-upsell-benefits {
    grid-template-columns: 1fr;
  }
  .credits-balance-value {
    font-size: 36px;
  }

  .avatar-crop-card {
    width: min(96vw, 560px);
    padding: 16px;
    border-radius: 22px;
  }
  .avatar-crop-head {
    flex-direction: column;
  }
  .avatar-crop-preview {
    grid-template-columns: 1fr;
  }
  .avatar-crop-preview-box {
    width: min(140px, 100%);
  }
  .credit-offer-top,
  .credit-history-item {
    gap: 10px;
  }

  #patchNotesView .create-body {
    padding-left: 12px;
    padding-right: 12px;
  }

  .mobile-discovery-links-grid {
    grid-template-columns: 1fr;
  }
}

.mobile-app-update-modal {
  position: fixed;
  inset: 0;
  z-index: 12000;
  display: grid;
  place-items: center;
  padding: 18px;
}

.mobile-app-update-modal.hidden {
  display: none;
}

.mobile-app-update-backdrop {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 22%, rgba(236, 72, 153, .22), transparent 34%),
    rgba(6, 6, 10, .84);
  backdrop-filter: blur(14px);
}

.mobile-beta-access-modal .mobile-app-update-backdrop {
  background:
    radial-gradient(circle at 50% 18%, rgba(255, 210, 120, .22), transparent 34%),
    radial-gradient(circle at 50% 78%, rgba(139, 124, 246, .18), transparent 38%),
    rgba(6, 6, 10, .84);
}

.mobile-app-update-card {
  position: relative;
  width: min(420px, 100%);
  max-height: calc(100vh - 36px);
  overflow: auto;
  padding: 22px;
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 26px;
  background: rgba(18, 18, 25, .96);
  box-shadow: 0 28px 90px rgba(0, 0, 0, .48);
  text-align: center;
  animation: mobileUpdateCardIn .38s cubic-bezier(.2, .8, .2, 1) both;
}

.mobile-app-update-art {
  width: min(180px, 52vw);
  aspect-ratio: 1;
  margin: -4px auto 6px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background:
    radial-gradient(circle, rgba(139, 124, 246, .2), transparent 64%),
    radial-gradient(circle at 58% 44%, rgba(236, 72, 153, .2), transparent 58%);
  filter: drop-shadow(0 18px 42px rgba(0, 0, 0, .36));
  animation: mobileUpdateMascotFloat 4.6s ease-in-out .35s infinite;
}

.mobile-app-update-art img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.mobile-beta-access-card .mobile-app-update-art {
  border-radius: 24px;
  aspect-ratio: 16 / 10;
  width: min(240px, 66vw);
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.12);
}

.mobile-beta-access-card .mobile-app-update-art img {
  object-fit: cover;
  object-position: center 36%;
}

.mobile-beta-access-card .mobile-app-update-kicker {
  border-color: rgba(255, 210, 120, .34);
  color: #fff0b8;
  background: rgba(255, 210, 120, .14);
}

.mobile-app-update-kicker {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 999px;
  color: #d9d2ff;
  background: rgba(139, 124, 246, .14);
  font-size: 12px;
  font-weight: 800;
}

.mobile-app-update-card h2 {
  margin: 14px 0 0;
  color: #fff;
  font-size: 25px;
  line-height: 1.12;
  letter-spacing: 0;
}

.mobile-app-update-card p {
  margin: 12px 0 0;
  color: rgba(247, 244, 255, .78);
  font-size: 14px;
  line-height: 1.55;
}

.mobile-app-update-meta {
  margin-top: 12px;
  color: rgba(247, 244, 255, .56);
  font-size: 12px;
  font-weight: 700;
}

.mobile-app-update-actions {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.mobile-app-update-actions .btn-save,
.mobile-app-update-actions .mini-btn {
  width: 100%;
  min-height: 46px;
  justify-content: center;
}

.mobile-app-update-actions .mini-btn.ghost {
  border-color: rgba(255, 255, 255, .16);
  color: rgba(247, 244, 255, .86);
  background: rgba(255, 255, 255, .035);
}

.mobile-app-update-later {
  margin-top: 12px;
  border: 0;
  background: transparent;
  color: rgba(247, 244, 255, .62);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

@keyframes mobileUpdateCardIn {
  from {
    opacity: 0;
    transform: translateY(18px) scale(.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes mobileUpdateMascotFloat {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-7px);
  }
}

@media (max-height: 680px) {
  .mobile-app-update-card {
    padding: 18px;
  }

  .mobile-app-update-art {
    width: min(132px, 42vw);
  }

  .mobile-app-update-card h2 {
    font-size: 22px;
  }
}

@media (max-width: 960px) {
  #creditsView .credits-page,
  .chayt-plus-page,
  #aimodelratingView .create-body,
  #settingsView .create-body,
  #historyView .history-body,
  #chatStyleView .history-body,
  #conversationMemoryView .history-body {
    padding-left: 16px;
    padding-right: 16px;
    padding-bottom: calc(110px + env(safe-area-inset-bottom, 0px));
  }

  .chayt-plus-hero,
  .chayt-plus-benefits,
  .chayt-plus-plans,
  .chayt-plus-mini-plans {
    grid-template-columns: 1fr;
  }

  .chayt-plus-hero {
    padding: 20px;
    border-radius: 20px;
  }

  .chayt-plus-hero h1 {
    font-size: 36px;
  }

  #aimodelratingView .ai-model-rating-shell {
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }

  #aimodelratingView .ai-model-rating-toolbar {
    padding: 0 0 14px;
    border: 0;
    border-radius: 0;
    background: transparent;
  }

  #aimodelratingView .ai-model-card {
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    border-bottom: 1px solid rgba(255,255,255,0.06);
  }

  #aimodelratingView .ai-model-card:last-child {
    border-bottom: 0;
  }

  #aimodelratingView .ai-model-card-link {
    padding: 16px 0;
  }

  #aimodelratingView .ai-model-rating-detail-head,
  #aimodelratingView .ai-model-rating-summary-card,
  #aimodelratingView .ai-model-rating-form-card,
  #aimodelratingView .ai-model-comments-card {
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }

  #aimodelratingView .ai-model-rating-detail-head {
    gap: 12px;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
  }

  #aimodelratingView .ai-model-rating-detail-grid {
    gap: 18px;
  }

  #aimodelratingView .ai-model-rating-summary-card,
  #aimodelratingView .ai-model-rating-form-card {
    padding-bottom: 18px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
  }

  #aimodelratingView #aiModelRatingComments {
    max-height: none;
    overflow: visible;
  }

  #aimodelratingView .ai-model-comment {
    padding: 14px 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    border-bottom: 1px solid rgba(255,255,255,0.06);
  }

  #aimodelratingView .ai-model-comment:last-of-type {
    border-bottom: 0;
  }

  #settingsView .panel {
    padding: 0 0 22px;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    border-bottom: 1px solid rgba(255,255,255,0.06);
  }

  #settingsView .settings-overview {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  #settingsView .settings-overview-card {
    border-radius: 12px;
    padding: 13px;
  }

  #settingsView .danger-zone-head,
  #settingsView .danger-zone-card {
    grid-template-columns: 1fr;
  }

  #settingsView .danger-zone-head {
    align-items: stretch;
  }

  #settingsView .danger-zone-badge {
    width: fit-content;
  }

  #settingsView .danger-zone-card {
    padding: 14px 0 0;
    border: 0;
    border-radius: 0;
    background: transparent;
  }

  #settingsView .danger-zone-actions {
    justify-content: stretch;
  }

  #settingsView .danger-zone-actions > * {
    flex: 1 1 auto;
    text-align: center;
  }

  .delete-account-warning-modal {
    align-items: flex-end;
    padding: 12px;
  }

  .delete-account-warning-card {
    width: 100%;
    max-height: min(88vh, 760px);
    padding: 24px 18px calc(24px + env(safe-area-inset-bottom, 0px));
    border-radius: 22px;
  }

  .delete-account-warning-card h2 {
    font-size: 23px;
  }

  .delete-account-warning-actions {
    flex-direction: column-reverse;
  }

  .delete-account-warning-actions > * {
    width: 100%;
  }

  #settingsView .panel:last-child {
    border-bottom: 0;
    padding-bottom: 0;
  }

  #historyView .history-body {
    gap: 14px;
  }

  #historyView .history-list {
    gap: 0;
  }

  #historyView .history-card {
    padding: 16px 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    border-bottom: 1px solid rgba(255,255,255,0.06);
  }

  #historyView .history-card:last-child {
    border-bottom: 0;
  }

  #historyView .history-card-sessions {
    gap: 0;
  }

  #historyView .history-session {
    padding: 12px 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    border-bottom: 1px solid rgba(255,255,255,0.06);
  }

  #historyView .history-session:last-child {
    border-bottom: 0;
  }

  #historyView .history-session:hover {
    background: transparent;
  }

  .mobile-slide-view.active {
    position: fixed;
    inset: 0;
    width: 100dvw;
    max-width: 100dvw;
    height: 100dvh;
    min-height: 100dvh;
    box-sizing: border-box;
    z-index: 2400;
    background: var(--bg);
    overflow: hidden;
    animation: mobileSlideFromRight 0.26s cubic-bezier(.22,.7,.18,1) both;
  }

  .mobile-slide-view.is-leaving {
    position: fixed;
    inset: 0;
    width: 100dvw;
    max-width: 100dvw;
    height: 100dvh;
    min-height: 100dvh;
    box-sizing: border-box;
    display: flex;
    z-index: 2400;
    background: var(--bg);
    overflow: hidden;
    pointer-events: none;
    animation: mobileSlideToRight 0.24s cubic-bezier(.22,.7,.18,1) both;
  }

  #conversationMemoryView.active,
  #chatStyleView.active,
  #historyView.active {
    left: 0;
    right: 0;
    width: 100dvw;
    max-width: 100dvw;
  }

  #conversationMemoryView.active,
  #chatStyleView.active {
    height: 100vh;
    min-height: 100vh;
    height: 100svh;
    min-height: 100svh;
    height: 100dvh;
    min-height: 100dvh;
  }

  #conversationMemoryView .history-topbar,
  #chatStyleView .history-topbar,
  #historyView .history-topbar,
  #conversationMemoryView .history-body,
  #chatStyleView .history-body,
  #historyView .history-body {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }

  #conversationMemoryView .conversation-memory-body,
  #chatStyleView .chat-style-body {
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    align-content: start;
    padding-bottom: calc(120px + env(safe-area-inset-bottom, 0px));
    scroll-padding-bottom: calc(120px + env(safe-area-inset-bottom, 0px));
  }

  #conversationMemoryView .conversation-memory-body {
    flex: 1 0 auto;
    min-height: calc(100vh - 78px);
    min-height: calc(100svh - 78px);
    min-height: calc(100dvh - 78px);
    background: var(--bg);
  }

  #chatStyleView .chat-style-body {
    flex: 1 0 auto;
    min-height: calc(100vh - 78px);
    min-height: calc(100svh - 78px);
    min-height: calc(100dvh - 78px);
    background: var(--bg);
  }

  #chatStyleView .chat-style-panel {
    width: 100%;
  }

  #conversationMemoryView .memory-panel {
    width: 100%;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    backdrop-filter: none;
    gap: 16px;
  }

  #conversationMemoryView .memory-panel-head {
    gap: 14px;
  }

  #conversationMemoryView .memory-actions {
    width: 100%;
    justify-content: flex-start;
  }

  #conversationMemoryView .memory-actions .memory-icon-btn {
    width: 42px;
    height: 42px;
    flex-basis: 42px;
  }

  #conversationMemoryView .memory-model-grid {
    grid-template-columns: 1fr;
    margin: 0;
  }

  #chatStyleView .memory-model-field {
    padding: 10px 0;
    border-bottom: 1px solid rgba(255,255,255,0.06);
  }

  #chatStyleView .chat-style-model-browser,
  #conversationMemoryView #conversationSummaryModelPicker .chat-style-model-browser {
    gap: 18px;
  }

  #chatStyleView .chat-style-model-section,
  #conversationMemoryView #conversationSummaryModelPicker .chat-style-model-section {
    gap: 10px;
    min-width: 0;
  }

  #chatStyleView .chat-style-section-pill,
  #conversationMemoryView #conversationSummaryModelPicker .chat-style-section-pill {
    min-height: 34px;
    padding: 0;
    border-radius: 0;
    font-size: 18px;
  }

  #chatStyleView .chat-style-section-note,
  #conversationMemoryView #conversationSummaryModelPicker .chat-style-section-note {
    font-size: 11px;
  }

  #chatStyleView .chat-style-model-row,
  #conversationMemoryView #conversationSummaryModelPicker .chat-style-model-row {
    grid-auto-flow: column;
    grid-auto-columns: minmax(190px, 224px);
    grid-template-columns: unset;
    gap: 12px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    padding: 1px 16px 14px 2px;
    scroll-padding-right: 16px;
    touch-action: pan-x;
  }

  #chatStyleView .chat-style-model-card,
  #conversationMemoryView #conversationSummaryModelPicker .chat-style-model-card {
    min-height: 186px;
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(70px, 1fr) auto;
    align-items: stretch;
    gap: 14px;
    padding: 20px;
    border-radius: 12px;
    background: #242427;
  }

  #chatStyleView .chat-style-model-title,
  #conversationMemoryView #conversationSummaryModelPicker .chat-style-model-title {
    padding-bottom: 14px;
    border-bottom: 1px solid rgba(255,255,255,0.055);
    font-size: 18px;
    line-height: 1.18;
  }

  #chatStyleView .chat-style-model-desc,
  #conversationMemoryView #conversationSummaryModelPicker .chat-style-model-desc {
    grid-column: auto;
    font-size: 13px;
    line-height: 1.42;
  }

  #chatStyleView .chat-style-model-foot,
  #conversationMemoryView #conversationSummaryModelPicker .chat-style-model-foot {
    grid-column: auto;
    grid-row: auto;
    justify-self: stretch;
    align-self: end;
    flex-direction: row;
    align-items: flex-end;
    gap: 10px;
    font-size: 10.5px;
  }

  #chatStyleView .chat-style-energy-note,
  #conversationMemoryView #conversationSummaryModelPicker .chat-style-energy-note {
    max-width: 108px;
  }

  #yourCharactersView .your-characters-page {
    padding-left: 16px;
    padding-right: 16px;
    padding-bottom: calc(110px + env(safe-area-inset-bottom, 0px));
    gap: 14px;
  }

  #yourCharactersView .your-characters-hero,
  #yourCharactersView .your-characters-toolbar {
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }

  #yourCharactersView .your-characters-hero::after {
    display: none;
  }

  #yourCharactersView .your-characters-hero {
    gap: 12px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    padding-bottom: 18px;
  }

  #yourCharactersView .your-characters-toolbar {
    gap: 10px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    padding-bottom: 16px;
  }

  #yourCharactersView .your-characters-grid {
    gap: 0;
  }

  #yourCharactersView .your-character-card {
    padding: 16px 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    border-bottom: 1px solid rgba(255,255,255,0.06);
  }

  #yourCharactersView .your-character-card:hover {
    transform: none;
    border-color: rgba(255,255,255,0.06);
  }

  #yourCharactersView .your-character-card:last-child {
    border-bottom: 0;
  }

  #creditsView .credits-hero > div:first-child,
  #creditsView .credits-balance-card,
  #creditsView .credits-panel {
    padding-left: 0;
    padding-right: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }

  #creditsView .credits-hero {
    gap: 14px;
  }

  #creditsView .credits-page > * {
    border-bottom: 1px solid rgba(255,255,255,0.06);
    padding-bottom: 18px;
  }

  #creditsView .credits-page > *:last-child {
    border-bottom: 0;
    padding-bottom: 0;
  }
}

@media (max-width: 560px) {
  #homeView .discovery-tabs {
    margin: calc(68px + env(safe-area-inset-top, 0px)) -12px 0 !important;
    gap: 20px;
    padding: 8px 12px 0 !important;
  }

  #homeView .discovery-tab {
    font-size: 17px;
    padding-bottom: 8px;
  }

  .profile-interest-panel {
    padding: 10px;
  }

  .profile-interest-head {
    align-items: stretch;
    flex-direction: column;
  }

  .profile-interest-search {
    width: 100%;
  }

  .profile-interest-chip {
    min-height: 32px;
    padding: 5px 9px;
  }

  #creditsView .credits-page,
  #aimodelratingView .create-body,
  #settingsView .create-body,
  #historyView .history-body,
  #conversationMemoryView .history-body {
    padding-left: 12px;
    padding-right: 12px;
  }

  #chatStyleView .chat-style-model-row,
  #conversationMemoryView #conversationSummaryModelPicker .chat-style-model-row {
    grid-auto-columns: minmax(176px, 212px);
  }

  #aimodelratingView .ai-model-card,
  #aimodelratingView .ai-model-rating-summary-card,
  #aimodelratingView .ai-model-rating-form-card,
  #aimodelratingView .ai-model-comments-card {
    border-radius: 20px;
  }

  #aimodelratingView .ai-model-card {
    border-radius: 0;
  }

  .ai-model-comments-pagination {
    flex-direction: column;
    align-items: stretch;
  }

  .ai-model-comments-pagination-left,
  .ai-model-comments-pagination-actions {
    width: 100%;
    justify-content: space-between;
  }

  .ai-model-comments-page-info {
    flex: 1 1 auto;
    text-align: center;
  }

  #historyView .history-session {
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: start;
  }

  #historyView .history-session-preview {
    grid-column: 2 / -1;
  }

  #yourCharactersView .your-characters-page {
    padding-left: 12px;
    padding-right: 12px;
  }
}

@media (min-width: 961px) {
  #creditsView .credits-topbar,
  #creditsView .credits-page,
  #aimodelratingView .create-topbar,
  #aimodelratingView .create-body {
    width: min(calc(100% - 32px), 1476px);
    max-width: 1476px;
    align-self: center;
    box-sizing: border-box;
  }

  #settingsView .create-topbar,
  #settingsView .create-body {
    width: min(100%, 960px);
    max-width: 960px;
    align-self: center;
    box-sizing: border-box;
  }

  #creditsView .credits-page,
  #aimodelratingView .create-body,
  #settingsView .create-body {
    flex: 0 1 auto;
    overflow-x: hidden;
  }

  #aimodelratingView .ai-model-rating-shell,
  #aimodelratingView .ai-model-rating-toolbar,
  #aimodelratingView .ai-model-rating-grid,
  #creditsView .credits-page > * {
    min-width: 0;
    max-width: 100%;
  }
}

@media (max-width: 960px) {
  .discovery-search-page {
    overflow-y: auto;
    overflow-x: hidden;
    scroll-padding-bottom: calc(160px + env(safe-area-inset-bottom, 0px));
  }

  .discovery-search-head {
    z-index: 8;
  }

  .discovery-search-body {
    overflow: visible;
    padding-top: 10px;
  }

  .discovery-search-results {
    overflow: visible;
    gap: 12px;
    padding-bottom: calc(156px + env(safe-area-inset-bottom, 0px));
  }

  .discovery-search-result-card.discovery-search-simple-card {
    grid-template-columns: minmax(108px, 34%) minmax(0, 1fr);
    min-height: 174px;
    border-radius: 14px;
    overflow: hidden;
  }

  .discovery-search-simple-image,
  .discovery-search-result-card .bot-card-media {
    width: 100%;
    min-width: 0;
    height: 100%;
    min-height: 174px;
  }

  .discovery-search-simple-copy {
    min-width: 0;
    align-self: stretch;
    align-content: center;
    padding: 16px 12px 16px 0;
    overflow: hidden;
  }

  .discovery-search-simple-name,
  .discovery-search-simple-desc {
    min-width: 0;
    overflow-wrap: anywhere;
  }

  .discovery-search-simple-name {
    font-size: clamp(19px, 5vw, 24px);
    line-height: 1.16;
  }

  .discovery-search-simple-desc {
    font-size: clamp(14px, 3.8vw, 17px);
    line-height: 1.35;
    -webkit-line-clamp: 3;
  }

  .discovery-search-simple-tags {
    max-height: none;
    gap: 6px;
    overflow: visible;
  }

  .discovery-search-simple-tags .bot-chip {
    max-width: 100%;
  }

  .discovery-search-load-more-modal {
    position: sticky;
    bottom: calc(22px + env(safe-area-inset-bottom, 0px));
    z-index: 7;
    width: min(420px, calc(100% - 18px));
    margin: 10px auto calc(18px + env(safe-area-inset-bottom, 0px));
  }
}

@media (max-width: 960px) {
  #settingsView .settings-body {
    gap: 16px !important;
    padding-top: 14px !important;
    padding-bottom: calc(240px + env(safe-area-inset-bottom, 0px)) !important;
    scroll-padding-bottom: calc(240px + env(safe-area-inset-bottom, 0px)) !important;
  }

  #settingsView .settings-overview {
    position: relative;
    margin-bottom: 2px;
  }

  #settingsView .settings-overview-card {
    border-radius: 18px;
    border-color: rgba(255,255,255,0.09);
    background:
      radial-gradient(circle at 0% 0%, rgba(139,124,246,0.18), transparent 46%),
      linear-gradient(135deg, rgba(255,255,255,0.07), rgba(255,255,255,0.025));
  }

  #settingsView .panel {
    padding: 16px !important;
    border: 1px solid rgba(255,255,255,0.08) !important;
    border-radius: 20px !important;
    background:
      linear-gradient(180deg, rgba(255,255,255,0.045), rgba(255,255,255,0.018)),
      rgba(15,15,21,0.86) !important;
    box-shadow: 0 16px 44px rgba(0,0,0,0.16) !important;
  }

  #settingsView .panel-title {
    color: rgba(226,226,238,0.94);
    font-size: 15px;
    letter-spacing: 0.06em;
  }

  #settingsView .setting-help.full-line,
  #settingsView .setting-help {
    color: rgba(164,164,194,0.92);
    line-height: 1.5;
  }

  #settingsView .profile-settings-guide {
    gap: 10px;
  }

  #settingsView .profile-settings-guide .settings-guide-card {
    padding: 13px;
    border-radius: 16px;
    border-color: rgba(139,124,246,0.18);
    background: rgba(139,124,246,0.065);
  }

  #settingsView .profile-avatar-row-flat {
    align-items: center;
    text-align: center;
    padding: 16px;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 20px;
    background: rgba(0,0,0,0.16);
  }

  #settingsView .profile-avatar-row-flat .big-avatar {
    width: 86px;
    height: 86px;
  }

  #settingsView .profile-avatar-copy {
    width: 100%;
  }

  #settingsView .profile-avatar-copy .profile-section-title {
    justify-content: center;
    font-size: 13px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
  }

  #settingsView .avatar-controls {
    display: grid;
    grid-template-columns: 1fr;
    gap: 9px;
  }

  #settingsView .avatar-controls .mini-btn {
    width: 100%;
    justify-content: center;
    min-height: 40px;
  }

  #settingsView .form-section-heading {
    margin: 6px 0 0;
    padding: 10px 0 2px;
    color: rgba(226,226,238,0.95);
    font-size: 12px;
    letter-spacing: 0.09em;
  }

  #settingsView .profile-grid > .form-group,
  #settingsView .settings-grid > .form-group {
    padding: 12px;
    border: 1px solid rgba(255,255,255,0.065);
    border-radius: 16px;
    background: rgba(0,0,0,0.13);
  }

  #settingsView .profile-grid > .form-group.full {
    grid-column: 1 / -1;
  }

  #settingsView .form-group input,
  #settingsView .form-group textarea,
  #settingsView .form-group select {
    min-height: 40px;
    border-radius: 12px;
    background: rgba(255,255,255,0.045);
  }

  #settingsView .form-row {
    gap: 12px;
    padding: 14px 0;
  }

  #settingsView .profile-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
  }

  #settingsView .profile-actions > * {
    width: 100%;
    min-height: 42px;
    justify-content: center;
  }

  #settingsView #dangerZonePanel {
    margin-top: 4px;
    margin-bottom: calc(28px + env(safe-area-inset-bottom, 0px));
    border-color: rgba(224,85,85,0.34) !important;
    background:
      radial-gradient(circle at 0% 0%, rgba(224,85,85,0.2), transparent 48%),
      linear-gradient(180deg, rgba(224,85,85,0.085), rgba(255,255,255,0.018)),
      rgba(15,15,21,0.95) !important;
  }

  #settingsView #dangerZonePanel .danger-zone-card {
    padding: 13px;
    border: 1px solid rgba(224,85,85,0.18);
    border-radius: 16px;
    background: rgba(0,0,0,0.18);
  }
}

/* Settings overlay + final mobile cleanup pass */
.settings-overview-card {
  color: inherit;
  text-decoration: none;
}

@media (min-width: 961px) {
  body.chat-overlay-open #historyView.active,
  body.chat-overlay-open #chatStyleView.active,
  body.chat-overlay-open #conversationMemoryView.active {
    position: fixed;
    inset: 0;
    z-index: 2150;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 28px;
    background: rgba(8,8,12,0.74);
    backdrop-filter: blur(16px);
    overflow: hidden;
    animation: chatOverlayBackdropIn 260ms cubic-bezier(.22,.7,.18,1) both;
  }

  #historyView.active.is-overlay-closing,
  #chatStyleView.active.is-overlay-closing,
  #conversationMemoryView.active.is-overlay-closing,
  body.chat-overlay-open #historyView.active.is-overlay-closing,
  body.chat-overlay-open #chatStyleView.active.is-overlay-closing,
  body.chat-overlay-open #conversationMemoryView.active.is-overlay-closing {
    pointer-events: none;
    animation: chatOverlayBackdropOut 260ms cubic-bezier(.32,0,.2,1) both;
  }

  body.chat-overlay-open #historyView .history-topbar,
  body.chat-overlay-open #chatStyleView .history-topbar,
  body.chat-overlay-open #conversationMemoryView .history-topbar,
  body.chat-overlay-open #historyView .history-body,
  body.chat-overlay-open #chatStyleView .history-body,
  body.chat-overlay-open #conversationMemoryView .history-body {
    width: min(960px, calc(100vw - 56px));
    max-width: 960px;
    box-sizing: border-box;
    animation: chatOverlayPanelIn 300ms cubic-bezier(.18,.84,.24,1) both;
  }

  #historyView.active.is-overlay-closing .history-topbar,
  #historyView.active.is-overlay-closing .history-body,
  #chatStyleView.active.is-overlay-closing .history-topbar,
  #chatStyleView.active.is-overlay-closing .history-body,
  #conversationMemoryView.active.is-overlay-closing .history-topbar,
  #conversationMemoryView.active.is-overlay-closing .history-body {
    animation: chatOverlayPanelOut 230ms cubic-bezier(.32,0,.2,1) both;
  }

  body.chat-overlay-open #historyView .history-topbar,
  body.chat-overlay-open #chatStyleView .history-topbar,
  body.chat-overlay-open #conversationMemoryView .history-topbar {
    border: 1px solid rgba(255,255,255,0.1);
    border-bottom: 0;
    border-radius: 22px 22px 0 0;
    background:
      radial-gradient(circle at 12% 0%, rgba(139,124,246,0.16), transparent 42%),
      rgba(18,18,24,0.98);
    box-shadow: 0 24px 80px rgba(0,0,0,0.34);
  }

  body.chat-overlay-open #historyView .history-body,
  body.chat-overlay-open #chatStyleView .history-body,
  body.chat-overlay-open #conversationMemoryView .history-body {
    max-height: min(820px, calc(100dvh - 112px));
    overflow-y: auto;
    padding: 24px 26px 32px;
    border: 1px solid rgba(255,255,255,0.1);
    border-top: 0;
    border-radius: 0 0 22px 22px;
    background:
      linear-gradient(180deg, rgba(255,255,255,0.025), rgba(255,255,255,0.012)),
      rgba(13,13,18,0.98);
    box-shadow: 0 24px 80px rgba(0,0,0,0.42);
  }

  body.chat-overlay-open #historyView .history-list {
    max-height: none;
  }

  body.chat-overlay-open #chatStyleView .chat-style-panel,
  body.chat-overlay-open #conversationMemoryView .memory-panel {
    width: 100%;
  }

  body.chat-overlay-open #conversationMemoryView .memory-panel {
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    backdrop-filter: none;
  }

  body.chat-overlay-open #conversationMemoryView .memory-model-grid {
    grid-template-columns: 1fr;
    margin: 8px 0 0;
  }

  body.chat-overlay-open #conversationMemoryView .memory-model-field {
    width: 100%;
    min-width: 0;
  }

  body.chat-overlay-open #conversationMemoryView #conversationSummaryModelPicker {
    width: 100%;
    min-width: 0;
  }

  body.chat-overlay-open #conversationMemoryView #conversationSummaryModelPicker .chat-style-model-browser {
    gap: 16px;
  }

  body.chat-overlay-open #conversationMemoryView #conversationSummaryModelPicker .chat-style-model-row {
    padding-bottom: 4px;
  }

  body.chat-overlay-open #conversationMemoryView #conversationSummaryModelHint {
    display: none;
  }

  body.chat-overlay-open #conversationMemoryView #conversationSummaryInput {
    min-height: 128px;
    max-height: 180px;
    order: 2;
  }

  body.chat-overlay-open #conversationMemoryView .memory-model-grid {
    order: 3;
  }

  #chatView .chat-menu .chat-menu-new-btn svg {
    display: none;
  }

  #chatView .chat-menu .chat-menu-new-btn {
    gap: 0;
  }
}

@keyframes chatOverlayBackdropIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes chatOverlayBackdropOut {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

@keyframes chatOverlayPanelIn {
  from {
    opacity: 0;
    transform: translateY(28px) scale(0.965);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes chatOverlayPanelOut {
  from {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  to {
    opacity: 0;
    transform: translateY(20px) scale(0.975);
  }
}

@media (min-width: 961px) {
  body[data-current-view="history"] #chatView.active,
  body[data-current-view="chatStyle"] #chatView.active,
  body[data-current-view="conversationMemory"] #chatView.active {
    display: flex;
  }

  body[data-current-view="history"] #historyView.active,
  body[data-current-view="chatStyle"] #chatStyleView.active,
  body[data-current-view="conversationMemory"] #conversationMemoryView.active {
    position: fixed;
    inset: 0;
    z-index: 2150;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  body[data-current-view="history"] #chatView .chat-menu .chat-menu-new-btn svg,
  body[data-current-view="chatStyle"] #chatView .chat-menu .chat-menu-new-btn svg,
  body[data-current-view="conversationMemory"] #chatView .chat-menu .chat-menu-new-btn svg,
  #chatView .chat-menu .chat-menu-new-btn svg {
    display: none !important;
  }
}

@media (min-width: 961px) {
  body.settings-overlay-open #settingsView.active {
    position: fixed;
    inset: 0;
    z-index: 2100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 28px;
    background: rgba(8,8,12,0.74);
    backdrop-filter: blur(16px);
    overflow: hidden;
    animation: settingsOverlayFade 180ms ease both;
  }

  body.settings-overlay-open #settingsView .create-topbar,
  body.settings-overlay-open #settingsView .create-body {
    width: min(960px, calc(100vw - 56px));
    max-width: 960px;
    align-self: auto;
    box-sizing: border-box;
  }

  body.settings-overlay-open #settingsView .create-topbar {
    border: 1px solid rgba(255,255,255,0.1);
    border-bottom: 0;
    border-radius: 22px 22px 0 0;
    background:
      radial-gradient(circle at 12% 0%, rgba(139,124,246,0.16), transparent 42%),
      rgba(18,18,24,0.98);
    box-shadow: 0 24px 80px rgba(0,0,0,0.34);
  }

  body.settings-overlay-open #settingsView .create-body {
    max-height: min(820px, calc(100dvh - 112px));
    flex: 0 1 auto;
    overflow-y: auto;
    padding: 24px 26px 32px;
    border: 1px solid rgba(255,255,255,0.1);
    border-top: 0;
    border-radius: 0 0 22px 22px;
    background:
      linear-gradient(180deg, rgba(255,255,255,0.025), rgba(255,255,255,0.012)),
      rgba(13,13,18,0.98);
    box-shadow: 0 24px 80px rgba(0,0,0,0.42);
  }

  body.settings-overlay-open #settingsView .panel {
    border-color: rgba(255,255,255,0.09);
    background:
      linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.018)),
      rgba(20,20,26,0.92);
  }
}

@keyframes settingsOverlayFade {
  from {
    opacity: 0;
    transform: scale(0.985);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@media (max-width: 960px) {
  #settingsView.active {
    background:
      radial-gradient(circle at 50% -10%, rgba(139,124,246,0.18), transparent 32%),
      #0b0b10;
  }

  #settingsView .create-topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    min-height: 58px;
    padding: calc(10px + env(safe-area-inset-top, 0px)) 12px 10px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    background: rgba(13,13,18,0.92);
    backdrop-filter: blur(18px);
  }

  #settingsView .create-title {
    font-size: 18px;
    font-weight: 800;
  }

  #settingsView .settings-body {
    max-width: 100% !important;
    padding: 14px 12px calc(260px + env(safe-area-inset-bottom, 0px)) !important;
    gap: 14px !important;
    overflow-y: auto !important;
    scroll-padding-bottom: calc(260px + env(safe-area-inset-bottom, 0px)) !important;
  }

  #settingsView .settings-overview {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
  }

  #settingsView .settings-overview-card {
    min-height: 88px;
    padding: 14px 15px;
    border-radius: 20px;
    border: 1px solid rgba(255,255,255,0.1);
    background:
      radial-gradient(circle at 0% 0%, rgba(139,124,246,0.22), transparent 52%),
      linear-gradient(135deg, rgba(255,255,255,0.075), rgba(255,255,255,0.028));
    box-shadow: 0 16px 38px rgba(0,0,0,0.2);
  }

  #settingsView .panel {
    padding: 16px !important;
    border: 1px solid rgba(255,255,255,0.09) !important;
    border-radius: 22px !important;
    background:
      linear-gradient(180deg, rgba(255,255,255,0.05), rgba(255,255,255,0.018)),
      rgba(15,15,21,0.94) !important;
    box-shadow: 0 14px 38px rgba(0,0,0,0.18) !important;
  }

  #settingsView .panel-title {
    color: rgba(244,244,252,0.96);
    font-size: 15px;
    font-weight: 850;
  }

  #settingsView .profile-settings-guide .settings-guide-card,
  #settingsView .profile-avatar-row-flat,
  #settingsView .profile-grid > .form-group,
  #settingsView .settings-grid > .form-group,
  #settingsView .profile-interest-panel {
    border: 1px solid rgba(255,255,255,0.075);
    border-radius: 18px;
    background: rgba(0,0,0,0.16);
  }

  #settingsView .profile-avatar-row-flat {
    align-items: center;
    text-align: center;
    padding: 16px;
  }

  #settingsView .profile-avatar-row-flat .big-avatar {
    width: 90px;
    height: 90px;
  }

  #settingsView .profile-avatar-copy,
  #settingsView .avatar-controls,
  #settingsView .profile-actions {
    width: 100%;
  }

  #settingsView .avatar-controls,
  #settingsView .profile-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 9px;
  }

  #settingsView .avatar-controls .mini-btn,
  #settingsView .profile-actions > * {
    width: 100%;
    min-height: 42px;
    justify-content: center;
  }

  #settingsView .form-section-heading {
    padding-top: 10px;
    color: rgba(244,244,252,0.96);
    font-size: 12px;
    letter-spacing: 0.09em;
  }

  #settingsView .form-group input,
  #settingsView .form-group textarea,
  #settingsView .form-group select {
    min-height: 42px;
    border-radius: 14px;
    background: rgba(255,255,255,0.055);
  }

  #settingsView #dangerZonePanel {
    display: grid !important;
    gap: 14px !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow: visible !important;
    margin-bottom: calc(42px + env(safe-area-inset-bottom, 0px));
    border-color: rgba(224,85,85,0.42) !important;
    background:
      radial-gradient(circle at 0% 0%, rgba(224,85,85,0.22), transparent 48%),
      linear-gradient(180deg, rgba(224,85,85,0.09), rgba(255,255,255,0.018)),
      rgba(16,12,16,0.98) !important;
  }

  #settingsView #dangerZonePanel .danger-zone-head {
    display: grid !important;
    grid-template-columns: 1fr auto;
    gap: 10px;
    align-items: start;
  }

  #settingsView #dangerZonePanel .danger-zone-card {
    display: grid !important;
    grid-template-columns: auto minmax(0, 1fr) !important;
    gap: 12px;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    padding: 14px;
    border: 1px solid rgba(224,85,85,0.2);
    border-radius: 18px;
    background:
      radial-gradient(circle at 0% 0%, rgba(224,85,85,0.14), transparent 56%),
      rgba(0,0,0,0.18);
  }

  #settingsView #dangerZonePanel .danger-zone-icon {
    width: 40px;
    height: 40px;
    border-radius: 14px;
  }

  #settingsView #dangerZonePanel .danger-zone-card p,
  #settingsView #dangerZonePanel .setting-help {
    display: block !important;
    color: rgba(255,205,205,0.82) !important;
  }

  #settingsView #dangerZonePanel .danger-zone-actions {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 9px;
    grid-column: 1 / -1;
  }

  #settingsView #dangerZonePanel .danger-zone-details-link {
    width: 100%;
    min-height: 42px;
    border-color: rgba(255,255,255,0.1);
    border-radius: 14px;
    background: rgba(255,255,255,0.055);
  }
}

@media (max-width: 960px) {
  #settingsView #dangerZonePanel {
    display: flex !important;
    flex-direction: column !important;
    gap: 14px !important;
    padding: 18px !important;
    border: 1px solid rgba(224,85,85,0.34) !important;
    border-radius: 24px !important;
    background:
      radial-gradient(circle at 0% 0%, rgba(224,85,85,0.18), transparent 42%),
      linear-gradient(180deg, rgba(224,85,85,0.08), rgba(255,255,255,0.018)),
      rgba(15,13,18,0.98) !important;
    box-shadow: 0 18px 44px rgba(0,0,0,0.24) !important;
    overflow: hidden !important;
  }

  #settingsView #dangerZonePanel::before {
    display: none !important;
  }

  #settingsView #dangerZonePanel .danger-zone-head {
    display: flex !important;
    align-items: flex-start !important;
    justify-content: space-between !important;
    gap: 12px !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
  }

  #settingsView #dangerZonePanel .danger-zone-head .panel-title {
    color: #fff0f0 !important;
    font-size: 16px !important;
    letter-spacing: 0.08em !important;
  }

  #settingsView #dangerZonePanel .danger-zone-head .setting-help {
    display: none !important;
  }

  #settingsView #dangerZonePanel .danger-zone-badge {
    align-self: flex-start;
    width: auto !important;
    padding: 6px 9px !important;
    border-radius: 999px !important;
    background: rgba(224,85,85,0.12) !important;
    border: 1px solid rgba(224,85,85,0.32) !important;
    color: #ffc4c4 !important;
    font-size: 10px !important;
    line-height: 1 !important;
  }

  #settingsView #dangerZonePanel .danger-zone-card {
    display: grid !important;
    grid-template-columns: 42px minmax(0, 1fr) !important;
    gap: 12px !important;
    align-items: start !important;
    padding: 14px !important;
    border: 1px solid rgba(224,85,85,0.22) !important;
    border-radius: 20px !important;
    background:
      linear-gradient(135deg, rgba(224,85,85,0.11), rgba(255,255,255,0.018)),
      rgba(0,0,0,0.18) !important;
  }

  #settingsView #dangerZonePanel .danger-zone-icon {
    width: 42px !important;
    height: 42px !important;
    margin: 0 !important;
    border-radius: 15px !important;
    grid-column: 1;
    grid-row: 1;
  }

  #settingsView #dangerZonePanel .danger-zone-card > div:nth-child(2) {
    grid-column: 2;
    min-width: 0;
  }

  #settingsView #dangerZonePanel .danger-zone-card strong {
    color: #fff4f4 !important;
    font-size: 15px !important;
  }

  #settingsView #dangerZonePanel .danger-zone-card p {
    margin-top: 6px !important;
    color: rgba(255,220,220,0.82) !important;
    font-size: 13px !important;
    line-height: 1.5 !important;
  }

  #settingsView #dangerZonePanel .danger-zone-actions {
    grid-column: 1 / -1 !important;
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 10px !important;
    margin-top: 4px !important;
  }

  #settingsView #dangerZonePanel .danger-zone-details-link,
  #settingsView #dangerZonePanel .btn-delete {
    width: 100% !important;
    min-height: 44px !important;
    border-radius: 15px !important;
    font-weight: 800 !important;
  }

  #settingsView #dangerZonePanel .danger-zone-mobile-card .btn-delete {
    margin-top: 54px !important;
  }
}

@media (max-width: 960px) {
  #settingsView #dangerZonePanel,
  #settingsView #dangerZonePanel * {
    min-height: 0 !important;
  }

  #settingsView #dangerZonePanel {
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
  }

  #settingsView #dangerZonePanel .danger-zone-mobile-head,
  #settingsView #dangerZonePanel .danger-zone-card {
    position: static !important;
    transform: none !important;
  }

  #settingsView #dangerZonePanel .danger-zone-card {
    margin-top: 12px !important;
    display: grid !important;
    grid-template-columns: 1fr !important;
    padding: 16px !important;
  }

  #settingsView #dangerZonePanel .danger-zone-icon {
    display: none !important;
  }

  #settingsView #dangerZonePanel .danger-zone-card > div:nth-child(2) {
    grid-column: 1 !important;
    grid-row: auto !important;
  }

  #settingsView #dangerZonePanel .danger-zone-actions {
    grid-column: 1 !important;
    grid-row: auto !important;
    margin-top: 4px !important;
  }

  #settingsView #dangerZonePanel > .danger-zone-card {
    display: none !important;
  }

  #settingsView #dangerZonePanel .danger-zone-mobile-card {
    display: flex !important;
    flex-direction: column !important;
    gap: 12px !important;
    margin-top: 22px !important;
    padding: 16px !important;
    border: 1px solid rgba(224,85,85,0.22) !important;
    border-radius: 20px !important;
    background:
      linear-gradient(135deg, rgba(224,85,85,0.11), rgba(255,255,255,0.018)),
      rgba(0,0,0,0.18) !important;
  }

  #settingsView #dangerZonePanel .danger-zone-mobile-card > * {
    position: static !important;
    transform: none !important;
    grid-column: auto !important;
    grid-row: auto !important;
  }

  #settingsView #dangerZonePanel .danger-zone-mobile-card .danger-zone-details-link {
    display: none !important;
  }

  #settingsView #dangerZonePanel .danger-zone-mobile-card strong {
    color: #fff4f4 !important;
    font-size: 15px !important;
  }

  #settingsView #dangerZonePanel .danger-zone-mobile-card p {
    margin: 0 !important;
    color: rgba(255,220,220,0.82) !important;
    font-size: 13px !important;
    line-height: 1.5 !important;
  }
}

/* Final Danger Zone source of truth */
#settingsView #dangerZonePanel {
  gap: 14px !important;
}

#settingsView #dangerZonePanel .danger-zone-mobile-card {
  display: none !important;
}

#settingsView #dangerZonePanel > .danger-zone-card {
  display: grid !important;
}

#settingsView #dangerZonePanel .danger-zone-actions {
  display: flex !important;
  align-items: center !important;
  justify-content: flex-end !important;
  gap: 10px !important;
}

#settingsView #dangerZonePanel .danger-zone-head {
  min-height: 0 !important;
}

#settingsView #dangerZonePanel .danger-zone-badge {
  position: static !important;
  transform: none !important;
}

@media (max-width: 960px) {
  #settingsView #dangerZonePanel {
    display: block !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    overflow: visible !important;
  }

  #settingsView #dangerZonePanel .danger-zone-head {
    display: none !important;
  }

  #settingsView #dangerZonePanel .danger-zone-head .panel-title {
    margin: 0 !important;
    line-height: 1.1 !important;
    color: #fff3f3 !important;
  }

  #settingsView #dangerZonePanel .danger-zone-badge {
    flex: 0 0 auto !important;
    margin: 0 !important;
    padding: 7px 10px !important;
    border-radius: 999px !important;
    font-size: 10px !important;
    line-height: 1 !important;
    white-space: nowrap !important;
  }

  #settingsView #dangerZonePanel > .danger-zone-card {
    display: none !important;
  }

  #settingsView #dangerZonePanel .danger-zone-mobile-card {
    display: flex !important;
    flex-direction: column !important;
    gap: 12px !important;
    margin: 0 !important;
    padding: 16px !important;
    border-radius: 20px !important;
  }

  #settingsView #dangerZonePanel .danger-zone-mobile-card .btn-delete {
    margin-top: 0 !important;
  }
}

@media (min-width: 961px) {
  #settingsView #dangerZonePanel {
    display: flex !important;
    flex-direction: column !important;
    gap: 16px !important;
    height: auto !important;
    min-height: auto !important;
    max-height: none !important;
    padding: 20px !important;
    overflow: visible !important;
    border: 1px solid rgba(224,85,85,0.28) !important;
    border-radius: 18px !important;
    background:
      radial-gradient(circle at 0% 0%, rgba(224,85,85,0.12), transparent 42%),
      linear-gradient(180deg, rgba(224,85,85,0.055), rgba(255,255,255,0.015)),
      rgba(20,18,23,0.94) !important;
  }

  #settingsView #dangerZonePanel::before {
    display: none !important;
  }

  #settingsView #dangerZonePanel .danger-zone-head {
    display: flex !important;
    align-items: flex-start !important;
    justify-content: space-between !important;
    gap: 18px !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
  }

  #settingsView #dangerZonePanel .danger-zone-head .panel-title {
    color: #ffe7e7 !important;
    font-size: 13px !important;
    line-height: 1.2 !important;
  }

  #settingsView #dangerZonePanel .danger-zone-head .setting-help {
    display: block !important;
    margin-top: 6px !important;
    color: rgba(255,210,210,0.72) !important;
  }

  #settingsView #dangerZonePanel .danger-zone-badge {
    flex: 0 0 auto !important;
    align-self: flex-start !important;
    margin: 0 !important;
    padding: 7px 11px !important;
    border-radius: 999px !important;
    border: 1px solid rgba(224,85,85,0.34) !important;
    background: rgba(224,85,85,0.11) !important;
    color: #ffcaca !important;
    font-size: 10px !important;
    line-height: 1 !important;
    white-space: nowrap !important;
  }

  #settingsView #dangerZonePanel > .danger-zone-card {
    display: grid !important;
    grid-template-columns: 46px minmax(0, 1fr) auto !important;
    gap: 16px !important;
    align-items: center !important;
    margin: 0 !important;
    padding: 16px !important;
    border: 1px solid rgba(224,85,85,0.2) !important;
    border-radius: 16px !important;
    background:
      linear-gradient(135deg, rgba(224,85,85,0.095), rgba(255,255,255,0.018)),
      rgba(0,0,0,0.16) !important;
  }

  #settingsView #dangerZonePanel .danger-zone-mobile-card {
    display: none !important;
  }

  #settingsView #dangerZonePanel .danger-zone-actions {
    display: flex !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    justify-content: flex-end !important;
    gap: 10px !important;
    grid-column: auto !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  #settingsView #dangerZonePanel .danger-zone-details-link,
  #settingsView #dangerZonePanel .btn-delete {
    min-height: 40px !important;
    white-space: nowrap !important;
  }
}

@media (max-width: 960px) {
  #chatView.menu-open::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 2200;
    background: rgba(0,0,0,0.16);
    pointer-events: none;
    animation: chatMenuBackdropIn 0.18s ease both;
  }

  #chatView .chat-menu {
    position: fixed;
    top: 0;
    right: 0;
    left: auto;
    width: min(74vw, 340px);
    max-width: none;
    height: 100dvh;
    min-width: 0;
    box-sizing: border-box;
    padding:
      calc(28px + env(safe-area-inset-top, 0px))
      max(22px, calc(18px + env(safe-area-inset-right, 0px)))
      calc(22px + env(safe-area-inset-bottom, 0px))
      22px;
    display: flex;
    flex-direction: column;
    align-content: start;
    gap: 18px;
    border-width: 0 0 0 1px;
    border-radius: 0;
    background: #111116;
    box-shadow: -10px 0 28px rgba(0,0,0,0.3);
    opacity: 1;
    transform: translateX(104%);
    transform-origin: center right;
    transition: transform 0.26s cubic-bezier(.22,.7,.18,1);
    z-index: 2600;
    isolation: isolate;
    transform-style: preserve-3d;
  }

  #chatView .chat-menu.is-open {
    opacity: 1;
    transform: translateX(0);
  }

  #chatView .chat-menu.is-closing {
    opacity: 1;
    transform: translateX(104%);
  }

  #chatView .chat-menu button {
    min-height: 34px;
    padding: 0;
    border-radius: 0;
    color: rgba(245,245,250,0.86);
    font-size: 12.5px;
    font-weight: 540;
    letter-spacing: 0;
    justify-content: space-between;
    gap: 10px;
  }

  #chatView .chat-menu button::after {
    content: ">";
    color: rgba(245,245,250,0.62);
    font-size: 17px;
    font-weight: 300;
    line-height: 1;
  }

  #chatView .chat-menu .chat-menu-new-btn {
    order: 100;
    align-self: stretch;
    margin-top: auto;
    min-height: 48px;
    justify-content: center;
    gap: 12px;
    padding: 0 18px;
    border-radius: 999px;
    background: rgba(255,255,255,0.08);
    color: #f6f5ff;
    font-weight: 720;
    box-shadow: 0 10px 24px rgba(0,0,0,0.2);
  }

  #chatView .chat-menu .chat-menu-new-btn svg {
    display: block;
    flex: 0 0 auto;
  }

  #chatView .chat-menu .chat-menu-new-btn::after {
    display: none;
  }

  #chatView .chat-menu button:hover {
    background: transparent;
    color: #fff;
  }

  #chatView .chat-menu button[data-action="rate"] {
    color: #9b8cff;
  }

  #chatView .chat-menu button[data-action="delete-chat"] {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(255,255,255,0.08);
  }

  #chatView .chat-menu button[data-action="delete-chat"],
  #chatView .chat-menu button[data-action="delete-user"],
  #chatView .chat-menu button[data-action="delete-bot"] {
    color: rgba(255,158,166,0.94);
  }
}

/* Desktop create page overflow cleanup */
#main {
  min-width: 0;
}

.view {
  overflow-x: hidden;
}

#createView {
  min-width: 0;
  overflow: hidden;
  scrollbar-gutter: auto;
}

#createView.active {
  display: flex;
}

#createView .create-topbar {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

#createView .create-body {
  flex: 1 1 auto;
  min-height: 0;
  width: min(100%, 620px);
  max-width: 620px;
  overflow-y: auto;
  overflow-x: clip;
  scrollbar-gutter: stable;
}

#createView .panel,
#createView .form-grid,
#createView .form-group,
#createView .settings-grid,
#createView .create-persona-actions,
#createView .persona-action-card,
#createView .tag-editor,
#createView .tag-editor-row,
#createView .visibility-picker,
#createView .rating-picker,
#createView .custom-picker,
#createView .model-picker-card {
  min-width: 0;
  max-width: 100%;
}

#createView input,
#createView textarea,
#createView select,
#createView button {
  max-width: 100%;
}

/* Discovery picker polish */
.home-toolbar .discovery-filter-picker {
  flex: 0 1 220px;
  width: 220px;
}

.home-toolbar #homeSortPicker {
  flex-basis: 250px;
  width: 250px;
}

.home-toolbar .discovery-filter-picker .visibility-trigger,
.discovery-search-filters .discovery-filter-picker .visibility-trigger {
  min-height: 42px;
  border-radius: 12px;
  background: rgba(255,255,255,0.035);
  border-color: var(--border);
}

.discovery-search-filters .discovery-filter-picker {
  width: 100%;
  min-width: 0;
}

.discovery-search-filters .custom-select-menu {
  width: 100%;
  min-width: 100%;
  max-width: 100%;
  max-height: min(420px, 52vh);
  overflow-y: auto;
}

.home-toolbar .discovery-filter-picker .custom-select-menu {
  width: 100%;
  min-width: 100%;
  max-width: 100%;
}

#yourCharactersView .search-submit-btn {
  display: none !important;
}

/* Clean settings page pass */
#settingsView {
  min-width: 0;
  overflow: hidden;
}

#settingsView .create-body.settings-body {
  flex: 1 1 auto;
  min-height: 0;
  width: min(100%, 620px);
  max-width: 620px;
  margin: 0 auto;
  padding: 28px 0 72px;
  gap: 18px;
  overflow-y: auto;
  overflow-x: clip;
  scrollbar-gutter: stable;
}

#settingsView .panel {
  display: grid;
  gap: 18px;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

#settingsView .panel-title {
  margin: 0;
  color: var(--text);
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: none;
}

#settingsView .form-grid.two-col,
#settingsView .settings-grid,
#settingsView .ai-provider-inner-grid {
  grid-template-columns: 1fr;
  gap: 14px;
}

#settingsView .form-section-heading,
#settingsView .panel-subtitle {
  margin: 8px 0 -2px;
  padding: 0;
  color: var(--text);
  font-size: 14px;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: none;
}

#settingsView .form-group,
#settingsView .profile-interest-panel,
#settingsView .ai-provider-fields,
#settingsView .profile-avatar-row-flat,
#settingsView .roleplay-style-panel {
  min-width: 0;
  max-width: 100%;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

#settingsView .form-group label,
#settingsView .form-label {
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: none;
}

#settingsView input:not([type="checkbox"]):not([type="range"]):not([type="color"]),
#settingsView textarea,
#settingsView select {
  min-height: 42px;
  border-radius: 10px;
  border-color: rgba(255,255,255,0.18);
  background: #15161b;
  color: var(--text);
}

#settingsView textarea {
  min-height: 88px;
}

#settingsView input:focus,
#settingsView textarea:focus,
#settingsView select:focus {
  border-color: rgba(255,255,255,0.42);
}

#settingsView .settings-select-picker,
#settingsView .custom-select-picker {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  position: relative;
}

#settingsView .form-group:has(.settings-select-picker.open),
#settingsView .form-group:has(.custom-select-picker.open) {
  position: relative;
  z-index: 3200;
}

#settingsView .settings-select-picker.open,
#settingsView .custom-select-picker.open {
  z-index: 3201;
}

#settingsView .settings-select-picker .visibility-trigger,
#settingsView .custom-select-trigger {
  min-height: 42px;
  border-radius: 10px;
  background: #15161b;
  border-color: rgba(255,255,255,0.18);
}

#settingsView .custom-select-menu {
  width: 100%;
  min-width: 100%;
  max-width: 100%;
  max-height: min(620px, 58vh);
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  z-index: 9002;
}

#settingsView .custom-select-menu.fixed-custom-select-menu {
  min-width: 0;
  max-width: calc(100vw - 24px);
}

#settingsView .custom-select-menu .visibility-option {
  min-height: 54px;
  touch-action: manipulation;
}

#settingsView .panel.picker-panel-open {
  position: relative;
  z-index: 9000;
}

#settingsView .setting-help.full-line,
#settingsView .profile-avatar-copy > .setting-help,
#settingsView .ai-provider-fields > .setting-help {
  display: none !important;
}

#settingsView .setting-help {
  color: #a2abc8;
  font-size: 11px;
  line-height: 1.4;
}

@media (max-width: 760px), (pointer: coarse) {
  #settingsView select.custom-picker-native {
    display: block !important;
    width: 100%;
    min-height: 42px;
    padding: 0 42px 0 12px;
    border: 1px solid rgba(255,255,255,0.18);
    border-radius: 10px;
    background: #15161b;
    color: var(--text);
    font: inherit;
    font-weight: 800;
  }

  #settingsView .settings-select-picker.custom-select-picker,
  #settingsView .settings-select-picker.visibility-picker {
    display: none !important;
  }
}

#settingsView .profile-avatar-row-flat {
  display: flex;
  align-items: center;
  gap: 14px;
}

#settingsView .profile-avatar-row-flat .big-avatar {
  width: 72px;
  height: 72px;
  flex: 0 0 72px;
  border-radius: 50%;
}

#settingsView .profile-avatar-copy {
  display: grid;
  gap: 10px;
  min-width: 0;
}

#settingsView .profile-section-title {
  color: var(--text);
  font-size: 14px;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: none;
}

#settingsView .avatar-controls,
#settingsView .profile-actions,
#settingsView .form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

#settingsView .mini-btn,
#settingsView .btn-save,
#settingsView .btn-delete {
  border-radius: 10px;
}

#settingsView .profile-interest-title {
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
}

#settingsView .profile-interest-panel {
  display: grid;
  gap: 10px;
}

#settingsView .profile-interest-chip,
#settingsView .profile-interest-chip:hover,
#settingsView .profile-interest-chip:active {
  transform: none !important;
  transition: none !important;
}

#settingsView .panel:hover,
#settingsView .profile-interest-panel:hover,
#settingsView .settings-resource-link:hover {
  transform: none !important;
}

#settingsView .visual-bubble-toggle {
  min-height: 40px;
}

#settingsView .visual-bubble-help {
  margin-top: -8px;
}

#settingsView .settings-resource-panel {
  gap: 12px;
}

#settingsView .settings-social-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

#settingsView .settings-social-link {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  min-height: 64px;
  padding: 10px;
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 10px;
  background: rgba(255,255,255,0.045);
  color: var(--text);
  text-decoration: none;
}

#settingsView .settings-social-link:hover {
  background: rgba(255,255,255,0.065);
  border-color: rgba(255,255,255,0.22);
}

#settingsView .settings-social-link span:last-child,
#settingsView .settings-resource-link span:last-child {
  min-width: 0;
}

#settingsView .settings-social-link strong {
  display: block;
  font-size: 13px;
}

#settingsView .settings-social-link small {
  display: block;
  margin-top: 2px;
  color: var(--sub);
  font-size: 11px;
  overflow-wrap: anywhere;
}

#settingsView .settings-social-icon svg {
  width: 19px;
  height: 19px;
}

#settingsView .settings-resource-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

#settingsView .settings-resource-link {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  min-height: 58px;
  padding: 10px;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 10px;
  background: rgba(255,255,255,0.035);
  color: var(--text);
  text-decoration: none;
}

#settingsView .settings-resource-link:hover {
  background: rgba(255,255,255,0.055);
  border-color: rgba(255,255,255,0.2);
}

#settingsView .settings-resource-icon {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  border-radius: 10px;
  background: rgba(139,124,246,0.14);
  color: #d7d1ff;
}

#settingsView .settings-resource-icon svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

#settingsView .settings-resource-link span:last-child {
  display: grid;
  gap: 2px;
  min-width: 0;
}

#settingsView .settings-resource-link strong {
  font-size: 13px;
  line-height: 1.2;
}

#settingsView .settings-resource-link small {
  color: #a2abc8;
  font-size: 11px;
  line-height: 1.25;
}

#settingsView.has-unsaved-settings #saveProfileBtn,
#settingsView #saveProfileBtn.needs-save {
  border-color: rgba(255,212,107,0.42);
  box-shadow: 0 0 0 1px rgba(255,212,107,0.16), 0 12px 28px rgba(0,0,0,0.24);
}

.settings-unsaved-modal {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(5,5,9,0.62);
  backdrop-filter: blur(10px);
}

.settings-unsaved-modal.hidden {
  display: none;
}

.settings-unsaved-card {
  width: min(420px, 100%);
  display: grid;
  gap: 18px;
  padding: 20px;
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.07), rgba(255,255,255,0.025)),
    #16161f;
  color: var(--text);
  box-shadow: 0 24px 70px rgba(0,0,0,0.48);
}

.settings-unsaved-kicker {
  color: #ffd46b;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.settings-unsaved-title {
  margin-top: 6px;
  color: #fff;
  font-size: 20px;
  font-weight: 850;
}

.settings-unsaved-card p {
  margin-top: 8px;
  color: var(--sub);
  font-size: 13px;
  line-height: 1.45;
}

.settings-unsaved-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.settings-unsaved-actions .mini-btn,
.settings-unsaved-actions .btn-save {
  min-height: 40px;
  border-radius: 10px;
}

.profile-saving-modal {
  position: fixed;
  inset: 0;
  z-index: 9100;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(5,5,9,0.46);
  backdrop-filter: blur(8px);
}

.profile-saving-modal.hidden {
  display: none;
}

.profile-saving-card {
  width: min(360px, 100%);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.075), rgba(255,255,255,0.025)),
    #15151e;
  color: var(--text);
  box-shadow: 0 22px 60px rgba(0,0,0,0.44);
}

.profile-saving-spinner {
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  border-radius: 50%;
  border: 3px solid rgba(255,255,255,0.14);
  border-top-color: #fff;
  animation: spin 0.9s linear infinite;
}

.profile-saving-card span:last-child {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.profile-saving-card strong {
  color: #fff;
  font-size: 15px;
}

.profile-saving-card small {
  color: var(--sub);
  font-size: 12px;
  line-height: 1.35;
}

#settingsView #saveProfileBtn.is-saving {
  opacity: 0.78;
  cursor: wait;
}

/* Friendlier Credits and Models pass */
#creditsView .credits-page {
  max-width: 980px;
  gap: 16px;
}

#creditsView .credits-hero {
  grid-template-columns: minmax(0, 1fr);
}

#creditsView .credits-hero > div:first-child,
#creditsView .credits-balance-card,
#creditsView .credits-panel {
  border-radius: 18px;
  box-shadow: none;
}

#creditsView .credits-hero > div:first-child {
  min-height: 0;
  padding: 22px;
}

#creditsView .credits-hero h1 {
  font-size: clamp(2.1rem, 6vw, 3.2rem);
}

#creditsView .credits-balance-card {
  display: grid;
  gap: 14px;
  padding: 18px;
}

#creditsView .credits-mini-stats {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

#creditsView .credits-daily-card,
#creditsView .credits-referral-card,
#creditsView .credit-offer-card,
#creditsView .credit-history-item {
  border-radius: 14px;
  background: rgba(255,255,255,0.035);
}

#creditsView .credits-referral-panel,
#creditsView .credits-buy-panel,
#creditsView .chayt-plus-credit-panel {
  display: grid;
  gap: 14px;
}

#creditsView .credits-referral-grid {
  grid-template-columns: 1fr;
}

#creditsView .credits-referral-code-row,
#creditsView .credits-redeem-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
}

#creditsView .credits-redeem-row {
  grid-template-columns: minmax(0, 1fr) auto;
}

#creditsView .credit-offers {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  align-items: start;
}

#creditsView .credit-offer-card {
  display: grid;
  align-content: start;
  align-self: start;
  gap: 12px;
  min-height: 0;
}

#creditsView .credit-history-list {
  max-height: 320px;
}

#aimodelratingView .ai-model-rating-shell,
#aimodelratingView .ai-model-rating-toolbar,
#aimodelratingView .ai-model-rating-detail-head,
#aimodelratingView .ai-model-rating-summary-card,
#aimodelratingView .ai-model-rating-form-card,
#aimodelratingView .ai-model-comments-card {
  border-radius: 18px;
  box-shadow: none;
}

#aimodelratingView .ai-model-rating-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 320px);
  align-items: end;
  gap: 16px;
}

#aimodelratingView .ai-model-rating-toolbar-copy h2 {
  margin-bottom: 6px;
  font-size: clamp(1.7rem, 4vw, 2.4rem);
}

#aimodelratingView .ai-model-rating-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

#aimodelratingView .ai-model-card {
  border-radius: 14px;
  background: rgba(255,255,255,0.035);
  box-shadow: none;
}

#aimodelratingView .ai-model-card:hover {
  transform: none;
}

#aimodelratingView .ai-model-card-link {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) auto;
  gap: 10px 16px;
  padding: 14px;
}

#aimodelratingView .ai-model-card-top,
#aimodelratingView .ai-model-card-badges,
#aimodelratingView .ai-model-card-stars,
#aimodelratingView .ai-model-card-desc {
  min-width: 0;
}

#aimodelratingView .ai-model-card-badges,
#aimodelratingView .ai-model-card-stars,
#aimodelratingView .ai-model-card-desc {
  grid-column: 1 / -1;
}

#aimodelratingView .ai-model-card-score {
  align-self: start;
  min-width: 66px;
  border-radius: 12px;
}

@media (max-width: 720px) {
  #creditsView .credits-mini-stats,
  #creditsView .credit-offers,
  #aimodelratingView .ai-model-rating-toolbar,
  #aimodelratingView .ai-model-card-link {
    grid-template-columns: 1fr;
  }

  #creditsView .credits-referral-code-row,
  #creditsView .credits-redeem-row {
    grid-template-columns: 1fr;
  }

  #creditsView .credits-referral-actions {
    justify-content: stretch;
    width: 100%;
  }

  #creditsView .credits-icon-btn {
    flex: 1 1 0;
  }
}

#settingsView .profile-interest-head {
  align-items: center;
}

#settingsView .profile-interest-search {
  min-height: 38px;
  border-radius: 10px;
}

#settingsView .form-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 44px;
  gap: 16px;
  padding: 0;
  border: 0;
}

#settingsView .setting-toggle {
  border-radius: 10px;
  border-color: rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.03);
}

#settingsView .roleplay-style-nav {
  border: 0;
  background: transparent;
}

#settingsView #dangerZonePanel {
  margin-top: 4px;
  padding-top: 18px !important;
  border-top: 1px solid rgba(255,107,107,0.24) !important;
}

@media (max-width: 960px) {
  #settingsView .create-body.settings-body {
    width: 100%;
    max-width: 100%;
    padding: 14px 16px calc(150px + env(safe-area-inset-bottom, 0px)) !important;
    gap: 18px !important;
    scroll-padding-bottom: calc(150px + env(safe-area-inset-bottom, 0px)) !important;
  }

  #settingsView .panel-title {
    font-size: 18px;
  }

  #settingsView .profile-avatar-row-flat {
    align-items: center;
    text-align: left;
  }

  #settingsView .avatar-controls,
  #settingsView .profile-actions,
  #settingsView .form-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  #settingsView .avatar-controls > *,
  #settingsView .profile-actions > *,
  #settingsView .form-actions > * {
    width: 100%;
    justify-content: center;
  }

  #settingsView .settings-resource-grid {
    grid-template-columns: 1fr;
  }

  #settingsView .settings-social-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .discovery-tag-tutorial-card {
    max-height: min(260px, calc(100dvh - 112px));
    min-height: 0;
    overflow-y: auto;
    scrollbar-width: none;
  }

  .discovery-tag-tutorial-card::-webkit-scrollbar {
    display: none;
  }

  .discovery-tag-tutorial-copy p {
    min-height: 0;
  }

  .discovery-tag-tutorial-guide {
    max-height: min(230px, 32dvh);
  }

  #chatStyleView .chat-style-model-row,
  #conversationMemoryView #conversationSummaryModelPicker .chat-style-model-row {
    grid-auto-columns: minmax(178px, 204px);
    align-items: start;
    gap: 10px;
    padding: 1px 10px 8px 2px;
  }

  #chatStyleView .chat-style-body {
    gap: 10px;
    padding-top: 10px;
  }

  #chatStyleView .chat-style-model-browser {
    gap: 16px;
  }

  #chatStyleView .chat-style-model-section {
    gap: 8px;
  }

  #chatStyleView .chat-style-model-card,
  #conversationMemoryView #conversationSummaryModelPicker .chat-style-model-card {
    height: auto;
    min-height: 186px;
    max-height: none;
    grid-template-rows: auto minmax(54px, 1fr) auto;
    align-content: stretch;
    gap: 8px;
    padding: 12px;
    overflow: visible;
  }

  #chatStyleView .chat-style-model-card.chayt-mode-card,
  #conversationMemoryView #conversationSummaryModelPicker .chat-style-model-card.chayt-mode-card {
    min-height: 206px;
    grid-template-rows: auto minmax(42px, auto) minmax(50px, 1fr) auto;
    align-content: stretch;
  }

  #chatStyleView .chat-style-model-title,
  #conversationMemoryView #conversationSummaryModelPicker .chat-style-model-title {
    display: block;
    min-height: 0;
    padding-bottom: 8px;
    overflow: visible;
    font-size: 14px;
    line-height: 1.16;
  }

  #chatStyleView .chat-style-model-desc,
  #conversationMemoryView #conversationSummaryModelPicker .chat-style-model-desc {
    display: block;
    overflow: visible;
    font-size: 12px;
    line-height: 1.28;
  }

  #chatStyleView .chat-style-model-foot,
  #conversationMemoryView #conversationSummaryModelPicker .chat-style-model-foot {
    min-height: 26px;
    align-items: flex-end;
    gap: 6px;
    font-size: 10px;
  }

  #chatStyleView .chat-style-energy-note,
  #conversationMemoryView #conversationSummaryModelPicker .chat-style-energy-note {
    max-width: 72px;
    line-height: 1.08;
  }

  #chatStyleView .chat-style-section-head,
  #conversationMemoryView #conversationSummaryModelPicker .chat-style-section-head {
    align-items: flex-start;
    gap: 6px;
    padding-bottom: 6px;
  }

  #chatStyleView .chat-style-section-pill,
  #conversationMemoryView #conversationSummaryModelPicker .chat-style-section-pill {
    min-height: 28px;
    font-size: 18px;
  }

  #chatStyleView .chat-style-section-note,
  #conversationMemoryView #conversationSummaryModelPicker .chat-style-section-note {
    padding-left: 18px;
    font-size: 11px;
    line-height: 1.3;
  }

  #conversationMemoryView .conversation-memory-body,
  #chatStyleView .chat-style-body {
    align-content: initial;
  }

  #conversationMemoryView .conversation-memory-body {
    flex: 1 1 auto;
    min-height: 0;
  }

  #conversationMemoryView #conversationSummaryInput {
    min-height: 132px;
    max-height: 210px;
  }

  #settingsView .ai-provider-inner-grid {
    align-items: start;
    gap: 12px;
  }

  #settingsView .ai-provider-flat,
  #settingsView .ai-provider-inner-grid .full {
    min-height: 0 !important;
  }

  #settingsView .ai-provider-flat input {
    min-height: 42px !important;
    height: 42px;
  }
}

@media (max-width: 960px) {
  #chatStyleView .chat-style-model-row,
  #conversationMemoryView #conversationSummaryModelPicker .chat-style-model-row {
    grid-auto-columns: minmax(178px, 204px);
    align-items: start;
  }

  #chatStyleView .chat-style-model-card,
  #conversationMemoryView #conversationSummaryModelPicker .chat-style-model-card {
    height: auto;
    min-height: 186px;
    max-height: none;
    grid-template-rows: auto minmax(54px, 1fr) auto;
    align-content: stretch;
    overflow: visible;
  }

  #chatStyleView .chat-style-model-title,
  #conversationMemoryView #conversationSummaryModelPicker .chat-style-model-title,
  #chatStyleView .chat-style-model-desc,
  #conversationMemoryView #conversationSummaryModelPicker .chat-style-model-desc {
    display: block;
    min-height: 0;
    overflow: visible;
    -webkit-line-clamp: unset;
    -webkit-box-orient: unset;
  }
}

/* Mobile Chat Style keeps the horizontal picker, but vertical page scroll wins on touch. */
@media (max-width: 960px) {
  #chatStyleView.active {
    display: flex !important;
    flex-direction: column !important;
    height: 100vh !important;
    min-height: 100vh !important;
    height: 100svh !important;
    min-height: 100svh !important;
    height: 100dvh !important;
    min-height: 100dvh !important;
    overflow: hidden !important;
  }

  #chatStyleView .history-topbar {
    flex: 0 0 auto !important;
  }

  #chatStyleView .chat-style-body {
    flex: 1 1 auto !important;
    height: calc(100vh - 64px) !important;
    min-height: calc(100vh - 64px) !important;
    max-height: calc(100vh - 64px) !important;
    height: calc(100svh - 64px) !important;
    min-height: calc(100svh - 64px) !important;
    max-height: calc(100svh - 64px) !important;
    height: calc(100dvh - 64px) !important;
    min-height: calc(100dvh - 64px) !important;
    max-height: calc(100dvh - 64px) !important;
    box-sizing: border-box !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
    touch-action: pan-y;
    padding-bottom: calc(220px + env(safe-area-inset-bottom, 0px)) !important;
    scroll-padding-bottom: calc(220px + env(safe-area-inset-bottom, 0px)) !important;
  }

  #chatStyleView .chat-style-model-section:last-child {
    padding-bottom: calc(80px + env(safe-area-inset-bottom, 0px));
  }

  #chatStyleView .chat-style-model-row {
    display: grid !important;
    grid-auto-flow: column !important;
    grid-auto-columns: minmax(178px, 204px) !important;
    grid-template-columns: unset !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    overscroll-behavior-x: contain;
    scrollbar-width: thin !important;
    touch-action: auto !important;
    -webkit-overflow-scrolling: touch;
  }

  #chatStyleView .chat-style-model-card {
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
  }
}
