/* Loaded after the base styles so reading size remains effective on mobile. */
body{--ui-font-size:12px;--chat-font-size:var(--ui-font-size);--chat-line-height:1.8;--chat-heading-size:15px;--chat-code-size:11px;--chat-input-size:var(--chat-font-size);--chat-secondary-size:11px}
body.large-text{--chat-font-size:14px;--chat-line-height:1.85;--chat-heading-size:17px;--chat-code-size:13px;--chat-secondary-size:12px}
body .sidebar .nav-item{font-size:var(--ui-font-size)}
body .message,body.large-text .message{font-size:var(--chat-font-size);line-height:var(--chat-line-height)}
body .message-text,body.large-text .message-text,body .message-text p,body .message-text li{font-size:inherit;line-height:inherit}
/* Justify prose like a document paragraph; leave its final line natural. */
body .message.user,body .message-text,.room-entry-content,.reading-preview-answer p{text-align:justify;text-justify:inter-ideograph;text-align-last:start}
body .message-text :is(h1,h2,h3,h4,h5,h6,pre,code,table,th,td){text-align:start;text-align-last:auto;text-justify:auto}
body .message{margin-top:20px;margin-bottom:20px}
body .message-heading{margin-bottom:8px}
body .message-text :is(h1,h2){font-size:calc(var(--chat-heading-size) + 2px);line-height:1.5}
body .message-text h3,body.large-text .message-text h3{font-size:var(--chat-heading-size);line-height:1.6;margin:12px 0 6px}
body .message-text :is(h4,h5,h6){font-size:calc(var(--chat-font-size) + 1px);line-height:1.6}
body .message-text blockquote{font-size:var(--chat-secondary-size);line-height:1.8;margin:10px 0;padding:2px 12px;border-left:2px solid var(--line);color:var(--muted)}
body .message-text table{font-size:inherit}
body .message-text{white-space:normal;overflow-wrap:anywhere}
body .message.user .message-text{white-space:pre-wrap}
body .message-text p{margin:0 0 .85em}
body .message-text :is(h3,h4,h5,h6){font-weight:650;margin:1.25em 0 .5em;color:var(--ink)}
body .message-text :is(ul,ol){margin:.5em 0 1em;padding-inline-start:1.8em}
body .message-text li{padding-inline-start:.2em;margin:.3em 0}
body .message-text li :is(ul,ol){margin:.3em 0 .5em}
body .message-text li>p{margin:.35em 0}
body .message-text strong{font-weight:700;color:var(--ink)}
body .message-text blockquote{background:var(--soft);border-left:3px solid var(--green);padding:8px 12px;border-radius:0 6px 6px 0}
body .message-text blockquote p:last-child{margin-bottom:0}
body .message-text pre{overflow-x:auto;white-space:pre;max-width:100%;padding:12px 14px;border:1px solid var(--line);border-radius:8px}
body .message-text pre code{white-space:pre;padding:0;background:transparent}
body .message-text a:not(.inline-source){color:var(--deep);text-decoration:underline;text-underline-offset:3px}
body .message-text .answer-table{max-width:100%;overflow-x:auto;margin:1em 0}
body .message-text table{border-collapse:collapse;width:100%;min-width:260px}
body .message-text :is(th,td){border:1px solid var(--line);padding:7px 10px;vertical-align:top}
body .message-text th{background:var(--soft);font-weight:600}
body .message-text hr{border:0;border-top:1px solid var(--line);margin:1.3em 0}
body .message-text>:first-child{margin-top:0}
body .message-text>:last-child{margin-bottom:0}
body .message-text code,body.large-text .message-text code{font-size:var(--chat-code-size);line-height:1.75}
body .composer textarea,body.large-text .composer textarea{font-size:var(--chat-input-size);line-height:1.65;min-height:44px}
body .followup-question,body.large-text .followup-question{font-size:var(--chat-font-size);line-height:1.65}
body :is(.source-list,.source-heading,.source-summary,.source-notice,.followup-heading){font-size:var(--chat-secondary-size)}
body .room-entry-content{font-size:var(--chat-font-size);line-height:var(--chat-line-height)}
.reading-preview{border:1px solid var(--line);border-radius:12px;padding:20px;margin:20px 0;background:var(--bg)}
.reading-preview-header{display:flex;justify-content:space-between;gap:12px;align-items:center;flex-wrap:wrap;font-size:12px;color:var(--muted);margin-bottom:18px}
.reading-preview-answer{font-size:var(--chat-font-size);line-height:var(--chat-line-height);color:var(--ink)}
.reading-preview-answer h3{font-size:var(--chat-heading-size);line-height:1.6;margin:0 0 10px}
.reading-preview-answer p{font-size:inherit;line-height:inherit;margin:0}
.reading-preview-input{font-size:var(--chat-input-size);line-height:1.75;padding:12px 14px;border:1px solid var(--line);border-radius:9px;margin-top:20px;color:var(--muted);background:var(--field)}
.reading-preview>small{display:block;font-size:11px;line-height:1.7;color:var(--muted);margin-top:14px}
.learner-profile-panel>h2{margin-bottom:16px}
.recent-chat-row{display:flex;align-items:center;gap:3px;min-width:0}
.recent-chat-row .recent-chat{flex:1;min-width:0;width:auto}
.recent-chat-row .recent-chat{display:flex;align-items:center;gap:6px}
.recent-chat-name{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;flex:1}
.conversation-pin{display:inline-flex;color:var(--green);flex-shrink:0}
.conversation-pin .icon{width:12px;height:12px}
.conversation-section-label{font-size:10px;color:var(--muted);padding:13px 10px 5px;letter-spacing:.6px}
.conversation-section-label:first-child{padding-top:4px}
.conversation-more{display:grid;place-items:center;width:29px;height:29px;flex:0 0 29px;border-radius:6px;color:var(--muted);padding:5px}
.conversation-more .icon{width:18px;height:18px}
.conversation-more:hover,.conversation-more[aria-expanded=true]{background:var(--hover);color:var(--deep)}
.conversation-more:focus-visible{outline:2px solid var(--focus);outline-offset:1px}
.conversation-more:disabled{opacity:.4;cursor:wait}
.conversation-menu{position:fixed;z-index:95;border:1px solid var(--line);border-radius:10px;background:var(--surface-raised);box-shadow:var(--popup-shadow);padding:4px;overflow:auto;overscroll-behavior:contain}
.conversation-menu-title{font-size:10px;color:var(--muted);white-space:nowrap;text-overflow:ellipsis;overflow:hidden;padding:5px 8px 6px}
.conversation-menu [role=menuitem]{display:flex;align-items:center;gap:8px;width:100%;padding:6px 9px;border-radius:6px;text-align:left;font-size:12px;line-height:1.5;color:var(--ink)}
.conversation-menu [role=menuitem]:hover,.conversation-menu [role=menuitem]:focus-visible{background:var(--hover);outline:none}
.conversation-menu [role=menuitem].danger{color:var(--red)}
.conversation-menu .icon{width:14px;height:14px;flex-shrink:0}
.conversation-menu-divider{height:1px;background:var(--line);margin:3px 6px}
.history-pin{display:inline-block;vertical-align:middle;border-radius:4px;padding:1px 5px;margin-right:7px;background:var(--soft);color:var(--deep);font-size:10px;font-weight:400}
.rename-hint{font-size:12px;margin-top:10px;line-height:1.8}
.conversation-running{display:inline-block;flex:0 0 12px;width:12px;height:12px;border:1.5px solid var(--line);border-top-color:var(--green);border-radius:50%;animation:chat-working .9s linear infinite}
.conversation-unread{display:inline-block;flex:0 0 6px;width:6px;height:6px;background:var(--green);border-radius:50%}
.conversation-failed{font-size:11px;font-weight:600;color:var(--red);flex-shrink:0}
.conversation-queued{font-size:10px;line-height:16px;min-width:16px;text-align:center;border-radius:5px;color:var(--deep);background:var(--soft);flex-shrink:0}
.conversation-module-tag{font-size:10px;line-height:17px;padding:0 4px;border-radius:4px;background:var(--soft);color:var(--deep);white-space:nowrap;flex-shrink:0}
.conversation-filters{display:flex;flex:0 0 auto;gap:3px;border:1px solid var(--line);background:var(--field);border-radius:8px;padding:3px;margin:0 0 7px}
.conversation-filters button{flex:1;min-width:0;font-size:11px;line-height:18px;padding:3px 1px;border-radius:5px;color:var(--muted);white-space:nowrap}
.conversation-filters button:hover{background:var(--hover);color:var(--deep)}
.conversation-filters button[aria-pressed=true]{background:var(--soft);color:var(--deep);font-weight:600}
.conversation-filters button:focus-visible,.history-module-filters button:focus-visible{outline:2px solid var(--focus);outline-offset:1px}
.history-module-filters{display:flex;flex-wrap:wrap;gap:7px;margin-bottom:18px}
.history-module-filters button{display:flex;align-items:center;font-size:12px;line-height:20px;padding:5px 11px;border:1px solid var(--line);border-radius:18px;color:var(--muted)}
.history-module-filters button span{font-size:10px;margin-left:7px;opacity:.85}
.history-module-filters button:hover{background:var(--hover)}
.history-module-filters button[aria-pressed=true]{background:var(--soft);color:var(--deep);border-color:var(--focus);font-weight:500}
.history-module-tag{display:inline-block;font-size:10px;line-height:18px;padding:0 5px;margin-right:8px;border-radius:4px;background:var(--soft);color:var(--deep);white-space:nowrap}
.history-empty [data-conversation-filter],.empty-panel [data-conversation-filter]{display:block;margin-top:10px}
.empty-panel [data-conversation-filter]{margin-inline:auto}
@media(pointer:coarse){.conversation-filters button{min-height:30px}.history-module-filters button{min-height:38px}}
@keyframes chat-working{to{transform:rotate(360deg)}}
@media(prefers-reduced-motion:reduce){.conversation-running{animation:none}}
@media(pointer:coarse){.conversation-more{width:38px;height:38px;flex-basis:38px}.conversation-menu [role=menuitem]{min-height:44px}}
#learner-profile-form>.subtle{font-size:13px;line-height:1.9;margin-bottom:20px}
#learner-profile-form .privacy-note{line-height:1.9;margin-top:16px}
@media(max-width:600px){.reading-preview{padding:16px}.reading-preview-header{align-items:flex-start}}
/* Keep mobile input readable and avoid automatic zoom when focusing it. */
@media(max-width:760px),(pointer:coarse){body .composer textarea,body.large-text .composer textarea,.reading-preview-input{font-size:max(16px,var(--chat-input-size))}}
/* F7 links are action destinations, separate from answer evidence. */
.product-entries{margin-top:18px;padding-top:14px;border-top:1px solid var(--line)}.product-entry{display:flex;align-items:center;justify-content:space-between;gap:14px;margin-top:10px;padding:13px 15px;border:1px solid var(--line);border-radius:10px;background:var(--surface)}.product-entry>div{min-width:0}.product-entry strong{font-size:13px;font-weight:600}.product-entry p{margin-top:5px;font-size:11px;color:var(--muted);line-height:1.8}.product-entry-actions{display:flex;flex-shrink:0;flex-direction:column;gap:6px;align-items:flex-start}.product-entry-actions .secondary{font-size:12px;padding:7px 11px;white-space:nowrap}@media(max-width:760px){.product-entry{align-items:flex-start;flex-direction:column}.product-entry-actions{flex-direction:row;flex-wrap:wrap;align-items:center;gap:10px}}

.room-recovery{padding:12px 16px;margin:0 16px 12px;border:1px solid var(--line);border-radius:10px;background:var(--soft)}.room-recovery[hidden]{display:none}.room-recovery>div{display:flex;gap:12px;flex-wrap:wrap;margin-top:8px}.room-recovery button{font-size:12px}
