/* ES家匿名板 —— 浅色玻璃风，重排版
   变量集中在 :root，改皮肤只动这一块。 */

:root {
  --accent: #00aaff;
  --accent-hover: #22b8ff;
  --accent-fg: #fff;
  --text: #1a1a1a;
  --text-2: #5f6672;
  --text-3: #8d95a1;
  --surface: rgba(255, 255, 255, .72);
  --surface-solid: #fff;
  --stroke: rgba(0, 0, 0, .07);
  --stroke-strong: rgba(0, 0, 0, .12);
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 12px 32px rgba(16, 24, 40, .07);
  --radius: 14px;
  --radius-sm: 10px;
  --max: 760px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

/* 兜底：任何位置的图片都不许把布局撑破（回复里的图以前没有约束） */
img { max-width: 100%; height: auto; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system,
               "PingFang SC", "Microsoft YaHei UI", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  line-height: 1.7;
  color: var(--text);
  background-color: #eef2f7;
  background-image:
    radial-gradient(900px 520px at 12% -8%, rgba(0, 170, 255, .16), transparent 70%),
    radial-gradient(760px 480px at 96% 4%, rgba(120, 180, 255, .14), transparent 72%),
    linear-gradient(180deg, #f7fafd 0%, #eef2f7 42%, #eaeef4 100%);
  background-attachment: fixed;
}

.wrap {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 18px 56px;
}

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 18px;
  padding: 14px 16px;
  background: rgba(247, 250, 253, .78);
  backdrop-filter: blur(18px) saturate(150%);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
  border: 1px solid var(--stroke);
  border-radius: 14px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .04);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
  color: var(--text);
  font-weight: 600;
  font-size: 16px;
  letter-spacing: .01em;
}

.brand .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(0, 170, 255, .16);
}

.topnav { display: flex; gap: 8px; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-fg);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background .15s ease, transform .1s ease, box-shadow .15s ease;
}

.btn:hover { background: var(--accent-hover); }
.btn:active { transform: translateY(1px); }

.btn.ghost {
  background: rgba(255, 255, 255, .7);
  border-color: var(--stroke);
  color: var(--text-2);
}
.btn.ghost:hover { color: var(--text); background: #fff; }

/* ---------- 卡片 ---------- */
.card {
  background: var(--surface);
  backdrop-filter: blur(20px) saturate(150%);
  -webkit-backdrop-filter: blur(20px) saturate(150%);
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 22px;
}

/* ---------- 帖子列表 ---------- */
.list { display: flex; flex-direction: column; gap: 12px; }

.post-item {
  display: block;
  text-decoration: none;
  color: inherit;
  background: var(--surface);
  backdrop-filter: blur(20px) saturate(150%);
  -webkit-backdrop-filter: blur(20px) saturate(150%);
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  box-shadow: 0 1px 2px rgba(16, 24, 40, .03);
  padding: 16px 18px;
  transition: border-color .15s ease, box-shadow .15s ease, transform .12s ease;
}

.post-item:hover {
  border-color: rgba(0, 170, 255, .45);
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}

.post-item h2 {
  margin: 0 0 6px;
  font-size: 16.5px;
  font-weight: 650;
  line-height: 1.45;
  color: var(--text);
}

.post-item .excerpt {
  margin: 0;
  color: var(--text-2);
  font-size: 14px;
  line-height: 1.65;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  font-size: 12.5px;
  color: var(--text-3);
}

.meta .who { color: var(--text-2); font-weight: 600; }
.meta .sep { width: 3px; height: 3px; border-radius: 50%; background: currentColor; opacity: .55; }

.tag {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 8px;
  border-radius: 999px;
  background: rgba(0, 170, 255, .12);
  color: #0079b8;
  font-size: 12px;
  font-weight: 600;
}

/* ---------- 帖子详情 ---------- */
.thread-head h1 {
  margin: 0 0 10px;
  font-size: 22px;
  line-height: 1.4;
  font-weight: 680;
  word-break: break-word;
}

.thread-body {
  margin: 16px 0 4px;
  font-size: 15.5px;
  line-height: 1.85;
  word-break: break-word;
}

.thread-body img,
.reply .body img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-sm);
  margin: 10px 0;
  display: block;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .06);
}

.thread-body a,
.reply .body a { color: #0079b8; word-break: break-all; }

/* ---------- 回复 ---------- */
.section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 26px 0 12px;
  font-size: 14px;
  font-weight: 650;
  color: var(--text-2);
}

