/* ── Workshop 主题（视频分析首页）── */
.workshop {
  --bg: #f3efe8;
  --bg-soft: #faf8f4;
  --panel: #ffffff;
  --panel2: #f7f4ef;
  --border: #e8e2d8;
  --text: #2a2622;
  --muted: #8a8278;
  --accent: #3d5a80;
  --accent-soft: #5c7a9e;
  --accent2: #6b5b95;
  --success: #3d8b6e;
  --warn: #c17c3a;
  --danger: #c45c5c;
  --shadow: 0 12px 40px rgba(42, 38, 34, 0.08);
  --shadow-sm: 0 4px 16px rgba(42, 38, 34, 0.06);
  --radius: 16px;
  --radius-sm: 10px;
}

.workshop * { box-sizing: border-box; }

.workshop body,
body.workshop {
  margin: 0;
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

.workshop {
  display: grid;
  grid-template-columns: 72px 1fr;
  min-height: 100vh;
}

/* 左侧导航 */
.ws-nav {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 16px 8px;
  background: var(--bg-soft);
  border-right: 1px solid var(--border);
  position: sticky;
  top: 0;
  height: 100vh;
}

.ws-nav-logo {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #8ec5fc, #e0c3fc);
  color: #fff;
  font-weight: 700;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
  box-shadow: var(--shadow-sm);
}

.ws-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 100%;
  padding: 10px 4px;
  border-radius: var(--radius-sm);
  font-size: 0.68rem;
  color: var(--muted);
  text-decoration: none;
  cursor: default;
  transition: background 0.15s, color 0.15s;
}

a.ws-nav-item { cursor: pointer; }
a.ws-nav-item:hover { background: var(--panel2); color: var(--text); }

.ws-nav-item.is-active {
  background: var(--panel);
  color: var(--text);
  box-shadow: var(--shadow-sm);
  font-weight: 600;
}

.ws-nav-item--muted { opacity: 0.45; }

.ws-nav-icon {
  font-size: 1.1rem;
  line-height: 1;
}

.ws-nav-foot {
  margin-top: auto;
  padding-top: 12px;
  font-size: 0.65rem;
  color: var(--muted);
  text-align: center;
}

.ws-credits {
  display: block;
  padding: 6px 8px;
  border-radius: 999px;
  background: var(--panel);
  border: 1px solid var(--border);
}

/* 主区域 */
.ws-shell {
  display: grid;
  grid-template-columns: 1fr 280px;
  grid-template-rows: auto 1fr;
  gap: 0;
  min-height: 100vh;
}

.ws-hero {
  grid-column: 1 / -1;
  padding: 40px 48px 28px;
  background: linear-gradient(180deg, var(--bg-soft) 0%, var(--bg) 100%);
}

.ws-hero-inner {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(280px, 0.95fr);
  gap: 40px;
  max-width: 1280px;
}

.ws-eyebrow {
  margin: 0 0 12px;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  color: var(--muted);
  font-weight: 600;
}

.ws-title {
  margin: 0 0 16px;
  font-size: clamp(1.75rem, 3.2vw, 2.35rem);
  font-weight: 700;
  line-height: 1.22;
  letter-spacing: -0.02em;
}

.ws-lead {
  margin: 0 0 20px;
  font-size: 0.92rem;
  line-height: 1.65;
  color: var(--muted);
  max-width: 36em;
}

.ws-steps {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 24px;
}

.ws-step {
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 0.78rem;
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--muted);
}

.ws-step.is-on {
  background: var(--text);
  color: #fff;
  border-color: var(--text);
}

.ws-step-arrow {
  color: var(--muted);
  font-size: 0.85rem;
}

/* 上传区 */
.ws-upload-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}

.ws-upload-zone {
  display: block;
  cursor: pointer;
}

.ws-upload-zone.is-dragover {
  outline: 2px dashed var(--accent-soft);
  outline-offset: 4px;
  border-radius: var(--radius-sm);
}

.ws-upload-placeholder {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  min-height: 120px;
  padding: 20px;
  border-radius: var(--radius-sm);
  background: var(--bg-soft);
  border: 1px dashed var(--border);
  transition: border-color 0.15s, background 0.15s;
}

