/* ============================================================
 * 08-avatar.css  （166 行）
 * style.css 的拆分片段（按顺序加载，与原来完全等价）。
 *
 * 这一片主要管这些类：
 *   · .avatar（10 处）
 *   · .gamble-pop（6 处）
 *   · .admin-btn（3 处）
 *   · .treasury-row（3 处）
 *   · .more-slot（3 处）
 *   · .mypoll-opt（2 处）
 *   · .modal（2 处）
 *   · .admin-tab（2 处）
 *   · .name-hint（2 处）
 *   · .mypolls-tab（1 处）
 *   · .mypolls-list（1 处）
 *   · .mypolls-empty（1 处）
 *   · .mypoll-card（1 处）
 *   · .mypoll-q（1 处）
 *   · .mypoll-meta（1 处）
 *   · .mypoll-bar（1 处）
 *   · .mypoll-txt（1 处）
 *   · .mypoll-me（1 处）
 * ============================================================ */
.mypolls-tab.active { background: var(--brand-soft); border-color: var(--brand); color: var(--brand); font-weight: 600; }
.mypolls-list { max-height: 52vh; overflow-y: auto; }
.mypolls-empty { color: var(--muted); font-size: 13px; text-align: center; padding: 24px 0; }
.mypoll-card {
  border: 1px solid var(--line); border-radius: 12px;
  padding: 12px 13px; margin-bottom: 10px; background: var(--panel-soft);
}
.mypoll-q { font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.mypoll-meta { font-size: 11.5px; color: var(--muted); margin-bottom: 9px; }
.mypoll-opt {
  position: relative; display: flex; align-items: center; gap: 6px;
  border: 1px solid var(--line); border-radius: 8px;
  padding: 6px 10px; margin-bottom: 5px; font-size: 13px;
  background: var(--panel); overflow: hidden;
}
.mypoll-bar { position: absolute; left: 0; top: 0; bottom: 0; background: var(--brand-soft); opacity: .6; transition: width .3s; }
.mypoll-txt { position: relative; z-index: 1; }
.mypoll-opt.mine { border-color: var(--brand); }
.mypoll-me {
  position: relative; z-index: 1; margin-left: auto;
  font-size: 10.5px; font-style: normal; color: var(--brand);
  border: 1px solid var(--brand-line); border-radius: 999px; padding: 0 6px;
}

/* ==================== 管理面板 ==================== */
.modal.admin-modal { width: 520px; max-width: calc(100vw - 24px); }
.admin-tabs { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.admin-tab {
  border: 1px solid var(--line); background: var(--panel-soft); color: var(--muted);
  border-radius: 999px; padding: 5px 13px; font-size: 12.5px; cursor: pointer;
}
.admin-tab.active { background: var(--brand-soft); border-color: var(--brand); color: var(--brand); font-weight: 600; }
.admin-body { max-height: 54vh; overflow-y: auto; }
.admin-row {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 0; border-bottom: 1px dashed var(--line);
}
.admin-info { flex: 1; min-width: 0; }
.admin-main { font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.admin-sub { font-size: 11.5px; color: var(--muted); margin-top: 2px; line-height: 1.5; }
.admin-acts { display: flex; gap: 5px; flex-wrap: wrap; justify-content: flex-end; }
.admin-btn { font-size: 11.5px !important; padding: 3px 9px !important; height: auto !important; }
.admin-btn.danger { color: #dc2626 !important; border-color: #fca5a5 !important; }
.admin-btn.danger:hover { background: #fef2f2 !important; }
.admin-log-head { display: flex; justify-content: flex-end; margin-bottom: 8px; }
.admin-empty { color: var(--muted); font-size: 13px; text-align: center; padding: 20px 0; }
html[data-theme="dark"] .admin-btn.danger { color: #f87171 !important; border-color: #7f1d1d !important; }

/* ============================================================
 * 平板端适配（iPad 竖屏 768 / 横屏 1024 / 小新等 834）
 * 目标：侧栏不挤、消息区够宽、按钮好点、弹窗不溢出
 * ============================================================ */
@media (max-width: 1024px) and (min-width: 781px) {
  /* 侧栏收窄一点，给聊天区让位 */
  .sidebar { width: 232px !important; flex: 0 0 232px !important; }
  .brand span { display: none; }
  .messages { padding-left: 14px !important; padding-right: 14px !important; }
  /* 触屏点击区域放大 */
  .btn.icon, .head-btn, .more-btn { min-width: 38px !important; min-height: 38px !important; }
  .msg-actions { opacity: 1 !important; }          /* 平板没有 hover，操作按钮常显 */
  .reactions { opacity: 1 !important; max-height: 400px !important; }
  /* 输入区 */
  .composer textarea { font-size: 15px !important; }
  /* 弹窗不要贴边 */
  .modal { max-width: min(560px, calc(100vw - 80px)) !important; }
}

@media (max-width: 900px) {
  .sidebar { width: 210px !important; flex: 0 0 210px !important; }
  .room-item .rpreview { font-size: 11.5px; }
}

/* 触屏设备：操作按钮常显（没有 hover） */
@media (hover: none), (pointer: coarse) {
  .msg-actions { opacity: 1 !important; height: auto !important; }
  .messages .msg > .reactions { opacity: 1 !important; max-height: 400px !important; }
  .rx-add { opacity: 1 !important; }
  /* 消息菜单之类的间距放大，避免误触 */
  .ctx-menu button { padding: 11px 14px !important; font-size: 14px !important; }
  .emoji-panel { width: min(420px, calc(100vw - 24px)) !important; }
  .emoji-panel .emoji-grid { grid-template-columns: repeat(auto-fill, minmax(40px, 1fr)) !important; }
}

/* 顶栏"起个名字"按钮 */
.name-hint {
  font-size: 12px; padding: 4px 11px; border-radius: 999px;
  background: var(--brand); color: #fff; border: none; cursor: pointer;
  margin-right: 8px; white-space: nowrap;
  animation: nameHintPulse 2.2s ease-in-out infinite;
}
@keyframes nameHintPulse {
  0%, 100% { box-shadow: 0 0 0 0 var(--brand-soft); }
  50% { box-shadow: 0 0 0 6px transparent; }
}
.name-hint:hover { filter: brightness(1.06); }

/* 横屏平板：消息区留白更合理 */
@media (orientation: landscape) and (min-width: 1000px) {
  .messages { padding-left: 20px !important; padding-right: 20px !important; }
}

/* ==================== 沙币库 ==================== */
.modal.treasury-modal { width: 440px; max-width: calc(100vw - 24px); }
.treasury-hero {
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  border-radius: 14px; padding: 16px; text-align: center; margin-bottom: 12px;
}
html[data-theme="dark"] .treasury-hero { background: linear-gradient(135deg, #78350f, #92400e); }
.treasury-amount { font-size: 30px; font-weight: 800; color: #92400e; letter-spacing: .5px; }
html[data-theme="dark"] .treasury-amount { color: #fde68a; }
.treasury-sub { font-size: 12px; color: #a16207; margin-top: 4px; }
html[data-theme="dark"] .treasury-sub { color: #fbbf24; }
.treasury-bar { height: 8px; background: rgba(255,255,255,.5); border-radius: 999px; margin-top: 10px; overflow: hidden; }
.treasury-fill { height: 100%; background: linear-gradient(90deg, #22c55e, #eab308, #dc2626); border-radius: 999px; transition: width .4s; }
.treasury-tip { font-size: 12.5px; color: var(--muted); line-height: 1.7; margin: 0 0 12px; }
.treasury-tabs { display: flex; gap: 6px; margin-bottom: 10px; }
.treasury-list { max-height: 40vh; overflow-y: auto; }
.treasury-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 0; border-bottom: 1px dashed var(--line); font-size: 13px;
}
.treasury-row.win .treasury-win { color: #16a34a; }
.treasury-row.lose .treasury-win { color: #dc2626; }
.treasury-name { font-weight: 600; }
.treasury-win { font-size: 12.5px; }

/* ==================== 来一把结算动画 ==================== */
.gamble-pop {
  position: fixed; left: 50%; top: 38%; transform: translate(-50%, -50%) scale(.85);
  z-index: 9999; padding: 22px 34px; border-radius: 18px; text-align: center;
  background: #fff; box-shadow: 0 18px 50px rgba(0,0,0,.28);
  animation: gambleIn .34s cubic-bezier(.2,1.5,.5,1) forwards;
}
.gamble-pop.win { background: linear-gradient(135deg, #dcfce7, #86efac); }
.gamble-pop.lose { background: linear-gradient(135deg, #fee2e2, #fca5a5); }
.gamble-pop.out { opacity: 0; transform: translate(-50%, -50%) scale(.9); transition: all .35s; }
.gamble-big { font-size: 30px; font-weight: 800; color: #14532d; }
.gamble-pop.lose .gamble-big { color: #7f1d1d; }
.gamble-small { font-size: 12.5px; color: #166534; margin-top: 6px; }
.gamble-pop.lose .gamble-small { color: #991b1b; }
@keyframes gambleIn { to { transform: translate(-50%, -50%) scale(1); } }

/* ==================== 头像框 / 徽章（所有头像通用） ==================== */
.avatar.avatar-frame { position: relative; }
.avatar.frame-qingzhu  { box-shadow: 0 0 0 2px #22c55e, 0 0 8px rgba(34,197,94,.55); }
.avatar.frame-hailan   { box-shadow: 0 0 0 2px #3b82f6, 0 0 8px rgba(59,130,246,.55); }
.avatar.frame-liujin   { box-shadow: 0 0 0 2px #eab308, 0 0 10px rgba(234,179,8,.65); }
.avatar.frame-lieyan   { box-shadow: 0 0 0 2px #ef4444, 0 0 12px rgba(239,68,68,.7); }
.avatar.avatar-badge::after {
  content: ''; position: absolute; right: -2px; bottom: -2px;
  width: 12px; height: 12px; border-radius: 50%;
  border: 2px solid var(--panel);
}
.avatar.badge-changke::after { background: #38bdf8; }
.avatar.badge-coder::after   { background: #8b5cf6; }
.avatar.badge-night::after   { background: #6366f1; }
.avatar.badge-king::after    { background: linear-gradient(135deg, #f59e0b, #dc2626); }

/* 更多面板：新入口的格子与隐藏 */
.more-slot.hidden { display: none !important; }
.more-slot.admin-only { display: flex; }
.more-slot.admin-only.hidden { display: none !important; }
.more-cell svg { width: 21px; height: 21px; }
/* 面板本身容错：内容多了也能滚动，不会把页面撑坏 */
.more-panel { max-height: calc(100vh - 90px); overflow-y: auto; }
