:root { color-scheme: light; font: 16px/1.55 system-ui, sans-serif; color: #202020; background: #fff; }
* { box-sizing: border-box; }
body { margin: 0; }
main { width: min(100%, 760px); height: 100dvh; margin: auto; padding: max(20px, env(safe-area-inset-top)) 24px max(12px, env(safe-area-inset-bottom)); display: flex; flex-direction: column; }
.ephemeral-note { text-align: center; font-size: .85rem; color: #a2a79e; margin: 0 0 20px; }
#workspace { flex: 1; min-height: 0; display: flex; flex-direction: column; }
#messages { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 20px 4px; scrollbar-width: thin; }
article { width: fit-content; max-width: 88%; margin: 0 0 20px; }
article.user { margin-left: auto; background: #f2f2f2; border-radius: 20px 20px 5px 20px; padding: 12px 18px; }
article.assistant { padding: 8px 4px; }
article p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
article .incomplete { font-size: .8rem; color: #b6ad94; margin-top: 10px; }
.composer { flex-shrink: 0; padding-top: 12px; }
#chat-form { display: flex; align-items: flex-end; gap: 12px; background: #fff; border: 1px solid #ddd; border-radius: 24px; padding: 10px; }
textarea, input { font: inherit; color: inherit; background: transparent; border: 0; min-width: 0; }
textarea { flex: 1; resize: none; padding: 8px 6px; max-height: 150px; }
textarea::placeholder, input::placeholder { color: #999f94; }
button { font: inherit; font-size: .9rem; font-weight: 600; cursor: pointer; border: 0; border-radius: 20px; padding: 10px 18px; background: #e9e9e9; color: #222; }
button:disabled { opacity: .45; cursor: default; }
button.quiet { background: transparent; color: #444; }
:focus-visible { outline: 2px solid #e9e9e9; outline-offset: 3px; }
#privacy-note, .mock-note { text-align: center; color: #999f94; font-size: .73rem; margin: 10px 0 0; }
.mock-note { font-size: .68rem; }
#status { text-align: center; color: #555; font-size: .8rem; margin: 8px 0 0; }
#status:empty { display: none; }
#confirmation { margin-bottom: 12px; padding: 14px; background: #fff; border: 1px solid #ddd; border-radius: 16px; font-size: .85rem; }
#quote { margin: 0 0 10px; }
.login-panel { flex-shrink: 0; font-size: .8rem; color: #bbc1b5; }
.login-panel summary { cursor: pointer; text-align: center; }
.login-panel form { padding: 12px 0; }
#trial-note { text-align: center; margin: 0 0 8px; font-size: .85rem; color: #555; }
.account-actions { display: flex; justify-content: center; align-items: center; gap: 12px; font-size: .85rem; }
.account-actions a { color: #e9e9e9; padding: 8px; }
#login-form { max-width: 360px; width: 100%; margin: auto; display: grid; gap: 14px; }
#login-form label { font-size: .85rem; color: #bbc1b5; }
#invite { padding: 14px; border: 1px solid #ddd; border-radius: 14px; background: #fff; width: 100%; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
[hidden] { display: none !important; }
@media (max-width: 480px) { main { padding-left: 14px; padding-right: 14px; } article { max-width: 92%; } }

#plan-controls { display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap; font-size: .8rem; margin: 12px 0; }
#plan-controls select { font: inherit; background: #fff; color: #222; border: 1px solid #ddd; border-radius: 8px; padding: 6px; max-width: 100%; }
#manage-usage { color: #e9e9e9; }
dialog { max-width: min(90vw, 430px); color: #222; background: #fff; border: 1px solid #ddd; border-radius: 18px; padding: 24px; }
dialog::backdrop { background: #0009; }

#api-controls { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: .6rem; margin: 1rem 0; }
#api-controls[hidden] { display: none; }
#api-controls select { min-width: 0; max-width: 100%; }
#api-controls p { flex-basis: 100%; margin: 0; font-size: .8rem; color: var(--muted, #777); }

#prompt:focus, #prompt:focus-visible { outline: none; box-shadow: none; }
#status { margin: 0 0 8px; }
#api-controls select { font: inherit; color: #222; background: #fff; border: 1px solid #ddd; border-radius: 8px; padding: 6px; }

/* Empty chats keep the composer at the viewport midpoint. The logo occupies
   the space above it; existing conversations retain the bottom composer. */
main { position: relative; }
.brand-header { display: flex; align-items: center; flex-shrink: 0; height: 48px; }
.brand-header img { display: block; object-fit: contain; margin-left: -16px; }
.hero-logo { display: none; }
main:has(#messages:empty) .brand-header { display: none; }
main:has(#messages:empty) #messages { display: none; }
main:has(#messages:empty) .composer {
  position: absolute; top: 50%; left: 24px; right: 24px;
  transform: translateY(-50%); padding-top: 0;
}
main:has(#messages:empty) .hero-logo {
  display: block; position: absolute; bottom: calc(100% + 12px); left: 50%;
  transform: translateX(-50%); width: clamp(120px, 24dvh, 224px); height: auto;
}
@media (max-width: 480px) {
  main:has(#messages:empty) .composer { left: 14px; right: 14px; }
}
@media (max-height: 500px) {
  main:has(#messages:empty) .hero-logo { width: 100px; bottom: 100%; }
}

#chat-pitch { flex-shrink: 0; align-self: center; width: max-content; max-width: calc(100vw - 28px); margin: 18px 0 0; color: #6b7270; font-size: .85rem; line-height: 1.65; text-align: center; text-wrap: pretty; }

#wallet-dialog { width: min(92vw, 460px); max-height: 90dvh; overflow-y: auto; }
#wallet-close { float: right; }
#wallet-content { clear: both; }
#wallet-content h2 { font-size: 1.3rem; }
#wallet-content button { display: block; width: 100%; margin: 10px 0; }
#wallet-content input { width: 100%; border: 1px solid #ccc; border-radius: 10px; padding: 12px; margin: 8px 0; }
.wallet-note, #wallet-notice { font-size: .8rem; color: #666; }
.wallet-balance { font-size: 1.5rem; }
.recovery-code { display: block; overflow-wrap: anywhere; padding: 16px; background: #f3f6f5; border-radius: 10px; user-select: all; }
.wallet-qr { display: block; max-width: 100%; width: 240px; margin: auto; }
.pair-comparison { display: block; font-size: 2rem; letter-spacing: .25em; text-align: center; }

#wallet-content textarea { display: block; width: 100%; border: 1px solid #ccc; border-radius: 10px; padding: 12px; font-size: .85rem; }

.connection-label { display: block; font-size: .75rem; color: #62716d; margin-bottom: 8px; }

/* Keep each answer's recorded provider alongside its text. */
article.assistant { display: grid; grid-template-columns: minmax(0, 1fr) 132px; column-gap: 20px; width: 100%; max-width: 100%; }
article.assistant > p, article.assistant > .connection-label { grid-column: 1; }
.reply-route { grid-column: 2; grid-row: 1 / span 3; align-self: start; border-left: 1px solid #e5e9e7; padding-left: 12px; color: #69736e; font-size: .72rem; line-height: 1.5; overflow-wrap: anywhere; }
.reply-route strong, .reply-route span { display: block; }
.reply-route strong { font-weight: 600; color: #46534c; }
@media (max-width: 480px) {
  article.assistant { grid-template-columns: minmax(0, 1fr) 88px; column-gap: 12px; }
  .reply-route { padding-left: 8px; font-size: .67rem; }
}
