/* ============================================================
 * 95-emoji-panel.css —— 精简版
 *
 * ★ 这个文件只负责三件事，别的一律不碰：
 *   ① 弹幕面板（#modal-danmaku）
 *   ② 点歌面板（#modal-music）
 *   ③ 弹幕飘动层（.danmaku-layer）
 *
 * ★ 不管的（交回项目原有样式）：
 *   · 表情面板（emoji-panel）—— 01-msg.css / 02-mention-item.css 已经有一套
 *   · 输入框那一行（.composer）—— 03-msg.css 已经有一套
 *   · 弹窗的遮罩和盒子（.mask / .modal）—— 02-mention-item.css 已经有一套
 *
 * 为什么这么克制：前几轮我往这个文件里加了几百行"改进"，
 * 结果和项目原有样式打架，把输入框都弄没了。
 * 教训：**改样式前先看原来是怎么写的，能不加就不加。**
 * ============================================================ */

/* ============================================================
 * ① 弹幕飘动层
 *    和消息区平级（放在 #messages 外面）
 *    —— 放在 #messages 里面会被滚动容器裁掉，还会跟着滚
 * ============================================================ */
.danmaku-layer {
  position: absolute;
  left: 0;
  right: 0;
  top: 56px;              /* 从房间标题下面开始飘 */
  height: 220px;
  overflow: hidden;
  pointer-events: none;   /* 绝不挡点击 */
  z-index: 25;            /* 在消息之上、弹窗之下 */
}
.danmaku-item {
  position: absolute;
  left: 100%;
  white-space: nowrap;
  font-size: 15px;
  line-height: 28px;
  padding: 0 10px;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, .75);
  background: rgba(0, 0, 0, .32);
  border-radius: 999px;
  animation-name: danmaku-fly;
  animation-timing-function: linear;
  animation-fill-mode: forwards;
  will-change: transform;
}
.danmaku-item b { font-weight: 600; opacity: .85; margin-right: 2px; }
@keyframes danmaku-fly {
  from { transform: translateX(0); }
  to   { transform: translateX(calc(-100vw - 100%)); }
}
@media (prefers-reduced-motion: reduce) {
  .danmaku-item { animation-duration: .01s !important; }
}

/* ============================================================
 * ② 弹幕面板
 *    结构：#modal-danmaku.mask > .modal > 内容
 *    遮罩和盒子的基础样式由 .mask / .modal 提供（别重复定义）
 *    这里只管"里面的内容"怎么排
 * ============================================================ */
#modal-danmaku .modal {
  width: min(540px, 94vw);
  max-width: 540px;
}
#modal-danmaku h3 {
  margin: 0 0 6px;
  font-size: 16px;
  line-height: 1.6;
}
#modal-danmaku .modal-sub {
  font-size: 12.5px;
  color: var(--muted);
  font-weight: 400;
  margin-left: 6px;
}
#modal-danmaku .danmaku-list {
  height: 46vh;
  min-height: 180px;
  max-height: 420px;
  overflow-y: auto;
  padding: 12px 14px;
  margin: 10px 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-soft);
  box-sizing: border-box;
}
#modal-danmaku .danmaku-list .mention-empty,
#modal-danmaku .danmaku-list > div:only-child {
  display: block;
  width: 100%;
  padding: 40px 10px;
  text-align: center;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.9;
}
#modal-danmaku .danmaku-row {
  font-size: 14px;
  line-height: 1.75;
  word-break: break-word;
  margin-bottom: 6px;
}
#modal-danmaku .danmaku-row b { color: var(--brand); font-weight: 600; margin-right: 3px; }
#modal-danmaku .danmaku-row i { font-style: normal; font-size: 11.5px; color: var(--muted); margin-left: 8px; }
#modal-danmaku .danmaku-send {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}
#modal-danmaku .danmaku-send input {
  flex: 1 1 auto;
  min-width: 0;
  padding: 11px 14px;
  font-size: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-soft);
  color: var(--text);
  box-sizing: border-box;
}
#modal-danmaku .danmaku-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
#modal-danmaku .danmaku-tip { font-size: 12px; color: var(--muted); line-height: 1.7; }

