﻿/* ==========================================================================
   social.css —— 抢红包 / 聊天室 / 互赠（微信风格）
   ========================================================================== */

/* ---------------- 红包横幅 ---------------- */
.rp-banner {
    position: fixed;
    top: 76px;
    left: 50%;
    transform: translate(-50%, -24px);
    z-index: 1700;
    display: none;
    align-items: center;
    gap: 10px;
    padding: 10px 18px 10px 12px;
    border-radius: 999px;
    background: linear-gradient(120deg, #f2503e, #d92f22);
    color: #ffe9c7;
    font-size: 13.5px;
    font-weight: 700;
    letter-spacing: .02em;
    border: 1px solid rgba(255, 217, 158, .55);
    box-shadow: 0 14px 34px -14px rgba(217, 47, 34, .95), inset 0 1px 0 rgba(255, 255, 255, .28);
    cursor: pointer;
    opacity: 0;
    transition: opacity .3s ease, transform .3s ease;
}
.rp-banner.show { display: inline-flex; opacity: 1; transform: translate(-50%, 0); }
.rp-banner .rp-ico {
    width: 30px; height: 30px; flex: none;
    display: grid; place-items: center;
    border-radius: 9px;
    background: linear-gradient(150deg, #ffd89a, #e8a33a);
    color: #8a1e12;
    font-size: 16px;
    animation: rpBob 1.6s ease-in-out infinite;
}
.rp-banner .rp-hint { font-size: 11px; font-weight: 500; opacity: .85; }
@keyframes rpBob { 0%, 100% { transform: translateY(0) rotate(-4deg); } 50% { transform: translateY(-3px) rotate(4deg); } }

/* ---------------- 红包弹窗（微信风） ---------------- */
.rp-modal {
    position: relative;
    width: 320px;
    max-width: 92vw;
    padding: 0 !important;
    border-radius: 18px !important;
    overflow: hidden;
    background: #e54d42 !important;
    border: 0 !important;
    box-shadow: 0 30px 70px -24px rgba(0, 0, 0, .75) !important;
    text-align: center;
    color: #ffe9c7;
}
.rp-head {
    padding: 22px 20px 10px;
    background: linear-gradient(180deg, #ee5a4f, #e54d42);
}
.rp-avatar {
    width: 46px; height: 46px;
    margin: 0 auto 10px;
    border-radius: 50%;
    display: grid; place-items: center;
    background: linear-gradient(140deg, #ffd89a, #e8a33a);
    color: #8a1e12;
    font-weight: 800;
    font-size: 18px;
    box-shadow: 0 0 0 2px rgba(255, 233, 199, .6);
}
.rp-from { font-size: 13px; color: #ffd9b0; }
.rp-msg { margin-top: 6px; font-size: 17px; font-weight: 800; color: #fff6e2; letter-spacing: .04em; }
.rp-body { padding: 8px 20px 22px; }
.rp-open {
    position: relative;
    width: 84px; height: 84px;
    margin: 6px auto 4px;
    border-radius: 50%;
    display: grid; place-items: center;
    background: radial-gradient(circle at 50% 30%, #ffe6b8, #edb353 60%, #d09b34);
    color: #7d1a0e;
    font-size: 30px;
    font-weight: 900;
    font-family: var(--font-display);
    border: 0;
    cursor: pointer;
    box-shadow: 0 12px 28px -10px rgba(0, 0, 0, .6), inset 0 2px 0 rgba(255, 255, 255, .55);
    transition: transform .15s ease, box-shadow .2s ease;
}
.rp-open:hover { transform: scale(1.04); }
.rp-open:active { transform: scale(.96); }
.rp-open::after {
    content: "";
    position: absolute;
    inset: -6px;
    border-radius: 50%;
    border: 2px solid rgba(255, 233, 199, .35);
    animation: rpPulse 1.8s ease-out infinite;
}
@keyframes rpPulse {
    0% { transform: scale(.9); opacity: .9; }
    100% { transform: scale(1.35); opacity: 0; }
}
.rp-tip { font-size: 12px; color: #ffd0a8; margin-top: 10px; }
.rp-result { padding: 18px 20px 24px; display: none; }
.rp-result.show { display: block; animation: rpIn .35s ease-out; }
@keyframes rpIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.rp-amount {
    font-size: 40px;
    font-weight: 900;
    color: #ffd89a;
    font-family: var(--font-display);
    line-height: 1.1;
    text-shadow: 0 2px 18px rgba(255, 216, 154, .55);
}
.rp-amount small { font-size: 14px; margin-left: 4px; color: #ffe9c7; }
.rp-sub { font-size: 12.5px; color: #ffd0a8; margin-top: 6px; }
.rp-actions { display: flex; gap: 10px; justify-content: center; margin-top: 18px; flex-wrap: wrap; }
.rp-btn {
    padding: 9px 20px;
    border-radius: 999px;
    border: 1px solid rgba(255, 233, 199, .5);
    background: rgba(255, 255, 255, .12);
    color: #fff3dc;
    font-size: 13px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: background .18s ease;
}
.rp-btn:hover { background: rgba(255, 255, 255, .22); }
.rp-btn.gold { background: linear-gradient(120deg, #ffd89a, #e8a33a); color: #7d1a0e; border-color: transparent; }

/* ---------------- 聊天室 ---------------- */
.chat-fab {
    position: fixed;
    right: 22px;
    bottom: 152px;
    z-index: 1450;
    width: 52px; height: 52px;
    display: none;
    align-items: center; justify-content: center;
    border-radius: 16px;
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--accent);
    font-size: 22px;
    cursor: pointer;
    box-shadow: var(--shadow);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    transition: transform .2s ease, border-color .2s ease;
}
.chat-fab:hover { transform: translateY(-2px); border-color: var(--accent); }
.chat-fab .chat-dot {
    position: absolute; top: 6px; right: 6px;
    width: 8px; height: 8px; border-radius: 50%;
    background: #ff5a68;
    box-shadow: 0 0 8px #ff5a68;
    display: none;
}
.chat-fab.has-new .chat-dot { display: block; }

/* QQ 风格：独立正方形圆角浮窗 */
.chat-panel {
    position: fixed;
    right: 24px;
    bottom: 96px;
    z-index: 1750;
    width: 392px;
    height: min(612px, calc(100vh - 150px));
    max-width: calc(100vw - 28px);
    display: flex;
    flex-direction: column;
    background: var(--surface-solid);
    border: 1px solid var(--line);
    border-radius: 20px;
    box-shadow: 0 30px 80px -34px rgba(0, 0, 0, .85), 0 0 0 1px rgba(255, 255, 255, .04) inset;
    overflow: hidden;
    opacity: 0;
    transform: translateY(18px) scale(.96);
    pointer-events: none;
    transition: opacity .22s ease, transform .24s cubic-bezier(.2, .9, .3, 1.08);
}
.chat-panel.open { opacity: 1; transform: none; pointer-events: auto; }
.chat-head {
    display: flex; align-items: center; gap: 8px;
    padding: 13px 14px 11px;
    border-bottom: 1px solid var(--line);
    background: linear-gradient(125deg, var(--grad-soft), transparent 78%);
}
.chat-head h3 { margin: 0; font-size: 15.5px; color: var(--heading); }
.chat-close { margin-left: auto; }
.chat-rooms { display: flex; gap: 6px; padding: 10px 14px 6px; flex-wrap: wrap; }
.chat-room {
    padding: 5px 11px;
    border-radius: 99px;
    border: 1px solid var(--line);
    background: var(--surface-3);
    color: var(--text);
    font-size: 12px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
}
.chat-room.active { background: var(--grad); color: var(--accent-ink); border-color: transparent; }
.chat-room.locked { opacity: .45; cursor: not-allowed; }
.chat-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.chat-msg { display: flex; gap: 8px; align-items: flex-start; max-width: 100%; }
.chat-msg.mine { flex-direction: row-reverse; }
.chat-ava {
    width: 30px; height: 30px; flex: none;
    border-radius: 50%;
    display: grid; place-items: center;
    background: linear-gradient(140deg, #7dd3fc, #22d3ee);
    color: #04121f;
    font-size: 12px; font-weight: 800;
    overflow: hidden;
}
.chat-ava img { width: 100%; height: 100%; object-fit: cover; }
.chat-body { min-width: 0; max-width: 76%; }
.chat-meta { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--muted); margin-bottom: 3px; }
.chat-msg.mine .chat-meta { justify-content: flex-end; }
.chat-bubble {
    padding: 8px 12px;
    border-radius: 12px;
    background: var(--surface-3);
    color: var(--text);
    font-size: 13.5px;
    line-height: 1.55;
    word-break: break-word;
    border: 1px solid var(--line);
}
.chat-msg.mine .chat-bubble { background: var(--grad-soft); border-color: var(--line-strong); }
.chat-packet {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 9px 14px;
    border-radius: 10px;
    background: linear-gradient(120deg, #f2503e, #d92f22);
    color: #ffe9c7;
    font-size: 13px; font-weight: 700;
    border: 1px solid rgba(255, 217, 158, .5);
    cursor: pointer;
}
.chat-packet:hover { filter: brightness(1.06); }
.chat-input-row {
    display: flex; gap: 8px;
    padding: 10px 14px 14px;
    border-top: 1px solid var(--line);
}
.chat-input-row input {
    flex: 1; min-width: 0;
    padding: 9px 12px;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: var(--input-bg);
    color: var(--text);
    font-family: inherit;
    font-size: 13.5px;
}
.chat-input-row input:focus { outline: none; border-color: var(--accent); }
.chat-send {
    padding: 0 14px;
    border-radius: 10px;
    border: 0;
    background: var(--grad);
    color: var(--accent-ink);
    font-weight: 800;
    font-family: inherit;
    cursor: pointer;
}
.chat-empty { text-align: center; color: var(--muted); font-size: 12.5px; padding: 24px 8px; }
.chat-muted-note { padding: 8px 14px; font-size: 12px; color: #d97706; }

/* ---------------- 互赠 ---------------- */
.gift-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.gift-grid .form-group { margin-bottom: 0; }
.gift-note { font-size: 12px; color: var(--muted); margin-top: 10px; line-height: 1.7; }

@media (max-width: 768px) {
    .rp-banner { top: 66px; font-size: 12.5px; padding: 8px 14px 8px 10px; }
    .rp-banner .rp-ico { width: 26px; height: 26px; font-size: 14px; }
    /* 手机端：第一行功能按钮（表情/图片/竞猜/红包），第二行输入框 + 发送 */
    .chat-input-row {
        flex-wrap: wrap;
        gap: 6px;
        padding: 8px 10px 12px;
        align-items: center;
    }
    .chat-input-row > input {
        order: 5;
        flex: 1 1 70%;
        padding: 8px 10px;
        font-size: 13px;
    }
    .chat-input-row > .chat-send:last-of-type {
        order: 6;
        flex: 0 0 auto;
        min-width: 62px;
    }
    .chat-input-row > .chat-emoji-btn { width: 36px; height: 36px; }
    .chat-input-row > .chat-send {
        height: 36px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
    .chat-panel {
        right: 12px;
        left: 12px;
        bottom: 82px;
        width: auto;
        max-width: none;
        height: min(72vh, calc(100vh - 110px));
        border-radius: 18px;
    }
    .chat-fab { right: 14px; bottom: 132px; width: 46px; height: 46px; font-size: 20px; }
    .gift-grid { grid-template-columns: 1fr; }
}

/* ---------------- 表情面板 / 撤回提示 ---------------- */
.chat-emoji-btn {
    flex: none;
    width: 40px;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: var(--surface-3);
    font-size: 19px;
    line-height: 1;
    cursor: pointer;
    transition: border-color .16s ease;
}
.chat-emoji-btn:hover { border-color: var(--accent); }
.chat-emoji-panel {
    display: none;
    grid-template-columns: repeat(8, 1fr);
    gap: 4px;
    padding: 8px 14px;
    border-top: 1px solid var(--line);
    background: var(--surface-3);
    max-height: 168px;
    overflow-y: auto;
}
.chat-emoji-panel.open { display: grid; }
.chat-emoji {
    border: 0;
    background: transparent;
    font-size: 20px;
    line-height: 1;
    padding: 4px 0;
    border-radius: 8px;
    cursor: pointer;
    transition: background .14s ease, transform .14s ease;
}
.chat-emoji:hover { background: var(--surface-2); transform: scale(1.15); }
.chat-recall {
    font-size: 12px;
    color: var(--muted);
    font-style: italic;
    padding: 4px 10px;
    border-radius: 8px;
    border: 1px dashed var(--line);
}
.chat-msg.mine .chat-recall { border-color: var(--line-strong); }

@media (max-width: 768px) {
    .chat-emoji-panel { grid-template-columns: repeat(7, 1fr); }
}

/* ---------------- QQ 风格资料卡 ---------------- */
.uc-modal { width: 420px; max-width: 94vw; padding: 0 !important; overflow: hidden; }
.uc-banner {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 20px 18px;
    background: linear-gradient(125deg, rgba(34, 211, 238, .22), rgba(168, 85, 247, .18) 60%, transparent);
    border-bottom: 1px solid var(--line);
}
.uc-ava {
    width: 58px; height: 58px;
    flex: none;
    border-radius: 50%;
    display: grid; place-items: center;
    font-size: 22px; font-weight: 800;
    color: #04121f;
    background: linear-gradient(140deg, #7dd3fc, #22d3ee);
    overflow: hidden;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, .12);
}
.uc-ava img { width: 100%; height: 100%; object-fit: cover; }
.uc-id { min-width: 0; flex: 1; }
.uc-name {
    display: flex; align-items: center; gap: 7px;
    font-size: 18px; font-weight: 800; color: var(--heading);
    flex-wrap: wrap;
}
.uc-sub { margin-top: 3px; font-size: 12px; color: var(--muted); letter-spacing: .02em; }
.uc-close {
    position: absolute; right: 12px; top: 12px;
    width: 26px; height: 26px;
    border-radius: 8px; border: 0;
    background: transparent; color: var(--muted);
    font-size: 13px; cursor: pointer;
}
.uc-close:hover { background: var(--surface-3); color: var(--text); }

.uc-level { padding: 14px 20px 10px; }
.uc-lvrow { display: flex; align-items: baseline; gap: 8px; margin-bottom: 7px; }
.uc-lv { font-size: 13px; color: var(--muted); }
.uc-lv b { font-size: 19px; color: var(--accent); font-family: var(--font-display); }
.uc-lvtitle { font-size: 12px; color: var(--text); font-weight: 700; }
.uc-bar {
    height: 7px; border-radius: 99px;
    background: var(--surface-3);
    border: 1px solid var(--line);
    overflow: hidden;
}
.uc-bar i {
    display: block; height: 100%; width: 0;
    border-radius: 99px;
    background: var(--grad);
    transition: width .5s cubic-bezier(.2, .8, .2, 1);
}
.uc-remain { margin-top: 6px; font-size: 11.5px; color: var(--muted); }

.uc-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    padding: 0 20px 14px;
}
.uc-stat {
    display: flex; flex-direction: column; align-items: center; gap: 2px;
    padding: 9px 4px;
    border-radius: 11px;
    background: var(--surface-3);
    border: 1px solid var(--line);
}
.uc-stat b { font-size: 15px; color: var(--heading); font-family: var(--font-display); }
.uc-stat span { font-size: 10.5px; color: var(--muted); }

.uc-section { padding: 0 20px 14px; }
.uc-sec-title {
    font-size: 12.5px; font-weight: 700; color: var(--text);
    margin-bottom: 8px;
    display: flex; align-items: center; gap: 6px;
}
.uc-sec-title em {
    font-style: normal; font-size: 11px; color: var(--muted);
    background: var(--surface-3); border: 1px solid var(--line);
    padding: 0 6px; border-radius: 99px;
}
.uc-medals { display: flex; flex-wrap: wrap; gap: 6px; }
.uc-medal {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 4px 9px;
    border-radius: 99px;
    font-size: 11.5px;
    background: var(--surface-3);
    border: 1px solid var(--line);
    color: var(--text);
}
.uc-medal .um-ico { font-size: 13px; }
.uc-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.uc-tag {
    padding: 4px 9px;
    border-radius: 8px;
    font-size: 11.5px;
    background: rgba(34, 211, 238, .10);
    border: 1px solid rgba(34, 211, 238, .25);
    color: var(--text);
}
.uc-empty { font-size: 11.5px; color: var(--muted); }

@media (max-width: 480px) {
    .uc-modal { width: 100%; }
    .uc-stats { grid-template-columns: repeat(2, 1fr); }
}

.chat-ava { cursor: pointer; transition: transform .16s ease; }
.chat-ava:hover { transform: scale(1.08); }
.chat-name { cursor: pointer; font-weight: 600; }
.chat-name:hover { color: var(--accent); text-decoration: underline; }

/* 聊天窗口打开时，隐藏右下角悬浮按钮，避免遮挡 */
body.chat-open .back-top,
body.chat-open .dm-fab,
body.chat-open .chat-fab {
    opacity: 0 !important;
    pointer-events: none !important;
    transform: scale(.85) !important;
}

/* 细节打磨：气泡与头像 */
.chat-bubble {
    border-radius: 4px 14px 14px 14px;
    box-shadow: 0 6px 16px -12px rgba(0, 0, 0, .8);
}
.chat-msg.mine .chat-bubble {
    border-radius: 14px 4px 14px 14px;
    background: linear-gradient(135deg, rgba(34, 211, 238, .16), rgba(168, 85, 247, .16));
    border-color: rgba(34, 211, 238, .32);
}
.chat-ava {
    box-shadow: 0 0 0 2px var(--surface-solid), 0 0 0 3px rgba(34, 211, 238, .35);
}
.chat-head h3 { letter-spacing: .01em; }
.chat-room { transition: border-color .16s ease, background .16s ease, color .16s ease; }
.chat-room:hover { border-color: var(--line-strong); }
.chat-input-row { background: var(--surface-solid); }

.banned-hint { margin-top: 6px; font-size: 11.5px; color: var(--muted); }
#giftNoteHint, #cpNoteHint { margin-top: 5px; font-size: 11.5px; color: var(--muted); }


/* ---------------- 竞猜 ---------------- */
.quiz-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.quiz-toolbar .btn-submit { margin-left: auto; padding: 7px 14px; font-size: 12.5px; }
.quiz-list { display: flex; flex-direction: column; gap: 9px; max-height: 52vh; overflow-y: auto; padding-right: 4px; }
.quiz-card {
    padding: 11px 13px;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: var(--surface-3);
    cursor: pointer;
    transition: border-color .16s ease, transform .16s ease, background .16s ease;
}
.quiz-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.quiz-card.closed { opacity: .78; }
.quiz-card-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.quiz-card-top b { font-size: 13.5px; color: var(--heading); }
.quiz-card-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 6px; font-size: 11.5px; color: var(--muted); }
.quiz-status { margin-left: auto; padding: 2px 9px; border-radius: 99px; font-size: 11px; font-weight: 700; }
.quiz-status.open { background: rgba(52, 211, 153, .16); color: #34d399; }
.quiz-status.closed { background: var(--surface-2); color: var(--muted); }
.quiz-empty { text-align: center; font-size: 12.5px; color: var(--muted); padding: 22px 8px; }

.quiz-play { max-width: 460px; }
.qp-head { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.quiz-ring { flex: none; }
.qp-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.qp-meta-row { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }
.qp-meta-row b { color: var(--heading); font-weight: 700; }
.quiz-options { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.quiz-opt {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 11px;
    border: 1px solid var(--line);
    background: var(--surface-3);
    color: var(--text);
    font-size: 13.5px;
    font-family: inherit;
    text-align: left;
    cursor: pointer;
    transition: border-color .16s ease, background .16s ease;
}
.quiz-opt:hover:not(:disabled) { border-color: var(--accent); }
.quiz-opt:disabled { cursor: default; opacity: .85; }
.quiz-opt.mine { border-color: var(--accent); background: var(--grad-soft); }
.quiz-opt.answer { border-color: #34d399; background: rgba(52, 211, 153, .12); }
.qo-key {
    width: 24px; height: 24px; flex: none;
    display: grid; place-items: center;
    border-radius: 8px;
    background: var(--surface-2);
    font-size: 12px; font-weight: 800; color: var(--accent);
}
.qo-text { flex: 1; min-width: 0; }
.qo-tag { font-size: 10.5px; font-weight: 700; padding: 2px 8px; border-radius: 99px; background: var(--surface-2); color: var(--muted); }
.qo-tag.ok { background: rgba(52, 211, 153, .18); color: #10b981; }
.quiz-bars-wrap, .rp-chart-wrap { margin: 4px 0 10px; }
.quiz-bars, .rp-chart { display: block; width: 100%; }

.rp-detail-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; font-size: 13px; color: var(--text); }
.rp-detail-list { display: flex; flex-direction: column; gap: 6px; max-height: 32vh; overflow-y: auto; }
.rp-detail-row {
    display: flex; align-items: center; gap: 10px;
    padding: 7px 11px;
    border-radius: 9px;
    border: 1px solid var(--line);
    background: var(--surface-3);
    font-size: 12.5px;
}
.rpd-name { flex: 1; min-width: 0; color: var(--heading); font-weight: 600; }
.rpd-points { color: #f59e0b; font-weight: 800; }
.rpd-time { color: var(--muted); font-size: 11px; }

@media (max-width: 768px) {
    .qp-head { flex-direction: column; align-items: flex-start; }
    .quiz-ring { align-self: center; }
}


/* 竞猜抢答 */
.quiz-claimbar { margin: 4px 0 12px; }
.quiz-claim {
    width: 100%;
    padding: 13px;
    border: 0;
    border-radius: 12px;
    background: linear-gradient(120deg, #fbbf24, #f97316);
    color: #3a1a00;
    font-size: 15px;
    font-weight: 800;
    font-family: inherit;
    letter-spacing: .04em;
    cursor: pointer;
    box-shadow: 0 12px 26px -14px rgba(249, 115, 22, .9);
    transition: transform .15s ease, filter .15s ease;
}
.quiz-claim:hover { transform: translateY(-1px); filter: brightness(1.06); }
.quiz-claim:active { transform: scale(.98); }
.qc-note {
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px dashed var(--line);
    font-size: 12.5px;
    color: var(--muted);
    text-align: center;
}
.qc-note.ok { border-color: rgba(52, 211, 153, .5); color: #34d399; }
.qc-note.warn { border-color: rgba(251, 191, 36, .5); color: #fbbf24; }


/* 竞猜列表卡片重排 */
.quiz-card-head { display: flex; align-items: center; gap: 8px; }
.quiz-card-head .qc-title {
    flex: 1;
    min-width: 0;
    font-size: 13.5px;
    color: var(--heading);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.quiz-card-head .quiz-status { flex: none; }
.quiz-card-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 7px; font-size: 11.5px; color: var(--muted); }
.quiz-card-meta .chip { font-size: 10.5px; padding: 2px 8px; }
.quiz-status.pending { background: rgba(251, 191, 36, .16); color: #fbbf24; }
.quiz-bars, .rp-chart { display: block; max-width: 100%; }

/* 打开弹窗时隐藏弹幕，避免盖住界面 */
body.modal-open .dm-layer { display: none !important; }


/* 聊天室右键菜单 */
.chat-ctxmenu {
    position: fixed;
    z-index: 3000;
    display: none;
    min-width: 158px;
    padding: 6px;
    border-radius: 12px;
    background: var(--surface-solid);
    border: 1px solid var(--line);
    box-shadow: 0 18px 44px -20px rgba(0, 0, 0, .85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}
.chat-ctxmenu.show { display: block; animation: ctxIn .14s ease-out; }
@keyframes ctxIn { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: none; } }
.chat-ctx-item {
    display: block;
    width: 100%;
    padding: 8px 11px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--text);
    font-size: 12.5px;
    font-family: inherit;
    text-align: left;
    cursor: pointer;
    white-space: nowrap;
}
.chat-ctx-item:hover { background: var(--surface-3); }
.chat-ctx-item.danger { color: #f87171; }
.chat-ctx-item.danger:hover { background: rgba(248, 113, 113, .12); }


/* ---------------- 聊天新消息小卡片 ---------------- */
.chat-toast-stack {
    position: fixed;
    right: 18px;
    bottom: 26px;          /* 屏幕最右下角，聊天室外 */
    z-index: 2360;
    display: flex;
    flex-direction: column;
    gap: 9px;
    pointer-events: none;
}
/* 聊天室打开时，提示卡片移到聊天室左侧外，不遮挡聊天室 */
body.chat-open .chat-toast-stack { right: 440px; bottom: 26px; }
body.chat-open .notify-stack { right: 440px; bottom: 120px; }
.chat-mini-card {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 276px;
    padding: 10px 12px;
    border-radius: 14px;
    background: var(--surface-solid);
    border: 1px solid var(--line);
    box-shadow: 0 18px 40px -22px rgba(0, 0, 0, .85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    pointer-events: auto;
    cursor: pointer;
    animation: cmcIn .26s cubic-bezier(.2, .9, .3, 1.1);
}
@keyframes cmcIn { from { opacity: 0; transform: translateX(18px) scale(.96); } to { opacity: 1; transform: none; } }
.chat-mini-card:hover { border-color: var(--accent); }
.cmc-ava {
    width: 34px; height: 34px; flex: none;
    border-radius: 50%;
    display: grid; place-items: center;
    background: linear-gradient(140deg, #7dd3fc, #22d3ee);
    color: #04121f;
    font-size: 14px; font-weight: 800;
}
.cmc-body { flex: 1; min-width: 0; }
.cmc-name {
    display: flex; align-items: center; gap: 6px;
    font-size: 12.5px; font-weight: 700; color: var(--heading);
}
.cmc-tag {
    font-size: 9.5px; font-weight: 700; padding: 1px 6px; border-radius: 99px;
    background: rgba(34, 211, 238, .16); color: #22d3ee;
}
.cmc-text {
    margin-top: 2px;
    font-size: 12px; color: var(--muted);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cmc-close {
    flex: none; width: 20px; height: 20px;
    border: 0; border-radius: 6px; background: transparent;
    color: var(--muted); font-size: 11px; cursor: pointer;
}
.cmc-close:hover { background: var(--surface-3); color: var(--text); }

/* 微信风红包明细 */
.rp-detail-list { display: flex; flex-direction: column; gap: 2px; max-height: 36vh; overflow-y: auto; }
.rp-detail-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 8px;
    border-radius: 10px;
    border: 0;
    border-bottom: 1px solid var(--line);
    background: transparent;
}
.rp-detail-row:hover { background: var(--surface-3); }
.rpd-ava {
    width: 34px; height: 34px; flex: none;
    border-radius: 50%;
    display: grid; place-items: center;
    background: linear-gradient(140deg, #ffd89a, #e8a33a);
    color: #5a3600; font-size: 14px; font-weight: 800;
    overflow: hidden;
}
.rpd-ava img { width: 100%; height: 100%; object-fit: cover; }
.rpd-main { flex: 1; min-width: 0; }
.rpd-name { font-size: 13px; font-weight: 600; color: var(--heading); }
.rpd-time { font-size: 10.5px; color: var(--muted); margin-top: 1px; }
.rpd-points { flex: none; font-size: 13px; font-weight: 800; color: #f59e0b; }

@media (max-width: 768px) {
    .chat-toast-stack { right: 10px; bottom: 16px; }
    body.chat-open .chat-toast-stack { right: 10px; bottom: 16px; }
    body.chat-open .notify-stack { right: 10px; bottom: 108px; }
    .chat-mini-card { width: 236px; }
}

/* 邮箱验证 */
.email-tag {
    font-size: 10.5px; font-weight: 700; padding: 1px 8px;
    border-radius: 99px; margin-left: 4px;
    background: var(--surface-3); color: var(--muted);
}
.email-tag.ok { background: rgba(52, 211, 153, .16); color: #34d399; }
.email-tag.pending { background: rgba(251, 191, 36, .16); color: #fbbf24; }
.email-row { display: flex; gap: 8px; margin-bottom: 7px; }
.email-row .input-box { flex: 1; min-width: 0; }
.email-send, .email-verify { flex: none; padding: 9px 12px; font-size: 12.5px; white-space: nowrap; }
.email-hint { font-size: 11.5px; color: var(--muted); line-height: 1.6; }
.email-hint-chip {
    position: fixed;
    left: 18px;
    bottom: 26px;
    z-index: 1450;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 14px;
    border-radius: 999px;
    font-size: 12.5px;
    font-weight: 600;
    color: #3a2500;
    background: linear-gradient(120deg, #ffe08a, #f6b73c);
    border: 1px solid rgba(255, 255, 255, .5);
    box-shadow: 0 14px 32px -16px rgba(246, 183, 60, .95);
    cursor: pointer;
    transition: transform .18s ease, filter .18s ease;
}
.email-hint-chip:hover { transform: translateY(-1px); filter: brightness(1.05); }
@media (max-width: 768px) {
    .email-hint-chip { left: 12px; bottom: 84px; font-size: 11.5px; padding: 7px 11px; }
}


/* 只读聊天室提示 */
.chat-readable-note {
    margin: 0 14px 8px;
    padding: 8px 11px;
    border-radius: 10px;
    font-size: 11.5px;
    line-height: 1.6;
    color: #fbbf24;
    background: rgba(251, 191, 36, .10);
    border: 1px dashed rgba(251, 191, 36, .45);
}
.chat-room.readonly { opacity: .82; border-style: dashed; }


/* 聊天室图片消息 */
.chat-img {
    display: block;
    max-width: 220px;
    max-height: 240px;
    border-radius: 12px;
    border: 1px solid var(--line);
    cursor: zoom-in;
    transition: transform .18s ease, border-color .18s ease;
}
.chat-img:hover { transform: scale(1.01); border-color: var(--accent); }
@media (max-width: 768px) {
    .chat-img { max-width: 178px; max-height: 200px; }
}


/* 引用条 */
.chat-reply-bar {
    display: flex; align-items: center; gap: 8px;
    margin: 0 14px 6px; padding: 7px 10px;
    border-radius: 10px;
    background: rgba(56, 189, 248, .10);
    border-left: 3px solid #38bdf8;
    font-size: 11.5px; color: var(--muted);
}
.crb-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crb-close { flex: none; border: 0; background: transparent; color: var(--muted); cursor: pointer; }

/* 引用块 */
.chat-quote {
    margin-bottom: 4px; padding: 5px 8px;
    border-left: 3px solid rgba(56, 189, 248, .6);
    border-radius: 7px;
    background: rgba(56, 189, 248, .08);
    font-size: 11px; color: var(--muted);
    max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* @ 选择器 */
.chat-at-picker {
    display: none;
    position: absolute; left: 12px; right: 12px;
    bottom: 58px;
    max-height: 190px; overflow-y: auto;
    padding: 6px;
    border-radius: 12px;
    background: var(--surface-solid);
    border: 1px solid var(--line);
    box-shadow: 0 18px 40px -22px rgba(0, 0, 0, .8);
    z-index: 8;
}
.chat-at-picker.open { display: block; }
.at-item {
    display: flex; align-items: center; gap: 8px;
    width: 100%; padding: 6px 8px;
    border: 0; border-radius: 8px;
    background: transparent; color: var(--text);
    font-size: 12.5px; cursor: pointer; text-align: left;
}
.at-item:hover { background: var(--surface-3); }
.at-ava {
    width: 22px; height: 22px; flex: none;
    border-radius: 50%; display: grid; place-items: center;
    background: linear-gradient(140deg, #7dd3fc, #22d3ee);
    color: #04121f; font-size: 11px; font-weight: 800;
}

/* 通知卡片 */
.notify-stack {
    position: fixed; right: 18px; bottom: 120px;
    z-index: 2355;
    display: flex; flex-direction: column; gap: 8px;
    pointer-events: none;
}
.notify-card {
    width: 268px; padding: 10px 12px;
    border-radius: 14px;
    background: var(--surface-solid);
    border: 1px solid var(--line);
    box-shadow: 0 18px 40px -22px rgba(0, 0, 0, .85);
    pointer-events: auto; cursor: pointer;
    animation: cmcIn .26s cubic-bezier(.2, .9, .3, 1.1);
}
.notify-card:hover { border-color: var(--accent); }
.nc-title { font-size: 12.5px; font-weight: 800; color: var(--heading); }
.nc-text { margin-top: 3px; font-size: 11.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nc-close { position: absolute; }
.notify-card { position: relative; }
.nc-close {
    position: absolute; right: 8px; top: 8px;
    border: 0; background: transparent; color: var(--muted);
    font-size: 11px; cursor: pointer;
}

/* 私信窗口（美化版：支持表情 / 图片） */
@media (min-width: 769px) {
    .dm-modal { max-width: 440px; }
}
.dm-modal {
    padding: 0;
    overflow: hidden;
    border-radius: 20px;
    border: 1px solid var(--line);
    background: var(--surface-solid);
    box-shadow: 0 40px 100px -30px rgba(0, 0, 0, .9);
}
.dm-head {
    display: flex; align-items: center; gap: 11px;
    padding: 13px 15px;
    background: linear-gradient(120deg, rgba(56, 189, 248, .16), rgba(168, 85, 247, .14));
    border-bottom: 1px solid var(--line);
}
.dm-avatar {
    width: 38px; height: 38px; flex: none;
    border-radius: 50%;
    display: grid; place-items: center;
    background: linear-gradient(140deg, #7dd3fc, #a855f7);
    color: #04121f;
    font-size: 16px; font-weight: 800;
    box-shadow: 0 6px 16px -8px rgba(125, 211, 252, .8);
}
.dm-title-wrap { flex: 1; min-width: 0; }
.dm-title { font-size: 14.5px; font-weight: 800; color: var(--heading); }
.dm-sub { margin-top: 2px; font-size: 10.5px; color: var(--muted); }
.dm-close {
    flex: none; width: 30px; height: 30px;
    border: 1px solid var(--line); border-radius: 9px;
    background: transparent; color: var(--muted);
    font-size: 14px; cursor: pointer; transition: all .16s;
}
.dm-close:hover { color: var(--text); border-color: var(--accent); }

.dm-list {
    height: 350px;
    overflow-y: auto;
    padding: 14px 14px 6px;
    display: flex; flex-direction: column; gap: 10px;
    background:
        radial-gradient(600px 200px at 90% 0%, rgba(56, 189, 248, .06), transparent 70%),
        var(--surface-solid);
}
.dm-empty { margin: auto; color: var(--muted); font-size: 12.5px; }
.dm-msg { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; max-width: 100%; }
.dm-msg.mine { align-items: flex-end; }
.dm-bubble {
    position: relative;
    max-width: 78%;
    padding: 9px 12px;
    border-radius: 14px 14px 14px 5px;
    background: var(--surface-3);
    border: 1px solid var(--line);
    font-size: 13.5px;
    line-height: 1.55;
    color: var(--text);
    word-break: break-word;
    white-space: pre-wrap;
}
.dm-msg.mine .dm-bubble {
    border-radius: 14px 14px 5px 14px;
    background: var(--grad);
    border-color: transparent;
    color: var(--accent-ink);
}
.dm-time { font-size: 10px; color: var(--muted); padding: 0 3px; }
.dm-img {
    max-width: 190px; max-height: 220px;
    border-radius: 12px;
    border: 1px solid var(--line);
    cursor: zoom-in;
    transition: transform .16s ease, border-color .16s ease;
}
.dm-img:hover { transform: scale(1.01); border-color: var(--accent); }

.dm-emoji-panel {
    display: none;
    grid-template-columns: repeat(8, 1fr);
    gap: 2px;
    padding: 8px;
    border-top: 1px solid var(--line);
    background: var(--surface-solid);
    max-height: 150px;
    overflow-y: auto;
}
.dm-emoji-panel.open { display: grid; }
.dm-emoji {
    border: 0; background: transparent;
    font-size: 19px; line-height: 1;
    padding: 6px 0; border-radius: 8px;
    cursor: pointer;
}
.dm-emoji:hover { background: var(--surface-3); }

.dm-input-row {
    display: flex; align-items: center; gap: 7px;
    padding: 10px 12px 12px;
    border-top: 1px solid var(--line);
    background: var(--surface-solid);
}
.dm-tool {
    flex: none;
    width: 36px; height: 36px;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: var(--surface-3);
    font-size: 16px;
    cursor: pointer;
    transition: all .16s;
}
.dm-tool:hover { border-color: var(--accent); }
.dm-input-row input[type="text"] {
    flex: 1; min-width: 0;
    padding: 9px 12px;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: var(--input-bg);
    color: var(--text);
    font-family: inherit;
    font-size: 13.5px;
}
.dm-input-row input[type="text"]:focus { outline: none; border-color: var(--accent); }
.dm-send {
    flex: none;
    height: 36px; padding: 0 16px;
    border: 0; border-radius: 10px;
    background: var(--grad);
    color: var(--accent-ink);
    font-weight: 800; font-family: inherit; font-size: 13.5px;
    cursor: pointer;
}
.dm-send:hover { filter: brightness(1.05); }
@media (max-width: 768px) {
    .dm-list { height: 46vh; }
    .dm-modal { border-radius: 18px; }
}
@media (max-width: 768px) {
    .notify-stack { right: 12px; bottom: 260px; }
    .notify-card { width: 232px; }
}


/* 聊天室内的竞猜按钮 */
.chat-quiz-btn {
    flex: none;
    width: auto;
    padding: 0 9px;
    font-size: 15px;
    background: linear-gradient(140deg, rgba(250, 204, 21, .22), rgba(245, 158, 11, .18));
    border: 1px solid rgba(250, 204, 21, .45);
    color: #fbbf24;
}
.chat-quiz-btn:hover { border-color: #fbbf24; background: rgba(250, 204, 21, .3); }
@media (max-width: 768px) {
    .chat-input-row #chatQuizBtn { padding: 0 7px; font-size: 14px; }
}


/* ---------------- 中奖名单（美化） ---------------- */
.winner-total {
    margin: 0 0 10px;
    font-size: 12.5px;
    color: var(--muted);
}
.winner-total b { color: #fbbf24; font-size: 15px; }
.winner-row {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 11px 13px;
    margin-bottom: 8px;
    border-radius: 14px;
    border: 1px solid var(--line);
    background: linear-gradient(120deg, rgba(251, 191, 36, .07), rgba(56, 189, 248, .05));
    transition: border-color .16s ease, transform .16s ease;
}
.winner-row:hover { border-color: rgba(251, 191, 36, .55); transform: translateX(2px); }
.winner-row.me { border-color: var(--accent); background: var(--grad-soft); }
.wr-rank {
    width: 30px; flex: none;
    text-align: center;
    font-size: 14px; font-weight: 800; color: var(--muted);
}
.wr-avatar {
    width: 38px; height: 38px; flex: none;
    border-radius: 50%;
    display: grid; place-items: center;
    overflow: hidden;
    background: linear-gradient(140deg, #ffd89a, #e8a33a);
    color: #5a3600; font-size: 15px; font-weight: 800;
}
.wr-avatar img { width: 100%; height: 100%; object-fit: cover; }
.wr-main { flex: 1; min-width: 0; }
.wr-name { font-size: 13.5px; font-weight: 800; color: var(--heading); }
.wr-sub { margin-top: 2px; font-size: 11px; color: var(--muted); }
.wr-key { flex: none; text-align: right; display: flex; flex-direction: column; gap: 3px; }
.wr-code {
    font-family: var(--font-mono);
    font-size: 12px;
    color: #fbbf24;
    letter-spacing: .04em;
}
.wr-pts {
    font-size: 11px;
    color: var(--muted);
    background: var(--surface-3);
    padding: 1px 8px;
    border-radius: 99px;
    align-self: flex-end;
}
.winner-empty {
    text-align: center;
    padding: 26px 10px;
    color: var(--muted);
}
.we-ico { font-size: 38px; margin-bottom: 8px; }
.we-title { font-size: 14px; font-weight: 800; color: var(--heading); }
.we-desc { margin-top: 5px; font-size: 12px; }

/* ---------------- 电子证书（美化） ---------------- */
.cert-empty {
    position: relative;
    overflow: hidden;
    padding: 34px 20px 28px;
    text-align: center;
    border-radius: 18px;
    border: 1px dashed rgba(251, 191, 36, .45);
    background:
        radial-gradient(420px 180px at 50% -20%, rgba(251, 191, 36, .18), transparent 70%),
        var(--surface-3);
}
.ce-glow {
    position: absolute; left: 50%; top: -60px;
    width: 220px; height: 220px;
    transform: translateX(-50%);
    background: radial-gradient(circle, rgba(251, 191, 36, .35), transparent 65%);
    pointer-events: none;
}
.ce-medal {
    position: relative;
    font-size: 46px;
    filter: drop-shadow(0 10px 22px rgba(251, 191, 36, .45));
    margin-bottom: 10px;
}
.ce-title {
    position: relative;
    font-size: 17px;
    font-weight: 800;
    color: var(--heading);
    letter-spacing: .02em;
}
.ce-desc {
    position: relative;
    margin-top: 8px;
    font-size: 12.5px;
    color: var(--muted);
    line-height: 1.7;
}
.ce-tips {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-top: 16px;
}
.ce-tips span {
    font-size: 11.5px;
    padding: 5px 11px;
    border-radius: 99px;
    background: rgba(56, 189, 248, .10);
    border: 1px solid rgba(56, 189, 248, .22);
    color: #7dd3fc;
}
.cert-card { position: relative; overflow: hidden; }
.cc-ribbon {
    position: absolute; right: -30px; top: 12px;
    transform: rotate(38deg);
    padding: 3px 34px;
    font-size: 10px; font-weight: 800;
    color: #3a2500;
    background: linear-gradient(120deg, #ffe08a, #f6b73c);
    letter-spacing: .08em;
}

/* ---------------- 竞猜开奖结果卡 ---------------- */
.qp-settle {
    display: flex;
    flex-direction: column;
    gap: 7px;
    padding: 12px 13px;
    border-radius: 14px;
    border: 1px solid var(--line);
    background: var(--surface-3);
    min-width: 210px;
}
.qps-title {
    font-size: 13px;
    font-weight: 800;
    color: #fbbf24;
    margin-bottom: 2px;
}
.qps-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12.5px;
    color: var(--muted);
}
.qps-label { width: 44px; flex: none; }
.qps-name { flex: 1; color: var(--heading); font-weight: 700; }
.qps-delta {
    flex: none;
    font-weight: 800;
    font-size: 13px;
    padding: 1px 8px;
    border-radius: 8px;
}
.qps-delta.plus { color: #34d399; background: rgba(52, 211, 153, .14); }
.qps-delta.minus { color: #f87171; background: rgba(248, 113, 113, .14); }
.qps-note { flex: none; font-size: 11px; color: var(--muted); }
.qps-reason { margin-top: 4px; font-size: 11.5px; color: var(--muted); }


/* ---------------- 头像图片统一渲染（防止原图撑大布局） ---------------- */
.chat-ava img, .cmc-ava img, .dm-avatar img, .dm-ava-s img,
.stu-ava img, .cam-ava img, .nc-ava img {
    width: 100%; height: 100%;
    object-fit: cover;
    border-radius: 50%;
    display: block;
}
.chat-ava, .cmc-ava, .dm-avatar, .dm-ava-s, .stu-ava, .cam-ava, .nc-ava {
    overflow: hidden;
}
.po-avatar-img, .lb-avatar-img {
    width: 100%; height: 100%;
    object-fit: cover;
    border-radius: 50%;
    display: block;
}
.po-avatar, .lb-avatar { overflow: hidden; }

/* 通知卡片：头像 + 两行文字 */
.notify-card { display: flex; align-items: center; gap: 9px; }
.nc-ava {
    width: 32px; height: 32px; flex: none;
    border-radius: 50%;
    display: grid; place-items: center;
    background: linear-gradient(140deg, #7dd3fc, #22d3ee);
    color: #04121f; font-size: 13px; font-weight: 800;
}
.nc-body { flex: 1; min-width: 0; }

/* 私信消息头像布局 */
.dm-msg { flex-direction: row; align-items: flex-start; gap: 7px; }
.dm-msg.mine { flex-direction: row-reverse; }
.dm-ava-s {
    width: 28px; height: 28px; flex: none;
    border-radius: 50%;
    display: grid; place-items: center;
    background: linear-gradient(140deg, #7dd3fc, #a855f7);
    color: #04121f; font-size: 11px; font-weight: 800;
}
.dm-msg-body { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; max-width: 82%; }
.dm-msg.mine .dm-msg-body { align-items: flex-end; }

/* 后台学生 / 聊天头像 */
.stu-ava {
    width: 22px; height: 22px;
    display: inline-grid; place-items: center;
    border-radius: 50%;
    margin-right: 7px;
    overflow: hidden;
    background: linear-gradient(140deg, #7dd3fc, #22d3ee);
    color: #04121f; font-size: 11px; font-weight: 800;
    vertical-align: middle;
}
.cam-ava {
    width: 20px; height: 20px;
    display: inline-grid; place-items: center;
    border-radius: 50%;
    margin-right: 6px;
    overflow: hidden;
    background: linear-gradient(140deg, #7dd3fc, #22d3ee);
    color: #04121f; font-size: 10px; font-weight: 800;
    vertical-align: middle;
}


/* 聊天室工具按钮：功能一行、输入框一行（全平台） */
.chat-input-row { flex-wrap: wrap; gap: 7px; padding: 9px 12px 12px; }
.chat-input-row > input { order: 5; flex: 1 1 62%; padding: 9px 11px; }
.chat-input-row > .chat-send:last-of-type { order: 6; flex: 0 0 auto; min-width: 68px; }
.chat-input-row > .chat-emoji-btn { width: 38px; height: 38px; }
.chat-input-row > .chat-send {
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.chat-input-row > #chatQuizBtn, .chat-input-row > #chatPacketBtn { padding: 0 10px; }

/* 功能按钮行：顶部对齐 */
.chat-input-row > .chat-emoji-btn,
.chat-input-row > .chat-send { order: 1; }

/* 头部好友按钮 */
.chat-head-btn {
    width: 30px; height: 30px; flex: none;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: var(--surface-3);
    color: var(--text);
    font-size: 14px;
    cursor: pointer;
    transition: border-color .16s ease, background .16s ease;
}
.chat-head-btn:hover { border-color: var(--accent); }
.chat-head { gap: 7px; }
.chat-head h3 { flex: 1; }

/* 好友面板 */
.chat-friends-panel {
    display: none;
    max-height: 46%;
    overflow-y: auto;
    padding: 10px 12px;
    border-bottom: 1px solid var(--line);
    background: var(--surface-solid);
}
.chat-friends-panel.open { display: block; }
.cf-title {
    display: flex; align-items: center; gap: 7px;
    font-size: 12.5px; font-weight: 800; color: var(--heading);
    margin-bottom: 8px;
}
.cf-title span {
    font-size: 10.5px; font-weight: 700;
    color: #7dd3fc; background: rgba(56, 189, 248, .16);
    padding: 1px 8px; border-radius: 99px;
}
.cf-loading, .cf-empty { padding: 14px 6px; text-align: center; font-size: 12px; color: var(--muted); }
.cf-row {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 9px; margin-bottom: 6px;
    border-radius: 11px;
    border: 1px solid var(--line);
    background: var(--surface-3);
}
.cf-ava {
    width: 32px; height: 32px; flex: none;
    border-radius: 50%; overflow: hidden;
    display: grid; place-items: center;
    background: linear-gradient(140deg, #7dd3fc, #22d3ee);
    color: #04121f; font-weight: 800; font-size: 13px;
}
.cf-ava img { width: 100%; height: 100%; object-fit: cover; }
.cf-main { flex: 1; min-width: 0; }
.cf-name { font-size: 12.5px; font-weight: 700; color: var(--heading); }
.cf-sub { margin-top: 2px; font-size: 10.5px; color: var(--muted); }
.cf-btn {
    flex: none; padding: 5px 11px;
    border-radius: 9px; border: 1px solid var(--line);
    background: var(--surface-2); color: var(--text);
    font-size: 11.5px; font-weight: 700; cursor: pointer;
}
.cf-btn:hover { border-color: var(--accent); color: var(--accent); }

/* Canvas 表情贴纸 */
.chat-emoji-panel { grid-template-columns: repeat(6, 1fr); gap: 4px; padding: 9px; }
.chat-emoji-panel .emoji-sticker, .dm-emoji-panel .emoji-sticker {
    width: 100% !important;
    height: auto !important;
    aspect-ratio: 1 / 1;
    max-width: 46px;
    cursor: pointer;
    border-radius: 13px;
    transition: transform .14s ease, filter .14s ease;
}
.chat-emoji-panel .emoji-sticker:hover,
.dm-emoji-panel .emoji-sticker:hover { transform: translateY(-2px) scale(1.06); filter: brightness(1.1); }

/* 右键菜单图标 */
.chat-ctx-item {
    display: flex;
    align-items: center;
    gap: 9px;
    text-align: left;
}
.chat-ctx-item .ctx-ic { flex: none; }
.chat-ctx-item span { flex: 1; }


/* 竞猜详情：作答 / 答案行 & 返回按钮 */
.qps-row.answer .qps-name { color: #7dd3fc; }
.qp-back { margin-right: auto; }
.qo-tag.warn { background: rgba(251, 191, 36, .18); color: #fbbf24; }


/* 聊天室 Canvas 图标排版 */
.chat-head { align-items: center; }
.chat-logo {
    width: 24px; height: 24px; flex: none;
    margin-right: 2px;
}
.chat-head h3 { flex: 1; display: flex; align-items: center; gap: 6px; }
.chat-head-btn, .chat-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.chat-head-btn { padding: 0; }
.chat-ic { display: block; pointer-events: none; }
.chat-room {
    display: inline-flex !important;
    align-items: center;
    gap: 5px;
}
.chat-room .chat-ic { flex: none; }
.chat-emoji-btn, .chat-send { display: inline-flex; align-items: center; justify-content: center; gap: 4px; }
.chat-send-btn span { font-size: 13px; }
#chatFab canvas { display: block; }


/* ---------------- 图片 / 表情包统一尺寸 ---------------- */
.chat-img {
    width: 150px !important;
    height: 150px !important;
    max-width: 150px;
    max-height: 150px;
    object-fit: contain;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: rgba(4, 12, 24, .35);
    cursor: zoom-in;
}
.chat-img:hover { border-color: var(--accent); }
.dm-img {
    width: 150px !important;
    height: 150px !important;
    max-width: 150px;
    max-height: 150px;
    object-fit: contain;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: rgba(4, 12, 24, .35);
    cursor: zoom-in;
}
@media (max-width: 768px) {
    .chat-img, .dm-img {
        width: 120px !important;
        height: 120px !important;
        max-width: 120px;
        max-height: 120px;
    }
}

/* 图标尺寸兜底（防止任何情况下被撑大） */
.chat-ic {
    max-width: 22px;
    max-height: 22px;
}
.chat-logo { max-width: 24px; max-height: 24px; }
#chatFab .chat-ic { max-width: 24px; max-height: 24px; }

/* ---------------- 表情包面板 ---------------- */
.em-section-title {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 2px 0 4px;
    font-size: 11.5px;
    font-weight: 700;
    color: var(--muted);
}
.em-section-title span {
    font-size: 10px;
    padding: 0 7px;
    border-radius: 99px;
    background: rgba(56, 189, 248, .16);
    color: #7dd3fc;
}
.em-sticker-grid {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(52px, 1fr));
    gap: 6px;
    padding: 2px 0 6px;
    border-bottom: 1px dashed var(--line);
    margin-bottom: 4px;
}
.stk-item {
    position: relative;
    aspect-ratio: 1 / 1;
    border-radius: 12px;
    overflow: hidden;
    background: rgba(56, 189, 248, .08);
    border: 1px solid var(--line);
    cursor: pointer;
    transition: transform .15s ease, border-color .15s ease;
}
.stk-item:hover { transform: translateY(-2px); border-color: var(--accent); }
.stk-item img {
    width: 100%; height: 100%;
    object-fit: contain;
    display: block;
}
.stk-del {
    position: absolute;
    right: 2px; top: 2px;
    width: 16px; height: 16px;
    border: 0; border-radius: 50%;
    background: rgba(0, 0, 0, .6);
    color: #fff;
    font-size: 9px;
    line-height: 1;
    cursor: pointer;
    opacity: 0;
    transition: opacity .15s ease;
}
.stk-item:hover .stk-del { opacity: 1; }
.stk-empty {
    grid-column: 1 / -1;
    padding: 10px 6px;
    font-size: 11.5px;
    color: var(--muted);
    text-align: center;
}
.em-emoji-grid {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 4px;
}
/* 聊天/私信表情面板宽度自适应 */
.chat-emoji-panel { grid-template-columns: 1fr; }
.chat-emoji-panel .em-emoji-grid { grid-template-columns: repeat(6, 1fr); }
.dm-emoji-panel { grid-template-columns: 1fr; padding: 8px; }
.dm-emoji-panel .em-emoji-grid { grid-template-columns: repeat(6, 1fr); }

/* ---------------- 图片查看弹窗 ---------------- */
.img-view-modal { max-width: 520px; padding: 0; overflow: hidden; }
.ivm-head {
    padding: 14px 18px;
    font-size: 15px; font-weight: 800; color: var(--heading);
    border-bottom: 1px solid var(--line);
    background: linear-gradient(120deg, rgba(56, 189, 248, .14), rgba(168, 85, 247, .1));
}
.ivm-body {
    display: grid;
    place-items: center;
    padding: 16px;
    background: rgba(4, 12, 24, .45);
    max-height: 56vh;
    overflow: auto;
}
.ivm-body img {
    max-width: 100%;
    max-height: 52vh;
    border-radius: 12px;
    display: block;
}

/* ---------------- 手机端聊天室尺寸优化 ---------------- */
@media (max-width: 768px) {
    .chat-panel {
        right: 8px;
        left: 8px;
        bottom: 74px;
        height: min(74vh, calc(100vh - 96px));
        border-radius: 16px;
    }
    .chat-head { padding: 10px 11px 9px; }
    .chat-head h3 { font-size: 14.5px; }
    .chat-head-btn { width: 28px; height: 28px; }
    .chat-rooms { padding: 7px 10px; gap: 6px; }
    .chat-room { padding: 5px 10px; font-size: 11.5px; }
    .chat-room .chat-ic { max-width: 15px; max-height: 15px; }
    .chat-input-row { padding: 7px 9px 10px; gap: 6px; }
    .chat-input-row > .chat-emoji-btn,
    .chat-input-row > .chat-send { height: 34px; width: 34px; }
    .chat-input-row > .chat-send:last-of-type { width: auto; min-width: 62px; }
    .chat-input-row > input { padding: 7px 10px; font-size: 12.5px; }
    .chat-send-btn span { font-size: 12px; }
}


/* 聊天输入区：工具行 + 输入行（确定性两行布局） */
.chat-input-row {
    display: flex !important;
    flex-direction: column;
    align-items: stretch !important;
    gap: 7px;
    padding: 9px 12px 12px;
    border-top: 1px solid var(--line);
    background: var(--surface-solid);
}
.chat-tools {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}
.chat-send-row {
    display: flex;
    align-items: center;
    gap: 7px;
}
.chat-send-row input[type="text"] {
    flex: 1;
    min-width: 0;
    padding: 9px 12px;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: var(--input-bg);
    color: var(--text);
    font-family: inherit;
    font-size: 13.5px;
}
.chat-send-row input[type="text"]:focus { outline: none; border-color: var(--accent); }
.chat-send-row .chat-send { height: 38px; min-width: 72px; }
.chat-tools .chat-emoji-btn,
.chat-tools .chat-send { width: 38px; height: 38px; padding: 0; flex: none; }
.chat-tools .chat-quiz-btn,
.chat-tools #chatPacketBtn { width: 38px; padding: 0; }
@media (max-width: 768px) {
    .chat-input-row { padding: 7px 9px 10px; gap: 6px; }
    .chat-tools { gap: 5px; }
    .chat-tools .chat-emoji-btn,
    .chat-tools .chat-send { width: 33px; height: 33px; }
    .chat-send-row input[type="text"] { padding: 7px 10px; font-size: 12.5px; }
    .chat-send-row .chat-send { height: 33px; min-width: 60px; }
}

.chat-tools { justify-content: flex-start !important; }
.chat-send-row { justify-content: flex-start; width: 100%; }


/* 聊天室在线人数 */
.chat-online {
    font-size: 9.5px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 99px;
    background: rgba(52, 211, 153, .16);
    color: #34d399;
    white-space: nowrap;
}
.chat-room.active .chat-online { background: rgba(255, 255, 255, .2); color: #eaf4ff; }
.chat-room:disabled .chat-online { opacity: .6; }
.chat-head-online {
    font-size: 10.5px;
    font-weight: 700;
    color: #34d399;
    background: rgba(52, 211, 153, .12);
    padding: 2px 8px;
    border-radius: 99px;
    margin-right: 4px;
    white-space: nowrap;
}

/* 聊天室禁止缩放/双击放大，触摸更跟手 */
#chatPanel, #chatPanel * { touch-action: manipulation; }
#chatPanel img.chat-img { pointer-events: auto; }
@media (max-width: 768px) {
    .chat-room { padding: 5px 9px; }
    .chat-online { font-size: 9px; padding: 1px 5px; }
    .chat-head-online { font-size: 10px; padding: 1px 7px; }
}


/* ---------------- 禁言设置弹窗 ---------------- */
.mute-modal { max-width: 420px; padding: 0; overflow: hidden; }
.mm-head {
    display: flex; align-items: center; gap: 11px;
    padding: 14px 16px;
    background: linear-gradient(120deg, rgba(248, 113, 113, .18), rgba(168, 85, 247, .1));
    border-bottom: 1px solid var(--line);
}
.mm-ico {
    width: 38px; height: 38px; flex: none;
    display: grid; place-items: center;
    border-radius: 12px; font-size: 18px;
    background: rgba(248, 113, 113, .18);
    border: 1px solid rgba(248, 113, 113, .3);
}
.mm-main { flex: 1; min-width: 0; }
.mm-title { font-size: 15px; font-weight: 800; color: var(--heading); }
.mm-sub { margin-top: 3px; font-size: 11px; color: var(--muted); }
.mm-body { padding: 14px 16px 6px; }
.mm-label { font-size: 12px; color: var(--muted); margin-bottom: 7px; }
.mm-durations { display: flex; gap: 7px; flex-wrap: wrap; margin-bottom: 14px; }
.mm-dur {
    padding: 6px 12px;
    border-radius: 9px;
    border: 1px solid var(--line);
    background: var(--surface-3);
    color: var(--text);
    font-size: 12px;
    cursor: pointer;
}
.mm-dur:hover { border-color: var(--accent); }
.mm-dur.active { border-color: #f87171; background: rgba(248, 113, 113, .16); color: #fca5a5; }
.mm-input {
    width: 100%;
    box-sizing: border-box;
    padding: 9px 11px;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: var(--input-bg);
    color: var(--text);
    font-family: inherit;
    font-size: 13px;
    margin-bottom: 6px;
}
.mm-input:focus { outline: none; border-color: var(--accent); }
.btn-submit.danger { background: linear-gradient(120deg, #f87171, #ef4444); color: #fff; }

/* 后台禁言列表 */
.muted-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 11px;
    margin-bottom: 7px;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: var(--surface-3);
}
.mr-main { flex: 1; min-width: 0; }
.mr-name { font-size: 13px; font-weight: 700; color: var(--heading); }
.mr-sub { margin-top: 2px; font-size: 11px; color: var(--muted); }
