:root {
  --plum: #4a1942;
  --plum-deep: #35112f;
  --plum-soft: #6b2a60;
  --orange: #f97316;
  --orange-deep: #ea580c;
  --cream: #fff7f0;
  --ink: #2a1226;
  --muted: #7a5a72;
  --panel: rgba(255, 247, 240, 0.92);
  --line: rgba(74, 25, 66, 0.12);
  --shadow: 0 20px 50px rgba(74, 25, 66, 0.18);
  --radius: 22px;
  --font-sd: "Lateef", "Amiri", "Noto Naskh Arabic", serif;
  --font-en: "Lateef", "Amiri", Georgia, serif;
  --chat-fs: 1.05rem;
  --chat-lh: 1.65;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: var(--font-sd);
  background: var(--cream);
  overflow: hidden;
}

[hidden] {
  display: none !important;
}

/* ——— Landing ——— */
.landing {
  position: relative;
  height: 100%;
  overflow: auto;
  display: flex;
  flex-direction: column;
  padding: 1rem 1.25rem 2rem;
}

.landing-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(900px 500px at 85% -5%, rgba(249, 115, 22, 0.35), transparent 55%),
    radial-gradient(800px 480px at -10% 90%, rgba(74, 25, 66, 0.35), transparent 50%),
    linear-gradient(165deg, #4a1942 0%, #5c2153 38%, #3a1434 100%);
}

.landing-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, transparent 55%, rgba(255, 247, 240, 0.08) 100%);
  pointer-events: none;
}

.landing-top,
.landing-hero,
.landing-points {
  position: relative;
  z-index: 1;
}

.landing-top {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.35rem 0;
}

.landing-mark {
  width: 42px;
  height: 42px;
  object-fit: contain;
  border-radius: 50%;
  background: #000;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
}

.landing-wordmark {
  font-family: var(--font-en);
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.02em;
  font-size: 1.15rem;
}

.landing-hero {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  max-width: 36rem;
  margin: 0 auto;
  padding: 1.5rem 0 1rem;
  animation: rise 0.7s ease both;
}

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

.landing-logo {
  width: min(220px, 52vw);
  height: auto;
  aspect-ratio: 1;
  object-fit: contain;
  border-radius: 50%;
  background: #000;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.4);
  animation: float 5s ease-in-out infinite;
}

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

.landing-brand {
  margin: 1rem 0 0.35rem;
  font-family: var(--font-en);
  font-size: clamp(2.2rem, 8vw, 3.4rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  color: #fff;
  line-height: 1.1;
}

.landing-tagline {
  margin: 0.5rem 0 0;
  color: #ffe8d6;
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.85;
  max-width: 22em;
}

.landing-sub {
  margin: 0.45rem 0 0;
  color: rgba(255, 247, 240, 0.78);
  font-size: 1.05rem;
  font-weight: 400;
  line-height: 1.9;
  max-width: 28em;
}

.cta {
  margin-top: 1.75rem;
  border: none;
  border-radius: 999px;
  padding: 0.95rem 2.2rem;
  font: inherit;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--plum);
  background: linear-gradient(135deg, #ffb078 0%, var(--orange) 55%, var(--orange-deep) 100%);
  cursor: pointer;
  box-shadow: 0 14px 32px rgba(249, 115, 22, 0.4);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.cta:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 40px rgba(249, 115, 22, 0.5);
}

.landing-powered {
  margin: 1.1rem 0 0;
  color: rgba(255, 247, 240, 0.65);
  font-family: var(--font-en);
  font-size: 0.85rem;
}

.landing-powered strong {
  color: var(--orange);
  font-weight: 700;
}

.landing-points {
  list-style: none;
  margin: 0 auto;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.55rem;
  max-width: 40rem;
}

.landing-points li {
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  background: rgba(255, 247, 240, 0.12);
  border: 1px solid rgba(255, 247, 240, 0.2);
  color: #ffe8d6;
  font-size: 0.9rem;
}

/* ——— Chat app ——— */
.app {
  max-width: 820px;
  height: 100%;
  margin: 0 auto;
  padding: 1rem 1rem 0.85rem;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 0.65rem;
  background:
    radial-gradient(700px 360px at 100% 0%, rgba(249, 115, 22, 0.12), transparent 55%),
    radial-gradient(600px 320px at 0% 100%, rgba(74, 25, 66, 0.1), transparent 50%),
    var(--cream);
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
}

.brand-logo {
  width: 44px;
  height: 44px;
  object-fit: contain;
  border-radius: 50%;
  background: #000;
  flex-shrink: 0;
}

.icon-btn {
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--plum);
  display: grid;
  place-items: center;
  cursor: pointer;
  flex-shrink: 0;
}

