@import url("https://fonts.googleapis.com/css2?family=Roboto:wght@700&display=swap");

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

html,
body {
  width: 100%;
  height: 100%;
}

body {
  font-family: Arial, Helvetica, sans-serif;
  background: #0b0b0f;
  color: white;
  overflow: hidden;
}

button,
input,
textarea {
  font: inherit;
}

button {
  transition: 0.15s ease;
  background: none;
}

.app {
  display: flex;
  width: 100%;
  height: 100vh;
}

.hidden {
  display: none !important;
}


/* =========================
   SIDEBAR
========================= */

.sidebar {
  width: 250px;
  min-width: 250px;
  height: 100vh;

  background: #111116;

  border-right:
    1px solid #27272f;

  padding:
    25px 18px;

  display: flex;

  flex-direction: column;
}

.logo {
  font-size: 25px;

  font-weight: 700;

  margin-bottom: 40px;
}

nav {
  display: flex;

  flex-direction: column;

  gap: 10px;
}

.nav-btn,
.settings-btn {
  width: 100%;

  background: transparent;

  color: #aaa;

  border: 0;

  border-radius: 10px;

  padding:
    13px 15px;

  text-align: left;

  font-size: 15px;

  cursor: pointer;
}

.nav-btn:hover,
.settings-btn:hover {
  background: #1d1d25;

  color: #fff;
}

.nav-btn.active {
  background: #23232c;

  color: #fff;
}

.sidebar-divider {
  height: 1px;

  background: #292930;

  margin:
    22px 5px;
}

.chat-history-section {
  flex: 1;

  min-height: 0;

  display: flex;

  flex-direction: column;
}

.sidebar-section-title {
  padding:
    0 10px;

  margin-bottom: 10px;

  color: #666;

  font-size: 12px;

  text-transform: uppercase;

  letter-spacing: 0.8px;
}

.chat-history-list {
  display: flex;

  flex-direction: column;

  gap: 4px;

  overflow-y: auto;

  padding-right: 3px;
}

.history-empty {
  padding: 10px;

  color: #555;

  font-size: 13px;
}

.history-item {
  width: 100%;

  background: transparent;

  color: #fff;

  border: 0;

  border-radius: 9px;

  padding: 10px;

  text-align: left;

  cursor: pointer;
}

.history-item:hover,
.history-item.active {
  background: #23232c;
}

.history-character,
.history-title {
  display: block;

  white-space: nowrap;

  overflow: hidden;

  text-overflow: ellipsis;
}

.history-character {
  margin-bottom: 4px;

  color: #777;

  font-size: 12px;
}

.history-title {
  color: #ddd;

  font-size: 14px;
}

.settings-btn {
  margin-top: 20px;
}


/* =========================
   MAIN
========================= */

.main-content {
  flex: 1;

  min-width: 0;

  height: 100vh;

  padding: 35px;

  overflow-y: auto;
}

.view {
  width: 100%;
}

.top-bar {
  margin-bottom: 40px;
}

.top-bar h2 {
  margin-bottom: 7px;

  font-size: 28px;
}

.top-bar p,
.create-header p {
  color: #777;

  font-size: 14px;
}

.empty-state {
  height: 65vh;

  display: flex;

  flex-direction: column;

  align-items: center;

  justify-content: center;

  text-align: center;
}

.empty-icon {
  margin-bottom: 20px;

  font-size: 55px;
}

.empty-state h2 {
  margin-bottom: 10px;

  font-size: 24px;
}

.empty-state p {
  margin-bottom: 25px;

  color: #888;
}

.main-create-btn,
.save-character-btn {
  background: #fff;

  color: #000;

  border: 0;

  border-radius: 10px;

  padding:
    12px 20px;

  font-size: 14px;

  font-weight: 700;

  cursor: pointer;
}

.main-create-btn:hover,
.save-character-btn:hover {
  opacity: 0.85;
}


/* =========================
   CREATE / EDIT
========================= */

.create-header {
  display: flex;

  align-items: center;

  gap: 18px;

  margin-bottom: 28px;
}

.create-header h2 {
  margin-bottom: 5px;

  font-size: 27px;
}

.back-btn {
  width: 42px;

  min-width: 42px;

  height: 42px;

  display: flex;

  align-items: center;

  justify-content: center;

  background: #1d1d25;

  color: #fff;

  border:
    1px solid #30303a;

  border-radius: 10px;

  font-size: 20px;

  cursor: pointer;
}

.back-btn:hover {
  background: #2a2a34;
}

.character-form {
  max-width: 900px;

  display: flex;

  flex-direction: column;

  gap: 18px;

  padding-bottom: 50px;
}

.creator-card {
  background: #14141b;

  border:
    1px solid #292934;

  border-radius: 16px;

  padding: 20px;
}

.creator-card-title {
  display: flex;

  align-items: flex-start;

  gap: 12px;

  margin-bottom: 18px;
}

.creator-card-title > span {
  font-size: 22px;
}

.creator-card-title h3 {
  font-size: 17px;

  margin-bottom: 4px;
}

.creator-card-title p {
  font-size: 12px;

  color: #777;

  line-height: 1.45;
}

.powers-heading {
  align-items: center;
}

.powers-heading > div {
  flex: 1;
}

.character-form label,
.form-field {
  display: flex;

  flex-direction: column;

  gap: 8px;

  font-size: 13px;

  font-weight: 700;

  color: #ddd;
}

.field-label {
  font-size: 13px;

  font-weight: 700;
}

.character-form input,
.character-form textarea {
  width: 100%;

  background: #0f0f15;

  color: #fff;

  border:
    1px solid #30303a;

  border-radius: 10px;

  padding:
    13px 14px;

  outline: none;
}

.character-form input:focus,
.character-form textarea:focus {
  border-color: #7066b7;
}

.character-form input::placeholder,
.character-form textarea::placeholder {
  color: #5f5f6b;
}

.character-form textarea {
  min-height: 110px;

  resize: vertical;

  line-height: 1.55;
}

.small-textarea {
  min-height: 85px !important;
}

.creator-large-textarea {
  min-height: 180px !important;
}

.form-grid {
  display: grid;

  gap: 14px;
}

.two-columns {
  grid-template-columns:
    1fr 1fr;
}

.avatar-editor-row {
  display: flex;

  align-items: center;

  gap: 18px;

  margin-bottom: 18px;
}

.avatar-preview-wrap {
  width: 110px;

  height: 110px;

  min-width: 110px;

  border-radius: 24px;

  background: #1d1d28;

  border:
    1px solid #2c2c38;

  overflow: hidden;

  display: flex;

  align-items: center;

  justify-content: center;
}

.avatar-preview {
  width: 100%;

  height: 100%;

  object-fit: cover;
}

.avatar-placeholder {
  font-size: 42px;
}

.grow-field {
  flex: 1;
}

.pronoun-picker {
  display: grid;

  grid-template-columns:
    repeat(4, 1fr);

  gap: 6px;

  background: #0f0f15;

  border:
    1px solid #30303a;

  border-radius: 10px;

  padding: 5px;
}

.pronoun-option {
  border: 0;

  border-radius: 8px;

  padding:
    10px 6px;

  color: #8f84df;

  cursor: pointer;

  font-weight: 700;
}

.pronoun-option:hover {
  background: #1b1b27;
}

.pronoun-option.active {
  background: #2b2941;

  color: #fff;
}

.outline-add-btn {
  width: 100%;

  border:
    1px solid #6f5af5;

  color: #9a82ff;

  border-radius: 10px;

  padding: 11px;

  cursor: pointer;

  font-weight: 700;
}

.outline-add-btn:hover {
  background: #221e36;
}

.example-list {
  display: flex;

  flex-direction: column;

  gap: 12px;

  margin-bottom: 12px;
}

.example-card {
  background: #0f0f15;

  border:
    1px solid #2c2c38;

  border-radius: 12px;

  padding: 14px;
}

.example-card-head {
  display: flex;

  align-items: center;

  justify-content: space-between;

  margin-bottom: 10px;
}

.example-card-head strong {
  font-size: 13px;
}

.remove-example-btn {
  border: 0;

  color: #ff737d;

  cursor: pointer;

  padding:
    5px 8px;

  border-radius: 6px;
}

.remove-example-btn:hover {
  background: #2a171d;
}

.example-grid {
  display: grid;

  grid-template-columns:
    1fr 1fr;

  gap: 10px;
}

.example-grid textarea {
  min-height: 110px !important;
}

.switch {
  display: inline-block;

  position: relative;

  width: 46px;

  height: 26px;

  cursor: pointer;
}

.switch input {
  opacity: 0;

  width: 0;

  height: 0;
}

.switch-slider {
  position: absolute;

  inset: 0;

  background: #30303b;

  border-radius: 20px;

  transition: 0.2s;
}

.switch-slider::before {
  content: "";

  position: absolute;

  width: 20px;

  height: 20px;

  left: 3px;

  top: 3px;

  background: #fff;

  border-radius: 50%;

  transition: 0.2s;
}

.switch input:checked + .switch-slider {
  background: #725af2;
}

.switch input:checked + .switch-slider::before {
  transform:
    translateX(20px);
}

.powers-fields {
  display: flex;

  flex-direction: column;

  gap: 14px;
}

.background-preview {
  height: 180px;

  margin-top: 14px;

  border:
    1px dashed #353541;

  border-radius: 12px;

  background:
    #0f0f15 center / cover no-repeat;

  display: flex;

  align-items: center;

  justify-content: center;

  color: #666;

  overflow: hidden;
}

.background-preview.has-image span {
  display: none;
}

.creator-form-actions {
  display: flex;

  justify-content: flex-end;

  gap: 10px;
}

.secondary-btn {
  background: #1b1b23;

  color: #ddd;

  border:
    1px solid #30303a;

  border-radius: 10px;

  padding:
    12px 18px;

  cursor: pointer;
}

.secondary-btn:hover {
  background: #25252e;
}


/* =========================
   CHARACTER CARDS
========================= */

.characters-grid {
  display: grid;

  grid-template-columns:
    repeat(
      auto-fill,
      minmax(220px, 1fr)
    );

  gap: 20px;
}

.character-card {
  width: 100%;

  max-width: 270px;

  background: #15151b;

  border:
    1px solid #292931;

  border-radius: 15px;

  overflow: hidden;

  cursor: pointer;

  transition: 0.2s ease;
}

.character-card:hover {
  transform:
    translateY(-4px);

  border-color: #555;
}

.character-image,
.character-placeholder {
  width: 100%;

  height: 240px;

  background: #1d1d25;
}

.character-image {
  display: block;

  object-fit: cover;
}

.character-placeholder {
  display: flex;

  align-items: center;

  justify-content: center;

  font-size: 60px;
}

.character-info {
  padding: 16px;
}

.character-info h3 {
  margin-bottom: 7px;

  font-size: 18px;
}

.character-info p {
  color: #888;

  font-size: 14px;

  line-height: 1.4;
}


/* =========================
   CHAT BACKGROUND
========================= */

#chatView {
  position: relative;

  isolation: isolate;

  height:
    calc(100vh - 70px);

  display: flex;

  flex-direction: column;

  overflow: hidden;

  border-radius: 4px;
}

.chat-background {
  position: absolute;

  inset: 0;

  z-index: -2;

  background-position: center;

  background-size: cover;

  background-repeat: no-repeat;

  opacity: 0;

  transform:
    scale(1.02);

  transition:
    opacity 0.25s ease;
}

.chat-background.active {
  opacity: 0.30;
}

.chat-background::after {
  content: "";

  position: absolute;

  inset: 0;

  background:
    linear-gradient(
      180deg,
      rgba(11, 11, 15, 0.74),
      rgba(11, 11, 15, 0.88) 35%,
      rgba(11, 11, 15, 0.93)
    );
}

.chat-layer {
  position: relative;

  z-index: 1;
}


/* =========================
   CHAT HEADER
========================= */

.chat-header {
  display: flex;

  align-items: center;

  justify-content: space-between;

  gap: 20px;

  padding-bottom: 18px;

  border-bottom:
    1px solid rgba(70, 70, 82, 0.55);
}

.chat-header-left {
  flex: 1;

  min-width: 0;

  display: flex;

  align-items: center;

  gap: 15px;
}

.chat-avatar {
  width: 50px;

  min-width: 50px;

  height: 50px;

  object-fit: cover;

  border-radius: 50%;

  background: #1d1d25;
}

.chat-character-info {
  min-width: 0;
}

.chat-character-info h2,
.chat-character-info p {
  white-space: nowrap;

  overflow: hidden;

  text-overflow: ellipsis;
}

.chat-character-info h2 {
  margin-bottom: 4px;

  font-size: 18px;
}

.chat-character-info p {
  color: #888;

  font-size: 13px;
}

.chat-actions {
  display: flex;

  align-items: center;

  gap: 10px;
}

.memory-btn,
.menu-btn,
.new-chat-btn {
  height: 42px;

  background:
    rgba(29, 29, 37, 0.88);

  color: #fff;

  border:
    1px solid #30303a;

  border-radius: 10px;

  cursor: pointer;

  backdrop-filter:
    blur(6px);
}

.memory-btn,
.menu-btn {
  width: 42px;

  display: flex;

  align-items: center;

  justify-content: center;
}

.memory-btn {
  font-size: 18px;
}

.menu-btn {
  font-size: 22px;
}

.new-chat-btn {
  padding:
    0 15px;

  font-weight: 700;
}

.memory-btn:hover,
.menu-btn:hover,
.new-chat-btn:hover {
  background: #292932;
}

.chat-menu-wrapper {
  position: relative;
}

.chat-menu {
  position: absolute;

  top: 50px;

  right: 0;

  z-index: 100;

  width: 185px;

  padding: 6px;

  background: #18181f;

  border:
    1px solid #30303a;

  border-radius: 12px;

  box-shadow:
    0 12px 35px
    rgba(0, 0, 0, 0.45);
}

.chat-menu button {
  width: 100%;

  padding:
    11px 12px;

  background: transparent;

  color: #fff;

  border: 0;

  border-radius: 8px;

  text-align: left;

  cursor: pointer;
}

.chat-menu button:hover {
  background: #25252d;
}

.menu-divider {
  height: 1px;

  margin:
    5px 4px;

  background: #303038;
}

.chat-menu .danger-option {
  color: #ff7777;
}

.current-chat-bar {
  padding:
    13px 10px;

  color: #666;

  border-bottom:
    1px solid rgba(50, 50, 60, 0.48);

  font-size: 12px;
}

.current-chat-bar strong {
  margin-left: 4px;

  color: #aaa;
}


/* =========================
   MESSAGES
========================= */

.messages {
  flex: 1;

  min-height: 0;

  padding:
    30px 10px;

  display: flex;

  flex-direction: column;

  gap: 14px;

  overflow-y: auto;

  scroll-behavior: smooth;
}

.message-row {
  display: flex;

  flex-direction: column;

  max-width: 72%;
}

.message-row.user {
  align-self: flex-end;

  align-items: flex-end;
}

.message-row.character {
  align-self: flex-start;

  align-items: flex-start;
}

.message-row.system {
  align-self: center;

  align-items: center;
}

.message {
  max-width: 100%;

  padding:
    12px 16px;

  border-radius: 16px;

  font-size: 15px;

  line-height: 1.6;

  white-space: pre-wrap;

  overflow-wrap: anywhere;
}

.message.user {
  background:
    rgba(255, 255, 255, 0.96);

  color: #111;

  border-bottom-right-radius: 5px;
}

.message.character {
  background:
    rgba(28, 28, 35, 0.83);

  color: #f3f3f5;

  border:
    1px solid rgba(66, 66, 78, 0.18);

  border-bottom-left-radius: 5px;

  backdrop-filter:
    blur(5px);
}

.message.system {
  max-width: 500px;

  background:
    rgba(25, 25, 31, 0.9);

  color: #888;

  border:
    1px solid #282830;

  text-align: center;

  font-size: 13px;
}

.action-text {
  color: #858592;

  font-family:
    Georgia,
    "Times New Roman",
    serif;

  font-style: italic;

  font-size: 1.03em;
}


/* RESPONSE VERSIONS */

.message-tools {
  display: flex;

  align-items: center;

  gap: 4px;

  margin-top: 5px;

  margin-left: 6px;

  color: #81818e;
}

.message-tool-btn {
  min-width: 30px;

  height: 28px;

  border:
    1px solid transparent;

  border-radius: 8px;

  color: #8d8d9a;

  cursor: pointer;

  padding:
    0 7px;
}

.message-tool-btn:hover:not(:disabled) {
  background:
    rgba(36, 36, 45, 0.86);

  border-color: #34343f;

  color: #fff;
}

.message-tool-btn:disabled {
  opacity: 0.25;

  cursor: default;
}

.variant-count {
  font-size: 11px;

  color: #777;

  min-width: 34px;

  text-align: center;
}

.message-regenerate {
  font-size: 18px;
}


/* EMPTY CHAT */

.chat-empty {
  flex: 1;

  min-height: 300px;

  padding: 40px;

  display: flex;

  flex-direction: column;

  align-items: center;

  justify-content: center;

  color: #666;

  text-align: center;
}

.chat-empty-avatar {
  width: 80px;

  height: 80px;

  margin-bottom: 18px;

  object-fit: cover;

  border-radius: 50%;

  background: #1d1d25;
}

.chat-empty h3 {
  margin-bottom: 8px;

  color: #bbb;

  font-size: 20px;
}

.chat-empty p {
  max-width: 400px;

  color: #777;

  font-size: 14px;

  line-height: 1.5;
}


/* =========================
   CHAT INPUT
========================= */

.chat-form {
  display: flex;

  gap: 10px;

  padding-top: 15px;

  border-top:
    1px solid rgba(70, 70, 82, 0.55);
}

.chat-form textarea {
  flex: 1;

  min-width: 0;

  background:
    rgba(24, 24, 31, 0.90);

  color: #fff;

  border:
    1px solid #3a3a46;

  border-radius: 14px;

  padding:
    15px 18px;

  outline: none;

  font-size: 15px;

  line-height: 1.45;

  resize: none;

  overflow-y: hidden;

  min-height: 52px;

  max-height: 180px;

  backdrop-filter:
    blur(7px);
}

.chat-form textarea:focus {
  border-color: #6f6f7c;
}

.chat-form textarea::placeholder {
  color: #777;
}

.chat-form textarea:disabled {
  opacity: 0.65;
}

.chat-form button {
  min-width: 85px;

  background: #fff;

  color: #000;

  border: 0;

  border-radius: 14px;

  padding:
    0 22px;

  font-weight: 700;

  cursor: pointer;
}

.chat-form button:hover {
  opacity: 0.85;
}


/* =========================
   TYPING
========================= */

.typing-bubble {
  min-width: 58px;
}

.typing-indicator {
  height: 20px;

  display: flex;

  align-items: center;

  gap: 5px;
}

