/* =============================================
   帖子详情页 — post.css
   MXChino 论坛帖子详情（纸张社区版）
   ============================================= */

:root {
  --tb-max: 1480px;
  --tb-font: var(--font-ui);
  --tb-bg: #FAF9F5;
  --tb-card: #ffffff;
  --tb-ink: #141413;
  --tb-muted: #6B665E;
  --tb-border: #E8E6DC;
  --tb-primary: #D97757;
  --tb-primary-weak: rgba(217,119,87,.08);
  --tb-avatar-fallback-bg: transparent;
  --tb-avatar-fallback-border: transparent;
  --tb-link: #4e6ef2;
  --tb-radius: 12px;
}

/* ---- 页面 ---- */
.pd-page {
  font-family: var(--font-ui);
  background-color: var(--tb-bg);
  background-image: url('/assets/paper-texture.png');
  background-repeat: repeat;
  color: var(--tb-ink);
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.6;
}

.pd-container {
  max-width: var(--tb-max);
  margin: 0 auto;
  padding: 24px clamp(18px,3vw,48px) 48px;
}

/* ---- 两栏布局（左帖子 + 右侧预留） ---- */
.pd-layout {
  display: grid;
  grid-template-columns: minmax(0,980px) minmax(280px,360px);
  gap: 28px;
  align-items: start;
}

.pd-main { min-width: 0; }
.pd-sidebar {
  position: sticky;
  top: 96px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.pd-side-card {
  border: 1px solid rgba(23,18,15,.16);
  background: rgba(255,255,255,.78);
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 12px 34px rgba(42,35,28,.06);
  backdrop-filter: blur(2px);
}

.pd-side-card--post {
  background: linear-gradient(145deg,rgba(255,255,255,.9),rgba(247,239,228,.88));
}

.pd-side-card__eyebrow {
  display: inline-flex;
  margin-bottom: 10px;
  padding: 3px 9px;
  border: 1px solid rgba(217,119,87,.28);
  border-radius: 999px;
  background: rgba(217,119,87,.1);
  color: #B85F40;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.pd-side-card h2 {
  margin: 0 0 8px;
  font-size: 20px;
  line-height: 1.25;
  color: var(--tb-ink);
  font-weight: 900;
}

.pd-side-card p {
  margin: 0 0 14px;
  color: #5f5a52;
  font-size: 14px;
  line-height: 1.75;
}

.pd-side-card__btn {
  width: 100%;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #C96442;
  border-radius: 8px;
  background: #D97757;
  color: #fff;
  font-size: 15px;
  font-weight: 800;
  text-decoration: none;
}

.pd-side-card__btn:hover { background: #C96442; }

.pd-side-links {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.pd-side-links a {
  min-height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--tb-border);
  border-radius: 6px;
  background: #fff;
  color: #3f3a34;
  text-decoration: none;
  font-size: 13px;
  font-weight: 700;
}

.pd-side-links a:hover {
  border-color: #D97757;
  color: #B85F40;
}

/* ============================================
   楼层通用（主楼 + 评论楼层共用）
   ============================================ */
.tb-floor {
  display: grid;
  grid-template-columns: 88px minmax(0,1fr);
  gap: 0;
  padding: 0;
  background: var(--tb-card);
  border-bottom: 1px solid #eee8de;
}

.tb-floor--op {
  border-radius: 8px 8px 0 0;
  border-bottom: 1px solid var(--tb-border);
  border: 1px solid rgba(23,18,15,.14);
  border-bottom: none;
  box-shadow: 0 14px 38px rgba(42,35,28,.06);
}

.tb-floor__aside {
  width: auto;
  padding: 18px 10px;
  background: #FBF8F1;
  border-right: 1px solid #eee8de;
  display: flex;
  justify-content: center;
}

.tb-floor__body {
  min-width: 0;
  padding: 18px 22px;
}

/* ---- 头像 ---- */
.tb-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--tb-avatar-fallback-bg);
  border: 0;
  color: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
  position: relative;
  padding: 0;
  box-shadow: none;
}

