/* Orbit: the main agent is a sun, and the other agents circle it in a deep blue sky. */

/* The app's own fonts, so every device shows the same ones and no page ever asks another site for them. */
@font-face { font-family: "Spectral"; font-style: italic; font-weight: 400; font-display: swap; src: url(/fonts/spectral-italic-400-latin-ext.woff2) format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Spectral"; font-style: italic; font-weight: 400; font-display: swap; src: url(/fonts/spectral-italic-400-latin.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Spectral"; font-style: italic; font-weight: 500; font-display: swap; src: url(/fonts/spectral-italic-500-latin-ext.woff2) format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Spectral"; font-style: italic; font-weight: 500; font-display: swap; src: url(/fonts/spectral-italic-500-latin.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Instrument Sans"; font-style: italic; font-weight: 400 700; font-display: swap; src: url(/fonts/instrument-sans-italic-400-700-latin-ext.woff2) format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Instrument Sans"; font-style: italic; font-weight: 400 700; font-display: swap; src: url(/fonts/instrument-sans-italic-400-700-latin.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Instrument Sans"; font-style: normal; font-weight: 400 700; font-display: swap; src: url(/fonts/instrument-sans-normal-400-700-latin-ext.woff2) format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Instrument Sans"; font-style: normal; font-weight: 400 700; font-display: swap; src: url(/fonts/instrument-sans-normal-400-700-latin.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "DM Mono"; font-style: normal; font-weight: 400; font-display: swap; src: url(/fonts/dm-mono-normal-400-latin-ext.woff2) format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "DM Mono"; font-style: normal; font-weight: 400; font-display: swap; src: url(/fonts/dm-mono-normal-400-latin.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "DM Mono"; font-style: normal; font-weight: 500; font-display: swap; src: url(/fonts/dm-mono-normal-500-latin-ext.woff2) format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "DM Mono"; font-style: normal; font-weight: 500; font-display: swap; src: url(/fonts/dm-mono-normal-500-latin.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  --sky-glow: #2C47F2;
  --sky-mid: #1530D0;
  --sky: #0D1EB0;
  --sky-edge: #0A1799;
  --night: #07126F;
  --night-2: #0B1A8C;
  --night-3: #12259F;
  --line: #27359A;
  --line-strong: #5B6BE0;
  --text: #F3F5FF;
  --muted: #C9D0FF;
  --ink: #07126F;
  --sun: #FFC83D;
  --sun-soft: #FFE29A;
  --coral: #FF8A6B;
  --aurora: #5FE3BC;
  --danger: #FFB3A3;
  --agent: var(--sun); /* the open agent's own color */
  --radius: 18px;
  --serif: Spectral, Georgia, "Iowan Old Style", "Noto Serif", serif;
  --sans: "Instrument Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "DM Mono", ui-monospace, "Cascadia Mono", "SF Mono", Consolas, monospace;
  --ease: cubic-bezier(.22, 1, .36, 1);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--sky-edge); color: var(--text); font: 15px/1.55 var(--sans); }
button, input, select, textarea { font: inherit; color: inherit; }
option, optgroup { background: var(--night); color: var(--text); }
code, pre { font-family: var(--mono); font-size: .9em; }
a { color: var(--sun-soft); }
:focus-visible { outline: 2px solid #FFFFFF; outline-offset: 3px; }
.icon { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; display: block; }

#app {
  --map-width: clamp(380px, 46vw, 720px);
  display: grid; grid-template-columns: var(--map-width) minmax(0, 1fr); height: 100vh; height: 100dvh;
  transition: grid-template-columns .5s var(--ease);
}
#app.map-collapsed { --map-width: 96px; }

/* ---------------------------------------------------------------- the sky */
#sidebar {
  position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: hidden;
  background: radial-gradient(circle at 50% 46%, var(--sky-glow) 0%, var(--sky-mid) 30%, var(--sky) 62%, var(--sky-edge) 100%);
}
#stars { position: absolute; inset: 0; pointer-events: none; }
#stars span { position: absolute; border-radius: 50%; background: #FFFFFF; animation: twinkle 4s ease-in-out infinite; }
.sky-top { position: relative; z-index: 2; display: flex; align-items: center; gap: 12px; padding: 18px 44px 0 24px; }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; margin-right: auto; }
.brand img { border-radius: 8px; flex: none; }
.brand-name { font: italic 500 34px/1.1 var(--serif); color: #FFFFFF; }
.conn { display: inline-flex; align-items: center; gap: 8px; font: 12.5px/1.3 var(--mono); white-space: nowrap; }
.conn::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: none; }
.conn.online::before { background: var(--aurora); }
.conn.offline::before { background: var(--sun); }
#toggle-map { flex: none; }

