/* ============================================================
   IMC 大更新 · 像素风 + 新模块样式
   首选：Minecraft AE Pixel（MC 原生方块字，含中文）
   该字体 U+00A0–U+00FF 区段字形损坏，用 unicode-range 排除，
   让带重音的拉丁字符回退到 Fusion Pixel / Zpix。
   全部本地文件，无外部依赖，离线可用。
   ============================================================ */
@font-face {
  font-family: "Minecraft AE";
  src: url("/static/fonts/MinecraftAE-Pixel.ttf") format("truetype");
  font-weight: normal;
  font-style: normal;
  font-display: swap;
  /* 排除损坏区段，其余全部由本字体覆盖 */
  unicode-range: U+0000-009F, U+0100-10FFFF;
}
@font-face {
  font-family: "Fusion Pixel";
  src: url("/static/fonts/fusion-pixel.woff2") format("woff2");
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Zpix";
  src: url("/static/fonts/zpix.woff2") format("woff2");
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

:root {
  --px-font: "Minecraft AE", "Fusion Pixel", "Zpix", "Courier New", monospace;
  --px-ink: #1f2937;
  --px-line: #d7dde5;
  --px-card: #ffffff;
  --px-soft: #f6f8fa;
  --px-accent: #4ade80;
  --px-purple: #818cf8;
  --px-red: #ef4444;
}

/* 全站像素字：稍加大字号保证点阵清晰 */
html, body, button, input, textarea, select {
  font-family: var(--px-font) !important;
  letter-spacing: .3px;
}
body { font-size: 15px; line-height: 1.65; }
h1, h2, h3, .post-title { letter-spacing: 1px; }
img.avatar, .logo-mark, img { image-rendering: pixelated; }

/* 方角 + 硬边阴影，像素 UI 质感 */
.card, .post, .ext-card, .btn, input, textarea, select, .nav-btn {
  border-radius: 4px !important;
}
.card, .post, .ext-card {
  border: 2px solid var(--px-line) !important;
  box-shadow: 3px 3px 0 rgba(31, 41, 55, .08) !important;
}
.btn {
  border: 2px solid transparent;
  box-shadow: 2px 2px 0 rgba(31, 41, 55, .16);
  font-weight: 600;
}
.btn:active { transform: translate(2px, 2px); box-shadow: none; }
input, textarea, select { border: 2px solid var(--px-line) !important; }

/* 侧栏变长后可滚动 */
.sidebar { overflow-y: auto; max-height: calc(100vh - 76px); }
.sidebar .nav-divider {
  font-size: 11px; color: #6b7280; letter-spacing: 2px;
  padding: 12px 10px 4px; margin: 0; font-weight: 600;
}
.sidebar .nav-btn { font-size: 14px; }
.sidebar .nav-btn .nav-badge {
  display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 6px;
  background: var(--px-red); color: #fff; border-radius: 9px;
  font-size: 11px; line-height: 18px; text-align: center;
}

/* ---------------- 通用组件 ---------------- */
.ext-card {
  background: var(--px-card); border: 2px solid var(--px-line);
  box-shadow: 3px 3px 0 rgba(31,41,55,.08); padding: 16px; margin-bottom: 14px;
}
.ext-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.ext-head h1 { margin: 0; font-size: 24px; }
.ext-sub { color: #6b7280; font-size: 13px; margin: 0 0 16px; }
.ext-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.ext-empty { padding: 36px 16px; text-align: center; color: #9ca3af; font-size: 14px; }
.ext-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.muted { color: #6b7280; }
.small { font-size: 12px; }

.ext-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.ext-tab {
  border: 2px solid var(--px-line); background: #fff; color: #374151;
  padding: 7px 14px; cursor: pointer; font-size: 13px;
  font-family: var(--px-font); border-radius: 4px;
}
.ext-tab:hover { background: var(--px-soft); }
.ext-tab.active { background: var(--top-color, #4ade80); border-color: #1f2937; color: #052e16; font-weight: 700; }
.ext-tab .cnt { background: var(--px-red); color: #fff; border-radius: 9px; padding: 0 5px; margin-left: 5px; font-size: 11px; }

.px-tag {
  display: inline-block; padding: 2px 8px; font-size: 11px;
  border: 1px solid var(--px-line); background: var(--px-soft); border-radius: 3px;
}
.px-tag.hot { background: #fee2e2; border-color: #fecaca; color: #b91c1c; }
.px-tag.ok { background: #dcfce7; border-color: #86efac; color: #166534; }
.px-tag.warn { background: #fef3c7; border-color: #fcd34d; color: #92400e; }

.avatar-sm { width: 34px; height: 34px; border-radius: 3px; object-fit: cover; border: 1px solid var(--px-line); }
.avatar-md { width: 56px; height: 56px; border-radius: 3px; object-fit: cover; border: 2px solid var(--px-line); }
.click-user { cursor: pointer; }
.click-user:hover { text-decoration: underline; }

/* ---------------- 用户主页卡片 ---------------- */
.uc-mask { position: fixed; inset: 0; background: rgba(15,23,42,.42); z-index: 900; }
.uc-card {
  position: fixed; z-index: 901; top: 50%; left: 50%; transform: translate(-50%,-50%);
  width: min(360px, 92vw); background: #fff; border: 3px solid #1f2937;
  box-shadow: 8px 8px 0 rgba(31,41,55,.25); padding: 20px; border-radius: 4px;
}
.uc-top { display: flex; gap: 12px; align-items: center; margin-bottom: 12px; }
.uc-name { font-size: 19px; font-weight: 700; }
.uc-bio { font-size: 13px; color: #4b5563; min-height: 34px; margin-bottom: 12px; word-break: break-word; }
.uc-stats { display: flex; gap: 16px; font-size: 12px; color: #6b7280; margin-bottom: 14px; }
.uc-actions { display: flex; gap: 8px; }
.uc-actions .btn { flex: 1; }
.uc-close { position: absolute; top: 8px; right: 10px; border: none; background: transparent;
            cursor: pointer; font-size: 18px; font-family: var(--px-font); }

/* ---------------- 音乐浮窗 ---------------- */
.mini-player {
  position: fixed; right: 20px; bottom: 20px; z-index: 800;
  width: 270px; background: #fff; border: 3px solid #1f2937;
  box-shadow: 6px 6px 0 rgba(31,41,55,.25); border-radius: 4px;
}
.mp-head {
  display: flex; align-items: center; gap: 8px; padding: 7px 9px;
  background: var(--top-color, #4ade80); color: #052e16;
  cursor: move; user-select: none; font-size: 13px; font-weight: 700;
}
.mp-head #mp-title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mp-grip { cursor: move; }
.mp-head button { border: none; background: transparent; cursor: pointer;
                  font-family: var(--px-font); font-size: 14px; color: #052e16; }
.mini-player audio { width: 100%; display: block; height: 38px; }

/* ---------------- 消息中心 ---------------- */
.msg-wrap { display: grid; grid-template-columns: 290px 1fr; gap: 14px; align-items: start; }
.msg-panel { background: #fff; border: 2px solid var(--px-line); border-radius: 4px; overflow: hidden; }
.msg-tabs { display: flex; border-bottom: 2px solid var(--px-line); }
.msg-tab { flex: 1; padding: 9px 4px; text-align: center; cursor: pointer; font-size: 12px;
           border: none; background: #fff; font-family: var(--px-font); color: #6b7280; }
.msg-tab.active { background: var(--top-color, #4ade80); color: #052e16; font-weight: 700; }
.msg-list { max-height: 520px; overflow-y: auto; }
.msg-item { display: flex; gap: 10px; padding: 10px 12px; border-bottom: 1px solid #f1f3f5; cursor: pointer; align-items: center; }
.msg-item:hover { background: #f9fafb; }
.msg-item.active { background: #ecfdf5; }
.msg-item .who { flex: 1; min-width: 0; }
.msg-item .nm { font-weight: 700; font-size: 13px; }
.msg-item .sub { font-size: 11px; color: #9ca3af; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-item .unread { background: var(--px-red); color: #fff; border-radius: 9px; font-size: 11px; padding: 1px 6px; }
.notif-item { display: flex; gap: 10px; padding: 11px 12px; border-bottom: 1px solid #f1f3f5; align-items: flex-start; }
.notif-item.unread { background: #f0fdf4; }
.notif-item .txt { flex: 1; font-size: 13px; }
.notif-ico { font-size: 18px; width: 24px; text-align: center; }
.notif-time { font-size: 11px; color: #9ca3af; }

.chat-panel { background: #fff; border: 2px solid var(--px-line); border-radius: 4px;
              display: flex; flex-direction: column; height: 570px; }
.chat-head { padding: 10px 14px; border-bottom: 2px solid var(--px-line); display: flex; align-items: center; gap: 10px; font-weight: 700; }
.chat-body { flex: 1; overflow-y: auto; padding: 14px; background: #fbfcfd; }
.chat-empty { height: 100%; display: flex; align-items: center; justify-content: center; color: #9ca3af; }
.msg-row { display: flex; margin-bottom: 12px; align-items: flex-start; gap: 6px; }
.msg-row.me { flex-direction: row-reverse; }
.bubble { max-width: 70%; padding: 8px 11px; font-size: 13px; line-height: 1.6;
          word-break: break-word; white-space: pre-wrap; border: 2px solid var(--px-line); border-radius: 4px; background: #fff; }
.msg-row.me .bubble { background: var(--top-color, #4ade80); border-color: #1f2937; color: #052e16; }
.bubble img { max-width: 220px; max-height: 200px; display: block; border: 1px solid var(--px-line); }
.bubble .file-link { display: block; margin-top: 4px; }
.msg-tools { font-size: 10px; color: #9ca3af; align-self: flex-end; white-space: nowrap; }
.msg-del { border: none; background: transparent; color: #9ca3af; cursor: pointer; font-size: 11px; font-family: var(--px-font); }
.msg-del:hover { color: var(--px-red); }
.chat-input { display: flex; gap: 8px; padding: 10px; border-top: 2px solid var(--px-line); align-items: center; }
.chat-input input[type=text] { flex: 1; }
.icon-btn { border: 2px solid var(--px-line); background: #fff; cursor: pointer;
            padding: 6px 9px; font-size: 15px; font-family: var(--px-font); border-radius: 4px; }
.icon-btn:hover { background: var(--px-soft); }
.search-bar { display: flex; gap: 8px; margin-bottom: 14px; }
.search-bar input { flex: 1; }

/* ---------------- 评论区 / 下载 ---------------- */
.comment-box { margin-top: 12px; }
.comment-form { display: flex; gap: 8px; margin-bottom: 12px; }
.comment-form textarea { flex: 1; min-height: 60px; }
.comment-item { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px dashed var(--px-line); }
.comment-item .body { flex: 1; min-width: 0; }
.comment-item .meta { font-size: 12px; color: #6b7280; margin-bottom: 3px; }
.comment-item .text { font-size: 14px; word-break: break-word; white-space: pre-wrap; }
.comment-reply { margin: 8px 0 0 28px; padding: 8px 10px; background: var(--px-soft); border-left: 3px solid var(--px-purple); }
.reply-form { display: flex; gap: 6px; margin-top: 8px; }
.reply-form input { flex: 1; }
.dl-bar { display: flex; align-items: center; gap: 10px; padding: 10px 12px;
          border: 2px dashed var(--px-line); background: var(--px-soft); border-radius: 4px; margin-top: 12px; }
.dl-bar .fname { flex: 1; font-size: 13px; word-break: break-all; }

/* ---------------- 直播 ---------------- */
.live-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.live-card { background: #fff; border: 2px solid var(--px-line); border-radius: 4px; overflow: hidden; }
.live-thumb { height: 130px; background: linear-gradient(135deg,#1f2937,#4ade80); display: flex;
              align-items: center; justify-content: center; color: #fff; font-size: 34px; }
.live-body { padding: 12px; }
.live-title { font-weight: 700; font-size: 15px; margin-bottom: 6px; }
.live-meta { font-size: 12px; color: #6b7280; }
.live-badge { display: inline-block; background: var(--px-red); color: #fff; padding: 1px 7px; font-size: 11px; border-radius: 3px; }
.room-wrap { display: grid; grid-template-columns: 1fr 300px; gap: 14px; align-items: start; }
.screen-box { background: #0f172a; border: 3px solid #1f2937; aspect-ratio: 16/9;
              display: flex; align-items: center; justify-content: center; position: relative; overflow: hidden; }
.screen-box img { width: 100%; height: 100%; object-fit: contain; }
.screen-box iframe { width: 100%; height: 100%; border: 0; }
.screen-hint { color: #94a3b8; font-size: 14px; text-align: center; padding: 20px; }
.live-chat { background: #fff; border: 2px solid var(--px-line); border-radius: 4px;
             display: flex; flex-direction: column; height: 420px; }
.live-chat-body { flex: 1; overflow-y: auto; padding: 10px; font-size: 13px; }
.live-chat-body .line { margin-bottom: 6px; word-break: break-word; }
.live-chat-body .who { color: var(--px-purple); font-weight: 700; }
.room-code { font-size: 22px; letter-spacing: 4px; font-weight: 700; color: #1f2937;
             background: #fef3c7; border: 2px dashed #f59e0b; padding: 6px 14px; display: inline-block; }

/* ---------------- 资源 / 音乐 / 视频 ---------------- */
.media-card { background: #fff; border: 2px solid var(--px-line); border-radius: 4px; padding: 13px; }
.media-card .t { font-weight: 700; font-size: 15px; margin-bottom: 6px; word-break: break-word; }
.media-card .d { font-size: 12px; color: #6b7280; min-height: 32px; margin-bottom: 10px; }
.media-card .foot { display: flex; align-items: center; gap: 8px; font-size: 12px; color: #6b7280; }
.music-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px;
             border-bottom: 1px solid var(--px-line); }
.music-row:hover { background: var(--px-soft); }
.music-row .info { flex: 1; min-width: 0; }
.music-row .t { font-weight: 700; font-size: 14px; }
.music-row .a { font-size: 12px; color: #6b7280; }
.video-feed { max-width: 480px; margin: 0 auto; }
.video-stage { background: #000; aspect-ratio: 9/16; max-height: 70vh; position: relative;
               border: 3px solid #1f2937; border-radius: 4px; overflow: hidden; }
.video-stage video { width: 100%; height: 100%; object-fit: contain; background: #000; }
.video-info { padding: 12px 4px; }
.video-nav { display: flex; justify-content: center; gap: 10px; margin-top: 12px; }
.upload-zone { border: 2px dashed var(--px-line); padding: 14px; border-radius: 4px; background: var(--px-soft); }
.admin-vid { display: flex; gap: 12px; align-items: center; padding: 10px;
             border-bottom: 1px solid var(--px-line); }
.admin-vid video { width: 120px; height: 80px; object-fit: cover; background: #000; }

/* ---------------- 响应式 ---------------- */
@media (max-width: 860px) {
  .msg-wrap, .room-wrap { grid-template-columns: 1fr; }
  .msg-list { max-height: 240px; }
  .chat-panel { height: 60vh; }
  .mini-player { right: 10px; bottom: 10px; width: 230px; }
  .bubble { max-width: 84%; }
}

/* 设置页 - 背景图上传 */
.bg-upload-box { display: flex; flex-direction: column; gap: 10px; min-width: 260px; }
.bg-preview { width: 100%; max-width: 320px; border-radius: 10px; overflow: hidden; border: 1px solid #e5e7eb; }
.bg-preview img { width: 100%; display: block; }
.bg-actions { display: flex; gap: 8px; }
.bg-hint { font-size: 12px; color: #6b7280; min-height: 16px; }
