/* ── 设计令牌与基础重置 ───────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }

:root {
  color-scheme: light;
  --bg: #f7f6fb;
  --surface: #ffffff;
  --surface-hover: #fbfaff;
  --surface-soft: #f3f0fa;
  --border: #e5e0ef;
  --border-strong: #d4cbe7;
  --text: #211b2e;
  --text-secondary: #6f687d;
  --accent: #7c3aed;
  --accent-hover: #6d28d9;
  --accent-soft: #f0e9ff;
  --cyan: #0891b2;
  --danger: #c24156;
  --danger-soft: #fff0f2;
  --success: #167a52;
  --success-soft: #e9f7f0;
  --warning: #98610a;
  --warning-soft: #fff6dd;
  --radius: 18px;
  --radius-sm: 11px;
  --shadow: 0 1px 2px rgba(44, 27, 71, 0.03), 0 8px 28px rgba(64, 42, 97, 0.055);
  --shadow-lg: 0 24px 70px rgba(48, 27, 82, 0.14);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei UI", "Microsoft YaHei", sans-serif;
}

html { font-size: 16px; scroll-behavior: smooth; }
body {
  min-height: 100vh;
  font-family: var(--font);
  line-height: 1.65;
  color: var(--text);
  background:
    radial-gradient(circle at 8% 0%, rgba(124, 58, 237, 0.065), transparent 28rem),
    radial-gradient(circle at 96% 22%, rgba(8, 145, 178, 0.045), transparent 25rem),
    var(--bg);
  -webkit-font-smoothing: antialiased;
}
button, input, textarea, select { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }
a { color: var(--accent); }
::selection { color: var(--text); background: #dfd0ff; }
:focus-visible { outline: 3px solid rgba(8, 145, 178, 0.42); outline-offset: 3px; }

/* ── 登录 ─────────────────────────────────────────────────── */
.login-screen {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 100vh;
  min-height: 100svh;
  padding: 32px 20px;
  overflow: hidden;
  isolation: isolate;
}
.login-ambient {
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(circle at 25% 25%, rgba(124, 58, 237, 0.17), transparent 26rem),
    radial-gradient(circle at 78% 70%, rgba(8, 145, 178, 0.12), transparent 24rem);
}
.login-ambient::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.32;
  background-image: linear-gradient(rgba(124, 58, 237, 0.05) 1px, transparent 1px), linear-gradient(90deg, rgba(124, 58, 237, 0.05) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(to bottom, black, transparent 80%);
}
.login-card {
  width: min(100%, 440px);
  padding: 44px;
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 26px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  animation: loginIn 0.45s ease-out both;
}
.login-brand-mark {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  margin-bottom: 26px;
  color: #fff;
  border-radius: 17px;
  background: linear-gradient(145deg, #8b5cf6, var(--accent-hover));
  box-shadow: 0 12px 30px rgba(124, 58, 237, 0.25);
}
.login-brand-mark svg { width: 30px; height: 30px; }
.eyebrow {
  margin-bottom: 7px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.15em;
}
.login-card h1 { font-size: 30px; line-height: 1.25; letter-spacing: -0.035em; }
.login-subtitle { margin-top: 10px; color: var(--text-secondary); font-size: 14px; }
.login-form { display: grid; gap: 12px; margin-top: 30px; }
.login-form label { font-size: 13px; font-weight: 600; }
.login-form input {
  width: 100%;
  min-height: 50px;
  padding: 12px 15px;
  color: var(--text);
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-sm);
  outline: none;
  background: rgba(255, 255, 255, 0.85);
  transition: border-color 0.18s, box-shadow 0.18s;
}
.login-form input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.1); }
.login-form .btn { width: 100%; margin-top: 4px; }
.form-error { padding: 10px 12px; color: var(--danger); border-radius: 9px; background: var(--danger-soft); font-size: 13px; line-height: 1.55; }
.login-footnote { margin-top: 22px; color: var(--text-secondary); font-size: 12px; text-align: center; }
@keyframes loginIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }

/* ── 应用框架与导航 ───────────────────────────────────────── */
.app { max-width: 1120px; margin: 0 auto; padding: 0 28px 64px; }
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  margin: 0 -28px;
  padding: 0 28px;
  border-bottom: 1px solid rgba(229, 224, 239, 0.85);
  background: rgba(247, 246, 251, 0.88);
  backdrop-filter: blur(22px) saturate(150%);
  -webkit-backdrop-filter: blur(22px) saturate(150%);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; min-height: 68px; gap: 20px; }
