:root {
  --bg: #f7f7f7;
  --fg: #0d0d0d;
  --muted: #9b9b9b;
  --user-bubble: #eaf1ff;
  --user-text: #2f6bed;
  --blue: #2f6bed;
  --composer-bg: #ffffff;
  --composer-shadow: 0 2px 10px rgba(0,0,0,.07), 0 0 0 1px rgba(0,0,0,.05);
  --circle-border: #e6e6e6;
}
[data-theme="dark"] {
  --bg: #212121; --fg: #ececec; --muted: #9a9a9a;
  --user-bubble: #2f3b57; --user-text: #cfe0ff; --blue: #2f6bed;
  --composer-bg: #2f2f2f; --composer-shadow: 0 0 0 1px rgba(255,255,255,.08); --circle-border: #4a4a4a;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg); color: var(--fg);
  /* Matches chatgpt.com mobile: it loads NO webfont, so this is the system font (San Francisco on
     iPhone). "OpenAI Sans" kept as a late fallback only; the real mobile page renders SF too. */
  font-family: -apple-system, "SF Pro Text", "SF Pro", BlinkMacSystemFont, "OpenAI Sans", system-ui, "Segoe UI", Helvetica, Arial, sans-serif;
  font-size: 17px; line-height: 1.5;
  display: flex; flex-direction: column; -webkit-font-smoothing: antialiased;
}

/* Top bar */
.topbar {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  padding: 8px 14px; padding-top: calc(8px + env(safe-area-inset-top));
  position: sticky; top: 0; background: var(--bg); z-index: 5;
}
.topbar .menu-circle { justify-self: start; }
.topbar .title { justify-self: center; }
.topbar .login-pill { justify-self: end; }
.menu-circle {
  width: 44px; height: 44px; border-radius: 50%; background: var(--composer-bg);
  border: 1px solid var(--circle-border); color: var(--fg);
  display: inline-flex; align-items: center; justify-content: center; padding: 0;
}
.title { font-size: 20px; font-weight: 700; }
.conversation .title { visibility: hidden; }
.login-pill {
  background: #000; color: #fff; border: none; font-size: 17px; font-weight: 600;
  padding: 11px 22px; border-radius: 999px;
}

/* Thread */
.thread { flex: 1; overflow-y: auto; padding: 4px 18px 16px; -webkit-overflow-scrolling: touch; }
.thread-inner { max-width: 760px; margin: 0 auto; }
.empty-state { display: flex; flex-direction: column; align-items: center; padding-top: 26vh; gap: 26px; }
.greeting { font-size: 28px; font-weight: 600; margin: 0; text-align: center; }

.msg { margin: 18px 0; }
.msg.user { display: flex; justify-content: flex-end; }
.msg.user .bubble {
  background: var(--user-bubble); color: var(--user-text);
  border-radius: 22px; padding: 11px 17px; max-width: 85%; font-size: 18px;
}
.msg.assistant .bubble { font-size: 18px; line-height: 1.7; }
.bubble { white-space: pre-wrap; word-wrap: break-word; }
.msg.assistant h3 { font-size: 21px; font-weight: 700; margin: 22px 0 10px; }
.msg.assistant .li { display: flex; gap: 10px; margin: 6px 0; }
.msg.assistant .li .num { font-weight: 700; }
.msg.assistant p { margin: 14px 0; }
.msg.assistant strong { font-weight: 700; }
.cursor::after { content: "▍"; margin-left: 1px; animation: blink 1s steps(2,start) infinite; }
@keyframes blink { to { visibility: hidden; } }

/* Suggestion chip (empty state) */
.suggest { display: flex; justify-content: center; margin-top: 2px; }
.chip {
  background: var(--composer-bg); border: 1px solid var(--circle-border);
  border-radius: 999px; padding: 10px 18px; font-size: 16px; color: var(--fg);
}

/* Composer */
.composer { position: sticky; bottom: 0; background: var(--bg); padding: 8px 14px calc(10px + env(safe-area-inset-bottom)); }
.composer-inner {
  display: flex; align-items: flex-end; gap: 6px; max-width: 760px; margin: 0 auto;
  background: var(--composer-bg); box-shadow: var(--composer-shadow);
  border-radius: 28px; padding: 7px 8px 7px 10px;
}
.icon-btn {
  background: none; border: none; color: var(--fg); padding: 0;
  width: 40px; height: 40px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto;
}
#input {
  flex: 1; border: none; outline: none; resize: none; background: transparent; color: var(--fg);
  font: inherit; line-height: 1.4; padding: 9px 2px; max-height: 160px; overflow-y: auto; min-width: 0;
}
#input::placeholder { color: var(--muted); }
#input { scrollbar-width: none; }
#input::-webkit-scrollbar { display: none; }

.circle-btn {
  width: 42px; height: 42px; border-radius: 50%; background: var(--blue); color: #fff;
  border: none; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto;
}
[hidden] { display: none !important; }