/* ---------- 弹幕的两个频道：本房间 / 全站 ----------
 * 用户要的："弹幕应该是发在所有房间都能看到的地方，
 *            要不你可以加房间弹幕和全局弹幕两个选择吧"
 * 所以面板顶部放两个切换按钮，两边各有各的历史。 */
.danmaku-scope {
  display: flex;
  gap: 6px;
  margin: 8px 0 4px;
  flex: 0 0 auto;
}
.dm-scope-tab {
  padding: 6px 14px;
  font-size: 13px;
  line-height: 1.4;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel-soft);
  color: var(--muted);
  cursor: pointer;
  transition: background .14s, color .14s, border-color .14s;
}
.dm-scope-tab:hover { border-color: var(--brand); color: var(--brand); }
.dm-scope-tab.active {
  background: var(--brand-soft);
  border-color: var(--brand);
  color: var(--brand);
  font-weight: 600;
}

/* ---------- 全站弹幕：和本房间的区分开 ----------
 * 飞过去的那条给个偏蓝的底，历史列表里加个左边框，
 * 一眼能看出"这条是从别的房间飘来的"。 */
.danmaku-item.dm-global {
  background: rgba(47, 111, 237, .42);
}
#modal-danmaku .danmaku-row.dm-row-global {
  border-left: 3px solid var(--brand);
  padding-left: 8px;
  margin-left: -11px;
}
#modal-danmaku .danmaku-row.dm-row-global b { color: var(--brand); }

/* 频道按钮在窄面板里也别挤 */
@media (max-width: 420px) {
  .dm-scope-tab { padding: 5px 10px; font-size: 12px; }
}

/* ============================================================
 * ③ 点歌面板
 * ============================================================ */
#modal-music .modal {
  width: min(560px, 94vw);
  max-width: 560px;
}
#modal-music h3 { margin: 0 0 6px; font-size: 16px; line-height: 1.6; }
#modal-music .modal-sub {
  font-size: 12.5px;
  color: var(--muted);
  font-weight: 400;
  margin-left: 6px;
}
#modal-music .music-add {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 10px 0 6px;
}
#modal-music .music-add input {
  flex: 1 1 180px;
  min-width: 0;
  padding: 10px 14px;
  font-size: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-soft);
  color: var(--text);
  box-sizing: border-box;
}
#modal-music .music-msg { min-height: 18px; font-size: 12.5px; color: var(--muted); }
#modal-music .music-msg.bad { color: #e5484d; }
#modal-music .music-list {
  height: 40vh;
  min-height: 150px;
  max-height: 360px;
  overflow-y: auto;
  margin: 8px 0;
}
#modal-music .music-summary {
  padding: 8px 12px;
  margin-bottom: 8px;
  font-size: 12.5px;
  line-height: 1.7;
  color: var(--muted);
  background: var(--panel-soft);
  border-radius: 9px;
}
#modal-music .music-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  margin-bottom: 6px;
  border: 1px solid var(--line);
  border-radius: 10px;
}
#modal-music .music-row.playing { border-color: var(--brand); background: rgba(34, 197, 94, .07); }
#modal-music .music-idx { width: 22px; text-align: center; color: var(--muted); font-size: 13px; flex: 0 0 auto; }
#modal-music .music-row.playing .music-idx { color: var(--brand); }
#modal-music .music-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
#modal-music .music-main b { font-size: 14px; font-weight: 500; }
#modal-music .music-meta { font-size: 12px; color: var(--muted); line-height: 1.6; word-break: break-word; }
#modal-music .music-acts { flex: 0 0 auto; display: flex; gap: 6px; }
#modal-music .music-acts .btn { padding: 5px 12px; font-size: 12.5px; text-decoration: none; }
#modal-music .music-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 6px;
}
#modal-music .music-tip { font-size: 12px; color: var(--muted); }