.ws-upload-zone:hover .ws-upload-placeholder,
.ws-upload-zone.has-file .ws-upload-placeholder {
  border-color: var(--accent-soft);
  background: #fff;
}

.ws-upload-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--panel);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  color: var(--accent);
  margin-bottom: 4px;
}

.ws-upload-placeholder strong {
  font-size: 0.95rem;
}

.ws-upload-placeholder span:last-child {
  font-size: 0.8rem;
  color: var(--muted);
}

.ws-upload-meta {
  margin: 10px 0 0;
}

.ws-upload-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.ws-field {
  flex: 1;
  min-width: 120px;
}

.ws-field--narrow { flex: 0 0 100px; min-width: 90px; }

.ws-field label {
  display: block;
  font-size: 0.72rem;
  color: var(--muted);
  margin-bottom: 5px;
}

.ws-node-hint { margin: 10px 0 0; }

.ws-status-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.ws-status-pill {
  font-size: 0.72rem;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--panel2);
  border: 1px solid var(--border);
  color: var(--text);
}

.ws-status-pill--muted { color: var(--muted); }

.ws-import-details {
  margin-top: 14px;
  font-size: 0.82rem;
}

.ws-import-details summary {
  cursor: pointer;
  color: var(--muted);
  user-select: none;
}

.ws-import-details[open] summary { margin-bottom: 10px; }

/* 历史卡片网格 */
.ws-gallery-wrap {
  padding-top: 48px;
}

.ws-gallery-label {
  margin: 0 0 14px;
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 600;
}

.ws-gallery {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

.ws-gallery-card {
  aspect-ratio: 4 / 5;
  border: none;
  border-radius: var(--radius);
  padding: 18px 16px;
  text-align: left;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  color: #2a2622;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s, box-shadow 0.15s;
  font-family: inherit;
}

.ws-gallery-card:nth-child(odd) { transform: translateY(8px); }
.ws-gallery-card:nth-child(even) { transform: translateY(-4px); }

.ws-gallery-card:hover {
  transform: translateY(-3px) !important;
  box-shadow: var(--shadow);
}

.ws-gallery-card h4 {
  margin: 0 0 6px;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.3;
}

.ws-gallery-card p {
  margin: 0;
  font-size: 0.72rem;
  opacity: 0.75;
}

.ws-gallery-empty {
  grid-column: 1 / -1;
  padding: 32px;
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  background: var(--panel);
}

/* 工作区 + 侧栏 */
.ws-workspace {
  padding: 0 48px 40px;
  max-width: 1000px;
}

.ws-rail {
  padding: 0 24px 24px 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: sticky;
  top: 0;
  align-self: start;
  max-height: 100vh;
  overflow-y: auto;
}

.ws-panel-head {
  margin-bottom: 14px;
}

.ws-panel-head h3 {
  margin: 0 0 4px;
  font-size: 1rem;
  font-weight: 700;
}

.ws-panel-head .meta { margin: 0; }

.ws-rail-card {
  margin-bottom: 0 !important;
}

.ws-rail-card h3 {
  margin: 0 0 10px;
  font-size: 0.82rem;
  color: var(--muted);
  font-weight: 600;
}

/* ── 通用组件（workshop 内）── */
.workshop .card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}

.workshop .card h3 {
  margin: 0 0 12px;
  font-size: 0.95rem;
  color: var(--text);
  font-weight: 700;
}

.workshop label { display: block; font-size: 0.82rem; color: var(--muted); margin-bottom: 6px; }

.workshop input[type="file"],
.workshop select,
.workshop input[type="number"] {
  width: 100%;
  padding: 9px 11px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-soft);
  color: var(--text);
  font-size: 0.85rem;
}

.workshop .btn {
  border: none;
  border-radius: var(--radius-sm);
  padding: 10px 18px;
  font-size: 0.88rem;
  cursor: pointer;
  color: #fff;
  background: var(--accent);
  font-weight: 600;
  transition: opacity 0.15s, transform 0.1s;
}

.workshop .btn:hover:not(:disabled) { opacity: 0.92; }
.workshop .btn:disabled { opacity: 0.4; cursor: not-allowed; }

