/* The floating assistant (Components/Layout/AssistantHost.razor): the logo's eclipse, slowly alive, carrying a conversation
   from page to page. The eclipse markup and colours are the page loader's (app.css "page loading"); only its pace and the
   states are set here. Below Bootstrap's modals (1050) so a dialog still covers it, above the pet (pet.css) and tool runs. */

.rl-assist {
    --assist-size: 56px;
    --assist-glow: rgba(168, 85, 247, 0.55);
    --assist-ink: #ede9fe;
    position: fixed;
    z-index: 1040;
    width: var(--assist-size);
    height: var(--assist-size);
    transition: left .35s var(--rl-ease, ease), top .35s var(--rl-ease, ease), opacity .3s ease;
    touch-action: none;
}
.rl-assist.is-dragging { transition: none; }

/* ── the eclipse ───────────────────────────────────────────────────────────────────────────────────────────────── */
.rl-assist__orb {
    position: relative;
    display: block;
    width: 100%;
    height: 100%;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    cursor: grab;
    animation: rl-assist-float 7s ease-in-out infinite;
    -webkit-tap-highlight-color: transparent;
}
.rl-assist.is-dragging .rl-assist__orb { cursor: grabbing; animation: none; transform: scale(1.08); }
.rl-assist__orb:focus-visible { outline: 2px solid var(--rl-accent); outline-offset: 6px; }

.rl-assist__eclipse { --eclipse-size: 100%; width: 100%; height: 100%; pointer-events: none; }
/* Slower than the page loader's: this one lives on the screen, and something always spinning fast is a distraction. */
.rl-assist__eclipse .eclipse__sun { animation-duration: 14s; }
.rl-assist__eclipse .eclipse__corona { inset: -75%; animation-duration: 5.5s; }
/* Motion's transport sits where this glow would otherwise wash over Cache & play and the ruler. */
body:has(.mo) .rl-assist__eclipse .eclipse__corona { inset: -28%; }
.rl-assist__orb:hover .rl-assist__eclipse .eclipse__corona { animation-duration: 2.6s; }

/* Halloween's witch's hat (AssistantHost.WearsHat): sits on the moon tipped left, clear of the dot at the top right. A pale
   edge keeps the dark hat from vanishing into a dark or true-black page. */
