/* frame.css: the chat frame around the conversation: the avatar, the header, the sidebar, the scene layers, the
   page error, the push prompt, the profile card, the pinned messages panel, the connection dot and the notice strip
   (js/ui/frame.js, js/ui/sidebar.js and js/ui/pins.js; templates t-frame, t-room-row, t-user-row and t-pins-panel).
   css/README.md has the map of the stylesheets. */

/* ==== Avatar ==== */
/* js/render/avatar.js; t-avatar */

.avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    flex-shrink: 0;
    overflow: hidden;
    user-select: none;
}

.avatar-small {
    width: 24px;
    height: 24px;
    font-size: 0.75rem;
}

.avatar-medium {
    width: 40px;
    height: 40px;
    font-size: 1rem;
}

.avatar-large {
    width: 80px;
    height: 80px;
    font-size: 2rem;
}

.avatar-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-initials {
    color: white;
    font-weight: 600;
    text-transform: uppercase;
    /* The avatar div gets box-shadow since border would cut into the gradient */
}

.avatar:has(.avatar-initials) {
    box-shadow: 0 0 0 1px white;
}

/* ==== Header: title, pin and mailbox buttons, status chip and menu, hamburger ==== */
/* js/ui/frame.js; t-frame, t-header-room, t-header-back, t-status-menu */

.chat-header {
    background: var(--bg-header);
    color: var(--text-white);
    padding: 0.5rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 1px 0 rgba(4,4,5,0.2),0 1.5px 0 rgba(6,6,7,0.05),0 2px 0 rgba(4,4,5,0.05);
}

.chat-header h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-header .back-button {
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 4px;
    transition: background-color 0.2s, color 0.2s;
    flex-shrink: 0;
}

.chat-header .back-button:hover {
    background: color-mix(in srgb, var(--bg-muted) 40%, transparent);
    color: var(--text-primary);
}

.dm-header-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
}

.dm-header-title .avatar {
    flex-shrink: 0;
}

/* The controls take the rest of the row and pack to the right. The pin button's auto margin (below) pulls it
   out of the group to the left, next to the title: on a desktop the pins belong to the conversation column, and
   a button over the sidebar read as a sidebar control (user feedback 2026-10-18). No shrink: a long title gives
   way, the buttons never overlap. The margin keeps air between a long title and the first control; the header
   itself has no gap. */
.header-controls {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.75rem;
    flex: 1 0 auto;
    margin-left: 0.5rem;
}

/* The mailbox button, and the pin button in the same shape (SH-47) */
.mailbox-button,
.pins-button {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    transition: background-color 0.2s, color 0.2s;
}

.mailbox-button:hover,
.pins-button:hover {
    background: color-mix(in srgb, var(--bg-muted) 40%, transparent);
    color: var(--text-primary);
}

.mailbox-button.has-unread {
    color: var(--status-away);
}

.mailbox-button.has-unread:hover {
    color: var(--status-away-hover);
}

.mailbox-badge,
.pins-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--color-danger);
    color: white;
    font-size: 0.625rem;
    font-weight: 700;
    padding: 1px 4px;
    border-radius: 8px;
    min-width: 14px;
    text-align: center;
    line-height: 1.2;
}

/* The pin button (SH-47): the mailbox's shape (above), with the count of pins as a badge in the accent colour,
   not the mailbox's red: a pin asks for nothing. Hidden without pins.
   order and margin-right: auto put it first in the controls and push the rest to the right edge, so it sits
   right after the title. The phone rule below undoes both. */
.pins-button {
    order: -1;
    margin-right: auto;
}

.pins-badge {
    background: var(--accent-primary);
    color: var(--accent-ink);
}

.users-toggle {
    display: none; /* SH-08: above 768 px the sidebar is always there, and the search field has this place (search.css) */
    align-items: center;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    transition: background-color 0.2s, color 0.2s;
}

.users-toggle:hover {
    background: color-mix(in srgb, var(--bg-muted) 40%, transparent);
    color: var(--text-primary);
}

