@font-face {
  font-family: "Noto Naskh Arabic";
  src: url("/static/fonts/NotoNaskhArabic.woff2") format("woff2");
  font-weight: 400 600;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #0a0610;
  --bg-2: #120a18;
  --text: #f8eee8;
  --text-soft: #d9c9cf;
  --muted: #a08f9e;
  --muted-2: #7e6f7d;
  --pomegranate: #ff4d6d;
  --pomegranate-deep: #d92d55;
  --coral: #ff7a59;
  --saffron: #ffc857;
  --jade: #4ee0a8;
  --violet: #8b5cf6;
  --glass: rgba(255, 255, 255, 0.055);
  --glass-strong: rgba(255, 255, 255, 0.09);
  --line: rgba(255, 255, 255, 0.11);
  --line-strong: rgba(255, 255, 255, 0.18);
  --user-1: #e33b5e;
  --user-2: #b8324c;
  --font-ar: "Noto Naskh Arabic", "Segoe UI", Tahoma;
  --font-sans: "Söhne", "Styrene B", -apple-system, BlinkMacSystemFont, "Segoe UI",
    Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-zh: "Microsoft YaHei", "Noto Sans SC", "PingFang SC", sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  height: 100%;
  margin: 0;
}

body {
  color: var(--text);
  font-family: var(--font-ar), var(--font-sans), var(--font-zh), sans-serif;
  font-size: 16px;
  background: var(--bg);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

button,
textarea {
  font-family: inherit;
}

.zh {
  font-family: var(--font-zh);
  direction: ltr;
  unicode-bidi: isolate;
}

.svg-defs {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

/* -------------------------------------------------------------- background */
.scene {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  background: radial-gradient(ellipse at 50% 0%, #1b0d22 0%, #0a0610 56%, #060309 100%);
}

.aurora {
  position: absolute;
  border-radius: 50%;
  filter: blur(110px);
  opacity: 0.55;
  will-change: transform;
}

.a1 {
  top: -220px;
  right: -150px;
  width: 640px;
  height: 640px;
  background: radial-gradient(circle, rgba(255, 77, 109, 0.62), transparent 68%);
  animation: drift-a 26s ease-in-out infinite;
}

.a2 {
  bottom: -240px;
  left: -180px;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(124, 58, 237, 0.52), transparent 68%);
  opacity: 0.42;
  animation: drift-b 32s ease-in-out infinite;
}

.a3 {
  top: 26%;
  left: 52%;
  width: 460px;
  height: 460px;
  background: radial-gradient(circle, rgba(255, 200, 87, 0.42), transparent 68%);
  opacity: 0.2;
  animation: drift-c 24s ease-in-out infinite;
}

.a4 {
  right: 16%;
  bottom: 8%;
  width: 380px;
  height: 380px;
  background: radial-gradient(circle, rgba(78, 224, 168, 0.34), transparent 68%);
  opacity: 0.18;
  animation: drift-b 28s ease-in-out infinite reverse;
}

.stars {
  position: absolute;
  inset: 0;
  opacity: 0.55;
  background-image:
    radial-gradient(1px 1px at 8% 18%, rgba(255, 255, 255, 0.65), transparent),
    radial-gradient(1px 1px at 22% 42%, rgba(255, 200, 87, 0.5), transparent),
    radial-gradient(1.5px 1.5px at 36% 12%, rgba(255, 255, 255, 0.45), transparent),
    radial-gradient(1px 1px at 51% 32%, rgba(139, 92, 246, 0.55), transparent),
    radial-gradient(1px 1px at 64% 8%, rgba(255, 255, 255, 0.4), transparent),
    radial-gradient(1.5px 1.5px at 76% 26%, rgba(255, 200, 87, 0.4), transparent),
    radial-gradient(1px 1px at 88% 14%, rgba(255, 255, 255, 0.55), transparent),
    radial-gradient(1px 1px at 94% 48%, rgba(78, 224, 168, 0.45), transparent),
    radial-gradient(1px 1px at 12% 68%, rgba(255, 255, 255, 0.35), transparent),
    radial-gradient(1.5px 1.5px at 28% 84%, rgba(255, 77, 109, 0.4), transparent),
    radial-gradient(1px 1px at 45% 62%, rgba(255, 255, 255, 0.3), transparent),
    radial-gradient(1px 1px at 58% 78%, rgba(255, 200, 87, 0.35), transparent),
    radial-gradient(1px 1px at 72% 58%, rgba(255, 255, 255, 0.45), transparent),
    radial-gradient(1.5px 1.5px at 86% 72%, rgba(139, 92, 246, 0.4), transparent),
    radial-gradient(1px 1px at 96% 88%, rgba(255, 255, 255, 0.35), transparent);
  background-repeat: no-repeat;
  animation: star-pulse 7s ease-in-out infinite;
}

.vignette {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 44%, transparent 30%, rgba(4, 2, 7, 0.58) 100%);
}

.grain {
  position: absolute;
  inset: -20%;
  opacity: 0.055;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.55'/%3E%3C/svg%3E");
  background-size: 180px 180px;
  mix-blend-mode: soft-light;
  animation: grain 9s steps(6) infinite;
}

/* ------------------------------------------------------------------- shell */
.app {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100vh;
  height: 100dvh;
}

/* ------------------------------------------------------------------ header */
.topbar {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: calc(18px + env(safe-area-inset-top)) 28px 10px;
}

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

.brand-orb {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 40px;
  height: 40px;
  color: var(--saffron);
  background: radial-gradient(circle at 30% 25%, rgba(255, 255, 255, 0.17), rgba(255, 255, 255, 0.03) 62%);
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  box-shadow: 0 0 28px rgba(255, 77, 109, 0.24), inset 0 1px 0 rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(12px);
}

.brand-orb svg {
  width: 19px;
  height: 19px;
  filter: drop-shadow(0 0 6px rgba(255, 200, 87, 0.45));
}

.brand-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  line-height: 1;
}