.typing-indicator span {
  width: 6px;

  height: 6px;

  background: #999;

  border-radius: 50%;

  animation:
    typingDot
    1.2s
    infinite
    ease-in-out;
}

.typing-indicator span:nth-child(2) {
  animation-delay: 0.15s;
}

.typing-indicator span:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes typingDot {
  0%,
  60%,
  100% {
    transform:
      translateY(0);

    opacity: 0.35;
  }

  30% {
    transform:
      translateY(-4px);

    opacity: 1;
  }
}

.message.streaming::after {
  content: "";

  display: inline-block;

  width: 2px;

  height: 16px;

  margin-left: 3px;

  vertical-align: -2px;

  background: #aaa;

  animation:
    streamCursor
    0.8s
    infinite;
}

@keyframes streamCursor {
  0%,
  45% {
    opacity: 1;
  }

  46%,
  100% {
    opacity: 0;
  }
}


/* =========================
   RIGHT CLICK MENU
========================= */

.message-context-menu {
  position: fixed;

  z-index: 3000;

  width: 230px;

  padding: 7px;

  background: #1b1b29;

  border:
    1px solid #36364a;

  border-radius: 13px;

  box-shadow:
    0 16px 42px
    rgba(0, 0, 0, 0.52);

  overflow: hidden;
}

.context-action {
  width: 100%;

  display: flex;

  align-items: center;

  gap: 13px;

  padding:
    12px 13px;

  border: 0;

  border-radius: 9px;

  background: transparent;

  color: #45c7ed;

  text-align: left;

  font-size: 15px;

  cursor: pointer;
}

.context-action > span:first-child {
  width: 24px;

  display: inline-flex;

  justify-content: center;

  font-size: 19px;
}

.context-action:hover {
  background: #28283a;
}

.context-divider {
  height: 1px;

  background: #303044;

  margin:
    5px 3px;
}

.context-danger {
  color: #ff616b;
}


/* =========================
   MEMORY
========================= */

.memory-modal {
  position: fixed;

  inset: 0;

  z-index: 2000;

  display: flex;

  justify-content: flex-end;
}

.memory-overlay {
  position: absolute;

  inset: 0;

  background:
    rgba(0, 0, 0, 0.62);

  backdrop-filter:
    blur(3px);
}

.memory-panel {
  position: relative;

  z-index: 2;

  width:
    min(520px, 92vw);

  height: 100vh;

  padding:
    26px 24px;

  background: #111116;

  border-left:
    1px solid #303039;

  overflow-y: auto;

  box-shadow:
    -20px 0 50px
    rgba(0, 0, 0, 0.4);

  animation:
    memorySlideIn
    0.22s
    ease;
}

@keyframes memorySlideIn {
  from {
    transform:
      translateX(30px);

    opacity: 0;
  }

  to {
    transform:
      translateX(0);

    opacity: 1;
  }
}

.memory-header {
  display: flex;

  align-items: flex-start;

  justify-content: space-between;

  gap: 15px;

  padding-bottom: 20px;

  border-bottom:
    1px solid #292930;
}

.memory-title-row {
  display: flex;

  align-items: center;

  gap: 10px;
}

.memory-title-icon {
  font-size: 24px;
}

.memory-header h2 {
  font-size: 23px;
}

.memory-header p {
  margin-top: 7px;

  color: #777;

  font-size: 13px;
}

.memory-close-btn {
  width: 38px;

  height: 38px;

  display: flex;

  align-items: center;

  justify-content: center;

  background: #1d1d25;

  color: #aaa;

  border:
    1px solid #30303a;

  border-radius: 10px;

  font-size: 25px;

  cursor: pointer;
}

.memory-close-btn:hover {
  background: #292932;

  color: #fff;
}

.memory-status-card {
  margin-top: 20px;

  padding: 15px;

  display: flex;

  align-items: center;

  justify-content: space-between;

  gap: 16px;

  background: #18181f;

  border:
    1px solid #292932;

  border-radius: 12px;
}

.memory-status-label {
  display: block;

  margin-bottom: 5px;

  color: #666;

  font-size: 11px;

  text-transform: uppercase;

  letter-spacing: 0.7px;
}

.memory-status-card strong {
  font-size: 14px;
}

.memory-progress {
  color: #777;

  font-size: 12px;

  white-space: nowrap;
}

.memory-section {
  padding:
    22px 0;

  border-bottom:
    1px solid #24242b;
}

.memory-section h3 {
  margin-bottom: 12px;

  color: #eee;

  font-size: 14px;
}

.memory-text {
  color: #aaa;

  font-size: 14px;

  line-height: 1.65;

  white-space: pre-wrap;
}

.memory-list {
  display: flex;

  flex-direction: column;

  gap: 9px;

  list-style: none;
}

.memory-list li {
  position: relative;

  padding-left: 18px;

  color: #aaa;

  font-size: 14px;

  line-height: 1.55;
}

.memory-list li::before {
  content: "•";

  position: absolute;

  left: 2px;

  color: #777;
}

.memory-empty-item {
  color: #666 !important;

  font-style: italic;
}

.memory-footer {
  padding:
    20px 0 5px;

  display: flex;

  flex-direction: column;

  gap: 7px;

  color: #555;

  font-size: 11px;

  line-height: 1.5;
}


/* =========================
   SCROLLBARS
========================= */

.messages::-webkit-scrollbar,
.chat-history-list::-webkit-scrollbar,
.main-content::-webkit-scrollbar,
.memory-panel::-webkit-scrollbar {
  width: 6px;
}

.messages::-webkit-scrollbar-track,
.chat-history-list::-webkit-scrollbar-track,
.main-content::-webkit-scrollbar-track,
.memory-panel::-webkit-scrollbar-track {
  background: transparent;
}

.messages::-webkit-scrollbar-thumb,
.chat-history-list::-webkit-scrollbar-thumb,
.main-content::-webkit-scrollbar-thumb,
.memory-panel::-webkit-scrollbar-thumb {
  background: #34343d;

  border-radius: 10px;
}


/* =========================
   RESPONSIVE
========================= */

@media (max-width: 800px) {
  .two-columns,
  .example-grid {
    grid-template-columns: 1fr;
  }

  .avatar-editor-row {
    align-items: flex-start;

    flex-direction: column;
  }

  .avatar-preview-wrap {
    width: 90px;

    height: 90px;
  }

  .creator-card {
    padding: 16px;
  }
}


@media (max-width: 700px) {
  .sidebar {
    width: 76px;

    min-width: 76px;

    padding:
      20px 9px;
  }

  .logo {
    font-size: 0;

    text-align: center;
  }

  .logo::after {
    content: "C";

    font-size: 25px;
  }

  .nav-btn,
  .settings-btn {
    font-size: 0;

    text-align: center;
  }

  #chatsBtn::after {
    content: "💬";

    font-size: 20px;
  }

  #createBtn::after {
    content: "＋";

    font-size: 22px;
  }

  .settings-btn::after {
    content: "⚙";

    font-size: 20px;
  }

  .sidebar-section-title {
    display: none;
  }

  .history-character {
    display: none;
  }

  .main-content {
    padding:
      20px 15px;
  }

  #chatView {
    height:
      calc(100vh - 40px);
  }

  .chat-character-info p {
    display: none;
  }

  .memory-btn,
  .new-chat-btn,
  .menu-btn {
    width: 42px;

    min-width: 42px;
  }

  .new-chat-btn {
    padding: 0;

    font-size: 0;
  }

  .new-chat-btn::after {
    content: "＋";

    font-size: 22px;
  }

  .message-row {
    max-width: 86%;
  }

  .memory-panel {
    width: 100%;
  }
}


@media (max-width: 450px) {
  .sidebar {
    width: 64px;

    min-width: 64px;
  }

  .main-content {
    padding:
      15px 10px;
  }

  .message-row {
    max-width: 91%;
  }

  .message {
    font-size: 14px;
  }
}
/* =========================
   FIX CHAT MENU LAYER
========================= */

.chat-header.chat-layer {
  z-index: 1000;
}

.chat-menu-wrapper {
  z-index: 1001;
}

.chat-menu {
  z-index: 1002;
  pointer-events: auto;
}

.current-chat-bar.chat-layer {
  z-index: 2;
}

.messages.chat-layer {
  z-index: 1;
}

.chat-form.chat-layer {
  z-index: 2;
}
/* =========================
   BATTLE IMAGE ATTACHMENTS
========================= */

.chat-input-row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}

.attach-btn {
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.08);
  color: white;
  border-radius: 14px;
  min-width: 46px;
  height: 46px;
  cursor: pointer;
  font-size: 18px;
  transition: 0.2s ease;
}

.attach-btn:hover {
  background: rgba(255, 255, 255, 0.14);
  transform: translateY(-1px);
}

.attachment-preview {
  margin-bottom: 10px;
}

.attachment-preview-card {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(10px);
}

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

.attachment-preview-meta {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.attachment-preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.attachment-preview-title {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: rgba(255, 255, 255, 0.85);
}

.attachment-remove-btn {
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.85);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
}

#attachmentNote {
  width: 100%;
  resize: vertical;
  min-height: 56px;
  max-height: 120px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 10px 12px;
  background: rgba(0, 0, 0, 0.18);
  color: white;
  outline: none;
}

#attachmentNote::placeholder {
  color: rgba(255, 255, 255, 0.45);
}

/* message attachments */

.message-attachment {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 8px;
}

.message-attachment img {
  max-width: 240px;
  max-height: 240px;
  width: 100%;
  object-fit: cover;
  border-radius: 14px;
  display: block;
}

.message-attachment-note {
  font-size: 12px;
  line-height: 1.4;
  opacity: 0.82;
  white-space: pre-wrap;
}

.message.user .message-text,
.message.character .message-text {
  white-space: pre-wrap;
  word-break: break-word;
}
/* =========================================================
   BATTLE VISION — POLISHED COMPOSER
   Keep this block at the VERY END of style.css
========================================================= */


/* Main composer now stacks:
   attachment preview
   then input row
*/

.chat-form.chat-layer {
  display: flex;
  flex-direction: column;
  gap: 10px;
}


/* =========================================
   MAIN INPUT ROW
========================================= */

.chat-input-row {
  width: 100%;

  display: flex;

  align-items: flex-end;

  gap: 10px;
}


.chat-input-row .message-input {
  flex: 1;

  min-width: 0;
}



/* =========================================
   IMAGE BUTTON
========================================= */

.chat-form .attach-btn {
  width: 52px;

  min-width: 52px;

  height: 52px;

  flex:
    0 0 52px;


  padding: 0;


  display: inline-flex;

  align-items: center;

  justify-content: center;


  background:
    rgba(
      24,
      24,
      31,
      0.90
    );


  color:
    #aaaab5;


  border:
    1px solid
    #3a3a46;


  border-radius:
    14px;


  cursor:
    pointer;


  backdrop-filter:
    blur(7px);


  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease,
    transform 0.15s ease;
}


.chat-form .attach-btn svg {
  width: 23px;

  height: 23px;


  fill: none;

  stroke:
    currentColor;


  stroke-width:
    1.8;


  stroke-linecap:
    round;


  stroke-linejoin:
    round;


  pointer-events:
    none;
}


.chat-form .attach-btn:hover:not(:disabled) {
  opacity: 1;


  color:
    #ffffff;


  background:
    rgba(
      39,
      39,
      49,
      0.96
    );


  border-color:
    #565665;


  transform:
    translateY(-1px);
}


.chat-form .attach-btn:active:not(:disabled) {
  transform:
    translateY(0);
}


.chat-form .attach-btn:disabled {
  opacity:
    0.45;


  cursor:
    default;


  transform:
    none;
}



/* =========================================
   KEYBOARD FOCUS
========================================= */

.chat-form .attach-btn:focus-visible,
.chat-form .send-btn:focus-visible,
.chat-form .attachment-remove-btn:focus-visible {
  outline:
    2px solid
    #7b6cff;


  outline-offset:
    2px;
}



/* =========================================
   SEND BUTTON
========================================= */

.chat-form .send-btn {
  min-width:
    86px;


  height:
    52px;


  flex:
    0 0 auto;


  padding:
    0 22px;
}



/* =========================================
   ATTACHMENT PREVIEW
========================================= */

.attachment-preview {
  width:
    100%;


  animation:
    attachmentFadeIn
    0.16s
    ease;
}


@keyframes attachmentFadeIn {

  from {
    opacity: 0;

    transform:
      translateY(4px);
  }


  to {
    opacity: 1;

    transform:
      translateY(0);
  }

}



.attachment-preview-card {
  width:
    min(
      620px,
      100%
    );


  display:
    grid;


  grid-template-columns:
    72px
    minmax(
      0,
      1fr
    );


  gap:
    12px;


  padding:
    10px;


  background:
    rgba(
      20,
      20,
      27,
      0.96
    );


  border:
    1px solid
    #343440;


  border-radius:
    16px;


  box-shadow:
    0
    10px
    28px
    rgba(
      0,
      0,
      0,
      0.22
    );


  backdrop-filter:
    blur(10px);
}



/* =========================================
   PREVIEW THUMBNAIL
========================================= */

.attachment-thumb-wrap {
  width:
    72px;


  height:
    72px;


  border-radius:
    12px;


  overflow:
    hidden;


  background:
    #0f0f15;


  border:
    1px solid
    #30303a;
}


.attachment-preview-image {
  width:
    100%;


  height:
    100%;


  display:
    block;


  object-fit:
    cover;
}



/* =========================================
   PREVIEW INFORMATION
========================================= */

.attachment-preview-info {
  min-width:
    0;


  display:
    flex;


  flex-direction:
    column;


  justify-content:
    center;


  gap:
    8px;
}


.attachment-preview-top {
  display:
    flex;


  align-items:
    flex-start;


  justify-content:
    space-between;


  gap:
    12px;
}


.attachment-preview-top > div {
  min-width:
    0;
}


.attachment-preview-top strong,
.attachment-preview-top span {
  display:
    block;
}


.attachment-preview-top strong {
  margin-bottom:
    3px;


  color:
    #f1f1f4;


  font-size:
    13px;
}


.attachment-preview-top span {
  color:
    #777784;


  font-size:
    11px;


  line-height:
    1.35;
}



/* =========================================
   REMOVE ATTACHMENT BUTTON
========================================= */

.chat-form .attachment-remove-btn {
  width:
    30px;


  min-width:
    30px;


  height:
    30px;


  flex:
    0 0 30px;


  padding:
    0;


  display:
    inline-flex;


  align-items:
    center;


  justify-content:
    center;


  background:
    transparent;


  color:
    #858591;


  border:
    1px solid
    transparent;


  border-radius:
    9px;


  cursor:
    pointer;
}


.chat-form .attachment-remove-btn svg {
  width:
    16px;


  height:
    16px;


  fill:
    none;


  stroke:
    currentColor;


  stroke-width:
    1.9;


  stroke-linecap:
    round;


  pointer-events:
    none;
}


.chat-form .attachment-remove-btn:hover:not(:disabled) {
  opacity:
    1;


  background:
    #2a2026;


  color:
    #ff7882;


  border-color:
    #4a2a33;
}


.chat-form .attachment-remove-btn:disabled {
  opacity:
    0.4;


  cursor:
    default;
}



/* =========================================
   ATTACHMENT NOTE
========================================= */

.chat-form .attachment-note {
  width:
    100%;


  min-width:
    0;


  min-height:
    42px;


  max-height:
    86px;


  flex:
    none;


  padding:
    10px 11px;


  background:
    #101016;


  color:
    #e9e9ed;


  border:
    1px solid
    #30303a;


  border-radius:
    10px;


  outline:
    none;


  font-size:
    12px;


  line-height:
    1.4;


  resize:
    vertical;


  overflow-y:
    auto;


  backdrop-filter:
    none;
}


.chat-form .attachment-note:focus {
  border-color:
    #5d587a;
}


.chat-form .attachment-note::placeholder {
  color:
    #60606b;
}



/* =========================================
   ATTACHED IMAGE INSIDE USER MESSAGE
========================================= */

.message-attachment {
  width:
    min(
      340px,
      100%
    );


  display:
    flex;


  flex-direction:
    column;


  gap:
    8px;


  margin-bottom:
    9px;
}


.message-attachment img {
  width:
    100%;


  max-height:
    320px;


  display:
    block;


  object-fit:
    cover;


  border-radius:
    12px;


  border:
    1px solid
    rgba(
      0,
      0,
      0,
      0.12
    );
}


.message-attachment-note {
  padding:
    0 2px;


  color:
    #4c4c54;


  font-size:
    12px;


  line-height:
    1.45;
}


.message.character
.message-attachment-note {
  color:
    #92929d;
}


.message.character
.message-attachment img {
  border-color:
    rgba(
      255,
      255,
      255,
      0.08
    );
}


.message-text {
  min-width:
    0;
}



/* =========================================
   MOBILE
========================================= */

@media (max-width: 700px) {

  .chat-input-row {
    gap:
      8px;
  }


  .chat-form .attach-btn {
    width:
      48px;


    min-width:
      48px;


    height:
      48px;


    flex-basis:
      48px;
  }


  .chat-form .send-btn {
    min-width:
      72px;


    height:
      48px;


    padding:
      0 16px;
  }


  .attachment-preview-card {
    grid-template-columns:
      60px
      minmax(
        0,
        1fr
      );
  }


  .attachment-thumb-wrap {
    width:
      60px;


    height:
      60px;
  }

}



@media (max-width: 450px) {

  .chat-form .send-btn {
    min-width:
      64px;


    padding:
      0 13px;
  }


  .attachment-preview-card {
    grid-template-columns:
      54px
      minmax(
        0,
        1fr
      );


    gap:
      9px;
  }


  .attachment-thumb-wrap {
    width:
      54px;


    height:
      54px;
  }


  .attachment-preview-top span {
    display:
      none;
  }

}


/* =========================================================
   BATTLE MEDIA V1
   Photo + Audio + Video attachment menu
   Added on top of the working Battle Vision stylesheet.
========================================================= */

.chat-form.chat-layer {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chat-input-row {
  width: 100%;
  display: flex;
  align-items: flex-end;
  gap: 10px;
}

.chat-input-row .message-input {
  flex: 1;
  min-width: 0;
}

.media-menu-wrapper {
  position: relative;
  flex: 0 0 auto;
  z-index: 1700;
}

.chat-form .media-menu-btn {
  width: 52px;
  min-width: 52px;
  height: 52px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(24, 24, 31, 0.90);
  color: #aaaab5;
  border: 1px solid #3a3a46;
  border-radius: 14px;
  cursor: pointer;
  backdrop-filter: blur(7px);
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease,
    transform 0.15s ease;
}

.chat-form .media-menu-btn svg {
  width: 25px;
  height: 25px;
  fill: currentColor;
  stroke: none;
  pointer-events: none;
}

.chat-form .media-menu-btn:hover:not(:disabled),
.chat-form .media-menu-btn[aria-expanded="true"] {
  opacity: 1;
  color: #fff;
  background: rgba(39, 39, 49, 0.97);
  border-color: #565665;
  transform: translateY(-1px);
}

.chat-form .media-menu-btn:disabled {
  opacity: 0.45;
  cursor: default;
  transform: none;
}

.media-attach-menu {
  position: absolute;
  left: 0;
  bottom: 62px;
  z-index: 1800;
  width: 245px;
  padding: 7px;
  background: rgba(20, 20, 27, 0.985);
  border: 1px solid #363641;
  border-radius: 15px;
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.48);
  backdrop-filter: blur(14px);
  animation: battleMediaMenuIn 0.14s ease;
}