.section-title .count {
  min-width: 22px;
  height: 20px;
  padding: 0 7px;
  border-radius: 999px;
  background: rgba(0, 0, 0, .055);
  color: var(--text-2);
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.replies { display: flex; flex-direction: column; gap: 10px; }

.reply {
  background: rgba(255, 255, 255, .62);
  border: 1px solid var(--stroke);
  border-radius: var(--radius-sm);
  padding: 13px 16px;
}

.reply .head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
  font-size: 13px;
  color: var(--text-3);
}

.reply .who { color: var(--text-2); font-weight: 650; }
.reply .body { white-space: normal; word-break: break-word; overflow-wrap: anywhere; }

.empty {
  padding: 26px 8px;
  text-align: center;
  color: var(--text-3);
  font-size: 14px;
}

/* ---------- 表单 ---------- */
.form-card { margin-top: 20px; }

.field { margin-bottom: 14px; }

.field label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
}

.field .hint { color: var(--text-3); font-weight: 400; }

input[type="text"],
textarea {
  width: 100%;
  font: inherit;
  color: var(--text);
  background: rgba(255, 255, 255, .9);
  border: 1px solid var(--stroke-strong);
  border-radius: var(--radius-sm);
  padding: 10px 13px;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}

textarea { resize: vertical; min-height: 120px; line-height: 1.75; }

input[type="text"]:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 170, 255, .16);
}

.form-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 4px;
}

/* ---------- 提示条 ---------- */
.notice {
  margin: 0 0 16px;
  padding: 11px 15px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  border: 1px solid transparent;
}

.notice.error {
  background: rgba(255, 59, 48, .08);
  border-color: rgba(255, 59, 48, .22);
  color: #b3261e;
}

.notice.ok {
  background: rgba(0, 170, 255, .09);
  border-color: rgba(0, 170, 255, .25);
  color: #00689e;
}

/* ---------- 分页 ---------- */
.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 24px 0 0;
  font-size: 13.5px;
  color: var(--text-3);
}

.pager a, .pager span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 32px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, .7);
  color: var(--text-2);
  text-decoration: none;
}

.pager a:hover { border-color: rgba(0, 170, 255, .45); color: var(--text); }
.pager .current { background: var(--accent); border-color: transparent; color: #fff; font-weight: 650; }
.pager .gap { border: 0; background: none; }

/* ---------- 页脚 ---------- */
.foot {
  margin-top: 34px;
  text-align: center;
  font-size: 12.5px;
  color: var(--text-3);
}

.backlink { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); text-decoration: none; font-size: 14px; }
.backlink:hover { color: var(--accent); }

@media (max-width: 560px) {
  body { font-size: 14.5px; }
  .wrap { padding: 0 14px 44px; }
  .topbar { margin: 0 0 16px; padding: 12px 14px; }
  .card { padding: 16px 15px; }
  .thread-head h1 { font-size: 19px; }
  .brand-text { font-size: 15px; }
}

/* ---------- 置顶标记 ---------- */
.tag.pin { background: rgba(255, 59, 48, .13); color: #c62828; }

/* ---------- 后台 ---------- */
.admin-list { display: flex; flex-direction: column; gap: 8px; }

.admin-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--stroke);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, .62);
}

.admin-info { min-width: 0; flex: 1; }

.admin-title {
  display: block;
  color: var(--text);
  font-weight: 650;
  font-size: 15px;
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-title:hover { color: var(--accent); }

.admin-info .meta { margin-top: 4px; }

.admin-actions { display: flex; flex-wrap: wrap; gap: 6px; flex-shrink: 0; }
.admin-actions form { margin: 0; }

.btn.small { height: 28px; padding: 0 11px; font-size: 12.5px; }

.btn.danger {
  background: rgba(255, 59, 48, .1);
  border-color: rgba(255, 59, 48, .3);
  color: #b3261e;
}
.btn.danger:hover { background: rgba(255, 59, 48, .18); }

@media (max-width: 620px) {
  .admin-row { flex-direction: column; align-items: stretch; }
  .admin-actions { justify-content: flex-end; }
}

/* ---------- 帖子列表页：四边 8px（其它页面保持原样） ---------- */
.page-list .wrap { padding: 8px; }
.page-list .topbar {
  margin: 0 0 8px;
  padding: 12px 10px;
}

/* ---------- ES家 App（UA 含 eshome）：顶栏给状态栏留 40px ---------- */
.is-app .topbar { padding-top: 50px; }
.is-app.page-list .wrap { padding-top: 0; }

/* ---------- 帖子详情页：不显示顶栏，靠正文上方的返回链接 ---------- */
.page-thread .topbar { display: none; }
.page-thread .wrap { padding-top: 14px; }

/* ES家 App 里不显示底部版权 */
.is-app .foot { display: none; }

/* ES家 App：背景透明，露出 App 自己的底 */
body.is-app {
  background-color: transparent;
  background-image: none;
}

/* ---------- 顶栏图标按钮 ---------- */
.topnav { align-items: center; }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, .7);
  color: var(--text-2);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}