.logo { display: flex; align-items: center; gap: 11px; min-width: 0; }
.logo-icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  color: #fff;
  border-radius: 11px;
  background: linear-gradient(145deg, #8b5cf6, var(--accent-hover));
  box-shadow: 0 6px 16px rgba(124, 58, 237, 0.2);
}
.logo-icon svg { width: 21px; height: 21px; }
.logo-text { font-size: 16px; font-weight: 700; letter-spacing: -0.015em; white-space: nowrap; }
.logo-text span { margin-left: 4px; color: var(--text-secondary); font-size: 13px; font-weight: 500; }
.header-actions { display: flex; align-items: center; gap: 12px; }
.header-status { display: flex; align-items: center; gap: 7px; color: var(--text-secondary); font-size: 12px; white-space: nowrap; }
.header-status .dot { width: 7px; height: 7px; border-radius: 50%; background: #22a06b; box-shadow: 0 0 0 4px rgba(34, 160, 107, 0.1); }
.header-status .dot.off { background: #d28a19; box-shadow: 0 0 0 4px rgba(210, 138, 25, 0.1); }
.header-button {
  min-width: 44px;
  min-height: 38px;
  padding: 6px 11px;
  color: var(--text-secondary);
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  cursor: pointer;
  font-size: 12px;
}
.header-button:hover { color: var(--text); border-color: var(--border); background: var(--surface); }
.tabs { display: flex; gap: 5px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  position: relative;
  flex: 0 0 auto;
  min-height: 46px;
  padding: 10px 15px 12px;
  color: var(--text-secondary);
  border: 0;
  background: none;
  cursor: pointer;
  font-size: 13px;
  font-weight: 550;
  white-space: nowrap;
}
.tab::after { content: ""; position: absolute; right: 14px; bottom: -1px; left: 14px; height: 2px; border-radius: 2px; background: transparent; }
.tab:hover { color: var(--accent); }
.tab.active { color: var(--accent); }
.tab.active::after { background: var(--accent); }
.main { padding-top: 30px; }
.tab-page { animation: pageIn 0.22s ease-out; }
@keyframes pageIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }

/* ── 通用组件 ─────────────────────────────────────────────── */
.section-title { margin-bottom: 14px; color: var(--text-secondary); font-size: 12px; font-weight: 650; letter-spacing: 0.07em; text-transform: uppercase; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 44px;
  padding: 10px 20px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.35;
  transition: background 0.18s, border-color 0.18s, box-shadow 0.18s, transform 0.12s;
}
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: 0.48; cursor: not-allowed; }
.btn-primary { color: #fff; background: var(--accent); box-shadow: 0 6px 16px rgba(124, 58, 237, 0.17); }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); box-shadow: 0 8px 20px rgba(124, 58, 237, 0.23); }
.btn-outline { color: var(--accent); border-color: var(--border-strong); background: var(--surface); }
.btn-outline:hover:not(:disabled) { border-color: #bda7e5; background: var(--accent-soft); }
.btn-sm { min-height: 38px; padding: 8px 14px; font-size: 12px; }
.btn-lg { min-height: 50px; padding: 13px 28px; border-radius: 13px; font-size: 15px; }
.panel {
  margin-bottom: 18px;
  padding: 23px 24px;
  border: 1px solid rgba(229, 224, 239, 0.9);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
}
.panel-title { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; margin-bottom: 16px; font-size: 15px; font-weight: 700; letter-spacing: -0.01em; }
.panel-title.clickable { cursor: pointer; user-select: none; }
.panel-title.clickable .hint { margin-right: auto; }
.hint { color: var(--text-secondary); font-size: 12px; font-weight: 400; line-height: 1.6; }
.panel textarea,
.panel input[type="text"],
.panel input[type="password"],
.panel input[type="url"],
.panel select {
  width: 100%;
  min-height: 43px;
  padding: 10px 12px;
  color: var(--text);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  outline: none;
  background: #fbfafd;
  font-size: 13px;
  transition: border-color 0.18s, box-shadow 0.18s, background 0.18s;
  resize: vertical;
}
.panel textarea { line-height: 1.7; }
.panel textarea:focus,
.panel input[type="text"]:focus,
.panel input[type="password"]:focus,
.panel input[type="url"]:focus,
.panel select:focus { border-color: var(--accent); background: #fff; box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.08); }
.panel input::placeholder, .panel textarea::placeholder, .login-form input::placeholder { color: #9a94a5; }
.page-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin: 4px 0 24px; }
.page-heading h2 { font-size: 27px; line-height: 1.3; letter-spacing: -0.035em; }
.page-heading p:not(.eyebrow) { max-width: 720px; margin-top: 7px; color: var(--text-secondary); font-size: 13px; }
.page-heading > .btn, .page-heading > .config-status { flex: 0 0 auto; margin-top: 9px; }
.error-text, .danger-text { color: var(--danger); }
.error-text { font-size: 12px; line-height: 1.6; overflow-wrap: anywhere; }

/* ── 上传与照片理解 ───────────────────────────────────────── */
.upload-section { margin-bottom: 28px; }
.drop-zone {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 272px;
  margin-bottom: 20px;
  padding: 48px 24px;
  overflow: hidden;
  color: var(--text);
  border: 1.5px dashed #cbbce6;
  border-radius: 22px;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.92), rgba(243, 238, 252, 0.88));
  box-shadow: inset 0 1px 0 #fff;
  cursor: pointer;
  text-align: center;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
}
.drop-zone::before { content: ""; position: absolute; width: 270px; height: 270px; top: -180px; right: -80px; border-radius: 50%; background: rgba(8, 145, 178, 0.06); }
.drop-zone:hover, .drop-zone:focus-visible { border-color: var(--accent); box-shadow: 0 12px 36px rgba(86, 54, 133, 0.08); }
.drop-zone.drag-over { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 5px rgba(124, 58, 237, 0.09); }
.drop-zone-inner { position: relative; }
.drop-icon { display: grid; place-items: center; width: 66px; height: 66px; margin: 0 auto 18px; color: var(--accent); border: 1px solid #e2d6f6; border-radius: 20px; background: #fff; box-shadow: 0 9px 25px rgba(81, 47, 128, 0.09); }
.drop-icon svg { width: 31px; height: 31px; }
.drop-title { margin-bottom: 5px; font-size: 19px; font-weight: 700; letter-spacing: -0.02em; }
.drop-subtitle { color: var(--text-secondary); font-size: 13px; }
.drop-hint { margin-top: 8px; color: var(--text-secondary); font-size: 12px; }
.preview-area { display: flex; align-items: center; gap: 18px; margin-bottom: 18px; padding: 15px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.preview-image { width: 96px; height: 96px; flex: 0 0 auto; overflow: hidden; border-radius: 13px; background: var(--surface-soft); }
.preview-image img { width: 100%; height: 100%; object-fit: cover; }
.preview-info { flex: 1; min-width: 0; }
.preview-name { margin-bottom: 6px; overflow: hidden; font-size: 14px; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.preview-exif { margin-bottom: 10px; color: var(--text-secondary); font-size: 12px; overflow-wrap: anywhere; }
.photo-thumbs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 12px; }
.photo-thumb { min-width: 0; overflow: hidden; border: 1.5px solid var(--border); border-radius: 13px; background: var(--surface); }
.photo-thumb.selected { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.09); }
.photo-thumb.has-error { border-color: var(--danger); }
.thumb-select { position: relative; display: block; width: 100%; padding: 0; border: 0; background: var(--surface-soft); cursor: pointer; }
.thumb-select img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.thumb-order, .thumb-status { position: absolute; padding: 3px 8px; color: #fff; border-radius: 12px; background: rgba(33, 27, 46, 0.8); font-size: 10px; backdrop-filter: blur(8px); }
.thumb-order { top: 7px; left: 7px; }
.thumb-status { right: 7px; bottom: 7px; }
.has-error .thumb-status { background: var(--danger); }
.thumb-name { padding: 7px 9px 0; overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.thumb-error { padding: 4px 9px 0; color: var(--danger); font-size: 11px; line-height: 1.4; overflow-wrap: anywhere; }
.thumb-actions { display: flex; flex-wrap: wrap; gap: 2px; padding: 5px; }
.thumb-actions .mini-btn { padding: 3px 6px; }
.analysis-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 11px 20px; margin-bottom: 12px; }
.analysis-item { min-width: 0; font-size: 13px; line-height: 1.65; overflow-wrap: anywhere; }
.analysis-item b, .analysis-facts b { display: block; margin-bottom: 2px; color: var(--text-secondary); font-size: 11px; font-weight: 600; }
.analysis-facts { margin-bottom: 12px; color: var(--text-secondary); font-size: 12px; line-height: 1.7; }
.analysis-item:has(.analysis-control) { padding: 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-hover); }
.analysis-control, .analysis-facts textarea { width: 100%; min-height: 40px; padding: 8px 10px; color: var(--text); border: 1px solid var(--border-strong); border-radius: 8px; outline: none; background: var(--surface); line-height: 1.6; resize: vertical; }
.analysis-control { margin-top: 5px; }
.analysis-control:focus, .analysis-facts textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.09); }
.analysis-facts.editing { margin-top: 14px; }
.analysis-facts textarea { margin-top: 5px; font-size: 13px; }
.analysis-edit-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 14px; margin-top: 12px; }
.group-list { margin-top: 12px; font-size: 13px; }
.group-list b { color: var(--text-secondary); }
.group-list ul { margin: 5px 0 0 20px; }