@keyframes battleMediaMenuIn {
  from {
    opacity: 0;
    transform: translateY(6px) scale(0.98);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.chat-form .media-option {
  width: 100%;
  min-width: 0;
  height: auto;
  padding: 10px 11px;
  display: flex;
  align-items: center;
  gap: 11px;
  background: transparent;
  color: #eeeef2;
  border: 0;
  border-radius: 10px;
  text-align: left;
  cursor: pointer;
}

.chat-form .media-option:hover {
  opacity: 1;
  background: #292933;
}

.media-option-icon {
  width: 36px;
  min-width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #202029;
  color: #b9b6cb;
  border: 1px solid #343440;
  border-radius: 10px;
}

.media-option-icon svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.media-option > span:last-child {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.media-option strong {
  font-size: 13px;
  font-weight: 700;
}

.media-option small {
  color: #777784;
  font-size: 11px;
  font-weight: 400;
}

.chat-form .send-btn {
  min-width: 86px;
  height: 52px;
  flex: 0 0 auto;
  padding: 0 22px;
}

.chat-form .media-menu-btn:focus-visible,
.chat-form .send-btn:focus-visible,
.chat-form .attachment-remove-btn:focus-visible,
.chat-form .media-option:focus-visible {
  outline: 2px solid #7b6cff;
  outline-offset: 2px;
}

.attachment-preview {
  width: 100%;
  animation: attachmentFadeIn 0.16s ease;
}

.attachment-preview-card {
  width: min(680px, 100%);
  display: grid;
  grid-template-columns: minmax(86px, 170px) minmax(0, 1fr);
  gap: 12px;
  padding: 10px;
  background: rgba(20, 20, 27, 0.96);
  border: 1px solid #343440;
  border-radius: 16px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(10px);
}

.attachment-preview-visual {
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: #0f0f15;
  border: 1px solid #30303a;
  border-radius: 12px;
}

.attachment-preview-image,
.attachment-preview-video {
  width: 100%;
  max-height: 132px;
  display: block;
  object-fit: cover;
  border-radius: 11px;
}

.attachment-preview-audio {
  width: 100%;
  min-width: 145px;
  height: 40px;
}

.attachment-preview-icon {
  width: 54px;
  height: 54px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #a8a5ba;
  background: #1d1d27;
  border-radius: 14px;
}

.attachment-preview-icon svg {
  width: 28px;
  height: 28px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.attachment-preview-info {
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
}

.attachment-preview-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.attachment-preview-top > div {
  min-width: 0;
}

.attachment-preview-top strong,
.attachment-preview-top span {
  display: block;
}

.attachment-preview-top strong {
  margin-bottom: 3px;
  color: #f1f1f4;
  font-size: 13px;
}

.attachment-preview-top span {
  max-width: 420px;
  color: #777784;
  font-size: 11px;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-form .attachment-remove-btn {
  width: 30px;
  min-width: 30px;
  height: 30px;
  flex: 0 0 30px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  color: #858591;
  border: 1px solid transparent;
  border-radius: 9px;
  cursor: pointer;
}

.chat-form .attachment-remove-btn svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  pointer-events: none;
}

.chat-form .attachment-remove-btn:hover:not(:disabled) {
  opacity: 1;
  background: #2a2026;
  color: #ff7882;
  border-color: #4a2a33;
}

.chat-form .attachment-note {
  width: 100%;
  min-width: 0;
  min-height: 42px;
  max-height: 86px;
  flex: none;
  padding: 10px 11px;
  background: #101016;
  color: #e9e9ed;
  border: 1px solid #30303a;
  border-radius: 10px;
  outline: none;
  font-size: 12px;
  line-height: 1.4;
  resize: vertical;
  overflow-y: auto;
  backdrop-filter: none;
}

.chat-form .attachment-note:focus {
  border-color: #5d587a;
}

.chat-form .attachment-note::placeholder {
  color: #60606b;
}

.message-attachment {
  width: min(370px, 100%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 9px;
}

.message-attachment > img,
.message-attachment > video {
  width: 100%;
  max-height: 350px;
  display: block;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid rgba(0, 0, 0, 0.12);
}

.message-media-shell {
  width: min(370px, 100%);
  padding: 10px;
  background: rgba(0, 0, 0, 0.08);
  border: 1px solid rgba(0, 0, 0, 0.10);
  border-radius: 12px;
}

.message-media-label {
  margin-bottom: 7px;
  font-size: 11px;
  opacity: 0.72;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.message-media-shell audio {
  width: 100%;
  height: 40px;
  display: block;
}

.message-attachment-note {
  padding: 0 2px;
  color: #4c4c54;
  font-size: 12px;
  line-height: 1.45;
}

.message.character .message-attachment-note {
  color: #92929d;
}

.message.character .message-media-shell {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.08);
}

.message.character .message-attachment > img,
.message.character .message-attachment > video {
  border-color: rgba(255, 255, 255, 0.08);
}

.message-text {
  min-width: 0;
}

@media (max-width: 700px) {
  .chat-input-row {
    gap: 8px;
  }

  .chat-form .media-menu-btn {
    width: 48px;
    min-width: 48px;
    height: 48px;
  }

  .chat-form .send-btn {
    min-width: 72px;
    height: 48px;
    padding: 0 16px;
  }

  .media-attach-menu {
    width: 225px;
    bottom: 58px;
  }

  .attachment-preview-card {
    grid-template-columns: 92px minmax(0, 1fr);
  }

  .attachment-preview-audio {
    min-width: 80px;
  }
}

@media (max-width: 450px) {
  .chat-form .send-btn {
    min-width: 64px;
    padding: 0 13px;
  }

  .media-attach-menu {
    width: min(225px, calc(100vw - 95px));
  }

  .attachment-preview-card {
    grid-template-columns: 72px minmax(0, 1fr);
    gap: 9px;
  }

  .attachment-preview-top span {
    max-width: 190px;
  }
}

/* =========================================================
   CHATI-AI VISUAL POLISH V1
   Fancy creator symbols + iOS-style buttons + action styling
   + finished-response animation.
   Keep this block at the VERY END of style.css.
========================================================= */

.creator-card-title .section-symbol {
  width: 38px;
  min-width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: -5px;
  color: #b9b4d8;
  background:
    linear-gradient(
      145deg,
      rgba(62, 60, 80, 0.78),
      rgba(28, 28, 39, 0.76)
    );
  border: 1px solid rgba(151, 143, 190, 0.22);
  border-radius: 12px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.055),
    0 7px 18px rgba(0, 0, 0, 0.16);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition:
    transform 0.38s cubic-bezier(0.2, 0.9, 0.2, 1.15),
    color 0.25s ease,
    border-color 0.25s ease,
    background 0.25s ease,
    box-shadow 0.25s ease;
}

.creator-card-title .section-symbol svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.65;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.creator-card:hover .section-symbol {
  color: #ddd8ff;
  border-color: rgba(163, 151, 224, 0.34);
  background:
    linear-gradient(
      145deg,
      rgba(76, 71, 103, 0.88),
      rgba(33, 32, 46, 0.82)
    );
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.075),
    0 9px 22px rgba(0, 0, 0, 0.2);
  transform: translateY(-1px) scale(1.045);
}

.creator-card-title.powers-heading > span:not(.section-symbol) {
  filter: drop-shadow(0 3px 9px rgba(255, 196, 76, 0.16));
}


/* User actions typed as **action** */

.message.user .action-text {
  color: #73737e;
  font-family:
    Georgia,
    "Times New Roman",
    serif;
  font-style: italic;
  font-weight: 600;
  letter-spacing: 0.005em;
}

.message.character .action-text {
  color: #858592;
}


/* iOS-like button spring */

button {
  -webkit-tap-highlight-color: transparent;
  transform-origin: center;
  will-change: transform, filter;
}

button:not(:disabled) {
  transition:
    transform 0.34s cubic-bezier(0.22, 1, 0.36, 1),
    filter 0.24s ease,
    opacity 0.24s ease,
    box-shadow 0.28s ease,
    background-color 0.28s ease,
    border-color 0.28s ease,
    color 0.28s ease;
}

@media (hover: hover) {
  button:not(:disabled):hover {
    filter: brightness(1.06);
  }
}

button:not(:disabled):active {
  transform: scale(0.94) !important;
  filter: brightness(0.96);
  transition:
    transform 0.075s ease-out,
    filter 0.075s ease-out !important;
}

.back-btn:not(:disabled):active,
.memory-btn:not(:disabled):active,
.menu-btn:not(:disabled):active,
.message-tool-btn:not(:disabled):active,
.memory-close-btn:not(:disabled):active,
.media-menu-btn:not(:disabled):active,
.attachment-remove-btn:not(:disabled):active,
.remove-example-btn:not(:disabled):active {
  transform: scale(0.88) !important;
}

@media (hover: hover) {
  .main-create-btn:not(:disabled):hover,
  .save-character-btn:not(:disabled):hover,
  .send-btn:not(:disabled):hover {
    opacity: 1;
    transform: translateY(-1px) scale(1.012);
    box-shadow:
      0 8px 22px rgba(0, 0, 0, 0.18),
      0 1px 0 rgba(255, 255, 255, 0.4) inset;
  }

  .secondary-btn:not(:disabled):hover,
  .outline-add-btn:not(:disabled):hover,
  .nav-btn:not(:disabled):hover,
  .settings-btn:not(:disabled):hover,
  .new-chat-btn:not(:disabled):hover,
  .memory-btn:not(:disabled):hover,
  .menu-btn:not(:disabled):hover,
  .back-btn:not(:disabled):hover {
    transform: translateY(-1px) scale(1.012);
  }
}


/* Finished AI response animation */

.message-row.response-finished-row {
  animation:
    responseRowSettle
    0.52s
    cubic-bezier(0.16, 1, 0.3, 1)
    both;
}

.message.character.response-finished {
  position: relative;
  isolation: isolate;
  animation:
    responseBubbleSettle
    0.52s
    cubic-bezier(0.16, 1, 0.3, 1)
    both;
}

.message.character.response-finished .message-text {
  animation:
    responseTextReveal
    0.62s
    cubic-bezier(0.16, 1, 0.3, 1)
    both;
}

.message-row.response-finished-row .message-tools {
  animation:
    responseToolsReveal
    0.38s
    0.18s
    cubic-bezier(0.16, 1, 0.3, 1)
    both;
}

@keyframes responseRowSettle {
  0% {
    transform: translateY(7px);
  }
  100% {
    transform: translateY(0);
  }
}

@keyframes responseBubbleSettle {
  0% {
    opacity: 0.82;
    transform: scale(0.988);
    box-shadow: 0 0 0 rgba(0, 0, 0, 0);
  }
  55% {
    opacity: 1;
    transform: scale(1.004);
  }
  100% {
    opacity: 1;
    transform: scale(1);
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.08);
  }
}

@keyframes responseTextReveal {
  0% {
    opacity: 0.74;
    transform: translateY(3px);
    filter: blur(1.15px);
  }
  45% {
    opacity: 1;
    filter: blur(0.15px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
  }
}

@keyframes responseToolsReveal {
  0% {
    opacity: 0;
    transform: translateY(3px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  button,
  button:not(:disabled),
  .creator-card-title .section-symbol,
  .message-row.response-finished-row,
  .message.character.response-finished,
  .message.character.response-finished .message-text,
  .message-row.response-finished-row .message-tools {
    animation: none !important;
    transition-duration: 0.01ms !important;
  }
}


/* =========================================================
   CHATI-AI PRIVATE CHAT V1
   Temporary chat UI. Uses line-art SVG icons only.
========================================================= */

.new-chat-menu-wrapper {
  position: relative;
}

.new-chat-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
}

.new-chat-trigger-icon,
.new-chat-chevron,
.new-chat-option-icon svg,
.private-chat-badge svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.new-chat-trigger-icon {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.new-chat-trigger-icon svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.new-chat-chevron {
  width: 15px;
  height: 15px;
  opacity: 0.55;
  transition:
    transform 0.28s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.2s ease;
}

.new-chat-btn[aria-expanded="true"] .new-chat-chevron {
  transform: rotate(180deg);
  opacity: 0.9;
}

.new-chat-menu {
  position: absolute;
  top: 50px;
  right: 0;
  z-index: 130;
  width: 255px;
  padding: 7px;
  background:
    linear-gradient(
      155deg,
      rgba(29, 29, 39, 0.98),
      rgba(20, 20, 28, 0.98)
    );
  border: 1px solid rgba(116, 111, 145, 0.28);
  border-radius: 15px;
  box-shadow:
    0 18px 45px rgba(0, 0, 0, 0.48),
    inset 0 1px 0 rgba(255, 255, 255, 0.045);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  transform-origin: top right;
  animation:
    privateMenuIn
    0.22s
    cubic-bezier(0.16, 1, 0.3, 1)
    both;
}

.new-chat-option {
  width: 100%;
  min-height: 58px;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 10px;
  background: transparent;
  color: #f2f1f7;
  border: 0;
  border-radius: 11px;
  text-align: left;
  cursor: pointer;
}

.new-chat-option:hover {
  background: rgba(78, 75, 96, 0.36);
}

.new-chat-option.private-option:hover {
  background: rgba(88, 81, 120, 0.32);
}

.new-chat-option-icon {
  width: 36px;
  min-width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #aaa5c8;
  background: rgba(75, 72, 94, 0.34);
  border: 1px solid rgba(138, 130, 176, 0.2);
  border-radius: 11px;
}

.new-chat-option.private-option .new-chat-option-icon {
  color: #c2b9ef;
  background: rgba(91, 79, 139, 0.26);
  border-color: rgba(151, 137, 210, 0.24);
}

.new-chat-option-icon svg {
  width: 19px;
  height: 19px;
}

.new-chat-option-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.new-chat-option-copy strong {
  font-size: 13px;
  font-weight: 700;
  line-height: 1.2;
}

.new-chat-option-copy small {
  color: #787784;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.25;
}

.new-chat-option.private-option .new-chat-option-copy small {
  color: #8f899f;
}

.current-chat-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.current-chat-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.private-chat-badge {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  color: #c8c2e3;
  background: rgba(74, 67, 105, 0.28);
  border: 1px solid rgba(139, 127, 194, 0.25);
  border-radius: 999px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.035);
  font-size: 11px;
  line-height: 1;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation:
    privateBadgeIn
    0.32s
    cubic-bezier(0.16, 1, 0.3, 1)
    both;
}

.private-chat-badge svg {
  width: 13px;
  height: 13px;
}

.private-chat-badge span {
  color: #ded9f4;
  font-weight: 700;
}

.private-chat-badge small {
  color: #827d91;
  font-size: 10px;
}

#chatView.private-chat-active .current-chat-bar {
  border-bottom-color: rgba(113, 102, 158, 0.28);
}

#chatView.private-chat-active .new-chat-btn {
  border-color: rgba(126, 115, 174, 0.32);
}

@keyframes privateMenuIn {
  0% {
    opacity: 0;
    transform: translateY(-5px) scale(0.975);
    filter: blur(1px);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
}

@keyframes privateBadgeIn {
  0% {
    opacity: 0;
    transform: translateY(-2px) scale(0.96);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (max-width: 760px) {
  .new-chat-btn::after {
    content: none;
  }

  .new-chat-chevron {
    display: none;
  }

  .new-chat-menu {
    right: -48px;
    width: min(255px, calc(100vw - 30px));
  }

  .private-chat-badge small {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .new-chat-menu,
  .private-chat-badge,
  .new-chat-chevron {
    animation: none !important;
    transition-duration: 0.01ms !important;
  }
}


/* =========================================================
   CINEMATIC CHAT UI V1
   Premium glass header, grouped bubbles, cinematic background,
   refined typing, and one-time message entrance motion.
========================================================= */

/* ---------- Cinematic chat frame ---------- */

#chatView {
  border-radius: 18px;
  background:
    linear-gradient(
      180deg,
      rgba(13, 13, 18, 0.18),
      rgba(13, 13, 18, 0.02) 24%,
      rgba(13, 13, 18, 0.12)
    );
}

.chat-background {
  transform: scale(1.045);
  filter: saturate(0.9) contrast(1.04) brightness(0.9);
  transition:
    opacity 0.42s ease,
    filter 0.42s ease,
    transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.chat-background.active {
  opacity: 0.38;
  transform: scale(1.025);
}

.chat-background::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(
      ellipse at 50% 38%,
      rgba(11, 11, 15, 0.05) 0%,
      rgba(11, 11, 15, 0.18) 44%,
      rgba(11, 11, 15, 0.58) 100%
    );
  pointer-events: none;
}

.chat-background::after {
  background:
    linear-gradient(
      180deg,
      rgba(10, 10, 14, 0.62) 0%,
      rgba(10, 10, 14, 0.72) 18%,
      rgba(10, 10, 14, 0.82) 66%,
      rgba(10, 10, 14, 0.94) 100%
    ),
    radial-gradient(
      circle at center,
      transparent 32%,
      rgba(5, 5, 8, 0.46) 100%
    );
}


/* ---------- Floating glass header ---------- */

.chat-header.chat-layer {
  margin: 2px 4px 8px;
  padding: 11px 13px;
  border:
    1px solid rgba(108, 108, 126, 0.24);
  border-radius: 18px;
  background:
    linear-gradient(
      145deg,
      rgba(24, 24, 32, 0.76),
      rgba(15, 15, 22, 0.66)
    );
  box-shadow:
    0 14px 34px rgba(0, 0, 0, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.045);
  backdrop-filter: blur(18px) saturate(1.12);
  -webkit-backdrop-filter: blur(18px) saturate(1.12);
}

.chat-header-left {
  gap: 13px;
}

.chat-avatar {
  width: 52px;
  min-width: 52px;
  height: 52px;
  border:
    1px solid rgba(193, 187, 226, 0.28);
  box-shadow:
    0 0 0 3px rgba(126, 113, 184, 0.07),
    0 8px 24px rgba(0, 0, 0, 0.28),
    0 0 24px rgba(121, 104, 193, 0.09);
  transition:
    transform 0.36s cubic-bezier(0.16, 1, 0.3, 1),
    box-shadow 0.36s ease,
    border-color 0.3s ease;
}

@media (hover: hover) {
  .chat-header-left:hover .chat-avatar {
    transform: translateY(-1px) scale(1.025);
    border-color: rgba(205, 198, 239, 0.4);
    box-shadow:
      0 0 0 3px rgba(126, 113, 184, 0.09),
      0 10px 28px rgba(0, 0, 0, 0.3),
      0 0 30px rgba(121, 104, 193, 0.14);
  }
}

.chat-character-info h2 {
  letter-spacing: -0.015em;
}

.chat-character-info p {
  color: #8e8e9b;
}

.chat-memory-icon {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.55;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.memory-btn,
.menu-btn,
.new-chat-btn {
  background:
    linear-gradient(
      145deg,
      rgba(37, 37, 47, 0.82),
      rgba(24, 24, 32, 0.74)
    );
  border-color: rgba(104, 104, 121, 0.28);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.035),
    0 7px 18px rgba(0, 0, 0, 0.11);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.memory-btn {
  font-size: initial;
}

.current-chat-bar.chat-layer {
  min-height: 30px;
  margin: 0 9px 2px;
  padding: 5px 7px 8px;
  border-bottom-color: rgba(88, 88, 103, 0.18);
  background: transparent;
}

.current-chat-bar strong {
  color: #b4b4bf;
}


/* ---------- Conversation spacing ---------- */

.messages.chat-layer {
  padding: 22px 14px 28px;
  gap: 14px;
  scroll-padding-bottom: 28px;
}

.message-row {
  position: relative;
  max-width: min(74%, 760px);
  transition:
    margin 0.24s ease;
}

.message-row.group-middle,
.message-row.group-end {
  margin-top: -7px;
}

.message {
  border-radius: 18px;
  line-height: 1.62;
  letter-spacing: 0.002em;
  transition:
    border-color 0.25s ease,
    box-shadow 0.28s ease,
    background 0.28s ease,
    transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

.message.user {
  background:
    linear-gradient(
      155deg,
      rgba(255, 255, 255, 0.99),
      rgba(239, 239, 245, 0.97)
    );
  border:
    1px solid rgba(255, 255, 255, 0.78);
  box-shadow:
    0 8px 24px rgba(0, 0, 0, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.78);
}

.message.character {
  background:
    linear-gradient(
      145deg,
      rgba(34, 34, 43, 0.84),
      rgba(24, 24, 32, 0.76)
    );
  border:
    1px solid rgba(111, 108, 130, 0.2);
  box-shadow:
    0 9px 28px rgba(0, 0, 0, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.026);
  backdrop-filter: blur(13px) saturate(1.05);
  -webkit-backdrop-filter: blur(13px) saturate(1.05);
}

@media (hover: hover) {
  .message-row.user:hover .message.user {
    box-shadow:
      0 10px 30px rgba(0, 0, 0, 0.15),
      inset 0 1px 0 rgba(255, 255, 255, 0.82);
  }

  .message-row.character:hover .message.character {
    border-color: rgba(135, 130, 157, 0.28);
    box-shadow:
      0 11px 30px rgba(0, 0, 0, 0.18),
      inset 0 1px 0 rgba(255, 255, 255, 0.035);
  }
}

/* Grouped user bubbles */
.message-row.user.group-start .message.user {
  border-bottom-right-radius: 8px;
}

.message-row.user.group-middle .message.user {
  border-top-right-radius: 8px;
  border-bottom-right-radius: 8px;
}

.message-row.user.group-end .message.user {
  border-top-right-radius: 8px;
  border-bottom-right-radius: 5px;
}

.message-row.user.group-solo .message.user {
  border-bottom-right-radius: 5px;
}

/* Grouped character bubbles */
.message-row.character.group-start .message.character {
  border-bottom-left-radius: 8px;
}

.message-row.character.group-middle .message.character {
  border-top-left-radius: 8px;
  border-bottom-left-radius: 8px;
}

.message-row.character.group-end .message.character {
  border-top-left-radius: 8px;
  border-bottom-left-radius: 5px;
}

.message-row.character.group-solo .message.character {
  border-bottom-left-radius: 5px;
}

.message-tools {
  opacity: 0.44;
  transform: translateY(-1px);
  transition:
    opacity 0.22s ease,
    transform 0.26s cubic-bezier(0.16, 1, 0.3, 1);
}

.message-row.character:hover .message-tools,
.message-tools:focus-within,
.message-row.response-finished-row .message-tools {
  opacity: 1;
  transform: translateY(0);
}


/* ---------- One-time message entrance ---------- */

.message-row.message-enter-row,
.message-row.message-stream-enter-row {
  animation:
    cinematicMessageRowIn
    0.42s
    cubic-bezier(0.16, 1, 0.3, 1)
    both;
}

.message.message-enter {
  animation:
    cinematicBubbleIn
    0.44s
    cubic-bezier(0.16, 1, 0.3, 1)
    both;
}

@keyframes cinematicMessageRowIn {
  0% {
    opacity: 0;
    transform: translateY(8px);
  }

  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes cinematicBubbleIn {
  0% {
    opacity: 0.72;
    transform: scale(0.975);
  }

  65% {
    opacity: 1;
    transform: scale(1.004);
  }

  100% {
    opacity: 1;
    transform: scale(1);
  }
}


/* ---------- Refined typing indicator ---------- */

.typing-row {
  max-width: 88px;
}

.typing-bubble {
  min-width: 64px;
  padding: 12px 15px;
  background:
    linear-gradient(
      145deg,
      rgba(37, 37, 47, 0.9),
      rgba(25, 25, 33, 0.84)
    ) !important;
  border-color: rgba(123, 119, 145, 0.24) !important;
  box-shadow:
    0 10px 28px rgba(0, 0, 0, 0.17),
    inset 0 1px 0 rgba(255, 255, 255, 0.03) !important;
}

.typing-indicator {
  height: 19px;
  gap: 5px;
}

.typing-indicator span {
  width: 6px;
  height: 6px;
  background:
    linear-gradient(
      180deg,
      #d2cfdf,
      #8b879b
    );
  box-shadow:
    0 0 9px rgba(185, 175, 225, 0.18);
  animation:
    cinematicTypingDot
    1.15s
    infinite
    cubic-bezier(0.4, 0, 0.2, 1);
}

.typing-indicator span:nth-child(2) {
  animation-delay: 0.13s;
}

.typing-indicator span:nth-child(3) {
  animation-delay: 0.26s;
}

@keyframes cinematicTypingDot {
  0%,
  58%,
  100% {
    opacity: 0.32;
    transform: translateY(0) scale(0.82);
  }

  28% {
    opacity: 1;
    transform: translateY(-4px) scale(1.08);
  }
}

.message.streaming::after {
  width: 1.5px;
  height: 15px;
  margin-left: 4px;
  border-radius: 999px;
  background: rgba(216, 213, 230, 0.82);
}


/* ---------- Premium composer ---------- */

.chat-form.chat-layer {
  margin: 0 4px 3px;
  padding: 10px;
  border:
    1px solid rgba(104, 104, 121, 0.2);
  border-radius: 18px;
  background:
    linear-gradient(
      145deg,
      rgba(22, 22, 29, 0.7),
      rgba(15, 15, 21, 0.62)
    );
  box-shadow:
    0 -4px 28px rgba(0, 0, 0, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.025);
  backdrop-filter: blur(16px) saturate(1.08);
  -webkit-backdrop-filter: blur(16px) saturate(1.08);
}

.chat-input-row .message-input,
.chat-form .media-menu-btn {
  background:
    rgba(29, 29, 38, 0.8);
  border-color: rgba(105, 105, 122, 0.32);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.018);
}

.chat-input-row .message-input:focus {
  background: rgba(31, 31, 41, 0.88);
  border-color: rgba(137, 132, 160, 0.58);
  box-shadow:
    0 0 0 3px rgba(117, 105, 172, 0.07),
    inset 0 1px 0 rgba(255, 255, 255, 0.025);
}

.chat-form .send-btn {
  box-shadow:
    0 8px 22px rgba(0, 0, 0, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.52);
}


/* ---------- Empty chat polish ---------- */

.chat-empty-avatar {
  border:
    1px solid rgba(185, 178, 215, 0.2);
  box-shadow:
    0 12px 34px rgba(0, 0, 0, 0.24),
    0 0 30px rgba(119, 105, 179, 0.08);
}

.chat-empty h3 {
  color: #d0d0d8;
  letter-spacing: -0.015em;
}


/* ---------- Responsive cinematic layout ---------- */

@media (max-width: 900px) {
  .message-row {
    max-width: 82%;
  }

  .chat-header.chat-layer {
    margin-left: 1px;
    margin-right: 1px;
  }

  .chat-form.chat-layer {
    margin-left: 1px;
    margin-right: 1px;
  }
}

@media (max-width: 620px) {
  .chat-header.chat-layer {
    padding: 9px 10px;
    border-radius: 15px;
  }

  .chat-avatar {
    width: 46px;
    min-width: 46px;
    height: 46px;
  }

  .messages.chat-layer {
    padding-left: 5px;
    padding-right: 5px;
  }

  .message-row {
    max-width: 90%;
  }

  .chat-form.chat-layer {
    padding: 8px;
    border-radius: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .message-row.message-enter-row,
  .message-row.message-stream-enter-row,
  .message.message-enter,
  .typing-indicator span,
  .chat-avatar,
  .chat-background {
    animation: none !important;
    transition-duration: 0.01ms !important;
  }
}


/* =========================================================
   SIDEBAR + NAVIGATION POLISH V2
   ========================================================= */

.sidebar {
  width: 276px;
  min-width: 276px;
  padding: 18px 14px 16px;
  background:
    linear-gradient(
      180deg,
      rgba(18, 18, 24, 0.985),
      rgba(13, 13, 18, 0.985)
    );
  border-right: 1px solid rgba(87, 87, 103, 0.26);
  box-shadow:
    18px 0 44px rgba(0, 0, 0, 0.08),
    inset -1px 0 0 rgba(255, 255, 255, 0.015);
  overflow: visible;
  transition:
    width 0.42s cubic-bezier(0.16, 1, 0.3, 1),
    min-width 0.42s cubic-bezier(0.16, 1, 0.3, 1),
    padding 0.42s cubic-bezier(0.16, 1, 0.3, 1),
    background 0.3s ease;
}

.sidebar.is-collapsed {
  width: 78px;
  min-width: 78px;
  padding-left: 12px;
  padding-right: 12px;
}

.sidebar-brand-row {
  min-height: 46px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 19px;
}

.sidebar-brand {
  min-width: 0;
  flex: 1;
  display: flex;
  align-items: center;
  gap: 11px;
  border: 0;
  border-radius: 13px;
  padding: 4px;
  color: #f3f3f6;
  cursor: pointer;
  overflow: hidden;
  text-align: left;
}

.sidebar-brand-mark {
  width: 36px;
  min-width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(139, 132, 176, 0.28);
  border-radius: 11px;
  background:
    linear-gradient(
      145deg,
      rgba(58, 55, 78, 0.7),
      rgba(30, 29, 41, 0.84)
    );
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.055),
    0 8px 22px rgba(0, 0, 0, 0.16);
  color: #dfdbea;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.04em;
  transition:
    transform 0.3s cubic-bezier(0.16, 1, 0.3, 1),
    border-color 0.25s ease,
    box-shadow 0.3s ease;
}

.sidebar-brand-name {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  font-size: 20px;
  font-weight: 760;
  letter-spacing: -0.035em;
  opacity: 1;
  transform: translateX(0);
  transition:
    opacity 0.22s ease,
    transform 0.32s cubic-bezier(0.16, 1, 0.3, 1),
    width 0.32s ease;
}

@media (hover: hover) {
  .sidebar-brand:hover .sidebar-brand-mark {
    transform: translateY(-1px) scale(1.025);
    border-color: rgba(160, 152, 200, 0.4);
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.075),
      0 10px 26px rgba(0, 0, 0, 0.2),
      0 0 22px rgba(126, 113, 184, 0.08);
  }
}

.sidebar-collapse-btn {
  width: 36px;
  min-width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(86, 86, 101, 0.27);
  border-radius: 11px;
  background: rgba(31, 31, 40, 0.62);
  color: #8e8e9d;
  cursor: pointer;
  transition:
    transform 0.36s cubic-bezier(0.16, 1, 0.3, 1),
    background 0.25s ease,
    color 0.25s ease,
    border-color 0.25s ease;
}

.sidebar-collapse-btn svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.38s cubic-bezier(0.16, 1, 0.3, 1);
}

.sidebar.is-collapsed .sidebar-collapse-btn svg {
  transform: rotate(180deg);
}

@media (hover: hover) {
  .sidebar-collapse-btn:hover {
    color: #e6e4ed;
    background: rgba(43, 43, 54, 0.78);
    border-color: rgba(120, 117, 139, 0.38);
  }
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sidebar .nav-btn,
.sidebar .settings-btn {
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 11px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: #9797a4;
  font-size: 14px;
  font-weight: 650;
  text-align: left;
  overflow: hidden;
  position: relative;
  transition:
    background 0.24s ease,
    color 0.24s ease,
    border-color 0.24s ease,
    transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.sidebar .nav-btn.active {
  background:
    linear-gradient(
      145deg,
      rgba(46, 44, 62, 0.76),
      rgba(34, 33, 46, 0.76)
    );
  border-color: rgba(119, 112, 153, 0.22);
  color: #efedf4;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.035),
    0 7px 20px rgba(0, 0, 0, 0.08);
}

.sidebar .nav-btn.active::before {
  content: "";
  position: absolute;
  left: 3px;
  top: 50%;
  width: 2px;
  height: 18px;
  border-radius: 999px;
  background: #a79ccf;
  transform: translateY(-50%);
  box-shadow: 0 0 12px rgba(167, 156, 207, 0.36);
}

.sidebar-nav-icon,
.sidebar-search-icon,
.sidebar-private-icon {
  width: 22px;
  min-width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
}

.sidebar-nav-icon svg,
.sidebar-search-icon svg,
.sidebar-private-icon svg,
.sidebar-search-clear svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.55;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sidebar-label {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  opacity: 1;
  transform: translateX(0);
  transition:
    opacity 0.2s ease,
    transform 0.32s cubic-bezier(0.16, 1, 0.3, 1);
}

@media (hover: hover) {
  .sidebar .nav-btn:hover,
  .sidebar .settings-btn:hover {
    background: rgba(35, 35, 45, 0.72);
    border-color: rgba(86, 86, 101, 0.2);
    color: #e7e6ec;
    transform: translateX(1px);
  }
}

.sidebar-search {
  min-height: 42px;
  margin-top: 14px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 10px;
  border: 1px solid rgba(78, 78, 92, 0.28);
  border-radius: 12px;
  background: rgba(20, 20, 27, 0.7);
  color: #797986;
  overflow: hidden;
  cursor: text;
  transition:
    border-color 0.25s ease,
    background 0.25s ease,
    box-shadow 0.25s ease,
    width 0.38s cubic-bezier(0.16, 1, 0.3, 1);
}

.sidebar-search:focus-within,
.sidebar-search.has-query {
  border-color: rgba(123, 116, 158, 0.46);
  background: rgba(25, 25, 34, 0.86);
  box-shadow:
    0 0 0 3px rgba(112, 100, 169, 0.055),
    inset 0 1px 0 rgba(255, 255, 255, 0.018);
  color: #a9a5ba;
}

.sidebar-search-input {
  width: 100%;
  min-width: 0;
  height: 40px;
  border: 0;
  outline: none;
  background: transparent;
  color: #ededf1;
  font-size: 13px;
  transition:
    opacity 0.2s ease,
    width 0.32s ease;
}

.sidebar-search-input::placeholder {
  color: #676773;
}

.sidebar-search-input::-webkit-search-cancel-button {
  display: none;
}

.sidebar-search-clear {
  width: 26px;
  min-width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 8px;
  color: #767684;
  cursor: pointer;
}

.sidebar-search-clear svg {
  width: 15px;
  height: 15px;
}

@media (hover: hover) {
  .sidebar-search-clear:hover {
    background: rgba(255, 255, 255, 0.045);
    color: #d7d5df;
  }
}

.sidebar-private-indicator {
  min-height: 45px;
  margin-top: 9px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid rgba(111, 106, 142, 0.23);
  border-radius: 12px;
  background:
    linear-gradient(
      145deg,
      rgba(40, 38, 53, 0.58),
      rgba(25, 24, 34, 0.66)
    );
  color: #a7a2b8;
  overflow: hidden;
}

.sidebar-private-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
  white-space: nowrap;
  overflow: hidden;
  transition:
    opacity 0.2s ease,
    transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.sidebar-private-copy strong {
  color: #d5d1df;
  font-size: 12px;
  font-weight: 700;
}

.sidebar-private-copy small {
  color: #716d7f;
  font-size: 10px;
}

.sidebar-divider {
  margin: 16px 5px 13px;
  background: rgba(78, 78, 91, 0.24);
  transition: margin 0.3s ease;
}

.sidebar-section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 24px;
  padding: 0 7px;
  margin-bottom: 7px;
  overflow: hidden;
}

.sidebar-section-title {
  margin: 0;
  padding: 0;
  color: #60606c;
  font-size: 10px;
  font-weight: 720;
  letter-spacing: 0.11em;
  white-space: nowrap;
  transition:
    opacity 0.2s ease,
    transform 0.3s ease;
}

.chat-history-count {
  min-width: 21px;
  height: 20px;
  display: grid;
  place-items: center;
  padding: 0 6px;
  border: 1px solid rgba(78, 78, 92, 0.24);
  border-radius: 999px;
  background: rgba(27, 27, 35, 0.72);
  color: #71717d;
  font-size: 10px;
  font-weight: 700;
  transition:
    opacity 0.2s ease,
    transform 0.3s ease;
}

.chat-history-list {
  gap: 3px;
  padding: 1px 2px 4px 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(103, 100, 120, 0.28) transparent;
}

.chat-history-list::-webkit-scrollbar {
  width: 4px;
}

.chat-history-list::-webkit-scrollbar-thumb {
  background: rgba(103, 100, 120, 0.28);
  border-radius: 999px;
}

.history-item {
  min-height: 52px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 8px;
  border: 1px solid transparent;
  border-radius: 12px;
  position: relative;
  overflow: hidden;
  transition:
    background 0.22s ease,
    border-color 0.22s ease,
    transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.history-item:hover,
.history-item.active {
  background: rgba(35, 35, 45, 0.72);
}

.history-item.active {
  border-color: rgba(108, 103, 137, 0.2);
  background:
    linear-gradient(
      145deg,
      rgba(42, 40, 54, 0.72),
      rgba(31, 30, 41, 0.76)
    );
}

@media (hover: hover) {
  .history-item:hover {
    transform: translateX(1px);
    border-color: rgba(90, 88, 105, 0.18);
  }
}

.history-avatar {
  width: 35px;
  min-width: 35px;
  height: 35px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(102, 99, 119, 0.28);
  border-radius: 11px;
  background:
    linear-gradient(
      145deg,
      rgba(51, 49, 64, 0.8),
      rgba(31, 30, 40, 0.88)
    );
  color: #c8c5d2;
  font-size: 12px;
  font-weight: 760;
  overflow: hidden;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.025);
}

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

.history-copy {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
  overflow: hidden;
  transition:
    opacity 0.2s ease,
    transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.history-character,
.history-title {
  margin: 0;
}

.history-character {
  color: #747480;
  font-size: 10.5px;
  font-weight: 620;
}

.history-title {
  color: #c6c6ce;
  font-size: 12.5px;
  font-weight: 590;
}

.history-item.active .history-title {
  color: #f0eef4;
}

.history-active-dot {
  width: 5px;
  min-width: 5px;
  height: 5px;
  border-radius: 50%;
  background: transparent;
  transition:
    background 0.2s ease,
    box-shadow 0.2s ease;
}

.history-item.active .history-active-dot {
  background: #aaa0d1;
  box-shadow: 0 0 9px rgba(170, 160, 209, 0.46);
}

.history-empty {
  margin: 3px 2px;
  padding: 13px 10px;
  border: 1px dashed rgba(78, 78, 91, 0.2);
  border-radius: 11px;
  color: #565662;
  font-size: 11px;
  text-align: center;
}

.sidebar .settings-btn {
  margin-top: 12px;
}

.empty-icon {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  margin-bottom: 20px;
  border: 1px solid rgba(102, 99, 119, 0.24);
  border-radius: 18px;
  background: rgba(25, 25, 33, 0.68);
  color: #7f7b8d;
  font-size: initial;
}

.empty-icon svg {
  width: 30px;
  height: 30px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.35;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.character-placeholder {
  font-size: 48px;
  font-weight: 760;
  letter-spacing: -0.04em;
  color: #777484;
}

/* Compact mode */
.sidebar.is-collapsed .sidebar-brand-row {
  justify-content: center;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
}

.sidebar.is-collapsed .sidebar-brand {
  flex: none;
  width: 42px;
  justify-content: center;
  padding: 3px;
}

.sidebar.is-collapsed .sidebar-brand-mark {
  width: 36px;
  min-width: 36px;
}

.sidebar.is-collapsed .sidebar-brand-name,
.sidebar.is-collapsed .sidebar-label,
.sidebar.is-collapsed .sidebar-search-input,
.sidebar.is-collapsed .sidebar-search-clear,
.sidebar.is-collapsed .sidebar-private-copy,
.sidebar.is-collapsed .sidebar-section-title,
.sidebar.is-collapsed .chat-history-count,
.sidebar.is-collapsed .history-copy,
.sidebar.is-collapsed .history-active-dot {
  width: 0;
  max-width: 0;
  opacity: 0;
  pointer-events: none;
  transform: translateX(-6px);
  overflow: hidden;
}

.sidebar.is-collapsed .sidebar-collapse-btn {
  width: 42px;
  min-width: 42px;
  height: 34px;
}

.sidebar.is-collapsed .nav-btn,
.sidebar.is-collapsed .settings-btn {
  width: 46px;
  min-width: 46px;
  height: 46px;
  min-height: 46px;
  justify-content: center;
  gap: 0;
  margin-left: auto;
  margin-right: auto;
  padding: 0;
}

.sidebar.is-collapsed .nav-btn.active::before {
  left: 1px;
  height: 17px;
}

.sidebar.is-collapsed .sidebar-search {
  width: 46px;
  min-width: 46px;
  height: 46px;
  min-height: 46px;
  justify-content: center;
  margin-left: auto;
  margin-right: auto;
  padding: 0;
  cursor: pointer;
}

.sidebar.is-collapsed .sidebar-private-indicator {
  width: 46px;
  min-width: 46px;
  height: 46px;
  min-height: 46px;
  justify-content: center;
  margin-left: auto;
  margin-right: auto;
  padding: 0;
}

.sidebar.is-collapsed .sidebar-divider {
  margin-left: 7px;
  margin-right: 7px;
}

.sidebar.is-collapsed .sidebar-section-heading {
  display: none;
}

.sidebar.is-collapsed .chat-history-list {
  align-items: center;
  padding-right: 0;
}

.sidebar.is-collapsed .history-item {
  width: 46px;
  min-width: 46px;
  height: 46px;
  min-height: 46px;
  justify-content: center;
  gap: 0;
  padding: 5px;
}

.sidebar.is-collapsed .history-avatar {
  width: 34px;
  min-width: 34px;
  height: 34px;
  border-radius: 10px;
}

.sidebar.is-collapsed .history-item.active::after {
  content: "";
  position: absolute;
  right: 2px;
  top: 50%;
  width: 4px;
  height: 16px;
  border-radius: 999px;
  background: #a79ccf;
  transform: translateY(-50%);
  box-shadow: 0 0 10px rgba(167, 156, 207, 0.38);
}

.sidebar.is-collapsed .history-empty {
  width: 42px;
  padding: 10px 3px;
  font-size: 0;
}

.sidebar.is-collapsed .history-empty::after {
  content: "—";
  font-size: 12px;
  color: #555561;
}

/* Compact-mode tooltips */
.sidebar.is-collapsed [data-tooltip] {
  position: relative;
}

.sidebar.is-collapsed [data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  left: calc(100% + 11px);
  top: 50%;
  z-index: 5000;
  padding: 7px 9px;
  border: 1px solid rgba(92, 92, 108, 0.32);
  border-radius: 9px;
  background: rgba(20, 20, 27, 0.96);
  color: #d8d7de;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transform: translate(4px, -50%) scale(0.97);
  transition:
    opacity 0.16s ease,
    transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@media (hover: hover) {
  .sidebar.is-collapsed [data-tooltip]:hover::after {
    opacity: 1;
    transform: translate(0, -50%) scale(1);
  }
}

/* Kill the old mobile emoji pseudo-icons. V2 uses SVG only. */
#chatsBtn::after,
#createBtn::after,
.settings-btn::after {
  content: none !important;
  display: none !important;
}

@media (max-width: 700px) {
  .sidebar {
    width: 230px;
    min-width: 230px;
    padding: 16px 11px;
  }

  .sidebar.is-collapsed {
    width: 68px;
    min-width: 68px;
    padding-left: 9px;
    padding-right: 9px;
  }

  .sidebar .nav-btn,
  .sidebar .settings-btn {
    font-size: 14px;
    text-align: left;
  }

  .sidebar.is-collapsed .nav-btn,
  .sidebar.is-collapsed .settings-btn {
    font-size: 14px;
    text-align: center;
  }

  .sidebar-section-title {
    display: block;
  }

  .history-character {
    display: block;
  }
}

@media (max-width: 450px) {
  .sidebar {
    width: 210px;
    min-width: 210px;
  }

  .sidebar.is-collapsed {
    width: 62px;
    min-width: 62px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .sidebar,
  .sidebar *,
  .history-item,
  .sidebar-search {
    transition-duration: 0.01ms !important;
    animation: none !important;
  }
}

/* Tooltip overflow fix for compact sidebar controls. */
.sidebar.is-collapsed .sidebar-brand,
.sidebar.is-collapsed .nav-btn,
.sidebar.is-collapsed .settings-btn,
.sidebar.is-collapsed .sidebar-search,
.sidebar.is-collapsed .sidebar-private-indicator,
.sidebar.is-collapsed .sidebar-collapse-btn {
  overflow: visible;
}


/* =========================================================
   GROUP CHAT V3.1
   ========================================================= */

.avatar-placeholder-polished {
  font-size: 0;
  background:
    radial-gradient(circle at 50% 38%, rgba(131, 118, 191, 0.12), transparent 48%),
    linear-gradient(145deg, rgba(29, 29, 39, 0.98), rgba(22, 22, 30, 0.98));
}

.avatar-placeholder-polished svg {
  width: 58px;
  height: 58px;
  fill: none;
  stroke: #b7addf;
  stroke-width: 1.45;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.88;
  filter: drop-shadow(0 7px 16px rgba(98, 83, 159, 0.16));
}

.groups-section {
  margin-top: 42px;
  padding-top: 28px;
  border-top: 1px solid rgba(92, 92, 107, 0.22);
}

.groups-section-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.groups-eyebrow,
.create-choice-eyebrow {
  display: block;
  margin-bottom: 5px;
  color: #777486;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.groups-section-header h3 {
  font-size: 21px;
  letter-spacing: -0.02em;
}

.groups-create-inline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  color: #bab6c9;
  border: 1px solid rgba(111, 106, 132, 0.28);
  border-radius: 11px;
  background: rgba(25, 25, 33, 0.66);
  cursor: pointer;
}

.groups-create-inline svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.groups-create-inline:hover {
  color: #fff;
  border-color: rgba(144, 135, 180, 0.42);
  background: rgba(34, 33, 45, 0.9);
}

.groups-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.group-card {
  position: relative;
  min-height: 150px;
  padding: 18px;
  overflow: hidden;
  border: 1px solid rgba(90, 90, 106, 0.28);
  border-radius: 17px;
  background:
    linear-gradient(145deg, rgba(24, 24, 32, 0.96), rgba(17, 17, 23, 0.98));
  cursor: pointer;
  isolation: isolate;
  transition:
    transform 0.3s cubic-bezier(0.16, 1, 0.3, 1),
    border-color 0.25s ease,
    box-shadow 0.28s ease;
}

.group-card::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  opacity: 0.3;
  background:
    radial-gradient(circle at 18% 0%, rgba(117, 102, 183, 0.26), transparent 42%);
}

.group-card:hover {
  transform: translateY(-3px);
  border-color: rgba(136, 127, 173, 0.42);
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.18);
}

.group-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.group-avatar-stack,
.chat-group-avatar,
.history-group-stack {
  display: flex;
  align-items: center;
}

.group-avatar-chip {
  position: relative;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  overflow: hidden;
  color: #d5d2df;
  background: #282733;
  border: 2px solid #17171f;
  border-radius: 50%;
  font-size: 14px;
  font-weight: 800;
  box-shadow: 0 7px 18px rgba(0, 0, 0, 0.2);
}

.group-avatar-chip + .group-avatar-chip {
  margin-left: -11px;
}

.group-avatar-chip img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.group-avatar-more {
  background: #302e3e;
  color: #aaa4c4;
  font-size: 11px;
}

.group-card-count {
  padding: 5px 8px;
  border: 1px solid rgba(118, 113, 137, 0.22);
  border-radius: 999px;
  color: #858291;
  background: rgba(17, 17, 23, 0.72);
  font-size: 11px;
}

.group-card h4 {
  margin-bottom: 7px;
  font-size: 17px;
}

.group-card p {
  display: -webkit-box;
  overflow: hidden;
  color: #7f7f8a;
  font-size: 13px;
  line-height: 1.45;
  line-clamp: 2;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

/* Create choice */
.create-choice-modal {
  position: fixed;
  inset: 0;
  z-index: 5200;
  display: grid;
  place-items: center;
  padding: 24px;
}

.create-choice-overlay {
  position: absolute;
  inset: 0;
  background: rgba(5, 5, 8, 0.68);
  backdrop-filter: blur(9px);
  -webkit-backdrop-filter: blur(9px);
}

.create-choice-panel {
  position: relative;
  width: min(660px, 100%);
  padding: 22px;
  border: 1px solid rgba(105, 102, 124, 0.34);
  border-radius: 22px;
  background:
    linear-gradient(145deg, rgba(27, 27, 36, 0.98), rgba(15, 15, 21, 0.99));
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.46);
  animation: createChoiceIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) both;
}

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

.create-choice-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.create-choice-header h2 {
  margin-bottom: 6px;
  font-size: 24px;
  letter-spacing: -0.025em;
}

.create-choice-header p {
  color: #7f7e89;
  font-size: 13px;
}

.create-choice-close {
  width: 38px;
  height: 38px;
  min-width: 38px;
  display: grid;
  place-items: center;
  color: #8f8c9b;
  border: 1px solid rgba(97, 94, 111, 0.28);
  border-radius: 11px;
  background: rgba(30, 30, 39, 0.78);
  cursor: pointer;
}

.create-choice-close svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
}

.create-choice-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.create-choice-card {
  min-height: 126px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 17px;
  text-align: left;
  color: #e4e2e9;
  border: 1px solid rgba(104, 101, 121, 0.25);
  border-radius: 17px;
  background: rgba(24, 24, 32, 0.76);
  cursor: pointer;
}

.create-choice-card:hover:not(:disabled) {
  border-color: rgba(139, 130, 177, 0.48);
  background: rgba(34, 33, 45, 0.92);
  transform: translateY(-2px);
}

.create-choice-card:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.create-choice-icon {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  color: #b5abd9;
  border: 1px solid rgba(130, 119, 173, 0.3);
  border-radius: 14px;
  background: rgba(93, 80, 153, 0.1);
}

.create-choice-icon svg,
.create-choice-arrow {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.45;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.create-choice-arrow {
  width: 17px;
  height: 17px;
  color: #666474;
}

.create-choice-copy {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.create-choice-copy strong {
  font-size: 15px;
}

.create-choice-copy small {
  color: #7d7a88;
  font-size: 12px;
  line-height: 1.4;
}

/* Group form */
.group-form {
  max-width: 980px;
}

.group-members-title {
  align-items: center;
}

.group-members-title > div {
  flex: 1;
}

.group-member-count {
  flex: none;
  padding: 6px 9px;
  color: #9d97b8;
  border: 1px solid rgba(121, 111, 163, 0.25);
  border-radius: 999px;
  background: rgba(82, 70, 139, 0.09);
  font-size: 11px !important;
  font-weight: 800;
}

.group-members-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 10px;
}

.group-member-option {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
  padding: 11px;
  color: #c9c7cf;
  border: 1px solid rgba(82, 82, 96, 0.28);
  border-radius: 13px;
  background: rgba(15, 15, 21, 0.72);
  cursor: pointer;
  text-align: left;
}

.group-member-option:hover {
  border-color: rgba(120, 113, 149, 0.42);
  background: rgba(25, 24, 33, 0.9);
}

.group-member-option.selected {
  border-color: rgba(151, 137, 212, 0.56);
  background:
    linear-gradient(145deg, rgba(63, 54, 101, 0.34), rgba(28, 27, 39, 0.9));
  box-shadow: inset 0 0 0 1px rgba(128, 113, 190, 0.09);
}

.group-member-avatar {
  width: 42px;
  height: 42px;
  min-width: 42px;
  display: grid;
  place-items: center;
  overflow: hidden;
  color: #cac5dd;
  border-radius: 50%;
  background: #272632;
  font-size: 13px;
  font-weight: 800;
}

.group-member-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.group-member-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.group-member-copy strong,
.group-member-copy small {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.group-member-copy strong { font-size: 13px; }
.group-member-copy small { color: #6f6e79; font-size: 11px; }

.group-member-check {
  width: 22px;
  height: 22px;
  margin-left: auto;
  display: grid;
  place-items: center;
  color: transparent;
  border: 1px solid rgba(101, 99, 113, 0.45);
  border-radius: 50%;
  background: rgba(17, 17, 23, 0.6);
}

.group-member-option.selected .group-member-check {
  color: #e8e5f4;
  border-color: rgba(151, 137, 212, 0.7);
  background: rgba(111, 93, 184, 0.55);
}

.group-member-check svg {
  width: 13px;
  height: 13px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Group chat header */
.chat-group-avatar {
  width: 58px;
  min-width: 58px;
  height: 50px;
  justify-content: center;
  padding-left: 6px;
}

.chat-group-avatar .group-avatar-chip {
  width: 38px;
  height: 38px;
  border-color: rgba(17, 17, 23, 0.95);
  font-size: 11px;
}

.chat-group-avatar .group-avatar-chip + .group-avatar-chip {
  margin-left: -18px;
}

/* Respond as */
.group-responder-bar {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 3px 2px 9px;
}

.group-responder-label {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #777584;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.group-responder-label svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.group-responder-options {
  min-width: 0;
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
}

.group-responder-options::-webkit-scrollbar { display: none; }

.group-responder-option {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 9px 5px 5px;
  color: #858391;
  border: 1px solid rgba(94, 92, 106, 0.25);
  border-radius: 999px;
  background: rgba(22, 22, 29, 0.58);
  cursor: pointer;
}

.group-responder-option:hover {
  color: #d4d1dc;
  border-color: rgba(128, 121, 153, 0.4);
  background: rgba(31, 30, 40, 0.86);
}

.group-responder-option.active {
  color: #f0edf7;
  border-color: rgba(148, 135, 205, 0.56);
  background: rgba(75, 63, 124, 0.35);
  box-shadow: 0 0 0 3px rgba(113, 94, 185, 0.05);
}

.group-responder-option:disabled { opacity: 0.5; cursor: default; }

.group-responder-avatar {
  width: 27px;
  height: 27px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 50%;
  background: #302e3d;
  font-size: 10px;
  font-weight: 800;
}

.group-responder-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.group-responder-name {
  max-width: 110px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 12px;
  font-weight: 700;
}

/* Group speaker metadata */
.group-speaker-meta {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0 0 6px 4px;
  color: #8e8a9d;
  font-size: 11px;
  font-weight: 700;
}

.group-speaker-avatar {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 50%;
  background: #2b2937;
  color: #c6c1d8;
  font-size: 9px;
  font-weight: 900;
}

.group-speaker-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.message-row.character.group-middle .group-speaker-meta,
.message-row.character.group-end .group-speaker-meta {
  display: none;
}

.typing-row.group-typing-row {
  max-width: 180px;
}

.history-avatar.history-group-stack {
  overflow: visible;
  width: 36px;
  min-width: 36px;
  background: transparent;
}

.history-group-stack .group-avatar-chip {
  width: 28px;
  height: 28px;
  border-width: 1.5px;
  border-color: #15151c;
  font-size: 9px;
}

.history-group-stack .group-avatar-chip + .group-avatar-chip {
  margin-left: -14px;
}

@media (max-width: 760px) {
  .create-choice-grid { grid-template-columns: 1fr; }
  .group-members-grid { grid-template-columns: 1fr 1fr; }
  .groups-section-header { align-items: center; }
}

@media (max-width: 560px) {
  .group-members-grid { grid-template-columns: 1fr; }
  .group-responder-label span { display: none; }
  .group-responder-bar { gap: 7px; }
  .group-responder-name { max-width: 82px; }
}

@media (prefers-reduced-motion: reduce) {
  .create-choice-panel,
  .group-card,
  .create-choice-card,
  .group-member-option,
  .group-responder-option {
    animation: none !important;
    transition-duration: 0.01ms !important;
  }
}

.chat-empty-group-stack {
  margin-bottom: 18px;
  justify-content: center;
}

.chat-empty-group-stack .group-avatar-chip {
  width: 54px;
  height: 54px;
  border-color: #121219;
}


/* =========================================================
   CHATI-AI PRIVATE GROUP CHAT V3.2
   Private group sessions use the same temporary-storage
   architecture while keeping the group responder selector.
========================================================= */

#chatView.private-group-chat-active .private-chat-badge {
  padding-inline: 9px;
  background:
    linear-gradient(
      135deg,
      rgba(78, 70, 116, 0.34),
      rgba(52, 49, 76, 0.28)
    );
  border-color: rgba(151, 138, 211, 0.3);
}

#chatView.private-group-chat-active .group-responder-bar {
  border-color: rgba(131, 118, 187, 0.24);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.025);
}

#chatView.private-group-chat-active .group-responder-option.active {
  box-shadow:
    0 0 0 1px rgba(153, 139, 214, 0.08),
    0 8px 22px rgba(0, 0, 0, 0.16);
}


/* =========================
   V3.2.1 ENTITY DELETE
   ========================= */

.chat-menu .entity-delete-option {
  display: flex;
  align-items: center;
  gap: 9px;
}

.chat-menu-line-icon {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.chat-menu-line-icon svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.65;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chat-menu .entity-delete-option:hover {
  background: rgba(116, 34, 45, 0.32);
  color: #ff8a93;
}


/* =========================
   V3.3 — APPEARANCE & VISUAL CONTINUITY
========================= */

.appearance-card {
  position: relative;
  overflow: hidden;
}

.appearance-card::after {
  content: "";
  position: absolute;
  width: 220px;
  height: 220px;
  right: -115px;
  top: -120px;
  border-radius: 50%;
  background: radial-gradient(
    circle,
    rgba(126, 109, 235, 0.09),
    rgba(126, 109, 235, 0) 70%
  );
  pointer-events: none;
}

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

.appearance-textarea {
  min-height: 132px !important;
}

.visual-continuity-row {
  margin-top: 16px;
  padding: 14px 15px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border: 1px solid rgba(126, 109, 235, 0.24);
  border-radius: 13px;
  background:
    linear-gradient(
      135deg,
      rgba(126, 109, 235, 0.085),
      rgba(255, 255, 255, 0.015)
    );
}

.visual-continuity-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.visual-continuity-copy strong {
  color: #efedf9;
  font-size: 13px;
  letter-spacing: 0.01em;
}

.visual-continuity-copy span {
  color: #797784;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.45;
}

.visual-continuity-switch {
  flex: 0 0 auto;
}

.memory-section-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.memory-visual-badge {
  flex: 0 0 auto;
  padding: 5px 8px;
  border: 1px solid rgba(126, 109, 235, 0.24);
  border-radius: 999px;
  background: rgba(126, 109, 235, 0.07);
  color: #8f87bf;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.memory-appearance-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.memory-appearance-card {
  border: 1px solid rgba(71, 70, 84, 0.72);
  border-radius: 13px;
  background: rgba(14, 14, 20, 0.58);
  padding: 13px 14px;
}

.memory-appearance-name {
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #eceaf6;
  font-size: 12px;
  font-weight: 800;
}

.memory-appearance-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #8275d7;
  box-shadow: 0 0 12px rgba(130, 117, 215, 0.42);
}

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

.memory-appearance-field {
  min-width: 0;
}

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

.memory-appearance-label {
  display: block;
  margin-bottom: 3px;
  color: #676572;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.memory-appearance-value {
  color: #bbb8c8;
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.memory-appearance-empty {
  color: #696773;
  font-size: 12px;
  line-height: 1.55;
}

@media (max-width: 760px) {
  .appearance-form-grid,
  .memory-appearance-grid {
    grid-template-columns: 1fr;
  }

  .memory-appearance-field.wide {
    grid-column: auto;
  }

  .visual-continuity-row {
    align-items: flex-start;
  }
}


/* =========================
   V3.4 — ROLEPLAY LEVELS
========================= */

.settings-modal {
  position: fixed;
  inset: 0;
  z-index: 5600;
  display: grid;
  place-items: center;
  padding: 24px;
}

.settings-overlay {
  position: absolute;
  inset: 0;
  background: rgba(5, 5, 8, 0.72);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.settings-panel {
  position: relative;
  z-index: 2;
  width: min(720px, 100%);
  max-height: min(760px, calc(100vh - 48px));
  overflow-y: auto;
  padding: 24px;
  border: 1px solid rgba(105, 102, 124, 0.34);
  border-radius: 24px;
  background:
    radial-gradient(
      circle at 85% 0%,
      rgba(126, 109, 235, 0.09),
      transparent 32%
    ),
    linear-gradient(
      145deg,
      rgba(27, 27, 36, 0.99),
      rgba(14, 14, 20, 0.995)
    );
  box-shadow:
    0 30px 90px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.025);
  animation:
    settingsPanelIn
    0.3s
    cubic-bezier(0.16, 1, 0.3, 1)
    both;
}

@keyframes settingsPanelIn {
  from {
    opacity: 0;
    transform: translateY(9px) scale(0.985);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.settings-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 20px;
  border-bottom: 1px solid rgba(84, 81, 99, 0.25);
}

.settings-heading {
  min-width: 0;
  display: flex;
  align-items: flex-start;
  gap: 13px;
}

.settings-heading-icon {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  display: grid;
  place-items: center;
  color: #aaa0d8;
  border: 1px solid rgba(130, 119, 173, 0.28);
  border-radius: 13px;
  background: rgba(93, 80, 153, 0.1);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.025);
}

.settings-heading-icon svg,
.settings-close-btn svg,
.roleplay-level-icon svg,
.roleplay-level-check svg,
.settings-boundary-icon svg,
.backup-card-icon svg,
.backup-status-icon svg,
.install-app-visual svg,
.install-app-hint-icon svg,
.install-nudge-mark svg,
.install-nudge-close svg,
.settings-action-icon svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.55;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.settings-heading-icon svg {
  width: 21px;
  height: 21px;
}

.settings-eyebrow,
.settings-section-kicker {
  display: block;
  margin-bottom: 4px;
  color: #777384;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.settings-header h2 {
  margin-bottom: 5px;
  color: #f1eff7;
  font-size: 24px;
  letter-spacing: -0.025em;
}

.settings-header p {
  color: #7e7b89;
  font-size: 13px;
  line-height: 1.5;
}

.settings-close-btn {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  display: grid;
  place-items: center;
  color: #8f8c9b;
  border: 1px solid rgba(97, 94, 111, 0.28);
  border-radius: 11px;
  background: rgba(30, 30, 39, 0.78);
  cursor: pointer;
}

.settings-close-btn:hover {
  color: #d8d4e5;
  border-color: rgba(128, 120, 162, 0.42);
  background: rgba(39, 38, 51, 0.92);
}

.settings-close-btn svg {
  width: 17px;
  height: 17px;
}

.settings-section {
  padding: 22px 0 8px;
}

.settings-section-title-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
}

.settings-section-title-row h3 {
  color: #efedf8;
  font-size: 17px;
  letter-spacing: -0.01em;
}

.roleplay-level-status {
  flex: 0 0 auto;
  padding: 6px 10px;
  color: #a99ee0;
  border: 1px solid rgba(126, 109, 235, 0.25);
  border-radius: 999px;
  background: rgba(126, 109, 235, 0.08);
  font-size: 11px;
  font-weight: 800;
}

.settings-section-description {
  margin-top: 8px;
  color: #7d7a87;
  font-size: 12px;
  line-height: 1.55;
}

.roleplay-level-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-top: 16px;
}

.roleplay-level-card {
  width: 100%;
  min-height: 88px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 15px 16px;
  text-align: left;
  color: #dedbe8;
  border: 1px solid rgba(84, 81, 99, 0.36);
  border-radius: 16px;
  background:
    linear-gradient(
      135deg,
      rgba(27, 27, 36, 0.84),
      rgba(18, 18, 25, 0.84)
    );
  cursor: pointer;
  transition:
    transform 0.18s cubic-bezier(0.16, 1, 0.3, 1),
    border-color 0.18s ease,
    background 0.18s ease,
    box-shadow 0.18s ease;
}

.roleplay-level-card:hover {
  transform: translateY(-1px);
  border-color: rgba(125, 117, 159, 0.48);
  background:
    linear-gradient(
      135deg,
      rgba(34, 33, 45, 0.94),
      rgba(21, 21, 29, 0.94)
    );
}

.roleplay-level-card.is-selected {
  border-color: rgba(139, 124, 220, 0.56);
  background:
    linear-gradient(
      135deg,
      rgba(88, 73, 164, 0.17),
      rgba(25, 24, 37, 0.95)
    );
  box-shadow:
    0 0 0 1px rgba(139, 124, 220, 0.07),
    0 12px 30px rgba(0, 0, 0, 0.18);
}

.roleplay-level-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  color: #8c879c;
  border: 1px solid rgba(100, 96, 116, 0.3);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.018);
}

.roleplay-level-card.is-selected .roleplay-level-icon {
  color: #b8aceb;
  border-color: rgba(139, 124, 220, 0.34);
  background: rgba(102, 84, 188, 0.1);
}

.roleplay-level-icon svg {
  width: 21px;
  height: 21px;
}

.roleplay-level-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.roleplay-level-copy strong {
  color: #e9e6f1;
  font-size: 14px;
}

.roleplay-level-copy small {
  color: #7e7b88;
  font-size: 12px;
  line-height: 1.45;
}

.roleplay-level-name-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.roleplay-level-name-row em {
  padding: 3px 7px;
  color: #9e93d2;
  border: 1px solid rgba(126, 109, 235, 0.22);
  border-radius: 999px;
  background: rgba(126, 109, 235, 0.07);
  font-size: 9px;
  font-style: normal;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.roleplay-level-check {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  color: transparent;
  border: 1px solid rgba(98, 95, 111, 0.42);
  border-radius: 50%;
  background: rgba(12, 12, 17, 0.5);
}

.roleplay-level-card.is-selected .roleplay-level-check {
  color: #ddd6ff;
  border-color: rgba(139, 124, 220, 0.58);
  background: rgba(91, 75, 171, 0.26);
}

.roleplay-level-check svg {
  width: 14px;
  height: 14px;
  stroke-width: 2;
}

.settings-boundary-note {
  margin-top: 14px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 12px;
  color: #74717e;
  border: 1px solid rgba(83, 80, 96, 0.26);
  border-radius: 12px;
  background: rgba(12, 12, 17, 0.38);
  font-size: 11px;
  line-height: 1.5;
}

.settings-boundary-icon {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  color: #8d86ae;
}

.settings-boundary-icon svg {
  width: 18px;
  height: 18px;
}


.settings-data-section {
  margin-top: 18px;
  padding-top: 22px;
  border-top: 1px solid rgba(84, 81, 99, 0.25);
}

.backup-data-status {
  flex: 0 0 auto;
  padding: 6px 10px;
  color: #9e96c5;
  border: 1px solid rgba(113, 105, 151, 0.24);
  border-radius: 999px;
  background: rgba(98, 86, 155, 0.07);
  font-size: 11px;
  font-weight: 800;
}

.backup-restore-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.backup-card {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px;
  border: 1px solid rgba(84, 81, 99, 0.34);
  border-radius: 16px;
  background:
    linear-gradient(
      140deg,
      rgba(27, 27, 36, 0.78),
      rgba(17, 17, 24, 0.88)
    );
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.018);
}

.backup-card-heading {
  display: flex;
  align-items: flex-start;
  gap: 11px;
}

.backup-card-icon {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  display: grid;
  place-items: center;
  color: #a79ed1;
  border: 1px solid rgba(126, 116, 169, 0.28);
  border-radius: 11px;
  background: rgba(104, 89, 181, 0.08);
}

.backup-card-icon svg {
  width: 18px;
  height: 18px;
}

.backup-card-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.backup-card-copy strong {
  color: #e7e4ef;
  font-size: 13px;
}

.backup-card-copy small {
  color: #777482;
  font-size: 11px;
  line-height: 1.45;
}

.backup-media-option {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 10px;
  color: inherit;
  border: 1px solid rgba(82, 79, 94, 0.26);
  border-radius: 12px;
  background: rgba(10, 10, 15, 0.28);
  cursor: pointer;
}

.backup-media-option input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.backup-media-toggle {
  position: relative;
  width: 35px;
  height: 20px;
  flex: 0 0 35px;
  border: 1px solid rgba(99, 95, 113, 0.42);
  border-radius: 999px;
  background: rgba(31, 30, 39, 0.96);
  transition:
    border-color 0.18s ease,
    background 0.18s ease;
}

.backup-media-toggle span {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #898592;
  transition:
    transform 0.2s cubic-bezier(0.16, 1, 0.3, 1),
    background 0.18s ease;
}

.backup-media-option input:checked + .backup-media-toggle {
  border-color: rgba(139, 124, 220, 0.5);
  background: rgba(102, 84, 188, 0.24);
}

.backup-media-option input:checked + .backup-media-toggle span {
  transform: translateX(15px);
  background: #d8d0ff;
}

.backup-media-option input:focus-visible + .backup-media-toggle {
  outline: 2px solid rgba(162, 149, 230, 0.72);
  outline-offset: 2px;
}

.backup-media-option input:disabled + .backup-media-toggle {
  opacity: 0.5;
}

.backup-media-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.backup-media-copy strong {
  color: #c9c5d2;
  font-size: 11px;
}

.backup-media-copy small {
  color: #6f6c79;
  font-size: 10px;
  line-height: 1.4;
}

.backup-primary-btn,
.backup-secondary-btn {
  width: 100%;
  min-height: 40px;
  margin-top: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 13px;
  border-radius: 11px;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
  transition:
    transform 0.18s cubic-bezier(0.16, 1, 0.3, 1),
    border-color 0.18s ease,
    background 0.18s ease,
    opacity 0.18s ease;
}

.backup-primary-btn {
  color: #111016;
  border: 0;
  background: #e7e2f6;
}

.backup-primary-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  background: #fff;
}

.backup-secondary-btn {
  color: #c5c0d2;
  border: 1px solid rgba(102, 97, 119, 0.38);
  background: rgba(31, 30, 40, 0.78);
}

.backup-secondary-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  color: #ece8f4;
  border-color: rgba(132, 123, 163, 0.5);
  background: rgba(41, 39, 53, 0.92);
}

