/* 校园即时聊 微信/QQ 风格 */
.chat-body { background: #edf1ea; margin: 0; min-height: 100vh; color: var(--ink); font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif; }
.chat-body--embed { background: #edf1ea; }
.chat-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 22px; background: var(--surface); border-bottom: 1px solid var(--line); }
.chat-top .brand { display: flex; align-items: center; gap: 8px; color: var(--ink); text-decoration: none; }
.chat-top .brand__text { display: inline-flex; flex-direction: column; line-height: 1.1; }
.chat-top .brand__en { font-size: 9px; letter-spacing: .18em; color: var(--muted-2); }
.chat-shell { max-width: 980px; margin: 0 auto; padding: 24px 16px; }
.chat-app { position: relative; display: flex; flex-direction: column; height: min(78vh, 760px); background: #f6f8f3; border: 1px solid var(--line); border-radius: 18px; overflow: hidden; box-shadow: 0 18px 50px rgba(16,37,26,.08); }
.chat-app__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; background: var(--surface); border-bottom: 1px solid var(--line); }
.chat-app__title { display: flex; align-items: center; gap: 10px; }
.chat-app__pulse { width: 9px; height: 9px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 4px rgba(34,197,94,.14); }
.chat-app__title h1 { margin: 0; font-size: 17px; letter-spacing: -.02em; }
.chat-app__title p { margin: 2px 0 0; color: var(--muted-2); font-size: 12px; }
.chat-app__title b { color: var(--brand); }
.chat-app__badge { flex: none; font-size: 11px; color: var(--brand); background: var(--brand-softer); padding: 4px 9px; border-radius: 999px; }
.chat-stream { flex: 1; overflow-y: auto; padding: 16px 18px 8px; display: flex; flex-direction: column; scroll-behavior: smooth; }
.chat-loadmore { text-align: center; padding: 2px 0 8px; }
.chat-loadmore__btn { border: 0; background: transparent; color: var(--muted-2); font: inherit; font-size: 12px; cursor: pointer; }
.chat-loadmore__btn:hover { color: var(--brand); }
.chat-empty { margin: auto; text-align: center; color: var(--muted-2); font-size: 13px; }
.chat-time-sep { text-align: center; margin: 14px 0 10px; color: var(--muted-2); font-size: 11px; }
.chat-row { display: flex; gap: 9px; align-items: flex-start; margin-top: 14px; }
.chat-row.is-grouped { margin-top: 4px; }
.chat-row.is-me { flex-direction: row-reverse; }
.chat-avatar { width: 34px; height: 34px; flex: none; border-radius: 50%; overflow: hidden; background: var(--brand-softer); display: grid; place-items: center; text-decoration: none; color: inherit; }
.chat-avatar .avatar { width: 100%; height: 100%; }
.chat-col { display: flex; flex-direction: column; align-items: flex-start; max-width: 72%; min-width: 0; }
.chat-row.is-me .chat-col { align-items: flex-end; }
.chat-name { display: flex; align-items: center; gap: 5px; margin: 0 3px 4px; color: var(--muted-2); font-size: 11.5px; }
.chat-online-dot { width: 6px; height: 6px; border-radius: 50%; background: #22c55e; }
.chat-bubble { padding: 9px 12px; border-radius: 4px 14px 14px 14px; background: var(--surface); border: 1px solid var(--line); color: var(--ink); font-size: 14px; line-height: 1.6; word-break: break-word; white-space: pre-wrap; box-shadow: 0 2px 6px rgba(16,37,26,.04); }
.chat-row.is-me .chat-bubble { background: var(--brand); color: #fff; border-color: transparent; border-radius: 14px 4px 14px 14px; }
.chat-row.is-pending .chat-bubble { opacity: .6; }
.chat-status { margin: 3px 3px 0; color: var(--muted-2); font-size: 11px; }
.chat-newmsg { position: absolute; left: 50%; bottom: 74px; transform: translateX(-50%); z-index: 4; border: 0; border-radius: 999px; padding: 7px 14px; background: var(--brand); color: #fff; font-size: 12px; font-weight: 600; box-shadow: 0 6px 20px rgba(19,107,69,.3); cursor: pointer; }
.chat-composer { display: flex; align-items: flex-end; gap: 8px; padding: 10px 12px; background: var(--surface); border-top: 1px solid var(--line); }
.chat-composer__emoji { flex: none; width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); font-size: 18px; line-height: 1; cursor: pointer; }
.chat-composer textarea { flex: 1; min-height: 38px; max-height: 120px; resize: none; overflow-y: auto; scrollbar-width: none; border: 1px solid var(--line); border-radius: 12px; padding: 9px 12px; background: var(--bg); color: var(--ink); font: inherit; font-size: 14px; line-height: 1.5; outline: none; }
.chat-composer textarea::-webkit-scrollbar { width: 0; height: 0; }
.chat-composer textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(19,107,69,.08); }
.chat-composer__send { flex: none; height: 38px; padding: 0 18px; border: 0; border-radius: 10px; background: var(--brand); color: #fff; font: inherit; font-size: 14px; font-weight: 700; cursor: pointer; }
.chat-composer__send:disabled { opacity: .5; cursor: not-allowed; }
.chat-emoji-panel { position: absolute; left: 12px; right: 12px; bottom: 62px; z-index: 6; display: grid; grid-template-columns: repeat(10, 1fr); gap: 4px; max-height: 200px; overflow-y: auto; padding: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 16px 40px rgba(16,37,26,.16); }
.chat-emoji-panel button { border: 0; background: transparent; font-size: 22px; line-height: 1; padding: 6px; border-radius: 8px; cursor: pointer; }
.chat-emoji-panel button:hover { background: var(--brand-softer); }
.chat-toast { position: absolute; left: 50%; bottom: 86px; transform: translateX(-50%); z-index: 10; padding: 8px 14px; border-radius: 8px; background: rgba(16,37,26,.9); color: #fff; font-size: 12px; transition: opacity .3s, transform .3s; }
.chat-toast.is-out { opacity: 0; transform: translateX(-50%) translateY(6px); }
@media (max-width: 640px) {
    .chat-top { display: none; }
    .chat-shell { padding: 0; max-width: none; }
    .chat-app { height: 100dvh; border-radius: 0; border: 0; }
    .chat-app__head { padding: 12px 14px; }
    .chat-stream { padding: 14px 12px 6px; }
    .chat-col { max-width: 78%; }
    .chat-composer { padding: 8px 10px calc(8px + env(safe-area-inset-bottom)); }
    .chat-emoji-panel { left: 8px; right: 8px; bottom: 60px; grid-template-columns: repeat(8, 1fr); }
}
.chat-body--embed .chat-top { display: none; }
.chat-body--embed .chat-shell { padding: 0; max-width: none; }
.chat-body--embed .chat-app { height: 100vh; border-radius: 0; border: 0; }

.chat-room-section { padding: 26px 0 46px; }
.chat-room-section .chat-shell { padding: 0; }
.chat-room-section .chat-app { height: min(72vh, 720px); }
.chat-room-page .chat-app { background: #f6f8f3; }
@media (max-width: 640px) {
    .chat-room-section { padding: 10px 0 24px; }
    .chat-room-section .chat-app {
        height: calc(100dvh - 190px);
        min-height: 520px;
        border-radius: 16px;
        border: 1px solid var(--line);
    }
}


/* 游客只读模式 */
.chat-guest-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    border-top: 1px solid var(--line);
    background: var(--surface);
    color: var(--muted);
    font-size: 12px;
}
.chat-guest-bar .btn { flex: 0 0 auto; }
@media (max-width: 560px) {
    .chat-guest-bar { flex-direction: column; align-items: stretch; text-align: center; }
    .chat-guest-bar .btn { width: 100%; justify-content: center; }
}
