/* =========================================================
   text-prompts.css —— 首页「文字提示词」模块
   全部用站内 CSS 变量，自动跟随浅色 / 深色 / 图片主题。
   ========================================================= */

/* ---------- 顶部分类 tabs ---------- */
.tp-tabs {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 14px; flex-wrap: wrap;
}
.tp-tabs__group {
  display: inline-flex; align-items: center; gap: 2px;
  padding: 3px; border-radius: var(--radius-pill);
  background: var(--surface-2);
  border: 1px solid var(--line);
}
.tp-tabs__btn {
  border: 0; background: transparent; cursor: pointer;
  padding: 7px 16px; border-radius: var(--radius-pill);
  font-size: 13.5px; font-weight: 600; font-family: inherit;
  color: var(--text-2);
  transition: all .22s var(--ease-out);
  white-space: nowrap;
}
.tp-tabs__btn:hover { color: var(--brand); }
.tp-tabs__btn.is-active {
  background: var(--grad-brand);
  color: #fff;
  box-shadow: var(--shadow-brand);
}
.tp-tabs__count {
  font-size: 11.5px; font-weight: 700; margin-left: 6px;
  opacity: .75; font-variant-numeric: tabular-nums;
}

.tp-submit {
  margin-left: auto;
  display: inline-flex; align-items: center; gap: 7px;
  height: 36px; padding: 0 18px;
  border-radius: var(--radius-pill);
  border: 1.5px solid var(--brand);
  background: transparent; color: var(--brand);
  font-size: 13.5px; font-weight: 700; font-family: inherit;
  cursor: pointer; transition: all .22s var(--ease-out);
}
.tp-submit svg { width: 16px; height: 16px; }
.tp-submit:hover {
  background: var(--brand); color: #fff;
  transform: translateY(-2px);
  box-shadow: var(--shadow-brand);
}

/* ---------- 提示词卡片网格 ---------- */
.tp-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(268px, 1fr));
  gap: 16px;
  /* 关键：不让同排卡片互相拉平高度，展开某张卡时其余卡片保持自身高度 */
  align-items: start;
}

/* ---------- 卡片 ---------- */
.tp-card {
  position: relative;
  display: flex; flex-direction: column;
  border-radius: var(--radius-lg, 16px);
  background: var(--surface);
  border: 1.5px solid var(--line);
  overflow: hidden;
  transition: transform .26s var(--ease-out), border-color .26s var(--ease-out), box-shadow .26s var(--ease-out);
  animation: tpCardIn .5s var(--ease-out) both;
}
@keyframes tpCardIn {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}
.tp-card:hover {
  transform: translateY(-4px);
  border-color: var(--brand);
  box-shadow: 0 14px 32px rgba(0, 0, 0, .10);
}

