:root {
  --xhs: #ff2e4d;
  --xhs-soft: #ff5c75;
  --ink: #1f2330;
  --muted: #6b7280;
  --line: #ececf1;
  --bg: #f6f6f9;
  --card: #ffffff;
  --radius: 16px;
  --shadow: 0 6px 24px rgba(31, 35, 48, 0.08);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.topbar {
  background: linear-gradient(120deg, var(--xhs), var(--xhs-soft));
  color: #fff;
  padding: 22px clamp(16px, 4vw, 40px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}
.brand { display: flex; align-items: center; gap: 14px; }
.logo {
  font-size: 34px;
  background: rgba(255, 255, 255, 0.18);
  width: 56px; height: 56px;
  display: grid; place-items: center;
  border-radius: 14px;
}
.topbar h1 { font-size: clamp(18px, 2.6vw, 24px); margin: 0; }
.tagline { margin: 2px 0 0; opacity: 0.92; font-size: 13px; }
.badge {
  background: rgba(255, 255, 255, 0.2);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  white-space: nowrap;
}

main {
  max-width: 1080px;
  margin: 0 auto;
  padding: clamp(16px, 3vw, 28px);
  display: grid;
  gap: 20px;
}

.panel {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: clamp(16px, 3vw, 26px);
}
.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin-bottom: 14px;
}
.panel-head h2 { font-size: 17px; margin: 0; }
.panel-head small { color: var(--muted); font-weight: 400; font-size: 12px; }
.deck-head { margin-top: 26px; }
.panel-actions { display: flex; gap: 8px; }

textarea {
  width: 100%;
  min-height: 200px;
  resize: vertical;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  font-size: 15px;
  font-family: inherit;
  line-height: 1.7;
  color: var(--ink);
  background: #fcfcfe;
}
textarea:focus { outline: none; border-color: var(--xhs-soft); }

.controls {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; margin-top: 14px;
}
.count-control { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--muted); }
.count-control input[type="range"] { accent-color: var(--xhs); width: 140px; }
.count-control output { font-weight: 700; color: var(--xhs); font-size: 16px; }

button {
  font-family: inherit; font-size: 14px; cursor: pointer;
  border-radius: 10px; border: 1px solid transparent; padding: 9px 16px;
  transition: transform 0.08s ease, background 0.15s ease, box-shadow 0.15s ease;
}
button:active { transform: translateY(1px); }
.primary {
  background: var(--xhs); color: #fff; font-weight: 600;
  box-shadow: 0 4px 14px rgba(255, 46, 77, 0.32);
}
.primary:hover { background: #ee1f3f; }
.ghost { background: #f3f3f7; color: var(--ink); border-color: var(--line); }
.ghost:hover { background: #eaeaf1; }

.hint { color: var(--muted); font-size: 13px; margin: 12px 0 0; min-height: 18px; }

/* 标题实验台 */
.title-list { display: grid; gap: 10px; }
.title-row {
  display: flex; align-items: flex-start; gap: 12px;
  border: 1.5px solid var(--line); border-radius: 12px;
  padding: 12px 14px; cursor: pointer; background: #fff;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.title-row:hover { border-color: var(--xhs-soft); background: #fff7f8; }
.title-row.active { border-color: var(--xhs); background: #fff1f3; }
.title-tag {
  flex: none; font-size: 11px; color: var(--xhs);
  background: #ffe7eb; border-radius: 6px; padding: 3px 8px; margin-top: 2px;
}
.title-main { flex: 1; }
.title-text { font-weight: 600; font-size: 15px; }
.title-note { font-size: 12px; color: var(--muted); margin-top: 2px; }
.title-copy { flex: none; }

/* 卡片网格 */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}
.xcard {
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  background: #fff;
  display: flex; flex-direction: column;
}
.xcard-head {
  background: linear-gradient(120deg, #fff0f2, #fff7e9);
  padding: 10px 14px;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  border-bottom: 1px solid var(--line);
}
.xcard-index {
  font-size: 12px; font-weight: 700; color: #fff;
  background: var(--xhs); border-radius: 999px;
  width: 22px; height: 22px; display: grid; place-items: center; flex: none;
}
.xcard-role { font-size: 13px; font-weight: 600; }
.xcard-emoji { margin-left: auto; font-size: 16px; }
.xcard-body { padding: 12px 14px; flex: 1; }
.xcard-title { font-weight: 600; font-size: 14px; margin-bottom: 8px; }
.xcard-lines { margin: 0; padding-left: 18px; font-size: 13px; color: #3a3f4d; }
.xcard-lines li { margin-bottom: 4px; }
.xcard-visual {
  font-size: 12px; color: var(--muted);
  border-top: 1px dashed var(--line); padding: 9px 14px; background: #fbfbfd;
}
.xcard-visual b { color: #444; font-weight: 600; }
.xcard-foot { padding: 0 14px 12px; }
.xcard-copy { font-size: 12px; padding: 6px 10px; }

.caption-box { margin-top: 24px; }
.caption-box h3 { font-size: 15px; margin: 0 0 8px; }
.caption-box pre {
  white-space: pre-wrap; word-break: break-word;
  background: #fcfcfe; border: 1.5px solid var(--line);
  border-radius: 12px; padding: 14px; font-family: inherit;
  font-size: 14px; margin: 0;
}

.about-panel h2 { font-size: 16px; margin: 0 0 12px; }
.about-list { margin: 0; padding-left: 18px; font-size: 14px; color: #3a3f4d; }
.about-list li { margin-bottom: 8px; }
.about-list strong { color: var(--xhs); }
.source { font-size: 12px; color: var(--muted); margin: 14px 0 0; }

footer {
  text-align: center; color: var(--muted); font-size: 12px;
  padding: 24px 16px 40px; position: relative;
}
.toast {
  position: fixed; left: 50%; bottom: 32px; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 999px;
  font-size: 13px; box-shadow: var(--shadow); z-index: 50;
}

@media (max-width: 560px) {
  .badge { display: none; }
  .controls { flex-direction: column; align-items: stretch; }
  .primary { width: 100%; }
  .card-grid { grid-template-columns: 1fr; }
}
