/* Conversation image preview stays outside custom chat skins. */
#chat-media-viewer {
    position: fixed; inset: 0; width: 100%; max-width: none; height: 100%; max-height: none;
    margin: 0; padding: 0; border: 0; color: #fff; background: #111;
    font-family: 'CustomUserFont', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    overscroll-behavior: contain;
}
#chat-media-viewer[open] { display: grid; grid-template-rows: auto minmax(0,1fr) auto; }
#chat-media-viewer::backdrop { background: #111; }
.chat-media-header { display: flex; align-items: center; gap: 12px; padding: calc(10px + env(safe-area-inset-top,0px)) 16px 10px; }
.chat-media-header > div { flex: 1; min-width: 0; display: grid; gap: 4px; }
#chat-media-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; font-weight: 500; }
#chat-media-position { color: #aaa; font-size: 12px; }
#chat-media-viewer button { display: grid; place-items: center; flex: none; min-width: 44px; min-height: 44px; padding: 8px; border-radius: 50%; color: #fff; background: #252525; }
#chat-media-viewer button:disabled { opacity: .3; }
#chat-media-viewer button:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
#chat-media-viewer svg { width: 22px; height: 22px; }
#chat-media-stage { position: relative; min-height: 0; overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; }
#chat-media-stage.zoomed { cursor: grab; }
#chat-media-stage.zoomed:active { cursor: grabbing; }
#chat-media-image { position: absolute; top: 50%; left: 50%; max-width: none; max-height: none; object-fit: contain; transform-origin: center; -webkit-user-drag: none; }
#chat-media-image[hidden] { display: none; }
#chat-media-status { position: absolute; top: 50%; left: 20px; right: 20px; text-align: center; color: #aaa; font-size: 14px; pointer-events: none; }
.chat-media-footer { display: grid; justify-items: center; gap: 12px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom,0px)); }
.chat-media-controls { display: flex; align-items: center; gap: 12px; }
#chat-media-viewer #chat-media-reset { min-width: 64px; border-radius: 22px; font-size: 13px; font-variant-numeric: tabular-nums; }
#chat-media-size { min-height: 16px; color: #aaa; font-size: 12px; }
#page-chat img[data-chat-image] { cursor: zoom-in; }
#page-chat img[data-chat-image]:focus-visible { outline: 2px solid var(--text); outline-offset: 3px; }
#page-chat .bubble .message-photo { display: block; width: auto; height: auto; max-width: min(100%, 320px); max-height: 360px; object-fit: contain; margin: 4px 0; border-radius: var(--radius-sm); }
@media (max-height:500px) {
    .chat-media-header { padding-block: 4px; }
    .chat-media-footer { padding-top: 4px; gap: 4px; }
    #chat-media-viewer button { min-height: 36px; min-width: 36px; }
}