h1 {
  margin: 0;
  font-family: var(--font-en);
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--plum);
  line-height: 1.1;
}

.tagline {
  margin: 0.1rem 0 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.meta {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-shrink: 0;
}

.badge {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.3rem 0.65rem;
  border-radius: 999px;
  background: rgba(74, 25, 66, 0.1);
  color: var(--plum);
  border: 1px solid var(--line);
}

.ghost {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--plum);
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}

.ghost:hover {
  background: rgba(249, 115, 22, 0.08);
}

.chat {
  overflow-y: auto;
  padding: 0.3rem 0.1rem 0.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  scroll-behavior: smooth;
  font-size: var(--chat-fs);
  line-height: var(--chat-lh);
}

.greeting {
  align-self: stretch;
  max-width: 100%;
  padding: 0.7rem 0.8rem;
  border-radius: 14px;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: 0 4px 14px rgba(74, 25, 66, 0.05);
  animation: rise 0.4s ease both;
}

.greeting-title {
  margin: 0 0 0.25rem;
  color: var(--plum);
  font-size: 1.12rem;
  font-weight: 700;
  line-height: 1.55;
}

.greeting-body {
  margin: 0;
  color: var(--ink);
  line-height: 1.55;
  font-size: 1.02rem;
}

.greeting-prompt {
  margin: 0.55rem 0 0.2rem;
  color: var(--plum);
  font-weight: 700;
  font-size: 1.05rem;
  line-height: 1.55;
}

.greeting-hint {
  margin: 0 0 0.55rem;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.5;
}

.categories {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.cat-chip {
  border: 1px solid rgba(249, 115, 22, 0.35);
  background: rgba(249, 115, 22, 0.08);
  color: var(--plum);
  border-radius: 999px;
  padding: 0.28rem 0.65rem;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease;
}

.cat-chip:hover {
  background: rgba(249, 115, 22, 0.18);
  transform: translateY(-1px);
}

.bubble {
  max-width: min(78%, 420px);
  padding: 0.55rem 0.7rem;
  border-radius: 14px;
  font-size: var(--chat-fs);
  line-height: var(--chat-lh);
  white-space: pre-wrap;
  word-break: break-word;
  animation: rise 0.3s ease both;
}

.bubble.user {
  align-self: flex-start;
  background: linear-gradient(145deg, var(--plum) 0%, var(--plum-deep) 100%);
  color: #fff7f0;
  border-bottom-left-radius: 6px;
}

.bubble.assistant {
  align-self: flex-end;
  background: #fff;
  border: 1px solid var(--line);
  border-bottom-right-radius: 6px;
  box-shadow: 0 6px 16px rgba(74, 25, 66, 0.05);
}

.bubble .label {
  display: block;
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  opacity: 0.7;
  margin-bottom: 0.2rem;
  font-family: var(--font-en);
}

.voice-summary {
  font-weight: 600;
  margin-bottom: 0.2rem;
  font-size: 0.95rem;
}

.bubble-meta {
  display: block;
  margin-top: 0.3rem;
  font-size: 0.65rem;
  opacity: 0.7;
}

/* WhatsApp-style voice note */
.voice-note {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  min-width: min(200px, 68vw);
  max-width: 240px;
  margin-top: 0.1rem;
}

.voice-note audio {
  display: none;
}

.vn-play {
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  border: none;
  border-radius: 50%;
  background: var(--orange);
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
  padding: 0;
}

.bubble.assistant .vn-play {
  background: var(--plum);
}

.vn-icon {
  display: grid;
  place-items: center;
  margin-left: 1px;
}

.vn-mid {
  position: relative;
  flex: 1;
  min-width: 0;
  height: 28px;
  display: flex;
  align-items: center;
}

.vn-wave {
  display: flex;
  align-items: center;
  gap: 2px;
  width: 100%;
  height: 18px;
  pointer-events: none;
}

.vn-wave span {
  width: 2.5px;
  border-radius: 2px;
  background: rgba(74, 25, 66, 0.25);
  flex-shrink: 0;
}

.vn-wave span.filled {
  background: var(--orange);
}

.bubble.user .vn-play {
  background: #fff;
  color: var(--plum);
}

.bubble.user .vn-wave span {
  background: rgba(255, 247, 240, 0.35);
}

.bubble.user .vn-wave span.filled {
  background: #ffb078;
}

.bubble.user .vn-speed,
.bubble.user .vn-time {
  color: #ffe8d6;
}

.vn-scrub {
  position: absolute;
  inset: 0;
  width: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.vn-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.1rem;
  flex-shrink: 0;
  min-width: 2.2rem;
}

.vn-speed {
  border: none;
  background: transparent;
  color: var(--plum);
  font: inherit;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0;
  cursor: pointer;
  line-height: 1;
  font-family: var(--font-en);
}

.vn-time {
  font-size: 0.68rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  font-family: var(--font-en);
}

.transcript-toggle {
  border: 1px solid rgba(249, 115, 22, 0.35);
  background: rgba(249, 115, 22, 0.1);
  color: var(--plum);
  width: 28px;
  height: 28px;
  padding: 0;
  margin-top: 0.35rem;
  border-radius: 8px;
  display: inline-grid;
  place-items: center;
  cursor: pointer;
  text-decoration: none;
  flex-shrink: 0;
}

.transcript-toggle:hover,
.transcript-toggle.is-open {
  background: rgba(249, 115, 22, 0.22);
  border-color: var(--orange);
}

.bubble.user .transcript-toggle {
  color: #ffe8d6;
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.28);
}