/* ---------- 点歌列表里的歌曲信息 ----------
 * 贴分享链接时，服务端会自动去查歌名/歌手/封面（见 src/music-info.js）。
 * 这里只负责把它们排好看：封面小图 + 歌名 + 平台标 + VIP 标。 */
#modal-music .music-cover {
  width: 40px;
  height: 40px;
  border-radius: 7px;
  object-fit: cover;
  flex: 0 0 auto;
  background: var(--panel-soft);
}
#modal-music .music-title-line {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  font-size: 14px;
  font-weight: 500;
}
#modal-music .music-title-line .music-name { font-weight: 500; }

/* 平台 / VIP 小标签 */
#modal-music .music-tag {
  font-style: normal;
  font-size: 10.5px;
  line-height: 1.5;
  padding: 1px 6px;
  border-radius: 5px;
  border: 1px solid var(--line);
  color: var(--muted);
  white-space: nowrap;
}
#modal-music .music-tag.netease { color: #c62828; border-color: rgba(198, 40, 40, .35); }
#modal-music .music-tag.qq { color: #1a9c4b; border-color: rgba(26, 156, 75, .35); }
#modal-music .music-tag.direct { color: var(--brand); border-color: var(--brand-line); }
#modal-music .music-tag.vip {
  color: #b8860b;
  border-color: rgba(184, 134, 11, .45);
  background: rgba(184, 134, 11, .08);
  font-weight: 600;
  cursor: help;
}

/* ---------- 点歌播放器（整房间同步） ----------
 * 音频元素就放在这一块里 —— 面板关掉它也继续放，
 * 因为 display:none 不影响 audio 播放。
 * 配套脚本：public/js/37-music-player.js */
#modal-music .music-player {
  border: 1px solid var(--brand-line, var(--line));
  border-radius: 11px;
  background: var(--panel-soft);
  padding: 10px 12px;
  margin: 8px 0 4px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}
#modal-music .music-player.hidden { display: none !important; }

#modal-music .mp-title {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13.5px;
  font-weight: 500;
  min-width: 0;
}
#modal-music .mp-note {
  color: var(--brand);
  flex: 0 0 auto;
  animation: mp-spin 2.4s linear infinite;
  display: inline-block;
}
@keyframes mp-spin { from { transform: rotate(0); } to { transform: rotate(360deg); } }
#modal-music .mp-title #mp-name {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#modal-music .mp-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
#modal-music .mp-time {
  font-size: 11.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  flex: 0 0 auto;
  min-width: 76px;
}
#modal-music .mp-seek { flex: 1 1 auto; min-width: 60px; accent-color: var(--brand); }
#modal-music .mp-btn { padding: 4px 12px; font-size: 12.5px; flex: 0 0 auto; }
#modal-music .mp-vol-wrap { display: flex; align-items: center; gap: 4px; flex: 1 1 auto; min-width: 70px; }
#modal-music .mp-vol-icon { font-size: 12px; opacity: .7; }
#modal-music .mp-vol { flex: 1 1 auto; min-width: 50px; accent-color: var(--brand); }

/* ============================================================
 * 点歌：搜歌界面（用户要的"像真正在软件里面搜索歌曲一样"）
 * 配套脚本：public/js/38-music-search.js
 * ============================================================ */
#modal-music .music-search {
  margin: 8px 0 6px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

#modal-music .ms-row { display: flex; gap: 8px; }
#modal-music .ms-input {
  flex: 1 1 auto;
  min-width: 0;
  padding: 10px 14px;
  font-size: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-soft);
  color: var(--text);
  box-sizing: border-box;
}
#modal-music .ms-input:focus {
  outline: none;
  border-color: var(--brand);
  background: var(--panel);
  box-shadow: 0 0 0 3px var(--brand-soft);
}
#modal-music .ms-go { flex: 0 0 auto; padding: 10px 20px; border-radius: 10px; }

