/* ========================================
   AI 绘图迭代报告 — Linear 风格
   ======================================== */

/* --- 亮色主题 Token（默认） --- */
:root {
  --color-bg: #FFFFFF;
  --color-bg-secondary: #F5F5F5;
  --color-bg-tertiary: #EBEBEB;
  --color-border: #E0E0E0;
  --color-text: #1A1A1A;
  --color-text-secondary: #6B7280;
  --color-accent: #4F46E5;
  --color-accent-hover: #4338CA;
  --color-accent-glow: #6366f1;
  --color-ai-primary: #9333EA;
  --color-ai-secondary: #DB2777;
  --color-success: #059669;
  --color-warning: #D97706;
  --color-timeline-line: #E0E0E0;
  --color-timeline-dot: #4F46E5;
  --color-feedback-bg: #FEF3C7;
  --color-feedback-border: #F59E0B;
  --color-feedback-text: #92400E;
  --color-code-bg: #F3F4F6;
  --shadow-card: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-card-hover: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-lightbox: 0 25px 60px rgba(0,0,0,0.3);
}

/* --- 暗色主题 Token --- */
[data-theme="dark"] {
  --color-bg: #0D0D0D;
  --color-bg-secondary: #1A1A1A;
  --color-bg-tertiary: #262626;
  --color-border: #333333;
  --color-text: #E5E5E5;
  --color-text-secondary: #A3A3A3;
  --color-accent: #5E6AD2;
  --color-accent-hover: #7C85E0;
  --color-accent-glow: #818cf8;
  --color-ai-primary: #a855f7;
  --color-ai-secondary: #ec4899;
  --color-success: #10b981;
  --color-warning: #FBBF24;
  --color-timeline-line: #333333;
  --color-timeline-dot: #5E6AD2;
  --color-feedback-bg: #422006;
  --color-feedback-border: #B45309;
  --color-feedback-text: #FDE68A;
  --color-code-bg: #262626;
  --shadow-card: 0 1px 3px rgba(0,0,0,0.3), 0 1px 2px rgba(0,0,0,0.2);
  --shadow-card-hover: 0 4px 12px rgba(0,0,0,0.4);
  --shadow-lightbox: 0 25px 60px rgba(0,0,0,0.6);
  color-scheme: dark;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', Roboto, sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background 0.3s ease, color 0.3s ease;
}

/* --- 任务起点 --- */
.origin-section {
  margin-bottom: 48px;
}

.origin-card {
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: 16px;
  padding: 24px;
  box-shadow: var(--shadow-card);
}

.origin-content {
  display: flex;
  gap: 24px;
  align-items: flex-start;
}

.origin-image-wrapper {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.origin-image-label {
  font-size: 0.6875rem;
  color: var(--color-text-secondary);
}

.origin-text {
  flex: 1;
  min-width: 0;
}

.origin-title {
  font-size: 0.9375rem;
  font-weight: 600;
  margin-bottom: 10px;
}

.origin-requirement {
  font-size: 0.875rem;
  color: var(--color-text-secondary);
  line-height: 1.7;
  margin-bottom: 16px;
  padding: 10px 14px;
  background: var(--color-code-bg);
  border-radius: 10px;
}

.origin-details {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.origin-detail-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.8125rem;
  color: var(--color-text);
}

.origin-detail-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

@media (max-width: 640px) {
  .origin-content {
    flex-direction: column;
    gap: 16px;
  }

  .origin-image-wrapper {
    align-self: center;
  }
}

/* --- 背景光效 --- */
.ambient-glow {
  position: fixed;
  top: -200px;
  left: 50%;
  transform: translateX(-50%);
  width: 800px;
  height: 500px;
  background: radial-gradient(ellipse, var(--color-accent-glow) 0%, transparent 70%);
  opacity: 0.06;
  border-radius: 50%;
  filter: blur(80px);
  pointer-events: none;
  z-index: 0;
}

[data-theme="dark"] .ambient-glow {
  opacity: 0.08;
}

/* --- Layout --- */
.page-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
}

.content-wrapper {
  max-width: 860px;
  margin: 0 auto;
  padding: 0 24px;
  width: 100%;
  position: relative;
  z-index: 1;
}

/* --- Header --- */
.header {
  padding: 48px 0 40px;
  text-align: center;
}

.header-title {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 20px;
}

