:root {
  color-scheme: light dark;
  --bg: #f5f2ff;
  --ink: #171126;
  --muted: #766d8f;
  --card: rgba(255, 255, 255, 0.78);
  --dark: #111025;
  --dark-2: #1a1731;
  --line: rgba(115, 91, 190, 0.18);
  --purple: #7c3aed;
  --pink: #d946ef;
  --cyan: #06b6d4;
  --gold: #f59e0b;
  --green: #22c55e;
  --red: #e11d48;
  --shadow: 0 20px 70px rgba(38, 24, 84, 0.16);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 0%, rgba(124, 58, 237, 0.22), transparent 28%),
    radial-gradient(circle at 92% 8%, rgba(217, 70, 239, 0.14), transparent 26%),
    radial-gradient(circle at 50% 100%, rgba(45, 212, 191, 0.13), transparent 32%),
    linear-gradient(180deg, #fbfaff 0%, var(--bg) 44%, #ece7ff 100%);
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
select {
  cursor: pointer;
}

.app {
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr) auto;
  gap: 14px;
  width: min(860px, calc(100% - 24px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 14px 0;
}

.app-header,
.setup-card,
.memory-card,
.seo-copy,
.chat-card,
.legal-note {
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 24px;
  background: var(--card);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.app-header {
  position: relative;
  overflow: hidden;
}

.app-header::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent 0%, rgba(255, 255, 255, 0.42) 38%, transparent 62%);
  transform: translateX(-120%);
  animation: shine 6s ease-in-out infinite;
  pointer-events: none;
}

.app-header::after {
  content: "";
  position: absolute;
  inset: auto -60px -80px auto;
  width: 180px;
  height: 180px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(124, 58, 237, 0.18), transparent 64%);
  pointer-events: none;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo,
.avatar {
  display: grid;
  place-items: center;
  color: white;
  font-weight: 950;
  background: linear-gradient(135deg, var(--purple), var(--pink));
  box-shadow: 0 14px 34px rgba(124, 58, 237, 0.28);
}

.logo {
  width: 46px;
  height: 46px;
  border-radius: 16px;
  font-size: 14px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 21px;
  line-height: 1.05;
}

.brand p,
.hint,
.status-line,
.empty-state p,
.typing {
  color: var(--muted);
}

.header-pills {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.online-pill,
.mode-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 900;
}

.online-pill {
  color: #047857;
  background: #ecfdf5;
}

.mode-pill {
  color: #5b21b6;
  background: #ede9fe;
}

.online-pill i,
.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--green);
  box-shadow: 0 0 0 5px rgba(34, 197, 94, 0.13);
  animation: pulseDot 1.8s ease-in-out infinite;
}

.insight-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.insight {
  position: relative;
  overflow: hidden;
  display: grid;
  gap: 7px;
  padding: 11px 12px;
  border: 1px solid rgba(255, 255, 255, 0.82);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.68);
  box-shadow: 0 12px 34px rgba(38, 24, 84, 0.1);
  backdrop-filter: blur(16px);
}

.insight::after {
  content: "";
  position: absolute;
  inset: -40% auto auto -20%;
  width: 74px;
  height: 74px;
  border-radius: 999px;
  background: rgba(124, 58, 237, 0.12);
}

.insight span {
  position: relative;
  color: #5b5070;
  font-size: 11px;
  font-weight: 950;
  text-transform: uppercase;
}

.meter {
  position: relative;
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(124, 58, 237, 0.12);
}

.meter i {
  display: block;
  width: var(--w);
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--purple), var(--cyan), var(--pink));
  background-size: 180% 100%;
  animation: meterFlow 2.8s ease-in-out infinite;
}

.setup-card {
  position: relative;
  overflow: hidden;
  display: grid;
  gap: 12px;
  padding: 14px;
  transition: transform 180ms ease, background 180ms ease;
}

.setup-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 20% 12%, rgba(124, 58, 237, 0.16), transparent 32%),
    radial-gradient(circle at 88% 92%, rgba(6, 182, 212, 0.11), transparent 30%);
  pointer-events: none;
}

.setup-card > * {
  position: relative;
  z-index: 1;
}

.setup-card:hover {
  transform: translateY(-1px);
}

.setup-card.connected {
  display: none;
}

.setup-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 2px 2px;
}

.wizard {
  perspective: 1000px;
}

.wizard-step {
  display: none;
  gap: 12px;
  min-height: 238px;
  transform-style: preserve-3d;
}

.wizard-step.active {
  display: grid;
  animation: cardFlip 320ms ease both;
}

.wizard-actions {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px;
  align-items: center;
}

.ghost-btn {
  min-height: 52px;
  padding: 0 15px;
  border: 1px solid rgba(124, 58, 237, 0.16);
  border-radius: 16px;
  color: #5b21b6;
  background: rgba(255, 255, 255, 0.66);
  font-weight: 950;
}