.workshop .btn.secondary {
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text);
  font-weight: 500;
}

.workshop .ws-btn-primary {
  background: var(--text);
  padding: 10px 22px;
  border-radius: 999px;
}

.workshop .btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.workshop .video-wrap {
  background: #1a1816;
  border-radius: var(--radius-sm);
  overflow: hidden;
  aspect-ratio: 16/9;
}

.workshop video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #1a1816;
}

.workshop .video-dur-hint { margin: 8px 0 0; font-size: 0.82rem; }
.workshop .video-dur-hint.warn { color: var(--warn); }

.workshop .timeline {
  position: relative;
  height: 52px;
  margin-top: 12px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: crosshair;
  user-select: none;
}

.workshop .timeline-seg {
  position: absolute;
  top: 4px;
  bottom: 4px;
  border-radius: 4px;
  opacity: 0.45;
}

.workshop .timeline-marker {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--text);
  transform: translateX(-50%);
  cursor: ew-resize;
  z-index: 2;
}

.workshop .timeline-marker::after {
  content: attr(data-label);
  position: absolute;
  top: -18px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.68rem;
  color: var(--muted);
  white-space: nowrap;
}

.workshop .timeline-playhead {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--warn);
  transform: translateX(-50%);
  pointer-events: none;
  z-index: 1;
}

.workshop .seg-list { list-style: none; padding: 0; margin: 12px 0 0; }

.workshop .seg-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
  font-size: 0.85rem;
  background: var(--bg-soft);
}

.workshop .seg-list .idx {
  color: var(--accent);
  font-weight: 700;
  min-width: 48px;
}

.workshop .flow { display: flex; flex-direction: column; gap: 6px; }

.workshop .flow-item {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: transparent;
  font-size: 0.8rem;
}

.workshop .flow-item .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border);
  margin-top: 5px;
  flex-shrink: 0;
}

.workshop .flow-item.active .dot {
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(61, 90, 128, 0.2);
}

.workshop .flow-item.done .dot { background: var(--success); }

.workshop .flow-item .title { font-weight: 600; font-size: 0.82rem; }
.workshop .flow-item .desc { color: var(--muted); margin-top: 1px; font-size: 0.72rem; }

.workshop .log {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px;
  font-family: Consolas, "Cascadia Mono", monospace;
  font-size: 0.72rem;
  max-height: 220px;
  overflow-y: auto;
  white-space: pre-wrap;
  color: var(--muted);
}

.workshop .badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  background: var(--panel2);
}

.workshop .badge.ok { background: #e6f4ee; color: var(--success); }
.workshop .badge.warn { background: #fdf3e7; color: var(--warn); }

.workshop .meta { font-size: 0.82rem; color: var(--muted); }
.workshop .hidden { display: none !important; }

.workshop .import-run-row {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}

.workshop .import-run-row select { flex: 1; min-width: 0; }

/* 角色截图 */
.workshop .review-hint { margin: 0; }

.workshop .review-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.workshop .review-char {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  width: 100%;
  min-width: 0;
  padding: 0;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-soft);
  cursor: pointer;
  overflow: hidden;
  text-align: center;
  color: inherit;
  font: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.workshop .review-char:hover { border-color: var(--accent-soft); }
.workshop .review-char.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(61, 90, 128, 0.2);
}
.workshop .review-char.done { border-color: var(--success); }

.workshop .review-char .thumb {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 4;
  background: #1a1816;
  overflow: hidden;
}

.workshop .review-char .thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.workshop .review-char .thumb .ph {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 0.72rem;
  color: var(--muted);
  padding: 8px;
}

.workshop .review-char .thumb .ph-icon {
  font-size: 1.4rem;
  line-height: 1;
  opacity: 0.5;
}

.workshop .review-char .thumb .done-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--success);
  color: #fff;
  font-size: 0.7rem;
  line-height: 20px;
  text-align: center;
}

.workshop .review-char .thumb.thumb-viewable { cursor: zoom-in; }

