* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #f5f5f5;
  color: #333;
  font-size: 14px;
  line-height: 1.6;
}

/* ===== 顶部 Header ===== */
.header {
  background: linear-gradient(135deg, #FF2442, #FF6B6B);
  color: #fff;
  padding: 20px 16px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 12px rgba(255, 36, 66, 0.2);
}

.header-inner {
  max-width: 800px;
  margin: 0 auto;
  text-align: center;
}

.header h1 {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 4px;
}

.header p {
  font-size: 13px;
  opacity: 0.9;
}

/* ===== 生成按钮 ===== */
.toolbar {
  padding: 16px;
  display: flex;
  justify-content: center;
}

.btn-generate {
  background: linear-gradient(135deg, #FF2442, #E91E63);
  color: #fff;
  border: none;
  padding: 14px 32px;
  border-radius: 50px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(255, 36, 66, 0.35);
  display: flex;
  align-items: center;
  gap: 8px;
  transition: transform 0.15s;
}

.btn-generate:active {
  transform: scale(0.96);
}

.btn-generate:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-icon {
  font-size: 18px;
}

/* ===== 提示条 ===== */
.tip-bar {
  background: #FFF8E1;
  border-left: 4px solid #FFC107;
  margin: 0 16px 16px;
  padding: 10px 14px;
  font-size: 13px;
  color: #666;
  border-radius: 6px;
  max-width: 768px;
  margin: 0 auto 16px;
}

@media (min-width: 768px) {
  .tip-bar {
    margin: 0 auto 16px;
  }
}

/* ===== 文案卡片 ===== */
.post-list {
  padding: 0 12px 80px;
  max-width: 800px;
  margin: 0 auto;
}

.post-card {
  background: #fff;
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

/* 时间条 */
.post-time-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: linear-gradient(90deg, #FFF8E1, #FFFDE7);
  padding: 10px 12px;
  border-radius: 8px;
  border-left: 3px solid #FFC107;
  margin-bottom: 14px;
}

.time-info {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 12px;
}

.time-icon { font-size: 14px; }
.time-date { font-weight: 700; color: #333; }
.time-ago {
  background: #FF2442;
  color: #fff;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
}

.btn-delete {
  background: #fff;
  color: #FF2442;
  border: 1px solid #FF2442;
  padding: 5px 10px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 13px;
}

.btn-delete:active { background: #FF2442; color: #fff; }

.post-card h2 {
  font-size: 17px;
  font-weight: 700;
  color: #333;
  margin-bottom: 14px;
  line-height: 1.4;
}

/* ===== 区块 ===== */
.section {
  margin-bottom: 14px;
}

.section-label {
  font-size: 11px;
  color: #999;
  margin-bottom: 6px;
  letter-spacing: 0.5px;
}

/* 复制框 */
.copy-box {
  background: #f8f8f8;
  border: 1px solid #eee;
  border-radius: 8px;
  padding: 12px 14px;
  position: relative;
  cursor: pointer;
  white-space: pre-wrap;
  line-height: 1.7;
  font-size: 14px;
  color: #333;
  word-break: break-word;
  user-select: text;
  -webkit-user-select: text;
}

.copy-box:active {
  background: #fff8f8;
  border-color: #FF2442;
}

.copy-box::after {
  content: "📋 复制";
  position: absolute;
  top: 8px;
  right: 10px;
  font-size: 11px;
  color: #FF2442;
  background: #fff0f0;
  padding: 2px 8px;
  border-radius: 4px;
}

.copy-box.copied::after {
  content: "✓ 已复制";
  color: #00c853;
  background: #e8f5e9;
}

.content-box {
  max-height: 240px;
  overflow-y: auto;
}

/* 标签 */
.tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.tag {
  background: #fff0f0;
  color: #FF2442;
  padding: 4px 10px;
  border-radius: 10px;
  font-size: 12px;
}

/* 图片网格 */
.images-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.images-grid img,
.img-placeholder,
.img-wrap {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid #eee;
  background: #fafafa;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.img-wrap {
  cursor: pointer;
  border: 1px solid #eee;
}

.img-wrap img {
  width: 100%;
  height: 100%;
  display: block;
  border: none;
  border-radius: 0;
}

.img-index {
  position: absolute;
  top: 6px;
  left: 6px;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
}

.img-download-btn {
  position: absolute;
  bottom: 6px;
  right: 6px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 36, 66, 0.9);
  color: #fff;
  border: none;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.img-download-btn:active {
  transform: scale(0.9);
}

.img-placeholder .loading {
  font-size: 12px;
  color: #999;
}

/* ===== 已发布按钮 ===== */
.btn-published {
  width: 100%;
  background: #fff;
  color: #00c853;
  border: 1px solid #00c853;
  padding: 10px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.btn-published:active { background: #00c853; color: #fff; }

.status-badge {
  text-align: center;
  background: #e8f5e9;
  color: #00c853;
  padding: 10px;
  border-radius: 8px;
  font-weight: 600;
}

/* ===== 空状态 ===== */
.empty {
  text-align: center;
  padding: 80px 20px;
  color: #999;
}

.empty-icon { font-size: 48px; margin-bottom: 12px; }
.empty-text { font-size: 14px; }

/* ===== 全屏遮罩（生成中）===== */
.gen-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gen-overlay-box {
  background: #fff;
  padding: 30px 40px;
  border-radius: 14px;
  text-align: center;
  max-width: 280px;
}

.gen-overlay-icon {
  font-size: 40px;
  margin-bottom: 12px;
  display: inline-block;
  animation: spin 1.5s linear infinite;
}

.gen-overlay-title { font-size: 17px; font-weight: 600; margin-bottom: 6px; }
.gen-overlay-desc { font-size: 13px; color: #999; margin-bottom: 12px; }
.gen-overlay-status { font-size: 12px; color: #FF2442; min-height: 18px; }

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* ===== 桌面端调整 ===== */
@media (min-width: 768px) {
  .header h1 { font-size: 24px; }
  .post-card { padding: 24px; }
  .post-card h2 { font-size: 20px; }
  .copy-box { font-size: 15px; }
  .images-grid { grid-template-columns: repeat(4, 1fr); }
}

/* ===== 大图预览 ===== */
.img-preview {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  padding: 20px;
}

.img-preview img {
  max-width: 100%;
  max-height: 70vh;
  border-radius: 8px;
}

.preview-actions {
  display: flex;
  gap: 12px;
  margin-top: 24px;
}

.btn-download {
  background: #FF2442;
  color: #fff;
  padding: 12px 28px;
  border-radius: 50px;
  font-size: 15px;
  font-weight: 700;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 6px;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(255, 36, 66, 0.4);
}

.btn-close {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  padding: 12px 28px;
  border-radius: 50px;
  font-size: 15px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  cursor: pointer;
}

.img-preview .save-tip {
  margin-top: 16px;
  background: rgba(255, 255, 255, 0.1);
  padding: 8px 18px;
  border-radius: 14px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.8);
}

/* Toast */
.toast {
  position: fixed;
  bottom: 60px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.85);
  color: #fff;
  padding: 10px 24px;
  border-radius: 22px;
  font-size: 14px;
  z-index: 10000;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s;
}

.toast.show { opacity: 1; }