.panel-kicker {
  display: block;
  margin-bottom: 4px;
  color: #7c3aed;
  font-size: 11px;
  font-weight: 950;
  letter-spacing: 0;
  text-transform: uppercase;
}

.setup-head h2 {
  font-size: 19px;
}

.mini-orbit {
  width: 42px;
  height: 42px;
  border-radius: 16px;
  background:
    radial-gradient(circle at 50% 50%, white 0 12%, transparent 13%),
    conic-gradient(from 120deg, var(--purple), var(--cyan), var(--pink), var(--purple));
  box-shadow: 0 14px 30px rgba(124, 58, 237, 0.2);
  animation: slowSpin 7s linear infinite;
}

.memory-card {
  display: grid;
  gap: 12px;
  padding: 14px;
}

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

.memory-head h2 {
  font-size: 17px;
}

.memory-head small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

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

.memory-head button {
  min-height: 36px;
  padding: 0 12px;
  border: 0;
  border-radius: 999px;
  color: #5b21b6;
  background: #ede9fe;
  font-size: 12px;
  font-weight: 950;
}

#memoryToggleBtn {
  display: none;
}

.memory-grid {
  display: grid;
  gap: 10px;
}

.memory-label {
  display: block;
  margin-bottom: 7px;
  color: #53466f;
  font-size: 11px;
  font-weight: 950;
  text-transform: uppercase;
}

.memory-list {
  display: grid;
  gap: 7px;
  max-height: 132px;
  overflow: auto;
}

.memory-list p,
.memory-item {
  margin: 0;
  padding: 9px 10px;
  border: 1px solid rgba(124, 58, 237, 0.12);
  border-radius: 14px;
  color: #5b5070;
  background: rgba(255, 255, 255, 0.55);
  font-size: 12px;
  line-height: 1.35;
}

.memory-item strong {
  display: block;
  color: #33234f;
  font-size: 13px;
}

.memory-item small {
  color: var(--muted);
}

.connected-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.summary-kicker {
  display: block;
  margin-bottom: 4px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.connected-summary strong {
  font-size: 18px;
}

.connected-summary button {
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 999px;
  color: white;
  background: rgba(255, 255, 255, 0.14);
  font-weight: 950;
}

.field {
  display: grid;
  gap: 7px;
}

.field span {
  color: #53466f;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.username-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

input,
select {
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--ink);
  outline: none;
  background: rgba(255, 255, 255, 0.82);
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(124, 58, 237, 0.56);
  box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.1);
}

.username-row button,
.chat-actions button,
.composer button {
  min-height: 44px;
  border: 0;
  border-radius: 14px;
  font-weight: 900;
}

.username-row button {
  padding: 0 13px;
  color: #4c1d95;
  background: #ede9fe;
}

.filter-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.filter-grid .field {
  padding: 10px;
  border: 1px solid rgba(124, 58, 237, 0.12);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.54);
}

.chip-block {
  display: grid;
  gap: 8px;
  padding: 11px;
  border: 1px solid rgba(124, 58, 237, 0.12);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.5);
}

.chip-block > span {
  color: #53466f;
  font-size: 11px;
  font-weight: 950;
  text-transform: uppercase;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.chip {
  min-height: 34px;
  padding: 0 11px;
  border: 1px solid rgba(124, 58, 237, 0.14);
  border-radius: 999px;
  color: #5b5070;
  background: rgba(255, 255, 255, 0.74);
  font-size: 12px;
  font-weight: 900;
  transition: transform 160ms ease, background 160ms ease, color 160ms ease;
}

.chip.active {
  border-color: transparent;
  color: white;
  background: linear-gradient(135deg, var(--purple), var(--pink));
  box-shadow: 0 10px 24px rgba(124, 58, 237, 0.2);
}

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

.bot-toggle {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 12px;
  border: 1px solid rgba(6, 182, 212, 0.18);
  border-radius: 18px;
  background:
    linear-gradient(135deg, rgba(6, 182, 212, 0.08), rgba(124, 58, 237, 0.08)),
    rgba(255, 255, 255, 0.52);
}

.bot-toggle input {
  appearance: none;
  width: 48px;
  height: 28px;
  border: 0;
  border-radius: 999px;
  background: rgba(83, 70, 111, 0.2);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.64);
  transition: background 160ms ease;
}

.bot-toggle input::before {
  content: "";
  display: block;
  width: 22px;
  height: 22px;
  margin: 3px;
  border-radius: 999px;
  background: white;
  box-shadow: 0 6px 12px rgba(38, 24, 84, 0.18);
  transition: transform 160ms ease;
}

.bot-toggle input:checked {
  background: linear-gradient(135deg, var(--purple), var(--cyan));
}

.bot-toggle input:checked::before {
  transform: translateX(20px);
}

.bot-toggle strong,
.bot-toggle small {
  display: block;
}

.bot-toggle strong {
  color: #33234f;
  font-size: 13px;
}

