:root {
  --accent: #5b7cfa;
  --accent-2: #8a6cf6;
  --bg: #f4f5f9;
  --card: #ffffff;
  --text: #1c1f2a;
  --muted: #7a8194;
  --line: #e8eaf2;
  --danger: #e5484d;
  --ok: #2f9e44;
  --shadow: 0 6px 20px rgba(28, 31, 42, .07);
  --radius: 16px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

body { padding-bottom: 74px; }

a { color: var(--accent); text-decoration: none; }

/* 顶栏 */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
  padding: 10px 14px 8px;
}
.topbar-row { display: flex; align-items: center; gap: 10px; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 16px; letter-spacing: .5px; }
.brand-dot { width: 9px; height: 9px; border-radius: 50%; background: linear-gradient(135deg, var(--accent), var(--accent-2)); }
.brand small { font-weight: 500; color: var(--muted); font-size: 12px; margin-left: 2px; }
.grades { display: flex; gap: 6px; margin-left: auto; }
.grade-btn {
  border: 1px solid var(--line); background: #fff; color: var(--muted);
  padding: 5px 12px; border-radius: 999px; font-size: 12.5px; cursor: pointer;
  transition: .18s;
}
.grade-btn.active { color: #fff; border-color: transparent; background: linear-gradient(135deg, var(--accent), var(--accent-2)); }

/* 内容区 */
.wrap { max-width: 720px; margin: 0 auto; padding: 12px 12px 20px; }

.toolbar { display: flex; align-items: center; gap: 8px; margin: 2px 2px 10px; color: var(--muted); font-size: 12.5px; }
.toolbar .spacer { margin-left: auto; }
.icon-btn {
  border: none; background: #fff; color: var(--muted); border-radius: 10px;
  padding: 6px 10px; font-size: 12.5px; cursor: pointer; box-shadow: var(--shadow);
}

/* 帖子卡片 */
.card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  margin-bottom: 12px; overflow: hidden;
}
.card-head { display: flex; align-items: center; gap: 10px; padding: 13px 14px 8px; }
.avatar {
  width: 38px; height: 38px; border-radius: 12px; flex: 0 0 38px;
  display: grid; place-items: center; font-weight: 700; color: #fff; font-size: 14px;
  background: linear-gradient(135deg, #7b93ff, #a07bff);
}
.who { min-width: 0; }
.who b { display: block; font-size: 14px; font-weight: 600; }
.who span { color: var(--muted); font-size: 11.5px; }

.card-body { padding: 0 14px 10px; }
.content { white-space: pre-wrap; word-break: break-word; font-size: 15px; }

.media-grid { display: grid; gap: 4px; margin-top: 9px; }
.media-grid.n1 { grid-template-columns: 1fr; }
.media-grid.n2 { grid-template-columns: 1fr 1fr; }
.media-grid.n3 { grid-template-columns: repeat(3, 1fr); }
.media-grid img {
  width: 100%; display: block; border-radius: 10px; object-fit: cover;
  max-height: 420px; cursor: zoom-in; background: #f0f2f7;
}
.media-grid.n2 img, .media-grid.n3 img { aspect-ratio: 1/1; max-height: none; }

.video-box { margin-top: 9px; border-radius: 12px; overflow: hidden; background: #000; position: relative; }
.video-box video { width: 100%; display: block; max-height: 480px; background: #000; }
.play-badge {
  position: absolute; inset: 0; display: grid; place-items: center; cursor: pointer;
  background: rgba(0,0,0,.18); transition: .2s;
}
.play-badge::after {
  content: ""; width: 54px; height: 54px; border-radius: 50%;
  background: rgba(255,255,255,.92) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24'><path d='M8 5v14l11-7z' fill='%235b7cfa'/></svg>") center/20px no-repeat;
  box-shadow: 0 6px 18px rgba(0,0,0,.25);
}

.card-foot { display: flex; align-items: center; gap: 18px; padding: 8px 14px 12px; color: var(--muted); font-size: 13px; }
.act { display: inline-flex; align-items: center; gap: 5px; cursor: pointer; user-select: none; transition: .15s; }
.act:hover { color: var(--accent); }
.act.on { color: var(--accent); font-weight: 600; }
.card-foot .spacer { margin-left: auto; font-size: 11.5px; }

/* 空状态 & 骨架 */
.empty { text-align: center; color: var(--muted); padding: 64px 20px; font-size: 14px; }
.empty b { display: block; color: var(--text); font-size: 16px; margin-bottom: 6px; }
.skeleton { height: 150px; border-radius: var(--radius); background: linear-gradient(90deg,#eceef5 25%,#f5f6fa 37%,#eceef5 63%); background-size: 400% 100%; animation: sk 1.3s ease infinite; margin-bottom: 12px; }
@keyframes sk { 0%{background-position:100% 50%} 100%{background-position:0 50%} }

/* 底部导航 */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: rgba(255,255,255,.95); backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar button {
  border: none; background: transparent; padding: 10px 0 11px; cursor: pointer;
  color: var(--muted); font-size: 12.5px; display: flex; flex-direction: column; align-items: center; gap: 3px;
}
.tabbar button.active { color: var(--accent); font-weight: 600; }
.tabbar .ico { font-size: 18px; line-height: 1; }

/* 弹层 */
.mask { position: fixed; inset: 0; background: rgba(16,18,26,.45); z-index: 40; display: none; }
.mask.show { display: block; }
.sheet {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 0; z-index: 41;
  width: 100%; max-width: 720px; max-height: 92vh; overflow: auto;
  background: #fff; border-radius: 18px 18px 0 0; padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
  display: none;
}
.sheet.show { display: block; animation: up .22s ease; }
@keyframes up { from { transform: translateX(-50%) translateY(18px); opacity: .6 } to { transform: translateX(-50%) translateY(0); opacity: 1 } }
.sheet-head { display: flex; align-items: center; margin-bottom: 12px; }
.sheet-head h3 { margin: 0; font-size: 16px; }
.sheet-head .x { margin-left: auto; border: none; background: #f2f3f8; width: 30px; height: 30px; border-radius: 50%; cursor: pointer; color: var(--muted); font-size: 16px; }

/* 表单 */
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 5px; }
.input, .textarea, select.input {
  width: 100%; border: 1px solid var(--line); background: #fafbfe; border-radius: 12px;
  padding: 11px 13px; font-size: 14.5px; font-family: inherit; color: var(--text); outline: none;
  transition: .18s;
}
.input:focus, .textarea:focus { border-color: var(--accent); background: #fff; box-shadow: 0 0 0 3px rgba(91,124,250,.12); }
.textarea { min-height: 108px; resize: vertical; }

.btn {
  width: 100%; border: none; border-radius: 12px; padding: 12px; font-size: 15px; font-weight: 600;
  color: #fff; background: linear-gradient(135deg, var(--accent), var(--accent-2)); cursor: pointer;
}
.btn:disabled { opacity: .55; cursor: default; }
.btn.ghost { background: #f2f3f8; color: var(--text); font-weight: 500; }
.btn.danger { background: var(--danger); }
.btn.small { width: auto; padding: 7px 14px; font-size: 13px; border-radius: 10px; }

.row { display: flex; gap: 10px; align-items: center; }
.row .btn { flex: 1; }

/* 发布页 */
.compose-media { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.thumb { position: relative; width: 82px; height: 82px; border-radius: 10px; overflow: hidden; background: #eceef5; }
.thumb img, .thumb video { width: 100%; height: 100%; object-fit: cover; }
.thumb .rm {
  position: absolute; top: 3px; right: 3px; width: 20px; height: 20px; border-radius: 50%;
  border: none; background: rgba(0,0,0,.55); color: #fff; cursor: pointer; font-size: 12px; line-height: 1;
}
.add-tile {
  width: 82px; height: 82px; border-radius: 10px; border: 1px dashed #cfd4e4; background: #fafbfe;
  display: grid; place-items: center; color: var(--muted); cursor: pointer; font-size: 22px;
}
.hint { font-size: 12px; color: var(--muted); margin-top: 6px; }

/* 帖子详情 */
.detail-comments { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 12px; }
.cmt { display: flex; gap: 9px; margin-bottom: 12px; }
.cmt .avatar { width: 30px; height: 30px; flex: 0 0 30px; border-radius: 9px; font-size: 12px; }
.cmt-body b { font-size: 13px; }
.cmt-body p { margin: 1px 0 0; font-size: 14px; word-break: break-word; }
.cmt-form { display: flex; gap: 8px; margin-top: 8px; }
.cmt-form input { flex: 1; }

/* 管理后台 */
.admin-tabs { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 12px; scrollbar-width: none; }
.admin-tabs::-webkit-scrollbar { display: none; }
.admin-tabs button {
  white-space: nowrap; border: 1px solid var(--line); background: #fff; color: var(--muted);
  border-radius: 999px; padding: 7px 13px; font-size: 13px; cursor: pointer;
}
.admin-tabs button.active { background: #22252f; color: #fff; border-color: #22252f; }
.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 9px; margin-bottom: 12px; }
.stat { background: #fafbfe; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.stat small { display: block; color: var(--muted); font-size: 11.5px; }
.stat b { font-size: 20px; }
.admin-item { border: 1px solid var(--line); border-radius: 12px; padding: 11px; margin-bottom: 9px; }
.admin-item .meta { display: flex; gap: 8px; font-size: 11.5px; color: var(--muted); margin-bottom: 5px; }
.admin-item .txt { font-size: 14px; white-space: pre-wrap; word-break: break-word; max-height: 120px; overflow: auto; }
.admin-item .ops { display: flex; gap: 8px; margin-top: 9px; flex-wrap: wrap; }
.admin-item .thumbs { display: flex; gap: 4px; margin-top: 7px; flex-wrap: wrap; }
.admin-item .thumbs img { width: 52px; height: 52px; object-fit: cover; border-radius: 7px; }

/* 图片预览 */
.viewer { position: fixed; inset: 0; z-index: 60; background: #000; display: none; }
.viewer.show { display: grid; place-items: center; }
.viewer img { max-width: 100%; max-height: 100%; object-fit: contain; }

/* toast */
.toast {
  position: fixed; left: 50%; bottom: 88px; transform: translateX(-50%);
  background: rgba(24,26,34,.92); color: #fff; padding: 9px 16px; border-radius: 10px;
  font-size: 13.5px; z-index: 70; opacity: 0; pointer-events: none; transition: .2s;
}
.toast.show { opacity: 1; }

@media (min-width: 700px) {
  .wrap { padding: 18px 16px 26px; }
  .card { border-radius: 18px; }
}
