[hidden] { display: none !important; }
:root {
  color-scheme: dark;
  --bg: #050810;
  --panel: #0a0f19;
  --panel-2: #101722;
  --panel-3: #151e2c;
  --line: rgba(255, 255, 255, 0.085);
  --line-strong: rgba(255, 255, 255, 0.16);
  --text: #f4f6fb;
  --muted: #8892a3;
  --muted-2: #5e6879;
  --acid: #d4ff43;
  --blue: #8093ff;
  --violet: #6748ff;
  --orange: #ff785f;
  --danger: #ff6d76;
  --sidebar: 296px;
  --ease: cubic-bezier(.2, .8, .2, 1);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  min-height: 100dvh;
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: "Avenir Next", Avenir, "Helvetica Neue", Tahoma, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button,
textarea,
input {
  font: inherit;
}

button {
  color: inherit;
}

button:focus-visible,
textarea:focus-visible,
input:focus-visible {
  outline: 2px solid var(--acid);
  outline-offset: 2px;
}

.app-shell {
  width: 100%;
  height: 100%;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: var(--sidebar) minmax(0, 1fr);
  background:
    radial-gradient(circle at 74% -20%, rgba(89, 67, 255, .13), transparent 34%),
    var(--bg);
}

.sidebar {
  position: relative;
  z-index: 30;
  display: flex;
  min-height: 0;
  flex-direction: column;
  padding: 22px 18px 16px;
  background:
    linear-gradient(180deg, rgba(255,255,255,.016), transparent 34%),
    #080d15;
  border-right: 1px solid var(--line);
}

.brand-row,
.chat-header,
.modal-head,
.history-head,
.side-link,
.new-chat,
.header-identity,
.modal-actions,
.data-section,
.data-buttons {
  display: flex;
  align-items: center;
}

.brand-row {
  justify-content: space-between;
  padding: 1px 5px 19px;
}

.brand {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .145em;
  color: #dfe4ed;
}

.brand strong {
  color: var(--acid);
}

.brand i {
  margin-left: 2px;
  color: var(--orange);
  font-style: normal;
}

.icon-button,
.modal-close,
.history-head button {
  border: 0;
  background: transparent;
  cursor: pointer;
}

.close-sidebar {
  display: none;
  color: var(--muted);
  font-size: 26px;
}

.profile-card {
  display: grid;
  grid-template-columns: 51px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(128,147,255,.09), rgba(255,255,255,.02));
  box-shadow: inset 0 1px rgba(255,255,255,.025);
}

.profile-photo-wrap {
  position: relative;
  width: 51px;
  height: 51px;
}

.profile-photo {
  width: 100%;
  height: 100%;
  border-radius: 16px;
  object-fit: cover;
  object-position: 50% 39%;
  filter: saturate(.9) contrast(1.05);
}

.profile-live {
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 13px;
  height: 13px;
  border: 3px solid #0d131e;
  border-radius: 50%;
  background: var(--acid);
  box-shadow: 0 0 10px rgba(212,255,67,.5);
}

.profile-card strong {
  display: block;
  overflow: hidden;
  color: #f6f7fa;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-card span:not(.profile-live) {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 10.5px;
}

.new-chat {
  width: 100%;
  justify-content: center;
  gap: 8px;
  margin: 12px 0 21px;
  padding: 12px 14px;
  border: 0;
  border-radius: 14px;
  background: var(--text);
  color: #070a10;
  font-size: 12px;
  font-weight: 750;
  cursor: pointer;
  transition: transform .18s var(--ease), background .18s var(--ease);
}

.new-chat:hover {
  transform: translateY(-1px);
  background: var(--acid);
}

.new-chat span {
  font-size: 17px;
  font-weight: 400;
}

.history-head {
  justify-content: space-between;
  padding: 0 6px 8px;
  color: var(--muted-2);
  font-size: 9px;
  font-weight: 750;
  letter-spacing: .16em;
}

.history-head button {
  color: var(--muted-2);
  font-size: 15px;
}

