
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', sans-serif;
       background: #0f1115; color: #e6e8eb; line-height: 1.55; padding: 24px;
       max-width: 1600px; margin: 0 auto; }
h1 { font-size: 28px; margin-bottom: 8px; color: #fff; }
h2 { font-size: 20px; margin: 24px 0 12px; color: #fff; border-left: 4px solid #4a9eff; padding-left: 10px; }
a { color: #4a9eff; text-decoration: none; }
a:hover { text-decoration: underline; }
.meta { color: #8b929c; font-size: 13px; margin-bottom: 20px; }
.stats-bar { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.stat { background: #1a1d24; padding: 12px 16px; border-radius: 8px; border: 1px solid #2a2e38; }
.stat b { display: block; font-size: 22px; color: #fff; }
.stat span { font-size: 12px; color: #8b929c; }

/* 视频行 */
.video-row {
  display: grid;
  grid-template-columns: 19% 1fr 19%;
  grid-template-rows: auto 1fr;
  gap: 10px 20px;
  background: #1a1d24;
  border: 1px solid #2a2e38;
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 14px;
  scroll-margin-top: 16px;
}
.video-row:hover { border-color: #4a9eff; }
.row-header {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-bottom: 10px;
  border-bottom: 1px solid #2a2e38;
}
.row-header .info-title { font-size: 16px; }
.row-header .engage-row { margin: 0; }
.thumb { width: 100%; }
.video-container {
  position: relative;
  width: 100%;
  aspect-ratio: 9/16;
  background: #000;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid #2a2e38;
}
.video-container video {
  position: absolute; top: 0; left: 0;
  width: 100%; height: 100%;
  object-fit: contain;
  background: #000;
}
.poster-wrap {
  position: absolute; inset: 0;
  cursor: pointer;
}
.poster-wrap img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.play-btn {
  position: absolute;
  bottom: 6px; left: 6px;
  width: 42px; height: 42px;
  background: rgba(0,0,0,0.65);
  border-radius: 50%;
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  pointer-events: none;
  transition: background .15s;
}
.poster-wrap:hover .play-btn { background: #4a9eff; }
.no-thumb {
  position: absolute; inset: 0;
  background: #0f1115; border: 1px dashed #2a2e38;
  display: flex; align-items: center; justify-content: center;
  color: #5a606b; font-size: 12px; border-radius: 6px;
}
.thumb-rank {
  margin-top: 8px; text-align: center; width: 100%;
  background: #0f1115; padding: 6px; border-radius: 6px;
}
.thumb-rank b { font-size: 18px; color: #fff; }
.thumb-rank span { display: none; }

.info-col { min-width: 0; }
.info-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 8px; gap: 12px; }
.info-title { font-size: 15px; color: #e6e8eb; flex: 1; word-break: break-word; }
.account-chip { background: #1d2a3a; color: #8bb8ff; padding: 2px 10px; border-radius: 12px; font-size: 11px; white-space: nowrap; }
.vid-chip { background: #0f1f14; color: #6dffa8; border: 1px solid #2a3f2e; padding: 2px 10px; border-radius: 12px; font-size: 11px; font-family: 'SF Mono', Consolas, monospace; cursor: pointer; white-space: nowrap; user-select: all; }
.vid-chip:hover { border-color: #6dffa8; background: #1a2e1e; }
.vid-chip.copied { background: #1a3a1e; color: #c0ffd8; border-color: #6dffa8; }

.engage-row { display: flex; flex-wrap: wrap; gap: 10px; margin: 8px 0; font-size: 12px; }
.engage-row .eitem { background: #0f1115; padding: 4px 10px; border-radius: 4px; border: 1px solid #2a2e38; }
.engage-row b { color: #fff; }
.engage-row .heat { background: #2b1d3a; color: #d4a6ff; border-color: #4a2e5a; font-weight: 600; }

.hook-line { color: #cfd3d9; font-size: 13px; margin: 8px 0; }
.hook-line b { color: #ffd56d; }
.struct-line { font-family: 'SF Mono', Consolas, monospace; font-size: 12px; color: #6dffa8; margin-bottom: 8px; word-break: break-all; }

.tags { display: flex; flex-wrap: wrap; gap: 4px; margin: 6px 0; }
.tag { background: #1d2a3a; color: #8bb8ff; padding: 1px 7px; border-radius: 3px; font-size: 11px; }

.ost-block { background: #0f1115; border: 1px solid #2a2e38; border-radius: 6px; padding: 10px 12px; margin: 8px 0; }
.ost-block summary { cursor: pointer; color: #8bb8ff; font-size: 12px; }
.ost-block ul { margin: 8px 0 0 16px; color: #cfd3d9; font-size: 12px; }
.ost-block li { margin: 2px 0; list-style-type: "· "; }
.ost-block .transcript-text { color: #cfd3d9; font-size: 12px; line-height: 1.7; white-space: pre-wrap; margin-top: 8px; }

.pattern-summary-todo {
  background: #2a1f0d; border: 1px dashed #5e4b0d; color: #ffd56d;
  padding: 8px 12px; border-radius: 6px; font-size: 12px; margin: 8px 0;
}

.resource-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; font-size: 12px; }
.resource-row a { background: #0f1115; padding: 4px 10px; border-radius: 4px; border: 1px solid #2a2e38; }

/* 视图切换 */
.view-nav { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 16px; align-items: center; }
.view-nav .label { color: #8b929c; font-size: 12px; margin-right: 4px; }
.view-chip {
  background: #1a1d24; color: #cfd3d9;
  padding: 6px 14px; border-radius: 18px;
  border: 1px solid #2a2e38; font-size: 13px;
  white-space: nowrap;
}
.view-chip:hover { border-color: #4a9eff; text-decoration: none; }
.view-chip.active { background: #1d2a3a; color: #8bb8ff; border-color: #4a9eff; font-weight: 600; }
.view-chip .count { color: #8b929c; font-size: 11px; margin-left: 4px; }
.view-chip.active .count { color: #6a8eb8; }
.view-nav .sep { color: #2a2e38; margin: 0 4px; }
.view-nav .side { color: #8b929c; font-size: 12px; }

/* 分页器 */
.pager { display: flex; flex-wrap: wrap; gap: 6px; margin: 14px 0; align-items: center; justify-content: center; }
.pager a, .pager span {
  background: #1a1d24; color: #cfd3d9;
  padding: 6px 12px; border-radius: 6px;
  border: 1px solid #2a2e38; font-size: 13px;
  min-width: 36px; text-align: center;
}
.pager a:hover { border-color: #4a9eff; text-decoration: none; }
.pager .active { background: #1d2a3a; color: #8bb8ff; border-color: #4a9eff; font-weight: 600; }
.pager .disabled { color: #4a4f59; background: #14161b; cursor: default; }
.pager .ellipsis { background: transparent; border: none; color: #5a606b; }

.footer { text-align: center; margin-top: 40px; color: #5a606b; font-size: 12px; }

/* 镜头时间线 */
/* 镜头时间线：可视化时间轴 */
.shot-timeline {
  max-height: 600px;
  overflow-y: auto;
  position: relative;
  background: #0f1115;
  border: 1px solid #2a2e38;
  border-radius: 6px;
}
.shot-timeline .no-data { color: #5a606b; font-size: 12px; padding: 12px; text-align: center; }

.timeline-header {
  position: sticky; top: 0; z-index: 5;
  display: grid;
  grid-template-columns: 36px 1.5fr 3.5fr 2.5fr 2.5fr;
  background: #0f1115;
  border-bottom: 1px solid #2a2e38;
  font-size: 11px; color: #8b929c;
}
.timeline-header > div { padding: 4px 6px; text-align: center; }
.timeline-header > div:first-child { padding: 4px 2px; font-size: 10px; }
.timeline-header > div + div { border-left: 1px solid #1a1d24; }

.timeline-inner {
  position: relative;
  /* height 由 python 计算：duration * pps */
}

/* 左侧刻度列：主竖线在左边缘，刻度从竖线向右伸，数字贴在刻度右边 */
.timeline-scale {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 36px;
}
/* 主竖线（尺子主干）：scale 列最左侧 */
.timeline-scale::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 1px;
  background: #8b929c;
}
.tick {
  position: absolute;
  left: 0; width: 36px;
  height: 12px !important; /* 覆盖老 html 里 inline height:40px */
  margin-top: -6px;         /* 让盒子以 top 定位为视觉中心 */
  font-size: 10px;
  line-height: 12px;
  color: #8b929c;
  font-family: 'SF Mono', Consolas, monospace;
  padding-left: 13px;       /* 主刻度线 10px + 2px 间距 */
  text-align: left;
  box-sizing: border-box;
  white-space: nowrap;
}
/* 刻度记号：从主竖线向右伸，垂直居中到 tick 的 50% 位置（和数字在同一水平线） */
.tick::before {
  content: '';
  position: absolute;
  left: 0; top: 50%;
  transform: translateY(-0.5px);
  width: 6px; height: 1px;
  background: #8b929c;
}
.tick.tick-major { color: #cfd3d9; }
.tick.tick-major::before { width: 10px; background: #cfd3d9; }

/* 4 个 track 列：beat / 镜头 / 口播 / 屏幕字 */
.track {
  position: absolute;
  top: 0; bottom: 0;
}
/* 比例 1.5:3.5:2.5:2.5 = 3:7:5:5，总 20 份。剩余宽 = 100% - 36px */
.track-beat    { left: 36px;                                    width: calc((100% - 36px) * 3 / 20); }
.track-content { left: calc(36px + (100% - 36px) * 3 / 20);     width: calc((100% - 36px) * 7 / 20); border-left: 1px solid #1a1d24; }
.track-vo      { left: calc(36px + (100% - 36px) * 10 / 20);    width: calc((100% - 36px) * 5 / 20); border-left: 1px solid #1a1d24; }
.track-ost     { left: calc(36px + (100% - 36px) * 15 / 20);    width: calc((100% - 36px) * 5 / 20); border-left: 1px solid #1a1d24; }

/* 方块 */
.block {
  position: absolute;
  left: 2px; right: 2px;
  padding: 3px 5px;
  font-size: 11px;
  line-height: 1.25;
  background: #1a1d24;
  border: 1px solid #2a2e38;
  border-radius: 3px;
  color: #cfd3d9;
  overflow: hidden;
  cursor: pointer;
  box-sizing: border-box;
  transition: background .1s, border-color .1s;
}
.block:hover { background: #1d2a3a; border-color: #4a9eff; }
.track-beat .block { border-color: #3a2a5e; color: #d4b8ff; background: #1a1030; }
.track-beat .block:hover { background: #2a1840; border-color: #9c6bff; }
.track-vo .block   { border-color: #1a3a1e; color: #6dffa8; background: #0f1a13; }
.track-vo .block:hover { background: #1a2e1e; }
.track-ost .block  { border-color: #5e4b0d; color: #ffd56d; background: #1a1508; }
.track-ost .block:hover { background: #2a200e; }

/* 播放头横线 */
.playhead {
  position: absolute;
  left: 0; right: 0;
  height: 2px;
  background: #4a9eff;
  pointer-events: none;
  z-index: 10;
  box-shadow: 0 0 6px rgba(74, 158, 255, 0.8);
  transition: background .1s, box-shadow .1s;
}
.playhead.dragging {
  background: #6dffa8;
  box-shadow: 0 0 10px rgba(109, 255, 168, 0.9);
}
/* 左侧刻度列上的拖动把手：只有这一小块接收事件，不挡中间 3 条 track 方块 */
.playhead-handle {
  position: absolute;
  left: 0;
  top: -10px;
  width: 36px;
  height: 22px;
  cursor: ns-resize;
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity .15s;
}
.playhead-handle::before {
  content: '⇅';
  width: 22px; height: 22px;
  background: #4a9eff;
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: bold;
  box-shadow: 0 0 6px rgba(74, 158, 255, 0.8);
}
.shot-timeline:hover .playhead-handle,
.playhead.dragging .playhead-handle { opacity: 1; }
.playhead.dragging .playhead-handle::before {
  background: #6dffa8;
  color: #0f1115;
  box-shadow: 0 0 8px rgba(109, 255, 168, 0.9);
}

/* 小屏（iPad、缩小浏览器）：砍右栏（info-col），保留左栏视频 + 中栏时间轴 */
@media (max-width: 1200px) {
  .video-row {
    grid-template-columns: 28% 1fr;
    grid-template-rows: auto 1fr;
  }
  .video-row > .info-col { display: none; }
}