.tb-avatar img { display:block;width:100%;height:100%;object-fit:contain; }
.tb-avatar__fallback{position:relative;z-index:1}
.tb-avatar--link{text-decoration:none;cursor:pointer}
.tb-avatar--link:hover{transform:translateY(-1px);box-shadow:none}
.tb-avatar--link.is-disabled{pointer-events:none;cursor:default;box-shadow:none;transform:none}

.tb-avatar--sm {
  width: 36px;
  height: 36px;
  padding: 0;
}

/* ---- 楼层 header ---- */
.tb-floor__header {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.tb-floor__name {
  font-size: 15px;
  font-weight: 600;
  color: var(--tb-ink);
}
.tb-floor__name--link{text-decoration:none;transition:color .15s}
.tb-floor__name--link:hover{color:var(--tb-primary)}
.tb-floor__name--link.is-disabled{pointer-events:none}

.tb-floor__meta {
  font-size: 12px;
  color: var(--tb-muted);
}

/* ---- 徽章 ---- */
.tb-badge {
  display: inline-flex;
  align-items: center;
  padding: 1px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
}

.tb-badge--op {
  background: var(--tb-primary-weak);
  color: var(--tb-primary);
}

/* ---- 标题 ---- */
.tb-title {
  font-size: 38px;
  font-weight: 900;
  line-height: 1.22;
  color: var(--tb-ink);
  margin: 8px 0 16px;
  letter-spacing: 0;
}

/* ---- 正文 ---- */
.tb-content {
  font-size: 18px;
  line-height: 2;
  color: #333;
  word-break: break-word;
  margin-bottom: 16px;
}

.tb-content p { margin: 0 0 12px; }
.tb-content p:last-child { margin-bottom: 0; }
.tb-content a { color: var(--tb-link); text-decoration: none; }
.tb-content a:hover { text-decoration: underline; }

.tb-content ul, .tb-content ol { margin: 10px 0; padding-left: 22px; }
.tb-content li { margin-bottom: 4px; }

/* ---- 图片 ---- */
.tb-images {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 16px;
}
.tb-images__item {
  display: block;
  width: auto;
  max-width: min(100%, 520px);
  max-height: 560px;
  border-radius: 8px;
  object-fit: contain;
}

.tb-images img {
  width: auto;
  max-width: 100%;
  margin: 0;
  border-radius: 6px;
  cursor: pointer;
  transition: opacity .15s;
}

.tb-images img:hover { opacity: .9; }

/* ---- 楼层文本（评论楼） ---- */
.tb-floor__text {
  font-size: 16px;
  line-height: 1.85;
  color: #333;
  margin-bottom: 8px;
  word-break: break-word;
}

/* ---- 楼层底部（时间 + 操作） ---- */
.tb-floor__footer {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
}

.tb-floor__footer-spacer { flex: 1; }

.tb-floor__action {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border: none;
  background: none;
  font-size: 12px;
  color: var(--tb-muted);
  cursor: pointer;
  border-radius: 4px;
  transition: all .15s;
}

.tb-floor__action svg { width: 14px; height: 14px; flex-shrink: 0; }

.tb-floor__action:hover {
  color: var(--tb-primary);
  background: var(--tb-primary-weak);
}

.tb-floor__action.is-active {
  color: var(--tb-primary);
}

/* ============================================
   主楼操作栏（转发 / 评论数 / 赞 / 收藏）
   ============================================ */
.tb-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  padding-top: 12px;
  border-top: 1px solid var(--tb-border);
  margin-top: 4px;
}

.tb-actions__btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 14px;
  border: none;
  background: none;
  font-size: 13px;
  color: var(--tb-muted);
  cursor: pointer;
  border-radius: 20px;
  transition: all .15s;
}

.tb-actions__btn[hidden] { display: none; }

.tb-actions__btn svg { width: 16px; height: 16px; flex-shrink: 0; }

.tb-actions__btn:hover {
  color: var(--tb-ink);
  background: #f0f0f0;
}

.tb-actions__btn.is-active {
  color: var(--tb-primary);
}

.tb-actions__btn--more {
  padding: 6px 8px;
  font-size: 16px;
  letter-spacing: 2px;
}

.tb-actions__spacer { flex: 1; }

/* ============================================
   评论区
   ============================================ */