.brand-eyebrow {
  color: var(--muted);
  font-family: var(--font-sans);
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: 0.28em;
  direction: ltr;
  unicode-bidi: isolate;
}

.brand-name {
  color: var(--text);
  font-family: var(--font-ar);
  font-size: 23px;
  font-weight: 600;
  line-height: 1.3;
}

.topbar-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 13px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--line);
  border-radius: 999px;
  backdrop-filter: blur(10px);
}

.live-dot {
  width: 7px;
  height: 7px;
  background: var(--jade);
  border-radius: 50%;
  animation: live 2.4s infinite;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 9px;
}

.mode-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 10px;
  color: var(--muted);
  font-size: 11.5px;
  white-space: nowrap;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--line);
  border-radius: 999px;
  backdrop-filter: blur(10px);
}

.status-dot {
  width: 6px;
  height: 6px;
  background: var(--jade);
  border-radius: 50%;
  box-shadow: 0 0 8px rgba(78, 224, 168, 0.7);
}

.mode-chip.demo .status-dot {
  background: var(--saffron);
  box-shadow: 0 0 8px rgba(255, 200, 87, 0.7);
}

.mode-chip.offline .status-dot {
  background: var(--pomegranate);
  box-shadow: 0 0 8px rgba(255, 77, 109, 0.7);
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  color: var(--text-soft);
  cursor: pointer;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  border-radius: 50%;
  backdrop-filter: blur(10px);
  transition: color 200ms ease, background 200ms ease, border-color 200ms ease,
    box-shadow 200ms ease;
}

.icon-btn svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  transition: transform 300ms ease;
}

.icon-btn:hover {
  color: var(--text);
  background: rgba(255, 77, 109, 0.12);
  border-color: rgba(255, 77, 109, 0.4);
  box-shadow: 0 0 24px rgba(255, 77, 109, 0.2);
}

.icon-btn:hover svg {
  transform: rotate(90deg);
}

/* -------------------------------------------------------------------- chat */
.chat {
  flex: 1 1 auto;
  width: 100%;
  max-width: 840px;
  min-height: 0;
  margin: 0 auto;
  padding: 18px 14px 12px;
  overflow-x: hidden;
  overflow-y: auto;
  scroll-behavior: smooth;
  scrollbar-color: rgba(255, 255, 255, 0.16) transparent;
  scrollbar-width: thin;
}

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

.chat::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.14);
  border: 2px solid transparent;
  border-radius: 999px;
  background-clip: padding-box;
}