/* 平台筛选 */
#modal-music .ms-tabs { display: flex; gap: 6px; }
#modal-music .ms-tab {
  padding: 4px 12px;
  font-size: 12.5px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel-soft);
  color: var(--muted);
  cursor: pointer;
}
#modal-music .ms-tab:hover { border-color: var(--brand); color: var(--brand); }
#modal-music .ms-tab.active {
  background: var(--brand-soft);
  border-color: var(--brand);
  color: var(--brand);
  font-weight: 600;
}

/* 结果列表：**卡片网格**（用户要的"像点播软件那种"）
 * 每张卡：封面（带时长角标和平台角标）+ 歌名 + 歌手 + 底部按钮 */
#modal-music .ms-results {
  max-height: 42vh;
  min-height: 90px;
  overflow-y: auto;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--panel-soft);
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
  gap: 10px;
  align-content: start;
}
#modal-music .ms-empty {
  grid-column: 1 / -1;
  padding: 26px 12px;
  text-align: center;
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.8;
}

#modal-music .ms-card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 11px;
  overflow: hidden;
  background: var(--panel);
  cursor: pointer;
  transition: border-color .14s, transform .14s, box-shadow .14s;
}
#modal-music .ms-card:hover {
  border-color: var(--brand);
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .1);
}

/* 封面：正方，撑满卡片宽度 */
#modal-music .ms-card-cover {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  background: var(--panel-soft);
  overflow: hidden;
}
#modal-music .ms-card-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
#modal-music .ms-card-cover.ms-cover-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  color: var(--muted);
  opacity: .45;
}

/* 时长角标：压在封面右下角 */
#modal-music .ms-card-dur {
  position: absolute;
  right: 6px;
  bottom: 6px;
  padding: 1px 6px;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  color: #fff;
  background: rgba(0, 0, 0, .62);
  border-radius: 5px;
  pointer-events: none;
}
/* 平台角标：压在封面左上角 */
#modal-music .ms-card-tag {
  position: absolute;
  left: 6px;
  top: 6px;
  padding: 1px 6px;
  font-size: 10.5px;
  border-radius: 5px;
  color: #fff;
  pointer-events: none;
}
#modal-music .ms-card-tag.netease { background: rgba(198, 40, 40, .88); }
#modal-music .ms-card-tag.qq { background: rgba(26, 156, 75, .88); }

/* 歌名 + 歌手 */
#modal-music .ms-card-body {
  padding: 7px 9px 4px;
  flex: 1 1 auto;
  min-width: 0;
}
#modal-music .ms-card-title {
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#modal-music .ms-card-artist {
  font-size: 11.5px;
  color: var(--muted);
  line-height: 1.5;
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 底部按钮：做醒目一点。
 * ★ 之前用的是 var(--brand-soft) 淡底 + 品牌色字 ——
 *   看着像"禁用状态" ✗（用户截图里那几个按钮就是灰绿灰绿的）。
 *   改成实心按钮，和参考图里那个红色的「点播」一个意思：
 *   一眼能看出来这是能点的。 */
#modal-music .ms-card-btn {
  flex: 0 0 auto;
  margin: 0 8px 8px;
  padding: 7px 8px;
  font-size: 12px;
  line-height: 1.4;
  font-weight: 500;
  border: 1px solid transparent;
  border-radius: 8px;
  background: var(--brand);
  color: #fff;
  cursor: pointer;
  transition: filter .14s, transform .1s;
}
#modal-music .ms-card-btn:hover { filter: brightness(1.08); }
#modal-music .ms-card-btn:active { transform: scale(.97); }
#modal-music .ms-card-btn[data-busy='1'] { opacity: .7; cursor: default; }

/* VIP 歌：用金色实心，和普通歌区分开 */
#modal-music .ms-card-btn.vip {
  background: #b8860b;
  color: #fff;
}
#modal-music .ms-card-btn.vip:hover { filter: brightness(1.1); }

/* 窄一点的面板：一行两张 */
@media (max-width: 520px) {
  #modal-music .ms-results { grid-template-columns: repeat(auto-fill, minmax(108px, 1fr)); }
  #modal-music .ms-card-title { font-size: 12.5px; }
  #modal-music .ms-card-btn { font-size: 11.5px; }
}