.tb-comments {
  background: rgba(255,255,255,.86);
  border: 1px solid rgba(23,18,15,.14);
  border-top: none;
  border-radius: 0 0 8px 8px;
  overflow: visible;
  box-shadow: 0 14px 38px rgba(42,35,28,.06);
}

/* ---- 评论区 header ---- */
.tb-comments__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--tb-border);
}

.tb-comments__left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.tb-comments__title {
  font-size: 15px;
  font-weight: 600;
  color: var(--tb-ink);
}

.tb-comments__filter {
  padding: 4px 12px;
  border: 1px solid var(--tb-border);
  border-radius: 14px;
  font-size: 12px;
  background: transparent;
  color: var(--tb-muted);
  cursor: pointer;
  transition: all .15s;
}

.tb-comments__filter:hover,
.tb-comments__filter.is-active {
  border-color: var(--tb-primary);
  color: var(--tb-primary);
  background: var(--tb-primary-weak);
}

.tb-comments__sort {
  display: flex;
  align-items: center;
  gap: 2px;
}

.tb-comments__sort-btn {
  padding: 4px 10px;
  border: none;
  background: none;
  font-size: 13px;
  color: var(--tb-muted);
  cursor: pointer;
  border-radius: 4px;
  transition: all .15s;
}

.tb-comments__sort-btn:hover { color: var(--tb-ink); }

.tb-comments__sort-btn.is-active {
  color: var(--tb-ink);
  font-weight: 600;
}

/* ---- 快速回复输入框（贴吧风格） ---- */
.tb-quick-input {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--tb-border);
}

.tb-quick-input__form {
  flex: 1;
  display: flex;
  gap: 8px;
}

.tb-quick-input__field {
  flex: 1;
  padding: 8px 14px;
  border: 1px solid var(--tb-border);
  border-radius: 20px;
  font-size: 13px;
  font-family: inherit;
  background: #f7f7f7;
  color: var(--tb-ink);
  outline: none;
  transition: border-color .15s;
}

.tb-quick-input__field:focus {
  border-color: var(--tb-primary);
  background: #fff;
}

.tb-quick-input__field::placeholder { color: #bbb; }

.tb-quick-input__submit {
  padding: 8px 18px;
  border: none;
  border-radius: 20px;
  background: var(--tb-primary);
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: opacity .15s;
  white-space: nowrap;
}

.tb-quick-input__submit:hover { opacity: .9; }

/* ---- 楼层列表 ---- */
.tb-floor-list .tb-floor {
  border-radius: 0;
}

.tb-floor-list .tb-floor:last-child {
  border-bottom: none;
}

/* ---- 楼中楼（lzl） ---- */
.tb-lzl-list {
  margin: 8px 0;
  padding: 10px 14px;
  background: #f7f8fa;
  border-radius: 8px;
}

.tb-lzl {
  font-size: 13px;
  line-height: 1.7;
  color: #555;
  padding: 4px 0;
}

.tb-lzl__name {
  color: var(--tb-link);
  font-weight: 500;
  cursor: pointer;
}

.tb-lzl__arrow {
  color: var(--tb-muted);
  margin: 0 4px;
  font-size: 12px;
}

.tb-lzl__sep { color: var(--tb-muted); }
.tb-lzl__text { color: #333; }

/* ---- 空状态 ---- */
.tb-empty {
  text-align: center;
  color: #999;
  padding: 32px 0;
  font-size: 14px;
}

/* ---- 已加载全部 ---- */
.tb-comments__end {
  text-align: center;
  color: #ccc;
  font-size: 13px;
  padding: 20px 0;
}

/* ---- 分页 ---- */
.tb-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 16px 0;
}

.tb-pagination__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 34px;
  padding: 0 10px;
  border-radius: 6px;
  font-size: 13px;
  border: 1px solid var(--tb-border);
  background: transparent;
  color: var(--tb-ink);
  cursor: pointer;
  transition: all .15s;
}

.tb-pagination__btn:hover {
  border-color: var(--tb-primary);
  color: var(--tb-primary);
}

.tb-pagination__btn.is-active {
  background: var(--tb-primary);
  color: #fff;
  border-color: var(--tb-primary);
}