.backup-primary-btn:disabled,
.backup-secondary-btn:disabled {
  opacity: 0.48;
  cursor: wait;
}

.backup-status-message {
  margin-top: 12px;
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 10px 11px;
  color: #74717e;
  border: 1px solid rgba(83, 80, 96, 0.24);
  border-radius: 12px;
  background: rgba(12, 12, 17, 0.34);
  font-size: 10.5px;
  line-height: 1.5;
}

.backup-status-message.is-working {
  color: #9b94ba;
  border-color: rgba(125, 113, 177, 0.3);
  background: rgba(95, 78, 166, 0.07);
}

.backup-status-message.is-success {
  color: #9eb9a8;
  border-color: rgba(91, 144, 110, 0.26);
  background: rgba(51, 118, 73, 0.07);
}

.backup-status-message.is-error {
  color: #c89eaa;
  border-color: rgba(163, 83, 105, 0.28);
  background: rgba(125, 49, 69, 0.08);
}

.backup-status-icon {
  width: 17px;
  height: 17px;
  flex: 0 0 17px;
  color: currentColor;
}

.backup-status-icon svg {
  width: 17px;
  height: 17px;
}


/* =========================
   PWA INSTALL EXPERIENCE
========================= */

.settings-install-section {
  margin-top: 18px;
  padding-top: 22px;
  border-top: 1px solid rgba(84, 81, 99, 0.25);
}

