:root{
  --w: 1500px;
  --fg: #111;
  --muted:#666;
  --border:#e5e5e5;
  --bg:#fff;
}

*{ box-sizing:border-box; }

body{
  margin:0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Noto Sans";
  color:var(--fg);
  background:var(--bg);
}

.page{ max-width: var(--w); margin: 0 auto; padding: 26px 18px 50px; }
.hero{ text-align:center; padding: 10px 0 18px; }
.title{ font-size: 34px; margin: 8px 0 10px; line-height: 1.15; }
.authors{ color: #444; font-size: 1.05rem; margin-top: 8px; }
.links{ display:flex; gap:10px; justify-content:center; flex-wrap:wrap; margin-top:12px; }

.section{ padding: 18px 0; border-top: 1px solid var(--border); }
.section h2{ margin: 0 0 10px; font-size: 22px; text-align:center; }
.abstract{ line-height:1.55; margin: 0; }

.section-title{
  text-align: left;
  margin: 18px 0 10px;
  font-size: 18px;
  font-weight: 650;
}

/* case card */
.case{
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px;
  margin: 14px 0;
}
.case .instruction{
  font-weight: 600;
  margin-bottom: 10px;
}

/* horizontal scroll like viva */
.scroll-x{ overflow-x:auto; padding-bottom: 6px; }

.grid{
  display:grid;
  grid-auto-flow: column;                 /* ✅ 永远一行 */
  grid-auto-columns: minmax(220px, 1fr);  /* ✅ 每列宽度 */
  gap: 12px;
  min-width: 860px;
}

.col{
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px;
}

.col .label{
  font-size: 14px;
  color: #333;           /* ✅ 更深 */
  font-weight: 500;
  margin-bottom: 8px;
  text-align: center;
}

.col.ours .label{
  color:#111;
  font-weight: 800;      /* ✅ Ours 加粗 */
}

.col video{
  width: 100%;
  border-radius: 12px;
  display:block;
  background: transparent; /* ✅ 不给黑底（避免黑边观感） */
}

/* footer */
.footer{
  border-top: 1px solid var(--border);
  margin-top: 14px;
  padding-top: 14px;
  color: var(--muted);
  font-size: 13px;
  text-align:center;
}

/* pills */
.pill{
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 22px;
  border-radius: 999px;
  font-size: 18px;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.2s ease;
}
.pill .icon{ display:flex; align-items:center; }
.pill.dark{ background:#1f2937; color:#fff; }
.pill.dark:hover{ background:#111827; transform: translateY(-1px); }
.pill em{ font-style: normal; font-size: 15px; opacity: 0.75; }

/* floating tools */
.btn{
  border: 1px solid var(--border);
  background: #fafafa;
  padding: 9px 14px;
  border-radius: 10px;
  cursor:pointer;
  text-decoration:none;
  color:#111;
  display:inline-flex;
  align-items:center;
  justify-content:center;
}
.btn:hover{ background:#f3f3f3; }
.btn.small{ padding:7px 10px; border-radius: 9px; font-size: 13px; }

.floating-tools{
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 9999;
  display: none;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  padding: 10px 10px 8px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.08);
}
.floating-tools .controls{
  display:flex; gap:8px; flex-wrap:wrap; justify-content:flex-end;
}
.floating-tools .hint{
  margin: 0;
  text-align: right;
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--muted);
  max-width: 260px;
}
@media (max-width: 700px){
  .floating-tools{ right: 12px; bottom: 12px; max-width: calc(100vw - 24px); }
  .floating-tools .hint{ max-width: none; }
}

/* ===== Consistent section spacing (light) ===== */
.section{
  padding: 26px 0;
  border-bottom: 1px solid rgba(0,0,0,.06);
}

/* ===== Demo (Data Construction) cards: match Comparison style ===== */
.case.demo-case{
  margin: 14px 0 22px 0;
  padding: 14px;
  border-radius: 16px;
  background: #fff;
  border: 1px solid var(--border);
}
.case.demo-case .scroll-x{
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: #fff;
}
.case.demo-case .grid{
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(220px, 1fr);
  gap: 12px;
  padding: 12px;
  min-width: 860px;
}
.case.demo-case .col{
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px;
  background: #fff;
  transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
}
.case.demo-case .col:hover{
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(0,0,0,.08);
  border-color: rgba(0,0,0,.16);
}
.case.demo-case .label{
  font-size: 14px;
  font-weight: 500;
  text-align: center;
  margin-bottom: 8px;
  padding: 6px 0;
  background: #555;
  color: #fff;
  border-radius: 8px;
}
.case.demo-case video{
  width: 100%;
  border-radius: 12px;
  display: block;
  background: transparent;
}

/* ===== Comparison: unified with Demo (LIGHT) ===== */
.comparison-block{
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px;
  margin: 14px 0 22px;
  background: #fff;
}

/* Instruction line (centered, larger by ~2–3pt) */
.comparison-instruction{
  text-align: center;
  font-size: 18px;            /* bigger */
  line-height: 1.35;
  margin: 2px 0 12px;
  cursor: pointer;
  user-select: none;
  color: var(--fg);
}
.comparison-instruction .inst-prefix{
  display: block;             /* like your screenshot: 'Instruction:' on its own line */
  font-weight: 800;
  margin-bottom: 6px;
}
.comparison-instruction .inst-text{
  display: -webkit-box;
  -webkit-box-orient: vertical;
  overflow: hidden;
  color: var(--fg);
  font-weight: 600;
}
.comparison-instruction .inst-toggle{
  display: none;
  margin-left: 10px;
  font-size: 13px;
  color: var(--muted);
  text-decoration: underline;
}

/* Collapse behavior (JS already toggles these classes) */
.comparison-instruction.collapsed .inst-text{ -webkit-line-clamp: 2; }
.comparison-instruction.expanded  .inst-text{ -webkit-line-clamp: unset; }
.comparison-instruction.collapsible .inst-toggle{ display: inline-block; }
.comparison-instruction.collapsed::after{
  content:"";
  position:absolute;
  left:12px; right:12px; bottom:0;
  height:18px;
  background: linear-gradient(to bottom, rgba(255,255,255,0), rgba(255,255,255,1));
  pointer-events:none;
}

/* Scroll window + grid */
.scroll-window{
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: #fff;
}
.compare-grid{
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(220px, 1fr);
  gap: 12px;
  padding: 12px;
  min-width: 860px;
}

/* Video cards */
.video-card{
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
  transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease, filter .12s ease;
}
.video-card:hover{
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(0,0,0,.08);
  border-color: rgba(0,0,0,.16);
  filter: brightness(1.01);
}

/* Role borders (subtle gray-scale) */
.video-card.role-source{ border-color: rgba(0,0,0,.16); }
.video-card.role-ours{ border-color: rgba(0,0,0,.13); }
.video-card.role-baseline{ border-color: rgba(0,0,0,.10); }

.video-label{
  padding: 9px 10px;
  font-size: 14px;
  font-weight: 500;
  text-align: center;
  background: #555;
  color: #fff;
  border-bottom: 1px solid rgba(0,0,0,.10);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Ours badge (keep only the blue pill) (JS already avoids duplicate text) */
.badge-ours{
  display: inline-block;
  margin-left: 6px;
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(80,160,255,.18);
  border: 1px solid rgba(80,160,255,.30);
  color: rgba(20,60,120,.92);
}

.video-wrap{
  width: 100%;
  aspect-ratio: 16/9;
  background: transparent;
}
.video-wrap video{
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  background: transparent;
}
.video-error{
  padding: 10px 12px;
  font-size: 12px;
  color: var(--muted);
}



/* Demo group titles (left aligned, no duplicate 'Case') */
.demo-group-title{
  margin: 26px 0 10px;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.01em;
  text-align: left;
  font-family: inherit;
}

/* If any old demo subtitles remain, hide them */
.demo-subtitle{ display:none !important; }


/* ===== v4 fixes: center without flex; demo titles; instruction clamp 1 line ===== */
.scroll-window{ display:block !important; }
.scroll-window.centered{ text-align:center; }
.scroll-window.centered .compare-grid{ display:inline-grid; }

.demo-group-title{
  font-size: 34px;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 8px 0 14px;
  text-align: left;
  color: var(--fg);
}

/* Reduce oversized demo headers that were inheriting huge styles */
.comparison-block .demo-group-title{ margin-top: 0; }

/* Instruction: collapse after first line */
.comparison-instruction{ font-size: 16px; line-height: 1.35; position: relative; }
.comparison-instruction .inst-prefix{ font-size: 16px; margin-bottom: 4px; }
.comparison-instruction.collapsed .inst-text{ -webkit-line-clamp: 1; }
.comparison-instruction.collapsed::after{
  height: 14px;
  left:10px; right:10px; bottom:2px;
}

/* ===== Demo (before Comparison): raw videos, no forced aspect/containers ===== */
.demo-block{
  margin: 18px 0 30px;
}

.demo-grid{
  display: flex;
  gap: 22px;
  flex-wrap: wrap;
  align-items: flex-start;
}

.demo-video{
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fff;
  overflow: hidden;
}

.demo-label{
  padding: 9px 10px;
  font-size: 14px;
  font-weight: 500;
  text-align: center;
  background: #555;
  color: #fff;
  border-bottom: 1px solid rgba(0,0,0,.10);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.demo-video video{
  display: block;
  width: auto;
  height: auto;
  max-width: 520px;
  max-height: 520px;
  background: transparent;
}

/* ===== Demo v6: match comparison title size + row layout ===== */
.demo-group-title{
  font-size: 28px;        /* align with comparison section headings */
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 10px 0 12px;
  text-align: left;
  color: var(--fg);
}
.demo-row{
  display: flex;
  gap: 22px;
  flex-wrap: wrap;
  align-items: flex-start;
  margin: 14px 0 24px;
}

/* ===== Demo layout fix: keep each block in one row (no wrap); scroll if needed ===== */
.demo-row{
  display: flex;
  flex-wrap: nowrap;      /* prevent wrapping that breaks alignment */
  overflow-x: auto;       /* if too wide, horizontal scroll */
  gap: 22px;
  align-items: flex-start;
  padding-bottom: 6px;    /* space for scrollbar */
  -webkit-overflow-scrolling: touch;
}

.demo-video{
  flex: 0 0 auto;         /* keep intrinsic width */
}

/* ===== Demo layout v8: 3-per-row grid (5 -> 3+2 automatically) ===== */
.demo-row{
  display: grid;
  grid-template-columns: repeat(3, max-content);
  gap: 22px;
  align-items: start;
  justify-content: start;
  margin: 14px 0 24px;
  overflow: visible; /* no scroll */
  padding-bottom: 0;
}

@media (max-width: 1100px){
  .demo-row{ grid-template-columns: repeat(2, max-content); }
}
@media (max-width: 720px){
  .demo-row{ grid-template-columns: repeat(1, max-content); }
}

.demo-super-title{
  margin: 26px 0 10px;
  text-align: center;
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

/* ===== Demo alignment polish ===== */
.demo-block{
  padding: 0 24px;
  box-sizing: border-box;
}

/* Make demo titles align with the grid left edge */
.demo-group-title{
  max-width: 1200px;
  margin: 10px auto 12px;
  padding: 0 0; /* keep flush with grid */
}

/* Base: 3-up rows */
.demo-row{
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
}

/* If a row has only 2 (e.g., In-hand last row), center it nicely */
.demo-row[data-count="2"]{
  grid-template-columns: repeat(2, 1fr);
  max-width: 820px;
}

/* If a row has only 1, keep it centered */
.demo-row[data-count="1"]{
  grid-template-columns: 1fr;
  max-width: 420px;
}

/* ===== DEMO FINAL FIX (CSS-only) ===== */

/* 1) 标题对齐视频网格：标题和网格用同一个 max-width + auto 居中 */
.demo-group-title,
.demo-super-title,
.demo-row{
  max-width: 1200px;
  margin-left: auto !important;
  margin-right: auto !important;
}

/* 保证 demo 区左右留白一致 */
.demo-block{
  padding: 0 24px;
  box-sizing: border-box;
}

/* 2) demo 行固定 3 列，整体不贴左 */
.demo-row{
  display: grid !important;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  justify-items: center;        /* 单元格内容居中 */
  align-items: start;
}

/* 每个视频卡不要无限长 */
.demo-video{
  width: 100%;
  max-width: 360px;
}

/* 视频按容器宽度走，不裁剪 */
.demo-video video{
  width: 100%;
  height: auto;
  object-fit: contain;
}

/* ——关键：最后一行 2 个视频居中（纯 CSS，无 JS）——
   用 :has() 检测这一行只有两个 .demo-video 时，把网格改成 2 列
*/
.demo-row:has(> .demo-video:nth-child(2):last-child){
  grid-template-columns: repeat(2, 1fr);
  max-width: 820px;            /* 让 2 个不会拉太开 */
}

/* 只有 1 个时也居中 */
.demo-row:has(> .demo-video:nth-child(1):last-child){
  grid-template-columns: 1fr;
  max-width: 420px;
}

/* 响应式 */
@media (max-width: 1100px){
  .demo-row{ grid-template-columns: repeat(2, 1fr); max-width: 760px; }
}
@media (max-width: 720px){
  .demo-row{ grid-template-columns: 1fr; max-width: 420px; }
}

/* ===== Patch: keep current layout, fix heading-to-content spacing ===== */
/* Tighten whitespace between the section h3 and the first comparison block (no width/layout changes). */
#comparisonSection > h3{
  margin-top: 18px;
  margin-bottom: 8px;
}
#comparisonSection #comparisonsLandscape .comparison-block:first-child,
#comparisonSection #comparisonsPortrait .comparison-block:first-child{
  margin-top: 8px;
}

/* Ensure the instruction bar doesn't add extra top space */
.comparison-instruction{ margin-top: 0; }
/* 微调：Local Editing 标题向右偏移一点 */
.demo-group-title{
  padding-left: 14px;   
}

/* ===== Title hierarchy fix ===== */

/* Section 主标题（FFP-300K Data Construction Demo） */
.section > h2{
  font-size: 36px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

/* Demo 子标题（Local Editing / Global Stylization / ...） */
.demo-group-title{
  font-size: 28px;
  font-weight: 600;
}

/* ===== FIX: Landscape h3 对齐视频 + 缩短 h3 到内容距离（强制生效） ===== */

/* 1) Landscape/Portrait 子标题：右移对齐到视频卡片起点 */
#comparisonSection > h3{
  padding-left: 24px !important;   /* 你要更右一点就 28px；更左一点就 20px */
  margin-bottom: 6px !important;   /* 缩短 h3 到下面内容的距离 */
}

/* 2) 让承载 comparison blocks 的容器本身顶上来一点（避免看起来“隔太远”） */
#comparisonSection #comparisonsLandscape,
#comparisonSection #comparisonsPortrait{
  margin-top: 6px !important;
}

/* 3) 再保险：第一个 block 不要自己再顶下去 */
#comparisonSection #comparisonsLandscape > .comparison-block:first-child,
#comparisonSection #comparisonsPortrait  > .comparison-block:first-child{
  margin-top: 6px !important;
}

/* ===== Abstract block (viva-like) ===== */
.abstract-block{
  background: #f6f8fb;
  padding: 64px 0;
}

.abstract-inner{
  max-width: 980px;
  margin: 0 auto;
  padding: 0 64px;            /* 左右留白 */
}

.abstract-title{
  text-align: center;
  font-size: 46px;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0 0 36px 0;
  color: #1f2a37;
}

.abstract-text{
  font-size: 22px;
  line-height: 1.65;
  letter-spacing: 0.01em;
  color: #4b5563;             
  margin: 0;
  text-align: left;          
}

@media (max-width: 900px){
  .abstract-inner{ padding: 0 24px; }
  .abstract-title{ font-size: 42px; }
  .abstract-text{ font-size: 20px; }
}




.hero{
  padding-top: 72px;
  padding-bottom: 56px;
}


.hero .title{
  line-height: 1.25;        
  margin-bottom: 32px;      
}


.hero .authors{
  font-size: 20px;
  line-height: 1.6;
  margin-bottom: 16px;      
}


.hero .affiliations{
  font-size: 18px;
  line-height: 1.5;
  margin-bottom: 28px;
}

.affil-line{
  display: flex;
  justify-content: center;
  gap: 32px;        
  flex-wrap: wrap; 
}
