/* ═══ VOID GACHA · 全服社交面板（左下角 · 掛 body） ═══ */
.void-chat-panel {
    /* 右側多留空，避免貼住展示卡牌 */
    --void-chat-w: min(400px, calc(100vw - var(--void-side-nav, 102px) - 72px));
    --void-chat-h: min(520px, 52dvh, calc(100dvh - 96px));
    position: fixed;
    left: max(16px, env(safe-area-inset-left, 0px));
    bottom: max(16px, env(safe-area-inset-bottom, 0px));
    width: var(--void-chat-w);
    height: var(--void-chat-h);
    max-height: calc(100dvh - 80px);
    min-height: min(320px, calc(100dvh - 80px));
    z-index: 150;
    display: flex;
    flex-direction: column;
    border-radius: 16px;
    border: 1px solid rgba(255, 215, 0, 0.3);
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow:
        0 16px 48px rgba(0, 0, 0, 0.6),
        16px 0 32px rgba(0, 0, 0, 0.45),
        0 0 32px rgba(0, 180, 255, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.08);
    overflow: hidden;
    font-size: 15px;
    color: rgba(235, 240, 255, 0.92);
    transition: transform 0.28s ease, opacity 0.28s ease, box-shadow 0.3s ease;
    contain: layout style;
}

.void-chat-panel.is-pulse {
    animation: voidChatPanelPulse 0.85s ease-out;
}

@keyframes voidChatPanelPulse {
    0% {
        box-shadow: 0 0 0 rgba(255, 215, 0, 0), 0 16px 48px rgba(0, 0, 0, 0.6);
    }
    40% {
        box-shadow: 0 0 40px rgba(255, 215, 0, 0.45), 0 0 60px rgba(0, 255, 255, 0.2);
    }
    100% {
        box-shadow: 0 16px 48px rgba(0, 0, 0, 0.6), 0 0 32px rgba(0, 180, 255, 0.1);
    }
}

.void-chat-frame-glow {
    pointer-events: none;
    position: absolute;
    inset: -1px;
    border-radius: 17px;
    background: linear-gradient(
        120deg,
        rgba(0, 255, 255, 0.35),
        rgba(255, 215, 0, 0.25),
        rgba(255, 110, 199, 0.3),
        rgba(0, 255, 255, 0.35)
    );
    background-size: 300% 300%;
    animation: voidChatBorderFlow 6s linear infinite;
    opacity: 0.55;
    z-index: 0;
    mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    mask-composite: exclude;
    -webkit-mask-composite: xor;
    padding: 1px;
}

@keyframes voidChatBorderFlow {
    to {
        background-position: 300% 50%;
    }
}

.void-chat-panel > *:not(.void-chat-frame-glow) {
    position: relative;
    z-index: 1;
}

/* 右緣輕微切割感，與後方卡牌區分開 */
.void-chat-panel::after {
    content: "";
    position: absolute;
    top: 8px;
    right: -24px;
    width: 28px;
    height: calc(100% - 16px);
    pointer-events: none;
    border-radius: 0 14px 14px 0;
    background: linear-gradient(90deg, rgba(0, 0, 0, 0.5), transparent);
    z-index: 0;
}

.void-chat-panel.is-collapsed {
    height: auto;
    max-height: 52px;
    min-height: 0;
}

.void-chat-panel.is-collapsed .void-chat-channel-hint,
.void-chat-panel.is-collapsed .void-chat-body,
.void-chat-panel.is-collapsed .void-chat-foot,
.void-chat-panel.is-collapsed .void-chat-friends-bar,
.void-chat-panel.is-collapsed .void-chat-tabs {
    display: none;
}

.void-chat-panel.is-hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateY(14px) scale(0.98);
}

/* ── 頂欄（緊湊兩行，避免擠掉訊息區） ── */
.void-chat-head {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 6px 8px 4px;
    border-bottom: 1px solid rgba(255, 215, 0, 0.18);
    background: linear-gradient(180deg, rgba(50, 24, 90, 0.55), rgba(8, 6, 20, 0.2));
}

.void-chat-head-top {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.void-chat-brand {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
    min-width: 0;
    font-family: Orbitron, 'Noto Sans TC', sans-serif;
    font-size: 12px;
    letter-spacing: 0.14em;
    color: rgba(0, 255, 255, 0.85);
}

.void-chat-collapse-btn {
    flex-shrink: 0;
}

.void-chat-brand-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #3dff9a;
    box-shadow: 0 0 8px #3dff9a;
    animation: voidChatDotBlink 1.8s ease-in-out infinite;
}

@keyframes voidChatDotBlink {
    0%,
    100% {
        opacity: 0.5;
    }
    50% {
        opacity: 1;
    }
}

