/* Ask owns this file; these chat primitives are intentionally shared with Companion. */
.ask-sheet { width: min(100%, 560px); max-width: 100%; max-height: min(86dvh, 760px); margin: auto auto 0; padding: 0; overflow: hidden; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-bottom: 0; border-radius: var(--r-lg) var(--r-lg) 0 0; }
.ask-sheet[open] { display: flex; flex-direction: column; }
.ask-sheet .sheet-body { min-height: 0; display: flex; flex-direction: column; padding: 0; }
.ask-body { min-height: 0; display: flex; flex: 1; flex-direction: column; }
.ask-quote { margin: 0; padding: 0 20px 16px; color: var(--ink-2); border-bottom: 1px solid var(--line); font: italic 18px/1.4 var(--serif); }
.chat-thread { min-height: 130px; flex: 1 1 auto; overflow-y: auto; overscroll-behavior: contain; display: flex; flex-direction: column; gap: 12px; padding: 18px 20px 10px; scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
.chat-msg { max-width: 90%; white-space: pre-wrap; overflow-wrap: anywhere; font: 400 17px/1.48 var(--serif); animation: ask-rise 220ms var(--ease) both; }
.chat-msg.user { align-self: flex-end; max-width: 82%; padding: 10px 14px; color: var(--ink); background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r) var(--r-sm) var(--r) var(--r); font: 400 15px/1.45 var(--sans); }
.chat-msg.ai { align-self: flex-start; color: var(--ink-2); }
.chat-typing { display: flex; gap: 4px; align-items: center; min-height: 25px; }
.chat-typing span { width: 5px; height: 5px; border-radius: 50%; background: var(--muted); animation: ask-dot 900ms var(--ease) infinite; }
.chat-typing span:nth-child(2) { animation-delay: 120ms; } .chat-typing span:nth-child(3) { animation-delay: 240ms; } .chat-typing-slow span { animation-duration: 1.2s; }
.ask-suggestions { display: flex; gap: 7px; overflow-x: auto; padding: 5px 20px 12px; scrollbar-width: none; }
.ask-suggestions::-webkit-scrollbar { display: none; }
.ask-suggestion { flex: 0 0 auto; min-height: 36px; padding: 8px 12px; color: var(--ink-2); background: transparent; border: 1px solid var(--line); border-radius: 999px; font: 500 12px/1.2 var(--sans); cursor: pointer; }
.ask-suggestion:hover { background: var(--surface-2); }
.chat-left { min-height: 30px; padding: 7px 20px 8px; color: var(--muted); border-top: 1px solid var(--line); text-align: center; letter-spacing: .02em; font: 400 11px/1.3 var(--sans); }
.chat-left:empty { display: none; }
.chat-form { display: flex; align-items: flex-end; gap: 8px; padding: 10px 12px max(12px, var(--safe-b)); border-top: 1px solid var(--line); background: var(--surface); }
.chat-input { min-width: 0; min-height: 46px; max-height: 112px; flex: 1; resize: none; overflow-y: auto; padding: 12px 14px; color: var(--ink); background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r); outline: none; font: 400 16px/1.35 var(--sans); }
.chat-input::placeholder { color: var(--muted); }
.chat-input:focus-visible { border-color: var(--muted); box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--muted); }
.chat-send { width: 46px; height: 46px; flex: none; display: grid; place-items: center; color: var(--on-accent); background: var(--accent); border: 0; border-radius: 50%; cursor: pointer; }
.chat-send .icon { width: 19px; height: 19px; stroke-width: 2; } .chat-send:disabled { opacity: .4; cursor: default; }
.chat-paywall { align-self: stretch; padding: 16px; color: var(--ink-2); background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r); font: 400 14px/1.5 var(--sans); }
.chat-paywall strong { display: block; margin-bottom: 5px; color: var(--ink); font: 500 20px/1.2 var(--serif); } .chat-paywall p { margin: 0 0 14px; }
.ask-paywall-action, .ask-retry { min-height: 38px; padding: 8px 13px; color: var(--on-accent); background: var(--accent); border: 0; border-radius: var(--r-sm); font: 600 12px/1 var(--sans); cursor: pointer; }
.chat-error { display: flex; align-items: center; gap: 10px; max-width: 100%; color: var(--muted); font: 400 13px/1.4 var(--sans); }
.chat-error .ask-retry { margin-left: auto; min-height: 32px; color: var(--ink); background: transparent; border: 1px solid var(--line); }
.ask-retry:hover { background: var(--surface-2); }
.ask-suggestion:focus-visible, .chat-send:focus-visible, .ask-paywall-action:focus-visible, .ask-retry:focus-visible { outline: 2px solid var(--muted); outline-offset: 3px; }
@keyframes ask-rise { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }
@keyframes ask-dot { 0%, 100% { opacity: .35; transform: translateY(0); } 50% { opacity: 1; transform: translateY(-2px); } }
@media (prefers-reduced-motion: reduce) { .chat-msg, .chat-typing span { animation: none; } }
@media (min-width: 600px) { .ask-sheet { border-bottom: 1px solid var(--line); border-radius: var(--r-lg); } }

/* round 8: the companion's face at the top left of the Ask sheet */
.ask-sheet .sheet-head { gap: 8px; }
.ask-buddy { width: 40px; height: 40px; flex: none; margin: -8px -4px -8px -8px; }
.ask-sheet .sheet-title { flex: 1; min-width: 0; }
.ask-more { display: flex; align-items: center; justify-content: center; gap: 6px; width: 100%; min-height: 40px; margin: 4px 0 8px; color: var(--ink); background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; font: 500 13px/1.2 var(--sans); cursor: pointer; }
.ask-more[hidden] { display: none; }
.ask-more:focus-visible { outline: 2px solid var(--muted); outline-offset: 3px; }