/* 贴链接那一块收起来 */
#modal-music .music-url-box {
  margin: 6px 0;
  font-size: 12.5px;
}
#modal-music .music-url-box summary {
  cursor: pointer;
  color: var(--muted);
  padding: 4px 0;
  user-select: none;
}
#modal-music .music-url-box summary:hover { color: var(--brand); }
#modal-music .music-url-box .music-add { margin-top: 6px; }

/* 上传本地音频那一行 */
#modal-music .music-upload-row {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
  margin-top: 9px;
  padding-top: 9px;
  border-top: 1px dashed var(--line);
}
#modal-music .music-upload-status {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.6;
  min-width: 0;
  flex: 1 1 auto;
  word-break: break-all;
}
#modal-music .music-upload-status.ok { color: #1a9c4b; }
#modal-music .music-upload-status.bad { color: #c62828; }

/* 点歌解析（管理面板那一页）的「一键填好」那一块 */
.mp-preset {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--panel-soft);
}
.mp-howto {
  margin-top: 8px;
  padding: 8px 10px;
  border-left: 3px solid var(--brand);
  border-radius: 4px;
  background: var(--panel-soft);
  line-height: 1.75;
}

/* 测试结果的三种状态，颜色区分开。
 * ★ 「接口通了但这首歌取不到」必须是**黄色**不是红色 ——
 *   红色会让人以为配置错了，然后去瞎改。 */
