:root {
  color-scheme: light dark;
  --bg: #ffffff;
  --fg: #1a1a1a;
  --muted: #6b6b6b;
  --border: #ddd;
  --bubble-user: #e8effc;
  --bubble-assistant: #f2f2f2;
  --accent: #3a5fcd;
  --danger: #b3261e;
  --success: #1e7d32;
  --warning: #b3790e;
  /* Per-room overrides (Erik's ask, 2026-10-01 - a purely human-facing background + bubble/text
     opacity) - see app.js's applyRoomAppearance. Defaults here are a no-op (no image, fully opaque),
     so a room with nothing set looks EXACTLY as it always has - these are never touched unless a
     room actually has an appearance saved. */
  --chat-bg-image: none;
  --bubble-opacity: 1;
  --text-opacity: 1;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16171a;
    --fg: #eaeaea;
    --muted: #9a9a9a;
    --border: #333;
    --bubble-user: #223054;
    --bubble-assistant: #26272b;
    --accent: #6f8fe8;
    --danger: #e5786f;
    --success: #6fcf82;
    --warning: #e0ab4b;
  }
}

* { box-sizing: border-box; }

/* Full-screen, opaque gate - used both by the real login screen and the post-Google
   password-setup gate (see app.js's showPasswordGate) - not a modal over the chat, a replacement
   for it, so neither one is missable or dismissable except by actually completing it. */
.gate-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  /* Same edge-to-edge reasoning as #sidebarToggle above - a taller form (signup) can otherwise land
     right against the status/nav bar on Android. */
  padding: calc(1.5rem + env(safe-area-inset-top)) 1.5rem calc(1.5rem + env(safe-area-inset-bottom));
}

.gate-screen[hidden] { display: none; }

.gate-card {
  width: 100%;
  max-width: 320px;
  text-align: center;
}

.gate-card h1 {
  font-size: 1.3rem;
  margin: 0 0 0.25rem;
}

.brand-banner {
  display: block;
  width: 100%;
  max-width: 220px;
  height: auto;
  margin: 0 auto 0.5rem;
}

.gate-card form {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-top: 1.2rem;
}

.gate-card input {
  font: inherit;
  font-size: 1rem;
  padding: 0.65rem 0.75rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--fg);
}

#googleSignInArea {
  display: flex;
  justify-content: center;
  margin-top: 1.5rem;
  min-height: 1px; /* avoids a layout jump once the button actually renders in - see initGoogleSignIn */
}

.login-link {
  display: block;
  width: 100%;
  margin-top: 0.75rem;
  font: inherit;
  font-size: 0.85rem;
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  text-decoration: underline;
}

/* Shown when a login/signup/set-password request itself fails (bad credentials, server
   unreachable, etc.) - needs to be visible right here since the gate screen replaces the whole
   app - there's nowhere else on screen to show it yet. */
.login-error {
  color: var(--danger);
  font-size: 0.85rem;
  margin-top: 1rem;
}

.login-error[hidden] { display: none; }

.login-user-btn {
  font: inherit;
  font-size: 1rem;
  padding: 0.75rem 1rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--fg);
  cursor: pointer;
}

.login-user-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* Same message shape as .login-error, for a request that succeeded (e.g. "Password updated"). */
.login-success {
  color: var(--success);
  font-size: 0.85rem;
  margin-top: 1rem;
}

.login-success[hidden] { display: none; }

/* Dismissable overlay for the settings panel - unlike .gate-screen (opaque, replaces the whole app,
   used for login/the forced post-Google password setup), this sits ON TOP of a normal, already-signed-
   in session and can be closed without completing anything. */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.5);
  padding: 1.5rem;
}

.modal-overlay[hidden] { display: none; }

.modal-card {
  position: relative;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.5rem;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.modal-card h2 {
  font-size: 1rem;
  margin: 1.5rem 0 0.25rem;
}

.modal-close {
  position: absolute;
  top: 0.5rem;
  right: 0.75rem;
  font: inherit;
  font-size: 1.4rem;
  line-height: 1;
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 0.25rem;
}

.modal-close:hover { color: var(--fg); }

/* ---------- appearance modal (Erik's ask, 2026-10-01) ---------- */

.appearance-card {
  width: 100%;
  max-width: 480px;
  max-height: 85vh;
  overflow-y: auto;
}

#appearanceImageGrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  gap: 0.5rem;
  margin: 0.75rem 0;
}