.thread-list {
  min-height: 0;
  flex: 1;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--panel-3) transparent;
}

.thread-item {
  position: relative;
  width: 100%;
  margin: 2px 0;
  padding: 11px 34px 11px 11px;
  overflow: hidden;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: #9da6b5;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
  transition: .16s ease;
}

.thread-item:hover,
.thread-item.active {
  border-color: var(--line);
  background: rgba(255,255,255,.035);
  color: var(--text);
}

.thread-item.active::before {
  position: absolute;
  left: 0;
  top: 10px;
  bottom: 10px;
  width: 2px;
  border-radius: 4px;
  background: var(--acid);
  content: "";
}

.thread-delete {
  position: absolute;
  top: 50%;
  right: 9px;
  width: 24px;
  height: 24px;
  transform: translateY(-50%);
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: transparent;
  cursor: pointer;
}

.thread-item:hover .thread-delete {
  color: var(--muted);
}

.thread-delete:hover {
  background: rgba(255,109,118,.12);
  color: var(--danger) !important;
}

.sidebar-foot {
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.side-link {
  width: 100%;
  gap: 10px;
  padding: 9px 7px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.side-link:hover {
  background: rgba(255,255,255,.035);
  color: var(--text);
}

.side-link > span:first-child {
  width: 17px;
  text-align: center;
}

.side-link b {
  flex: 1;
  font-size: 11px;
  font-weight: 600;
  text-align: left;
}

.side-link small {
  color: var(--muted-2);
  font-size: 9.5px;
}

.connection-dot {
  display: inline-block;
  width: 8px !important;
  height: 8px;
  border-radius: 50%;
  background: #5e6673;
}

.connection-dot.connected,
.connection-dot.linked {
  background: var(--acid);
  box-shadow: 0 0 8px rgba(212,255,67,.45);
}

.simulation-note {
  margin: 10px 7px 0;
  color: #46505f;
  font-size: 8.5px;
  line-height: 1.5;
}

.chat-main {
  position: relative;
  display: grid;
  min-width: 0;
  min-height: 0;
  grid-template-rows: 64px minmax(0, 1fr) auto;
  background:
    linear-gradient(rgba(255,255,255,.012) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.012) 1px, transparent 1px);
  background-size: 48px 48px;
}

.chat-main::after {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: radial-gradient(circle at 50% 36%, transparent 0, rgba(5,8,16,.22) 58%, rgba(5,8,16,.8) 100%);
  content: "";
}

.chat-header,
.chat-scroll,
.composer-wrap {
  position: relative;
  z-index: 2;
}

.chat-header {
  justify-content: space-between;
  padding: 0 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(5,8,16,.77);
  backdrop-filter: blur(18px);
}

.header-identity {
  gap: 10px;
}

.header-identity img {
  width: 34px;
  height: 34px;
  border-radius: 11px;
  object-fit: cover;
  object-position: 50% 38%;
}

.header-identity strong {
  display: block;
  font-size: 12px;
}

.header-identity span {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 2px;
  color: var(--muted);
  font-size: 9px;
}

.header-identity span i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--acid);
}

.header-action {
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255,255,255,.025);
  color: var(--muted);
  font-size: 10px;
  cursor: pointer;
}

.header-action:hover {
  border-color: var(--line-strong);
  color: var(--text);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 7px;
}

.header-action.compact {
  min-width: 42px;
  color: var(--acid);
}

.menu-button {
  display: none;
  color: var(--muted);
  font-size: 19px;
}

.chat-scroll {
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: #1e2633 transparent;
}

.welcome {
  width: min(820px, calc(100% - 48px));
  min-height: 100%;
  margin: 0 auto;
  padding: clamp(30px, 5vh, 60px) 0 42px;
  text-align: center;
  animation: appear .55s var(--ease) both;
}

.welcome.hidden {
  display: none;
}

