:root {
  --bg: #f5f5f7;
  --surface: rgba(255, 255, 255, 0.82);
  --surface-solid: #ffffff;
  --text: #1d1d1f;
  --muted: #6e6e73;
  --line: rgba(0, 0, 0, 0.06);
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.06);
  --radius: 20px;
  --pink: #ff6b9d;
  --mint: #6bcb77;
  --blue: #4d96ff;
  --lavender: #a66cff;
  --sun: #ffd166;
  --coral: #ff8a65;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
}
body {
  font-family: var(--font);
  color: var(--text);
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(circle at 0% 0%, rgba(255, 107, 157, 0.12), transparent 35%),
    radial-gradient(circle at 100% 0%, rgba(77, 150, 255, 0.12), transparent 30%),
    radial-gradient(circle at 50% 100%, rgba(107, 203, 119, 0.1), transparent 35%),
    var(--bg);
}

.header {
  flex-shrink: 0;
  z-index: 10;
  backdrop-filter: blur(18px);
  background: rgba(245, 245, 247, 0.72);
  border-bottom: 1px solid var(--line);
}
.header-inner {
  max-width: 1440px;
  margin: 0 auto;
  padding: 18px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
.selected-count {
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
}
.panel-head-videos {
  align-items: center;
}
.panel-head-left {
  display: flex;
  align-items: center;
  gap: 10px;
}
.select-all-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  margin: 0;
}
.select-all-label h2 { margin: 0; }
.select-all-label input {
  width: 16px;
  height: 16px;
  accent-color: var(--blue);
  cursor: pointer;
}
.brand { display: flex; gap: 14px; align-items: center; }
.brand-dot {
  width: 14px; height: 14px; border-radius: 50%;
  background: linear-gradient(135deg, var(--pink), var(--blue), var(--mint));
  box-shadow: 0 0 0 6px rgba(255, 107, 157, 0.12);
}
.brand h1 { margin: 0; font-size: 22px; font-weight: 700; letter-spacing: -0.02em; }
.brand p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }

.layout {
  flex: 1;
  min-height: 0;
  max-width: 1440px;
  width: 100%;
  margin: 0 auto;
  padding: 20px 24px;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr) 360px;
  gap: 18px;
  overflow: hidden;
}

.panel {
  background: var(--surface);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.65);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
  max-height: 100%;
  overflow: hidden;
}
.panel-head,
.platform-tabs,
.analysis-stats,
.prompt-box,
.analysis-toolbar {
  flex-shrink: 0;
}
.panel-head {
  padding: 18px 20px 12px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
}
.panel-head h2 { margin: 0; font-size: 17px; font-weight: 650; }
.video-link {
  display: block;
  margin-top: 6px;
  font-size: 12px;
  color: var(--blue);
  text-decoration: none;
  word-break: break-all;
}
.video-link:empty { display: none; }

.badge {
  background: linear-gradient(135deg, var(--pink), var(--lavender));
  color: white;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
}

.video-list {
  padding: 10px;
  overflow-x: hidden;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  overscroll-behavior: contain;
}
.video-item {
  width: 100%;
  text-align: left;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.55);
  border-radius: 16px;
  padding: 12px 14px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: 0.2s ease;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.video-item-check {
  flex-shrink: 0;
  padding-top: 2px;
}
.video-item-check input {
  width: 16px;
  height: 16px;
  accent-color: var(--blue);
  cursor: pointer;
}
.video-item-body {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  padding: 0;
  text-align: left;
  cursor: pointer;
  font: inherit;
  color: inherit;
}
.video-item.selected-batch {
  border-color: rgba(255, 107, 157, 0.35);
  background: linear-gradient(180deg, rgba(255,107,157,0.06), rgba(255,255,255,0.8));
}
.video-item:hover { transform: translateY(-1px); box-shadow: 0 8px 24px rgba(0,0,0,0.05); }
.video-item.active {
  border-color: rgba(77, 150, 255, 0.35);
  background: linear-gradient(180deg, rgba(77,150,255,0.08), rgba(255,255,255,0.8));
}
.video-item-title { font-size: 14px; font-weight: 600; margin-bottom: 6px; }
.video-item-meta { font-size: 12px; color: var(--muted); }

