.conversation{max-width:440px;height:calc(100svh - 25px);margin:auto;display:flex;flex-direction:column;padding:18px 20px 12px}.conversation header{position:relative;text-align:center;min-height:62px;font-size:14px}.conversation header button{position:absolute;right:0;top:0;background:#f8fafc;border-radius:7px;padding:7px;font-size:12px}.conversation #clock{display:block;font-size:12px;color:#9ca3af;margin-top:5px}.chat-progress{font-size:11px;color:#9ca3af}.chat-progress b{float:right}.chat-progress>div{height:4px;background:#f3f4f6;margin:8px 0}.chat-progress i{display:block;height:4px;background:#202938;border-radius:5px}.chat-mode{text-align:center;font-size:10px;color:#9ca3af}.chat-messages{flex:1;overflow:auto;display:flex;flex-direction:column;gap:14px;padding:16px 0;min-height:0;overscroll-behavior:contain}.bubble{max-width:85%;padding:12px 14px;font-size:13px;line-height:1.7;background:#f3f4f6;border-radius:12px;white-space:pre-wrap}.bubble.user{align-self:flex-end;background:#1f2937;color:white}.conversation form{display:flex;gap:8px;padding:10px 0}.conversation input,.conversation textarea{min-width:0;flex:1;border:0;background:#f3f4f6;border-radius:10px;padding:12px;font-size:13px}.conversation form button{background:#1f2937;color:white;border-radius:10px;padding:10px 14px}.completion-overlay{position:fixed;inset:0;background:#0009;display:grid;place-items:center;z-index:10}.completion-overlay>section{background:white;border-radius:16px;padding:24px;width:320px;text-align:center}.completion-overlay h2{font-size:18px}.completion-overlay .secondary{margin-top:10px}.loading-graph{height:200px;width:200px;margin:40px auto;background:conic-gradient(#fce7e7 0 25%,#e7edfc 0 50%,#fef9e6 0 75%,#e7f7ed 0);position:relative;border:1px solid #e5e7eb}.loading-graph i{position:absolute;left:55%;top:60%;width:12px;height:12px;background:#8a8cff;border-radius:50%}.qno{margin-top:clamp(50px,14vh,160px)}.qtext{font-size:16px;min-height:60px}.questions{padding-bottom:70px}.story{font-size:16px;line-height:1.9}.story .hint{font-size:11px}.study{z-index:30}.chapter-dots i{width:18px;height:5px}.center{padding-bottom:45px}.chat-intro-text{font-size:20px;font-weight:400}
.q-reference{max-width:390px;margin:34px auto 0;padding:14px 16px;border-left:3px solid #6d5add;background:#f6f4fd;color:#555160}.q-reference strong{font-size:11px}.q-reference p{margin:5px 0 0;font-size:12px;line-height:1.7}.q-reference+.qno{margin-top:32px}

#new-messages{align-self:center;border:0;border-radius:18px;padding:7px 14px;background:#202938;color:white;font-size:12px}#new-messages[hidden]{display:none}

.conversation textarea{font-family:inherit;font-size:16px;line-height:1.5;resize:none;max-height:144px;overflow-y:auto;overflow-x:hidden;white-space:pre-wrap;overflow-wrap:anywhere;box-sizing:border-box}.conversation form{align-items:flex-end}.completion-overlay>section{max-width:calc(100vw - 32px);box-sizing:border-box}.completion-overlay{z-index:100}

/* Keep recovery visible beside the composer, including on small screens. */
#chat-error:not(:empty){flex-shrink:0;max-height:32vh;overflow:auto;padding:8px 12px;background:#fff3ed;border-top:2px solid #c83d26;}
#chat-error .api-error{margin:0;padding:12px;border:2px solid #c83d26;border-radius:12px;background:#fff7f2;color:#702616;box-shadow:0 3px 14px #70261620;}
#chat-error .api-error strong{display:block;font-size:17px;font-weight:800;}
#chat-error .api-error p{margin:6px 0;font-size:14px;line-height:1.45;}
#chat-error .api-error button{width:100%;min-height:44px;background:#a93220;color:white;border:0;font-weight:700;}
