/* 微信视频功能：分享屏幕 */
.video-feature-choice-body {
    padding-top: 6px;
}

.video-feature-choice-hint,
.video-feature-choice-note {
    line-height: 1.5;
}

.video-feature-choice-note {
    margin-top: 12px;
    font-size: 12px;
    color: rgba(80, 80, 86, 0.72);
}

.video-feature-choice-grid {
    display: grid;
    gap: 12px;
    margin-top: 14px;
}

.video-feature-choice-btn {
    border: 1px solid #ececec;
    background: #fafafa;
    border-radius: 16px;
    padding: 14px 15px;
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 5px;
    color: inherit;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.video-feature-choice-btn--accent {
    border-color: rgba(7, 193, 96, 0.18);
    background: linear-gradient(135deg, rgba(7, 193, 96, 0.08) 0%, rgba(7, 193, 96, 0.02) 100%);
}

.video-feature-choice-btn-title {
    font-size: 15px;
    font-weight: 700;
    color: #202124;
}

.video-feature-choice-btn-sub {
    font-size: 12px;
    color: #666;
    line-height: 1.45;
}

.video-feature-choice-btn:active {
    opacity: 0.92;
}

.screen-share-global-root {
    position: fixed;
    inset: 0;
    /* 页面内最顶层：盖过情侣空间(100280)/主悬浮球(100400)等所有浮层 */
    z-index: 100600;
    pointer-events: none;
    isolation: isolate;
}

/* 直播区域约占窗口宽 48.5%：448 * 0.485 ≈ 217px，保证手机上也能看清分享内容 */
.screen-share-floating-window {
    position: absolute;
    top: calc(var(--safe-area-inset-top, env(safe-area-inset-top, 0px)) + 58px);
    right: calc(var(--safe-area-inset-right, env(safe-area-inset-right, 0px)) + 10px);
    width: 448px;
    min-height: 540px;
    display: none;
    pointer-events: auto;
    filter: drop-shadow(0 16px 28px rgba(12, 14, 20, 0.26));
    -webkit-tap-highlight-color: transparent;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    -webkit-user-drag: none;
    z-index: 1;
}

.screen-share-floating-window.is-dragging {
    filter: drop-shadow(0 20px 36px rgba(12, 14, 20, 0.38));
    opacity: 0.92;
    cursor: grabbing;
}

.screen-share-floating-window.show {
    display: block;
}

.screen-share-frame-shell {
    position: relative;
    width: 100%;
    aspect-ratio: 3 / 4;
}

.screen-share-frame-art {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    background: center / contain no-repeat url("assets/店铺;小木美工素材 (18).png");
    pointer-events: none;
    z-index: 2;
    -webkit-touch-callout: none;
    -webkit-user-drag: none;
}

/* 必须高于相框图（z-index:2）：素材中间的白色区域不透明，直播画面要覆盖在白色区域上方 */
.screen-share-live-surface {
    position: absolute;
    left: 28%;
    top: 29.5%;
    width: 48.5%;
    height: 34.5%;
    border-radius: 7px;
    overflow: hidden;
    background: #0f1115;
    transform: rotate(-3.5deg);
    transform-origin: center center;
    z-index: 3;
}

.screen-share-video,
.screen-share-fallback-img,
.screen-share-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: #0f1115;
    -webkit-touch-callout: none;
    -webkit-user-drag: none;
    user-select: none;
    pointer-events: none;
}

.screen-share-canvas {
    display: none;
}

/* 降级/原生预览：用背景图而非 <img>，避免安卓 WebView 长按弹出「保存图片」 */
.screen-share-fallback-img {
    display: none;
    background-color: #0f1115;
    background-position: center;
    background-size: cover;
    background-repeat: no-repeat;
}

.screen-share-floating-window.is-fallback .screen-share-fallback-img {
    display: block;
}

.screen-share-floating-window.is-fallback .screen-share-video {
    display: none;
}

.screen-share-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px 14px;
    text-align: center;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.5;
    letter-spacing: 0.02em;
    white-space: pre-line;
    color: rgba(255, 255, 255, 0.94);
    background: linear-gradient(135deg, rgba(20, 22, 28, 0.96), rgba(54, 58, 70, 0.92));
    z-index: 3;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    user-select: none;
}

.screen-share-floating-window.is-live .screen-share-placeholder {
    display: none;
}