.users-toggle svg {
    width: 20px;
    height: 20px;
}

@media (max-width: 768px) {
    .users-toggle {
        display: flex;
    }

    /* The sidebar is a slide-in here, so the pin button goes back among the controls, before the mailbox. */
    .pins-button {
        order: 0;
        margin: 0;
    }
}

/* Status dropdown container */
.status-dropdown-container {
    position: relative;
}

.status-button {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--status-online);
    border: none;
    /* Not --text-white: the chip's bg is the status colour, and themes with bright
       status greens need dark text here. Also colours the dot + gear (currentColor). */
    color: var(--status-chip-text);
    font-size: 0.875rem;
    padding: 0.25rem 0.75rem;
    border-radius: 3px;
    cursor: pointer;
    transition: filter 0.2s;
}

.status-button:hover {
    filter: brightness(1.1);
}

.status-button.status-online {
    background: var(--status-online);
}

.status-button.status-away {
    background: var(--status-away);
}

.status-button.status-invisible {
    background: var(--status-invisible);
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
    box-shadow: var(--glow-status);
}

.status-username {
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dropdown-gear {
    opacity: 0.7;
    margin-left: -0.125rem;
}

/* Backdrop for closing dropdown */
.dropdown-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 999;
}

/* Dropdown menu */
.status-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    background: var(--bg-darkest);
    border-radius: 4px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.24);
    min-width: 150px;
    padding: 0.375rem;
    z-index: 1000;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.5rem 0.625rem;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 0.875rem;
    text-align: left;
    border-radius: 2px;
    cursor: pointer;
    transition: background-color 0.15s, color 0.15s;
}

.dropdown-item:hover:not(:disabled) {
    background: color-mix(in srgb, var(--bg-muted) 40%, transparent);
    color: var(--text-white);
}

.dropdown-item:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.dropdown-item.active {
    background: color-mix(in srgb, var(--accent-primary) 20%, transparent);
    color: var(--text-white);
}

.dropdown-item.signout {
    color: var(--color-danger);
}

.dropdown-item.signout:hover {
    background: color-mix(in srgb, var(--color-danger) 20%, transparent);
    color: var(--color-danger);
}

.dropdown-divider {
    height: 1px;
    background: var(--bg-sidebar);
    margin: 0.375rem 0;
}

/* Status dots in dropdown */
.chat-header .status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* The colours of the states are with .user-status-dot below: one rule for the three dots. */

@media (max-width: 600px) {
    .chat-header {
        padding: 0.75rem 1rem;
    }

    .chat-header h3 {
        font-size: 1.25rem;
    }

    .status-username {
        max-width: 80px;
    }

    /* Five controls on a 390 px row: the gaps and the hamburger's padding shrink, the hit areas keep their
       size (user feedback 2026-10-18). */
    .header-controls {
        gap: 0.25rem;
    }

    .users-toggle {
        padding: 0.25rem 0.5rem;
    }
}

/* ==== Sidebar: rooms and people, the profile popup ==== */
/* js/ui/sidebar.js, js/ui/frame.js; t-room-row, t-add-room, t-user-row, t-profile-popup */

/* Desktop: always visible. One scroll area for rooms and people together: a long list scrolls, a short one
   shows no bar (SH-27). In the 2026-10-16 load test with 1,500 accounts the list was cut off (overflow hidden). */
.users-sidebar {
    width: 240px;
    background: var(--bg-sidebar);
    padding: 1rem;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--bg-header) transparent;
}

/* A fade over the last rows while more are below, so a phone with no visible scrollbar still shows there is
   more. sidebar.js toggles .has-more from the scroll position; sticky keeps the fade at the panel's bottom edge. */
.users-sidebar::after {
    content: '';
    display: block;
    position: sticky;
    bottom: -1rem;
    height: 2.5rem;
    margin: -2.5rem -1rem -1rem;
    background: linear-gradient(transparent, var(--bg-sidebar));
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
}

/* The fade is for the phone, where the scrollbar shows only during a touch. The desktop has the thin bar. */
@media (max-width: 768px) {
    .users-sidebar.has-more::after {
        opacity: 1;
    }
}

