/* Shared visual system for regular, Pro, and responsive web layouts.
   Loaded after the functional component styles; keep behavior in app.js. */
:root {
  --accent: var(--state);
  --bg: #f5e8d1;
  --sidebar-bg: #fdf1dd;
  /* One warm paper surface across the light UI: composer, sheets, history,
     reply cards, and the Pro rail all come from the same source of truth. */
  --surface: var(--sidebar-bg);
  --composer-bg: #fcf2e5;
  --input: #e9e5dc;
  --overlay: rgba(35, 33, 28, .30);
  --border: #dcd7cc;
  --border-strong: #bcb4a5;
  --text: #292a26;
  --text-2: #5b5b54;
  --text-3: #65645c;
  --invert-bg: #2e2f2a;
  --invert-text: #faf8f2;
  --bubble-ai: var(--sidebar-bg);
  --bubble-ai-text: #292a26;
  --shadow: 0 12px 36px rgba(45, 41, 31, .07);
  --r-major: 18px;
  --r-ctl: 10px;
  --sans: "Geist", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --col: 760px;
}
:root[data-theme="dark"] {
  --bg: #0c0d0f;
  --surface: #1e201e;
  --composer-bg: var(--surface);
  --sidebar-bg: #1e201e;
  --input: #262826;
  --overlay: rgba(0, 0, 0, .55);
  --border: #343733;
  --border-strong: #4a4e47;
  --text: #f0f1ec;
  --text-2: #b3b7ad;
  --text-3: #969c91;
  --invert-bg: #e9ece2;
  --invert-text: #20231c;
  --bubble-ai: #1e201e;
  --bubble-ai-text: #f0f1ec;
  --shadow: 0 12px 36px rgba(0, 0, 0, .18);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0c0d0f; --surface: #1e201e; --sidebar-bg: #1e201e; --input: #262826;
    --composer-bg: var(--surface);
    --overlay: rgba(0, 0, 0, .55);
    --border: #343733; --border-strong: #4a4e47;
    --text: #f0f1ec; --text-2: #b3b7ad; --text-3: #969c91;
    --invert-bg: #e9ece2; --invert-text: #20231c;
    --bubble-ai: #1e201e; --bubble-ai-text: #f0f1ec;
    --shadow: 0 12px 36px rgba(0, 0, 0, .18);
  }
}
/* Semantic text stays readable on the warm input and warning surfaces. */
:root[data-theme="light"] { --warn: #82591f; --danger: #a33228; }
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) { --warn: #82591f; --danger: #a33228; }
}
/* Conversation navigation needs stronger ink against the warmer light rail. */
:root[data-theme="light"] :is(body.pro #sidebar, .drawer) {
  --text: #1f1b16; --text-2: #40382f; --text-3: #51473c;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) :is(body.pro #sidebar, .drawer) {
    --text: #1f1b16; --text-2: #40382f; --text-3: #51473c;
  }
}
/* Flat charcoal keeps light primary actions readable through hover. */
:root[data-theme="light"] button.primary:not(.danger) { background: var(--invert-bg); }
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) button.primary:not(.danger) { background: var(--invert-bg); }
}
/* Light Pro answers share the warm page palette; the existing dark Pro
   reading surface is deliberately left to its own theme rules. */
