Files
magpie/internal/gui/assets/context.css
T
yetone e4bc3eeb6f gui: the context window card's head keeps its title, icons and model apart at every width
packinggoods on Discord, in #feedback: in a narrow window the Routing
page's "Context window" head drew the provider's icon over the end of
the title. The mono model id (remote-magpie/claude/cla...) and the Live
pill sat beside it. The cause was .ctx-fold, the title's button when the
card can fold. It had min-width:0, so it shrank under the route, and the
title's nowrap text ran on under the icons.

The title no longer shrinks (flex:none). The route and the state now go
together in .ctx-end, and the head wraps. Where the title leaves them too
little room they take a line of their own, ending at the right, and the
model id is cut there with an ellipsis. A folded card stays one line. At
520px and below it drops the agent's name and the lab part of the route.
At 420px and below it drops the route and the state's word, keeping the
state dot and the bar. The fold button keeps an outer height of 20px
(margin -1px), so opening the card doesn't move the page.

New test, ctx-head-narrow.test.cjs. It uses the reporter's model, live
and counted, with and without the agent, with and without a known window.
It runs en, zh, zh-TW, ja and de, at 1100 down to 340px, open and folded,
in Chromium and WebKit. It checks that the title's text is whole, that no
drawn parts overlap (boxes clipped to their overflow ancestors), that an
icon is never part-cut, and that nothing runs past the card.

Run at this head (rebased on a fresh origin/main), on mote, both engines:
ctx-head-narrow, ctx-route, context-window, routing-context-fold,
routing-ctx-still, routing-ctx-fold, routing-live-patch and i18n-keys:
188 pass, 0 fail. The whole GUI suite is running on WSL (Linux, both engines)
and had not reported when this was pushed. Mote was busy with three other
sessions' full suites. The owner's rule is to ship a verified fix at once.
Any red it finds that this change caused gets an issue.

