/* Lumi's conversation has its own type scale and scrolling area. */
#maruChat{position:fixed;inset:auto 20px var(--chat-bottom,108px) auto;width:440px;max-width:calc(100vw - 24px);height:var(--chat-height,640px);max-height:calc(100dvh - 24px);margin:0;padding:0;border:1px solid #667c8666;border-radius:24px;background:#152b39;color:#f6efe3;box-shadow:0 20px 70px #06101b66;overflow:hidden;font:400 16px/1.75 Noto,sans-serif;z-index:80;color-scheme:dark}
#maruChat:popover-open,#maruChat:not([popover]):not([hidden]){display:flex;flex-direction:column}
#maruChat[hidden]{display:none}
#maruChat button,#maruChat textarea{font:inherit}
#maruChat button{touch-action:manipulation}
#maruChat :is(button,textarea,a,summary):focus-visible{outline:2px solid #efce91;outline-offset:3px}
body.chat-open .presence{visibility:hidden!important}
body.chat-open #conversationThread{opacity:0!important}
/* Reserve the left of desktop for the subject of the conversation. */
html:not(.bplus) body.chat-open #turn{visibility:hidden}
html:not(.bplus) body.chat-open #landscape:not([hidden]){position:fixed!important;inset:100px auto 124px 20px!important;width:calc(100vw - 500px)!important;height:auto!important;max-width:none!important;max-height:none!important;transform:none!important;opacity:1!important}
html:not(.bplus) body.chat-open #landscape .tree-viewport{width:100%!important;height:100%!important;max-height:none!important}
.chat-header{display:flex;align-items:center;gap:6px;flex:none;padding:8px 12px 8px 4px;border-bottom:1px solid #ffffff18}
.chat-avatar{position:relative;flex:none;width:80px;height:80px;padding:0;border:0;background:transparent;border-radius:50%}
#chatMaru #maru{width:100%!important;height:100%!important;max-width:none!important;max-height:none!important;transform:none!important;filter:none!important}
.chat-fallback{display:block!important;position:absolute!important;inset:15%!important;width:70%!important;height:70%!important}
.chat-heading{flex:1;min-width:0}
#chatTitle{font:600 17px/1.5 Noto,sans-serif;margin:0;letter-spacing:0}
#chatContext{color:#dfc38e;font-size:12px;line-height:1.5;margin:2px 0 0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
#maruChat .chat-icon-button{display:grid;place-items:center;flex:none;min-width:44px;width:44px;min-height:44px;height:44px;border-radius:50%;color:#cfdbd8;background:none;border:0;padding:0}
#chatExpand{display:none!important}
.chat-icon-button .icon{width:20px;height:20px}
.chat-header #chatTopicsToggle span{display:none}
.chat-scroll{flex:1;min-height:0;overflow-y:auto;overscroll-behavior:contain;overflow-anchor:none;scrollbar-width:thin;scrollbar-color:#657570 transparent;padding:20px;scroll-padding:12px}
.chat-welcome{padding:4px 0 18px}
.chat-welcome>p{font-size:17px;line-height:1.85;margin:0 0 12px}
#maruChat .chat-context-button{display:flex;align-items:center;gap:10px;min-height:44px;padding:4px 0;color:#e8c891;font-size:13px}
.chat-exchange{margin-bottom:24px}
.chat-message{overflow-wrap:anywhere}
.chat-message p{font-size:16px;line-height:1.85;white-space:pre-line;margin:6px 0 0}
.chat-user{margin:0 0 18px 32px;padding:12px 16px;background:#d7c09114;border:1px solid #dfc38e30;border-radius:16px 16px 4px 16px}
.chat-user .chat-speaker{color:#d8c49d}
.chat-answer{padding:0 0 0 2px}
.chat-speaker{font-size:12px;letter-spacing:.03em;color:#e8c891}
.chat-status{display:inline-block;margin-left:10px;font-size:11px;color:#c7d2cb}
.chat-answer-actions{display:flex;align-items:center;flex-wrap:wrap;gap:4px 16px;margin-top:8px}
#maruChat .chat-answer-actions button{display:inline-flex;align-items:center;gap:7px;min-height:44px;padding:4px 0;color:#d1d9d4;font-size:12px;text-align:left}
.chat-answer-actions .icon{width:16px;height:16px;flex:none}
#maruChat [data-chat-save][aria-pressed=true]{color:#efce91}
.chat-detail{margin-top:8px}
.chat-detail summary{display:flex;align-items:center;justify-content:space-between;min-height:44px;gap:12px;font-size:13px;color:#dfc38e;list-style:none;cursor:pointer}
.chat-detail summary::-webkit-details-marker{display:none}
.chat-detail summary::marker{content:''}
.chat-detail summary .icon{width:16px;height:16px}
.chat-detail[open] summary .icon{transform:rotate(180deg)}
.chat-detail>p{border-left:1px solid #dfc38e55;padding-left:12px;color:#d0dcd7}
.chat-suggestions,.chat-clarifications{display:flex;flex-direction:column;gap:8px}
.chat-clarifications{margin-top:14px}
#maruChat [data-chat-question]{display:flex;align-items:center;justify-content:space-between;gap:10px;width:100%;min-height:44px;padding:10px 12px;border:1px solid #d3c49840;background:#ffffff04;color:#ead9b7;border-radius:13px;font-size:14px;line-height:1.6;text-align:left}
#maruChat [data-chat-question] .icon{width:16px;height:16px;flex:none}
#maruChat [data-chat-question]:hover{background:#e8c89113;border-color:#d3c49888}
.chat-contact{display:inline-flex;align-items:center;min-height:44px;font-size:13px;color:#e8c891;text-decoration:underline;text-underline-offset:4px;margin-top:10px}
.chat-topics{border-top:1px solid #ffffff25;margin-top:20px;padding-top:14px}
.chat-topics[hidden]{display:none}
.chat-topics-heading{display:flex;align-items:center;justify-content:space-between;gap:12px}
#chatTopicsTitle{font-size:16px;margin:0}
.chat-categories{display:flex;flex-wrap:wrap;gap:4px;margin:6px 0 14px}
#maruChat .chat-categories button{min-height:44px;padding:8px 10px;font-size:13px;border-radius:12px;color:#cbd7d0}
#maruChat .chat-categories button[aria-pressed=true]{background:#e8c8911c;color:#efce91}
.chat-topic-list{display:flex;flex-direction:column;gap:8px}
.chat-composer{position:relative;flex:none;border-top:1px solid #ffffff20;padding:6px 16px 12px;background:#132632}
.chat-composer-tools{display:flex;align-items:center;justify-content:space-between;gap:12px}
#maruChat .chat-composer-tools button{display:flex;align-items:center;gap:8px;min-height:40px;padding:2px 0;font-size:12px;color:#e8c891}
.chat-composer-tools .icon{width:16px;height:16px}
.chat-composer-tools>span{font-size:11px;color:#aebfbd}
#chatForm{display:flex;align-items:flex-end;gap:8px;margin:0}
#chatInput{display:block;box-sizing:border-box;flex:1;min-width:0;min-height:48px;max-height:96px;resize:none;border:1px solid #9bb0b366;border-radius:14px;background:#213c4b;color:#f6efe3;padding:10px 12px;font:400 16px/1.65 Noto,sans-serif;overflow-y:auto;scroll-margin:0!important}
#chatInput::placeholder{color:#b3c3c5}
#chatSend{min-width:56px;min-height:48px;border-radius:14px;border:0;background:#e8c891;color:#14232e;padding:8px 12px;font-weight:700!important}
#chatSend:disabled{opacity:.4;cursor:default}
#chatNotice{font-size:11px;line-height:1.6;color:#afbfbd;margin:8px 0 0}
#maruChat .chat-latest{position:absolute;bottom:calc(100% + 8px);left:50%;transform:translateX(-50%);display:flex;align-items:center;gap:8px;white-space:nowrap;min-height:44px;padding:8px 16px;border-radius:24px;background:#e8c891;color:#14232e;font-size:13px;box-shadow:0 4px 16px #0004}
#maruChat .chat-latest[hidden]{display:none}
html.bplus #maruChat{inset:auto 8px var(--chat-bottom,74px) 8px;width:auto;max-width:none;border-radius:24px}
html.bplus #chatExpand{display:grid!important}
html.bplus .chat-header{padding:6px 8px 6px 2px;gap:2px}
html.bplus .chat-avatar{width:68px;height:68px}
html.bplus .chat-scroll{padding:16px}
html.bplus .chat-composer{padding:4px 12px 10px}
html.bplus #chatNotice{font-size:10px}
#maruChat.is-cramped .chat-avatar{width:48px;height:48px}
#maruChat.is-cramped .chat-header{padding:2px 8px 2px 4px}
#maruChat.is-cramped :is(#chatContext,#chatNotice,.chat-composer-tools){display:none}
#maruChat.is-cramped .chat-composer{padding:6px 10px}
#maruChat.is-cramped .chat-scroll{padding:8px 14px}
#maruChat.is-tiny .chat-header{padding:0 6px}
#maruChat.is-tiny .chat-avatar{width:44px;height:44px}
#maruChat.is-tiny .chat-composer{padding:2px 6px}
#maruChat.is-tiny .chat-scroll{padding-block:0}
#maruChat.is-tiny #chatInput{height:44px!important;min-height:44px;max-height:44px;padding-block:8px;line-height:1.5}
#maruChat.is-tiny #chatSend{min-height:44px}
@media(prefers-reduced-motion:no-preference){#maruChat:popover-open{animation:chat-appear .16s ease-out}@keyframes chat-appear{from{opacity:0;translate:0 8px}to{opacity:1;translate:0 0}}}

/* The title takes focus only so screen readers start there; no visible ring. */
#chatTitle:focus{outline:none}
