:root {
  --color-bg: #ffffff;
  --color-surface: #f7f8fa;
  --color-border: #e2e5ea;
  --color-text: #1a1a2e;
  --color-text-secondary: #5a5f72;
  --color-accent: #2563eb;
  --color-accent-light: #eff4ff;
  --color-prompt-bg: #f0f4ff;
  --color-prompt-border: #b6ccfe;
  --max-width: 860px;
  --radius: 8px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; scroll-padding-top: 32px; }

body {
  font-family: "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.container { max-width: var(--max-width); margin: 0 auto; padding: 0 24px; }

/* -- Header -- */
header {
  text-align: center;
  padding: 60px 0 36px;
  border-bottom: 1px solid var(--color-border);
}
header h1 {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 12px;
  color: var(--color-text);
}
header .subtitle {
  font-size: 1.05rem;
  color: var(--color-text-secondary);
  margin-bottom: 24px;
}

/* -- Authors & Affiliations -- */
.author-list {
  font-size: 1.05rem;
  line-height: 2;
  margin-bottom: 8px;
}
.author-list a {
  color: var(--color-text);
  text-decoration: none;
  font-weight: 500;
}
.author-list a:hover {
  color: var(--color-accent);
  text-decoration: underline;
}
.author-list sup {
  font-size: 0.7em;
  color: var(--color-accent);
  margin-left: 1px;
}
.affiliation-list {
  font-size: 0.9rem;
  color: var(--color-text-secondary);
  margin-bottom: 12px;
  line-height: 1.8;
}
.affiliation-list sup {
  font-size: 0.75em;
  color: var(--color-accent);
  margin-right: 2px;
}
.paper-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 4px;
}
.paper-links a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--color-accent);
  border: 1.5px solid var(--color-accent);
  border-radius: 6px;
  text-decoration: none;
  transition: background 0.2s, color 0.2s;
}
.paper-links a:hover {
  background: var(--color-accent);
  color: #fff;
}

/* -- Teaser / Framework Sections -- */
.teaser-section, .abstract-section, .framework-section {
  padding: 36px 0;
  border-bottom: 1px solid var(--color-border);
}
.teaser-section img, .framework-section img {
  width: 100%;
  display: block;
  margin: 0 auto 16px;
  border-radius: var(--radius);
}
.fig-caption {
  font-size: 0.92rem;
  color: var(--color-text-secondary);
  line-height: 1.7;
  text-align: justify;
}
.fig-caption b {
  color: var(--color-text);
}
.abstract-section p {
  font-size: 0.95rem;
  color: var(--color-text);
  line-height: 1.75;
  text-align: justify;
}
.abstract-section h2, .framework-section h2, .teaser-section h2 {
  font-size: 1.45rem;
  font-weight: 700;
  margin-bottom: 20px;
  letter-spacing: -0.01em;
  text-align: center;
}

/* -- Sidebar TOC -- */
nav.toc-sidebar {
  position: fixed;
  top: 50%;
  left: 24px;
  transform: translateY(-50%);
  z-index: 100;
  width: 180px;
}
nav.toc-sidebar h3 {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-secondary);
  margin-bottom: 14px;
  padding-left: 14px;
}
nav.toc-sidebar ol {
  list-style: none;
  padding: 0;
  margin: 0;
  border-left: 2px solid var(--color-border);
}
nav.toc-sidebar li {
  position: relative;
}
nav.toc-sidebar a {
  display: block;
  padding: 8px 16px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--color-text-secondary);
  text-decoration: none;
  transition: color 0.25s, background 0.25s;
  border-left: 2px solid transparent;
  margin-left: -2px;
  line-height: 1.35;
}
nav.toc-sidebar a:hover {
  color: var(--color-accent);
  background: var(--color-accent-light);
}
nav.toc-sidebar li.active > a {
  color: var(--color-accent);
  font-weight: 700;
  border-left-color: var(--color-accent);
  background: var(--color-accent-light);
}

/* -- Section -- */
section { padding: 48px 0; }
section + section { border-top: 1px solid var(--color-border); }
.section-title {
  font-size: 1.45rem;
  font-weight: 700;
  margin-bottom: 8px;
  letter-spacing: -0.01em;
}
.section-desc {
  font-size: 0.95rem;
  color: var(--color-text-secondary);
  margin-bottom: 32px;
  max-width: 780px;
  line-height: 1.7;
}
/* -- Result Card -- */
.result-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 32px;
}
.result-card .card-label {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-secondary);
  margin-bottom: 16px;
}