.install-app-status {
  flex: 0 0 auto;
  padding: 6px 10px;
  color: #9e96c5;
  border: 1px solid rgba(113, 105, 151, 0.24);
  border-radius: 999px;
  background: rgba(98, 86, 155, 0.07);
  font-size: 11px;
  font-weight: 800;
}

.install-app-status.is-ready {
  color: #c6baff;
  border-color: rgba(139, 124, 220, 0.34);
  background: rgba(104, 88, 188, 0.11);
}

.install-app-status.is-installed {
  color: #a9c8b3;
  border-color: rgba(91, 144, 110, 0.28);
  background: rgba(51, 118, 73, 0.08);
}

.install-app-card {
  margin-top: 16px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 13px;
  padding: 15px 16px;
  border: 1px solid rgba(84, 81, 99, 0.34);
  border-radius: 16px;
  background:
    radial-gradient(circle at 90% 15%, rgba(126, 109, 235, 0.07), transparent 35%),
    linear-gradient(140deg, rgba(27, 27, 36, 0.8), rgba(17, 17, 24, 0.9));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.018);
}

.install-app-visual {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  display: grid;
  place-items: center;
  color: #aaa1d7;
  border: 1px solid rgba(126, 116, 169, 0.3);
  border-radius: 13px;
  background: rgba(104, 89, 181, 0.08);
}

