:root {
  --pink: #ff2e63;
  --pink-soft: #ff6b9d;
  --bg: #fff5f7;
  --card: #ffffff;
  --ink: #2b2330;
  --muted: #8a8190;
  --line: #f0d9e2;
  --shadow: 0 8px 28px rgba(255, 46, 99, 0.10);
  --radius: 16px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.wrap { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 18px; }

/* 顶栏 */
.topbar {
  background: linear-gradient(135deg, var(--pink) 0%, var(--pink-soft) 100%);
  color: #fff;
  padding: 22px 0;
  box-shadow: var(--shadow);
}
.topbar .wrap { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 14px; }
.logo {
  font-size: 38px; line-height: 1;
  background: rgba(255, 255, 255, 0.22);
  border-radius: 14px; padding: 8px 10px;
}
.topbar h1 { margin: 0; font-size: 22px; letter-spacing: 0.3px; }
.tagline { margin: 4px 0 0; font-size: 13.5px; opacity: 0.94; }
.badge {
  font-size: 12.5px; background: rgba(255, 255, 255, 0.2);
  padding: 6px 12px; border-radius: 999px; white-space: nowrap;
}

/* 布局 */
.layout {
  display: grid;
  grid-template-columns: 400px 1fr;
  gap: 22px;
  padding-top: 24px;
  padding-bottom: 10px;
  align-items: start;
}

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}
.input-panel { position: sticky; top: 18px; }

.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin-bottom: 16px; flex-wrap: wrap;
}
.panel-head h2 { margin: 0; font-size: 16px; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* 表单 */
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.field small { font-weight: 400; color: var(--muted); margin-left: 4px; }
.field input, .field textarea, .field select {
  width: 100%; padding: 11px 12px;
  border: 1.5px solid var(--line); border-radius: 11px;
  font-size: 14px; font-family: inherit; color: var(--ink);
  background: #fffafc; transition: border-color 0.15s, box-shadow 0.15s;
}
.field textarea { resize: vertical; min-height: 120px; line-height: 1.7; }
.field input:focus, .field textarea:focus, .field select:focus {
  outline: none; border-color: var(--pink-soft);
  box-shadow: 0 0 0 3px rgba(255, 107, 157, 0.15);
}
.row { display: flex; gap: 12px; }
.field.small { flex: 1; }

/* 按钮 */
.primary-btn {
  width: 100%; margin-top: 4px; padding: 13px;
  background: linear-gradient(135deg, var(--pink), var(--pink-soft));
  color: #fff; border: none; border-radius: 12px;
  font-size: 15px; font-weight: 700; cursor: pointer;
  box-shadow: 0 6px 16px rgba(255, 46, 99, 0.28);
  transition: transform 0.1s, box-shadow 0.15s;
}
.primary-btn:hover { transform: translateY(-1px); box-shadow: 0 9px 22px rgba(255, 46, 99, 0.34); }
.primary-btn:active { transform: translateY(0); }
.ghost-btn {
  background: #fff; color: var(--pink);
  border: 1.5px solid var(--line); border-radius: 10px;
  font-size: 12.5px; font-weight: 600; padding: 7px 12px; cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.ghost-btn:hover { background: #fff0f5; border-color: var(--pink-soft); }
.small-btn { margin-top: 10px; }
.hint { font-size: 12px; color: var(--muted); margin: 10px 0 0; text-align: center; }

/* 输出 */
.meta-bar {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin-bottom: 18px; font-size: 12.5px;
}
.meta-bar .chip {
  background: #fff0f5; color: var(--pink);
  border: 1px solid var(--line); border-radius: 999px; padding: 4px 11px;
}
.meta-bar .chip.kw { background: #f4f0ff; color: #7a5cff; border-color: #e6dcff; }

.block { margin-bottom: 26px; }
.block h3 { margin: 0 0 12px; font-size: 15px; display: flex; align-items: baseline; gap: 8px; }
.block h3 small { font-weight: 400; font-size: 12px; color: var(--muted); }

/* 标题候选 */
.title-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 9px; }
.title-list li {
  display: flex; align-items: center; gap: 10px;
  background: #fffafc; border: 1px solid var(--line);
  border-radius: 11px; padding: 11px 13px; cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.title-list li:hover { border-color: var(--pink-soft); background: #fff0f5; }
.title-list .formula {
  flex: none; font-size: 11px; font-weight: 700; color: #fff;
  background: var(--pink-soft); border-radius: 6px; padding: 3px 7px; white-space: nowrap;
}
.title-list .ttext { flex: 1; font-size: 14px; font-weight: 600; }
.title-list .copy-tip { font-size: 11px; color: var(--muted); flex: none; }

/* 卡片网格 */
.card-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.kcard {
  border: 1px solid var(--line); border-radius: 13px;
  overflow: hidden; background: #fff; display: flex; flex-direction: column;
}
.kcard.cover { grid-column: 1 / -1; }
.kcard .kc-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 9px 13px; font-size: 12px; font-weight: 700; color: #fff;
  background: linear-gradient(135deg, var(--pink), var(--pink-soft));
}
.kcard.content .kc-head { background: linear-gradient(135deg, #6c63ff, #9d8bff); }
.kcard.ending .kc-head { background: linear-gradient(135deg, #ff8a5c, #ffb37a); }
.kc-head .kc-copy {
  background: rgba(255,255,255,0.25); border: none; color: #fff;
  font-size: 11px; border-radius: 6px; padding: 3px 8px; cursor: pointer;
}
.kc-head .kc-copy:hover { background: rgba(255,255,255,0.4); }
.kc-body { padding: 13px; flex: 1; }
.kc-title { font-size: 14.5px; font-weight: 700; margin: 0 0 8px; }
.kc-text { font-size: 13px; white-space: pre-wrap; color: #463c4e; margin: 0; }
.kc-sub { font-size: 12px; color: var(--muted); margin: 8px 0 0; }
.kc-visual {
  margin: 11px 13px 13px; padding: 9px 11px;
  background: #fbf7ff; border: 1px dashed #e3d8f5; border-radius: 9px;
  font-size: 11.5px; color: #6b5f7a;
}
.kc-visual b { color: #7a5cff; }

/* caption */
.caption-box {
  background: #fffafc; border: 1px solid var(--line); border-radius: 12px;
  padding: 14px; font-size: 13px; white-space: pre-wrap; word-break: break-word;
  font-family: inherit; margin: 0; line-height: 1.75; color: #463c4e;
}

/* 空状态 */
.empty {
  text-align: center; color: var(--muted); font-size: 13.5px;
  padding: 30px 10px; border: 1px dashed var(--line); border-radius: 12px;
}

/* footer */
.footer { padding: 26px 18px 40px; color: var(--muted); font-size: 12.5px; text-align: center; }
.footer p { margin: 4px 0; }
.footer .sub { font-size: 11.5px; opacity: 0.85; }

/* toast */
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%) translateY(20px);
  background: #2b2330; color: #fff; padding: 10px 18px; border-radius: 999px;
  font-size: 13px; opacity: 0; pointer-events: none; transition: opacity 0.2s, transform 0.2s;
  z-index: 50;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* 响应式 */
@media (max-width: 880px) {
  .layout { grid-template-columns: 1fr; }
  .input-panel { position: static; }
  .topbar h1 { font-size: 19px; }
}
@media (max-width: 520px) {
  .card-grid { grid-template-columns: 1fr; }
  .row { flex-direction: column; gap: 0; }
  .badge { display: none; }
  .head-actions { width: 100%; }
}
