:root {
  color: #182033;
  background: #f7f8fc;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: #f7f8fc; }
button, textarea { font: inherit; }
button { cursor: pointer; }

.app-shell { margin: 0 auto; min-height: 100dvh; max-width: 680px; background: #fff; }
.screen { min-height: 100dvh; }
.topbar { display: flex; align-items: center; justify-content: space-between; min-height: 84px; padding: calc(16px + env(safe-area-inset-top)) 20px 16px; border-bottom: 1px solid #e8ebf2; }
.topbar h1 { margin: 1px 0 0; font-size: 25px; letter-spacing: -.4px; }
.eyebrow { margin: 0; color: #6d7483; font-size: 12px; font-weight: 600; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.export-button { padding: 7px 9px; color: #535c70; font-size: 12px; border: 1px solid #dce1eb; border-radius: 9px; background: #fff; }
.export-button:active { background: #f0f2f7; }
.status { display: inline-flex; align-items: center; gap: 6px; color: #6d7483; font-size: 12px; white-space: nowrap; }
.status::before { width: 8px; height: 8px; border-radius: 50%; background: #a9afbb; content: ""; }
.status[data-state="connected"] { color: #247348; }
.status[data-state="connected"]::before { background: #35a866; }
.status[data-state="connecting"]::before { background: #e6a22b; }
.status[data-state="reconnecting"] { color: #8b6416; }
.status[data-state="reconnecting"]::before { background: #e6a22b; }
.status[data-state="error"] { color: #ae3541; }
.status[data-state="error"]::before { background: #d7515e; }

.conversation { display: flex; width: 100%; align-items: center; gap: 13px; padding: 17px 20px; color: inherit; text-align: left; border: 0; border-bottom: 1px solid #eef0f5; background: #fff; }
.conversation:active { background: #f5f7fb; }
.avatar { display: grid; flex: 0 0 48px; width: 48px; height: 48px; place-items: center; color: #fff; font-weight: 700; border-radius: 16px; background: linear-gradient(135deg, #685ee8, #3e95db); }
.conversation-copy { display: grid; min-width: 0; gap: 4px; }
.conversation-copy strong { overflow: hidden; font-size: 16px; text-overflow: ellipsis; white-space: nowrap; }
.conversation-copy span, .hint { color: #737b8b; font-size: 13px; }
.chevron { margin-left: auto; color: #a9afbb; font-size: 30px; line-height: 1; }
.hint { margin: 18px 20px; line-height: 1.55; }

.chat-screen { display: grid; grid-template-rows: auto 1fr auto; }
.chat-header { justify-content: flex-start; gap: 10px; min-height: 72px; padding-top: calc(10px + env(safe-area-inset-top)); padding-bottom: 10px; }
.icon-button { display: grid; width: 38px; height: 38px; place-items: center; color: #31394a; font-size: 36px; line-height: 1; border: 0; border-radius: 50%; background: transparent; }
.icon-button:active { background: #eef1f7; }
.chat-title { display: grid; gap: 3px; min-width: 0; }
.chat-title h1 { overflow: hidden; max-width: 250px; margin: 0; font-size: 17px; text-overflow: ellipsis; white-space: nowrap; }
.messages { display: flex; flex-direction: column; gap: 12px; overflow-y: auto; padding: 20px; background: #f7f8fc; }
.empty-state { align-self: center; margin: auto; color: #798192; font-size: 14px; text-align: center; line-height: 1.6; }
.message { display: flex; flex-direction: column; gap: 4px; max-width: 80%; }
.message.remote { align-self: flex-start; }
.message.local { align-self: flex-end; align-items: flex-end; }
.bubble { padding: 10px 12px; color: #253047; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; border-radius: 15px 15px 15px 4px; background: #fff; box-shadow: 0 1px 2px rgb(26 37 58 / 8%); }
.local .bubble { color: #fff; border-radius: 15px 15px 4px 15px; background: #5950d8; }
.message-meta { color: #7c8494; font-size: 11px; }
.composer { display: flex; align-items: flex-end; gap: 10px; padding: 10px 14px calc(10px + env(safe-area-inset-bottom)); border-top: 1px solid #e8ebf2; background: #fff; }
.composer textarea { display: block; flex: 1; max-height: 120px; padding: 10px 12px; line-height: 1.4; resize: none; border: 1px solid #d9deea; border-radius: 18px; outline: none; }
.composer textarea:focus { border-color: #6359df; box-shadow: 0 0 0 3px rgb(99 89 223 / 12%); }
.composer button { min-height: 40px; padding: 0 15px; color: #fff; font-weight: 650; border: 0; border-radius: 15px; background: #5950d8; }
.composer button:disabled { cursor: not-allowed; background: #a8a5d9; }
.notice-card { max-width: 480px; margin: 20vh auto; padding: 24px; text-align: center; }
.notice-card h1 { margin: 0 0 9px; font-size: 22px; }.notice-card p { color: #667084; line-height: 1.6; }.notice-card code { padding: 2px 5px; border-radius: 5px; background: #eef0f6; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
@media (min-width: 681px) { .app-shell { min-height: 100vh; border-right: 1px solid #e8ebf2; border-left: 1px solid #e8ebf2; }.screen { min-height: 100vh; } }