/* Mobile: slide-in overlay */
@media (max-width: 768px) {
    .users-sidebar {
        position: fixed;
        right: 0;
        top: 41px;
        height: calc(100vh - 41px);
        transform: translateX(100%);
        transition: transform 0.2s ease;
        z-index: 99;
    }

    .users-sidebar.sidebar-open {
        transform: translateX(0);
    }
}

/* Sidebar sections */
.sidebar-section {
    margin-bottom: 1.5rem;
}

.sidebar-section h4 {
    color: var(--text-tertiary);
    text-transform: uppercase;
    font-size: 0.75rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    padding: 0 0.5rem;
}

/* Rooms list */
.rooms-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.room-item {
    display: flex;
    align-items: center;
    padding: 0.5rem;
    border-radius: 4px;
    font-size: 1rem;
    color: var(--text-tertiary);
    cursor: pointer;
    transition: all 0.15s;
}

.room-item:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.room-item.active {
    background: var(--bg-secondary);
    color: var(--text-white);
}

.room-icon {
    font-size: 1.25rem;
    margin-right: 0.5rem;
    color: var(--text-placeholder);
    font-weight: 500;
}

.room-item.active .room-icon,
.room-item:hover .room-icon {
    color: var(--text-primary);
}

.room-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.room-settings {
    background: transparent;
    border: none;
    color: var(--text-placeholder);
    cursor: pointer;
    padding: 2px 4px;
    line-height: 1;
    border-radius: 3px;
    opacity: 0;
    transition: all 0.15s;
    display: flex;
    align-items: center;
}

.room-item:hover .room-settings,
.room-item:focus-within .room-settings {   /* the gear shows for keyboard focus too */
    opacity: 1;
}

.room-settings:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.room-item.add-room {
    color: var(--color-success);
}

.room-item.add-room:hover {
    background: color-mix(in srgb, var(--color-success) 10%, transparent);
}

.room-item.add-room .room-icon {
    color: var(--color-success);
}

/* Users list */
.users-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.user-item {
    display: flex;
    align-items: center;
    padding: 0.5rem;
    border-radius: 4px;
    font-size: 1rem;
    color: var(--text-tertiary);
    cursor: pointer;
    transition: all 0.15s;
}

.user-item:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.user-item.current-user {
    color: var(--text-white);
    cursor: default;
}

.user-item.current-user:hover {
    background: transparent;
}

.user-item.active-dm {
    background: var(--bg-secondary);
    color: var(--text-white);
}

/* The rows are divs with role=link (sidebar.js): the keyboard ring is drawn here, inside the row's radius. */
.room-item:focus-visible,
.user-item:focus-visible {
    outline: 2px solid var(--accent-primary);
    outline-offset: -2px;
}

.users-sidebar .user-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* User status dot */
.user-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 0.5rem;
    flex-shrink: 0;
}

/* The state colours of the three status dots: the status menu of the header, the people row, the profile card.
   A selector list, not :is(): each selector keeps its own weight.
   `color` is set alongside `background` purely so --glow-status can be written once
   as `0 0 6px currentColor` and pick up whichever state colour the dot is showing.
   The dots hold no text, so the colour has no other effect. */
.chat-header .status-dot.online,
.user-status-dot.online,
.profile-card-status-dot.online {
    background: var(--status-online);
    color: var(--status-online);
    box-shadow: var(--glow-status);
}

.chat-header .status-dot.away,
.user-status-dot.away,
.profile-card-status-dot.away {
    background: var(--status-away);
    color: var(--status-away);
    box-shadow: var(--glow-status);
}

.chat-header .status-dot.invisible,
.user-status-dot.invisible,
.profile-card-status-dot.offline {
    background: var(--status-invisible);
}

/* Role badges: the admin shield and the bot robot after a name. They are icons of the sprite in every place that
   shows one: the people row here, the message header (message.css), the profile card, the Users table (admin.css).
   They were emoji pictures until 2026-11-12, and a picture keeps its own colours in every theme.
   inline-flex: an <svg> alone in an inline span stands on a text line of its own and makes the row taller.
   vertical-align counts only where the badge follows text in a line (the Users table); a flex row ignores it. */
