/* ==========================================================================
   Xero AI · content.css
   Messages and everything drawn inside answers: Markdown, code, tables,
   maths, quizzes, graphs, drawings, images, files and sources.
   ========================================================================== */

/* ---- Messages ---- */
.message { margin: 0 0 28px; animation: appear .25s ease; }
.mini-logo { width: 25px; height: 25px; border-radius: 8px; }
.mini-logo svg { width: 21px; height: 21px; }

.message-body { font-size: var(--msg-size); line-height: 1.75; overflow-wrap: anywhere; }
.message.assistant .message-body { padding: 4px 2px; line-height: 1.5; }
.message.user { width: fit-content; max-width: 85%; margin-left: auto; }
.message.user .message-body {
  padding: 9px 14px;
  line-height: 1.5;
  border-radius: 12px 12px 5px 12px;
  background: var(--user-bubble);
  -webkit-touch-callout: none;
}
.message.user .message-body:has(> .message-files > .message-image-slot):not(:has(.message-text)) { padding: 0; background: none; border-radius: 16px; } /* one picture alone: no coloured bubble around it */
.message.user.is-editing .message-body { outline: 1px solid color-mix(in srgb, var(--accent) 35%, var(--glass-edge)); outline-offset: 2px; } /* the same border colour as the "Editing message" box above the message field */
.message.error .message-body { color: var(--danger); }
.message-text.is-clamped { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; line-clamp: 3; overflow: hidden; }
.msg-more { display: block; margin: 4px 0 0; padding: 2px 0; border: 0; background: transparent; color: var(--muted); font: inherit; font-size: var(--ui-size); font-weight: 600; cursor: pointer; }
.msg-more:hover { color: var(--text); }
.message-files { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.message-files:last-child { margin-bottom: 0; }
.message-files .file-chip.is-openable { cursor: pointer; }
.message-files .file-chip.is-openable:focus-visible { outline: 2px solid color-mix(in srgb, CanvasText 35%, transparent); outline-offset: 2px; }
/* one picture in a sent message */
.message-image-slot { position: relative; display: block; width: fit-content; max-width: 100%; }
.message-image-download { position: absolute; top: 8px; right: 8px; width: 34px; height: 34px; display: none; place-items: center; border-radius: 50%; background: rgba(0, 0, 0, .55); color: #fff; -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.message-image-download svg { width: 18px; height: 18px; }
.message-image-slot.show-download .message-image-download { display: grid; }
.message-image { display: block; padding: 0; border: 0; background: none; cursor: zoom-in; border-radius: 16px; overflow: hidden; line-height: 0; }
.message-image-tag { display: block; width: auto; height: auto; max-width: min(100%, 300px); max-height: 300px; object-fit: cover; border-radius: 16px; -webkit-user-drag: none; }
/* file viewer */
.file-view-wrap { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; overflow: auto; }
.file-view-loading { flex: 1; display: grid; place-items: center; min-height: 120px; }
.file-view-spin { width: 22px; height: 22px; border-radius: 50%; border: 2px solid color-mix(in srgb, CanvasText 15%, transparent); border-top-color: color-mix(in srgb, CanvasText 55%, transparent); animation: file-view-spin .8s linear infinite; }
@keyframes file-view-spin { to { transform: rotate(360deg); } }
.file-view-media { max-width: 100%; max-height: 100%; border-radius: 12px; background: #000; }
.file-view-audio { display: flex; flex-direction: column; align-items: center; gap: 12px; width: min(100%, 420px); text-align: center; }
.file-view-audio audio { width: 100%; }
.file-view-pdf { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.file-view-pdf iframe { flex: 1; width: 100%; min-height: 0; border: 0; background: #fff; }
.file-view-readable { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: auto; }
.file-view-text { flex: 1 0 auto; }
.file-view-markdown { padding: 16px 20px; }
.file-view-sheet { overflow: auto; padding: 12px 16px; }
.file-view-table { border-collapse: collapse; font-size: .8125rem; white-space: nowrap; }
.file-view-table th, .file-view-table td { padding: 6px 12px; border: 1px solid var(--line); text-align: left; }
.file-view-table th { position: sticky; top: 0; background: var(--viewer-bg); font-weight: 600; }
.file-view-note { margin: 0; padding: 10px 16px; font-size: .78125rem; color: var(--muted); text-align: center; }
.file-view-card { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 24px; text-align: center; }
.file-view-icon svg { width: 52px; height: 52px; }
.file-view-name { max-width: 100%; overflow-wrap: anywhere; font-weight: 500; }
.file-view-meta { font-size: .75rem; color: var(--muted); }
.file-view-download { margin-top: 8px; padding: 9px 20px; border: 1px solid var(--line); border-radius: 999px; background: color-mix(in srgb, CanvasText 6%, transparent); color: var(--text); font: inherit; font-size: .8125rem; cursor: pointer; }
.file-view-download:hover { background: color-mix(in srgb, CanvasText 10%, transparent); }
.reply-part + .reply-part, .reply-part + .download-file, .download-file + .reply-part { margin-top: 12px; }

.message-actions { position: relative; display: flex; flex-wrap: nowrap; align-items: center; gap: 2px; min-width: 0; margin: 6px 0 0 -6px; }
.message-actions .icon-action { width: 30px; height: 30px; }
.message-actions .icon-action svg { width: 16px; height: 16px; }
/* Sent messages: Copy and Edit under the bubble. With a mouse they show while the pointer is over the message or anywhere on its line to the left; on phones and tablets they are always shown. */
.message.user { position: relative; isolation: isolate; }
.message.user::before { content: ""; position: absolute; z-index: -1; top: 0; bottom: 0; left: -100vw; right: 0; } /* the empty space beside the message counts as hovering it */
.message.user .user-actions { justify-content: flex-end; margin: 4px 0 0; opacity: 0; transition: opacity .15s ease; }
.message.user:hover .user-actions, .message.user .user-actions:focus-within { opacity: 1; }
.user-actions .icon-action { position: relative; }
/* The hover label (dark pill) is drawn by ui.js for every button and icon in the app. */
.hover-tip {
  position: fixed;
  z-index: 3000;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--text);
  color: var(--app-bg);
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.3;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
}
.hover-tip.show { opacity: 1; visibility: visible; }
@media (hover: none) and (pointer: coarse) {
  .message.user .user-actions { opacity: 1; margin-right: 10px; } /* a little to the left of the bubble's right edge */
  .user-actions .user-edit { left: 3px; } /* the Edit icon 3px to the right */
}

.retry-btn { margin-top: 10px; padding: 6px 11px; border: 1px solid var(--glass-edge); border-radius: 8px; background: var(--surface); font-size: 0.75rem; }
.retry-btn:hover { border-color: var(--accent); }
.stopped-note { display: flex; align-items: center; gap: 8px; margin-top: 10px; color: var(--muted); font-size: .95em; }
.stopped-note:first-child { margin-top: 2px; }
.stopped-note::before { content: ""; width: 9px; height: 9px; flex: none; border-radius: 3px; background: currentColor; opacity: .7; }

/* ---- Status: dots, labels, spinner ---- */
.status-line { display: inline-flex; align-items: center; gap: 10px; padding: 4px 0; line-height: 1; }
.status-label { font-size: 0.95rem; font-weight: 500; transition: opacity .2s ease; }
.status-label:empty { display: none; }
.status-label.swap-out { opacity: 0; }
.shimmer-text {
  background: linear-gradient(90deg, var(--muted) 0%, var(--text) 50%, var(--muted) 100%);
  background-size: 200% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: shimmer 1.6s linear infinite;
}
.typing-dots { display: inline-flex; align-items: center; gap: 5px; }
.typing-dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: bounce 1.1s ease-in-out infinite; }
.typing-dots i:nth-child(2) { animation-delay: .15s; }
.typing-dots i:nth-child(3) { animation-delay: .3s; }
/* From sending a message until the answer starts: a single pulsing dot instead of the three waving ones. */
.typing-dots.is-pulse i:nth-child(n+2) { display: none; }
.typing-dots.is-pulse i { width: 11px; height: 11px; background: var(--accent); animation: dot-pulse 1.2s ease-in-out infinite; }
@keyframes dot-pulse { 0%, 100% { transform: scale(.7); } 50% { transform: scale(1.2727); } }
.spinner {
  width: 14px;
  height: 14px;
  flex: none;
  border: 2px solid color-mix(in srgb, var(--accent) 28%, transparent);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

/* ---- Markdown ---- */
.message-body p { margin: 0 0 1.4em; }
.message-body p:last-child { margin-bottom: 0; }
.message-body a:not(.cite-pill, .dl-btn, .message-image-download) { color: var(--text); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; overflow-wrap: anywhere; }
.message-body :is(strong, b) { font-weight: 600; }
.message-body .md-heading { margin: 1.5em 0 .5em; font-weight: 600; line-height: 1.3; }
.message-body .md-heading:first-child { margin-top: 2px; }
.message-body .md-h1 { font-size: 1.5em; }
.message-body .md-h2 { font-size: 1.25em; }
.message-body .md-h3 { font-size: 1.125em; }
.message-body ul, .message-body ol { margin: 0 0 1.4em; padding-left: 1.2em; }
.message-body li { margin: 2px 0; line-height: 1.5; }
.message-body li > ul, .message-body li > ol { margin: 4px 0 0; }
.message-body blockquote { margin: 0 0 1.4em; padding: 0 0 0 1em; border-left: 3px solid color-mix(in srgb, var(--text) 25%, transparent); }
.message-body blockquote > :first-child { margin-top: 0; }
.message-body blockquote li { margin: 2px 0; }
.message-body blockquote ul, .message-body blockquote ol { margin-bottom: 4px; }
.message-body blockquote > :last-child { margin-bottom: 0; }
.message-body blockquote p { margin: 0 0 8px; }
.message-body hr { margin: 1.5em 0; border: 0; border-top: 1px solid color-mix(in srgb, CanvasText 12%, transparent); }
.message-body code.inline-code { padding: .15em .4em; border-radius: 6px; background: #f0f1f3; font: .875em var(--mono); overflow-wrap: anywhere; }
html[data-theme="dark"] .message-body code.inline-code { background: rgba(255, 255, 255, .12); }
.message-body .text-block { margin: 12px 0; padding: 0; white-space: pre-wrap; font: inherit; line-height: 1.8; }

/* Tables: only horizontal lines; wide tables scroll sideways. */
.table-wrap { margin: 16px 0; overflow-x: auto; -webkit-overflow-scrolling: touch; }
/* Phones and tablets scroll a wide table by touch and draw no scroll bar; desktop keeps it */
@media (hover: none) and (pointer: coarse) {
  .table-wrap { scrollbar-width: none; -ms-overflow-style: none; }
  .table-wrap::-webkit-scrollbar { display: none; }
}
.message-body table { width: 100%; border-collapse: collapse; font-size: .9375em; line-height: 1.5; }
.message-body th, .message-body td {
  min-width: 180px;
  padding: 10px 16px 10px 0;
  border-bottom: 1px solid color-mix(in srgb, CanvasText 12%, transparent);
  vertical-align: top;
  transition: border-color .15s ease;
}
/* Short entries (#, VSA, a name) take exactly the width of their text; long text gets the rest (classes set in render.js).
   A table where every column is short is only as wide as its text. */
.message-body th.col-fit, .message-body td.col-fit { min-width: 0; width: 1%; white-space: nowrap; }
.message-body table.table-fit { width: auto; }
.message-body table.table-fit .col-fit { width: auto; }
.message-body th.col-long, .message-body td.col-long { min-width: 280px; }
.message-body th { font-weight: 600; white-space: nowrap; border-bottom-color: color-mix(in srgb, CanvasText 28%, transparent); }
.table-wrap.is-scrolling th, .table-wrap.is-scrolling td { border-bottom-color: transparent; }
/* The last row has no line under it, unless a divider follows the table. */
.message-body table > :last-child > tr:last-child > :is(th, td) { border-bottom-color: transparent; }
.message-body .table-wrap:has(+ hr) table > :last-child > tr:last-child > :is(th, td) { border-bottom-color: color-mix(in srgb, CanvasText 12%, transparent); }
.message-body .table-wrap.is-scrolling table > :last-child > tr:last-child > :is(th, td) { border-bottom-color: transparent; }

/* Maths */
.math-block { margin: 12px 0; padding: 4px 0; overflow-x: auto; overflow-y: hidden; text-align: center; }
.math-block .katex-display { margin: 0; }
.message-body .katex { font-size: 1.08em; color: inherit; }

/* Citations: one pill per source at the end of a paragraph / list item / cell. */
.cite-group { display: inline-flex; flex-wrap: wrap; gap: 4px; margin-left: 4px; vertical-align: 1px; }
.cite-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 1px 8px 1px 5px;
  border: 1px solid var(--glass-edge);
  border-radius: 999px;
  background: var(--soft);
  color: var(--muted);
  font-size: 0.71875rem;
  font-weight: 500;
  line-height: 1.6;
  text-decoration: none;
  white-space: nowrap;
}
.cite-pill:hover { color: var(--text); border-color: color-mix(in srgb, var(--accent) 50%, var(--glass-edge)); }
.cite-pill img { width: 14px; height: 14px; border-radius: 4px; }

/* ---- Shared card for code blocks ---- */
.code-block, .prompt-card, .download-file {
  border: 1px solid var(--glass-edge);
  border-radius: 16px;
  background: color-mix(in srgb, var(--surface) 28%, transparent);
  -webkit-backdrop-filter: blur(14px) saturate(150%);
  backdrop-filter: blur(14px) saturate(150%);
  box-shadow: var(--glass-hi);
}

/* Code blocks */
.code-block { display: flex; flex-direction: column; margin: 14px 0; overflow: hidden; border-color: color-mix(in srgb, CanvasText 15%, transparent); }
.block-head { display: flex; align-items: center; gap: 10px; min-height: 42px; padding: 7px 8px 7px 14px; border-bottom: 1px solid var(--line); }
.lang-icon { width: 22px; height: 22px; display: inline-flex; flex: none; }
.lang-icon svg { width: 22px; height: 22px; }
.block-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.75rem; font-weight: 400; }
.code-block .block-head { min-height: 34px; padding: 3px 6px 3px 12px; gap: 8px; border-bottom-color: color-mix(in srgb, CanvasText 15%, transparent); } /* slimmer title bar on code blocks */
.code-block .lang-icon, .code-block .lang-icon svg { width: 16px; height: 16px; }
.code-block .block-title { flex: 0 1 auto; } /* the name hugs the Download button; the other buttons stay on the right */
.code-block .block-actions { gap: 6px; margin-right: 8px; } /* Copy sits a little further from Expand, and both a little away from the right edge */
.code-block .block-head .icon-action { width: 28px; height: 28px; }
.code-block .block-head .icon-action svg { width: 15px; height: 15px; }
.lang-badge { flex: none; padding: 2px 8px; border: 1px solid var(--glass-edge); border-radius: 999px; background: var(--soft); font-size: 0.65625rem; font-weight: 700; letter-spacing: .4px; text-transform: uppercase; }
.code-block pre {
  margin: 0;
  padding: 14px 16px;
  max-height: min(calc(var(--stable-vh, 1dvh) * 42), 340px); /* --stable-vh ignores the on-screen keyboard, so blocks do not change height when it opens */
  overflow: auto;
  overscroll-behavior: auto; /* at the top or bottom of the code, the scroll carries on to the chat */
  white-space: pre;
  tab-size: 2;
  font: .8125rem/1.6 var(--mono);
}
/* Code blocks scroll with the wheel, trackpad or touch, but draw no scrollbar at all */
.code-block pre { scrollbar-width: none; -ms-overflow-style: none; }
/* Code in the chat cannot be selected or copied by hand (the Copy button still works); the expanded view can be, on every device */
.code-block pre, .code-block pre * { -webkit-user-select: none; -moz-user-select: none; user-select: none; -webkit-touch-callout: none; }
.viewer-code, .viewer-code * { -webkit-user-select: text; -moz-user-select: text; user-select: text; -webkit-touch-callout: default; }
.code-block pre::-webkit-scrollbar { display: none; width: 0; height: 0; }

/* Syntax colours (VS Code light / dark) */
.code-block code, .viewer-code code, .svg-code code {
  --t-kw: #0000ff; --t-ctl: #af00db; --t-str: #a31515; --t-num: #098658; --t-cmt: #008000; --t-fn: #795e26;
  --t-type: #267f99; --t-var: #001080; --t-const: #0070c1; --t-tag: #800000; --t-attr: #e50000; --t-prop: #e50000;
  --t-sel: #800000; --t-val: #0451a5; --t-meta: #0000ff; --t-add: #098658; --t-del: #a31515;
}
html[data-theme="dark"] :is(.code-block, .viewer-code, .svg-code) code {
  --t-kw: #569cd6; --t-ctl: #c586c0; --t-str: #ce9178; --t-num: #b5cea8; --t-cmt: #6a9955; --t-fn: #dcdcaa;
  --t-type: #4ec9b0; --t-var: #9cdcfe; --t-const: #4fc1ff; --t-tag: #569cd6; --t-attr: #9cdcfe; --t-prop: #9cdcfe;
  --t-sel: #d7ba7d; --t-val: #ce9178; --t-meta: #c586c0; --t-add: #b5cea8; --t-del: #f48771;
}
.tok-kw { color: var(--t-kw); } .tok-ctl { color: var(--t-ctl); } .tok-str { color: var(--t-str); } .tok-num { color: var(--t-num); }
.tok-cmt { color: var(--t-cmt); } .tok-fn { color: var(--t-fn); } .tok-type { color: var(--t-type); } .tok-var { color: var(--t-var); }
.tok-const { color: var(--t-const); } .tok-tag { color: var(--t-tag); } .tok-attr { color: var(--t-attr); } .tok-prop { color: var(--t-prop); }
.tok-sel { color: var(--t-sel); } .tok-val { color: var(--t-val); } .tok-meta { color: var(--t-meta); }
.tok-add { color: var(--t-add); } .tok-del { color: var(--t-del); }

/* Buttons that float in a block's top-right corner */
.floating-actions { position: absolute; top: 6px; right: 6px; z-index: 2; display: flex; gap: 2px; }

/* Copy box (```text) and prompt card */
.copy-box { position: relative; margin: 14px 0; border: 1px solid var(--line); border-radius: 12px; }
.copy-box-body { padding: 14px 48px 14px 16px; overflow-x: auto; }
.prompt-card { margin: 14px 0; overflow: hidden; border-radius: 18px; }
.prompt-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px 0 18px; color: var(--muted); }
.prompt-label { font-size: .95em; font-weight: 500; }
.prompt-body { padding: 4px 18px 16px; line-height: 1.7; }

/* ASCII drawings */
.ascii-wrap { position: relative; margin: 12px 0; }
.ascii-block {
  margin: 0;
  padding: 4px 0;
  overflow-x: auto;
  white-space: pre;
  tab-size: 4;
  font: .875rem/1.2 var(--mono);
  font-variant-ligatures: none;
  font-kerning: none;               /* every character exactly one cell wide, so columns line up */
  font-feature-settings: "liga" 0, "calt" 0;
  letter-spacing: 0;
  -webkit-text-size-adjust: 100%;
}

/* SVG drawings */
.svg-block { position: relative; margin: 14px 0; }
.svg-block.is-streaming { color: var(--muted); }
.svg-stage { display: flex; justify-content: center; padding: 4px 0; }
.svg-stage img { display: block; width: min(100%, 520px); height: auto; max-height: min(calc(var(--stable-vh, 1dvh) * 70), 640px); object-fit: contain; }
.svg-stage.is-error { justify-content: flex-start; padding-right: 80px; color: var(--muted); }
.svg-code { margin-top: 8px; overflow: hidden; border: 1px solid var(--line); border-radius: 12px; }
.svg-code pre { margin: 0; padding: 12px 14px; max-height: min(calc(var(--stable-vh, 1vh) * 45), 360px); overflow: auto; font: .78125rem/1.6 var(--mono); }
.svg-block .floating-actions .icon-action { opacity: .6; }
.svg-block:hover .floating-actions .icon-action { opacity: 1; }
/* Graphs */
.graph-block { margin: 14px 0; }
.graph-block.is-streaming { color: var(--muted); }
/* Loading line of a graph or quiz: an animated icon and a light sweep across the text. */
.loading-row { display: inline-flex; align-items: center; gap: 10px; color: var(--muted); }
.load-icon { width: 18px; height: 18px; flex: none; }
.ld-bar { fill: var(--accent); transform-box: fill-box; transform-origin: 50% 100%; animation: ld-grow 1.2s ease-in-out infinite; }
.ld-bar:nth-child(2) { animation-delay: .2s; }
.ld-bar:nth-child(3) { animation-delay: .4s; }
.ld-line { stroke: var(--accent); stroke-width: 2.4; stroke-linecap: round; animation: ld-slide 1.8s ease-out infinite; }
.ld-line:nth-child(2) { animation-delay: .3s; }
.ld-line:nth-child(3) { animation-delay: .6s; }
.loading-text {
  background: linear-gradient(90deg, var(--muted) 0%, var(--muted) 35%, color-mix(in srgb, var(--muted) 35%, var(--surface)) 50%, var(--muted) 65%, var(--muted) 100%);
  background-size: 240px 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: ld-shimmer 1.6s linear infinite;
}
@keyframes ld-grow { 0%, 100% { transform: scaleY(.25); } 50% { transform: scaleY(1); } }
@keyframes ld-slide { 0%, 10% { transform: translateX(-6px); opacity: 0; } 35%, 85% { transform: translateX(0); opacity: 1; } 100% { opacity: 0; } }
@keyframes ld-shimmer { from { background-position: -120px 0; } to { background-position: 120px 0; } }
.graph-title { margin: 0 0 4px; font-size: .9375rem; font-weight: 400; text-align: left; }
.graph-stage { display: flex; justify-content: flex-start; margin-left: calc(-1 * min(2%, 12px)); } /* the title and equation sit exactly at the text edge; the drawing starts a little further left, as the y-axis numbers have empty room on their left */
.graph-stage svg { display: block; width: 100%; max-width: 560px; height: auto; }
.gr-grid { stroke: var(--text); stroke-opacity: .10; stroke-width: 1; }
.gr-axis { stroke: var(--text); stroke-opacity: .75; stroke-width: 1.6; }
.gr-arrow { fill: var(--text); fill-opacity: .75; }
.gr-dash { stroke: var(--muted); stroke-width: 1.4; stroke-dasharray: 6 5; }
.gr-curve { fill: none; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.gr-point { fill: var(--viewer-bg); stroke: var(--text); stroke-width: 2.2; }
.gr-text { fill: var(--muted); font: 500 .71875rem var(--font); }
.gr-axis-name { fill: var(--text); font-style: italic; font-weight: 600; font-size: 0.8125rem; }
.gr-label { fill: var(--text); font: 600 .75rem var(--font); paint-order: stroke; stroke: var(--viewer-bg); stroke-width: 4px; stroke-linejoin: round; }

/* ---- Quizzes ---- */
.quiz-block { display: flex; flex-direction: column; gap: 22px; margin: 14px 0; }
.quiz-title { display: flex; align-items: baseline; gap: 10px; margin-bottom: 10px; font-weight: 600; line-height: 1.5; }
.quiz-num { flex: none; min-width: 1.4em; font-weight: 600; }
.quiz-options { display: flex; flex-direction: column; gap: 8px; }
.quiz-opt {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 4px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  text-align: left;
  font-size: inherit;
  line-height: 1.45;
}
.quiz-opt:not(:disabled):hover { background: var(--soft); }
.quiz-opt:disabled { cursor: default; }
.quiz-q.is-preview .quiz-opt { opacity: .85; pointer-events: none; }
.quiz-dot {
  width: 18px;
  height: 18px;
  flex: none;
  display: grid;
  place-items: center;
  border: 2px solid var(--muted);
  border-radius: 50%;
  transition: border-color .18s ease, background .18s ease;
}
.quiz-dot svg { width: 12px; height: 12px; fill: none; stroke: #fff; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.quiz-key { flex: none; font-weight: 700; color: var(--muted); }
.quiz-label { flex: 1; min-width: 0; }
.quiz-opt.is-picked .quiz-dot { border-color: var(--accent); }
.quiz-opt.is-correct .quiz-dot { border-color: #2f9e57; background: #2f9e57; }
.quiz-opt.is-wrong .quiz-dot { border-color: #c0453a; background: #c0453a; }
.quiz-foot { display: flex; align-items: flex-start; gap: 14px; margin-top: 10px; }
.quiz-note { flex: 1; font-size: .93em; line-height: 1.5; }
/* The reason glides in when an answer is picked (not when saved answers are restored after a refresh). */
.quiz-q.animate-reveal .quiz-foot:not([hidden]) { animation: quiz-reveal .38s cubic-bezier(.22, .8, .3, 1) both; }
.quiz-note.is-fresh { animation: quiz-fade .3s ease both; }
@keyframes quiz-reveal { from { opacity: 0; transform: translateY(-8px); max-height: 0; } to { opacity: 1; transform: none; max-height: 30em; } }
@keyframes quiz-fade { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .quiz-q.animate-reveal .quiz-foot:not([hidden]), .quiz-note.is-fresh { animation: none; } }
.quiz-bar { display: flex; align-items: center; gap: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.quiz-bar[hidden] { display: none; }
.quiz-score { font-weight: 600; }
.quiz-reset { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-weight: 600; }
.quiz-reset[hidden] { display: none; }
.quiz-reset-text { cursor: default; user-select: none; }
.quiz-reset-btn { width: 28px; height: 28px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 50%; background: none; color: inherit; cursor: pointer; }
.quiz-reset-btn svg { width: 16px; height: 16px; }
.quiz-reset-btn:hover { background: var(--soft); color: var(--text); }
.quiz-loading { font-size: .95em; }

/* ---- Images ---- */
.md-img {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 120px;
  min-height: 120px;
  max-width: 100%;
  margin: 8px 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  vertical-align: top;
}
.md-img.is-loaded { display: block; min-width: 0; min-height: 0; cursor: zoom-in; }
.md-img.is-loaded .md-img-spin { display: none; }
.md-img-spin { width: 26px; height: 26px; border: 3px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
.md-img-tag { display: block; max-width: 100%; height: auto; }
.md-img-row { display: flex; flex-wrap: wrap; gap: 10px; margin: 6px 0; }

.message-image-slot.is-generated { margin-top: 4px; }
.message-image-slot.is-generated .message-image-tag { width: min(100%, 420px); max-width: 100%; max-height: none; object-fit: contain; border: 1px solid var(--line); border-radius: 14px; }
.message-image-slot.is-generated .message-image { border-radius: 14px; }

/* ---- Downloadable files ---- */
.download-file { display: flex; align-items: center; gap: 12px; margin: 12px 0; padding: 10px 12px; }
.file-name { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; font-weight: 600; }
.file-ico { width: 40px; height: 40px; flex: none; display: grid; place-items: center; border: 1px solid var(--glass-edge); border-radius: 12px; background: var(--soft); }
.file-ico svg { width: 26px; height: 26px; }
.file-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dl-btn {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 14px 7px 11px;
  border: 1px solid var(--glass-edge);
  border-radius: 999px;
  background: var(--soft);
  color: var(--text);
  font-size: 0.78125rem;
  font-weight: 600;
  text-decoration: none;
  transition: border-color .2s ease, transform .2s ease;
}
.dl-btn svg { width: 15px; height: 15px; color: var(--accent); }
.dl-btn:hover { border-color: var(--accent); transform: translateY(-1px); }

/* ---- Web search source chips ---- */
.search-sites { display: inline-flex; align-items: center; margin-left: 4px; padding-left: 8px; }
.site-chip {
  width: 26px;
  height: 26px;
  display: inline-grid;
  place-items: center;
  margin-left: -8px;
  border: 2px solid var(--glass-strong);
  border-radius: 50%;
  background: var(--glass-strong);
  animation: pop .25s ease both;
}
/* Activity line above the answer: what the AI is doing, folded into one line when the answer starts. */
.thinking-block { margin: 2px 0 10px; color: var(--muted); font-size: 0.84375rem; }
.thinking-head { display: inline-flex; align-items: center; gap: 10px; padding: 2px 0; border: 0; background: transparent; color: color-mix(in srgb, var(--text) 70%, transparent); font: inherit; font-weight: 600; cursor: pointer; }
.thinking-head:hover { color: var(--text); }
.thinking-chevron { width: 7px; height: 7px; margin-top: -3px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); transition: transform .2s ease; }

.source-ico {
  width: 20px;
  height: 20px;
  flex: none;
  display: inline-grid;
  place-items: center;
  overflow: hidden;
  border-radius: 50%;
  background: color-mix(in srgb, var(--accent) 16%, var(--soft));
  color: var(--accent);
  font-size: 0.6875rem;
  font-weight: 700;
}
.source-ico img { width: 16px; height: 16px; display: block; border-radius: 50%; }

/* ---- Sources line: between the answer and its action bar. The site icons are stacked (each above the one before it); only the label has a soft background ---- */
.sources-row { display: flex; margin: 10px 0 0; }
.sources-btn { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; cursor: pointer; outline: none; -webkit-user-select: none; user-select: none; } /* the icons and the label cannot be selected or copied */
.sources-btn:focus-visible { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent); }
.sources-stack { display: inline-flex; align-items: center; padding-left: 8px; }
.sources-stack .site-chip { width: 22px; height: 22px; animation: none; }
.sources-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px;
  border: 1px solid color-mix(in srgb, var(--glass-edge) 55%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, var(--soft) 45%, transparent);
  color: var(--muted);
  font-size: 0.78125rem;
  font-weight: 600;
  transition: background .2s ease, border-color .2s ease, color .2s ease;
}
.sources-btn:hover .sources-label, .sources-btn[aria-expanded="true"] .sources-label { color: var(--text); }
.sources-chevron { width: 6px; height: 6px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(-45deg); transition: transform .2s ease; } /* ">" like the Activity line; "<" while the panel is open */
.sources-btn[aria-expanded="true"] .sources-chevron { transform: rotate(135deg); }

/* ---- Phones ---- */
@media (max-width: 700px) {
  .message.user { max-width: 92%; }
  .code-block pre { max-height: min(calc(var(--stable-vh, 1dvh) * 29.4), 238px); } /* 30% shorter than on laptops and tablets */
}

/* "Can make mistakes" note under the newest answer only */
.reply-note { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; margin: 8px 0 0; color: color-mix(in srgb, var(--muted) 65%, transparent); font-size: 0.75rem; line-height: 1.4; }

/* Expand button on code blocks: fades in smoothly (no movement) when the title line is hovered (desktop) or the code is clicked / tapped.
   It lifts slightly only when the cursor is on the button itself, like Copy and Download. */
.code-block .expand-btn { opacity: 0; pointer-events: none; transition: opacity .25s ease, background .2s ease, color .2s ease, transform .2s ease; }
.code-block.is-active .expand-btn { opacity: 1; pointer-events: auto; }
@media (hover: hover) { .code-block .block-head:hover .expand-btn { opacity: 1; pointer-events: auto; } }

/* Activity line + timeline sheet */
/* Same 2px side padding as the answer text, so both start at the same left edge. */
.activity-block { padding: 0 2px; }
.activity-block.is-done .search-sites { display: none; }
.activity-block .thinking-chevron { transform: rotate(-45deg); margin-top: 0; }
.activity-block.is-open .thinking-chevron { transform: rotate(135deg); } /* "<" while its panel is open */ /* the ">" is there from the first moment, so the live thinking can be opened */
.sheet-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.sheet-x { flex: none; width: 28px; height: 28px; margin: -4px -6px -4px 0; padding: 0; border: 0; background: none; color: var(--muted); font-size: 1.5rem; line-height: 1; cursor: pointer; }
.sheet-x:hover { color: var(--text); }
.tl-body { padding-top: 6px; }
.tl-step { position: relative; display: flex; gap: 12px; padding-bottom: 18px; }
.tl-step::before { content: ""; position: absolute; left: 8px; top: 22px; bottom: 2px; width: 1px; background: var(--line); }
.tl-step.tl-end { padding-bottom: 4px; }
.tl-step.tl-end::before { display: none; }
.tl-icon { flex: none; width: 16px; height: 16px; margin-top: 2px; color: var(--muted); background: var(--surface, var(--bg)); }
.tl-main { min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.tl-title { color: var(--text); font-size: 0.9375rem; font-weight: 600; line-height: 1.35; }
.tl-text { color: var(--muted); font-size: 0.875rem; line-height: 1.5; overflow-wrap: anywhere; }
.tl-skel .tl-main { flex: 1; gap: 10px; }
.tl-skel .sk-dot { width: 16px; height: 16px; margin-top: 2px; border-radius: 50%; }
.tl-skel .sk-tall { height: 14px; }
.tl-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 2px; }
.tl-chip { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; padding: 4px 10px; border: 1px solid var(--line); border-radius: 999px; color: var(--text); font-size: 0.8125rem; text-decoration: none; }
.tl-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tl-more { color: var(--muted); }

/* Wave bars shown while the AI is working */
.wave-bars { display: inline-flex; align-items: center; gap: 2px; height: 14px; flex: none; }
.wave-bars i { width: 2px; height: 100%; border-radius: 2px; background: var(--accent); transform-origin: center; animation: wave-bar 1s ease-in-out infinite; }
.wave-bars i:nth-child(2) { animation-delay: .12s; }
.wave-bars i:nth-child(3) { animation-delay: .24s; }
.wave-bars i:nth-child(4) { animation-delay: .36s; }
@keyframes wave-bar { 0%, 100% { transform: scaleY(.3); } 50% { transform: scaleY(1); } }
.activity-block.is-done .wave-bars { display: none; }
.activity-done-icon { display: none; flex: none; width: 16px; height: 16px; margin-right: -4px; color: var(--muted); } /* the head's 10px gap minus 4px = 6px between icon and text */
.activity-block.is-done.has-thought .activity-done-icon { display: inline-flex; }

/* Chat skeleton: shown while a clicked chat is being fetched. Light grey shapes that fade softly in and out. */
.chat-skeleton { display: flex; flex-direction: column; gap: 11px; max-height: calc(100dvh - 170px); padding: 4px 2px; overflow: hidden; }
.sk-bar { display: block; flex: none; height: 12px; border-radius: 8px; background: color-mix(in srgb, var(--text) 3.5%, transparent); animation: sk-fade 2.2s ease-in-out infinite; }
.sk-me { align-self: flex-end; height: 34px; margin-top: 10px; border-radius: 14px; }
@keyframes sk-fade { 0%, 100% { opacity: .55; } 50% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .sk-bar { animation: none; } }
.chat-load-error { padding: 4px 2px; color: var(--muted); }
.chat-load-error p { margin: 0 0 10px; }