.appearance-thumb {
  position: relative;
  aspect-ratio: 1;
  border-radius: 8px;
  overflow: hidden;
  border: 2px solid transparent;
  cursor: pointer;
  padding: 0;
  background: none;
}

.appearance-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.appearance-thumb:hover { border-color: var(--border); }

.appearance-thumb.selected { border-color: var(--accent); }

#appearanceUploadRow {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

#appearanceUploadRow button {
  font: inherit;
  font-size: 0.85rem;
  padding: 0.4rem 0.8rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: none;
  color: var(--fg);
  cursor: pointer;
}

#appearanceUploadRow button:hover { border-color: var(--accent); }

.appearance-slider-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0.5rem 0 1rem;
}

.appearance-slider-row input[type="range"] {
  flex: 1;
}

.appearance-slider-row span {
  min-width: 3.5ch;
  font-size: 0.8rem;
  text-align: right;
}

/* Full-size image viewer (Erik's ask, 2026-09-10): edge-to-edge over a near-opaque backdrop, not a
   centered card like .modal-overlay - the image itself is the whole point, nothing should compete
   with it for space. touch-action: none on the viewport hands ALL pinch/pan/zoom gesture handling to
   app.js's pointer-event code rather than letting the browser's own native gesture also try to act on
   the same touches - see app.js's lightbox section for why. */
.lightbox-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0.92);
}

.lightbox-overlay[hidden] { display: none; }

.lightbox-viewport {
  width: 100%;
  height: 100%;
  overflow: hidden;
  touch-action: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: grab;
}

.lightbox-viewport.dragging { cursor: grabbing; }

.lightbox-image {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
  will-change: transform;
}

.lightbox-close {
  position: absolute;
  /* env(safe-area-inset-top) - same reason as #sidebarToggle above: Android's edge-to-edge display
     draws this overlay's content under the system status bar otherwise, putting the close button
     right behind it and out of reach (found live 2026-09-10 - missed this the first time round).
     Harmless no-op in a plain browser. */
  top: calc(0.5rem + env(safe-area-inset-top));
  right: 0.75rem;
  z-index: 201;
  font: inherit;
  font-size: 2rem;
  line-height: 1;
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  padding: 0.25rem 0.6rem;
}

.lightbox-close:hover { opacity: 0.8; }

/* The thumbnail shown inline in a chat bubble - hinting it's clickable (see app.js's openLightbox)
   without needing a separate icon overlay. */
.attached-image { cursor: zoom-in; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden; /* the page itself never scrolls - #messagesScroll does */
}

body {
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--fg);
}

#app {
  position: relative;
  display: flex;
  /* 100vh on mobile includes space hidden behind browser chrome (address bar) that isn't actually
     visible, which is exactly what was pushing the composer off-screen. 100dvh (dynamic viewport
     height) tracks the REAL visible area, including shrinking correctly when the on-screen keyboard
     opens - one responsive layout that works on any device, not a separate mobile page. Fallback to
     100vh first for browsers that don't know dvh yet; dvh overrides it where supported. */
  height: 100vh;
  height: 100dvh;
}

/* Sidebar is a DRAWER, not a layout column: fixed/overlaid, slides in over the content rather than
   resizing it (same pattern as most chat apps' room lists). #app's own width never changes when it
   opens or closes. */
#sidebarToggle {
  position: absolute;
  /* env(safe-area-inset-top) - without this, Android's edge-to-edge display (enforced for apps
     targeting API 35+, see anilith-app's MainActivity/EdgeToEdge.enable) draws the WebView content
     UNDER the system status bar, putting this button right behind it. Harmless no-op in a plain
     browser (env() resolves to 0 there). */
  top: calc(0.75rem + env(safe-area-inset-top));
  left: 0.75rem;
  z-index: 30;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--fg);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
}

#sidebarBackdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 15;
}

#sidebarBackdrop[hidden] { display: none; }

/* On a wide-enough screen the drawer opens by default and isn't a modal overlay in spirit - no
   permanent dimming of the chat behind it, even while JS considers it "open". */
@media (min-width: 700px) {
  #sidebarBackdrop { display: none !important; }
}