.install-app-visual svg {
  width: 20px;
  height: 20px;
}

.install-app-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.install-app-copy strong {
  color: #e8e5f0;
  font-size: 13px;
}

.install-app-copy small {
  color: #777482;
  font-size: 11px;
  line-height: 1.45;
}

.install-app-btn {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 14px;
  color: #111016;
  border: 0;
  border-radius: 11px;
  background: #e7e2f6;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
  transition:
    transform 0.18s cubic-bezier(0.16, 1, 0.3, 1),
    background 0.18s ease,
    opacity 0.18s ease;
}

.install-app-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  background: #fff;
}

.install-app-btn:disabled {
  opacity: 0.42;
  cursor: default;
}

.install-app-hint {
  margin-top: 12px;
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 10px 11px;
  color: #74717e;
  border: 1px solid rgba(83, 80, 96, 0.24);
  border-radius: 12px;
  background: rgba(12, 12, 17, 0.34);
  font-size: 10.5px;
  line-height: 1.5;
}

.install-app-hint.is-ready {
  color: #a59cc9;
  border-color: rgba(125, 113, 177, 0.3);
  background: rgba(95, 78, 166, 0.07);
}

.install-app-hint.is-installed {
  color: #9eb9a8;
  border-color: rgba(91, 144, 110, 0.26);
  background: rgba(51, 118, 73, 0.07);
}

.install-app-hint-icon {
  width: 17px;
  height: 17px;
  flex: 0 0 17px;
  color: currentColor;
}

.install-app-hint-icon svg {
  width: 17px;
  height: 17px;
}

