/* ========================================
   AI封面工厂 — 全局样式
   设计方向：克制极简 + 温暖人文
   避免泛AI审美（无青紫渐变、无默认卡片风）
   ======================================== */

/* --- Reset & Variables --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --ink: #1a1a1c;
  --ink-soft: #52525b;
  --ink-light: #9ca3af;
  --bg: #faf8f5;
  --bg-card: #ffffff;
  --accent: #e8453c;
  --accent-soft: #f04e45;
  --accent-wash: #fff0ee;
  --border: #e8e4df;
  --border-light: #f0ede8;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 20px rgba(0,0,0,0.06);
  --shadow-lg: 0 8px 40px rgba(0,0,0,0.08);
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-full: 100px;
  --font: "PingFang SC", "Noto Sans SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  --transition: 0.2s ease;
}

html { font-size: 16px; -webkit-font-smoothing: antialiased; scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.65;
  min-height: 100vh;
}
.hidden { display: none !important; }

/* --- Top Banner --- */
.top-banner {
  background: var(--ink);
  color: white;
  text-align: center;
  padding: 8px 16px;
  font-size: 0.78rem;
  letter-spacing: 0.3px;
  position: sticky;
  top: 0;
  z-index: 50;
}
.banner-icon { margin-right: 4px; }

/* --- Hero / Tool Section --- */
.hero {
  max-width: 680px;
  margin: 0 auto;
  padding: 56px 20px 36px;
  text-align: center;
}
.hero h1 {
  font-size: clamp(2rem, 5vw, 2.8rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin-bottom: 10px;
}
.hero h1 em {
  font-style: normal;
  color: var(--accent);
}
.hero .subtitle {
  font-size: 1.02rem;
  color: var(--ink-soft);
  margin-bottom: 32px;
  line-height: 1.6;
  max-width: 480px;
  margin-left: auto;
  margin-right: auto;
}
.tool-container { max-width: 560px; margin: 0 auto; }

/* --- Input Group --- */
.input-group {
  display: flex;
  gap: 8px;
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 5px;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.input-group:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-wash);
}
.input-group input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 0.98rem;
  font-family: var(--font);
  padding: 13px 14px;
  background: transparent;
  color: var(--ink);
  min-width: 0;
}
.input-group input::placeholder { color: var(--ink-light); }
.input-group button {
  background: var(--accent);
  color: white;
  border: none;
  padding: 13px 26px;
  border-radius: calc(var(--radius-lg) - 3px);
  font-size: 0.93rem;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--transition), transform 0.1s;
}
.input-group button:hover { background: var(--accent-soft); }
.input-group button:active { transform: scale(0.97); }
.input-group button:disabled {
  background: var(--ink-light);
  cursor: not-allowed;
  transform: none;
}

/* --- Random Row --- */
.random-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-top: 14px;
}
.random-btn {
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  padding: 8px 20px;
  border-radius: var(--radius-full);
  font-size: 0.86rem;
  font-family: var(--font);
  cursor: pointer;
  color: var(--ink-soft);
  transition: all var(--transition);
}
.random-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-wash);
}
.sep-text {
  color: var(--ink-light);
  font-size: 0.82rem;
  white-space: nowrap;
}
.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 12px;
}
.tag {
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: 0.81rem;
  color: var(--ink-soft);
  cursor: pointer;
  transition: all var(--transition);
  font-family: var(--font);
}
.tag:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-wash);
}

/* --- Loading --- */
.loading-indicator {
  text-align: center;
  padding: 56px 20px;
}
.loading-dots {
  display: flex;
  gap: 6px;
  justify-content: center;
  margin-bottom: 14px;
}
.loading-dots span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 1.4s ease-in-out infinite;
}
.loading-dots span:nth-child(2) { animation-delay: 0.2s; }
.loading-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes pulse {
  0%, 100% { opacity: 0.25; transform: scale(0.75); }
  50% { opacity: 1; transform: scale(1); }
}
.loading-text {
  color: var(--ink-light);
  font-size: 0.9rem;
}

/* --- Error State --- */
.error-state {
  text-align: center;
  padding: 48px 20px;
}
.error-icon { font-size: 2.5rem; margin-bottom: 10px; }
.error-title { font-weight: 700; font-size: 1.05rem; margin-bottom: 4px; }
.error-detail { color: var(--ink-light); font-size: 0.88rem; margin-bottom: 16px; }
.retry-btn {
  border: 1.5px solid var(--accent);
  background: white;
  color: var(--accent);
  padding: 10px 24px;
  border-radius: var(--radius-full);
  font-size: 0.9rem;
  font-family: var(--font);
  cursor: pointer;
  transition: all var(--transition);
  font-weight: 600;
}
.retry-btn:hover { background: var(--accent); color: white; }

/* --- Results --- */
.results-section {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 20px 48px;
}
.results-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 8px;
}
.results-header h2 {
  font-size: 1.2rem;
  font-weight: 700;
}
.results-header .count { font-size: 0.84rem; color: var(--ink-light); }
.results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}