.tb-pagination__btn:disabled {
  opacity: .4;
  cursor: not-allowed;
}

/* ---- 底部发帖框 ---- */
.tb-bottom-reply {
  display: flex;
  gap: 12px;
  padding: 20px;
  margin-top: 16px;
  background: var(--tb-card);
  border-radius: var(--tb-radius);
}

.tb-bottom-reply__form {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.tb-bottom-reply__textarea {
  width: 100%;
  min-height: 80px;
  padding: 12px;
  border: 1px solid var(--tb-border);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  line-height: 1.6;
  resize: vertical;
  background: #f7f7f7;
  color: var(--tb-ink);
  outline: none;
  box-sizing: border-box;
  transition: border-color .15s;
}

.tb-bottom-reply__textarea:focus {
  border-color: var(--tb-primary);
  background: #fff;
}

.tb-bottom-reply__textarea::placeholder { color: #bbb; }

.tb-bottom-reply__footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

/* ---- 内联回复框 ---- */
.tb-inline-reply {
  margin-top: 10px;
  padding: 10px 0;
}

.tb-inline-reply__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
  font-size: 13px;
  color: var(--tb-muted);
}

.tb-inline-reply__cancel {
  background: none;
  border: none;
  color: var(--tb-muted);
  cursor: pointer;
  font-size: 12px;
  padding: 2px 6px;
}

.tb-inline-reply__cancel:hover { color: var(--tb-primary); }

.tb-inline-reply textarea {
  width: 100%;
  min-height: 60px;
  padding: 8px 10px;
  border: 1px solid var(--tb-border);
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
  line-height: 1.5;
  resize: vertical;
  background: #f7f7f7;
  color: var(--tb-ink);
  outline: none;
  box-sizing: border-box;
}

.tb-inline-reply textarea:focus {
  border-color: var(--tb-primary);
  background: #fff;
}

.tb-inline-reply__actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 6px;
}

/* ---- 通用按钮 ---- */
.tb-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 7px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  border: 1px solid var(--tb-border);
  background: transparent;
  color: var(--tb-ink);
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
  text-decoration: none;
}

.tb-btn:hover {
  border-color: var(--tb-primary);
  color: var(--tb-primary);
}

.tb-btn--primary {
  background: var(--tb-primary);
  color: #fff;
  border-color: var(--tb-primary);
}