.void-chat-online {
    margin-left: auto;
    flex-shrink: 0;
    font-size: 11px;
    color: rgba(200, 220, 255, 0.65);
    letter-spacing: 0.06em;
    white-space: nowrap;
}

.void-chat-tabs {
    display: flex;
    gap: 3px;
    min-width: 0;
    width: 100%;
}

.void-chat-tab {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 7px 4px;
    border: none;
    border-radius: 10px 10px 0 0;
    background: transparent;
    color: rgba(200, 210, 255, 0.6);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.06em;
    cursor: pointer;
    position: relative;
    transition: color 0.2s, background 0.2s, text-shadow 0.2s;
}

.void-chat-tab-icon {
    font-size: 14px;
    line-height: 1;
}

.void-chat-tab:hover {
    color: #fff;
    background: rgba(127, 0, 255, 0.2);
}

.void-chat-tab.is-active {
    color: #fff;
    text-shadow: 0 0 12px rgba(0, 255, 255, 0.5);
    background: linear-gradient(180deg, rgba(0, 255, 255, 0.14), rgba(255, 0, 170, 0.06));
}

.void-chat-tab.is-active::after {
    content: '';
    position: absolute;
    left: 10%;
    right: 10%;
    bottom: 0;
    height: 2px;
    border-radius: 2px;
    background: linear-gradient(90deg, #00ffff, #ffd700, #ff6ec7);
    box-shadow: 0 0 12px rgba(0, 255, 255, 0.7);
}

.void-chat-panel[data-tab='system'] .void-chat-tab[data-tab='system'].is-active::after {
    background: linear-gradient(90deg, #ffd700, #fff8dc, #ffd700);
}

.void-chat-tab-badge {
    display: inline-block;
    min-width: 14px;
    padding: 0 4px;
    border-radius: 8px;
    font-size: 9px;
    line-height: 14px;
    background: linear-gradient(135deg, #ff3366, #ffd700);
    color: #1a0828;
    font-weight: 900;
}

.void-chat-tab-badge.hidden,
.void-chat-icon-btn.hidden {
    display: none;
}

.void-chat-channel-hint {
    flex-shrink: 0;
    flex: 0 0 auto;
    padding: 6px 12px 8px;
    font-size: 12px;
    color: rgba(180, 200, 255, 0.72);
    letter-spacing: 0.04em;
    line-height: 1.45;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.void-chat-panel[data-tab='system'] .void-chat-channel-hint {
    color: rgba(255, 215, 0, 0.7);
}

/* ── 好友列 ── */
.void-chat-friends-bar {
    flex: 0 0 auto;
    display: none;
    flex-wrap: wrap;
    gap: 6px;
    padding: 6px 10px;
    overflow: visible;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.void-chat-panel[data-tab='friends'] .void-chat-friends-bar {
    display: flex;
}

.void-chat-friend-chip {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px 4px 5px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(20, 12, 40, 0.7);
    color: rgba(220, 230, 255, 0.92);
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s;
}

.void-chat-friend-chip:hover {
    transform: translateY(-1px);
}

.void-chat-friend-chip.is-active {
    border-color: rgba(0, 255, 255, 0.6);
    box-shadow: 0 0 14px rgba(0, 255, 255, 0.3);
}

.void-chat-friend-chip .dot-online {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #3dff9a;
    box-shadow: 0 0 8px #3dff9a;
}

/* ── 訊息區 ── */
.void-chat-body {
    flex: 1 1 auto;
    min-height: 140px;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 10px 12px 8px;
    scroll-behavior: smooth;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.15), transparent 40%);
}

.void-chat-load-more {
    display: block;
    width: 100%;
    margin: 0 0 10px;
    padding: 8px 10px;
    border: 1px solid rgba(0, 240, 255, 0.35);
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.35);
    color: rgba(200, 240, 255, 0.92);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}

.void-chat-load-more:hover {
    border-color: rgba(0, 255, 255, 0.58);
    background: rgba(0, 255, 255, 0.12);
}

.void-chat-msg {
    margin-bottom: 10px;
    padding: 8px 10px;
    line-height: 1.55;
    font-size: 14px;
    word-break: break-word;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.03);
    animation: voidChatMsgIn 0.32s cubic-bezier(0.22, 1, 0.36, 1);
}

.void-chat-msg.is-self {
    background: rgba(0, 255, 255, 0.06);
    border: 1px solid rgba(0, 255, 255, 0.12);
}

@keyframes voidChatMsgIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.void-chat-msg--sys-gacha {
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid rgba(255, 215, 0, 0.5);
    background: linear-gradient(105deg, rgba(90, 50, 0, 0.45), rgba(50, 10, 80, 0.5));
    color: #fff4c4;
    font-weight: 700;
    text-shadow: 0 0 14px rgba(255, 215, 0, 0.45);
    animation: voidChatGoldPulse 2.2s ease-in-out infinite, voidChatMsgIn 0.4s ease-out;
}

.void-chat-msg--sys-gacha::before {
    content: '✦ ';
    color: #ffd700;
}

.void-chat-msg--sys-trade {
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid rgba(0, 240, 255, 0.42);
    background: linear-gradient(105deg, rgba(8, 40, 52, 0.55), rgba(20, 10, 48, 0.52));
    color: #d8f4ff;
    font-weight: 700;
    text-shadow: 0 0 10px rgba(0, 240, 255, 0.25);
    animation: voidChatMsgIn 0.4s ease-out;
}

.void-chat-msg--sys-trade .void-chat-msg-body {
    display: inline;
}

.void-chat-msg--sys-trade .rarity-SEC,
.void-chat-msg--sys-trade .void-chat-card-link.rarity-SEC {
    color: #f0abfc;
}

.void-chat-msg--sys-trade .rarity-MR,
.void-chat-msg--sys-trade .void-chat-card-link.rarity-MR {
    color: #ff6ec7;
}

.void-chat-msg--sys-trade .rarity-UR,
.void-chat-msg--sys-trade .void-chat-card-link.rarity-UR {
    color: #ffd700;
}

@keyframes voidChatGoldPulse {
    0%,
    100% {
        box-shadow: 0 0 10px rgba(255, 215, 0, 0.2);
    }
    50% {
        box-shadow: 0 0 22px rgba(255, 215, 0, 0.45), inset 0 0 20px rgba(255, 215, 0, 0.08);
    }
}

.void-chat-msg--sys-gacha .rarity-SEC {
    color: #f0abfc;
    text-shadow: 0 0 10px rgba(232, 121, 249, 0.8);
}
.void-chat-msg--sys-gacha .rarity-MR {
    color: #ff6ec7;
    text-shadow: 0 0 10px rgba(255, 77, 141, 0.7);
}
.void-chat-msg--sys-gacha .rarity-UR {
    color: #ffd700;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.8);
}

.void-chat-msg--sys-info {
    border: 1px dashed rgba(255, 215, 0, 0.28);
    color: rgba(255, 236, 200, 0.95);
    font-size: 15px;
    font-weight: 600;
    line-height: 1.6;
    padding: 10px 12px;
}

.void-chat-msg--world-boss-spawn {
    border: 1px solid rgba(255, 120, 60, 0.55);
    background: linear-gradient(120deg, rgba(80, 20, 10, 0.72), rgba(40, 10, 30, 0.78));
    color: #fff3dc;
    box-shadow: 0 0 18px rgba(255, 90, 40, 0.22);
    font-weight: 800;
}

.void-chat-msg--world-promo {
    border: 1px solid rgba(255, 180, 80, 0.35);
    background: linear-gradient(105deg, rgba(40, 20, 60, 0.55), rgba(20, 10, 40, 0.65));
    color: rgba(255, 230, 190, 0.98);
    font-weight: 700;
    line-height: 1.6;
    padding: 10px 12px;
}

.void-chat-msg--world-promo .void-chat-msg-sender {
    color: #ffd080;
    text-shadow: 0 0 10px rgba(255, 180, 80, 0.45);
}

.void-chat-msg--world-promo .void-chat-msg-body {
    color: rgba(255, 240, 210, 0.96);
}

.void-chat-panel[data-tab='system'] .void-chat-msg--sys-gacha {
    font-size: 14px;
    line-height: 1.55;
}

.void-chat-msg-meta {
    display: block;
    font-size: 12px;
    color: rgba(180, 200, 235, 0.72);
    margin-bottom: 5px;
    letter-spacing: 0.04em;
}

.void-chat-msg-sender {
    font-weight: 800;
    color: rgba(0, 255, 255, 0.9);
    margin-right: 4px;
}

.void-chat-msg-body {
    color: rgba(235, 242, 255, 0.94);
}

.void-chat-card-link,
.void-chat-card-plain {
    display: inline;
    margin: 0;
    padding: 0;
    border: none;
    background: none;
    font: inherit;
    color: #ffd700;
    font-weight: 800;
    cursor: pointer;
    text-decoration: underline;
    text-decoration-color: rgba(255, 215, 0, 0.55);
    text-underline-offset: 3px;
    vertical-align: baseline;
}

.void-chat-card-plain {
    cursor: default;
}

.void-chat-card-link:hover,
.void-chat-card-link:focus-visible {
    color: #fff;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.7);
    outline: none;
}

/* 預設金（SR 以下等未列稀有度） */
.void-chat-msg--sys-gacha .void-chat-card-link:not([class*='rarity-']),
.void-chat-msg--sys-gacha .void-chat-card-plain:not([class*='rarity-']) {
    color: #ffe566;
    text-shadow: 0 0 8px rgba(255, 215, 0, 0.55);
}

.void-chat-msg--sys-gacha .void-chat-card-link:not([class*='rarity-']):hover,
.void-chat-msg--sys-gacha .void-chat-card-link:not([class*='rarity-']):focus-visible {
    color: #fff;
    text-shadow: 0 0 14px rgba(255, 215, 0, 0.95);
}

/* SEC / MR / UR · 彩虹漸變字（含 data-rarity 後備） */
.void-chat-body .void-chat-card-link.rarity-SEC,
.void-chat-body .void-chat-card-link.rarity-MR,
.void-chat-body .void-chat-card-link.rarity-UR,
.void-chat-body .void-chat-card-link[data-rarity='SEC'],
.void-chat-body .void-chat-card-link[data-rarity='MR'],
.void-chat-body .void-chat-card-link[data-rarity='UR'],
.void-chat-body .void-chat-card-plain.rarity-SEC,
.void-chat-body .void-chat-card-plain.rarity-MR,
.void-chat-body .void-chat-card-plain.rarity-UR,
.void-chat-body .void-chat-card-plain[data-rarity='SEC'],
.void-chat-body .void-chat-card-plain[data-rarity='MR'],
.void-chat-body .void-chat-card-plain[data-rarity='UR'] {
    -webkit-appearance: none;
    appearance: none;
    background: linear-gradient(
        105deg,
        #ff3d9a 0%,
        #ffd700 14%,
        #7dff9a 28%,
        #00f0ff 42%,
        #c084fc 56%,
        #ff6b6b 70%,
        #ffd700 84%,
        #ff3d9a 100%
    );
    background-size: 320% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    text-shadow: none;
    text-decoration-color: rgba(200, 160, 255, 0.45);
    animation: void-chat-card-rainbow 4.2s linear infinite;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.85));
}