.install-nudge {
  position: fixed;
  right: max(18px, env(safe-area-inset-right));
  bottom: max(18px, env(safe-area-inset-bottom));
  z-index: 1400;
  width: min(390px, calc(100vw - 36px));
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 11px;
  padding: 12px;
  color: #e7e4ef;
  border: 1px solid rgba(112, 105, 145, 0.36);
  border-radius: 17px;
  background:
    radial-gradient(circle at 85% 15%, rgba(126, 109, 235, 0.14), transparent 40%),
    rgba(18, 18, 25, 0.96);
  box-shadow:
    0 18px 55px rgba(0, 0, 0, 0.42),
    inset 0 1px 0 rgba(255, 255, 255, 0.025);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  animation: installNudgeIn 0.32s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes installNudgeIn {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.install-nudge-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  color: #b3a9e1;
  border: 1px solid rgba(126, 116, 169, 0.28);
  border-radius: 12px;
  background: rgba(104, 89, 181, 0.09);
}

.install-nudge-mark svg {
  width: 19px;
  height: 19px;
}

.install-nudge-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.install-nudge-copy strong {
  font-size: 12px;
}

.install-nudge-copy span {
  color: #817d8b;
  font-size: 10.5px;
  line-height: 1.35;
}

.install-nudge-install {
  min-height: 34px;
  padding: 7px 12px;
  color: #111016;
  border: 0;
  border-radius: 10px;
  background: #e7e2f6;
  font-size: 10.5px;
  font-weight: 800;
  cursor: pointer;
}

.install-nudge-install:hover {
  background: #fff;
}

.install-nudge-close {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  color: #777381;
  border: 0;
  border-radius: 9px;
  cursor: pointer;
}

.install-nudge-close:hover {
  color: #d5d1df;
  background: rgba(255, 255, 255, 0.04);
}

.install-nudge-close svg {
  width: 15px;
  height: 15px;
}

@media (max-width: 620px) {
  .install-app-card {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .install-app-btn {
    grid-column: 1 / -1;
    width: 100%;
  }

  .install-nudge {
    left: max(12px, env(safe-area-inset-left));
    right: max(12px, env(safe-area-inset-right));
    bottom: max(12px, env(safe-area-inset-bottom));
    width: auto;
    grid-template-columns: auto minmax(0, 1fr) auto;
  }

  .install-nudge-install {
    grid-column: 1 / -1;
    width: 100%;
  }

  .install-nudge-close {
    grid-column: 3;
    grid-row: 1;
  }
}

.settings-actions {
  margin-top: 18px;
  padding-top: 17px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  border-top: 1px solid rgba(84, 81, 99, 0.25);
}

.settings-edit-current-btn,
.settings-done-btn {
  min-height: 41px;
  border-radius: 11px;
  padding: 10px 15px;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.settings-edit-current-btn {
  margin-right: auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #b8b4c3;
  border: 1px solid rgba(93, 90, 105, 0.34);
  background: rgba(28, 28, 36, 0.72);
}

.settings-edit-current-btn:hover {
  color: #e5e1ed;
  border-color: rgba(121, 115, 142, 0.45);
  background: rgba(38, 37, 48, 0.86);
}

.settings-action-icon,
.settings-action-icon svg {
  width: 17px;
  height: 17px;
}

.settings-done-btn {
  min-width: 88px;
  color: #111016;
  border: 0;
  background: #ece9f6;
}

.settings-done-btn:hover {
  background: #fff;
  transform: translateY(-1px);
}

@media (max-width: 640px) {
  .settings-modal {
    padding: 14px;
  }

  .settings-panel {
    max-height: calc(100vh - 28px);
    padding: 19px;
    border-radius: 20px;
  }

  .settings-heading-icon {
    display: none;
  }

  .settings-section-title-row {
    align-items: flex-start;
  }

  .roleplay-level-card {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .roleplay-level-check {
    display: none;
  }

  .backup-restore-grid {
    grid-template-columns: 1fr;
  }

  .settings-actions {
    align-items: stretch;
    flex-direction: column-reverse;
  }

  .settings-edit-current-btn,
  .settings-done-btn {
    width: 100%;
    justify-content: center;
    margin-right: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .settings-panel,
  .roleplay-level-card,
  .backup-media-toggle,
  .backup-media-toggle span,
  .backup-primary-btn,
  .backup-secondary-btn,
  .settings-done-btn {
    animation: none !important;
    transition: none !important;
  }
}



/* =========================================================
   CHATI-AI V3.6 — MOBILE UI + LOCAL IMAGE PICKERS
   ========================================================= */

:root {
  --app-height: 100dvh;
}

.app {
  height: var(--app-height, 100dvh);
  min-height: 0;
}

.mobile-sidebar-btn,
.sidebar-mobile-overlay {
  display: none;
}

/* ---------- Reusable local image picker ---------- */
.image-source-field {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.image-source-field > label {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.image-source-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.image-picker-btn,
.image-remove-btn {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 12px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
}

.image-picker-btn {
  color: #d7d2e6;
  border: 1px solid rgba(121, 113, 149, 0.36);
  background: rgba(40, 37, 53, 0.78);
}

.image-picker-btn:hover {
  color: #f3efff;
  border-color: rgba(151, 139, 196, 0.58);
  background: rgba(53, 48, 70, 0.94);
  transform: translateY(-1px);
}

.image-picker-btn svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.image-remove-btn {
  color: #8c8996;
  border: 1px solid rgba(91, 89, 103, 0.28);
  background: rgba(25, 25, 32, 0.7);
}

.image-remove-btn:hover {
  color: #d5d1dc;
  border-color: rgba(119, 114, 134, 0.42);
  background: rgba(34, 33, 43, 0.9);
}

.image-source-hint {
  color: #686672;
  font-size: 11px;
  line-height: 1.45;
}

body.image-processing,
body.image-processing * {
  cursor: progress !important;
}


/* ---------- Tablet/mobile shell ---------- */
@media (max-width: 1024px), (hover: none) and (pointer: coarse) {
  html,
  body {
    height: var(--app-height, 100dvh);
    overscroll-behavior: none;
  }

  body {
    min-width: 0;
    overflow: hidden;
  }

  .app {
    position: relative;
    width: 100%;
    height: var(--app-height, 100dvh);
    min-height: 0;
    overflow: hidden;
  }

  .mobile-sidebar-btn {
    display: grid !important;
    position: fixed;
    top: calc(env(safe-area-inset-top, 0px) + 10px);
    left: 12px;
    z-index: 5450;
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    color: #c8c4d6;
    border: 1px solid rgba(104, 101, 120, 0.35);
    border-radius: 13px;
    background:
      linear-gradient(
        145deg,
        rgba(35, 34, 45, 0.94),
        rgba(20, 20, 28, 0.95)
      );
    box-shadow:
      0 12px 30px rgba(0, 0, 0, 0.28),
      inset 0 1px 0 rgba(255, 255, 255, 0.035);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    cursor: pointer;
  }

  .mobile-sidebar-btn svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
  }

  body.mobile-chat-active .mobile-sidebar-btn {
    display: none !important;
  }

  .sidebar-mobile-overlay {
    position: fixed;
    inset: 0;
    z-index: 5470;
    display: block;
    border: 0;
    background: rgba(3, 3, 6, 0.58);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    cursor: default;
  }

  .sidebar-mobile-overlay.hidden {
    display: none !important;
  }

  .sidebar {
    position: fixed !important;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 5480;
    width: min(86vw, 320px) !important;
    min-width: min(86vw, 320px) !important;
    height: var(--app-height, 100dvh) !important;
    padding:
      calc(env(safe-area-inset-top, 0px) + 16px)
      13px
      calc(env(safe-area-inset-bottom, 0px) + 14px) !important;
    border-right: 1px solid rgba(102, 99, 118, 0.3);
    background:
      radial-gradient(
        circle at 15% 0%,
        rgba(111, 92, 180, 0.1),
        transparent 32%
      ),
      rgba(16, 16, 22, 0.985);
    box-shadow: 22px 0 70px rgba(0, 0, 0, 0.48);
    transform: translateX(-108%);
    transition:
      transform 0.34s cubic-bezier(0.16, 1, 0.3, 1),
      box-shadow 0.3s ease;
  }

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

  .sidebar.is-collapsed,
  .sidebar.mobile-open.is-collapsed {
    width: min(86vw, 320px) !important;
    min-width: min(86vw, 320px) !important;
    padding-left: 13px !important;
    padding-right: 13px !important;
  }

  .sidebar.is-collapsed .sidebar-brand-row {
    justify-content: initial;
  }

  .sidebar.is-collapsed .sidebar-brand {
    width: auto;
    justify-content: flex-start;
  }

  .sidebar.is-collapsed .sidebar-brand-mark {
    margin: 0;
  }

  .sidebar.is-collapsed .sidebar-brand-name,
  .sidebar.is-collapsed .sidebar-label,
  .sidebar.is-collapsed .sidebar-search-input,
  .sidebar.is-collapsed .sidebar-private-copy,
  .sidebar.is-collapsed .sidebar-section-title,
  .sidebar.is-collapsed .chat-history-count,
  .sidebar.is-collapsed .history-copy,
  .sidebar.is-collapsed .history-active-dot {
    display: initial !important;
  }

  .sidebar.is-collapsed .sidebar-search-clear {
    display: grid !important;
  }

  .sidebar.is-collapsed .nav-btn,
  .sidebar.is-collapsed .settings-btn {
    justify-content: flex-start;
    text-align: left;
  }

  .sidebar.is-collapsed .sidebar-search,
  .sidebar.is-collapsed .sidebar-private-indicator,
  .sidebar.is-collapsed .history-item {
    width: 100%;
  }

  .sidebar.is-collapsed .history-avatar {
    width: 38px;
    min-width: 38px;
    height: 38px;
  }

  .sidebar-collapse-btn {
    display: none !important;
  }

  .sidebar.mobile-open .sidebar-collapse-btn {
    display: none !important;
  }

  .main-content {
    width: 100%;
    height: var(--app-height, 100dvh);
    min-height: 0;
    padding:
      calc(env(safe-area-inset-top, 0px) + 68px)
      14px
      calc(env(safe-area-inset-bottom, 0px) + 18px);
    overflow-x: hidden;
    overflow-y: auto;
    scroll-behavior: smooth;
  }

  body.mobile-chat-active .main-content {
    padding: 0;
    overflow: hidden;
  }

  .top-bar {
    margin-bottom: 24px;
  }

  .top-bar h2 {
    font-size: clamp(25px, 7vw, 32px);
    letter-spacing: -0.035em;
  }

  .top-bar p,
  .create-header p {
    font-size: 13px;
    line-height: 1.5;
  }

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

  .character-card {
    max-width: none;
    border-radius: 16px;
  }

  .character-image,
  .character-placeholder {
    height: auto;
    aspect-ratio: 1 / 1;
  }

  .character-info {
    padding: 13px;
  }

  .character-info h3 {
    font-size: 16px;
  }

  .character-info p {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    overflow: hidden;
    font-size: 12px;
    line-height: 1.45;
  }

  .groups-section {
    margin-top: 32px;
  }

  .groups-section-header {
    align-items: flex-start;
    gap: 12px;
  }

  .groups-create-inline {
    min-height: 42px;
  }

  .groups-grid {
    grid-template-columns: 1fr;
    gap: 11px;
  }

  .create-header {
    gap: 12px;
    margin-bottom: 20px;
  }

  .create-header h2 {
    font-size: 25px;
  }

  .back-btn {
    width: 44px;
    min-width: 44px;
    height: 44px;
  }

  .character-form,
  .group-form {
    max-width: none;
  }

  .creator-card {
    padding: 16px;
    border-radius: 17px;
  }

  .creator-card-title {
    gap: 11px;
  }

  .creator-card-title .section-symbol {
    width: 39px;
    height: 39px;
    min-width: 39px;
  }

  .creator-card-title h3 {
    font-size: 16px;
  }

  .creator-card-title p {
    font-size: 12px;
    line-height: 1.4;
  }

  .two-columns,
  .example-grid,
  .appearance-form-grid {
    grid-template-columns: 1fr !important;
  }

  .avatar-editor-row {
    align-items: stretch;
    flex-direction: column;
  }

  .avatar-preview-wrap {
    width: 104px;
    height: 104px;
    align-self: center;
  }

  input,
  textarea,
  select {
    font-size: 16px;
  }

  .pronoun-picker {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .pronoun-option {
    min-height: 44px;
    padding-inline: 6px;
  }

  .image-source-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .image-picker-btn,
  .image-remove-btn {
    min-height: 44px;
  }

  .background-preview,
  .group-background-preview {
    min-height: 160px;
  }

  .creator-form-actions {
    position: sticky;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 8px);
    z-index: 8;
    padding: 10px;
    margin-inline: -4px;
    border: 1px solid rgba(88, 85, 102, 0.24);
    border-radius: 15px;
    background: rgba(16, 16, 22, 0.88);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
  }

  .creator-form-actions button {
    min-height: 44px;
  }

  .group-members-grid {
    grid-template-columns: 1fr !important;
  }

  .group-member-option {
    min-height: 62px;
  }

  .create-choice-modal {
    align-items: end;
    padding: 0;
  }

  .create-choice-panel {
    width: 100%;
    max-height: calc(var(--app-height, 100dvh) - env(safe-area-inset-top, 0px) - 18px);
    overflow-y: auto;
    padding:
      20px
      16px
      calc(env(safe-area-inset-bottom, 0px) + 18px);
    border-radius: 24px 24px 0 0;
  }

  .create-choice-grid {
    grid-template-columns: 1fr;
  }

  .create-choice-card {
    min-height: 104px;
  }

  /* Settings becomes an app-like full-screen sheet on mobile. */
  .settings-modal {
    align-items: stretch;
    place-items: stretch;
    padding: 0;
  }

  .settings-overlay {
    background: #0d0d12;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  .settings-panel {
    width: 100%;
    max-height: var(--app-height, 100dvh);
    height: var(--app-height, 100dvh);
    padding:
      calc(env(safe-area-inset-top, 0px) + 17px)
      15px
      calc(env(safe-area-inset-bottom, 0px) + 17px);
    border: 0;
    border-radius: 0;
    box-shadow: none;
    overscroll-behavior: contain;
  }

  .settings-header {
    position: sticky;
    top: calc(-1 * (env(safe-area-inset-top, 0px) + 17px));
    z-index: 10;
    margin:
      calc(-1 * (env(safe-area-inset-top, 0px) + 17px))
      -15px
      0;
    padding:
      calc(env(safe-area-inset-top, 0px) + 15px)
      15px
      15px;
    background: rgba(15, 15, 21, 0.94);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
  }

  .settings-close-btn {
    width: 44px;
    height: 44px;
  }

  .roleplay-level-card {
    min-height: 78px;
    padding: 13px;
  }

  .backup-restore-grid {
    grid-template-columns: 1fr;
  }

  .backup-primary-btn,
  .backup-secondary-btn,
  .settings-edit-current-btn,
  .settings-done-btn {
    min-height: 46px;
  }

  /* Full-screen chat optimized for touch + mobile keyboard. */
  #chatView {
    width: 100%;
    height: var(--app-height, 100dvh) !important;
    min-height: 0;
    border-radius: 0;
  }

  .chat-background {
    position: absolute;
    inset: 0;
  }

  .chat-header.chat-layer {
    flex: none;
    min-height: 64px;
    margin:
      calc(env(safe-area-inset-top, 0px) + 7px)
      8px
      5px;
    padding: 8px;
    border-radius: 16px;
  }

  .chat-header-left {
    min-width: 0;
    gap: 8px;
  }

  .chat-header .back-btn {
    width: 40px;
    min-width: 40px;
    height: 40px;
  }

  .chat-avatar {
    width: 42px;
    min-width: 42px;
    height: 42px;
  }

  .chat-group-avatar {
    width: 48px;
    min-width: 48px;
    height: 42px;
    padding-left: 4px;
  }

  .chat-group-avatar .group-avatar-chip {
    width: 32px;
    height: 32px;
  }

  .chat-group-avatar .group-avatar-chip + .group-avatar-chip {
    margin-left: -15px;
  }

  .chat-character-info {
    min-width: 0;
  }

  .chat-character-info h2 {
    max-width: 34vw;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    font-size: 15px;
  }

  .chat-character-info p {
    display: none !important;
  }

  .chat-actions {
    gap: 5px;
  }

  .memory-btn,
  .menu-btn,
  .new-chat-btn {
    width: 40px !important;
    min-width: 40px !important;
    height: 40px;
    padding: 0 !important;
    display: grid;
    place-items: center;
  }

  .new-chat-btn > span:not(.new-chat-trigger-icon),
  .new-chat-chevron {
    display: none;
  }

  .new-chat-trigger-icon {
    display: grid;
    place-items: center;
  }

  .new-chat-menu {
    position: fixed;
    top: auto;
    right: 8px;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 84px);
    left: 8px;
    width: auto;
    max-width: none;
  }

  .chat-menu {
    position: fixed;
    top: auto;
    right: 8px;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 84px);
    left: 8px;
    width: auto;
    max-width: none;
  }

  .current-chat-bar.chat-layer {
    flex: none;
    min-height: 28px;
    margin: 0 10px;
    padding: 3px 5px 6px;
  }

  .current-chat-label {
    min-width: 0;
  }

  .current-chat-bar strong {
    display: block;
    max-width: 48vw;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
  }

  .private-chat-badge {
    flex: none;
  }

  .messages.chat-layer {
    flex: 1 1 auto;
    min-height: 0;
    padding: 14px 10px 18px;
    gap: 12px;
    scroll-padding-bottom: 24px;
    overscroll-behavior-y: contain;
  }

  .message-row {
    max-width: 90%;
  }

  .message {
    padding: 11px 13px;
    border-radius: 17px;
    font-size: 14px;
    line-height: 1.55;
  }

  .message-row.character {
    max-width: 94%;
  }

  .variant-controls {
    min-height: 31px;
  }

  .group-speaker-meta {
    margin-left: 2px;
  }

  .chat-form.chat-layer {
    flex: none;
    margin:
      0
      8px
      calc(env(safe-area-inset-bottom, 0px) + 7px);
    padding: 8px;
    border-radius: 17px;
    box-shadow:
      0 -10px 36px rgba(0, 0, 0, 0.18),
      inset 0 1px 0 rgba(255, 255, 255, 0.025);
  }

  .group-responder-bar {
    gap: 7px;
    padding-bottom: 7px;
  }

  .group-responder-label {
    width: 28px;
  }

  .group-responder-label span {
    display: none;
  }

  .group-responder-options {
    padding-right: 2px;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
  }

  .group-responder-option {
    min-height: 38px;
    scroll-snap-align: start;
  }

  .group-responder-name {
    max-width: 82px;
  }

  .chat-input-row {
    align-items: flex-end;
    gap: 7px;
  }

  .chat-form .media-menu-btn,
  .chat-form .send-btn {
    min-width: 44px;
    width: 44px;
    height: 44px;
    min-height: 44px;
  }

  .chat-input-row .message-input {
    min-height: 44px;
    max-height: 128px;
    padding: 11px 12px;
    font-size: 16px;
    line-height: 1.35;
  }

  .chat-form .send-btn {
    padding: 0;
    font-size: 0;
  }

  .chat-form .send-btn::after {
    content: "↑";
    font-size: 20px;
    font-weight: 900;
    line-height: 1;
  }

  .media-attach-menu {
    position: fixed;
    top: auto;
    right: 8px;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 78px);
    left: 8px;
    width: auto;
    max-width: none;
  }

  .attachment-preview-card {
    max-height: 34vh;
    overflow-y: auto;
  }

  .memory-modal {
    padding: 0;
  }

  .memory-panel {
    width: 100%;
    max-width: none;
    height: var(--app-height, 100dvh);
    max-height: var(--app-height, 100dvh);
    border-radius: 0;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }

  .message-context-menu {
    max-width: calc(100vw - 20px);
  }
}


@media (max-width: 430px) {
  .characters-grid {
    grid-template-columns: 1fr;
  }

  .character-card {
    display: grid;
    grid-template-columns: 116px minmax(0, 1fr);
    min-height: 116px;
  }

  .character-image,
  .character-placeholder {
    width: 116px;
    height: 116px;
    aspect-ratio: auto;
  }

  .character-info {
    min-width: 0;
    padding: 13px 12px;
  }

  .character-info p {
    -webkit-line-clamp: 4;
    line-clamp: 4;
  }

  .groups-section-header {
    flex-direction: column;
  }

  .groups-create-inline {
    width: 100%;
    justify-content: center;
  }

  .creator-card {
    padding: 14px;
  }

  .pronoun-picker {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .image-source-actions {
    grid-template-columns: 1fr;
  }

  .image-remove-btn {
    width: 100%;
  }

  .chat-header.chat-layer {
    margin-left: 6px;
    margin-right: 6px;
  }

  .chat-character-info h2 {
    max-width: 30vw;
  }

  .memory-btn {
    display: none;
  }

  .message-row,
  .message-row.character {
    max-width: 96%;
  }

  .chat-form.chat-layer {
    margin-left: 6px;
    margin-right: 6px;
  }
}


@media (max-width: 1024px) and (orientation: landscape), (hover: none) and (pointer: coarse) and (orientation: landscape) {
  .main-content {
    padding-top: calc(env(safe-area-inset-top, 0px) + 58px);
  }

  body.mobile-chat-active .main-content {
    padding-top: 0;
  }

  .chat-header.chat-layer {
    margin-top: calc(env(safe-area-inset-top, 0px) + 4px);
    min-height: 54px;
  }

  .chat-avatar {
    width: 36px;
    min-width: 36px;
    height: 36px;
  }

  .messages.chat-layer {
    padding-top: 8px;
  }
}


@media (hover: none) and (pointer: coarse) {
  button,
  .character-card,
  .group-card,
  .history-item,
  .group-responder-option,
  .group-member-option {
    -webkit-tap-highlight-color: transparent;
  }

  button:active,
  .character-card:active,
  .group-card:active,
  .history-item:active,
  .group-responder-option:active,
  .group-member-option:active {
    transform: scale(0.985);
  }
}


@media (prefers-reduced-motion: reduce) {
  .mobile-sidebar-btn,
  .sidebar,
  .sidebar-mobile-overlay,
  .image-picker-btn,
  .image-remove-btn {
    transition: none !important;
    animation: none !important;
  }
}


/* =========================================================
   V3.7.2.2 — CHATI-AI FULL-SCREEN LIGHT CINEMATIC SPLASH
   ========================================================= */

body.splash-active {
  overflow: hidden;
}

body.splash-active .app {
  opacity: 0;
  transform: scale(.992);
}

.app {
  opacity: 1;
  transform: scale(1);
  transition:
    opacity .72s cubic-bezier(.22, .72, .22, 1),
    transform .9s cubic-bezier(.16, 1, .3, 1);
}

.cinematic-splash {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: grid;
  place-items: center;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 45%, rgba(155, 165, 194, .09), transparent 34%),
    radial-gradient(circle at 50% 62%, rgba(114, 91, 176, .035), transparent 46%),
    linear-gradient(180deg, #08090d 0%, #050609 58%, #030407 100%);
  opacity: 1;
  visibility: visible;
  isolation: isolate;
  transition:
    opacity .78s cubic-bezier(.4, 0, .2, 1),
    filter .78s ease,
    visibility 0s linear .78s;
}

.cinematic-splash::before {
  content: "";
  position: absolute;
  inset: -20%;
  pointer-events: none;
  background:
    radial-gradient(circle at 50% 46%, rgba(224, 229, 243, .07), transparent 27%),
    linear-gradient(115deg, transparent 34%, rgba(255, 255, 255, .012) 49%, transparent 64%);
  opacity: 0;
  animation: splashAmbientBloom 2.65s ease .2s forwards;
}

.cinematic-splash.is-leaving {
  opacity: 0;
  filter: blur(12px) brightness(.74);
  pointer-events: none;
}

.cinematic-splash-ambient {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse at center, rgba(255, 255, 255, .026), transparent 58%),
    linear-gradient(180deg, rgba(255,255,255,.006), transparent 34%, rgba(0,0,0,.12));
  opacity: .72;
}

/* This layer covers the ENTIRE splash viewport, so the light is never boxed
   by the logo/wordmark dimensions. */
.cinematic-splash-lightfield {
  display: none;
}

.cinematic-splash-sweep {
  position: absolute;
  top: -14vh;
  bottom: -14vh;
  left: -34vw;
  width: clamp(180px, 22vw, 420px);
  transform: skewX(-11deg) translate3d(-12vw, 0, 0);
  background:
    linear-gradient(
      90deg,
      transparent 0%,
      rgba(178, 191, 221, .018) 10%,
      rgba(214, 224, 244, .10) 31%,
      rgba(245, 248, 255, .32) 46%,
      rgba(255, 255, 255, .76) 51%,
      rgba(225, 233, 250, .18) 63%,
      rgba(187, 202, 235, .035) 83%,
      transparent 100%
    );
  filter: blur(18px);
  opacity: 0;
  animation: splashScreenSweep 1.42s cubic-bezier(.28, .68, .28, 1) .72s forwards;
}

.cinematic-splash-ray {
  position: absolute;
  top: -8vh;
  bottom: -8vh;
  left: -8vw;
  width: 2px;
  transform: rotate(2.5deg);
  background: linear-gradient(
    180deg,
    transparent,
    rgba(255,255,255,.46) 13%,
    rgba(255,255,255,.92) 43%,
    rgba(255,255,255,.98) 54%,
    rgba(255,255,255,.50) 84%,
    transparent
  );
  box-shadow:
    0 0 12px rgba(241, 245, 255, .9),
    0 0 34px rgba(198, 211, 243, .54),
    0 0 78px rgba(143, 165, 219, .22),
    0 0 130px rgba(129, 151, 209, .08);
  opacity: 0;
  animation: splashScreenRay 1.36s cubic-bezier(.28, .68, .28, 1) .75s forwards;
}

.cinematic-splash-stage {
  position: relative;
  z-index: 2;
  width: min(92vw, 720px);
  min-height: min(68vh, 500px);
  display: grid;
  place-items: center;
  overflow: visible;
  transform: translateY(-1vh) scale(.965);
  opacity: 0;
  animation: splashStageEnter .78s cubic-bezier(.16, 1, .3, 1) .12s forwards;
}

.cinematic-splash-halo {
  position: absolute;
  width: min(74vw, 560px);
  height: min(42vw, 310px);
  min-height: 210px;
  border-radius: 50%;
  background:
    radial-gradient(ellipse at center, rgba(224, 229, 242, .12), rgba(151, 161, 187, .035) 46%, transparent 74%);
  opacity: 0;
  filter: blur(34px);
  transform: scale(.8);
  animation: splashHalo 2.32s ease .42s forwards;
  pointer-events: none;
}

.cinematic-splash-logo {
  position: relative;
  z-index: 3;
  width: auto;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(18px, 3vh, 30px);
  overflow: visible;
  padding: 28px 40px 34px;
}

/* CA is now a true centered row. No absolute left/right positioning, no
   overlap, no clipping box around either glyph. */
.cinematic-splash-monogram {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: clamp(8px, 1.6vw, 18px);
  width: max-content;
  max-width: 92vw;
  overflow: visible;
  opacity: 0;
  transform: translateY(6px) scale(.95);
  animation: splashMarkReveal 1.12s cubic-bezier(.16, 1, .3, 1) .3s forwards;
}

.cinematic-splash-letter {
  position: relative;
  display: inline-block;
  flex: 0 0 auto;
  font-family: "Roboto", Arial, sans-serif;
  font-weight: 700;
  font-size: clamp(126px, 16vw, 202px);
  line-height: .88;
  letter-spacing: 0;
  padding: .08em .07em .13em;
  overflow: visible;
  color: transparent;
  background: linear-gradient(
    108deg,
    #626874 0%,
    #c9ced8 24%,
    #858b98 39%,
    #f7f9ff 47%,
    #ffffff 50%,
    #dce4f3 53%,
    #7c828f 62%,
    #d9dde6 82%,
    #616672 100%
  );
  background-size: 320% 100%;
  background-position: 100% 50%;
  background-repeat: no-repeat;
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter:
    drop-shadow(0 1px 1px rgba(255, 255, 255, .065))
    drop-shadow(0 18px 24px rgba(0, 0, 0, .58));
  user-select: none;
}

.cinematic-splash-letter-c {
  transform: scaleX(.91);
  transform-origin: center;
  animation: splashLetterShine 1.05s cubic-bezier(.28, .68, .28, 1) .72s forwards;
}

.cinematic-splash-letter-a {
  transform: scaleX(.86);
  transform-origin: center;
  animation: splashLetterShine 1.05s cubic-bezier(.28, .68, .28, 1) .90s forwards;
}

.cinematic-splash-wordmark {
  position: relative;
  z-index: 2;
  width: max-content;
  max-width: 92vw;
  min-height: 44px;
  display: grid;
  place-items: center;
  overflow: visible;
  opacity: 0;
  transform: translateY(10px);
  animation:
    splashWordmarkReveal .86s cubic-bezier(.16, 1, .3, 1) 1.5s forwards,
    splashWordmarkPulse .78s ease 2.2s forwards;
}

.cinematic-splash-word,
.cinematic-splash-word-glow {
  grid-area: 1 / 1;
  display: inline-block;
  width: max-content;
  max-width: 92vw;
  font-family: "Helvetica Neue", "Avenir Next", Avenir, Inter, Arial, sans-serif;
  font-size: clamp(17px, 2vw, 25px);
  font-weight: 300;
  line-height: 1.25;
  letter-spacing: .42em;
  padding: .28em .22em .42em .64em;
  white-space: nowrap;
  overflow: visible;
  user-select: none;
}

.cinematic-splash-word {
  color: transparent;
  background: linear-gradient(180deg, #fbfbfd 0%, #aeb4c1 50%, #d8dce5 100%);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 1px 0 rgba(255, 255, 255, .08));
}

.cinematic-splash-word-glow {
  color: rgba(246, 248, 255, .78);
  opacity: 0;
  filter:
    blur(2px)
    drop-shadow(0 0 10px rgba(236, 241, 255, .8))
    drop-shadow(0 0 26px rgba(190, 204, 235, .46));
  animation: splashWordGlow .88s ease 2.08s forwards;
}

@keyframes splashStageEnter {
  0% {
    opacity: 0;
    transform: translateY(calc(-1vh + 10px)) scale(.94);
    filter: blur(9px);
  }
  100% {
    opacity: 1;
    transform: translateY(-1vh) scale(.965);
    filter: blur(0);
  }
}

@keyframes splashMarkReveal {
  0% {
    opacity: 0;
    transform: translateY(8px) scale(.925);
    filter: brightness(.56) blur(3px);
  }
  62% { opacity: .97; }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter:
      brightness(1.03)
      drop-shadow(0 0 16px rgba(219, 225, 240, .08));
  }
}

@keyframes splashLetterShine {
  0% {
    background-position: 100% 50%;
    filter:
      brightness(.94)
      drop-shadow(0 1px 1px rgba(255, 255, 255, .065))
      drop-shadow(0 18px 24px rgba(0, 0, 0, .58));
  }
  48% {
    filter:
      brightness(1.34)
      drop-shadow(0 0 10px rgba(239, 244, 255, .36))
      drop-shadow(0 0 24px rgba(204, 218, 250, .20))
      drop-shadow(0 18px 24px rgba(0, 0, 0, .58));
  }
  100% {
    background-position: 0% 50%;
    filter:
      brightness(1.03)
      drop-shadow(0 1px 1px rgba(255, 255, 255, .065))
      drop-shadow(0 18px 24px rgba(0, 0, 0, .58));
  }
}

@keyframes splashScreenSweep {
  0% {
    left: -34vw;
    opacity: 0;
    transform: skewX(-11deg) translate3d(-12vw, 0, 0);
  }
  10% { opacity: .94; }
  76% { opacity: .70; }
  100% {
    left: 118vw;
    opacity: 0;
    transform: skewX(-11deg) translate3d(12vw, 0, 0);
  }
}

@keyframes splashScreenRay {
  0% {
    left: -8vw;
    opacity: 0;
  }
  9% { opacity: .96; }
  82% { opacity: .86; }
  100% {
    left: 108vw;
    opacity: 0;
  }
}

@keyframes splashWordmarkReveal {
  0% {
    opacity: 0;
    transform: translateY(10px);
    filter: blur(2.6px) brightness(.72);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0) brightness(1.08);
  }
}

@keyframes splashWordmarkPulse {
  0% { filter: brightness(1.08); }
  48% { filter: brightness(1.46); }
  100% { filter: brightness(1.12); }
}

@keyframes splashWordGlow {
  0% {
    opacity: 0;
    transform: scale(.985);
  }
  44% {
    opacity: .98;
    transform: scale(1.015);
  }
  100% {
    opacity: .2;
    transform: scale(1);
  }
}

@keyframes splashHalo {
  0% {
    opacity: 0;
    transform: scale(.76);
  }
  43% { opacity: .9; }
  100% {
    opacity: .28;
    transform: scale(1.07);
  }
}

@keyframes splashAmbientBloom {
  0% { opacity: 0; }
  54% { opacity: 1; }
  100% { opacity: .56; }
}

@media (max-width: 760px) {
  .cinematic-splash-stage {
    width: 100vw;
    min-height: 66vh;
    transform: translateY(-2.4vh) scale(.97);
  }

  .cinematic-splash-logo {
    gap: 20px;
    padding: 24px 18px 32px;
  }

  .cinematic-splash-monogram {
    gap: clamp(4px, 2vw, 10px);
    max-width: 96vw;
  }

  .cinematic-splash-letter {
    font-size: clamp(112px, 31vw, 158px);
    padding-inline: .05em;
  }

  .cinematic-splash-word,
  .cinematic-splash-word-glow {
    max-width: 96vw;
    font-size: clamp(15px, 4.7vw, 20px);
    letter-spacing: .32em;
    padding-left: .5em;
    padding-right: .12em;
  }

  .cinematic-splash-sweep {
    width: clamp(150px, 40vw, 260px);
    filter: blur(15px);
  }

  @keyframes splashStageEnter {
    0% {
      opacity: 0;
      transform: translateY(calc(-2.4vh + 8px)) scale(.95);
      filter: blur(8px);
    }
    100% {
      opacity: 1;
      transform: translateY(-2.4vh) scale(.97);
      filter: blur(0);
    }
  }
}

@media (prefers-reduced-motion: reduce) {
  body.splash-active .app {
    opacity: 0;
    transform: none;
  }

  .cinematic-splash-stage,
  .cinematic-splash-halo,
  .cinematic-splash-monogram,
  .cinematic-splash-letter,
  .cinematic-splash-wordmark,
  .cinematic-splash-word-glow,
  .cinematic-splash-sweep,
  .cinematic-splash-ray,
  .cinematic-splash::before {
    animation: none !important;
  }

  .cinematic-splash-stage,
  .cinematic-splash-monogram,
  .cinematic-splash-wordmark {
    opacity: 1;
    filter: none;
    transform: none;
  }

  .cinematic-splash-halo {
    opacity: .22;
    transform: none;
  }

  .cinematic-splash-word-glow {
    opacity: .12;
  }

  .cinematic-splash-sweep,
  .cinematic-splash-ray {
    display: none;
  }

  .cinematic-splash,
  .app {
    transition-duration: .28s !important;
  }
}

/* =========================================================
   V3.7.2.1 — EXACT SIDEBAR SHAPE LOGO
   Vector-traced from the supplied Chati-AI monogram.
   Sidebar only — no raster image and no text-letter approximation.
   ========================================================= */

.sidebar-brand {
  gap: 12px;
}

.sidebar-brand-mark.sidebar-shape-logo {
  position: relative;
  width: 48px;
  min-width: 48px;
  height: 43px;
  display: grid;
  place-items: center;
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  transition:
    transform 0.3s cubic-bezier(0.16, 1, 0.3, 1),
    filter 0.3s ease;
}

.sidebar-shape-logo-svg {
  width: 100%;
  height: 100%;
  display: block;
  overflow: visible;
  filter:
    drop-shadow(0 1px 0 rgba(255, 255, 255, 0.07))
    drop-shadow(0 4px 8px rgba(0, 0, 0, 0.34));
}

.sidebar-shape-logo-path {
  vector-effect: non-scaling-stroke;
}

.sidebar-brand-name {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  font-family: "Helvetica Neue", "Avenir Next", Avenir, Inter, Arial, sans-serif;
  font-size: 16px;
  font-weight: 650;
  letter-spacing: 0.16em;
  color: rgba(238, 239, 245, 0.94);
  text-transform: uppercase;
}

@media (hover: hover) {
  .sidebar-brand:hover .sidebar-brand-mark.sidebar-shape-logo {
    transform: translateY(-1px) scale(1.035);
    border-color: transparent;
    box-shadow: none;
    filter: drop-shadow(0 0 12px rgba(210, 218, 232, 0.14));
  }

  .sidebar-brand:hover .sidebar-shape-logo-svg {
    filter:
      brightness(1.08)
      drop-shadow(0 0 7px rgba(236, 241, 255, 0.12))
      drop-shadow(0 4px 8px rgba(0, 0, 0, 0.34));
  }
}

.sidebar.is-collapsed .sidebar-brand-mark.sidebar-shape-logo {
  width: 38px;
  min-width: 38px;
  height: 35px;
}

@media (max-width: 960px), (hover: none) and (pointer: coarse) {
  .sidebar-brand-mark.sidebar-shape-logo {
    width: 46px;
    min-width: 46px;
    height: 42px;
  }
}
