/* ============ JAMIX AI — black & gold chat surface ============ */

.jai-body {
  background: #070604;
  color: var(--text);
  overflow: hidden;
}

.jai-shell {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  isolation: isolate;
}

/* Soft gold light behind the black, no images to load. */
.jai-shell::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(60rem 30rem at 50% -10%, rgba(212, 164, 55, 0.14), transparent 65%),
    radial-gradient(40rem 26rem at 100% 110%, rgba(185, 134, 58, 0.10), transparent 70%),
    #070604;
}

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

/* ---------- Top bar ---------- */
.jai-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: calc(0.7rem + env(safe-area-inset-top)) clamp(0.9rem, 3vw, 1.6rem) 0.7rem;
  border-bottom: 1px solid var(--line);
  background: rgba(10, 8, 6, 0.86);
  backdrop-filter: blur(14px);
}

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

.jai-mark {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  flex: none;
  border-radius: 12px;
  font-family: var(--font-display);
  font-size: 0.95rem;
  letter-spacing: 0.04em;
  color: #1a1206;
  background: linear-gradient(135deg, var(--gold), var(--gold-soft));
  box-shadow: 0 8px 22px rgba(212, 164, 55, 0.25);
}

.jai-brand-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.jai-brand-text strong {
  font-family: var(--font-display);
  font-size: 1.05rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--cream);
}
.jai-brand-text em { color: var(--gold); font-style: normal; }
.jai-brand-text small { font-size: 0.66rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); }

.jai-actions { display: flex; align-items: center; gap: 0.6rem; }

.jai-status {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  color: var(--muted);
  white-space: nowrap;
}
.jai-status i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.jai-status[data-state="online"] { color: var(--gold); }
.jai-status[data-state="online"] i { background: var(--gold); box-shadow: 0 0 8px rgba(212, 164, 55, 0.8); }
.jai-status[data-state="offline"] i { background: #c2603f; }
.jai-status[data-state="checking"] i { animation: jai-pulse 1.2s ease-in-out infinite; }

.jai-new {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--cream);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}
.jai-new svg { width: 15px; height: 15px; }
.jai-new:hover { border-color: var(--gold); color: var(--gold); transform: translateY(-1px); }

/* ---------- Conversation area ---------- */
.jai-main {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: clamp(1rem, 3vw, 2rem) clamp(0.9rem, 3vw, 1.6rem);
  scrollbar-width: thin;
  scrollbar-color: rgba(212, 164, 55, 0.4) transparent;
}
.jai-main::-webkit-scrollbar { width: 8px; }
.jai-main::-webkit-scrollbar-thumb { background: rgba(212, 164, 55, 0.32); border-radius: 999px; }

.jai-welcome,
.jai-log { width: min(860px, 100%); margin-inline: auto; }

.jai-welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.9rem;
  padding: clamp(1.5rem, 6vh, 4rem) 0 2rem;
}

.jai-orb {
  display: grid;
  place-items: center;
  width: 92px;
  height: 92px;
  border-radius: 50%;
  border: 1px solid rgba(212, 164, 55, 0.45);
  background: radial-gradient(circle at 30% 25%, rgba(212, 164, 55, 0.28), rgba(12, 10, 8, 0.9) 70%);
  box-shadow: 0 0 40px rgba(212, 164, 55, 0.18), inset 0 0 24px rgba(212, 164, 55, 0.12);
}
.jai-orb span {
  font-family: var(--font-display);
  font-size: 1.5rem;
  letter-spacing: 0.06em;
  color: var(--gold);
}

.jai-title {
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 8vw, 3.6rem);
  letter-spacing: 0.06em;
  line-height: 1;
  text-transform: uppercase;
  color: var(--cream);
}
.jai-title span { color: var(--gold); }

.jai-tagline { max-width: 46ch; color: var(--muted); font-size: 0.98rem; }

.jai-suggestions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.6rem;
  width: min(560px, 100%);
  margin-top: 0.4rem;
}
.jai-chip {
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  font: inherit;
  font-size: 0.85rem;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}
.jai-chip:hover { border-color: var(--gold); background: rgba(212, 164, 55, 0.08); transform: translateY(-2px); }

.jai-fineprint { font-size: 0.72rem; color: var(--muted); opacity: 0.85; }

/* ---------- Messages ---------- */
.jai-log { display: flex; flex-direction: column; gap: 1rem; padding-bottom: 0.5rem; }

.jai-msg { display: flex; align-items: flex-start; gap: 0.6rem; }
.jai-msg-user { flex-direction: row-reverse; }

.jai-avatar {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex: none;
  margin-top: 0.15rem;
  border-radius: 9px;
  border: 1px solid var(--line);
  font-family: var(--font-display);
  font-size: 0.68rem;
  letter-spacing: 0.03em;
  color: var(--gold);
  background: rgba(212, 164, 55, 0.08);
}
.jai-msg-user .jai-avatar { color: var(--cream); background: rgba(255, 255, 255, 0.05); }