/* ----------------------------------------------------------------- welcome */
.welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100%;
  padding: 2vh 0 9vh;
  text-align: center;
  animation: fade-in 500ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.hero {
  position: relative;
  display: grid;
  place-items: center;
  width: 190px;
  height: 190px;
  margin-bottom: 24px;
}

.hero-glow {
  position: absolute;
  inset: -34%;
  background: radial-gradient(circle, rgba(255, 77, 109, 0.4), rgba(255, 200, 87, 0.12) 42%, transparent 68%);
  filter: blur(28px);
  animation: pulse 6s ease-in-out infinite;
}

.hero-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: conic-gradient(
    from 0deg,
    transparent 0 8%,
    rgba(255, 77, 109, 0.9) 22%,
    rgba(255, 200, 87, 0.95) 42%,
    rgba(78, 224, 168, 0.8) 60%,
    transparent 76%
  );
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 1.5px), #000 calc(100% - 1px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 1.5px), #000 calc(100% - 1px));
  opacity: 0.85;
  animation: spin 16s linear infinite;
}

.hero-core {
  position: relative;
  display: grid;
  place-items: center;
  width: 122px;
  height: 122px;
  background: radial-gradient(
    circle at 34% 26%,
    rgba(255, 255, 255, 0.18),
    rgba(255, 255, 255, 0.04) 46%,
    rgba(255, 255, 255, 0.015) 70%
  );
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 50%;
  box-shadow: inset 0 1px 26px rgba(255, 255, 255, 0.1), 0 24px 70px rgba(255, 77, 109, 0.26);
  backdrop-filter: blur(12px);
}

.hero-star {
  width: 56px;
  height: 56px;
  filter: drop-shadow(0 0 12px rgba(255, 122, 89, 0.55));
}

.spark {
  position: absolute;
  width: 5px;
  height: 5px;
  background: var(--saffron);
  border-radius: 50%;
  box-shadow: 0 0 10px 2px rgba(255, 200, 87, 0.6);
  animation: twinkle 3.2s ease-in-out infinite;
}

.s1 {
  top: 8%;
  right: 12%;
}

.s2 {
  bottom: 12%;
  left: 6%;
  background: var(--jade);
  box-shadow: 0 0 10px 2px rgba(78, 224, 168, 0.5);
  animation-delay: 0.8s;
}

.s3 {
  top: 24%;
  left: 2%;
  width: 4px;
  height: 4px;
  background: var(--pomegranate);
  box-shadow: 0 0 10px 2px rgba(255, 77, 109, 0.55);
  animation-delay: 1.4s;
}

.s4 {
  right: 24%;
  bottom: 2%;
  width: 3px;
  height: 3px;
  background: var(--violet);
  box-shadow: 0 0 10px 2px rgba(139, 92, 246, 0.5);
  animation-delay: 2s;
}

.welcome h2 {
  margin: 0;
  color: var(--text);
  font-family: var(--font-ar);
  font-size: 44px;
  font-weight: 500;
  line-height: 1.35;
  letter-spacing: -0.4px;
  text-wrap: balance;
}

.grad-text {
  color: transparent;
  background: linear-gradient(100deg, #ffc857 0%, #ff7a59 45%, #ff4d6d 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-underline {
  width: 180px;
  height: 12px;
  margin-top: 6px;
  opacity: 0.95;
}

.hero-underline path {
  stroke-dasharray: 220;
  stroke-dashoffset: 220;
  animation: draw 1.2s 350ms ease forwards;
}

.welcome-sub {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 15.5px;
  line-height: 1.9;
}

.suggestions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 9px;
  max-width: 680px;
  margin-top: 28px;
}

.suggestion {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  color: var(--text-soft);
  font-family: var(--font-ar);
  font-size: 13.5px;
  line-height: 1.4;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid var(--line);
  border-radius: 999px;
  backdrop-filter: blur(12px);
  transition: transform 200ms ease, border-color 200ms ease, background 200ms ease,
    box-shadow 200ms ease;
}

.suggestion .mood {
  font-size: 15px;
  line-height: 1;
  filter: saturate(1.1);
}

