/* 全局 */
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #f5f7fa;
  color: #1a202c;
  min-height: 100vh;
  padding: 24px;
  line-height: 1.5;
}

/* 顶部 */
.topbar {
  max-width: 1200px;
  margin: 0 auto 24px;
  text-align: center;
}
.topbar h1 { font-size: 28px; margin-bottom: 8px; color: #2d3748; }
.subtitle { color: #718096; font-size: 14px; }

/* 参数输入区 */
.params {
  max-width: 1200px;
  margin: 0 auto 24px;
  background: #fff;
  padding: 20px;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}
.param-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}
.param-grid label {
  display: flex;
  flex-direction: column;
  font-size: 13px;
}
.param-grid label.full { grid-column: 1 / -1; }
.param-grid span {
  color: #4a5568;
  margin-bottom: 4px;
  font-weight: 500;
}
.param-grid input {
  padding: 8px 10px;
  border: 1px solid #cbd5e0;
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.15s;
}
.param-grid input:focus {
  outline: none;
  border-color: #4299e1;
  box-shadow: 0 0 0 3px rgba(66,153,225,0.15);
}

/* Tab 切换 */
.tabs {
  max-width: 1200px;
  margin: 0 auto 20px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.tab {
  padding: 10px 18px;
  border: 1px solid #cbd5e0;
  background: #fff;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-family: inherit;
  transition: all 0.15s;
}
.tab:hover { border-color: #4299e1; color: #4299e1; }
.tab.active {
  background: #4299e1;
  color: #fff;
  border-color: #4299e1;
}

/* 控制条 */
.controls {
  max-width: 1200px;
  margin: 0 auto 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding: 12px 16px;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.04);
}
.control-left #count-info {
  font-size: 13px;
  color: #4a5568;
  font-weight: 500;
}
.control-right {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.btn-ctrl {
  padding: 7px 14px;
  border: 1px solid #cbd5e0;
  background: #f7fafc;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  font-family: inherit;
  font-weight: 500;
  transition: all 0.15s;
  color: #2d3748;
}
.btn-ctrl:hover {
  background: #ebf8ff;
  border-color: #4299e1;
  color: #2b6cb0;
}
.btn-ctrl.active {
  background: #4299e1;
  border-color: #4299e1;
  color: #fff;
}

/* 卡片容器 */
.cards {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
  gap: 20px;
}

/* 单张文案卡片 */
.card {
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
  display: flex;
  flex-direction: column;
}
.card-header {
  padding: 14px 16px;
  border-bottom: 1px solid #e2e8f0;
  background: #f7fafc;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}
.card-header .header-text { flex: 1; min-width: 0; }
.card-header h3 {
  font-size: 16px;
  color: #2d3748;
  margin-bottom: 4px;
}
.card-header .tone {
  font-size: 12px;
  color: #718096;
}
.btn-swap {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid #cbd5e0;
  background: #fff;
  font-size: 15px;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.4s, background 0.15s, border-color 0.15s, color 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.btn-swap:hover {
  background: #4299e1;
  color: #fff;
  border-color: #4299e1;
  transform: rotate(180deg);
}
.btn-swap:active { transform: rotate(360deg); }

/* 暗蓝色 H5 手机壳预览容器 */
.preview-wrap {
  background: #0a1929;
  padding: 20px 12px;
  display: flex;
  justify-content: center;
}
.phone {
  width: 375px;
  max-width: 100%;
  background: #0a1929;
  border-radius: 24px;
  padding: 16px;
  border: 2px solid #1e3a5f;
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
}
/* iframe 用于站内信 HTML 隔离样式 */
.phone iframe {
  width: 100%;
  border: none;
  background: transparent;
  min-height: 180px;
}
/* 纯文本预览（TG/WA/FB） */
.phone .text-preview {
  width: 100%;
  white-space: pre-wrap;
  word-wrap: break-word;
  color: #e2e8f0;
  font-size: 13px;
  font-family: -apple-system, "Segoe UI", sans-serif;
  line-height: 1.5;
}
.phone .text-preview strong { color: #ffd700; font-weight: bold; }
.phone .text-preview em { font-style: italic; }

/* 按钮区 */
.actions {
  padding: 12px 16px;
  display: flex;
  gap: 8px;
  border-top: 1px solid #e2e8f0;
}
.btn {
  flex: 1;
  padding: 8px 12px;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s;
  font-weight: 500;
}
.btn-primary {
  background: #4299e1;
  color: #fff;
}
.btn-primary:hover { background: #3182ce; }
.btn-secondary {
  background: #edf2f7;
  color: #2d3748;
}
.btn-secondary:hover { background: #e2e8f0; }
.btn.copied {
  background: #48bb78 !important;
  color: #fff !important;
}

/* 源码折叠 */
.source {
  border-top: 1px solid #e2e8f0;
}
.source summary {
  padding: 10px 16px;
  cursor: pointer;
  font-size: 13px;
  color: #4a5568;
  user-select: none;
  background: #f7fafc;
}
.source summary:hover { background: #edf2f7; }
.source pre {
  padding: 12px 16px;
  background: #1a202c;
  color: #e2e8f0;
  font-size: 12px;
  font-family: "SF Mono", Menlo, Monaco, Consolas, monospace;
  overflow-x: auto;
  white-space: pre-wrap;
  word-wrap: break-word;
  max-height: 300px;
  overflow-y: auto;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: #2d3748;
  color: #fff;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 14px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  opacity: 0;
  transition: all 0.3s ease;
  pointer-events: none;
  z-index: 1000;
}
.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* 底部 */
.foot {
  max-width: 1200px;
  margin: 32px auto 0;
  text-align: center;
  color: #a0aec0;
  font-size: 12px;
}

/* 响应式 */
@media (max-width: 600px) {
  body { padding: 12px; }
  .topbar h1 { font-size: 22px; }
  .cards { grid-template-columns: 1fr; }
  .phone { width: 100%; }
}