#sidebar {
  position: fixed;
  top: 0;
  left: 0;
  height: 100%;
  width: min(240px, 80vw);
  z-index: 20;
  transform: translateX(-100%);
  transition: transform 0.2s ease;
  border-right: 1px solid var(--border);
  background: var(--bg);
  padding: 1rem;
  padding-top: calc(3.25rem + env(safe-area-inset-top)); /* clears the toggle button, see its own comment */
  /* Same edge-to-edge reasoning as the top - without this, whatever's last in the sidebar (appVersion
     is margin-top:auto, pushing it and updateBanner to the bottom) lands right where Android's
     on-screen nav bar buttons overlap it. Found live 2026-09-02: Erik correctly guessed the missing
     app-version text was "off screen, under the restart server button" (the button that margin-top:
     auto lived on at the time, since removed - see server.js's shutdown() comment) - it was, exactly
     there, just invisible under the nav bar rather than truly off-screen. */
  padding-bottom: calc(1rem + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  overflow-y: auto;
}

#sidebar.open {
  transform: translateX(0);
}

#sidebar label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.85rem;
  color: var(--muted);
}

#currentUser {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.85rem;
}

#currentUserRow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

#currentUserName {
  font-weight: 600;
}

#switchUserBtn {
  font: inherit;
  font-size: 0.75rem;
  padding: 0.25rem 0.6rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: none;
  color: var(--muted);
  cursor: pointer;
}

#switchUserBtn:hover {
  color: var(--fg);
  border-color: var(--accent);
}

#sidebar select {
  font-size: 16px; /* below 16px, iOS Safari auto-zooms the whole page on focus */
  padding: 0.4rem;
  background: var(--bg);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 6px;
}

.muted { color: var(--muted); font-size: 0.8rem; }

#settingsBtn {
  font: inherit;
  font-size: 0.8rem;
  padding: 0.5rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: none;
  color: var(--muted);
  cursor: pointer;
}

#settingsBtn:hover {
  color: var(--fg);
  border-color: var(--accent);
}

/* App-only footer (appVersion/updateBanner, both hidden in a plain browser - see index.html's own
   comment) - pinned to the bottom of the sidebar, same role the removed restart button's margin-top:
   auto used to serve. A plain-browser sidebar simply has no bottom-pinned element any more, which is
   fine - there's nothing there to pin. */
#appVersion {
  margin-top: auto;
}

#updateBanner {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 0.6rem;
  border-radius: 8px;
  border: 1px solid var(--accent);
}

#updateBanner[hidden] { display: none; }

#updateBanner p { margin: 0; }

#updateBanner button {
  font: inherit;
  font-size: 0.8rem;
  padding: 0.4rem;
  border-radius: 6px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: white;
  cursor: pointer;
}

#chat {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0; /* flex children default to min-height:auto, which lets content overflow the
                    dvh-constrained container instead of scrolling inside it - this is what actually
                    keeps the composer on-screen rather than pushed below it */
  height: 100%;
  /* Room background (see :root's --chat-bg-image) - lives on #chat, not #messagesScroll, so it stays
     put behind the composer too, not just behind the scrolling message list. none by default - a
     room with no background set shows the plain --bg color underneath exactly as before. */
  background-image: var(--chat-bg-image);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

#messagesScroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 1rem 1.5rem;
  /* Same clearance as #sidebar's own padding-top - without this, scrolling all the way up reveals
     #loadOlderRow (the first child) rendered right under the status bar/hamburger toggle under
     Android's edge-to-edge rendering, both visually cut off and genuinely untappable. Found live
     2026-09-07: Erik could see "Load older" but couldn't actually tap it. */
  padding-top: calc(3.25rem + env(safe-area-inset-top));
}

#messages {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

#loadOlderRow {
  display: flex;
  justify-content: center;
  margin-bottom: 0.75rem;
}

#loadOlderRow[hidden] {
  display: none;
}

#loadOlderBtn {
  font: inherit;
  font-size: 0.8rem;
  padding: 0.3rem 0.9rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: none;
  color: var(--muted);
  cursor: pointer;
}

#loadOlderBtn:hover {
  color: var(--fg);
  border-color: var(--accent);
}

#loadOlderBtn:disabled {
  opacity: 0.5;
  cursor: default;
}

.section-divider {
  text-align: center;
  color: var(--muted);
  font-size: 0.75rem;
  margin: 0.4rem 0;
}

