:root {
  color-scheme: dark;
  --page: #07050c;
  --header: #17131f;
  --composer: #17131f;
  --wall: #0d0a13;
  --incoming: #1a1622;
  --outgoing: #331656;
  --violet: #8b3fe8;
  --violet-mid: #7c3aed;
  --violet-core: #b98bff;
  --violet-glow: #c77dff;
  --mint: #66e2b3;
  --text: #f7f5fa;
  --muted: #b8b0c8;
  --dim: #716b7d;
  --line: rgba(255, 255, 255, 0.09);
  --display: "Space Grotesk", sans-serif;
  --body: "Inter", sans-serif;
  --mono: "JetBrains Mono", monospace;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--page);
}

body {
  color: var(--text);
  font-family: var(--body);
}

button,
textarea {
  font: inherit;
}

button {
  color: inherit;
}

button,
a,
textarea {
  -webkit-tap-highlight-color: transparent;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.chat-app {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: 100%;
  height: 100dvh;
  min-height: 100%;
  margin: 0 auto;
  overflow: hidden;
  background: var(--wall);
}

.chat-header {
  position: relative;
  z-index: 5;
  display: flex;
  min-height: 66px;
  align-items: center;
  padding: max(8px, env(safe-area-inset-top)) 10px 8px;
  border-bottom: 1px solid var(--line);
  background: rgba(23, 19, 31, 0.97);
  box-shadow: 0 3px 16px rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(18px);
}

.header-icon {
  display: grid;
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  padding: 0;
  cursor: pointer;
  place-items: center;
  border: 0;
  border-radius: 50%;
  color: var(--muted);
  background: transparent;
}

.header-icon:hover,
.header-icon:focus-visible {
  color: white;
  background: rgba(255, 255, 255, 0.06);
  outline: none;
}

.header-icon svg,
.send-button svg,
.modal-header svg,
.security-chip svg {
  width: 21px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.back-icon {
  margin-left: -4px;
}

.avatar {
  position: relative;
  width: 43px;
  height: 43px;
  flex: 0 0 auto;
  padding: 3px;
  border: 1px solid rgba(185, 139, 255, 0.35);
  border-radius: 50%;
  background: #09070e;
  box-shadow: 0 0 22px rgba(139, 63, 232, 0.16);
}

.avatar::after {
  position: absolute;
  right: -1px;
  bottom: 1px;
  width: 10px;
  height: 10px;
  content: "";
  border: 2px solid var(--header);
  border-radius: 50%;
  background: var(--mint);
}

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

.contact-data {
  display: grid;
  min-width: 0;
  flex: 1;
  gap: 3px;
  margin-left: 10px;
}

.contact-data strong {
  overflow: hidden;
  font: 600 0.96rem/1.1 var(--display);
  letter-spacing: -0.015em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.contact-data strong span {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 500;
}

.contact-data small {
  color: var(--mint);
  font-size: 0.67rem;
}

.chat-wallpaper {
  position: relative;
  min-height: 0;
  padding: 12px 10px 18px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  background:
    radial-gradient(circle at 10% 10%, rgba(139, 63, 232, 0.07), transparent 28%),
    radial-gradient(circle at 92% 84%, rgba(67, 14, 144, 0.09), transparent 30%),
    var(--wall);
  scrollbar-color: rgba(185, 139, 255, 0.22) transparent;
}

.chat-wallpaper::before {
  position: fixed;
  inset: 66px 0 68px;
  pointer-events: none;
  content: "";
  opacity: 0.22;
  background-image:
    url("data:image/svg+xml,%3Csvg width='96' height='96' viewBox='0 0 96 96' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' stroke='%238b3fe8' stroke-opacity='.16' stroke-width='.7'%3E%3Cpath d='M16 19h9v9h-9zM68 12l7 7-7 7-7-7zM45 62h12M51 56v12M14 70c9-6 17 5 9 11M76 65c-7 0-9 10-2 13'/%3E%3Ccircle cx='48' cy='22' r='6'/%3E%3C/g%3E%3C/svg%3E");
}

.date-chip,
.security-chip {
  position: relative;
  z-index: 1;
  width: fit-content;
  margin-inline: auto;
  border: 1px solid var(--line);
  color: #9e97a8;
  background: rgba(22, 18, 29, 0.94);
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.15);
}

.date-chip {
  margin-bottom: 8px;
  padding: 5px 9px;
  border-radius: 7px;
  font: 500 0.56rem/1 var(--mono);
}

.security-chip {
  display: flex;
  max-width: 410px;
  align-items: center;
  gap: 7px;
  margin-bottom: 14px;
  padding: 7px 10px;
  border-color: rgba(102, 226, 179, 0.11);
  border-radius: 8px;
  color: #899e97;
  font-size: 0.58rem;
  line-height: 1.4;
  text-align: center;
}

.security-chip svg {
  width: 13px;
  flex: 0 0 auto;
}

.messages,
.quick-replies,
.typing-bubble {
  position: relative;
  z-index: 1;
}

.message-row {
  display: flex;
  margin-bottom: 5px;
  animation: message-in 0.35s cubic-bezier(0.2, 0.78, 0.2, 1) both;
}

.message-row.outgoing {
  justify-content: flex-end;
}

.message-bubble {
  position: relative;
  width: fit-content;
  max-width: min(87%, 590px);
  padding: 8px 9px 6px;
  border: 1px solid var(--line);
  border-radius: 5px 12px 12px;
  color: #f0edf4;
  background: var(--incoming);
  box-shadow: 0 5px 13px rgba(0, 0, 0, 0.15);
  font-size: 0.86rem;
  line-height: 1.46;
}

.message-bubble::before {
  position: absolute;
  top: -1px;
  left: -7px;
  width: 9px;
  height: 10px;
  content: "";
  background: linear-gradient(225deg, var(--incoming) 50%, transparent 51%);
}

.outgoing .message-bubble {
  border-color: rgba(185, 139, 255, 0.22);
  border-radius: 12px 5px 12px 12px;
  background: var(--outgoing);
}

.outgoing .message-bubble::before {
  right: -7px;
  left: auto;
  background: linear-gradient(135deg, var(--outgoing) 50%, transparent 51%);
}

.message-bubble p {
  margin: 0 0 7px;
}

.message-bubble p:last-of-type {
  margin-bottom: 0;
}

.message-bubble strong {
  color: white;
}

.message-label {
  display: block;
  margin-bottom: 4px;
  color: var(--violet-core);
  font-size: 0.66rem;
  font-weight: 700;
}

.message-meta {
  display: flex;
  min-width: 53px;
  align-items: center;
  justify-content: flex-end;
  gap: 3px;
  margin-top: 3px;
  color: #766f7e;
  font: 500 0.54rem/1 var(--mono);
}

.message-meta .ticks {
  color: #6fc5ee;
  font-family: var(--body);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: -0.34em;
  transform: translateX(-2px);
}

.typing-bubble {
  width: fit-content;
  margin: 1px 0 7px;
  padding: 10px 13px;
  border: 1px solid var(--line);
  border-radius: 5px 13px 13px;
  background: var(--incoming);
}

.typing-bubble span {
  display: inline-block;
  width: 5px;
  height: 5px;
  margin: 0 1.5px;
  border-radius: 50%;
  background: var(--violet-core);
  animation: typing 1s infinite ease-in-out;
}

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

.quick-replies {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 7px;
  margin: 9px 0 3px;
}

.quick-reply {
  min-height: 39px;
  padding: 8px 12px;
  cursor: pointer;
  border: 1px solid rgba(185, 139, 255, 0.38);
  border-radius: 999px;
  color: #dcc8f8;
  background: rgba(124, 58, 237, 0.12);
  font-size: 0.73rem;
  font-weight: 650;
  transition: 160ms ease;
}

.quick-reply:hover,
.quick-reply:focus-visible {
  border-color: var(--violet-core);
  color: white;
  background: rgba(124, 58, 237, 0.23);
  outline: none;
  transform: translateY(-1px);
}

.quick-reply.secondary {
  border-color: rgba(255, 255, 255, 0.13);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.035);
}

.composer {
  position: relative;
  z-index: 6;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 9px 9px max(9px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: rgba(23, 19, 31, 0.98);
  box-shadow: 0 -4px 18px rgba(0, 0, 0, 0.2);
}

.message-field {
  display: flex;
  min-height: 45px;
  flex: 1;
  align-items: center;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 23px;
  background: #211c29;
}

.message-field:focus-within {
  border-color: rgba(185, 139, 255, 0.38);
}

.message-field textarea {
  width: 100%;
  max-height: 110px;
  padding: 11px 0;
  resize: none;
  overflow-y: auto;
  border: 0;
  color: white;
  background: transparent;
  font-size: 0.87rem;
  line-height: 1.35;
  outline: none;
}

.message-field textarea::placeholder {
  color: #8b8492;
}

.send-button {
  display: grid;
  width: 45px;
  height: 45px;
  flex: 0 0 auto;
  padding: 0;
  cursor: pointer;
  place-items: center;
  border: 0;
  border-radius: 50%;
  color: white;
  background: linear-gradient(180deg, #aa62fb, #7c3aed);
  box-shadow: 0 8px 22px rgba(124, 58, 237, 0.28);
  transition: 160ms ease;
}

.send-button:disabled {
  cursor: default;
  color: #77717e;
  background: #2c2634;
  box-shadow: none;
}

.send-button:not(:disabled):hover,
.send-button:not(:disabled):focus-visible {
  outline: none;
  transform: scale(1.04);
}

.sites-message,
.portal-message,
.offer-message,
.checkout-message {
  width: min(86vw, 560px);
  max-width: 100%;
  margin: -8px -9px -6px;
  overflow: hidden;
  border-radius: inherit;
}

.card-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 13px 10px;
}

.card-kicker {
  margin: 0 0 4px;
  color: var(--violet-core);
  font: 500 0.55rem/1 var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.card-heading h2,
.portal-top h2,
.offer-top h2 {
  margin: 0;
  font: 600 1rem/1.18 var(--display);
  letter-spacing: -0.025em;
}

.carousel-count {
  color: var(--dim);
  font: 500 0.56rem/1 var(--mono);
}

.site-track {
  display: flex;
  gap: 9px;
  padding: 0 13px 5px;
  overflow-x: auto;
  scroll-behavior: smooth;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}

.site-track::-webkit-scrollbar { display: none; }

.site-card {
  --accent: #b98bff;
  width: calc(100% - 18px);
  min-width: calc(100% - 18px);
  padding: 0;
  overflow: hidden;
  cursor: pointer;
  scroll-snap-align: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: white;
  background: #0c0911;
  text-align: left;
}

.site-card:focus-visible,
.site-card:hover {
  border-color: color-mix(in srgb, var(--accent) 54%, transparent);
  outline: none;
}

.site-preview {
  position: relative;
  height: 136px;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(145deg, #1a1523, #0b0910);
}

.site-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  display: block;
}

.open-site {
  position: absolute;
  right: 9px;
  bottom: 8px;
  padding: 5px 7px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  color: rgba(255, 255, 255, 0.72);
  background: rgba(7, 5, 12, 0.64);
  font: 500 0.53rem/1 var(--mono);
  backdrop-filter: blur(7px);
}

.site-copy {
  padding: 10px 11px 11px;
}

.site-copy small {
  color: var(--accent);
  font: 500 0.53rem/1 var(--mono);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.site-copy strong {
  display: block;
  margin: 6px 0 3px;
  font: 600 0.86rem/1.15 var(--display);
}

.site-copy span {
  display: block;
  color: var(--muted);
  font-size: 0.64rem;
  line-height: 1.4;
}

.carousel-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 13px 11px;
}

.carousel-dots,
.carousel-arrows {
  display: flex;
  gap: 5px;
}

.carousel-dot {
  width: 14px;
  height: 3px;
  padding: 0;
  cursor: pointer;
  border: 0;
  border-radius: 9px;
  background: #443b4d;
}

.carousel-dot.active {
  width: 25px;
  background: var(--violet-core);
}

.carousel-arrow {
  display: grid;
  width: 30px;
  height: 30px;
  padding: 0;
  cursor: pointer;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.035);
}

.carousel-arrow:disabled { opacity: 0.28; cursor: default; }

.portal-top,
.offer-top {
  padding: 14px;
  background: radial-gradient(circle at 92% 0, rgba(185, 139, 255, 0.14), transparent 42%);
}

.portal-top > p:last-child,
.offer-top > p:last-child {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 0.68rem;
  line-height: 1.45;
}

.portal-link {
  display: block;
  width: fit-content;
  max-width: 100%;
  margin-top: 9px;
  overflow: hidden;
  padding: 5px 7px;
  border: 1px solid rgba(102, 226, 179, 0.16);
  border-radius: 6px;
  color: #83d6b6;
  background: rgba(102, 226, 179, 0.04);
  font: 500 0.53rem/1 var(--mono);
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.portal-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  border-top: 1px solid var(--line);
  background: var(--line);
}

.portal-item {
  min-height: 91px;
  padding: 10px;
  background: #110e18;
}

.portal-item small {
  display: block;
  margin-bottom: 10px;
  color: var(--violet-core);
  font: 500 0.52rem/1 var(--mono);
}

.portal-item strong {
  display: block;
  margin-bottom: 3px;
  font-size: 0.69rem;
}

.portal-item span {
  display: block;
  color: var(--dim);
  font-size: 0.59rem;
  line-height: 1.35;
}

.price {
  display: flex;
  align-items: flex-end;
  gap: 5px;
  margin: 8px 0;
}

.price strong {
  font: 700 2rem/0.9 var(--display);
  letter-spacing: -0.055em;
}

.price span {
  color: var(--muted);
  font-size: 0.7rem;
}

.offer-facts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  border-top: 1px solid var(--line);
  background: var(--line);
}

.offer-fact {
  padding: 10px 7px;
  background: #110e18;
  text-align: center;
}

.offer-fact strong {
  display: block;
  font: 600 0.63rem/1.2 var(--display);
}

.offer-fact span {
  display: block;
  margin-top: 3px;
  color: var(--dim);
  font-size: 0.52rem;
}

.checkout-card {
  padding: 14px;
  background: radial-gradient(circle at 95% 2%, rgba(185, 139, 255, 0.17), transparent 42%);
}

.checkout-summary {
  display: grid;
  gap: 7px;
  margin: 9px 0 12px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(0, 0, 0, 0.13);
}

.checkout-line {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 0.67rem;
}

.checkout-line strong {
  color: white;
  white-space: nowrap;
}

.checkout-link {
  position: relative;
  display: flex;
  min-height: 47px;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  overflow: hidden;
  padding: 10px 13px;
  border-radius: 10px;
  color: white;
  background: linear-gradient(180deg, #ad67fc, #7c3aed);
  box-shadow: 0 12px 30px rgba(124, 58, 237, 0.28), inset 0 1px rgba(255, 255, 255, 0.22);
  font-size: 0.73rem;
  font-weight: 700;
  text-decoration: none;
}

.checkout-link::after {
  content: "↗";
  font-size: 1rem;
}

.checkout-link:hover,
.checkout-link:focus-visible {
  outline: 2px solid rgba(185, 139, 255, 0.5);
  outline-offset: 2px;
}

.checkout-note {
  margin: 9px 0 0;
  color: var(--dim);
  font-size: 0.56rem;
  line-height: 1.45;
  text-align: center;
}

.site-dialog {
  width: min(1120px, 100%);
  height: 100dvh;
  max-width: none;
  max-height: none;
  margin: auto;
  padding: 0;
  overflow: hidden;
  border: 0;
  color: white;
  background: #09070d;
}

.site-dialog::backdrop {
  background: rgba(4, 3, 7, 0.92);
}

.modal-header {
  display: flex;
  min-height: 62px;
  align-items: center;
  gap: 8px;
  padding: max(8px, env(safe-area-inset-top)) 10px 8px;
  border-bottom: 1px solid var(--line);
  background: #17131f;
}

.modal-back,
.modal-close {
  display: flex;
  min-height: 39px;
  align-items: center;
  gap: 4px;
  padding: 7px 9px;
  cursor: pointer;
  border: 0;
  border-radius: 9px;
  color: var(--muted);
  background: transparent;
}

.modal-back:hover,
.modal-close:hover {
  color: white;
  background: rgba(255, 255, 255, 0.06);
}

.modal-back svg,
.modal-close svg { width: 18px; }
.modal-back span { font-size: 0.7rem; }

.modal-title {
  display: grid;
  min-width: 0;
  flex: 1;
  gap: 3px;
  text-align: center;
}

.modal-title strong {
  font: 600 0.85rem/1 var(--display);
}

.modal-title small {
  overflow: hidden;
  color: var(--dim);
  font: 500 0.51rem/1 var(--mono);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.iframe-shell {
  position: relative;
  height: calc(100% - 62px);
}

.iframe-shell iframe {
  width: 100%;
  height: 100%;
  border: 0;
  background: white;
}

.iframe-shell p {
  position: absolute;
  right: 9px;
  bottom: max(9px, env(safe-area-inset-bottom));
  max-width: calc(100% - 18px);
  margin: 0;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: #aaa3b2;
  background: rgba(10, 8, 15, 0.86);
  font-size: 0.55rem;
  line-height: 1.35;
  pointer-events: none;
  backdrop-filter: blur(7px);
}

.toast {
  position: fixed;
  right: 12px;
  bottom: 78px;
  z-index: 20;
  max-width: min(360px, calc(100% - 24px));
  padding: 11px 13px;
  border: 1px solid rgba(185, 139, 255, 0.3);
  border-radius: 9px;
  color: #f0edf4;
  background: rgba(23, 19, 31, 0.97);
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.46);
  font-size: 0.7rem;
  line-height: 1.4;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: 170ms ease;
}

.toast.visible { opacity: 1; transform: translateY(0); }

.noscript {
  position: fixed;
  inset: 12px;
  z-index: 50;
  display: grid;
  place-items: center;
  border-radius: 12px;
  color: white;
  background: #7c3aed;
  text-align: center;
}

@keyframes message-in {
  from { opacity: 0; transform: translateY(8px) scale(0.988); }
}

@keyframes typing {
  0%, 62%, 100% { opacity: 0.35; transform: translateY(0); }
  31% { opacity: 1; transform: translateY(-3px); }
}

@media (min-width: 760px) {
  body {
    background:
      linear-gradient(rgba(139, 63, 232, 0.025) 1px, transparent 1px),
      linear-gradient(90deg, rgba(139, 63, 232, 0.025) 1px, transparent 1px),
      radial-gradient(circle at 50% 15%, rgba(139, 63, 232, 0.14), transparent 42%),
      var(--page);
    background-size: 42px 42px, 42px 42px, auto, auto;
  }

  .chat-app {
    max-width: 860px;
    border-inline: 1px solid rgba(185, 139, 255, 0.12);
    box-shadow: 0 0 90px rgba(0, 0, 0, 0.62);
  }

  .chat-wallpaper {
    padding: 18px 34px 24px;
  }

  .chat-wallpaper::before {
    left: 50%;
    width: 860px;
    transform: translateX(-50%);
  }

  .composer {
    padding-inline: 22px;
  }

  .site-dialog {
    height: min(850px, calc(100dvh - 26px));
    border: 1px solid rgba(185, 139, 255, 0.24);
    border-radius: 16px;
    box-shadow: 0 35px 110px rgba(0, 0, 0, 0.75);
  }
}

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