/* UR / SSR · 紫霓虹發光（UR 疊加於彩虹之上） */
.void-chat-body .void-chat-card-link.rarity-UR,
.void-chat-body .void-chat-card-link[data-rarity='UR'],
.void-chat-body .void-chat-card-plain.rarity-UR,
.void-chat-body .void-chat-card-plain[data-rarity='UR'],
.void-chat-body .void-chat-card-plain[data-rarity='UR'] {
    animation:
        void-chat-card-rainbow 4.2s linear infinite,
        void-chat-card-purple-glow 2.2s ease-in-out infinite alternate;
    filter: drop-shadow(0 0 5px rgba(168, 85, 247, 0.95))
        drop-shadow(0 0 12px rgba(216, 70, 239, 0.75))
        drop-shadow(0 0 22px rgba(124, 58, 237, 0.55))
        drop-shadow(0 1px 2px rgba(0, 0, 0, 0.9));
}

.void-chat-body .void-chat-card-link.rarity-SEC:hover,
.void-chat-body .void-chat-card-link.rarity-MR:hover,
.void-chat-body .void-chat-card-link.rarity-UR:hover,
.void-chat-body .void-chat-card-link.rarity-SEC:focus-visible,
.void-chat-body .void-chat-card-link.rarity-MR:focus-visible,
.void-chat-body .void-chat-card-link.rarity-UR:focus-visible {
    color: transparent;
    -webkit-text-fill-color: transparent;
    outline: none;
}

