/* IMC 玩家交流平台 - 全局样式
   目标：简洁、好看、大字号、绿色顶栏 / 紫色侧栏 / 圆角卡片。
   颜色改成 CSS 变量 + 行内 :root 注入，方便"设置"页即时换色。
*/

:root {
  --top-color: #4ade80;
  --side-color: #818cf8;
  --bg: #f3f4f6;
  --card-bg: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --border: #e5e7eb;
  --primary: #4ade80;
  --primary-strong: #22c55e;
  --danger: #ef4444;
  --warn: #f59e0b;
  --title-scale: 1;
  --ui-scale: 1;
  --content-scale: 1;
  --radius: 14px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", "Hiragino Sans GB", Roboto, sans-serif;
  font-size: calc(16px * var(--ui-scale));
  color: var(--text);
  background: var(--bg);
}

a { color: inherit; text-decoration: none; }

/* ============================================================
   顶栏
============================================================ */
.topbar {
  background: var(--top-color);
  color: #052e16;
  padding: 14px 22px;
  font-size: calc(20px * var(--title-scale));
  font-weight: 800;
  letter-spacing: 0.4px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 20;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.04);
}
.topbar .logo { display: inline-flex; align-items: center; gap: 12px; }
.topbar .logo .logo-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: calc(34px * var(--title-scale));
  height: calc(34px * var(--title-scale));
  border-radius: 8px;
  background: #052e16;
  color: var(--top-color);
  font-weight: 900;
  font-size: calc(18px * var(--title-scale));
  letter-spacing: -0.5px;
  box-shadow: inset 0 -3px 0 rgba(255,255,255,0.18);
}
.topbar .logo .logo-text { display: inline-flex; flex-direction: column; line-height: 1; gap: 2px; }
.topbar .logo .logo-text strong { font-size: calc(18px * var(--title-scale)); letter-spacing: 0.4px; }
.topbar .logo .logo-text small { font-size: calc(11px * var(--title-scale)); opacity: 0.78; font-weight: 500; letter-spacing: 1px; }
.topbar .user-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255,255,255,0.6);
  padding: 4px 10px;
  border-radius: 999px;
  font-size: calc(14px * var(--title-scale));
  font-weight: 600;
}
.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  background: #d1d5db;
  border: 2px solid #ffffff;
}
.avatar.lg { width: 96px; height: 96px; }

/* 管理员 [Admin] 前缀：粗体红色 */
.admin-prefix {
  display: inline-block;
  color: #b91c1c;
  font-weight: 800;
  font-size: 0.85em;
  background: #fee2e2;
  border: 1px solid #fecaca;
  padding: 1px 6px;
  border-radius: 6px;
  margin-right: 4px;
  letter-spacing: 0.4px;
  vertical-align: 1px;
}
.admin-prefix::after { content: ""; display: inline-block; width: 2px; }