.orbit { position: relative; z-index: 1; flex: 1; min-height: 0; }
.rings, .constellation, .ticks { position: absolute; left: var(--cx); top: var(--cy); overflow: visible; pointer-events: none; }
.rings circle { fill: none; stroke: #FFFFFF; stroke-opacity: .5; stroke-width: 1.6; stroke-dasharray: 1 8; stroke-linecap: round; }
.ticks { animation: spin 180s linear infinite; }
.ticks circle { fill: none; stroke: #FFFFFF; stroke-opacity: .55; stroke-width: 7; }
.constellation path { fill: none; stroke: var(--sun); stroke-width: 1.6; stroke-dasharray: 6 6; opacity: 0; transition: opacity .3s; }
.constellation.on path { opacity: .95; }

.anchor { position: absolute; left: var(--cx); top: var(--cy); width: 0; height: 0; transition: transform 1s var(--ease); }
.planet { position: absolute; left: calc(var(--s) / -2); top: calc(var(--s) / -2); width: var(--s); height: var(--s); padding: 0; border: 0; border-radius: 50%; background: none; cursor: pointer; transition: width .6s var(--ease), height .6s var(--ease), left .6s var(--ease), top .6s var(--ease); }
.planet:hover { background: none; filter: brightness(1.08); }
.planet-body { display: block; width: 100%; height: 100%; animation: float 6s ease-in-out infinite; animation-delay: var(--delay, 0s); }
.planet .agent, .agent { display: block; width: 100%; height: 100%; overflow: visible; }
.agent-eyes { transform-box: fill-box; transform-origin: center; animation: blink 5.8s infinite; }
.agent-pupils { animation: look 9s ease-in-out infinite; }
.planet.fresh .planet-body { animation: pop .6s cubic-bezier(.3, 1.4, .5, 1) both; }
.planet.selected::after { content: ""; position: absolute; inset: -9px; border: 2px solid #FFFFFF; border-radius: 50%; pointer-events: none; }
.planet.needs::before { content: ""; position: absolute; inset: -7px; border: 4px solid var(--coral); border-radius: 50%; animation: ping 1.6s ease-out infinite; pointer-events: none; }
.planet.busy .planet-body { animation: wobble 1.1s ease-in-out infinite; }
.busy-ring { display: none; }
.planet.busy > .busy-ring { display: block; position: absolute; inset: -7px; border: 3px solid rgb(255 255 255 / .25); border-top-color: var(--agent-color, var(--sun)); border-radius: 50%; animation: spin 1.1s linear infinite; }
.planet.unread:not(.selected)::after { content: ""; position: absolute; right: 2%; top: 2%; width: 14px; height: 14px; border: 2px solid var(--sky); border-radius: 50%; background: var(--aurora); }
.planet-label { position: absolute; left: -84px; width: 168px; top: calc(var(--s) / 2 + 13px); text-align: center; pointer-events: none; transition: top .6s var(--ease); }
.anchor.label-above .planet-label { top: auto; bottom: calc(var(--s) / 2 + 9px); }
.planet-name { display: block; font: italic 400 22px/1.15 var(--serif); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.planet-note { display: block; font: 12px/1.4 var(--mono); color: #E8EBFF; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.planet-note.needs { color: #FFD0C4; }
.anchor.main .planet-name { font-size: 28px; font-weight: 500; }
.anchor.main .planet-note { color: var(--sun-soft); }
.moons { position: absolute; left: 0; top: 0; width: 0; height: 0; pointer-events: none; }
.moon-path { position: absolute; left: 0; top: 0; width: 0; height: 0; animation: spin 5s linear infinite; animation-delay: var(--moon-delay, 0s); }
.moon { position: absolute; left: -12px; top: calc(var(--s) / -2 - 28px); display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: #FFFFFF; color: var(--ink); animation: spin-back 5s linear infinite; animation-delay: var(--moon-delay, 0s); }
.moon.plain { left: -6px; top: calc(var(--s) / -2 - 20px); width: 12px; height: 12px; }
.add-planet { display: grid; place-items: center; border: 2px dashed #FFFFFF; background: rgb(255 255 255 / .1); color: #FFFFFF; transition: background .2s, width .6s var(--ease), height .6s var(--ease), left .6s var(--ease), top .6s var(--ease); }
.add-planet:hover { background: rgb(255 255 255 / .24); }

#sky-approvals { display: none; }
.sky-bottom { position: relative; z-index: 2; display: flex; flex-direction: column; gap: 6px; padding: 0 44px 12px 20px; }
.rooms-row { display: flex; align-items: center; gap: 6px; min-height: 44px; }
#rooms { display: flex; gap: 6px; min-width: 0; overflow-x: auto; scrollbar-width: none; padding: 3px; }
#rooms::-webkit-scrollbar { display: none; }
#rooms:empty { display: none; }
.new-room-label { display: none; }
#rooms:empty + #new-room { display: inline-flex; align-items: center; gap: 8px; padding: 0 18px 0 12px; border: 1.5px solid rgb(255 255 255 / .55); border-radius: 999px; }
#rooms:empty + #new-room .new-room-label { display: inline; font-weight: 500; }
#app.map-collapsed #rooms:empty + #new-room { padding: 0; border: 0; }
#app.map-collapsed #rooms:empty + #new-room .new-room-label { display: none; }
.room-pill { flex: none; display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 16px 0 20px; border: 1.5px solid rgb(255 255 255 / .55); border-radius: 999px; background: transparent; font-weight: 500; white-space: nowrap; }
.room-pill:hover { background: rgb(255 255 255 / .12); }
.room-pill.active { background: #FFFFFF; border-color: #FFFFFF; color: var(--ink); }
.room-minis { display: flex; flex: none; }
.room-minis .agent { width: 24px; height: 24px; margin-left: -7px; }
.room-pill .dot { margin-left: -2px; }
.tools { display: flex; justify-content: space-between; gap: 2px; }
.tool { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; flex: 1 1 0; min-width: 0; min-height: 52px; padding: 4px 2px; border: 0; border-radius: 14px; background: transparent; font: 11.5px/1.2 var(--mono); }
.tool:hover { background: rgb(255 255 255 / .12); }

/* The map collapsed: a slim rail with the same agents, tools and group chats. */
#app.map-collapsed .sky-top { flex-direction: column; padding: 14px 0 6px; gap: 8px; }
#app.map-collapsed .brand { margin: 0; }
#app.map-collapsed .brand-name, #app.map-collapsed .conn { font-size: 0; gap: 0; }
#app.map-collapsed .orbit { display: flex; flex-direction: column; align-items: center; gap: 6px; overflow-y: auto; scrollbar-width: none; padding: 8px 0; }
#app.map-collapsed .orbit::-webkit-scrollbar { display: none; }
#app.map-collapsed .rings, #app.map-collapsed .ticks, #app.map-collapsed .constellation, #app.map-collapsed .planet-label { display: none; }
#app.map-collapsed .anchor { position: relative; flex: none; left: auto; top: auto; width: 60px; height: 60px; transform: none !important; --s: 46px !important; }
#app.map-collapsed .anchor.main { --s: 56px !important; }
#app.map-collapsed .planet { left: calc(30px - var(--s) / 2); top: calc(30px - var(--s) / 2); }
#app.map-collapsed .planet.selected::after { inset: -5px; }
#app.map-collapsed .moons { left: 30px; top: 30px; }
#app.map-collapsed .moon { top: calc(var(--s) / -2 - 16px); width: 18px; height: 18px; left: -9px; }
#app.map-collapsed .moon .icon { width: 12px; height: 12px; }
#app.map-collapsed .sky-bottom { padding: 4px 0 10px; align-items: center; }
#app.map-collapsed .rooms-row { flex-direction: column; }
#app.map-collapsed #rooms { flex-direction: column; overflow: visible; }
#app.map-collapsed .room-pill { padding: 0; width: 46px; height: 46px; justify-content: center; }
#app.map-collapsed .room-pill .room-name, #app.map-collapsed .room-pill .room-minis, #app.map-collapsed .room-pill .dot { display: none; }
#app.map-collapsed .room-pill .room-glyph { display: block; }
#app.map-collapsed .tools { flex-direction: column; }
#app.map-collapsed .tool { flex: none; width: 56px; min-height: 44px; font-size: 0; gap: 0; }
.room-glyph { display: none; }

/* ---------------------------------------------------------------- the open agent */
#main { display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: hidden; border-radius: 36px 0 0 36px; background: var(--night); position: relative; z-index: 3; }
#dial { display: none; }
#bot-header { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 8px 18px; padding: 24px 36px 0; }
#bot-header:empty { display: none; }
.title { display: flex; align-items: center; gap: 14px; min-width: 0; flex: 1 1 200px; }
.title h1 { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 12px; margin: 0; font: italic 400 var(--name-size, 64px)/1.02 var(--serif); color: var(--agent); overflow-wrap: break-word; min-width: 0; transition: color .4s; }
.subtitle { color: #DDE2FF; font-size: 15px; margin-top: 4px; overflow-wrap: anywhere; }
.title-text { min-width: 0; }
.header-agent { flex: none; width: 58px; height: 58px; padding: 0; border: 0; border-radius: 50%; background: none; cursor: pointer; }
.header-agent:hover { background: none; filter: brightness(1.08); }
.header-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 6px; padding-top: 10px; }
.badge { display: inline-block; padding: 2px 10px; border: 1px solid var(--sun-soft); border-radius: 999px; color: var(--sun-soft); font: 12px/1.4 var(--mono); font-style: normal; vertical-align: 2px; white-space: nowrap; }
.chip { display: inline-flex; align-items: center; min-height: 36px; padding: 0 14px; border: 1px solid var(--line-strong); border-radius: 999px; font: 12.5px/1.3 var(--mono); white-space: nowrap; }
.chip.running { border-color: var(--agent); color: var(--agent); }
.chip.waiting { background: var(--coral); border-color: var(--coral); color: var(--ink); }
.members { display: flex; }
.members .agent { width: 30px; height: 30px; margin-left: -6px; }
.room-icon { flex: none; display: grid; place-items: center; width: 58px; height: 58px; border-radius: 50%; background: rgb(255 255 255 / .1); color: var(--sun); }
.icon-button.back { display: none; }

#tabs { display: flex; gap: 22px; padding: 6px 36px 0; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
#tabs::-webkit-scrollbar { display: none; }
#tabs:empty { border-bottom: 0; padding-top: 12px; }
.tab { flex: none; min-height: 44px; padding: 0; border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: none; color: #DDE2FF; font: 13px/1.2 var(--mono); letter-spacing: .05em; text-transform: uppercase; cursor: pointer; }
.tab:hover { background: none; color: #FFFFFF; }
.tab.active { color: var(--agent); border-bottom-color: var(--agent); }
#view { flex: 1; min-height: 0; display: flex; flex-direction: column; }

/* ---------------------------------------------------------------- chat */
.chat { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.messages { flex: 1; overflow-y: auto; padding: 16px 36px 8px; display: flex; flex-direction: column; gap: 18px; scrollbar-color: var(--line-strong) transparent; }
.messages > * { width: 100%; max-width: 780px; margin-left: auto; margin-right: auto; }
.msg { display: flex; flex-direction: column; }
.msg .bubble { overflow-wrap: anywhere; font-size: 16.5px; line-height: 1.55; word-spacing: .05em; }
.msg.user { align-items: flex-end; }
.msg.user .bubble { max-width: 80%; padding: 11px 18px; border-radius: 20px 20px 4px 20px; background: var(--text); color: var(--ink); }
.msg.user .bubble a { color: var(--ink); }
.msg.user .bubble code { background: rgb(7 18 111 / .1); }
.msg.bot .bubble { max-width: 66ch; }
.msg.peer .bubble { max-width: 66ch; padding: 11px 16px; border: 1px solid var(--line-strong); border-radius: 18px; }
.msg.peer.out { align-items: flex-end; }
.peer-label { font: 12.5px/1.4 var(--mono); color: var(--aurora); margin-bottom: 3px; }
.meta { display: flex; align-items: center; gap: 8px; margin-bottom: 5px; font: 12.5px/1.4 var(--mono); color: var(--who, var(--agent)); }
.meta .agent { width: 20px; height: 20px; flex: none; }
.meta time, .meta .when { color: var(--muted); }
.msg.user .meta, .msg.peer .meta { margin: 4px 2px 0; color: var(--muted); }
.system-note { align-self: center; width: auto !important; max-width: 90% !important; padding: 4px 14px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font: 12.5px/1.5 var(--mono); text-align: center; }
.system-note.error { color: var(--danger); border-color: #8D4A52; }
.activity { color: var(--muted); font-size: 13px; }
.activity summary { display: inline-flex; align-items: center; gap: 8px; min-height: 32px; padding: 2px 12px; border: 1px solid var(--line); border-radius: 999px; font: 12.5px/1.4 var(--mono); cursor: pointer; list-style: none; }
.activity summary::-webkit-details-marker { display: none; }
.activity summary:hover { color: #FFFFFF; border-color: var(--line-strong); }
.activity ol { display: flex; flex-direction: column; gap: 8px; margin: 10px 0 0 8px; padding: 0 0 0 18px; border-left: 2px dotted var(--line-strong); list-style: none; font: 13.5px/1.5 var(--mono); color: var(--text); }
.activity li { position: relative; overflow-wrap: anywhere; }
.activity li::before { content: ""; position: absolute; left: -26px; top: 4px; width: 12px; height: 12px; border-radius: 50%; background: var(--aurora); }
.activity li.fail::before { background: var(--coral); }
.activity .tool-name { color: var(--sun-soft); margin-right: 10px; }
.activity .preview { margin-top: 2px; color: var(--muted); font-size: 12.5px; white-space: pre-wrap; overflow-wrap: anywhere; }
.empty { margin: auto !important; width: auto !important; color: var(--muted); text-align: center; padding: 40px; }
.load-earlier { text-align: center; }

.md-h { font: italic 500 1.25em/1.3 var(--serif); margin: 10px 0 2px; }
.md-li { padding-left: 4px; }
.bubble pre { margin: 8px 0; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: #050D55; overflow-x: auto; white-space: pre; font-size: 13.5px; }
.bubble code { padding: 1px 5px; border-radius: 6px; background: var(--night-2); color: var(--sun-soft); }
.bubble pre code { padding: 0; background: none; color: inherit; }
.msg.user .bubble code { color: inherit; }

.chat-extras { flex: none; display: flex; flex-direction: column; gap: 8px; width: 100%; max-width: 852px; margin: 0 auto; padding: 0 36px; max-height: 55%; overflow-y: auto; }
.chat-extras > :empty { display: none; }
.live { padding: 14px 18px; border: 1px solid #3A4AB8; border-radius: var(--radius); }
.live-head { display: flex; align-items: center; gap: 10px; font: italic 500 20px/1.25 var(--serif); }
.live.helper-live { border-style: dashed; }
.live-tools { display: flex; flex-direction: column; gap: 7px; margin: 10px 0 2px 6px; padding: 0 0 0 18px; border-left: 2px dotted var(--line-strong); list-style: none; font: 13.5px/1.5 var(--mono); }
.live-tools li { position: relative; }
.live-line { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.live-mark { position: absolute; left: -25px; top: 5px; width: 12px; height: 12px; border-radius: 50%; background: var(--aurora); }
.live-tools li.running .live-mark { background: var(--sun); animation: glow 1s ease-in-out infinite; }
.live-tools li.fail .live-mark { background: var(--coral); }
.live-tools code { color: var(--sun-soft); margin-right: 8px; font-size: 1em; }
.thinking { margin-top: 8px; font-size: 13px; color: var(--muted); font-style: italic; white-space: pre-wrap; max-height: 84px; overflow: hidden; -webkit-mask-image: linear-gradient(transparent, #000 30%); mask-image: linear-gradient(transparent, #000 30%); }
.draft-text { margin-top: 8px; font-size: 15px; opacity: .9; }

.tasks { padding: 10px 16px; border: 1px solid var(--line); border-radius: var(--radius); font-size: 14px; }
.tasks summary { color: var(--muted); font: 12.5px/1.6 var(--mono); cursor: pointer; }
.tasks ul { list-style: none; margin: 6px 0 0; padding: 0; }
.tasks li { display: flex; gap: 8px; padding: 2px 0; }
.tasks li.done { color: var(--muted); text-decoration: line-through; }
.tasks li.done .tool-icon { color: var(--aurora); }
.tasks li.in_progress .tool-icon { color: var(--sun); }
.tool-icon { width: 14px; flex: none; text-align: center; }

.permission { display: flex; flex-direction: column; gap: 10px; padding: 18px 22px 20px; border-radius: 24px; background: var(--coral); color: var(--ink); }
.permission-title { margin: 0; font: italic 500 28px/1.12 var(--serif); text-wrap: balance; }
.permission pre { margin: 0; max-height: 200px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; font: 13.5px/1.55 var(--mono); }
.permission-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.permission button { min-height: 44px; padding: 0 20px; border: 2px solid var(--ink); background: transparent; color: var(--ink); font-weight: 600; }
.permission button:hover { background: rgb(7 18 111 / .12); }
.permission button.primary { background: var(--ink); color: #FFFFFF; }
.permission button.primary:hover { background: #0D1EB0; }
.permission button.danger { border-color: transparent; color: var(--ink); text-decoration: underline; }
.permission button:focus-visible { outline-color: var(--ink); }

.composer { flex: none; display: flex; align-items: flex-end; gap: 4px; width: calc(100% - 72px); max-width: 780px; margin: 8px auto 22px; padding: 5px; border: 1.5px solid var(--line-strong); border-radius: 30px; background: var(--sky); }
.composer:focus-within { border-color: #FFFFFF; }
.composer textarea { flex: 1; min-width: 0; min-height: 44px; max-height: 220px; padding: 10px 6px; border: 0; border-radius: 0; background: transparent; resize: none; font-size: 16.5px; line-height: 1.45; }
.composer textarea:focus { outline: none; }
.composer textarea::placeholder { color: var(--muted); }
.composer .icon-button.listening { color: var(--coral); animation: glow 1.2s ease-in-out infinite; }
.composer button[type="submit"] { flex: none; min-height: 44px; padding: 0 24px; border: 0; background: var(--agent); color: var(--ink); font-weight: 600; transition: background .4s, filter .15s; }
.composer button[type="submit"]:hover { background: var(--agent); filter: brightness(1.08); }
.attachments { flex: none; display: flex; flex-wrap: wrap; gap: 8px; width: 100%; max-width: 852px; margin: 0 auto; padding: 0 36px; }
.attachments:empty { display: none; }
.attachment { display: inline-flex; align-items: center; gap: 6px; padding: 4px 4px 4px 10px; border: 1px solid var(--line-strong); border-radius: 12px; font-size: 13.5px; }
.attachment img { width: 28px; height: 28px; object-fit: cover; border-radius: 6px; }
.attachment .icon-button { min-width: 32px; min-height: 32px; }
.msg-files { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.msg-files img { display: block; max-width: 240px; max-height: 180px; border-radius: 10px; }
.file-chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border: 1px solid currentColor; border-radius: 10px; font-size: 13.5px; text-decoration: none; color: inherit; }
.voice { display: flex; flex-direction: column; gap: 4px; min-width: 240px; }
.voice audio { width: 100%; max-width: 320px; height: 36px; }
.voice-transcript { font-size: 14px; line-height: 1.45; white-space: pre-wrap; }
.voice-transcript.muted { font-style: italic; opacity: .75; color: inherit; }
.voice-transcript.error { color: #A3271B; }
#recorder:empty { display: none; }
.recorder { display: flex; align-items: center; gap: 10px; padding: 8px 14px; border: 1px solid var(--line-strong); border-radius: var(--radius); font-size: 14px; }
.recorder .spacer { flex: 1; }
.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--coral); animation: glow 1.2s ease-in-out infinite; }
#rec-time { font-variant-numeric: tabular-nums; color: var(--muted); }

/* ---------------------------------------------------------------- tabs */
.pane { overflow-y: auto; padding: 20px 36px 40px; width: 100%; max-width: 860px; margin: 0 auto; scrollbar-color: var(--line-strong) transparent; }
.pane section { margin-bottom: 30px; }
.pane h2 { margin: 0 0 4px; font: italic 400 26px/1.2 var(--serif); }
.list { list-style: none; padding: 0; margin: 10px 0 0; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.list li { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--night-2); }
.list li:last-child { border-bottom: 0; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.row.spread { justify-content: space-between; flex-wrap: nowrap; align-items: flex-start; }
.row.spread p { margin: 0; }
.row label { flex: 1; }
label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: var(--muted); }
label.check { flex-direction: row; align-items: center; gap: 10px; color: var(--text); }
input, select, textarea { min-width: 0; max-width: 100%; padding: 9px 12px; border: 1.5px solid var(--line-strong); border-radius: 12px; background: var(--night-2); outline: none; }
input::placeholder, textarea::placeholder { color: #A9B3F5; }
input:focus, select:focus, textarea:focus { border-color: #FFFFFF; }
input:disabled, select:disabled { opacity: .6; }
input[type="checkbox"] { width: 18px; height: 18px; flex: none; accent-color: var(--sun); }
textarea { resize: vertical; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.danger-zone { border-top: 1px solid var(--line); padding-top: 20px; }
.look-row { display: flex; align-items: center; gap: 16px; margin-top: 10px; }
.look-row .agent { width: 84px; height: 84px; flex: none; }
.look-text { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; min-width: 0; }

/* ---------------------------------------------------------------- buttons */
button { min-height: 40px; padding: 7px 18px; border: 1px solid var(--line-strong); border-radius: 999px; background: transparent; cursor: pointer; }
button:hover { background: var(--night-3); }
button:disabled { opacity: .55; cursor: default; }
button.primary { background: var(--sun); border-color: var(--sun); color: var(--ink); font-weight: 600; }
button.primary:hover { background: var(--sun-soft); border-color: var(--sun-soft); }
button.danger { border-color: var(--danger); color: var(--danger); }
button.danger:hover { background: rgb(255 138 107 / .16); }
#main button.primary:not(.permission button) { background: var(--agent); border-color: var(--agent); transition: background .4s, border-color .4s, filter .15s; }
#main button.primary:not(.permission button):hover { filter: brightness(1.08); }
button.small { min-height: 36px; padding: 4px 14px; font-size: 13.5px; }
button.link { min-height: 0; padding: 0; border: 0; background: none; color: var(--sun-soft); font-size: 13px; }
button.link:hover { background: none; text-decoration: underline; }
.icon-button { display: inline-grid; place-items: center; min-width: 44px; min-height: 44px; padding: 0; border: 0; border-radius: 50%; background: none; color: inherit; }
.icon-button:hover { background: rgb(255 255 255 / .12); }

/* ---------------------------------------------------------------- dialogs and toasts */
dialog { width: min(600px, 94vw); padding: 0; border: 1px solid var(--line-strong); border-radius: 26px; background: var(--night); color: var(--text); box-shadow: 0 30px 80px rgb(0 0 20 / .6); scrollbar-color: var(--line-strong) transparent; }
dialog::backdrop { background: rgb(4 10 70 / .72); }
.dialog-body { display: flex; flex-direction: column; gap: 14px; padding: 24px 26px; }
.dialog-body h2 { margin: 0; font: italic 400 34px/1.1 var(--serif); }
fieldset { display: flex; flex-direction: column; gap: 12px; min-width: 0; margin: 0; padding: 12px 16px 16px; border: 1px solid var(--line-strong); border-radius: var(--radius); }
legend { padding: 0 8px; color: var(--sun-soft); font: 12.5px/1.4 var(--mono); }
.notice { margin: 0; padding: 12px 14px; border-radius: 14px; background: var(--night-3); border: 1px solid var(--line-strong); }
.result:empty { display: none; }
.result { padding: 9px 12px; border-radius: 12px; background: var(--night-2); font-size: 14px; }
.result.ok { color: #BDF5E1; background: #0B3A5C; }
.result.error { color: #FFD0C4; background: #4B1D5C; }
.pairing { padding: 12px 16px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--night-2); }
.pairing p { margin: 0 0 6px; }
.pair-code { margin: 4px 0 8px; font: 500 30px/1.2 var(--mono); letter-spacing: .12em; user-select: all; }
details summary { cursor: pointer; }
.skill { flex: 1; }
.skill pre { margin: 8px 0 0; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: #050D55; white-space: pre-wrap; }
/* Toasts don't catch taps meant for what's under them; only a button in one does. While a
   dialog is open, the app moves them into it (see placeToasts), so they show above it. */
#toasts { position: fixed; right: max(18px, env(safe-area-inset-right)); bottom: max(18px, env(safe-area-inset-bottom)); z-index: 10; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; pointer-events: none; }
.toast { max-width: 360px; padding: 10px 16px; border: 1px solid #FFFFFF; border-radius: 16px; background: var(--night-3); box-shadow: 0 6px 24px rgb(0 0 20 / .5); pointer-events: none; }
.toast.error { border-color: var(--coral); color: #FFD0C4; }
.toast button { margin-left: 8px; pointer-events: auto; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.stopped { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; height: 100vh; color: var(--muted); }
.stopped h1 { margin: 10px 0 0; color: var(--text); font: italic 400 34px/1.2 var(--serif); }
.spinner { display: inline-block; flex: none; width: 13px; height: 13px; border: 2px solid rgb(255 255 255 / .25); border-top-color: var(--agent); border-radius: 50%; animation: spin .8s linear infinite; }
.dot { flex: none; width: 8px; height: 8px; border-radius: 50%; }
.dot.running { background: var(--sun); animation: glow 1.2s ease-in-out infinite; }
.dot.waiting { background: var(--coral); }
.dot.unread { background: var(--aurora); }

/* The live browser view. */
@media (min-width: 721px) { dialog:has(.live-browser) { width: min(1100px, 96vw); } }
.live-browser { gap: 8px; }
.lb-bar { display: flex; align-items: center; gap: 8px; }
.lb-open { flex: 1; min-width: 0; display: flex; }
.lb-open input { flex: 1; min-width: 0; padding: 5px 12px; font-size: 14px; }
.lb-screen { position: relative; min-height: 120px; overflow: hidden; border: 1px solid var(--line-strong); border-radius: 12px; background: #FFFFFF; }
.lb-screen img { display: block; width: 100%; height: auto; cursor: pointer; touch-action: manipulation; }
.lb-screen img:not([src]) { display: none; }
.lb-note { min-height: 120px; padding: 40px 16px; text-align: center; background: var(--night-2); }
/* Over a page already shown, a note is a bar along the bottom. */
.lb-screen img[src] + .lb-note { position: absolute; left: 0; right: 0; bottom: 0; min-height: 0; padding: 8px 12px; background: rgb(7 18 111 / .92); }
.lb-note button { margin-left: 8px; }
.lb-type { display: flex; gap: 6px; }
.lb-type input { flex: 1; }
.lb-keys { display: flex; flex-wrap: wrap; gap: 6px; }

/* ---------------------------------------------------------------- making an agent */
@media (min-width: 721px) { dialog:has(.maker) { width: min(1040px, 96vw); } }
dialog:has(.maker) { overflow: hidden; }
.maker { display: grid; grid-template-columns: minmax(0, 42%) minmax(0, 1fr); max-height: min(92vh, 860px); }
.maker-stage { position: relative; display: flex; flex-direction: column; min-height: 620px; overflow: hidden; background: radial-gradient(circle at 50% 56%, var(--sky-glow) 0%, var(--sky-mid) 38%, var(--sky) 70%, var(--sky-edge) 100%); }
.maker-stage h2 { margin: 0; font: italic 500 46px/1.05 var(--serif); color: #FFFFFF; }
.maker-stage p { margin: 6px 0 0; max-width: 32ch; color: #E8EBFF; font-size: 15px; line-height: 1.45; }
.maker-head { position: relative; padding: 26px 30px 0; }
.maker-rings { position: absolute; left: 50%; top: 58%; width: 560px; height: 560px; margin: -280px 0 0 -280px; pointer-events: none; }
.maker-rings circle { fill: none; stroke: #FFFFFF; stroke-opacity: .55; stroke-width: 1.6; stroke-dasharray: 1 8; stroke-linecap: round; }
.maker-preview-box { position: relative; flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; min-height: 0; padding: 12px 12px 26px; }
.maker-preview { width: 210px; height: 210px; }
.maker-preview.bump { animation: bump .3s cubic-bezier(.3, 1.8, .5, 1); }
.maker-name { max-width: 100%; font: italic 500 36px/1.1 var(--serif); color: #FFFFFF; overflow-wrap: anywhere; text-align: center; }
.maker-combo { font: 13px/1.3 var(--mono); color: var(--sun-soft); }
.maker-sun { position: absolute; left: -44px; bottom: -44px; width: 150px; height: 150px; }
.maker-form { display: flex; flex-direction: column; gap: 14px; min-width: 0; padding: 26px 30px 24px; overflow-y: auto; scrollbar-color: var(--line-strong) transparent; }
.maker-close { align-self: flex-end; margin: -12px -14px -4px 0; }
.maker-fields { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: 12px; }
.maker-form label, .pick-head { font: 13px/1.4 var(--mono); color: #DDE2FF; }
.maker-form input, .maker-form textarea { font-family: var(--sans); font-size: 15px; color: #FFFFFF; }
.maker-form input[name="name"] { font: italic 400 22px/1.2 var(--serif); }
.pick { display: flex; flex-direction: column; gap: 6px; }
.pick-head { display: flex; justify-content: space-between; gap: 8px; }
.pick-head span:last-child { color: var(--sun-soft); }
.pick-grid { display: grid; gap: 6px; }
.pick-grid.nine { grid-template-columns: repeat(9, minmax(0, 1fr)); }
.pick-grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.pick-grid button { display: grid; place-items: center; min-width: 0; min-height: 52px; padding: 0; border: 2px solid transparent; border-radius: 14px; background: var(--night-2); color: var(--agent); transition: color .2s; }
.pick-grid button:hover { background: var(--night-3); }
.pick-grid button[aria-pressed="true"] { border-color: #FFFFFF; background: var(--sky-mid); }
.pick-grid button svg { width: 32px; height: 32px; overflow: visible; }
.pick-grid.colors button { min-height: 44px; border: 0; border-radius: 50%; background: var(--swatch); aspect-ratio: 1; }
.pick-grid.colors button[aria-pressed="true"] { box-shadow: 0 0 0 3px var(--night), 0 0 0 5px #FFFFFF; }
.pick-grid.eyes button { min-height: 56px; background: var(--agent); }
.pick-grid.eyes button:hover { background: var(--agent); filter: brightness(1.08); }
.pick-grid.eyes button[aria-pressed="true"] { background: var(--agent); }
.pick-grid.eyes svg { width: 68px; height: 39px; }
.maker-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-top: auto; }
.maker-actions .primary { min-height: 50px; padding: 0 28px; background: var(--agent); border-color: var(--agent); font-size: 16px; transition: background .2s; }
.maker-actions .primary:hover { background: var(--agent); filter: brightness(1.08); }
#look-surprise { display: inline-flex; align-items: center; gap: 8px; min-height: 50px; }
.maker .check { font-family: var(--sans); font-size: 14px; color: var(--text); }

/* ---------------------------------------------------------------- phones */
@media (max-width: 720px) {
  /* Two screens: the map of agents, then one chat full-screen. */
  #app, #app.map-collapsed { display: block; height: 100dvh; }
  #sidebar, #main { height: 100dvh; }
  #main { display: none; border-radius: 0; }
  #app.show-chat #sidebar { display: none; }
  #app.show-chat #main { display: flex; }
  #toggle-map { display: none; }
  .sky-top { padding: calc(14px + env(safe-area-inset-top)) 20px 0; }
  .sky-bottom { padding: 0 14px calc(8px + env(safe-area-inset-bottom)); }

  #sky-approvals { position: relative; z-index: 2; display: block; padding: 0 12px; }
  #sky-approvals .permission { margin-bottom: 6px; padding: 14px 16px; }
  #sky-approvals .permission-title { font-size: 24px; }
  #sky-approvals pre { max-height: 3.2em; overflow: hidden; font-size: 13px; }
  #sky-approvals .permission button { flex: 1 1 auto; }
  #sky-approvals .always { display: none; }

  .planet-name { font-size: 17px; }
  .planet-note { font-size: 11.5px; }
  .anchor.main .planet-name { font-size: 20px; }
  .anchor.main .planet-note { display: none; }

  /* The agents along a curve above the chat; it makes way when the keyboard is up. */
  #dial { position: relative; flex: none; display: block; height: 112px; border-radius: 0 0 26px 26px; background: radial-gradient(circle at 50% 40%, var(--sky-glow) 0%, var(--sky-mid) 45%, var(--sky) 100%); }
  #dial:empty { display: none; }
  #dial svg.dial-curve { position: absolute; left: 0; top: 0; width: 100%; height: 100%; }
  #dial svg.dial-curve path { fill: none; stroke: #FFFFFF; stroke-opacity: .55; stroke-width: 1.5; stroke-dasharray: 1 7; stroke-linecap: round; vector-effect: non-scaling-stroke; }
  .dial-agent { position: absolute; left: var(--x); top: var(--y); width: 46px; height: 46px; margin: -23px 0 0 -23px; padding: 0; border: 0; border-radius: 50%; background: none; }
  .dial-agent:hover { background: none; }
  .dial-agent.current { width: 72px; height: 72px; margin: -36px 0 0 -36px; }
  .dial-agent.add { display: grid; place-items: center; border: 2px dashed #FFFFFF; background: rgb(255 255 255 / .1); }
  .dial-agent.needs::before { content: ""; position: absolute; inset: -5px; border: 3px solid var(--coral); border-radius: 50%; animation: ping 1.6s ease-out infinite; }
  .dial-agent .moons { left: 50%; top: 50%; --s: 72px; }
  .dial-agent .moon { top: calc(var(--s) / -2 - 14px); width: 20px; height: 20px; left: -10px; }
  .dial-agent .moon .icon { width: 13px; height: 13px; }
  .dial-agent.current { z-index: 1; }

  .icon-button.back { display: inline-grid; }
  #bot-header { padding: 8px 12px 0 6px; gap: 2px 6px; flex-wrap: nowrap; align-items: center; }
  #dial:empty + #bot-header { padding-top: calc(10px + env(safe-area-inset-top)); }
  .title { gap: 6px; flex: 1 1 auto; }
  .title h1 { font-size: min(var(--name-size, 48px), 44px); }
  .title h1 .badge { display: none; }
  .header-agent { display: none; }
  .subtitle { display: none; }
  .header-actions { flex-wrap: nowrap; padding-top: 0; gap: 0; }
  .header-actions .chip { display: none; }
  .header-actions .chip.waiting, .header-actions .chip.running { display: inline-flex; min-height: 30px; padding: 0 10px; margin-right: 4px; }
  .header-actions .helper-chip { display: none; }
  .members { display: none; }
  #tabs { padding: 0 16px; gap: 16px; }
  .messages { padding: 12px 16px 6px; gap: 14px; }
  .msg.user .bubble { max-width: 88%; }
  .msg-files img { max-width: 100%; }
  .chat-extras, .attachments { padding: 0 12px; }
  .composer { width: calc(100% - 20px); margin: 6px auto calc(10px + env(safe-area-inset-bottom)); }
  .composer button[type="submit"] { padding: 0 18px; }
  .permission { padding: 14px 16px 16px; }
  .permission-title { font-size: 24px; }
  /* 16px text stops iPhones from zooming into a field when it gets focus. */
  .composer textarea, input, select, textarea { font-size: 16px; }

  dialog { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; margin: 0; border: 0; border-radius: 0; }
  .dialog-body { padding: calc(16px + env(safe-area-inset-top)) 16px calc(16px + env(safe-area-inset-bottom)); }
  .pane { padding: 14px 16px 30px; }

  .maker { display: flex; flex-direction: column; height: 100dvh; max-height: 100dvh; overflow-y: auto; }
  .maker-stage { flex: none; min-height: 310px; }
  .maker-stage p { display: none; }
  .maker-stage h2 { font-size: 34px; }
  .maker-head { padding: calc(14px + env(safe-area-inset-top)) 18px 0; }
  .maker-rings { top: 62%; }
  .maker-preview { width: 130px; height: 130px; }
  .maker-preview-box { padding: 4px 8px 14px; gap: 6px; }
  .maker-name { font-size: 28px; }
  .maker-sun { width: 110px; height: 110px; left: -34px; bottom: -34px; }
  .maker-form { padding: 16px 16px calc(18px + env(safe-area-inset-bottom)); overflow: visible; }
  .maker-close { position: absolute; right: 8px; top: calc(8px + env(safe-area-inset-top)); margin: 0; color: #FFFFFF; z-index: 2; }
  .maker-fields { grid-template-columns: 1fr; }
  .pick-grid.nine { grid-template-columns: repeat(5, minmax(0, 1fr)); }

  /* At the top on phones, clear of the Send button and a dialog's buttons. */
  #toasts { top: calc(8px + env(safe-area-inset-top)); bottom: auto; left: calc(10px + env(safe-area-inset-left)); right: calc(10px + env(safe-area-inset-right)); align-items: stretch; }
  .toast { max-width: none; }
}
@media (max-width: 720px) and (max-height: 560px) {
  #dial { display: none; }
}

/* Usage: stat tiles, ranked bars, tokens per day. One series, in the sun's yellow, which stands out on the dialog's blue. */
@media (min-width: 721px) { dialog:has(.usage) { width: min(760px, 96vw); } }
.usage { --series-1: #FFC83D; --series-1-hover: #FFD978; --axis: #5B6BE0; }
.usage.loading { opacity: .6; transition: opacity .15s; }
.usage h3 { margin: 0 0 8px; font: 13px/1.4 var(--mono); color: var(--sun-soft); font-weight: 400; }
.usage section { min-width: 0; }
.segmented { display: inline-flex; gap: 2px; align-self: flex-start; padding: 3px; border: 1px solid var(--line-strong); border-radius: 999px; }
.segmented button { border: 0; background: none; color: var(--muted); }
.segmented button:hover { color: var(--text); background: var(--night-2); }
.segmented button[aria-pressed="true"] { color: var(--ink); background: var(--sun); }
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.tile { min-width: 0; padding: 10px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--night-2); }
.tile-label, .tile-note { color: var(--muted); font-size: 12.5px; }
.tile-value { font: italic 400 30px/1.2 var(--serif); }
.tile-note { min-height: 1.4em; }
.ranked { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.ranked li { display: grid; grid-template-columns: minmax(84px, 9rem) minmax(0, 1fr) 4.2rem 4.6rem; gap: 10px; align-items: center; padding: 5px 8px; border-radius: 10px; outline: none; }
.ranked li:hover, .ranked li:focus-visible { background: var(--night-2); }
.ranked li:focus-visible { box-shadow: inset 0 0 0 1px #FFFFFF; }
.rk-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rk-track { height: 12px; }
.rk-bar { display: block; height: 100%; border-radius: 0 4px 4px 0; background: var(--series-1); }
.ranked li:hover .rk-bar, .ranked li:focus-visible .rk-bar { background: var(--series-1-hover); }
.rk-value, .rk-cost { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.rk-cost { color: var(--muted); }
.daily { margin: 0; }
.daily figcaption { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.dl-chart { display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-rows: 150px auto; column-gap: 8px; row-gap: 6px; margin-top: 10px; }
.dl-y { position: relative; min-width: 2.6em; color: var(--muted); font-size: 11.5px; font-variant-numeric: tabular-nums; }
.dl-y span { position: absolute; right: 0; transform: translateY(50%); line-height: 1; white-space: nowrap; }
.dl-plot { position: relative; display: flex; border-bottom: 1px solid var(--axis); }
.dl-grid { position: absolute; left: 0; right: 0; border-top: 1px solid var(--line); }
.dl-col { position: relative; flex: 1; min-width: 0; display: flex; align-items: flex-end; justify-content: center; border-radius: 4px; outline: none; }
.dl-col:focus-visible { box-shadow: inset 0 0 0 1px #FFFFFF; }
.dl-bar { width: min(24px, calc(100% - 2px)); border-radius: 4px 4px 0 0; background: var(--series-1); }
.dl-col:hover .dl-bar, .dl-col:focus-visible .dl-bar { background: var(--series-1-hover); }
.dl-x { grid-column: 2; display: flex; color: var(--muted); font-size: 11.5px; }
.dl-x span { flex: 1; min-width: 0; display: flex; justify-content: center; white-space: nowrap; }
.dl-x.sparse span:first-child { justify-content: flex-start; }
.dl-x.sparse span:last-child { justify-content: flex-end; }
.ranked.single .rk-track { visibility: hidden; }
.table-wrap { overflow-x: auto; margin-top: 8px; }
.usage-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.usage-table th, .usage-table td { padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.usage-table th:first-child { text-align: left; }
.usage-table thead th { color: var(--muted); font-weight: 500; }
.usage-table tbody th { font-weight: 400; }
.price-row { display: flex; flex-direction: column; gap: 6px; padding-top: 10px; border-top: 1px solid var(--line); }
.price-row .row { flex-wrap: nowrap; }
.price-row input { width: 100%; }
.viz-tip { position: fixed; z-index: 20; max-width: 300px; padding: 8px 12px; border: 1px solid #FFFFFF; border-radius: 12px; background: var(--night-3); box-shadow: 0 6px 24px rgb(0 0 20 / .5); font-size: 12.5px; line-height: 1.45; pointer-events: none; }
.viz-tip .value { display: block; font-size: 15px; }
.viz-tip .muted { margin-bottom: 3px; }
@media (max-width: 720px) {
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ranked li { grid-template-columns: minmax(72px, 7rem) minmax(0, 1fr) 3.6rem 4rem; gap: 8px; padding: 5px 4px; }
  .price-row .row { gap: 6px; }
}

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes spin-back { to { transform: rotate(-360deg); } }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
@keyframes wobble { 0%, 100% { transform: rotate(-3deg); } 50% { transform: rotate(3deg); } }
@keyframes blink { 0%, 93%, 100% { transform: scaleY(1); } 96.5% { transform: scaleY(.08); } }
@keyframes look { 0%, 62%, 100% { transform: translateX(0); } 70%, 82% { transform: translateX(-6px); } }
@keyframes ping { 0% { transform: scale(1); opacity: .95; } 100% { transform: scale(1.34); opacity: 0; } }
@keyframes twinkle { 0%, 100% { opacity: .25; } 50% { opacity: .95; } }
@keyframes pop { 0% { transform: scale(0); } 70% { transform: scale(1.14); } 100% { transform: scale(1); } }
@keyframes glow { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
@keyframes bump { 0% { transform: scale(1); } 45% { transform: scale(1.12) rotate(-4deg); } 100% { transform: scale(1); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