.rl-assist__hat {
    position: absolute;
    left: -12%;
    top: -45%;
    width: 96%;
    height: auto;
    overflow: visible;
    transform: rotate(-14deg);
    transform-origin: 50% 85%;
    pointer-events: none;
    filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .45));
}
.rl-assist__hat-cone, .rl-assist__hat-brim { fill: #1e1432; stroke: #c4b5fd; stroke-width: 1.4; stroke-linejoin: round; }
.rl-assist__hat-band { fill: #a855f7; }
.rl-assist__hat-buckle { fill: none; stroke: #f59e0b; stroke-width: 1.4; }

/* A ring that only shows in a state: listening ripples it outward, asking makes it amber. */
.rl-assist__ring {
    position: absolute;
    inset: -6px;
    border-radius: 50%;
    border: 2px solid transparent;
    pointer-events: none;
    opacity: 0;
}

.rl-assist__badge {
    position: absolute;
    top: -2px;
    right: -2px;
    min-width: 14px;
    height: 14px;
    padding: 0 3px;
    border-radius: 7px;
    background: #a855f7;
    border: 2px solid var(--rl-bg);
    color: #fff;
    font: 700 10px/10px var(--rl-font);
    text-align: center;
    pointer-events: none;
    animation: rl-assist-pop .3s ease-out both;
}
.rl-assist__badge--ask { background: #f59e0b; min-width: 18px; height: 18px; border-radius: 9px; line-height: 14px; font-size: 11px; }
/* Shade's number, at the foot of the eclipse: the assistant's own dot keeps the top to itself. */
.rl-assist__badge--shade {
    top: auto;
    bottom: -4px;
    right: -6px;
    min-width: 19px;
    height: 19px;
    padding: 0 4px;
    border-radius: 10px;
    background: #5865f2;
    font-size: 10.5px;
    line-height: 15px;
}
.rl-assist__badge--shade.is-urgent { background: #ef4444; }

/* Muted or deafened in talk mode: a struck-through microphone, headphones or both, at the foot of the eclipse on the side
   Shade's number leaves free. */
.rl-assist__mark {
    position: absolute;
    bottom: -4px;
    left: -6px;
    display: inline-flex;
    align-items: center;
    gap: 1px;
    height: 19px;
    padding: 0 3px;
    border-radius: 10px;
    background: var(--rl-bg);
    border: 1px solid color-mix(in srgb, var(--rl-danger) 60%, transparent);
    color: var(--rl-danger);
    pointer-events: none;
    animation: rl-assist-pop .3s ease-out both;
}
.rl-assist__mark svg { width: 12px; height: 12px; }

.rl-assist[data-state="thinking"] .eclipse__sun { animation-duration: 2.2s; }
.rl-assist[data-state="thinking"] .eclipse__corona { animation-duration: 1.8s; }

.rl-assist[data-state="speaking"] .eclipse__corona { animation: rl-assist-speak .9s ease-in-out infinite; }

.rl-assist[data-state="listening"] .rl-assist__ring {
    border-color: rgba(196, 181, 253, 0.85);
    animation: rl-assist-ripple 2s ease-out infinite;
}

.rl-assist[data-state="ask"] .rl-assist__ring {
    border-color: rgba(245, 158, 11, 0.9);
    animation: rl-assist-ripple 1.4s ease-out infinite;
}

/* Shade's turn at the ring, only while the assistant has nothing of its own to say with it: red ripples for a direct
   message or a mention, a steady green one for a call in progress. */
.rl-assist[data-state="idle"][data-shade="mention"] .rl-assist__ring {
    border-color: rgba(239, 68, 68, 0.85);
    animation: rl-assist-ripple 1.8s ease-out infinite;
}
.rl-assist[data-state="idle"][data-shade="call"] .rl-assist__ring { border-color: rgba(34, 197, 94, 0.9); opacity: 1; }

@keyframes rl-assist-float { 0%, 100% { transform: translateY(0) rotate(0deg); } 50% { transform: translateY(-4px) rotate(-3deg); } }
@keyframes rl-assist-speak { 0%, 100% { opacity: .75; transform: scale(.96); } 50% { opacity: 1; transform: scale(1.12); } }
@keyframes rl-assist-ripple { 0% { opacity: .9; transform: scale(.9); } 100% { opacity: 0; transform: scale(1.45); } }
@keyframes rl-assist-pop { from { transform: scale(0); } to { transform: scale(1); } }
@keyframes rl-assist-in { from { opacity: 0; transform: translateY(6px) scale(.98); } to { opacity: 1; transform: none; } }

/* Put away: half of it peeks in from the screen's edge, dimmed, until it is clicked. */
.rl-assist--tucked { opacity: .72; }
.rl-assist--tucked:hover { opacity: 1; }
.rl-assist--tucked .rl-assist__orb { animation: none; }

/* ── the speech bubble beside it ─────────────────────────────────────────────────────────────────────────────── */
.rl-assist__bubble {
    position: absolute;
    bottom: calc(100% + 10px);
    width: max-content;
    max-width: min(18rem, calc(100vw - 2rem));
    padding: .5rem .75rem;
    border-radius: 14px;
    border: 1px solid var(--rl-border);
    background: color-mix(in srgb, var(--rl-surface) 94%, transparent);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: var(--rl-shadow-md, 0 6px 24px rgba(0, 0, 0, .18));
    color: var(--rl-text);
    font-size: .86rem;
    line-height: 1.35;
    cursor: pointer;
    animation: rl-assist-in .25s var(--rl-ease, ease) both;
}
.rl-assist[data-side="left"] .rl-assist__bubble { right: 0; }
.rl-assist[data-side="right"] .rl-assist__bubble { left: 0; }
.rl-assist[data-vert="down"] .rl-assist__bubble { bottom: auto; top: calc(100% + 10px); }

/* ── the panel ─────────────────────────────────────────────────────────────────────────────────────────────── */
.rl-assist__panel {
    position: absolute;
    display: flex;
    flex-direction: column;
    /* --assist-panel-w / -h are set once the person has dragged the corner (AssistantHost.PositionStyle, js/assistant.js). */
    width: min(var(--assist-panel-w, 23rem), calc(100vw - 1.5rem));
    height: var(--assist-panel-h, min(32rem, calc(100vh - 6rem)));
    max-height: calc(100vh - 1rem);
    border: 1px solid var(--rl-border);
    border-radius: 18px;
    background: color-mix(in srgb, var(--rl-surface) 96%, transparent);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    box-shadow: 0 18px 48px rgba(12, 6, 32, .28), 0 0 0 1px rgba(168, 85, 247, .12);
    color: var(--rl-text);
    overflow: hidden;
    animation: rl-assist-in .22s var(--rl-ease, ease) both;
    cursor: auto;
    touch-action: auto;
}
/* Beside the eclipse, level with its top or its bottom, then moved back by however much of it that leaves off the screen
   (AssistantHost.Nudge) — from just past the middle of the screen that was its whole header. */
.rl-assist[data-side="left"] .rl-assist__panel { right: calc(100% + 12px - var(--assist-nudge-x, 0px)); }
.rl-assist[data-side="right"] .rl-assist__panel { left: calc(100% + 12px - var(--assist-nudge-x, 0px)); }
.rl-assist[data-vert="up"] .rl-assist__panel { bottom: calc(0px - var(--assist-nudge-y, 0px)); }
.rl-assist[data-vert="down"] .rl-assist__panel { top: calc(0px - var(--assist-nudge-y, 0px)); }
/* The panel is in the page for as long as the eclipse is (the Shade pane inside it has to outlive it being shut), so shut is
   the hidden attribute, which the display above would otherwise undo. */
.rl-assist__panel[hidden] { display: none !important; }
.rl-assist.is-resizing { user-select: none; -webkit-user-select: none; }
.rl-assist.is-resizing .rl-assist__panel { animation: none; }

/* ── the resize grip: the panel's corner away from the eclipse ─────────────────────────────────────────────── */
.rl-assist__resize {
    position: absolute;
    z-index: 3;
    width: 18px;
    height: 18px;
    touch-action: none;
    opacity: .55;
    transition: opacity .15s ease;
    background: linear-gradient(var(--grip-angle, 135deg), transparent 0 46%, var(--rl-text-muted) 46% 54%, transparent 54% 64%, var(--rl-text-muted) 64% 72%, transparent 72%);
}
.rl-assist__resize:hover, .rl-assist.is-resizing .rl-assist__resize { opacity: 1; }
.rl-assist[data-side="left"] .rl-assist__resize { left: 0; }
.rl-assist[data-side="right"] .rl-assist__resize { right: 0; }
.rl-assist[data-vert="up"] .rl-assist__resize { top: 0; }
.rl-assist[data-vert="down"] .rl-assist__resize { bottom: 0; }
/* Top-left and bottom-right drag along one diagonal, top-right and bottom-left along the other; the lines hug the corner. */
.rl-assist[data-side="left"][data-vert="up"] .rl-assist__resize { cursor: nwse-resize; --grip-angle: 315deg; }
.rl-assist[data-side="right"][data-vert="down"] .rl-assist__resize { cursor: nwse-resize; --grip-angle: 135deg; }
.rl-assist[data-side="right"][data-vert="up"] .rl-assist__resize { cursor: nesw-resize; --grip-angle: 225deg; }
.rl-assist[data-side="left"][data-vert="down"] .rl-assist__resize { cursor: nesw-resize; --grip-angle: 45deg; }

/* ── the two tabs: the conversation, and Shade ─────────────────────────────────────────────────────────────── */
.rl-assist__tabs {
    display: flex;
    gap: .25rem;
    padding: .4rem .5rem 0;
    border-bottom: 1px solid var(--rl-border);
    background: var(--rl-surface-sunken);
}
.rl-assist__tab {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .35rem .8rem .4rem;
    border: 1px solid transparent;
    border-bottom: 0;
    border-radius: 10px 10px 0 0;
    background: transparent;
    color: var(--rl-text-muted);
    font: inherit;
    font-size: .82rem;
    font-weight: 600;
    cursor: pointer;
    margin-bottom: -1px;
}
.rl-assist__tab:hover { color: var(--rl-text); }
.rl-assist__tab.is-on {
    border-color: var(--rl-border);
    background: color-mix(in srgb, var(--rl-surface) 96%, transparent);
    color: var(--rl-text);
    box-shadow: inset 0 2px 0 #a855f7;
}
.rl-assist__tab--shade.is-on { box-shadow: inset 0 2px 0 #5865f2; }
.rl-assist__tab:focus-visible { outline: 2px solid var(--rl-accent); outline-offset: -2px; }
.rl-assist__tabCount {
    min-width: 1.15rem;
    padding: 0 .3rem;
    border-radius: 999px;
    background: #5865f2;
    color: #fff;
    font-size: .66rem;
    font-weight: 700;
    line-height: 1.15rem;
    text-align: center;
}
.rl-assist__tabCount.is-urgent { background: #ef4444; }
.rl-assist__tabCount--ask { background: #f59e0b; }
.rl-assist__tabCount--dot { min-width: .5rem; width: .5rem; height: .5rem; padding: 0; background: #a855f7; }

.rl-assist__head {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: .25rem;
    padding: .6rem .6rem .55rem .9rem;
    border-bottom: 1px solid var(--rl-border);
    background: linear-gradient(120deg, rgba(124, 58, 237, .14), transparent 70%);
}
.rl-assist__title { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.rl-assist__title strong { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: .95rem; }

/* The title is a button: the way to another conversation. */
.rl-assist__switch {
    display: flex;
    align-items: center;
    gap: .2rem;
    max-width: 100%;
    margin: -.15rem 0 0 -.4rem;
    padding: .1rem .4rem;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
}
.rl-assist__switch:hover, .rl-assist__switch.is-on { background: rgba(168, 85, 247, .14); }
.rl-assist__switch:focus-visible { outline: 2px solid var(--rl-accent); outline-offset: 1px; }
.rl-assist__switch svg { flex: none; width: .9rem; height: .9rem; fill: none; stroke: var(--rl-text-muted); stroke-width: 1.8; transform: rotate(90deg); transition: transform .15s ease; }
.rl-assist__switch.is-on svg { transform: rotate(-90deg); }

.rl-assist__scrim { position: absolute; inset: 0; z-index: 1; border: 0; padding: 0; background: transparent; cursor: default; }
.rl-assist__switcher {
    position: absolute;
    top: calc(100% + 2px);
    left: .5rem;
    right: .5rem;
    max-height: min(17rem, calc(100vh - 12rem));
    overflow-y: auto;
    padding: .3rem;
    border: 1px solid var(--rl-border);
    border-radius: 12px;
    background: var(--rl-surface);
    box-shadow: 0 12px 32px rgba(12, 6, 32, .35);
    overscroll-behavior: contain;
    animation: rl-assist-in .14s ease-out both;
}
.rl-assist__pick {
    display: flex;
    align-items: baseline;
    gap: .6rem;
    width: 100%;
    padding: .4rem .6rem;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--rl-text);
    font: inherit;
    font-size: .86rem;
    text-align: left;
    cursor: pointer;
}
.rl-assist__pick span { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.rl-assist__pick small { flex: none; max-width: 40%; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; color: var(--rl-text-muted); font-size: .72rem; }
.rl-assist__pick:hover, .rl-assist__pick:focus-visible { background: rgba(168, 85, 247, .14); outline: none; }
.rl-assist__pick.is-on { background: rgba(168, 85, 247, .2); font-weight: 600; }
.rl-assist__pick--new { color: #a855f7; font-weight: 600; border-bottom: 1px solid var(--rl-border); border-radius: 8px 8px 0 0; margin-bottom: .25rem; }
.rl-assist__pickNote { margin: .4rem .6rem; color: var(--rl-text-muted); font-size: .8rem; }
.rl-assist__title small { color: var(--rl-text-muted); font-size: .75rem; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }

.rl-assist__icon {
    flex: none;
    display: inline-grid;
    place-items: center;
    width: 2rem;
    height: 2rem;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--rl-text-muted);
    cursor: pointer;
}
.rl-assist__icon svg { width: 1.05rem; height: 1.05rem; fill: none; stroke: currentColor; stroke-width: 1.6; }
.rl-assist__icon:hover { background: var(--rl-surface-sunken); color: var(--rl-text); }
.rl-assist__icon.is-on { background: rgba(168, 85, 247, .18); color: #a855f7; }
.rl-assist__icon.is-off { color: var(--rl-danger); }
.rl-assist__icon:disabled { opacity: .4; cursor: default; }
.rl-assist__icon:disabled:hover { background: transparent; color: var(--rl-text-muted); }

.rl-assist__log {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: .5rem;
    padding: .8rem .8rem .4rem;
    overscroll-behavior: contain;
}
.rl-assist__hint { color: var(--rl-text-muted); font-size: .85rem; margin: auto 0; text-align: center; padding: 0 1rem; }

.rl-assist__msg {
    max-width: 88%;
    padding: .5rem .7rem;
    border-radius: 14px;
    font-size: .88rem;
    line-height: 1.45;
    overflow-wrap: anywhere;
}
.rl-assist__msg--me { align-self: flex-end; background: var(--rl-bubble-user); color: var(--rl-bubble-user-text); white-space: pre-wrap; border-bottom-right-radius: 4px; }
.rl-assist__msg--it { align-self: flex-start; background: var(--rl-surface-raised); border: 1px solid var(--rl-border); border-bottom-left-radius: 4px; }
.rl-assist__msg--it > :first-child { margin-top: 0; }
.rl-assist__msg--it > :last-child { margin-bottom: 0; }
.rl-assist__msg--it p { margin: 0 0 .5em; }
.rl-assist__msg--it pre { font-size: .78rem; max-height: 12rem; overflow: auto; }
.rl-assist__msg--it img { max-width: 100%; border-radius: 8px; }
.rl-assist__msg--live { border-color: rgba(168, 85, 247, .35); }

.rl-assist__run { display: flex; align-items: center; gap: .45rem; font-size: .78rem; color: var(--rl-text-muted); padding-left: .2rem; }
.rl-assist__dot { width: .5rem; height: .5rem; border-radius: 50%; background: var(--rl-text-muted); flex: none; }
.rl-assist__run--running .rl-assist__dot { background: #a855f7; animation: rl-assist-speak 1s ease-in-out infinite; }
.rl-assist__run--awaitingapproval .rl-assist__dot { background: #f59e0b; }
.rl-assist__run--succeeded .rl-assist__dot { background: var(--rl-ok); }
.rl-assist__run--failed .rl-assist__dot, .rl-assist__run--denied .rl-assist__dot { background: var(--rl-danger); }

.rl-assist__typing { display: inline-flex; gap: 4px; padding: .2rem 0; }
.rl-assist__typing i { width: 6px; height: 6px; border-radius: 50%; background: #a855f7; animation: rl-assist-dots 1.2s ease-in-out infinite; }
.rl-assist__typing i:nth-child(2) { animation-delay: .15s; }
.rl-assist__typing i:nth-child(3) { animation-delay: .3s; }
@keyframes rl-assist-dots { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

.rl-assist__ask {
    border: 1px solid rgba(245, 158, 11, .55);
    background: rgba(245, 158, 11, .08);
    border-radius: 12px;
    padding: .55rem .7rem;
    font-size: .85rem;
}
.rl-assist__ask p { margin: 0 0 .35rem; }
.rl-assist__ask details { font-size: .75rem; color: var(--rl-text-muted); margin-bottom: .45rem; }
.rl-assist__ask pre { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 8rem; overflow: auto; margin: .3rem 0 0; }
.rl-assist__askRow { display: flex; gap: .4rem; }

.rl-assist__note { margin: 0; font-size: .8rem; color: var(--rl-danger); }

.rl-assist__compose {
    display: flex;
    align-items: flex-end;
    gap: .35rem;
    padding: .55rem .6rem .6rem;
    border-top: 1px solid var(--rl-border);
}
.rl-assist__compose textarea {
    flex: 1;
    min-height: 2.25rem;
    max-height: 7rem;
    resize: none;
    padding: .45rem .6rem;
    border: 1px solid var(--rl-border);
    border-radius: 12px;
    background: var(--rl-surface);
    color: var(--rl-text);
    font: inherit;
    font-size: .88rem;
    field-sizing: content;
}
.rl-assist__compose textarea:focus { outline: none; border-color: #a855f7; box-shadow: 0 0 0 3px rgba(168, 85, 247, .18); }
.rl-assist__send {
    flex: none;
    height: 2.25rem;
    padding: 0 .85rem;
    border: 0;
    border-radius: 12px;
    background: linear-gradient(135deg, #7c3aed, #a855f7);
    color: #fff;
    font-weight: 600;
    font-size: .85rem;
    cursor: pointer;
}
.rl-assist__send--stop { background: var(--rl-surface-sunken); color: var(--rl-text); border: 1px solid var(--rl-border); }

/* ── the right-click menu (built by js/assistant.js on <body>) ──────────────────────────────────────────────────── */
.rl-assist-menu {
    position: fixed;
    z-index: 1060;
    min-width: 13rem;
    padding: .3rem;
    border: 1px solid var(--rl-border);
    border-radius: 12px;
    background: color-mix(in srgb, var(--rl-surface) 97%, transparent);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 12px 36px rgba(12, 6, 32, .3);
    color: var(--rl-text);
    font-size: .86rem;
    animation: rl-assist-in .14s ease-out both;
}
.rl-assist-menu__item {
    display: flex;
    align-items: center;
    gap: .5rem;
    width: 100%;
    padding: .38rem .6rem .38rem .35rem;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: inherit;
    text-align: left;
    cursor: pointer;
}
.rl-assist-menu__item:hover:not(:disabled), .rl-assist-menu__item:focus-visible { background: rgba(168, 85, 247, .14); outline: none; }
.rl-assist-menu__item:disabled { opacity: .45; cursor: default; }
.rl-assist-menu__item.is-danger { color: var(--rl-danger); }
.rl-assist-menu__item kbd { margin-left: auto; padding: 0 .3rem; font-size: .68rem; color: var(--rl-text-muted); background: transparent; border: 1px solid var(--rl-border); border-radius: 4px; }
.rl-assist-menu__tick { width: 1rem; text-align: center; color: #a855f7; font-weight: 700; }
.rl-assist-menu__sep { height: 1px; margin: .3rem .4rem; background: var(--rl-border); }

/* ── small screens: the panel takes the bottom of the screen ──────────────────────────────────────────────── */
@media (max-width: 560px) {
    .rl-assist__panel {
        position: fixed;
        left: .5rem !important;
        right: .5rem !important;
        top: auto !important;
        bottom: .5rem !important;
        width: auto;
        height: min(30rem, calc(100vh - 5rem));
    }
    /* The panel already fills the width of the screen; there is nothing to drag. */
    .rl-assist__resize { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    .rl-assist, .rl-assist__orb { animation: none; transition: none; }
    .rl-assist__eclipse .eclipse__sun { animation-duration: 30s; }
    .rl-assist__eclipse .eclipse__corona, .rl-assist__ring, .rl-assist__typing i { animation: none; }
    .rl-assist[data-state="listening"] .rl-assist__ring, .rl-assist[data-state="ask"] .rl-assist__ring,
    .rl-assist[data-state="idle"][data-shade="mention"] .rl-assist__ring { opacity: 1; }
}

@media print { .rl-assist, .rl-assist-menu { display: none !important; } }

/* Docked in the browser extension's side panel (/extension/panel): no eclipse, the panel is the whole frame. */
.rl-assist--docked {
    position: fixed;
    inset: 0;
    width: auto;
    height: auto;
    transition: none;
    touch-action: auto;
}
.rl-assist--docked .rl-assist__orb,
.rl-assist--docked .rl-assist__bubble,
.rl-assist--docked .rl-assist__resize,
.rl-assist--docked .rl-shade__icon[title="Close"] { display: none; }
.rl-assist--docked .rl-assist__panel {
    position: absolute;
    /* Over the side and corner rules above, which place a floating panel beside its eclipse. */
    inset: 0 !important;
    width: auto;
    height: auto;
    max-height: none;
    transform: none;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    animation: none;
}

/* ── the assistant's pointer (js/screen-sense.js) ──────────────────────────────────────────────────────────────────────
   Where screen_act is about to press something: an arrow of its own that glides from the eclipse to the control, a ring
   round the control, a ripple when it presses. Never takes the mouse (pointer-events: none) and sits over everything. */
#rl-sense-pointer {
    position: fixed;
    left: 0;
    top: 0;
    z-index: 2147483646;
    width: 30px;
    height: 30px;
    margin: -3px 0 0 -3px;
    pointer-events: none;
    opacity: 0;
    transform: translate(-60px, -60px);
    transition-property: transform, opacity;
    transition-duration: 500ms, 180ms;
    transition-timing-function: cubic-bezier(.45, .05, .25, 1), ease;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, .45));
}
#rl-sense-pointer.is-on { opacity: 1; }
.rl-sense-pointer__arrow {
    fill: var(--rl-accent);
    stroke: #fff;
    stroke-width: 1.4;
    stroke-linejoin: round;
}
.rl-sense-pointer__tap {
    position: absolute;
    left: -9px;
    top: -9px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid var(--rl-accent);
    opacity: 0;
}
#rl-sense-pointer.is-tap .rl-sense-pointer__tap { animation: rl-sense-tap 520ms ease-out; }
@keyframes rl-sense-tap {
    from { opacity: .9; transform: scale(.4); }
    to { opacity: 0; transform: scale(1.8); }
}
#rl-sense-ring {
    position: fixed;
    z-index: 2147483645;
    pointer-events: none;
    border: 2px solid var(--rl-accent);
    border-radius: 8px;
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--rl-accent) 25%, transparent);
    opacity: 0;
    transition: opacity 220ms ease;
}
#rl-sense-ring.is-on { opacity: 1; }
@media (prefers-reduced-motion: reduce) {
    #rl-sense-pointer { transition-duration: 0ms, 0ms; }
    #rl-sense-pointer.is-tap .rl-sense-pointer__tap { animation: none; }
}

/* Words from another window being read aloud by the Narrator on this page (js/narrator-here.js), so they can be followed. */
.rl-narrate-card {
    position: fixed;
    left: 16px;
    bottom: 16px;
    z-index: 2147483000;
    width: min(28rem, calc(100vw - 32px));
    max-height: 45vh;
    display: flex;
    flex-direction: column;
    background: var(--rl-surface);
    color: var(--rl-text);
    border: 1px solid var(--rl-border);
    border-radius: 12px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, .35);
}
.rl-narrate-card__head {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .55rem .75rem;
    border-bottom: 1px solid var(--rl-border);
}
.rl-narrate-card__head strong { flex: 1; font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rl-narrate-card__close {
    border: 1px solid var(--rl-border);
    background: transparent;
    color: var(--rl-text-muted);
    border-radius: 6px;
    padding: .15rem .55rem;
    cursor: pointer;
}
.rl-narrate-card__body { overflow: auto; padding: .5rem .75rem .75rem; font-size: .92rem; line-height: 1.5; }
.rl-narrate-card__body p { margin: 0 0 .4rem; white-space: pre-wrap; }

/* In the desktop app the assistant can float over the person's whole desktop, in a see-through window of its own
   (/desktop/assistant, AssistantWindow.cs). The site window's eclipse then steps aside so there is one, not two; its page is
   still read and pressed from here. The attribute is kept on <html> by the app's bridge script (ShellBridge.cs). */
html[data-assistant-external] .rl-assist:not(.rl-assist--docked):not(.rl-assist--desktop),
html[data-assistant-external] .rl-assist-menu { display: none !important; }