.tb-btn--primary:hover { opacity: .9; color: #fff; }

.tb-btn--sm { padding: 5px 12px; font-size: 12px; }

.tb-btn--outline {
  border: 1px solid var(--tb-primary);
  color: var(--tb-primary);
  background: transparent;
  border-radius: 16px;
  padding: 4px 14px;
  font-size: 12px;
}

.tb-btn--outline:hover {
  background: var(--tb-primary-weak);
}

.tb-btn--block {
  display: flex;
  width: 100%;
  justify-content: center;
  padding: 10px;
  border-radius: 8px;
  background: var(--tb-primary);
  color: #fff;
  border: none;
  font-size: 14px;
  font-weight: 500;
}

.tb-btn--block:hover { opacity: .9; color: #fff; }

/* ============================================
   右侧栏
   ============================================ */
.pd-sidebar {
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: sticky;
  top: 80px;
}

/* ---- 论坛信息卡（对标贴吧"吧信息"） ---- */
.tb-bar-card {
  background: var(--tb-card);
  border-radius: var(--tb-radius);
  padding: 20px;
}

.tb-bar-card__top {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.tb-bar-card__avatar {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: linear-gradient(135deg, #D97757, #e8956e);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 700;
  flex-shrink: 0;
}

.tb-bar-card__info { flex: 1; min-width: 0; }

.tb-bar-card__name {
  font-size: 16px;
  font-weight: 700;
  color: var(--tb-ink);
  margin-bottom: 2px;
}

.tb-bar-card__stats {
  display: flex;
  gap: 14px;
  font-size: 12px;
  color: var(--tb-muted);
}

.tb-bar-card__stats strong {
  color: var(--tb-ink);
  font-weight: 600;
}

.tb-bar-card__meta {
  font-size: 12px;
  color: var(--tb-muted);
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--tb-border);
}

.tb-bar-card__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.tb-tag {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 12px;
  background: #f0f0f0;
  color: var(--tb-muted);
}

.tb-bar-card__desc {
  font-size: 13px;
  line-height: 1.6;
  color: #666;
  margin-bottom: 14px;
}

/* ---- 侧边卡片（相关推荐等） ---- */
.tb-side-card {
  background: var(--tb-card);
  border-radius: var(--tb-radius);
  overflow: hidden;
}

.tb-side-card__header {
  padding: 14px 16px;
  font-size: 14px;
  font-weight: 600;
  color: var(--tb-ink);
  border-bottom: 1px solid var(--tb-border);
}

.tb-side-card__body {
  padding: 4px 16px;
}

/* ---- 推荐列表 ---- */
.tb-recommend__item {
  display: block;
  padding: 10px 0;
  border-bottom: 1px solid #f0f0ee;
  text-decoration: none;
  transition: opacity .1s;
}

.tb-recommend__item:last-child { border-bottom: none; }
.tb-recommend__item:hover { opacity: .75; }

.tb-recommend__title {
  font-size: 13px;
  font-weight: 500;
  color: var(--tb-ink);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 3px;
}

.tb-recommend__time {
  font-size: 11px;
  color: var(--tb-muted);
}

/* ============================================
   Lightbox
   ============================================ */
.pd-lightbox {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0,0,0,.85);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
}

.pd-lightbox.is-open { opacity: 1; pointer-events: auto; }

.pd-lightbox__img {
  max-width: 90vw;
  max-height: 90vh;
  border-radius: 8px;
  box-shadow: 0 8px 40px rgba(0,0,0,.4);
}

.pd-lightbox__close {
  position: absolute;
  top: 20px;
  right: 24px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255,255,255,.15);
  border: none;
  color: #fff;
  font-size: 24px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s;
}

.pd-lightbox__close:hover { background: rgba(255,255,255,.3); }

/* ============================================
   楼主联系方式弹层
   ============================================ */
.pd-contact-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.pd-contact-modal[hidden] { display: none; }

.pd-contact-modal__bg {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, .5);
}

.pd-contact-modal__panel {
  position: relative;
  width: min(92vw, 440px);
  max-height: 84vh;
  overflow-y: auto;
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 14px 38px rgba(0, 0, 0, .22);
}

.pd-contact-modal__close {
  position: absolute;
  top: 10px;
  right: 12px;
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 50%;
  background: #f1f1f1;
  color: #666;
  font-size: 18px;
  cursor: pointer;
  line-height: 1;
}

.pd-contact-modal__close:hover {
  background: #e6e6e6;
  color: #222;
}

.pd-contact-modal__title {
  margin: 0 34px 14px 0;
  font-size: 18px;
  font-weight: 700;
  color: var(--tb-ink);
}

.pd-contact-modal__content {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pd-contact-modal__state {
  font-size: 14px;
  color: var(--tb-muted);
  line-height: 1.7;
}

.pd-contact-modal__state a {
  color: var(--tb-primary);
  text-decoration: underline;
}

.pd-contact-item {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: space-between;
  border: 1px solid var(--tb-border);
  border-radius: 10px;
  padding: 10px 12px;
  background: #fff;
}

.pd-contact-item__meta {
  min-width: 0;
  flex: 1;
}

.pd-contact-item__label {
  font-size: 12px;
  color: var(--tb-muted);
}

.pd-contact-item__value {
  margin-top: 2px;
  font-size: 14px;
  color: #222;
  font-weight: 600;
  word-break: break-all;
}

.pd-contact-item__copy {
  border: 1px solid var(--tb-primary);
  border-radius: 999px;
  background: #fff;
  color: var(--tb-primary);
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  cursor: pointer;
  white-space: nowrap;
}

.pd-contact-item__copy:hover {
  background: var(--tb-primary-weak);
}

.pd-contact-modal__actions {
  margin-top: 14px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.pd-edit-modal {
  position: fixed;
  inset: 0;
  z-index: 10020;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 52px 16px 20px;
}

.pd-edit-modal[hidden] { display: none; }

.pd-edit-modal__bg {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, .58);
}

.pd-edit-modal__panel {
  position: relative;
  width: min(92vw, 560px);
  max-height: calc(100vh - 84px);
  overflow-y: auto;
  background: #fff;
  border-radius: 10px;
  padding: 24px;
  box-shadow: 0 18px 60px rgba(0, 0, 0, .32);
}

.pd-edit-modal__close {
  position: absolute;
  top: 10px;
  right: 12px;
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 50%;
  background: #f1f1f1;
  color: #666;
  font-size: 18px;
  cursor: pointer;
  line-height: 1;
}

.pd-edit-modal__close:hover {
  background: #e6e6e6;
  color: #222;
}

.pd-edit-modal__title {
  margin: 0 34px 18px 0;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--tb-border);
  font-size: 20px;
  font-weight: 800;
  color: var(--tb-ink);
}