.workshop .review-char .info {
  padding: 8px 6px;
  min-height: 52px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.workshop .review-char .name {
  font-weight: 600;
  font-size: 0.8rem;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workshop .review-char .sub {
  font-size: 0.68rem;
  color: var(--muted);
  margin-top: 3px;
}

.workshop .review-pick-banner {
  margin: 0 0 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-soft);
  border: 1px dashed var(--border);
  font-size: 0.85rem;
  color: var(--muted);
}

.workshop .review-pick-banner.ready {
  border-style: solid;
  border-color: var(--accent-soft);
  color: var(--text);
}

.workshop .crop-stage {
  position: relative;
  border-radius: var(--radius-sm);
  overflow: hidden;
  aspect-ratio: 16 / 9;
  background: #1a1816;
}

.workshop .crop-stage video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.workshop .review-video-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: #1a1816;
  color: #f3efe8;
}

.workshop .review-vc-btn {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.12);
  color: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  line-height: 1;
}

.workshop .review-vc-btn:hover { background: rgba(255, 255, 255, 0.2); }

.workshop .review-vc-time {
  flex-shrink: 0;
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
  min-width: 7.5em;
}

.workshop .review-vc-seek {
  flex: 1;
  min-width: 0;
  height: 4px;
  accent-color: #f6d365;
  cursor: pointer;
}

.workshop .crop-dim {
  position: absolute;
  inset: 0;
  z-index: 10;
  background: rgba(0, 0, 0, 0.45);
  pointer-events: none;
}

.workshop .crop-box {
  position: absolute;
  z-index: 11;
  border: 3px solid var(--success);
  outline: 2px solid rgba(255, 255, 255, 0.85);
  background: rgba(61, 139, 110, 0.2);
  pointer-events: none;
}

.workshop .review-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
}

.workshop .review-detail {
  margin-top: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-soft);
  font-size: 0.85rem;
}

.workshop .review-detail-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 8px;
}

.workshop .review-shot-preview {
  margin: 8px 0 12px;
  max-width: 200px;
}

.workshop .review-shot-preview img {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: var(--radius-sm);
  display: block;
  cursor: zoom-in;
}

.workshop .review-shot-preview .view-hint {
  margin-top: 4px;
  font-size: 0.72rem;
  color: var(--muted);
}

.workshop .review-apps {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.workshop .review-apps .chip {
  font-size: 0.72rem;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--panel);
  border: 1px solid var(--border);
}

.workshop .result-links a {
  color: var(--accent);
  margin-right: 12px;
  font-size: 0.85rem;
}

.workshop .segment-result {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  background: var(--bg-soft);
  margin-bottom: 8px;
}

.workshop .char-track {
  background: var(--border);
  border-radius: 4px;
  height: 14px;
  position: relative;
  overflow: hidden;
}

.workshop .char-fill {
  position: absolute;
  top: 0;
  bottom: 0;
  background: var(--accent-soft);
  border-radius: 4px;
}

/* 截图预览弹窗 */
.workshop .shot-preview-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.workshop .shot-preview-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(42, 38, 34, 0.55);
}

.workshop .shot-preview-panel {
  position: relative;
  z-index: 1;
  max-width: min(92vw, 720px);
  padding: 16px;
  border-radius: var(--radius);
  background: var(--panel);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.workshop .shot-preview-close {
  position: absolute;
  top: 8px;
  right: 10px;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 8px;
  background: var(--bg-soft);
  cursor: pointer;
  font-size: 1.4rem;
}

@media (max-width: 1100px) {
  .ws-shell { grid-template-columns: 1fr; }
  .ws-rail {
    position: static;
    padding: 0 48px 32px;
    max-height: none;
    flex-direction: row;
    flex-wrap: wrap;
  }
  .ws-rail-card { flex: 1; min-width: 260px; }
  .ws-hero-inner { grid-template-columns: 1fr; }
  .ws-gallery-wrap { padding-top: 0; }
}

@media (max-width: 640px) {
  .workshop { grid-template-columns: 56px 1fr; }
  .ws-hero { padding: 24px 16px; }
  .ws-workspace { padding: 0 16px 24px; }
  .ws-rail { padding: 0 16px 24px; }
  .ws-gallery { grid-template-columns: 1fr; }
}