.bot-toggle small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.start-btn {
  min-height: 52px;
  border: 0;
  border-radius: 16px;
  color: white;
  background: linear-gradient(135deg, var(--purple), var(--pink));
  box-shadow: 0 16px 36px rgba(124, 58, 237, 0.24);
  font-size: 16px;
  font-weight: 950;
  position: relative;
  overflow: hidden;
  transition: transform 170ms ease, box-shadow 170ms ease;
}

.start-btn::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent, rgba(255, 255, 255, 0.32), transparent);
  transform: translateX(-120%);
  animation: shine 4.6s ease-in-out infinite;
}

.start-btn:not(:disabled):hover {
  transform: translateY(-1px);
  box-shadow: 0 20px 46px rgba(124, 58, 237, 0.31);
}

.start-btn:disabled,
.chat-actions button:disabled,
.composer button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.hint {
  text-align: center;
  font-size: 13px;
}

.legal-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 12px 14px;
  border-radius: 18px;
  color: #5b5070;
  font-size: 12px;
  line-height: 1.45;
}

.legal-note strong {
  flex: 0 0 auto;
  color: #33234f;
}

.seo-copy {
  display: grid;
  gap: 12px;
  padding: 16px;
  border-radius: 22px;
  color: #d8d1ea;
  line-height: 1.55;
  background:
  radial-gradient(circle at 20% 0%, rgba(124, 58, 237, 0.22), transparent 32%),
  radial-gradient(circle at 90% 90%, rgba(6, 182, 212, 0.14), transparent 30%),
  linear-gradient(135deg, #171325, #0c0a15);
}

.seo-copy h2,
.seo-copy h3 {
  margin: 0;
  color: white;
}

.seo-copy h2 {
  font-size: 20px;
}

.seo-copy h3 {
  font-size: 14px;
}

.seo-copy p {
  margin: 0;
  color: #b8afd0;
  font-size: 13px;
}

.seo-grid {
  display: grid;
  gap: 10px;
}

.seo-grid article {
  padding: 11px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.06);
}

.seo-copy details {
  padding: 11px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.05);
}

.seo-copy summary {
  cursor: pointer;
  color: #ddd6fe;
  font-weight: 950;
}

.chat-card {
  display: grid;
  grid-template-rows: auto auto auto minmax(220px, 1fr) auto auto;
  min-height: 0;
  overflow: hidden;
  position: relative;
  background:
    radial-gradient(circle at 50% 0%, rgba(124, 58, 237, 0.16), transparent 36%),
    radial-gradient(circle at 95% 82%, rgba(217, 70, 239, 0.11), transparent 30%),
    linear-gradient(180deg, var(--dark-2), var(--dark));
  color: white;
}

.chat-card::before {
  content: "";
  position: absolute;
  inset: 58px 0 auto auto;
  width: 190px;
  height: 190px;
  border-radius: 999px;
  background:
    linear-gradient(135deg, rgba(124, 58, 237, 0.2), rgba(6, 182, 212, 0.1));
  filter: blur(4px);
  opacity: 0.7;
  animation: floatGlow 7s ease-in-out infinite;
  pointer-events: none;
}

.chat-card > * {
  position: relative;
  z-index: 1;
}

.chat-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.session-timer {
  flex: 0 0 auto;
  min-height: 34px;
  padding: 8px 11px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  color: #ddd6fe;
  background: rgba(255, 255, 255, 0.08);
  font-size: 12px;
  font-weight: 950;
  letter-spacing: 0;
}

h2 {
  font-size: 20px;
}

.status-line {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 6px;
  font-size: 13px;
}

.status-line[data-state="waiting"] {
  color: #fde68a;
}

.status-line[data-state="connected"] {
  color: #bbf7d0;
}

.chat-actions {
  display: flex;
  gap: 8px;
}

.chat-actions button {
  padding: 0 11px;
  color: #ddd6fe;
  background: rgba(255, 255, 255, 0.08);
}

.chat-actions button:last-child {
  color: #fecdd3;
}

.chat-actions #addFriendBtn {
  display: none;
}

.empty-state {
  display: grid;
  place-items: center;
  gap: 8px;
  padding: 26px 16px 12px;
  text-align: center;
}

.avatar {
  width: 78px;
  height: 78px;
  border-radius: 26px;
}

.empty-state strong {
  font-size: 17px;
}

.empty-state p {
  max-width: 330px;
  font-size: 13px;
  line-height: 1.45;
}

.friend-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0 16px 8px;
  padding: 10px;
  border: 1px solid rgba(34, 197, 94, 0.18);
  border-radius: 18px;
  background:
    linear-gradient(135deg, rgba(34, 197, 94, 0.14), rgba(124, 58, 237, 0.12)),
    rgba(255, 255, 255, 0.07);
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.14);
  animation: popIn 180ms ease both;
}

.friend-bar[hidden] {
  display: none;
}

.friend-bar span,
.friend-bar strong {
  display: block;
}

.friend-bar span {
  color: #bbf7d0;
  font-size: 11px;
  font-weight: 950;
  text-transform: uppercase;
}