.icon-btn:hover { background: #fff; color: var(--text); border-color: var(--stroke-strong); }
.icon-btn:active { transform: translateY(1px); }
.icon-btn svg { display: block; }
.icon-btn .ico-sun { display: none; }
html[data-theme="dark"] .icon-btn .ico-sun { display: block; }
html[data-theme="dark"] .icon-btn .ico-moon { display: none; }

/* ---------- 底部悬浮发帖按钮 ---------- */
.fab {
  position: fixed;
  right: 16px;
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  z-index: 40;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 48px;
  padding: 0 20px 0 17px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 15px;
  font-weight: 650;
  text-decoration: none;
  box-shadow: 0 6px 18px rgba(0, 150, 255, .32), 0 1px 3px rgba(16, 24, 40, .18);
  transition: background .15s ease, transform .12s ease, box-shadow .15s ease;
}

.fab svg { display: block; }
.fab:hover { background: var(--accent-hover); transform: translateY(-1px); box-shadow: 0 10px 24px rgba(0, 150, 255, .4); }
.fab:active { transform: translateY(0); }

/* 列表页给悬浮按钮留出空间，别让最后一帖被盖住 */
.page-list .wrap { padding-bottom: 92px; }

@media (max-width: 560px) {
  .fab { right: 12px; bottom: calc(12px + env(safe-area-inset-bottom, 0px)); height: 46px; padding: 0 17px 0 15px; font-size: 14.5px; }
}

/* ---------- 深色模式 ---------- */
html[data-theme="dark"] {
  --text: #e7ebf1;
  --text-2: #a9b2c0;
  --text-3: #7b8593;
  --surface: rgba(255, 255, 255, .0512);
  --surface-solid: #1b1f26;
  --stroke: rgba(255, 255, 255, .0698);
  --stroke-strong: rgba(255, 255, 255, .16);
  --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 12px 32px rgba(0, 0, 0, .38);
  --accent: #2aa9ff;
  --accent-hover: #4bb8ff;
}

html[data-theme="dark"] body {
  background-color: #202020;
  background-image: none;
}

/* App 里依然要透明，这条要压住上面的深色背景 */
html[data-theme="dark"] body.is-app { background-color: transparent; background-image: none; }

html[data-theme="dark"] .topbar { background: rgba(32, 32, 32, .82); }
html[data-theme="dark"] .post-item { background: var(--surface); }
html[data-theme="dark"] .post-item:hover { background: rgba(255, 255, 255, .0837); }
html[data-theme="dark"] .reply { background: rgba(255, 255, 255, .045); }
html[data-theme="dark"] .admin-row { background: rgba(255, 255, 255, .045); }
html[data-theme="dark"] .icon-btn { background: rgba(255, 255, 255, .06); }
html[data-theme="dark"] .icon-btn:hover { background: rgba(255, 255, 255, .12); border-color: var(--stroke-strong); }
html[data-theme="dark"] .btn.ghost { background: rgba(255, 255, 255, .06); color: var(--text-2); }
html[data-theme="dark"] .btn.ghost:hover { background: rgba(255, 255, 255, .12); color: var(--text); }
html[data-theme="dark"] .pager a,
html[data-theme="dark"] .pager span { background: rgba(255, 255, 255, .06); }
html[data-theme="dark"] .pager a:hover { border-color: rgba(42, 169, 255, .5); }

html[data-theme="dark"] input[type="text"],
html[data-theme="dark"] textarea {
  background: rgba(255, 255, 255, .05);
  color: var(--text);
  border-color: var(--stroke-strong);
}
html[data-theme="dark"] input[type="text"]::placeholder,
html[data-theme="dark"] textarea::placeholder { color: var(--text-3); }

html[data-theme="dark"] .tag { background: rgba(42, 169, 255, .16); color: #7cc9ff; }
html[data-theme="dark"] .tag.pin { background: rgba(255, 69, 58, .2); color: #ff9d95; }
html[data-theme="dark"] .section-title .count { background: rgba(255, 255, 255, .08); }
html[data-theme="dark"] .notice.error { background: rgba(255, 69, 58, .12); border-color: rgba(255, 69, 58, .28); color: #ff9d95; }
html[data-theme="dark"] .notice.ok { background: rgba(42, 169, 255, .14); border-color: rgba(42, 169, 255, .3); color: #8ed0ff; }
html[data-theme="dark"] .btn.danger { background: rgba(255, 69, 58, .14); border-color: rgba(255, 69, 58, .3); color: #ff9d95; }
html[data-theme="dark"] .thread-body a,
html[data-theme="dark"] .reply .body a { color: #6cc4ff; }

/* 让原生控件（滚动条、选择框）跟随主题 */
html[data-theme="light"] { color-scheme: light; }
html[data-theme="dark"]  { color-scheme: dark; }

/* ES家 App 里隐藏深色模式按钮（主题由 App 决定） */
.is-app #btn-theme { display: none; }

/* 发帖页也不显示顶栏 */
.page-post .topbar { display: none; }
.page-post .wrap { padding-top: 14px; }

/* 深色模式下发帖按钮压暗一点，别那么扎眼 */
html[data-theme="dark"] .fab {
  background: #1c6ea4;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .45), 0 1px 3px rgba(0, 0, 0, .4);
}
html[data-theme="dark"] .fab:hover {
  background: #2380be;
  box-shadow: 0 10px 24px rgba(0, 0, 0, .5);
}

/* 深色模式下的实心按钮（发布 / 发表回复）跟发帖按钮统一压暗 */
html[data-theme="dark"] .btn:not(.ghost):not(.danger) {
  background: #1c6ea4;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .35);
}
html[data-theme="dark"] .btn:not(.ghost):not(.danger):hover {
  background: #2380be;
}

/* ---------- 列表行：正文可点 + 就地管理按钮 ---------- */
.post-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  flex-wrap: wrap;
}

.post-link {
  flex: 1 1 240px;
  min-width: 0;
  display: block;
  color: inherit;
  text-decoration: none;
}

.post-actions {
  display: none;
  gap: 6px;
  margin-left: auto;
  align-self: center;
  flex-wrap: wrap;
}

body.admin-mode .post-actions { display: flex; }

body.admin-mode .post-item:hover { border-color: var(--stroke); box-shadow: 0 1px 2px rgba(16, 24, 40, .03); transform: none; }
body.admin-mode .post-item:has(.post-actions:hover) { border-color: rgba(0, 170, 255, .45); }

@media (max-width: 560px) {
  .post-actions { margin-left: 0; width: 100%; justify-content: flex-end; }
}

/* 隐藏态必须真的不可见：.tag 自己设了 display，会盖掉浏览器默认的 [hidden] */
[hidden] { display: none !important; }

/* 帖子详情页的操作按钮 */
.thread-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-left: 4px;
}
.thread-actions .btn { height: 26px; padding: 0 10px; font-size: 12.5px; }

/* ---------- 发帖页：图片上传 ---------- */
.field-label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
}

.uploader { display: flex; flex-direction: column; gap: 10px; }

.upload-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border: 1px dashed var(--stroke-strong);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, .5);
  color: var(--text-3);
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease, color .15s ease;
}

.upload-card:hover {
  border-color: var(--accent);
  background: rgba(0, 170, 255, .06);
  color: var(--accent);
}

.upload-card:active { transform: translateY(1px); }
.upload-card svg { flex: none; }

.upload-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.upload-title { font-size: 14px; font-weight: 600; color: var(--text); }
.upload-sub { font-size: 12.5px; color: var(--text-3); }

.upload-previews {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(76px, 1fr));
  gap: 8px;
}
.upload-previews:empty { display: none; }

.thumb {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--stroke);
  background: var(--surface-solid);
}

