/* Agent mode: a full-screen voice conversation with Momo. Momo sits in the middle and changes with the phase
   (data-phase: listening, sending, thinking, working, speaking, paused), the chat runs under him, the crew working
   now is a strip of faces at the top, and three big controls sit at the bottom. Every animation moves only
   transform or opacity, nothing changes size while the talk runs, and motion stops for reduced-motion. */

/* Registered so the tone can glide from one phase colour to the next instead of jumping. */
@property --tone { syntax: '<color>'; inherits: true; initial-value: var(--violet); }
@property --tone-soft { syntax: '<color>'; inherits: true; initial-value: rgba(124, 92, 224, .16); }

.agent-btn { position: relative; height: 48px; padding: 0 14px 0 12px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--butter-soft); color: var(--butter-ink); display: inline-flex; align-items: center; gap: 6px; flex: none; font: inherit; font-size: 14px; font-weight: 600; transition: transform .3s var(--ease), background .3s var(--ease); }
.agent-btn:hover { transform: translateY(-1px); background: var(--butter); }
.agent-btn:focus-visible { outline: 2px solid var(--pen); outline-offset: 2px; }
.dock .agent-btn { height: 40px; padding: 0 10px; }

html.agent-open, html.agent-open body { overflow: hidden; }

.agent {
  --tone: var(--violet);
  --tone-soft: rgba(124, 92, 224, .16);
  --presence: 148px;
  position: fixed; inset: 0; z-index: 80; overflow: hidden;
  display: grid; grid-template-rows: auto auto minmax(0, 1fr) auto; justify-items: center;
  background: var(--wash); color: var(--ink);
  opacity: 0; transform: scale(.985);
  transition: opacity .35s var(--ease), transform .5s var(--ease), --tone .9s var(--ease), --tone-soft .9s var(--ease);
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
.agent [hidden], .agent[hidden] { display: none !important; }
.agent.on { opacity: 1; transform: none; }
.agent[data-phase="sending"] { --tone: var(--ink-2); --tone-soft: rgba(93, 86, 76, .12); }
.agent[data-phase="thinking"] { --tone: var(--pen); --tone-soft: rgba(43, 79, 214, .14); }
.agent[data-phase="working"] { --tone: var(--mint-ink); --tone-soft: rgba(15, 107, 76, .14); }
.agent[data-phase="speaking"] { --tone: var(--rust); --tone-soft: rgba(194, 79, 40, .14); }
.agent[data-phase="paused"] { --tone: #A39A8C; --tone-soft: rgba(163, 154, 140, .16); }
.agent button:focus-visible, .agent a:focus-visible { outline: 2px solid var(--pen); outline-offset: 2px; }

/* ---------- soft moving light behind everything ---------- */
.agent-bg { position: absolute; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.agent-bg i { position: absolute; width: 70vmax; height: 70vmax; border-radius: 50%; background: radial-gradient(closest-side, var(--tone-soft), transparent 70%); will-change: transform; }
.agent-bg i:nth-child(1) { left: -25vmax; top: -30vmax; animation: agent-drift-a 26s ease-in-out infinite alternate; }
.agent-bg i:nth-child(2) { right: -30vmax; top: 10vh; opacity: .8; animation: agent-drift-b 32s ease-in-out infinite alternate; }
.agent-bg i:nth-child(3) { left: 10vw; bottom: -45vmax; opacity: .6; background: radial-gradient(closest-side, rgba(255, 225, 122, .35), transparent 70%); animation: agent-drift-a 38s ease-in-out infinite alternate-reverse; }
.agent > :not(.agent-bg) { position: relative; z-index: 1; }
/* Above the rest, so the crew card that opens under a chip is never covered by Momo. */
.agent > .agent-top { z-index: 3; }
@keyframes agent-drift-a { from { transform: translate3d(0, 0, 0) scale(1); } to { transform: translate3d(8vmax, 6vmax, 0) scale(1.12); } }
@keyframes agent-drift-b { from { transform: translate3d(0, 0, 0) scale(1.05); } to { transform: translate3d(-10vmax, 4vmax, 0) scale(.95); } }

/* ---------- top: who you are talking to, the crew, make small ---------- */
.agent-top { width: 100%; display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 16px; padding: 16px 24px 4px; }
.agent-tag { display: inline-flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 600; color: var(--ink-2); white-space: nowrap; }
.agent-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; background: var(--tone, var(--violet)); box-shadow: 0 0 0 4px var(--tone-soft, rgba(124, 92, 224, .16)); animation: pulse 2.4s var(--ease) infinite; }
.agent-icon { justify-self: end; width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line-2); background: rgba(var(--card-rgb), .75); color: var(--ink); display: grid; place-items: center; transition: background .2s var(--ease), transform .2s var(--ease); }
.agent-icon:hover { background: var(--card); transform: translateY(-1px); }

.agent-crew-wrap { position: relative; min-width: 0; max-width: min(760px, 62vw); }
.agent-crew { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 4px; }
.agent-crew::-webkit-scrollbar { display: none; }
.agent-crew-idle { display: inline-flex; align-items: center; height: 40px; padding: 0 16px; border-radius: 999px; background: rgba(var(--card-rgb), .6); border: 1px solid var(--line-2); font-size: 13.5px; color: var(--ink-3); white-space: nowrap; }
.agent-mate { flex: none; display: inline-flex; align-items: center; gap: 8px; width: 228px; height: 44px; padding: 0 14px 0 6px; border-radius: 999px; border: 1px solid var(--line-2); background: rgba(var(--card-rgb), .82); text-align: left; transition: background .2s var(--ease), border-color .2s var(--ease), transform .2s var(--ease); }
.agent-mate.enter { animation: agent-pop .35s var(--ease) both; }
.agent-mate:hover { background: var(--card); transform: translateY(-1px); }
.agent-mate[aria-expanded="true"] { border-color: var(--ink); background: var(--card); }
.agent-mate-face { position: relative; flex: none; }
.agent-mate-live { position: absolute; right: -1px; bottom: -1px; width: 10px; height: 10px; border-radius: 50%; background: #2BB673; box-shadow: 0 0 0 2px var(--card); }
.agent-mate-text { min-width: 0; display: flex; flex-direction: column; line-height: 1.15; }
.agent-mate-text b { font-size: 12.5px; }
.agent-mate-now { font-size: 12.5px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.agent-crew-detail { position: absolute; top: calc(100% + 6px); left: 50%; z-index: 3; width: min(360px, 90vw); transform: translateX(-50%); display: flex; flex-direction: column; gap: 6px; padding: 14px 16px; border-radius: 18px; background: var(--card); border: 1px solid var(--line-2); box-shadow: 0 24px 48px -28px rgba(29, 26, 22, .55); font-size: 14px; line-height: 1.45; animation: agent-pop-center .25s var(--ease) both; }
.agent-crew-detail span { color: var(--ink-2); }
.agent-crew-open { align-self: flex-start; margin-top: 4px; font-weight: 600; text-decoration: none; }

/* ---------- Momo and the one-word state ---------- */
.agent-hero { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 8px 16px 6px; }
.agent-words { display: flex; flex-direction: column; align-items: center; }
.agent-presence { position: relative; width: var(--presence); height: var(--presence); flex: none; display: grid; place-items: center; }
.ap-halo { position: absolute; inset: -22%; border-radius: 50%; background: radial-gradient(closest-side, var(--tone-soft), transparent 72%); animation: ap-breathe 5.5s ease-in-out infinite; }
.ap-ring { position: absolute; inset: 12%; border-radius: 50%; border: 1.5px solid var(--tone); opacity: 0; }
.ap-core { position: relative; width: 62%; height: 62%; border-radius: 50%; background: var(--butter-pale); overflow: hidden; box-shadow: 0 24px 46px -24px rgba(29, 26, 22, .55), 0 0 0 6px rgba(255, 255, 255, .95), 0 0 0 7px var(--tone-soft); transition: transform .6s var(--ease), filter .6s var(--ease); }
.ap-core img { width: 100%; height: 100%; object-fit: cover; }
.ap-orbit { position: absolute; inset: 2%; border-radius: 50%; opacity: 0; transition: opacity .4s var(--ease); }
.ap-orbit i { position: absolute; top: 50%; left: 50%; width: 8px; height: 8px; margin: -4px; border-radius: 50%; background: var(--tone); }
.ap-orbit i:nth-child(1) { transform: rotate(0deg) translateX(calc(var(--presence) * .48)); }
.ap-orbit i:nth-child(2) { transform: rotate(120deg) translateX(calc(var(--presence) * .48)); opacity: .6; }
.ap-orbit i:nth-child(3) { transform: rotate(240deg) translateX(calc(var(--presence) * .48)); opacity: .35; }
.agent-presence[data-phase="listening"] .ap-ring { animation: ap-ripple 3.2s var(--ease) infinite; }
.agent-presence[data-phase="listening"] .ap-ring-2 { animation-delay: 1.6s; }
.agent-presence[data-phase="thinking"] .ap-ring-1 { opacity: .7; border-style: dashed; inset: 8%; animation: spin 9s linear infinite; }
.agent-presence[data-phase="thinking"] .ap-core { animation: momo-bob 4s ease-in-out infinite; }
.agent-presence[data-phase="working"] .ap-orbit { opacity: 1; animation: spin 6s linear infinite; }
.agent-presence[data-phase="working"] .ap-ring-1 { opacity: .25; inset: 2%; }
.agent-presence[data-phase="speaking"] .ap-core { animation: ap-talk 1.1s ease-in-out infinite; }
.agent-presence[data-phase="speaking"] .ap-ring { animation: ap-ripple 1.6s var(--ease) infinite; }
.agent-presence[data-phase="speaking"] .ap-ring-2 { animation-delay: .8s; }
.agent-presence[data-phase="sending"] .ap-core { transform: scale(.96); }
/* Paused: the rings stop and Momo rests, a little faded, so it reads as "not hearing you" at a glance. */
.agent-presence[data-phase="paused"] .ap-halo { animation-duration: 9s; opacity: .55; }
.agent-presence[data-phase="paused"] .ap-core { transform: scale(.94); filter: saturate(.55); }
.agent-presence[data-phase="paused"] .ap-ring-1 { opacity: .5; border-style: dashed; }
.agent-presence::after { content: ''; position: absolute; right: 12%; bottom: 12%; width: 32px; height: 32px; border-radius: 50%; background: var(--ink) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='var(--card)' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 9v6h4l5 4V5L8 9z'/%3E%3Cpath d='M17 9l4 6M21 9l-4 6'/%3E%3C/svg%3E") center / 17px no-repeat; box-shadow: 0 0 0 4px var(--card); opacity: 0; transform: scale(.6); transition: opacity .3s var(--ease), transform .4s var(--ease); }
.agent-presence.muted::after { opacity: 1; transform: none; }
@keyframes ap-breathe { 0%, 100% { transform: scale(.94); opacity: .85; } 50% { transform: scale(1.04); opacity: 1; } }
@keyframes ap-ripple { 0% { transform: scale(1); opacity: .5; } 100% { transform: scale(1.55); opacity: 0; } }
@keyframes ap-talk { 0%, 100% { transform: scale(1); } 20% { transform: scale(1.035); } 45% { transform: scale(.99); } 70% { transform: scale(1.025); } }

/* Fixed line boxes: a longer word or hint never pushes the chat up or down. */
.agent-state { margin-top: 10px; height: 44px; font-size: 40px; font-weight: 700; letter-spacing: -0.04em; line-height: 44px; color: var(--ink); white-space: nowrap; }
.agent-sub { margin: 4px 0 0; height: 22px; max-width: min(46ch, 92vw); font-size: 15.5px; line-height: 22px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- the chat ---------- */
.agent-thread { width: min(720px, 100%); min-height: 0; overflow-y: auto; overscroll-behavior: contain; display: flex; flex-direction: column; gap: 14px; padding: 18px 20px 12px; mask-image: linear-gradient(to bottom, transparent 0, #000 22px, #000 calc(100% - 10px), transparent 100%); scrollbar-width: thin; }
.agent-empty { margin: auto 0; text-align: center; font-size: 15px; color: var(--ink-3); }
/* The chat sits at the bottom, near the controls, and grows upward like a messaging app. */
.agent-empty[hidden] + * { margin-top: auto; }
.agent-turn { display: flex; gap: 10px; max-width: 100%; font-size: 16px; line-height: 1.55; }
.agent-turn.enter { animation: agent-turn-in .4s var(--ease) both; }
.agent-turn.you { align-self: flex-end; flex-direction: column; align-items: flex-end; max-width: 82%; }
.agent-turn.momo { align-self: flex-start; max-width: 92%; }
.agent-bubble { padding: 11px 16px; border-radius: 20px; overflow-wrap: anywhere; }
.agent-turn.you .agent-bubble { background: var(--ink); color: var(--on-ink); border-bottom-right-radius: 6px; }
.agent-turn.momo .agent-bubble { background: rgba(var(--card-rgb), .92); border: 1px solid var(--line-2); border-bottom-left-radius: 6px; box-shadow: 0 14px 30px -24px rgba(29, 26, 22, .45); }
.agent-turn-face { width: 30px; height: 30px; flex: none; border-radius: 50%; background: var(--butter-pale); margin-top: 4px; }
.agent-turn-col { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.agent-turn-quote { display: block; margin-bottom: 4px; padding-left: 8px; border-left: 3px solid var(--butter); font-size: 12.5px; opacity: .75; }
/* Momo's words as tidy text: real bold, lists and links, never raw symbols. */
.agent-bubble.rich > * { margin: 0; }
.agent-bubble.rich > * + * { margin-top: 8px; }
.agent-bubble.rich ul, .agent-bubble.rich ol { padding-left: 20px; }
.agent-bubble.rich li + li { margin-top: 3px; }
.agent-bubble.rich strong { font-weight: 650; }
.agent-bubble.rich .rt-h { font-size: 16px; font-weight: 700; letter-spacing: -0.01em; }
.agent-bubble.rich code { font-family: var(--mono); font-size: 13.5px; background: var(--fill); padding: 1px 5px; border-radius: 5px; }
.agent-bubble.rich pre { font-family: var(--mono); font-size: 13px; line-height: 1.5; white-space: pre; overflow-x: auto; background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.agent-bubble.rich pre code { background: none; padding: 0; font-size: inherit; }
.agent-bubble.rich a { color: var(--pen); text-underline-offset: 2px; }
/* A long answer is a card showing its first lines; "Show all" opens the rest. */
.agent-bubble.long { max-height: 15.5em; overflow: hidden; mask-image: linear-gradient(to bottom, #000 calc(100% - 64px), transparent); }
.agent-bubble.long.open { max-height: none; mask-image: none; }
.agent-turn-actions { display: flex; gap: 6px; min-height: 26px; padding-left: 4px; }
.agent-more, .agent-turn-reply { height: 26px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line-2); background: rgba(var(--card-rgb), .85); color: var(--ink-2); font-size: 12.5px; font-weight: 600; transition: background .2s var(--ease), color .2s var(--ease), border-color .2s var(--ease); }
.agent-more { color: var(--ink); }
.agent-more:hover, .agent-turn-reply:hover { background: var(--card); color: var(--ink); border-color: var(--ink-3); }
.agent-turn-reply.on { background: var(--butter-soft); border-color: var(--butter-edge); color: var(--butter-ink); }
/* What he is saying right now: one bubble that only changes its words, with Send beside it. */
.agent-turn.live, .agent-turn.held { align-self: flex-end; flex-direction: row; align-items: flex-end; gap: 8px; max-width: 88%; }
.agent-turn.live .agent-bubble, .agent-turn.held .agent-bubble { background: rgba(var(--card-rgb), .7); color: var(--ink); border: 1.5px dashed var(--tone); border-bottom-right-radius: 6px; }
.agent-turn.held .agent-bubble { color: var(--ink-3); font-style: italic; border-color: var(--line-2); }
.agent-live-text::after { content: ''; display: inline-block; width: 2px; height: 1em; margin-left: 3px; vertical-align: -2px; background: var(--tone); animation: ember 1s steps(2) infinite; }
.agent-turn.held .agent-live-text::after { display: none; }
.agent-send { flex: none; display: inline-flex; align-items: center; gap: 6px; height: 44px; padding: 0 18px; border-radius: 999px; border: 0; background: var(--tone); color: #FFFFFF; font-size: 15px; font-weight: 700; box-shadow: 0 12px 24px -14px var(--tone); transition: transform .2s var(--ease); }
.agent-send:hover { transform: translateY(-1px); }
.agent-send:active { transform: scale(.97); }

/* Things he can open or answer, in the chat where they happened. */
.agent-card { align-self: flex-start; display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; align-items: center; gap: 12px; width: min(560px, 100%); padding: 12px 12px 12px 14px; border-radius: 18px; background: rgba(var(--card-rgb), .88); border: 1px solid var(--line-2); box-shadow: 0 14px 30px -26px rgba(29, 26, 22, .5); }
.agent-card.enter { animation: agent-turn-in .4s var(--ease) both; }
.agent-card-body { min-width: 0; display: flex; flex-direction: column; gap: 3px; font-size: 14px; line-height: 1.4; }
.agent-card-head { font-size: 12.5px; color: var(--ink-3); }
.agent-card-title { font-size: 15px; font-weight: 650; overflow-wrap: anywhere; }
.agent-card-text { color: var(--ink-2); }
.agent-card-shot { display: block; margin-top: 6px; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); max-width: 280px; }
.agent-card-shot img { width: 100%; height: auto; max-height: 170px; object-fit: cover; object-position: top; }
.agent-card-open { align-self: center; height: 40px; padding: 0 16px; border-radius: 999px; border: 0; background: var(--ink); color: var(--on-ink); font-size: 14px; font-weight: 650; white-space: nowrap; transition: transform .2s var(--ease); }
.agent-card-open:hover { transform: translateY(-1px); }
.ac-ask { border-color: rgba(194, 79, 40, .35); background: var(--peach); }
.ac-ask .agent-card-head { color: var(--rust); font-weight: 650; }
.ac-ask .agent-card-open { background: var(--rust); }
.ac-show { background: var(--butter-soft); border-color: var(--butter-edge); }

/* ---------- bottom: reply chip, first-time tip, the three controls ---------- */
.agent-dock { width: min(720px, 100%); display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 8px 16px 22px; }
.agent-reply { display: flex; align-items: center; gap: 8px; max-width: 100%; padding: 5px 6px 5px 14px; border-radius: 999px; background: var(--butter-soft); color: var(--butter-ink); border: 1px solid var(--butter-edge); font-size: 13.5px; animation: agent-pop .25s var(--ease) both; }
.agent-reply b { min-width: 0; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.agent-reply-label { flex: none; opacity: .8; }
.agent-reply-x { flex: none; width: 28px; height: 28px; border-radius: 50%; border: 0; background: transparent; color: inherit; display: grid; place-items: center; }
.agent-tip { margin-bottom: 10px; display: flex; align-items: center; gap: 12px; max-width: 100%; padding: 10px 10px 10px 16px; border-radius: 16px; background: var(--ink); color: var(--on-ink); font-size: 14.5px; line-height: 1.4; box-shadow: 0 18px 34px -20px rgba(29, 26, 22, .7); animation: agent-pop .35s var(--ease) .4s both; }
.agent-tip b { color: var(--butter); font-weight: 650; }
.agent-tip-x { flex: none; height: 36px; padding: 0 14px; border-radius: 999px; border: 0; background: rgba(var(--card-rgb), .16); color: var(--on-ink); font-weight: 650; font-size: 14px; }
.agent-ctls { display: flex; align-items: flex-start; justify-content: center; gap: clamp(20px, 6vw, 44px); }
.agent-ctl, .agent-primary { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 0; border: 0; background: none; color: var(--ink); font-size: 14px; font-weight: 650; -webkit-tap-highlight-color: transparent; }
.agent-ctl-icon { display: grid; place-items: center; width: 64px; height: 64px; border-radius: 50%; background: rgba(var(--card-rgb), .9); border: 1px solid var(--line-2); box-shadow: 0 14px 28px -22px rgba(29, 26, 22, .55); transition: transform .25s var(--ease), background .25s var(--ease), color .25s var(--ease), border-color .25s var(--ease); }
.agent-ctl:hover .agent-ctl-icon, .agent-primary:hover:not(:disabled) .agent-ctl-icon { transform: translateY(-2px); }
.agent-ctl:active .agent-ctl-icon, .agent-primary:active:not(:disabled) .agent-ctl-icon { transform: scale(.94); }
.agent-ctl.on .agent-ctl-icon { background: var(--ink); border-color: var(--ink); color: var(--on-ink); }
.agent-primary { margin-top: -10px; }
.agent-primary .agent-ctl-icon { width: 84px; height: 84px; background: var(--ink); border: 0; color: var(--on-ink); box-shadow: 0 0 0 6px var(--tone-soft), 0 22px 40px -22px rgba(29, 26, 22, .8); }
.agent-primary.on .agent-ctl-icon { background: var(--violet); box-shadow: 0 0 0 6px rgba(124, 92, 224, .18), 0 22px 40px -22px rgba(29, 26, 22, .8); }
.agent-primary:disabled { cursor: default; opacity: .6; }
.agent-end .agent-ctl-icon { color: var(--rust); border-color: rgba(194, 79, 40, .3); }
.agent-end:hover .agent-ctl-icon { background: var(--rust); color: var(--on-ink); border-color: var(--rust); }
@keyframes agent-turn-in { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes agent-pop { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes agent-pop-center { from { opacity: 0; transform: translate(-50%, -4px); } to { opacity: 1; transform: translateX(-50%); } }

/* ---------- minimised pill ---------- */
.agent-pill { position: fixed; left: 0; right: 0; margin: 0 auto; width: max-content; max-width: calc(100vw - 32px); bottom: 100px; z-index: 45; display: inline-flex; align-items: center; gap: 10px; padding: 8px 8px 8px 16px; border-radius: 999px; border: 0; background: var(--ink); color: var(--on-ink); font-size: 14px; box-shadow: 0 18px 34px -18px rgba(29, 26, 22, .7); animation: rise .4s var(--ease) both; }
.agent-pill[hidden] { display: none; }
.agent-pill[data-phase="thinking"] { --tone: #8EA4FF; }
.agent-pill[data-phase="working"] { --tone: #6EE7B7; }
.agent-pill[data-phase="speaking"] { --tone: #FF9A73; }
.agent-pill[data-phase="paused"] { --tone: #C9C1B3; }
.agent-pill.noted { background: #2A2520; box-shadow: 0 0 0 3px var(--butter), 0 18px 34px -18px rgba(29, 26, 22, .7); }
.agent-pill-text { min-width: 0; max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.agent-pill-open { padding: 6px 12px; border-radius: 999px; background: rgba(var(--card-rgb), .14); font-weight: 600; }

/* ---------- what Momo opened ---------- */
.shown-flash { animation: shown-glow 1.6s var(--ease); }
@keyframes shown-glow { 0% { box-shadow: 0 0 0 0 rgba(255, 225, 122, 0); } 18% { box-shadow: 0 0 0 4px var(--butter), 0 0 0 10px rgba(255, 225, 122, .35); } 100% { box-shadow: 0 0 0 0 rgba(255, 225, 122, 0); } }
.shown-card { position: fixed; right: 20px; bottom: 24px; z-index: 85; width: min(360px, calc(100vw - 32px)); display: flex; flex-direction: column; gap: 12px; padding: 14px; border-radius: var(--radius); background: var(--card); border: 1px solid var(--line-2); box-shadow: 0 28px 56px -28px rgba(29, 26, 22, .6); animation: rise .4s var(--ease) both; }
.shown-card-head { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; gap: 10px; align-items: center; }
.shown-card-head img { width: 36px; height: 36px; border-radius: 50%; background: var(--butter-pale); }
.shown-card-head > span { min-width: 0; display: flex; flex-direction: column; font-size: 14px; }
.shown-card-label { font-size: 12.5px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shown-card .btn { justify-content: center; }


@media (max-height: 760px) {
  .agent { --presence: 112px; }
  .agent-state { height: 38px; font-size: 32px; line-height: 38px; margin-top: 6px; }
}

@media (max-width: 860px) {
  .agent { --presence: 104px; }
  .agent-btn { height: 44px; padding: 0 12px 0 10px; }
  .agent-top { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: 'tag icon' 'crew crew'; gap: 8px 12px; padding: 10px 16px 0; }
  .agent-tag { grid-area: tag; }
  .agent-icon { grid-area: icon; }
  .agent-crew-wrap { grid-area: crew; max-width: 100%; }
  .agent-crew { padding: 2px 0; }
  .agent-mate { width: 196px; }
  .agent-crew-detail { left: 0; transform: none; width: 100%; animation-name: agent-pop; }
  .agent-hero { padding: 4px 16px 0; }
  .agent-state { height: 36px; font-size: 30px; line-height: 36px; margin-top: 6px; }
  .agent-sub { font-size: 14.5px; }
  .agent-thread { padding: 14px 16px 10px; gap: 12px; }
  .agent-turn { font-size: 15.5px; }
  .agent-turn.you, .agent-turn.live, .agent-turn.held { max-width: 92%; }
  .agent-card { grid-template-columns: 32px minmax(0, 1fr); }
  .agent-card-open { grid-column: 2; justify-self: start; }
  .agent-dock { padding: 6px 16px calc(14px + env(safe-area-inset-bottom)); }
  .agent-ctl-icon { width: 60px; height: 60px; }
  .agent-primary .agent-ctl-icon { width: 76px; height: 76px; }
  .shown-card { right: 16px; bottom: calc(90px + env(safe-area-inset-bottom)); }
  .agent-pill { bottom: calc(160px + env(safe-area-inset-bottom)); }
}

@media (prefers-reduced-motion: reduce) {
  .agent, .agent-turn, .agent-card, .agent-mate, .agent-tip, .agent-reply, .agent-crew-detail, .agent-pill, .shown-card, .shown-flash { animation: none !important; transition: none; }
  .agent-bg i, .ap-halo, .ap-ring, .ap-core, .ap-orbit, .agent-dot, .agent-live-text::after { animation: none !important; }
  .agent-presence[data-phase="listening"] .ap-ring-1, .agent-presence[data-phase="speaking"] .ap-ring-1 { opacity: .35; }
}