.suggestion:hover {
  background: rgba(255, 77, 109, 0.1);
  border-color: rgba(255, 77, 109, 0.4);
  box-shadow: 0 8px 28px rgba(255, 77, 109, 0.16);
  transform: translateY(-2px);
}

.suggestion:active {
  transform: translateY(0) scale(0.98);
}

/* ----------------------------------------------------------------- messages */
.messages {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 10px 0 18px;
}

.msg {
  display: flex;
  max-width: 100%;
  animation: rise 280ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.msg.user {
  width: 100%;
  align-self: flex-start;
  justify-content: flex-start;
}

.msg.user .bubble {
  max-width: 78%;
  padding: 12px 16px;
  color: #fff7f2;
  font-size: 16.5px;
  line-height: 1.75;
  background: linear-gradient(135deg, var(--user-1), var(--user-2));
  border-radius: 20px 20px 6px 20px;
  box-shadow: 0 14px 36px rgba(227, 59, 94, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.msg.ai {
  width: 100%;
  flex-direction: row-reverse;
  align-items: flex-start;
  align-self: flex-end;
  gap: 11px;
}

.msg.ai .bubble {
  max-width: 78%;
  padding: 14px 18px;
  color: var(--text);
  font-size: 17px;
  line-height: 1.85;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.085), rgba(255, 255, 255, 0.032));
  border: 1px solid var(--line);
  border-radius: 20px 20px 20px 6px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07), 0 20px 55px rgba(0, 0, 0, 0.38);
  backdrop-filter: blur(18px);
}

.avatar {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  margin-top: 4px;
  padding: 7px;
  color: var(--saffron);
  overflow: visible;
  background: rgba(255, 255, 255, 0.055);
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  box-shadow: 0 0 22px rgba(255, 200, 87, 0.16);
}

.bubble-text {
  white-space: pre-wrap;
  text-align: start;
  unicode-bidi: plaintext;
}

.bubble-text.streaming::after {
  display: inline-block;
  width: 2px;
  height: 1em;
  margin-inline-start: 3px;
  vertical-align: -0.12em;
  content: "";
  background: linear-gradient(to bottom, var(--saffron), var(--pomegranate));
  border-radius: 2px;
  animation: caret 1s steps(2) infinite;
}

.msg.ai.error .bubble {
  color: #ffd4dc;
  background: rgba(255, 77, 109, 0.12);
  border-color: rgba(255, 77, 109, 0.32);
}

.msg.ai.error .avatar {
  color: var(--pomegranate);
  box-shadow: 0 0 22px rgba(255, 77, 109, 0.24);
}

.msg.ai .bubble.degraded {
  background: rgba(255, 200, 87, 0.075);
  border-color: rgba(255, 200, 87, 0.22);
}

.status-line {
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.7;
}

.typing {
  display: inline-flex;
  gap: 3px;
  align-items: flex-end;
  height: 14px;
  padding: 2px 1px;
}

.typing span {
  width: 3px;
  height: 6px;
  background: linear-gradient(to top, var(--pomegranate), var(--saffron));
  border-radius: 2px;
  animation: equalize 1s ease-in-out infinite;
}

.typing span:nth-child(2) {
  height: 10px;
  animation-delay: 0.15s;
}

.typing span:nth-child(3) {
  height: 8px;
  animation-delay: 0.3s;
}

/* ---------------------------------------------------------------- composer */
.composer-wrap {
  position: relative;
  z-index: 3;
  flex: 0 0 auto;
  width: 100%;
  padding: 8px 24px calc(16px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, rgba(10, 6, 16, 0.96) 30%, rgba(10, 6, 16, 0));
}

.composer-shell {
  position: relative;
  width: 100%;
  max-width: 840px;
  margin: 0 auto;
}

.composer-glow {
  position: absolute;
  inset: 10% 6% 0;
  pointer-events: none;
  background: linear-gradient(90deg, rgba(255, 77, 109, 0.5), rgba(255, 200, 87, 0.35), rgba(78, 224, 168, 0.3));
  border-radius: 40px;
  filter: blur(38px);
  opacity: 0.34;
  will-change: transform, opacity;
  animation: glow-breathe 7s ease-in-out infinite;
}

.composer {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 14px 10px;
  background: rgba(20, 12, 26, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 26px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.09);
  backdrop-filter: blur(22px);
  transition: border-color 200ms ease, box-shadow 200ms ease;
}