.friend-bar strong {
  color: white;
  font-size: 14px;
}

.friend-bar button {
  min-height: 40px;
  padding: 0 13px;
  border: 0;
  border-radius: 999px;
  color: #052e16;
  background: #bbf7d0;
  font-size: 12px;
  font-weight: 950;
}

.friend-bar button:disabled {
  opacity: 0.65;
}

.messages {
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: auto;
  padding: 12px 16px;
}

.message {
  max-width: 82%;
  padding: 11px 13px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.45;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.12);
  animation: popIn 180ms ease both;
}

.message.me {
  align-self: flex-end;
  border-bottom-right-radius: 5px;
  background: linear-gradient(135deg, var(--purple), var(--pink));
}

.message.stranger {
  align-self: flex-start;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-bottom-left-radius: 5px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.08));
}

.message.system {
  align-self: center;
  max-width: 94%;
  color: #bdb6d5;
  background: transparent;
  text-align: center;
  font-size: 12px;
}

.message.gif {
  min-width: 154px;
  padding: 0;
  overflow: hidden;
  background: transparent;
  box-shadow: none;
}

.gif-card {
  display: grid;
  place-items: center;
  min-height: 96px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 20px;
  color: white;
  background:
    radial-gradient(circle at 30% 20%, rgba(255, 255, 255, 0.28), transparent 24%),
    linear-gradient(135deg, var(--purple), var(--cyan), var(--pink));
  background-size: 160% 160%;
  font-size: 18px;
  font-weight: 950;
  animation: gifMove 2.8s ease-in-out infinite;
}

.message.me .gif-card {
  border-bottom-right-radius: 6px;
}

.message.stranger .gif-card {
  border-bottom-left-radius: 6px;
}

.typing {
  padding: 0 16px 8px;
  text-align: center;
  font-size: 12px;
}

.quick-replies {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 0 12px 10px;
  scrollbar-width: none;
}

.quick-replies[hidden] {
  display: none;
}

.quick-replies::-webkit-scrollbar {
  display: none;
}

.quick-replies button {
  flex: 0 0 auto;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  color: #e9d5ff;
  background: rgba(255, 255, 255, 0.08);
  font-size: 12px;
  font-weight: 900;
}

.quick-replies button:hover {
  background: rgba(124, 58, 237, 0.26);
}

.composer {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  position: relative;
}

.composer-tools {
  display: flex;
  gap: 6px;
}

.tool-btn {
  display: grid;
  place-items: center;
  width: 42px;
  min-height: 46px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 15px;
  color: #ddd6fe;
  background: rgba(255, 255, 255, 0.08);
  font-weight: 950;
}

.tool-btn:not(:disabled):hover,
.chat-actions button:not(:disabled):hover,
.username-row button:hover {
  transform: translateY(-1px);
  filter: brightness(1.05);
}

.picker {
  position: absolute;
  left: 12px;
  bottom: 70px;
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  width: min(280px, calc(100% - 24px));
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 18px;
  background: rgba(20, 16, 39, 0.94);
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(16px);
  animation: popIn 150ms ease both;
  z-index: 3;
}

.picker[hidden] {
  display: none;
}

.picker button {
  min-width: 42px;
  min-height: 38px;
  border: 0;
  border-radius: 12px;
  color: white;
  background: rgba(255, 255, 255, 0.1);
  font-weight: 900;
}

.gif-picker button {
  min-width: 58px;
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.85), rgba(217, 70, 239, 0.78));
}

textarea {
  width: 100%;
  min-height: 46px;
  max-height: 110px;
  resize: none;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 15px;
  color: white;
  outline: none;
  background: rgba(255, 255, 255, 0.09);
}

textarea::placeholder {
  color: #8f86aa;
}

.composer > button:not(.tool-btn) {
  min-width: 76px;
  padding: 0 15px;
  color: white;
  background: linear-gradient(135deg, var(--purple), var(--pink));
}