/* ===== 分享屏幕：悬浮到系统屏幕上（Document PiP 置顶窗口）的布局 ===== */
.screen-share-pip-body {
    margin: 0;
    overflow: hidden;
    background: #fff5f7;
}

.screen-share-global-root.pip-mode {
    position: fixed;
    inset: 0;
}

/* 进入 PiP 时 JS 会清空内联 left/top/right/transform，所以这里不需要 !important；
   去掉 !important 后用户在悬浮窗里长按拖拽产生的内联坐标才能生效 */
.screen-share-global-root.pip-mode .screen-share-floating-window {
    top: 4px;
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    /* 跟随悬浮窗大小缩放：宽度吃满 94vw，同时按相框 3:4 比例用 70vh 限高，
       保证用户把悬浮窗拉大时猫咪相框同步变大、拉小时也不溢出。
       Document PiP 仅存在于 Chrome/Edge 116+，min() 多参数在这些内核完全可用；
       移动端（iPhone/华为/小米等）走页面内小窗，不受此规则影响。 */
    width: min(96vw, 78vh, 720px);
    min-height: 0;
    filter: drop-shadow(0 10px 18px rgba(12, 14, 20, 0.22));
}

.screen-share-global-root.pip-mode .screen-share-mini-chat {
    left: 8px;
    right: 8px;
    bottom: 8px;
    width: auto;
    height: min(48vh, 320px);
    max-height: 60vh;
}

/* ===== 分享屏幕：小窗点击菜单（少女漫画风配色） ===== */
.screen-share-menu {
    position: absolute;
    display: none;
    flex-direction: column;
    gap: 6px;
    min-width: 148px;
    padding: 10px;
    border-radius: 20px;
    border: 2px solid rgba(255, 183, 197, 0.35);
    background: #fff5f7;
    box-shadow: 0 4px 20px rgba(255, 183, 197, 0.45), 0 10px 30px rgba(196, 181, 253, 0.18);
    pointer-events: auto;
    z-index: 40;
    isolation: isolate;
    touch-action: manipulation;
}

.screen-share-menu.show {
    display: flex;
}

.screen-share-menu-item {
    border: none;
    border-radius: 999px;
    padding: 9px 14px;
    background: #ffb7c5;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    text-align: center;
    box-shadow: 0 4px 15px rgba(255, 183, 197, 0.38);
    cursor: pointer;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    -webkit-tap-highlight-color: transparent;
    position: relative;
    z-index: 1;
    min-height: 44px;
    touch-action: manipulation;
}

.screen-share-menu-item:active {
    transform: scale(0.97);
}

.screen-share-menu-item:nth-child(2) {
    background: #c4b5fd;
    box-shadow: 0 4px 15px rgba(196, 181, 253, 0.38);
}

.screen-share-menu-item:nth-child(3) {
    background: #fde68a;
    color: #4a5568;
    box-shadow: 0 4px 15px rgba(253, 230, 138, 0.38);
}

.screen-share-menu-item--danger {
    background: transparent !important;
    color: #ffb7c5 !important;
    border: 2px solid rgba(255, 183, 197, 0.4) !important;
    box-shadow: none !important;
}

/* ===== 分享屏幕：便捷聊天悬浮迷你界面（少女漫画风） ===== */
.screen-share-mini-chat {
    position: absolute;
    right: calc(var(--safe-area-inset-right, env(safe-area-inset-right, 0px)) + 10px);
    bottom: calc(var(--safe-area-inset-bottom, env(safe-area-inset-bottom, 0px)) + 14px);
    width: min(348px, 92vw);
    /* 高度自适应：不超过手机真机屏幕高度的一半 */
    height: min(48vh, 430px);
    max-height: 50vh;
    display: none;
    flex-direction: column;
    overflow: hidden;
    border-radius: 24px;
    border: 2px solid rgba(255, 183, 197, 0.35);
    background-color: #fff5f7;
    /* 网点纹理 screentone */
    background-image:
        radial-gradient(circle 2px at 20% 30%, rgba(255, 182, 193, 0.35) 0%, transparent 100%),
        radial-gradient(circle 1.5px at 70% 20%, rgba(255, 182, 193, 0.28) 0%, transparent 100%),
        radial-gradient(circle 2px at 50% 70%, rgba(255, 182, 193, 0.3) 0%, transparent 100%);
    background-size: 56px 56px;
    box-shadow: 0 0 20px rgba(255, 183, 197, 0.25), 0 8px 30px rgba(196, 181, 253, 0.2);
    pointer-events: auto;
    z-index: 30;
}

