/*
 * Context menus. Right click on desktop, long press on touch and every "more"
 * button share this one surface; only row height and the touch backdrop differ.
 * Rows run edge to edge and the panel's rounding clips them, like settings cards.
 */
:root { --menu-surface: light-dark(#fbfafcf2, #29272df2); --menu-line: color-mix(in srgb, currentColor 11%, transparent); }
html body :is(.floating-menu, .message-actions-options, .voice-speed-menu) {
  padding: 0; overflow: hidden auto; border: 0; border-radius: 1.1rem; color: var(--color-light-01);
  background: var(--menu-surface); -webkit-backdrop-filter: blur(26px) saturate(1.4); backdrop-filter: blur(26px) saturate(1.4);
  box-shadow: 0 1rem 2.8rem rgb(0 0 0 / .3), 0 .15rem .6rem rgb(0 0 0 / .16), 0 0 0 .5px color-mix(in srgb, currentColor 10%, transparent);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
html body .floating-menu { min-width: min(13rem, var(--floating-menu-available-width, calc(100vw - 24px))); }
html body :is(.floating-menu-item, .message-actions-options > button) {
  position: relative; display: flex; align-items: center; gap: .85rem; width: 100%; min-height: 2.95rem; margin: 0; padding: .55rem 1rem;
  border: 0; border-radius: 0; background: transparent; box-shadow: none; color: inherit;
  font: inherit; font-size: .95rem; font-weight: 430; line-height: 1.25; text-align: start; text-decoration: none; cursor: pointer; -webkit-tap-highlight-color: transparent;
}
html body .floating-menu-item:active { transform: none; }
/* Swipe action choice: compact rows, each with its swipe colour and a check. */
html body .swipe-action-menu { min-width: min(16rem, var(--floating-menu-available-width, calc(100vw - 24px))); }
html body .swipe-action-menu .floating-menu-item { min-height: 2.6rem; padding-block: .35rem; gap: .7rem; }
html body .swipe-action-menu .floating-menu-item > span:has(> .swipe-menu-icon) { flex: 0 0 1.6rem; }
html body .swipe-action-menu .swipe-menu-icon { width: 1.6rem; height: 1.6rem; border-radius: 50%; }
html body .swipe-action-menu .swipe-menu-icon .ui-icon { width: .95rem; height: .95rem; opacity: 1; }
html body .swipe-action-menu .swipe-menu-icon[data-tone="none"] { background: transparent; box-shadow: inset 0 0 0 1.5px var(--menu-line); color: inherit; }
html body .swipe-action-menu .floating-menu-label { flex: 1; }
html body .swipe-action-menu .swipe-menu-check { display: grid; margin-inline-start: auto; color: inherit; }
html body .swipe-action-menu .swipe-menu-check .ui-icon { width: 1.05rem; height: 1.05rem; fill: currentColor; }
@media (hover: hover) and (pointer: fine) { html body .swipe-action-menu .floating-menu-item { min-height: 2.2rem; padding-block: .2rem; } html body .swipe-action-menu .swipe-menu-icon { width: 1.4rem; height: 1.4rem; } html body .swipe-action-menu .floating-menu-item > span:has(> .swipe-menu-icon) { flex-basis: 1.4rem; } }
/* Playback speed: the same surface holding a grid of shared chips. */
/* Options are rounded squares concentric with the menu: their radius is the
   menu's rounding minus its padding. */
html body .voice-speed-menu { --speed-menu-radius: 1.1rem; --speed-menu-padding: .45rem; display: grid; grid-template-columns: repeat(3, 1fr); gap: .3rem; width: 11.4rem; padding: var(--speed-menu-padding); border-radius: var(--speed-menu-radius); overflow: visible; }
html body .voice-speed-menu[hidden] { display: none; }
html body .voice-speed-menu > .camayo-chip { min-height: 2.3rem; padding: .3rem .2rem; border-radius: max(.25rem, calc(var(--speed-menu-radius) - var(--speed-menu-padding))); font-variant-numeric: tabular-nums; }
html body .voice-speed-menu > .camayo-chip:not([aria-checked="true"]) { background: color-mix(in srgb, currentColor 7%, transparent); }
@media (hover: hover) { html body .voice-speed-menu > .camayo-chip:not([aria-checked="true"]):hover { background: color-mix(in srgb, currentColor 13%, transparent); } }
html body :is(.floating-menu-item, .message-actions-options > button) > span:not(.floating-menu-chevron):not(.floating-menu-label):has(> .ui-icon) { display: grid; place-items: center; flex: 0 0 1.25rem; margin: 0; }
html body :is(.floating-menu-item, .message-actions-options > button) > span:not(.floating-menu-chevron) > .ui-icon { width: 1.15rem; height: 1.15rem; flex: none; margin: 0; opacity: .92; pointer-events: none; }
html body :is(.floating-menu-item, .message-actions-options > button):is(:focus-visible, :active, [aria-expanded="true"], .is-gesture-active) { outline: none; background: color-mix(in srgb, currentColor 9%, transparent); }
html body :is(.floating-menu-item, .message-actions-options > button).is-destructive { color: light-dark(#b3324c, #ff8fa1); }
html body :is(.floating-menu-item, .message-actions-options > button).is-destructive:is(:focus-visible, :active, .is-gesture-active) { background: color-mix(in srgb, #d83b55 16%, transparent); color: light-dark(#b3324c, #ff8fa1); }
html body :is(.floating-menu-item, .message-actions-options > button):disabled { background: transparent; opacity: .4; }
/* Keyboard hint at the end of an item (decorateMenuItem option.shortcut); not on touch-only devices. */
html body :is(.floating-menu-item, .message-actions-options > button) > .menu-shortcut { margin-inline-start: auto; padding-inline-start: .75rem; opacity: .6; }
@media (hover: none) and (pointer: coarse) { html body :is(.floating-menu-item, .message-actions-options > button) > .menu-shortcut { display: none; } }
@media (hover: hover) {
  html body :is(.floating-menu-item, .message-actions-options > button):not(:disabled):hover { background: color-mix(in srgb, currentColor 9%, transparent); }
  html body :is(.floating-menu-item, .message-actions-options > button).is-destructive:not(:disabled):hover { background: color-mix(in srgb, #d83b55 16%, transparent); color: light-dark(#b3324c, #ff8fa1); }
  html body .is-aiming-at-submenu .floating-menu-item:hover:not([aria-expanded="true"], :focus-visible) { background: transparent; }
}
@media (hover: none) { html body :is(.floating-menu-item, .message-actions-options > button):hover:not(:active):not([aria-expanded="true"]):not(.is-gesture-active) { background: transparent; } }
html body :is(.floating-menu, .message-actions-options) > .menu-separator { flex: none; height: 1px; margin: .3rem 1rem; border: 0; background: var(--menu-line); transition: opacity .14s ease; }
html body :is(.floating-menu, .message-actions-options) > :is(:hover, :focus-visible, .is-gesture-active) + .menu-separator,
html body :is(.floating-menu, .message-actions-options) > .menu-separator:has(+ :is(:hover, :focus-visible, .is-gesture-active)) { opacity: 0; }
html body :is(.floating-menu, .message-actions-options) > .reaction-quick-strip { max-width: none; margin: 0 0 .3rem; padding: .15rem .7rem .4rem; position: relative; border-bottom: 0; }
/* The divider is inset like the other separators; the emoji rail reaches the
   menu's edge so its fade ends there. */
html body :is(.floating-menu, .message-actions-options) > .reaction-quick-strip::after { content: ''; position: absolute; inset: auto 1rem 0; height: 1px; background: var(--menu-line); }
html body :is(.floating-menu, .message-actions-options) > .reaction-quick-strip:only-child::after { display: none; }
html body :is(.floating-menu, .message-actions-options) > .reaction-quick-strip .reaction-quick-rail { margin-inline-start: -.7rem; padding-inline-start: .7rem; }
html body :is(.floating-menu, .message-actions-options) > .reaction-quick-strip:only-child { margin: 0; padding-block: .2rem; border: 0; }
html body .floating-menu-section { padding: .7rem 1rem .3rem; font-size: .74rem; font-weight: 600; opacity: .6; }
html body .floating-menu-item > .floating-menu-chevron { margin-inline: auto -.15rem; }
/* Mouse: the same menu, compact like a desktop menu. */
@media (hover: hover) and (pointer: fine) {
  html body :is(.floating-menu, .message-actions-options, .voice-speed-menu) { border-radius: .8rem; }
  html body .voice-speed-menu { --speed-menu-radius: .8rem; --speed-menu-padding: .3rem; width: 10.2rem; gap: .2rem; }
  html body .voice-speed-menu > .camayo-chip { min-height: 1.85rem; font-size: .78rem; }
  html body :is(.floating-menu-item, .message-actions-options > button) { min-height: 2.1rem; padding: .3rem .85rem; gap: .65rem; font-size: .84rem; }
  html body :is(.floating-menu-item, .message-actions-options > button) > span:not(.floating-menu-chevron) > .ui-icon { width: 1rem; height: 1rem; }
  html body :is(.floating-menu, .message-actions-options) > .menu-separator { margin-block: .2rem; }
  html body .floating-menu-section { padding: .6rem .85rem .25rem; font-size: .7rem; }
}

/* Touch: wide enough for one-handed reading and a full row of reactions. */
html body :is(.mobile-message-actions, .message-actions-return) .message-actions-options { width: min(100%, 16.5rem); min-width: 0; }
@media (max-width: 649.98px) { html body .floating-menu:not(.floating-submenu) { min-width: min(17rem, var(--floating-menu-available-width, calc(100vw - 24px))); } }
:where(.floating-menu, .message-actions-options) * { font-family: inherit; }

/* A held chat: its preview above its actions, the list blurred behind. */
.chat-peek { position: fixed; inset: 0; width: 100%; max-width: none; height: 100dvh; max-height: none; margin: 0; padding: 0; border: 0; background: transparent; color: var(--color-light-01); overflow: hidden; }
.chat-peek::backdrop { background: transparent; }
.chat-peek-scrim { position: fixed; inset: 0; background: #08070a73; -webkit-backdrop-filter: blur(18px) saturate(1.2); backdrop-filter: blur(18px) saturate(1.2); animation: message-actions-backdrop-in .18s ease-out both; }
.chat-peek-scroll { position: relative; height: 100%; overflow-y: auto; overscroll-behavior: contain; box-sizing: border-box; padding: calc(env(safe-area-inset-top, 0px) + 1rem) 1rem calc(env(safe-area-inset-bottom, 0px) + 1.5rem); scrollbar-width: none; touch-action: pan-y; }
.chat-peek-scroll::-webkit-scrollbar { display: none; }
.chat-peek-card { position: sticky; top: 0; z-index: 1; display: flex; flex-direction: column; width: min(100%, 30rem); margin: 0 auto; overflow: hidden; border-radius: 1.4rem; background: var(--color-background-01); box-shadow: 0 1.2rem 3rem #0006, 0 0 0 .5px color-mix(in srgb, currentColor 12%, transparent); }
.chat-peek-head { display: flex; align-items: center; gap: .7rem; flex: none; padding: .75rem 1rem; border-bottom: 1px solid var(--color-border-subtle); }
.chat-peek-head strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 1rem; }
html body .chat-peek-avatar { flex: none; width: 2.2rem; height: 2.2rem; border-radius: 50%; object-fit: cover; font-size: .75rem; }
/* The preview paints the real transcript (chat.js transcriptMarkup), so the
   bubbles, pictures and link cards are the open chat's. Hover actions stay off. */
.chat-peek-messages { flex: 1; min-height: 0; display: block; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; touch-action: pan-y; padding: .6rem clamp(8px, 2.6vw, 16px) .9rem; outline: none; }
/* Block flow like the chat itself, so bubbles and pictures keep their size. */
.chat-peek-messages > .chat-peek-status { margin: 2rem auto; text-align: center; }
.chat-peek-messages > .chat-peek-retry { display: flex; margin: 0 auto; }
.chat-peek-messages .file-preview { max-width: 100%; }
.chat-peek-messages :is(.message-actions-trigger, .conversation-start) { display: none; }
/* The preview is for reading: pictures, files and links do not open from it
   (a tap opens the chat). Only voice messages play in place. */
.chat-peek-messages .bubble * { pointer-events: none; }
.chat-peek-messages .bubble .voice-message :is(button, input, .voice-seek-strip, .voice-timeline),
.chat-peek-messages .bubble .voice-message :is(button, .voice-timeline) * { pointer-events: auto; }
.chat-peek-messages .voice-expand { display: none; }
.chat-peek-status { margin: auto; color: var(--color-placeholder); font-size: .85rem; }
.chat-peek-spacer { flex: none; }
/* Opening the chat from the preview (chat-peek.js morphIntoChat): the preview
   leaves the top layer and lies between the list and the growing chat; a veil
   in the card's colour covers the wallpaper and fades. */
.chat-peek.is-expanding { display: block; }
.chat-peek.is-expanding .chat-peek-scrim { animation: none; }
.chat-peek-veil { position: absolute; inset: 0; z-index: -1; background: var(--color-background-01); pointer-events: none; }
/* The menu hangs from the preview's leading edge, like a message menu under its bubble. */
html body .chat-peek .chat-peek-actions { position: relative; z-index: 2; width: min(100%, 16.5rem); margin: .9rem auto 0 max(0px, calc((100% - 30rem) / 2)); transform-origin: top left; }