@keyframes void-chat-card-rainbow {
    0% {
        background-position: 0% 50%;
    }
    100% {
        background-position: 320% 50%;
    }
}

@keyframes void-chat-card-purple-glow {
    0% {
        filter: drop-shadow(0 0 4px rgba(168, 85, 247, 0.75))
            drop-shadow(0 0 10px rgba(216, 70, 239, 0.55))
            drop-shadow(0 0 18px rgba(124, 58, 237, 0.35))
            drop-shadow(0 1px 2px rgba(0, 0, 0, 0.9));
    }
    100% {
        filter: drop-shadow(0 0 8px rgba(192, 132, 252, 1))
            drop-shadow(0 0 18px rgba(232, 121, 249, 0.9))
            drop-shadow(0 0 32px rgba(167, 139, 250, 0.65))
            drop-shadow(0 1px 2px rgba(0, 0, 0, 0.9));
    }
}

.void-chat-world-share {
    display: inline;
}

/* 世界頻道分享：僅文字連結，不顯示卡圖預覽（含舊訊息殘留） */
.void-chat-body .void-chat-card-share {
    display: none !important;
}

.void-chat-bag-box.is-world-share .void-chat-bag-trade-only {
    display: none !important;
}

.void-chat-empty {
    text-align: center;
    padding: 28px 14px;
    color: rgba(180, 190, 220, 0.55);
    font-size: 14px;
    line-height: 1.65;
}

/* ── 輸入區 ── */
.void-chat-foot {
    flex: 0 0 auto;
    flex-shrink: 0;
    padding: 8px 10px 10px;
    border-top: 1px solid rgba(255, 215, 0, 0.15);
    background: rgba(0, 0, 0, 0.4);
}

