/* ask.css - the question screen (UI overhaul R3, track A;
   docs/spec-ui-overhaul-r3-build.md §3, A2, A3, A5): the question box, the
   line under the box, home, the answer card and its blocks, the error and
   limit blocks. The card's rules are written onto the legacy class names its
   renderers emit; new chrome uses aw- names. The print rules stay in the
   page's print block (block "R3 A").

   Colours are tokens only (static/ui/tokens.css; scripts/test_ui_tokens.py
   checks). Referenced as /static/ui/ask.css?v=<CACHE_VERSION number>. It is
   linked before the page's <style>, so a legacy rule of the page that is
   still there wins at equal specificity; a commit that rebuilds a block
   deletes that block's legacy rules (plan G5). */

/* ---------- the question box (A2; the prototype's query.css 10-64) ----------
   The box is a size container: its tool labels show when the box is wide
   enough (a container query on the box only, never on the column that holds
   the answer, so the printed card keeps the page as its containing block:
   plan A2 item 2, fact digest Q§13 item 22). */

.aw-qbox {
  container-type: inline-size; container-name: aw-qbox;
  display: flex; flex-direction: column; gap: 8px;
  padding: 12px 12px 10px;
  border: 1px solid var(--border-hi); border-radius: var(--r-box);
  background: var(--surface); box-shadow: var(--shadow-card);
}
.aw-qbox:focus-within { border-color: var(--amber-line); }
.aw-qbox-input {
  display: block; width: 100%; min-height: 26px; max-height: 208px; margin: 0; padding: 0 4px;
  border: 0; outline: 0; resize: none; overflow-y: hidden; background: transparent;
  color: var(--text-hi); font-family: var(--sans); font-size: 16px; line-height: 26px; font-weight: 400;
}
.aw-qbox-input::placeholder { color: var(--muted); opacity: 1; }
.aw-qbar { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; }
.aw-qbar-right { display: flex; align-items: center; gap: 6px; margin-left: auto; }

