/* Ask Sig as Sig's health terminal (miraclehealth.us/ai). Loads after ai.css and plan.css and
   dresses the same page: a window under the site's bar with a title bar (Sig's ring,
   a tab for the question it's on, the twelve who answer) and a status bar that stay put while the
   conversation scrolls between them; the conversation on the left, as a shell: the question at
   the prompt (sig@miracle ~/chats › ask "…"), the run as numbered log lines (01 safety ✓ …), then
   the answer under the Safety agent's check, and the box to write in as the same prompt; the
   blood markers beside it (mind.css). Every agent keeps one colour (Eleven), and so does
   every part of an answer: numbered in the gutter, a rule beside it in its agent's colour, and a
   line over it saying what kind of part it is (// the studies, // blood tests…) and, on the right,
   which agent signed it. Safety notes inform; they never shout. The typing bar has its own place
   at the foot of the conversation and never moves; only the conversation scrolls. On a phone it is
   the conversation alone, edge to edge, with the ring and the count in its title bar; the blood
   markers pull up as a sheet. */

.ai{
  --a-safety:#FF6B5B;--a-planner:#FF9F4A;--a-recommender:#F2C94C;--a-community:#3D8BFF;--a-combination:#5FE08A;--a-markers:#3FE0C5;
  --a-synergy:#55D3FF;--a-evidence:#6FA8FE;--a-relatives:#8F95FF;--a-mechanism:#B98CFF;--a-builder:#FF7FC8;
  /* the Interpretation agent, last of all and at the ring's centre: white, every colour at once */
  --a-interpretation:#F7F8FA;
  --tm-page:#000000;--tm-win:#000000;--tm-bar:#17171A;--tm-pane2:#121214;--tm-stat:#000000;
  --tm-tx:#F7F8FA;--tm-t2:#A1A7B2;--tm-t3:#7F8796;--tm-line:rgba(255,255,255,.1);--tm-line2:rgba(255,255,255,.2);
  /* the gap around the window, the title bar, the pane's header, the foot (no status bar since the
     owner's rule of November 18, so 0), the pane's padding */
  --tm-g:16px;--tm-tb:44px;--tm-ph:34px;--tm-sb:0px;--tm-px:24px;
  /* the height under the title bar */
  --tm-h:calc(100svh - var(--top-h) - 2 * var(--tm-g) - var(--tm-tb) - var(--tm-sb));
}
.ai [data-agent="safety"],.ai [data-agent="review"]{--ac:var(--a-safety)}
.ai [data-agent="planner"]{--ac:var(--a-planner)}
.ai [data-agent="recommender"]{--ac:var(--a-recommender)}
.ai [data-agent="community"]{--ac:var(--a-community)}
.ai [data-agent="combination"]{--ac:var(--a-combination)}
.ai [data-agent="markers"]{--ac:var(--a-markers)}
.ai [data-agent="synergy"]{--ac:var(--a-synergy)}
.ai [data-agent="evidence"]{--ac:var(--a-evidence)}
.ai [data-agent="relatives"]{--ac:var(--a-relatives)}
.ai [data-agent="mechanism"]{--ac:var(--a-mechanism)}
.ai [data-agent="builder"]{--ac:var(--a-builder)}
.ai [data-agent="interpretation"]{--ac:var(--a-interpretation)}
.ai [data-a1="safety"]{--ac1:var(--a-safety)}.ai [data-a2="safety"]{--ac2:var(--a-safety)}
.ai [data-a1="planner"]{--ac1:var(--a-planner)}.ai [data-a2="planner"]{--ac2:var(--a-planner)}
.ai [data-a1="recommender"]{--ac1:var(--a-recommender)}.ai [data-a2="recommender"]{--ac2:var(--a-recommender)}
.ai [data-a1="community"]{--ac1:var(--a-community)}.ai [data-a2="community"]{--ac2:var(--a-community)}
.ai [data-a1="combination"]{--ac1:var(--a-combination)}.ai [data-a2="combination"]{--ac2:var(--a-combination)}
.ai [data-a1="markers"]{--ac1:var(--a-markers)}.ai [data-a2="markers"]{--ac2:var(--a-markers)}
.ai [data-a1="synergy"]{--ac1:var(--a-synergy)}.ai [data-a2="synergy"]{--ac2:var(--a-synergy)}
.ai [data-a1="evidence"]{--ac1:var(--a-evidence)}.ai [data-a2="evidence"]{--ac2:var(--a-evidence)}
.ai [data-a1="relatives"]{--ac1:var(--a-relatives)}.ai [data-a2="relatives"]{--ac2:var(--a-relatives)}
.ai [data-a1="mechanism"]{--ac1:var(--a-mechanism)}.ai [data-a2="mechanism"]{--ac2:var(--a-mechanism)}
.ai [data-a1="builder"]{--ac1:var(--a-builder)}.ai [data-a2="builder"]{--ac2:var(--a-builder)}
.ai [data-a1="interpretation"]{--ac1:var(--a-interpretation)}.ai [data-a2="interpretation"]{--ac2:var(--a-interpretation)}
html:has(body.ai){scroll-padding-top:calc(var(--top-h) + var(--tm-g,16px) + var(--tm-tb,42px) + 12px);scroll-padding-bottom:120px}

