:root {
  --page-bg: #fcfaf8;
  --page-bg-alt: #f6eee7;
  --surface: rgba(255, 255, 255, 0.88);
  --surface-strong: #ffffff;
  --surface-soft: #f6eae1;
  --ink: #111111;
  --ink-soft: #6f675f;
  --line: rgba(17, 17, 17, 0.08);
  --line-strong: rgba(17, 17, 17, 0.14);
  --accent: #cb9557;
  --accent-deep: #b87c43;
  --shadow: 0 26px 70px rgba(24, 20, 15, 0.08);
  --shadow-soft: 0 12px 28px rgba(24, 20, 15, 0.06);
  --radius-xl: 34px;
  --radius-lg: 28px;
  --radius-md: 20px;
  --radius-pill: 999px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  font-family: "Manrope", sans-serif;
  background:
    radial-gradient(circle at 10% 12%, rgba(203, 149, 87, 0.16), transparent 22%),
    radial-gradient(circle at 88% 8%, rgba(203, 149, 87, 0.1), transparent 18%),
    linear-gradient(180deg, #fffdfb 0%, #fcfaf8 55%, #f7f1ea 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(17, 17, 17, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(17, 17, 17, 0.02) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: radial-gradient(circle at center, black 24%, transparent 86%);
  opacity: 0.28;
}

a,
button,
textarea {
  font: inherit;
}

textarea,
.message-bubble p,
.question-orbit {
  font-family: "Manrope", sans-serif;
}

button {
  border: 0;
  background: none;
  cursor: pointer;
}

img {
  display: block;
  max-width: 100%;
}

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

.page-shell {
  position: relative;
  min-height: 100vh;
  padding: 24px;
  overflow: clip;
}

.stage {
  width: min(100%, 1280px);
  min-height: calc(100vh - 48px);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

.experience {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 620px;
  gap: 28px;
  align-items: center;
  width: 100%;
  transition: grid-template-columns 780ms cubic-bezier(0.22, 1, 0.36, 1), gap 780ms cubic-bezier(0.22, 1, 0.36, 1);
}

.experience.is-chatting {
  grid-template-columns: 0fr minmax(0, 1fr);
  gap: 0;
}

.portrait-stage,
.response-panel {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: rgba(255, 255, 255, 0.66);
  box-shadow: var(--shadow);
}

.portrait-stage {
  min-height: 760px;
  overflow: hidden;
  background:
    radial-gradient(circle at center, rgba(203, 149, 87, 0.12), transparent 26%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.78), rgba(246, 234, 225, 0.76));
  transition:
    opacity 700ms cubic-bezier(0.22, 1, 0.36, 1),
    transform 700ms cubic-bezier(0.22, 1, 0.36, 1),
    min-height 700ms cubic-bezier(0.22, 1, 0.36, 1);
}

.experience.is-chatting .portrait-stage {
  opacity: 0;
  transform: translateX(-24px) scale(0.97);
  pointer-events: none;
  min-height: 0;
}

.portrait-stage::before {
  content: "";
  position: absolute;
  inset: 22px;
  border: 1px solid rgba(203, 149, 87, 0.12);
  border-radius: 28px;
}

.portrait-aura {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 420px;
  height: 420px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(203, 149, 87, 0.14), rgba(203, 149, 87, 0));
  filter: blur(8px);
}

.portrait-shell {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 360px;
  height: 500px;
}

.portrait-ring {
  position: absolute;
  inset: 40px 18px 28px;
  border-radius: 220px 220px 34px 34px;
  border: 1px solid rgba(203, 149, 87, 0.18);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.5), rgba(246, 234, 225, 0.14));
}

.portrait-core {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.portrait-core img {
  width: min(88%, 300px);
  filter: drop-shadow(0 20px 36px rgba(17, 17, 17, 0.12));
}

.suggestion-chip,
#send-button {
  font-family: "Plus Jakarta Sans", sans-serif;
}

.suggestion-chip {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 15px;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.76);
  color: var(--ink-soft);
  box-shadow: var(--shadow-soft);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.question-orbit {
  position: absolute;
  max-width: 240px;
  min-height: 58px;
  padding: 12px 18px;
  justify-content: center;
  text-align: center;
  line-height: 1.42;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.9);
  transition:
    transform 180ms ease,
    box-shadow 180ms ease,
    border-color 180ms ease;
  animation: float 7s ease-in-out infinite;
}

.question-orbit:hover {
  transform: translateY(-4px);
  border-color: rgba(203, 149, 87, 0.28);
  box-shadow: 0 16px 34px rgba(24, 20, 15, 0.1);
}

.orbit-1 { top: 74px; left: 52px; animation-delay: 0s; }
.orbit-2 { top: 114px; right: 58px; animation-delay: 1s; }
.orbit-3 { left: 38px; top: 50%; animation-delay: 2s; }
.orbit-4 { right: 34px; top: 48%; animation-delay: 3s; }
.orbit-5 { left: 96px; bottom: 106px; animation-delay: 4s; }
.orbit-6 { right: 86px; bottom: 82px; animation-delay: 5s; }

.response-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(460px, 1fr) auto;
  gap: 18px;
  min-height: 760px;
  height: min(820px, calc(100vh - 48px));
  padding: 22px;
  max-width: 620px;
  width: 100%;
  justify-self: end;
  transition:
    max-width 780ms cubic-bezier(0.22, 1, 0.36, 1),
    transform 780ms cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 780ms cubic-bezier(0.22, 1, 0.36, 1);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(246, 234, 225, 0.74));
}

.mobile-presence {
  display: none;
}