/* 顶部预览区：显示标题大字 + 摘要 */
.tp-card__preview {
  position: relative;
  padding: 20px 18px 16px;
  min-height: 92px;
  display: flex; flex-direction: column; justify-content: center;
  background: linear-gradient(135deg, var(--brand-soft), var(--surface));
  border-bottom: 1.5px solid var(--line);
}
.tp-card__type {
  position: absolute; top: 12px; right: 12px;
  font-size: 11px; font-weight: 700; letter-spacing: .3px;
  padding: 2px 9px; border-radius: var(--radius-pill);
  background: var(--surface); color: var(--brand);
  border: 1px solid var(--line);
}
.tp-card__type--image { color: var(--accent-600); }
.tp-card__title {
  font-size: 19px; font-weight: 800; letter-spacing: -.4px;
  color: var(--text);
  padding-right: 62px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tp-card__excerpt {
  margin-top: 6px; font-size: 12.5px; line-height: 1.6;
  color: var(--text-3);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}

/* 主体信息 */
.tp-card__body {
  padding: 12px 18px 14px;
  display: flex; flex-direction: column; gap: 10px;
  flex: 1;
}
.tp-card__tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tp-tag {
  font-size: 11px; font-weight: 600;
  padding: 2px 9px; border-radius: var(--radius-pill);
  background: var(--brand-soft); color: var(--brand);
}
.tp-tag--user { background: var(--surface-2); color: var(--text-2); }

.tp-card__foot {
  display: flex; align-items: center; gap: 8px;
  margin-top: auto; padding-top: 4px;
  font-size: 12px; color: var(--text-3);
}
.tp-card__author { color: var(--text-2); font-weight: 600; }
.tp-card__date { color: var(--text-3); }

.tp-card__toggle {
  margin-left: auto;
  display: inline-flex; align-items: center; gap: 4px;
  border: 0; background: transparent; cursor: pointer;
  font-size: 12.5px; font-weight: 700; font-family: inherit;
  color: var(--brand); padding: 4px 0;
}
.tp-card__toggle svg {
  width: 14px; height: 14px;
  transition: transform .26s var(--ease-out);
}
.tp-card.is-open .tp-card__toggle svg { transform: rotate(90deg); }

/* 展开后的完整正文 */
.tp-card__full {
  display: none;
  padding: 0 18px 16px;
}
.tp-card.is-open .tp-card__full { display: block; }
.tp-card__full-inner {
  padding: 14px 16px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-size: 13px; line-height: 1.85;
  color: var(--text-2);
  white-space: pre-wrap; word-break: break-word;
  max-height: 340px; overflow-y: auto;
}
.tp-card__full-inner::-webkit-scrollbar { width: 6px; }
.tp-card__full-inner::-webkit-scrollbar-thumb {
  background: var(--line); border-radius: 3px;
}
.tp-card__copy {
  display: inline-flex; align-items: center; gap: 6px;
  margin-top: 10px;
  height: 30px; padding: 0 14px;
  border-radius: var(--radius-pill);
  border: 1.5px solid var(--brand);
  background: transparent; color: var(--brand);
  font-size: 12.5px; font-weight: 700; font-family: inherit;
  cursor: pointer; transition: all .2s var(--ease-out);
}
.tp-card__copy svg { width: 14px; height: 14px; }
.tp-card__copy:hover { background: var(--brand); color: #fff; }
.tp-card__copy.is-done { background: var(--brand); color: #fff; }

/* 空状态 / 加载 */
.tp-empty {
  grid-column: 1 / -1;
  padding: 48px 20px; text-align: center;
  color: var(--text-3); font-size: 14px;
}
.tp-empty b { display: block; font-size: 15px; color: var(--text-2); margin-bottom: 6px; }

/* ---------- 投稿弹窗 ---------- */
.tp-modal {
  position: fixed; inset: 0; z-index: 9000;
  display: grid; place-items: center;
  padding: 20px;
  background: rgba(0, 0, 0, .45);
  backdrop-filter: blur(4px);
  animation: tpFade .22s ease both;
}
.tp-modal[hidden] { display: none; }
@keyframes tpFade { from { opacity: 0 } to { opacity: 1 } }

.tp-modal__panel {
  width: min(640px, 100%);
  max-height: min(86vh, 760px);
  overflow-y: auto;
  border-radius: 18px;
  background: var(--surface);
  border: 1.5px solid var(--line);
  box-shadow: 0 24px 64px rgba(0, 0, 0, .28);
  animation: tpPop .28s var(--ease-out) both;
}
@keyframes tpPop {
  from { opacity: 0; transform: translateY(20px) scale(.97); }
  to   { opacity: 1; transform: none; }
}
.tp-modal__head {
  display: flex; align-items: center; gap: 10px;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--line);
}
.tp-modal__head h3 { margin: 0; font-size: 18px; font-weight: 800; }
.tp-modal__head p { margin: 3px 0 0; font-size: 12.5px; color: var(--text-3); }
.tp-modal__close {
  margin-left: auto;
  width: 32px; height: 32px; border-radius: 50%;
  border: 0; background: var(--surface-2); color: var(--text-2);
  font-size: 15px; line-height: 1; cursor: pointer;
  transition: all .2s var(--ease-out);
}
.tp-modal__close:hover { background: var(--brand); color: #fff; transform: rotate(90deg); }

.tp-form { padding: 20px 24px 24px; }
.tp-field { margin-bottom: 16px; }
.tp-field > label {
  display: block; margin-bottom: 7px;
  font-size: 13px; font-weight: 700; color: var(--text-2);
}
.tp-field > label em { color: var(--brand); font-style: normal; }
.tp-field input[type=text],
.tp-field select,
.tp-field textarea {
  width: 100%;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  font-family: inherit; font-size: 14px;
  padding: 10px 13px;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.tp-field textarea {
  min-height: 170px; resize: vertical; line-height: 1.75;
}
.tp-field input:focus, .tp-field select:focus, .tp-field textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}
.tp-field__hint { margin-top: 6px; font-size: 11.5px; color: var(--text-3); }
.tp-field__count { float: right; font-size: 11.5px; color: var(--text-3); font-variant-numeric: tabular-nums; }

.tp-type-row { display: flex; gap: 8px; flex-wrap: wrap; }
.tp-type {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: var(--radius-pill);
  border: 1.5px solid var(--line); background: var(--bg);
  font-size: 13px; font-weight: 600; font-family: inherit;
  color: var(--text-2); cursor: pointer; transition: all .2s var(--ease-out);
}
.tp-type.is-active {
  border-color: var(--brand); background: var(--brand-soft); color: var(--brand);
}

.tp-form__foot {
  display: flex; align-items: center; gap: 12px;
  padding-top: 4px;
}
.tp-form__msg { font-size: 13px; color: var(--text-3); flex: 1; }
.tp-form__msg.is-err { color: #E23D3D; }
.tp-form__msg.is-ok { color: #16A34A; }
.tp-btn {
  height: 38px; padding: 0 22px; border-radius: var(--radius-pill);
  border: 1.5px solid var(--line); background: var(--bg);
  color: var(--text-2); font-size: 13.5px; font-weight: 700; font-family: inherit;
  cursor: pointer; transition: all .2s var(--ease-out);
}
.tp-btn:hover { border-color: var(--brand); color: var(--brand); }
.tp-btn--primary {
  background: var(--grad-brand); border-color: transparent; color: #fff;
  box-shadow: var(--shadow-brand);
}
.tp-btn--primary:hover { color: #fff; transform: translateY(-2px); }
.tp-btn:disabled { opacity: .55; cursor: not-allowed; transform: none !important; }

/* ---------- 响应式 ---------- */
@media (max-width: 760px) {
  .tp-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
  .tp-card__preview { padding: 16px 14px 13px; min-height: 76px; }
  .tp-card__title { font-size: 16px; padding-right: 0; }
  .tp-card__type { position: static; align-self: flex-start; margin-bottom: 6px; }
  .tp-card__body { padding: 10px 14px 12px; gap: 8px; }
  .tp-card__full { padding: 0 14px 14px; }
  .tp-card__full-inner { font-size: 12.5px; max-height: 260px; }
  .tp-submit { margin-left: 0; width: 100%; justify-content: center; }
  .tp-tabs { gap: 8px; }
  .tp-tabs__group { width: 100%; justify-content: space-between; }
  .tp-tabs__btn { flex: 1; padding: 7px 8px; font-size: 12.5px; }
  .tp-modal__panel { border-radius: 14px; }
  .tp-form { padding: 16px 18px 20px; }
}