.admin-badge,
.bot-badge {
    display: inline-flex;
    flex-shrink: 0;
    vertical-align: -0.125em;
}

/* The accent alone is too dark for the default theme: #5865f2 on the sidebar (#2f3136) is 2.8:1. A quarter of the
   theme's strongest text colour lifts it to 4.3:1 there. That colour is dark in the light themes, so the mix moves
   the right way in each theme. */
.admin-badge {
    color: color-mix(in srgb, var(--accent-primary) 75%, var(--text-white));
}

.bot-badge {
    color: var(--text-muted);
}

.users-sidebar :is(.admin-badge, .bot-badge) {
    margin-left: 0.25rem;
}

/* Unread dot: the quiet marker a MUTED room or DM gets instead of a count.
   Muting hides the number and the notification, never the fact that something arrived. */
.unread-dot {
    width: 8px;
    height: 8px;
    background: var(--text-primary);
    border-radius: 50%;
    margin-left: 0.25rem;
    flex-shrink: 0;
}

.room-item.has-unread {
    color: var(--text-primary);
}

/* Unread badge: the count an unmuted room or DM gets */
.unread-badge {
    background: var(--color-danger);
    color: white;
    font-size: 0.6875rem;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}

/* Crossed bell on muted channels. Sits before the unread dot/badge; the two coexist by
   design (bell = you muted it, dot = something still arrived). DM rows show it for any
   effective mute; room rows only for a per-room Individual choice — see showsBell in store.js. */
.mute-bell {
    display: flex;
    align-items: center;
    margin-left: 0.25rem;
    color: var(--text-placeholder);
    flex-shrink: 0;
}

/* Mobile-only "view profile" info button */
.profile-info-btn {
    background: transparent;
    border: none;
    color: var(--text-placeholder);
    cursor: pointer;
    padding: 2px;
    margin-left: 4px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    line-height: 1;
    transition: color 0.15s, background 0.15s, transform 0.15s;
}

.profile-info-btn:hover,
.profile-info-btn:active {
    color: var(--text-primary);
    background: var(--bg-hover);
    transform: scale(1.2);
}

/* Profile popout container (the card itself is .profile-card, below) */
.profile-popup {
    position: fixed;
    z-index: 200;
    width: 280px;
    pointer-events: none; /* desktop: tooltip-like, never steals clicks/hover */
    animation: profilePopIn 0.12s ease-out;
}

.profile-popup.is-mobile {
    left: 50% !important;
    top: 50% !important;
    transform: translate(-50%, -50%);
    width: min(320px, calc(100vw - 32px));
    pointer-events: auto;
    animation: profilePopInMobile 0.14s ease-out;
}

.profile-popup-backdrop {
    position: fixed;
    inset: 0;
    z-index: 199;
    background: rgba(0, 0, 0, 0.5);
    animation: profileBackdropIn 0.12s ease-out;
}