.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

.thumb button {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 20px;
  height: 20px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, .55);
  color: #fff;
  font-size: 13px;
  line-height: 1;
  display: grid;
  place-items: center;
  cursor: pointer;
}
.thumb button:hover { background: rgba(0, 0, 0, .78); }

html[data-theme="dark"] .upload-card { background: rgba(255, 255, 255, .04); }
html[data-theme="dark"] .upload-card:hover { background: rgba(42, 169, 255, .10); }

/* 标题前的置顶/精华标记 */
/* 标题行用 flex，标记和文字靠 align-items 居中 */
.post-item h2,
.thread-head h1 {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.title-text { min-width: 0; }

.title-tag {
  flex: none;
  padding: 0 5px;
  border-radius: 5px;
}
.post-item h2 .title-tag { height: 18px; padding: 0 4px; font-size: 11.5px; border-radius: 4px; }
.thread-head h1 .title-tag { height: 20px; padding: 0 5px; font-size: 12.5px; border-radius: 5px; }

/* ---------- 滚动加载状态 ---------- */
.scroll-status {
  min-height: 34px;
  margin: 18px 0 6px;
  text-align: center;
  font-size: 13.5px;
  color: var(--text-3);
}
.scroll-status.is-end { color: var(--text-3); opacity: .75; }
.scroll-status.is-error { color: #b3261e; cursor: pointer; }
html[data-theme="dark"] .scroll-status.is-error { color: #ff9d95; }