.mp-ok { color: #1a9c4b; font-weight: 500; }
.mp-warn { color: #b8860b; }
.mp-bad { color: #c62828; }

/* Cookie 健康状态那一行（上次自动检测 + QQ 到期倒计时） */
.mp-health {
  display: block;
  margin-top: 6px;
  padding: 7px 9px;
  border-radius: 7px;
  background: var(--panel-soft);
  line-height: 1.75;
}

/* QQ音乐那一组，和网易云那块分开，免得混着看 */
.mp-qq-box {
  margin-top: 14px;
  padding: 10px;
  border: 1px solid var(--line);
  border-left: 3px solid #1a9c4b;
  border-radius: 9px;
  background: var(--panel-soft);
}
.mp-qq-head {
  font-size: 12.5px;
  font-weight: 600;
  color: #1a9c4b;
  margin-bottom: 8px;
  line-height: 1.6;
}

/* ---------- 管理面板里的表单字段 ----------
 * 「点歌解析」那一页要填接口地址、Cookie 这些东西。
 * 样式跟着 08-avatar.css 里那套 admin-* 走，保持一致。 */
.admin-field {
  margin-bottom: 10px;
}
.admin-label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--text);
}
.admin-input {
  width: 100%;
  box-sizing: border-box;
  padding: 8px 11px;
  font-size: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  color: var(--text);
}
.admin-input:focus {
  outline: none;
  border-color: var(--brand);
  background: var(--panel);
  box-shadow: 0 0 0 3px var(--brand-soft);
}
.admin-field .admin-sub {
  /* 说明文字跟在输入框下面，别挤在一起 */
  margin-top: 4px;
  font-size: 11.5px;
  line-height: 1.6;
}

/* ============================================================
 * ④ 表情面板：浮动窗（可拖动 + 可缩放 + 记住位置）
 *
 * 为什么要在这一层覆盖：
 *   01-msg.css 把 .emoji-panel 设计成**内嵌在聊天区底部**的一条
 *   （flex: 0 0 auto; height: 208px）。
 *   但用户要的是"能拖着走、能拉边框改大小"的悬浮窗，
 *   所以要把它改成绝对定位，脱离文档流。
 *
 * 配套脚本：public/js/35-emoji-drag.js
 *   它负责拖动、缩放、把位置存进 localStorage、窗口变小自动收回。
 *   它给面板加 .dragging / .resizing 两个状态类，
 *   给它自己创建的 .emoji-resize（缩放手柄）和 .emoji-reset（复位按钮）挂事件。
 *   所以这几个类的样式必须在这里定义 —— 少了它们手柄看不见也拖不动。
 *
 * 定位基准：#emoji-panel 是 .chat 的直接子元素，
 *   而 01-msg.css 里写了 .chat { position: relative }，
 *   所以 left/top 是相对聊天区的，跟着窗口缩放也不会跑偏。
 * ============================================================ */
.emoji-panel {
  position: absolute;
  left: 14px;
  bottom: 78px;                 /* 浮在输入框上方一点 */
  right: auto;
  top: auto;
  width: min(440px, calc(100% - 28px));
  height: 380px;
  max-height: none;             /* 覆盖 01-msg.css 的 38vh —— 浮动窗不受那条限制 */
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 14px 44px rgba(0, 0, 0, .18);
  background: var(--panel);
  overflow: hidden;
  z-index: 40;                  /* 盖在消息区之上 */
  animation: none;              /* 浮动窗不要那个"从下往上"的入场动画 */
}

/* 拖动 / 缩放过程中：禁掉文字选中，光标给个提示 */
.emoji-panel.dragging { user-select: none; cursor: grabbing; }
.emoji-panel.resizing { user-select: none; }

/* 拖动把手：标题那一行 */
.emoji-panel .emoji-head { cursor: grab; }
.emoji-panel.dragging .emoji-head { cursor: grabbing; }

/* 标题里的"（拖这里移动）"提示 */
.emoji-drag-hint {
  font-size: 11px;
  color: var(--muted);
  opacity: .7;
  margin-left: 8px;
  pointer-events: none;         /* 别挡住关闭按钮的点击 */
}

/* 右下角的缩放手柄：两道斜线，看着像能拉 */
.emoji-resize {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 18px;
  height: 18px;
  cursor: nwse-resize;
  z-index: 2;
  background:
    linear-gradient(135deg, transparent 0 46%, var(--line) 46% 54%, transparent 54%),
    linear-gradient(135deg, transparent 0 70%, var(--line) 70% 78%, transparent 78%);
  border-bottom-right-radius: 13px;
}
.emoji-resize:hover { background-color: var(--panel-soft); }

/* 右上角的复位按钮
 * ★ 位置要避开关闭按钮：关闭按钮在 .emoji-head 里、贴着右边（right 约 12px）。
 *   之前复位按钮写的 right: 8px，两个就叠在一起了（用户截图看到"图标堆叠"）。
 *   放到 38px，正好在关闭按钮左边。 */
.emoji-reset {
  position: absolute;
  right: 38px;
  top: 5px;
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
}
.emoji-reset:hover { background: var(--panel-soft); color: var(--text); }

/* 标题行右侧留出两个按钮的位置，免得"（拖这里移动）"被压住 */
.emoji-panel .emoji-head { padding-right: 64px; }

/* ============================================================
 * 空状态文字：在网格里必须**跨满整行**
 *
 * 为什么需要：表情包网格是 display:grid（每格 72px）。
 * 空状态的 div 用的是 .mention-empty 这个类 ——
 * 那个类是给 @提及 下拉框写的（12px 小字、小内边距），
 * 放进网格里就变成"一个 72px 宽的格子"，
 * 结果那句"还没有表情包：点「＋ 添加」上传…"被挤成一列竖排的字
 * （用户截图看到的就是这个）。
 * ============================================================ */
.sticker-grid > .mention-empty,
.sticker-grid > .sticker-empty,
#sticker-grid > .mention-empty,
#room-sticker-grid > .mention-empty,
#hot-sticker-grid > .mention-empty {
  grid-column: 1 / -1;
  padding: 20px 12px;
  text-align: center;
  font-size: 13px;
  line-height: 1.9;
  color: var(--muted);
  white-space: normal;
  word-break: break-word;
}

/* 面板拉窄之后：格子变小、分类标签换行，
   这样内容跟着面板一起自适应，不会挤成一团 */