.void-chat-foot.is-readonly .void-chat-compose {
    display: none;
}

.void-chat-foot-readonly-hint {
    display: none;
    margin: 0;
    text-align: center;
    font-size: 13px;
    line-height: 1.5;
    color: rgba(255, 215, 0, 0.82);
    letter-spacing: 0.06em;
}

.void-chat-foot.is-readonly .void-chat-foot-readonly-hint {
    display: block;
}

.void-chat-compose {
    position: relative;
    display: flex;
    align-items: center;
    gap: 6px;
}

.void-chat-input {
    flex: 1;
    min-width: 0;
    padding: 9px 12px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(6, 4, 18, 0.9);
    color: #fff;
    font-size: 16px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.void-chat-input:focus {
    border-color: rgba(0, 255, 255, 0.5);
    box-shadow: 0 0 0 2px rgba(0, 255, 255, 0.15), 0 0 20px rgba(0, 255, 255, 0.1);
}

.void-chat-input.void-chat-input--spam {
    border-color: rgba(255, 90, 90, 0.75);
    box-shadow: 0 0 0 2px rgba(255, 60, 60, 0.25);
    animation: voidChatInputSpam 0.45s ease;
}

@keyframes voidChatInputSpam {
    0%,
    100% {
        transform: translateX(0);
    }
    20%,
    60% {
        transform: translateX(-3px);
    }
    40%,
    80% {
        transform: translateX(3px);
    }
}

.void-chat-foot-actions {
    display: flex;
    gap: 5px;
    flex-shrink: 0;
}

.void-chat-icon-btn {
    width: 34px;
    height: 34px;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.45);
    color: rgba(220, 235, 255, 0.9);
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, transform 0.15s;
}

.void-chat-icon-btn:hover {
    border-color: rgba(0, 255, 255, 0.5);
    background: rgba(0, 255, 255, 0.12);
    transform: scale(1.06);
}

.void-chat-send {
    padding: 9px 14px;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, #7f00ff 0%, #00b4d8 50%, #ffd700 100%);
    background-size: 200% auto;
    color: #fff;
    font-size: 11px;
    font-weight: 900;
    letter-spacing: 0.1em;
    cursor: pointer;
    transition: filter 0.2s, transform 0.15s, background-position 0.3s;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.void-chat-send:hover {
    filter: brightness(1.15);
    transform: translateY(-2px);
    background-position: 100% center;
}

/* ── 統一表情包（輸入框正上方） ── */
.void-chat-emoji-pop {
    --emoji-accent: rgba(127, 200, 255, 0.55);
    --emoji-glow: rgba(127, 0, 255, 0.2);
    position: absolute;
    left: 0;
    right: 0;
    bottom: calc(100% + 8px);
    z-index: 20;
    padding: 10px;
    border-radius: 14px;
    border: 1px solid rgba(255, 215, 0, 0.28);
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow:
        0 -10px 36px rgba(0, 0, 0, 0.55),
        0 0 28px var(--emoji-glow),
        inset 0 1px 0 rgba(255, 255, 255, 0.06);
    overflow: hidden;
}

.void-chat-emoji-pop::before {
    content: "";
    position: absolute;
    inset: -1px;
    border-radius: inherit;
    padding: 1px;
    background: linear-gradient(
        135deg,
        rgba(255, 215, 0, 0.45),
        var(--emoji-accent),
        rgba(0, 180, 255, 0.35),
        rgba(255, 215, 0, 0.45)
    );
    background-size: 300% 300%;
    animation: void-chat-emoji-border-flow 6s ease infinite;
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
    z-index: 0;
}

@keyframes void-chat-emoji-border-flow {
    0%,
    100% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
}

.void-chat-emoji-pop.hidden {
    display: none;
}

.void-chat-emoji-scroll {
    position: relative;
    z-index: 1;
    max-height: min(200px, 32vh);
    overflow-x: hidden;
    overflow-y: auto;
    padding-right: 2px;
}

.void-chat-emoji-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 6px;
}

@media (max-width: 420px) {
    .void-chat-emoji-grid {
        grid-template-columns: repeat(5, 1fr);
    }
}

.void-chat-emoji-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 8px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    background: linear-gradient(145deg, rgba(40, 20, 70, 0.45), rgba(8, 6, 20, 0.75));
    font-size: 21px;
    line-height: 1;
    cursor: pointer;
    transition: background 0.18s, transform 0.18s, box-shadow 0.18s, border-color 0.18s;
}

.void-chat-emoji-btn:hover {
    border-color: var(--emoji-accent);
    background: rgba(255, 255, 255, 0.1);
    transform: scale(1.2);
    box-shadow: 0 0 16px var(--emoji-glow);
    z-index: 2;
}

