.community-chat { width: min(1080px, 100%); height: 100%; min-height: 520px; margin: 0 auto; display: flex; flex-direction: column; overflow: hidden; border: 1px solid var(--line); border-radius: 18px; background: rgba(16,20,31,.94); box-shadow: var(--shadow); }
.community-chat-head { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.community-scopes { display: flex; gap: 5px; }
.community-scope, .room-chat-tab { min-height: 34px; padding: 7px 12px; border: 1px solid transparent; border-radius: 9px; background: transparent; color: var(--muted); font: inherit; font-size: 12px; font-weight: 750; cursor: pointer; }
.community-scope.is-active, .room-chat-tab.is-active { color: var(--text); border-color: var(--line-strong); background: var(--panel-2); }
.community-scope:disabled { opacity: .38; cursor: default; }
.scope-badge { display: inline-grid; place-items: center; min-width: 17px; height: 17px; margin-left: 6px; padding: 0 5px; border-radius: 999px; background: linear-gradient(145deg, #7152d3, #438ed9); color: #fff; font-size: 10px; font-style: normal; font-weight: 800; line-height: 1; vertical-align: 1px; box-shadow: 0 3px 9px rgba(40, 70, 150, .35); }
.community-chat-body { min-height: 0; flex: 1; display: flex; }
.community-thread { min-width: 0; flex: 1; display: flex; flex-direction: column; }
.thread-messages { min-height: 0; flex: 1; overflow-y: auto; padding: 18px; scrollbar-width:thin; scrollbar-color:rgba(145,171,194,.22) transparent; }
.thread-message { width:100%; max-width:none; display:grid; grid-template-columns:38px 76px minmax(0,1fr); align-items:baseline; gap:5px; margin:0; padding:2px; border:0; border-radius:0; background:transparent; }
.thread-message.mine { margin:0; border:0; border-radius:0; background:transparent; }
.thread-message b { min-width:0; overflow:hidden; color:#9e93c6; font-size:11.5px; font-weight:760; text-overflow:ellipsis; white-space:nowrap; }
.thread-message.mine b { color:#9bbf9a; }
.thread-message b.tone-0 { color:#9bbf9a; }.thread-message b.tone-1 { color:#83adbe; }.thread-message b.tone-2 { color:#9e93c6; }.thread-message b.tone-3 { color:#b7a785; }
.thread-message time { color:#62707d; font-size:9.5px; font-variant-numeric:tabular-nums; }
.thread-message p { min-width:0; margin:0; color:#d9dee3; font-size:12.5px; line-height:1.3; white-space:pre-wrap; overflow-wrap:anywhere; user-select:text; }
.thread-message.system b,.thread-message.system p { color:var(--muted); font-style:italic; }
.thread-empty, .chat-loading { display: grid; place-items: center; min-height: 240px; color: var(--muted); text-align: center; }
.community-compose { position:relative; display:flex; align-items:flex-end; gap:9px; padding:6px 11px 11px; }
.community-input-wrap { position:relative; min-width:0; flex:1; }

.chat-field { outline:none; white-space:pre-wrap; overflow-wrap:anywhere; -webkit-user-select:text; user-select:text; cursor:text; }
.chat-field.is-empty::before { content:attr(data-placeholder); display:inline; color:#6b7f95; pointer-events:none; -webkit-user-select:none; user-select:none; }
.chat-field.is-disabled { opacity:.6; cursor:default; }
.chat-field .chat-emoji { width:22px; height:22px; margin:0 1px; vertical-align:-.34em; }

.community-input { width:100%; min-height:48px; max-height:144px; display:block; overflow-y:auto; padding:12px 60px 12px 14px; border:1px solid var(--line); border-radius:12px; background:rgba(3,11,19,.8); color:var(--text); font:inherit; font-size:14px; line-height:1.45; transition:border-color .15s,box-shadow .15s; }
.community-input:focus { border-color:rgba(123,108,225,.62); box-shadow:0 0 0 3px rgba(123,108,225,.1); }
.community-counter { position:absolute; right:10px; bottom:8px; color:var(--muted); font-size:9px; pointer-events:none; }
.community-compose-actions { position:relative; display:flex; align-items:flex-end; gap:8px; }
.emoji-toggle { width:42px; height:42px; flex:0 0 auto; display:grid; place-items:center; padding:0; border:1px solid var(--line); border-radius:11px; background:var(--panel-2); color:#d9d3ff; font-size:21px; line-height:1; cursor:pointer; transition:border-color .15s,background .15s,transform .08s; }
.emoji-toggle:hover,.emoji-toggle[aria-expanded="true"] { border-color:rgba(123,108,225,.55); background:rgba(90,75,151,.28); }
.emoji-toggle:active { transform:scale(.96); }
.emoji-picker { position:absolute; right:0; bottom:calc(100% + 10px); z-index:12; width:300px; display:flex; flex-direction:column; gap:6px; padding:8px; border:1px solid var(--line-strong); border-radius:13px; background:rgba(7,16,27,.98); box-shadow:0 18px 42px rgba(0,0,0,.42); backdrop-filter:blur(18px); }
.emoji-picker[hidden] { display:none; }
.emoji-picker-tabs { display:flex; gap:4px; }
.emoji-picker-tabs button { flex:1; min-height:30px; padding:6px 8px; border:1px solid transparent; border-radius:8px; background:transparent; color:var(--muted); font:inherit; font-size:11px; font-weight:750; cursor:pointer; }
.emoji-picker-tabs button.is-active { color:var(--text); border-color:var(--line-strong); background:var(--panel-2); }
.emoji-picker-pane[data-picker-pane="emoji"] { display:grid; grid-template-columns:repeat(6,1fr); gap:4px; }
.emoji-picker-pane[data-picker-pane="sticker"] { display:grid; grid-template-columns:repeat(3,1fr); gap:6px; max-height:260px; overflow-y:auto; padding-right:2px; scrollbar-width:thin; }
.emoji-picker-pane[hidden] { display:none; }
.emoji-picker-pane button { width:38px; height:36px; display:grid; place-items:center; padding:0; border:0; border-radius:8px; background:transparent; cursor:pointer; }
.emoji-picker-pane button:hover { background:rgba(123,108,225,.22); }
.emoji-picker-pane button img { width:26px; height:26px; object-fit:contain; display:block; pointer-events:none; }
.emoji-picker-pane .sticker-btn { width:auto; height:auto; padding:4px; border-radius:10px; }
.emoji-picker-pane .sticker-btn img { width:78px; height:78px; }
.chat-emoji, .thread-message p .chat-emoji, .room-msg-body p .chat-emoji { width:1.35em; height:1.35em; margin:0 .06em; vertical-align:-.28em; object-fit:contain; display:inline-block; }
.chat-sticker { width:132px; height:132px; margin:2px 0; object-fit:contain; display:block; }
.chat-sticker.is-inline { width:72px; height:72px; display:inline-block; vertical-align:middle; }
.community-send { width:42px; height:42px; flex:0 0 auto; display:grid; place-items:center; padding:0; border:1px solid rgba(123,108,225,.42); border-radius:11px; background:rgba(90,75,151,.26); color:#cfd8ff; cursor:pointer; transition:border-color .15s,background .15s,color .15s,transform .08s,opacity .15s; }
.community-send svg { width:17px; height:17px; }
.community-send:hover:not(:disabled) { border-color:rgba(150,134,246,.7); background:rgba(108,90,190,.4); color:#f1f4ff; }
.community-send:active:not(:disabled) { transform:scale(.96); }
.community-send:disabled { opacity:.4; cursor:default; }
.reply-bar { display:flex; align-items:center; justify-content:space-between; gap:10px; margin:0 11px; padding:7px 11px; border:1px solid rgba(123,108,225,.28); border-radius:10px; background:rgba(60,50,110,.2); color:#c3bbe8; font-size:11px; }
.reply-bar.is-empty { border-style:dashed; border-color:rgba(145,171,194,.18); background:transparent; color:var(--muted); }
.reply-bar b { color:#e2ddff; font-weight:750; }
.reply-clear { width:22px; height:22px; flex:0 0 auto; display:grid; place-items:center; padding:0; border:0; border-radius:6px; background:transparent; color:inherit; font-size:15px; line-height:1; cursor:pointer; }
.reply-clear:hover { background:rgba(123,108,225,.22); color:#fff; }
.thread-message.is-private { cursor:pointer; border-radius:7px; }
.thread-message.is-private:hover { background:rgba(96,80,180,.12); }
.thread-message.is-private p { color:#cfc6ef; }
.community-chat .thread-message.is-private { grid-template-columns:38px 124px minmax(0,1fr); }
@media (max-width:680px) { .community-chat .thread-message.is-private { grid-template-columns:34px 100px minmax(0,1fr); } }
@media (max-width:390px) { .community-chat .thread-message.is-private { grid-template-columns:28px 88px minmax(0,1fr); } }
.room-chat-tabs { display: flex; gap: 4px; padding: 7px 9px; border-bottom: 1px solid var(--line); }.room-chat-tab.team { color: #b89aee; }.room-chat-tab.team.is-active { border-color: rgba(160,119,221,.3); background: rgba(135,92,196,.12); }
@media (max-width:680px) {
    .community-chat { height:100%; min-height:0; border-radius:12px; }
    .community-chat-head { flex:0 0 auto; align-items:stretch; flex-direction:column; gap:8px; padding:8px; }
    .community-scopes { width:100%; display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:5px; }
    .community-scope { min-height:42px; padding:8px 6px; font-size:12px; }
    .community-chat-body { min-height:0; flex:1; flex-direction:column; }
    .community-thread { min-height:0; flex:1; }
    .thread-messages { min-height:0; padding:10px 8px 6px; overscroll-behavior:contain; }
    .thread-message { max-width:none; grid-template-columns:34px 66px minmax(0,1fr); gap:4px; padding:2px 0; }
    .thread-message time { font-size:9px; }
    .thread-message b { font-size:10.5px; }
    .thread-message p { font-size:12px; line-height:1.32; }
    .community-compose { flex:0 0 auto; gap:6px; padding:5px 8px max(8px,env(safe-area-inset-bottom)); background:linear-gradient(180deg,rgba(7,18,29,.35),rgba(5,15,24,.92)); }
    .community-input { min-height:46px; max-height:116px; padding:11px 46px 11px 12px; font-size:14px; }
    .community-counter { right:8px; bottom:7px; font-size:8px; }
    .community-compose-actions { gap:5px; }
    .emoji-toggle { width:44px; height:46px; border-radius:11px; }
    .community-send { width:44px; height:46px; border-radius:11px; }
    .emoji-picker { right:0; width:min(300px,calc(100vw - 24px)); padding:7px; }
    .emoji-picker-pane[data-picker-pane="emoji"] { grid-template-columns:repeat(6,1fr); gap:3px; }
    .emoji-picker-pane[data-picker-pane="sticker"] { grid-template-columns:repeat(3,1fr); max-height:220px; }
    .emoji-picker-pane button { width:38px; height:36px; }
    .emoji-picker-pane .sticker-btn img { width:70px; height:70px; }
    .room-chat-tab { flex:1; min-height:40px; }
}

@media (max-width:380px) {
    .thread-message { grid-template-columns:32px 58px minmax(0,1fr); gap:3px; }
    .thread-message b { font-size:10px; }
    .thread-message p { font-size:11.5px; }
    .community-compose { gap:4px; padding-inline:6px; }
    .emoji-toggle { width:40px; }
    .community-send { width:40px; }
}

.dm-modal { padding: 20px; }
.dm-modal h2 { margin: 5px 0 12px; font-size: 20px; letter-spacing: -.02em; }
.dm-input { width: 100%; min-height: 108px; max-height: 200px; display: block; overflow-y: auto; padding: 12px 13px; border: 1px solid var(--line); border-radius: 12px; background: rgba(3,11,19,.8); color: var(--text); font: inherit; font-size: 13.5px; line-height: 1.45; }
.dm-input:focus { border-color: rgba(123,108,225,.62); box-shadow: 0 0 0 3px rgba(123,108,225,.1); }
.dm-foot { position: relative; display: flex; align-items: center; gap: 10px; margin-top: 7px; color: var(--muted); font-size: 10px; }
.dm-hint { margin-right: auto; }
.dm-emoji { width: 32px; height: 32px; border-radius: 9px; font-size: 17px; }
.dm-counter { font-variant-numeric: tabular-nums; }