.hero-portrait {
  position: relative;
  width: clamp(132px, 15vw, 174px);
  height: clamp(132px, 15vw, 174px);
  margin: 0 auto 22px;
  transform: rotate(-2deg);
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 37% 37% 45% 34%;
  background: #111a2a;
  box-shadow: 0 28px 70px rgba(0,0,0,.38);
}

.hero-portrait::before {
  position: absolute;
  inset: -8px;
  z-index: -1;
  border: 1px solid rgba(212,255,67,.22);
  border-radius: inherit;
  content: "";
}

.hero-portrait img {
  width: 100%;
  height: 100%;
  border-radius: inherit;
  object-fit: cover;
  object-position: 50% 37%;
  filter: saturate(.9) contrast(1.08);
}

.portrait-glow {
  position: absolute;
  inset: 58% 7% -10% 15%;
  z-index: -1;
  border-radius: 50%;
  background: rgba(81,71,255,.45);
  filter: blur(30px);
}

.portrait-mark {
  position: absolute;
  right: -19px;
  bottom: 10px;
  padding: 5px 8px;
  transform: rotate(2deg);
  border-radius: 8px;
  background: var(--acid);
  color: #090d11;
  font-size: 12px;
  font-weight: 850;
  letter-spacing: .08em;
}

.welcome-kicker {
  margin: 0 0 10px;
  color: var(--blue);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .24em;
}

.welcome h1 {
  margin: 0;
  color: #f3f5f9;
  font-size: clamp(31px, 4vw, 54px);
  font-weight: 650;
  letter-spacing: -.045em;
  line-height: 1.02;
}

.welcome h1 em {
  color: var(--acid);
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 500;
}

.welcome-copy {
  max-width: 500px;
  margin: 16px auto 24px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.suggestions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.suggestions button {
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255,255,255,.025);
  color: #9ba5b5;
  font-size: 10px;
  cursor: pointer;
  transition: .16s ease;
}

.suggestions button:hover {
  transform: translateY(-1px);
  border-color: rgba(212,255,67,.28);
  background: rgba(212,255,67,.055);
  color: var(--text);
}

.message-list {
  width: min(820px, calc(100% - 48px));
  margin: 0 auto;
  padding: 28px 0 58px;
}

.message {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 12px;
  margin: 0 0 28px;
  animation: messageIn .34s var(--ease) both;
}

.message.user {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 24px;
}

