/* Chat layout. Scoped to the existing screen; site and header dimensions stay native. */
@layer studio-chat {
html.refresh body #chat .chat-main-card {overflow:visible!important}
html.refresh body #chat .chat-topbar {z-index:5!important}
html.refresh body #chat .messages {position:relative!important;z-index:0!important}
html.refresh body #chat.chat-screen {padding:20px!important;min-width:0!important}
html.refresh body #chat .chat-main-card {display:grid!important;grid-template-columns:minmax(0,1fr)!important;gap:10px!important;padding:18px!important;margin:0!important;min-width:0!important;border:1px solid var(--concept-line)!important;border-radius:16px!important;background:var(--concept-surface)!important;box-shadow:none!important}
html.refresh body #chat .chat-topbar {display:grid!important;grid-template-columns:minmax(0,1fr) auto!important;gap:14px!important;align-items:center!important;padding:16px!important;min-height:0!important;height:auto!important;border:1px solid var(--concept-line)!important;border-radius:12px!important;background:var(--concept-subtle)!important;box-shadow:none!important;position:relative!important;overflow:visible!important}
html.refresh body #chat .chat-heading {grid-column:1!important;grid-row:1!important;display:flex!important;align-items:center!important;gap:8px!important;flex-wrap:wrap!important;min-width:0!important;margin:0!important;padding:0!important}
html.refresh body #chat #chatTitle {font:750 18px/1.25 'Manrope Variable',Manrope,Arial,sans-serif!important;letter-spacing:-.3px!important;margin:0!important;padding:0!important;color:var(--concept-text)!important;min-width:0!important}
html.refresh body #chat .chat-title-star {display:none!important}
html.refresh body #chat .chat-title-text {background:none!important;color:var(--concept-text)!important;-webkit-text-fill-color:currentColor!important;text-shadow:none!important}
html.refresh body #chat :is(.chat-demo-badge,.chat-age) {position:static!important;display:inline-flex;align-items:center;justify-content:center;flex:none;min-height:22px!important;padding:2px 7px!important;margin:0!important;border:1px solid var(--concept-line)!important;border-radius:6px!important;background:var(--concept-surface)!important;color:var(--concept-muted)!important;font:600 10px/1.2 'Manrope Variable',Manrope,Arial,sans-serif!important;box-shadow:none!important;white-space:nowrap!important}
html.refresh body #chat .chat-demo-badge[hidden] {display:none!important}
html.refresh body #chat .chat-top-actions {position:relative!important;grid-column:2!important;grid-row:1!important;display:flex!important;align-items:center!important;justify-content:flex-end!important;gap:8px!important;min-width:0!important}
html.refresh body #chat :is(.chat-more,#chatExitButton) {position:relative!important;grid-column:auto!important;grid-row:auto!important;top:auto!important;right:auto!important;bottom:auto!important;left:auto!important;margin:0!important;float:none!important;transform:none!important}
html.refresh body #chat .chat-top-actions #chatMore {position:static!important;flex:none!important;width:36px!important;height:36px!important}
html.refresh body #chat .chat-more>summary {width:36px!important;height:36px!important;min-height:36px!important;min-width:36px!important;padding:0!important;border:1px solid var(--concept-line)!important;border-radius:8px!important;background:var(--concept-surface)!important;color:var(--concept-accent)!important;font-size:0!important;list-style:none!important;box-shadow:none!important}
html.refresh body #chat .chat-more>summary::marker {content:""!important}
html.refresh body #chat .chat-more-panel {position:absolute!important;inset:auto 0 auto auto!important;top:calc(100% + 8px)!important;width:224px!important;max-width:calc(100vw - 48px)!important;margin:0!important;padding:8px!important;background:var(--concept-surface)!important;border:1px solid var(--concept-line)!important;border-radius:10px!important;box-shadow:0 8px 24px #0002!important;z-index:90!important}
html.refresh body #chat .chat-more-panel .actions {display:grid!important;grid-template-columns:minmax(0,1fr)!important;gap:6px!important}
html.refresh body #chat .chat-more-panel button {width:100%!important;min-width:0!important;min-height:36px!important;margin:0!important;font-size:12px!important}
html.refresh body #chat #chatExitButton {--mark-height:36px;--mark-chip:24px;--mark-inset:5px;--mark-pad:36px;--mark-font:12px;flex:none!important;width:100px!important;min-width:100px!important;max-width:100px!important;height:36px!important;min-height:36px!important;padding:6px 10px 6px 36px!important;border-radius:8px!important;font-size:12px!important;line-height:1.2!important;white-space:nowrap!important;overflow-wrap:normal!important;word-break:normal!important}
html.refresh body #chat .roulette-avatars {grid-column:1/-1!important;grid-row:2!important;display:grid!important;grid-template-columns:minmax(0,1fr) minmax(0,1fr)!important;gap:14px!important;width:100%!important;min-width:0!important;margin:0!important;padding:12px 0 0!important;border-top:1px solid var(--concept-line)!important}
html.refresh body #chat .chat-person {display:flex!important;align-items:center!important;gap:10px!important;min-width:0!important;margin:0!important;padding:0!important;background:none!important;border:0!important;box-shadow:none!important}
html.refresh body #chat .chat-person>div {min-width:0!important;display:grid!important;gap:3px!important}
html.refresh body #chat .chat-person strong {display:block!important;max-width:100%!important;overflow:hidden!important;text-overflow:ellipsis!important;white-space:nowrap!important;font-size:13px!important;line-height:1.3!important;font-weight:700!important;color:var(--concept-text)!important}
html.refresh body #chat .chat-person small {display:block!important;max-width:100%!important;overflow:hidden!important;text-overflow:ellipsis!important;white-space:nowrap!important;font-size:11px!important;line-height:1.2!important;color:var(--concept-muted)!important}
html.refresh body #chat :is(.animal-toggle,.animal-peer) {display:flex!important;align-items:center!important;justify-content:center!important;flex:0 0 40px!important;width:40px!important;height:40px!important;min-width:40px!important;min-height:40px!important;padding:4px!important;border:1px solid var(--concept-line)!important;border-radius:11px!important;background:var(--concept-field)!important;box-shadow:none!important;filter:none!important;animation:none!important;transform:none!important;color:var(--concept-accent)!important;font-size:24px!important}
html.refresh body #chat .animal-toggle>span {display:flex!important;align-items:center!important;justify-content:center!important;width:100%!important;height:100%!important;min-width:0!important}
html.refresh body #chat :is(.animal-toggle,.animal-peer) .animal-icon-svg {width:30px!important;height:30px!important;max-width:100%!important;max-height:100%!important;filter:none!important}
html.refresh body #chat :is(.animal-toggle,.animal-peer)::before,html.refresh body #chat :is(.animal-toggle,.animal-peer)::after {content:none!important;display:none!important;box-shadow:none!important;filter:none!important}
html.refresh body #chat .chat-status-row {display:flex!important;align-items:center!important;justify-content:space-between!important;flex-wrap:wrap!important;gap:8px!important;min-height:20px!important;margin:0!important;padding:0 2px!important;border:0!important;background:none!important;color:var(--concept-muted)!important}
html.refresh body #chat #status {margin:0!important;padding:0!important;font-size:11px!important;line-height:1.45!important;font-weight:500!important;color:var(--concept-muted)!important;min-width:0!important;overflow-wrap:break-word!important}
html.refresh body #chat .chat-history-tools {display:flex;justify-content:flex-end!important;margin:0!important;padding:0!important;min-height:0!important}
html.refresh body #chat .chat-history-tools[hidden] {display:none!important}
html.refresh body #chat #saveChatHistory {--mark-height:32px;--mark-font:11px;--mark-chip:20px;--mark-inset:4px;--mark-pad:30px;width:auto!important;min-width:138px!important;height:32px!important;min-height:32px!important;padding:4px 10px 4px 30px!important;font-size:11px!important;white-space:nowrap!important;overflow-wrap:normal!important}
html.refresh body #chat .messages {display:block!important;min-width:0!important;min-height:300px!important;height:clamp(300px,40vh,380px)!important;max-height:380px!important;overflow:auto!important;overscroll-behavior:contain!important;padding:14px!important;margin:0!important;background:var(--concept-field)!important;border:1px solid var(--concept-line)!important;border-radius:12px!important;box-shadow:none!important;scrollbar-width:thin;scrollbar-color:var(--concept-line) transparent}
html.refresh body #chat .message {display:flex!important;align-items:flex-end!important;justify-content:flex-start!important;gap:8px!important;min-width:0!important;width:100%!important;max-width:100%!important;padding:0!important;margin:0 0 12px!important;background:none!important;border:0!important;border-radius:0!important;box-shadow:none!important;transform:none!important}
html.refresh body #chat .message.mine {flex-direction:row-reverse!important}
html.refresh body #chat .message:not(.mine) {flex-direction:row!important}
html.refresh body #chat .message .message-animal {position:static!important;display:flex!important;align-items:center!important;justify-content:center!important;flex:0 0 30px!important;width:30px!important;height:30px!important;min-width:30px!important;padding:3px!important;margin:0!important;border:1px solid var(--concept-line)!important;border-radius:9px!important;background:var(--concept-surface)!important;color:var(--concept-accent)!important;box-shadow:none!important;filter:none!important;transform:none!important;animation:none!important;font-size:20px!important}
html.refresh body #chat .message-animal .animal-icon-svg {width:24px!important;height:24px!important;filter:none!important}
html.refresh body #chat .message .message-bubble {display:block!important;min-width:0!important;width:auto!important;max-width:calc(100% - 42px)!important;padding:11px 13px!important;border:1px solid var(--concept-line)!important;border-radius:12px 12px 12px 4px!important;background:var(--concept-surface)!important;color:var(--concept-text)!important;box-shadow:none!important;overflow-wrap:anywhere!important;word-break:normal!important;transform:none!important}
html.refresh body #chat .message.mine .message-bubble {background:var(--concept-accent-soft)!important;border-radius:12px 12px 4px 12px!important}
html.refresh body #chat :is(.message,.message-bubble)::before,html.refresh body #chat :is(.message,.message-bubble)::after {content:none!important;display:none!important;background:none!important;box-shadow:none!important}
html.refresh body #chat .message .message-bubble>b {display:block!important;margin:0 0 4px!important;font-size:11px!important;font-weight:650!important;line-height:1.3!important;color:var(--concept-muted)!important}
html.refresh body #chat .message-content {display:block!important;font-size:14px!important;line-height:1.55!important;color:var(--concept-text)!important;white-space:pre-wrap!important}
html.refresh body #chat .message-meta {display:block!important;margin:6px 0 0!important;padding:0!important;font-size:10px!important;line-height:1.2!important;text-align:right!important;color:var(--concept-muted)!important}
html.refresh body #chat .message.system {justify-content:center!important;margin:0 0 14px!important}
html.refresh body #chat .message.system .message-bubble {max-width:100%!important;padding:8px 12px!important;border:0!important;border-radius:8px!important;background:var(--concept-subtle)!important;text-align:center!important}
html.refresh body #chat .message.system .message-content {font-size:11px!important;line-height:1.5!important;color:var(--concept-muted)!important}
html.refresh body #chat .message.system b {display:none!important}
html.refresh body #chat #chatComposer {display:grid!important;grid-template-columns:minmax(0,1fr) 144px!important;grid-template-rows:auto auto!important;gap:9px!important;align-items:center!important;padding:12px 0 0!important;margin:0!important;min-width:0!important;background:none!important;border:0!important;border-top:1px solid var(--concept-line)!important;border-radius:0!important;box-shadow:none!important}
html.refresh body #chat #msg {grid-column:1!important;grid-row:1!important;box-sizing:border-box!important;width:100%!important;min-width:0!important;height:44px!important;min-height:44px!important;max-height:none!important;margin:0!important;padding:10px 13px!important;border:1px solid var(--concept-line)!important;border-radius:9px!important;background:var(--concept-field)!important;color:var(--concept-text)!important;font:500 14px/1.3 'Manrope Variable',Manrope,Arial,sans-serif!important;box-shadow:none!important}
html.refresh body #chat #msg::placeholder {color:var(--concept-muted)!important;opacity:1!important}
html.refresh body #chat :is(button,summary,#msg):focus-visible {outline:2px solid var(--concept-accent)!important;outline-offset:2px!important}
html.refresh body #chat #sendButton {grid-column:2!important;grid-row:1!important}
html.refresh body #chat #chatNextButton {grid-column:2!important;grid-row:2!important}
html.refresh body #chat #chatPromptsToggle {grid-column:1!important;grid-row:2!important;justify-self:start!important;width:auto!important;min-width:132px!important;max-width:100%!important}
html.refresh body #chat #chatComposer :is(#sendButton,#chatNextButton,#chatPromptsToggle) {--mark-height:40px;--mark-font:12px;--mark-chip:24px;--mark-inset:5px;--mark-pad:36px;min-height:40px!important;height:40px!important;max-height:none!important;margin:0!important;padding:7px 10px 7px 36px!important;font-size:12px!important;line-height:1.2!important;border-radius:9px!important;white-space:nowrap!important;overflow-wrap:normal!important;word-break:normal!important}
html.refresh body #chat #chatComposer :is(#sendButton,#chatNextButton) {width:144px!important;min-width:144px!important;max-width:144px!important}
html.refresh body #chat #chatNextButton {--mark-fill:var(--concept-surface);--mark-ink:var(--concept-accent);--mark-chip-fill:var(--concept-accent-soft);background:var(--concept-surface)!important;color:var(--concept-accent)!important;border-color:var(--concept-line)!important;border-left-color:var(--concept-accent)!important}
html.refresh body #chat #chatNextButton:hover:not(:disabled) {background:var(--concept-accent-soft)!important}
html.refresh body #chat :is(#chatError,#chatPromptStatus):empty {display:none!important}
html.refresh body #chat #chatError {margin:0!important;font-size:12px!important}
html.refresh body #chat .peer-typing {margin:0!important;font-size:11px!important;line-height:1.3!important;color:var(--concept-muted)!important}
html.refresh body #chat .chat-prompts {gap:8px!important;padding:10px!important;margin:0!important;border:1px solid var(--concept-line)!important;border-radius:10px!important;background:var(--concept-subtle)!important}
html.refresh body #chat .chat-prompts button {min-width:0!important;font-size:12px!important;overflow-wrap:normal!important}
/* A stable 3 + 2 action grid, rather than a wrapping row of unequal pills. */
html.refresh body #chat #chatPrompts:not([hidden]) {display:grid!important;grid-template-columns:repeat(6,minmax(0,1fr))!important;gap:8px!important;align-items:stretch!important;width:100%!important;min-width:0!important;box-sizing:border-box!important}
html.refresh body #chat #chatPrompts[hidden] {display:none!important}
html.refresh body #chat #chatPrompts>button {--mark-height:40px;--mark-font:12px;--mark-chip:24px;--mark-inset:5px;--mark-pad:36px;grid-column:span 2!important;width:100%!important;min-width:0!important;max-width:100%!important;height:40px!important;min-height:40px!important;margin:0!important;padding:6px 10px 6px 36px!important;font-size:12px!important;line-height:1.3!important;white-space:nowrap!important;overflow-wrap:normal!important;word-break:normal!important;text-align:center!important;border-radius:9px!important;box-shadow:none!important}
html.refresh body #chat #chatPrompts>:is(#inviteSharedGame,#inviteDiceGame) {grid-column:span 3!important}
html.refresh body #chat #chatPrompts>button::after {left:calc(var(--mark-inset) + (var(--mark-chip) - 20px)/2)!important;width:20px!important;height:20px!important}
@media(max-width:600px) {
 html.refresh body #chat.chat-screen {padding:8px!important}
 html.refresh body #chat .chat-main-card {padding:10px!important;gap:9px!important;border-radius:13px!important}
 html.refresh body #chat .chat-topbar {grid-template-columns:minmax(0,1fr)!important;padding:10px!important;gap:10px!important}
 html.refresh body #chat .chat-heading {grid-column:1!important;grid-row:1!important;gap:6px!important;padding-right:0!important}
 html.refresh body #chat #chatTitle {font-size:17px!important}
 html.refresh body #chat .chat-top-actions {grid-column:1!important;grid-row:2!important;justify-content:flex-end!important}
 html.refresh body #chat .roulette-avatars {grid-row:3!important;gap:8px!important;padding-top:10px!important}
 html.refresh body #chat .chat-person {gap:6px!important}
 html.refresh body #chat .chat-person strong {font-size:12px!important}
 html.refresh body #chat .chat-person small {font-size:10px!important}
 html.refresh body #chat :is(.animal-toggle,.animal-peer) {flex-basis:34px!important;width:34px!important;height:34px!important;min-width:34px!important;min-height:34px!important;padding:3px!important;border-radius:9px!important}
 html.refresh body #chat :is(.animal-toggle,.animal-peer) .animal-icon-svg {width:26px!important;height:26px!important}
 html.refresh body #chat .messages {height:260px!important;min-height:260px!important;max-height:260px!important;padding:10px!important}
 html.refresh body #chat .message-content {font-size:13px!important;line-height:1.5!important}
 html.refresh body #chat .message .message-bubble {padding:9px 10px!important}
 html.refresh body #chat #chatComposer {grid-template-columns:minmax(0,1fr) 128px!important;gap:8px!important;padding-top:10px!important}
 html.refresh body #chat #msg {grid-column:1/-1!important;grid-row:1!important;font-size:16px!important}
 html.refresh body #chat #sendButton {grid-column:2!important;grid-row:2!important}
 html.refresh body #chat #chatPromptsToggle {grid-column:1!important;grid-row:2!important;width:100%!important;min-width:0!important}
 html.refresh body #chat #chatComposer #chatNextButton {grid-column:1/-1!important;grid-row:3!important;width:100%!important;min-width:0!important;max-width:none!important}
 html.refresh body #chat #chatComposer #sendButton {width:128px!important;min-width:128px!important;max-width:128px!important}
 html.refresh body #chat #chatComposer :is(#sendButton,#chatNextButton,#chatPromptsToggle) {--mark-height:36px;--mark-font:12px;min-height:36px!important;height:36px!important;padding-top:5px!important;padding-bottom:5px!important}
 html.refresh body #chat #saveChatHistory {min-width:130px!important}
 html.refresh body #chat #chatPrompts:not([hidden]) {gap:6px!important;padding:8px!important}
 html.refresh body #chat #chatPrompts>button[data-prompt] {height:60px!important;min-height:60px!important;padding:33px 4px 6px!important;font-size:12px!important;border-left-width:1px!important}
 html.refresh body #chat #chatPrompts>button[data-prompt]::before {left:calc(50% - 12px)!important;top:7px!important;transform:none!important;width:24px!important;height:24px!important}
 html.refresh body #chat #chatPrompts>button[data-prompt]::after {left:calc(50% - 10px)!important;top:9px!important;transform:none!important;width:20px!important;height:20px!important}
 html.refresh body #chat #chatPrompts>:is(#inviteSharedGame,#inviteDiceGame) {grid-column:1/-1!important;--mark-font:12px;font-size:12px!important}
}
}