.aw-qtool {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-width: 44px; height: 44px; flex: none; margin: 0; padding: 0;
  border: 0; border-radius: var(--r-ctl);
  background: transparent; color: var(--text-dim);
  font-family: var(--sans); font-size: 14px; line-height: 20px; font-weight: 500;
  cursor: pointer; -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.aw-qtool-label { display: none; }
/* the funnel while a filter is applied (amber tint; the pressed state and
   the button's name say it too, never the colour alone) */
.aw-qtool[aria-pressed="true"] { background: var(--amber-tint); color: var(--amber-text); }
.aw-qtool-dot { position: absolute; top: 8px; right: 7px; box-shadow: 0 0 0 2px var(--surface); }
/* Upload while the account has no documents (static/ui/ask.js, data-emph;
   founder 2026-11-16): a steady ring drawn inside the button (nothing moves)
   and, once, three soft pulses of a ring outside it a second after it
   appears; under reduced motion only the steady ring. The ring and the
   no-documents prompt's words are the cue, never the colour alone. */
.aw-qtool[data-emph="on"] { box-shadow: inset 0 0 0 2px var(--amber-text); color: var(--amber-text); }
.aw-qtool[data-emph="on"]::after {
  content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  opacity: 0; animation: aw-qtool-ring 1.6s ease-out 1s 3;
}
@keyframes aw-qtool-ring {
  0% { opacity: 0.7; box-shadow: 0 0 0 0 var(--amber-text); }
  100% { opacity: 0; box-shadow: 0 0 0 10px var(--amber-text); }
}
@media (prefers-reduced-motion: reduce) {
  .aw-qtool[data-emph="on"]::after { animation: none; }
}

@container aw-qbox (min-width: 560px) {
  .aw-qbar { gap: 4px; }
  .aw-qtool { padding: 0 12px 0 8px; }
  .aw-qtool-label { display: inline; }
  .aw-qtool-dot { position: static; box-shadow: none; }
}

.aw-qmode {
  display: inline-flex; align-items: center; gap: 4px;
  height: 44px; flex: none; margin: 0; padding: 0 10px 0 14px;
  border: 1px solid var(--border-hi); border-radius: var(--r-round);
  background: var(--raised); color: var(--text);
  font-family: var(--sans); font-size: 14px; line-height: 20px; font-weight: 500; white-space: nowrap;
  cursor: pointer; -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.aw-qmode .aw-ic { color: var(--text-dim); }
/* Ask: the amber circle with the logo's dart; grey while the box is blank or
   an answer is being produced */
.aw-qask {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; flex: none; margin: 0; padding: 0;
  border: 1px solid var(--amber-edge); border-radius: 50%; background: var(--amber);
  cursor: pointer; -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.aw-qask .aw-dart-f1 { fill: var(--on-amber); }
.aw-qask .aw-dart-f2 { fill: var(--on-amber-shade); }
.aw-qask:disabled { border-color: var(--border-hi); background: var(--raised); cursor: default; }
.aw-qask:disabled .aw-dart-f1 { fill: var(--disabled); }
.aw-qask:disabled .aw-dart-f2 { fill: var(--disabled-shade); }

/* ---------- the line under the box (A2; the prototype's query.css 68-80) ---------- */

.aw-scope {
  display: flex; flex-wrap: wrap; align-items: center; gap: 2px 8px;
  padding: 10px 6px 0;
  font-family: var(--sans); font-size: 13px; line-height: 18px; color: var(--muted);
}
.aw-scope:has(.aw-scope-chip) { padding-top: 3px; }
.aw-scope-main { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 2px 8px; min-width: 0; max-width: 100%; }
.aw-scope-chip {
  display: inline-flex; align-items: center; max-width: 100%; min-width: 0; min-height: 44px;
  margin: 0; padding: 0; border: 0; background: transparent; color: inherit; font: inherit;
  cursor: pointer; -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.aw-scope-chip .aw-chip { gap: 6px; max-width: 100%; min-width: 0; padding: 0 8px 0 12px; }
.aw-scope-chip-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.aw-scope-chip-n { flex: none; }
/* R2's indexing link sits in the line; the allowance and the fallback-test
   chip take lines of their own */
.aw-scope .aw-index-line { margin-top: 0; }
.aw-scope-quota { flex-basis: 100%; color: var(--amber-text); }
.aw-scope .aw-llm-line { flex-basis: 100%; margin-top: 0; }

/* The allowance in the line (plan allowances part 2, D20, D21; the founder's
   frames R2, R4, R6 and W1 to W4): the tip on a row of its own, and at the
   right end the ring or "See plans", its centre under the Ask button's
   (the box's border and padding and half the button: 1 + 12 + 22 px from the
   box's right edge) and level with the line's first row. The end is out of
   the flow, so the line keeps its height; the line keeps room for it. */
.aw-scope { position: relative; }
.aw-scope[data-end] { padding-right: 62px; }
.aw-scope[data-end="plans"] { padding-right: 96px; }
.aw-scope-tip { flex-basis: 100%; }
.aw-scope-tip-text[data-tone="amber"] { color: var(--amber-text); font-weight: 500; }
.aw-scope-tip-text[data-tone="blue"] { color: var(--blue); font-weight: 500; }
.aw-scope-end { position: absolute; top: -3px; right: 13px; display: flex; align-items: center; justify-content: flex-end; height: 44px; }
.aw-scope-end[hidden] { display: none; }
.aw-scope:has(.aw-scope-chip) .aw-scope-end { top: 3px; }
.aw-scope-ring {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; margin: 0; padding: 0; border: 0; border-radius: 50%;
  background: transparent; cursor: pointer; -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.aw-scope-plans {
  display: inline-flex; align-items: center; min-height: 44px; margin: 0; padding: 0; border: 0;
  background: transparent; color: var(--amber-text); font-family: var(--sans); font-size: 14px; line-height: 20px;
  font-weight: 600; white-space: nowrap; cursor: pointer; -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
@media (hover: hover) { .aw-scope-plans:hover, .aw-used-plans:hover { text-decoration: underline; } }
/* plan allowances part 3 (C17, D29): "Change" / "Choose one" beside what the
   library rule lets a question search; a 44 px target, underlined (not a
   colour alone) */
.aw-scope:has(.aw-scope-lib) { padding-top: 3px; }
.aw-scope:has(.aw-scope-lib) .aw-scope-end { top: 3px; }
.aw-scope-lib {
  display: inline-flex; align-items: center; min-height: 44px; margin: 0; padding: 0 4px; border: 0;
  border-radius: var(--r-chip); background: transparent; color: var(--amber-text);
  font-family: var(--sans); font-size: 14px; line-height: 20px; font-weight: 600; white-space: nowrap;
  text-decoration: underline; text-underline-offset: 3px; cursor: pointer;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.aw-scope-lib:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
/* a ring (the line's, and the usage block's large ones): the track, the arc,
   the centre dot of Standard, the bar of a used week. Express takes the
   indexing dot's amber (3:1 on the light background, where the brand amber
   is not); the dot, the bar and the words beside a ring carry the state, the
   colour only repeats it. */
.aw-ring { display: block; flex: none; }
.aw-ring-track { stroke: var(--border-hi); }
.aw-ring-arc { stroke: var(--dot); }
.aw-ring-standard .aw-ring-arc { stroke: var(--blue); }
.aw-ring-dot { fill: var(--blue); }
.aw-ring-used .aw-ring-track, .aw-ring-bar { stroke: var(--muted); }
.aw-ring-text { fill: var(--text-hi); font-family: var(--sans); font-size: 20px; font-weight: 600; }
/* the block of a week or a day that is used (frame W4), at home and for a
   refused question */
.aw-used {
  display: flex; flex-direction: column; gap: 6px; padding: 16px;
  border: 1px solid var(--border); border-radius: var(--r-block); background: var(--surface);
  font-family: var(--sans);
}
.aw-used-title { font-size: 17px; line-height: 24px; font-weight: 600; color: var(--text-hi); }
.aw-used-text { font-size: 15px; line-height: 22px; color: var(--text-dim); }
.aw-used-plans {
  display: inline; margin: 0; padding: 0; border: 0; background: transparent; color: var(--amber-text);
  font: inherit; font-weight: 600; cursor: pointer; -webkit-tap-highlight-color: transparent;
}

/* ---------- home (A5, design C8; the prototype's query.css 84-94 and
   base.css 301-306): the allowance block, the no-documents prompt, the
   recent questions. #aw-home is shown only at home (static/ui/ask.js). No
   element here takes the class answer-card (print takes the first one). ---------- */

.aw-home { display: flex; flex-direction: column; gap: 22px; padding-top: 22px; }
.aw-home-empty { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding: 18px 6px 0; }
.aw-home-empty-title { margin: 0; font-size: 20px; line-height: 26px; font-weight: 600; color: var(--text-hi); }
/* no width limit, and balanced lines where it must wrap: one word never sits alone on the second line (his look, 2026-11-17) */
.aw-home-empty-text { margin: 0; text-wrap: balance; font-size: 15px; line-height: 22px; color: var(--text-dim); }
.aw-home-empty .aw-qtool-first { margin-top: 8px; }
/* "Upload your first PDF" at home and on the Documents page: the question
   box's Upload tool again, in amber with its emphasis ring and its label at
   every width, so the user knows the button next time (his request,
   2026-11-17) */
.aw-qtool-first { padding: 0 12px 0 8px; color: var(--amber-text); box-shadow: inset 0 0 0 2px var(--amber-text); }
.aw-qtool-first .aw-qtool-label { display: inline; }
.aw-recent { display: flex; flex-direction: column; }
.aw-recent-label { padding: 0 6px 8px; }
.aw-recent-item {
  display: flex; align-items: flex-start; gap: 12px;
  width: 100%; min-height: 48px; margin: 0; padding: 13px 6px;
  border: 0; border-top: 1px solid var(--border); background: transparent; color: inherit;
  font-family: var(--sans); text-align: left; cursor: pointer;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.aw-recent-item:last-child { border-bottom: 1px solid var(--border); }
.aw-recent-q { flex: 1; min-width: 0; font-size: 15px; line-height: 21px; color: var(--text); overflow-wrap: anywhere; }
.aw-recent-when { flex: none; padding-top: 2px; font-size: 12px; line-height: 18px; color: var(--muted); white-space: nowrap; }
.aw-recent-item:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
@media (hover: hover) { .aw-recent-item:hover { background: var(--hover); } }

/* Settings → History and privacy: the line A5 adds (the page's
   renderQueryHistorySection; the prototype's settings-a.css 41-42) */
#query-history-section .aw-set-line { margin-top: 14px; font-size: 14px; line-height: 20px; color: var(--text-dim); }
#query-history-section .aw-set-line .aw-ic { color: var(--muted); }

/* ---------- the stage chip (A2 item 11): while an answer is produced or opened ---------- */

.aw-stage {
  display: none; align-items: center; gap: 10px; min-height: 44px; padding: 0 6px;
  font-family: var(--sans); font-size: 14px; line-height: 20px; color: var(--text-dim);
}
.aw-stage.show { display: flex; }

/* ---------- the custom-instructions pop-up (A2 item 6; the prototype's query.css 233-237) ---------- */

.aw-ci { display: flex; flex-direction: column; margin-top: 14px; }
.aw-ci-text { height: 168px; }
/* the device sitting (2026-11-15): the empty box's grey examples (ask.js
   CI_EXAMPLES) take six lines on a phone and seven at 320 px; a placeholder
   that does not fit is cut, not scrolled, so the phone's sheet gives the box
   room for seven (from 700 px they take five lines of the 168 px) */
@media (max-width: 699px) {
  .aw-ci-text { height: 192px; }
}
.aw-ci-note, .aw-ci-error { margin-top: 10px; }

/* ---------- focus and hover ---------- */

:where(.aw-qtool, .aw-qmode, .aw-qask, .aw-scope-chip):focus-visible {
  outline: 2px solid var(--focus); outline-offset: 2px;
}
@media (hover: hover) {
  .aw-qtool:hover:not([aria-pressed="true"]) { background: var(--hover); color: var(--text-hi); }
  .aw-qmode:hover { background: var(--selected); }
  .aw-qask:hover:not(:disabled) { filter: brightness(1.06); }
  .aw-scope-chip:hover .aw-chip { border-color: var(--amber-text); }
}

/* ======================================================================
   The answer card (A3, design C2; the prototype's query.css 96-193 for the
   card, the check, General knowledge, the sources and the disclaimer; the
   rarer states from the same block patterns, design §4.19 item 11). The
   rules are written onto the class names the page's renderers emit
   (renderAnswer, the streamed card and the pinned helpers), new chrome on
   aw- names. Nothing here gives the card's column a transform, filter,
   contain or overflow: the reading-position code measures the document's
   scroll, and the print block (static/index.html) lays out the card's chain
   as plain blocks on paper.
   ====================================================================== */

.answer-area { display: flex; flex-direction: column; gap: 1rem; }

.answer-card { display: flex; flex-direction: column; padding: 0 4px; color: var(--text); animation: aw-ans-in 0.3s ease; }
@keyframes aw-ans-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
/* A card replacing a streamed preview must not fade in: that is the blank flash and a 6 px drift at the final swap. */
.answer-card.no-enter { animation: none; }
.answer-print-logo { display: none; }

/* the icons of the glyphs (static/ui/answer.js): the glyph stays in the
   text, hidden; the icon follows the size of its text */
.aw-gl { display: none; }
.answer-card .aw-ans-ic { display: inline-block; width: 1.25em; height: 1.25em; flex: none; vertical-align: -0.28em; margin-right: 0.4em; }

/* ---------- chrome: the question line, the meta row, the notes over the body ---------- */

/* the question in quotes, no label (A3 item 1) */
.answer-card .aw-ans-q {
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden;
  margin: 0; font-size: 15px; line-height: 22px; color: var(--text-dim);
}
.answer-card .aw-ans-q .answer-question-text::before { content: "\201C"; }
.answer-card .aw-ans-q .answer-question-text::after { content: "\201D"; }
/* the streamed card has no meta row: its question line keeps a little air */
.streaming-preview .aw-ans-q { margin-bottom: 8px; }

/* date · time · mode, and the four actions */
.answer-card .answer-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 44px; margin-right: -12px; }
.answer-card .answer-meta { font-size: 13px; line-height: 18px; color: var(--muted); }
/* the mode wraps as one piece on a narrow card */
.answer-card .aw-ans-mode { white-space: nowrap; }
.answer-card .answer-actions { display: flex; flex: none; }

/* a fallback, the storage-full note, the Sources row, the weak-match cue */
.answer-card .answer-fallback-banner {
  display: flex; align-items: flex-start; gap: 2px; margin: 0 0 12px; padding: 10px 14px;
  border: 1px solid var(--gk-line); border-radius: var(--r-block); background: var(--gk-bg);
  font-size: 14px; line-height: 20px; font-weight: 500; color: var(--gk);
}
/* a Standard answer's label, above the answer (plan allowances part 2, D22):
   an icon, "Standard answer." in blue with words beside it, never colour
   alone; its paper line shows only in print (the page's print block) */
.answer-card .answer-grade {
  display: flex; align-items: flex-start; gap: 10px; margin: 4px 0 14px; padding: 10px 14px;
  border: 1px solid var(--blue-line); border-radius: var(--r-block); background: var(--blue-bg);
  font-size: 14px; line-height: 20px; color: var(--text);
}
.answer-card .answer-grade > .aw-ic { flex: none; margin-top: 1px; color: var(--blue); }
.answer-card .answer-grade-main { min-width: 0; }
.answer-card .answer-grade-name { font-weight: 600; color: var(--blue); }
.answer-card .answer-grade-print { display: none; }
.answer-card .answer-grade-link {
  display: inline; margin: 0; padding: 0; border: 0; background: transparent; color: var(--amber-text);
  font: inherit; font-weight: 500; text-decoration: underline; white-space: nowrap; cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.answer-card .answer-grade-link:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: var(--r-chip); }
.answer-card .answer-history-full {
  margin: 4px 0 8px; padding: 10px 14px;
  border: 1px solid var(--warn-line); border-radius: var(--r-block); background: var(--warn-bg);
  font-size: 14px; line-height: 20px; color: var(--text);
}
.answer-card .aw-ans-scope { display: flex; flex-wrap: wrap; gap: 2px 8px; margin: 0 0 8px; font-size: 13px; line-height: 18px; color: var(--muted); }
.answer-card .aw-ans-scope .answer-question-label { font-weight: 600; color: var(--text-dim); }
.answer-card .aw-ans-scope .answer-question-text { color: var(--text-dim); }
.answer-card .weak-match {
  display: flex; align-items: flex-start; margin: 0 0 10px; padding: 10px 14px;
  border: 1px solid var(--weak-border); border-radius: var(--r-block); background: var(--weak-bg);
  font-size: 14px; line-height: 20px; color: var(--weak);
}

/* ---------- the body (the model's markdown, sanitised) ---------- */

.answer-body { padding-top: 4px; border-top: 1px solid var(--border); font-size: 16px; line-height: 25px; color: var(--text); overflow-wrap: break-word; }
.answer-body > :first-child { margin-top: 12px; }
.answer-body p { margin: 8px 0 0; }
.answer-body h1, .answer-body h2, .answer-body h3, .answer-body h4 { margin: 22px 0 0; font-weight: 600; color: var(--text-hi); }
.answer-body h1 { font-size: 18px; line-height: 25px; }
.answer-body h2 { font-size: 15px; line-height: 22px; color: var(--amber-text); }
.answer-body h3 { margin-top: 16px; font-size: 16px; line-height: 25px; }
.answer-body h4 { margin-top: 14px; font-size: 15px; line-height: 22px; }
.answer-body h3 + p { margin-top: 6px; }
.answer-body ul, .answer-body ol { margin: 6px 0 0; padding-left: 22px; }
.answer-body li { margin-top: 6px; }
.answer-body li > ul, .answer-body li > ol { margin-top: 4px; }
.answer-body strong { font-weight: 600; color: var(--text-hi); }
.answer-body em { font-style: italic; }
.answer-body blockquote { margin: 10px 0 0; padding: 2px 0 2px 14px; border-left: 3px solid var(--border-hi); color: var(--text-dim); }
.answer-body hr { margin: 18px 0 4px; border: 0; border-top: 1px solid var(--border); }
/* a link of the model's; one to the app itself lost its address when it was
   sanitised (security review R3-1) and reads as the text around it */
.answer-body a[href]:not(.answer-cite) { color: var(--text-hi); text-decoration: underline; text-underline-offset: 3px; }
.answer-body code { font-family: var(--mono); font-size: 0.85em; padding: 1px 5px; border: 1px solid var(--border); border-radius: 4px; background: var(--code-bg); }
.answer-body pre { margin: 10px 0 0; padding: 12px 14px; overflow-x: auto; border: 1px solid var(--border); border-radius: var(--r-ctl); background: var(--pre-bg); }
.answer-body pre code { padding: 0; border: 0; background: none; font-size: 13px; }
.answer-body .table-wrap { margin: 10px 0 0; overflow-x: auto; border: 1px solid var(--border-hi); border-radius: var(--r-ctl); }
.answer-body table { width: 100%; border-collapse: collapse; font-size: 14px; line-height: 20px; }
.answer-body thead { background: var(--amber-wash); }
.answer-body th {
  padding: 9px 12px; text-align: left; white-space: nowrap;
  font-size: 13px; line-height: 18px; font-weight: 600; color: var(--amber-text);
  border-bottom: 1px solid var(--amber-line); border-right: 1px solid var(--border);
}
.answer-body td { padding: 9px 12px; vertical-align: top; color: var(--text); border-bottom: 1px solid var(--border); border-right: 1px solid var(--border); }
.answer-body th:last-child, .answer-body td:last-child { border-right: 0; }
.answer-body tbody tr:last-child td { border-bottom: 0; }
.answer-body tbody tr:nth-child(even) { background: var(--stripe); }

/* a citation chip (built by the pinned _linkifyCitations): at least 24 px
   high with a taller hit area (design §6, V6); it declares its own size,
   weight and case so it stays a chip inside an amber heading, bold text or a
   table header (3-ii §4.1); aria-current marks the page open beside it (A4) */
.answer-body a.answer-cite {
  position: relative; display: inline-block; padding: 0 6px;
  border: 1px solid var(--cite-border); border-radius: var(--r-chip); background: var(--cite-bg); color: var(--cite);
  font-family: var(--mono); font-size: 12.5px; font-style: normal; font-weight: 400; line-height: 22px;
  letter-spacing: 0; text-transform: none; text-decoration: none; white-space: nowrap; vertical-align: 1px;
}
.answer-body a.answer-cite::after { content: ""; position: absolute; inset: -9px -5px; }
.answer-body a.answer-cite[aria-current="true"] { border-color: var(--amber-edge); background: var(--amber); color: var(--on-amber); font-weight: 500; }
.answer-body a.answer-cite:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* the WARNING / CAUTION / NOTE marks (answer.js, on the text nodes) */
.answer-body .aw-dec { font-weight: 600; }
.answer-body .aw-dec-warning { color: var(--red); }
.answer-body .aw-dec-caution { color: var(--amber-text); }
.answer-body .aw-dec-note { color: var(--blue); font-weight: inherit; }
/* the line above the part of a Best judgment answer that is general knowledge */
.answer-body .gk-marker {
  display: block; margin: 1.4em 0 0.4em; padding-top: 0.8em; border-top: 2px solid var(--border-hi);
  color: var(--gk); font-size: 14px; line-height: 20px; font-weight: 600;
}
/* the blocks a correction changed, marked in place (A1 decision 15) */
.answer-body .fix-changed { box-shadow: inset 3px 0 0 var(--fix); background: var(--fix-bg); padding-left: 8px; border-radius: 2px; }
.answer-body tr.fix-changed td { background: var(--fix-bg); }
/* a screen reader hears "Changed" before a corrected block; nothing is drawn
   and the copied text is unchanged (founder 2026-11-19, D14) */
.answer-body .fix-changed:not(tr)::before { content: "" / "Changed"; }
.answer-body .fix-landing { animation: fixland 1.4s ease-out; }
@keyframes fixland { from { background-color: var(--fix-glow); } }

/* the streamed card's parts */
/* the typing caret: drawn here, the page writes no glyph for it (R3 E1) */
.stream-caret { display: inline-block; width: 0.55em; color: var(--text-dim); animation: streamblink 1s steps(2, start) infinite; }
.stream-caret::before { content: ''; display: inline-block; width: 0.375em; height: 1em; vertical-align: -0.19em; background: currentColor; }
@keyframes streamblink { 0% { opacity: 1; } 50% { opacity: 0; } }
.stream-retry-note { margin: 12px 0 10px; font-size: 14px; line-height: 20px; color: var(--text-dim); }
.verify-pending { display: flex; align-items: center; gap: 10px; min-height: 44px; margin-top: 12px; font-size: 14px; line-height: 20px; color: var(--text-dim); }
.verify-secs { margin-left: auto; font-family: var(--mono); font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.pace-hidden { visibility: hidden; }

/* ---------- the notes under the body, the checks, the jump chips ---------- */

/* cut short or declined (amber: a half procedure is a safety matter) */
.answer-card .answer-note {
  display: flex; align-items: flex-start; margin-top: 16px; padding: 12px 14px;
  border: 1px solid var(--warn-line); border-radius: var(--r-block); background: var(--warn-bg);
  font-size: 14px; line-height: 20px; color: var(--text);
}
.answer-card .answer-note .aw-ans-ic { color: var(--amber-text); }

/* the automatic check: the typed block, the untyped one, the quiet one */
.answer-card .verification-warning, .answer-card .verify-quiet, .answer-card .answer-corrected, .answer-card .answer-checked {
  margin-top: 16px; padding: 14px 16px; border: 1px solid var(--warn-line); border-radius: var(--r-block); background: var(--warn-bg);
  font-size: 15px; line-height: 23px; color: var(--text);
}
.answer-card .verification-warning:not(.typed) { display: flex; align-items: flex-start; }
.answer-card .verification-warning .aw-ans-ic, .answer-card .verify-title .aw-ans-ic { color: var(--amber-text); }
.answer-card .verify-title { font-weight: 600; color: var(--text-hi); }
.answer-card .verify-lead { margin-top: 8px; }
.answer-card .verification-warning ul, .answer-card .verify-quiet ul, .answer-card .answer-corrected ul { margin: 8px 0 0; padding: 0; list-style: none; }
.answer-card .verification-warning li, .answer-card .verify-quiet li, .answer-card .answer-corrected li { margin-top: 8px; }
.answer-card .verify-type {
  display: inline-block; margin-right: 8px; padding: 0 8px;
  border: 1px solid var(--warn-line); border-radius: var(--r-chip); background: var(--warn-chip);
  font-size: 12.5px; line-height: 20px; font-weight: 600; color: var(--amber-text);
}
.answer-card .verify-minor-item { color: var(--text-dim); }
.answer-card .verify-minor-tag {
  display: inline-block; margin-right: 8px; padding: 0 6px; border: 1px solid var(--border-hi); border-radius: var(--r-chip);
  font-size: 11.5px; line-height: 18px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted);
}
.answer-card .verify-pointer { display: block; margin-top: 2px; font-size: 13px; line-height: 19px; color: var(--text-dim); }
/* minor or unverified points only: neutral, not a warning (A10) */
.answer-card .verify-quiet { border-color: var(--weak-border); background: var(--weak-bg); color: var(--weak); }
.answer-card .verify-quiet .verify-title, .answer-card .verify-quiet .verify-title .aw-ans-ic { color: var(--weak); }
/* the fold of the quiet points (corrections decision 14): a button whose
   chevron turns when it opens */
.answer-card .verify-fold-toggle {
  display: flex; align-items: center; gap: 4px; width: 100%; min-height: 44px; margin: -10px 0; padding: 0;
  border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer;
}
.answer-card .verify-fold-toggle .verify-title { flex: 1; min-width: 0; }
.answer-card .verification-warning .verify-fold, .answer-card .verify-quiet.verify-fold { margin-top: 10px; }
.answer-card .verify-fold.collapsed > ul { display: none; }
.verify-fold-caret .aw-ans-ic, .sources-tri .aw-ans-ic { margin: 0; transition: transform var(--t-fast); }
.verify-fold-toggle[aria-expanded="true"] .verify-fold-caret .aw-ans-ic,
.sources-toggle[aria-expanded="true"] .sources-tri .aw-ans-ic { transform: rotate(90deg); }
/* corrected after the check, or checked and kept as written (green) */
.answer-card .answer-corrected, .answer-card .answer-checked { border-color: var(--fix-border); background: var(--fix-bg); }
.answer-card .answer-checked { display: flex; align-items: flex-start; color: var(--text); }
.answer-card .answer-corrected .verify-title .aw-ans-ic, .answer-card .answer-checked .aw-ans-ic { color: var(--fix); }
.answer-card .answer-corrected .verify-type { border-color: var(--fix-border); color: var(--fix); background: none; }
/* "Jump to first change": a button inside the title's line, 44 px high
   without growing the line */
.answer-card .fix-jump {
  display: inline-flex; align-items: center; gap: 2px; min-height: 44px; margin: -11px 0; padding: 0 2px;
  border: 0; background: none; color: var(--fix); font: inherit; font-weight: 500;
  text-decoration: underline; text-underline-offset: 3px; vertical-align: middle; cursor: pointer;
}
.answer-card .fix-jump .aw-ic { width: 16px; height: 16px; }
.answer-card .answer-corrected.pulse { animation: fixpulse 0.9s ease-in-out 2; }
@keyframes fixpulse { 0%, 100% { box-shadow: none; } 50% { box-shadow: 0 0 0 3px var(--fix-glow); } }
.answer-card .verification-warning.pulse { animation: verifypulse 0.9s ease-in-out 2; }
@keyframes verifypulse { 0%, 100% { box-shadow: none; } 50% { box-shadow: 0 0 0 3px var(--warn-glow); } }
/* the chip at the top of a card whose warning (or correction) arrived after
   the text was read (D2): a button to it */
.answer-card .verify-jump {
  display: inline-flex; align-items: center; gap: 8px; align-self: flex-start; min-height: 44px; margin: 0 0 12px; padding: 0 14px;
  border: 1px solid var(--warn-line); border-radius: var(--r-ctl); background: var(--warn-bg-lo); color: var(--amber-text);
  font-family: var(--sans); font-size: 14px; line-height: 20px; font-weight: 500; cursor: pointer;
}
.answer-card .verify-jump.fix { border-color: var(--fix-border); background: var(--fix-bg); color: var(--fix); }

/* ---------- General knowledge and the Interpretation (not from the documents: purple) ---------- */

.answer-card .gk-section, .answer-card .interp-section {
  display: flex; flex-direction: column; gap: 10px; margin-top: 16px; padding: 14px 16px;
  border: 1px solid var(--gk-line); border-radius: var(--r-block); background: var(--gk-bg);
}
.answer-card .gk-section-title { font-size: 15px; line-height: 22px; font-weight: 600; color: var(--gk); }
.answer-card .gk-section-title .aw-ans-ic { color: var(--gk); }
.answer-card .gk-section-body { font-size: 16px; line-height: 25px; color: var(--text); }
.answer-card .gk-section-body > :first-child { margin-top: 0; }
.answer-card .gk-section-body p { margin: 8px 0 0; }
.answer-card .gk-section-body ul, .answer-card .gk-section-body ol { margin: 6px 0 0; padding-left: 22px; }
.answer-card .gk-conflict { font-size: 14px; line-height: 20px; font-weight: 500; color: var(--amber-text); }
.answer-card .gk-warning { display: flex; align-items: flex-start; font-size: 13px; line-height: 19px; color: var(--text-dim); }
.answer-card .gk-warning .aw-ans-ic { color: var(--gk); }
.answer-card .interp-checking { font-size: 13px; line-height: 19px; color: var(--text-dim); }
/* the offer of an Interpretation under a Best judgment answer */
.answer-card .interp-ask { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; margin-top: 16px; }
.answer-card .interp-ask .aw-btn { white-space: normal; text-align: left; }
.answer-card .interp-ask-note { font-size: 13px; line-height: 19px; color: var(--text-dim); }
.answer-card .interp-ask-status { font-size: 14px; line-height: 20px; color: var(--amber-text); }

/* ---------- the sources (the pinned _sourcesPanelHtml's markup) ---------- */

.answer-card .sources { margin-top: 20px; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.answer-card .sources-toggle {
  display: flex; align-items: center; justify-content: space-between; width: 100%; min-height: 52px; margin: 0; padding: 0 2px;
  border: 0; background: transparent; color: var(--text); font-family: var(--sans); font-size: 15px; line-height: 20px; font-weight: 500;
  text-align: left; cursor: pointer;
}
.answer-card .sources-tri { display: inline-flex; color: var(--muted); }
.answer-card .sources-list { display: flex; flex-direction: column; padding-bottom: 6px; }
.answer-card .sources.collapsed .source-item { display: none; }
.answer-card .source-item { display: flex; align-items: flex-start; gap: 12px; min-height: 52px; padding: 8px 2px; border-top: 1px solid var(--border); }
.answer-card .source-num { flex: none; width: 20px; padding-top: 2px; font-family: var(--mono); font-size: 12.5px; line-height: 20px; color: var(--muted); }
.answer-card .source-link { display: flex; flex-direction: column; flex: 1; min-width: 0; color: inherit; text-decoration: none; }
.answer-card .source-section { font-size: 15px; line-height: 21px; color: var(--text); }
.answer-card .source-meta { display: flex; flex-wrap: wrap; gap: 0 8px; font-size: 13px; line-height: 18px; color: var(--muted); }
.answer-card .source-file { min-width: 0; overflow-wrap: anywhere; }
.answer-card .source-page { color: var(--amber-text); }
/* the file name under the shown name when the two differ (A4 item 7,
   answer.js), as the Documents page writes it */
.answer-card .aw-src-file { display: block; font-family: var(--mono); font-size: 12.5px; line-height: 18px; color: var(--muted); overflow-wrap: anywhere; }
/* the row of the page open beside the answer (A4 item 3, founder decision 9) */
.answer-card .source-item[aria-current="true"] .source-section { color: var(--amber-text); font-weight: 500; }

/* the disclaimer: on every answer, never dismissable */
.answer-card .answer-disclaimer { display: flex; align-items: flex-start; padding: 16px 0 8px; font-size: 13px; line-height: 19px; color: var(--text-dim); }
.answer-card .answer-disclaimer .aw-ans-ic { color: var(--muted); }

/* ---------- the error and limit blocks of the answer area (A3 item 6): R2's note ---------- */

.aw-block .aw-note-main .aw-btn { margin-top: 8px; }

/* ---------- focus, hover, motion ---------- */

:where(.answer-card .verify-jump, .answer-card .fix-jump, .answer-card .sources-toggle, .answer-card .verify-fold-toggle,
  .answer-card .source-link):focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
@media (hover: hover) {
  .answer-body a.answer-cite:hover { border-color: var(--amber-text); }
  .answer-card .sources-toggle:hover, .answer-card .source-item:hover { background: var(--hover); }
  .answer-card .source-link:hover .source-section { text-decoration: underline; text-underline-offset: 3px; }
  .answer-card .verify-jump:hover { filter: brightness(1.06); }
}
@media (prefers-reduced-motion: reduce) {
  .answer-card, .stream-caret, .answer-card .verification-warning.pulse, .answer-card .answer-corrected.pulse,
  .answer-body .fix-landing { animation: none; }
}
.aw-scope-ring:focus-visible { outline: 2px solid var(--focus); outline-offset: -4px; }
.aw-scope-plans:focus-visible, .aw-used-plans:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: var(--r-chip); }