/* ── 背包選卡 ── */
.void-chat-bag-modal {
    position: fixed;
    inset: 0;
    /* 高於手機版聊天面板 (210) 與底部導覽 (220) */
    z-index: 280;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(6px);
}

.void-chat-bag-modal.hidden {
    display: none;
}

.void-chat-bag-box {
    width: min(920px, 96vw);
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    border-radius: 18px;
    border: 1px solid rgba(255, 215, 0, 0.35);
    background: rgba(10, 6, 24, 0.96);
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.75), 0 0 40px rgba(127, 0, 255, 0.2);
}

.void-chat-bag-hint {
    margin: 0;
    padding: 0 20px 10px;
    font-size: 13px;
    line-height: 1.45;
    color: rgba(200, 215, 255, 0.72);
    letter-spacing: 0.03em;
    text-align: center;
}

.void-chat-bag-head {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 14px 48px 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.void-chat-bag-head h3 {
    margin: 0;
    font-size: 18px;
    color: #ffd700;
    letter-spacing: 0.06em;
    text-align: center;
}

.void-chat-bag-close {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
}

.void-chat-bag-search-wrap {
    display: flex;
    justify-content: center;
    padding: 0 20px 12px;
}

.void-chat-bag-search {
    width: min(420px, 100%);
    padding: 10px 14px;
    border-radius: 10px;
    border: 1px solid rgba(0, 240, 255, 0.45);
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    font-size: 16px;
    font-family: 'Noto Sans TC', 'Segoe UI', sans-serif;
    text-align: center;
}

.void-chat-bag-search::placeholder {
    color: rgba(180, 200, 255, 0.55);
}

.void-chat-bag-search:focus {
    outline: none;
    border-color: rgba(0, 240, 255, 0.75);
    box-shadow: 0 0 16px rgba(0, 240, 255, 0.2);
}

.void-chat-bag-no-result {
    margin: 0;
    padding: 0 20px 16px;
    text-align: center;
    font-size: 14px;
    font-weight: 700;
    color: rgba(200, 215, 255, 0.75);
}

.void-chat-bag-no-result.hidden {
    display: none;
}

.void-chat-bag-box.is-card-selected .void-chat-bag-list,
.void-chat-bag-box.is-card-selected .void-chat-bag-search-wrap,
.void-chat-bag-box.is-card-selected .void-chat-bag-no-result {
    display: none;
}

.void-chat-bag-box.is-card-selected .void-chat-bag-hint {
    color: #ffe9a8;
    border-bottom: 1px solid rgba(255, 215, 0, 0.15);
    padding-bottom: 12px;
    margin-bottom: 0;
}

.void-chat-bag-list {
    flex: 1 1 auto;
    min-height: 280px;
    max-height: min(56vh, 560px);
    overflow-y: auto;
    overflow-x: hidden;
    padding: 4px 18px 16px;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    align-content: start;
}

.void-chat-bag-list > .void-chat-empty {
    grid-column: 1 / -1;
}

.void-chat-bag-item {
    display: flex;
    flex-direction: column;
    padding: 0;
    min-width: 0;
    height: auto;
    align-self: start;
    border-radius: 14px;
    border: 2px solid rgba(255, 255, 255, 0.14);
    background: rgba(0, 0, 0, 0.5);
    text-align: center;
    cursor: pointer;
    color: inherit;
    overflow: hidden;
    transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s;
}

.void-chat-bag-item:hover {
    border-color: rgba(0, 255, 255, 0.45);
    box-shadow: 0 0 16px rgba(0, 255, 255, 0.2);
    transform: translateY(-2px);
}

.void-chat-bag-item.is-selected {
    border-color: rgba(255, 215, 0, 0.75);
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.35);
}

.void-chat-bag-item__art {
    position: relative;
    width: 100%;
    aspect-ratio: 2 / 3;
    min-height: 200px;
    flex-shrink: 0;
    background: linear-gradient(180deg, #0a0614 0%, #06040c 100%);
    overflow: hidden;
}

.void-chat-bag-item__frame {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: stretch;
    justify-content: stretch;
}

.void-chat-bag-item__frame .void-card-stage,
.void-chat-bag-item__frame .catalog-tile-3d {
    width: 100%;
    height: 100%;
}

.void-chat-bag-item__frame .void-card-img,
.void-chat-bag-item__frame .catalog-tile-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center center;
    filter: contrast(1.05) saturate(1.08);
}

.void-chat-bag-item__frame--empty {
    align-items: center;
    justify-content: center;
    font-size: 28px;
}

.void-chat-bag-item__meta {
    padding: 10px 12px 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(0, 0, 0, 0.35);
    text-align: center;
}