Broken by hand: ctx-head-narrow on the old context.css/js is 52 of 52
red (e.g. "open at 580px: the title is whole ... cut:true", "title and
lab icon overlap").

Not tried: the real Wails app (WebKit on macOS, WebKitGTK on Linux,
WebView2 on Windows).
2026-11-04 01:39:01 +08:00

431 lines
33 KiB
CSS

/* Context windows: a request's prompt as a card (Routing, the Usage page's
Context tab) and each agent's score and tags. */
:root {
--k-system: var(--c6); --k-tools: var(--c2); --k-skills: var(--c7); --k-memory: var(--c4);
--k-files: var(--c3); --k-chat: var(--c1);
--k-free: color-mix(in srgb, var(--fg) 7%, transparent);
}
/* results in orange, its own hue: the palette's pink sank to maroon on a
dark tile. Colorblind mode keeps its palette's */
:root { --k-results: #ea580c; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --k-results: #fdba74; } }
:root[data-theme="dark"] { --k-results: #fdba74; }
:root[data-colorblind="1"] { --k-results: var(--c5); }
.k-system { --k: var(--k-system); }
.k-tools { --k: var(--k-tools); }
.k-skills { --k: var(--k-skills); }
.k-memory { --k: var(--k-memory); }
.k-files { --k: var(--k-files); }
.k-results { --k: var(--k-results); }
.k-chat { --k: var(--k-chat); }
i.dot { display: inline-block; flex: none; width: 8px; height: 8px; border-radius: 2.5px; background: var(--k); }
i.dot.free { background: var(--k-free); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--fg) 10%, transparent); }
.ctx-card { position: relative; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px 12px; display: flex; flex-direction: column; gap: 14px; min-width: 0; font-variant-numeric: tabular-nums; }
.ctx-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; min-width: 0; }
/* the route and the state, kept together at the end of the head: beside
the title while the whole model id fits there, else on a line of their
own, where the id ends in an ellipsis */
.ctx-end { display: flex; flex: 1 1 auto; justify-content: flex-end; align-items: center; gap: 8px; min-width: 0; }
.ctx-head .grow, .ctx-foot .grow, .ctx-contents-head .grow, .ctx-agent-head .grow, .ctx-agent-foot .grow, .ctx-sess-head .grow { flex: 1; }
.ctx-title { flex: none; font-size: 13px; font-weight: 600; color: var(--fg); white-space: nowrap; }
.ctx-route, .ctx-who, .ctx-what { display: inline-flex; align-items: center; gap: 5px; min-width: 0; }
/* the title never gives way: the model id does, down to its ellipsis, and
past that the route is cut at its own edge, so nothing in it is drawn
over the title or the state (packinggoods on Discord: in a narrow window
the provider's icon sat on the end of "Context window") */
.ctx-route { gap: 6px; font-size: 12px; overflow: hidden; }
.ctx-who { flex: none; color: var(--fg-2); font-weight: 500; white-space: nowrap; }
.ctx-who .ic { width: 14px; height: 14px; }
.ctx-what .ic { flex: none; width: 12px; height: 12px; }
.ctx-sep { flex: none; color: var(--faint); }
:where(.ctx-card.max420) :is(.ctx-who-n, .ctx-sep) { display: none; }
.ctx-model { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--code-font, var(--code)); font-size: 11px; color: var(--muted); }
.ctx-state { display: inline-flex; align-items: center; gap: 5px; flex: none; height: 20px; padding: 0 8px; border-radius: 10px; font-size: 11px; font-weight: 500; background: var(--pill); color: var(--fg-2); }
.ctx-state i { width: 6px; height: 6px; border-radius: 50%; background: var(--faint); }
.ctx-state.counted i { background: var(--green); }
.ctx-state.live { background: var(--green-soft); color: var(--green); }
.ctx-state.live i { background: var(--green); animation: ctx-pulse 1.4s ease-in-out infinite; }
/* every word of the state in one cell, the one that is on shown: the pill
is as wide whatever the request's state, so nothing beside it moves */
.ctx-state-w { display: inline-grid; }
.ctx-state-w > span { grid-area: 1 / 1; text-align: center; white-space: nowrap; }
.ctx-state-w > span:not(.on) { visibility: hidden; }
@keyframes ctx-pulse { 50% { opacity: .35; transform: scale(.8); } }
.ctx-k { display: flex; align-items: center; gap: 8px; font-size: 10.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); white-space: nowrap; }
:root[lang="zh"] .ctx-k, :root[lang="ja"] .ctx-k { letter-spacing: .02em; }
.ctx-top { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 12px 28px; }
.ctx-top > :only-child { grid-column: 1 / -1; }
.ctx-stat { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
/* the figure and its words apart: a flex item's leading space is dropped,
so the gap is the space ("—命中" read as one, dumplings on Discord) */
.ctx-big { display: flex; align-items: baseline; gap: .35em; white-space: nowrap; color: var(--muted); font-size: 13px; }
.ctx-big b { font-size: 28px; line-height: 1.1; font-weight: 600; letter-spacing: -.02em; color: var(--fg); }
.ctx-sub { font-size: 10.5px; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
:root[lang="zh"] .ctx-sub, :root[lang="ja"] .ctx-sub { letter-spacing: .02em; }
.ctx-health { height: 17px; display: inline-flex; align-items: center; padding: 0 7px; border-radius: 9px; font-size: 10px; letter-spacing: .03em; }
.ctx-health.ok { background: var(--green-soft); color: var(--green); }
.ctx-health.warn { background: var(--amber-soft); color: var(--amber); }
.ctx-health.bad { background: var(--red-soft); color: var(--red); }
.ctx-bar { position: relative; display: block; height: 6px; border-radius: 3px; background: var(--k-free); overflow: hidden; }
.ctx-bar i { position: absolute; inset: 0 auto 0 0; border-radius: 3px; background: var(--green); transform-origin: left; animation: ctx-grow .7s var(--ease, ease) backwards; }
.ctx-cache .ctx-bar { margin: 3px 0 2px; }
.ctx-cache .ctx-bar i { transition: width .3s var(--ease, ease); }
/* under way: the last request's cache, dimmed till this one's comes */
.ctx-cache :is(.ctx-big, .ctx-bar) { transition: opacity .3s var(--ease, ease); }
.ctx-cache.was :is(.ctx-big, .ctx-bar) { opacity: .45; }
/* nothing to show: a dash and the words why, no empty bar; the bar keeps
its room, so the card doesn't move when the figure comes */
.ctx-cache.none .ctx-big b { color: var(--faint); }
.ctx-cache.none .ctx-bar { visibility: hidden; }
@media (prefers-reduced-motion: reduce) { .ctx-cache .ctx-bar i, .ctx-cache :is(.ctx-big, .ctx-bar) { transition: none; } }
@keyframes ctx-grow { from { transform: scaleX(0); } }
/* the window, a cell for each 1/400 of it */
.ctx-waffle { display: grid; grid-template-columns: repeat(50, minmax(0, 1fr)); gap: 2px; }
/* a card 520px wide or less (context.js sets max520 by its width) */
:where(.ctx-card.max520) .ctx-waffle { grid-template-columns: repeat(25, minmax(0, 1fr)); }
.ctx-waffle > i { aspect-ratio: 1; border-radius: 2px; background: var(--k, var(--k-free)); transition: opacity .16s, transform .16s; animation: ctx-cell .32s var(--ease, ease) backwards; animation-delay: var(--d, 0ms); }
.ctx-waffle > i.free { --k: var(--k-free); }
@keyframes ctx-cell { from { opacity: 0; transform: scale(.4); } }
.ctx-waffle[data-f] > i { opacity: .16; }
.ctx-waffle[data-f="system"] > i.k-system, .ctx-waffle[data-f="tools"] > i.k-tools, .ctx-waffle[data-f="skills"] > i.k-skills,
.ctx-waffle[data-f="memory"] > i.k-memory, .ctx-waffle[data-f="files"] > i.k-files,
.ctx-waffle[data-f="results"] > i.k-results, .ctx-waffle[data-f="chat"] > i.k-chat,
.ctx-waffle[data-f="free"] > i.free, .ctx-waffle[data-f="item"] > i.on { opacity: 1; }
.ctx-waffle[data-f="item"] > i.on { transform: scale(1.12); }
.ctx-tip { position: absolute; z-index: 5; min-width: 190px; max-width: 280px; padding: 8px 10px; border-radius: 9px; background: #17171b; color: #ededf1; box-shadow: 0 10px 30px rgba(0, 0, 0, .28); font-size: 11.5px; pointer-events: none; display: flex; flex-direction: column; gap: 3px; }
.ctx-tip[hidden] { display: none; }
.ctx-tip-head { display: flex; align-items: center; gap: 6px; margin-bottom: 2px; }
.ctx-tip-head .grow { flex: 1; }
.ctx-tip-head span:last-child { color: #a1a1aa; }
.ctx-tip-row { display: flex; gap: 10px; color: #b9b9c1; }
.ctx-tip-row .n { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ctx-tip-row.on { color: #fff; font-weight: 500; }
.ctx-tip-more { color: #85858d; font-size: 10.5px; }
.ctx-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: -4px; }
.ctx-leg { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--fg-2); cursor: default; padding: 2px 0; }
.ctx-leg .v { color: var(--muted); }
.ctx-leg:hover .n { color: var(--fg); }
.ctx-contents { display: flex; flex-direction: column; gap: 6px; padding-top: 12px; border-top: 1px solid var(--line); }
.ctx-contents-head { display: flex; align-items: center; gap: 10px; min-width: 0; }
.ctx-contents-head .segs { max-width: 100%; overflow-x: auto; scrollbar-width: none; flex: none; }
.ctx-contents-head .segs .opt { height: 20px; padding: 0 9px; font-size: 11px; white-space: nowrap; flex: none; }
:where(.ctx-card.max520) .ctx-contents-head { flex-wrap: wrap; }
:where(.ctx-card.max520) .ctx-contents-head .segs { flex: 1 1 100%; }
.ctx-rows { display: flex; flex-direction: column; }
.ctx-row { display: flex; align-items: center; gap: 8px; min-height: 26px; padding: 0 6px; margin: 0 -6px; border-radius: 6px; font-size: 12px; }
.ctx-row:hover { background: var(--pill); }
.ctx-name { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 6px; overflow: hidden; white-space: nowrap; }
.ctx-name b { font-weight: 500; color: var(--fg); overflow: hidden; text-overflow: ellipsis; flex: none; max-width: 100%; }
.ctx-name small { color: var(--faint); font-size: 11px; overflow: hidden; text-overflow: ellipsis; direction: rtl; text-align: left; min-width: 0; }
.ctx-x { font-size: 11px; color: var(--muted); }
.ctx-tag { flex: none; font-family: var(--code-font, var(--code)); font-size: 10px; padding: 1px 5px; border-radius: 4px; background: var(--pill); color: var(--muted); }
.ctx-mini { flex: none; width: 72px; height: 4px; border-radius: 2px; background: var(--k-free); overflow: hidden; }
.ctx-mini i { display: block; height: 100%; border-radius: 2px; background: var(--k); }
.ctx-v { flex: none; width: 48px; text-align: right; color: var(--fg-2); font-size: 11.5px; }
:where(.ctx-card.max420) :is(.ctx-mini, .ctx-tag) { display: none; }
.ctx-empty { font-size: 12px; color: var(--muted); padding: 4px 0; }
.ctx-more { align-self: flex-start; margin-top: 2px; font-size: 11.5px; }
.ctx-foot { display: flex; align-items: center; gap: 10px; min-width: 0; font-size: 11px; color: var(--muted); }
.ctx-crumbs { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--code-font, var(--code)); font-size: 10.5px; color: var(--muted); }
.ctx-note { white-space: nowrap; flex: none; }
.ctx-session { display: flex; align-items: center; gap: 12px; margin-top: -4px; }
.ctx-session .ctx-spark { flex: 1; height: 34px; }
.ctx-spark { position: relative; display: block; width: 100%; }
.ctx-spark svg { display: block; width: 100%; height: 100%; overflow: visible; }
.ctx-spark .at { position: absolute; width: 7px; height: 7px; margin: -3.5px 0 0 -3.5px; border-radius: 50%; background: var(--card); border: 1.6px solid var(--k-chat); box-sizing: border-box; pointer-events: none; }
.ctx-spark .win { stroke: var(--line); stroke-dasharray: 3 3; stroke-width: 1; vector-effect: non-scaling-stroke; }
.ctx-spark .area { fill: color-mix(in srgb, var(--k-chat) 14%, transparent); }
.ctx-spark .line { fill: none; stroke: var(--k-chat); stroke-width: 1.5; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.ctx-spark .hit { fill: transparent; cursor: pointer; }
.ctx-spark .hit:hover { fill: color-mix(in srgb, var(--fg) 7%, transparent); }
/* Routing: the card under the story of the request */
.rt-log .ctx-card { margin-top: 12px; }
/* folded: its head alone, how full it is beside the title */
.ctx-fold { display: inline-flex; flex: none; align-items: center; gap: 6px; height: 22px; margin: -1px 0 -1px -4px; padding: 0 6px 0 4px; border: 0; border-radius: 6px; background: none; color: inherit; font: inherit; cursor: pointer; }
.ctx-fold:hover { background: var(--pill); }
.ctx-fold .tw { display: inline-flex; width: 10px; flex: none; color: var(--faint); }
.ctx-fold .tw svg { transition: transform .2s var(--ease, ease); }
.ctx-card.shut .ctx-fold .tw svg { transform: rotate(-90deg); }
.ctx-short { display: none; flex: none; font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.ctx-card.shut .ctx-short { display: inline; }
/* the padding is the open card's, so the title stays where it is when it
opens and the page doesn't follow it (it moved 4px with a 10px one) */
.ctx-card.shut > :not(.ctx-head) { display: none; }
/* its head alone, the space under it is the space over it */
.ctx-card.shut { padding-bottom: 14px; }
/* folded, the head is one line of a fixed height whatever a live request
puts in it, so nothing under it moves; a thin bar of what fills the
window, a part each, takes the room between the figure and the model */
.ctx-card.shut .ctx-head { height: 20px; white-space: nowrap; flex-wrap: nowrap; }
/* folded, the bar takes the room and the model id gives it up first. A
narrower card keeps the agent's icon alone, a narrow one no route and
the state's dot without its word; only past that is the figure cut, so
nothing is drawn over another */
.ctx-card.shut .ctx-end { flex: 0 1 auto; }
.ctx-card.shut.max520 :is(.ctx-who-n, .ctx-sep, .ctx-what) { display: none; }
.ctx-card.shut.max420 .ctx-route { display: none; }
.ctx-card.shut.max420 .ctx-end { flex: none; }
.ctx-card.shut.max420 .ctx-state { padding: 0 7px; }
.ctx-card.shut.max420 .ctx-state-w { display: none; }
.ctx-card.shut.max420 .ctx-short { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.ctx-stack { display: none; flex: 1 1 0; min-width: 24px; max-width: 360px; height: 6px; border-radius: 3px; background: var(--k-free); overflow: hidden; }
.ctx-card.shut .ctx-stack { display: flex; }
.ctx-stack i { flex: none; height: 100%; background: var(--k); transition: width .3s var(--ease, ease); }
@media (prefers-reduced-motion: reduce) { .ctx-stack i { transition: none; } }
/* the Usage page's Context tab */
.ctx-agents { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); gap: 12px; margin: 4px 0 18px; }
.ctx-agent, .ctx-tune { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px 12px; display: flex; flex-direction: column; gap: 12px; min-width: 0; font-variant-numeric: tabular-nums; }
.ctx-agent-head { display: flex; align-items: center; gap: 10px; min-width: 0; }
.ctx-who-box { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.ctx-who-box .ctx-who { display: flex; align-items: center; gap: 8px; min-width: 0; }
.ctx-who-box .ctx-who .ic { width: 20px; height: 20px; flex: none; }
.ctx-who-box .ctx-who b { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ctx-who-sub { font-size: 11px; color: var(--muted); }
.ctx-grade { display: flex; flex-direction: column; align-items: center; gap: 2px; flex: none; }
.ctx-grade-word { font-size: 10.5px; font-weight: 600; }
.ctx-ring { position: relative; width: 52px; height: 52px; --tone: var(--accent); }
.ctx-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ctx-ring circle { fill: none; stroke-width: 5; stroke-linecap: round; }
.ctx-ring .track { stroke: var(--k-free); }
.ctx-ring .arc { stroke: var(--tone); stroke-dashoffset: var(--to); animation: ctx-arc .9s var(--ease, ease) backwards; }
.ctx-pane.still .ctx-waffle > i, .ctx-pane.still .ctx-bar i, .ctx-pane.still .ctx-ring .arc { animation: none; }
@keyframes ctx-arc { from { stroke-dashoffset: 163.36; } }
.ctx-ring b { position: absolute; inset: 0; display: grid; place-items: center; font-size: 16px; font-weight: 650; letter-spacing: -.02em; }
.ctx-ring.great, .ctx-grade-word.great { --tone: var(--green); color: var(--green); }
.ctx-ring.good, .ctx-grade-word.good { --tone: var(--c2); color: var(--c2); }
.ctx-ring.fair, .ctx-grade-word.fair { --tone: var(--amber); color: var(--amber); }
.ctx-ring.poor, .ctx-grade-word.poor { --tone: var(--red); color: var(--red); }
/* colorblind mode turns --c2 amber, as fair's; good keeps a blue, its
palette's --c1 (#2073) */
:root[data-colorblind="1"] :is(.ctx-ring, .ctx-grade-word).good { --tone: var(--c1); color: var(--c1); }
.ctx-ring b { color: var(--fg); }
.ctx-scores { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 18px; }
.ctx-score { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 8px; font-size: 11.5px; color: var(--fg-2); cursor: default; }
.ctx-score .ctx-bar { height: 4px; }
.ctx-score .ctx-bar i { background: var(--green); }
.ctx-score.warn .ctx-bar i { background: var(--amber); }
.ctx-score.bad .ctx-bar i { background: var(--red); }
.ctx-score .v { color: var(--muted); font-size: 10.5px; }
.ctx-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.ctx-tags:empty { display: none; }
.ctx-chip { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 9px; border-radius: 11px; font-size: 11.5px; font-weight: 500; background: var(--pill); color: var(--fg-2); cursor: default; }
.ctx-chip i { width: 6px; height: 6px; border-radius: 50%; background: var(--c7); }
.ctx-chip.good { background: var(--green-soft); color: var(--green); }
.ctx-chip.good i { background: var(--green); }
.ctx-chip.warn { background: var(--amber-soft); color: var(--amber); }
.ctx-chip.warn i { background: var(--amber); }
.ctx-chip.info i { background: var(--accent); }
.ctx-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 12px; padding: 10px 0 2px; border-top: 1px solid var(--line); }
.ctx-fact { display: flex; flex-direction: column; gap: 2px; min-width: 0; cursor: default; }
.ctx-fact b { font-size: 15px; font-weight: 600; letter-spacing: -.01em; }
.ctx-fact .ctx-k { font-size: 9.5px; overflow: hidden; text-overflow: ellipsis; display: block; }
.ctx-mix { display: flex; flex-direction: column; gap: 6px; }
.ctx-share { display: flex; height: 8px; border-radius: 4px; overflow: hidden; gap: 2px; background: var(--k-free); }
.ctx-share i { display: block; min-width: 3px; background: var(--k); }
.ctx-mix-keys { display: flex; flex-wrap: wrap; gap: 2px 12px; font-size: 11px; color: var(--muted); }
.ctx-mix-keys span { display: inline-flex; align-items: center; gap: 5px; }
.ctx-agent-foot { display: flex; align-items: center; gap: 8px; min-width: 0; margin-top: auto; }
.ctx-models { display: flex; flex-wrap: wrap; gap: 4px; min-width: 0; }
.ctx-models code { font-family: var(--code-font, var(--code)); font-size: 10.5px; padding: 2px 6px; border-radius: 5px; background: var(--pill); color: var(--fg-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.ctx-agent-foot .text { flex: none; font-size: 11.5px; }
.ctx-sess-head { margin-top: 6px; }
.ctx-sess-head .segs .opt { height: 20px; padding: 0 9px; font-size: 11px; }
.ctx-sess-list { display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.ctx-sess + .ctx-sess { border-top: 1px solid var(--line-2, var(--line)); }
.ctx-sess-row { all: unset; box-sizing: border-box; width: 100%; display: grid; grid-template-columns: 20px minmax(0, 1.3fr) minmax(80px, 1fr) 44px minmax(0, auto) 92px; align-items: center; gap: 12px; padding: 8px 14px; cursor: pointer; font-size: 12px; font-variant-numeric: tabular-nums; }
.ctx-sess-row:hover { background: var(--pill); }
.ctx-sess-row:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.ctx-sess-row .ic { width: 18px; height: 18px; }
.ctx-sess-name { display: flex; flex-direction: column; min-width: 0; gap: 1px; }
.ctx-sess-name b { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ctx-sess-name b.raw { font-family: var(--code-font, var(--code)); font-weight: 500; letter-spacing: .02em; }
.ctx-sess-name code { font-family: var(--code-font, var(--code)); font-size: 10.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ctx-sess-row .ctx-spark { height: 24px; }
.ctx-sess-peak { justify-self: end; font-weight: 600; }
.ctx-sess-peak.ok { color: var(--green); }
.ctx-sess-peak.warn { color: var(--amber); }
.ctx-sess-peak.bad { color: var(--red); }
.ctx-sess-meta, .ctx-sess-when { color: var(--muted); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ctx-sess-when { text-align: right; }
.ctx-sess.open { background: var(--card-2); }
.ctx-sess.open > .ctx-card { margin: 0 12px 12px; }
@media (max-width: 640px) {
.ctx-sess-row { grid-template-columns: 20px minmax(0, 1fr) 64px 40px; }
.ctx-sess-meta, .ctx-sess-when { display: none; }
.ctx-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.ctx-scores { grid-template-columns: 1fr; }
.ctx-top { grid-template-columns: 1fr; }
}
.ctx-none { display: flex; flex-direction: column; gap: 4px; align-items: center; padding: 48px 16px; color: var(--muted); font-size: 12.5px; text-align: center; background: var(--card); border: 1px dashed var(--line); border-radius: 14px; }
.ctx-none b { color: var(--fg); font-size: 13.5px; font-weight: 600; }
@media (prefers-reduced-motion: reduce) {
.ctx-waffle > i, .ctx-bar i, .ctx-ring .arc, .ctx-state.live i { animation: none; }
.ctx-waffle > i { transition: none; }
}
/* Safari 15: no color-mix, so the free cells and the line's area are
tinted by opacity */
@supports not (color: color-mix(in srgb, red 50%, blue)) {
:root { --k-free: rgba(128, 128, 128, .12); }
i.dot.free { box-shadow: inset 0 0 0 1px var(--line); }
.ctx-spark .area { fill: var(--k-chat); fill-opacity: .14; }
.ctx-spark .hit:hover { fill: var(--line); }
}
/* tuned for you */
.ctx-tune { gap: 10px; }
.ctx-tune-total { font-size: 12px; font-weight: 600; color: var(--green); background: var(--green-soft); border-radius: 11px; padding: 3px 10px; white-space: nowrap; }
.ctx-tune-row { display: flex; flex-direction: column; gap: 10px; padding: 14px 0 4px; border-top: 1px solid var(--line); min-width: 0; }
.ctx-tune-title { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.ctx-tune-title b { font-size: 13px; font-weight: 600; flex: none; }
.ctx-tunes { align-items: start; }
.ctx-tunes > :only-child { grid-column: 1 / -1; }
.ctx-tune-title code { font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.ctx-tune-vals { display: flex; align-items: flex-end; gap: 12px; min-width: 0; }
.ctx-tune-val { display: flex; flex-direction: column; gap: 2px; flex: none; }
.ctx-tune-val .ctx-k { font-size: 9.5px; }
.ctx-tune-val b { font-size: 18px; font-weight: 600; letter-spacing: -.01em; }
.ctx-tune-val.now b { color: var(--fg-2); }
.ctx-tune-row:not(.done) .ctx-tune-val.now b { text-decoration: line-through; text-decoration-color: var(--muted); text-decoration-thickness: 1px; color: var(--muted); }
.ctx-tune-val.best b { color: var(--green); }
.ctx-tune-arrow { color: var(--muted); font-size: 14px; padding-bottom: 3px; }
.ctx-tune-chart { position: relative; height: 112px; margin: 2px 6px 0; cursor: default; }
.ctx-tc-plot { position: absolute; inset: 0 0 18px; }
.ctx-tc-plot svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.ctx-tune-chart .hot { stop-color: var(--red); stop-opacity: .32; }
.ctx-tune-chart .cool { stop-color: var(--red); stop-opacity: .02; }
.ctx-tune-chart .level { stroke: var(--green); stroke-width: 1; stroke-dasharray: 3 4; vector-effect: non-scaling-stroke; opacity: .7; }
.ctx-tune-chart .line { fill: none; stroke: var(--red); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.ctx-tc-plot svg { animation: ctx-draw 1s var(--ease, ease) backwards; }
@keyframes ctx-draw { from { clip-path: inset(-20px 100% -20px 0); } to { clip-path: inset(-20px 0 -20px 0); } }
@keyframes ctx-pop { from { opacity: 0; transform: scale(.4); } }
.ctx-tc-dot { animation: ctx-pop .35s .8s var(--ease, ease) backwards; }
.ctx-tc-dot { position: absolute; width: 9px; height: 9px; margin: -4.5px 0 0 -4.5px; border-radius: 50%; border: 2px solid var(--card); box-sizing: border-box; }
.ctx-tc-dot.now { background: var(--red); box-shadow: 0 0 0 4px color-mix(in srgb, var(--red) 22%, transparent); width: 11px; height: 11px; margin: -5.5px 0 0 -5.5px; }
.ctx-tc-dot.worst { background: color-mix(in srgb, var(--red) 55%, var(--card)); }
.ctx-tc-dot.best { background: var(--green); box-shadow: 0 0 0 4px color-mix(in srgb, var(--green) 22%, transparent), 0 0 14px color-mix(in srgb, var(--green) 60%, transparent); width: 11px; height: 11px; margin: -5.5px 0 0 -5.5px; }
.ctx-tc-tag { position: absolute; bottom: calc(100% + 5px); left: 50%; transform: translateX(-50%); font-size: 11px; font-weight: 700; white-space: nowrap; color: var(--red); letter-spacing: -.01em; }
.ctx-tc-dot.best .ctx-tc-tag { color: var(--green); }
.ctx-tc-dot.worst .ctx-tc-tag { font-weight: 600; opacity: .8; }
.ctx-tc-tag.start { left: -4px; transform: none; }
.ctx-tc-tag.end { left: auto; right: -4px; transform: none; }
.ctx-tc-x { position: absolute; left: 0; right: 0; bottom: 0; height: 14px; font-size: 10px; color: var(--muted); }
.ctx-tc-x span { position: absolute; transform: translateX(-50%); white-space: nowrap; }
.ctx-tc-x span.start { transform: none; margin-left: -6px; }
.ctx-tc-x span.end { transform: translateX(-100%); margin-left: 6px; }
.ctx-tc-x span.best { color: var(--green); font-weight: 600; }
.ctx-tc-x span.now { color: var(--red); font-weight: 600; }
.ctx-pane.tune-still .ctx-tune-chart :is(svg, .ctx-tc-dot) { animation: none; }
@media (prefers-reduced-motion: reduce) { .ctx-tune-chart :is(svg, .ctx-tc-dot) { animation: none; } }
.ctx-tune-note { padding: 0 4px 12px; }
.ctx-tune-why { margin: 0; font-size: 12px; line-height: 1.5; color: var(--fg-2); }
/* what the advice doesn't weigh (#1854), quieter than the facts it follows */
.ctx-tune-caveat { margin: -4px 0 0; font-size: 11px; line-height: 1.45; color: var(--muted); overflow-wrap: anywhere; }
.ctx-tune-foot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; }
.ctx-tune-src { font-size: 11px; color: var(--muted); margin-top: -7px; overflow-wrap: anywhere; }
.ctx-tune-foot .grow { flex: 1; }
/* a part, a cell or an item clicked opens its text (masaka on Discord) */
.ctx-click { cursor: pointer; }
.ctx-leg.ctx-click { border-radius: 5px; }
.ctx-click:focus-visible { outline: 2px solid var(--accent, var(--fg)); outline-offset: 1px; }
.ctx-waffle > i:not(.free) { cursor: pointer; }
.modal .dialog.wide { width: min(880px, 100%); }
.modal .editor.ctx-view { height: min(760px, calc(100vh - 80px)); }
.modal .editor.ctx-view > .ehead { gap: 8px; }
.modal .editor.ctx-view > .ehead b { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ctx-view-total { flex: none; font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.modal .editor.ctx-view > .ebody { display: block; }
.ctx-view-body { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.ctx-view-note { margin: 0; font-size: 11.5px; color: var(--muted); }
.ctx-view-wait, .ctx-view-gone { margin: 0; padding: 12px 0; font-size: 12px; color: var(--muted); }
.ctx-vi-list { display: flex; flex-direction: column; gap: 2px; }
.ctx-vi { min-width: 0; border-radius: 8px; }
.ctx-vi.open { background: color-mix(in srgb, var(--fg) 3%, transparent); }
.ctx-vi-head { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 30px; padding: 0 8px; border: 0; border-radius: 8px; background: none; color: var(--fg); font: inherit; font-size: 12px; text-align: left; cursor: pointer; }
.ctx-vi-head:hover { background: var(--pill); }
.ctx-vi-head .grow { flex: 1; }
.ctx-vi-head .ctx-name { min-width: 0; }
.ctx-vi-head .tw { display: inline-flex; width: 10px; flex: none; color: var(--faint); }
.ctx-vi-head .tw svg { transform: rotate(-90deg); transition: transform .2s var(--ease, ease); }
.ctx-vi.open > .ctx-vi-head .tw svg { transform: none; }
.ctx-vi-text { display: flex; flex-direction: column; gap: 10px; padding: 4px 8px 10px 26px; min-width: 0; }
.ctx-piece { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.ctx-piece-head { display: flex; align-items: center; gap: 6px; min-height: 22px; }
.ctx-piece-head .grow { flex: 1; }
.ctx-role { font-size: 10.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.ctx-piece-name { font-family: var(--code-font, var(--code)); font-size: 11px; color: var(--fg-2); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ctx-piece-note { font-size: 11.5px; color: var(--muted); }
.ctx-text-box { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; min-width: 0; }
.ctx-text { margin: 0; width: 100%; box-sizing: border-box; padding: 8px 10px; border-radius: 6px; background: var(--pill); font-family: var(--code-font, var(--code)); font-size: 11.5px; line-height: 1.5; color: var(--fg); white-space: pre-wrap; overflow-wrap: anywhere; user-select: text; -webkit-user-select: text; }
.ctx-text-more[hidden] { display: none; }
.ctx-view-all { margin-right: auto; }
/* the window as a map (flohoeller's context map): each item a tile sized
by its tokens inside its part's, the free space hatched. The tiles glide
to their sizes as a live request grows; context.js lays them out */
.ctx-viz { position: relative; }
.ctx-viz[data-look="map"] > .ctx-waffle, .ctx-viz[data-look="grid"] > .ctx-map { display: none; }
.ctx-map { position: relative; width: 100%; aspect-ratio: 3.1 / 1; min-height: 132px; max-height: 232px; margin: -1.5px 0; }
:where(.ctx-card.max520) .ctx-map { aspect-ratio: 2 / 1; }
.ctx-tile {
--t-ease: cubic-bezier(.32, .72, 0, 1);
position: absolute; box-sizing: border-box; overflow: hidden; display: flex; flex-direction: column; gap: 1px;
padding: 7px 9px; border-radius: 7px; cursor: pointer;
background: color-mix(in srgb, var(--k) 11%, var(--card));
box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--k) 24%, transparent);
transition: left .62s var(--t-ease), top .62s var(--t-ease), width .62s var(--t-ease), height .62s var(--t-ease),
background-color .22s ease, box-shadow .22s ease, opacity .24s ease;
}
.ctx-tile .n { font-size: 11.5px; font-weight: 550; line-height: 1.25; color: color-mix(in srgb, var(--k) 72%, var(--fg)); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ctx-tile .v { font-size: 10.5px; line-height: 1.25; color: color-mix(in srgb, var(--k) 42%, var(--muted)); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ctx-tile.low { padding-top: 5px; padding-bottom: 5px; }
.ctx-tile.low .v { display: none; }
.ctx-tile.bare > * { visibility: hidden; }
.ctx-tile:hover, .ctx-tile.on {
background: color-mix(in srgb, var(--k) 19%, var(--card));
box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--k) 48%, transparent);
}
.ctx-tile.free {
--k: var(--fg); cursor: default;
background: repeating-linear-gradient(-45deg, color-mix(in srgb, var(--fg) 5.5%, transparent) 0 1px, transparent 1px 6px), color-mix(in srgb, var(--fg) 1.5%, var(--card));
box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--fg) 9%, transparent);
}
.ctx-tile.free .n { color: var(--muted); font-weight: 500; }
.ctx-tile.free .v { color: color-mix(in srgb, var(--muted) 78%, transparent); }
.ctx-tile.gone { pointer-events: none; }
.ctx-map[data-f] > .ctx-tile { opacity: .32; }
.ctx-map[data-f="system"] > .k-system, .ctx-map[data-f="tools"] > .k-tools, .ctx-map[data-f="skills"] > .k-skills,
.ctx-map[data-f="memory"] > .k-memory, .ctx-map[data-f="files"] > .k-files,
.ctx-map[data-f="results"] > .k-results, .ctx-map[data-f="chat"] > .k-chat,
.ctx-map[data-f="free"] > .free, .ctx-map[data-f="tile"] > .on { opacity: 1; }
.ctx-pane.still .ctx-tile { transition: none; }
@media (prefers-reduced-motion: reduce) { .ctx-tile { transition: background-color .2s, box-shadow .2s, opacity .2s; } }
.ctx-tip-head b { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ctx-tip-sub { color: #a1a1aa; font-size: 11px; }
/* the look: the map or the grid, the reader's pick */
.ctx-look { display: inline-flex; gap: 2px; margin-left: auto; padding: 2px; border-radius: 7px; background: var(--pill); align-self: center; }
.ctx-look-b { display: inline-grid; place-items: center; width: 24px; height: 20px; padding: 0; border: 0; border-radius: 5px; background: none; color: var(--faint); cursor: pointer; transition: background-color .2s ease, color .2s ease, box-shadow .2s ease; }
.ctx-look-b svg { fill: currentColor; }
.ctx-look-b:hover { color: var(--fg-2); }
.ctx-look-b.on { background: var(--card); color: var(--fg); box-shadow: 0 1px 2px rgba(0, 0, 0, .12), 0 0 0 .5px color-mix(in srgb, var(--fg) 10%, transparent); }
/* an image the request carried, in its text */
.ctx-pic { display: block; width: fit-content; max-width: 100%; margin: 4px 0 2px; padding: 0; border: 0; border-radius: 10px; overflow: hidden; background: color-mix(in srgb, var(--fg) 4%, transparent); box-shadow: 0 0 0 1px color-mix(in srgb, var(--fg) 9%, transparent); cursor: zoom-in; transform-origin: top left; opacity: 0; transition: opacity .4s ease; }
.ctx-pic.in { opacity: 1; }
.ctx-pic img { display: block; max-width: min(100%, 420px); max-height: 240px; width: auto; height: auto; object-fit: contain; }
.ctx-pic.open { cursor: zoom-out; }
.ctx-pic.open img { max-width: 100%; max-height: none; }
@media (prefers-reduced-motion: reduce) { .ctx-pic { transition: none; } }