/* ============================================================
   co-mic-sheet.css · 连麦浮层 / 观众操作浮层 / 邀请观众二级抽屉
   ------------------------------------------------------------
   从 co-mic.css 拆出。画面布局/九宫格/浮动席位见 co-mic.css。
   ============================================================ */
/* ============ 连麦浮层（复用 .drawer）============
   初始布局 + 多观众连接/申请/邀请列表 */
#coMicSheet {
    z-index: 27;
    max-height: calc(100% - 132px);
    /* sheet 自身不滚动——它承载了下拖关闭手势，滚动放到内部 .comic-scroll 里 */
    overflow-y: hidden;
    overscroll-behavior: none;
    /* 让内部滚动容器可以撑满剩余高度 */
    display: flex;
    flex-direction: column;
}

/* 三列等宽头部保证收起、标题、结束操作始终共用同一水平中心线。 */
.comic-sheet-header {
    position: relative;
    z-index: 1;
    min-height: 32px;
    margin-bottom: 16px;
    display: grid;
    grid-template-columns: 88px minmax(0, 1fr) 88px;
    align-items: center;
}

#coMicSheet .comic-sheet-header .drawer-title {
    grid-column: 2;
    margin-bottom: 0;
    line-height: 20px;
    text-align: center;
}

.comic-collapse-button,
.comic-end-all-button {
    border: 0;
    background: transparent;
    font: inherit;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.comic-collapse-button {
    grid-column: 1;
    width: 36px;
    height: 32px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    color: rgba(255, 255, 255, 0.76);
}

.comic-collapse-button svg {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.comic-end-all-button {
    grid-column: 3;
    justify-self: end;
    padding: 6px 0;
    color: #e56b73;
    font-size: 13px;
    font-weight: 600;
    line-height: 20px;
    letter-spacing: 0.3px;
}

.comic-collapse-button:active {
    transform: scale(0.94);
}

.comic-end-all-button:active {
    color: #ff858d;
    transform: scale(0.96);
}

.comic-collapse-button[hidden],
.comic-end-all-button[hidden] {
    display: none;
}

/* 观众列表滚动容器：观众多时列表内滚动，头部（accent/handle/title）固定；overscroll 隔离 */
.comic-scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    /* 触屏惯性 + 只允许纵向滚动，避免与下拖关闭手势冲突 */
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
    /* 隐藏滚动条 */
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.comic-scroll::-webkit-scrollbar {
    width: 0;
    height: 0;
    display: none;
}

/* 深色圆角卡片区 */
.comic-section {
    position: relative;
    z-index: 1;
    padding: 16px;
    border-radius: 16px;
    background: rgba(0, 0, 0, 0.28);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

#coMicSheet .comic-section + .comic-section {
    margin-top: 12px;
}

.comic-section-title {
    font-size: 12px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.85);
    margin-bottom: 12px;
    letter-spacing: 0.5px;
}

/* 四个布局选项按“浮动/二宫格、固定/九宫格”排成两行两列。 */
.comic-layouts {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.comic-layout {
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 6px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.05) 0%, rgba(255, 255, 255, 0.015) 100%),
        rgba(0, 0, 0, 0.22);
    color: rgba(255, 255, 255, 0.72);
    font-size: 13px;
    letter-spacing: 0.5px;
    cursor: pointer;
    position: relative;
    transition: color 200ms ease, border-color 200ms ease, background 200ms ease, transform 120ms ease;
}

.comic-layout:not(.active):active {
    transform: scale(0.97);
    color: rgba(255, 255, 255, 0.9);
}

.comic-layout svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.6;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.comic-layout-icon {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 选中态：品牌渐变描边 + 品牌色文字/图标（随主题变量走） */
.comic-layout.active {
    border-color: transparent;
    color: var(--brand-text-strong);
    font-weight: 600;
    background:
        linear-gradient(180deg,
            color-mix(in srgb, var(--brand-2) 26%, transparent) 0%,
            color-mix(in srgb, var(--brand-1) 16%, transparent) 100%);
}

.comic-layout.active::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 12px;
    padding: 1.5px;
    background: linear-gradient(135deg, var(--brand-1), var(--brand-2) 55%, var(--brand-3));
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
}

/* 连麦观众区域始终保留；空闲时展示空状态，接通后展示观众和结束按钮。 */
.comic-audience-section {
    min-height: 152px;
}

.comic-audience-empty {
    min-height: 92px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.52);
    font-size: 14px;
    letter-spacing: 0.5px;
}

.comic-dynamic-section[hidden] {
    display: none;
}

.comic-audience-row {
    min-height: 54px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.07);
}

.comic-audience-identity {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.comic-audience-avatar {
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border-radius: 50%;
    font-size: 20px;
    background: color-mix(in srgb, var(--brand-1) 18%, rgba(255, 255, 255, 0.06));
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--brand-2) 22%, transparent);
    overflow: hidden;
}

.audience-image-avatar {
    position: relative;
    width: 100%;
    height: 100%;
    display: block;
    overflow: hidden;
    border-radius: 50%;
}

.audience-image-avatar::before {
    content: attr(data-emoji);
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(25, 27, 34, 0.9);
    font-size: 0.72em;
    line-height: 1;
}

.audience-image-avatar img {
    position: relative;
    z-index: 1;
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    background-color: inherit;
    opacity: 0;
    transition: opacity 100ms ease;
}

.audience-image-avatar img.is-loaded {
    opacity: 1;
}