@media (min-width: 760px) {
  .app {
    grid-template-columns: 320px minmax(0, 1fr);
    grid-template-rows: auto auto auto minmax(0, 1fr) auto;
    align-items: stretch;
  }

  .app-header {
    grid-column: 1 / -1;
  }

  .insight-strip {
    grid-column: 1 / -1;
  }

  .setup-card {
    align-self: start;
    align-content: start;
    border-radius: 28px;
  }

  .memory-card {
    align-self: start;
    border-radius: 24px;
  }

  .setup-card:not(.connected) {
    padding: 18px;
  }

  .wizard-step {
    min-height: 286px;
  }

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

  .username-row {
    grid-template-columns: 1fr;
  }

  .username-row button {
    width: 100%;
  }

  .chat-card {
    grid-column: 2;
    grid-row: 3 / span 2;
    min-height: calc(100vh - 170px);
  }

  .legal-note {
    grid-column: 1 / -1;
  }

  .seo-copy {
    grid-column: 1 / -1;
  }

  .seo-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 759px) {
  .insight-strip {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 7px;
  }

  .insight {
    min-height: 50px;
    gap: 5px;
    padding: 8px 9px;
    border-radius: 16px;
    background:
      linear-gradient(135deg, rgba(124, 58, 237, 0.18), rgba(6, 182, 212, 0.1)),
      rgba(255, 255, 255, 0.07);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 12px 28px rgba(0, 0, 0, 0.18);
  }

  .insight::after {
    width: 50px;
    height: 50px;
    opacity: 0.7;
  }

  .insight span {
    font-size: 9px;
  }

  .meter {
    height: 6px;
  }

  .memory-card {
    gap: 9px;
    padding: 10px;
    overflow: hidden;
  }

  #memoryToggleBtn {
    display: inline-flex;
    align-items: center;
  }

  #clearHistoryBtn {
    display: none;
  }

  .memory-card.open #clearHistoryBtn {
    display: inline-flex;
    align-items: center;
  }

  .memory-card:not(.open) .memory-grid {
    display: none;
  }

  .memory-card.open .memory-grid {
    display: grid;
  }

  .composer {
    display: flex;
    align-items: flex-end;
    gap: 6px;
    padding: 9px;
  }

  .composer-tools {
    flex: 0 0 auto;
    align-items: flex-end;
  }

  .tool-btn {
    flex: 0 0 38px;
    width: 38px;
    min-width: 38px;
    min-height: 44px;
    height: 44px;
    padding: 0;
  }

  .composer > button:not(.tool-btn) {
    flex: 0 0 58px;
    width: 58px;
    min-width: 58px;
    min-height: 44px;
    height: 44px;
    padding: 0;
  }

  .composer textarea {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 44px;
    height: 44px;
    max-height: 86px;
    padding: 11px;
  }

  input,
  select {
    min-height: 38px;
  }

  .start-btn,
  .ghost-btn {
    min-height: 40px;
    border-radius: 13px;
    font-size: 13px;
  }

  .chat-actions {
    gap: 6px;
  }

  .chat-actions button {
    min-height: 34px;
    padding: 0 9px;
    border-radius: 12px;
    font-size: 11px;
  }

  .friend-bar {
    margin: 0 10px 7px;
    padding: 8px;
    border-radius: 15px;
  }

  .friend-bar strong {
    font-size: 13px;
  }

  .friend-bar button {
    min-height: 34px;
    padding: 0 11px;
    font-size: 11px;
  }

  .tool-btn {
    flex-basis: 36px;
    width: 36px;
    min-width: 36px;
    min-height: 40px;
    height: 40px;
    border-radius: 13px;
    font-size: 12px;
  }

  .composer > button:not(.tool-btn) {
    flex-basis: 54px;
    width: 54px;
    min-width: 54px;
    min-height: 40px;
    height: 40px;
    border-radius: 13px;
    font-size: 12px;
  }

  .composer textarea {
    min-height: 40px;
    height: 40px;
    padding: 10px;
    border-radius: 13px;
  }

  .setup-card {
    gap: 7px;
    padding: 10px;
    border-radius: 20px;
  }

  .connected-summary {
    gap: 8px;
  }

  .summary-kicker {
    font-size: 10px;
    margin-bottom: 2px;
  }

  .connected-summary strong {
    font-size: 16px;
  }

  .connected-summary button {
    min-height: 34px;
    padding: 0 12px;
    font-size: 12px;
  }

  .setup-head h2 {
    font-size: 17px;
  }

  .mini-orbit {
    width: 36px;
    height: 36px;
    border-radius: 14px;
  }

  .wizard-step {
    min-height: 142px;
    gap: 8px;
  }

  .username-row {
    gap: 7px;
  }

  input,
  select {
    min-height: 40px;
    border-radius: 14px;
    font-size: 14px;
  }

  .username-row button {
    min-height: 40px;
    padding: 0 12px;
    border-radius: 14px;
    font-size: 12px;
  }

  .start-btn,
  .ghost-btn {
    min-height: 40px;
    border-radius: 14px;
    font-size: 13px;
  }

  .hint {
    font-size: 11px;
  }
}

