* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', sans-serif; background: #f0f4f8; color: #1e293b; }

.app { max-width: 860px; margin: 0 auto; padding: 16px; }

/* Header */
.header {
  display: flex; align-items: center; justify-content: space-between;
  background: linear-gradient(135deg, #1e293b, #334155);
  color: #fff; padding: 16px 20px; border-radius: 14px; margin-bottom: 16px;
}
.back-btn { color: #94a3b8; font-size: 13px; text-decoration: none; white-space: nowrap; }
.back-btn:hover { color: #fff; }
.header-center { text-align: center; flex: 1; }
.header-center h1 { font-size: 18px; font-weight: 800; }
.subtitle { font-size: 12px; color: #94a3b8; margin-top: 4px; }
.header-right { font-size: 13px; color: #94a3b8; white-space: nowrap; }
.header-right #balanceNum { color: #818cf8; font-weight: 700; }

/* Card */
.card { background: #fff; border-radius: 14px; padding: 20px; margin-bottom: 14px; box-shadow: 0 1px 4px rgba(0,0,0,0.06); }
.card h3 { font-size: 15px; font-weight: 700; color: #0f172a; margin-bottom: 14px; }

/* Token */
#tokenSection input { width: 100%; padding: 10px 14px; border: 1.5px solid #e2e8f0; border-radius: 8px; font-size: 14px; outline: none; }
#tokenSection input:focus { border-color: #818cf8; }

/* Mode tabs */
.mode-tabs { display: flex; gap: 8px; margin-bottom: 16px; }
.mode-tab {
  flex: 1; padding: 10px; border: 2px solid #e2e8f0; border-radius: 10px;
  background: #f8fafc; font-size: 13px; font-weight: 600; cursor: pointer; transition: all 0.2s;
}
.mode-tab.active { border-color: #818cf8; background: #eef2ff; color: #4f46e5; }
.mode-tab:hover:not(.active) { border-color: #c7d2fe; }

.mode-panel { display: block; }
.mode-panel.hidden { display: none; }

/* Form */
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; color: #475569; margin-bottom: 6px; }
.form-group input[type=text], .form-group textarea {
  width: 100%; padding: 10px 14px; border: 1.5px solid #e2e8f0; border-radius: 8px;
  font-size: 14px; outline: none; resize: vertical; font-family: inherit;
}
.form-group input:focus, .form-group textarea:focus { border-color: #818cf8; }

/* Upload */
.upload-area {
  border: 2px dashed #c7d2fe; border-radius: 10px; padding: 24px;
  text-align: center; cursor: pointer; transition: all 0.2s; background: #f8fafc;
}
.upload-area:hover { border-color: #818cf8; background: #eef2ff; }
.upload-icon { font-size: 28px; margin-bottom: 8px; }
#docFileName { font-size: 13px; color: #64748b; }

/* Params */
.params-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.params-header h3 { margin-bottom: 0; }
.btn-auto {
  padding: 7px 14px; background: linear-gradient(135deg, #818cf8, #6366f1);
  color: #fff; border: none; border-radius: 8px; font-size: 13px; font-weight: 600;
  cursor: pointer; transition: opacity 0.2s;
}
.btn-auto:hover { opacity: 0.85; }
.btn-auto:disabled { opacity: 0.5; cursor: not-allowed; }

.auto-reason {
  background: #eef2ff; border: 1px solid #c7d2fe; border-radius: 8px;
  padding: 10px 14px; font-size: 13px; color: #4f46e5; margin-bottom: 14px;
}
.auto-reason.hidden { display: none; }

.params-grid { display: flex; flex-direction: column; gap: 14px; }
.param-group label { font-size: 13px; font-weight: 600; color: #475569; display: block; margin-bottom: 6px; }
.option-row { display: flex; flex-wrap: wrap; gap: 8px; }

.opt-chip {
  padding: 6px 14px; border: 1.5px solid #e2e8f0; border-radius: 100px;
  font-size: 13px; cursor: pointer; transition: all 0.15s; background: #f8fafc;
}
.opt-chip:hover { border-color: #c7d2fe; background: #eef2ff; }
.opt-chip.active { border-color: #818cf8; background: #eef2ff; color: #4f46e5; font-weight: 600; }
.btn-preview {
  margin-top: 10px; padding: 8px 18px; background: #f1f5f9;
  border: 1.5px solid #e2e8f0; border-radius: 8px; font-size: 13px;
  font-weight: 600; cursor: pointer; color: #475569; transition: all 0.2s;
}
.btn-preview:hover { border-color: #818cf8; color: #4f46e5; }
.btn-preview:disabled { opacity: 0.5; cursor: not-allowed; }

.url-previews { display: flex; flex-direction: column; gap: 14px; margin-top: 14px; }
.url-previews.hidden { display: none; }

.url-preview-card {
  border: 1.5px solid #e2e8f0; border-radius: 12px; overflow: hidden; background: #fff;
}
.url-preview-card.success { border-color: #10b981; }
.url-preview-card.error { border-color: #f87171; }

.url-preview-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px; background: #f8fafc; border-bottom: 1px solid #e2e8f0;
}
.url-preview-num { font-size: 12px; font-weight: 700; color: #64748b; }
.url-preview-status { font-size: 12px; font-weight: 600; }
.url-preview-status.ok { color: #10b981; }
.url-preview-status.err { color: #ef4444; }

.url-preview-body { display: flex; gap: 12px; padding: 12px; }
.url-preview-shot {
  width: 100px; flex-shrink: 0; border-radius: 8px; overflow: hidden;
  border: 1px solid #e2e8f0; cursor: pointer;
}
.url-preview-shot img { width: 100%; display: block; }
.url-preview-shot:hover { border-color: #818cf8; }

.url-preview-text { flex: 1; font-size: 12px; color: #64748b; line-height: 1.6; }
.url-preview-text strong { color: #1e293b; font-size: 13px; display: block; margin-bottom: 4px; }

/* 截图放大弹窗 */
.screenshot-modal {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.7);
  z-index: 1000; align-items: center; justify-content: center;
}
.screenshot-modal.show { display: flex; }
.screenshot-modal img { max-width: 90vw; max-height: 90vh; border-radius: 12px; }
.screenshot-modal-close {
  position: absolute; top: 20px; right: 20px; color: #fff;
  font-size: 28px; cursor: pointer; line-height: 1;
}

.opt-chip .chip-desc { display: block; font-size: 11px; color: #94a3b8; font-weight: 400; margin-top: 2px; }
.opt-chip.multi.active { border-color: #10b981; background: #f0fdf4; color: #059669; font-weight: 600; }

.toggle-label { display: flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; }
.toggle-label input { width: 16px; height: 16px; accent-color: #6366f1; }

/* Generate */
.generate-area { text-align: center; margin-bottom: 20px; }
.btn-generate {
  padding: 14px 48px; background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff; border: none; border-radius: 12px; font-size: 16px; font-weight: 700;
  cursor: pointer; transition: opacity 0.2s; box-shadow: 0 4px 16px rgba(99,102,241,0.3);
}
.btn-generate:hover { opacity: 0.9; }
.btn-generate:disabled { opacity: 0.5; cursor: not-allowed; }
.cost-hint { font-size: 12px; color: #94a3b8; margin-top: 8px; }

/* Result */
#resultArea { background: #fff; border-radius: 14px; padding: 20px; box-shadow: 0 1px 4px rgba(0,0,0,0.06); }
#resultArea.hidden { display: none; }
.result-toolbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.result-toolbar h3 { font-size: 15px; font-weight: 700; }
.result-actions { display: flex; gap: 8px; }

.btn-copy {
  padding: 8px 16px; background: #10b981; color: #fff; border: none;
  border-radius: 8px; font-size: 13px; font-weight: 600; cursor: pointer; transition: opacity 0.2s;
}
.btn-copy:hover { opacity: 0.85; }
.btn-regen {
  padding: 8px 16px; background: #f1f5f9; color: #475569; border: 1.5px solid #e2e8f0;
  border-radius: 8px; font-size: 13px; font-weight: 600; cursor: pointer;
}
.btn-regen:hover { border-color: #818cf8; color: #4f46e5; }

/* Article tabs */
.article-tabs { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.article-tabs.hidden { display: none; }
.article-tab {
  padding: 6px 14px; border: 1.5px solid #e2e8f0; border-radius: 8px;
  font-size: 12px; cursor: pointer; background: #f8fafc;
}
.article-tab.active { border-color: #818cf8; background: #eef2ff; color: #4f46e5; font-weight: 600; }

/* Article content */
.article-content {
  min-height: 300px; padding: 20px; border: 1.5px solid #e2e8f0; border-radius: 10px;
  font-size: 15px; line-height: 1.8; outline: none;
}
.article-content:focus { border-color: #818cf8; }
.article-content h2 { font-size: 18px; font-weight: 700; margin: 20px 0 10px; color: #0f172a; }
.article-content h3 { font-size: 16px; font-weight: 600; margin: 16px 0 8px; color: #1e293b; }
.article-content p { margin-bottom: 12px; color: #334155; }
.article-content strong { color: #0f172a; }
.article-content ul, .article-content ol { padding-left: 20px; margin-bottom: 12px; }
.article-content li { margin-bottom: 6px; color: #334155; }

.copy-tip {
  text-align: center; padding: 10px; background: #f0fdf4;
  border-radius: 8px; font-size: 13px; color: #16a34a; margin-top: 12px;
}

@media (max-width: 600px) {
  .header { flex-direction: column; gap: 8px; text-align: center; }
  .mode-tabs { flex-direction: column; }
  .result-toolbar { flex-direction: column; gap: 10px; align-items: flex-start; }
}

/* 自定义要求 */
.params-grid .full-width { grid-column: 1 / -1; }
.params-grid .full-width textarea {
  width: 100%; padding: 10px 12px; border: 1.5px solid #e2e8f0;
  border-radius: 8px; font-size: 13px; resize: vertical;
  font-family: inherit; color: #1e293b; background: #f8fafc;
  transition: border-color 0.2s;
}
.params-grid .full-width textarea:focus { outline: none; border-color: #818cf8; background: #fff; }

/* Chrome 提示 */
.chrome-hint {
  margin-top: 10px; padding: 10px 14px; background: #fffbeb;
  border: 1.5px solid #fcd34d; border-radius: 8px;
  font-size: 13px; color: #92400e; line-height: 1.6;
}
.chrome-hint a { color: #d97706; font-weight: 600; }
.chrome-hint.hidden { display: none; }