.composer:focus-within {
  border-color: rgba(255, 122, 89, 0.45);
  box-shadow: 0 24px 90px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 122, 89, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.input-placeholder {
  position: absolute;
  top: 18px;
  right: 20px;
  left: 20px;
  overflow: hidden;
  color: var(--muted-2);
  font-family: var(--font-ar), var(--font-sans), var(--font-zh), sans-serif;
  font-size: 17px;
  line-height: 1.75;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
  pointer-events: none;
  transition: opacity 160ms ease;
}

.input {
  position: relative;
  width: 100%;
  min-height: 50px;
  max-height: 180px;
  padding: 6px 6px 4px;
  overflow-y: auto;
  color: var(--text);
  font-family: var(--font-ar), var(--font-sans), var(--font-zh), sans-serif;
  font-size: 17px;
  line-height: 1.75;
  text-align: right;
  resize: none;
  background: transparent;
  border: 0;
  outline: 0;
}

.input[dir="ltr"] {
  text-align: left;
}

.input:focus-visible {
  outline: none;
}

.composer-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 2px;
}

.composer-left,
.composer-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.persona {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.persona-star {
  flex: 0 0 auto;
  width: 14px;
  height: 14px;
  color: var(--saffron);
  filter: drop-shadow(0 0 5px rgba(255, 200, 87, 0.45));
}

.counter {
  color: var(--muted-2);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  direction: ltr;
}

.counter.near {
  color: var(--saffron);
}

.send-wrap {
  --p: 0%;
  width: 46px;
  height: 46px;
  padding: 2px;
  background: conic-gradient(
    from -90deg,
    var(--pomegranate) 0,
    var(--saffron) var(--p),
    rgba(255, 255, 255, 0.12) var(--p)
  );
  border-radius: 50%;
  transition: background 200ms linear;
}

.send-btn {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  color: var(--muted);
  cursor: pointer;
  background: rgba(255, 255, 255, 0.05);
  border: 0;
  border-radius: 50%;
  transition: background 200ms ease, color 200ms ease, box-shadow 200ms ease,
    transform 150ms ease;
}

.send-btn svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.send-btn:not(:disabled) {
  color: #1a0b12;
  background: linear-gradient(135deg, var(--saffron), var(--coral));
  box-shadow: 0 0 26px rgba(255, 122, 89, 0.4);
}

.send-btn:not(:disabled):hover {
  background: linear-gradient(135deg, #ffd77a, #ff8b6a);
  transform: translateY(-1px);
}

.send-btn:disabled {
  cursor: default;
  opacity: 0.7;
}

.composer-note {
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.6;
  text-align: center;
}

.composer-note .sep {
  margin: 0 4px;
  color: var(--pomegranate);
}

/* ------------------------------------------------------------------- misc */
:focus-visible {
  outline: 2px solid rgba(255, 122, 89, 0.6);
  outline-offset: 2px;
}

::selection {
  background: rgba(255, 77, 109, 0.35);
}

@keyframes drift-a {
  0%,
  100% {
    transform: translate3d(0, 0, 0) scale(1);
  }
  50% {
    transform: translate3d(-70px, 60px, 0) scale(1.08);
  }
}

@keyframes drift-b {
  0%,
  100% {
    transform: translate3d(0, 0, 0) scale(1);
  }
  50% {
    transform: translate3d(70px, -50px, 0) scale(1.06);
  }
}

@keyframes drift-c {
  0%,
  100% {
    transform: translate3d(0, 0, 0) scale(1);
  }
  50% {
    transform: translate3d(-50px, 40px, 0) scale(1.12);
  }
}

@keyframes pulse {
  0%,
  100% {
    opacity: 0.55;
    transform: scale(1);
  }
  50% {
    opacity: 0.88;
    transform: scale(1.06);
  }
}

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

@keyframes twinkle {
  0%,
  100% {
    opacity: 0.25;
    transform: scale(0.8);
  }
  50% {
    opacity: 1;
    transform: scale(1.15);
  }
}

@keyframes draw {
  to {
    stroke-dashoffset: 0;
  }
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fade-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes equalize {
  0%,
  100% {
    opacity: 0.5;
    transform: scaleY(0.55);
  }
  50% {
    opacity: 1;
    transform: scaleY(1);
  }
}

@keyframes caret {
  0%,
  49% {
    opacity: 1;
  }
  50%,
  100% {
    opacity: 0;
  }
}

@keyframes live {
  0% {
    box-shadow: 0 0 0 0 rgba(78, 224, 168, 0.45);
  }
  70% {
    box-shadow: 0 0 0 7px rgba(78, 224, 168, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(78, 224, 168, 0);
  }
}

@keyframes glow-breathe {
  0%,
  100% {
    opacity: 0.24;
    transform: scale(0.98);
  }
  50% {
    opacity: 0.44;
    transform: scale(1.02);
  }
}

@keyframes star-pulse {
  0%,
  100% {
    opacity: 0.35;
  }
  50% {
    opacity: 0.7;
  }
}

@keyframes grain {
  0%,
  100% {
    transform: translate(0, 0);
  }
  20% {
    transform: translate(-2%, 1%);
  }
  40% {
    transform: translate(1%, -2%);
  }
  60% {
    transform: translate(-1%, 2%);
  }
  80% {
    transform: translate(2%, -1%);
  }
}

/* --------------------------------------------------------------- responsive */
@media (max-width: 760px) {
  .topbar {
    gap: 10px;
    padding: calc(13px + env(safe-area-inset-top)) 16px 8px;
  }

  .brand {
    gap: 9px;
  }

  .brand-orb {
    width: 36px;
    height: 36px;
  }

  .brand-orb svg {
    width: 17px;
    height: 17px;
  }

  .brand-name {
    font-size: 21px;
  }

  .brand-eyebrow {
    font-size: 7.5px;
  }

  .topbar-status,
  .mode-chip {
    display: none;
  }

  .icon-btn {
    width: 36px;
    height: 36px;
  }

  .aurora {
    filter: blur(80px);
  }

  .a1,
  .a2 {
    width: 480px;
    height: 480px;
  }

  .chat {
    padding: 14px 23px 10px;
  }

  .welcome {
    padding: 1vh 0 7vh;
  }

  .hero {
    width: 150px;
    height: 150px;
    margin-bottom: 18px;
  }

  .hero-core {
    width: 96px;
    height: 96px;
  }

  .hero-star {
    width: 44px;
    height: 44px;
  }

  .welcome h2 {
    font-size: 32px;
    line-height: 1.45;
    letter-spacing: -0.2px;
  }

  .hero-underline {
    width: 140px;
  }

  .welcome-sub {
    font-size: 14.5px;
  }

  .suggestions {
    gap: 7px;
    margin-top: 22px;
  }

  .suggestion {
    padding: 8px 12px;
    font-size: 12.5px;
  }

  .messages {
    gap: 16px;
    padding-top: 6px;
  }

  .msg.user .bubble {
    max-width: 88%;
    padding: 10px 14px;
    font-size: 15.5px;
  }

  .msg.ai {
    gap: 9px;
  }

  .msg.ai .bubble {
    max-width: 90%;
    padding: 12px 14px;
    font-size: 16px;
    backdrop-filter: blur(12px);
  }

  .avatar {
    width: 27px;
    height: 27px;
    padding: 6px;
  }

  .composer-wrap {
    padding: 6px 12px calc(10px + env(safe-area-inset-bottom));
  }

  .composer {
    padding: 10px 11px 9px;
    border-radius: 23px;
    backdrop-filter: blur(16px);
  }

  .input-placeholder {
    top: 17px;
    right: 17px;
    left: 17px;
    font-size: 16px;
  }

  .input {
    min-height: 46px;
    font-size: 16px;
  }

  .send-wrap {
    width: 44px;
    height: 44px;
  }

  .composer-note {
    margin-top: 7px;
    font-size: 10px;
  }
}

@media (max-width: 420px) {
  .brand-eyebrow {
    display: none;
  }

  .welcome h2 {
    font-size: 28px;
  }

  .welcome-sub {
    font-size: 13.5px;
  }

  .suggestion {
    padding: 8px 10px;
    font-size: 12px;
  }

  .suggestion .mood {
    font-size: 14px;
  }
}

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