: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; }
.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; }
.act.liked .icon-like { border-color: #e0245e; background: #e0245e; }

.icon-like, .icon-comment {
  width: 17px; height: 17px;
  display: inline-block;
  border: 1.6px solid currentColor;
}
.icon-like {
  background: transparent;
  -webkit-mask: radial-gradient(circle at 30% 35%, #000 60%, transparent 61%) left,
                radial-gradient(circle at 70% 35%, #000 60%, transparent 61%) right;
  border: 0;
  position: relative;
}
.icon-like::before {
  content: "\2665";
  font-size: 17px;
  line-height: 1;
  color: currentColor;
}
.act.liked .icon-like::before { color: #e0245e; }
.icon-comment {
  border-radius: 6px 6px 6px 0;
}

/* 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; }

/* 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;
}

/* 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; }