.bubble.user .transcript-toggle:hover,
.bubble.user .transcript-toggle.is-open {
  background: rgba(255, 255, 255, 0.22);
}

.transcript-panel {
  margin-top: 0.3rem;
  font-size: 0.95rem;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.composer {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 0.6rem;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.status {
  font-size: 0.9rem;
  color: var(--plum);
  margin-bottom: 0.35rem;
}

.row {
  display: flex;
  gap: 0.45rem;
  align-items: center;
}

.mic {
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 14px;
  background: linear-gradient(145deg, var(--plum-soft), var(--plum));
  color: #fff;
  cursor: pointer;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  box-shadow: 0 8px 18px rgba(74, 25, 66, 0.28);
}

.mic.recording {
  background: linear-gradient(145deg, var(--orange), var(--orange-deep));
  animation: rec 1s ease-in-out infinite;
}

@keyframes rec {
  0%, 100% { box-shadow: 0 0 0 0 rgba(249, 115, 22, 0.45); }
  50% { box-shadow: 0 0 0 12px rgba(249, 115, 22, 0); }
}

.text-form {
  flex: 1;
  display: flex;
  gap: 0.35rem;
  align-items: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.25rem 0.25rem 0.25rem 0.7rem;
}

.text-form input {
  flex: 1;
  border: none;
  outline: none;
  font: inherit;
  font-size: 1.02rem;
  background: transparent;
  color: var(--ink);
  min-width: 0;
  line-height: 1.45;
}

.send {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 10px;
  background: var(--orange);
  color: #fff;
  cursor: pointer;
  display: grid;
  place-items: center;
}

.hint {
  margin: 0.4rem 0 0;
  text-align: center;
  color: var(--muted);
  font-size: 0.72rem;
  font-family: var(--font-en);
}

.busy .mic,
.busy .send,
.busy #textInput,
.busy .cat-chip {
  pointer-events: none;
  opacity: 0.65;
}

@media (max-width: 600px) {
  .landing-tagline { font-size: 1.1rem; }
  .tagline { display: none; }
  h1 { font-size: 1.15rem; }
  .bubble { max-width: 88%; }
  :root {
    --chat-fs: 1rem;
    --chat-lh: 1.6;
  }
}