.void-chat-bag-item__name {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    font-size: 14px;
    font-weight: 800;
    line-height: 1.35;
    margin-bottom: 4px;
    color: #fff;
    overflow: hidden;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.85);
}

.void-chat-bag-item__rarity {
    display: block;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: rgba(200, 220, 255, 0.88);
}

.void-chat-bag-box.is-card-selected .void-chat-bag-compose:not(.hidden) {
    flex: 1;
    border-top: none;
}

.void-chat-bag-compose {
    display: flex;
    gap: 18px;
    padding: 16px 18px 20px;
    border-top: 1px solid rgba(255, 215, 0, 0.25);
    background: linear-gradient(180deg, rgba(20, 12, 40, 0.6), rgba(8, 4, 18, 0.9));
    flex-shrink: 0;
}

.void-chat-bag-compose.hidden {
    display: none;
}

.void-chat-bag-preview {
    flex: 0 0 168px;
    width: 168px;
    aspect-ratio: 2 / 3;
    border-radius: 12px;
    overflow: hidden;
    border: 2px solid rgba(255, 215, 0, 0.45);
    background: #06040c;
    position: relative;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

.void-chat-bag-preview .void-chat-bag-item__frame {
    position: absolute;
    inset: 0;
}

.void-chat-bag-fields {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.void-chat-bag-selected-name {
    margin: 0;
    font-size: 15px;
    font-weight: 800;
    color: #ffe9a8;
    line-height: 1.4;
    text-align: center;
    text-shadow: 0 0 12px rgba(255, 215, 0, 0.25);
}

.void-chat-bag-change {
    align-self: center;
    margin-bottom: 2px;
    padding: 6px 10px;
    border: 1px solid rgba(0, 255, 255, 0.35);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.35);
    color: rgba(0, 255, 255, 0.9);
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}

.void-chat-bag-change:hover {
    border-color: rgba(0, 255, 255, 0.65);
    background: rgba(0, 40, 60, 0.45);
}

.void-chat-bag-trade-type,
.void-chat-bag-currency {
    display: flex;
    gap: 8px;
    width: 100%;
    max-width: 360px;
}

.void-chat-bag-type-btn {
    flex: 1;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(0, 0, 0, 0.35);
    color: rgba(255, 255, 255, 0.75);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s, color 0.2s;
}

.void-chat-bag-type-btn.is-active {
    border-color: rgba(255, 215, 0, 0.6);
    background: rgba(90, 60, 0, 0.45);
    color: #ffd700;
}

.void-chat-bag-currency-btn {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(0, 0, 0, 0.35);
    color: rgba(255, 255, 255, 0.75);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s, color 0.2s;
}

.void-chat-bag-currency-btn .void-coin-icon {
    flex-shrink: 0;
}

.void-chat-bag-currency-btn.is-active[data-currency='silver'] {
    border-color: rgba(0, 212, 255, 0.55);
    background: rgba(0, 60, 90, 0.45);
    color: #7df9ff;
}

.void-chat-bag-currency-btn.is-active[data-currency='gold'] {
    border-color: rgba(255, 215, 0, 0.6);
    background: rgba(90, 60, 0, 0.45);
    color: #ffd700;
}

.void-chat-bag-price-label {
    font-size: 13px;
    font-weight: 700;
    color: rgba(200, 215, 255, 0.85);
    text-align: center;
    width: 100%;
}

.void-chat-bag-price {
    width: 100%;
    max-width: 360px;
    text-align: center;
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid rgba(0, 255, 255, 0.35);
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    font-size: 18px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.void-chat-bag-price:focus {
    outline: none;
    border-color: rgba(255, 215, 0, 0.65);
    box-shadow: 0 0 12px rgba(255, 215, 0, 0.25);
}

.void-chat-bag-confirm {
    width: 100%;
    max-width: 360px;
    margin-top: 4px;
    padding: 13px 16px;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, #7f00ff, #00d4ff);
    color: #fff;
    font-size: 15px;
    font-weight: 800;
    cursor: pointer;
    letter-spacing: 0.04em;
    transition: transform 0.15s, box-shadow 0.2s;
}

@media (max-width: 720px) {
    .void-chat-bag-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
        max-height: min(46vh, 440px);
    }

    .void-chat-bag-item__art {
        min-height: 160px;
    }

    .void-chat-bag-compose {
        flex-direction: column;
        align-items: stretch;
    }

    .void-chat-bag-preview {
        flex: none;
        width: min(140px, 42vw);
        margin: 0 auto;
    }
}

.void-chat-bag-confirm:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(127, 0, 255, 0.45);
}

@media (max-width: 900px) {
    .void-chat-panel {
        --void-chat-w: min(360px, calc(100vw - var(--void-side-nav, 96px) - 48px));
        --void-chat-h: min(440px, 48dvh, calc(100dvh - 72px));
        left: max(8px, env(safe-area-inset-left, 0px));
        bottom: max(8px, env(safe-area-inset-bottom, 0px));
    }
}