/* --- Cover Card --- */
.cover-card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1.5px solid var(--border);
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
  cursor: pointer;
}
.cover-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.cover-card.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-wash);
}
.cover-preview {
  aspect-ratio: 3/4;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: #eae5de;
}
.cover-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.cover-preview .cover-bg {
  position: absolute;
  inset: 0;
}
.cover-preview .cover-title-overlay {
  position: absolute;
  z-index: 1;
  padding: 16px;
  text-align: center;
  color: white;
  font-weight: 800;
  text-shadow: 0 2px 6px rgba(0,0,0,0.35);
  line-height: 1.3;
  word-break: break-word;
}
.cover-card-actions {
  padding: 10px 12px;
  display: flex;
  gap: 6px;
  justify-content: flex-end;
  border-top: 1px solid var(--border-light);
}
.cover-card-actions button {
  border: none;
  background: none;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  font-family: var(--font);
  cursor: pointer;
  transition: all var(--transition);
}
.btn-download {
  background: var(--ink) !important;
  color: white !important;
  font-weight: 600;
}
.btn-download:hover { opacity: 0.8; }
.btn-edit-text {
  color: var(--ink-soft) !important;
  border: 1px solid var(--border) !important;
}
.btn-edit-text:hover { border-color: var(--ink-soft) !important; }
.btn-share-cover {
  color: var(--accent) !important;
  border: 1px solid var(--accent-wash) !important;
}
.btn-share-cover:hover { background: var(--accent-wash) !important; }

/* --- Empty State --- */
.empty-state {
  text-align: center;
  padding: 64px 20px;
}
.empty-icon { font-size: 2.8rem; margin-bottom: 12px; }
.empty-state p { color: var(--ink-soft); font-size: 0.95rem; line-height: 1.6; }
.empty-hint { margin-top: 10px; font-size: 0.85rem !important; color: var(--ink-light) !important; }
.inline-tag {
  display: inline-block;
  background: var(--accent-wash);
  color: var(--accent);
  padding: 2px 10px;
  border-radius: 100px;
  cursor: pointer;
  font-size: 0.82rem;
  margin: 2px;
  transition: background var(--transition);
}
.inline-tag:hover { background: #ffe0db; }

/* --- Inspired Section --- */
.inspired-section {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 20px 48px;
}
.inspired-section h2 { font-size: 1.2rem; font-weight: 700; margin-bottom: 6px; }
.section-subtitle { font-size: 0.85rem; color: var(--ink-light); margin-bottom: 18px; }
.examples-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
}
.example-item {
  aspect-ratio: 3/4;
  border-radius: var(--radius-sm);
  overflow: hidden;
  cursor: pointer;
  position: relative;
  transition: transform var(--transition), box-shadow var(--transition);
}
.example-item:hover {
  transform: scale(1.03);
  box-shadow: var(--shadow-md);
}
.example-item .example-inner {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 0.88rem;
  text-align: center;
  padding: 14px;
  text-shadow: 0 1px 4px rgba(0,0,0,0.3);
  line-height: 1.4;
}

/* --- Features Section --- */
.features-section {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 20px 56px;
}
.features-section h2 {
  font-size: 1.2rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 28px;
}
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
}
.feature-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 24px;
  text-align: center;
}
.feature-icon { font-size: 2rem; margin-bottom: 10px; }
.feature-card h3 { font-size: 1rem; font-weight: 700; margin-bottom: 6px; }
.feature-card p { font-size: 0.86rem; color: var(--ink-soft); line-height: 1.55; }

/* --- FAQ --- */
.faq-section {
  max-width: 700px;
  margin: 0 auto;
  padding: 0 20px 56px;
}
.faq-section h2 {
  font-size: 1.2rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 24px;
}
.faq-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.faq-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg-card);
}
.faq-item summary {
  padding: 14px 18px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.93rem;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: '+';
  font-size: 1.2rem;
  color: var(--ink-light);
  font-weight: 300;
}
.faq-item[open] summary::after { content: '−'; }
.faq-item p {
  padding: 0 18px 16px;
  font-size: 0.86rem;
  color: var(--ink-soft);
  line-height: 1.6;
}

/* --- Footer --- */
.footer {
  text-align: center;
  padding: 32px 16px;
  color: var(--ink-light);
  font-size: 0.81rem;
  border-top: 1px solid var(--border-light);
}
.footer a { color: var(--ink-soft); text-decoration: none; transition: color var(--transition); }
.footer a:hover { color: var(--accent); }
.footer-links { margin-top: 6px; }
.footer-sep { margin: 0 6px; opacity: 0.4; }

/* --- Toast --- */
.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: white;
  padding: 11px 22px;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-family: var(--font);
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
  box-shadow: var(--shadow-lg);
}
.toast.show { opacity: 1; pointer-events: auto; }

/* --- Responsive --- */
@media (max-width: 640px) {
  .hero { padding: 36px 14px 24px; }
  .hero h1 { font-size: 1.65rem; }
  .hero .subtitle { font-size: 0.9rem; }
  .input-group { flex-direction: column; gap: 6px; padding: 6px; }
  .input-group button { width: 100%; padding: 13px; border-radius: var(--radius-sm); }
  .results-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .examples-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .features-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .feature-card { padding: 16px; }
  .cover-card-actions { gap: 4px; }
  .cover-card-actions button { padding: 5px 10px; font-size: 0.73rem; }
}

@media (max-width: 380px) {
  .results-grid { grid-template-columns: 1fr; }
  .examples-grid { grid-template-columns: repeat(2, 1fr); }
  .features-grid { grid-template-columns: 1fr; }
}