.emoji-panel[data-w="narrow"] .emoji-grid {
  grid-template-columns: repeat(auto-fill, 32px);
  grid-auto-rows: 32px;
  gap: 4px;
}
.emoji-panel[data-w="narrow"] .emoji-grid button { font-size: 20px; }
.emoji-panel[data-w="narrow"] .sticker-grid {
  grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
}
.emoji-panel[data-w="narrow"] .sticker-cell { height: 64px; }
.emoji-panel[data-w="narrow"] .sticker-cat-row { gap: 5px; }
.emoji-panel[data-w="narrow"] .sticker-cat-tab { padding: 3px 8px; font-size: 11.5px; }

/* 小屏幕上不要浮得太大 */
@media (max-width: 560px) {
  .emoji-panel {
    left: 8px;
    width: calc(100% - 16px);
    height: 320px;
    bottom: 70px;
  }
}

/* ============================================================
 * 「本房间 / 热门」时，把"分类"那一行整体藏掉
 *
 * 切范围的 JS 只藏了 #sticker-cats，没藏旁边的「＋ 新分类」按钮，
 * 所以看"本房间"时那个按钮还杵在那儿（截图里能看到）。
 * 用 :has() 按当前选中的范围标签判断，一处搞定三个范围。
 * ============================================================ */
.sticker-pane:has(#scope-room.active) .sticker-cat-row,
.sticker-pane:has(#scope-hot.active) .sticker-cat-row {
  display: none !important;
}

/* ============================================================
 * ★★ .hidden 必须永远赢 ★★
 *
 * 背景：项目里有 25 处写了 display: grid/flex !important
 *   （比如 92-plugin-ui.css 的 .sticker-grid { display: grid !important }）。
 *   而 .hidden 也是 display: none !important。
 *   两者**优先级相同**（都是单个类名），于是比"谁写在后面"——
 *   92-plugin-ui.css 在 01-msg.css 后面，所以网格赢了，
 *   切到"本房间"时"我的表情"那个网格**藏不掉**，两层叠在一起显示。
 *
 * 解法：用双类名 .hidden.hidden 把优先级提到 (0,2,0)，
 *   高于任何单类名的 !important 规则 —— 不管加载顺序如何都赢。
 *   这样以后别人再写 display:xxx !important 也不会把隐藏弄失效。
 * ============================================================ */
.hidden.hidden,
[hidden][hidden] {
  display: none !important;
}

/* ============================================================
 * 「更多」面板：按钮藏起来时，整个格子（连文字标签）一起藏
 *
 * 现象：没置顶消息的时候，「更多」里会剩一个空框，下面挂着"置顶"两个字。
 *
 * 原因：那个格子是
 *     <div class="more-slot">
 *       <button id="btn-pins" class="more-cell hidden">…</button>   ← 按钮藏了
 *       <span class="more-label">置顶</span>                        ← 标签还在
 *     </div>
 *   JS 只给**按钮**加了 hidden，没管外面的格子和标签。
 *
 * 修法：用 :has() 判断"格子里有被藏起来的按钮"，把整个格子藏掉。
 *   这样以后再有类似的格子（按钮按条件显示）也自动正确，不用每处都写一遍。
 * ============================================================ */
.more-slot:has(> button.hidden) {
  display: none !important;
}

/* ============================================================
 * ⑤ 资料卡：看别人的时候，藏掉"装饰商店"和"编辑资料"
 *
 * 用 CSS 而不是 JS 的原因：JS 那份被 try/catch 包着，
 *   出错就静默失效（用户反馈过两次"还是能看到装饰商店"）。
 *   CSS 是声明式的，只要类名对上就一定生效。
 *
 * data-view="other" 由 openHomepage 设置在 #modal-homepage 上。
 * ============================================================ */
#modal-homepage[data-view="other"] #btn-gift,
#modal-homepage[data-view="other"] #home-edit {
  display: none !important;
}
/* 看自己时才显示这两个 */
#modal-homepage[data-view="me"] #btn-gift,
#modal-homepage[data-view="me"] #home-edit {
  display: inline-flex;
}