@keyframes profilePopIn {
    from { opacity: 0; transform: translateY(4px) scale(0.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes profilePopInMobile {
    from { opacity: 0; transform: translate(-50%, -50%) scale(0.95); }
    to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

@keyframes profileBackdropIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ==== Frame layout: the columns, the scene layers, the sidebar backdrop, the page error ==== */
/* js/ui/frame.js, js/main.js; t-frame, t-error */
/* The message list inside the conversation column is in timeline.css. */

.chat-container {
    height: 100vh; /* fallback for older browsers */
    height: 100svh; /* small viewport height - consistent on mobile */
    display: flex;
    flex-direction: column;
    background: var(--bg-primary);
    overflow: hidden;
    /* Establishes the stacking context the scene layers live in. Without it their
       z-index: -1 escapes to an ancestor and the scene disappears behind the page.
       overflow: hidden alone does NOT create one. */
    isolation: isolate;
    /* The containing block of the scene layers (.theme-scene, .theme-scrim). They are
       position: absolute so that they cover the frame and nothing above it - see the
       note at .theme-scene. */
    position: relative;
}

/* ==========================================================================
   Themed background scene. The design record of the themes left the tree with
   the Blazor code; css/README.md says how to read it.

   z-index: -1 inside .chat-container's stacking context paints these ABOVE the
   container's own --bg-primary background (which stays as the fallback while
   images load) but BELOW every in-flow child. That is why the header, sidebar
   and message list need no z-index of their own.

   position: absolute inside .chat-container (position: relative), not fixed. A
   fixed layer spans the viewport, and the notice strip (SH-20) sits above the
   frame, outside this stacking context, so a fixed scene painted over the strip:
   in Tea House the strip showed as a band of garden. Not background-attachment:
   fixed either - that repaints on every scroll and misbehaves on iOS Safari. The
   container itself never scrolls (the list inside it does), so an absolute layer
   composites once, as the fixed one did.

   The five backgrounds are one element rather than five divs; the shorthand
   lists below are positionally matched, so a layer a theme leaves as `none`
   still holds its slot and the others stay aligned. Listed top-first, which is
   the reverse of the source theme's paint order.
   ========================================================================== */
.theme-scene {
    position: absolute;
    inset: 0;
    z-index: -1;
    /* Sits behind content but still spans gaps in the shell, where it would
       otherwise swallow clicks meant for the container. */
    pointer-events: none;

    background-image:
        var(--scene-footer),
        var(--scene-footertile),
        var(--scene-header),
        var(--scene-headertile),
        var(--scene-canvastile);
    background-repeat:
        no-repeat,
        repeat-x,
        no-repeat,
        repeat-x,
        repeat;
    background-position:
        right bottom,
        right bottom,
        left top,
        left top,
        left top;
    /* The header and footer strips are taller than many viewports, so a scene theme
       scales every layer by one shared factor here. Sharing the factor is what keeps
       the teahouse standing on the garden's ground line. */
    background-size: var(--scene-sizes);
}

/* Separate element rather than a ::after on .theme-scene: when scene crossfading
   arrives there will be two .theme-scene elements at varying opacity, and a scrim
   attached to them would fade along with the artwork. */
.theme-scrim {
    position: absolute;
    inset: 0;
    z-index: -1; /* same layer as the scene; later in the DOM, so it paints over */
    pointer-events: none;
    background: var(--canvas-scrim);
}

.header-line {
    width: 100%;
    height: 3px;
    display: block;
    flex-shrink: 0;
    image-rendering: auto;
    object-fit: fill;
}

.chat-main {
    flex: 1;
    display: flex;
    overflow: hidden;
    min-width: 0; /* Allow flex item to shrink below content size */
}

.messages-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-canvas-panel);
    position: relative; /* .top-pill (timeline.css) is positioned against the column */
    min-width: 0; /* Allow flex item to shrink below content size */
    overflow: hidden;
}

/* Backdrop for mobile sidebar */
.sidebar-backdrop {
    display: none;
}

@media (max-width: 768px) {
    .sidebar-backdrop.show {
        display: block;
        position: fixed;
        top: 41px;
        left: 0;
        right: 0;
        bottom: 0;
        background: transparent;
        z-index: 98;
    }

    .chat-main {
        width: 100%;
    }
}

/* The page error (SH-41): main.js shows it in the conversation column when a page fails to mount. */
.error-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 2rem;
    text-align: center;
    color: var(--text-primary);
}

.error-content h3 {
    color: var(--color-danger);
    margin: 0 0 0.5rem 0;
    font-size: 1.25rem;
}

.error-content p {
    color: var(--text-muted);
    margin: 0 0 1.5rem 0;
    font-size: 0.875rem;
    max-width: 400px;
}

.error-retry-button,
.error-reload-button {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    margin: 0 0.25rem;
    transition: background-color 0.15s ease;
}

.error-retry-button {
    background: var(--accent-primary);
    color: var(--accent-ink);
}

.error-retry-button:hover {
    background: var(--accent-hover);
}

.error-reload-button {
    background: var(--bg-input);
    color: var(--text-primary);
}

.error-reload-button:hover {
    background: var(--bg-muted);
}

/* ==== Push prompt of the installed app, and the install dialog in its classes ==== */
/* js/pages/chat.js, js/pwa.js; t-push-prompt, t-pwa-install */

.push-prompt-overlay {
    position: fixed;
    inset: 0;
    z-index: 300;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    animation: pushPromptFadeIn 0.3s ease-out;
}

.push-prompt-overlay.hiding {
    animation: pushPromptFadeOut 0.3s ease-in forwards;
}

.push-prompt-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    max-width: 380px;
    width: 100%;
    padding: 2.5rem 2rem 2rem;
    background: var(--bg-header);
    border-radius: 12px;
}