.user-bubble {
  display: flex;
  max-width: min(620px, 86%);
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.message-avatar {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  object-fit: cover;
  object-position: 50% 38%;
}

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

.message-author {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 7px;
  color: var(--muted-2);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .11em;
}

.message-author strong {
  color: var(--text);
  font-size: 10px;
}

.message-text {
  max-width: 690px;
  color: #e7eaf0;
  font-size: 14px;
  line-height: 1.72;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.message-text[dir="rtl"] {
  font-family: Tahoma, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.85;
  text-align: right;
}

.user .message-text {
  max-width: 100%;
  padding: 11px 15px;
  border: 1px solid rgba(128,147,255,.16);
  border-radius: 18px 18px 5px 18px;
  background: linear-gradient(135deg, rgba(128,147,255,.14), rgba(255,255,255,.055));
  color: #f0f2f7;
  line-height: 1.55;
}

.message-attachments {
  display: flex;
  max-width: 100%;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.message-attachment {
  display: flex;
  min-height: 48px;
  align-items: center;
  gap: 9px;
  padding: 8px 11px;
  border: 1px solid rgba(128,147,255,.18);
  border-radius: 14px;
  background: rgba(128,147,255,.09);
  color: #cbd2df;
  font-size: 10px;
}

.message-attachment img {
  width: min(240px, 58vw);
  max-height: 260px;
  border-radius: 11px;
  object-fit: cover;
}

.audio-wave {
  color: var(--acid);
  font-size: 21px;
  letter-spacing: -.13em;
}

.meme-card {
  position: relative;
  width: min(430px, 100%);
  margin-top: 15px;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 17px;
  background: #0d131d;
}

.meme-card img {
  display: block;
  width: 100%;
  max-height: 440px;
  object-fit: contain;
  background: #05070b;
}

.meme-credit {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 10px;
  color: #657081;
  font-size: 8px;
}

.meme-credit a {
  color: #7683a1;
  text-decoration: none;
}

.meme-fallback {
  display: none;
  min-height: 170px;
  align-items: center;
  justify-content: center;
  padding: 30px;
  background: linear-gradient(145deg, #171f2e, #090e17);
  color: var(--acid);
  font-family: Georgia, serif;
  font-size: 25px;
  line-height: 1.25;
  text-align: center;
}

.message-actions {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 10px;
  opacity: .38;
  transition: opacity .16s ease;
}

.message:hover .message-actions {
  opacity: 1;
}

.message-actions button {
  padding: 5px 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 9px;
  cursor: pointer;
}

.message-actions button:hover {
  border-color: var(--line);
  background: rgba(255,255,255,.035);
  color: var(--text);
}

.message-actions button.approved {
  color: var(--acid);
}

.typing .message-text {
  display: flex;
  align-items: center;
  gap: 5px;
  min-height: 28px;
}

.typing-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--muted);
  animation: typing 1.2s infinite ease-in-out;
}

.typing-dot:nth-child(2) { animation-delay: .14s; }
.typing-dot:nth-child(3) { animation-delay: .28s; }

.composer-wrap {
  position: relative;
  padding: 12px 24px 14px;
  background: linear-gradient(0deg, #050810 60%, rgba(5,8,16,0));
}

.composer {
  display: grid;
  width: min(820px, 100%);
  margin: 0 auto;
  grid-template-columns: 36px minmax(0, 1fr) 36px 36px 42px;
  align-items: end;
  gap: 10px;
  padding: 8px 9px;
  border: 1px solid var(--line-strong);
  border-radius: 20px;
  background: rgba(14,20,30,.94);
  box-shadow: 0 14px 50px rgba(0,0,0,.29), inset 0 1px rgba(255,255,255,.025);
  backdrop-filter: blur(18px);
  transition: border-color .18s ease, box-shadow .18s ease;
}

.composer:focus-within {
  border-color: rgba(128,147,255,.48);
  box-shadow: 0 14px 50px rgba(0,0,0,.32), 0 0 0 3px rgba(128,147,255,.06);
}

.composer textarea {
  width: 100%;
  max-height: 150px;
  resize: none;
  overflow-y: auto;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 16px;
  line-height: 1.45;
}

.composer-tool {
  width: 36px;
  height: 36px;
  align-self: end;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: #8994a5;
  font-size: 20px;
  cursor: pointer;
}

.composer-tool:hover {
  background: rgba(255,255,255,.05);
  color: var(--text);
}

.mic-button {
  font-size: 15px;
}

.mic-button.recording {
  background: rgba(255,109,118,.14);
  color: var(--danger);
  animation: recordPulse 1.2s infinite ease-in-out;
}

.attachment-preview {
  display: none;
  width: min(820px, 100%);
  margin: 0 auto 8px;
  flex-wrap: wrap;
  gap: 8px;
}

.attachment-preview.has-items {
  display: flex;
}

.pending-attachment {
  position: relative;
  display: flex;
  max-width: 210px;
  align-items: center;
  gap: 8px;
  padding: 7px 30px 7px 8px;
  border: 1px solid var(--line-strong);
  border-radius: 13px;
  background: #101722;
  color: #aeb7c6;
  font-size: 9px;
}

.pending-attachment img {
  width: 40px;
  height: 40px;
  border-radius: 9px;
  object-fit: cover;
}

.pending-attachment button {
  position: absolute;
  top: 4px;
  right: 5px;
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.emoji-picker {
  position: absolute;
  right: max(18px, calc((100% - 820px) / 2));
  bottom: calc(100% - 6px);
  z-index: 20;
  width: min(390px, calc(100vw - 24px));
  max-height: min(430px, 52vh);
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 19px;
  background: rgba(13,19,29,.985);
  box-shadow: 0 22px 70px rgba(0,0,0,.56);
}

.emoji-picker-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 13px;
  border-bottom: 1px solid var(--line);
  font-size: 10px;
}

.emoji-picker-head button {
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-size: 20px;
}

.emoji-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  max-height: min(375px, 45vh);
  gap: 2px;
  overflow-y: auto;
  padding: 8px;
}

.emoji-grid button {
  min-width: 40px;
  min-height: 40px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  font-size: 23px;
  cursor: pointer;
}

.emoji-grid button:hover {
  background: rgba(255,255,255,.06);
}

.composer textarea::placeholder {
  color: #5c6675;
}

.send-button {
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 14px;
  background: var(--acid);
  color: #090d10;
  font-size: 22px;
  font-weight: 800;
  cursor: pointer;
  transition: transform .15s ease, opacity .15s ease;
}

.send-button:hover {
  transform: translateY(-1px);
}

.send-button:disabled {
  opacity: .28;
  cursor: default;
  transform: none;
}

.composer-hint {
  margin: 7px auto 0;
  color: #4c5665;
  font-size: 8.5px;
  text-align: center;
}

.modal {
  width: min(520px, calc(100% - 30px));
  max-width: none;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 23px;
  background: #0d131d;
  color: var(--text);
  box-shadow: 0 32px 100px rgba(0,0,0,.72);
}

.modal::backdrop {
  background: rgba(2,4,8,.76);
  backdrop-filter: blur(8px);
}

.modal-card {
  padding: 24px;
}

.wide-modal {
  width: 100%;
}

#dataDialog {
  width: min(680px, calc(100% - 30px));
}

.modal-head {
  justify-content: space-between;
  margin-bottom: 18px;
}

.modal-head span {
  color: var(--blue);
  font-size: 8px;
  font-weight: 800;
  letter-spacing: .2em;
}

.modal-head h2 {
  margin: 4px 0 0;
  font-size: 23px;
  font-weight: 650;
  letter-spacing: -.03em;
}

.modal-close {
  color: var(--muted);
  font-size: 25px;
}

.modal-copy,
.data-explain {
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.65;
}

.field-label {
  display: block;
  margin: 12px 0 7px;
  color: #9da6b4;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.key-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #090e16;
}

.key-field input {
  min-width: 0;
  padding: 12px 13px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 12px;
}

.key-field button {
  padding: 0 13px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 9px;
  cursor: pointer;
}

.remember-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 10px;
}

