/* ==========================================================================
   元镜 - 1:1 Pixel Perfect Design System & Application Styles
   ========================================================================== */

:root {
  /* Primary & Accent Palette */
  --primary-color: #5346e0;
  --primary-hover: #4335ce;
  --primary-light: #eeeffe;
  --primary-gradient: linear-gradient(135deg, #6355ff 0%, #4b3bcb 100%);
  
  /* Neutral Palette */
  --sidebar-bg: #181e2e;
  --sidebar-hover: #22293d;
  --sidebar-text: #8c96ab;
  --sidebar-text-active: #ffffff;
  --header-bg: #ffffff;
  --body-bg: #f5f7fa;
  
  /* Content & Text Colors */
  --text-main: #1f2937;
  --text-secondary: #6b7280;
  --text-muted: #9ca3af;
  --border-color: #e5e7eb;
  --card-bg: #ffffff;

  /* Tag & Status Colors */
  --status-green-bg: #f0fdf4;
  --status-green-border: #bbf7d0;
  --status-green-text: #16a34a;
  
  --status-orange-bg: #fff7ed;
  --status-orange-border: #ffedd5;
  --status-orange-text: #ea580c;

  --status-red-bg: #fef2f2;
  --status-red-border: #fecaca;
  --status-red-text: #dc2626;

  --status-blue-bg: #eff6ff;
  --status-blue-border: #bfdbfe;
  --status-blue-text: #2563eb;
  
  --dark-pill-bg: #374151;
  --dark-navy-btn: #1e2638;

  /* Shadows & Radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.06), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
  --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.03);

  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s ease;
}

/* Reset & Global Settings */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background-color: var(--body-bg);
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* Main Layout Grid */
#app-layout {
  display: flex;
  width: 100vw;
  height: 100vh;
}

/* Sidebar Styles */
.sidebar {
  width: 230px;
  background-color: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  flex-shrink: 0;
  z-index: 20;
}

.sidebar-brand {
  height: 64px;
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.sidebar-brand-logo {
  position: relative;
  width: 86px;
  flex-shrink: 0;
  aspect-ratio: 934 / 328;
  overflow: hidden;
}

.sidebar-brand-logo img {
  position: absolute;
  width: 164.454%;
  max-width: none;
  height: auto;
  transform: translate(-20.768%, -40.625%);
}

/* 元镜字标是按容器比例画的 SVG，不需要上面那套裁切。 */
.sidebar-brand-logo img.yj-wordmark {
  position: static;
  width: 100%;
  height: 100%;
  transform: none;
}

.sidebar-brand-tagline {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0;
  padding-left: 12px;
  border-left: 1px solid rgba(185, 177, 244, 0.24);
  color: #c7c5df;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.35;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.sidebar-brand-amp {
  color: #a99cf4;
}

.sidebar-nav {
  padding: 20px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  color: var(--sidebar-text);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
  user-select: none;
}

.nav-item:hover {
  background-color: var(--sidebar-hover);
  color: #ffffff;
}

.nav-item.active {
  background: var(--primary-gradient);
  color: var(--sidebar-text-active);
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(83, 70, 224, 0.35);
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-avatar-badge {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366f1, #4f46e5);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
}

.user-meta {
  display: flex;
  flex-direction: column;
}

.user-meta-name {
  color: #ffffff;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
}

.user-meta-role {
  color: #6b7280;
  font-size: 11px;
}

/* Main Content Area */
.main-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

/* Header Navbar */
.top-header {
  height: 64px;
  background-color: var(--header-bg);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  flex-shrink: 0;
  position: relative;
  z-index: 200;
}

.header-title-area {
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-main);
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* Points Badge */
.points-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  background-color: #fffbe6;
  border: 1px solid #ffe58f;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 13px;
  color: #d48806;
  font-weight: 600;
}

.points-icon {
  font-size: 13px;
}

/* Header Icons */
.header-icon-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #6b7280;
  cursor: pointer;
  position: relative;
  transition: background-color var(--transition-fast);
}

.header-icon-btn:hover {
  background-color: #f3f4f6;
  color: var(--text-main);
}

.notification-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  background-color: #ff4d4f;
  color: #ffffff;
  font-size: 10px;
  font-weight: 700;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #ffffff;
}