/* -- Video Showcase Layout (large generated + small ref PiP) -- */
.video-showcase {
  position: relative;
  width: 100%;
}
.video-showcase .main-video {
  width: 100%;
  border-radius: 6px;
  background: #000;
  display: block;
}
.video-showcase .ref-pip {
  position: absolute;
  bottom: 16px;
  left: 16px;
  width: 140px;
  border-radius: 6px;
  border: 2px solid rgba(255,255,255,0.85);
  box-shadow: 0 2px 12px rgba(0,0,0,0.35);
  background: #000;
  cursor: pointer;
  transition: width 0.3s ease, box-shadow 0.2s;
  z-index: 2;
}
.video-showcase .ref-pip:hover {
  width: 220px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}
.video-showcase .ref-badge {
  position: absolute;
  bottom: 16px;
  left: 16px;
  transform: translateY(-100%);
  margin-bottom: 4px;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #fff;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  padding: 3px 8px;
  border-radius: 4px;
  z-index: 3;
  pointer-events: none;
}
.video-showcase .gen-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #fff;
  background: var(--color-accent);
  padding: 3px 10px;
  border-radius: 4px;
  z-index: 3;
  pointer-events: none;
}

/* -- Prompt Toggle -- */
.prompt-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 14px;
  padding: 7px 14px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--color-accent);
  background: var(--color-accent-light);
  border: 1px solid var(--color-prompt-border);
  border-radius: 6px;
  cursor: pointer;
  user-select: none;
  transition: background 0.2s;
}
.prompt-toggle:hover { background: #dfe8ff; }
.prompt-toggle svg {
  width: 14px; height: 14px;
  fill: currentColor;
  transition: transform 0.25s ease;
}
.prompt-toggle.active svg { transform: rotate(180deg); }

.prompt-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s ease, opacity 0.3s ease, margin 0.3s ease;
  opacity: 0;
  margin-top: 0;
}
.prompt-content.open {
  max-height: 600px;
  opacity: 1;
  margin-top: 12px;
}
.prompt-content-inner {
  background: var(--color-prompt-bg);
  border-left: 3px solid var(--color-prompt-border);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 14px 18px;
  font-size: 0.88rem;
  color: var(--color-text);
  line-height: 1.65;
}

/* -- Comparison Grid -- */
.video-compare {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
.video-item { text-align: center; }
.video-item video, .video-item img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 6px;
  background: #000;
  display: block;
}
.video-label {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--color-text-secondary);
  margin-top: 6px;
  letter-spacing: 0.03em;
}
.video-label.ours {
  color: var(--color-accent);
  font-weight: 700;
}

/* -- Reference Inputs Row -- */
.ref-inputs {
  display: flex;
  gap: 16px;
  margin-bottom: 16px;
  align-items: flex-end;
}
.ref-inputs .ref-input-item {
  text-align: center;
}
.ref-inputs .ref-input-item img,
.ref-inputs .ref-input-item video {
  height: 140px;
  border-radius: 6px;
  background: #000;
  display: block;
  object-fit: cover;
}
.ref-inputs .ref-input-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--color-text-secondary);
  margin-top: 5px;
  letter-spacing: 0.03em;
}

/* -- Subsection -- */
.subsection-title {
  font-size: 1.12rem;
  font-weight: 700;
  margin-bottom: 6px;
  margin-top: 8px;
  color: var(--color-text);
}
.subsection-desc {
  font-size: 0.88rem;
  color: var(--color-text-secondary);
  margin-bottom: 24px;
  max-width: 780px;
  line-height: 1.65;
}

/* -- Showcase Grid (2-col) -- */
.showcase-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
.showcase-grid .result-card {
  margin-bottom: 0;
}
.showcase-grid .video-showcase .ref-pip {
  width: 100px;
  bottom: 12px;
  left: 12px;
}
.showcase-grid .video-showcase .ref-pip:hover {
  width: 160px;
}
.showcase-grid .video-showcase .ref-badge {
  bottom: 12px;
  left: 12px;
  font-size: 0.6rem;
}
.showcase-grid .video-showcase .gen-badge {
  font-size: 0.6rem;
  top: 8px;
  left: 8px;
  padding: 2px 8px;
}
.showcase-grid .prompt-toggle {
  font-size: 0.76rem;
  padding: 5px 10px;
  margin-top: 10px;
}
.showcase-grid .prompt-content-inner {
  font-size: 0.82rem;
}