/* ── 平台与创作要求 ───────────────────────────────────────── */
.platform-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 11px; }
.platform-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 104px;
  padding: 16px 10px;
  color: var(--text);
  border: 1.5px solid var(--border);
  border-radius: 14px;
  background: #fdfcfe;
  cursor: pointer;
  transition: border-color 0.18s, background 0.18s, box-shadow 0.18s, transform 0.12s;
}
.platform-card:hover { border-color: #bea9e3; background: var(--surface-hover); transform: translateY(-1px); }
.platform-card.selected { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.08); }
.platform-icon { font-size: 28px; line-height: 1; }
.platform-name { font-size: 12px; font-weight: 600; }
.generation-style { display: grid; grid-template-columns: auto minmax(220px, 320px); align-items: center; justify-content: end; gap: 10px; margin-top: 16px; color: var(--text-secondary); font-size: 12px; font-weight: 600; }
.temp-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 11px; margin-top: 14px; }
.trend-use { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; min-height: 40px; color: var(--text-secondary); font-size: 12px; }
.trend-use input, .lock-toggle input { width: 16px; height: 16px; accent-color: var(--accent); }
.action-section { display: flex; justify-content: center; gap: 11px; margin: 26px 0 30px; }

/* ── 生成结果与反馈 ───────────────────────────────────────── */
.result-section, .style-section { margin-bottom: 28px; }
.result-meta { margin: 0 2px 13px; color: var(--text-secondary); font-size: 12px; }
.result-content, .version-card { overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.version-card { margin-bottom: 18px; }
.version-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 15px 22px; border-bottom: 1px solid var(--border); background: linear-gradient(100deg, #fbf9ff, #fff); }
.version-strategy { font-size: 13px; font-weight: 700; }
.version-strategy .tag { display: inline-grid; place-items: center; width: 25px; height: 25px; margin-right: 9px; color: var(--accent); border-radius: 8px; background: var(--accent-soft); }
.version-body { padding: 21px 22px 8px; }
.version-warnings { padding: 10px 22px; color: var(--danger); background: var(--danger-soft); font-size: 12px; }
.field-row { margin-bottom: 18px; }
.field-label { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 7px; color: var(--text-secondary); font-size: 11px; font-weight: 650; letter-spacing: 0.035em; }
.field-actions { display: flex; gap: 5px; }
.mini-btn, .copy-btn {
  min-height: 30px;
  padding: 4px 8px;
  color: var(--accent);
  border: 0;
  border-radius: 7px;
  background: transparent;
  cursor: pointer;
  font-size: 11px;
  font-weight: 550;
}
.mini-btn:hover, .copy-btn:hover { background: var(--accent-soft); }
.mini-btn:disabled { opacity: 0.4; cursor: wait; }
.version-title, .result-title { color: var(--text); font-size: 18px; font-weight: 700; line-height: 1.5; letter-spacing: -0.015em; overflow-wrap: anywhere; }
.version-text, .result-desc { color: #342c41; font-size: 14px; line-height: 1.85; white-space: pre-wrap; overflow-wrap: anywhere; }
.result-hashtags { display: flex; flex-wrap: wrap; gap: 7px; }
.hashtag-chip { display: inline-block; padding: 4px 10px; color: #6740a4; border: 1px solid #ebe2f8; border-radius: 20px; background: #f7f2ff; font-size: 12px; font-weight: 500; overflow-wrap: anywhere; }
.result-tone { display: inline-block; padding: 4px 10px; color: var(--text-secondary); border-radius: 20px; background: var(--surface-soft); font-size: 12px; }
.version-foot { display: flex; flex-wrap: wrap; gap: 8px; padding: 15px 22px; border-top: 1px dashed var(--border); background: #fdfcfe; }
.feedback-panel { display: flex; flex-wrap: wrap; gap: 7px; padding: 0 22px 17px; background: #fdfcfe; }
.fb-tag { min-height: 34px; padding: 5px 11px; color: var(--text-secondary); border: 1px solid var(--border); border-radius: 20px; background: var(--surface); cursor: pointer; font-size: 12px; }
.fb-tag.on { color: #fff; border-color: var(--accent); background: var(--accent); }
.result-feedback { display: flex; flex-direction: column; gap: 10px; margin-top: 18px; padding-top: 16px; border-top: 1px dashed var(--border); }
.feedback-hint { color: var(--text-secondary); font-size: 12px; }
.feedback-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.feedback-btn { font-size: 12px; }
.like-btn:hover { color: var(--success); border-color: var(--success); }
.dislike-btn:hover { color: var(--danger); border-color: var(--danger); }
.feedback-recorded, .style-saved { color: var(--success); font-size: 13px; font-weight: 500; }
.dislike-textarea { width: 100%; padding: 10px 12px; border: 1.5px solid var(--border); border-radius: var(--radius-sm); outline: none; font-size: 13px; resize: vertical; }
.dislike-textarea:focus { border-color: var(--accent); }

/* ── 风格与历史 ───────────────────────────────────────────── */
.style-header { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.style-badge { padding: 4px 9px; color: var(--accent); border-radius: 20px; background: var(--accent-soft); font-size: 11px; font-weight: 550; }
.style-manager { display: grid; grid-template-columns: minmax(180px, 0.8fr) minmax(300px, 1.2fr); gap: 14px; margin-bottom: 12px; padding: 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-hover); }
.style-manager > label { display: flex; flex-direction: column; gap: 6px; color: var(--text-secondary); font-size: 12px; font-weight: 600; }
.style-create-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.style-current-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 12px; min-height: 36px; margin-bottom: 10px; }
.style-current-actions .mini-btn { padding-left: 0; }
.style-panel { padding: 20px; border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.style-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px; }
.style-item { display: flex; flex-direction: column; gap: 6px; }
.style-label { color: var(--text-secondary); font-size: 11px; font-weight: 600; letter-spacing: 0.04em; }
.style-item select, .style-item input[type="text"] { width: 100%; padding: 10px 12px; color: var(--text); border: 1.5px solid var(--border); border-radius: var(--radius-sm); outline: none; background: var(--bg); font-size: 14px; }
.style-item select:focus, .style-item input[type="text"]:focus { border-color: var(--accent); }
.style-text-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 14px; }
.lock-toggle { display: flex; align-items: center; gap: 6px; min-height: 34px; color: var(--text-secondary); font-size: 12px; font-weight: 400; }
.style-form { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.style-form label { display: flex; flex-direction: column; gap: 6px; color: var(--text-secondary); font-size: 12px; }
.style-form label:nth-child(n+7) { grid-column: span 2; }
.style-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 11px; margin-top: 17px; }
.example-add { display: grid; grid-template-columns: 140px 1fr; gap: 9px; margin-bottom: 15px; }
.example-add textarea, .example-add #exNote { grid-column: span 2; }
.example-add .btn { grid-column: span 2; justify-self: start; }
.example-item, .history-item { padding: 14px 0; border-top: 1px solid var(--border); font-size: 13px; overflow-wrap: anywhere; }
.history-item:first-child { border-top: 0; }
.example-item .kind { margin-right: 8px; font-size: 11px; font-weight: 650; }
.example-item .kind.positive { color: var(--success); }
.example-item .kind.negative { color: var(--danger); }
.example-item .ex-note { color: var(--text-secondary); font-size: 12px; }
.example-item .ex-del { float: right; }
.history-meta { margin-bottom: 5px; color: var(--text-secondary); font-size: 11px; overflow-wrap: anywhere; }
.history-title { margin-bottom: 5px; font-weight: 650; }
.history-body { max-height: 70px; overflow: hidden; color: var(--text-secondary); white-space: pre-wrap; }
#historyList { display: grid; gap: 12px; }
.history-group { overflow: hidden; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); transition: border-color 0.18s ease, box-shadow 0.18s ease; }
.history-group:has(.history-group-toggle[aria-expanded="true"]) { border-color: #d7c6ed; box-shadow: var(--shadow); }
.history-group-head { display: flex; align-items: center; gap: 10px; padding: 10px 12px 10px 4px; background: linear-gradient(110deg, #fcfbfe, #f8f5fc); }
.history-group-toggle { display: flex; flex: 1; align-items: center; gap: 11px; min-width: 0; min-height: 58px; padding: 8px 10px; color: var(--text); border: 0; border-radius: 10px; background: transparent; cursor: pointer; text-align: left; }
.history-group-toggle:hover { background: rgba(124, 58, 237, 0.045); }
.history-chevron { flex: 0 0 auto; width: 18px; height: 18px; color: var(--accent); transition: transform 0.18s ease; }
.history-group-toggle[aria-expanded="true"] .history-chevron { transform: rotate(90deg); }
.history-group-heading { display: flex; flex: 1; flex-direction: column; min-width: 0; gap: 5px; }
.history-group-title { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; font-size: 14px; font-weight: 680; }
.history-group-type { padding: 2px 7px; color: var(--accent); border-radius: 6px; background: var(--accent-soft); font-size: 10px; font-weight: 600; }
.history-group-meta { color: var(--text-secondary); font-size: 11px; line-height: 1.55; overflow-wrap: anywhere; }
.history-group-preview { display: grid; min-width: 0; gap: 2px; padding-top: 3px; }
.history-preview-title { overflow: hidden; font-size: 12px; font-weight: 600; line-height: 1.55; text-overflow: ellipsis; white-space: nowrap; }
.history-preview-body { display: -webkit-box; overflow: hidden; color: var(--text-secondary); font-size: 12px; font-weight: 400; line-height: 1.6; overflow-wrap: anywhere; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.history-count { flex: 0 0 auto; padding: 4px 9px; color: var(--text-secondary); border: 1px solid var(--border); border-radius: 16px; background: var(--surface); font-size: 11px; white-space: nowrap; }
.history-group-delete { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 8px 11px; color: var(--danger); border: 1px solid transparent; border-radius: 9px; background: transparent; cursor: pointer; font-size: 12px; white-space: nowrap; }
.history-group-delete svg { width: 16px; height: 16px; }
.history-group-delete:hover { border-color: #efcbd2; background: var(--danger-soft); }
.history-group-delete:disabled { cursor: wait; opacity: 0.55; }
.history-group-content { position: relative; display: grid; gap: 12px; margin: 0 14px 14px 30px; padding: 14px 14px 14px 20px; border-left: 2px solid #d5c2ed; border-radius: 0 0 13px 13px; background: #faf8fd; }
.history-record { padding: 16px; border: 1px solid #e2d9ee; border-radius: 12px; background: #fff; box-shadow: 0 3px 12px rgba(66, 43, 96, 0.045); }
.history-record:first-child { border-top: 1px solid #e2d9ee; }
.history-record-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; margin-bottom: 10px; color: var(--text-secondary); font-size: 11px; }
.history-strategy { padding: 4px 8px; color: var(--accent); border-radius: 7px; background: var(--accent-soft); font-weight: 600; }
.history-record .history-title { font-size: 14px; line-height: 1.65; }
.history-record .history-body { max-height: none; margin: 8px 0 12px; font-size: 13px; line-height: 1.8; overflow-wrap: anywhere; }
.history-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; }
.history-tags span { color: var(--cyan); font-size: 11px; overflow-wrap: anywhere; }
.history-loading, .history-empty { display: flex; align-items: center; justify-content: center; gap: 15px; min-height: 156px; padding: 28px 20px; color: var(--text-secondary); border: 1px dashed var(--border-strong); border-radius: 14px; background: var(--surface-hover); text-align: left; }
.history-loading .spinner { flex: 0 0 auto; width: 27px; height: 27px; }
.history-loading strong, .history-empty strong { display: block; margin-bottom: 5px; color: var(--text); font-size: 14px; }
.history-loading p, .history-empty p { max-width: 420px; font-size: 12px; line-height: 1.7; }
.history-empty { flex-direction: column; gap: 7px; text-align: center; }
.history-empty .mini-btn { margin-top: 8px; }

/* ── 趋势来源与报告 ───────────────────────────────────────── */
.trend-toolbar { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; margin-bottom: 15px; }
.source-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px; }
.source-card { padding: 15px; border: 1px solid var(--border); border-radius: 13px; background: var(--surface-hover); }
.source-head, .source-meta, .report-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
.source-head { font-size: 13px; }
.source-type, .config-status { display: inline-flex; align-items: center; min-height: 24px; padding: 3px 9px; border-radius: 20px; font-size: 10px; font-weight: 600; line-height: 1.35; white-space: nowrap; }
.source-type { color: var(--text-secondary); background: var(--surface-soft); }
.source-type.third_party_api { color: var(--warning); background: var(--warning-soft); }
.source-type.official_api { color: var(--cyan); background: #e9f8fb; }
.source-meta { margin: 11px 0 7px; color: var(--text-secondary); font-size: 11px; }
.config-status.ready { color: var(--success); background: var(--success-soft); }
.config-status.pending { color: var(--warning); background: var(--warning-soft); }
.trend-actions { display: flex; flex-wrap: wrap; gap: 9px; margin: 14px 0 9px; }
.report-head { font-size: 14px; }
.report-meta { margin: 7px 0 11px; color: var(--text-secondary); font-size: 12px; }
.report-scope { padding: 12px 14px; color: #4b3a64; border-left: 3px solid #bda1ed; border-radius: 4px 10px 10px 4px; background: #f7f3fd; font-size: 13px; }
.report-section { margin-top: 14px; font-size: 13px; }
.frequency-list { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 7px; }
.frequency-list span { padding: 5px 10px; color: var(--text-secondary); border: 1px solid var(--border); border-radius: 16px; background: #fdfcfe; font-size: 12px; }
.history-report { display: block; width: 100%; min-height: 40px; padding: 10px 0; color: var(--accent); border: 0; border-top: 1px solid var(--border); background: none; cursor: pointer; text-align: left; font-size: 12px; }
.trend-item { padding: 14px 0; border-top: 1px solid var(--border); }
.trend-item:first-child { border-top: 0; }
.trend-item-title { margin-bottom: 5px; font-size: 14px; font-weight: 650; overflow-wrap: anywhere; }
.trend-item-title a { color: var(--text); text-decoration-color: var(--border-strong); text-underline-offset: 3px; }
.trend-metrics { margin-top: 7px; color: var(--text-secondary); font-size: 11px; overflow-wrap: anywhere; }

/* ── 创作复盘 ─────────────────────────────────────────────── */
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 13px; margin-bottom: 18px; }
.metric-card { position: relative; display: flex; flex-direction: column; min-width: 0; padding: 20px; overflow: hidden; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); box-shadow: var(--shadow); }
.metric-card::before { content: ""; position: absolute; top: 0; right: 0; left: 0; height: 3px; background: linear-gradient(90deg, var(--accent), #b89bea); }
.metric-card:nth-child(even)::before { background: linear-gradient(90deg, var(--cyan), #79c9d9); }
.metric-card > span { color: var(--text-secondary); font-size: 12px; }
.metric-card strong { margin: 7px 0 2px; font-size: 31px; line-height: 1.25; letter-spacing: -0.04em; }
.metric-card small { color: var(--text-secondary); font-size: 11px; line-height: 1.5; overflow-wrap: anywhere; }
.review-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.suggestion-panel { border-color: #ddd0f1; background: linear-gradient(145deg, #fff, #fcfbff); }
.eligibility { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 10px; padding: 13px 15px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-hover); }
.eligibility p { color: #4f455e; font-size: 13px; }
.eligibility small { flex-basis: 100%; color: var(--text-secondary); font-size: 11px; }
.suggestion-card { margin-top: 14px; padding: 18px; border: 1px solid #ded2f0; border-radius: 14px; background: #fff; }
.suggestion-card.applied { border-color: #cde8db; }
.suggestion-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 13px; }
.suggestion-head > div { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.suggestion-head b { font-size: 14px; }
.suggestion-changes { display: grid; gap: 10px; margin-bottom: 14px; }
.suggestion-change { padding: 13px 14px; border-radius: 11px; background: #f8f5fc; }
.suggestion-field { margin-bottom: 4px; color: var(--accent); font-size: 11px; font-weight: 700; }
.suggestion-value { font-size: 13px; font-weight: 600; line-height: 1.7; overflow-wrap: anywhere; }
.suggestion-change p { margin-top: 6px; color: var(--text-secondary); font-size: 12px; }
.evidence-links { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 9px; }
.evidence-links span { padding: 3px 7px; color: var(--text-secondary); border: 1px solid var(--border); border-radius: 6px; background: #fff; font-size: 10px; }
.signal-item { padding: 15px 0; border-top: 1px solid var(--border); }
.signal-item:first-child { border-top: 0; }
.signal-title { margin-bottom: 7px; font-size: 13px; font-weight: 650; }
.signal-item > p { margin-top: 8px; font-size: 13px; }
.signal-diff { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.signal-diff del, .signal-diff ins { display: block; padding: 11px 12px; border-radius: 9px; font-size: 12px; line-height: 1.7; text-decoration: none; white-space: pre-wrap; overflow-wrap: anywhere; }
.signal-diff del { color: #87515b; background: #fff3f4; }
.signal-diff ins { color: #28634c; background: #eef9f3; }

/* ── API 设置 ─────────────────────────────────────────────── */
.settings-notice { margin-bottom: 18px; padding: 13px 16px; color: #426275; border: 1px solid #d6e9ef; border-radius: 12px; background: #f0f9fb; font-size: 12px; }
.settings-notice.error { color: var(--danger); border-color: #f0ccd3; background: var(--danger-soft); }
.integration-card { padding-bottom: 24px; }
.integration-card .panel-title > span:first-child { margin-right: auto; }
.integration-card > label, .integration-fields > label, .field-label-text, .form-grid label { display: flex; flex-direction: column; gap: 7px; color: var(--text-secondary); font-size: 12px; font-weight: 550; }
.integration-card > label + label { margin-top: 14px; }
.integration-fields { margin-top: 15px; }
.integration-fields > .hint { margin-top: 10px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.integration-fields > label { margin-bottom: 13px; }
.settings-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 13px; padding: 5px 2px; }
.settings-actions .hint { flex: 1; min-width: 240px; }

/* ── 加载与 Toast ─────────────────────────────────────────── */
button.is-busy { cursor: wait; }
.button-spinner { display: inline-block; width: 1em; height: 1em; margin-right: 6px; vertical-align: -2px; border: 2px solid currentColor; border-top-color: transparent; border-radius: 50%; animation: spin 0.8s linear infinite; }
.loading-overlay { position: fixed; inset: 0; z-index: 200; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; background: rgba(247, 246, 251, 0.82); backdrop-filter: blur(10px); }
.loading-spinner { display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 28px 34px; border: 1px solid rgba(255,255,255,0.9); border-radius: 18px; background: rgba(255,255,255,0.8); box-shadow: var(--shadow-lg); }
.spinner { width: 34px; height: 34px; border: 3px solid #e5dcf1; border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-overlay p { max-width: 300px; color: var(--text-secondary); font-size: 13px; text-align: center; }
.toast { position: fixed; bottom: 24px; left: 50%; z-index: 300; width: max-content; max-width: calc(100vw - 32px); padding: 12px 19px; transform: translateX(-50%); border-radius: 12px; box-shadow: var(--shadow-lg); font-size: 13px; font-weight: 550; text-align: center; animation: toastIn 0.2s ease; }
.toast.error { color: #fff; background: #a9344b; }
.toast.success { color: #fff; background: #167a52; }
.toast.info { color: #fff; background: #332944; }
@keyframes toastIn { from { opacity: 0; transform: translateX(-50%) translateY(8px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }

/* ── 响应式与动效偏好 ─────────────────────────────────────── */
@media (max-width: 900px) {
  .platform-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .temp-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
  .app { padding: 0 16px 44px; }
  .header { margin: 0 -16px; padding: 0 16px; }
  .header-inner { min-height: 60px; gap: 10px; }
  .logo-icon { width: 33px; height: 33px; }
  .logo-text { font-size: 15px; }
  .logo-text span, .header-status { display: none; }
  .header-actions { gap: 3px; }
  .header-button { min-height: 44px; }
  .tab { min-height: 46px; padding: 10px 13px 12px; font-size: 12px; }
  .main { padding-top: 22px; }
  .panel { padding: 19px 17px; border-radius: 16px; }
  .page-heading { flex-direction: column; gap: 13px; margin-bottom: 19px; }
  .page-heading h2 { font-size: 24px; }
  .page-heading > .btn, .page-heading > .config-status { margin-top: 0; }
  .drop-zone { min-height: 230px; padding: 38px 18px; border-radius: 18px; }
  .drop-title { font-size: 17px; }
  .preview-area { align-items: flex-start; gap: 13px; padding: 12px; }
  .preview-image { width: 78px; height: 78px; }
  .preview-name { white-space: normal; overflow-wrap: anywhere; }
  .photo-thumbs { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .analysis-grid { grid-template-columns: 1fr; gap: 10px; }
  .platform-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .platform-card { min-height: 92px; }
  .temp-grid, .trend-toolbar, .source-grid, .form-grid, .style-form, .style-text-row, .style-manager, .review-grid, .signal-diff { grid-template-columns: 1fr; }
  .generation-style { grid-template-columns: 1fr; justify-content: stretch; }
  .style-form label:nth-child(n+7) { grid-column: span 1; }
  .example-add { grid-template-columns: 1fr; }
  .example-add textarea, .example-add #exNote, .example-add .btn { grid-column: span 1; }
  .action-section { align-items: stretch; flex-direction: column; }
  .action-section .btn { width: 100%; }
  .version-head, .version-body, .version-foot { padding-right: 17px; padding-left: 17px; }
  .version-warnings { padding-right: 17px; padding-left: 17px; }
  .feedback-panel { padding-right: 17px; padding-left: 17px; }
  .field-label { align-items: flex-start; }
  .field-actions { flex-wrap: wrap; justify-content: flex-end; }
  .metric-grid { gap: 10px; }
  .metric-card { padding: 16px; }
  .metric-card strong { font-size: 27px; }
  .suggestion-card { padding: 15px; }
  .suggestion-head { flex-direction: column; gap: 6px; }
  .settings-actions { align-items: flex-start; flex-direction: column; }
  .settings-actions .hint { min-width: 0; }
  .history-group-head { flex-wrap: wrap; gap: 0; padding: 8px; }
  .history-group-toggle { flex-basis: 100%; padding-right: 6px; padding-left: 6px; }
  .history-group-delete { margin: 0 6px 6px auto; }
  .history-group-content { gap: 10px; margin: 0 8px 10px 16px; padding: 10px 8px 10px 12px; }
  .history-record { padding: 14px 12px; }
  .history-loading { min-height: 140px; padding: 22px 16px; }
  .btn-sm { min-height: 44px; }
  .mini-btn { min-height: 38px; }
  .fb-tag { min-height: 40px; }
  .login-card { padding: 34px 25px; border-radius: 22px; }
  .login-card h1 { font-size: 27px; }
  .toast { bottom: 16px; }
}

@media (max-width: 380px) {
  .metric-grid { grid-template-columns: 1fr; }
  .thumb-actions .mini-btn { padding-right: 4px; padding-left: 4px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