/* Profile Menu */
.profile-menu {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 20px;
}

/* Views Container & Switcher */
.view-container {
  flex: 1;
  overflow-y: auto;
  padding: 28px;
  display: none;
  animation: fadeIn 0.25s ease-in-out;
}

.view-container.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Section Header & Subtitles */
.page-header {
  margin-bottom: 24px;
}

.page-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 4px;
}

.page-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
}

/* Common Card Box */
.card-box {
  background-color: var(--card-bg);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}

.card-header-flex {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.card-title-text {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Badges & Pills */
.pill-tag {
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 12px;
  font-weight: 500;
}

.pill-tag.gray {
  background-color: #f3f4f6;
  color: #4b5563;
}

.pill-tag.green {
  background-color: #f0fdf4;
  color: #16a34a;
  font-weight: 600;
}

.pill-tag.orange {
  background-color: #fff7ed;
  color: #ea580c;
  font-weight: 600;
}

.pill-tag.dark {
  background-color: var(--dark-pill-bg);
  color: #ffffff;
  font-weight: 600;
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 4px;
}

/* Button UI Components */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  border: 1px solid transparent;
  outline: none;
  user-select: none;
}

/* 原先只有 .auth-btn:disabled 有样式，.btn 加了 disabled 后看不出任何区别，
   用户会以为按钮坏了而反复点击。补一条通用的禁用态。 */
.btn:disabled,
.btn[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
  filter: grayscale(1);
}

.btn-primary {
  background: var(--primary-gradient);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(83, 70, 224, 0.25);
}

.btn-primary:hover {
  opacity: 0.93;
  box-shadow: 0 6px 16px rgba(83, 70, 224, 0.35);
  transform: translateY(-1px);
}

.btn-navy {
  background-color: var(--dark-navy-btn);
  color: #ffffff;
}

.btn-navy:hover {
  background-color: #2d3748;
}

.btn-secondary {
  background-color: #ffffff;
  border-color: #d1d5db;
  color: #374151;
}

.btn-secondary:hover {
  background-color: #f9fafb;
  border-color: #9ca3af;
}

.btn-block {
  width: 100%;
}

.btn-lg {
  padding: 13px 24px;
  font-size: 15px;
}

/* Inputs & Form Elements */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 8px;
}

.form-input, .form-textarea, .form-select {
  width: 100%;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  font-size: 13.5px;
  color: var(--text-main);
  background-color: #ffffff;
  outline: none;
  transition: border-color var(--transition-fast);
  font-family: inherit;
}

.form-input:focus, .form-textarea:focus, .form-select:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(83, 70, 224, 0.1);
}

.form-textarea {
  resize: vertical;
  min-height: 80px;
}

/* View 1: 素材修改 Layout */
.edit-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