.screen-share-mini-chat.show {
    display: flex;
}

.screen-share-mini-chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 12px 8px;
    background: linear-gradient(135deg, #ffb7c5, #fecdd3);
    box-shadow: 0 3px 10px rgba(255, 183, 197, 0.3);
}

.screen-share-mini-chat-title {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.screen-share-mini-chat-close {
    flex: none;
    width: 26px;
    height: 26px;
    border: none;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.88);
    color: #ffb7c5;
    font-size: 17px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(255, 183, 197, 0.3);
    -webkit-tap-highlight-color: transparent;
}

/* 便捷聊天：头部表情按钮 */
.screen-share-mini-chat-emoji-btn {
    flex: none;
    width: 26px;
    height: 26px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.88);
    color: #ffb7c5;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(255, 183, 197, 0.3);
    -webkit-tap-highlight-color: transparent;
}

.screen-share-mini-chat-emoji-btn svg {
    width: 17px;
    height: 17px;
}

/* 便捷聊天：表情面板（展开在头部下方，读微信表情库）
   细粉色描边 + 四周留边距，与消息列表视觉分隔；滚动条隐形 */
.screen-share-mini-chat-emoji-panel {
    display: none;
    flex: none;
    max-height: 168px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    margin: 8px 10px 2px;
    padding: 8px 10px;
    background: rgba(255, 255, 255, 0.92);
    border: 1.5px solid rgba(255, 183, 197, 0.55);
    border-radius: 14px;
    box-shadow: 0 2px 10px rgba(255, 183, 197, 0.16);
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.screen-share-mini-chat-emoji-panel.show {
    display: block;
}

.ss-mini-emoji-category {
    font-size: 11px;
    font-weight: 700;
    color: #b0889a;
    margin: 6px 0 4px;
}

.ss-mini-emoji-category:first-child {
    margin-top: 0;
}

.ss-mini-emoji-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(44px, 1fr));
    gap: 6px;
}

.ss-mini-emoji-item {
    border: none;
    padding: 2px;
    background: transparent;
    border-radius: 8px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.ss-mini-emoji-item:active {
    background: rgba(255, 183, 197, 0.2);
}

.ss-mini-emoji-item img {
    display: block;
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: contain;
}

.ss-mini-emoji-empty {
    padding: 14px 4px;
    text-align: center;
    font-size: 12px;
    color: #b0889a;
}

.screen-share-mini-chat-list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px 12px;
    /* 隐形滚动条：标准属性（Firefox）+ 旧 IE/Edge 属性，WebKit 内核走下方伪元素规则 */
    scrollbar-width: none;
    -ms-overflow-style: none;
}

/* 隐形滚动条：覆盖 Safari / Chrome / Edge / 夸克 / Via / 雨见等 WebKit & Blink 内核 */
.screen-share-mini-chat-list::-webkit-scrollbar,
.screen-share-mini-chat-emoji-panel::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
    background: transparent;
}

.ss-mini-row {
    display: flex;
}

.ss-mini-row--user {
    justify-content: flex-end;
}

.ss-mini-row--friend {
    justify-content: flex-start;
}

.ss-mini-row--system {
    justify-content: center;
}

/* 群聊便捷聊天：成员名标签竖排在气泡上方 */
.ss-mini-row--named {
    flex-direction: column;
    align-items: flex-start;
}

.ss-mini-name {
    font-size: 10px;
    line-height: 1.4;
    color: #b0889a;
    margin: 0 0 2px 8px;
}

.ss-mini-bubble {
    max-width: 82%;
    padding: 8px 12px;
    border-radius: 18px;
    font-size: 13px;
    line-height: 1.5;
    word-break: break-word;
    white-space: pre-wrap;
}