@media (max-width: 480px) {
  body {
    color: white;
    background:
      radial-gradient(circle at 18% 0%, rgba(124, 58, 237, 0.36), transparent 32%),
      radial-gradient(circle at 92% 14%, rgba(6, 182, 212, 0.18), transparent 28%),
      linear-gradient(180deg, #100d20 0%, #171226 46%, #0f0d1b 100%);
  }

  .app {
    width: min(100% - 14px, 860px);
    gap: 8px;
    padding: 8px 0;
  }

  .app-header,
  .setup-card,
  .memory-card,
  .seo-copy,
  .chat-card,
  .legal-note {
    border-color: rgba(255, 255, 255, 0.11);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.24);
  }

  .brand p,
  .mode-pill {
    display: none;
  }

  .app-header {
    padding: 11px;
  }

  .logo {
    width: 40px;
    height: 40px;
    border-radius: 14px;
  }

  h1 {
    font-size: 19px;
  }

  .online-pill {
    min-height: 30px;
    padding: 0 10px;
    font-size: 12px;
  }

  .insight {
    border-color: rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.08);
  }

  .insight span {
    color: #c4b5fd;
  }

  .setup-card {
    gap: 8px;
    padding: 10px;
  }

  .memory-card {
    gap: 9px;
    padding: 10px;
    overflow: hidden;
  }

  .memory-card:not(.open) {
    padding-bottom: 10px;
  }

  .memory-head h2 {
    color: white;
    font-size: 15px;
  }

  .memory-head small {
    color: #b8afd0;
    font-size: 10px;
  }

  .memory-actions {
    gap: 6px;
  }

  .memory-head button {
    min-height: 32px;
    padding: 0 10px;
    color: white;
    background: rgba(124, 58, 237, 0.34);
    font-size: 11px;
  }

  #memoryToggleBtn {
    display: inline-flex;
    align-items: center;
  }

  #clearHistoryBtn {
    display: none;
  }

  .memory-card.open #clearHistoryBtn {
    display: inline-flex;
    align-items: center;
  }

  .memory-card:not(.open) .memory-grid {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    pointer-events: none;
    margin-top: -9px;
  }

  .memory-grid {
    transition: max-height 220ms ease, opacity 180ms ease, margin 180ms ease;
    max-height: 190px;
    opacity: 1;
  }

  .memory-grid {
    grid-template-columns: 1fr 1fr;
    gap: 7px;
  }

  .memory-label {
    color: #c4b5fd;
    font-size: 10px;
  }

  .memory-list {
    max-height: 84px;
  }

  .memory-list p,
  .memory-item {
    padding: 8px;
    border-color: rgba(255, 255, 255, 0.1);
    color: #b8afd0;
    background: rgba(255, 255, 255, 0.07);
    font-size: 11px;
  }

  .memory-item strong {
    color: white;
    font-size: 12px;
  }

  .setup-head {
    padding: 0;
  }

  .panel-kicker {
    margin-bottom: 2px;
    color: #c4b5fd;
    font-size: 10px;
  }

  .setup-head h2 {
    color: white;
    font-size: 16px;
  }

  .wizard-step {
    gap: 8px;
    min-height: 178px;
  }

  .wizard-actions {
    grid-template-columns: 82px minmax(0, 1fr);
    gap: 7px;
  }

  .ghost-btn {
    min-height: 44px;
    border-color: rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    color: #ddd6fe;
    background: rgba(255, 255, 255, 0.08);
    font-size: 12px;
  }

  .mini-orbit {
    width: 34px;
    height: 34px;
    border-radius: 13px;
  }

  .field {
    gap: 5px;
  }

  .field span,
  .chip-block > span {
    color: #c4b5fd;
    font-size: 10px;
  }

  input,
  select {
    min-height: 38px;
    border-color: rgba(255, 255, 255, 0.1);
    border-radius: 13px;
    color: white;
    background: rgba(255, 255, 255, 0.08);
  }

  select option {
    color: #171126;
  }

  .username-row {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 6px;
  }

  .username-row button {
    min-height: 38px;
    padding: 0 10px;
    border-radius: 13px;
    color: white;
    background: rgba(124, 58, 237, 0.35);
    font-size: 12px;
  }

  .filter-grid {
    grid-template-columns: 1fr;
    gap: 7px;
  }

  .insight-strip {
    grid-template-columns: 1fr;
    gap: 7px;
  }

  .insight {
    grid-template-columns: 92px minmax(0, 1fr);
    align-items: center;
    padding: 9px 10px;
  }

  .filter-grid .field,
  .chip-block,
  .bot-toggle {
    padding: 8px;
    border-color: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    background: rgba(255, 255, 255, 0.07);
  }

  .chip-row {
    gap: 6px;
  }

  .chip {
    min-height: 30px;
    padding: 0 9px;
    border-color: rgba(255, 255, 255, 0.1);
    color: #ddd6fe;
    background: rgba(255, 255, 255, 0.08);
    font-size: 11px;
  }

  .bot-toggle {
    gap: 8px;
    grid-template-columns: auto minmax(0, 1fr);
  }

  .bot-toggle input {
    width: 42px;
    height: 24px;
    min-height: 24px;
    background: rgba(255, 255, 255, 0.14);
  }

  .bot-toggle input::before {
    width: 18px;
    height: 18px;
  }

  .bot-toggle input:checked::before {
    transform: translateX(18px);
  }

  .bot-toggle strong {
    color: white;
    font-size: 12px;
  }

  .bot-toggle small {
    color: #b8afd0;
    font-size: 10px;
  }

  .start-btn {
    min-height: 44px;
    border-radius: 14px;
    font-size: 14px;
  }

  .hint {
    font-size: 11px;
  }

  .chat-card {
    min-height: calc(100vh - 410px);
  }

  .chat-top {
    align-items: center;
  }

  .session-timer {
    order: 3;
    min-height: 30px;
    padding: 6px 9px;
    font-size: 11px;
  }

  .legal-note {
    display: block;
    padding: 11px 12px;
    color: #b8afd0;
  }

  .legal-note strong {
    display: block;
    margin-bottom: 3px;
    color: white;
  }

  .seo-copy {
    padding: 12px;
    border-radius: 18px;
  }

  .seo-copy h2 {
    font-size: 17px;
  }

  .message {
    max-width: 90%;
  }

  .composer {
    display: flex;
    align-items: flex-end;
    gap: 6px;
    padding: 9px;
  }

  .composer-tools {
    flex: 0 0 auto;
    align-items: flex-end;
  }

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

  .composer > button:not(.tool-btn) {
    flex: 0 0 auto;
    min-width: 58px;
    min-height: 44px;
    height: 44px;
    padding: 0 11px;
  }

  textarea {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 44px;
    height: 44px;
    max-height: 86px;
    padding: 11px;
  }
}