:root[data-theme="light"] body.pro {
  --bubble-ai: var(--surface); --bubble-ai-text: var(--text);
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) body.pro {
    --bubble-ai: var(--surface); --bubble-ai-text: var(--text);
  }
}
body, body.pro {
  --sans: "Geist", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --pro-canvas: var(--bg); --pro-rail: var(--sidebar-bg); --pro-raise: var(--surface);
  --pro-edge: var(--border); --pro-edge-hi: var(--border-strong);
  font-family: var(--sans); background: var(--bg); color: var(--text);
}
/* Explicit-theme legacy selectors define Pro tokens on body. */
:root body.pro {
  --pro-canvas: var(--bg); --pro-rail: var(--sidebar-bg); --pro-raise: var(--surface);
  --pro-edge: var(--border); --pro-edge-hi: var(--border-strong);
}
body::after, body.centered-idle .brand-moment, body.centered-idle .hero-cta { display: none; }
button, select, textarea, input { font-family: var(--sans); }
button, a, select { -webkit-tap-highlight-color: transparent; }
:where(button, a, select, input, textarea, [tabindex]):focus-visible {
  outline: 2px solid var(--text-2); outline-offset: 4px;
}
header { min-height: 80px; padding: 18px 0; background: var(--bg); }
.header-right { gap: 10px; }
/* The service badge duplicates the regular product's privacy messaging. */
body:not(.pro) #mode-badge { display: none; }
body.pro #mode-badge, body.pro #status-strip .ss-on { display: none; }
.wordmark { letter-spacing: -.04em; }
.pill-btn, .icon-btn { min-height: 38px; color: var(--text-2); border-radius: 10px; }
.icon-btn { width: 38px; }
.pill-btn:hover, .icon-btn:hover { background: var(--input); color: var(--text); }
.badge { font: 11px var(--sans); letter-spacing: .01em; text-transform: none; padding: 7px 10px; border-color: var(--border); }
.badge::before, .scrub-status::before { animation: none; }
.pro-tag { border: 1px solid var(--border-strong); padding: 3px 5px; border-radius: 5px; font-size: 9px; letter-spacing: .08em; }
body:not(.pro).centered-idle .hero {
  margin: clamp(60px, 13vh, 120px) auto 30px; text-align: center;
}
.hero .eyebrow { font: 500 11px var(--sans); letter-spacing: .16em; color: var(--text-3); margin-bottom: 18px; }
.hero h1 { font-size: clamp(36px, 4.2vw, 48px); line-height: 1.15; font-weight: 600; letter-spacing: -.045em; margin-bottom: 20px; }
.hero h1 #cipher-prompt, .hero h1 .quiet {
  color: var(--text); background: none; -webkit-text-fill-color: currentColor; animation: none;
}
.hero h1 .quiet { color: var(--text-2); }
:root .hero p { color: var(--text-2); font-size: 16px; line-height: 1.7; max-width: 510px; margin: 0 auto; }
body:not(.pro).centered-idle #card-1 { max-width: var(--col); margin: 0 auto; width: 100%; }
body:not(.pro).centered-idle .hero-learn {
  width: auto; align-self: center; margin: 20px 0 40px; padding: 8px; font-size: 13px;
}
body #card-1, body.pro.chat-mode #card-1, body.pro.centered-idle #card-1 {
  background: var(--composer-bg); border: 1px solid var(--border); border-radius: 18px;
  box-shadow: 0 3px 6px rgba(0, 0, 0, .02), var(--shadow);
  backdrop-filter: none; -webkit-backdrop-filter: none;
}
body #card-1:focus-within { border-color: var(--border-strong); }
body #card-1 textarea, body.pro.centered-idle #card-1 textarea, body:not(.pro).centered-idle textarea {
  font-size: 16px; line-height: 1.6; min-height: 108px; padding: 20px 22px 12px;
}
#prompt-input::placeholder { color: var(--text-3); opacity: 1; }
body #card-1 .row, body.pro.centered-idle #card-1 .row {
  min-height: 64px; padding: 10px 12px; gap: 8px; border-top: 1px solid var(--border);
}
#attach-btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 40px; padding: 8px 10px; font-size: 13px; flex: none; }
#attach-btn svg { flex: none; }
@media (min-width: 641px) {
  body #card-1 #attach-btn { border-radius: 9px; }
  body #card-1 #attach-btn:focus-visible {
    color: var(--text);
    background: color-mix(in srgb, var(--text) 12%, var(--composer-bg));
    box-shadow: inset 0 0 0 1px var(--border-strong);
  }
}
@media (min-width: 641px) and (hover: hover) and (pointer: fine) {
  body #card-1 #attach-btn:hover:not(:disabled) {
    color: var(--text);
    background: color-mix(in srgb, var(--text) 12%, var(--composer-bg));
    box-shadow: inset 0 0 0 1px var(--border-strong);
  }
}
@media (min-width: 641px) and (prefers-reduced-motion: no-preference) {
  body #card-1 #attach-btn { transition: background-color 140ms ease, color 140ms ease, box-shadow 140ms ease; }
}
body #card-1 .row #model-select {
  font: 500 13px var(--sans); min-width: 0; max-width: 230px; min-height: 40px;
  padding-left: 10px; color: var(--text); border-radius: 9px; background-color: var(--input);
}
body #strict-inline, body.pro.centered-idle #strict-inline {
  display: inline-flex; align-items: center;
  font: 500 12px var(--sans); min-height: 36px; padding: 7px 10px; border-radius: 9px; border-color: var(--border);
}
.scrub-status { font: 12px var(--sans); letter-spacing: 0; color: var(--text-2); white-space: nowrap; }
body #scrub-btn, body.pro.centered-idle #scrub-btn {
  width: 42px; height: 42px; min-width: 42px; border-radius: 12px; font-size: 20px;
  background: var(--invert-bg); color: var(--invert-text); box-shadow: none; flex: none;
}
body #scrub-btn:hover { opacity: .86; transform: none; }
#amounts-mode { margin: 0 20px 12px; padding: 6px 10px; width: fit-content; font: 12px var(--sans); border-radius: 7px; background: var(--input); color: var(--text-2); }
#chips { padding-left: 16px; padding-right: 16px; gap: 8px; }
.chip { min-width: 0; max-width: 100%; border-radius: 9px; font-size: 12px; }
.chip button { min-width: 30px; min-height: 30px; }
#chat-log { padding-top: 32px; }
body:not(.pro) #chat-log, body:not(.pro).chat-active #card-1 { margin-left: auto; margin-right: auto; width: 100%; max-width: var(--col); }
.msg { margin-bottom: 28px; }
.msg.assistant .bubble { border: 1px solid var(--border); border-radius: 16px; padding: 22px 24px; font-size: 15px; line-height: 1.75; box-shadow: none; }
.msg.user .bubble { background: var(--input); color: var(--text); border-radius: 16px; padding: 14px 18px; font-size: 15px; line-height: 1.65; }
.msg .msg-inner { min-width: 0; }
.msg-meta, .msg-actions button { font-family: var(--sans); font-size: 12px; color: var(--text-2); }
.settings-panel { right: 12px; width: 290px; max-width: calc(100vw - 32px); padding: 8px; border-radius: 15px; box-shadow: var(--shadow); background: var(--surface); }
.setting-row { padding: 12px; gap: 16px; min-height: 52px; font-size: 13px; }
.setting-row small { font-family: var(--sans); font-size: 12px; line-height: 1.5; color: var(--text-3); margin-top: 3px; }
.setting-link:hover { background: var(--input); border-radius: 9px; }
.switch { flex: none; width: 38px; }
.drawer { background: var(--surface); }
.drawer-head { padding: 20px; }
.drawer-section { font-family: var(--sans); font-size: 11px; letter-spacing: .08em; }
.conv-row { border-radius: 10px; }
.conv-title { font-size: 14px; }
.conv-meta, .drawer-empty { font-family: var(--sans); font-size: 12px; line-height: 1.6; }
.review-tool-dialog { background: var(--surface); border-color: var(--border); border-radius: 18px; box-shadow: var(--shadow); max-height: 90dvh; overflow-y: auto; }
.review-text-panes > * { min-width: 0; }
.review-text-panes pre { background: var(--input); color: var(--text); border: 1px solid var(--border); border-radius: 10px; font: 13px/1.65 var(--mono); }
.review-tool-dialog textarea, .review-tool-dialog input, .dlg-input { background: var(--input); color: var(--text); border: 1px solid var(--border); border-radius: 9px; font-size: 16px; padding: 12px; }
.strict-pair { gap: 8px; }
.strict-pair input { font-size: 14px; padding: 9px; }
body.pro .hero { display: none; }
body.pro.centered-idle #pro-empty { display: flex; flex-direction: column; align-items: center; text-align: center; }
body.pro.centered-idle #pro-empty h2 { font-size: 30px; line-height: 1.25; letter-spacing: -.035em; font-weight: 600; margin: 18px 0 10px; }
body.pro #pro-empty .pe-intro { display: block; max-width: none; font: 14px/1.6 var(--sans); color: var(--text-2); margin: 0 0 12px; }
body.pro.centered-idle .pe-context { display: inline-flex; gap: 8px; align-items: center; min-height: 34px; padding: 6px 11px; border: 1px solid var(--border); border-radius: 8px; color: var(--text-2); font: 12px var(--sans); letter-spacing: 0; text-transform: none; background: var(--surface); }
body.pro.centered-idle .pe-context svg { display: block; width: 14px; height: 14px; }
body.pro.centered-idle .pe-status { font: 12px var(--sans); color: var(--text-3); letter-spacing: 0; margin: 0 0 24px; }
body.pro.centered-idle #pe-flows { gap: 10px; margin-top: 22px; }
.pf-label { font: 500 11px var(--sans); letter-spacing: .09em; margin-bottom: 2px; }
.pf-group { flex: 1; min-width: 0; }
.pf-cat-btn { width: 100%; justify-content: space-between; min-height: 48px; padding: 12px 14px; font-size: 13px; border-radius: 11px; background: var(--surface); border-color: var(--border); }
.pf-cat-btn:hover, .pf-group.open .pf-cat-btn { background: var(--input); }
.pf-menu { background: var(--surface); border-color: var(--border-strong); padding: 6px; border-radius: 12px; min-width: 275px; }
.pf-group:nth-child(2) .pf-menu { left: 0; transform: none; }
.pf-group:last-child .pf-menu { left: auto; right: 0; transform: none; }
.pf-item { gap: 4px; padding: 12px; border-radius: 8px; }
.pf-item .pf-blurb { color: var(--text-2); font-size: 12px; line-height: 1.5; }
@media (min-width: 900px) {
  /* The regular reading column is deliberately narrower than the page shell.
     Keep its header controls on the page edge rather than stranded at the
     column's edge. */
  body:not(.pro) header > .header-right {
    position: absolute; top: 50%;
    right: calc(50% - 50vw + 24px);
    transform: translateY(-50%);
  }
  body.pro #sidebar { background: var(--sidebar-bg); border-color: var(--border); padding: 24px 14px 16px; }
  body.pro .sb-brand { font-size: 19px; padding: 0 10px 26px; }
  body.pro #sb-new-chat { background: var(--input); height: 44px; font-size: 13px; padding: 0 14px; margin: 0 0 20px; border-radius: 10px; }
  body.pro #sidebar .drawer-section { font: 500 11px var(--sans); color: var(--text-3); padding: 12px 10px 8px; letter-spacing: .08em; }
  body.pro .sb-client { min-height: 38px; padding: 9px 10px; border-radius: 9px; }
  body.pro .sb-client:not(.active) { color: var(--text-2); }
  body.pro .sb-manage { padding: 10px; font-size: 12px; }
  body.pro #sb-list .conv-row { padding: 10px; }
  body.pro #sb-list .conv-title { font-size: 13px; }
  body.pro #sb-list .conv-meta { font: 11px/1.5 var(--sans); margin-top: 4px; }
  body.pro .sb-note { font: 11px var(--sans); letter-spacing: 0; text-transform: none; padding: 16px 10px 0; color: var(--text-3); }
  body.pro header, body.pro.centered-idle header { min-height: 72px; background: var(--bg); padding-top: 16px; padding-bottom: 16px; }
  body.pro.centered-idle .wrap { padding-bottom: 76px; }
  body.pro.centered-idle { --idle-w: min(760px, 100%); }
  body.pro.centered-idle #pro-empty { padding-bottom: 0; }
  body.pro.chat-active #chat-log, body.pro.chat-active #card-1 { max-width: 860px; }
  body.pro.chat-active header { justify-content: center; padding-left: 40px; padding-right: 40px; }
  body.pro.chat-active #conv-bar { flex: 0 1 860px; width: 100%; max-width: 860px; padding: 0; }
  body.pro.chat-active header > .header-right { position: absolute; right: 40px; top: 50%; transform: translateY(-50%); }
  /* Active conversations use an edge-positioned control; retain the normal Pro gutter. */
  body.pro.chat-active .settings-panel { right: 20px; }
  body.pro.chat-active header #settings-btn { width: 32px; height: 32px; min-height: 32px; padding: 0; }
  body.pro.chat-active header #jobs-cue { position: absolute; right: 0; top: 100%; }
  body.pro #conv-bar #cb-receipt { margin-left: auto; }
  body.pro #conv-bar #raw-toggle { margin-left: 0; }
}
@media (max-width: 899px) {
  body.pro.centered-idle #pro-empty { margin: 48px 0 0; }
  body.pro.centered-idle #pe-flows { width: 100%; margin-bottom: 40px; }
  body.pro.centered-idle #card-1 { margin-top: 0; }
}
@media (max-width: 640px) {
  .wrap { padding: 0 16px max(16px, env(safe-area-inset-bottom)); }
  header { min-height: 76px; padding: calc(12px + env(safe-area-inset-top)) 0 12px; gap: 8px; }
  .header-right { gap: 2px; }
  .logo { font-size: 19px; gap: 5px; }
  .wordmark .glyph-o { width: .78em; height: .64em; }
  .header-right .badge { display: none; }
  .header-right .pill-btn, .header-right .icon-btn { width: 44px; height: 44px; min-height: 44px; padding: 0; justify-content: center; flex: none; }
  .header-right .pill-btn svg, #settings-btn svg { width: 18px; height: 18px; }
  .header-right .pill-btn span { display: none; }
  body:not(.pro).centered-idle .hero { margin: clamp(40px, 8vh, 72px) 0 28px; text-align: left; }
  body.centered-idle .hero .eyebrow { display: block; margin-bottom: 18px; font-size: 10px; }
  body.centered-idle .hero h1 { font-size: clamp(28px, 8vw, 34px); line-height: 1.2; margin-bottom: 18px; }
  :root body.centered-idle .hero p { margin: 0; max-width: 360px; font-size: 15px; line-height: 1.65; }
  body.centered-idle #card-1 { position: static; margin: 0; }
  body #card-1 textarea, body.pro.centered-idle #card-1 textarea, body:not(.pro).centered-idle textarea { padding: 18px 16px 10px; min-height: 114px; font-size: 16px; }
  body #card-1 .row, body.pro.centered-idle #card-1 .row { display: grid; grid-template-columns: 44px minmax(0, 1fr) 44px; padding: 8px; gap: 6px; }
  #attach-btn { grid-column: 1; grid-row: 1; width: 44px; height: 44px; padding: 0; }
  #attach-btn svg { width: 20px; height: 20px; }
  #attach-btn .attach-txt, #card-1 .row .spacer { display: none; }
  body #card-1 .row #model-select { grid-column: 2; grid-row: 1; width: 100%; max-width: none; min-height: 44px; font-size: 13px; margin: 0; }
  body #scrub-btn, body.pro.centered-idle #scrub-btn { grid-column: 3; grid-row: 1; width: 44px; height: 44px; min-width: 44px; margin: 0; }
  body #scrub-status, body.centered-idle:not(.composer-active) #scrub-status { display: flex; grid-column: 1 / -1; grid-row: 2; justify-self: end; font-size: 11px; padding: 5px 8px; gap: 7px; }
  #scrub-status::after { display: none; }
  body.pro #scrub-status { display: none; }
  body #strict-inline, body.pro.centered-idle #strict-inline { display: inline-flex; grid-column: 1 / -1; grid-row: 2; justify-self: start; min-height: 44px; }
  body:not(.pro).centered-idle .hero-learn { margin: 18px 0 32px; }
  body.pro.centered-idle #pro-empty { margin-top: 34px; }
  body.pro.centered-idle #pro-empty h2 { font-size: 27px; }
  body.pro #pro-empty .pe-intro { font-size: 14px; max-width: 300px; }
  body.pro.centered-idle #pe-flows { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 24px; }
  .pf-label { grid-column: 1 / -1; margin-bottom: 4px; }
  .pf-group { position: static; }
  .pf-cat-btn { min-height: 48px; font-size: 12px; padding: 10px 12px; }
  body.pro #pe-flows { position: relative; }
  .pf-group .pf-menu, .pf-group:nth-child(2) .pf-menu, .pf-group:last-child .pf-menu { top: calc(100% + 8px); left: 0; right: 0; width: 100%; min-width: 0; transform: none; }
  /* Space for an open quick-action menu so the page can scroll to every item. */
  body.pro.centered-idle #pe-flows:has(.pf-group.open) { margin-bottom: 290px; }
  .settings-panel { right: 12px; max-height: calc(100dvh - 96px); overflow-y: auto; }
  .setting-row { min-height: 56px; }
  .switch { min-width: 44px; min-height: 28px; }
  .switch::after { top: 5px; }
  .msg.assistant .bubble { padding: 18px; font-size: 15px; }
  .msg.user .bubble { padding: 12px 16px; font-size: 15px; }
  .msg .msg-inner { max-width: 100%; }
  .msg.user .msg-inner { max-width: 92%; }
  #chat-log { padding-top: 20px; }
  .review-tool-dialog { padding: 20px; width: calc(100vw - 24px); }
  .strict-pair input { font-size: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; }
}