.push-prompt-icon {
    color: var(--accent-primary);
    margin-bottom: 1.25rem;
}

.push-prompt-heading {
    color: var(--text-white);
    font-size: 1.375rem;
    font-weight: 700;
    margin: 0 0 0.75rem;
}

.push-prompt-body {
    color: var(--text-muted);
    font-size: 0.9375rem;
    line-height: 1.5;
    margin: 0 0 1.75rem;
}

.push-prompt-enable {
    width: 100%;
    padding: 0.75rem 1.5rem;
    background: var(--accent-primary);
    color: var(--accent-ink);
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.push-prompt-enable:hover:not(:disabled) {
    background: var(--accent-hover);
}

.push-prompt-enable:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.push-prompt-later {
    background: none;
    border: none;
    color: var(--text-placeholder);
    font-size: 0.8125rem;
    cursor: pointer;
    padding: 0.75rem 0.5rem 0.25rem;
    transition: color 0.15s ease;
}

.push-prompt-later:hover {
    color: var(--text-muted);
}

@keyframes pushPromptFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes pushPromptFadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

/* ==== Profile card ==== */
/* js/ui/frame.js; t-profile-popup */

.profile-card {
    width: 100%;
    background: var(--bg-darkest);
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
    color: var(--text-primary);
}

/* Gradient banner — matches the user's avatar color identity */
.profile-card-banner {
    height: 56px;
    width: 100%;
}

/* Avatar overlaps the banner, Discord-style, with a ring in the card color */
.profile-card-avatar {
    margin: -40px 0 0 16px;
    width: fit-content;
}

.profile-card-avatar .avatar {
    box-shadow: 0 0 0 5px var(--bg-darkest);
}

.profile-card-body {
    padding: 8px 16px 16px;
}

.profile-card-identity {
    display: flex;
    flex-direction: column;
    gap: 1px;
    margin-top: 6px;
}

.profile-card-name {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-white);
    line-height: 1.25;
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}

.profile-card-username {
    font-size: 0.8125rem;
    color: var(--text-muted);
}

/* Presence line */
.profile-card-statusline {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.profile-card-status-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* The colours of the states are with .user-status-dot above: one rule for the three dots. */

.profile-card-divider {
    height: 1px;
    background: var(--border-dark);
    margin: 12px 0;
}

.profile-card-section {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.profile-card-label {
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-tertiary);
}

.profile-card-bio {
    margin: 0;
    font-size: 0.875rem;
    line-height: 1.4;
    color: var(--text-secondary);
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.profile-card-empty {
    margin: 0;
    font-size: 0.8125rem;
    font-style: italic;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 4px;
}

.profile-card-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 10px;
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

/* ==== Pinned messages panel ==== */
/* SH-48, SH-49; js/ui/pins.js; t-pins-panel, t-pin-entry */

/* Appended to the body. On desktop overlays.place sets top and left and reveals it; on a phone the media rule below
   makes it a bottom sheet and shows it directly, as the More menu does. */
.pins-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 999;
}

.pins-panel {
    position: fixed;
    z-index: 1000;
    width: 420px;
    max-width: calc(100vw - 16px);
    max-height: 70vh;
    display: flex;
    flex-direction: column;
    background: var(--bg-darkest);
    border-radius: 8px;
    box-shadow: 0 0 0 1px rgba(4, 4, 5, 0.15), 0 8px 16px rgba(0, 0, 0, 0.24);
    visibility: hidden;
}

.pins-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-dark);
}