/* ---------------------------------------------------------------- Sig's ring */
/* Every piece lit while Sig is idle; while the agents work its pieces light one by one round the ring
   (the loading ring of both apps, kit.css .mh-wait, the same keyframes); beside an answer and in the
   agents' tab, lit piece by piece as each one reports */
[data-sig]{display:block;flex:none}
[data-sig] svg{display:block;width:100%;height:100%;overflow:visible}
.rg{opacity:.16;transition:opacity .4s}
.rg.on{opacity:1}
[data-sig].is-spin .rg{animation:mh-wait 1.32s linear infinite}
[data-sig].is-spin .rg:nth-child(2){animation-delay:.12s}[data-sig].is-spin .rg:nth-child(3){animation-delay:.24s}[data-sig].is-spin .rg:nth-child(4){animation-delay:.36s}[data-sig].is-spin .rg:nth-child(5){animation-delay:.48s}[data-sig].is-spin .rg:nth-child(6){animation-delay:.60s}[data-sig].is-spin .rg:nth-child(7){animation-delay:.72s}[data-sig].is-spin .rg:nth-child(8){animation-delay:.84s}[data-sig].is-spin .rg:nth-child(9){animation-delay:.96s}[data-sig].is-spin .rg:nth-child(10){animation-delay:1.08s}[data-sig].is-spin .rg:nth-child(11){animation-delay:1.20s}
[data-sig].is-spin .rg-c{animation:none;opacity:.16}
[data-sig].is-flag .rg[data-a="safety"]{animation:tm-pulse 1.2s ease-in-out infinite}
@keyframes tm-pulse{0%,100%{opacity:1}50%{opacity:.35}}
@keyframes tm-blink{0%,49.9%{opacity:1}50%,100%{opacity:0}}
@keyframes tm-spin{to{transform:rotate(360deg)}}

/* ---------------------------------------------------------------- the window */
.tm.ai-app{grid-template-columns:minmax(0,1fr);grid-template-rows:auto minmax(0,1fr) auto;gap:0;width:calc(100% - 2 * var(--tm-g));max-width:none;margin:calc(var(--top-h) + var(--tm-g)) auto 0;padding:0}
.tm .tm-title{grid-column:1/-1;grid-row:1}
.tm .ai-chat{grid-column:1;grid-row:2}
@media (min-width:1101px){
  .tm.ai-app{grid-template-columns:minmax(0,1fr) clamp(380px,32%,560px)}
}
/* the panes: the conversation on the window's own dark, the side pane a shade lighter */
.tm .ai-chat{max-width:none;width:auto;justify-self:stretch;min-height:var(--tm-h);background:var(--tm-win);border-left:1px solid var(--tm-line);border-right:1px solid var(--tm-line)}

/* The title bar: stays under the site's bar while the conversation scrolls. Above it, the gap
   keeps the page's colour, so nothing scrolling behind it shows. The window is square, like How it
   works' cards and the Signal's on the front page. */
.tm .tm-title{position:sticky;top:calc(var(--top-h) + var(--tm-g));z-index:9;display:flex;align-items:flex-end;height:var(--tm-tb);padding:0 14px 0 16px;border:1px solid var(--tm-line);border-radius:0;background:var(--tm-bar);color:var(--tm-tx)}
.tm .tm-title::before{content:'';position:absolute;left:-1px;right:-1px;bottom:calc(100% + 1px);height:calc(var(--tm-g) + 2px);background:var(--tm-page);pointer-events:none}
.tm-brand{display:flex;align-items:center;gap:10px;flex:none;align-self:center;padding-right:18px}
.tm-logo{width:18px;height:18px}
.tm-brand b{font:650 14px/1 var(--body);letter-spacing:-.01em;color:var(--tm-tx)}
/* The chats, as a browser's tabs: the open one joined to the conversation below it, the others
   behind; × on the open one and on hover, + after the last. They shrink as more open, then the
   strip scrolls. */