.bubble {
  position: relative;
  max-width: 70%;
  padding: 0.6rem 0.9rem;
  border-radius: 12px;
  white-space: pre-wrap;
  word-wrap: break-word;
  /* --text-opacity (see :root) - 1 by default, a no-op; only actually fades the text once a room's
     appearance sets it below 1, e.g. to let a background image show through more. Genuinely
     independent of --bubble-opacity below - that one only ever touches .bubble.user/.assistant's
     OWN background property, never this color. What actually changes together as bubble-opacity
     drops is CONTRAST, not opacity: a more transparent bubble shows more of an arbitrary photo behind
     the text, so a fixed text color can become hard to read even though its own alpha never moved -
     that's what the outline below is actually for (Erik's ask, 2026-10-02), not a second opacity bug. */
  color: color-mix(in srgb, var(--fg) calc(var(--text-opacity) * 100%), transparent);
  /* A faint stroke (the classic 4-direction text-shadow trick - no font renders -webkit-text-stroke
     identically enough to rely on it here) using --bg, which already has real contrast against --fg
     in both themes. Always on, fixed strength, independent of either opacity slider - this is a
     legibility floor, not something to tune - so text stays readable against any arbitrary photo
     color once the bubble itself is faded down or gone entirely. */
  text-shadow:
    -1px -1px 0 var(--bg), 1px -1px 0 var(--bg),
    -1px  1px 0 var(--bg), 1px  1px 0 var(--bg);
}

.bubble .speaker {
  display: block;
  font-size: 0.75rem;
  color: var(--muted);
  margin-bottom: 0.2rem;
}

.bubble.user {
  /* --bubble-opacity (see :root) - 1 by default, a no-op; blends the bubble's own background toward
     transparent, independent of --text-opacity above, so a background image can show through the
     bubble panel without the TEXT itself fading at the same rate. */
  background: color-mix(in srgb, var(--bubble-user) calc(var(--bubble-opacity) * 100%), transparent);
}

.bubble.assistant {
  background: color-mix(in srgb, var(--bubble-assistant) calc(var(--bubble-opacity) * 100%), transparent);
}

/* User/assistant bubbles are wrapped in this (see buildBubble/2026-09-09) so a tap-to-reveal
   timestamp can be attached - this row, not the bubble itself, is #messages' direct flex child now,
   so it's what carries the align-self that used to live on .bubble.user/.bubble.assistant directly.
   Tool-call/system bubbles skip this wrapper entirely (no timestamp, no delete button) and keep their
   own align-self as before. Column direction (2026-09-10, replacing the earlier side-by-side layout,
   Erik's ask) - the timestamp is now a genuine "drawer" ABOVE the bubble that pushes the rest of the
   conversation down when it opens, not something that fades in beside it. */
.message-row {
  display: flex;
  flex-direction: column;
  max-width: 70%;
}

.message-row.user {
  align-self: flex-end;
}

.message-row.assistant {
  align-self: flex-start;
}

.message-row .bubble {
  max-width: 100%; /* the row above already caps overall width; the bubble just fills it */
}

/* grid-template-rows: 0fr -> 1fr is the current standard way to animate to/from an intrinsic
   ("auto") height - height: auto can't be transitioned directly at all, and a fixed max-height guess
   would either clip a larger font-size setting or leave dead space above shorter text. */
.message-timestamp-wrap {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.2s ease;
}

.message-timestamp-wrap.visible {
  grid-template-rows: 1fr;
}

.message-timestamp-inner {
  overflow: hidden;
  min-height: 0;
}

.message-timestamp {
  display: block;
  font-size: 0.7rem;
  color: var(--muted);
  white-space: nowrap;
  cursor: default;
  padding-bottom: 0.25rem;
}

.message-row.user .message-timestamp { text-align: right; }
.message-row.assistant .message-timestamp { text-align: left; }

/* Constant (never tap-to-reveal, unlike .message-timestamp above) marker between two calendar days'
   worth of messages - see app.js's buildDateDivider. An actual line either side of the label, same
   spirit as #loadOlderRow's pill but drawn as a real divider since this one isn't a button. */
.date-divider {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--muted);
  font-size: 0.75rem;
  margin: 0.4rem 0;
}

.date-divider::before, .date-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* Message send/reply status (Erik's ask, 2026-09-12): a single small indicator on the CURRENT pending
   exchange's bubble, reflecting the real server-side pipeline stage rather than a client-side guess -
   see app.js's setMessageStatus. Sits inline right after the bubble text, same line, no layout jump
   between states since every state renders at the same fixed size. */
.msg-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 0.85rem;
  height: 0.85rem;
  margin-left: 0.4rem;
  vertical-align: middle;
  flex: none;
}

/* sending / received / accepted all share the same ring - only the border style and ::after content
   change, so the icon doesn't visibly resize or jump between these three. */
.msg-status--sending, .msg-status--received, .msg-status--accepted {
  border-radius: 50%;
  box-sizing: border-box;
  font-size: 0.6rem;
  line-height: 1;
}