.remember-row input {
  accent-color: var(--acid);
}

.status-line {
  min-height: 18px;
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 9px;
}

.modal-actions {
  justify-content: flex-end;
  gap: 8px;
  margin-top: 13px;
}

.button-ghost,
.button-primary {
  padding: 9px 13px;
  border-radius: 11px;
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
}

.button-ghost {
  border: 1px solid var(--line);
  background: rgba(255,255,255,.025);
  color: var(--muted);
}

.button-primary {
  border: 0;
  background: var(--acid);
  color: #090d10;
}

.data-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}

.data-stats div {
  min-width: 0;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255,255,255,.025);
}

.data-stats strong,
.data-stats span {
  display: block;
}

.data-stats strong {
  color: var(--acid);
  font-size: 18px;
}

.data-stats span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 8px;
  line-height: 1.35;
}

.data-section {
  justify-content: space-between;
  gap: 15px;
  padding: 13px 0;
  border-top: 1px solid var(--line);
}

.data-section strong,
.data-section span {
  display: block;
}

.data-section strong {
  font-size: 11px;
}

.data-section span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 9px;
}

.data-buttons {
  flex-shrink: 0;
  gap: 6px;
}

.feedback-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 7px;
}

.feedback-grid button {
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255,255,255,.025);
  color: var(--muted);
  font-size: 10px;
  cursor: pointer;
}

.feedback-grid button.selected {
  border-color: rgba(212,255,67,.42);
  background: rgba(212,255,67,.08);
  color: var(--acid);
}