.pins-title {
    font-weight: 600;
    font-size: 0.9375rem;
    color: var(--text-primary);
}

.pins-close,
.pin-unpin {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: none;
    border: none;
    border-radius: 4px;
    color: var(--text-muted);
    font-size: 0.875rem;
    cursor: pointer;
}

.pins-close:hover {
    color: var(--text-primary);
    background: color-mix(in srgb, var(--bg-muted) 40%, transparent);
}

/* The unpin control is a crossed pin in the danger colour: a grey ✕ next to the panel's own ✕ read as "close", not
   "remove" (user feedback 2026-10-18), and a trash icon read as "delete the message" (2026-10-23). The icon is
   Material Symbols "keep_off", the twin of the "push_pin" in the header and the More menu, with the slash gap built
   into the one path, so no mask and no id that the cloned template entries would share. */
.pin-unpin {
    color: var(--color-danger);
}

.pin-unpin:hover {
    color: white;
    background: var(--color-danger);
}

.pins-list {
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--bg-muted) transparent;   /* the sidebar's thin bar, not the browser's grey one; --bg-header is too close to the panel's own colour */
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.pin-entry {
    position: relative; /* the refusal text of overlays.reason anchors here */
    padding: 0.625rem 0.75rem;
    border-radius: 6px;
    background: var(--bg-input);
    color: var(--text-primary);
    cursor: pointer;
}

.pin-entry:hover,
.pin-entry:focus-visible {
    background: var(--bg-hover);
}

.pin-entry.jumping {
    opacity: 0.6; /* older pages are loading on the way to the row (SH-49) */
}

.pin-entry-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.25rem;
}

.pin-entry-header .avatar {
    width: 20px;
    height: 20px;
    font-size: 0.5rem;
    flex-shrink: 0;
}

.pin-author {
    font-weight: 600;
}

.pin-time {
    flex: 1;
    color: var(--text-muted);
    font-size: 0.75rem;
}

.pin-text {
    font-size: 0.9375rem;
    line-height: 1.4;
    white-space: pre-wrap; /* the message's own line breaks, as in the row */
    word-break: break-word;
    overflow-wrap: break-word;
}

/* Media under the text, at the panel's width (SH-48), in the row's blocks: the pictures, each video as the row's
   player, the GIFs, the voice player, or a link card. The user asked to see the GIF and the media, not a label
   (2026-10-18), and the whole gallery, small (2026-10-23). The height cap keeps three entries in one view. The frame
   shrinks to the picture, so a tap beside a single picture jumps and does not open the viewer. */
.pin-media {
    margin-top: 0.375rem;
}

.pin-frame {
    position: relative;
    display: block;
    width: fit-content;
    max-width: 100%;
}

.pin-picture,
.pin-gif {
    display: block;
    max-width: 100%;
    max-height: 240px;
    border-radius: 4px;
}

/* A picture that opens the viewer is in a <button> (pins.js): no button look, only the picture's own box. A single
   picture's button fits the picture, so a tap beside it jumps (SH-49); a grid cell's button fills its cell. */
.pin-shot {
    position: relative; /* the focus ring below */
    display: block;
    padding: 0;
    border: 0;
    background: none;
    color: inherit;
    font: inherit;
    cursor: zoom-in;
}

.pin-media > .pin-shot {
    width: fit-content;
    max-width: 100%;
}

/* Inside, not outside: .pin-grid clips its cells (overflow: hidden, for the round corners), and an outer ring would
   show only as a sliver in the 2 px gap. On a layer over the picture: an inset outline of the button paints under
   its picture and does not show. */
.pin-shot:focus-visible {
    outline: none;
}

.pin-shot:focus-visible::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 4px;
    box-shadow: inset 0 0 0 2px var(--accent-primary);
}