.tm-tabstrip{display:flex;align-items:flex-end;gap:2px;flex:0 1 auto;min-width:0;align-self:stretch;margin-bottom:-1px}
.tm-chats{position:relative;display:flex;align-items:flex-end;gap:2px;min-width:0;height:100%;overflow-x:auto;overflow-y:hidden;scrollbar-width:none}
.tm-chats::-webkit-scrollbar{display:none}
.tm-chats.scrolls{-webkit-mask-image:linear-gradient(90deg,transparent,#000 18px,#000 calc(100% - 18px),transparent);mask-image:linear-gradient(90deg,transparent,#000 18px,#000 calc(100% - 18px),transparent)}
.tm-tab{position:relative;display:flex;align-items:center;flex:0 1 220px;min-width:100px;height:32px;margin-bottom:0;border:1px solid transparent;border-bottom:0;border-radius:0;color:var(--tm-t3);transition:background-color .15s,color .15s}
.tm-tab.on{z-index:1;border-color:var(--tm-line);background:var(--tm-win);color:var(--tm-tx)}
.tm-tab:not(.on):hover{background:var(--hover);color:var(--tm-t2)}
.tm-tab:not(.on)+.tm-tab:not(.on)::before{content:'';position:absolute;left:-2px;top:9px;bottom:9px;width:1px;background:var(--tm-line)}
.tm-tabopen{display:flex;align-items:center;gap:9px;flex:1;min-width:0;height:100%;padding:0 4px 0 13px;border:0;border-radius:0;background:none;color:inherit;font:500 13px/1 var(--body);text-align:left;cursor:pointer}
/* the chat tabs scroll in their strip, so their ring sits inside; the + beside them has room outside */
.tm-tabopen:focus-visible,.tm-tabx:focus-visible{outline:2px solid var(--tm-tx);outline-offset:-2px}
.tm-plus:focus-visible{outline:2px solid var(--tm-tx);outline-offset:2px}
.tm-tabdot{flex:none;width:7px;height:7px;border-radius:50%;background:rgba(255,255,255,.32)}
.tm-tab.on .tm-tabdot{background:var(--tm-tx)}
.tm-tab.busy .tm-tabdot{background:var(--tm-tx);animation:tm-pulse 1.2s ease-in-out infinite}
.tm-tabname{min-width:0;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}
.tm-tabx{flex:none;display:grid;place-items:center;width:22px;height:22px;margin-right:5px;padding:0;border:0;border-radius:0;background:none;color:inherit;opacity:0;cursor:pointer;transition:opacity .15s,background-color .15s}
.tm-tabx svg{width:11px;height:11px}
.tm-tab.on .tm-tabx,.tm-tab:hover .tm-tabx,.tm-tabx:focus-visible{opacity:.75}
.tm-tabx:hover{opacity:1;background:var(--hover)}
.tm-tab.lone .tm-tabx{display:none}
.tm-tab.lone .tm-tabopen{padding-right:13px}
.tm-plus{flex:none;display:grid;place-items:center;align-self:center;width:28px;height:28px;margin-left:4px;padding:0;border:0;border-radius:0;background:none;color:var(--tm-t2);cursor:pointer;transition:background-color .15s,color .15s}
.tm-plus:hover:not(:disabled){background:var(--hover);color:var(--tm-tx)}
.tm-plus:disabled{opacity:.5;cursor:default}

/* The status bar: stays at the foot of the window */

/* ---------------------------------------------------------------- the conversation's pane */
.tm .ai-bar{min-height:var(--tm-ph);padding:0 10px 0 20px;border-bottom:1px solid var(--tm-line);gap:12px}
.tm .ai-id{gap:10px;min-width:0}
/* the pane's bar: its heading (for screen readers on most screens) */
.tm .ai-id h1{font:400 13px/1 var(--body);color:var(--tm-t3);white-space:nowrap;font-stretch:100%;text-transform:none}
/* the pane's header stays under the title bar, like the agents' tabs beside it */
@media (min-width:701px){
  .tm .ai-bar{position:sticky;top:calc(var(--top-h) + var(--tm-g) + var(--tm-tb));z-index:7;background:var(--tm-win)}
  .tm .help-pin{top:calc(var(--top-h) + var(--tm-g) + var(--tm-tb) + var(--tm-ph) + 8px)}
}
/* the first screen: the greeting and four ways in, over the typing bar */
.tm .ai-thread{gap:16px;padding:20px var(--tm-px) 24px}
.tm .ai-chat.is-empty .ai-thread{padding:24px var(--tm-px) 8px}
.tm .ai-empty{padding:0}
.tm .ai-hello{width:40px;height:40px}
.tm .ai-begin{padding:8px var(--tm-px) 24px}
.tm .ai-start{border-color:var(--tm-line2);background:transparent}
.tm .ai-start:hover{border-color:var(--tm-tx);background:transparent}
.tm .ai-pulse{border-top-color:var(--tm-line)}

/* In a wide pane the answer keeps a readable line and the first screen a readable block */
@media (min-width:701px){
  .tm .ai-thread>*{max-width:900px}
  .tm .ai-empty,.tm .ai-begin>*{max-width:760px}
}

/* ---------------------------------------------------------------- the typing bar */
/* Its own place at the foot of the conversation, never over it: the box to write in (the same on
   the first screen and in a chat) and one line of small print under it. Only the conversation
   above it scrolls. */
.tm .ai-dock{position:relative;flex:none;z-index:5;margin:0;padding:12px var(--tm-px) 10px;border-top:1px solid var(--tm-line);background:var(--tm-win)}
.tm .ai-dock::before{top:-21px;height:20px;background:linear-gradient(rgba(0,0,0,0),var(--tm-win))}
.tm .ai-composer{align-items:flex-start;gap:10px;max-width:900px;min-height:56px;padding:6px 10px 6px 16px;border:1px solid var(--tm-line2);border-radius:0;background:var(--tm-bar);transition:border-color .15s}
.tm .ai-composer:focus-within{border-color:var(--tm-tx)}
.tm .ai-composer:has(textarea:focus-visible){outline:2px solid var(--text);outline-offset:2px}
.tm .ai-fine{max-width:900px;margin:8px 0 0;padding:0 2px;font-size:13px;line-height:1.45;color:var(--tm-t3)}
.ai-fine-s{display:none}
/* where the whole line won't fit on one line, the short one */
.tm .ai-dock{container-type:inline-size}
@container (max-width:680px){
  .ai-fine-x{display:none}
  .ai-fine-s{display:inline}
}
.tm-field{position:relative;display:flex;flex:1;min-width:0}
.tm .ai-composer textarea{padding:9px 0;font:500 16px/22px var(--body);color:var(--tm-tx);caret-color:var(--tm-tx)}
.tm .ai-composer textarea::placeholder{font-weight:400;color:var(--tm-t3)}
/* An empty prompt shows a block cursor (dim until the box has the keyboard), the hint after it */
.tm .ai-count{align-self:center;font:500 12.5px/1 var(--body);color:var(--tm-t3)}
/* the send key: ↵ send, then ■ stop while the agents work */
.tm .ai-send{align-self:center;display:inline-flex;align-items:center;justify-content:center;width:auto;height:40px;padding:0 12px;border-radius:0;border:1px solid var(--tm-line2);background:transparent;color:var(--tm-t3);font:500 13px/1 var(--body);white-space:nowrap;transition:border-color .15s,color .15s,background-color .15s}
.tm .ai-send svg,.tm .ai-send .k-stop{display:none}
.tm .ai-send.stop .k-send{display:none}
.tm .ai-send.stop .k-stop{display:inline}
.tm .ai-send:not(:disabled){border-color:var(--tm-tx);background:var(--tm-tx);color:#000000}
.tm .ai-send:not(:disabled):hover{border-color:#FFFFFF;background:#FFFFFF}
.tm .ai-send.stop,.tm .ai-send.stop:hover{border-color:rgba(255,255,255,.6);background:transparent;color:var(--tm-tx)}
.tm .ai-send:disabled{background:transparent;color:var(--tm-tx);opacity:.5}
@media (pointer:coarse),(max-width:700px){
  .tm .ai-send{width:40px;height:40px;padding:0;border:0;border-radius:0;background:var(--tm-tx);color:#000000}
  .tm .ai-send svg{display:block}
  .tm .ai-send .tm-key{display:none!important}
  .tm .ai-send:not(:disabled),.tm .ai-send:not(:disabled):hover{background:var(--tm-tx);color:#000000}
  .tm .ai-send:disabled{background:transparent;color:var(--tm-tx);opacity:.5}
  .tm .ai-send.stop,.tm .ai-send.stop:hover{background:var(--tm-tx);color:#000000}
  .tm .ai-send.stop .i-send{display:none}
  .tm .ai-send.stop .i-stop{display:inline}
}

/* ---------------------------------------------------------------- the log */
/* their question, as typed at the prompt */
.tm .msg.ai{display:block}
.tm .msg.ai .sheet{margin:0;padding:0}
.tm .waiting{display:none}
/* the run: one line per step, in the colour of the agent that took it, folded into one line once
   the answer is being written */
.tm .trace{margin:0 0 4px}
.tm .trace-sum{display:inline-flex;flex-wrap:wrap;align-items:center;gap:4px 8px;min-height:28px;padding:2px 0;font:500 13.5px/1.5 var(--body);color:var(--tm-t2);text-align:left}
.tm .trace-sum::after{display:none}
.tm .trace-sum:hover{color:var(--tm-tx)}
.tm .trace-sum b{font-weight:500;color:var(--tm-tx)}
.ts-car{width:1ch;color:var(--tm-t3)}
.ts-sw{display:inline-flex;gap:2px}
.ts-sw i{width:9px;height:4px;border-radius:0;background:var(--ac)}
.ts-act{color:var(--tm-t3);text-decoration:underline;text-underline-offset:3px}
.ts-busy{display:inline-flex;flex:none}
.ts-busy .mh-wait-ring{display:block}
.tm .trace .trace-steps,.tm .trace.done .trace-steps{display:none}
.tm .trace.open .trace-steps,.tm .trace.done.open .trace-steps{display:grid;gap:0;margin-top:2px}
.tm .tstep{display:grid;grid-template-columns:22px 15ch 12px minmax(0,1fr);column-gap:10px;align-items:start;padding:1px 0;font:400 13.5px/1.6 var(--body)}
.ts-n{color:var(--tm-t3);font-variant-numeric:tabular-nums}
.ts-who{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-weight:500;color:var(--ac)}
.tm .tstep-what{color:var(--tm-t2)}
.ts-st{position:relative;height:20px;text-align:center;color:var(--ac)}
.tstep.done .ts-st::before{content:'';display:inline-block;width:.95em;height:.95em;background:currentColor;vertical-align:-.12em;-webkit-mask:url(/img/i-check.svg) center/contain no-repeat;mask:url(/img/i-check.svg) center/contain no-repeat;text-shadow:none}
.tstep.run .ts-st::before{content:'';position:absolute;left:2px;top:7px;width:7px;height:7px;border-radius:50%;background:var(--ac);animation:tm-pulse 1.2s ease-in-out infinite}
.tstep.flag .ts-st::before{content:'!';color:var(--a-safety);text-shadow:none}
.tm .tstep-chips{display:flex;flex-wrap:wrap;gap:5px;margin:4px 0 3px}
.tm .tstep-chips a,.tm .tstep-chips span{padding:2px 8px;border-radius:0;border:1px solid var(--tm-line2);background:transparent;color:var(--tm-t2);font:500 13px/1.5 var(--body);text-decoration:none}
.tm .tstep-chips a:hover{border-color:var(--tm-tx);color:var(--tm-tx)}
/* the answer's head */
.tm .sheet-body{padding-left:0}
.tm .prose{font-size:15.5px;line-height:1.62;color:rgba(255,255,255,.9)}
.tm .prose>*+*{margin-top:6px}
.tm .prose ul{gap:6px}
.tm .prose ul li{padding-left:17px}
.tm .prose ul li::before{left:3px;top:.68em;width:5px;height:5px;background:var(--tm-t3)}
.tm .prose ul+p,.tm .prose p+ul{margin-top:6px}
.ctag{display:flex;flex-wrap:wrap;justify-content:space-between;gap:2px 16px;margin:0 0 4px;font:400 13px/1.5 var(--body);text-transform:none;color:var(--tm-t3);user-select:none;-webkit-user-select:none}
.ctag b{font-weight:500;color:var(--ac)}
.pt-by{color:var(--tm-t3)}
/* the part's number, in the gutter */
.tm .prose h2{margin-top:14px;font:600 16px/1.35 var(--body);font-weight:600;font-stretch:100%;text-transform:none}
.tm .prose ol li::before{font-family:var(--mono)}
.tm .prose.streaming>p:last-child::after,.tm .prose.streaming>h2:last-child::after,.tm .prose.streaming>ul:last-child>li:last-child::after,.tm .prose.streaming>ol:last-child>li:last-child::after{width:.6em;height:1.1em;border-radius:0;background:var(--tm-tx);animation:tm-blink 1.06s steps(1) infinite}
.tm details.more{margin:8px 0 4px;border-top:1px dashed var(--tm-line2)}
.tm details.more>summary{min-height:36px;font:500 13px/1 var(--body);color:var(--tm-t2)}
/* the cards keep their own layout, with the agent that made them over each and its colour down its side */
.tm .sheet-body>.ctag{position:relative;margin:16px 0 0}
.tm .sheet-body>.ctag+.card{margin-top:6px}
.tm .sheet-body>.card[data-agent]{border-left:3px solid var(--ac)}
/* the efficacy read: the Interpretation agent's derivation, on the terminal's own panel */
.tm .card.interp{border-color:var(--tm-line);background:var(--tm-pane2);color:var(--tm-tx)}
.tm .card.interp p.sub,.tm .ip-row dt,.tm .ip-rung{color:var(--tm-t3)}
.tm .ip-row dd{color:var(--tm-t2)}
.tm .ip-main dd,.tm .ip-sum{color:var(--tm-tx)}
.tm .ip-verdict{border-top-color:var(--tm-line)}
.tm .ip-dot{color:var(--a-interpretation);box-shadow:none}
/* where it came from: the studies in the Evidence librarian's blue, the community in its lime */
.tm .answer-src{gap:4px 14px;margin-top:12px;font:400 13px/1.5 var(--body);color:var(--tm-t3)}
.tm .answer-src .src-k{letter-spacing:0;font-weight:400}
.tm .src-part{color:var(--tm-t2)}
.tm .v-dot{width:8px;height:8px;border:0;border-radius:0}
.tm .v-dot.v-studies{background:#14ECC3;box-shadow:none}
.tm .v-dot.v-community{background:var(--a-community);box-shadow:none}
/* the foot: the Safety agent's check, then copying */
.tm .sheet-foot{margin-top:10px;font:500 13px/1.45 var(--body);color:var(--tm-t2)}
.tm .sheet-foot{justify-content:flex-end}
.tm .sheet-foot .mini{min-height:38px;margin:0;padding:0 12px;border-radius:0;border:1px solid var(--tm-line2);background:transparent;color:var(--tm-t2);font:500 13px/1 var(--body)}
.tm .sheet-foot .mini:hover{border-color:var(--tm-tx);color:var(--tm-tx)}
/* after words of crisis, 988 stays in reach: opaque, so nothing scrolling under it shows through */
.tm .help-pin{margin:10px var(--tm-px) 0;background:linear-gradient(rgba(224,104,92,.16),rgba(224,104,92,.16)),var(--tm-win)}

/* ---------------------------------------------------------------- beside the chat */
@media (min-width:1101px){
  .tm .ai-rail{grid-column:2;grid-row:2;position:sticky;top:calc(var(--top-h) + var(--tm-g) + var(--tm-tb));align-self:start;height:var(--tm-h);max-height:none;margin:0;padding:0;overflow:auto;border:0;border-right:1px solid var(--tm-line);border-radius:0;background:var(--tm-pane2);scrollbar-width:thin;scrollbar-color:rgba(255,255,255,.22) transparent}
  .tm .ai-chat{border-right-color:var(--tm-line)}
}

/* ---------------------------------------------------------------- phones: edge to edge */
@media (max-width:700px){
  .ai{--tm-g:0px;--tm-px:16px;--tm-tb:52px;--tm-sb:0px;--tm-ph:44px}
  .tm.ai-app{width:100%;max-width:none;margin:var(--top-h) 0 0}
  .tm .tm-title{top:var(--top-h);padding:0 14px;border-width:0 0 1px;border-radius:0;align-items:center}
  .tm .tm-title::before,.tm .tm-title::after{display:none}
  .tm-brand{padding-right:10px}
  .tm-brand b{font-size:15px}
  .tm .ai-bar{gap:0;padding:0 6px 0 4px}
  .tm .ai-bar .ai-id{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
  .tm .ai-bar .tm-tabstrip{flex:1;height:var(--tm-ph)}
  .tm .ai-bar .tm-tab{flex-basis:180px;min-width:100px;height:40px}
  .tm-plus{width:40px;height:40px}
  .tm .ai-bar .tm-tabx{opacity:.75}
  .tm .ai-chat{min-height:calc(100svh - var(--top-h) - var(--tm-tb) - var(--tm-sb));border:0}
  .tm .help-pin{top:calc(var(--top-h) + var(--tm-tb) + 8px)}
  .tm .ai-dock{padding:8px var(--tm-px) calc(8px + env(safe-area-inset-bottom))}
  .tm .ai-composer{min-height:50px;padding:4px 6px 4px 12px}
  .tm .ai-fine{margin-top:6px;font-size:13px}
  .tm .ai-composer textarea{font-size:16px}
  .tm .ai-thread{padding-top:12px}
  .tm .prose{font-size:15px}
  .tm .tstep{grid-template-columns:18px 14ch 10px minmax(0,1fr);column-gap:7px;font-size:11.5px}
  .tm .trace-sum{font-size:11.5px}
}
@media (max-width:480px){
}

/* ---------------------------------------------------------------- Sig's own page (/sig) */
/* No site bar over it: the window starts at the top, beside a side panel with the chats kept on
   this device and the site's own links (the site's bar and footer give way to it, nothing is
   lost). The window fills the browser, on a phone too, like an app: the page never scrolls, only
   the conversation does, in its own pane between the title bar and the typing bar, which stays
   put. On a narrow screen the panel slides in from the left. */
html:has(body.sigapp){--top-h:0px}
.sg{--sg-w:272px;display:grid;grid-template-columns:var(--sg-w) minmax(0,1fr);min-height:100dvh}
.sg-main{min-width:0}
.sg-side{position:sticky;top:0;z-index:30;display:flex;flex-direction:column;height:100dvh;overflow-y:auto;overscroll-behavior:contain;scrollbar-width:thin;scrollbar-color:rgba(255,255,255,.22) transparent;padding:10px 10px 12px 12px;border-right:1px solid var(--tm-line);background:#000000;color:var(--tm-tx)}
.sg-head{display:flex;align-items:center;justify-content:space-between;height:44px;padding:0 0 0 6px}
.sg-logo{display:block;padding:4px 0}
.sg-logo img{display:block;width:auto;height:20px}
.sg-fold,.tm-menu{display:grid;place-items:center;flex:none;width:32px;height:32px;padding:0;border:0;border-radius:0;background:none;color:var(--tm-t2);cursor:pointer}
.sg-fold:hover,.tm-menu:hover{background:var(--hover);color:var(--tm-tx)}
.sg-fold:focus-visible,.tm-menu:focus-visible,.sg-new:focus-visible,.sg-open:focus-visible,.sg-del:focus-visible,.sg-wipe:focus-visible,.sg-site a:focus-visible,.sg-yes:focus-visible,.sg-no:focus-visible,.sg-wipe-yes:focus-visible,.sg-wipe-no:focus-visible{outline:2px solid var(--tm-tx);outline-offset:2px}
.tm-menu{display:none;align-self:center;margin-right:8px}
.sg-new{display:flex;align-items:center;gap:10px;width:100%;min-height:40px;margin:10px 0 4px;padding:0 12px;border:1px solid var(--tm-line2);border-radius:0;background:transparent;color:var(--tm-tx);font:600 14px/1 var(--body);cursor:pointer}
.sg-new:hover{border-color:var(--tm-tx);background:transparent}
.sg-new svg{color:var(--tm-tx)}
/* on a short screen the panel scrolls as a whole rather than squeezing its links */
.sg-side>:not(.sg-chats){flex-shrink:0}
.sg-chats{flex:1;min-height:0;margin:12px -6px 0 -3px;padding-right:6px;padding-left:3px;overflow-y:auto;scrollbar-width:thin;scrollbar-color:rgba(255,255,255,.2) transparent}
.sg-k{margin:0 10px 6px;font:500 13px/1 var(--body);text-transform:none;color:var(--tm-t3)}
.sg-list{display:grid;grid-template-columns:minmax(0,1fr);gap:1px;margin:0;padding:0;list-style:none}
.sg-item{position:relative;display:flex;align-items:center;border-radius:0}
.sg-item:hover{background:var(--hover)}
.sg-item.on{background:rgba(255,255,255,.08)}
.sg-open{display:flex;align-items:center;gap:9px;flex:1;min-width:0;min-height:36px;padding:0 6px 0 10px;border:0;border-radius:0;background:none;color:var(--tm-t2);font:500 13px/1.3 var(--body);text-align:left;cursor:pointer}
.sg-item.on .sg-open{color:var(--tm-tx)}
.sg-dot{flex:none;width:6px;height:6px;border-radius:50%}
.sg-item.tabbed .sg-dot{background:rgba(255,255,255,.35)}
.sg-item.on .sg-dot{background:var(--tm-tx)}
.sg-item.busy .sg-dot{background:var(--tm-tx);animation:tm-pulse 1.2s ease-in-out infinite}
.sg-name{flex:1;min-width:0;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}
.sg-when{flex:none;font:500 12px/1 var(--body);color:var(--tm-t3)}
.sg-del{flex:none;display:grid;place-items:center;width:28px;height:28px;margin-right:4px;padding:0;border:0;border-radius:0;background:none;color:var(--tm-t3);opacity:0;cursor:pointer}
.sg-del svg{width:16px;height:16px}
.sg-item:hover .sg-del,.sg-item:focus-within .sg-del{opacity:1}
.sg-item:hover .sg-when,.sg-item:focus-within .sg-when{display:none}
.sg-del:hover{background:var(--hover);color:var(--tm-tx)}
/* a touch screen can't hover: the bin is always there */
@media (hover:none){
  .sg-del{opacity:.7}
  .sg-item:hover .sg-when,.sg-item:focus-within .sg-when{display:inline}
}
.sg-item.asking{display:grid;gap:8px;padding:9px 8px 9px 10px;background:rgba(255,107,91,.07);box-shadow:inset 0 0 0 1px rgba(255,107,91,.32)}
.sg-ask{margin:0;font-size:12.5px;line-height:1.4;color:var(--tm-t2);overflow-wrap:anywhere}
.sg-ask b{font-weight:600;color:var(--tm-tx)}
.sg-asks{display:flex;gap:8px}
.sg-none{margin:2px 8px;font-size:13px;line-height:1.5;color:var(--tm-t3)}
.sg-foot{display:grid;gap:10px;padding:12px 0 0;border-top:1px solid var(--tm-line)}
.sg-site{display:grid;gap:1px}
.sg-site a{display:flex;align-items:center;min-height:36px;padding:0 10px;border-radius:0;color:var(--tm-t2);font:500 13.5px/1 var(--body);text-decoration:none}
.sg-site a:hover{background:var(--hover);color:var(--tm-tx)}
.sg-site a[aria-current="page"]{background:rgba(255,255,255,.08);color:var(--tm-tx)}
.sg-acct{display:flex;align-items:center;gap:14px;padding:0 10px}
.sg-signin{color:var(--tm-t2);font:500 13.5px/1 var(--body);text-decoration:none}
.sg-signin:hover{color:var(--tm-tx)}
.sg-wipe-row{display:flex;flex-wrap:wrap;align-items:center;gap:6px 10px;padding:0 0 0 2px}
.sg-wipe,.sg-wipe-yes,.sg-wipe-no,.sg-yes,.sg-no{display:inline-flex;align-items:center;gap:9px;min-height:32px;padding:0 8px;border:0;border-radius:0;background:none;color:var(--tm-t3);font:500 12.5px/1 var(--body);cursor:pointer}
.sg-wipe:hover:not(:disabled){background:var(--hover);color:var(--tm-tx)}
.sg-wipe:disabled{color:var(--tm-tx);opacity:.5;cursor:default}
.sg-wipe-ask{width:100%;margin:0 8px;font-size:12.5px;line-height:1.45;color:var(--tm-t2)}
.sg-wipe-yes,.sg-yes{border:1px solid rgba(255,154,142,.55);color:#FF9A8E}
.sg-wipe-yes:hover,.sg-yes:hover{background:var(--hover)}
.sg-wipe-no,.sg-no{border:1px solid var(--tm-line2);color:var(--tm-t2)}
.sg-wipe-no:hover,.sg-no:hover{color:var(--tm-tx)}
.sg-legal{display:flex;flex-wrap:wrap;align-items:center;gap:0 14px;margin:0;padding:0 10px;font-size:13px;color:var(--tm-t3)}
.sg-legal a{color:inherit}
.sg-legal a:hover{color:var(--tm-tx)}
.sg-scrim{position:fixed;inset:0;z-index:29;background:rgba(0,0,0,.55)}
/* hidden on a wide screen: the panel folds away and the menu button brings it back */
.sg.folded{grid-template-columns:minmax(0,1fr)}
.sg.folded .sg-side{display:none}
.sg.folded .tm-menu{display:grid}
.sigapp .tm.ai-app{margin:var(--tm-g) auto}
html:has(body.sigapp),body.sigapp{height:100%;overflow:hidden;overscroll-behavior:none}
.sigapp .tm.ai-app{height:calc(100dvh - 2 * var(--tm-g))}
.sigapp .tm .tm-title{position:relative;top:auto}
.sigapp .tm .ai-chat{min-height:0;overflow:hidden}
/* (the pane is also what anything placed out of the flow inside it is measured from: a label kept for
   screen readers at the end of a long chat would otherwise hang below the window, and make the page
   itself able to move under the pane) */
.sigapp .tm .ai-scroll{position:relative;flex:1 1 auto;display:flex;flex-direction:column;min-height:0;overflow-y:auto;overscroll-behavior:contain;scrollbar-width:thin;scrollbar-color:rgba(255,255,255,.22) transparent;scroll-padding:12px 0 24px}
.sigapp .tm .help-pin{position:relative;top:auto;margin-bottom:10px}
/* on a wide screen the chat's name is on its tab, so the pane needs no header of its own (it stays
   for screen readers, with the page's heading) */
@media (min-width:701px){
  .sigapp .tm .ai-bar{position:absolute;width:1px;height:1px;min-height:0;padding:0;border:0;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
}
@media (min-width:1101px){
  .sigapp .tm .ai-rail{position:relative;top:auto;align-self:stretch;height:auto;min-height:0}
}
/* where the site's bar would fold its links into a menu, the panel slides in over the window from
   the menu button; a little narrower until then */
/* the logo: in the side panel when it stands beside the page; in the bar when the panel is a drawer, as on every page */
.tm-home{display:none}
@media (max-width:900px){
  .tm-home{display:flex;align-items:center;flex:none;min-height:40px;margin-right:14px;align-self:center}.tm-home img{display:block;width:auto;height:20px}
  .sg,.sg.folded{grid-template-columns:minmax(0,1fr)}
  .sg-side,.sg.folded .sg-side{position:fixed;top:0;bottom:0;left:0;display:flex;width:min(86vw,300px);height:100dvh;visibility:hidden;transform:translateX(-102%);transition:transform .22s ease,visibility 0s linear .22s;box-shadow:12px 0 40px rgba(0,0,0,.5)}
  .sg.drawer .sg-side{visibility:visible;transform:none;transition:transform .22s ease}
  .tm-menu,.sg.folded .tm-menu{display:grid}
  .sg-side{overflow-y:auto;overscroll-behavior:contain}
  .sg-fold,.tm-menu{width:40px;height:40px}
  .sg-site.os-places a,.sg-open{min-height:40px}
  .sg-signin,.sg-legal a{display:inline-flex;align-items:center;min-height:40px}
  .sg-logo{padding:9px 0}
  .sg-wipe{min-height:40px}
}
@media (max-width:700px){
  .sigapp .tm.ai-app{height:100dvh;margin:0}
  .tm-menu{margin-right:4px}
}

/* ---------------------------------------------------------------- less motion, and paper */
@media (prefers-reduced-motion:reduce){
  [data-sig].is-spin .rg,[data-sig].is-flag .rg,.tstep.run .ts-st::before,.tm-tab.busy .tm-tabdot,
  .tm .prose.streaming>*::after,.tm .prose.streaming>*>li::after{animation:none!important}
  .rg,.sg-side{transition:none!important}
  .sg-item.busy .sg-dot{animation:none!important}
}
@media print{
  .tm-title,.tm-boot,.a-top .msg-sig,.a-how,.a-next,.a-quiet,.ai-composer,.ts-sw,.sg-side,.sg-scrim{display:none!important}
  .a-top,.a-rk,.a-check{color:#444444!important}
  .sg{display:block!important}
  body.sigapp{overflow:visible!important}
  .sigapp .tm.ai-app,.sigapp .tm .ai-chat{height:auto!important;overflow:visible!important}
  .tm.ai-app{display:block!important;padding:0!important}
  .ai,.ai #main,.ai-app,.tm .ai-chat{background:#FFFFFF!important;color:#111111!important;border:0!important;margin:0!important;width:auto!important}
  .tm .bubble,.tm .prose,.tm .prose p,.tm .prose li,.tm .prose strong,.tm .prose a,.tm .prose h2,.tm .answer-src,.tm .src-part,.tm .sheet,.a-who b,.a-rv>p,.a-list{color:#111111!important;text-shadow:none!important}
  .ctag,.ctag b{color:#444444!important;text-shadow:none!important}
}


/* ---------------------------------------------------------------- the site's side panel, here too
   The same order as on every page: New chat, the four places, what's in this window (the chats), the
   rest of the site, then joining and the legal. Only the chats give way on a short screen; the panel
   scrolls when it must, and the page behind an open drawer holds still */
.sg-side{overflow-y:auto;scrollbar-width:none}
.sg-side>:not(.sg-chats){flex-shrink:0}
.sg-site{margin:8px 0 4px}
.sg-chats{min-height:min(120px,15dvh);padding-top:8px;border-top:1px solid var(--tm-line)}
.sg-more{margin-top:8px}
@media (min-width:901px){.sg-foot{position:sticky;bottom:-12px;z-index:1;margin-bottom:-12px;padding-bottom:12px;background:inherit}}
:root:has(#sg.drawer){overflow:hidden}
/* the stop key's square is drawn: neither font has one */
.tm .ai-send .k-stop::before{content:'';display:inline-block;width:.6em;height:.6em;margin-right:.5em;background:currentColor;vertical-align:.02em}