/* Procedural Code-Generated Media Box */
.preview-media-box {
  background: linear-gradient(145deg, #f1f5f9 0%, #e2e8f0 100%);
  border-radius: var(--radius-md);
  height: 300px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  color: #64748b;
  font-size: 14px;
  margin-bottom: 16px;
  overflow: hidden;
  border: 1px solid #cbd5e1;
  padding-top: 40px;
}

.preview-media-box img {
  max-width: 90%;
  max-height: 240px;
  object-fit: contain;
  border-radius: 8px;
}

/* Procedural Mockup Poster */
.procedural-poster {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  background: radial-gradient(circle at 50% 30%, #fef3c7 0%, #f1f5f9 70%);
}

.poster-watermark {
  font-size: 13px;
  color: #94a3b8;
  font-weight: 500;
  letter-spacing: 0.5px;
  background: rgba(255, 255, 255, 0.85);
  padding: 6px 14px;
  border-radius: 20px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}

.poster-hero-mock {
  margin-top: 10px;
  width: 70px;
  height: 70px;
  border-radius: 50%;
  background: linear-gradient(135deg, #f43f5e, #fb7185);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 28px;
  box-shadow: 0 8px 16px rgba(244, 63, 94, 0.25);
}

.poster-badge-text {
  margin-top: 10px;
  font-size: 12px;
  font-weight: 700;
  color: #e11d48;
  background: #ffe4e6;
  padding: 2px 8px;
  border-radius: 4px;
}

.score-badge-corner {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 5;
}

.score-badge-corner .score-num {
  color: #fbbf24;
}

.score-badge-corner .score-num-green {
  color: #4ade80;
}

/* Alert Diagnosis Box */
.alert-diagnosis {
  background-color: #fff7ed;
  border: 1px solid #ffedd5;
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-bottom: 18px;
}

.alert-diagnosis-title {
  color: #c2410c;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 4px;
}

.alert-diagnosis-body {
  color: #ea580c;
  font-size: 12px;
  line-height: 1.6;
}

/* Output Result Box */
.result-dashed-box {
  background: linear-gradient(145deg, #f8fafc 0%, #eef2ff 100%);
  border: 2px dashed #818cf8;
  border-radius: var(--radius-md);
  height: 260px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  margin-bottom: 16px;
  overflow: hidden;
}

.procedural-result-poster {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 50% 40%, #e0e7ff 0%, #f8fafc 80%);
  position: relative;
}

.result-done-text {
  color: var(--primary-color);
  font-weight: 800;
  font-size: 17px;
  letter-spacing: 0.5px;
  margin-top: 8px;
}

.result-sparkle-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--primary-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 20px;
  box-shadow: 0 4px 14px rgba(83, 70, 224, 0.35);
}

.result-enhanced-cta {
  margin-top: 10px;
  background: linear-gradient(90deg, #ef4444, #f97316);
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
}

/* Evaluation Box */
.eval-result-box {
  background-color: #f0fdf4;
  border: 1px solid #dcfce7;
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 18px;
}

.eval-title {
  color: #166534;
  font-weight: 700;
  font-size: 13.5px;
  margin-bottom: 10px;
}

.eval-bullet {
  font-size: 12.5px;
  color: #15803d;
  margin-bottom: 6px;
}

.eval-bullet:last-child {
  margin-bottom: 0;
}

.eval-bold {
  font-weight: 700;
  color: #16a34a;
}

/* Dashed Dropzone */
.dashed-dropzone {
  border: 2px dashed #cbd5e1;
  border-radius: var(--radius-md);
  padding: 24px 16px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  background-color: #fafafa;
  position: relative;
}

.dashed-dropzone:hover {
  border-color: var(--primary-color);
  background-color: #f5f3ff;
}

.dropzone-text-primary {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
  margin-top: 8px;
}

.dropzone-text-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}


.btn-purple-light {
  background-color: var(--primary-light);
  color: var(--primary-color);
  font-size: 13px;
}

.btn-purple-light:hover {
  background-color: #e0e2fe;
}

/* Selected File Card */
.selected-file-card {
  background-color: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-md);
  padding: 12px;
  margin-top: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.file-thumb-video {
  width: 44px;
  height: 44px;
  border-radius: 6px;
  background: linear-gradient(135deg, #0284c7, #38bdf8);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 14px;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(2, 132, 199, 0.25);
}

.file-meta-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
}

.file-meta-score {
  font-size: 11px;
  color: #16a34a;
  font-weight: 600;
  margin-top: 2px;
}

/* Segment Pill Selector */
.pill-selector {
  display: flex;
  gap: 10px;
}

.pill-option {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  text-align: center;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.pill-option.active {
  border-color: var(--primary-color);
  color: var(--primary-color);
  background-color: var(--primary-light);
  font-weight: 600;
}

.progress-metric-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  margin-bottom: 6px;
}

.progress-bar-track {
  height: 6px;
  background-color: #e2e8f0;
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 12px;
}

.progress-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.5s ease;
}

.progress-bar-fill.green { background-color: #22c55e; }
.progress-bar-fill.blue { background-color: #3b82f6; }

/* View 3: 创意裂变 Layout */
.fission-mode-selector {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 24px;
}

/* Tab Segment Toggle */
.segment-tabs {
  display: inline-flex;
  background-color: #f1f5f9;
  padding: 3px;
  border-radius: 8px;
}

.segment-tab-btn {
  padding: 6px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  border-radius: 6px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.segment-tab-btn.active {
  background-color: #ffffff;
  color: var(--primary-color);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Toggle Switch UI */
.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #cbd5e1;
  transition: .2s;
  border-radius: 24px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .2s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: var(--primary-color);
}

input:checked + .slider:before {
  transform: translateX(20px);
}

/* Fission Right Side Panel */
.ai-boost-card {
  background: linear-gradient(180deg, #fffbeb 0%, #ffffff 100%);
  border: 1px solid #fef3c7;
  border-radius: var(--radius-md);
  padding: 16px;
  margin-top: 16px;
  margin-bottom: 20px;
}

.ai-boost-header {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
  color: #b45309;
  margin-bottom: 14px;
}

.ai-metric-val {
  font-size: 16px;
  font-weight: 800;
}

.ai-metric-val.orange { color: #f97316; }
.ai-metric-val.yellow { color: #eab308; }
.ai-metric-val.green { color: #22c55e; }

.progress-bar-fill.orange { background-color: #f97316; }
.progress-bar-fill.yellow { background-color: #eab308; }

.cost-estimate-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 20px;
}

.cost-num {
  font-weight: 700;
  color: var(--text-main);
}

/* NEW: 5A素材效果排行榜 (Ranking List Table View) Styles */
/* ===== 系统设置的二级菜单 ===== */
/* 8 个配置卡片原本堆在一页往下滚，拆成左菜单 + 右单页 */
.settings-layout {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}
.settings-subnav {
  position: sticky; top: 16px;
  background: #fff; border-radius: 12px; padding: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  display: flex; flex-direction: column; gap: 2px;
}
.settings-subnav-item {
  display: block; padding: 9px 12px; border-radius: 8px;
  cursor: pointer; user-select: none;
  border-left: 3px solid transparent;
}
.settings-subnav-item:hover { background: #f8fafc; }
.settings-subnav-item.active {
  background: var(--primary-light, #eef2ff);
  border-left-color: var(--primary-color, #6366f1);
}
.settings-subnav-label {
  display: block; font-size: 13px; font-weight: 600; color: var(--text-main, #1e293b);
}
.settings-subnav-item.active .settings-subnav-label { color: var(--primary-color, #6366f1); }
.settings-subnav-desc {
  display: block; font-size: 11px; color: #9ca3af; line-height: 1.5; margin-top: 2px;
}
/* 只显示当前那一页。默认全部隐藏，避免菜单还没渲染完时先闪一屏全部卡片 */
.settings-pane { display: none; }
.settings-pane.active { display: block; }
.settings-body { min-width: 0; max-width: 820px; }
@media (max-width: 900px) {
  .settings-layout { grid-template-columns: 1fr; }
  .settings-subnav { position: static; flex-direction: row; flex-wrap: wrap; }
  .settings-subnav-item { border-left: none; border-bottom: 3px solid transparent; }
  .settings-subnav-item.active { border-bottom-color: var(--primary-color, #6366f1); }
  .settings-subnav-desc { display: none; }
}

.ranking-tabs-bar {
  display: flex;
  gap: 24px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 20px;
}

.ranking-tab-item {
  padding: 10px 0;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  position: relative;
  transition: color var(--transition-fast);
}

.ranking-tab-item:hover {
  color: var(--primary-color);
}

.ranking-tab-item.active {
  color: var(--primary-color);
  font-weight: 700;
}

.ranking-tab-item.active::after {
  content: "";
  position: absolute;
  bottom: -1px;
  left: 0; right: 0;
  height: 2px;
  background-color: var(--primary-color);
  border-radius: 2px;
}

.ranking-table-container {
  background-color: #ffffff;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.ranking-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.ranking-table th {
  background-color: #fafafa;
  padding: 14px 18px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-color);
}

.ranking-table td {
  padding: 16px 18px;
  font-size: 13px;
  color: var(--text-main);
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}

.ranking-table tr:last-child td {
  border-bottom: none;
}

.ranking-table tr:hover {
  background-color: #f8fafc;
}

/* Material Thumb & File Info */
.material-cell-flex {
  display: flex;
  align-items: center;
  gap: 12px;
}

.material-thumb-square {
  width: 42px;
  height: 42px;
  border-radius: 6px;
  background: linear-gradient(135deg, #e2e8f0, #cbd5e1);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #64748b;
  font-size: 16px;
  flex-shrink: 0;
}

.material-file-title {
  font-weight: 700;
  color: var(--text-main);
  font-size: 13.5px;
}

.material-file-size {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Score Cell Badges */
.score-cell-box {
  /* 期望结果要求「综合」列也不换行。原为 column，数字与等级字母上下堆叠，
     正是测试反馈的换行现象（其余五列是行内排布，只需 nowrap 即可）。 */
  display: flex;
  flex-direction: row;
  align-items: baseline;
  gap: 4px;
  white-space: nowrap;
}

.score-cell-num {
  font-size: 15px;
  font-weight: 800;
  line-height: 1.2;
  white-space: nowrap;   /* 分数与等级字母不换行 */
}

.score-cell-letter {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
}

.score-cell-num.green { color: #16a34a; }
.score-cell-num.blue { color: #2563eb; }
.score-cell-num.orange { color: #ea580c; }
.score-cell-num.red { color: #dc2626; }

/* ===== 需求「排行榜逻辑大调整」4：上传时间列 ===== */
/* 表格从 11 列加到 12 列，原来 18px 的左右内边距合计要吃掉 12×36=432px，
   剩给内容的宽度不够，「综合」列的数字和等级字母又会被挤成两行——
   就是测试单上记过的「综合数字评分与字母打分换行」。这里把左右内边距
   收到 12px，省出的 144px 全让给内容；上下不动，行高与改动前一致。
   移动端那条 @media 规则在本文件更靠后，仍然覆盖这两个值，不受影响。 */
.ranking-table th,
.ranking-table td { padding-left: 12px; padding-right: 12px; }

/* 上传按钮与隐藏文件框的布局容器 */
.upload-menu-wrap { position: relative; display: inline-block; }

/* ===== 需求「上传素材改造」5：[NEW] 角标 ===== */
/* 挂在缩略图外面这一层而不是 .material-thumb-square 上：那个盒子是 42px，
   里面的 <img> 却是 48px、会溢出，角标贴着 42px 的边算就会落到图片里面去。
   外面套一层由内容撑开的 inline-flex，角标永远贴在真实缩略图的右上角。 */
.material-thumb-wrap { position: relative; display: inline-flex; flex-shrink: 0; }

.action-link {
  color: var(--primary-color);
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  text-decoration: none;
}

.action-link:hover {
  text-decoration: underline;
}

/* Back Link Bar */
.back-link-bar {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--primary-color);
  cursor: pointer;
  margin-bottom: 16px;
  padding: 4px 10px;
  border-radius: 6px;
  background-color: var(--primary-light);
  transition: background-color var(--transition-fast);
}

.back-link-bar:hover {
  background-color: #e0e2fe;
}











/* 5 Dimension Cards Row */

/* Dimension Cards */
.dim-card {
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  padding: 14px;
  background-color: #ffffff;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.dim-card:hover {
  border-color: var(--primary-color);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.dim-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.dim-name {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-main);
}

.dim-score {
  font-size: 18px;
  font-weight: 800;
}

.dim-score.red { color: #ef4444; }
.dim-score.green { color: #22c55e; }
.dim-score.orange { color: #f97316; }
.dim-score.blue { color: #3b82f6; }

.dim-bar-track {
  height: 4px;
  background-color: #f1f5f9;
  border-radius: 2px;
  margin-bottom: 10px;
  overflow: hidden;
}

.dim-bar-fill {
  height: 100%;
  border-radius: 2px;
}

.dim-desc {
  font-size: 11px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* Optimization Plan Section */
.plan-container {
  background-color: #ffffff;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  padding: 24px;
}

.plan-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  margin-top: 20px;
}

.plan-step-list {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.plan-step-item {
  display: flex;
  gap: 12px;
}

.plan-step-badge {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background-color: var(--primary-light);
  color: var(--primary-color);
  font-weight: 700;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
}

.plan-step-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.plan-step-desc {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.prompt-display-card {
  background-color: #0f172a;
  border-radius: var(--radius-md);
  padding: 16px;
  color: #e2e8f0;
  position: relative;
}

.prompt-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  font-size: 12px;
  font-weight: 600;
  color: #94a3b8;
}

.btn-copy-mini {
  background-color: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  border: none;
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 4px;
  cursor: pointer;
}

.btn-copy-mini:hover {
  background-color: rgba(255, 255, 255, 0.2);
}

.prompt-code-text {
  font-family: inherit;
  font-size: 12px;
  line-height: 1.7;
  color: #cbd5e1;
  word-break: break-all;
}

/* Modal Overlay */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  animation: fadeIn 0.2s ease-in-out;
}

.modal-overlay.active {
  display: flex;
}

/* #6：上传/生成期间浮窗是全屏遮罩，整页点不动，唯一出口是「取消」。
   最小化把同一个浮窗收成右下角小卡片：遮罩层不再拦截点击
   （pointer-events 只留给卡片本身），上传继续跑，
   进度条 / 倒计时写的还是 #modalProgressFill、#modalTimerText 这几个元素，
   所以 JS 侧一行业务逻辑都不用改。 */
.modal-overlay.minimized {
  background-color: transparent;
  backdrop-filter: none;
  animation: none;
  pointer-events: none;
  align-items: flex-end;
  justify-content: flex-end;
  padding: 16px;
}

.modal-overlay.minimized .modal-box {
  width: 300px;
  padding: 14px 16px 16px;
  text-align: left;
  pointer-events: auto;
  border: 1px solid #e2e8f0;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.18);
}

.modal-overlay.minimized .loading-spinner {
  width: 20px;
  height: 20px;
  border-width: 2px;
  margin: 0 0 8px;
}

.modal-overlay.minimized .modal-title { font-size: 13px; }
.modal-overlay.minimized .modal-desc { font-size: 11px; }

.modal-box {
  background-color: #ffffff;
  border-radius: var(--radius-lg);
  width: 440px;
  padding: 28px;
  box-shadow: var(--shadow-lg);
  text-align: center;
}

.loading-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid var(--primary-light);
  border-top-color: var(--primary-color);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 20px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.modal-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 8px;
}

.modal-desc {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 20px;
}

/* Toast Message */
.toast-msg {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background-color: #1e293b;
  color: #ffffff;
  padding: 10px 20px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
  opacity: 0;
  pointer-events: none;
  transition: all 0.25s ease;
  z-index: 200;
}

.toast-msg.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ========================================================================== */
/* Auth Overlay & Mobile Responsive */
/* ========================================================================== */

.auth-overlay {
  position: fixed; inset: 0; background: linear-gradient(135deg, #181e2e 0%, #1e2638 100%);
  display: none; align-items: center; justify-content: center; z-index: 1000;
}
.auth-card {
  background: #fff; border-radius: 16px; padding: 40px 36px; width: 380px; max-width: 90vw;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.auth-brand { text-align: center; margin-bottom: 28px; }
.auth-brand-icon { font-size: 36px; margin-bottom: 8px; }
.auth-brand-title { font-size: 20px; font-weight: 800; color: #1f2937; }
.auth-brand-sub { font-size: 12px; color: #6b7280; margin-top: 4px; }
.auth-tabs { display: flex; gap: 0; border-bottom: 2px solid #f1f5f9; margin-bottom: 20px; }
.auth-tab {
  flex: 1; text-align: center; padding: 10px; font-size: 14px; font-weight: 600;
  color: #9ca3af; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -2px;
  transition: all 0.15s;
}
.auth-tab.active { color: #5346e0; border-bottom-color: #5346e0; }
.auth-error {
  display: none; background: #fef2f2; border: 1px solid #fecaca; color: #dc2626;
  padding: 8px 12px; border-radius: 8px; font-size: 13px; margin-bottom: 16px;
}
.auth-field { margin-bottom: 16px; }
.auth-field label { display: block; font-size: 13px; font-weight: 600; color: #1f2937; margin-bottom: 6px; }
.auth-field input {
  width: 100%; padding: 10px 14px; border: 1px solid #e5e7eb; border-radius: 10px;
  font-size: 14px; outline: none; transition: border-color 0.15s; box-sizing: border-box;
}
.auth-field input:focus { border-color: #5346e0; box-shadow: 0 0 0 3px rgba(83,70,224,0.1); }
.auth-btn {
  width: 100%; padding: 12px; background: linear-gradient(135deg, #6355ff 0%, #4b3bcb 100%);
  color: #fff; border: none; border-radius: 10px; font-size: 15px; font-weight: 700;
  cursor: pointer; transition: opacity 0.15s;
}
.auth-btn:hover { opacity: 0.93; }
.auth-btn:disabled { opacity: 0.6; cursor: not-allowed; }
.auth-footer { text-align: center; font-size: 11px; color: #9ca3af; margin-top: 20px; }

/* Mobile Hamburger */
.mobile-menu-btn {
  display: none; position: relative; background: transparent; color: var(--text-main); border: none; border-radius: 8px;
  width: 36px; height: 36px; font-size: 18px; cursor: pointer; flex-shrink: 0;
}
.sidebar-overlay {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 15;
}
.sidebar-overlay.active { display: block; }

/* Mobile Responsive */
@media (max-width: 768px) {
  .mobile-menu-btn { display: flex; align-items: center; justify-content: center; }
  .sidebar {
    position: fixed; left: -230px; top: 0; bottom: 0; z-index: 20;
    transition: left 0.25s ease;
  }
  .sidebar.sidebar-open { left: 0; }
  .main-wrapper { width: 100%; }
  .top-header { padding: 0 12px; height: 52px; }
  .header-title { font-size: 14px; }
  .header-controls { gap: 8px; }
  .points-pill { font-size: 11px; padding: 4px 8px; }
  .view-container { padding: 12px; }
  .page-title { font-size: 18px; }
  .edit-grid { grid-template-columns: 1fr; }
  .ranking-table-container { overflow-x: auto; }
  .ranking-table th, .ranking-table td { padding: 10px 12px; font-size: 12px; }
  .plan-grid { grid-template-columns: 1fr; }
  .card-box { padding: 14px; }
  .modal-box { width: 90vw; padding: 20px; }
  .dim-card { padding: 10px; }
  .dim-card-header { gap: 4px; }
  .dim-name { font-size: 12px; }
  .dim-desc { font-size: 11px; }
  .plan-step-desc { font-size: 12px; }
  .alert-diagnosis-body { font-size: 13px !important; line-height: 1.5 !important; }
  .header-title-area { gap: 4px; }
}

@media (max-width: 480px) {
  .ranking-table { min-width: 600px; }
  .auth-card { padding: 28px 20px; }
}

/* Dropdown Panels (Notification/Settings/UserMenu) */
.dropdown-panel {
  position: absolute; top: calc(100% + 8px); right: 0;
  background: #fff; border: 1px solid #e5e7eb; border-radius: 12px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.12); z-index: 50;
  min-width: 240px; overflow: hidden;
}
.dropdown-panel-header {
  padding: 12px 16px; font-size: 13px; font-weight: 700; color: #1f2937;
  border-bottom: 1px solid #f1f5f9; background: #fafafa;
}
.dropdown-panel-body { padding: 8px; max-height: 400px; overflow-y: auto; }
.dropdown-empty { text-align: center; font-size: 13px; color: #9ca3af; padding: 24px 0; }
.settings-panel-wide { min-width: 360px; }
.settings-section { margin-bottom: 14px; }
.settings-label { font-size: 12px; font-weight: 600; color: #475569; margin-bottom: 6px; }
.settings-input {
  width: 100%; padding: 8px 10px; border: 1px solid #e5e7eb; border-radius: 8px;
  font-size: 13px; outline: none; box-sizing: border-box;
}
.settings-input:focus { border-color: #5346e0; box-shadow: 0 0 0 2px rgba(83,70,224,0.08); }
.settings-user-info { font-size: 13px; color: #1f2937; font-weight: 600; }
.settings-divider { height: 1px; background: #f1f5f9; margin: 12px 0; }
.settings-price-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.settings-price-grid label { font-size: 11px; color: #6b7280; }
.user-menu-item {
  padding: 10px 12px; font-size: 13px; color: #1f2937; cursor: pointer;
  border-radius: 8px; transition: background 0.15s; display: flex; align-items: center; gap: 6px;
}
.user-menu-item:hover { background: #f5f3ff; }
.user-menu-item.logout-item { color: #dc2626; border-top: 1px solid #f1f5f9; margin-top: 4px; padding-top: 12px; }

/* Mobile dropdown panels */
@media (max-width: 768px) {
  .dropdown-panel { position: fixed; left: 16px; right: 16px; top: 60px; min-width: auto; }
  .settings-panel-wide { min-width: auto; left: 16px; right: 16px; }
  .settings-price-grid { grid-template-columns: 1fr 1fr 1fr; gap: 6px; }
  .settings-input { font-size: 12px; padding: 6px 8px; }
  .header-icon-btn { width: 28px; height: 28px; }
  .header-icon-btn svg { width: 16px; height: 16px; }
  .profile-menu .user-avatar-badge { width: 28px !important; height: 28px !important; font-size: 11px !important; }
  .header-controls { gap: 6px !important; }
  .points-pill { font-size: 10px; padding: 3px 6px; }
  .preview-media-box { height: 200px; }
  .result-dashed-box { height: 200px; }
  .card-header-flex { flex-wrap: wrap; gap: 8px; }
  .ai-boost-card { padding: 12px; }
  .prompt-display-card { padding: 12px; }
  .prompt-code-text { font-size: 11px; }
  .dim-card { padding: 10px; }
  .dim-score { font-size: 16px; }
  .dim-name { font-size: 11px; }
  .dim-desc { font-size: 10px; }
  .back-link-bar { margin-bottom: 8px; }
}

@media (max-width: 380px) {
  .settings-price-grid { grid-template-columns: 1fr; }
  .auth-brand-title { font-size: 18px; }
  .auth-btn { font-size: 14px; padding: 10px; }
}

/* Upload Placeholder */
.upload-placeholder {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  height: 100%; cursor: pointer; transition: all 0.15s; padding: 20px;
}
.upload-placeholder:hover { opacity: 0.8; }

/* 文件名截断 */
.filename-truncate {
  max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  display: inline-block; vertical-align: middle;
}
.material-file-title { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-meta-name { max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 768px) {
  .filename-truncate { max-width: 100px; }
  .material-file-title { max-width: 100px; }
  .file-meta-name { max-width: 120px; }
}

/* 排行榜行可点击，给出手型光标 */
.ranking-table tbody tr {
  cursor: pointer;
}

/* 裂变失败原因：上游额度/限频这类问题要让用户直接看懂，而不是只给一个「失败」 */
.fission-fail-note {
  margin-top: 6px; padding: 6px 8px; border-radius: 6px;
  background: #fef2f2; border: 1px solid #fecaca; color: #b91c1c;
  font-size: 11px; line-height: 1.5;
}