@keyframes shine {
  0%, 48% { transform: translateX(-120%); }
  65%, 100% { transform: translateX(120%); }
}

@keyframes pulseDot {
  0%, 100% { box-shadow: 0 0 0 5px rgba(34, 197, 94, 0.13); }
  50% { box-shadow: 0 0 0 8px rgba(34, 197, 94, 0.05); }
}

@keyframes meterFlow {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

@keyframes floatGlow {
  0%, 100% { transform: translate(36px, -18px) scale(1); }
  50% { transform: translate(18px, 12px) scale(1.08); }
}

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

@keyframes gifMove {
  0%, 100% { background-position: 0% 50%; transform: scale(1); }
  50% { background-position: 100% 50%; transform: scale(1.02); }
}

@keyframes slowSpin {
  to { transform: rotate(360deg); }
}

@keyframes cardFlip {
  from {
    opacity: 0;
    transform: rotateY(-18deg) translateY(8px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: rotateY(0deg) translateY(0) scale(1);
  }
}

body {
  color: #f7f4ff;
  background:
    radial-gradient(circle at 12% -8%, rgba(124, 58, 237, 0.34), transparent 30%),
    radial-gradient(circle at 92% 8%, rgba(6, 182, 212, 0.18), transparent 28%),
    radial-gradient(circle at 50% 108%, rgba(217, 70, 239, 0.16), transparent 34%),
    linear-gradient(180deg, #0b0914 0%, #141020 48%, #090812 100%);
}

.app-header,
.setup-card,
.memory-card,
.legal-note {
  border-color: rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.28);
}

.brand p,
.field span,
.memory-label,
.hint,
.legal-note,
.empty-state p {
  color: #b8afd0;
}

.field span,
.chip-block > span,
.panel-kicker,
.memory-label {
  color: #c4b5fd;
}

input,
select,
.filter-grid .field,
.chip-block,
.bot-toggle,
.memory-list p,
.memory-item {
  border-color: rgba(255, 255, 255, 0.1);
  color: white;
  background: rgba(255, 255, 255, 0.07);
}

select option {
  color: #171126;
}

.memory-item strong,
.legal-note strong,
.bot-toggle strong {
  color: white;
}

.insight {
  border-color: rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.08);
}

.insight span {
  color: #c4b5fd;
}

/* Compact premium chat surface */
.chat-card {
  grid-template-rows: auto auto auto minmax(240px, 1fr) auto auto;
  border-color: rgba(255, 255, 255, 0.12);
  background:
    radial-gradient(circle at 50% -8%, rgba(124, 58, 237, 0.25), transparent 38%),
    radial-gradient(circle at 100% 80%, rgba(6, 182, 212, 0.12), transparent 30%),
    linear-gradient(180deg, #171325, #0c0a15);
}

.chat-top {
  align-items: center;
  gap: 8px;
  padding: 12px;
}

.chat-top h2 {
  font-size: 17px;
}

.status-line {
  margin-top: 4px;
  font-size: 12px;
}

.session-timer {
  min-height: 30px;
  padding: 6px 9px;
  font-size: 11px;
}

.chat-actions {
  gap: 6px;
}

.chat-actions button {
  min-height: 32px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 950;
}

.friend-bar {
  margin: 0 12px 7px;
  padding: 8px 9px;
  border-radius: 15px;
}

.friend-bar span {
  font-size: 10px;
}

.friend-bar strong {
  font-size: 13px;
}

.friend-bar button {
  min-height: 32px;
  padding: 0 11px;
  font-size: 11px;
}

.messages {
  gap: 8px;
  padding: 10px 12px;
}

.message {
  padding: 9px 11px;
  border-radius: 14px;
  font-size: 13px;
}

.quick-replies {
  gap: 6px;
  padding: 0 10px 8px;
}

.quick-replies button {
  min-height: 30px;
  padding: 0 10px;
  font-size: 11px;
}

.composer {
  gap: 7px;
  padding: 9px;
}

.tool-btn {
  width: 38px;
  min-height: 40px;
  border-radius: 13px;
}

textarea {
  min-height: 40px;
  padding: 10px;
  border-radius: 13px;
}

.composer > button:not(.tool-btn) {
  min-width: 62px;
  min-height: 40px;
  padding: 0 12px;
  border-radius: 13px;
  font-size: 12px;
}

/* Final stable composer layout for desktop and mobile */
.composer {
  display: flex;
  align-items: flex-end;
  gap: 7px;
}

.composer-tools {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-end;
  gap: 6px;
}

.tool-btn {
  flex: 0 0 38px;
  width: 38px;
  min-width: 38px;
  height: 40px;
  min-height: 40px;
  padding: 0;
}

.composer textarea {
  flex: 1 1 auto;
  min-width: 0;
  height: 40px;
  min-height: 40px;
  max-height: 92px;
}

.composer > button:not(.tool-btn) {
  flex: 0 0 62px;
  width: 62px;
  min-width: 62px;
  height: 40px;
  min-height: 40px;
  padding: 0;
}

.chat-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.chat-actions button {
  min-height: 30px;
  padding: 0 8px;
  font-size: 11px;
}

/* Premium in-chat action rail */
.chat-actions {
  display: flex;
  gap: 7px;
  margin: 0 10px 8px;
  padding: 7px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 16px;
  background:
    linear-gradient(135deg, rgba(124, 58, 237, 0.14), rgba(6, 182, 212, 0.08)),
    rgba(255, 255, 255, 0.06);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
  overflow-x: auto;
  scrollbar-width: none;
}

.chat-actions[hidden] {
  display: none;
}

.chat-actions::-webkit-scrollbar {
  display: none;
}

.chat-actions button {
  flex: 1 0 auto;
  min-height: 32px;
  padding: 0 11px;
  border-radius: 999px;
  white-space: nowrap;
  background: rgba(255, 255, 255, 0.08);
}

#cancelBtn {
  color: #fed7aa;
}

#skipBtn {
  color: #bfdbfe;
}