.modal-textarea {
  width: 100%;
  resize: vertical;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 13px;
  outline: 0;
  background: #090e16;
  color: var(--text);
  font-size: 12px;
  line-height: 1.5;
}

.modal-textarea.large {
  min-height: 190px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 100;
  padding: 9px 13px;
  transform: translate(-50%, 16px);
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  background: #151d29;
  color: #e9edf5;
  font-size: 10px;
  opacity: 0;
  pointer-events: none;
  box-shadow: 0 14px 40px rgba(0,0,0,.42);
  transition: .22s var(--ease);
}

.toast.show {
  transform: translate(-50%, 0);
  opacity: 1;
}

.sidebar-scrim {
  display: none;
}

@keyframes appear {
  from { opacity: 0; transform: translateY(8px); }
}

@keyframes messageIn {
  from { opacity: 0; transform: translateY(7px); }
}

@keyframes typing {
  0%, 70%, 100% { transform: translateY(0); opacity: .35; }
  35% { transform: translateY(-4px); opacity: 1; }
}

@keyframes recordPulse {
  50% { box-shadow: 0 0 0 6px rgba(255,109,118,.08); }
}

@media (max-width: 820px) {
  .app-shell {
    display: block;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    padding-top: max(18px, env(safe-area-inset-top));
    padding-bottom: max(14px, env(safe-area-inset-bottom));
    width: min(330px, 88vw);
    transform: translateX(-102%);
    box-shadow: 20px 0 60px rgba(0,0,0,.48);
    transition: transform .25s var(--ease);
  }

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

  .sidebar-scrim {
    position: fixed;
    inset: 0;
    z-index: 25;
    display: block;
    background: rgba(2,4,8,.66);
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease;
  }

  .sidebar-scrim.show {
    opacity: 1;
    pointer-events: auto;
  }

  .close-sidebar,
  .menu-button {
    display: block;
  }

  .chat-main {
    width: 100%;
    height: 100%;
    min-height: 100dvh;
  }

  .chat-header {
    min-height: calc(58px + env(safe-area-inset-top));
    padding: env(safe-area-inset-top) 12px 0;
  }

  .welcome,
  .message-list {
    width: min(100% - 30px, 760px);
  }

  .welcome {
    padding-top: 34px;
  }

  .welcome h1 {
    font-size: clamp(29px, 8.5vw, 43px);
  }

  .composer-wrap {
    padding: 8px 10px max(9px, env(safe-area-inset-bottom));
  }

  .message {
    grid-template-columns: 30px minmax(0, 1fr);
    gap: 9px;
  }

  .message-avatar {
    width: 30px;
    height: 30px;
  }

  .message-text {
    font-size: 13.5px;
  }

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

  .user-bubble { max-width: 91%; }

  .message-actions { opacity: .78; overflow-x: auto; }

  .message-actions button { min-height: 34px; white-space: nowrap; }

  .composer { grid-template-columns: 40px minmax(0, 1fr) 40px 40px 44px; gap: 3px; border-radius: 18px; }

  .composer-tool { width: 40px; height: 40px; }

  .send-button { width: 44px; height: 44px; }

  .composer-hint { display: none; }

  .emoji-picker { position: fixed; right: 8px; bottom: calc(74px + env(safe-area-inset-bottom)); left: 8px; width: auto; }

  .emoji-grid { grid-template-columns: repeat(7, 1fr); }

  .emoji-grid button { min-width: 38px; min-height: 42px; }

  .data-stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .data-section {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 480px) {
  .header-action { padding: 8px; }
  .header-action.compact { min-width: 39px; }
  .composer { grid-template-columns: 38px minmax(0, 1fr) 38px 38px 42px; padding: 7px; }
  .emoji-grid { grid-template-columns: repeat(6, 1fr); }
  .suggestions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .suggestions button {
    white-space: normal;
  }

  .hero-portrait {
    width: 126px;
    height: 126px;
  }

  .welcome-copy {
    font-size: 12px;
  }

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

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
}

/* Reconstruction v1 */
.profile-photo,.header-identity img,.hero-portrait img,.message-avatar{object-fit:cover;object-position:50% 34%;}
.hero-portrait img{width:100%;height:100%;}
.message-sources{display:flex;align-items:center;gap:8px;margin-top:10px;}
.source-button{border:0;background:transparent;color:#75808f;font:600 9px/1.2 inherit;padding:0;cursor:pointer;letter-spacing:.02em;}
.source-button:hover{color:#c8ff2e;}
.source-badge{width:6px;height:6px;border-radius:50%;background:#c8ff2e;box-shadow:0 0 10px rgba(200,255,46,.45);}
.sources-list{display:grid;gap:12px;max-height:60vh;overflow:auto;padding-right:4px;}
.source-card{border:1px solid var(--line);border-radius:16px;padding:14px;background:rgba(9,13,22,.72);}
.source-card header{display:flex;justify-content:space-between;gap:16px;margin-bottom:8px;align-items:flex-start;}
.source-card strong{font-size:12px;color:#f0f3f8;}
.source-card small{font-size:9px;color:#778190;text-align:right;}
.source-card p{white-space:pre-wrap;color:#aeb6c3;font-size:11px;line-height:1.65;margin:0;max-height:150px;overflow:auto;}
.source-card.external{border-color:rgba(110,140,255,.28);}
.source-card.external a{color:#98adff;text-decoration:none;word-break:break-all;}
.sources-empty{color:#737e8c;font-size:11px;padding:24px 0;text-align:center;}
.data-section>small{color:#c8ff2e;font-size:9px;}
.status-line.error{color:#ff8e9c;}
.status-line.ok{color:#c8ff2e;}
.message-text:empty{display:none;}
.message.visual-only .message-text{display:none;}
.reaction-emoji{font-size:30px;line-height:1;margin-top:4px;}
.silence-mark{font-size:22px;color:#697383;letter-spacing:.25em;}
.profile-card span#moodLabel{max-width:150px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
@media (max-width:760px){.sources-modal{max-width:calc(100vw - 22px)}.source-card header{display:block}.source-card small{display:block;text-align:left;margin-top:4px}}


/* Photo selector */
.avatar-modal { max-width: 760px; }
.avatar-choice-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}
.avatar-choice {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255,255,255,.025);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: border-color .18s var(--ease), transform .18s var(--ease), background .18s var(--ease);
}
.avatar-choice:hover { transform: translateY(-2px); border-color: var(--line-strong); background: rgba(255,255,255,.045); }
.avatar-choice.selected { border-color: var(--acid); box-shadow: 0 0 0 2px rgba(212,255,67,.12); background: rgba(212,255,67,.055); }
.avatar-choice > img {
  width: 100%;
  aspect-ratio: 1;
  display: block;
  object-fit: cover;
  object-position: 50% 38%;
  border-radius: 12px;
  margin-bottom: 9px;
  background: var(--panel-3);
}
.avatar-choice strong { display: block; font-size: 12px; line-height: 1.25; }
.avatar-choice small { display: block; margin-top: 4px; color: var(--muted); font-size: 9px; line-height: 1.35; }
.auto-choice { grid-column: span 2; }
.avatar-auto-stack {
  position: relative;
  display: block;
  height: 116px;
  margin-bottom: 9px;
}
.avatar-auto-stack img {
  position: absolute;
  width: 88px;
  height: 88px;
  object-fit: cover;
  object-position: 50% 38%;
  border: 3px solid var(--panel-2);
  border-radius: 18px;
  box-shadow: 0 12px 28px rgba(0,0,0,.3);
}
.avatar-auto-stack img:nth-child(1) { left: 7%; top: 10px; z-index: 3; }
.avatar-auto-stack img:nth-child(2) { left: 34%; top: 20px; z-index: 2; }
.avatar-auto-stack img:nth-child(3) { right: 7%; top: 7px; z-index: 1; }
@media (max-width: 680px) {
  .avatar-choice-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .auto-choice { grid-column: span 2; }
}