/* -- Collapsible Result Card -- */
.collapsible-header {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
  padding: 4px 0;
}
.collapsible-header .card-label {
  margin-bottom: 0;
}
.collapsible-header .collapse-icon {
  width: 18px;
  height: 18px;
  fill: var(--color-text-secondary);
  transition: transform 0.3s ease;
  flex-shrink: 0;
}
.collapsible-header.open .collapse-icon {
  transform: rotate(180deg);
}
.collapsible-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.5s ease, opacity 0.3s ease;
  opacity: 0;
}
.collapsible-body.open {
  max-height: 3000px;
  opacity: 1;
}

/* -- Play All Button -- */
.play-all-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 14px;
  font-size: 0.76rem;
  font-weight: 600;
  color: #fff;
  background: var(--color-accent);
  border: none;
  border-radius: 5px;
  cursor: pointer;
  user-select: none;
  transition: background 0.2s, box-shadow 0.2s;
  margin-left: auto;
}
.play-all-btn:hover {
  background: #1d4ed8;
  box-shadow: 0 2px 6px rgba(37,99,235,0.3);
}
.play-all-btn svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
}

/* -- Intro Video Tabs -- */
.intro-tabs {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 24px;
}
.intro-tab {
  padding: 12px 28px;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--color-text-secondary);
  background: var(--color-surface);
  border: 2px solid var(--color-border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.25s ease;
  user-select: none;
}
.intro-tab:hover {
  border-color: var(--color-accent);
  color: var(--color-accent);
  background: var(--color-accent-light);
}
.intro-tab.active {
  background: var(--color-accent);
  color: #fff;
  border-color: var(--color-accent);
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}
.intro-video-panel {
  display: none;
}
.intro-video-panel.active {
  display: block;
}

/* -- Highlights Scroll -- */
.highlights-section {
  padding: 36px 0;
  border-bottom: 1px solid var(--color-border);
}
.highlights-viewport {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
  overflow: visible;
  position: relative;
}
.highlights-scroll {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.highlights-scroll::-webkit-scrollbar {
  display: none;
}
.highlights-item {
  flex: 0 0 100%;
  scroll-snap-align: center;
  border-radius: var(--radius);
  overflow: hidden;
  background: #000;
}
.highlights-item .video-showcase {
  position: relative;
}
.highlights-item .main-video {
  width: 100%;
  display: block;
  border-radius: var(--radius);
}
.highlights-item .ref-pip {
  width: 120px;
  bottom: 12px;
  left: 12px;
}
.highlights-item .ref-pip:hover {
  width: 200px;
}
.highlights-item .ref-badge {
  bottom: 12px;
  left: 12px;
}
/* -- Highlights Arrows -- */
.hl-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 5;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: rgba(255,255,255,0.85);
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, box-shadow 0.2s;
}
.hl-arrow:hover {
  background: #fff;
  box-shadow: 0 3px 12px rgba(0,0,0,0.25);
}
.hl-arrow svg {
  width: 20px;
  height: 20px;
  fill: var(--color-text);
}
.hl-arrow-left {
  left: 32px;
}
.hl-arrow-right {
  right: 32px;
}

.highlights-dots {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 14px;
}
.highlights-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--color-border);
  border: none;
  padding: 0;
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
}
.highlights-dot.active {
  background: var(--color-accent);
  transform: scale(1.35);
}

/* -- Footer -- */
footer {
  text-align: center;
  padding: 32px 0;
  border-top: 1px solid var(--color-border);
  font-size: 0.82rem;
  color: var(--color-text-secondary);
}
.footer-deploy {
  font-size: 0.88rem;
  color: var(--color-text);
  line-height: 1.7;
  margin-bottom: 8px;
}
.footer-deploy a {
  color: var(--color-accent);
  font-weight: 600;
  text-decoration: none;
}
.footer-deploy a:hover {
  text-decoration: underline;
}
.footer-meta {
  font-size: 0.8rem;
  color: var(--color-text-secondary);
}

/* -- Responsive -- */
@media (min-width: 1320px) {
  nav.toc-sidebar { left: calc((100vw - var(--max-width)) / 2 - 210px); }
}
@media (max-width: 1319px) {
  nav.toc-sidebar { display: none; }
}
@media (max-width: 768px) {
  header { padding: 40px 0 28px; }
  header h1 { font-size: 1.5rem; }
  .video-showcase .ref-pip { width: 100px; }
  .video-showcase .ref-pip:hover { width: 160px; }
  .video-compare { grid-template-columns: 1fr 1fr; }
  .showcase-grid { grid-template-columns: 1fr; }
  .result-card { padding: 16px; }
}