.title-input {
  width: 100%;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  font: inherit;
  color: inherit;
  padding: 2px 6px;
  margin: -2px -6px;
  transition: border-color 0.15s, background 0.15s;
}
.title-input:hover:not(:disabled) {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.6);
}
.title-input:focus {
  outline: none;
  border-color: rgba(77, 150, 255, 0.45);
  background: #fff;
}
.title-input:disabled {
  opacity: 0.65;
  cursor: default;
}
.title-input-main {
  display: block;
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 4px;
  padding: 4px 8px;
  margin-left: -8px;
}
.video-item .title-input {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 6px;
}
.title-save-status {
  display: inline-block;
  font-size: 11px;
  color: var(--muted);
  margin-left: 4px;
}
.title-save-status.saving { color: var(--blue); }
.title-save-status.saved { color: #22a06b; }
.title-save-status.error { color: #e34935; }

.empty-hint {
  padding: 0 16px 16px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.6;
}

.comments-scroll {
  padding: 16px 20px 20px;
  overflow-x: hidden;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  overscroll-behavior: contain;
}
.placeholder {
  min-height: 240px;
  display: grid;
  place-content: center;
  text-align: center;
  color: var(--muted);
}
.placeholder-icon { font-size: 42px; margin-bottom: 8px; }

.comment-card {
  background: var(--surface-solid);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px 16px;
  margin-bottom: 12px;
}
.comment-top { display: flex; justify-content: space-between; gap: 12px; }
.comment-author { font-weight: 650; font-size: 14px; }
.comment-meta { font-size: 12px; color: var(--muted); white-space: nowrap; }
.comment-content { margin-top: 8px; line-height: 1.65; font-size: 15px; }
.replies { margin-top: 12px; padding-left: 14px; border-left: 3px solid rgba(255, 107, 157, 0.35); }
.reply {
  background: #fafafa;
  border-radius: 14px;
  padding: 10px 12px;
  margin-top: 8px;
}

.stats-row, .analysis-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.analysis-stats {
  padding: 0 20px 12px;
}
.panel-analysis {
  min-height: 0;
}
.analysis-body {
  padding: 0 20px 20px;
  flex: 1;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  font-size: 14px;
  line-height: 1.7;
}
.stat-chip {
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,0.8);
  border: 1px solid var(--line);
}
.stat-chip.pink { color: var(--pink); }
.stat-chip.mint { color: #2f9e44; }
.stat-chip.blue { color: var(--blue); }
.stat-chip.sun { color: #c58d00; }

.platform-tabs {
  display: flex;
  gap: 8px;
  padding: 0 20px 12px;
  border-bottom: 1px solid var(--line);
}
.platform-tab {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.7);
  color: var(--muted);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.platform-tab.active {
  color: white;
  border-color: transparent;
  background: linear-gradient(135deg, var(--pink), var(--coral));
}
.platform-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  margin-right: 8px;
  vertical-align: 1px;
}
.platform-badge.douyin { background: rgba(29, 29, 31, 0.08); color: #1d1d1f; }
.platform-badge.xiaohongshu { background: rgba(255, 45, 85, 0.12); color: #ff2d55; }

.prompt-box {
  margin: 0 16px 12px;
  padding: 12px;
  border-radius: 16px;
  background: rgba(255,255,255,0.65);
  border: 1px solid var(--line);
}
.prompt-box summary { cursor: pointer; font-weight: 600; font-size: 13px; }
.prompt-box textarea {
  width: 100%;
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace;
  resize: vertical;
}
.prompt-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}
.analysis-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 0 20px 10px;
}
.analysis-saved {
  flex: 1;
  min-width: 140px;
  font-size: 12px;
  color: var(--muted);
}
.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4 {
  margin: 1.2em 0 0.6em;
  line-height: 1.35;
  letter-spacing: -0.01em;
}
.markdown-body h1 { font-size: 20px; }
.markdown-body h2 { font-size: 17px; }
.markdown-body h3 { font-size: 15px; color: #333; }
.markdown-body h4 { font-size: 14px; }
.markdown-body p { margin: 0.75em 0; }
.markdown-body ul,
.markdown-body ol {
  margin: 0.6em 0 0.9em;
  padding-left: 1.35em;
}
.markdown-body li { margin: 0.35em 0; }
.markdown-body li > ul,
.markdown-body li > ol { margin-top: 0.25em; }
.markdown-body strong { font-weight: 700; color: #111; }
.markdown-body em { font-style: italic; }
.markdown-body code {
  font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace;
  background: rgba(0, 0, 0, 0.05);
  padding: 0.15em 0.4em;
  border-radius: 6px;
}
.markdown-body pre {
  margin: 0.9em 0;
  padding: 12px 14px;
  border-radius: 14px;
  background: #1d1d1f;
  color: #f5f5f7;
  overflow: auto;
}
.markdown-body pre code {
  background: none;
  padding: 0;
  color: inherit;
}
.markdown-body blockquote {
  margin: 0.9em 0;
  padding: 0.2em 0 0.2em 14px;
  border-left: 3px solid rgba(77, 150, 255, 0.45);
  color: var(--muted);
}
.markdown-body hr {
  border: none;
  border-top: 1px solid var(--line);
  margin: 1.2em 0;
}
.markdown-body a {
  color: var(--blue);
  text-decoration: none;
}
.markdown-body a:hover { text-decoration: underline; }
.markdown-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.9em 0;
  font-size: 13px;
}
.markdown-body th,
.markdown-body td {
  border: 1px solid var(--line);
  padding: 8px 10px;
  text-align: left;
}
.markdown-body .muted { color: var(--muted); }

.btn {
  border: none;
  border-radius: 999px;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: 0.2s ease;
}
.btn-sm { padding: 7px 12px; font-size: 12px; }
.btn-primary {
  color: white;
  background: linear-gradient(135deg, var(--blue), var(--lavender));
  box-shadow: 0 8px 20px rgba(77, 150, 255, 0.25);
}
.btn-primary:disabled { opacity: 0.45; cursor: not-allowed; box-shadow: none; }
.btn-secondary {
  background: rgba(255,255,255,0.9);
  border: 1px solid var(--line);
}
.btn-ghost {
  background: rgba(255,255,255,0.55);
  border: 1px solid var(--line);
}

.dialog {
  border: none;
  padding: 0;
  background: transparent;
}
.dialog::backdrop { background: rgba(0,0,0,0.28); backdrop-filter: blur(4px); }
.dialog-card {
  width: min(440px, calc(100vw - 32px));
  background: var(--surface-solid);
  border-radius: 24px;
  padding: 24px;
  box-shadow: var(--shadow);
}
.dialog-card h3 { margin: 0 0 16px; }
.dialog-card label {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
  font-size: 13px;
  font-weight: 600;
}
.dialog-card input {
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  font-size: 14px;
}
.hint { font-size: 12px; color: var(--muted); margin: -6px 0 12px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }

.loading {
  display: inline-block;
  width: 14px; height: 14px;
  border: 2px solid rgba(255,255,255,0.35);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  vertical-align: -2px;
  margin-right: 6px;
}
@keyframes spin { to { transform: rotate(360deg); } }

@keyframes spin { to { transform: rotate(360deg); } }

.dialog-wide .batch-reports-card {
  width: min(960px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
}
.batch-reports-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 4px;
}
.batch-reports-head h3 { margin: 0; }
.batch-reports-hint { margin: 0 0 12px; }
.batch-reports-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 16px;
  min-height: 420px;
  max-height: calc(100vh - 180px);
}
.batch-reports-list-wrap,
.batch-reports-preview-wrap {
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.batch-reports-list {
  overflow-y: auto;
  flex: 1;
  padding: 8px;
}
.batch-reports-preview-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,0.85);
}
.batch-reports-preview-title {
  flex: 1;
  min-width: 120px;
  font-size: 13px;
  font-weight: 600;
}
.batch-reports-preview {
  overflow-y: auto;
  flex: 1;
  padding: 16px;
  font-size: 14px;
  line-height: 1.7;
}
.batch-report-item {
  width: 100%;
  text-align: left;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 6px;
  background: transparent;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.batch-report-item:hover {
  background: rgba(77,150,255,0.06);
}
.batch-report-item.active {
  border-color: rgba(77,150,255,0.35);
  background: rgba(77,150,255,0.08);
}
.batch-report-item-title {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 4px;
  line-height: 1.4;
}
.batch-report-item-meta {
  font-size: 11px;
  color: var(--muted);
}

@media (max-width: 1100px) {
  html, body {
    height: auto;
    overflow: auto;
  }
  body {
    display: block;
  }
  .layout {
    grid-template-columns: 1fr;
    height: auto;
    overflow: visible;
  }
  .panel {
    height: auto;
    max-height: none;
    min-height: 420px;
  }
  .comments-scroll,
  .analysis-body,
  .video-list {
    max-height: 60vh;
  }
  .batch-reports-layout {
    grid-template-columns: 1fr;
    max-height: none;
  }
}
