:root {
  --bg: #2e2b2b;
  --card: #050505;
  --card-edge: rgba(255, 255, 255, 0.08);
  --text: #f4f2eb;
  --muted: rgba(244, 242, 235, 0.64);
  --subtle: rgba(255, 255, 255, 0.08);
  --input: rgba(30, 34, 38, 0.92);
  --bubble-user: #1f1f22;
  --accent: #29d37d;
  --accent-soft: rgba(41, 211, 125, 0.28);
  --shadow: 0 28px 80px rgba(0, 0, 0, 0.38);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "Manrope", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 50% 10%, rgba(255, 255, 255, 0.06), transparent 30%),
    radial-gradient(circle at 50% 90%, rgba(0, 0, 0, 0.34), transparent 35%),
    var(--bg);
}

.app-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px 16px;
}

.app-card {
  position: relative;
  width: min(100%, 390px);
  height: min(820px, calc(100vh - 32px));
  max-height: calc(100vh - 32px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 28px;
  border: 1px solid var(--card-edge);
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 221, 76, 0.9), rgba(94, 170, 95, 0.55) 34%, rgba(7, 17, 9, 0.22) 58%, rgba(0, 0, 0, 0) 70%),
    radial-gradient(circle at 50% 100%, rgba(38, 214, 118, 0.52), rgba(0, 0, 0, 0) 22%),
    linear-gradient(180deg, #051109 0%, #030403 50%, #020202 100%);
  box-shadow: var(--shadow);
  isolation: isolate;
}

.app-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 18%, rgba(255, 236, 159, 0.14), transparent 24%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent 18%, transparent 82%, rgba(255, 255, 255, 0.02));
  pointer-events: none;
  z-index: -1;
}

.app-card__glow {
  position: absolute;
  inset: auto 12% -18% 12%;
  height: 220px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(41, 211, 125, 0.42) 0%, rgba(41, 211, 125, 0) 72%);
  filter: blur(20px);
  opacity: 0.8;
  pointer-events: none;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 3;
  flex: 0 0 auto;
  padding: 14px 18px 8px;
  background: linear-gradient(180deg, rgba(86, 132, 49, 0.18) 0%, rgba(86, 132, 49, 0.06) 72%, rgba(86, 132, 49, 0) 100%);
}

.app-header__identity {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.app-header__badge {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.app-header__badge img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: center top;
}

.app-header__text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.app-header__text strong {
  font-size: 0.7rem;
  font-weight: 700;
}

.app-header__text span {
  font-size: 0.62rem;
  color: var(--muted);
}

.chat-stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  padding: 6px 18px 12px;
}

.intro {
  flex: 1;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 16px;
  padding: 0 24px 0;
  text-align: center;
  transition: opacity 220ms ease, transform 220ms ease;
}

.intro.is-hidden {
  display: none;
  flex: 0 0 auto;
  opacity: 0;
  transform: translateY(-8px);
  pointer-events: none;
  height: 0;
  min-height: 0;
  margin: 0;
  overflow: hidden;
  padding: 0;
}

.intro__avatar {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  overflow: hidden;
  border: 3px solid rgba(226, 218, 63, 0.82);
  box-shadow: 0 0 0 6px rgba(255, 255, 255, 0.05);
}

.intro__avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
}

.intro h1 {
  max-width: 304px;
  margin: 0;
  color: rgba(255, 255, 255, 0.96);
  font-size: clamp(1.1rem, 4.4vw, 1.55rem);
  line-height: 1.3;
  font-weight: 500;
}

.intro h1 strong {
  font-weight: 800;
}

.message-list {
  display: none;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 6px 4px 10px;
  gap: 18px;
  overscroll-behavior: contain;
}

.message-list.is-active {
  display: flex;
  flex-direction: column;
}

.message-list::-webkit-scrollbar {
  width: 6px;
}

.message-list::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
}

.message {
  display: flex;
}

.message--user {
  justify-content: flex-end;
}

.message__bubble {
  max-width: 82%;
  padding: 14px 16px;
  border-radius: 24px;
  color: rgba(255, 255, 255, 0.92);
  font-size: 0.98rem;
  line-height: 1.5;
  white-space: pre-wrap;
}

.message__bubble p,
.message__bubble ul {
  margin: 0;
}

.message__bubble p + p,
.message__bubble ul + p,
.message__bubble p + ul {
  margin-top: 10px;
}

.message__bubble ul {
  padding-left: 1.1rem;
}

.message__bubble li + li {
  margin-top: 4px;
}

.message__bubble strong {
  font-weight: 800;
}

.message--user .message__bubble {
  background: var(--bubble-user);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.03);
}

.message:not(.message--user) .message__bubble {
  padding-left: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.86);
}

.message--typing .message__bubble {
  color: rgba(255, 255, 255, 0.68);
  letter-spacing: 0.32em;
}

.quick-actions {
  display: none !important;
}

.composer-wrap {
  position: sticky;
  bottom: 0;
  z-index: 3;
  flex: 0 0 auto;
  padding: 0 18px 22px;
  background: linear-gradient(180deg, rgba(2, 2, 2, 0) 0%, rgba(2, 2, 2, 0.88) 22%, rgba(2, 2, 2, 0.96) 100%);
  backdrop-filter: blur(10px);
}

.composer {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 10px 10px 18px;
  border-radius: 999px;
  background: var(--input);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.composer input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.94);
  font: inherit;
  font-size: 16px;
}

.composer input::placeholder {
  color: rgba(255, 255, 255, 0.36);
}

.send-button {
  width: 46px;
  height: 46px;
  flex: 0 0 auto;
  border: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #f2ffe7;
  cursor: pointer;
  background: linear-gradient(180deg, #31e48b 0%, #1cc16b 100%);
  box-shadow: 0 0 18px var(--accent-soft);
  transition: transform 180ms ease, box-shadow 180ms ease, opacity 180ms ease;
}

.send-button:hover,
.send-button:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 0 22px rgba(41, 211, 125, 0.42);
  outline: none;
}

.send-button:disabled {
  opacity: 0.7;
  cursor: wait;
}

.send-button svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

.disclaimer {
  margin: 14px auto 0;
  max-width: 280px;
  text-align: center;
  color: rgba(255, 255, 255, 0.28);
  font-family: "Inter", sans-serif;
  font-size: 0.42rem;
  line-height: 1.45;
}

.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;
}

@media (max-width: 480px) {
  html,
  body {
    height: 100%;
    min-height: 100%;
    overflow: hidden;
  }

  .app-shell {
    min-height: 100%;
    height: 100%;
    display: block;
    overflow: hidden;
    padding: 0;
  }

  .app-card {
    width: 100%;
    min-height: 100%;
    height: 100%;
    max-height: 100%;
    border-radius: 0;
    border: 0;
  }

  .chat-stage {
    padding-inline: 16px;
    padding-top: 4px;
  }

  .composer-wrap {
    padding-inline: 16px;
    padding-bottom: calc(18px + env(safe-area-inset-bottom, 0px));
  }

  .composer {
    gap: 12px;
    padding: 10px 10px 10px 16px;
  }

  .composer input {
    font-size: 16px;
  }

  .send-button {
    width: 44px;
    height: 44px;
  }
}