@media (max-width: 720px) {
    .void-chat-panel {
        min-height: 0;
    }

    .void-chat-panel::after {
        display: none;
    }

    .void-chat-panel:not(.is-hidden) {
        --void-chat-w: min(100%, calc(100vw - 16px));
        left: max(8px, env(safe-area-inset-left, 0px));
        right: max(8px, env(safe-area-inset-right, 0px));
        width: auto;
        bottom: calc(var(--void-mobile-nav-h, 54px) + var(--void-mobile-chat-offset, 14px));
        z-index: 210;
    }

    .void-chat-panel:not(.is-hidden).is-collapsed {
        --void-chat-h: auto;
        height: auto;
        max-height: 48px;
        min-height: 0;
        bottom: calc(var(--void-mobile-nav-h, 54px) + var(--void-mobile-chat-offset, 14px));
    }

    .void-chat-panel:not(.is-hidden).is-collapsed .void-chat-body,
    .void-chat-panel:not(.is-hidden).is-collapsed .void-chat-foot {
        display: none !important;
        min-height: 0 !important;
        height: 0 !important;
        padding: 0 !important;
        margin: 0 !important;
        border: none !important;
    }

    .void-chat-panel:not(.is-hidden):not(.is-collapsed) {
        --void-chat-h: min(420px, calc(100dvh - var(--void-mobile-nav-h, 54px) - 88px));
        height: var(--void-chat-h);
        max-height: min(480px, calc(100dvh - var(--void-mobile-nav-h, 54px) - 72px));
        min-height: min(320px, calc(100dvh - var(--void-mobile-nav-h, 54px) - 88px));
    }

    .void-chat-panel:not(.is-hidden):not(.is-collapsed) .void-chat-body {
        flex: 1 1 auto;
        min-height: min(220px, calc(100dvh - var(--void-mobile-nav-h, 54px) - 200px));
        max-height: none;
        overflow-y: auto;
        overflow-x: hidden;
        overscroll-behavior: contain;
        touch-action: pan-y;
        -webkit-overflow-scrolling: touch;
    }

    body.void-chat-scroll-lock {
        overflow: hidden;
        height: 100dvh;
    }

    body.void-chat-scroll-lock #screen-app {
        overflow: hidden;
        max-height: 100dvh;
        touch-action: none;
    }

    body.void-chat-scroll-lock .void-chat-panel {
        touch-action: auto;
    }

    .void-chat-collapse-btn {
        min-width: 40px;
        min-height: 40px;
        padding: 8px 10px;
        font-size: 16px;
    }

    body:has(.void-chat-panel:not(.is-hidden).is-collapsed) #screen-app {
        padding-bottom: calc(var(--void-mobile-nav-h, 54px) + var(--void-mobile-chat-gap, 62px));
    }

    body:has(.void-chat-panel:not(.is-hidden):not(.is-collapsed)) #screen-app {
        padding-bottom: calc(var(--void-mobile-nav-h, 54px) + 78px);
    }

    body.void-chat-scroll-lock:not(:has(.void-chat-panel:not(.is-collapsed))) {
        overflow: auto;
        height: auto;
        touch-action: auto;
    }

    body.void-chat-scroll-lock:not(:has(.void-chat-panel:not(.is-collapsed))) #screen-app {
        overflow: visible;
        max-height: none;
        touch-action: auto;
    }

    body.pull-overlay-open .void-chat-panel,
    body.gacha-age-open .void-chat-panel {
        opacity: 0 !important;
        pointer-events: none !important;
        visibility: hidden !important;
    }

    .void-chat-head {
        padding: 6px 8px 4px;
    }

    .void-chat-tab {
        font-size: 11px;
        padding: 5px 3px;
    }

    .void-chat-msg {
        font-size: 15px;
        line-height: 1.6;
        padding: 9px 11px;
    }

    .void-chat-msg-sender {
        display: block;
        font-size: 15px;
        line-height: 1.35;
        margin: 0 0 3px;
    }

    .void-chat-msg-meta {
        font-size: 13px;
    }

    .void-chat-panel[data-tab='system'] .void-chat-msg--sys-gacha {
        font-size: 15px;
    }
}

@media (max-height: 640px) {
    .void-chat-panel {
        --void-chat-h: min(380px, calc(100dvh - 64px));
    }

    .void-chat-channel-hint {
        padding: 2px 10px 4px;
        font-size: 9px;
    }
}

@media (max-height: 480px) {
    .void-chat-panel {
        --void-chat-h: calc(100dvh - 56px);
        max-height: calc(100dvh - 56px);
    }

    .void-chat-channel-hint {
        display: none;
    }

    .void-chat-tab {
        padding: 5px 2px;
        font-size: 9px;
    }
}