.comic-audience-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: rgba(255, 255, 255, 0.88);
    font-size: 13px;
}

.comic-audience-action {
    min-width: 68px;
    height: 36px;
    padding: 0 14px;
    flex-shrink: 0;
    border: 1px solid color-mix(in srgb, var(--brand-2) 28%, rgba(255, 255, 255, 0.08));
    border-radius: 10px;
    color: #fff;
    background: color-mix(in srgb, var(--brand-1) 34%, rgba(255, 255, 255, 0.08));
    font: inherit;
    font-size: 12px;
    cursor: pointer;
}

/* 带前置图标的按钮（当前用于“接通”）：图标 + 文字水平排布，与仅文字的“邀请”做视觉区分 */
.comic-audience-action.with-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 0 12px;
}

.comic-audience-action-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    color: currentColor;
}

.comic-audience-action.danger {
    border-color: rgba(255, 79, 86, 0.22);
    color: #ff7076;
    background: rgba(255, 79, 86, 0.1);
}

.comic-audience-action:disabled {
    border-color: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.4);
    background: rgba(255, 255, 255, 0.06);
    cursor: default;
}

.comic-audience-action:not(:disabled):active {
    transform: scale(0.96);
}

/* ============ 连麦观众操作浮层 ============ */
/* 尺寸/样式对齐直播中「更多」抽屉里的 .cap-icon（44×44 圆 + 22 SVG + 1.6 描边 + label 11px）。
   布局：handle + 标题 都用 sheet.css 默认规格贴顶（和其他浮层同位置），
   操作行（.comic-manage-actions）在剩余空间内垂直居中。 */
#coMicAudienceSheet,
#hostPeerManageSheet,
#audiencePeerManageSheet {
    z-index: 30;
    min-height: 170px;
    padding: 10px 20px 16px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    touch-action: none;
    user-select: none;
}

#coMicAudienceSheet .drawer-handle,
#hostPeerManageSheet .drawer-handle,
#audiencePeerManageSheet .drawer-handle {
    cursor: grab;
    flex: 0 0 auto;
}

/* 标题保留 sheet.css 默认 margin-bottom: 16px，位置与其他浮层标题一致 */

.comic-manage-actions {
    position: relative;
    z-index: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 48px;
    /* 占据 handle+标题 下方的剩余空间并把内部图标垂直居中 */
    flex: 1 1 auto;
    margin-top: 0;
}

/* 单个按钮对齐 .cap（sheet.css）：竖向堆叠，图标 + label，无背景 */
.comic-manage-action {
    width: 64px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    border: 0;
    color: rgba(255, 255, 255, 0.75);
    background: none;
    font: inherit;
    cursor: pointer;
}

.comic-manage-action[hidden] {
    display: none;
}

/* 图标容器对齐 .cap-icon：44×44 圆 + 深灰底 */
.comic-manage-action-icon {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: rgba(255, 255, 255, 0.9);
    background: rgba(255, 255, 255, 0.08);
    transition: transform 140ms ease, color 180ms ease, background 200ms ease;
}

/* SVG 尺寸/描边对齐 .cap svg */
.comic-manage-action-icon svg {
    width: 22px;
    height: 22px;
    stroke: rgba(255, 255, 255, 0.9);
    fill: none;
    stroke-width: 1.6;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* 文字对齐 .cap-label：11px */
.comic-manage-action-label {
    font-size: 11px;
    line-height: 1.3;
    letter-spacing: 0;
    white-space: nowrap;
    color: rgba(255, 255, 255, 0.75);
}

/* 静音激活态：仅通过图标斜线（.comic-mute-slash）表达"已静音"，
   不改背景，保持与外侧「更多」抽屉里静音的常规态背景一致。 */

/* 断开连麦：红色调 */
.comic-manage-action.danger {
    color: #ff9095;
}

.comic-manage-action.danger .comic-manage-action-icon {
    color: #ff8087;
    background: rgba(255, 79, 86, 0.12);
}

.comic-manage-action.danger .comic-manage-action-icon svg {
    stroke: #ff8087;
    /* 新图标结构更精细，描边略降到 1.4，避免在 22×22 里显得过粗 */
    stroke-width: 1.4;
}

.comic-manage-action:active .comic-manage-action-icon {
    transform: scale(0.94);
}

/* 静音图标：默认隐藏斜线；.is-muted 时显示，形成 mic → micSlash 的切换（与 settings.js 完全一致） */
.comic-mute-slash {
    display: none;
}

.comic-manage-action.is-muted .comic-mute-slash {
    display: inline;
}

/* ============ 邀请观众连麦（二级抽屉） ============ */
#coMicInviteSheet {
    z-index: 28;
    height: 620px;
    padding: 10px 20px 34px;
    touch-action: none;
    user-select: none;
}

#coMicInviteSheet .drawer-handle {
    cursor: grab;
}

#coMicSheet {
    touch-action: none;
    user-select: none;
}

#coMicSheet .drawer-handle {
    cursor: grab;
}

.comic-invite-empty {
    position: relative;
    z-index: 1;
    height: 510px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.36);
    font-size: 15px;
    letter-spacing: 0.5px;
}

.comic-invite-content {
    position: relative;
    z-index: 1;
    min-height: 510px;
}

.comic-invite-content > .comic-audience-row {
    margin-top: 12px;
}

.comic-invite-content .comic-invite-empty {
    height: 510px;
}