/* ============================================================
   侧栏 + 主体布局
============================================================ */
.layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 0;
  min-height: calc(100vh - 64px);
}
.layout.no-side { grid-template-columns: 1fr; }
.sidebar {
  background: var(--side-color);
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: sticky;
  top: 64px;
  height: calc(100vh - 64px);
}
.sidebar .nav-btn {
  background: #ffffff;
  border: none;
  border-radius: var(--radius);
  padding: 14px 16px;
  font-size: 16px;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
  color: #1e1b4b;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
  display: flex;
  align-items: center;
  gap: 10px;
}
.sidebar .nav-btn .nav-ico {
  width: 28px; height: 28px;
  border-radius: 8px;
  background: #ede9fe;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 14px;
  color: #6d28d9;
  flex: 0 0 28px;
}
.sidebar .nav-btn:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.08); }
.sidebar .nav-btn.active { background: #bbf7d0; color: #064e3b; outline: 3px solid #16a34a; }
.sidebar .nav-btn.active .nav-ico { background: #064e3b; color: #bbf7d0; }
.sidebar .nav-btn .nav-badge {
  margin-left: auto;
  background: #ef4444;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.sidebar .nav-quit { background: #fff1f2; color: #b91c1c; }
.sidebar .nav-quit .nav-ico { background: #fecaca; color: #b91c1c; }
.sidebar .nav-spacer { flex: 1; }
.main {
  padding: 24px 28px calc(24px * var(--content-scale));
  font-size: calc(15px * var(--content-scale));
}

/* ============================================================
   通用卡片 / 表单 / 按钮
============================================================ */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 22px;
  margin-bottom: 18px;
  box-shadow: 0 1px 0 rgba(0,0,0,0.02);
}

h1, h2, h3 { margin: 0 0 14px; font-weight: 800; }

.btn {
  display: inline-block;
  padding: 10px 16px;
  border-radius: 10px;
  background: #f3f4f6;
  color: #111827;
  border: 1px solid var(--border);
  font-weight: 600;
  cursor: pointer;
  font-size: 15px;
  transition: filter .15s ease, transform .05s ease;
}
.btn:hover { filter: brightness(0.97); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--primary); border-color: var(--primary-strong); color: #052e16; }
.btn-primary:hover { background: var(--primary-strong); }
.btn-danger { background: var(--danger); border-color: #dc2626; color: #fff; }
.btn-ghost { background: transparent; }
.btn-sm { padding: 6px 10px; font-size: 13px; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }

input[type="text"], input[type="password"], input[type="number"], input[type="email"],
textarea, select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  font-size: 15px;
  background: #ffffff;
  outline: none;
  transition: border-color .15s ease;
}
input:focus, textarea:focus, select:focus { border-color: var(--primary); }
textarea { min-height: 120px; resize: vertical; }
label { display: block; font-size: 14px; color: var(--muted); margin-bottom: 6px; font-weight: 600; }

.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.gap-sm { gap: 6px; }
.spacer { flex: 1; }
.muted { color: var(--muted); }

/* 简易进度条 */
.progress { width: 100%; height: 14px; background: #e5e7eb; border-radius: 999px; overflow: hidden; margin-top: 8px; }
.progress > span { display: block; height: 100%; background: linear-gradient(90deg, var(--primary), var(--primary-strong)); }
.progress.gray > span { background: linear-gradient(90deg, #cbd5e1, #94a3b8); }

/* 帖子列表项 */
.post {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 22px;
  margin-bottom: 16px;
}
.post-head { display: flex; align-items: center; gap: 10px; }
.post-head .name { font-weight: 800; font-size: 16px; }
.post-head .lv { background: #ecfeff; color: #0e7490; border-radius: 6px; padding: 2px 6px; font-size: 12px; font-weight: 700; }
.post-head .time { margin-left: auto; color: var(--muted); font-size: 13px; }
.post-title { font-size: 17px; font-weight: 700; margin: 8px 0 6px; }
.post-body { color: #1f2937; line-height: 1.6; white-space: pre-wrap; word-break: break-word; }
.post-attachment {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #f3f4f6;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 12px;
  margin: 8px 0;
  font-size: 14px;
}
.post-actions { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

.action {
  padding: 6px 10px;
  border-radius: 8px;
  background: #ffffff;
  border: 1px solid var(--border);
  font-size: 13px;
  cursor: pointer;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.action:hover { color: var(--text); }
.action.on { background: #fee2e2; color: #b91c1c; border-color: #fecaca; }
.action.danger { color: var(--danger); }

/* 通知/Toast */
.toast {
  position: fixed; top: 70px; right: 24px;
  background: #111827; color: #fff;
  padding: 10px 14px; border-radius: 10px;
  font-size: 14px; z-index: 50;
  box-shadow: 0 8px 30px rgba(0,0,0,.2);
  animation: toastIn .2s ease;
}
@keyframes toastIn { from { opacity: 0; transform: translateY(-8px); } }

/* 设置页：分区 */
.section-title { font-size: 18px; font-weight: 800; margin: 6px 0 10px; }
.field-row { display: flex; align-items: center; gap: 12px; padding: 8px 0; }
.field-row label.title { flex: 0 0 120px; color: var(--text); font-weight: 600; }

input[type="color"] { width: 48px; height: 32px; padding: 2px; border-radius: 8px; cursor: pointer; }
input[type="range"] { width: 220px; }

.warn-line { color: var(--danger); font-size: 13px; margin-top: 8px; }
.danger-card { background: #fff5f5; border-color: #fecaca; }

/* 登录/注册 */
.auth-wrap { display: grid; place-items: center; min-height: 100vh; padding: 24px; }
.auth-card { width: 100%; max-width: 420px; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 28px; box-shadow: 0 10px 30px rgba(0,0,0,.06); }
.auth-card h1 { font-size: 22px; text-align: center; }

@media (max-width: 720px) {
  .layout { grid-template-columns: 90px 1fr; }
  .sidebar .nav-btn { padding: 12px 6px; font-size: 14px; }
  .main { padding: 16px; }
}

/* ============================================================
   Profile 个人主页新排版
============================================================ */
.profile-hero {
  display: flex; align-items: center; gap: 22px;
  background: linear-gradient(135deg, var(--card-bg), #f9fafb);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 26px;
  margin-bottom: 18px;
}
.profile-hero .avatar.lg {
  width: 88px; height: 88px;
  border: 3px solid #ffffff;
  box-shadow: 0 4px 18px rgba(0,0,0,0.08);
}
.profile-meta { flex: 1; min-width: 0; }
.profile-name {
  font-size: 22px; font-weight: 800; letter-spacing: 0.4px;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.profile-tags { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.tag {
  display: inline-flex; align-items: center;
  padding: 3px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 700;
  background: #ecfeff; color: #0e7490;
}
.tag-lv { background: #fef9c3; color: #92400e; }
.tag-admin { background: #fee2e2; color: #b91c1c; }
.tag-id { background: #e5e7eb; color: #374151; font-family: ui-monospace, monospace; }
.profile-bio {
  margin-top: 8px; color: var(--muted); font-size: 14px; line-height: 1.5;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-bottom: 18px;
}
.grid-2 .card { margin-bottom: 0; }

.stat-line {
  display: flex; align-items: baseline; justify-content: space-between;
  padding: 8px 0; border-bottom: 1px dashed var(--border);
}
.stat-line:last-child { border-bottom: none; }
.stat-line .k { color: var(--muted); font-size: 14px; }
.stat-line .v { font-weight: 700; font-size: 15px; }

.danger-zone {
  background: #fff5f5;
  border: 1px solid #fecaca;
  border-radius: var(--radius);
  padding: 18px 22px;
}
.danger-zone h3 { color: #b91c1c; margin-bottom: 6px; }
.danger-zone p { color: #7f1d1d; font-size: 14px; margin: 0 0 12px; }

.avatar-uploader {
  display: inline-flex; flex-direction: column; align-items: center; gap: 8px;
}
.avatar-uploader .btn { padding: 6px 12px; font-size: 13px; }

.warn { color: #b45309; font-weight: 600; }

@media (max-width: 820px) {
  .grid-2 { grid-template-columns: 1fr; }
  .profile-hero { flex-direction: column; align-items: flex-start; }
}

/* ============================================================
   Settings 偏好设置新排版
============================================================ */
.settings-hero {
  display: flex; align-items: center; gap: 18px;
  background: linear-gradient(135deg, var(--card-bg), #f9fafb);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 26px;
  margin-bottom: 18px;
}
.settings-hero-icon {
  width: 56px; height: 56px; border-radius: 14px;
  background: #052e16; color: var(--top-color);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 28px; font-weight: 900;
  box-shadow: inset 0 -3px 0 rgba(255,255,255,0.15);
}
.settings-hero-text h1 { margin: 0 0 4px; font-size: 22px; }
.settings-hero-text p { margin: 0; color: var(--muted); font-size: 14px; }

.settings-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0;
  margin-bottom: 16px;
  box-shadow: 0 1px 0 rgba(0,0,0,0.02);
  overflow: hidden;
}
.settings-card-head {
  display: flex; align-items: center; gap: 14px;
  padding: 16px 22px;
  border-bottom: 1px solid var(--border);
  background: #fafafa;
}
.settings-card-ico {
  width: 36px; height: 36px; border-radius: 10px;
  background: #ede9fe; color: #6d28d9;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 18px; flex: 0 0 36px;
}
.settings-card-head .card-title { margin: 0; font-size: 16px; }
.settings-card-head .card-sub { margin: 2px 0 0; color: var(--muted); font-size: 13px; }

.setting-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px;
  padding: 14px 22px;
  border-bottom: 1px solid var(--border);
}
.settings-card .setting-row:last-child { border-bottom: none; }
.setting-row.check-row { cursor: pointer; }
.setting-row.check-row input[type="checkbox"] {
  width: 18px; height: 18px; flex: 0 0 18px; accent-color: var(--primary-strong);
}
.setting-label { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.setting-title { color: var(--text); font-weight: 700; font-size: 15px; }
.setting-desc { color: var(--muted); font-size: 13px; }
.setting-desc.warn { color: #b45309; }

.setting-control {
  flex: 0 0 auto;
  width: auto;
  min-width: 180px;
}

.color-row {
  display: inline-flex; align-items: center; gap: 10px;
}
.color-row input[type="color"] { width: 44px; height: 36px; padding: 2px; border-radius: 8px; cursor: pointer; border: 1px solid var(--border); background: #fff; }
.hex {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px; color: #374151;
  background: #f3f4f6;
  padding: 4px 8px; border-radius: 6px;
}

.range-row {
  display: inline-flex; align-items: center; gap: 10px;
  flex: 0 0 auto;
}
.range-row input[type="range"] { width: 220px; }
.scale-val {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px; font-weight: 700; color: #374151;
  min-width: 48px; text-align: right;
}

.settings-footer {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 4px 24px;
  margin-top: 8px;
  flex-wrap: wrap; gap: 12px;
}
.settings-actions { display: inline-flex; gap: 10px; }
.settings-version { color: var(--muted); font-size: 13px; letter-spacing: 0.4px; }

@media (max-width: 720px) {
  .setting-row { flex-direction: column; align-items: flex-start; gap: 10px; }
  .range-row, .color-row, .setting-control { width: 100%; }
  .range-row input[type="range"] { flex: 1; }
}

/* ============================================================
   帖子内嵌翻译块
============================================================ */
.post-translate-block {
  margin-top: 10px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-left: 4px solid var(--primary);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: calc(14px * var(--content-scale));
  transition: max-height .25s ease, opacity .2s ease;
  overflow: hidden;
}
.post-translate-block.collapsed { display: none; }
.post-translate-block .translate-head {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: #475569; margin-bottom: 6px;
}
.post-translate-block .translate-ico { font-size: 16px; }
.post-translate-block .translate-head strong { color: #0f172a; font-weight: 700; }
.post-translate-block .translate-close {
  margin-left: auto;
  background: transparent; border: none; color: #94a3b8;
  font-size: 14px; cursor: pointer; padding: 2px 6px; border-radius: 6px;
}
.post-translate-block .translate-close:hover { background: #e2e8f0; color: #0f172a; }
.post-translate-block .translate-body {
  white-space: pre-wrap; word-break: break-word;
  color: #0f172a; line-height: 1.65;
}

/* ============================================================
   侧栏管理员分隔
============================================================ */
.sidebar .nav-divider {
  font-size: 12px; font-weight: 700; color: #ede9fe;
  letter-spacing: 1px;
  padding: 6px 4px 2px;
  margin-top: 6px;
  border-top: 1px dashed rgba(255,255,255,0.25);
  text-transform: uppercase;
  opacity: 0.85;
}
.sidebar .nav-btn.nav-admin .nav-ico { background: #fef3c7; color: #92400e; }

/* ============================================================
   管理员 - 举报列表 / 用户管理
============================================================ */
.tag-banned { background: #fecaca; color: #b91c1c; }

.report-card { border-left: 4px solid #ef4444; }
.report-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px;
}
.report-reason {
  background: #fff7ed;
  border-left: 3px solid #f59e0b;
  padding: 6px 10px;
  font-size: 14px;
  color: #7c2d12;
  border-radius: 6px;
  margin-bottom: 10px;
}
.report-quote {
  background: #f9fafb;
  border: 1px dashed var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 10px;
}
.report-quote .post-title { font-size: 15px; margin: 0 0 6px; font-weight: 700; }
.report-quote .post-body { color: #475569; font-size: 14px; max-height: 120px; overflow: hidden; position: relative; }
.report-quote .post-body::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 28px;
  background: linear-gradient(180deg, transparent, #f9fafb);
}
.report-actions { display: flex; gap: 8px; }

.user-table {
  width: 100%; border-collapse: collapse;
  font-size: 14px;
}
.user-table thead th {
  text-align: left; font-weight: 700; color: var(--muted);
  padding: 12px 16px; border-bottom: 1px solid var(--border);
  background: #fafafa;
}
.user-table tbody td {
  padding: 12px 16px; border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.user-table tbody tr:hover { background: #fafafa; }
.user-table tbody tr:last-child td { border-bottom: none; }
.user-table .lv {
  background: #fef9c3; color: #92400e;
  border-radius: 6px; padding: 2px 8px;
  font-size: 12px; font-weight: 700;
}

@media (max-width: 820px) {
  .user-table thead { display: none; }
  .user-table, .user-table tbody, .user-table tr, .user-table td { display: block; width: 100%; }
  .user-table tr { border-bottom: 1px solid var(--border); padding: 8px 0; }
  .user-table td { border: none; padding: 6px 16px; }
  .user-table td::before { content: attr(data-label); font-weight: 700; color: var(--muted); margin-right: 8px; }
}
