.reply-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-top: 16px;
  box-shadow: var(--shadow-sm);
  position: relative;
}
.reply-box h3 { font-size: 14px; margin: 0 0 12px; display: flex; align-items: center; gap: 8px; }
.reply-toolbar {
  display: flex;
  gap: 6px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  background: var(--surface-2);
  border-bottom: none;
}
.reply-toolbar button {
  border: none;
  background: transparent;
  padding: 4px 10px;
  cursor: pointer;
  border-radius: 4px;
  color: var(--text-muted);
  font-size: 13px;
  font-family: var(--font);
}
.reply-toolbar button:hover { background: var(--surface); color: var(--primary); }

/* Emoji 选择面板 */
.jx-emoji-panel {
  position: absolute;
  top: 100%;
  left: 8px;
  z-index: 50;
  margin-top: 4px;
  width: 320px;
  max-height: 240px;
  overflow-y: auto;
  padding: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 2px;
}
.jx-emoji-panel .jx-emoji-item {
  border: none;
  background: transparent;
  padding: 4px 0;
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
  border-radius: 4px;
  color: inherit;
  font-family: inherit;
}
.jx-emoji-panel .jx-emoji-item:hover { background: var(--surface-2); }
/* 游客提示条 */
.jx-guest-notice {
  padding: 10px 14px;
  margin-bottom: 12px;
  background: linear-gradient(90deg, rgba(59,130,246,.08), rgba(139,92,246,.08));
  border-left: 3px solid var(--primary);
  border-radius: 6px;
  font-size: 13px;
}

/* 游客昵称 / 邮箱。input 的默认 min-content 宽度约 180px，
   若不显式给 min-width:0，两列并排会撑破窄屏容器。 */
.guest-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}
.guest-fields input {
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  outline: none;
}
.guest-fields input:focus { border-color: var(--primary); }

.reply-box textarea {
  width: 100%;
  min-height: 100px;
  border: 1px solid var(--border);
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  padding: 12px;
  font-family: var(--font);
  font-size: 14px;
  background: var(--surface);
  color: var(--text);
  resize: vertical;
  outline: none;
  display: block;
  box-sizing: border-box;
}
.reply-box textarea:focus { border-color: var(--primary); }
.reply-footer { margin-top: 12px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.reply-footer .hint { font-size: 12px; color: var(--text-faint); }
.reply-footer .right { margin-left: auto; }

.reply-box [data-jx-feedback].success { color: var(--accent-green); }
.reply-box [data-jx-feedback].error { color: var(--accent-red); }

/* 主题标题输入：与工具栏/正文区分开，独立卡片式，更显眼 */
.jx-topic-title-field {
  margin-bottom: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  border-left: 3px solid var(--primary);
}
.jx-topic-title-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: .04em;
  text-transform: uppercase;
  margin-bottom: 6px;
}
.jx-topic-title-input {
  width: 100%;
  padding: 6px 0;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 18px;
  font-weight: 600;
  font-family: var(--font);
  outline: none;
  box-sizing: border-box;
}
.jx-topic-title-input::placeholder { color: var(--text-faint); font-weight: 400; }

/* 字段提示行（长度提示 + 实时计数） */
.jx-field-tips {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-faint);
}
.jx-field-tips .jx-field-counter { font-variant-numeric: tabular-nums; }
.jx-field-tips .jx-field-counter.is-over { color: var(--accent-red, #ef4444); }
.jx-topic-title-field .jx-field-tips { margin-top: 6px; }

/* 验证码行：论坛回复与 WP 原生评论共用同一套外观（胶囊卡片） */
.jx-captcha-row {
  margin-top: 12px;
  padding: 8px 12px;
  display: inline-flex;
  gap: 10px;
  align-items: center;
  font-size: 13px;
  flex-wrap: wrap;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  max-width: 100%;
  box-sizing: border-box;
}
.jx-captcha-row .jx-captcha-q {
  color: var(--text);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: .02em;
}
.jx-captcha-row .jx-captcha-answer {
  width: 72px;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  outline: none;
  text-align: center;
  -moz-appearance: textfield;
}
.jx-captcha-row .jx-captcha-answer::-webkit-outer-spin-button,
.jx-captcha-row .jx-captcha-answer::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.jx-captcha-row .jx-captcha-answer:focus { border-color: var(--primary); }
.jx-captcha-row .jx-captcha-refresh {
  font-size: 12px;
  color: var(--text-muted);
  text-decoration: none;
}
.jx-captcha-row .jx-captcha-refresh:hover { color: var(--primary); }

/* WP 原生评论表单里的验证码行取消 <p> 继承的默认 margin */
.jx-comments .comment-form-captcha.jx-captcha-row { margin: 12px 0 0; }

/* 回复框顶部的"回复中"引用条 */
.jx-quote-strip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  margin-bottom: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--primary);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-muted);
}
.jx-quote-strip[hidden] { display: none; }
.jx-quote-strip-icon { color: var(--primary); display: inline-flex; }
.jx-quote-strip-text {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text);
}
.jx-quote-strip-close {
  border: none;
  background: transparent;
  color: var(--text-faint);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
}
.jx-quote-strip-close:hover { color: var(--accent-red, #ef4444); }

@media (max-width: 900px) {
  .reply-box { padding: 14px 12px; }
  .reply-box textarea { font-size: 16px; padding: 10px; }
  .guest-fields input { font-size: 16px; }
  .jx-topic-title-field { padding: 10px 12px; }
  /* 16px 起步，否则 iOS 聚焦时会放大整页 */
  .jx-topic-title-input { font-size: 17px; }
  .reply-toolbar { flex-wrap: wrap; }
  .reply-footer { gap: 8px; }
  .reply-footer .right { margin-left: auto; }
  .jx-captcha-row { display: flex; width: 100%; }
  .jx-captcha-row .jx-captcha-answer { font-size: 16px; }

  /* 固定 320px 会撑破窄屏：改为贴合回复框左右边界 */
  .jx-emoji-panel {
    left: 8px;
    right: 8px;
    width: auto;
    grid-template-columns: repeat(7, 1fr);
  }
}
@media (max-width: 480px) {
  .guest-fields { grid-template-columns: 1fr; gap: 8px; }
  .jx-emoji-panel { grid-template-columns: repeat(6, 1fr); max-height: 200px; }
  .jx-emoji-panel .jx-emoji-item { font-size: 20px; }
  .reply-toolbar button { padding: 4px 8px; }
}
