@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans+Arabic:wght@400;500;600;700&display=swap');

:root {
  --bg: #17121a;
  --panel: #251c26;
  --panel2: #30232f;
  --border: #593e54;
  --text: #f5edf3;
  --muted: #d1becd;
  --pink: #e990b4;
  --pink2: #bd668c;
  --line: #70495f;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    radial-gradient(ellipse at 42% 56%, #382334 0, transparent 46%),
    linear-gradient(120deg, #17121a, #211720 65%, #19131b);
  color: var(--text);
  font-family: 'IBM Plex Sans Arabic', Arial, sans-serif;
}

.shell {
  height: 100dvh;
  display: grid;
  grid-template-columns: 1fr 380px;
  max-width: 1800px;
  margin: auto;
}

.sidebar {
  grid-column: 2;
  background: rgba(25, 19, 27, 0.92);
  border-right: 1px solid #4c394a;
  padding: 35px 25px 18px;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.main {
  grid-column: 1;
  grid-row: 1;
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100dvh;
  overflow: hidden;
}

.brand {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  color: var(--pink);
  text-decoration: none;
  font-weight: 700;
  font-size: 32px;
  padding: 0 3px 28px;
}

.brand-heart {
  font-size: 28px;
}

.new-chat {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 17px;
  background: linear-gradient(100deg, #bd6589, #d681a1);
  border: 0;
  color: #fff;
  border-radius: 15px;
  padding: 16px;
  font: 600 17px/1.4 'IBM Plex Sans Arabic', Arial, sans-serif;
  cursor: pointer;
  box-shadow: 0 8px 25px #ad4a722b;
}

.new-chat b {
  font-size: 25px;
  line-height: 20px;
}

.history-heading {
  font-size: 17px;
  font-weight: 600;
  padding: 30px 5px 14px;
}

.history {
  overflow: auto;
  flex: 1;
}

.history-item {
  width: 100%;
  text-align: right;
  display: block;
  border: 1px solid transparent;
  background: #2b222b;
  color: #f4eaf2;
  border-radius: 15px;
  padding: 14px 15px;
  margin: 7px 0;
  cursor: pointer;
  font: inherit;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-item:hover,
.history-item.active {
  background: #392a37;
  border-color: #74516b;
}

.empty-history {
  color: #a996a7;
  font-size: 13px;
  padding: 12px 5px;
}

.side-foot {
  border-top: 1px solid #453344;
  padding: 15px 4px 0;
  color: #a995a8;
  font-size: 12px;
}

.topbar {
  height: 78px;
  flex: 0 0 78px;
  border-bottom: 1px solid #50394b;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 0 31px;
  gap: 14px;
}

.top-title {
  font-size: 19px;
  font-weight: 600;
}

.chat-icon {
  color: #e8b0cd;
  font-size: 24px;
  margin-right: 2px;
}

.icon-btn {
  display: none;
  background: transparent;
  border: 1px solid var(--border);
  color: white;
  border-radius: 9px;
  padding: 7px;
}

.welcome {
  margin: auto;
  width: min(760px, calc(100% - 48px));
  padding: 12px 0 82px;
  text-align: center;
}

.heart-flourish {
  font-size: 54px;
  color: var(--pink);
  line-height: 1;
  margin-bottom: 13px;
  text-shadow: 0 0 25px #d978a866;
}

.welcome h1 {
  font-size: 48px;
  margin: 0 0 6px;
  font-weight: 700;
  letter-spacing: -1px;
}

.welcome > p {
  color: #ddc9d8;
  font-size: 21px;
  margin: 0 0 32px;
}

.setup-card {
  background: transparent;
  text-align: right;
}

.setup-card > label {
  display: block;
  color: #f1e4ee;
  font-size: 17px;
  font-weight: 600;
  margin: 0 14px 8px;
}

.name-field {
  display: flex;
  align-items: center;
  gap: 8px;
  width: min(580px, 100%);
  margin: 0 auto 32px;
  border: 1px solid #78516b;
  background: #30232e;
  border-radius: 15px;
  padding: 0 15px;
}

.name-field input {
  width: 100%;
  border: 0;
  background: transparent;
  color: #fff;
  padding: 14px 5px;
  font: 16px 'IBM Plex Sans Arabic', Arial, sans-serif;
  outline: none;
}

.name-field input::placeholder {
  color: #c8b1c1;
}

.name-field span {
  color: #dba8c4;
  font-size: 22px;
}

.personas {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 26px;
  width: min(620px, 100%);
  margin: 0 auto 20px;
  direction: rtl;
}

.persona {
  border: 1px solid #76506b;
  background: linear-gradient(145deg, #352731, #2c202c);
  color: #fff;
  border-radius: 21px;
  padding: 0 0 13px;
  overflow: hidden;
  cursor: pointer;
  font: inherit;
  position: relative;
  transition: 0.18s;
}

.persona:hover,
.persona.selected {
  border-color: #e58fb5;
  box-shadow: 0 0 0 2px #d57b9f33, 0 12px 35px #110b1240;
  transform: translateY(-2px);
}

.portrait {
  height: 170px;
  display: block;
  background: linear-gradient(145deg, #39283a, #58344b);
}

.portrait svg {
  width: 100%;
  height: 100%;
  display: block;
}

.persona b {
  display: block;
  font-size: 19px;
  margin-top: 8px;
}

.radio {
  display: block;
  width: 18px;
  height: 18px;
  border: 2px solid #d6a9c4;
  border-radius: 50%;
  margin: 7px auto 0;
}

.persona.selected .radio {
  border: 5px solid var(--pink);
}

.privacy-note {
  width: min(740px, 100%);
  margin: 0 auto 9px;
  background: #392735;
  border: 1px solid #593c51;
  border-radius: 14px;
  padding: 12px 15px;
  display: flex;
  gap: 12px;
  align-items: center;
  text-align: right;
  color: #e7d9e4;
  font-size: 13px;
  line-height: 1.6;
}

.info {
  color: #f0a2c0;
  font-size: 22px;
}

.age-check {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 9px;
  color: #eadde7;
  font-size: 13px;
  line-height: 1.7;
  margin: 11px 0 0;
}

.age-check input {
  accent-color: var(--pink);
  margin-top: 5px;
  width: 17px;
  height: 17px;
}

.chat-view {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.messages {
  flex: 1;
  overflow: auto;
  width: min(850px, 100%);
  margin: 0 auto;
  padding: 26px 22px 170px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.message {
  max-width: 88%;
  display: flex;
  gap: 11px;
  align-items: flex-start;
}

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

.message.assistant {
  align-self: flex-end;
}

.message .m-avatar {
  flex: 0 0 32px;
  height: 32px;
  border-radius: 50%;
  background: #57374f;
  color: #f2bbd4;
  display: grid;
  place-items: center;
  font-size: 13px;
}

.message.user .m-avatar {
  background: #34485d;
  color: #c1e0fb;
}

.bubble {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.85;
  border: 1px solid #503a4d;
  background: #302431;
  border-radius: 4px 16px 16px 16px;
  padding: 12px 15px;
  color: #f4edf3;
}

.message.user .bubble {
  background: #493342;
  border-radius: 16px 4px 16px 16px;
}

.composer-wrap {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 15px 26px 12px;
  background: linear-gradient(0deg, #17121a 74%, transparent);
}

.composer {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px;
  border: 1px solid #79556d;
  background: #2c222c;
  border-radius: 19px;
  box-shadow: 0 10px 40px #0004;
}

.composer textarea {
  resize: none;
  max-height: 140px;
  flex: 1;
  border: 1px solid transparent;
  background: transparent;
  color: #fff;
  outline: none;
  padding: 10px 12px;
  font: 16px/1.6 'IBM Plex Sans Arabic', Arial, sans-serif;
}

.composer textarea::placeholder {
  color: #bba7b8;
}

.composer button {
  width: 49px;
  height: 43px;
  flex: 0 0 49px;
  border: 0;
  border-radius: 13px;
  background: linear-gradient(145deg, #e891b4, #be678c);
  color: #fff;
  font-size: 23px;
  cursor: pointer;
}

.composer button:disabled {
  opacity: 0.5;
}

.fine-print {
  text-align: center;
  font-size: 10px;
  color: #99889a;
  margin-top: 5px;
}

.typing {
  display: flex;
  align-items: center;
  gap: 5px;
  color: #c7b2c4;
  font-size: 12px;
  padding: 0 9px 7px;
}

.typing i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #e3a0c2;
  animation: pulse 0.9s infinite alternate;
}

.typing i:nth-child(2) {
  animation-delay: 0.2s;
}

.typing i:nth-child(3) {
  animation-delay: 0.4s;
}

.typing span {
  margin-right: 4px;
}

.hidden {
  display: none !important;
}

.toast {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  background: #4a2d45;
  color: white;
  padding: 11px 17px;
  border-radius: 10px;
  opacity: 0;
  pointer-events: none;
  transition: 0.2s;
  z-index: 8;
}

.toast.show {
  opacity: 1;
}

@keyframes pulse {
  to {
    opacity: 0.25;
    transform: translateY(-3px);
  }
}

.seo-content {
  max-width: 980px;
  margin: 0 auto;
  padding: 56px 24px 25px;
  color: #e9dce7;
  line-height: 1.9;
}

.seo-content h2 {
  font-size: 22px;
  color: #f1bdd5;
  margin: 0 0 8px;
}

.seo-content p {
  font-size: 16px;
  color: #c9b8c8;
  margin: 0 0 28px;
}

.seo-links {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}

.seo-links a,
.site-footer a {
  color: #efa4c3;
  text-decoration: none;
}

.site-footer {
  text-align: center;
  border-top: 1px solid #463444;
  color: #9b8b9b;
  padding: 18px;
  font-size: 12px;
}

.seo-content details {
  background: #2b222b;
  border: 1px solid #513b50;
  border-radius: 12px;
  padding: 12px 15px;
  margin: 10px 0;
  color: #e9dce7;
}

.seo-content summary {
  cursor: pointer;
  color: #f0b3d0;
  font-weight: 600;
}

.seo-content details p {
  margin: 8px 0 0;
  font-size: 14px;
}

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

  .sidebar {
    padding: 28px 19px;
  }

  .brand {
    font-size: 27px;
  }

  .welcome h1 {
    font-size: 39px;
  }

  .welcome {
    width: min(700px, calc(100% - 36px));
  }

  .portrait {
    height: 145px;
  }
}

@media (max-width: 700px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    display: none;
    position: fixed;
    z-index: 5;
    inset: 0 0 0 auto;
    width: min(330px, 86vw);
    box-shadow: 0 0 0 100vw #0009;
  }

  .sidebar.open {
    display: flex;
  }

  .main {
    grid-column: 1;
    grid-row: 1;
  }

  .icon-btn {
    display: block;
  }

  .topbar {
    height: 61px;
    flex-basis: 61px;
    padding: 0 15px;
  }

  .welcome {
    padding: 10px 0 105px;
    width: calc(100% - 26px);
  }

  .welcome h1 {
    font-size: 32px;
  }

  .welcome > p {
    font-size: 16px;
    margin-bottom: 24px;
  }

  .heart-flourish {
    font-size: 42px;
  }

  .name-field {
    margin-bottom: 20px;
  }

  .personas {
    gap: 12px;
    margin-bottom: 14px;
  }

  .portrait {
    height: 112px;
  }

  .persona {
    border-radius: 16px;
  }

  .persona b {
    font-size: 16px;
  }

  .privacy-note {
    font-size: 11px;
    padding: 9px 11px;
  }

  .age-check {
    font-size: 11px;
  }

  .composer-wrap {
    padding: 11px 12px 8px;
  }

  .composer {
    gap: 7px;
  }

  .composer button {
    width: 42px;
    flex-basis: 42px;
  }

  .messages {
    padding: 18px 13px 150px;
  }

  .message {
    max-width: 95%;
  }
}