#blockBtn,
#reportBtn {
  color: #fecdd3;
}

.hero-idle,
.search-radar {
  display: grid;
  place-items: center;
  gap: 8px;
}

.hero-idle[hidden],
.search-radar[hidden] {
  display: none;
}

.avatar,
.radar-orb span {
  background: linear-gradient(135deg, var(--purple), var(--pink));
}

.avatar-neon {
  background: linear-gradient(135deg, #06b6d4, #7c3aed, #d946ef);
}

.avatar-moon {
  background: linear-gradient(135deg, #64748b, #a78bfa, #f8fafc);
  color: #111025;
}

.avatar-flame {
  background: linear-gradient(135deg, #f59e0b, #ef4444, #d946ef);
}

.avatar-cloud {
  background: linear-gradient(135deg, #38bdf8, #e0f2fe, #a78bfa);
  color: #111025;
}

.search-radar {
  width: min(100%, 360px);
  padding: 6px 0;
}

.radar-orb {
  position: relative;
  display: grid;
  place-items: center;
  width: 116px;
  height: 116px;
  border-radius: 999px;
  background:
    repeating-radial-gradient(circle, rgba(167, 139, 250, 0.16) 0 1px, transparent 2px 19px),
    radial-gradient(circle, rgba(124, 58, 237, 0.16), transparent 68%);
  overflow: hidden;
}

.radar-orb::before {
  content: "";
  position: absolute;
  inset: 50% 50% 0 50%;
  width: 56px;
  height: 56px;
  transform-origin: 0 0;
  background: linear-gradient(45deg, rgba(34, 211, 238, 0.45), transparent 70%);
  animation: radarSweep 1.8s linear infinite;
}

.radar-orb::after {
  content: "";
  position: absolute;
  inset: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: inherit;
}

.radar-orb span {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border-radius: 20px;
  color: white;
  font-weight: 950;
  box-shadow: 0 16px 36px rgba(124, 58, 237, 0.32);
}

.radar-orb i {
  position: absolute;
  inset: 8px;
  border-radius: inherit;
  border: 1px solid rgba(34, 211, 238, 0.2);
  animation: radarPulse 1.6s ease-in-out infinite;
}

.search-radar strong {
  font-size: 16px;
}

.search-radar p {
  color: #b8afd0;
  font-size: 12px;
}

.search-tags {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
}

.search-tags span {
  min-height: 28px;
  padding: 7px 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  color: #ddd6fe;
  background: rgba(255, 255, 255, 0.08);
  font-size: 11px;
  font-weight: 900;
}

@keyframes radarSweep {
  to { transform: rotate(360deg); }
}

@keyframes radarPulse {
  0%, 100% { transform: scale(0.92); opacity: 0.5; }
  50% { transform: scale(1.04); opacity: 1; }
}