/* Desktop menus open toward available space instead of below the fold. */
@media (min-width: 641px) {
  .pf-menu { top: auto; bottom: calc(100% + 8px); max-height: 50dvh; overflow-y: auto; }
}
.switch { width: 38px; height: 24px; }
.switch::after { top: 4px; left: 4px; }
.switch.on::after { transform: translateX(14px); }
@media (max-width: 640px) {
  .switch { width: 44px; height: 28px; }
  .switch::after { top: 6px; }
  .switch.on::after { transform: translateX(20px); }
  #attach-btn { margin-right: 0; }
}

.review-text-panes h3 { font: 600 12px var(--sans); color: var(--text-2); margin: 0 0 8px; }
.review-text-panes pre { margin: 0; }
#strict-body details { margin: 16px 18px; }
#strict-body summary { font-size: 13px; line-height: 1.5; cursor: pointer; padding: 10px 0; }
.strict-pair:has(input) { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.strict-pair input { width: 100%; max-width: none; }
.strict-sub, .receipt-caption { font: 11px/1.6 var(--sans); letter-spacing: 0; text-transform: none; }
.strict-sub { margin-top: 6px; }
.strict-add input { font-size: 16px; min-height: 44px; }
.strict-foot button, .review-tool-dialog button { min-height: 44px; }
.review-tool-dialog button { padding: 9px 14px; color: var(--text); background: var(--input); border: 1px solid var(--border); border-radius: 9px; cursor: pointer; font-size: 13px; }
.review-tool-dialog button:hover { border-color: var(--border-strong); }
.review-tool-dialog::backdrop { background: var(--overlay); }
@media (max-width: 640px) {
  body.pro.centered-idle:not(.composer-active) #scrub-status { display: none; }
  body.chat-active #card-1 textarea { min-height: 60px; padding-top: 14px; max-height: 26dvh; }
  .strict-add input { flex-basis: 100%; width: 100%; }
  .strict-foot .primary, .strict-foot .ghost { font-size: 14px; }
  body.pro.chat-active header { flex-wrap: wrap; }
  body.pro.chat-active .logo .pro-tag { display: none; }
  body.pro.chat-active #conv-bar { display: flex; order: 3; flex: 1 0 100%; align-items: center; gap: 8px; min-width: 0; padding: 4px 0; }
  body.pro #conv-bar #cb-title, body.pro #conv-bar #cb-sep { display: none; }
  body.pro #conv-bar #cb-context { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
  body.pro #conv-bar #raw-toggle, body.pro #conv-bar #cb-receipt { min-height: 36px; font: 12px var(--sans); padding: 7px 10px; margin: 0; border: 1px solid var(--border); border-radius: 8px; flex: none; }
  body.pro #conv-bar #raw-toggle span { display: inline; }
}
@media (max-width: 360px) {
  body.chat-active header { gap: 0; }
  body.chat-active .header-right { gap: 0; }
  body.chat-active .logo { font-size: 17px; }
}

/* The field belongs to the background, with solid surfaces for controls. */
#field, body.pro #field {
  display: block; position: fixed; inset: 0; width: 100%; height: 100dvh;
  pointer-events: none; z-index: 0;
}
/* Hide immediately in desktop Pro, including before field.js initializes. */
@media (min-width: 641px) {
  body.pro #field { display: none; }
}
body.centered-idle header, body.pro.centered-idle header { background: transparent; }