.msg-status--sending {
  border: 0.12rem solid var(--muted);
  border-top-color: transparent;
  animation: msg-status-spin 0.7s linear infinite;
}

.msg-status--received {
  border: 0.12rem solid var(--muted);
}

.msg-status--accepted {
  border: 0.12rem solid var(--success);
  color: var(--success);
}

.msg-status--accepted::after {
  content: "\2713"; /* checkmark */
}

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

/* Generating: three dots, staggered - a real chat-app "typing" convention, not a spinner, since a turn
   at this point could be running for minutes (a cold model load) and a spinner reads as "about to
   finish any second" in a way three slow-pulsing dots don't. */
.msg-status--generating {
  gap: 0.1rem;
}

.msg-status-dot {
  width: 0.2rem;
  height: 0.2rem;
  border-radius: 50%;
  background: var(--muted);
  animation: msg-status-pulse 1.1s ease-in-out infinite;
}

.msg-status-dot:nth-child(2) { animation-delay: 0.15s; }
.msg-status-dot:nth-child(3) { animation-delay: 0.3s; }

@keyframes msg-status-pulse {
  0%, 60%, 100% { opacity: 0.25; }
  30% { opacity: 1; }
}

/* Error/never-reached: the triangle itself IS the retry action now (Erik's ask, 2026-10-08) - tap it
   to resend directly, no separate button. The detail text below is always visible in this state (not
   tap-to-reveal anymore, since the icon's tap is spoken for) - still "the little drawer for the error
   message" Erik asked to keep, just no longer gated behind a second tap. */
.msg-status--error {
  color: var(--warning);
  cursor: pointer;
  font-size: 0.8rem;
}

.msg-status--error::after {
  content: "\26A0"; /* warning triangle */
}

.msg-status-detail {
  display: block;
  margin-top: 0.3rem;
  font-size: 0.75rem;
  color: var(--warning);
  max-width: 100%;
  overflow-wrap: break-word;
}

/* Local-only removal (Erik's ask, 2026-10-08): clears ONLY the phone/browser's own cached pending
   entry for a message that hasn't reached the server yet - never anything already in real history.
   Lives inside the detail drawer, separate from the triangle's own tap-to-retry. */
.msg-status-remove-btn {
  display: block;
  margin-top: 0.4rem;
  padding: 0.3rem 0.7rem;
  border: 1px solid var(--muted);
  border-radius: 8px;
  background: none;
  color: var(--muted);
  font-size: 0.75rem;
  cursor: pointer;
}

.msg-status-remove-btn:hover {
  color: var(--fg);
  border-color: var(--fg);
}

.bubble.tool-call {
  align-self: flex-start;
  background: none;
  border: 1px dashed var(--border);
  color: var(--muted);
  font-size: 0.8rem;
  max-width: 90%;
}

.bubble.system {
  align-self: center;
  color: var(--muted);
  font-size: 0.8rem;
  background: none;
}

#composer {
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  gap: 0.5rem;
  padding: 1rem 1.5rem;
  /* iOS home-indicator / notch safe area - the actual bottom edge often isn't safe to put controls
     right up against. viewport-fit=cover in the meta tag is what makes env() report a real value. */
  padding-bottom: max(1rem, env(safe-area-inset-bottom));
  border-top: 1px solid var(--border);
}

#composerRow {
  display: flex;
  gap: 0.5rem;
}

#attachBtn, #cameraBtn {
  flex-shrink: 0;
  width: 2.6rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--fg);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}

/* Emoji glyph runs a bit large next to the plain-text "+" - matches attachBtn's own visual weight
   instead of dominating the composer row. */
#cameraBtn {
  font-size: 1.1rem;
}

#pendingImages {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

#pendingImages .pending-thumb {
  position: relative;
  width: 64px;
  height: 64px;
}

#pendingImages .pending-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--border);
}

#pendingImages .pending-thumb button {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: white;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
}

.bubble img.attached-image {
  display: block;
  max-width: min(320px, 100%);
  max-height: 320px;
  border-radius: 8px;
  margin-top: 0.4rem;
  object-fit: contain;
}

#input {
  flex: 1;
  resize: none;
  font: inherit;
  font-size: 16px; /* below 16px, iOS Safari auto-zooms the whole page on focus */
  padding: 0.6rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--fg);
}

#composer button {
  padding: 0 1.2rem;
  border: none;
  border-radius: 8px;
  background: var(--accent);
  color: white;
  font-weight: 600;
  cursor: pointer;
}

#composer button:disabled {
  opacity: 0.5;
  cursor: default;
}