.ss-mini-row--user .ss-mini-bubble {
    background: linear-gradient(135deg, #ffb7c5, #fecdd3);
    color: #fff;
    border-bottom-right-radius: 6px;
    box-shadow: 0 2px 10px rgba(255, 183, 197, 0.35);
}

.ss-mini-row--friend .ss-mini-bubble {
    background: rgba(255, 255, 255, 0.86);
    color: #4a5568;
    border: 2px solid rgba(255, 183, 197, 0.18);
    border-bottom-left-radius: 6px;
    box-shadow: 0 2px 10px rgba(255, 183, 197, 0.16);
}

/* 便捷聊天：表情/图片消息 */
.ss-mini-bubble img,
.ss-mini-bubble img.chat-emoji {
    display: block;
    max-width: 132px;
    max-height: 132px;
    width: auto;
    height: auto;
    border-radius: 10px;
    object-fit: contain;
}

/* 便捷聊天：语音消息（标签 + 文字转写） */
.ss-mini-bubble--voice {
    display: flex;
    align-items: flex-start;
    gap: 6px;
}

.ss-mini-voice-tag {
    flex: none;
    margin-top: 1px;
    padding: 1px 8px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.04em;
    background: rgba(255, 255, 255, 0.55);
    color: #e290a5;
}

.ss-mini-row--friend .ss-mini-voice-tag {
    background: rgba(255, 183, 197, 0.22);
    color: #d97a93;
}

.ss-mini-row--system .ss-mini-bubble {
    max-width: 92%;
    padding: 4px 12px;
    background: rgba(255, 183, 197, 0.14);
    color: #b0889a;
    font-size: 11px;
    border-radius: 999px;
}

.ss-mini-typing .ss-mini-bubble {
    color: #c4b5fd;
    font-weight: 600;
}

.screen-share-mini-chat-inputbar {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 8px 10px calc(8px + var(--safe-area-inset-bottom, env(safe-area-inset-bottom, 0px)) * 0.4);
    background: rgba(255, 255, 255, 0.7);
    border-top: 1px solid rgba(255, 183, 197, 0.22);
}

.screen-share-mini-chat-input {
    flex: 1;
    min-width: 0;
    max-height: 84px;
    resize: none;
    border: 1px solid rgba(255, 183, 197, 0.3);
    border-radius: 18px;
    padding: 8px 14px;
    background: #fff;
    color: #4a5568;
    font-size: 13px;
    line-height: 1.45;
    font-family: inherit;
    outline: none;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.screen-share-mini-chat-input:focus {
    border-color: rgba(255, 183, 197, 0.65);
    box-shadow: 0 0 0 3px rgba(255, 183, 197, 0.18);
}

.screen-share-mini-chat-input::placeholder {
    color: rgba(255, 183, 197, 0.6);
}

.screen-share-mini-chat-send {
    flex: none;
    border: none;
    border-radius: 999px;
    padding: 9px 18px;
    background: #ffb7c5;
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(255, 183, 197, 0.5);
    transition: transform 0.25s ease, opacity 0.25s ease;
    -webkit-tap-highlight-color: transparent;
}

.screen-share-mini-chat-send:active {
    transform: scale(0.96);
}

.screen-share-mini-chat-send:disabled {
    opacity: 0.55;
    cursor: default;
}

/* 便捷聊天：「接收」按钮（描边样式区别于「发送」，接收中禁用变灰） */
.screen-share-mini-chat-receive {
    flex: none;
    border: 1.5px solid rgba(255, 183, 197, 0.65);
    border-radius: 999px;
    padding: 8px 14px;
    background: #fff;
    color: #e98aa2;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(255, 183, 197, 0.25);
    transition: transform 0.25s ease, opacity 0.25s ease;
    -webkit-tap-highlight-color: transparent;
}

.screen-share-mini-chat-receive:active {
    transform: scale(0.96);
}

.screen-share-mini-chat-receive:disabled {
    opacity: 0.55;
    cursor: default;
}

html[data-appearance="dark"] .video-feature-choice-note,
html[data-appearance="dark"] .video-feature-choice-btn-sub {
    color: rgba(235, 235, 245, 0.7);
}

html[data-appearance="dark"] .video-feature-choice-btn-title {
    color: #f5f5f7;
}

html[data-appearance="dark"] .video-feature-choice-btn {
    border-color: rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.06);
}

@media (max-width: 420px) {
    /* 窄屏真机：尽量放大可视预览区，封顶接近全宽 */
    .screen-share-floating-window {
        top: calc(var(--safe-area-inset-top, env(safe-area-inset-top, 0px)) + 48px);
        right: calc(var(--safe-area-inset-right, env(safe-area-inset-right, 0px)) + 4px);
        width: min(392px, 94vw);
        min-height: 470px;
    }

    .screen-share-placeholder {
        font-size: 14px;
        padding: 10px 12px;
    }
}

@media (max-height: 680px) {
    .screen-share-floating-window {
        width: min(360px, 92vw);
        min-height: 430px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .video-feature-choice-btn,
    .screen-share-floating-window {
        transition: none !important;
    }
}