.pd-edit-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.pd-edit-form__field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
  color: var(--tb-ink);
}

.pd-edit-form__field input,
.pd-edit-form__field textarea {
  width: 100%;
  border: 1px solid var(--tb-border);
  border-radius: 6px;
  padding: 10px 12px;
  background: #fff;
  color: var(--tb-ink);
  font: inherit;
}

.pd-edit-form__field textarea {
  min-height: 150px;
  resize: vertical;
}

.pd-edit-upload {
  display: flex;
  min-height: 58px;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  border: 1px dashed #d7cbbf;
  border-radius: 8px;
  background: #fff;
  padding: 10px 12px;
  cursor: pointer;
  transition: border-color .15s, background .15s, box-shadow .15s;
}

.pd-edit-upload:hover,
.pd-edit-upload.is-dragover {
  border-color: var(--tb-primary);
  background: var(--tb-primary-weak);
  box-shadow: 0 0 0 3px rgba(217, 119, 87, .12);
}

.pd-edit-upload input { display: none; }
.pd-edit-upload strong { font-size: 13px; }
.pd-edit-upload em {
  font-style: normal;
  font-size: 12px;
  color: var(--tb-muted);
}

.pd-edit-preview {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 8px;
}

.pd-edit-preview__item {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  border: 1px solid var(--tb-border);
  border-radius: 7px;
  background: #f8f6f1;
}

.pd-edit-preview__item img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.pd-edit-preview__remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, .68);
  color: #fff;
  font-size: 16px;
  line-height: 24px;
  cursor: pointer;
}

.pd-edit-form__msg {
  min-height: 18px;
  font-size: 13px;
  color: var(--tb-muted);
}

.pd-edit-form__msg.is-error { color: #c0392b; }

.pd-edit-form__actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 2px;
}

/* ============================================
   响应式
   ============================================ */
@media (max-width: 960px) {
  .pd-layout {
    grid-template-columns: 1fr;
  }

  .pd-sidebar {
    position: static;
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 640px) {
  .pd-container {
    padding: 12px 14px 32px;
  }

  .tb-floor {
    grid-template-columns: 1fr;
  }

  .tb-floor__aside {
    width: auto;
    justify-content: flex-start;
    border-right: none;
    border-bottom: 1px solid #eee8de;
    padding: 14px 16px;
  }

  .tb-floor__body { padding: 14px 16px; }
  .tb-avatar { width: 36px; height: 36px; font-size: 14px; }
  .pd-edit-modal { padding-top: 24px; }
  .pd-edit-modal__panel { width: 95vw; max-height: calc(100vh - 48px); padding: 20px; }
  .pd-edit-preview { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .tb-title { font-size: 27px; }
  .tb-content { font-size: 16px; }

  .tb-actions { flex-wrap: wrap; }
  .tb-actions__btn { padding: 5px 10px; font-size: 12px; }

  .tb-comments__header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    padding: 12px 16px;
  }

  .tb-quick-input { padding: 10px 16px; }

  .tb-bottom-reply { padding: 14px 16px; }

  .tb-bar-card { padding: 16px; }

  .pd-sidebar { grid-template-columns: 1fr; gap: 12px; }
  .pd-side-links { grid-template-columns: 1fr; }
}
