:root {
  --blue: #108ee9;
  --gray: #888;
  --line: #e5e5e5;
  --bg: #f5f5f9;
  --maxw: 600px;
}

body {
  background: var(--bg);
  -webkit-user-select: auto;
  user-select: auto;
}

.hide { display: none !important; }

/* Top stack (ad + header) */
.topstack {
  position: sticky;
  top: 0;
  z-index: 50;
}

/* Ad bar */
.ad-bar {
  background: linear-gradient(90deg, #fff4e5, #ffe9cc);
  border-bottom: 1px solid #ffd8a3;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 0 12px;
  min-height: 34px;
  position: relative;
}
.ad-content {
  color: #a05a00;
  font-size: 13px;
  text-align: center;
  line-height: 1.4;
  padding: 7px 0;
  max-width: var(--maxw);
  word-break: break-word;
}
.ad-content::before {
  content: "广告";
  display: inline-block;
  font-size: 10px;
  color: #fff;
  background: #f0a020;
  border-radius: 3px;
  padding: 1px 4px;
  margin-right: 6px;
  vertical-align: 1px;
}
.ad-edit {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(240,160,32,0.15);
  border: 0;
  color: #a05a00;
  font-size: 12px;
  padding: 3px 8px;
  border-radius: 10px;
  cursor: pointer;
}
.ad-field {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  font-size: 14px;
}
.ad-field .ad-label { color: #333; }

/* Header */
.app-header {
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: saturate(1.4) blur(8px);
}
.app-header-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  height: 48px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.app-title {
  font-size: 19px;
  font-weight: 700;
  color: #111;
  letter-spacing: 1px;
}

.app-main {
  max-width: var(--maxw);
  margin: 0 auto;
  background: #fff;
  min-height: 100vh;
}

/* Compose */
.compose { padding: 14px 16px; }
.compose-text {
  width: 100%;
  border: 0;
  resize: none;
  font-size: 17px;
  line-height: 1.5;
  color: #222;
  background: transparent;
}
.compose-bar,
.comment-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
}

/* icon add-photo button */
.icon-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--blue);
  font-size: 14px;
  cursor: pointer;
}
.icon-photo {
  width: 18px; height: 18px;
  border: 1.5px solid var(--blue);
  border-radius: 4px;
  position: relative;
  display: inline-block;
}
.icon-photo::before {
  content: ""; position: absolute; width: 5px; height: 5px;
  border-radius: 50%; border: 1.5px solid var(--blue);
  top: 2px; left: 2px;
}
.icon-photo::after {
  content: ""; position: absolute; left: 2px; right: 1px; bottom: 2px;
  height: 6px; background: var(--blue);
  clip-path: polygon(0 100%, 35% 30%, 60% 70%, 80% 40%, 100% 100%);
}

/* buttons override to look less like full-width alipay button */
.am-button.tiny,
.am-button.tiny-blue {
  display: inline-block;
  width: auto;
  min-width: 64px;
  height: 32px;
  line-height: 32px;
  padding: 0 16px;
  border-radius: 16px;
  font-size: 14px;
}