.jai-bubble {
  max-width: min(78%, 64ch);
  padding: 0.75rem 1rem;
  border: 1px solid var(--line);
  border-radius: 16px 16px 16px 4px;
  background: rgba(255, 255, 255, 0.045);
  font-size: 0.94rem;
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.jai-msg-user .jai-bubble {
  border-color: transparent;
  border-radius: 16px 16px 4px 16px;
  color: #1a1206;
  font-weight: 500;
  background: linear-gradient(135deg, var(--gold), var(--gold-soft));
}

.jai-bubble-error {
  border-color: rgba(194, 96, 63, 0.5);
  background: rgba(194, 96, 63, 0.10);
  color: #e8c9bd;
}
.jai-retry {
  display: inline-block;
  margin-top: 0.6rem;
  padding: 0.35rem 0.85rem;
  border: 1px solid rgba(212, 164, 55, 0.55);
  border-radius: 999px;
  background: none;
  color: var(--gold);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}
.jai-retry:hover { background: rgba(212, 164, 55, 0.12); }

/* ---------- Typing ---------- */
.jai-typing { display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.35rem 0.1rem; }
.jai-typing i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--gold);
  animation: jai-bounce 1.1s ease-in-out infinite;
}
.jai-typing i:nth-child(2) { animation-delay: 0.15s; }
.jai-typing i:nth-child(3) { animation-delay: 0.3s; }

@keyframes jai-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.45; }
  30% { transform: translateY(-4px); opacity: 1; }
}
@keyframes jai-pulse {
  0%, 100% { opacity: 0.35; }
  50% { opacity: 1; }
}

/* ---------- Offline banner ---------- */
.jai-offline {
  margin: 0;
  padding: 0.55rem 1rem;
  border-top: 1px solid rgba(194, 96, 63, 0.35);
  background: rgba(194, 96, 63, 0.12);
  color: #e8c9bd;
  font-size: 0.78rem;
  text-align: center;
}

/* ---------- Composer ---------- */
.jai-composer {
  border-top: 1px solid var(--line);
  background: rgba(10, 8, 6, 0.92);
  backdrop-filter: blur(14px);
  padding: 0.75rem clamp(0.9rem, 3vw, 1.6rem) calc(0.6rem + env(safe-area-inset-bottom));
}

.jai-form {
  display: flex;
  align-items: flex-end;
  gap: 0.6rem;
  width: min(860px, 100%);
  margin-inline: auto;
}

.jai-input {
  flex: 1;
  min-width: 0;
  max-height: 160px;
  padding: 0.8rem 1rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font: inherit;
  font-size: 16px; /* keeps iOS from zooming the page on focus */
  line-height: 1.5;
  resize: none;
  overflow-y: auto;
}
.jai-input::placeholder { color: var(--muted); }
.jai-input:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(212, 164, 55, 0.12); }
.jai-input:disabled { opacity: 0.6; }

.jai-send {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  flex: none;
  border: 0;
  border-radius: 14px;
  color: #1a1206;
  background: linear-gradient(135deg, var(--gold), var(--gold-soft));
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}
.jai-send svg { width: 21px; height: 21px; }
.jai-send:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 10px 26px rgba(212, 164, 55, 0.32); }
.jai-send:disabled { opacity: 0.45; cursor: default; }

.jai-hint {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  width: min(860px, 100%);
  margin: 0.45rem auto 0;
  font-size: 0.7rem;
  color: var(--muted);
}
.jai-count { color: var(--gold); }

/* ---------- Toast ---------- */
.jai-toast {
  position: fixed;
  left: 50%;
  bottom: calc(6.5rem + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  padding: 0.55rem 1.1rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(20, 16, 12, 0.96);
  color: var(--cream);
  font-size: 0.8rem;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.5);
  z-index: 20;
}

/* ---------- Small screens ---------- */
@media (max-width: 720px) {
  .jai-top { gap: 0.5rem; }
  .jai-brand-text small { display: none; }
  .jai-brand-text strong { font-size: 0.95rem; }
  .jai-status { padding: 0.3rem 0.5rem; }
  .jai-new { padding: 0.45rem 0.7rem; }
  .jai-new span { display: none; }
  .jai-suggestions { grid-template-columns: 1fr; }
  .jai-bubble { max-width: 86%; font-size: 0.92rem; }
  .jai-orb { width: 74px; height: 74px; }
  .jai-orb span { font-size: 1.2rem; }
  .jai-welcome { padding-top: 1.2rem; }
}

@media (max-width: 380px) {
  .jai-status span { display: none; }
  .jai-status { padding: 0.35rem; }
}

@media (prefers-reduced-motion: reduce) {
  .jai-typing i, .jai-status i { animation: none; }
  .jai-chip:hover, .jai-new:hover, .jai-send:hover { transform: none; }
}