.header-meta {
  display: flex;
  justify-content: center;
  gap: 24px;
  flex-wrap: wrap;
}

.meta-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8125rem;
  color: var(--color-text-secondary);
}

.meta-item svg {
  width: 14px;
  height: 14px;
  opacity: 0.6;
}

/* --- 主题切换按钮 --- */
.theme-toggle {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 100;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--color-border);
  background: var(--color-bg-secondary);
  color: var(--color-text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.theme-toggle:hover {
  background: var(--color-bg-tertiary);
  color: var(--color-text);
}

.theme-toggle svg {
  width: 18px;
  height: 18px;
}

/* --- Section 标题 --- */
.section-heading {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 32px;
}

.section-heading-bar {
  width: 3px;
  height: 20px;
  border-radius: 2px;
  background: linear-gradient(180deg, var(--color-ai-primary), var(--color-ai-secondary));
  flex-shrink: 0;
}

.section-heading h2 {
  font-size: 1.0625rem;
  font-weight: 600;
  white-space: nowrap;
}

.section-heading-line {
  flex: 1;
  height: 1px;
  background: var(--color-border);
}

/* --- 时间线 --- */
.timeline {
  position: relative;
  padding-left: 32px;
  margin-bottom: 64px;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 7px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: var(--color-timeline-line);
}

.timeline-item {
  position: relative;
  margin-bottom: 40px;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.timeline-item.visible {
  opacity: 1;
  transform: translateY(0);
}

.timeline-item:last-child {
  margin-bottom: 0;
}

/* 时间线圆点 */
.timeline-dot {
  position: absolute;
  left: -32px;
  top: 6px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--color-bg);
  border: 2px solid var(--color-timeline-dot);
  z-index: 2;
  transition: all 0.3s ease;
}

.timeline-item:last-child .timeline-dot {
  background: var(--color-timeline-dot);
  box-shadow: 0 0 0 4px var(--color-bg), 0 0 0 6px var(--color-timeline-dot);
}

/* 时间线卡片 */
.timeline-card {
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: 16px;
  padding: 24px;
  box-shadow: var(--shadow-card);
  transition: box-shadow 0.3s ease, transform 0.3s ease;
}

.timeline-card:hover {
  box-shadow: var(--shadow-card-hover);
  transform: translateY(-1px);
}

/* 卡片头部 */
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.version-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--color-accent);
  background: color-mix(in srgb, var(--color-accent) 8%, transparent);
  padding: 4px 12px;
  border-radius: 20px;
}

.card-time {
  font-size: 0.75rem;
  color: var(--color-text-secondary);
}

/* 参数标签 */
.params-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.param-tag {
  font-size: 0.6875rem;
  color: var(--color-text-secondary);
  background: var(--color-bg-tertiary);
  padding: 2px 10px;
  border-radius: 20px;
  letter-spacing: 0.02em;
}

/* Prompt 区域 */
.prompt-section {
  margin-bottom: 16px;
}

.prompt-cn {
  font-size: 0.875rem;
  line-height: 1.7;
  color: var(--color-text);
  margin-bottom: 8px;
}

.prompt-en-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.75rem;
  color: var(--color-text-secondary);
  cursor: pointer;
  border: none;
  background: none;
  padding: 2px 0;
  transition: color 0.2s;
}

.prompt-en-toggle:hover {
  color: var(--color-text);
}

.prompt-en-toggle svg {
  width: 12px;
  height: 12px;
  transition: transform 0.3s ease;
}

.prompt-en-toggle.expanded svg {
  transform: rotate(180deg);
}

.prompt-en-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s ease, opacity 0.3s ease;
  opacity: 0;
}

.prompt-en-content.expanded {
  max-height: 300px;
  opacity: 1;
}

.prompt-en-text {
  font-size: 0.8125rem;
  line-height: 1.7;
  color: var(--color-text-secondary);
  margin-top: 8px;
  padding: 12px 16px;
  background: var(--color-code-bg);
  border-radius: 10px;
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  word-break: break-word;
}

/* 图片缩略图 */
.image-thumb-wrapper {
  margin-bottom: 16px;
}