/* The row's player (ui/video.js), at the panel's cap of 240 px and not the row's 350 px: three entries fit in one
   view. One video under the other, as in the row (.video-gallery). */
.pin-media > * + * {
    margin-top: 4px;
}

.pin-media .video-player {
    max-height: 240px;
}

/* Two or more pictures: square cells that crop as the row's gallery does (MR-25). pins.js sets --cols from the
   count: one row up to four pictures, two rows above that, so the block stays near the 240 px cap. */
.pin-grid {
    display: grid;
    grid-template-columns: repeat(var(--cols, 3), minmax(0, 1fr));
    gap: 2px;
    border-radius: 4px;
    overflow: hidden;
}

.pin-cell {
    position: relative;
    display: block;
    aspect-ratio: 1;
    background: var(--bg-hover); /* the cell has its shape before its lazy picture arrives */
}

.pin-cell > .pin-picture,
.pin-cell > .pin-gif {
    width: 100%;
    height: 100%;
    max-height: none;
    object-fit: cover;
    border-radius: 0;
}

.pin-card {
    display: block;
}

.pin-card-title {
    display: block;
    width: fit-content; /* a link title opens the link on its text only; the empty rest of the line jumps (SH-49) */
    max-width: 100%;
    margin-top: 0.25rem;
    font-size: 0.8125rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pin-card-site {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.pin-attachment-label {
    display: inline-block;
    margin-top: 0.25rem;
    color: var(--text-muted);
    font-size: 0.8125rem;
}

.pin-entry-foot {
    margin-top: 0.375rem;
    color: var(--text-muted);
    font-size: 0.75rem;
}

/* The phone tier (GEN-18): a bottom sheet over a dimmed page */
@media (max-width: 600px) {
    .pins-panel {
        visibility: visible;
        left: 0;
        right: 0;
        bottom: 0;
        width: auto;
        max-width: none;
        max-height: 80vh;
        border-radius: 12px 12px 0 0;
        padding-bottom: env(safe-area-inset-bottom);
    }

    .pins-backdrop {
        background: rgba(0, 0, 0, 0.5);
    }
}

/* ==== Connection dot, notice strip and frame height ==== */
/* SH-17 to SH-20; js/ui/frame.js, js/update.js; t-frame, #notice in index.html */

/* The connection dot before the status chip (SH-17) and its bubble (SH-18). */
.connection-dot { width: 10px; height: 10px; border-radius: 50%; border: none; padding: 0; background: #f0a030; cursor: pointer; position: relative; animation: connection-pulse 1.2s ease-in-out infinite; }
.connection-dot.offline { background: transparent; border: 2px solid #888; animation: none; }
.connection-dot.action { background: #ed4245; animation: none; }
.connection-dot .connection-bubble { position: absolute; top: calc(100% + 8px); right: 0; white-space: nowrap; background: var(--bg-tooltip); color: #fff; font-size: 0.75rem; padding: 0.375rem 0.625rem; border-radius: 6px; z-index: 20; }
@keyframes connection-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
.header-line.connecting { animation: connection-pulse 1.2s ease-in-out infinite; }
.header-line.offline { opacity: 0.4; }
@media (prefers-reduced-motion: reduce) { .connection-dot, .header-line.connecting { animation: none; } }

/* The notice strip (SH-20): one line, one control, above the frame. */
.notice-strip { display: flex; align-items: center; justify-content: center; gap: 0.75rem; padding: 0.375rem 1rem; background: #f0a030; color: #1a1a1a; font-size: 0.875rem; }
.notice-action { background: #1a1a1a; color: #fff; border: none; border-radius: 4px; padding: 0.25rem 0.75rem; cursor: pointer; font-size: inherit; }
.notice-action:empty { display: none; }
.notice-action:disabled { opacity: 0.6; cursor: default; }   /* "Updating…" while the reload waits for the new copy (OF-18) */

/* The frame takes the rest of the window instead of a full viewport height: the conversation is shorter while the
   strip shows (SH-20). */
#app > .chat-container { height: auto; flex: 1; min-height: 0; }
