:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --border: #e6e8eb;
  --text: #1f2329;
  --muted: #6b7280;
  --primary: #2563eb;
  --primary-soft: #eaf1ff;
  --green: #16a34a;
  --green-soft: #e8f6ec;
  --amber: #d97706;
  --amber-soft: #fdf2e3;
  --red: #dc2626;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* nav */
.nav {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.nav-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 18px;
}
.nav-brand { font-weight: 700; font-size: 18px; color: var(--text); }
.nav-brand:hover { text-decoration: none; }
.nav-links { display: flex; gap: 16px; flex: 1; }
.nav-links a { color: var(--muted); font-size: 14px; }
.nav-links a:hover { color: var(--text); text-decoration: none; }
.nav-user { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--primary-soft); color: var(--primary);
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 13px;
}

/* layout */
.container { max-width: 960px; margin: 24px auto; padding: 0 20px; }
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; flex-wrap: wrap; gap: 12px; }
h1 { font-size: 22px; margin: 0; }
h2 { font-size: 18px; }
.muted { color: var(--muted); font-size: 13px; }
.warn { color: var(--amber); background: var(--amber-soft); border: 1px solid #f3d8a8; padding: 10px 12px; border-radius: var(--radius); font-size: 14px; }
.warn a { color: var(--amber); font-weight: 600; }
.spacer { flex: 1; }

/* search & tabs */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 18px; }
.search {
  flex: 1; min-width: 200px;
  padding: 9px 12px; border: 1px solid var(--border); border-radius: var(--radius);
  font-size: 14px; background: var(--surface);
}
.tabs { display: flex; gap: 8px; }
.tab {
  padding: 8px 16px; border: 1px solid var(--border); border-radius: 999px;
  background: var(--surface); cursor: pointer; font-size: 14px; color: var(--muted);
}
.tab.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* cards */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow); transition: transform .08s ease;
}
.card:hover { transform: translateY(-2px); }
.card-title { font-size: 16px; font-weight: 600; margin: 0 0 6px; }
.card-title a { color: var(--text); }
.card-title a:hover { color: var(--primary); text-decoration: none; }
.card-meta { color: var(--muted); font-size: 12px; margin-bottom: 8px; }
.card-desc { font-size: 14px; color: #374151; }

/* tags */
.tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.tag {
  font-size: 12px; padding: 2px 9px; border-radius: 999px;
  background: var(--primary-soft); color: var(--primary);
}
.tag.green { background: var(--green-soft); color: var(--green); }
.tag.amber { background: var(--amber-soft); color: var(--amber); }

/* buttons */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 16px; border-radius: var(--radius); border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font-size: 14px; cursor: pointer;
}
.btn:hover { text-decoration: none; background: #f1f3f5; }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: #1d4ed8; }
.btn-green { background: var(--green); color: #fff; border-color: var(--green); }
.btn-green:hover { background: #15803d; }
.btn-danger { background: #fff; color: var(--red); border-color: #f3c0c0; }
.btn-danger:hover { background: #fff1f1; }
.btn-sm { padding: 5px 12px; font-size: 13px; }

/* forms */
.form { max-width: 640px; margin: 0 auto; }
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 14px; font-weight: 500; margin-bottom: 6px; }
.input, .textarea, select.input {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border);
  border-radius: var(--radius); font-size: 14px; background: var(--surface);
  font-family: inherit;
}
.textarea { min-height: 220px; resize: vertical; }
.hint { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* article view */
.article-body { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); }
.article-body h1, .article-body h2, .article-body h3 { margin-top: 1.2em; }
.article-body pre { background: #0f172a; color: #e2e8f0; padding: 14px; border-radius: 8px; overflow: auto; }
.article-body code { background: #eef2f7; padding: 2px 5px; border-radius: 4px; font-size: 13px; }
.article-body pre code { background: none; padding: 0; }
.article-body img { max-width: 100%; }

/* members */
.member-list { display: flex; flex-direction: column; gap: 10px; }
.member {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
}
.member .role { font-size: 12px; color: var(--amber); margin-left: auto; }

/* misc */
.empty { text-align: center; color: var(--muted); padding: 60px 20px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.pill-meta { display: flex; gap: 14px; color: var(--muted); font-size: 13px; margin-bottom: 14px; flex-wrap: wrap; }
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: #1f2329; color: #fff; padding: 10px 18px; border-radius: 999px; font-size: 14px;
  opacity: 0; transition: opacity .2s; pointer-events: none; z-index: 50;
}
.toast.show { opacity: 1; }
.divider { height: 1px; background: var(--border); margin: 24px 0; }

/* upload & cover */
.upload-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }
.cover-preview { margin-top: 8px; }
.cover-preview img { max-width: 220px; max-height: 160px; border-radius: 8px; border: 1px solid var(--border); display: block; }
.cover-wrap {
  position: relative; margin: -16px -16px 12px; overflow: hidden;
  border-radius: var(--radius) var(--radius) 0 0;
}
.card-cover {
  width: 100%; height: 160px; object-fit: cover; display: block;
}
.view-detail {
  position: absolute; right: 10px; bottom: 10px;
  background: rgba(17,24,39,.72); color: #fff;
  padding: 6px 14px; border-radius: 999px; font-size: 13px;
  opacity: 0; transform: translateY(6px);
  transition: opacity .18s ease, transform .18s ease, background .15s ease;
}
.cover-wrap:hover .view-detail { opacity: 1; transform: translateY(0); }
.view-detail:hover { background: var(--primary); text-decoration: none; }
.article-cover {
  width: 100%; max-height: 360px; object-fit: cover;
  border-radius: var(--radius); margin-bottom: 18px; border: 1px solid var(--border);
}

/* tag cloud & clickable tags */
.tag-cloud { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 18px; }
.cloud-label { font-size: 13px; color: var(--muted); }
.tag-link { cursor: pointer; text-decoration: none; }
.tag-link:hover { filter: brightness(0.96); text-decoration: none; }
.tag .count { opacity: .6; font-size: 11px; }
.search-section { margin-bottom: 24px; }
.search-section h2 { font-size: 16px; margin: 0 0 12px; }

/* category bar & badges */
.cat-bar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 18px; }
.cat-link { cursor: pointer; text-decoration: none; }
.cat-link:hover { filter: brightness(0.96); text-decoration: none; }
.cat-link.active { background: var(--amber); color: #fff; border-color: var(--amber); }
.cat-badge {
  display: inline-block; background: var(--amber-soft); color: var(--amber);
  font-size: 12px; font-weight: 600; padding: 2px 10px; border-radius: 999px;
  margin-bottom: 8px; text-decoration: none;
}
.cat-badge:hover { filter: brightness(0.97); text-decoration: none; }

/* profession badges (持有人物职业) */
.prof-badge { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 999px; }
.prof-knight { background: #e8f0fe; color: #1a73e8; }
.prof-warlock { background: #f3e8fd; color: #8430ce; }
.prof-fighter { background: #fde8e8; color: #d5390b; }
.prof-sage { background: #e6f4ea; color: #188038; }

/* character cards & picker */
.char-list { display: flex; gap: 10px; flex-wrap: wrap; }
.char-card {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; min-width: 200px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 10px 14px; box-shadow: var(--shadow);
}
.char-name { font-weight: 600; margin-bottom: 4px; }
.char-option {
  display: flex; align-items: center; gap: 8px; padding: 8px 10px;
  border: 1px solid var(--border); border-radius: 10px; cursor: pointer; margin-bottom: 8px;
}
.char-option:hover { background: var(--bg); }
.char-option input { margin: 0; }

/* avatar with image */
.avatar-img {
  width: 30px; height: 30px; border-radius: 50%; object-fit: cover;
  display: inline-block; vertical-align: middle;
}

/* nav user area */
.nav-username { font-size: 14px; color: var(--text); }
.nav-username:hover { text-decoration: none; color: var(--primary); }
.notif-bell {
  position: relative; font-size: 18px; text-decoration: none; line-height: 1;
  padding: 4px 6px; border-radius: 8px;
}
.notif-bell:hover { background: var(--bg); text-decoration: none; }
.notif-badge {
  position: absolute; top: -4px; right: -4px;
  background: var(--red); color: #fff; font-size: 10px; font-weight: 700;
  min-width: 16px; height: 16px; border-radius: 8px; padding: 0 4px;
  display: flex; align-items: center; justify-content: center; line-height: 1;
}

/* stats bar */
.stats-bar {
  display: flex; gap: 24px; margin-bottom: 20px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 20px; box-shadow: var(--shadow);
}
.stat-item { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.stat-num { font-size: 22px; font-weight: 700; color: var(--text); }
.stat-label { font-size: 12px; color: var(--muted); }

/* like & favorite buttons */
.action-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 14px; border: 1px solid var(--border); border-radius: 999px;
  background: var(--surface); cursor: pointer; font-size: 14px; color: var(--muted);
  transition: all .15s;
}
.action-btn:hover { background: var(--bg); }
.action-btn.active { color: var(--red); border-color: #f3c0c0; background: #fff5f5; }
.action-btn.fav-active { color: var(--amber); border-color: #f5d699; background: var(--amber-soft); }

/* article meta bar */
.article-meta {
  display: flex; gap: 16px; align-items: center; flex-wrap: wrap;
  margin-bottom: 16px; padding: 12px 0; border-bottom: 1px solid var(--border);
}
.meta-item { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; color: var(--muted); }

/* comments section */
.comments-section { margin-top: 32px; }
.comments-section h2 { font-size: 16px; margin-bottom: 16px; }
.comment-form { margin-bottom: 20px; }
.comment-form textarea {
  width: 100%; min-height: 80px; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: var(--radius);
  font-size: 14px; font-family: inherit; background: var(--surface); resize: vertical;
}
.comment-form .row { margin-top: 8px; }
.comment-list { display: flex; flex-direction: column; gap: 12px; }
.comment-item {
  display: flex; gap: 10px; padding: 12px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
}
.comment-body { flex: 1; }
.comment-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.comment-head .username { font-weight: 600; font-size: 14px; color: var(--text); }
.comment-head .time { font-size: 12px; color: var(--muted); }
.comment-content { font-size: 14px; line-height: 1.6; color: var(--text); }
.comment-del { font-size: 12px; color: var(--red); cursor: pointer; margin-left: auto; border: none; background: none; }
.comment-empty { color: var(--muted); text-align: center; padding: 24px; }
.comment-reply { font-size: 12px; color: var(--primary); cursor: pointer; border: none; background: none; }
.comment-replies { margin: 8px 0 0 40px; display: flex; flex-direction: column; gap: 10px; border-left: 2px solid var(--border); padding-left: 12px; }
.comment-reply-item { background: var(--bg); border-radius: 8px; padding: 8px 10px; }
.reply-box { margin: 8px 0 0 40px; }
.reply-box .reply-input { width: 100%; min-height: 60px; border: 1px solid var(--border); border-radius: 8px; padding: 8px; font: inherit; resize: vertical; box-sizing: border-box; }
.reply-box .row { margin-top: 6px; gap: 8px; }

/* pinned badge (articles) */
.pin-badge { display: inline-block; background: var(--amber-soft); color: var(--amber); border: 1px solid #f3d8a8; padding: 3px 10px; border-radius: 999px; font-size: 13px; font-weight: 600; margin-bottom: 12px; }

/* admin role badges */
.role-badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.role-badge.super { background: #fde8f3; color: #c2185b; border: 1px solid #f5c6dd; }
.role-badge.admin { background: var(--primary-soft); color: var(--primary); }
.role-badge.user { background: var(--bg); color: var(--muted); border: 1px solid var(--border); }

/* admin console */
.admin-tabs { display: flex; gap: 8px; margin: 8px 0 20px; }
.tab-btn { padding: 7px 16px; border: 1px solid var(--border); background: var(--surface); border-radius: 8px; cursor: pointer; font: inherit; }
.tab-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.admin-table { width: 100%; border-collapse: collapse; background: var(--surface); border-radius: var(--radius); overflow: hidden; }
.admin-table th, .admin-table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); font-size: 14px; }
.admin-table th { background: var(--bg); color: var(--muted); font-weight: 600; }
.admin-table tr:last-child td { border-bottom: none; }

/* pagination */
.pagination { display: flex; gap: 6px; justify-content: center; align-items: center; margin-top: 24px; }
.page-btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 36px; height: 36px; padding: 0 10px;
  border: 1px solid var(--border); border-radius: 8px; background: var(--surface);
  font-size: 14px; color: var(--text); text-decoration: none; cursor: pointer;
}
.page-btn:hover { background: var(--primary-soft); border-color: var(--primary); text-decoration: none; color: var(--primary); }
.page-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.page-dots { color: var(--muted); padding: 0 4px; }

/* team chat */
.team-chat {
  margin-top: 20px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
}
.team-chat-header { padding: 12px 16px; border-bottom: 1px solid var(--border); font-weight: 600; font-size: 15px; }
.chat-messages {
  max-height: 360px; overflow-y: auto; padding: 16px;
  display: flex; flex-direction: column; gap: 10px;
}
.chat-msg { display: flex; gap: 8px; }
.chat-msg .chat-body { flex: 1; }
.chat-msg .chat-head { display: flex; gap: 6px; align-items: center; margin-bottom: 2px; }
.chat-msg .chat-head .username { font-size: 13px; font-weight: 600; }
.chat-msg .chat-head .time { font-size: 11px; color: var(--muted); }
.chat-msg .chat-content { font-size: 14px; line-height: 1.5; }
.chat-form { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--border); }
.chat-form input {
  flex: 1; padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius);
  font-size: 14px; background: var(--surface);
}
.chat-empty { text-align: center; color: var(--muted); padding: 20px; font-size: 13px; }

/* edit modal */
.modal-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,.4); z-index: 100;
  display: flex; align-items: center; justify-content: center;
}
.modal {
  background: var(--surface); border-radius: var(--radius); padding: 24px;
  width: 90%; max-width: 420px; box-shadow: 0 8px 32px rgba(0,0,0,.12);
}
.modal h3 { margin: 0 0 16px; font-size: 18px; }
.modal .field { margin-bottom: 14px; }
.modal .modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 8px; }

/* avatar upload */
.avatar-upload { display: flex; align-items: center; gap: 14px; }
.avatar-upload .preview { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; border: 2px solid var(--border); }
.avatar-upload .placeholder {
  width: 64px; height: 64px; border-radius: 50%; background: var(--primary-soft); color: var(--primary);
  display: flex; align-items: center; justify-content: center; font-size: 24px; font-weight: 600;
}

/* notification list */
.notif-item {
  display: flex; gap: 12px; padding: 14px 16px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  margin-bottom: 8px; transition: background .1s;
}
.notif-item.unread { border-left: 3px solid var(--primary); }
.notif-item a { color: var(--text); }
.notif-item a:hover { color: var(--primary); text-decoration: none; }
.notif-icon { font-size: 18px; }
.notif-content { flex: 1; }
.notif-text { font-size: 14px; }
.notif-time { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* member management */
.member .kick-btn {
  margin-left: auto; font-size: 12px; color: var(--red);
  background: none; border: 1px solid #f3c0c0; border-radius: 6px;
  padding: 2px 8px; cursor: pointer;
}
.member .kick-btn:hover { background: #fff5f5; }

/* draft list */
.draft-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); margin-bottom: 8px;
}
.draft-item .draft-title { font-weight: 500; }
.draft-item .draft-actions { display: flex; gap: 8px; }

/* ---------- titles / leveling ---------- */
.user-title {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(224, 179, 65, 0.12);
  color: #e0b341;
  border: 1px solid #e0b341;
  white-space: nowrap;
  vertical-align: middle;
}
.user-title.custom { background: rgba(168, 85, 247, 0.14); border-color: #a855f7; color: #c084fc; }
.comment-head .user-title { margin-right: 4px; }

.profile-head { display: flex; gap: 14px; align-items: center; }
.profile-info { display: flex; flex-direction: column; }

.level-bar {
  position: relative;
  height: 18px;
  background: #1f2430;
  border-radius: 999px;
  overflow: hidden;
  margin-top: 12px;
  max-width: 460px;
}
.level-bar-fill { height: 100%; background: linear-gradient(90deg, #e0b341, #f5c842); transition: width .3s; }
.level-bar-text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,.4);
}

.daily-tasks { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.daily-task {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 12px; background: #fff; border: 1.5px solid #111; border-radius: 10px;
  color: #111;
}
.daily-task.done { opacity: .55; }
.dt-name { font-size: 14px; color: #111; }
.dt-exp { color: #b07a00; font-size: 12px; margin-left: 4px; font-weight: 600; }
.dt-done { color: #2e7d32; font-size: 13px; font-weight: 600; }

.tier-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: 6px; }
.tier-row { display: flex; align-items: center; gap: 8px; }
.tier-label { width: 72px; font-size: 12px; color: #9aa4b2; flex: none; }
.tier-input { flex: 1; }
.dt-edit { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.dt-name-input { flex: 1; }
.dt-exp-input { width: 90px; flex: none; }

/* responsive */
@media (max-width: 640px) {
  .nav-inner { padding: 10px 14px; gap: 10px; }
  .nav-links { gap: 10px; }
  .nav-links a { font-size: 13px; }
  .nav-username { display: none; }
  .container { padding: 0 14px; margin-top: 16px; }
  .grid { grid-template-columns: 1fr; }
  .stats-bar { gap: 14px; padding: 12px; }
  .stat-num { font-size: 18px; }
  .article-meta { gap: 10px; }
  .comment-item { padding: 10px; }
}

/* site announcement popup */
.ann-modal-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(0,0,0,.45);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.ann-modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 10px 40px rgba(0,0,0,.2);
  max-width: 480px; width: 100%;
  padding: 24px;
}
.ann-title {
  margin: 0 0 12px;
  font-size: 20px;
  color: var(--primary);
  display: flex; align-items: center; gap: 8px;
}
.ann-title::before { content: "📢"; }
.ann-content {
  white-space: pre-wrap;
  word-break: break-word;
  margin-bottom: 20px;
  color: var(--text);
  font-size: 15px;
  line-height: 1.7;
  max-height: 50vh; overflow-y: auto;
}
.ann-ok { width: 100%; }
.checkbox-row { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.checkbox-row input { width: auto; }


@media (max-width: 640px) {
  .tier-grid { grid-template-columns: 1fr; }
}
