:root{
  --bg: #ffffff;
  --fg: #0b0b0b;
  --muted: #6b7280;
  --border: #e5e7eb;
  --accent: #111827;
  --surface: #f9fafb;
}
*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, Noto Sans, "Apple Color Emoji","Segoe UI Emoji";
  background:var(--bg);
  color:var(--fg);
  overflow:hidden;
}

.topbar{
  height:56px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:0 16px;
}
.topbar__left{display:flex;align-items:center;gap:8px}
.topbar__link{display:inline-flex;align-items:center;gap:8px;color:inherit;text-decoration:none}
.logo{height:22px;width:22px}
.brand{font-weight:600;letter-spacing:0.2px}

/* Refresh button */
.topbar__refresh{display:inline-flex;gap:8px;align-items:center;border:1px solid var(--border);background:#fff;border-radius:10px;padding:8px 12px;cursor:pointer;color:#111827}
.topbar__refresh svg{width:16px;height:16px}

.main{max-width:900px;margin:0 auto;padding:0 16px;height:calc(100vh - 56px);height:calc(100dvh - 56px);display:flex;flex-direction:column}
.main.center{justify-content:center}
.hero{
  text-align:center;
  font-size:44px;
  line-height:1.1;
  margin:15px 0 20px;
}
.hero-avatar{width:40px;height:40px;border-radius:50%;vertical-align:middle;margin-right:8px;display:none}

.composer{position:sticky;bottom:0;margin-top:auto;background:linear-gradient(to top, rgba(255,255,255,1) 70%, rgba(255,255,255,0));padding-bottom:18px}
.main.center .composer{position:static;margin:0 auto;padding-bottom:0;max-width:720px;width:100%}
.main.center .chat{display:none}
.main.center .hero{margin:0 0 16px}
.composer__inputwrap{
  display:flex;
  align-items:center;
  gap:8px;
  border:1px solid var(--border);
  background:var(--surface);
  border-radius:28px;
  padding:8px 10px 8px 16px;
}
.composer__input{
  border:none;
  outline:none;
  resize:none;
  background:transparent;
  width:100%;
  font-size:16px;
  line-height:22px;
  padding:8px 0;
}
.composer__send{
  border:none;
  background:var(--accent);
  color:#fff;
  width:36px;height:36px;
  border-radius:50%;
  display:grid;place-items:center;
  cursor:pointer;
}
.composer__hints{display:flex;gap:8px;margin-top:8px}
.composer__hints .hint--right{margin-left:auto}
.hint{display:inline-flex;align-items:center;gap:6px;border:1px solid var(--border);background:#fff;border-radius:999px;padding:8px 14px;color:var(--muted);font-size:13px;cursor:pointer}
.hint svg{width:16px;height:16px}
.attachments{display:flex;gap:8px;flex-wrap:wrap;margin-top:10px}
.attachment{display:inline-flex;align-items:center;gap:6px;border:1px solid var(--border);background:#fff;border-radius:10px;padding:6px 10px}
.attachment img{width:28px;height:28px;border-radius:6px;object-fit:cover}
.attachment__name{font-size:12px;color:#374151;max-width:160px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.attachment__remove{border:none;background:#ef4444;color:#fff;border-radius:50%;width:18px;height:18px;display:grid;place-items:center;cursor:pointer}

/* Attachments inside chat messages */
.msg__attachments{display:flex;gap:8px;flex-wrap:wrap;margin-top:8px}
.msg__attachments .attachment{padding:4px 8px}
.msg__attachments .attachment img{width:40px;height:40px;border-radius:8px}

.chat{margin:24px 0 12px;display:flex;flex-direction:column;gap:8px;flex:1 1 auto;min-height:0;overflow:auto}
.visually-hidden{position:absolute;left:-10000px;top:auto;width:1px;height:1px;overflow:hidden}
.msg{display:flex;gap:12px;padding:10px 12px;border:1px solid var(--border);border-radius:14px;background:#fff}
.msg--user{align-self:flex-end;background:#f3f4f6}
.msg__role{font-weight:600;color:var(--muted);min-width:80px}
.msg__avatar{width:24px;height:24px;border-radius:50%;flex:0 0 auto}
.msg__text{white-space:pre-wrap}
.msg__text h3{font-size:16px;line-height:1.4;margin:8px 0 6px;font-weight:600}
.msg__text h4{font-size:14px;line-height:1.4;margin:6px 0 4px;font-weight:600;color:#111827}
.msg__text blockquote{margin:8px 0;padding:8px 12px;border-left:3px solid #e5e7eb;background:#f9fafb;border-radius:4px}
.msg__text a{color:#2563eb;text-decoration:underline}
.msg__text code{background:#f3f4f6;border:1px solid var(--border);border-radius:6px;padding:0 4px;font-family:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;font-size:0.95em}

/* Modal */
.modal[hidden]{display:none}
.modal{position:fixed;inset:0;z-index:100000}
.modal__backdrop{position:absolute;inset:0;background:rgba(0,0,0,.5)}
.modal__content{position:relative;max-width:720px;margin:10vh auto;background:#fff;border-radius:12px;overflow:hidden;box-shadow:0 20px 60px rgba(0,0,0,.2)}
.modal__video{display:block;width:100%;background:#000;aspect-ratio:4/3}
.modal__controls{display:flex;align-items:center;gap:8px;padding:8px 12px;background:#fff;border-top:1px solid var(--border)}
.modal__label{font-size:12px;color:#374151;display:inline-flex;align-items:center;gap:6px}
.modal__select{padding:4px 8px;border:1px solid var(--border);border-radius:8px}
.modal__error{color:#ef4444;font-size:12px;margin-left:auto}
.modal__actions{display:flex;justify-content:flex-end;gap:8px;padding:12px;background:#fff;border-top:1px solid var(--border)}
.btn{border:1px solid var(--border);background:#fff;border-radius:10px;padding:8px 14px;cursor:pointer}
.btn--primary{background:#111827;color:#fff;border-color:#111827}

@media (max-width:640px){
  .hero{font-size:32px;margin:4px 0 8px}
  .main.center .hero{margin:0 0 8px}
  .chat{margin:6px 0 6px}
  .msg__role{display:none}
}


/* Desktop-specific tweaks */
@media (min-width:1024px){
  .logo{height:44px;width:44px}
  .brand{font-size:22px}
}


/* Footer */
.footer{
  position:fixed;
  left:0;right:0;bottom:0;
  background:#fff;
  border-top:1px solid var(--border);
  padding:12px 16px;
  color:var(--muted);
  font-size:12px;
  line-height:1.4;
}
.footer p{max-width:800px;margin:0 auto}
/* leave space so composer/content don't sit under the footer */
.main{padding-bottom:96px}

/* Collapsed footer on mobile after submit */
.footer--collapsed{padding:8px 12px}
.footer__collapsed{max-width:900px;margin:0 auto;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.footer__collapsed a{color:#2563eb;text-decoration:underline}

/* Typing/thinking dots */
.typing{display:inline-block;letter-spacing:4px;color:var(--muted)}
.typing span{display:inline-block;opacity:.2;animation:dotPulse 1.2s infinite ease-in-out}
.typing span:nth-child(1){animation-delay:0s}
.typing span:nth-child(2){animation-delay:.2s}
.typing span:nth-child(3){animation-delay:.4s}
.typing span:nth-child(4){animation-delay:.6s}
@keyframes dotPulse{0%,100%{opacity:.2;transform:translateY(0)}50%{opacity:1;transform:translateY(-2px)}}



