/* Conversation layout is local to the browser; never resize the shared PTY. */
#mobile-sessions, #close-sessions { display: none; }
.chat-panel { position: relative; border: 1px solid var(--line); background: #141e25; }
.chat-info { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 4px 12px; border-bottom: 1px solid var(--line); }
#chat-status { min-width: 0; overflow-wrap: anywhere; font-size: 11px; color: var(--muted); }
.chat-info button { flex-shrink: 0; }
.chat-scroll { height: 56svh; min-height: 100px; overflow-y: auto; overflow-x: hidden; padding: 12px 16px 24px; overscroll-behavior: contain; overflow-anchor: none; }
.chat-empty { max-width: 420px; margin: 40px auto; color: var(--muted); text-align: center; font-size: 14px; line-height: 1.8; }
#load-older { display: block; margin: 0 auto 18px; }
.chat-message { display: flex; flex-direction: column; align-items: flex-start; margin: 0 0 20px; min-width: 0; }
.chat-message.user { align-items: flex-end; }
.message-label { font-size: 11px; color: var(--muted); margin: 0 3px 6px; }
.message-bubble { max-width: min(94%, 860px); min-width: 0; border: 1px solid #34434e; border-radius: 3px 14px 14px; padding: 14px 16px; background: #24313b; color: #edf1f4; white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word; line-height: 1.75; font-weight: 400; }
.user .message-bubble { background: #a3e5bf; border-color: #a3e5bf; color: #132d20; border-radius: 14px 3px 14px 14px; }
.message-bubble pre { max-width: 100%; white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word; font-size: .9em; line-height: 1.6; padding: 10px; border-radius: 6px; background: #0d161db0; color: #e1eaf1; font-family: Consolas, Menlo, monospace; tab-size: 2; }
.latest-button { position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%); padding: 9px 16px; border: 1px solid #517965; border-radius: 22px; background: #294c3d; color: #d6f7e4; box-shadow: 0 3px 18px #0005; font-size: 12px; white-space: nowrap; }
select { width: 100%; min-width: 0; font: inherit; color: var(--text); background: var(--bg); padding: 12px 8px; border: 1px solid var(--line); border-radius: 8px; }
select option { max-width: 100%; }
dialog { overflow-wrap: anywhere; max-height: calc(var(--app-height, 100dvh) - 28px); overflow-y: auto; }
.dialog-actions { flex-wrap: wrap; }
.session-heading>div:first-child { min-width: 0; flex: 1; }
.session-actions { display: flex; gap: 6px; flex: 0 0 auto; align-items: center; }
.session-actions .secondary { font-size: 12px; white-space: nowrap; }
.resume-note { font-size: 12px; line-height: 1.6; color: var(--muted); margin: -10px 0 14px; overflow-wrap: anywhere; }
.mobile-console .resume-note { flex: 0 0 auto; font-size: 11px; margin: 0; padding: 5px 10px; background: #1b2929; }

/* Response typography: override global page-title/code styles only in bubbles. */
.message-bubble.markdown-body { white-space: normal; }
.markdown-body>:first-child { margin-top: 0; }
.markdown-body>:last-child { margin-bottom: 0; }
.markdown-body p { margin: 0 0 .8em; }
.markdown-body h1, .markdown-body h2, .markdown-body h3, .markdown-body h4, .markdown-body h5, .markdown-body h6 { color: inherit; letter-spacing: 0; line-height: 1.5; font-weight: 650; margin: 1.15em 0 .5em; }
.markdown-body h1 { font-size: 1.25em; }
.markdown-body h2 { font-size: 1.16em; }
.markdown-body h3 { font-size: 1.08em; }
.markdown-body h4, .markdown-body h5, .markdown-body h6 { font-size: 1em; }
.markdown-body strong { font-weight: 650; }
.markdown-body em { font-style: italic; }
.markdown-body s { color: #b5c2ca; }
.markdown-body ul, .markdown-body ol { margin: .5em 0 .9em; padding-left: 1.5em; }
.markdown-body li { margin: .3em 0; padding-left: .1em; }
.markdown-body li>p { margin: .35em 0; }
.markdown-body li>ul, .markdown-body li>ol { margin: .3em 0; }
.markdown-body li::marker { color: #b0d2c2; }
.markdown-body blockquote { margin: .8em 0; padding: .3em .8em; border-left: 3px solid #84baa2; background: #17242e; color: #bfced8; border-radius: 0 6px 6px 0; }
.markdown-body blockquote>:last-child { margin-bottom: 0; }
.markdown-body hr { border: 0; border-top: 1px solid #465762; margin: 1em 0; }
.markdown-body a[href] { color: #b1e9d1; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.markdown-body a.local-reference { color: #cbdce8; text-decoration: none; }
.markdown-body code { font-family: Consolas, "Cascadia Mono", Menlo, monospace; font-size: .9em; background: #121e27; color: #ccebdc; padding: .12em .35em; border-radius: 4px; white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word; }
.markdown-body .code-block { max-width: 100%; min-width: 0; margin: .8em 0; border: 1px solid #41535f; border-radius: 8px; overflow: hidden; background: #111c24; }
.markdown-body .code-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 5px 10px; border-bottom: 1px solid #344650; background: #1a2b35; font-size: 11px; line-height: 1.4; color: #a4b8c5; }
.markdown-body .code-language { min-width: 0; overflow-wrap: anywhere; }
.markdown-body .copy-code { flex-shrink: 0; color: #cce8da; background: #29463e; min-height: 32px; padding: 6px 10px; font-size: 12px; }
.markdown-body .copy-code:hover { background: #3b5d50; }
.markdown-body .code-block pre { margin: 0; padding: 12px; border-radius: 0; background: transparent; line-height: 1.65; font-size: .875em; max-width: 100%; white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word; overflow: visible; }
.markdown-body pre code { background: transparent; padding: 0; color: #e1eaf1; border-radius: 0; font-size: 1em; }
.markdown-body .task-item { list-style: none; }
.markdown-body .task-checkbox { display: inline-block; width: 1.3em; color: #9caeb8; font-weight: 600; }
.markdown-body .task-checkbox.checked { color: #a3e5bf; }
.markdown-body .message-image-note { color: #9eb0bc; font-size: .85em; }
.markdown-body .message-table { width: 100%; max-width: 100%; table-layout: fixed; border-collapse: collapse; margin: .8em 0; font-size: .9em; }
.markdown-body .message-table th, .markdown-body .message-table td { border: 1px solid #465963; padding: 8px 10px; min-width: 0; vertical-align: top; text-align: left; overflow-wrap: anywhere; word-break: break-word; }
.markdown-body .message-table th { background: #172933; color: #c3e2d4; font-weight: 600; }
.markdown-body .message-table tbody tr:nth-child(even) { background: #1b2b35; }
.markdown-body .table-cell-label { display: none; }
.markdown-body .table-cell-value { min-width: 0; }
.copy-buffer { position: fixed; top: 0; left: 0; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

/* Same rule for narrow phones and coarse-pointer landscape phones. The only
   scrollable content is vertical: messages, terminal text, or the session list. */
body.mobile-console { overflow: hidden; width: 100%; }
.mobile-console #workspace { position: fixed; top: var(--app-top, 0px); left: 0; width: 100%; height: var(--app-height, 100dvh); display: flex; flex-direction: column; overflow: hidden; }
.mobile-console .topbar { flex: 0 0 42px; height: 42px; padding: 0 10px; gap: 4px; }
.mobile-console .wordmark { display: none; }
.mobile-console #mobile-sessions { display: block; padding: 9px 6px; }
.mobile-console .layout { display: flex; flex: 1; min-height: 0; overflow: hidden; }
.mobile-console .sidebar { display: none; }
.mobile-console .detail { display: flex; flex: 1; min-height: 0; width: 100%; padding: 0; overflow: hidden; }
.mobile-console #session-panel { display: flex; flex-direction: column; min-height: 0; height: 100%; overflow: hidden; }
.mobile-console .session-heading { flex: 0 0 auto; margin: 0; padding: 8px 12px; border-bottom: 1px solid var(--line); align-items: center; }
.mobile-console .session-heading>div { min-width: 0; }
.mobile-console .session-title-row h1 { font-size: 16px; max-width: 55vw; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mobile-console .path { display: none; }
.mobile-console #open-desktop { padding: 7px 8px; font-size: 10px; }
.mobile-console .terminal-toolbar { flex: 0 0 auto; padding: 5px 10px; border: 0; border-radius: 0; gap: 4px; }
.mobile-console .terminal-toolbar>span { min-width: 0; font-size: 10px; }
.mobile-console #view-expand, .mobile-console #view-terminal, .mobile-console #view-preview { display: none; }
.mobile-console .view-toolbar { flex: 0 0 auto; border: 0; padding: 3px 8px; gap: 2px; }
.mobile-console .view-toolbar .quiet { padding: 5px 7px; min-height: 30px; }
.mobile-console .chat-panel { display: flex; flex-direction: column; flex: 1; min-height: 0; border: 0; }
.mobile-console .chat-info { flex: 0 0 auto; min-height: 30px; padding: 0 10px; }
.mobile-console .chat-info button { padding: 7px; font-size: 11px; }
.mobile-console .chat-scroll { flex: 1; min-height: 0; height: auto; padding: 12px 12px 18px; touch-action: pan-y; }
.mobile-console .message-bubble { max-width: 96%; padding: 12px 14px; }
.mobile-console .user .message-bubble { max-width: 90%; }
.mobile-console .markdown-body .message-table, .mobile-console .markdown-body .message-table tbody { display: block; width: 100%; }
/* Keep column headers in the accessibility tree; show each value with its own
   column label on phones, rather than squeezing a wide table or scrolling it. */
.mobile-console .markdown-body .message-table thead { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); }
.mobile-console .markdown-body .message-table tbody tr { display: block; width: 100%; padding: 3px 10px; margin: 0 0 10px; border: 1px solid #465963; border-radius: 7px; background: #192a34; }
.mobile-console .markdown-body .message-table td { display: block; width: 100%; border: 0; border-bottom: 1px solid #344750; padding: 8px 0; text-align: left!important; }
.mobile-console .markdown-body .message-table td:last-child { border-bottom: 0; }
.mobile-console .markdown-body .table-cell-label { display: block; margin: 0 0 3px; font-size: 11px; line-height: 1.5; color: #a7bcb0; font-weight: 600; }
.mobile-console .markdown-body .message-table td .table-cell-value { font-size: 1.1em; }
.mobile-console .terminal-scroll { flex: 1; min-height: 0; max-height: none; overflow-x: hidden; overflow-y: auto; padding: 10px 12px; }
.mobile-console .terminal-reading { width: 100%; min-width: 0; min-height: 0; }
.mobile-console #view-hint { display: none; }
.mobile-console .keybar { flex: 0 0 auto; flex-wrap: wrap; overflow: visible; white-space: normal; padding: 5px 8px; gap: 4px; }
.mobile-console .keybar>span { display: none; }
.mobile-console .keybar button { padding: 5px 8px; min-height: 30px; font-size: 11px; }
.mobile-console .composer { flex: 0 0 auto; gap: 6px; margin: 0; border-radius: 0; border-left: 0; border-right: 0; padding: 8px 10px max(8px, env(safe-area-inset-bottom)); }
.mobile-console .composer textarea { min-width: 0; min-height: 42px; max-height: 100px; height: 42px; resize: none; padding: 8px; background: #101a22; border-radius: 6px; font-size: 16px; }
.mobile-console .composer .primary { padding: 11px 14px; }
.mobile-console .session-footer { flex: 0 0 auto; margin: 0; padding: 0 8px; min-height: 26px; gap: 2px; }
.mobile-console .session-footer .quiet { font-size: 10px; padding: 5px 6px; }
.mobile-console .session-footer>span { font-size: 9px; }
.mobile-console .detail-note { display: none; }
.mobile-console #welcome { min-height: 0; overflow-y: auto; padding: 24px; }
.mobile-console #close-sessions { display: block; align-self: flex-end; }
.mobile-console.sessions-open .sidebar { position: absolute; z-index: 30; inset: 42px 0 0; display: flex; width: 100%; min-height: 0; border: 0; padding: 12px; background: var(--bg); overflow-y: auto; }
.mobile-console.sessions-open #sessions { flex-direction: column; overflow-x: hidden; flex: 1; min-height: 0; overflow-y: auto; }
.mobile-console.sessions-open .session-card { width: 100%; min-width: 0; }
.mobile-console .toast { bottom: 100px; }
@media (max-height: 520px) {
  .mobile-console .topbar { flex-basis: 34px; height: 34px; }
  .mobile-console .session-heading { padding: 4px 10px; }
  .mobile-console .keybar { padding: 2px 8px; }
  .mobile-console .keybar button { min-height: 26px; padding: 3px 7px; }
  .mobile-console .session-footer { display: none; }
}