.image-thumb {
  width: 140px;
  height: 140px;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid var(--color-border);
  cursor: pointer;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.image-thumb:hover {
  transform: scale(1.03);
  box-shadow: var(--shadow-card-hover);
}

/* 反馈区域 */
.feedback-block {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  background: var(--color-feedback-bg);
  border: 1px solid var(--color-feedback-border);
  border-radius: 10px;
  font-size: 0.8125rem;
  line-height: 1.6;
  color: var(--color-feedback-text);
}

.feedback-block svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  margin-top: 2px;
  opacity: 0.7;
}

.feedback-arrow {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
  font-size: 0.75rem;
  color: var(--color-text-secondary);
}

.feedback-arrow svg {
  width: 14px;
  height: 14px;
}

/* --- 总结区 --- */
.summary-section {
  margin-bottom: 64px;
}

/* Key Findings */
.findings-grid {
  display: grid;
  gap: 16px;
  margin-bottom: 48px;
}

.finding-card {
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: 14px;
  padding: 20px 24px;
  box-shadow: var(--shadow-card);
  transition: box-shadow 0.3s ease, transform 0.3s ease;
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.5s ease, transform 0.5s ease, box-shadow 0.3s ease;
}

.finding-card.visible {
  opacity: 1;
  transform: translateY(0);
}

.finding-card:hover {
  box-shadow: var(--shadow-card-hover);
}

.finding-issue {
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.finding-issue-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-warning);
  flex-shrink: 0;
}

.finding-detail {
  font-size: 0.8125rem;
  color: var(--color-text-secondary);
  line-height: 1.7;
  margin-bottom: 10px;
}

.finding-solution {
  font-size: 0.8125rem;
  line-height: 1.7;
  padding: 10px 14px;
  background: color-mix(in srgb, var(--color-success) 6%, transparent);
  border-left: 3px solid var(--color-success);
  border-radius: 0 8px 8px 0;
  color: var(--color-text);
}

/* Prompt 写作规则 */
.rules-list {
  list-style: none;
  display: grid;
  gap: 10px;
}

.rule-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: 0.8125rem;
  line-height: 1.7;
  color: var(--color-text);
  padding: 12px 16px;
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  opacity: 0;
  transform: translateX(-12px);
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.rule-item.visible {
  opacity: 1;
  transform: translateX(0);
}

.rule-number {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: color-mix(in srgb, var(--color-accent) 10%, transparent);
  color: var(--color-accent);
  font-size: 0.6875rem;
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 1px;
}

/* --- Lightbox --- */
.lightbox-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  cursor: zoom-out;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.lightbox-overlay.active {
  opacity: 1;
  visibility: visible;
}

.lightbox-img {
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
  border-radius: 12px;
  box-shadow: var(--shadow-lightbox);
  transform: scale(0.9);
  transition: transform 0.3s ease;
}

.lightbox-overlay.active .lightbox-img {
  transform: scale(1);
}

.lightbox-close {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.2);
  background: rgba(255,255,255,0.1);
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.lightbox-close:hover {
  background: rgba(255,255,255,0.2);
}

.lightbox-close svg {
  width: 20px;
  height: 20px;
}

.lightbox-label {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.8125rem;
  color: rgba(255,255,255,0.6);
  background: rgba(0,0,0,0.4);
  padding: 6px 16px;
  border-radius: 20px;
}

/* --- Footer --- */
.footer {
  margin-top: auto;
  padding: 32px 0;
  text-align: center;
}

.footer p {
  font-size: 0.6875rem;
  color: var(--color-text-secondary);
  opacity: 0.2;
  letter-spacing: 0.15em;
  font-weight: 300;
}

/* --- 响应式 --- */
@media (max-width: 640px) {
  .content-wrapper {
    padding: 0 16px;
  }

  .header {
    padding: 32px 0 28px;
  }

  .header-title {
    font-size: 1.375rem;
  }

  .header-meta {
    gap: 12px;
  }

  .timeline {
    padding-left: 24px;
  }

  .timeline::before {
    left: 5px;
  }

  .timeline-dot {
    left: -24px;
    width: 12px;
    height: 12px;
  }

  .timeline-item:last-child .timeline-dot {
    box-shadow: 0 0 0 3px var(--color-bg), 0 0 0 5px var(--color-timeline-dot);
  }

  .timeline-card {
    padding: 18px;
    border-radius: 14px;
  }

  .card-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  .image-thumb {
    width: 110px;
    height: 110px;
  }

  .theme-toggle {
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
  }

  .theme-toggle svg {
    width: 16px;
    height: 16px;
  }
}