/* Equations use bundled fonts and scroll within their own surface on phones. */
.bubble .md, .pane .md { white-space: normal; min-width: 0; }
.msg.assistant .bubble { max-width: 100%; }
.md .math-block {
  max-width: 100%; overflow-x: auto; overflow-y: hidden;
  margin: 16px 0; padding: 14px 16px; border-radius: 10px;
  border: 1px solid currentColor;
  border-color: color-mix(in srgb, currentColor 12%, transparent);
  background: color-mix(in srgb, currentColor 3%, transparent);
  overscroll-behavior-x: contain; scrollbar-width: thin;
}
.md .math-inline { display: inline-block; max-width: 100%; overflow-x: auto; vertical-align: middle; padding: 2px 0; }
.md .katex { font-size: 1.08em; text-align: initial; white-space: nowrap; word-break: normal; }
.md .katex-display { margin: 0; text-align: left; }
.md .katex-display > .katex { text-align: left; }
.md .math-restored { border-bottom: 1px solid currentColor; border-bottom-color: color-mix(in srgb, currentColor 40%, transparent); }
.md .math-fallback { white-space: pre-wrap; font-family: var(--mono); font-size: .92em; overflow-wrap: anywhere; }
.md .math-block:focus-visible { outline: 2px solid currentColor; outline-offset: 3px; }
@media (max-width: 640px) {
  .md .math-block { padding: 12px; margin: 12px 0; }
}