/* Profile header */
.profile { position: relative; }
.profile-banner {
  min-height: 120px;
  background: linear-gradient(135deg, #1da1f2 0%, #108ee9 50%, #0d8ae0 100%);
  overflow: hidden;
}
.profile-banner.has-img {
  background: none;
  min-height: 0;
}
.profile-banner-img {
  display: block;
  width: 100%;
  height: auto;
}
.profile-banner-img.hide { display: none; }
.profile-body { padding: 0 16px 14px; position: relative; }
.profile-avatar {
  width: 72px; height: 72px;
  border-radius: 50%;
  border: 3px solid #fff;
  background: linear-gradient(135deg, #1da1f2, #108ee9);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; font-weight: 700;
  margin-top: -36px;
  position: relative;
  z-index: 2;
  overflow: hidden;
}
.profile-avatar.has-img {
  background: none;
  background-size: cover; background-position: center;
}
.profile-row {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 8px;
}
.profile-name { font-size: 19px; font-weight: 800; color: #111; }
.profile-actions { display: flex; gap: 8px; flex: 0 0 auto; }
.profile-bio {
  font-size: 14px; color: #555; margin-top: 4px; white-space: pre-wrap; word-break: break-word;
}
.profile-stats {
  display: flex; gap: 18px; margin-top: 10px; font-size: 14px; color: #555;
}
.profile-stats b { color: #111; font-weight: 700; }

.admin-stats {
  display: flex; justify-content: space-around;
  border-top: 1px solid var(--line); padding: 10px 16px;
}
.admin-stat { font-size: 13px; color: var(--gray); }
.admin-stat b { display: block; font-size: 18px; color: #111; }

.compose { padding: 14px 16px; background: #fff; }
.compose-text {
  width: 100%; border: 0; resize: none;
  font-size: 17px; line-height: 1.5; color: #222; background: transparent;
}

/* preview grid for images */
.preview-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 4px;
  margin-top: 10px;
}
.preview-grid:empty { display: none; margin: 0; }
.preview-grid.single { grid-template-columns: 1fr; }
.preview-item {
  position: relative;
  padding-top: 62%;
  border-radius: 12px;
  overflow: hidden;
  background: #f0f0f0;
}
.preview-item img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  cursor: zoom-in;
}
.preview-item .rm {
  position: absolute;
  top: 6px; right: 6px;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: rgba(0,0,0,0.55);
  color: #fff;
  border: 0;
  font-size: 14px;
  line-height: 22px;
  cursor: pointer;
}

/* Post */
.post { padding: 14px 16px; }
.feed .post.card {
  background: #fff;
  border: 1px solid #ebedf0;
  border-radius: 14px;
  margin: 12px 14px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  transition: box-shadow .15s;
}
.feed .post.card:hover { box-shadow: 0 3px 10px rgba(0,0,0,0.08); }
.feed { background: var(--bg); padding-bottom: 20px; }
.post-head {
  display: flex;
  align-items: center;
  gap: 10px;
}
.avatar {
  width: 42px; height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1da1f2, #108ee9);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
  flex: 0 0 auto;
}
.post-meta { flex: 1; min-width: 0; }
.post-author { font-size: 15px; font-weight: 700; color: #111; }
.post-badge {
  font-size: 11px;
  font-weight: 500;
  color: #fff;
  background: var(--blue);
  border-radius: 8px;
  padding: 1px 6px;
  margin-left: 4px;
  vertical-align: 1px;
}
.post-time { font-size: 13px; }
.post-del { background: none; border: 0; font-size: 13px; cursor: pointer; }

.post-content {
  font-size: 16px;
  line-height: 1.6;
  color: #222;
  white-space: pre-wrap;
  word-break: break-word;
  margin: 8px 0 0;
}

.post-actions {
  display: flex;
  gap: 48px;
  margin-top: 12px;
}
.act {
  background: none;
  border: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--gray);
  font-size: 14px;
  cursor: pointer;
  padding: 4px 0;
}
.act.liked { color: #e0245e; }

.icon-comment {
  width: 17px; height: 17px;
  display: inline-block;
  border: 1.6px solid currentColor;
  border-radius: 6px 6px 6px 0;
}
.icon-like {
  width: 17px; height: 17px;
  display: inline-block;
  border: 0;
  background: none;
  position: relative;
  line-height: 17px;
  text-align: center;
}
.icon-like::before {
  content: "\2665";
  font-size: 16px;
  line-height: 17px;
  color: currentColor;
}
.act.liked .icon-like::before { color: #e0245e; }

/* Comments */
.comments {
  margin-top: 12px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}
.comment {
  display: flex;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid #f2f2f2;
}
.comment .c-avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: #cfd8e3; color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; flex: 0 0 auto;
}
.comment .c-body { flex: 1; min-width: 0; }
.comment .c-name { font-size: 13px; font-weight: 600; color: #333; }
.comment .c-time { font-size: 12px; color: #aaa; margin-left: 6px; font-weight: 400; }
.comment .c-text {
  font-size: 14px; color: #333; margin-top: 2px;
  white-space: pre-wrap; word-break: break-word;
}
.comment .c-img {
  margin-top: 6px;
  max-width: 160px;
  border-radius: 10px;
  cursor: zoom-in;
}
.comment .c-del {
  background: none; border: 0; color: #bbb; font-size: 12px; cursor: pointer;
}

.comment-form { margin-top: 10px; }
.comment-name {
  width: 100%; border: 1px solid var(--line);
  border-radius: 8px; padding: 6px 10px; font-size: 14px;
  margin-bottom: 6px; background: #fafafa;
}
.comment-text {
  width: 100%; border: 1px solid var(--line);
  border-radius: 8px; padding: 8px 10px; font-size: 14px;
  resize: none; background: #fafafa;
}

.empty {
  text-align: center;
  color: var(--gray);
  padding: 60px 20px;
  font-size: 15px;
}

/* Modal */
.modal { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; }
.modal-mask { position: absolute; inset: 0; background: rgba(0,0,0,0.45); }
.modal-panel {
  position: relative;
  width: 82%; max-width: 320px;
  background: #fff; border-radius: 14px; padding: 20px;
  text-align: center;
}
.modal-title { font-size: 17px; font-weight: 700; margin-bottom: 14px; }
.modal-input {
  width: 100%; border: 1px solid var(--line);
  border-radius: 8px; padding: 10px 12px; font-size: 15px;
}
.modal-error { color: #e0245e; font-size: 13px; margin-top: 8px; }
.modal-actions { display: flex; gap: 10px; margin-top: 16px; }
.modal-actions .am-button { flex: 1; }

/* Lightbox */
.lightbox {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,0.9);
  display: flex; align-items: center; justify-content: center;
}
.lightbox img { max-width: 96%; max-height: 92%; border-radius: 6px; }

.toast {
  position: fixed; left: 50%; bottom: 60px; transform: translateX(-50%);
  background: rgba(0,0,0,0.8); color: #fff;
  padding: 8px 16px; border-radius: 20px; font-size: 14px;
  z-index: 300; max-width: 80%;
}

/* Pin tag */
.pin-tag {
  display: flex; align-items: center; gap: 4px;
  font-size: 12px; color: var(--gray); margin-bottom: 6px; padding-left: 2px;
}
.pin-ico {
  width: 12px; height: 12px; display: inline-block;
  background: var(--gray);
  clip-path: polygon(50% 0, 62% 34%, 100% 38%, 70% 62%, 80% 100%, 50% 78%, 20% 100%, 30% 62%, 0 38%, 38% 34%);
}

/* Post avatar / author with image */
.post-avatar { font-size: 16px; overflow: hidden; }
.post-avatar.has-img { background: none; background-size: cover; background-position: center; }
.post-author-name { }

/* Admin mini buttons on post */
.post-admin { display: flex; gap: 6px; flex: 0 0 auto; }
.mini-btn {
  background: #f2f3f5; border: 0; border-radius: 12px;
  font-size: 12px; color: #555; padding: 4px 10px; cursor: pointer;
}
.mini-btn.del-btn { color: #e0245e; background: #fdeef2; }
.mini-btn.pinned { color: #fff; background: var(--blue); }

/* Comment reply (admin) */
.c-reply {
  margin-top: 6px; background: #f4f8ff; border-left: 3px solid var(--blue);
  border-radius: 0 8px 8px 0; padding: 6px 10px;
}
.c-reply .c-reply-head { font-size: 12px; font-weight: 700; color: var(--blue); }
.c-reply .c-reply-head .rbadge {
  font-size: 10px; color: #fff; background: var(--blue);
  border-radius: 6px; padding: 0 4px; margin-left: 4px;
}
.c-reply .c-reply-text { font-size: 13px; color: #333; margin-top: 2px; white-space: pre-wrap; word-break: break-word; }
.c-reply .c-reply-del { background: none; border: 0; color: #aaa; font-size: 11px; cursor: pointer; float: right; }
.c-reply-btn { background: none; border: 0; color: var(--blue); font-size: 12px; cursor: pointer; padding: 0; margin-top: 2px; }
.c-reply-form { display: flex; gap: 6px; margin-top: 6px; }
.c-reply-form input {
  flex: 1; border: 1px solid var(--line); border-radius: 8px;
  padding: 5px 8px; font-size: 13px; background: #fafafa;
}
.c-reply-form button {
  border: 0; background: var(--blue); color: #fff;
  border-radius: 8px; font-size: 13px; padding: 0 12px; cursor: pointer;
}

/* Wide modals + textarea + profile fields */
.modal-panel.modal-wide { width: 90%; max-width: 420px; text-align: left; }
.modal-textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 8px;
  padding: 8px 10px; font-size: 15px; resize: none; background: #fafafa;
}
.pf-field { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.pf-label { width: 40px; font-size: 14px; color: #555; flex: 0 0 auto; }
.pf-upload { cursor: pointer; }
.pf-avatar-preview {
  width: 56px; height: 56px; border-radius: 50%;
  background: #eef1f4 center/cover no-repeat; color: var(--blue);
  display: flex; align-items: center; justify-content: center; font-size: 13px;
}
.pf-banner-upload { flex: 1; }
.pf-banner-preview {
  display: block; height: 60px; border-radius: 8px;
  background: #eef1f4 center/cover no-repeat; color: var(--blue);
  display: flex; align-items: center; justify-content: center; font-size: 13px;
}

/* Image ad */
.ad-content { position: relative; }
.ad-img { max-width: 100%; max-height: 120px; border-radius: 8px; display: block; }
.ad-img.hide { display: none; }
.ad-bar.has-img { padding: 8px 42px 8px 12px; min-height: 0; }
.ad-bar.has-img .ad-content {
  display: flex; flex-direction: column; align-items: center; gap: 6px; width: 100%; padding: 4px 0;
}
.ad-bar.has-img .ad-content::before {
  position: absolute; top: 0; left: 0; z-index: 1;
}
.link-btn {
  background: none; border: 0; color: var(--blue); font-size: 13px;
  cursor: pointer; padding: 0; margin: 0 0 8px 52px;
}
.modal-hint { font-size: 12px; color: var(--gray); margin-top: 10px; }

/* Crop modal */
.crop-hint { font-size: 12px; color: var(--gray); margin: 4px 0 10px; }
.crop-stage {
  width: 100%;
  max-height: 60vh;
  background: #000;
  border-radius: 8px;
  overflow: hidden;
}
.crop-stage img { display: block; max-width: 100%; }
#cropModal .modal-panel { max-width: 520px; }

/* Compose title + tools + video */
.compose-title {
  width: 100%; border: 0; border-bottom: 1px solid var(--line);
  font-size: 17px; font-weight: 700; color: #111; padding: 4px 0 8px;
  background: transparent; margin-bottom: 8px;
}
.compose-tools { display: flex; gap: 18px; align-items: center; }
.icon-video {
  width: 18px; height: 18px; display: inline-block; position: relative;
  border: 1.5px solid var(--blue); border-radius: 4px;
}
.icon-video::after {
  content: ""; position: absolute; top: 50%; left: 50%;
  transform: translate(-40%, -50%);
  border-left: 7px solid var(--blue);
  border-top: 5px solid transparent; border-bottom: 5px solid transparent;
}
.video-preview { margin-top: 10px; position: relative; }
.video-preview video {
  width: 100%; max-height: 320px; border-radius: 12px; background: #000; display: block;
}
.video-rm {
  margin-top: 6px; background: #fdeef2; color: #e0245e; border: 0;
  border-radius: 12px; font-size: 13px; padding: 5px 12px; cursor: pointer;
}
.post-title {
  font-size: 17px; font-weight: 800; color: #111; margin: 8px 0 2px;
  line-height: 1.4; word-break: break-word;
}

/* Post card toggle */
.post-cardlink {
  display: block;
  text-decoration: none;
  color: inherit;
}
.post-cardlink:hover .post-title { color: var(--blue); }

.post-first-image { margin-top: 8px; }
.post-thumb {
  display: block; width: 100%; max-height: 260px; height: auto;
  object-fit: cover; border-radius: 12px; background: #f0f0f0;
}
.post-first-image.hide { display: none; }

/* Detail page */
.post.detail { padding: 16px; }
.detail-title { font-size: 22px; font-weight: 800; color: #111; margin: 12px 0 6px; line-height: 1.35; word-break: break-word; }
.detail-content { font-size: 16px; line-height: 1.7; }
.post.detail .comments { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 12px; }
.post.detail .post-video video { width: 100%; border-radius: 12px; }
.back-link { color: var(--blue); font-size: 14px; text-decoration: none; }

/* Dashboard / analytics */
.dashboard { border-top: 8px solid #f0f2f5; padding: 14px 16px; }
.dash-title { font-size: 16px; font-weight: 800; color: #111; margin-bottom: 10px; }
.dash-sub { font-size: 13px; color: var(--gray); margin: 16px 0 8px; }
.dash-nums { display: flex; gap: 8px; }
.dash-num {
  flex: 1; background: #f7f9fb; border-radius: 10px; padding: 10px 6px;
  text-align: center;
}
.dash-num b { display: block; font-size: 20px; color: var(--blue); }
.dash-num span { font-size: 12px; color: var(--gray); }
.chart { width: 100%; overflow-x: auto; }
.chart svg { display: block; }
.top-ips { display: flex; flex-direction: column; gap: 4px; }
.ip-row {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 13px; padding: 6px 10px; background: #f7f9fb; border-radius: 8px;
}
.ip-row .ip { color: #333; font-family: monospace; }
.ip-row .ip-bar {
  flex: 1; height: 6px; margin: 0 10px; background: #e6ebf0; border-radius: 3px; overflow: hidden;
}
.ip-row .ip-bar i { display: block; height: 100%; background: var(--blue); }
.ip-row .ip-count { color: var(--gray); min-width: 28px; text-align: right; }
.ip-row .ip-loc { color: #7a869a; font-size: 12px; margin-left: 8px; flex: 0 0 auto; max-width: 45%; text-align: right; word-break: break-all; }
.ip-query { display: flex; gap: 8px; }
.ip-query input {
  flex: 1; border: 1px solid var(--line); border-radius: 8px;
  padding: 8px 10px; font-size: 14px; background: #fafafa;
}
.ip-query-result {
  margin-top: 10px; background: #f7f9fb; border-radius: 10px; padding: 12px;
  font-size: 14px; color: #333; line-height: 1.7;
}
.ip-query-result .r-ip { font-family: monospace; font-weight: 700; }
.ip-query-result .r-loc { color: var(--blue); font-weight: 700; }
.ip-query-result .r-isp { color: var(--gray); font-size: 13px; }

/* Visibility control */
.vis-control { margin-top: 10px; }
.vis-row { display: flex; align-items: center; gap: 8px; }
.vis-label { font-size: 13px; color: var(--gray); flex: 0 0 auto; }
.vis-mode {
  border: 1px solid var(--line); border-radius: 8px; padding: 5px 8px;
  font-size: 13px; background: #fafafa; color: #333;
}
.vis-domains { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }
.vis-domains.hide { display: none; }
.vis-chk { font-size: 13px; color: #333; display: inline-flex; align-items: center; gap: 4px; }
.post-vis {
  display: inline-block; font-size: 11px; color: #8a6d00;
  background: #fff7e0; border: 1px solid #ffe3a3; border-radius: 8px;
  padding: 0 6px; margin-top: 3px;
}
.post.hidden-here { opacity: 0.55; }

/* Domain manager */
.dash-domains { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.domain-list { display: flex; flex-wrap: wrap; gap: 6px; flex: 1; }
.domain-chip {
  font-size: 12px; background: #eef4ff; color: #2b6fd6;
  border-radius: 10px; padding: 2px 8px;
}
.domain-chip.dead { background: #f2f2f2; color: #999; }
.recent-actions { display: flex; flex-direction: column; gap: 2px; max-height: 260px; overflow-y: auto; }
.ra-row {
  display: flex; gap: 8px; font-size: 12px; color: #555;
  padding: 5px 0; border-bottom: 1px solid #f2f2f2;
}
.ra-row .ra-time { color: #aaa; flex: 0 0 auto; }
.ra-row .ra-ip { font-family: monospace; color: #333; flex: 1; word-break: break-all; }
.ra-row .ra-act { flex: 0 0 auto; }
.ra-row .ra-act.view { color: #7a869a; }
.ra-row .ra-act.like { color: #e0245e; }
.ra-row .ra-act.comment { color: #17bf63; }

/* ===== Admin tools row (main admin page) ===== */
.admin-tools {
  display: flex;
  gap: 10px;
  padding: 12px 16px;
  border-top: 1px solid var(--line);
  flex-wrap: wrap;
}
.admin-tool-btn { text-decoration: none; }

/* ===== Stats page (dedicated, PC-optimized) ===== */
.stats-page { background: var(--bg); }
.admin-bar {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255,255,255,0.95);
  backdrop-filter: saturate(1.4) blur(8px);
  border-bottom: 1px solid var(--line);
}
.admin-bar-inner {
  max-width: 1080px; margin: 0 auto; height: 52px; padding: 0 16px;
  display: flex; align-items: center; justify-content: space-between;
}
.admin-brand { font-size: 18px; font-weight: 800; color: #111; letter-spacing: .5px; }
.admin-nav { display: flex; align-items: center; gap: 6px; }
.admin-nav-link {
  font-size: 14px; color: #555; padding: 6px 12px; border-radius: 16px; text-decoration: none;
}
.admin-nav-link.active { background: #eef4ff; color: var(--blue); font-weight: 700; }

.admin-main { max-width: 1080px; margin: 0 auto; padding: 16px; }

.cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.stat-card {
  background: #fff; border-radius: 12px; padding: 18px 12px; text-align: center;
  box-shadow: 0 1px 2px rgba(0,0,0,.05);
}
.stat-card b { display: block; font-size: 26px; color: var(--blue); font-weight: 800; }
.stat-card span { font-size: 13px; color: var(--gray); }

.panel {
  background: #fff; border-radius: 12px; padding: 16px; margin-top: 16px;
  box-shadow: 0 1px 2px rgba(0,0,0,.05);
}
.panel-title { font-size: 15px; font-weight: 700; color: #111; margin-bottom: 12px; }
.grid-2 { display: grid; grid-template-columns: 1fr; gap: 16px; margin-top: 16px; }
.stats-page .recent-actions { max-height: 480px; }

@media (min-width: 820px) {
  .cards { grid-template-columns: repeat(4, 1fr); }
  .grid-2 { grid-template-columns: 1fr 1fr; align-items: start; }
  .stat-card b { font-size: 30px; }
}

/* ===== PC widening for the main admin page ===== */
@media (min-width: 900px) {
  .admin-page .app-main { max-width: 760px; box-shadow: 0 0 0 1px rgba(0,0,0,.04); }
  .admin-page .compose-text { font-size: 16px; }
}

/* =====================================================================
   NEO-BRUTALIST THEME  ——  统一博客与个人主页的视觉风格
   ===================================================================== */
:root{
  --nb-bg:#f5efe1; --nb-paper:#fffdf6; --nb-ink:#14110b;
  --nb-red:#ff5a3c; --nb-blue:#2f6bff; --nb-lime:#b8f02d; --nb-yellow:#ffcf33;
  --nb-shadow:5px 5px 0 var(--nb-ink); --nb-shadow-sm:3px 3px 0 var(--nb-ink);
  --nb-sans:"Space Grotesk","Noto Sans SC",system-ui,sans-serif;
  --nb-display:"Archivo Black","Noto Sans SC",system-ui,sans-serif;
}
body, body.am-bg-white{
  background:var(--nb-bg);
  font-family:var(--nb-sans);
  color:var(--nb-ink);
}

/* header */
.topstack{}
.app-header{ background:var(--nb-paper); border-bottom:3px solid var(--nb-ink); }
.app-header.am-hairline-bottom::after{ display:none; }
.app-title,#appTitle{ font-family:var(--nb-display); color:var(--nb-ink); letter-spacing:-.4px; font-weight:400; }
.back-link{ font-weight:700; }

/* main column transparent so cream shows between cards */
.app-main{ background:transparent !important; min-height:auto; box-shadow:none !important; }

/* buttons */
.am-button.tiny, .am-button.tiny-blue{
  border:2px solid var(--nb-ink) !important;
  box-shadow:var(--nb-shadow-sm);
  border-radius:10px; font-weight:700;
  background:var(--nb-paper); color:var(--nb-ink);
  transition:transform .1s, box-shadow .1s;
}
.am-button.tiny-blue{ background:var(--nb-blue); color:#fff; }
.am-button.tiny:hover, .am-button.tiny-blue:hover{ transform:translate(-2px,-2px); box-shadow:5px 5px 0 var(--nb-ink); }
.am-button.tiny:active, .am-button.tiny-blue:active{ transform:translate(2px,2px); box-shadow:none; }

/* profile as a card */
.profile{
  background:var(--nb-paper);
  border:3px solid var(--nb-ink);
  border-radius:18px; overflow:hidden;
  box-shadow:var(--nb-shadow);
  margin:16px; 
}
.profile-banner{ border-bottom:3px solid var(--nb-ink); min-height:130px; }
.profile-avatar{ border:3px solid var(--nb-ink) !important; box-shadow:var(--nb-shadow-sm); }
.profile-name{ font-family:var(--nb-display); font-weight:400; letter-spacing:-.3px; }
.profile-bio{ color:#43402f; }
.profile-stats b{ font-family:var(--nb-display); font-weight:400; }
.admin-stats{ border-top:2px dashed var(--nb-ink); }
.admin-stat b{ font-family:var(--nb-display); font-weight:400; color:var(--nb-blue); }
.admin-tools{ border-top:2px dashed var(--nb-ink); }
.post-badge{ background:var(--nb-blue); border:2px solid var(--nb-ink); border-radius:8px; }

/* compose as a card */
#composeWrap.compose{
  background:var(--nb-paper);
  border:3px solid var(--nb-ink) !important;
  border-radius:18px; box-shadow:var(--nb-shadow);
  margin:16px;
}
#composeWrap.compose.am-hairline-bottom::after{ display:none; }
.compose-title{ border-bottom:2px solid var(--nb-ink); font-family:var(--nb-display); font-weight:400; }

/* feed + cards */
.feed{ background:transparent; padding-bottom:24px; }
.feed .post.card{
  background:var(--nb-paper);
  border:3px solid var(--nb-ink);
  border-radius:18px;
  box-shadow:var(--nb-shadow);
  margin:16px;
}
.feed .post.card:hover{ transform:translate(-2px,-2px); box-shadow:8px 8px 0 var(--nb-ink); }
.avatar, .post-avatar{ border:2px solid var(--nb-ink); }
.post-title{ font-family:var(--nb-display); font-weight:400; letter-spacing:-.3px; }
.post-cardlink:hover .post-title{ color:var(--nb-blue); }
.post-thumb{ border:2px solid var(--nb-ink); }
.pin-tag{ color:var(--nb-red); font-weight:700; }

/* like/comment actions */
.post-actions{ border-top:2px dashed #e5ddca; padding-top:10px; gap:34px; }
.act{ font-weight:600; }

/* comments */
.comments{ border-top:2px dashed var(--nb-ink); }
.comment{ border-bottom:1px solid #efe7d4; }
.c-avatar{ border:2px solid var(--nb-ink); background:var(--nb-yellow); color:var(--nb-ink); font-weight:700; }
.comment-name, .comment-text,
.modal-input, .modal-textarea{
  border:2px solid var(--nb-ink) !important;
  border-radius:10px; background:var(--nb-paper);
}
.c-reply{ border-left:4px solid var(--nb-blue); background:#eef3ff; }
.rbadge{ background:var(--nb-blue); }

/* modals */
.modal-panel{ border:3px solid var(--nb-ink); box-shadow:8px 8px 0 var(--nb-ink); border-radius:18px; }
.modal-title{ font-family:var(--nb-display); font-weight:400; }

/* ad bar */
.ad-bar{ border-bottom:3px solid var(--nb-ink); }

/* detail page */
.post.detail{
  background:var(--nb-paper);
  border:3px solid var(--nb-ink);
  border-radius:18px; box-shadow:var(--nb-shadow);
  margin:16px 12px;
}
.detail-title{ font-family:var(--nb-display); font-weight:400; letter-spacing:-.4px; }

/* ===== stats page ===== */
.stats-page{ background:var(--nb-bg); }
.stats-page .admin-bar{ background:var(--nb-paper); border-bottom:3px solid var(--nb-ink); }
.stats-page .admin-brand{ font-family:var(--nb-display); font-weight:400; }
.stats-page .admin-nav-link.active{ background:var(--nb-yellow); color:var(--nb-ink); border:2px solid var(--nb-ink); }
.stat-card, .stats-page .panel{
  border:3px solid var(--nb-ink) !important;
  box-shadow:var(--nb-shadow) !important;
  border-radius:14px; background:var(--nb-paper);
}
.stat-card b{ font-family:var(--nb-display); font-weight:400; color:var(--nb-blue); }
.panel-title{ font-family:var(--nb-display); font-weight:400; }

/* empty / loading */
.empty, .feed-loading{ color:#8a8064; }

/* ===== Works management page ===== */
.wform { display: flex; flex-direction: column; gap: 12px; }
.wform__row { display: flex; gap: 12px; }
.wform__field { display: flex; flex-direction: column; gap: 5px; font-size: 13px; font-weight: 600; color: #43402f; }
.wform__field > span { font-size: 13px; }
.wform__emoji { width: 90px; flex: 0 0 auto; }
.wform__grow { flex: 1; }
.wform input, .wform textarea {
  border: 2px solid var(--nb-ink); border-radius: 10px;
  padding: 9px 11px; font-size: 15px; background: var(--nb-paper);
  font-family: inherit; width: 100%;
}
.wform textarea { resize: vertical; }
.wform__actions { display: flex; gap: 10px; justify-content: flex-end; }

.works-list { display: flex; flex-direction: column; gap: 14px; }
.wrow { display: flex; gap: 14px; align-items: flex-start; }
.wrow__emoji { font-size: 34px; flex: 0 0 auto; line-height: 1.2; }
.wrow__main { flex: 1; min-width: 0; }
.wrow__main h3 { font-family: var(--nb-display); font-weight: 400; font-size: 18px; margin: 0 0 4px; }
.wrow__main p { margin: 0 0 8px; font-size: 14px; color: #43402f; }
.wrow__tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.wrow__tags span { font-family: var(--mono, monospace); font-size: 11px; border: 2px solid var(--nb-ink); padding: 2px 7px; background: #fff; }
.wrow__url { font-size: 12px; }
.wrow__link { color: var(--nb-blue); font-weight: 700; word-break: break-all; }
.wrow__nolink { color: #a99f86; }
.wrow__ops { display: flex; flex-direction: column; gap: 6px; flex: 0 0 auto; }
.wrow__ops .am-button.tiny { min-width: 52px; padding: 0 10px; }
.wrow__del { color: var(--nb-red) !important; }
@media (max-width: 640px) {
  .wrow { flex-wrap: wrap; }
  .wrow__ops { flex-direction: row; flex-wrap: wrap; width: 100%; }
}

/* ===== File share pages ===== */
.dropzone { display: block; border: 3px dashed var(--nb-ink); border-radius: 14px; background: #fffdf6; cursor: pointer; text-align: center; padding: 28px 16px; transition: background .15s; }
.dropzone:hover { background: var(--nb-yellow); }
.dropzone__inner { display: flex; flex-direction: column; gap: 4px; align-items: center; }
.dropzone__ico { font-size: 40px; }
.dropzone__inner b { font-size: 16px; }
.dropzone__hint { font-size: 12px; color: #8a8064; }
.pending-list { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; }
.pend-item { display: flex; align-items: center; gap: 10px; border: 2px solid var(--nb-ink); border-radius: 10px; padding: 6px 10px; background: #fff; }
.pend-name { flex: 1; font-size: 14px; word-break: break-all; }
.pend-size { font-family: var(--mono, monospace); font-size: 12px; color: #6b6350; }
.pend-rm { border: 0; background: none; color: var(--nb-red); font-size: 16px; cursor: pointer; }
.upbar { height: 14px; border: 2px solid var(--nb-ink); border-radius: 8px; overflow: hidden; margin-top: 12px; background: #fff; }
.upbar span { display: block; height: 100%; width: 0; background: var(--nb-blue); transition: width .2s; }

.share-hint { font-size: 13px; color: #6b6350; margin-bottom: 12px; }
.share-hint a { color: var(--nb-blue); font-weight: 700; }
.share-list { display: flex; flex-direction: column; gap: 12px; }
.share-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.share-row--dl { text-decoration: none; color: inherit; }
.share-row--dl:hover { transform: translate(-2px,-2px); box-shadow: 8px 8px 0 var(--nb-ink); }
.share-row__main { display: flex; align-items: center; gap: 12px; min-width: 0; }
.share-row__ico { font-size: 30px; flex: 0 0 auto; }
.share-row__name { font-weight: 700; word-break: break-all; }
.share-row__meta { font-family: var(--mono, monospace); font-size: 12px; color: #6b6350; margin-top: 2px; }
.share-row__ops { display: flex; gap: 8px; flex: 0 0 auto; flex-wrap: wrap; justify-content: flex-end; }
.share-del { color: var(--nb-red) !important; }
@media (max-width: 640px) {
  .share-row { flex-wrap: wrap; }
  .share-row__ops { width: 100%; }
}

/* ===== 投喂土豆 ===== */
.donate-btn {
  display: block; width: calc(100% - 0px); margin-top: 12px;
  border: 3px solid var(--nb-ink); border-radius: 12px;
  background: var(--nb-yellow); color: var(--nb-ink);
  font-weight: 700; font-size: 15px; padding: 10px; cursor: pointer;
  box-shadow: var(--nb-shadow-sm); transition: transform .1s, box-shadow .1s;
}
.donate-btn:hover { transform: translate(-2px,-2px); box-shadow: 5px 5px 0 var(--nb-ink); }
.donate-btn:active { transform: translate(2px,2px); box-shadow: none; }
.donate-note { font-size: 14px; color: #43402f; margin-bottom: 14px; }
.donate-codes { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.donate-codes:has(.hide) { grid-template-columns: 1fr; }
.donate-code { border: 2px solid var(--nb-ink); border-radius: 12px; overflow: hidden; text-align: center; background: #fff; }
.donate-code.hide { display: none; }
.donate-code__label { font-weight: 700; color: #fff; padding: 6px; font-size: 14px; }
.donate-code__label--wx { background: #09bb07; }
.donate-code__label--ali { background: #1677ff; }
.donate-code img { display: block; width: 100%; height: auto; }
@media (max-width: 480px) { .donate-codes { grid-template-columns: 1fr; } }

/* ===== Share poster ===== */
.icon-share { font-weight: 700; margin-right: 2px; }
.share-status { text-align: center; color: #6b6350; padding: 24px 0; font-size: 14px; }
.share-result { text-align: center; max-height: 60vh; overflow: auto; }
.share-img { max-width: 100%; max-height: 58vh; width: auto; height: auto; border: 2px solid var(--nb-ink); border-radius: 10px; }
#shareModal .modal-panel { max-height: 92vh; display: flex; flex-direction: column; }
.share-tip { font-size: 12px; color: #8a8064; text-align: center; margin-top: 8px; }

/* the off-screen poster that gets captured */
.poster {
  width: 560px; box-sizing: border-box;
  background: #fffdf6; color: #14110b;
  padding: 30px 30px 24px;
  font-family: "Space Grotesk","Noto Sans SC",system-ui,sans-serif;
  border: 4px solid #14110b;
}
.poster .pp-head { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.poster .pp-avatar { width: 60px; height: 60px; border-radius: 50%; border: 3px solid #14110b; object-fit: cover; }
.poster .pp-avatar--t { display: flex; align-items: center; justify-content: center; background: #2f6bff; color: #fff; font-weight: 800; font-size: 24px; }
.poster .pp-name { font-size: 20px; font-weight: 800; display: flex; align-items: center; gap: 8px; }
.poster .pp-badge { font-size: 12px; background: #2f6bff; color: #fff; border: 2px solid #14110b; border-radius: 8px; padding: 1px 7px; }
.poster .pp-time { font-size: 13px; color: #8a8064; margin-top: 2px; }
.poster .pp-title { font-family: "Archivo Black","Noto Sans SC",sans-serif; font-size: 27px; line-height: 1.3; margin: 6px 0 12px; word-break: break-word; }
.poster .pp-content { font-size: 17px; line-height: 1.75; white-space: pre-wrap; word-break: break-word; color: #2e2b20; }
.poster .pp-imgs { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.poster .pp-img { width: 100%; border-radius: 12px; border: 2px solid #14110b; display: block; }
.poster .pp-video { margin-top: 14px; padding: 12px; border: 2px dashed #14110b; border-radius: 10px; font-weight: 700; color: #6b6350; text-align: center; }
.poster .pp-foot { display: flex; align-items: center; gap: 16px; margin-top: 24px; padding-top: 18px; border-top: 3px dashed #14110b; }
.poster .pp-qr { width: 132px; height: 132px; flex: 0 0 auto; border: 2px solid #14110b; border-radius: 8px; overflow: hidden; background: #fff; }
.poster .pp-qr img, .poster .pp-qr canvas { display: block; width: 132px !important; height: 132px !important; }
.poster .pp-foot-hi { font-size: 18px; font-weight: 800; }
.poster .pp-foot-site { font-size: 15px; color: #6b6350; margin-top: 6px; font-family: "Space Mono",monospace; }

/* ===== admin (站长) comments ===== */
.c-badge { font-size: 10px; color: #fff; background: var(--nb-blue, #2f6bff); border: 1px solid var(--nb-ink, #14110b); border-radius: 6px; padding: 0 5px; margin-left: 5px; vertical-align: 1px; font-weight: 700; }
.comment--admin { background: #f4f8ff; border-radius: 10px; padding: 8px; margin: 4px 0; }
.comment--admin .c-avatar { border: 2px solid var(--nb-blue, #2f6bff); background-color: var(--nb-blue, #2f6bff); }
.comment-asadmin { font-size: 13px; color: #2f6bff; font-weight: 700; background: #eef3ff; border: 2px solid var(--nb-ink, #14110b); border-radius: 10px; padding: 8px 10px; margin-bottom: 6px; }

/* ===== 双广告位（帖子栏内，左右并排） ===== */
.ad-row {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 16px 16px 4px;
}
.ad-row.ad-row--single { grid-template-columns: 1fr; }
.ad-slot {
  display: flex; flex-direction: column;
  min-height: 64px; gap: 0;
  border: 3px solid var(--nb-ink, #14110b);
  border-radius: 14px;
  background: #fff7e0;
  box-shadow: var(--nb-shadow-sm, 3px 3px 0 #14110b);
  overflow: hidden;
  text-decoration: none;
  color: #7a5a00;
}
.ad-slot[href] { cursor: pointer; }
.ad-slot[href]:hover { transform: translate(-2px,-2px); box-shadow: 5px 5px 0 var(--nb-ink, #14110b); }
.ad-slot.hide { display: none; }
.ad-slot__tag {
  display: inline-block;
  font-size: 10px; font-weight: 700; color: #fff;
  background: #f0a020; border: 1px solid var(--nb-ink,#14110b);
  border-radius: 5px; padding: 2px 6px;
  align-self: flex-start; margin: 8px 0 0 10px;
}
.ad-slot__img { display: block; width: 100%; height: auto; max-height: 150px; object-fit: cover; }
.ad-slot__text { display: block; padding: 8px 12px 10px; font-size: 13px; font-weight: 600; line-height: 1.4; word-break: break-word; }
.ad-slot__img + .ad-slot__text { padding-top: 8px; }
.ad-slot__empty { display: flex; align-items: center; justify-content: center; min-height: 64px; color: #b09a6a; font-size: 13px; }
.ad-edit-btn {
  position: absolute; top: -12px; right: 10px;
  font-size: 12px; font-weight: 700; color: #a05a00;
  background: var(--nb-yellow, #ffcf33); border: 2px solid var(--nb-ink,#14110b);
  border-radius: 10px; padding: 3px 10px; cursor: pointer; z-index: 2;
}
.ad-edit-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.ad-edit-col { border: 2px solid var(--nb-ink,#14110b); border-radius: 12px; padding: 12px; background: #fffdf6; }
.ad-edit-col__t { font-weight: 700; margin-bottom: 8px; }
.ad-edit-col .modal-input { margin-top: 6px; }
@media (max-width: 560px) { .ad-edit-grid { grid-template-columns: 1fr; } }

/* ===== 图片排版：九宫格 / 列表 ===== */
.preview-grid.g3 { grid-template-columns: repeat(3, 1fr); }
.preview-grid.g3.single { grid-template-columns: 1fr; }
.preview-grid.list { display: flex; flex-direction: column; gap: 8px; }
.preview-grid.list .preview-item { padding-top: 0; height: auto; background: none; }
.preview-grid.list .preview-item img { position: static; width: 100%; height: auto; border-radius: 12px; }

/* layout picker (compose/edit) */
.layout-pick { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.layout-pick.hide { display: none; }
.layout-pick__label { font-size: 13px; color: var(--gray, #888); }
.layout-opt {
  border: 2px solid var(--nb-ink, #14110b); background: #fff; color: var(--nb-ink, #14110b);
  border-radius: 8px; font-size: 13px; padding: 4px 12px; cursor: pointer; font-weight: 600;
}
.layout-opt.active { background: var(--nb-blue, #2f6bff); color: #fff; }

/* poster image layouts (share) */
.poster .pp-imgs--grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.poster .pp-imgs--grid .pp-img { width: 100%; aspect-ratio: 1/1; object-fit: cover; margin: 0; }
.poster .pp-imgs--one .pp-img { width: 100%; }
.poster .pp-more { font-size: 13px; color: #6b6350; margin-top: 8px; font-weight: 600; }

.poster .pp-imgs__title { font-size: 12px; color: #6b6350; font-weight: 700; margin-bottom: 4px; }

/* cover image indicator */
.preview-item.is-cover { border: 3px solid var(--nb-red,#ff5a3c); border-radius: 14px; }
.preview-item.is-cover::after { content: "封面"; position: absolute; top: 6px; left: 6px; background: var(--nb-red,#ff5a3c); color: #fff; font-size: 11px; font-weight: 700; border: 1px solid var(--nb-ink,#14110b); border-radius: 5px; padding: 1px 6px; z-index: 2; }
.cover-set { position: absolute; bottom: 6px; right: 6px; z-index: 2; font-size: 11px; font-weight: 600; background: rgba(255,255,255,.92); border: 1px solid var(--nb-ink,#14110b); border-radius: 6px; padding: 2px 8px; cursor: pointer; color: var(--nb-ink,#14110b); }
.preview-item.is-cover .cover-set { background: var(--nb-red,#ff5a3c); color: #fff; }

/* ===== Link cards ===== */
.link-cards { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.link-cards:empty { display: none; margin: 0; }
.link-card { display: flex; gap: 12px; border: 3px solid var(--nb-ink,#14110b); border-radius: 14px; overflow: hidden; background: var(--nb-paper,#fffdf6); text-decoration: none; color: var(--nb-ink,#14110b); box-shadow: var(--nb-shadow-sm,3px 3px 0 #14110b); transition: transform .15s, box-shadow .15s; }
.link-card:hover { transform: translate(-2px,-2px); box-shadow: 5px 5px 0 var(--nb-ink,#14110b); }
.link-card__img { width: 100px; min-height: 80px; object-fit: cover; flex: 0 0 auto; background: #f0f0f0; }
.link-card__img--icon { display: flex; align-items: center; justify-content: center; font-size: 34px; background: #eef4ff; min-width: 100px; }
.link-card__text { flex: 1; min-width: 0; padding: 10px 12px 10px 0; overflow: hidden; }
.link-card__title { font-weight: 700; font-size: 15px; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.link-card__desc { font-size: 13px; color: #6b6350; margin-top: 4px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.link-card__site { font-size: 11px; color: #a99f86; margin-top: 4px; }
.poster .pp-linkcard { font-size: 13px; color: #2f6bff; padding: 6px 0 2px; font-weight: 500; }
.poster .pp-linkcard { font-size: 13px; color: #2f6bff; padding: 6px 0 2px; font-weight: 500; }
.poster .pp-linkcard--rich { display: flex; gap: 10px; border: 2px solid #e0d8c4; border-radius: 10px; padding: 8px; margin: 4px 0; }
.poster .pp-linkcard--rich .pp-linkcard__img { width: 60px; height: 60px; object-fit: cover; border-radius: 6px; flex: 0 0 auto; }
.poster .pp-linkcard__body { flex: 1; min-width: 0; }
.poster .pp-linkcard__t { font-weight: 700; font-size: 13px; color: #14110b; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.poster .pp-linkcard__dom { font-size: 11px; color: #8a8064; margin-top: 3px; }


/* ===== 帖子详情页图片不裁切，自然宽高比 ===== */
.post.detail .post-images .preview-item {
  padding-top: 0 !important;
  height: auto !important;
  background: none;
}
.post.detail .post-images .preview-item img {
  position: static !important;
  width: 100%;
  height: auto;
  object-fit: contain;
}