.mobile-question-strip {
  display: none;
}

.experience.is-chatting .response-panel {
  max-width: 100%;
  box-shadow: 0 30px 80px rgba(24, 20, 15, 0.1);
}

.chat-messages {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 0;
  overflow: auto;
  padding-right: 10px;
  padding-bottom: 4px;
  overscroll-behavior: contain;
}

.chat-messages::-webkit-scrollbar {
  width: 8px;
}

.chat-messages::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(17, 17, 17, 0.12);
}

.empty-state {
  min-height: 100%;
}

.message-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

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

.social-avatar {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 15px;
  overflow: hidden;
  box-shadow: var(--shadow-soft);
  flex: 0 0 auto;
}

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

.message-bubble {
  max-width: min(94%, 760px);
  padding: 18px 18px 16px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow-soft);
}

.message-bubble a {
  color: var(--accent-deep);
  font-weight: 700;
  text-decoration: none;
}

.message-bubble a:hover {
  text-decoration: underline;
}

.message-bubble strong {
  color: var(--ink);
}

.message-row.user .message-bubble {
  background: linear-gradient(135deg, #1a1714, #2c2621);
  border-color: transparent;
}

.message-bubble p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 1rem;
  line-height: 1.72;
}

.message-row.user .message-bubble p,
.message-row.user .message-bubble strong {
  color: rgba(255, 255, 255, 0.9);
}

.message-bubble p + p {
  margin-top: 12px;
}

.chat-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: end;
}

.chat-form textarea {
  width: 100%;
  min-height: 62px;
  max-height: 180px;
  padding: 18px 18px 16px;
  border: 1px solid var(--line-strong);
  border-radius: 24px;
  resize: none;
  outline: none;
  background: rgba(255, 255, 255, 0.94);
  color: var(--ink);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
  font-size: 1rem;
}

.chat-form textarea::placeholder {
  color: rgba(111, 103, 95, 0.64);
}

.chat-form textarea:focus {
  border-color: rgba(203, 149, 87, 0.38);
  box-shadow:
    0 0 0 4px rgba(203, 149, 87, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

#send-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 126px;
  min-height: 62px;
  padding: 0 22px;
  border-radius: 24px;
  background: var(--accent);
  color: #111111;
  box-shadow: 0 16px 34px rgba(203, 149, 87, 0.24);
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition:
    transform 180ms ease,
    background-color 180ms ease;
}

#send-button:hover:not(:disabled) {
  transform: translateY(-2px);
  background: var(--accent-deep);
}

#send-button:disabled {
  opacity: 0.72;
  cursor: wait;
}

.typing {
  display: inline-flex;
  gap: 6px;
  align-items: center;
}

.typing span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(17, 17, 17, 0.32);
  animation: bounce 1s infinite ease-in-out;
}

.typing span:nth-child(2) { animation-delay: 0.12s; }
.typing span:nth-child(3) { animation-delay: 0.24s; }

.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition:
    opacity 700ms ease,
    transform 700ms ease;
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@keyframes bounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.35; }
  40% { transform: translateY(-4px); opacity: 1; }
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

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

  .experience.is-chatting {
    grid-template-columns: 1fr;
  }

  .response-panel {
    max-width: 100%;
    height: auto;
  }

  .portrait-stage,
  .response-panel {
    min-height: 680px;
  }
}

@media (max-width: 760px) {
  .page-shell {
    padding: 10px;
  }

  .stage {
    min-height: calc(100svh - 20px);
  }

  .portrait-stage {
    display: none;
  }

  .response-panel {
    grid-template-rows: auto minmax(0, 1fr) auto;
    min-height: calc(100svh - 20px);
    height: calc(100svh - 20px);
    padding: 14px;
    gap: 12px;
    border-radius: 26px;
  }

  .mobile-presence {
    position: relative;
    display: grid;
    gap: 10px;
    padding: 4px 0 0;
  }

  .mobile-presence-avatar {
    position: absolute;
    top: -2px;
    right: 4px;
    width: 74px;
    height: 74px;
    border-radius: 22px;
    overflow: hidden;
    opacity: 0.38;
    pointer-events: none;
    box-shadow: 0 16px 28px rgba(24, 20, 15, 0.08);
  }

  .mobile-presence-avatar::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.34));
  }

  .mobile-presence-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }

  .mobile-question-strip {
    display: grid;
    gap: 8px;
    padding-right: 84px;
    margin-bottom: 2px;
  }

  .mobile-question {
    justify-content: flex-start;
    width: 100%;
    min-height: 44px;
    padding: 0 16px;
    text-align: left;
    line-height: 1.35;
    font-size: 0.72rem;
    letter-spacing: 0.05em;
    text-transform: none;
  }

  .chat-form {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .chat-messages {
    padding-right: 6px;
  }

  .message-row {
    gap: 10px;
  }

  .social-avatar {
    width: 38px;
    height: 38px;
    border-radius: 13px;
  }

  .message-bubble {
    max-width: calc(100% - 18px);
    padding: 16px 16px 14px;
    border-radius: 22px;
  }

  .message-bubble p {
    font-size: 0.95rem;
    line-height: 1.62;
  }

  .chat-form textarea {
    min-height: 56px;
    padding: 16px 16px 14px;
    border-radius: 22px;
  }

  #send-button {
    width: 100%;
    min-height: 56px;
    border-radius: 22px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .question-orbit,
  .typing span,
  .reveal,
  #send-button,
  .experience,
  .portrait-stage,
  .response-panel {
    animation: none;
    transition: none;
  }
}
