/* 文生图页面样式（复用 style.css 的小清新主题变量） */
body.kp-page .topbar { max-width: 1180px; }
main.kp-main { max-width: 1180px; padding-top: 4px; }
body.kp-locked { overflow: hidden; }

/* 图片栏目切换（Krea2 / Qwen） */
.kp-tabs {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #f5faf8;
}
.kp-tab {
  padding: 7px 14px;
  border-radius: 9px;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 700;
  text-decoration: none;
  transition: color .16s ease, background .16s ease;
}
.kp-tab:hover { color: var(--text); }
.kp-tab.is-active {
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--primary-deep));
}
@media (max-width: 720px) {
  .kp-tabs { display: none; }
}

.kp-grid {
  display: grid;
  grid-template-columns: 430px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}
/* 右列：上方生成结果，下方历史记录 */
.kp-right {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}
.kp-right .card { margin-top: 0; }
.kp-stage {
  min-height: 600px;
  display: flex;
  flex-direction: column;
}

/* ---------- 参数区 ---------- */
.field { margin-top: 14px; }
.field-label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 7px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.seed-row { display: flex; gap: 8px; }
.seed-row .input { flex: 1 1 auto; min-width: 0; }
select.input { cursor: pointer; }
textarea.input { resize: vertical; line-height: 1.65; }
input[type="range"] {
  width: 100%;
  accent-color: var(--primary);
  margin: 10px 0 2px;
}
.res-line { margin-top: 10px; }
.kp-cost { margin-top: 6px; font-size: 13px; color: var(--muted); }
.kp-cost.insufficient { color: var(--err); }

/* ---------- 风格选择 ---------- */
.style-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 18px;
}
.style-head .field-label { margin: 0; }
.style-search { max-width: 190px; padding: 8px 11px; font-size: 13px; }
.sel-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; min-height: 18px; }
.sel-chip {
  border: 1px solid #bfe8d6;
  background: #eafaf2;
  color: #0b7a56;
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 12px;
  cursor: pointer;
  font-family: inherit;
  transition: background .15s ease;
}
.sel-chip:hover { background: #d9f5e7; }

.style-grid-wrap {
  margin-top: 9px;
  max-height: 420px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fbfefc;
  padding: 10px 10px 12px;
}
.style-section {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: .4px;
  margin: 12px 2px 8px;
}
.style-section:first-child { margin-top: 2px; }
.style-grid-inner {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(86px, 1fr));
  gap: 8px;
}
.style-item {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 5px 5px 6px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  font-family: inherit;
  transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}
.style-item:hover {
  border-color: #b9d9cc;
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(16, 74, 58, .08);
}
.style-item img,
.style-ph {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 7px;
  background: var(--bg-soft);
  display: block;
}
.style-item span {
  font-size: 11.5px;
  line-height: 1.25;
  color: var(--text);
  text-align: center;
  height: 2.5em;
  overflow: hidden;
}
.style-item.sel {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(16, 185, 129, .22);
}
.style-item.sel::after {
  content: "✓";
  position: absolute;
  top: 4px;
  right: 5px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 11px;
  line-height: 18px;
  text-align: center;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .2);
}
.style-empty { padding: 16px 6px; }

.kp-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 18px;
  flex-wrap: wrap;
}
.kp-actions .btn.primary { min-width: 150px; }
.kp-actions .msg { margin: 0; }

/* ---------- 结果区 ---------- */
.stage-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--muted);
  min-height: 500px;
}
.stage-glyph {
  width: 74px;
  height: 74px;
  border-radius: 24px;
  background: linear-gradient(135deg, #eafaef, #e6f7ff);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  box-shadow: inset 0 0 0 1px #d7eee4;
}
.stage-busy {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 500px;
  text-align: center;
}
.spinner {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 3px solid #d9f0e7;
  border-top-color: var(--primary);
  animation: kp-spin .9s linear infinite;
}
@keyframes kp-spin { to { transform: rotate(360deg); } }
.busy-text { font-size: 14px; font-weight: 600; }
.stage-done { display: flex; flex-direction: column; gap: 4px; }
.result-img {
  width: 100%;
  height: auto;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--bg-soft);
}
.result-meta { font-size: 12.5px; color: var(--muted); line-height: 1.7; margin-top: 10px; }
.stage-actions { margin-top: 12px; flex-wrap: wrap; }

/* ---------- 历史记录 ---------- */
/* 行结构与视频站同构：.history-item（列）内第一行 .h-main 横向放缩略图/时间/状态/提示词，第二行放参数 */
.kp-history { min-width: 0; }
.kp-history .h-main .h-prompt { flex: 1 1 220px; min-width: 0; }
.kp-h-thumb {
  width: 48px;
  height: 48px;
  border-radius: 9px;
  object-fit: cover;
  border: 1px solid var(--border);
  background: var(--bg-soft);
  flex-shrink: 0;
  cursor: zoom-in;
}
.kp-h-thumb.ph {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 11px;
  cursor: default;
}
.kp-h-meta { color: var(--muted); font-size: 12px; white-space: nowrap; }

/* 提示词悬浮框：本页使用浅色主题 */
.kp-page .prompt-tip {
  background: #fff;
  color: var(--text);
  border: 1px solid #bfe0d2;
  border-radius: 12px;
  box-shadow: 0 12px 30px rgba(16, 74, 58, .16);
}
.kp-page .prompt-tip-foot { border-top-color: var(--border); }
.kp-page .prompt-tip-hint { color: var(--muted); }
.kp-page .prompt-tip-copy {
  border-color: #bfe0d2;
  background: #f3fbf7;
  color: var(--primary-deep);
}
.kp-page .prompt-tip-copy:hover { background: #e7f7ef; }
.kp-page .prompt-tip.prompt-tip-copied {
  border-color: var(--primary);
  box-shadow: 0 12px 30px rgba(30, 138, 104, .22);
}
.kp-page .prompt-tip-anchor { cursor: copy; }

@media (max-width: 640px) {
  .kp-history .history-item { gap: 8px; }
  .kp-h-meta { white-space: normal; }
}

/* ---------- 账号登录 ---------- */
.kp-gate {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(15, 45, 36, .38);
  backdrop-filter: blur(5px);
}
.kp-gate-card { width: min(460px, 100%); }
.kp-gate-row { margin-top: 14px; }
.kp-gate-row .input { flex: 1 1 auto; min-width: 0; }
.kp-gate-actions { margin-top: 10px; }

@media (max-width: 960px) {
  .kp-grid { grid-template-columns: 1fr; }
  .kp-stage { min-height: 420px; }
  .stage-empty, .stage-busy { min-height: 320px; }
  .field-row { grid-template-columns: 1fr; }
}
